PageSourceSearch

https://assets.ambiki.com/packs/js/4032-296f4d16baab6ce7248a.chunk.js

js ambiki.com collected 2026-10-04 07:20:17 UTC 2,759,717 bytes, 3 lines download raw bytes

1/*! For license information please see 4032-296f4d16baab6ce7248a.chunk.js.LICENSE.txt */
2(globalThis.webpackChunkambiki||=[]).push([[4032],{14032(e,t,i){"use strict";i.r(t),i.d(t,{default:()=>m});var r=i.cw(function(e,t){i.r(t);i.d(t,["default",0,'
vendor: 12,816 bytes, line 2
2!function(){class ThrottledInvoker{constructor(e){this._callback=e,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&&(this._channel.port1.close(),this._channel.port2.close()),this._callback=()=>{}}}var e=1e-6,t="undefined"!=typeof Float32Array?Float32Array:Array;function i(){var e=new t(16);return t!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function r(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function n(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],h=t[9],d=t[10],p=t[11],f=t[12],m=t[13],_=t[14],g=t[15],y=i*s-r*a,x=i*l-n*a,v=i*u-o*a,b=r*l-n*s,w=r*u-o*s,A=n*u-o*l,E=c*m-h*f,I=c*_-d*f,D=c*g-p*f,P=h*_-d*m,T=h*g-p*m,z=d*g-p*_,M=y*z-x*T+v*P+b*D-w*I+A*E;return M?(e[0]=(s*z-l*T+u*P)*(M=1/M),e[1]=(n*T-r*z-o*P)*M,e[2]=(m*A-_*w+g*b)*M,e[3]=(d*w-h*A-p*b)*M,e[4]=(l*D-a*z-u*I)*M,e[5]=(i*z-n*D+o*I)*M,e[6]=(_*v-f*A-g*x)*M,e[7]=(c*A-d*v+p*x)*M,e[8]=(a*T-s*D+u*E)*M,e[9]=(r*D-i*T-o*E)*M,e[10]=(f*w-m*v+g*y)*M,e[11]=(h*v-c*w-p*y)*M,e[12]=(s*I-a*P-l*E)*M,e[13]=(i*P-r*I+n*E)*M,e[14]=(m*x-f*b-_*y)*M,e[15]=(c*b-h*x+d*y)*M,e):null}function o(e,t,i){var r=t[0],n=t[1],o=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=t[9],p=t[10],f=t[11],m=t[12],_=t[13],g=t[14],y=t[15],x=i[0],v=i[1],b=i[2],w=i[3];return e[0]=x*r+v*s+b*h+w*m,e[1]=x*n+v*l+b*d+w*_,e[2]=x*o+v*u+b*p+w*g,e[3]=x*a+v*c+b*f+w*y,e[4]=(x=i[4])*r+(v=i[5])*s+(b=i[6])*h+(w=i[7])*m,e[5]=x*n+v*l+b*d+w*_,e[6]=x*o+v*u+b*p+w*g,e[7]=x*a+v*c+b*f+w*y,e[8]=(x=i[8])*r+(v=i[9])*s+(b=i[10])*h+(w=i[11])*m,e[9]=x*n+v*l+b*d+w*_,e[10]=x*o+v*u+b*p+w*g,e[11]=x*a+v*c+b*f+w*y,e[12]=(x=i[12])*r+(v=i[13])*s+(b=i[14])*h+(w=i[15])*m,e[13]=x*n+v*l+b*d+w*_,e[14]=x*o+v*u+b*p+w*g,e[15]=x*a+v*c+b*f+w*y,e}function a(e,t,i){var r,n,o,a,s,l,u,c,h,d,p,f,m=i[0],_=i[1],g=i[2];return t===e?(e[12]=t[0]*m+t[4]*_+t[8]*g+t[12],e[13]=t[1]*m+t[5]*_+t[9]*g+t[13],e[14]=t[2]*m+t[6]*_+t[10]*g+t[14],e[15]=t[3]*m+t[7]*_+t[11]*g+t[15]):(n=t[1],o=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=t[9],p=t[10],f=t[11],e[0]=r=t[0],e[1]=n,e[2]=o,e[3]=a,e[4]=s,e[5]=l,e[6]=u,e[7]=c,e[8]=h,e[9]=d,e[10]=p,e[11]=f,e[12]=r*m+s*_+h*g+t[12],e[13]=n*m+l*_+d*g+t[13],e[14]=o*m+u*_+p*g+t[14],e[15]=a*m+c*_+f*g+t[15]),e}function s(e,t,i){var r=i[0],n=i[1],o=i[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function l(e,t,i){var r=Math.sin(i),n=Math.cos(i),o=t[4],a=t[5],s=t[6],l=t[7],u=t[8],c=t[9],h=t[10],d=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*n+u*r,e[5]=a*n+c*r,e[6]=s*n+h*r,e[7]=l*n+d*r,e[8]=u*n-o*r,e[9]=c*n-a*r,e[10]=h*n-s*r,e[11]=d*n-l*r,e}function u(e,t,i){var r=Math.sin(i),n=Math.cos(i),o=t[0],a=t[1],s=t[2],l=t[3],u=t[8],c=t[9],h=t[10],d=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*n-u*r,e[1]=a*n-c*r,e[2]=s*n-h*r,e[3]=l*n-d*r,e[8]=o*r+u*n,e[9]=a*r+c*n,e[10]=s*r+h*n,e[11]=l*r+d*n,e}function c(){var e=new t(3);return t!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function h(e){var i=new t(3);return i[0]=e[0],i[1]=e[1],i[2]=e[2],i}function d(e){var t=e[0],i=e[1],r=e[2];return Math.sqrt(t*t+i*i+r*r)}function p(e,i,r){var n=new t(3);return n[0]=e,n[1]=i,n[2]=r,n}function f(e,t,i,r){return e[0]=t,e[1]=i,e[2]=r,e}function m(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e}function _(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e}function g(e,t,i){return e[0]=Math.min(t[0],i[0]),e[1]=Math.min(t[1],i[1]),e[2]=Math.min(t[2],i[2]),e}function y(e,t,i){return e[0]=Math.max(t[0],i[0]),e[1]=Math.max(t[1],i[1]),e[2]=Math.max(t[2],i[2]),e}function x(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function v(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e}function b(e,t){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2];return Math.sqrt(i*i+r*r+n*n)}function w(e,t){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2];return i*i+r*r+n*n}function A(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function E(e,t){var i=t[0],r=t[1],n=t[2],o=i*i+r*r+n*n;return o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e}function I(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function D(e,t,i){var r=t[0],n=t[1],o=t[2],a=i[0],s=i[1],l=i[2];return e[0]=n*l-o*s,e[1]=o*a-r*l,e[2]=r*s-n*a,e}function P(e,t,i,r){var n=t[0],o=t[1],a=t[2];return e[0]=n+r*(i[0]-n),e[1]=o+r*(i[1]-o),e[2]=a+r*(i[2]-a),e}function T(e,t,i){var r=t[0],n=t[1],o=t[2],a=i[3]*r+i[7]*n+i[11]*o+i[15];return e[0]=(i[0]*r+i[4]*n+i[8]*o+i[12])/(a=a||1),e[1]=(i[1]*r+i[5]*n+i[9]*o+i[13])/a,e[2]=(i[2]*r+i[6]*n+i[10]*o+i[14])/a,e}function z(e,t,i){var r=i[0],n=i[1],o=i[2],a=i[3],s=t[0],l=t[1],u=t[2],c=n*u-o*l,h=o*s-r*u,d=r*l-n*s;return e[0]=s+a*(c+=c)+n*(d+=d)-o*(h+=h),e[1]=l+a*h+o*c-r*d,e[2]=u+a*d+r*h-n*c,e}function M(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}var C,R=_,L=d;function F(e,t,i){var r=t[0],n=t[1],o=t[2],a=t[3];return e[0]=i[0]*r+i[4]*n+i[8]*o+i[12]*a,e[1]=i[1]*r+i[5]*n+i[9]*o+i[13]*a,e[2]=i[2]*r+i[6]*n+i[10]*o+i[14]*a,e[3]=i[3]*r+i[7]*n+i[11]*o+i[15]*a,e}function B(){var e=new t(4);return t!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function O(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}c(),C=new t(4),t!=Float32Array&&(C[0]=0,C[1]=0,C[2]=0,C[3]=0);var V,k,N,U=(V=c(),k=p(1,0,0),N=p(0,1,0),function(e,t,i){var r=I(t,i);return r<-.999999?(D(V,k,t),L(V)<1e-6&&D(V,N,t),E(V,V),function(e,t,i){i*=.5;var r=Math.sin(i);e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(i)}(e,V,Math.PI),e):r>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(D(V,t,i),e[0]=V[0],e[1]=V[1],e[2]=V[2],e[3]=1+r,function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],a=i*i+r*r+n*n+o*o;return a>0&&(a=1/Math.sqrt(a)),e[0]=i*a,e[1]=r*a,e[2]=n*a,e[3]=o*a,e}(e,e))});function G(){var e=new t(2);return t!=Float32Array&&(e[0]=0,e[1]=0),e}function j(e,i){var r=new t(2);return r[0]=e,r[1]=i,r}function $(e,t,i){return e[0]=t,e[1]=i,e}function W(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e}function X(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e}function q(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e}function Z(e){var t=e[0],i=e[1];return Math.sqrt(t*t+i*i)}function Y(e,t){var i=t[0],r=t[1],n=i*i+r*r;return n>0&&(n=1/Math.sqrt(n)),e[0]=t[0]*n,e[1]=t[1]*n,e}function J(e,t){return e[0]*t[0]+e[1]*t[1]}function K(e,t){this.x=e,this.y=t}function Q(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!Q(e[i],t[i]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==t){if("object"!=typeof t)return!1;const i=e,r=t;if(Object.keys(i).length!==Object.keys(r).length)return!1;for(const e in i)if(!Q(i[e],r[e]))return!1;return!0}return e===t}function ee(e,t,i=0,r=e.length-1,n=ie){for(;r>i;){if(r-i>600){const o=r-i+1,a=t-i+1,s=Math.log(o),l=.5*Math.exp(2*s/3),u=.5*Math.sqrt(s*l*(o-l)/o)*(a-o/2<0?-1:1);ee(e,t,Math.max(i,Math.floor(t-a*l/o+u)),Math.min(r,Math.floor(t+(o-a)*l/o+u)),n)}const o=e[t];let a=i,s=r;for(te(e,i,t),n(e[r],o)>0&&te(e,i,r);a<s;){for(te(e,a,s),a++,s--;n(e[a],o)<0;)a++;for(;n(e[s],o)>0;)s--}0===n(e[i],o)?te(e,i,s):(s++,te(e,s,r)),s<=t&&(i=s+1),t<=s&&(r=s-1)}}function te(e,t,i){const r=e[t];e[t]=e[i],e[i]=r}function ie(e,t){return e<t?-1:e>t?1:0}function re(e){let t=0;for(let i,r,n=0,o=e.length,a=o-1;n<o;a=n++)i=e[n],r=e[a],t+=(r.x-i.x)*(i.y+r.y);return t}function ne(e,t){return t.area-e.area}function oe(e){const t=e.length;if(t<3)return!0;const i=e[0];let r=0,n=0,o=1;for(;o<t&&(r=e[o].x-i.x,n=e[o].y-i.y,0===r&&0===n);o++);if(o===t)return!0;for(;o<t;o++)if(r*(e[o].y-i.y)-n*(e[o].x-i.x)!==0)return!1;return!0}function ae(e,t){const i=e.length,r=[];let n,o;for(let t=0;t<i;t++){const i=re(e[t]);0===i&&oe(e[t])||(e[t].area=Math.abs(i),void 0===o&&(o=i<0),o===i<0?(n&&r.push(n),n=[e[t]]):n.push(e[t]))}if(n&&r.push(n),t>1)for(let e=0;e<r.length;e++){const i=r[e];i.length<=t||(ee(i,t,1,i.length-1,ne),r[e]=i.slice(0,t))}return r}function se(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function le(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function ue(e,t,i){const r=e[0]-t[0],n=e[1]-t[1],o=e[0]-i[0],a=e[1]-i[1];return r*a-o*n===0&&r*o<=0&&n*a<=0}function ce(e,t,i){return t[1]>e[1]!=i[1]>e[1]&&e[0]<(i[0]-t[0])*(e[1]-t[1])/(i[1]-t[1])+t[0]}function he(e,t,i=!1){let r=!1;for(let n=0,o=t.length;n<o;n++){const o=t[n];for(let t=0,n=o.length,a=n-1;t<n;a=t++){const n=o[a],s=o[t];if(ue(e,n,s))return i;ce(e,n,s)&&(r=!r)}}return r}function de(e,t,i,r){const n=r[0]-i[0],o=r[1]-i[1],a=(e[0]-i[0])*o-n*(e[1]-i[1]),s=(t[0]-i[0])*o-n*(t[1]-i[1]);return a>0&&s<0||a<0&&s>0}function pe(e,t,i,r){return 0!==(n=[r[0]-i[0],r[1]-i[1]])[0]*(o=[t[0]-e[0],t[1]-e[1]])[1]-n[1]*o[0]&&!(!de(e,t,i,r)||!de(i,r,e,t));var n,o}function fe(e){const t=new K(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),i=new K(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const r of e[0])t.x>r.x&&(t.x=r.x),t.y>r.y&&(t.y=r.y),i.x<r.x&&(i.x=r.x),i.y<r.y&&(i.y=r.y);return{min:t,max:i}}B(),B(),function(){var e=new t(9);t!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1}(),G(),K.prototype={clone(){return new K(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){const t=e.x-this.x,i=e.y-this.y;return t*t+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){const t=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=t,this},_add(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){const e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){const t=Math.cos(e),i=Math.sin(e),r=i*this.x+t*this.y;return this.x=t*this.x-i*this.y,this.y=r,this},_rotateAround(e,t){const i=Math.cos(e),r=Math.sin(e),n=t.y+r*(this.x-t.x)+i*(this.y-t.y);return this.x=t.x+i*(this.x-t.x)-r*(this.y-t.y),this.y=n,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:K},K.convert=function(e){if(e instanceof K)return e;if(Array.isArray(e))return new K(+e[0],+e[1]);if(void 0!==e.x&&void 0!==e.y)return new K(+e.x,+e.y);throw new Error("Expected [x, y] or {x, y} point format")};const me=Math.PI/180,_e=180/Math.PI,ge=/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function ye(e){return e*me}function xe(e){return e*_e}function ve(e,t,i){return Math.min(i,Math.max(t,e))}function be(e,t,i){return(i=ve((i-e)/(t-e),0,1))*i*(3-2*i)}function we(e,t,i){const r=i-t,n=((e-t)%r+r)%r+t;return n===t?i:n}function Ae(){return function e(t){return t?(t^Math.random()*(16>>t/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,e)}()}function Ee(e){return!!e&&ge.test(e)}function Ie(e,t){e.forEach(e=>{t[e]&&(t[e]=t[e].bind(t))})}function Se(e,t,i){const r={};for(const i in e)r[i]=t.call(this,e[i],i,e);return r}function De(e){return Array.isArray(e)?e.map(De):"object"==typeof e&&e?Se(e,De):e}function Pe(e,t){for(let i=0;i<e.length;i++)if(t.includes(e[i]))return!0;return!1}const Te={};function ze(e){Te[e]||("undefined"!=typeof console&&console.warn(e),Te[e]=!0)}function Me(e,t,i){return(i.y-e.y)*(t.x-e.x)>(t.y-e.y)*(i.x-e.x)}function Ce(e){return("undefined"!=typeof self||void 0!==e)&&"undefined"!=typeof WorkerGlobalScope&&(void 0!==e?e:self)instanceof WorkerGlobalScope}function Re(e){const t={};if(e.replace(/(?:^|(?:\
2\s*\\,\\s*))([^\\x00-\\x20\\(\\)<>@\\,;\\:\\\\"\\/\\[\\]\\?\\=\\{\\}\\x7F]+)(?:\\=(?:([^\\x00-\\x20\\(\\)<>@\\,;\\:\\\\"\\/\\[\\]\\?\\=\\{\\}\\x7F]+)|(?:\\"((?:[^"\\\\]|\\\\.)*)\\")))?/g,(e,i,r,n)=>{const o=r||n;return t[i]=!o||o.toLowerCase(),""}),t["max-age"]){const e=parseInt(t["max-age"],10);isNaN(e)?delete t["max-age"]:t["max-age"]=e}return t}function Le(e){try{const t=self[e];return t.setItem("_mapbox_test_",1),t.removeItem("_mapbox_test_"),!0}catch(e){return!1}}function Fe(e,t){return[e[4*t],e[4*t+1],e[4*t+2],e[4*t+3]]}function Be(e,t,i){return(e-t.min)*(i.max-i.min)/(t.max-t.min)+i.min}var Oe="3.31.0";let Ve,ke,Ne,Ue,Ge,je,He;const $e={requestIdleCallback:e=>{if("undefined"!=typeof requestIdleCallback)return requestIdleCallback(e);setTimeout(()=>e({didTimeout:!1,timeRemaining:()=>50}),0)},now:()=>void 0!==Ge?Ge:performance.now(),setNow(e){Ge=e},restoreNow(){Ge=void 0},frame(e){const t=requestAnimationFrame(e);return{cancel:()=>cancelAnimationFrame(t)}},getImageData(e,t=0){const{width:i,height:r}=e;je||(je=document.createElement("canvas"));const n=je.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("failed to create canvas 2d context");return(i>je.width||r>je.height)&&(je.width=i,je.height=r),n.clearRect(-t,-t,i+2*t,r+2*t),n.drawImage(e,0,0,i,r),n.getImageData(-t,-t,i+2*t,r+2*t)},resolveURL:e=>(Ne||(Ne=document.createElement("a")),Ne.href=e,Ne.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(Ue??=window.matchMedia("(prefers-reduced-motion: reduce)"),Ue.matches)},hasCanvasFingerprintNoise(){if(void 0!==He)return He;if(ke??=self.OffscreenCanvas&&!!new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof self.createImageBitmap,!ke)return He=!1,!1;const e=new OffscreenCanvas(85,1),t=e.getContext("2d",{willReadFrequently:!0});let i=0;for(let r=0;r<e.width;++r)t.fillStyle=`rgba(${i++},${i++},${i++}, 255)`,t.fillRect(r,0,1,1);const r=t.getImageData(0,0,e.width,e.height);i=0;for(let e=0;e<r.data.length;++e)if(e%4!=3&&i++!==r.data[e])return He=!0,!0;return He=!1,!1}},We={API_URL:"https://api.mapbox.com",API_URL_REGEX:/^((https?:)?\\/\\/)?([^\\/]+\\.)?mapbox\\.c(n|om)(\\/|\\?|$)/i,API_TILEJSON_REGEX:/^((https?:)?\\/\\/)?([^\\/]+\\.)?mapbox\\.c(n|om)(\\/v[0-9]*\\/.*\\.json.*$)/i,API_SPRITE_REGEX:/^((https?:)?\\/\\/)?([^\\/]+\\.)?mapbox\\.c(n|om)(\\/styles\\/v[0-9]*\\/)(.*\\/sprite.*\\..*$)/i,API_FONTS_REGEX:/^((https?:)?\\/\\/)?([^\\/]+\\.)?mapbox\\.c(n|om)(\\/fonts\\/v[0-9]*\\/)(.*\\.pbf.*$)/i,API_STYLE_REGEX:/^((https?:)?\\/\\/)?([^\\/]+\\.)?mapbox\\.c(n|om)(\\/styles\\/v[0-9]*\\/)(.*$)/i,API_CDN_URL_REGEX:/^((https?:)?\\/\\/)?api\\.mapbox\\.c(n|om)(\\/mapbox-gl-js\
vendor: 19,696 bytes, line 2
2\/)(.*$)/i,get EVENTS_URL(){if(!We.API_URL)return null;try{const e=new URL(We.API_URL);return"api.mapbox.cn"===e.hostname?"https://events.mapbox.cn/events/v2":"api.mapbox.com"===e.hostname?"https://events.mapbox.com/events/v2":null}catch(e){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:"/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MESHOPT_URL:"/mapbox-gl-js/meshopt_base_v1.2.wasm",MESHOPT_SIMD_URL:"/mapbox-gl-js/meshopt_simd_v1.2.wasm",BUILDING_GEN_URL:"/mapbox-gl-js/building-gen/building_gen_v1.2.6.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1",TILE_PROVIDER_URLS:Object.assign(Object.create(null),{pmtiles:"/mapbox-gl-js/plugins/mapbox-gl-pmtiles-provider/v0.0.2/mapbox-gl-pmtiles-provider.js"})};function Xe(e){return We.API_URL_REGEX.test(e)}function qe(e){return We.API_CDN_URL_REGEX.test(e)}function Ze(e){return We.API_SPRITE_REGEX.test(e)}function Ye(e){return We.API_STYLE_REGEX.test(e)&&!Ze(e)}const Je={create:"create",load:"load",fullLoad:"fullLoad"};function Ke(e){const t=e.name.split("?")[0];return qe(t)&&t.includes("mapbox-gl.js")?"javascript":qe(t)&&t.includes("mapbox-gl.css")?"css":function(e){return We.API_FONTS_REGEX.test(e)}(t)?"fontRange":Ze(t)?"sprite":Ye(t)?"style":function(e){return We.API_TILEJSON_REGEX.test(e)}(t)?"tilejson":"other"}function Qe(e){const t=e?e.url.toString():void 0;return t?performance.getEntriesByName(t):[]}class Scheduler{constructor(){this.tasks=new Map,Ie(["process"],this),this.invoker=new ThrottledInvoker(this.process),this.nextId=0}add(e,t){const i=this.nextId++,r=function({type:e,renderSourceType:t,zoom:i}){i=i||0;const r=1===t;return"message"===e?0:"maybePrepare"!==e||r?"parseTile"!==e||r?"parseTile"===e&&r?300-i:"maybePrepare"===e&&r?400-i:500:200-i:100-i}(t);if(0===r){try{e()}finally{}return null}return this.tasks.set(i,{fn:e,metadata:t,priority:r,id:i}),this.invoker.trigger(),{cancel:()=>{this.tasks.delete(i)}}}process(){try{const e=this.pick();if(!e)return;this.tasks.delete(e.id),this.tasks.size>0&&this.invoker.trigger(),e.fn()}finally{}}pick(){let e=null,t=1/0;for(const i of this.tasks.values())i.priority<t&&(t=i.priority,e=i);return e}remove(){this.tasks.clear(),this.invoker.remove()}}class GridIndex{constructor(e,t,i){if(this.boxSeen=new Uint32Array(0),this.circleSeen=new Uint32Array(0),this.generation=0,e instanceof ArrayBuffer){const t=new Int32Array(e);this.width=t[0],this.height=t[1],this.xCellCount=t[2],this.yCellCount=t[3],this.boxUid=t[4],this.circleUid=t[5];const i=this.xCellCount*this.yCellCount,r=[];for(let e=0;e<i;e++){const i=t[6+e],n=t[6+e+1];r.push(i===n?null:t.subarray(i,n))}const n=t[6+i],o=[];for(let e=0;e<i;e++){const i=t[n+e],r=t[n+e+1];o.push(i===r?null:t.subarray(i,r))}let a=t[n+i];this.boxCells=r,this.circleCells=o,this.boxKeys=t.subarray(a,a+this.boxUid),a+=this.boxUid,this.circleKeys=t.subarray(a,a+this.circleUid),a+=this.circleUid,this.bboxes=t.subarray(a,a+4*this.boxUid),a+=4*this.boxUid,this.circles=t.subarray(a,a+3*this.circleUid)}else{this.width=e,this.height=t,this.xCellCount=Math.ceil(e/i),this.yCellCount=Math.ceil(t/i);const r=this.xCellCount*this.yCellCount,n=[],o=[];for(let e=0;e<r;e++)n.push([]),o.push([]);this.boxCells=n,this.circleCells=o,this.boxKeys=[],this.circleKeys=[],this.bboxes=[],this.circles=[],this.boxUid=0,this.circleUid=0}this.xScale=this.xCellCount/this.width,this.yScale=this.yCellCount/this.height}keysLength(){return this.boxKeys.length+this.circleKeys.length}clear(){for(const e of this.boxCells)e&&(e.length=0);for(const e of this.circleCells)e&&(e.length=0);this.circleKeys.length=0,this.boxKeys.length=0,this.bboxes.length=0,this.circles.length=0,this.boxUid=0,this.circleUid=0}insert(e,t,i,r,n){const o=this.boxUid++,a=this._xCell(t),s=this._yCell(i),l=this._xCell(r),u=this._yCell(n);for(let e=a;e<=l;e++)for(let t=s;t<=u;t++)this.boxCells[this.xCellCount*t+e].push(o);this.boxKeys.push(e),this.bboxes.push(t,i,r,n)}insertCircle(e,t,i,r){const n=this.circleUid++,o=this._xCell(t-r),a=this._yCell(i-r),s=this._xCell(t+r),l=this._yCell(i+r);for(let e=o;e<=s;e++)for(let t=a;t<=l;t++)this.circleCells[this.xCellCount*t+e].push(n);this.circleKeys.push(e),this.circles.push(t,i,r)}query(e,t,i,r,n){const o=[];if(i<0||e>this.width||r<0||t>this.height)return o;const a=this._nextGen(),{boxCells:s,circleCells:l,boxKeys:u,circleKeys:c,bboxes:h,circles:d,boxSeen:p,circleSeen:f,xCellCount:m}=this,_=this._xCell(e),g=this._yCell(t),y=this._xCell(i),x=this._yCell(r);for(let v=_;v<=y;v++)for(let _=g;_<=x;_++){const g=m*_+v,y=s[g];if(y)for(let s=0;s<y.length;s++){const l=y[s];if(p[l]===a)continue;p[l]=a;const c=4*l,d=h[c],f=h[c+1],m=h[c+2],_=h[c+3];e<=m&&t<=_&&i>=d&&r>=f&&(!n||n(u[l]))&&o.push({key:u[l],x1:d,y1:f,x2:m,y2:_})}const x=l[g];if(x)for(let s=0;s<x.length;s++){const l=x[s];if(f[l]===a)continue;f[l]=a;const u=3*l,h=d[u],p=d[u+1],m=d[u+2];!this._circleAndRectCollide(h,p,m,e,t,i,r)||n&&!n(c[l])||o.push({key:c[l],x1:h-m,y1:p-m,x2:h+m,y2:p+m})}}return o}queryKeys(e,t,i,r,n){const o=[];if(i<0||e>this.width||r<0||t>this.height)return o;const a=this._nextGen(),{boxCells:s,boxKeys:l,bboxes:u,boxSeen:c,xCellCount:h,xScale:d,yScale:p}=this,f=this._xCell(e),m=this._yCell(t),_=this._xCell(i),g=this._yCell(r);for(let y=f;y<=_;y++)for(let f=m;f<=g;f++){if(n&&!n(y/d,f/p,(y+1)/d,(f+1)/p))continue;const m=s[h*f+y];if(m)for(let s=0;s<m.length;s++){const h=m[s];if(c[h]===a)continue;c[h]=a;const d=4*h,p=u[d],f=u[d+1],_=u[d+2],g=u[d+3];(n?n(p,f,_,g):e<=_&&t<=g&&i>=p&&r>=f)&&o.push(l[h])}}return o}hitTest(e,t,i,r,n){if(i<0||e>this.width||r<0||t>this.height)return!1;const o=this._nextGen(),{boxCells:a,circleCells:s,boxKeys:l,circleKeys:u,bboxes:c,circles:h,boxSeen:d,circleSeen:p,xCellCount:f}=this,m=this._xCell(e),_=this._yCell(t),g=this._xCell(i),y=this._yCell(r);for(let x=m;x<=g;x++)for(let m=_;m<=y;m++){const _=f*m+x,g=a[_];if(g)for(let a=0;a<g.length;a++){const s=g[a];if(d[s]===o)continue;d[s]=o;const u=4*s;if(e<=c[u+2]&&t<=c[u+3]&&i>=c[u]&&r>=c[u+1]&&(!n||n(l[s])))return!0}const y=s[_];if(y)for(let a=0;a<y.length;a++){const s=y[a];if(p[s]===o)continue;p[s]=o;const l=3*s;if(this._circleAndRectCollide(h[l],h[l+1],h[l+2],e,t,i,r)&&(!n||n(u[s])))return!0}}return!1}hitTestCircle(e,t,i,r){const n=e-i,o=t-i,a=e+i,s=t+i;if(a<0||n>this.width||s<0||o>this.height)return!1;const l=this._nextGen(),{boxCells:u,circleCells:c,boxKeys:h,circleKeys:d,bboxes:p,circles:f,boxSeen:m,circleSeen:_,xCellCount:g}=this,y=this._xCell(n),x=this._yCell(o),v=this._xCell(a),b=this._yCell(s);for(let n=y;n<=v;n++)for(let o=x;o<=b;o++){const a=g*o+n,s=u[a];if(s)for(let n=0;n<s.length;n++){const o=s[n];if(m[o]===l)continue;m[o]=l;const a=4*o;if(this._circleAndRectCollide(e,t,i,p[a],p[a+1],p[a+2],p[a+3])&&(!r||r(h[o])))return!0}const y=c[a];if(y)for(let n=0;n<y.length;n++){const o=y[n];if(_[o]===l)continue;_[o]=l;const a=3*o;if(this._circlesCollide(f[a],f[a+1],f[a+2],e,t,i)&&(!r||r(d[o])))return!0}}return!1}static serialize(e,t){const i=e.toArrayBuffer();return t&&t.add(i),{buffer:i}}static deserialize(e){return new GridIndex(e.buffer)}toArrayBuffer(){const e=this.xCellCount*this.yCellCount;let t=0,i=0;for(let r=0;r<e;r++)t+=this.boxCells[r].length,i+=this.circleCells[r].length;const r=new Int32Array(6+(e+1)+t+(e+1)+i+this.boxUid+this.circleUid+4*this.boxUid+3*this.circleUid);r[0]=this.width,r[1]=this.height,r[2]=this.xCellCount,r[3]=this.yCellCount,r[4]=this.boxUid,r[5]=this.circleUid;let n=6+(e+1);for(let t=0;t<e;t++){r[6+t]=n;const e=this.boxCells[t];r.set(e,n),n+=e.length}r[6+e]=n;const o=n;n+=e+1;for(let t=0;t<e;t++){r[o+t]=n;const e=this.circleCells[t];r.set(e,n),n+=e.length}return r[o+e]=n,r.set(this.boxKeys,n),n+=this.boxUid,r.set(this.circleKeys,n),n+=this.circleUid,r.set(this.bboxes,n),n+=4*this.boxUid,r.set(this.circles,n),r.buffer}_xCell(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_yCell(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_nextGen(){return this.boxSeen.length<this.boxUid&&(this.boxSeen=new Uint32Array(this.boxUid)),this.circleSeen.length<this.circleUid&&(this.circleSeen=new Uint32Array(this.circleUid)),this.generation=this.generation+1>>>0,0===this.generation&&(this.boxSeen.fill(0),this.circleSeen.fill(0),this.generation=1),this.generation}_circlesCollide(e,t,i,r,n,o){const a=r-e,s=n-t,l=i+o;return l*l>a*a+s*s}_circleAndRectCollide(e,t,i,r,n,o,a){const s=(o-r)/2,l=Math.abs(e-(r+s));if(l>s+i)return!1;const u=(a-n)/2,c=Math.abs(t-(n+u));if(c>u+i)return!1;if(l<=s||c<=u)return!0;const h=l-s,d=c-u;return h*h+d*d<=i*i}}var et,tt={},it=function(){if(et)return tt;et=1;var e={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 t(e){return(e=Math.round(e))<0?0:e>255?255:e}function i(e){return t("%"===e[e.length-1]?parseFloat(e)/100*255:parseInt(e))}function r(e){return(t="%"===e[e.length-1]?parseFloat(e)/100:parseFloat(e))<0?0:t>1?1:t;var t}function n(e,t,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?e+(t-e)*i*6:2*i<1?t:3*i<2?e+(t-e)*(2/3-i)*6:e}try{tt.parseCSSColor=function(o){var a,s=o.replace(/ /g,"").toLowerCase();if(s in e)return e[s].slice();if("#"===s[0])return 4===s.length?(a=parseInt(s.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===s.length&&(a=parseInt(s.substr(1),16))>=0&&a<=16777215?[(16711680&a)>>16,(65280&a)>>8,255&a,1]:null;var l=s.indexOf("("),u=s.indexOf(")");if(-1!==l&&u+1===s.length){var c=s.substr(0,l),h=s.substr(l+1,u-(l+1)).split(","),d=1;switch(c){case"rgba":if(4!==h.length)return null;d=r(h.pop());case"rgb":return 3!==h.length?null:[i(h[0]),i(h[1]),i(h[2]),d];case"hsla":if(4!==h.length)return null;d=r(h.pop());case"hsl":if(3!==h.length)return null;var p=(parseFloat(h[0])%360+360)%360/360,f=r(h[1]),m=r(h[2]),_=m<=.5?m*(f+1):m+f-m*f,g=2*m-_;return[t(255*n(g,_,p+1/3)),t(255*n(g,_,p)),t(255*n(g,_,p-1/3)),d];default:return null}}return null}}catch(e){}return tt}();function rt(e,t,i){return e*(1-i)+t*i}const nt=new Map;class Color{constructor(e,t,i,r=1){this.r=e,this.g=t,this.b=i,this.a=r}static parse(e){if(!e)return;if(e instanceof Color)return e;if("string"!=typeof e)return;const t=nt.get(e);if(t)return t;const i=it.parseCSSColor(e);if(!i)return;const r=new Color(i[0]/255,i[1]/255,i[2]/255,i[3]);return nt.set(e,r),r}toString(){const{r:e,g:t,b:i,a:r}=this;return`rgba(${Math.round(255*e)},${Math.round(255*t)},${Math.round(255*i)},${r})`}toNonPremultipliedRenderColor(e){const{r:t,g:i,b:r,a:n}=this;return new NonPremultipliedRenderColor(e,t,i,r,n)}toPremultipliedRenderColor(e){const{r:t,g:i,b:r,a:n}=this;return new PremultipliedRenderColor(e,t*n,i*n,r*n,n)}clone(){return new Color(this.r,this.g,this.b,this.a)}}class RenderColor{constructor(e,t,i,r,n,o=!1){if(this.premultiplied=!1,this.premultiplied=o,e){const o=e.image.height,a=o*o;this.premultiplied?(t=0===n?0:t/n*(o-1),i=0===n?0:i/n*(o-1),r=0===n?0:r/n*(o-1)):(t*=o-1,i*=o-1,r*=o-1),t=Math.max(0,Math.min(o-1,t)),i=Math.max(0,Math.min(o-1,i)),r=Math.max(0,Math.min(o-1,r));const s=Math.floor(t),l=Math.floor(i),u=Math.floor(r),c=Math.ceil(t),h=Math.ceil(i),d=Math.ceil(r),p=t-s,f=i-l,m=r-u,_=e.image.data,g=4*(s+l*a+u*o),y=4*(s+l*a+d*o),x=4*(s+h*a+u*o),v=4*(s+h*a+d*o),b=4*(c+l*a+u*o),w=4*(c+l*a+d*o),A=4*(c+h*a+u*o),E=4*(c+h*a+d*o);this.r=rt(rt(rt(_[g],_[y],m),rt(_[x],_[v],m),f),rt(rt(_[b],_[w],m),rt(_[A],_[E],m),f),p)/255*(this.premultiplied?n:1),this.g=rt(rt(rt(_[g+1],_[y+1],m),rt(_[x+1],_[v+1],m),f),rt(rt(_[b+1],_[w+1],m),rt(_[A+1],_[E+1],m),f),p)/255*(this.premultiplied?n:1),this.b=rt(rt(rt(_[g+2],_[y+2],m),rt(_[x+2],_[v+2],m),f),rt(rt(_[b+2],_[w+2],m),rt(_[A+2],_[E+2],m),f),p)/255*(this.premultiplied?n:1),this.a=n}else this.r=t,this.g=i,this.b=r,this.a=n}toArray(){const{r:e,g:t,b:i,a:r}=this;return[255*e,255*t,255*i,r]}toHslaArray(){let{r:e,g:t,b:i,a:r}=this;if(this.premultiplied){if(0===r)return[0,0,0,0];const n=1/r;e*=n,t*=n,i*=n}const n=Math.min(Math.max(e,0),1),o=Math.min(Math.max(t,0),1),a=Math.min(Math.max(i,0),1),s=Math.min(n,o,a),l=Math.max(n,o,a),u=l-s,c=.5*(s+l);if(0===u)return[0,0,100*c,r];const h=c>.5?u/(2-l-s):u/(l+s);let d;switch(l){case n:d=60*((o-a)/u+(o<a?6:0));break;case o:d=60*((a-n)/u+2);break;default:d=60*((n-o)/u+4)}return[d,100*h,100*c,r]}toArray01(){const{r:e,g:t,b:i,a:r}=this;return[e,t,i,r]}toArray01Scaled(e){const{r:t,g:i,b:r}=this;return[t*e,i*e,r*e]}toArray01Linear(){const{r:e,g:t,b:i,a:r}=this;return[Math.pow(e,2.2),Math.pow(t,2.2),Math.pow(i,2.2),r]}}class NonPremultipliedRenderColor extends RenderColor{constructor(e,t,i,r,n){super(e,t,i,r,n,!1)}}class PremultipliedRenderColor extends RenderColor{constructor(e,t,i,r,n){super(e,t,i,r,n,!0)}}Color.black=new Color(0,0,0,1),Color.white=new Color(1,1,1,1),Color.transparent=new Color(0,0,0,0),Color.red=new Color(1,0,0,1),Color.blue=new Color(0,0,1,1);class ParsingError extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class Scope{constructor(e,t=[]){this.parent=e,this.bindings=Object.create(null);for(const[e,i]of t)this.bindings[e]=i}concat(e){return new Scope(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const ot={kind:"null"},at={kind:"number"},st={kind:"string"},lt={kind:"boolean"},ut={kind:"color"},ct={kind:"object"},ht={kind:"value"},dt={kind:"collator"},pt={kind:"formatted"},ft={kind:"resolvedImage"};function mt(e,t){return{kind:"array",itemType:e,N:t}}function _t(e){if("array"===e.kind){const t=_t(e.itemType);return"number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}const gt=[ot,at,st,lt,ut,pt,ct,mt(ht),ft];function yt(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!yt(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind)for(const e of gt)if(!yt(e,t))return null}return`Expected ${_t(e)} but found ${_t(t)} instead.`}function xt(e,t){return t.some(t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e)}function vt(e,t){return"array"===e.kind&&"array"===t.kind?e.N===t.N&&vt(e.itemType,t.itemType):e.kind===t.kind}class Collator{constructor(e,t,i){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class FormattedSection{constructor(e,t,i,r,n){this.text=e.normalize?e.normalize():e,this.image=t,this.scale=i,this.fontStack=r,this.textColor=n}}class Formatted{constructor(e){this.sections=e}static fromString(e){return new Formatted([new FormattedSection(e,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(e=>0!==e.text.length||!!e.image&&e.image.hasPrimary())}static factory(e){return e instanceof Formatted?e:Formatted.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map(e=>e.text).join("")}serialize(){const e=["format"];for(const t of this.sections){if(t.image){const i=t.image.getPrimary().id.toString();e.push(["image",i]);continue}e.push(t.text);const i={};t.fontStack&&(i["text-font"]=["literal",t.fontStack.split(",")]),t.scale&&(i["font-scale"]=t.scale),t.textColor&&(i["text-color"]=["rgba"].concat(t.textColor.toNonPremultipliedRenderColor(null).toArray())),e.push(i)}return e}}class ImageId{constructor(e){"string"==typeof e?this.name=e:(this.name=e.name,this.iconsetId=e.iconsetId)}static from(e){return new ImageId(e)}static toString(e){return e.iconsetId?`${e.name}
2\x1f${e.iconsetId}`:e.name}static parse(e){const[t,i]=e.split("\x1f");return new ImageId({name:t,iconsetId:i})}static isEqual(e,t){return e.name===t.name&&e.iconsetId===t.iconsetId}toString(){return ImageId.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}class ImageVariant{constructor(e,t={}){this.id=ImageId.from(e),this.params=t.params,this.sx=t.sx||1,this.sy=t.sy||
vendor: 9,140 bytes, line 2
21}toString(){return JSON.stringify(this)}static parse(e){let t,i,r,n;try{({id:t,params:i,sx:r,sy:n}=JSON.parse(e)||{})}catch(e){return null}return t?new ImageVariant(t,{params:i,sx:r,sy:n}):null}scaleSelf(e,t=e){return this.sx*=e,this.sy*=t,this}}class ResolvedImage{constructor(e,t,i,r,n=!1){this.primaryId=ImageId.from(e),this.primaryOptions=t,i&&(this.secondaryId=ImageId.from(i)),this.secondaryOptions=r,this.available=n}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new ImageVariant(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new ImageVariant(this.secondaryId,this.secondaryOptions):null}static from(e){return"string"!=typeof e?e:ResolvedImage.build({name:e})}static build(e,t,i,r){return!e||"object"==typeof e&&!("name"in e)?null:new ResolvedImage(e,i,t,r)}}function bt(e,t,i,r){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:`Invalid rgba value [${[e,t,i,r].join(", ")}]: \'a\' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof r?[e,t,i,r]:[e,t,i]).join(", ")}]: \'r\', \'g\', and \'b\' must be between 0 and 255.`}function wt(e){if(null===e)return!0;if("string"==typeof e)return!0;if("boolean"==typeof e)return!0;if("number"==typeof e)return!0;if(e instanceof Color)return!0;if(e instanceof Collator)return!0;if(e instanceof Formatted)return!0;if(e instanceof ResolvedImage)return!0;if(Array.isArray(e)){for(const t of e)if(!wt(t))return!1;return!0}if("object"==typeof e){for(const t in e)if(!wt(e[t]))return!1;return!0}return!1}function Et(e){if(null===e)return ot;if("string"==typeof e)return st;if("boolean"==typeof e)return lt;if("number"==typeof e)return at;if(e instanceof Color)return ut;if(e instanceof Collator)return dt;if(e instanceof Formatted)return pt;if(e instanceof ResolvedImage)return ft;if(Array.isArray(e)){const t=e.length;let i;for(const t of e){const e=Et(t);if(i){if(i===e)continue;i=ht;break}i=e}return mt(i||ht,t)}return ct}function It(e){return null===e?"":"string"==typeof e||"number"==typeof e||"boolean"==typeof e?String(e):e instanceof Formatted||e instanceof ResolvedImage||e instanceof Color?e.toString():JSON.stringify(e)}class Literal{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(2!==e.length)return t.error(`\'literal\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!wt(e[1]))return t.error("invalid value");const i=e[1];let r=Et(i);const n=t.expectedType;return"array"!==r.kind||0!==r.N||!n||"array"!==n.kind||"number"==typeof n.N&&0!==n.N||(r=n),new Literal(r,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof Color?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof Formatted?this.value.serialize():this.value}}class RuntimeError{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const St={string:st,number:at,boolean:lt,object:ct};class Assertion{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i,r=1;const n=e[0];if("array"===n){let n,o;if(e.length>2){const i=e[1];if("string"!=typeof i||!(i in St)||"object"===i)return t.error(\'The item type argument of "array" must be one of string, number, boolean\',1);n=St[i],r++}else n=ht;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return t.error(\'The length argument to "array" must be a positive integer literal\',2);o=e[2],r++}i=mt(n,o)}else i=St[n];const o=[];for(;r<e.length;r++){const i=t.parse(e[r],r,ht);if(!i)return null;o.push(i)}return new Assertion(i,o)}evaluate(e){for(let t=0;t<this.args.length;t++){const i=this.args[t].evaluate(e);if(!yt(this.type,Et(i)))return i;if(t===this.args.length-1)throw new RuntimeError(`The expression ${JSON.stringify(this.args[t].serialize())} evaluated to ${_t(Et(i))} but was expected to be of type ${_t(this.type)}.`)}return null}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=this.type,t=[e.kind];if("array"===e.kind){const i=e.itemType;if("string"===i.kind||"number"===i.kind||"boolean"===i.kind){t.push(i.kind);const r=e.N;("number"==typeof r||this.args.length>1)&&t.push(r)}}return t.concat(this.args.map(e=>e.serialize()))}}class FormatExpression{constructor(e){this.type=pt,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[1];if(!Array.isArray(i)&&"object"==typeof i)return t.error("First argument must be an image or text section.");const r=[];let n=!1;for(let i=1;i<=e.length-1;++i){const o=e[i];if(n&&"object"==typeof o&&!Array.isArray(o)){n=!1;let e=null;if(o["font-scale"]&&(e=t.parseObjectValue(o["font-scale"],i,"font-scale",at),!e))return null;let a=null;if(o["text-font"]&&(a=t.parseObjectValue(o["text-font"],i,"text-font",mt(st)),!a))return null;let s=null;if(o["text-color"]&&(s=t.parseObjectValue(o["text-color"],i,"text-color",ut),!s))return null;const l=r.at(-1);l.scale=e,l.font=a,l.textColor=s}else{const o=t.parse(e[i],i,ht);if(!o)return null;const a=o.type.kind;if("string"!==a&&"value"!==a&&"null"!==a&&"resolvedImage"!==a)return t.error("Formatted text type must be \'string\', \'value\', \'image\' or \'null\'.");n=!0,r.push({content:o,scale:null,font:null,textColor:null})}}return new FormatExpression(r)}evaluate(e){return new Formatted(this.sections.map(t=>{const i=t.content.evaluate(e);return vt(Et(i),ft)?new FormattedSection("",i,null,null,null):new FormattedSection(It(i),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null)}))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor)}outputDefined(){return!1}serialize(){const e=["format"];for(const t of this.sections){e.push(t.content.serialize());const i={};t.scale&&(i["font-scale"]=t.scale.serialize()),t.font&&(i["text-font"]=t.font.serialize()),t.textColor&&(i["text-color"]=t.textColor.serialize()),e.push(i)}return e}}class ImageExpression{constructor(e,t,i,r){this._imageWarnHistory={},this.type=ft,this.namePrimary=e,this.nameSecondary=t,i&&(this.paramsPrimary=i.params,this.iconsetIdPrimary=i.iconset?i.iconset.id:void 0),r&&(this.paramsSecondary=r.params,this.iconsetIdSecondary=r.iconset?r.iconset.id:void 0)}static parse(e,t){if(e.length<2)return t.error("Expected two or more arguments.");let i=1;const r=[];function n(){if(i<e.length){const n=t.parse(e[i],i++,st);return n?(r.push({image:n,options:{}}),!0):(t.error(r.length?"Secondary image variant is not a string.":"No image name provided."),!1)}return!0}function o(){if(i<e.length){const o=e[i];if(null===(n=o)||"object"!=typeof n||Array.isArray(n))return!0;const a=o.params,s=o.iconset,l=t.concat(i);if(!a&&!s)return i++,!0;if(a){if("object"!=typeof a||a.constructor!==Object)return l.error(\'Image options "params" should be an object\'),!1;const e={},t=l.concat(void 0,"params");for(const i in a){if(!i)return t.error("Image parameter name should be non-empty"),!1;const r=t.concat(void 0,i).parse(a[i],void 0,ut,void 0,{typeAnnotation:"coerce"});if(!r)return!1;e[i]=r}r.at(-1).options.params=e}if(s){if("object"!=typeof s||s.constructor!==Object)return l.error(\'Image options "iconset" should be an object\'),!1;if(!s.id)return l.error(\'Image options "iconset" should have an "id" property\'),!1;r.at(-1).options.iconset=s}return i++,!0}var n;return!0}for(let e=0;e<2;e++)if(!n()||!o())return;return new ImageExpression(r[0].image,r[1]?r[1].image:void 0,r[0].options,r[1]?r[1].options:void 0)}evaluateParams(e,t){const i={};if(t){for(const r in t)if(t[r])try{i[r]=t[r].evaluate(e)}catch(e){continue}if(0!==Object.keys(i).length)return{params:i}}}evaluate(e){const t={name:this.namePrimary.evaluate(e),iconsetId:this.iconsetIdPrimary},i=this.nameSecondary?{name:this.nameSecondary.evaluate(e),iconsetId:this.iconsetIdSecondary}:void 0,r=ResolvedImage.build(t,i,this.paramsPrimary?this.evaluateParams(e,this.paramsPrimary):void 0,this.paramsSecondary?this.evaluateParams(e,this.paramsSecondary):void 0);if(r&&e.availableImages){const t=r.getPrimary().id;if(r.available=e.availableImages.some(e=>ImageId.isEqual(e,t)),r.available){const t=r.getSecondary()?r.getSecondary().id:null;t&&(r.available=e.availableImages.some(e=>ImageId.isEqual(e,t)))}}return r}eachChild(e){if(e(this.namePrimary),this.paramsPrimary)for(const t in this.paramsPrimary)this.paramsPrimary[t]&&e(this.paramsPrimary[t]);if(this.nameSecondary&&(e(this.nameSecondary),this.paramsSecondary))for(const t in this.paramsSecondary)this.paramsSecondary[t]&&e(this.paramsSecondary[t])}outputDefined(){return!1}serializeOptions(e,t){const i={};if(t&&(i.iconset={id:t}),e){i.params={};
vendor: 11,707 bytes, line 2
2for(const t in e)e[t]&&(i.params[t]=e[t].serialize())}return Object.keys(i).length>0?i:void 0}serialize(){const e=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const t=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);t&&e.push(t)}if(this.nameSecondary&&(e.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const t=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);t&&e.push(t)}return e}}function Dt(e){return"string"==typeof(t=e)||t instanceof String?"string":Pt(e)?"number":function(e){return"boolean"==typeof e||e instanceof Boolean}(e)?"boolean":Array.isArray(e)?"array":null===e?"null":function(e){return null!=e&&!Array.isArray(e)&&"function"!=typeof e&&!(e instanceof String||e instanceof Number||e instanceof Boolean)&&"object"==typeof e}(e)?"object":typeof e;var t}function Pt(e){return"number"==typeof e||e instanceof Number}const Tt={"to-boolean":lt,"to-color":ut,"to-number":at,"to-string":st};class Coercion{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[0],r=[];let n=ot;if("to-array"===i){if(!Array.isArray(e[1]))return null;const i=e[1].length;if(t.expectedType){if("array"!==t.expectedType.kind)return t.error(`Expected ${t.expectedType.kind} but found array.`);n=mt(t.expectedType.itemType,i)}else{if(!(i>0&&wt(e[1][0])))return null;n=mt(Et(e[1][0]),i)}for(let o=0;o<i;o++){const i=e[1][o];let a;if(Array.isArray(i))a=t.parse(i,void 0,n.itemType);else{const e=Dt(i);if(e!==n.itemType.kind)return t.error(`Expected ${n.itemType.kind} but found ${e}.`);a=t.registry.literal.parse(["literal",void 0===i?null:i],t)}if(!a)return null;r.push(a)}}else{if(("to-boolean"===i||"to-string"===i)&&2!==e.length)return t.error("Expected one argument.");n=Tt[i];for(let i=1;i<e.length;i++){const n=t.parse(e[i],i,ht);if(!n)return null;r.push(n)}}return new Coercion(n,r)}evaluate(e){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(e));if("color"===this.type.kind){let t,i;for(const r of this.args){if(t=r.evaluate(e),i=null,t instanceof Color)return t;if("string"==typeof t){const i=e.parseColor(t);if(i)return i}else if(Array.isArray(t)&&(i=t.length<3||t.length>4?`Invalid rbga value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:bt(t[0],t[1],t[2],t[3]),!i))return new Color(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new RuntimeError(i||`Could not parse color from value \'${"string"==typeof t?t:String(JSON.stringify(t))}\'`)}if("number"===this.type.kind){let t=null;for(const i of this.args){if(t=i.evaluate(e),null===t)return 0;const r=Number(t);if(!isNaN(r))return r}throw new RuntimeError(`Could not convert ${JSON.stringify(t)} to number.`)}return"formatted"===this.type.kind?Formatted.fromString(It(this.args[0].evaluate(e))):"resolvedImage"===this.type.kind?ResolvedImage.build(It(this.args[0].evaluate(e))):"array"===this.type.kind?this.args.map(t=>t.evaluate(e)):It(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){if("formatted"===this.type.kind)return new FormatExpression([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new ImageExpression(this.args[0]).serialize();const e="array"===this.type.kind?[]:[`to-${this.type.kind}`];return this.eachChild(t=>{e.push(t.serialize())}),e}}const zt=["Unknown","Point","LineString","Polygon"];class EvaluationContext{constructor(e,t,i){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=e,this.options=t,this.iconImageUseTheme=i}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?zt[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(e){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const e=this.featureDistanceData.center,t=this.featureDistanceData.scale,{x:i,y:r}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(i*t-e[0])+this.featureDistanceData.bearing[1]*(r*t-e[1])}return 0}parseColor(e){return Color.parse(e)}getConfig(e){return this.options?this.options.get(e):null}}class CompoundExpression{constructor(e,t,i,r,n){this.name=e,this.type=t,this._evaluate=i,this.args=r,this._overloadIndex=n}evaluate(e){if(!this._evaluate){const e=CompoundExpression.definitions[this.name];this._evaluate=Array.isArray(e)?e[2]:e.overloads[this._overloadIndex][1]}return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(e=>e.serialize()))}static parse(e,t){const i=e[0],r=CompoundExpression.definitions[i];if(!r)return t.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const n=Array.isArray(r)?r[0]:r.type,o=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,a=[];let s=null,l=-1;for(const[r,u]of o){if(Array.isArray(r)&&r.length!==e.length-1)continue;a.push(r),l++,null===s?s=t._forkForSignature():s.errors.length=0;const o=[];let c=!1;for(let t=1;t<e.length;t++){const i=e[t],n=Array.isArray(r)?r[t-1]:r.type,a=s.parse(i,1+o.length,n);if(!a){c=!0;break}o.push(a)}if(!c)if(Array.isArray(r)&&r.length!==o.length)s.error(`Expected ${r.length} arguments, but found ${o.length} instead.`);else{for(let e=0;e<o.length;e++){const t=Array.isArray(r)?r[e]:r.type;s.checkSubtype(t,o[e].type,e+1)}if(0===s.errors.length)return new CompoundExpression(i,n,u,o,l)}}if(1===a.length)t.errors.push(...s.errors);else{const i=(a.length?a:o.map(([e])=>e)).map(Mt).join(" | "),r=[];for(let i=1;i<e.length;i++){const n=t.parse(e[i],1+r.length);if(!n)return null;r.push(_t(n.type))}t.error(`Expected arguments of type ${i}, but found (${r.join(", ")}) instead.`)}return null}static register(e,t){CompoundExpression.definitions=t;for(const i in t)e[i]=CompoundExpression}}function Mt(e){return Array.isArray(e)?`(${e.map(_t).join(", ")})`:`(${_t(e.type)}...)`}class CollatorExpression{constructor(e,t,i){this.type=dt,this.locale=i,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(2!==e.length)return t.error("Expected one argument."),null;const i=e[1];if("object"!=typeof i||Array.isArray(i))return t.error("Collator options argument must be an object."),null;const r=void 0===i["case-sensitive"]?t.parse(!1,1,lt):t.parseObjectValue(i["case-sensitive"],1,"case-sensitive",lt);if(!r)return null;const n=void 0===i["diacritic-sensitive"]?t.parse(!1,1,lt):t.parseObjectValue(i["diacritic-sensitive"],1,"diacritic-sensitive",lt);if(!n)return null;let o=null;return i.locale&&(o=t.parseObjectValue(i.locale,1,"locale",st),!o)?null:new CollatorExpression(r,n,o)}evaluate(e){return new Collator(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}serialize(){const e={};return e["case-sensitive"]=this.caseSensitive.serialize(),e["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(e.locale=this.locale.serialize()),["collator",e]}}function Ct(e){return(180+e)/360}function Rt(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Lt(e){return 360*e-180}function Ft(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}const Bt=8192;function Ot(e,t){const i=Ct(e[0]),r=Rt(e[1]),n=Math.pow(2,t.z);return[Math.round(i*n*Bt),Math.round(r*n*Bt)]}function Vt(e,t){for(let i=0;i<t.length;i++)if(he(e,t[i]))return!0;return!1}function kt(e,t,i){for(const r of i)for(let i=0,n=r.length,o=n-1;i<n;o=i++)if(pe(e,t,r[o],r[i]))return!0;return!1}function Nt(e,t){for(let i=0;i<e.length;++i)if(!he(e[i],t))return!1;for(let i=0;i<e.length-1;++i)if(kt(e[i],e[i+1],t))return!1;return!0}function Ut(e,t){for(let i=0;i<t.length;i++)if(Nt(e,t[i]))return!0;return!1}function Gt(e,t,i){const r=[];for(let n=0;n<e.length;n++){const o=[];for(let r=0;r<e[n].length;r++){const a=Ot(e[n][r],i);se(t,a),o.push(a)}r.push(o)}return r}function jt(e,t,i){const r=[];for(let n=0;n<e.length;n++){const o=Gt(e[n],t,i);r.push(o)}return r}function Ht(e,t,i,r){if(e[0]<i[0]||e[0]>i[2]){const t=.5*r;let n=e[0]-i[0]>t?-r:i[0]-e[0]>t?r:0;0===n&&(n=e[0]-i[2]>t?-r:i[2]-e[0]>t?r:0),e[0]+=n}se(t,e)}function $t(e,t,i,r){const n=Math.pow(2,r.z)*Bt,o=[r.x*Bt,r.y*Bt],a=[];if(!e)return a;for(const r of e)for(const e of r){const r=[e.x+o[0],e.y+o[1]];Ht(r,t,i,n),a.push(r)}return a}function Wt(e,t,i,r){const n=Math.pow(2,r.z)*Bt,o=[r.x*Bt,r.y*Bt],a=[];if(!e)return a;for(const i of e){const e=[];for(const r of i){const i=[r.x+o[0],r.y+o[1]];se(t,i),e.push(i)}a.push(e)}if(t[2]-t[0]<=n/2){(s=t)[0]=s[1]=1/0,s[2]=s[3]=-1/0;for(const e of a)for(const r of e)Ht(r,t,i,n)}var s;return a}class Within{constructor(e,t){this.type=lt,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`\'within\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(wt(e[1])){const t=e[1];if("FeatureCollection"===t.type)for(let e=0;e<t.features.length;++e){const i=t.features[e].geometry.type;if("Polygon"===i||"MultiPolygon"===i)return new Within(t,t.features[e].geometry)}else if("Feature"===t.type){const e=t.geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new Within(t,t.geometry)}else if("Polygon"===t.type||"MultiPolygon"===t.type)return new Within(t,t)}return t.error("\'within\' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(!n)return!1;if("Polygon"===t.type){const o=Gt(t.coordinates,r,n),a=$t(e.geometry(),i,r,n);if(!le(i,r))return!1;for(const e of a)if(!he(e,o))return!1}if("MultiPolygon"===t.type){const o=jt(t.coordinates,r,n),a=$t(e.geometry(),i,r,n);if(!le(i,r))return!1;for(const e of a)if(!Vt(e,o))return!1}return!0}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(!n)return!1;if("Polygon"===t.type){const o=Gt(t.coordinates,r,n),a=Wt(e.geometry(),i,r,n);if(!le(i,r))return!1;for(const e of a)if(!Nt(e,o))return!1}if("MultiPolygon"===t.type){const o=jt(t.coordinates,r,n),a=Wt(e.geometry(),i,r,n);if(!le(i,r))return!1;for(const e of a)if(!Ut(e,o))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}class TinyQueue{constructor(e=[],t=(e,t)=>e<t?-1:e>t?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:i}=this,r=t[e];for(;e>0;){const n=e-1>>1,o=t[n];if(i(r,o)>=0)break;t[e]=o,e=n}t[e]=r}_down(e){const{data:t,compare:i}=this,r=this.length>>1,n=t[e];for(;e<r;){let r=1+(e<<1);const o=r+1;if(o<this.length&&i(t[o],t[r])<0&&(r=o),i(t[r],n)>=0)break;t[e]=t[r],e=r}t[e]=n}}var Xt=8192;
vendor: 17,029 bytes, line 2
2function qt(e,t,i){return[e,t,i].filter(Boolean).join("\x1f")}function Zt(e,t){switch(e){case"string":return It(t);case"number":return+t;case"boolean":return!!t;case"color":return Color.parse(t);case"formatted":return Formatted.fromString(It(t));case"resolvedImage":return ResolvedImage.build(It(t))}return t}function Yt(e,t,i,r){return void 0!==r&&(e=r*Math.round(e/r)),void 0!==t&&e<t&&(e=t),void 0!==i&&e>i&&(e=i),e}class Config{constructor(e,t,i,r=!1){this.type=e,this.key=t,this.scope=i,this.featureConstant=r}static parse(e,t){let i=t.expectedType;if(i??=ht,e.length<2||e.length>3)return t.error("Invalid number of arguments for \'config\' expression.");const r=t.parse(e[1],1);if(!(r instanceof Literal))return t.error("Key name of \'config\' expression must be a string literal.");let n,o=!0;const a=It(r.value);if(e.length>=3){const i=t.parse(e[2],2);if(!(i instanceof Literal))return t.error("Scope of \'config\' expression must be a string literal.");n=It(i.value)}if(t.options){const e=qt(a,n,t._scope),i=t.options.get(e);i&&(o=Jt(i.value||i.default))}return new Config(i,a,n,o)}evaluate(e){const t=qt(this.key,this.scope,e.scope),i=e.getConfig(t);if(!i)return null;const{type:r,value:n,values:o,minValue:a,maxValue:s,stepValue:l}=i,u=i.default.evaluate(e);let c=u;if(n){const t=e.scope;e.scope=(t||"").split("\x1f").slice(1).join("\x1f"),c=n.evaluate(e),e.scope=t}return r&&(c=Zt(r,c)),void 0===c||void 0===a&&void 0===s&&void 0===l||("number"==typeof c?c=Yt(c,a,s,l):Array.isArray(c)&&(c=c.map(e=>"number"==typeof e?Yt(e,a,s,l):e))),void 0!==n&&void 0!==c&&o&&!o.includes(c)&&(c=u,r&&(c=Zt(r,c))),(r&&r!==this.type||void 0!==c&&!vt(Et(c),this.type))&&(c=Zt(this.type.kind,c)),c}eachChild(){}outputDefined(){return!1}serialize(){const e=["config",this.key];return this.scope&&e.concat(this.scope),e}}function Jt(e){if(e instanceof CompoundExpression){if("get"===e.name&&1===e.args.length)return!1;if("feature-state"===e.name)return!1;if("has"===e.name&&1===e.args.length)return!1;if("properties"===e.name||"geometry-type"===e.name||"id"===e.name)return!1;if(e.name.startsWith("filter-"))return!1}if(e instanceof Within)return!1;if(e instanceof Distance)return!1;if(e instanceof Config)return e.featureConstant;let t=!0;return e.eachChild(e=>{t&&!Jt(e)&&(t=!1)}),t}function Kt(e){if(e instanceof CompoundExpression&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild(e=>{t&&!Kt(e)&&(t=!1)}),t}function Qt(e,t){if(e instanceof CompoundExpression&&t.has(e.name))return!1;let i=!0;return e.eachChild(e=>{i&&!Qt(e,t)&&(i=!1)}),i}function ei(e,t){return Qt(e,new Set(t))}const ti=1/298.257223563,ii=ti*(2-ti),ri=Math.PI/180;function ni(e){const t=6378.137*ri*1e3,i=Math.cos(e*ri),r=1/(1-ii*(1-i*i)),n=Math.sqrt(r);return[t*n*i,t*n*r*(1-ii)]}function oi(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}function ai(e,t,i,r){const n=oi(e[0]-t[0])*i,o=(e[1]-t[1])*r;return Math.sqrt(n*n+o*o)}function si(e,t,i,r,n){let o=t[0],a=t[1],s=oi(i[0]-o)*r,l=(i[1]-a)*n;if(0!==s||0!==l){const t=(oi(e[0]-o)*r*s+(e[1]-a)*n*l)/(s*s+l*l);t>1?(o=i[0],a=i[1]):t>0&&(o+=s/r*t,a+=l/n*t)}return s=oi(e[0]-o)*r,l=(e[1]-a)*n,Math.sqrt(s*s+l*l)}function li(e,t){return t.dist-e.dist}function ui(e){const t=[1/0,1/0,-1/0,-1/0];if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}function ci(e){return e[1]-e[0]+1}function hi(e,t){const i=e[1]>=e[0]&&e[1]<t;return i||console.warn("Distance Expression: Index is out of range"),i}function di(e,t){if(e[0]>e[1])return[null,null];const i=ci(e);if(t){if(2===i)return[e,null];const t=Math.floor(i/2);return[[e[0],e[0]+t],[e[0]+t,e[1]]]}{if(1===i)return[e,null];const t=Math.floor(i/2)-1;return[[e[0],e[0]+t],[e[0]+t+1,e[1]]]}}function pi(e,t){const i=[1/0,1/0,-1/0,-1/0];if(!hi(t,e.length))return i;for(let r=t[0];r<=t[1];++r)se(i,e[r]);return i}function fi(e){const t=[1/0,1/0,-1/0,-1/0];for(let i=0;i<e.length;++i)for(let r=0;r<e[i].length;++r)se(t,e[i][r]);return t}function mi(e,t,i,r){if(ui(e)||ui(t))return NaN;let n=0,o=0;return e[2]<t[0]&&(n=t[0]-e[2]),e[0]>t[2]&&(n=e[0]-t[2]),e[1]>t[3]&&(o=e[1]-t[3]),e[3]<t[1]&&(o=t[1]-e[3]),ai([0,0],[n,o],i,r)}function _i(e,t,i=8192){const r=Math.pow(2,t.z),n=(e.y/i+t.y)/r;return[Lt((e.x/i+t.x)/r),Ft(n)]}function gi(e,t){const i=[];for(let r=0;r<e.length;++r)i.push(_i(e[r],t));return i}function yi(e,t,i,r){const n=function(e,t,i,r){let n=1/0,o=e[0][0],a=e[0][1];for(let s=0;s<e.length-1;s++){let l=e[s][0],u=e[s][1],c=oi(e[s+1][0]-l)*i,h=(e[s+1][1]-u)*r,d=0;0===c&&0===h||(d=(oi(t[0]-l)*i*c+(t[1]-u)*r*h)/(c*c+h*h),d>1?(l=e[s+1][0],u=e[s+1][1]):d>0&&(l+=c/i*d,u+=h/r*d)),c=oi(t[0]-l)*i,h=(t[1]-u)*r;const p=c*c+h*h;p<n&&(n=p,o=l,a=u)}return[o,a]}(t,e,i,r);return ai(e,n,i,r)}function xi(e,t,i,r,n,o){const a=i.slice(r[0],r[1]+1);let s=1/0;for(let i=t[0];i<=t[1];++i)if(0===(s=Math.min(s,yi(e[i],a,n,o))))return 0;return s}function vi(e,t,i,r,n,o){const a=Math.min(si(e,i,r,n,o),si(t,i,r,n,o)),s=Math.min(si(i,e,t,n,o),si(r,e,t,n,o));return Math.min(a,s)}function bi(e,t,i,r,n,o){if(!hi(t,e.length)||!hi(r,i.length))return NaN;let a=1/0;for(let s=t[0];s<t[1];++s)for(let t=r[0];t<r[1];++t){if(pe(e[s],e[s+1],i[t],i[t+1]))return 0;a=Math.min(a,vi(e[s],e[s+1],i[t],i[t+1],n,o))}return a}function wi(e,t,i,r,n,o){if(!hi(t,e.length)||!hi(r,i.length))return NaN;let a=1/0;for(let s=t[0];s<=t[1];++s)for(let t=r[0];t<=r[1];++t)if(0===(a=Math.min(a,ai(e[s],i[t],n,o))))return a;return a}function Ai(e,t,i,r){if(he(e,t,!0))return 0;let n=1/0;for(const o of t){const t=o.length;if(t<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(o[0]!==o[t-1]&&0===(n=Math.min(n,si(e,o[t-1],o[0],i,r))))return n;if(0===(n=Math.min(n,yi(e,o,i,r))))return n}return n}function Ei(e,t,i,r,n){if(!hi(t,e.length))return NaN;for(let r=t[0];r<=t[1];++r)if(he(e[r],i,!0))return 0;let o=1/0;for(let a=t[0];a<t[1];++a)for(const t of i)for(let i=0,s=t.length,l=s-1;i<s;l=i++){if(pe(e[a],e[a+1],t[l],t[i]))return 0;o=Math.min(o,vi(e[a],e[a+1],t[l],t[i],r,n))}return o}function Ii(e,t){for(const i of e)for(let e=0;e<=i.length-1;++e)if(he(i[e],t,!0))return!0;return!1}function Si(e,t,i,r,n=1/0){const o=fi(e),a=fi(t);if(n!==1/0&&mi(o,a,i,r)>=n)return n;if(le(o,a)){if(Ii(e,t))return 0}else if(Ii(t,e))return 0;let s=n;for(const n of e)for(let e=0,o=n.length,a=o-1;e<o;a=e++)for(const o of t)for(let t=0,l=o.length,u=l-1;t<l;u=t++){if(pe(n[a],n[e],o[u],o[t]))return 0;s=Math.min(s,vi(n[a],n[e],o[u],o[t],i,r))}return s}function Di(e,t,i,r,n,o,a,s){if(null===a||null===s)return;const l=mi(pi(n,a),pi(o,s),i,r);l<t&&e.push({dist:l,range1:a,range2:s})}function Pi(e,t,i,r,n,o=1/0){let a=Math.min(ai(e[0],i[0][0],r,n),o);if(0===a)return a;const s=new TinyQueue([{dist:0,range1:[0,e.length-1],range2:[0,0]}],li),l=t?50:100,u=fi(i);for(;s.length;){const o=s.pop();if(o.dist>=a)continue;const c=o.range1;if(ci(c)<=l){if(!hi(c,e.length))return NaN;if(t){const t=Ei(e,c,i,r,n);if(0===(a=Math.min(a,t)))return a}else for(let t=c[0];t<=c[1];++t){const o=Ai(e[t],i,r,n);if(0===(a=Math.min(a,o)))return a}}else{const i=di(c,t);if(null!==i[0]){const t=mi(pi(e,i[0]),u,r,n);t<a&&s.push({dist:t,range1:i[0],range2:[0,0]})}if(null!==i[1]){const t=mi(pi(e,i[1]),u,r,n);t<a&&s.push({dist:t,range1:i[1],range2:[0,0]})}}}return a}function Ti(e,t,i,r,n,o,a=1/0){let s=Math.min(a,ai(e[0],i[0],n,o));if(0===s)return s;const l=new TinyQueue([{dist:0,range1:[0,e.length-1],range2:[0,i.length-1]}],li),u=t?50:100,c=r?50:100;for(;l.length;){const a=l.pop();if(a.dist>=s)continue;const h=a.range1,d=a.range2;if(ci(h)<=u&&ci(d)<=c){if(!hi(h,e.length)||!hi(d,i.length))return NaN;if(t&&r?s=Math.min(s,bi(e,h,i,d,n,o)):t||r?t&&!r?s=Math.min(s,xi(i,d,e,h,n,o)):!t&&r&&(s=Math.min(s,xi(e,h,i,d,n,o))):s=Math.min(s,wi(e,h,i,d,n,o)),0===s)return s}else{const a=di(h,t),u=di(d,r);Di(l,s,n,o,e,i,a[0],u[0]),Di(l,s,n,o,e,i,a[0],u[1]),Di(l,s,n,o,e,i,a[1],u[0]),Di(l,s,n,o,e,i,a[1],u[1])}}return s}function zi(e,t,i,r,n,o=1/0){let a=o;const s=pi(e,[0,e.length-1]);for(const o of i)if(!(a!==1/0&&mi(s,pi(o,[0,o.length-1]),r,n)>=a)&&(a=Math.min(a,Ti(e,t,o,!0,r,n,a)),0===a))return a;return a}function Mi(e,t,i,r,n,o=1/0){let a=o;const s=pi(e,[0,e.length-1]);for(const o of i){if(a!==1/0&&mi(s,fi(o),r,n)>=a)continue;const i=Pi(e,t,o,r,n,a);if(isNaN(i))return i;if(0===(a=Math.min(a,i)))return a}return a}function Ci(e,t,i){const r=[];for(const i of e)for(const e of i)r.push(_i(e,t));const[n,o]=ni(r[0][1]);return"Point"===i.type||"MultiPoint"===i.type||"LineString"===i.type?Ti(r,!1,"Point"===i.type?[i.coordinates]:i.coordinates,"LineString"===i.type,n,o):"MultiLineString"===i.type?zi(r,!1,i.coordinates,n,o):"Polygon"===i.type||"MultiPolygon"===i.type?Mi(r,!1,"Polygon"===i.type?[i.coordinates]:i.coordinates,n,o):null}function Ri(e,t,i){const r=[];for(const i of e){const e=[];for(const r of i)e.push(_i(r,t));r.push(e)}const[n,o]=ni(r[0][0][1]);if("Point"===i.type||"MultiPoint"===i.type||"LineString"===i.type)return zi("Point"===i.type?[i.coordinates]:i.coordinates,"LineString"===i.type,r,n,o);if("MultiLineString"===i.type){let e=1/0;for(let t=0;t<i.coordinates.length;t++){const a=zi(i.coordinates[t],!0,r,n,o,e);if(isNaN(a))return a;if(0===(e=Math.min(e,a)))return e}return e}if("Polygon"===i.type||"MultiPolygon"===i.type){let e=1/0;for(let t=0;t<r.length;t++){const a=Mi(r[t],!0,"Polygon"===i.type?[i.coordinates]:i.coordinates,n,o,e);if(isNaN(a))return a;if(0===(e=Math.min(e,a)))return e}return e}return null}function Li(e,t,i){const r=[];for(const i of ae(e,0)){const e=[];for(let r=0;r<i.length;++r)e.push(gi(i[r],t));r.push(e)}const[n,o]=ni(r[0][0][0][1]);if("Point"===i.type||"MultiPoint"===i.type||"LineString"===i.type)return Mi("Point"===i.type?[i.coordinates]:i.coordinates,"LineString"===i.type,r,n,o);if("MultiLineString"===i.type){let e=1/0;for(let t=0;t<i.coordinates.length;t++){const a=Mi(i.coordinates[t],!0,r,n,o,e);if(isNaN(a))return a;if(0===(e=Math.min(e,a)))return e}return e}return"Polygon"===i.type||"MultiPolygon"===i.type?function(e,t,i,r){let n=1/0;for(const o of e)for(const e of t){const t=Si(o,e,i,r,n);if(isNaN(t))return t;if(0===(n=Math.min(n,t)))return n}return n}("Polygon"===i.type?[i.coordinates]:i.coordinates,r,n,o):null}function Fi(e){return"Point"===e||"MultiPoint"===e||"LineString"===e||"MultiLineString"===e||"Polygon"===e||"MultiPolygon"===e}function Bi(e){if(!wt(e)||"object"!=typeof e||null===e||Array.isArray(e))return null;const t=e;if("FeatureCollection"===t.type){if(0===t.features.length)return null;const e=[];for(const i of t.features){if(!Fi(i.geometry.type))return null;e.push(i.geometry)}return e}return"Feature"===t.type?Fi(t.geometry.type)?[t.geometry]:null:Fi(t.type)?[t]:null}class Distance{constructor(e){this.type=at,this.geojson=e}static parse(e,t){if(2!==e.length)return t.error(`\'distance\' expression requires either one argument, but found \' ${e.length-1} instead.`);const i=e[1],r=wt(i)&&!Array.isArray(i),n=t.parse(r?["literal",i]:i,1,ht);if(!n)return null;for(const[e,i]of[[["measure-light"],"brightness"],[["pitch"],"pitch"],[["distance-from-center"],"distance-from-center"]])if(!ei(n,e))return t.error(`\'distance\' expression may not depend on ${i}.`);return Kt(n)?n instanceof Literal&&!Bi(n.value)?t.error("\'distance\' expression needs to be an array with format [\'Distance\', GeoJSONObj]."):new Distance(n):t.error("\'distance\' expression may not depend on feature-state.")}evaluate(e){const t=Bi(this.geojson.evaluate(e));if(!t)return console.warn("Distance Expression: could not resolve a valid Point/LineString/Polygon GeoJSON geometry."),null;const i=e.geometry(),r=e.canonicalID();if(null==i||null==r)return console.warn("Distance Expression: requires valid feature and canonical information."),null;const n=e.geometryType(),o="Point"===n?Ci:"LineString"===n?Ri:"Polygon"===n?Li:null;if(!o)return console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries."),null;let a=1/0;for(const e of t){const t=o(i,r,e);if(null==t||isNaN(t))return t;if(0===(a=Math.min(a,t)))break}return a}eachChild(e){e(this.geojson)}outputDefined(){return!0}serialize(){return["distance",this.geojson.serialize()]}}class Var{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(2!==e.length||"string"!=typeof e[1])return t.error("\'var\' expression requires exactly one string literal argument.");const i=e[1];return t.scope.has(i)?new Var(i,t.scope.get(i)):t.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class ParsingContext{constructor(e,t=[],i,r=new Scope,n=[],o,a,s){this.registry=e,this.path=t,this.scope=r,this.errors=n,this.expectedType=i,this._scope=o,this.options=a,this.iconImageUseTheme=s}get key(){let e="";for(let t=0;t<this.path.length;t++){const i=this.path[t];e+="string"==typeof i?`[\'${i}\']`:`[${i}]`}return e}parse(e,t,i,r,n={}){if(t||i){const o=this.expectedType,a=this.scope;r&&(this.scope=this.scope.concat(r)),this.expectedType=i||null;const s="number"==typeof t;s&&this.path.push(t);const l=this._parse(e,n);return s&&this.path.pop(),this.expectedType=o,this.scope=a,l}return this._parse(e,n)}parseObjectValue(e,t,i,r,n,o={}){const a=this.expectedType,s=this.scope;n&&(this.scope=this.scope.concat(n)),this.expectedType=r||null,this.path.push(t),this.path.push(i);const l=this._parse(e,o);return this.path.pop(),this.path.pop(),this.expectedType=a,this.scope=s,l}_parse(e,t){if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error(\'Expected an array with at least one element. If you wanted a literal array, use ["literal", []].\');const i="string"==typeof e[0]&&Object.hasOwn(this.registry,e[0])?this.registry[e[0]]:void 0;if(i){let r=i.parse(e,this);if(!r)return null;if(this.expectedType){const e=this.expectedType,i=r.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==i.kind)if("color"!==e.kind&&"formatted"!==e.kind&&"resolvedImage"!==e.kind||"value"!==i.kind&&"string"!==i.kind){if(this.checkSubtype(e,i))return null}else r=Vi(r,e,t.typeAnnotation||"coerce");else r=Vi(r,e,t.typeAnnotation||"assert")}if(!(r instanceof Literal)&&"resolvedImage"!==r.type.kind&&ki(r)){const e=new EvaluationContext(this._scope,this.options,this.iconImageUseTheme);try{r=new Literal(r.type,r.evaluate(e))}catch(e){return this.error(e.message),null}}return r}return Coercion.parse(["to-array",e],this)}return this.error(void 0===e?"\'undefined\' value invalid. Use null instead.":"object"==typeof e?\'Bare objects invalid. Use ["literal", {...}] instead.\':`Expected an array, but found ${typeof e} instead.`)}concat(e,t,i,r){const n=r?this.scope.concat(r):this.scope,o=this.path.slice();return"number"==typeof e&&o.push(e),"string"==typeof t&&o.push(t),new ParsingContext(this.registry,o,i||null,n,this.errors,this._scope,this.options,this.iconImageUseTheme)}_forkForSignature(){return new ParsingContext(this.registry,this.path.slice(),null,this.scope,[],this._scope,this.options,this.iconImageUseTheme)}error(e,...t){const i=`${this.key}${t.map(e=>`[${e}]`).join("")}`;this.errors.push(new ParsingError(i,e))}checkSubtype(e,t,i){const r=yt(e,t);return r&&this.error(r,..."number"==typeof i?[i]:[]),r}}const Oi=new Set(["zoom","heatmap-density","worldview","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed","is-active-floor"]);function Vi(e,t,i){return"assert"===i?new Assertion(t,[e]):"coerce"===i?new Coercion(t,[e]):e}function ki(e){if(e instanceof Var)return ki(e.boundExpression);if(e instanceof CompoundExpression&&"error"===e.name)return!1;if(e instanceof CollatorExpression)return!1;if(e instanceof Within)return!1;if(e instanceof Distance)return!1;if(e instanceof Config)return!1;const t=e instanceof Coercion||e instanceof Assertion;let i=!0;return e.eachChild(e=>{i=t?i&&ki(e):i&&e instanceof Literal}),!!i&&Jt(e)&&Qt(e,Oi)}function Ni(e,t){const i=e.length-1;let r,n,o=0,a=i,s=0;for(;o<=a;)if(s=Math.floor((o+a)/2),r=e[s],n=e[s+1],r<=t){if(s===i||t<n)return s;o=s+1}else{if(!(r>t))throw new RuntimeError("Input is not a number.");a=s-1}return 0}class Step{constructor(e,t,i){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[e,t]of i)this.labels.push(e),this.outputs.push(t)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");const i=t.parse(e[1],1,at);if(!i)return null;const r=[];let n=null;t.expectedType&&"value"!==t.expectedType.kind&&(n=t.expectedType);for(let i=1;i<e.length;i+=2){const o=1===i?-1/0:e[i],a=e[i+1],s=i,l=i+1;if("number"!=typeof o)return t.error(\'Input/output pairs for "step" expressions must be defined using literal numeric values (not c
2omputed expressions) for the input values.\',s);if(r.length&&r.at(-1)[0]>=o)return t.error(\'Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.\',s);const u=t.parse(a,l,n);if(!u)return null;n=n||u.type,r.push([o,u])}return new Step(n,i,r)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const r=this.input.evaluate(e);if(r<=t[0])return i[0].evaluate(e);const n=t.length;return r>=t[n-1]?i[n-1].evaluate(e):i[Ni(t,r)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){const e=["step",this.input.serialize()];for(let t=0;t<this.labels.length;t++)t>0&&e.push(this.labels[t]),e.push(this.outputs[t].serialize());return e}}var Ui=Object.freeze({__proto__:null,array:function(e,t,i){return e.map((e,r)=>rt(e,t[r],i))},color:function(e,t,i){return new Color(rt(e.r,t.r,i),rt(e.g,t.g,i),rt(e.b,t.b,i),rt(e.a,t.a,i))},number:rt});const Gi=.95047,ji=1.08883,Hi=4/29,$i=6/29,Wi=3*$i*$i,Xi=$i*$i*$i,qi=Math.PI/180,Zi=180/Math.PI;function Yi(e){return e>Xi?Math.pow(e,1/3):e/Wi+Hi}function Ji(e){return e>$i?e*e*e:Wi*(e-Hi)}function Ki(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function Qi(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function er(e){const t=Qi(e.r),i=Qi(e.g),r=Qi(e.b),n=Yi((.4124564*t+.3575761*i+.1804375*r)/Gi),o=Yi((.2126729*t+.7151522*i+.072175*r)/1);return{l:116*o-16,a:500*(n-o),b:200*(o-Yi((.0193339*t+.119192*i+.9503041*r)/ji)),alpha:e.a}}function tr(e){let t=(e.l+16)/116,i=isNaN(e.a)?t:t+e.a/500,r=isNaN(e.b)?t:t-e.b/200;return t=1*Ji(t),i=Gi*Ji(i),r=ji*Ji(r),new Color(Ki(3.2404542*i-1.5371385*t-.4985314*r),Ki(-.969266*i+1.8760108*t+.041556*r),Ki(.0556434*i-.2040259*t+1.0572252*r),e.alpha)}function ir(e,t,i){const r=t-e;return e+i*(r>180||r<-180?r-360*Math.round(r/360):r)}const rr={forward:er,reverse:tr,interpolate:function(e,t,i){return{l:rt(e.l,t.l,i),a:rt(e.a,t.a,i),b:rt(e.b,t.b,i),alpha:rt(e.alpha,t.alpha,i)}}},nr={forward:function(e){const{l:t,a:i,b:r}=er(e),n=Math.atan2(r,i)*Zi;return{h:n<0?n+360:n,c:Math.sqrt(i*i+r*r),l:t,alpha:e.a}},reverse:function(e){const t=e.h*qi,i=e.c;return tr({l:e.l,a:Math.cos(t)*i,b:Math.sin(t)*i,alpha:e.alpha})},interpolate:function(e,t,i){return{h:ir(e.h,t.h,i),c:rt(e.c,t.c,i),l:rt(e.l,t.l,i),alpha:rt(e.alpha,t.alpha,i)}}};var or=Object.freeze({__proto__:null,hcl:nr,lab:rr});class Interpolate{constructor(e,t,i,r,n){this.type=e,this.operator=t,this.interpolation=i,this.input=r,this.labels=[],this.outputs=[];for(const[e,t]of n)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,t,i,r){let n=0;if("exponential"===e.name)n=ar(t,e.base,i,r);else if("linear"===e.name)n=ar(t,1,i,r);else if("cubic-bezier"===e.name){const o=e.controlPoints,a=function(e,t,i,r){const n=3*e,o=3*(i-e)-n,a=1-n-o,s=3*t,l=3*(r-t)-s,u=1-s-l;return function(e,t=1e-6){if(e<=0)return 0;if(e>=1)return 1;let i=e;for(let r=0;r<8;r++){const r=((a*i+o)*i+n)*i-e;if(Math.abs(r)<t)return((u*i+l)*i+s)*i;const c=(3*a*i+2*o)*i+n;if(Math.abs(c)<1e-6)break;i-=r/c}let r=0,c=1;i=e;for(let s=0;s<20;s++){const s=((a*i+o)*i+n)*i;if(Math.abs(s-e)<t)break;e>s?r=i:c=i,i=.5*(r+c)}return((u*i+l)*i+s)*i}}(o[0],o[1],o[2],o[3]);n=a(ar(t,1,i,r))}return n}static parse(e,t){let[i,r,n,...o]=e;if(!Array.isArray(r)||0===r.length)return t.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){const e=r[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:e}}else{if("cubic-bezier"!==r[0])return t.error(`Unknown interpolation type ${String(r[0])}`,1,0);{const e=r.slice(1);if(4!==e.length||e.some(e=>"number"!=typeof e||e<0||e>1))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:e}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length-1>3&&(e.length-1)%2!=0)return t.error("Expected an even number of arguments.");if(n=t.parse(n,2,at),!n)return null;const a=[];let s=null;"interpolate-hcl"===i||"interpolate-lab"===i?s=ut:t.expectedType&&"value"!==t.expectedType.kind&&(s=t.expectedType);for(let e=0;e<o.length;e+=2){const i=o[e],r=o[e+1],n=e+3,l=e+4;if("number"!=typeof i)return t.error(\'Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not c
2omputed expressions) for the input values.\',n);if(a.length&&a.at(-1)[0]>=i)return t.error(\'Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.\',n);const u=t.parse(r,l,s);if(!u)return null;s=s||u.type,a.push([i,u])}return"number"===s.kind||"color"===s.kind||"array"===s.kind&&"number"===s.itemType.kind&&"number"==typeof s.N?new Interpolate(s,i,r,n,a):t.error(`Type ${_t(s)} is not interpolatable.`)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const r=this.input.evaluate(e);if(r<=t[0])return i[0].evaluate(e);const n=t.length;if(r>=t[n-1])return i[n-1].evaluate(e);const o=Ni(t,r),a=Interpolate.interpolationFactor(this.interpolation,r,t[o],t[o+1]),s=i[o].evaluate(e),l=i[o+1].evaluate(e);return"interpolate"===this.operator?Ui[this.type.kind.toLowerCase()](s,l,a):"interpolate-hcl"===this.operator?nr.reverse(nr.interpolate(nr.forward(s),nr.forward(l),a)):rr.reverse(rr.interpolate(rr.forward(s),rr.forward(l),a))}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e;e="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];const t=[this.operator,e,this.input.serialize()];for(let e=0;e<this.labels.length;e++)t.push(this.labels[e],this.outputs[e].serialize());return t}}function ar(e,t,i,r){const n=r-i,o=e-i;return 0===n?0:1===t?o/n:(Math.pow(t,o)-1)/(Math.pow(t,n)-1)}class Coalesce{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expectected at least one argument."),null;let i=null;const r=t.expectedType;r&&"value"!==r.kind&&(i=r);const n=[];for(const r of e.slice(1)){const e=t.parse(r,1+n.length,i,void 0,{typeAnnotation:"omit"});if(!e)return null;i=i||e.type,n.push(e)}const o=r&&n.some(e=>yt(r,e.type));return new Coalesce(o?ht:i,n)}evaluate(e){let t,i=null,r=0;for(const n of this.args){if(r++,i=n.evaluate(e),i&&i instanceof ResolvedImage&&!i.available&&(t||(t=i),i=null,r===this.args.length))return t;if(null!==i)break}return i}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=["coalesce"];return this.eachChild(t=>{e.push(t.serialize())}),e}}const sr=/[^a-zA-Z0-9_]/;class Let{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const i=[];for(let r=1;r<e.length-1;r+=2){const n=e[r];if("string"!=typeof n)return t.error(`Expected string, but found ${typeof n} instead.`,r);if(sr.test(n))return t.error("Variable names must contain only alphanumeric characters or \'_\'.",r);const o=t.parse(e[r+1],r+1);if(!o)return null;i.push([n,o])}const r=t.parse(e.at(-1),e.length-1,t.expectedType,i);return r?new Let(i,r):null}outputDefined(){return this.result.outputDefined()}serialize(){const e=["let"];for(const[t,i]of this.bindings)e.push(t,i.serialize());return e.push(this.result.serialize()),e}}class At{constructor(e,t,i){this.type=e,this.index=t,this.input=i}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,at),r=t.parse(e[2],2,mt(t.expectedType||ht));return i&&r?new At(r.type.itemType,i,r):null}evaluate(e){const t=this.index.evaluate(e),i=this.input.evaluate(e);if(t<0)throw new RuntimeError("Array index out of bounds: negative index");if(t>=i.length)throw new RuntimeError("Array index out of bounds: index exceeds array size");if(t!==Math.floor(t))throw new RuntimeError("Array index must be an integer. Use at-interpolated for fractional indices");return i[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class AtInterpolated{constructor(e,t,i){this.type=e,this.index=t,this.input=i}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,at),r=t.parse(e[2],2,mt(t.expectedType||ht));return i&&r?new AtInterpolated(r.type.itemType,i,r):null}evaluate(e){const t=this.index.evaluate(e),i=this.input.evaluate(e);if(t<0)throw new RuntimeError(`Array index out of bounds: ${t} < 0.`);if(t>i.length-1)throw new RuntimeError(`Array index out of bounds: ${t} > ${i.length-1}.`);if(t===Math.floor(t))return i[t];const r=Math.floor(t),n=Math.ceil(t),o=i[r],a=i[n];if("number"!=typeof o||"number"!=typeof a)throw new RuntimeError(`Cannot interpolate between non-number values at index ${t}.`);return rt(o,a,t-r)}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class Match{constructor(e,t,i,r,n,o){this.inputType=e,this.type=t,this.input=i,this.cases=r,this.outputs=n,this.otherwise=o}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error("Expected an even number of arguments.");let i,r;t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);const n={},o=[];for(let a=2;a<e.length-1;a+=2){let s=e[a];const l=e[a+1];if(Array.isArray(s)||(s=[s]),0===s.length)return t.error("Expected at least one branch label.",a);for(const e of s){if("number"!=typeof e&&"string"!=typeof e)return t.error("Branch labels must be numbers or strings.",a);if("number"==typeof e&&Math.abs(e)>Number.MAX_SAFE_INTEGER)return t.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`,a);if("number"==typeof e&&Math.floor(e)!==e)return t.error("Numeric branch labels must be integer values.",a);if(i){if(t.checkSubtype(i,Et(e),a))return null}else i=Et(e);if(void 0!==n[String(e)])return t.error("Branch labels must be unique.",a);n[String(e)]=o.length}const u=t.parse(l,a,r);if(!u)return null;r=r||u.type,o.push(u)}const a=t.parse(e[1],1,ht);if(!a)return null;const s=t.parse(e.at(-1),e.length-1,r);return s?"value"!==a.type.kind&&t.checkSubtype(i,a.type,1)?null:new Match(i,r,a,n,o,s):null}evaluate(e){const t=this.input.evaluate(e);return(vt(Et(t),this.inputType)&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}
vendor: 9,565 bytes, line 2
2eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["match",this.input.serialize()],t=Object.keys(this.cases).sort(),i=[],r={};for(const e of t){const t=r[this.cases[e]];void 0===t?(r[this.cases[e]]=i.length,i.push([this.cases[e],[e]])):i[t][1].push(e)}const n=e=>"number"===this.inputType.kind?Number(e):e;for(const[t,r]of i)e.push(1===r.length?n(r[0]):r.map(n)),e.push(this.outputs[t].serialize());return e.push(this.otherwise.serialize()),e}}class Case{constructor(e,t,i){this.type=e,this.branches=t,this.otherwise=i}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`),null;if(e.length%2!=0)return t.error("Expected an odd number of arguments."),null;let i;t.expectedType&&"value"!==t.expectedType.kind&&(i=t.expectedType);const r=[];for(let n=1;n<e.length-1;n+=2){const o=t.parse(e[n],n,lt);if(!o)return null;const a=t.parse(e[n+1],n+1,i);if(!a)return null;r.push([o,a]),i=i||a.type}const n=t.parse(e.at(-1),e.length-1,i);return n?new Case(i,r,n):null}evaluate(e){for(const[t,i]of this.branches)if(t.evaluate(e))return i.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[t,i]of this.branches)e(t),e(i);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild(t=>{e.push(t.serialize())}),e}}class Slice{constructor(e,t,i,r){this.type=e,this.input=t,this.beginIndex=i,this.endIndex=r}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`),null;const i=t.parse(e[1],1,ht),r=t.parse(e[2],2,at);if(!i||!r)return null;if(n=i.type,![mt(ht),st,ht].some(e=>e.kind===n.kind))return t.error(`Expected first argument to be of type array or string, but found ${_t(i.type)} instead`),null;var n;if(4===e.length){const n=t.parse(e[3],3,at);return n?new Slice(i.type,i,r,n):null}return new Slice(i.type,i,r)}evaluate(e){const t=this.input.evaluate(e),i=this.beginIndex.evaluate(e);if(!xt(t,["string","array"]))throw new RuntimeError(`Expected first argument to be of type array or string, but found ${_t(Et(t))} instead.`);if(this.endIndex){const r=this.endIndex.evaluate(e);return t.slice(i,r)}return t.slice(i)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function lr(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function ur(e,t,i,r){return 0===r.compare(t,i)}function cr(e,t,i){const r="=="!==e&&"!="!==e;return class Comparison{constructor(e,t,i){this.type=lt,this.lhs=e,this.rhs=t,this.collator=i,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");const i=e[0];let n=t.parse(e[1],1,ht);if(!n)return null;if(!lr(i,n.type))return t.error(`"${i}" comparisons are not supported for type \'${_t(n.type)}\'.`,1);let o=t.parse(e[2],2,ht);if(!o)return null;if(!lr(i,o.type))return t.error(`"${i}" comparisons are not supported for type \'${_t(o.type)}\'.`,2);if(n.type.kind!==o.type.kind&&"value"!==n.type.kind&&"value"!==o.type.kind)return t.error(`Cannot compare types \'${_t(n.type)}\' and \'${_t(o.type)}\'.`);r&&("value"===n.type.kind&&"value"!==o.type.kind?n=new Assertion(o.type,[n]):"value"!==n.type.kind&&"value"===o.type.kind&&(o=new Assertion(n.type,[o])));let a=null;if(4===e.length){if("string"!==n.type.kind&&"string"!==o.type.kind&&"value"!==n.type.kind&&"value"!==o.type.kind)return t.error("Cannot use collator to compare non-string types.");if(a=t.parse(e[3],3,dt),!a)return null}return new Comparison(n,o,a)}evaluate(n){const o=this.lhs.evaluate(n),a=this.rhs.evaluate(n);if(r&&this.hasUntypedArgument){const t=Et(o),i=Et(a);if(t.kind!==i.kind||"string"!==t.kind&&"number"!==t.kind)throw new RuntimeError(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${i.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){const e=Et(o),i=Et(a);if("string"!==e.kind||"string"!==i.kind)return t(n,o,a)}return this.collator?i(n,o,a,this.collator.evaluate(n)):t(n,o,a)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}serialize(){const t=[e];return this.eachChild(e=>{t.push(e.serialize())}),t}}}const hr=cr("==",function(e,t,i){return t===i},ur),dr=cr("!=",function(e,t,i){return t!==i},function(e,t,i,r){return!ur(0,t,i,r)}),pr=cr("<",function(e,t,i){return t<i},function(e,t,i,r){return r.compare(t,i)<0}),fr=cr(">",function(e,t,i){return t>i},function(e,t,i,r){return r.compare(t,i)>0}),mr=cr("<=",function(e,t,i){return t<=i},function(e,t,i,r){return r.compare(t,i)<=0}),_r=cr(">=",function(e,t,i){return t>=i},function(e,t,i,r){return r.compare(t,i)>=0});class NumberFormat{constructor(e,t,i,r,n,o){this.type=st,this.number=e,this.locale=t,this.currency=i,this.unit=r,this.minFractionDigits=n,this.maxFractionDigits=o}static parse(e,t){if(3!==e.length)return t.error("Expected two arguments.");const i=t.parse(e[1],1,at);if(!i)return null;const r=e[2];if("object"!=typeof r||Array.isArray(r))return t.error("NumberFormat options argument must be an object.");let n=null;if(r.locale&&(n=t.parseObjectValue(r.locale,2,"locale",st),!n))return null;let o=null;if(r.currency&&(o=t.parseObjectValue(r.currency,2,"currency",st),!o))return null;let a=null;if(r.unit&&(a=t.parseObjectValue(r.unit,2,"unit",st),!a))return null;let s=null;if(void 0!==r["min-fraction-digits"]&&(s=t.parseObjectValue(r["min-fraction-digits"],2,"min-fraction-digits",at),!s))return null;let l=null;return void 0===r["max-fraction-digits"]||(l=t.parseObjectValue(r["max-fraction-digits"],2,"max-fraction-digits",at),l)?new NumberFormat(i,n,o,a,s,l):null}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class Length{constructor(e){this.type=at,this.input=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`),null;const i=t.parse(e[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?(t.error(`Expected argument of type string or array, but found ${_t(i.type)} instead.`),null):new Length(i):null}evaluate(e){const t=this.input.evaluate(e);if("string"==typeof t)return t.length;if(Array.isArray(t))return t.length;throw new RuntimeError(`Expected value to be of type string or array, but found ${_t(Et(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild(t=>{e.push(t.serialize())}),e}}function gr(e){return function(){e=1831565813+(e|=0)|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}const yr={"==":hr,"!=":dr,">":fr,"<":pr,">=":_r,"<=":mr,array:Assertion,at:At,"at-interpolated":AtInterpolated,boolean:Assertion,case:Case,coalesce:Coalesce,collator:CollatorExpression,format:FormatExpression,image:ImageExpression,interpolate:Interpolate,"interpolate-hcl":Interpolate,"interpolate-lab":Interpolate,length:Length,let:Let,literal:Literal,match:Match,number:Assertion,"number-format":NumberFormat,object:Assertion,slice:Slice,step:Step,string:Assertion,"to-boolean":Coercion,"to-color":Coercion,"to-number":Coercion,"to-string":Coercion,var:Var,within:Within,distance:Distance,config:Config};function xr(e,[t,i,r,n]){t=t.evaluate(e),i=i.evaluate(e),r=r.evaluate(e);const o=n?n.evaluate(e):1,a=bt(t,i,r,o);if(a)throw new RuntimeError(a);return new Color(t/255,i/255,r/255,o)}function vr(e,[t,i,r,n]){t=t.evaluate(e),i=i.evaluate(e),r=r.evaluate(e);const o=n?n.evaluate(e):1,a=function(e,t,i,r){return"number"==typeof e&&e>=0&&e<=360?"number"==typeof t&&t>=0&&t<=100&&"number"==typeof i&&i>=0&&i<=100?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:`Invalid hsla value [${[e,t,i,r].join(", ")}]: \'a\' must be between 0 and 1.`:`Invalid hsla value [${("number"==typeof r?[e,t,i,r]:[e,t,i]).join(", ")}]: \'s\', and \'l\' must be between 0 and 100.`:`Invalid hsla value [${("number"==typeof r?[e,t,i,r]:[e,t,i]).join(", ")}]: \'h\
vendor: 14,680 bytes, line 2
2' must be between 0 and 360.`}(t,i,r,o);if(a)throw new RuntimeError(a);const s=`hsla(${t}, ${i}%, ${r}%, ${o})`,l=Color.parse(s);if(!l)throw new RuntimeError(`Failed to parse HSLA color: ${s}`);return l}function br(e,t){return e in t}function wr(e,t){const i=t[e];return void 0===i?null:i}function Ar(e){return{type:e}}function Er(e,t){if(!xt(e,["boolean","string","number","null"]))throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${_t(Et(e))} instead.`);if(!xt(t,["string","array"]))throw new RuntimeError(`Expected second argument to be of type array or string, but found ${_t(Et(t))} instead.`)}function Ir(e){if(e instanceof Config)return new Set([e.key]);let t=new Set;return e.eachChild(e=>{t=new Set([...t,...Ir(e)])}),t}function Sr(e){if(e instanceof CompoundExpression&&"is-active-floor"===e.name)return!0;let t=!1;return e.eachChild(e=>{!t&&Sr(e)&&(t=!0)}),t}function Dr(e){return{result:"success",value:e}}function Pr(e){return{result:"error",value:e}}function Tr(e,t){return!!e&&!!e.parameters&&e.parameters.includes(t)}function zr(e){return"data-driven"===e["property-type"]}function Mr(e){return!!e.expression&&e.expression.interpolated}function Cr(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function Rr(e){return e}function Lr(e,t){const i="color"===t.type,r=e.stops&&"object"==typeof e.stops[0][0],n=r||!(r||void 0!==e.property),o=e.type||(Mr(t)?"exponential":"interval");if(i&&((e={...e}).stops&&(e.stops=e.stops.map(e=>[e[0],Color.parse(e[1])])),e.default=Color.parse(e.default?e.default:t.default)),e.colorSpace&&"rgb"!==e.colorSpace&&!or[e.colorSpace])throw new Error(`Unknown color space: ${e.colorSpace}`);let a,s,l;if("exponential"===o)a=Vr;else if("interval"===o)a=Or;else if("categorical"===o){a=Br,s=Object.create(null);for(const t of e.stops)s[t[0]]=t[1];l=typeof e.stops[0][0]}else{if("identity"!==o)throw new Error(`Unknown function type "${o}"`);a=kr}if(r){const i={},r=[];for(let t=0;t<e.stops.length;t++){const n=e.stops[t],o=n[0].zoom;void 0===i[o]&&(i[o]={zoom:o,type:e.type,property:e.property,default:e.default,stops:[]},r.push(o)),i[o].stops.push([n[0].value,n[1]])}const n=[];for(const e of r)n.push([i[e].zoom,Lr(i[e],t)]);const o={name:"linear"};return{kind:"composite",interpolationType:o,interpolationFactor:Interpolate.interpolationFactor.bind(void 0,o),zoomStops:n.map(e=>e[0]),evaluate:({zoom:i},r)=>Vr({stops:n,base:e.base},t,i).evaluate(i,r)}}if(n){const i="exponential"===o?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:i,interpolationFactor:Interpolate.interpolationFactor.bind(void 0,i),zoomStops:e.stops.map(e=>e[0]),evaluate:({zoom:i})=>a(e,t,i,s,l)}}return{kind:"source",evaluate(i,r){const n=r&&r.properties?r.properties[e.property]:void 0;return void 0===n?Fr(e.default,t.default):a(e,t,n,s,l)}}}function Fr(e,t,i){return void 0!==e?e:void 0!==t?t:void 0!==i?i:void 0}function Br(e,t,i,r,n){return Fr(typeof i===n?r[i]:void 0,e.default,t.default)}function Or(e,t,i){if(!Pt(i))return Fr(e.default,t.default);const r=e.stops.length;if(1===r)return e.stops[0][1];if(i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[r-1][0])return e.stops[r-1][1];const n=Ni(e.stops.map(e=>e[0]),i);return e.stops[n][1]}function Vr(e,t,i){const r=void 0!==e.base?e.base:1;if(!Pt(i))return Fr(e.default,t.default);const n=e.stops.length;if(1===n)return e.stops[0][1];if(i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[n-1][0])return e.stops[n-1][1];const o=Ni(e.stops.map(e=>e[0]),i),a=function(e,t,i,r){const n=r-i,o=e-i;return 0===n?0:1===t?o/n:(Math.pow(t,o)-1)/(Math.pow(t,n)-1)}(i,r,e.stops[o][0],e.stops[o+1][0]),s=e.stops[o][1],l=e.stops[o+1][1];let u=Ui[t.type]||Rr;if(e.colorSpace&&"rgb"!==e.colorSpace){const t=or[e.colorSpace];u=(e,i)=>t.reverse(t.interpolate(t.forward(e),t.forward(i),a))}return"function"==typeof s.evaluate?{evaluate(...e){const t=s.evaluate.apply(void 0,e),i=l.evaluate.apply(void 0,e);if(void 0!==t&&void 0!==i)return u(t,i,a)}}:u(s,l,a)}function kr(e,t,i){return"color"===t.type?i=Color.parse(i):"formatted"===t.type?i=Formatted.fromString(i.toString()):"resolvedImage"===t.type?i=ResolvedImage.build(i.toString()):Dt(i)===t.type||"enum"===t.type&&t.values[i]||(i=void 0),Fr(i,e.default,t.default)}CompoundExpression.register(yr,{error:[{kind:"error"},[st],(e,[t])=>{throw new RuntimeError(t.evaluate(e))}],typeof:[st,[ht],(e,[t])=>_t(Et(t.evaluate(e)))],"to-rgba":[mt(at,4),[ut],(e,[t])=>t.evaluate(e).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[mt(at,4),[ut],(e,[t])=>t.evaluate(e).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[ut,[at,at,at],xr],rgba:[ut,[at,at,at,at],xr],hsl:[ut,[at,at,at],vr],hsla:[ut,[at,at,at,at],vr],has:{type:lt,overloads:[[[st],(e,[t])=>br(t.evaluate(e),e.properties())],[[st,ct],(e,[t,i])=>br(t.evaluate(e),i.evaluate(e))]]},get:{type:ht,overloads:[[[st],(e,[t])=>wr(t.evaluate(e),e.properties())],[[st,ct],(e,[t,i])=>wr(t.evaluate(e),i.evaluate(e))]]},"feature-state":[ht,[st],(e,[t])=>wr(t.evaluate(e),e.featureState||{})],properties:[ct,[],e=>e.properties()],"geometry-type":[st,[],e=>e.geometryType()],worldview:[st,[],e=>e.globals.worldview||""],"is-active-floor":[lt,Ar(st),(e,t)=>{if(!(e.globals&&e.globals.activeFloors&&e.globals.activeFloors.size>0))return!1;if(0===t.length)return!0;const i=e.globals.activeFloors;return t.some(t=>{const r=t.evaluate(e);return i.has(r)})}],id:[ht,[],e=>e.id()],zoom:[at,[],e=>e.globals.zoom],pitch:[at,[],e=>e.globals.pitch||0],"distance-from-center":[at,[],e=>e.distanceFromCenter()],"measure-light":[at,[st],(e,[t])=>e.measureLight(t.evaluate(e))],"heatmap-density":[at,[],e=>e.globals.heatmapDensity||0],"line-progress":[at,[],e=>e.globals.lineProgress||0],"raster-value":[at,[],e=>e.globals.rasterValue||0],"raster-particle-speed":[at,[],e=>e.globals.rasterParticleSpeed||0],"sky-radial-progress":[at,[],e=>e.globals.skyRadialProgress||0],accumulated:[ht,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[at,Ar(at),(e,t)=>{let i=0;for(const r of t)i+=r.evaluate(e);return i}],"*":[at,Ar(at),(e,t)=>{let i=1;for(const r of t)i*=r.evaluate(e);return i}],"-":{type:at,overloads:[[[at,at],(e,[t,i])=>t.evaluate(e)-i.evaluate(e)],[[at],(e,[t])=>-t.evaluate(e)]]},"/":[at,[at,at],(e,[t,i])=>t.evaluate(e)/i.evaluate(e)],"%":[at,[at,at],(e,[t,i])=>t.evaluate(e)%i.evaluate(e)],ln2:[at,[],()=>Math.LN2],pi:[at,[],()=>Math.PI],e:[at,[],()=>Math.E],"^":[at,[at,at],(e,[t,i])=>Math.pow(t.evaluate(e),i.evaluate(e))],sqrt:[at,[at],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[at,[at],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[at,[at],(e,[t])=>Math.log(t.evaluate(e))],log2:[at,[at],(e,[t])=>Math.log2(t.evaluate(e))],sin:[at,[at],(e,[t])=>Math.sin(t.evaluate(e))],cos:[at,[at],(e,[t])=>Math.cos(t.evaluate(e))],tan:[at,[at],(e,[t])=>Math.tan(t.evaluate(e))],asin:[at,[at],(e,[t])=>Math.asin(t.evaluate(e))],acos:[at,[at],(e,[t])=>Math.acos(t.evaluate(e))],atan:[at,[at],(e,[t])=>Math.atan(t.evaluate(e))],min:[at,Ar(at),(e,t)=>Math.min(...t.map(t=>t.evaluate(e)))],max:[at,Ar(at),(e,t)=>Math.max(...t.map(t=>t.evaluate(e)))],abs:[at,[at],(e,[t])=>Math.abs(t.evaluate(e))],round:[at,[at],(e,[t])=>{const i=t.evaluate(e);return i<0?-Math.round(-i):Math.round(i)}],floor:[at,[at],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[at,[at],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[lt,[st,ht],(e,[t,i])=>e.properties()[t.value]===i.value],"filter-id-==":[lt,[ht],(e,[t])=>e.id()===t.value],"filter-type-==":[lt,[st],(e,[t])=>e.geometryType()===t.value],"filter-<":[lt,[st,ht],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r<n}],"filter-id-<":[lt,[ht],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i<r}],"filter->":[lt,[st,ht],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>n}],"filter-id->":[lt,[ht],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i>r}],"filter-<=":[lt,[st,ht],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r<=n}],"filter-id-<=":[lt,[ht],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i<=r}],"filter->=":[lt,[st,ht],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>=n}],"filter-id->=":[lt,[ht],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i>=r}],"filter-has":[lt,[ht],(e,[t])=>t.value in e.properties()],"filter-has-id":[lt,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[lt,[mt(st)],(e,[t])=>t.value.includes(e.geometryType())],"filter-id-in":[lt,[mt(ht)],(e,[t])=>t.value.includes(e.id())],"filter-in-small":[lt,[st,mt(ht)],(e,[t,i])=>i.value.includes(e.properties()[t.value])],"filter-in-large":[lt,[st,mt(ht)],(e,[t,i])=>function(e,t,i,r){for(;i<=r;){const n=i+r>>1;if(t[n]===e)return!0;t[n]>e?r=n-1:i=n+1}return!1}(e.properties()[t.value],i.value,0,i.value.length-1)],all:{type:lt,overloads:[[[lt,lt],(e,[t,i])=>t.evaluate(e)&&i.evaluate(e)],[Ar(lt),(e,t)=>{for(const i of t)if(!i.evaluate(e))return!1;return!0}]]},any:{type:lt,overloads:[[[lt,lt],(e,[t,i])=>t.evaluate(e)||i.evaluate(e)],[Ar(lt),(e,t)=>{for(const i of t)if(i.evaluate(e))return!0;return!1}]]},"!":[lt,[lt],(e,[t])=>!t.evaluate(e)],"is-supported-script":[lt,[st],(e,[t])=>{const i=e.globals&&e.globals.isSupportedScript;return!i||i(t.evaluate(e))}],upcase:[st,[st],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[st,[st],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[st,Ar(ht),(e,t)=>t.map(t=>It(t.evaluate(e))).join("")],split:[mt(st),[st,st],(e,[t,i])=>t.evaluate(e).split(i.evaluate(e))],in:[lt,[ht,ht],(e,[t,i])=>{const r=t.evaluate(e),n=i.evaluate(e);return null!=n&&(Er(r,n),n.includes(r))}],"index-of":{type:at,overloads:[[[ht,ht],(e,[t,i])=>{const r=t.evaluate(e),n=i.evaluate(e);return Er(r,n),n.indexOf(r)}],[[ht,ht,at],(e,[t,i,r])=>{const n=t.evaluate(e),o=i.evaluate(e),a=r.evaluate(e);return Er(n,o),o.indexOf(n,a)}]]},"resolved-locale":[st,[dt],(e,[t])=>t.evaluate(e).resolvedLocale()],random:[at,[at,at,ht],(e,t)=>{const[i,r,n]=t.map(t=>t.evaluate(e));if(i>r)return i;if(i===r)return i;let o;if("string"==typeof n)o=function(e){let t=0;if(0===e.length)return t;for(let i=0;i<e.length;i++)t=(t<<5)-t+e.charCodeAt(i),t&=t;return t}(n);else{if("number"!=typeof n)throw new RuntimeError(`Invalid seed input: ${n}`);o=n}return i+gr(o)()*(r-i)}]});class StyleExpression{constructor(e,t,i,r,n){this.expression=e,this._warningHistory={},this._scope=i,this._options=r,this._iconImageUseTheme=n,this._evaluator=new EvaluationContext(i,r,n),this._defaultValue=t?function(e){return"color"===e.type&&(Cr(e.default)||Array.isArray(e.default))?new Color(0,0,0,0):"color"===e.type?Color.parse(e.default)||null:void 0===e.default?null:e.default}(t):null,this._enumValues=t&&"enum"===t.type?t.values:null,this.configDependencies=Ir(e),this.isIndoorDependent=Sr(e)}evaluateWithoutErrorHandling(e,t,i,r,n,o,a,s){const l=this._evaluator;return l.globals=e,l.feature=t,l.featureState=i,l.canonical=r||null,l.availableImages=n||null,l.formattedSection=o,l.featureTileCoord=a||null,l.featureDistanceData=s||null,this.expression.evaluate(l)}evaluate(e,t,i,r,n,o,a,s,l){this._evaluator||(this._evaluator=new EvaluationContext(this._scope,this._options,this._iconImageUseTheme)),this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=i||null,this._evaluator.canonical=r||null,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o||null,this._evaluator.featureTileCoord=a||null,this._evaluator.featureDistanceData=s||null,this._evaluator.iconImageUseTheme=l||null;try{const e=this.expression.evaluate(this._evaluator);if(null==e||"number"==typeof e&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new RuntimeError(`Expected value to be one of ${Object.keys(this._enumValues).map(e=>JSON.stringify(e)).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){const t=e;return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${t.message}`)),this._defaultValue}}}function Nr(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&Object.hasOwn(yr,e[0])}function Ur(e,t,i,r,n){const o=new ParsingContext(yr,[],t?function(e){const t={color:ut,string:st,number:at,enum:st,boolean:lt,formatted:pt,resolvedImage:ft,object:ct};return"array"===e.type?mt(t[e.value]||ht,e.length):t[e.type]}(t):void 0,void 0,void 0,i,r,n),a=o.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return a?Dr(new StyleExpression(a,t,i,r,n)):Pr(o.errors)}class ZoomConstantExpression{constructor(e,t,i,r){this.kind=e,this._styleExpression=t,this.isLightConstant=i,this.isLineProgressConstant=r,this.isStateDependent="constant"!==e&&!Kt(t.expression),this.configDependencies=Ir(t.expression),this.isIndoorDependent=Sr(t.expression)}evaluateWithoutErrorHandling(e,t,i,r,n,o){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,o)}evaluate(e,t,i,r,n,o,a){return this._styleExpression.evaluate(e,t,i,r,n,o,void 0,void 0,a)}}class ZoomDependentExpression{constructor(e,t,i,r,n,o){this.kind=e,this.zoomStops=i,this._styleExpression=t,this.isStateDependent="camera"!==e&&!Kt(t.expression),this.isIndoorDependent=Sr(t.expression),this.isLightConstant=n,this.isLineProgressConstant=o,this.configDependencies=Ir(t.expression),this.interpolationType=r}evaluateWithoutErrorHandling(e,t,i,r,n,o){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,o)}evaluate(e,t,i,r,n,o){return this._styleExpression.evaluate(e,t,i,r,n,o)}interpolationFactor(e,t,i){return this.interpolationType?Interpolate.interpolationFactor(this.interpolationType,e,t,i):0}}function Gr(e,t,i,r,n){if("error"===(e=Ur(e,t,i,r,n)).result)return e;const o=e.value.expression,a=Jt(o);if(!a&&!zr(t))return Pr([new ParsingError("","data expressions not supported")]);const s=ei(o,["zoom","pitch","distance-from-center"]);if(!s&&!function(e){return Tr(e.expression,"zoom")}(t))return Pr([new ParsingError("","zoom expressions not supported")]);const l=ei(o,["measure-light"]);if(!l&&!function(e){return Tr(e.expression,"measure-light")}(t))return Pr([new ParsingError("","measure-light expression not supported")]);const u=ei(o,["line-progress"]);if(!u&&!function(e){return Tr(e.expression,"line-progress")}(t))return Pr([new ParsingError("","line-progress expression not supported")]);const c=t.expression&&t.expression.relaxZoomRestriction,h=jr(o);return h||s||c?h instanceof ParsingError?Pr([h]):h instanceof Interpolate&&!Mr(t)?Pr([new ParsingError("",
2\'"interpolate" expressions cannot be used with this property\')]):Dr(h?new ZoomDependentExpression(a&&u?"camera":"composite",e.value,h.labels,h instanceof Interpolate?h.interpolation:void 0,l,u):new ZoomConstantExpression(a&&u?"constant":"source",e.value,l,u)):Pr([new ParsingError("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.\')])}class StylePropertyFunction{constructor(e,t){this._parameters=e,this._specification=t,Object.assign(this,Lr(this._parameters,this._specification))}static deserialize(e){return new StylePropertyFunction(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function jr(e){let t=null;if(e instanceof Let)t=jr(e.result);else if(e instanceof Coalesce){for(const i of e.args)if(t=jr(i),t)break}else(e instanceof Step||e instanceof Interpolate)&&e.input instanceof CompoundExpression&&"zoom"===e.input.name&&(t=e);return t instanceof ParsingError||e.eachChild(e=>{const i=jr(e);i instanceof ParsingError?t=i:t&&i&&t!==i&&(t=new ParsingError("",\'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.\'))}),t}function Hr(e,t){const i=e.indexOf("?"),r=i<0?e:e.slice(0,i),n=new URLSearchParams(i<0?"":e.slice(i));for(const[e,i]of Object.entries(t))n.set(e,i);return`${r}?${n}`}
vendor: 1,135 bytes, line 2
2function $r(e,t={persistentParams:[]}){const i=e.indexOf("?");if(i<0)return e;const r=new URLSearchParams,n=new URLSearchParams(e.slice(i));for(const e of t.persistentParams){const t=n.get(e);t&&r.set(e,t)}const o=r.toString();return`${e.slice(0,i)}${o.length>0?`?${o}`:""}`}const Wr=["language","worldview","jobid"];let Xr;function qr(){const e=function(){try{return caches}catch(e){}}();e&&null==Xr&&(Xr=e.open("mapbox-tiles"))}Object.freeze({Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"});class AJAXError extends Error{constructor(e,t,i){super(),this.url=i,this.statusText=e,this.status=t}get message(){return 401===this.status&&Xe(this.url)?`${this.statusText}: you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/guides/#access-tokens-and-token-scopes`:this.statusText}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const Zr=Ce()?()=>self.worker.referrer:()=>("blob:"===location.protocol?parent:self).location.href,Yr=/^\\w+:/,Jr=/[\\r\
vendor: 5,592 bytes, line 2
2\n]+/;async function Kr(e,t){let i;return i="arrayBuffer"===e.type?await t.arrayBuffer():"json"===e.type?await t.json():await t.text(),{data:i,headers:t.headers}}async function Qr(e,t){return t&&t.throwIfAborted(),(i=e.url).startsWith("file:")||Zr().startsWith("file:")&&!Yr.test(i)?async function(e,t){return new Promise((i,r)=>{const n=new XMLHttpRequest,o=()=>{t.removeEventListener("abort",o),n.abort(),r(t.reason)};t&&t.addEventListener("abort",o),n.open(e.method||"GET",e.url,!0),"arrayBuffer"===e.type&&(n.responseType="arraybuffer");for(const t in e.headers)n.setRequestHeader(t,e.headers[t]);"json"===e.type&&(n.responseType="text",n.setRequestHeader("Accept","application/json")),n.withCredentials="include"===e.credentials,n.onerror=()=>{t&&t.removeEventListener("abort",o),r(new Error(n.statusText))},n.onload=()=>{if(t&&t.removeEventListener("abort",o),(n.status>=200&&n.status<300||0===n.status)&&null!==n.response){let t=n.response;if("json"===e.type)try{t=JSON.parse(n.response)}catch(e){return void r(e)}const o=new Headers;n.getAllResponseHeaders().trim().split(Jr).forEach(e=>{const t=e.split(": "),i=t.shift(),r=t.join(": ");i&&o.set(i,r)}),i({data:t,headers:o})}else r(new AJAXError(n.statusText,n.status,e.url))},n.send(e.body)})}(e,t):async function(e,t){const i=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,referrer:Zr(),referrerPolicy:e.referrerPolicy,signal:t}),r=(n=i.url).indexOf("sku=")>0&&Xe(n);var n;if("json"===e.type&&i.headers.set("Accept","application/json"),r){let r=null;try{r=await async function(e){if(qr(),null==Xr)return null;const t=await Xr;let i=$r(e.url,{persistentParams:Wr});const r=e.headers.get("Range");r&&(i=Hr(i,{range:r}));const n=await t.match(i);if(!n)return null;const o=function(e){if(!e)return!1;const t=new Date(e.headers.get("expires")||0),i=Re(e.headers.get("cache-control")||"");return Number(t)>Date.now()&&!i["no-cache"]}(n);return t.delete(i).catch(e=>ze(e.message)),o&&t.put(i,n.clone()).catch(e=>ze(e.message)),{response:n,fresh:o}}(i)}catch(e){"SecurityError"!==e.message&&ze(e.toString())}if(r&&r.fresh)return t&&t.throwIfAborted(),Kr(e,r.response)}const o=Date.now();let a;try{a=await fetch(i)}catch(t){if("AbortError"===t.name)throw t;throw new Error(`${t.message} ${e.url}`,{cause:t})}if(t&&t.throwIfAborted(),!a.ok)throw new AJAXError(a.statusText,a.status,e.url);const s=r?a.clone():null,l=await Kr(e,a);return s&&async function(e,t,i){if(qr(),null==Xr)return;const r=Re(t.headers.get("cache-control")||"");if(r["no-store"])return;const n={status:t.status,statusText:t.statusText,headers:new Headers(t.headers)};r["max-age"]&&n.headers.set("Expires",new Date(i+1e3*r["max-age"]).toUTCString());const o=n.headers.get("expires");if(!o)return;if(new Date(o).getTime()-i<42e4)return;let a=$r(e.url,{persistentParams:Wr});if(206===t.status){const t=e.headers.get("Range");if(!t)return;n.status=200,a=Hr(a,{range:t})}const s=new Response(200!==(l=t.status)&&404!==l&&[101,103,204,205,304].includes(l)?null:t.body,n);var l;if(qr(),null!=Xr)try{const e=await Xr;await e.put(a,s)}catch(e){ze(e.message)}}(i,s,o),l}(e,t);var i}async function en(e,t){return Qr(Object.assign(e,{type:"arrayBuffer"}),t)}const tn={};function rn(e,t,i={}){Object.defineProperty(e,"_classRegistryKey",{value:t,writable:!1}),tn[t]={klass:e,omit:i.omit||[]}}rn(Object,"Object"),rn(GridIndex,"Grid"),delete K.prototype.constructor,rn(Color,"Color"),rn(Formatted,"Formatted"),rn(FormattedSection,"FormattedSection"),rn(ResolvedImage,"ResolvedImage"),rn(StylePropertyFunction,"StylePropertyFunction"),rn(StyleExpression,"StyleExpression",{omit:["_evaluator"]}),rn(ImageId,"ImageId"),rn(ImageVariant,"ImageVariant"),rn(ZoomDependentExpression,"ZoomDependentExpression"),rn(ZoomConstantExpression,"ZoomConstantExpression"),rn(CompoundExpression,"CompoundExpression",{omit:["_evaluate"]});for(const e in yr)tn[yr[e]._classRegistryKey]||rn(yr[e],`Expression${e}`);function nn(e){return e&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}const on={Error,TypeError,RangeError,SyntaxError,ReferenceError,URIError,EvalError},an=new Set(["message","stack","cause","errors","name","class"]);function sn(e,t){if(null===e)return null;const i=typeof e;if("object"!==i)return"bigint"===i?{$name:"BigInt",value:e.toString()}:e;if(Array.isArray(e)){const i=e.length,r=[];r.length=i;for(let n=0;n<i;n++)r[n]=sn(e[n],t);return r}if(ArrayBuffer.isView(e))return t&&t.add(e.buffer),e;if(nn(e)||e instanceof ImageBitmap)return t&&t.add(e),e;if(e instanceof ImageData)return t&&t.add(e.data.buffer),e;if(e instanceof Map){const i={$name:"Map",entries:[]};for(const[r,n]of e.entries())i.entries.push(sn(r),sn(n,t));return i}if(e instanceof Headers)return{$name:"Headers",entries:[...e]};if(e instanceof Set){const t={$name:"Set"};let i=0;for(const r of e.values())t[++i]=sn(r);return t}if(e instanceof Date||e instanceof RegExp||e instanceof Boolean||e instanceof Number||e instanceof String)return e;if(e instanceof Error){const i=e,r=i.constructor&&i.constructor.name||"Error",n={$name:"$Error",class:i instanceof AJAXError?"AJAXError":i instanceof DOMException?"DOMException":i instanceof AggregateError?"AggregateError":on[r]?r:"Error",name:i.name,message:i.message};i.stack&&(n.stack=i.stack),"cause"in i&&i.cause!==i&&(n.cause=sn(i.cause,t)),i instanceof AggregateError&&(n.errors=i.errors.filter(e=>e!==i).map(e=>sn(e,t)));const o=i;for(const e in o)Object.hasOwn(o,e)&&(an.has(e)||(n[e]=sn(o[e],t)));return n}const r=e.constructor||Object,n=r._classRegistryKey;if(!n)throw new Error(`Can
2\'t serialize object of unregistered class "${r.name}".`);const o=r.serialize?r.serialize(e,t):{};if(!r.serialize){const i=tn[n].omit,r=e;for(const e in r)Object.hasOwn(r,e)&&(i.includes(e)||(o[e]=sn(r[e],t)))}if(o.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==n&&(o.$name=n),o}function ln(e){if(null===e||"object"!=typeof e)return e;if(Array.isArray(e)){for(let t=0;t<e.length;t++)e[t]=ln(e[t]);return e}if(ArrayBuffer.isView(e)||nn(e)||e instanceof ImageBitmap||e instanceof ImageData||e instanceof Date||e instanceof RegExp||e instanceof Boolean||e instanceof Number||e instanceof String)return e;const t=e.$name||"Object";if("Map"===t){const t=e.entries||[],i=new Map;for(let e=0;e<t.length;e+=2)i.set(ln(t[e]),ln(t[e+1]));return i}if("Headers"===t)return new Headers(e.entries);if("Set"===t){const t=new Set;for(const i in e)"$name"!==i&&t.add(ln(e[i]));return t}if("BigInt"===t)return BigInt(e.value);if("$Error"===t){const t=e.class||"Error",i=e.name||t,r=e.message||"";let n;n="DOMException"===t?new DOMException(r,i):"AggregateError"===t?new AggregateError((e.errors||[]).map(ln),r):"AJAXError"===t?new AJAXError(e.statusText,e.status,e.url):new(on[t]||Error)(r),"DOMException"!==t&&(n.name=i),e.stack&&(n.stack=e.stack),"cause"in e&&(n.cause=ln(e.cause));const o=n;for(const t in e)Object.hasOwn(e,t)&&("$name"===t||an.has(t)||(o[t]=ln(e[t])));return n}const{klass:i}=tn[t];if(!i)throw new Error(`Can\
vendor: 15,727 bytes, line 2
2't deserialize unregistered class "${t}".`);if(i.deserialize)return i.deserialize(e);const r=Object.create(i.prototype);for(const t in e)"$name"!==t&&(r[t]=ln(e[t]));return r}const un={type:"message"};class Actor{constructor(e,t,i){this.target=e,this.parent=t,this.mapId=i,this.pendingResponses=new Map,Ie(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler=new Scheduler}send(e,t,i){const{signal:r,targetMapId:n,metadata:o}=i||{},a=Math.round(1e18*Math.random()).toString(36).substring(0,10),s=new Set;return r&&r.aborted?Promise.reject(r.reason):(this.target.postMessage({id:a,type:e,targetMapId:n,sourceMapId:this.mapId,data:sn(t,s)},[...s]),new Promise((e,t)=>{const i={resolve:e,reject:t,metadata:o||un};if(r){const e=()=>{this.pendingResponses.delete(a),t(r.reason)};r.addEventListener("abort",e,{once:!0}),i.detach=()=>r.removeEventListener("abort",e)}this.pendingResponses.set(a,i)}))}notify(e,t,i){const{targetMapId:r}=i||{},n=new Set;this.target.postMessage({type:e,targetMapId:r,sourceMapId:this.mapId,data:sn(t,n)},[...n])}sendCancelable(e,t,i,r){const n=new AbortController;return this.send(e,t,{...i,signal:n.signal}).then(e=>r(null,e)).catch(e=>{"AbortError"!==e.name&&r(e)}),n}getWorkerSourceActor(e){return{scheduler:this.scheduler,send:(t,i,r)=>this.send(t,i,{...r,targetMapId:e}),notify:(t,i)=>{this.notify(t,i,{targetMapId:e})},sendCancelable:(t,i,r,n)=>this.sendCancelable(t,i,{...r,targetMapId:e},n)}}receive(e){const t=e.data;if(!t)return;const i=t.id;if(!t.targetMapId||this.mapId===t.targetMapId)if(Ce(self)){const e=this.pendingResponses.get(i);this.scheduler.add(()=>{this.processTask(i,t)},e&&e.metadata||un)}else this.processTask(i,t)}async processTask(e,t){if("<response>"===t.type){const i=this.pendingResponses.get(e);if(this.pendingResponses.delete(e),i){i.detach&&i.detach();try{t.error?i.reject(ln(t.error)):i.resolve(ln(t.data))}catch(e){i.reject(e)}}return}const i=new Set,r=ln(t.data);try{let n;if(this.parent[t.type])n=await this.parent[t.type](t.sourceMapId,r);else{if(!this.parent.getWorkerSource)throw new Error(`Could not find function ${t.type}`);{const e=t.type.split("."),{source:i,scope:o}=r,a=this.parent.getWorkerSource(t.sourceMapId,{type:e[0],source:i,scope:o});n=await a[e[1]](r)}}if(!e)return;this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:null,data:sn(n,i)},[...i])}catch(t){this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:sn(t),data:null},[])}}remove(){for(const e of this.pendingResponses.values())e.detach&&e.detach(),e.reject(new DOMException("Actor removed","AbortError"));this.pendingResponses.clear(),this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}class Event{constructor(e,...t){Object.assign(this,t[0]||{}),this.type=e}}class ErrorEvent extends Event{constructor(e,t={}){super("error",{error:e,...t}),this.error=e}}function cn(e,t,i){i[e]&&i[e].includes(t)||(i[e]=i[e]||[],i[e].push(t))}function hn(e,t,i){if(i[e]){const r=i[e].indexOf(t);-1!==r&&i[e].splice(r,1)}}class Evented{constructor(){this._listeners={},this._oneTimeListeners={}}on(e,t){return cn(e,t,this._listeners),this}off(e,t){return hn(e,t,this._listeners),hn(e,t,this._oneTimeListeners),this}once(e,t){return t?(cn(e,t,this._oneTimeListeners),this):new Promise(t=>{this.once(e,t)})}fire(e,t){const i="string"==typeof e?new Event(e,t):e,r=i.type;if(this.listens(r)){i.target=this;const e=this._listeners[r]?this._listeners[r].slice():[];for(const t of e)t.call(this,i);const t=this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[];for(const e of t)hn(r,e,this._oneTimeListeners),e.call(this,i);const n=this._eventedParent;if(n){const e="function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData;Object.assign(i,e),n.fire(i)}}else i instanceof ErrorEvent&&console.error(i.error);return this}listens(e){return!!(this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}const dn=e=>e>=1536&&e<=1791,pn=e=>e>=1872&&e<=1919,fn=e=>e>=2208&&e<=2303,mn=e=>e>=11904&&e<=12031,_n=e=>e>=12032&&e<=12255,gn=e=>e>=12272&&e<=12287,yn=e=>e>=12288&&e<=12351,xn=e=>e>=12352&&e<=12447,vn=e=>e>=12448&&e<=12543,bn=e=>e>=12544&&e<=12591,wn=e=>e>=12704&&e<=12735,An=e=>e>=12736&&e<=12783,En=e=>e>=12784&&e<=12799,In=e=>e>=12800&&e<=13055,Sn=e=>e>=13056&&e<=13311,Dn=e=>e>=13312&&e<=19903,Pn=e=>e>=19968&&e<=40959,Tn=e=>e>=40960&&e<=42127,zn=e=>e>=42128&&e<=42191,Mn=e=>e>=63744&&e<=64255,Cn=e=>e>=64336&&e<=65023,Rn=e=>e>=65040&&e<=65055,Ln=e=>e>=65072&&e<=65103,Fn=e=>e>=65104&&e<=65135,Bn=e=>e>=65136&&e<=65279,On=e=>e>=65280&&e<=65519;function Vn(e){for(const t of e)if(Gn(t.charCodeAt(0)))return!0;return!1}function kn(e){for(const t of e)if(!Nn(t.charCodeAt(0)))return!1;return!0}function Nn(e){return!(dn(e)||pn(e)||fn(e)||Cn(e)||Bn(e))}function Un(e){return!(e<11904||!(wn(e)||bn(e)||Ln(e)||Mn(e)||Sn(e)||mn(e)||An(e)||yn(e)||Dn(e)||Pn(e)||In(e)||On(e)||xn(e)||gn(e)||_n(e)||En(e)||vn(e)||Rn(e)||zn(e)||Tn(e)))}function Gn(e){return!(746!==e&&747!==e&&(e<4352||!(wn(e)||bn(e)||Ln(e)&&!(e>=65097&&e<=65103)||Mn(e)||Sn(e)||mn(e)||An(e)||!(!yn(e)||e>=12296&&e<=12305||e>=12308&&e<=12319||12336===e)||Dn(e)||Pn(e)||In(e)||(e=>e>=12592&&e<=12687)(e)||(e=>e>=43360&&e<=43391)(e)||(e=>e>=55216&&e<=55295)(e)||(e=>e>=4352&&e<=4607)(e)||(e=>e>=44032&&e<=55215)(e)||xn(e)||gn(e)||(e=>e>=12688&&e<=12703)(e)||_n(e)||En(e)||vn(e)&&12540!==e||!(!On(e)||65288===e||65289===e||65293===e||e>=65306&&e<=65310||65339===e||65341===e||65343===e||e>=65371&&e<=65503||65507===e||e>=65512&&e<=65519)||!(!Fn(e)||e>=65112&&e<=65118||e>=65123&&e<=65126)||(e=>e>=5120&&e<=5759)(e)||(e=>e>=6320&&e<=6399)(e)||Rn(e)||(e=>e>=19904&&e<=19967)(e)||Tn(e)||zn(e))))}function jn(e){return 12307===e||12312===e||12313===e||12316===e||12448===e||12540===e||e>=8592&&e<=8595||8208===e||8229===e||8741===e||e>=9472&&e<=9547||65294===e||65309===e||65374===e||65507===e}function Hn(e){return!(Gn(e)||function(e){return!!((e=>e>=128&&e<=255)(e)&&(167===e||169===e||174===e||177===e||188===e||189===e||190===e||215===e||247===e)||(e=>e>=8192&&e<=8303)(e)&&(8214===e||8224===e||8225===e||8240===e||8241===e||8251===e||8252===e||8258===e||8263===e||8264===e||8265===e||8273===e)||(e=>e>=8448&&e<=8527)(e)||(e=>e>=8528&&e<=8591)(e)||(e=>e>=8960&&e<=9215)(e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||9003===e||e>=9085&&e<=9114||e>=9150&&e<=9165||9167===e||e>=9169&&e<=9179||e>=9186&&e<=9215)||(e=>e>=9216&&e<=9279)(e)&&9251!==e||(e=>e>=9280&&e<=9311)(e)||(e=>e>=9312&&e<=9471)(e)||(e=>e>=9632&&e<=9727)(e)||(e=>e>=9728&&e<=9983)(e)&&!(e>=9754&&e<=9759)||(e=>e>=11008&&e<=11263)(e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||yn(e)||vn(e)||(e=>e>=57344&&e<=63743)(e)||Ln(e)||Fn(e)||On(e)||8734===e||8756===e||8757===e||e>=9984&&e<=10087||e>=10102&&e<=10131||65532===e||65533===e)}(e))}function $n(e){return dn(e)||pn(e)||fn(e)||Cn(e)||Bn(e)}function Wn(e){return e>=1424&&e<=2303||Cn(e)||Bn(e)}function Xn(e,t){return!(!t&&Wn(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||(e=>e>=6016&&e<=6143)(e))}function qn(e){for(const t of e)if(Wn(t.charCodeAt(0)))return!0;return!1}const Zn="parsing",Yn="parsed";let Jn="unavailable",Kn=null;const Qn=function(){return Jn},eo={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>"loaded"===Jn||null!=eo.applyArabicShaping,isLoading:()=>"loading"===Jn,setState(e){Jn=e.pluginStatus,Kn=e.pluginURL},isParsing:()=>Jn===Zn,isParsed:()=>Jn===Yn,getPluginURL:()=>Kn};class EvaluationParameters{constructor(e,t){this.zoom=e,t?(this.now=t.now,this.fadeDuration=t.fadeDuration,this.transition=t.transition,this.pitch=t.pitch,this.brightness=t.brightness,this.worldview=t.worldview,this.activeFloors=t.activeFloors):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(e){return function(e,t){for(const i of e)if(!Xn(i.charCodeAt(0),t))return!1;return!0}(e,eo.isLoaded())}}class PropertyValue{constructor(e,t,i,r,n){this.property=e,this.value=t,this.expression=function(e,t,i,r,n){if(Cr(e))return new StylePropertyFunction(e,t);if(Nr(e)||Array.isArray(e)&&e.length>0){const o=Gr(e,t,i,r,n);if("error"===o.result)throw new Error(o.value.map(e=>`${e.key}: ${e.message}`).join(", "));return o.value}{let i=e;return"string"==typeof e&&"color"===t.type&&(i=Color.parse(e)),{kind:"constant",configDependencies:new Set,isIndoorDependent:!1,evaluate:()=>i}}}(void 0===t?e.specification.default:t,e.specification,i,r,n)}isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(e,t,i,r){return this.property.possiblyEvaluate(this,e,t,i,r)}}class TransitionablePropertyValue{constructor(e,t,i,r){this.property=e,this.value=new PropertyValue(e,void 0,t,i,r)}transitioned(e,t){return new TransitioningPropertyValue(this.property,this.value,t,{...e.transition,...this.transition},e.now)}untransitioned(){return new TransitioningPropertyValue(this.property,this.value,null,{},0)}}class Transitionable{constructor(e,t,i,r){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=t,this._options=i,this._iconImageUseTheme=r,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(e){return De(this._values[e].value.value)}setValue(e,t){Object.hasOwn(this._values,e)||(this._values[e]=new TransitionablePropertyValue(this._values[e].property,this._scope,this._options,this._iconImageUseTheme)),this._values[e].value=new PropertyValue(this._values[e].property,null===t?void 0:De(t),this._scope,this._options,this._iconImageUseTheme),this._values[e].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].value.expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[e].value.isIndoorDependent())}setTransitionOrValue(e,t){t&&(this._options=t);const i=this._properties.properties;if(e)for(const t in e){const r=e[t];if(t.endsWith("-transition")){const e=t.slice(0,-11);i[e]&&this.setTransition(e,r)}else Object.hasOwn(i,t)&&this.setValue(t,r)}}getTransition(e){return De(this._values[e].transition)}setTransition(e,t){Object.hasOwn(this._values,e)||(this._values[e]=new TransitionablePropertyValue(this._values[e].property)),this._values[e].transition=De(t)||void 0}serialize(){const e={};for(const t of Object.keys(this._values)){const i=this.getValue(t);void 0!==i&&(e[t]=i);const r=this.getTransition(t);void 0!==r&&(e[`${t}-transition`]=r)}return e}transitioned(e,t){const i=new Transitioning(this._properties);for(const r of Object.keys(this._values))i._values[r]=this._values[r].transitioned(e,t._values[r]);return i}untransitioned(){const e=new Transitioning(this._properties);for(const t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}isIndoorDependent(){return this._isIndoorDependent}}class TransitioningPropertyValue{constructor(e,t,i,r,n){const o=r.delay||0,a=r.duration||0;n=n||0,this.property=e,this.value=t,this.begin=n+o,this.end=this.begin+a,e.specification.transition&&(r.delay||r.duration)&&(this.prior=i)}possiblyEvaluate(e,t,i){const r=e.now||0,n=this.value.possiblyEvaluate(e,t,i),o=this.prior;if(o){if(r>this.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(r<this.begin)return o.possiblyEvaluate(e,t,i);{const a=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(o.possiblyEvaluate(e,t,i),n,function(e){if(e<=0)return 0;if(e>=1)return 1;const t=e*e,i=t*e;return 4*(e<.5?i:3*(e-t)+i-.75)}(a))}}return n}}class Transitioning{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,i){const r=new PossiblyEvaluated(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(e,t,i);return r}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Layout{constructor(e,t,i,r){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._scope=t,this._options=i,this._iconImageUseTheme=r,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(e){return De(this._values[e].value)}setValue(e,t){this._values[e]=new PropertyValue(this._values[e].property,null===t?void 0:De(t),this._scope,this._options,this._iconImageUseTheme),this._values[e].expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[e].isIndoorDependent())}serialize(){const e={};for(const t of Object.keys(this._values)){const i=this.getValue(t);void 0!==i&&(e[t]=i)}return e}possiblyEvaluate(e,t,i,r){const n=new PossiblyEvaluated(this._properties);for(const o of Object.keys(this._values))n._values[o]=this._values[o].possiblyEvaluate(e,t,i,r);return n}isIndoorDependent(){return this._isIndoorDependent}}class PossiblyEvaluatedPropertyValue{constructor(e,t,i,r){this.property=e,this.value=t,this.parameters=i,this.iconImageUseTheme=r}isConstant(){return"constant"===this.value.kind}constantOr(e){return"constant"===this.value.kind?this.value.value:e}evaluate(e,t,i,r,n){return this.property.evaluate(this.value,this.parameters,e,t,i,r,this.iconImageUseTheme,n)}}class PossiblyEvaluated{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class DataConstantProperty{constructor(e){this.specification=e}possiblyEvaluate(e,t){return e.expression.evaluate(t)}interpolate(e,t,i){const r=Ui[this.specification.type];return r?r(e,t,i):e}}class DataDrivenProperty{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,i,r,n){return"constant"===e.expression.kind||"camera"===e.expression.kind?new PossiblyEvaluatedPropertyValue(this,{kind:"constant",value:e.expression.evaluate(t,null,{},i,r,void 0,n)},t):new PossiblyEvaluatedPropertyValue(this,e.expression,t,n)}interpolate(e,t,i){if("constant"!==e.value.kind||"constant"!==t.value.kind)return e;if(void 0===e.value.value||void 0===t.value.value)return new PossiblyEvaluatedPropertyValue(this,{kind:"constant",value:void 0},e.parameters);const r=Ui[this.specification.type];return r?new PossiblyEvaluatedPropertyValue(this,{kind:"constant",value:r(e.value.value,t.value.value,i)},e.parameters):e}evaluate(e,t,i,r,n,o,a,s){return"constant"===e.kind?e.value:e.evaluate(t,i,r,n,o,s,a)}}class ColorRampProperty{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,r){return!!e.expression.evaluate(t,null,{},i,r)}interpolate(){return!1}}class Properties{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const t=new EvaluationParameters(0,{});for(const i in e){const r=e[i],n=r.specification;n&&n.overridable&&this.overridableProperties.push(i);const o=this.defaultPropertyValues[i]=new PropertyValue(r,void 0),a=this.defaultTransitionablePropertyValues[i]=new TransitionablePropertyValue(r);this.defaultTransitioningPropertyValues[i]=a.untransitioned(),this.defaultPossiblyEvaluatedValues[i]=o.possiblyEvaluate(t)}}}rn(DataDrivenProperty,"DataDrivenProperty"),rn(DataConstantProperty,"DataConstantProperty"),rn(ColorRampProperty,"ColorRampProperty");var to=JSON.parse(
2\
vendor: 18,768 bytes, line 2
2'{"expression":1,"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"appearance":{"condition":{"type":"boolean","expression":{"interpolated":1,"parameters":["distance-from-center","feature","feature-state","measure-light","pitch","zoom"]},"property-type":"data-driven"},"name":{"type":"string"},"properties":{"type":"*"}},"function":{"type":{"type":"enum","default":"exponential","values":{"identity":1,"exponential":1,"interval":1,"categorical":1}},"default":{"type":"*"},"expression":1,"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"colorSpace":{"type":"enum","default":"rgb","values":{"rgb":1,"lab":1,"hcl":1}}},"$version":8,"$root":{"transition":{"type":"transition"},"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},"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"},"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":{"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1,"object":{}}},"default":{"type":"*","expression":1},"values":{"type":"array","value":"*"},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}},"id":{"type":"string"},"properties":{"type":"properties"}},"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","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"use-theme":1},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"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":1,"parameters":["zoom"]},"transition":1},"shadow-draw-before-layer":{"type":"string"}},"properties_light_ambient":{"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"use-theme":1},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"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","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"use-theme":1},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"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","default":[-180,-85.051129,180,85.051129],"length":4,"value":"number"},"extra_bounds":{"type":"array","value":{"type":"array","length":4,"value":"number"}},"scheme":{"type":"enum","default":"xyz","values":{"xyz":1,"tms":1}},"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","default":[-180,-85.051129,180,85.051129],"length":4,"value":"number"},"extra_bounds":{"type":"array","value":{"type":"array","length":4,"value":"number"}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","default":"xyz","values":{"xyz":1,"tms":1}},"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","default":[-180,-85.051129,180,85.051129],"length":4,"value":"number"},"extra_bounds":{"type":"array","value":{"type":"array","length":4,"value":"number"}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","default":"mapbox","values":{"terrarium":1,"mapbox":1}},"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","default":[-180,-85.051129,180,85.051129],"length":4,"value":"number"},"extra_bounds":{"type":"array","value":{"type":"array","length":4,"value":"number"}},"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,"minimum":0,"maximum":512},"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","default":[0,0,0],"length":3,"value":"number"}},"modelLightOverrides":{"light-ambient-color":{"type":"color"},"light-ambient-intensity":{"type":"number"},"light-directional-color":{"type":"color"},"light-directional-intensity":{"type":"number"}},"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","default":[0,0],"minimum":[-180,-90],"maximum":[180,90],"length":2,"value":"number"},"orientation":{"type":"array","default":[0,0,0],"length":3,"value":"number"},"lightOverrides":{"type":"modelLightOverrides"},"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}},"url":{"type":"string"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"},"models":{"type":"modelSourceModels"}},"layer":{"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"building":{},"raster":{},"raster-particle":{},"hillshade":{},"model":{},"background":{},"sky":{},"slot":{},"placement-group":{},"clip":{}}},"id":{"type":"string"},"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"}},"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","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_sky":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_model":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"model-id":{"type":"string","default":"","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"model-allow-density-reduction":{"type":"boolean","default":true}},"layout_clip":{"clip-layer-types":{"type":"array","default":[],"value":"enum","values":{"model":1,"symbol":1},"expression":1},"clip-layer-scope":{"type":"array","default":[],"value":"string","expression":1},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"fill-elevation-reference":{"type":"enum","default":"none","values":{"none":1,"hd-road-base":1,"hd-road-markup":1},"expression":1},"fill-construct-bridge-guard-rail":{"type":"boolean","default":"true","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"circle-elevation-reference":{"type":"enum","default":"none","values":{"none":1,"hd-road-markup":1},"expression":1},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_heatmap":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_fill-extrusion":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"fill-extrusion-edge-radius":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"source-max-zoom":{"type":"number","minimum":0,"maximum":24}},"layout_building":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"building-facade":{"type":"boolean","default":false,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-floors":{"type":"number","default":3,"minimum":1,"maximum":200,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-unit-width":{"type":"number","default":3.1,"minimum":1,"maximum":20,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-window":{"type":"array","default":[0.9,0.9],"minimum":0.1,"maximum":1,"length":2,"value":"number","expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-roof-shape":{"type":"enum","default":"flat","values":{"flat":1,"hipped":1,"gabled":1,"parapet":1,"mansard":1,"skillion":1,"pyramidal":1},"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-height":{"type":"number","default":0,"minimum":0,"expression":1,"transition":1,"property-type":"data-driven"},"building-base":{"type":"number","default":0,"minimum":0,"expression":1,"transition":1,"property-type":"data-driven"},"building-flood-light-wall-radius":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"building-flood-light-ground-radius":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"building-flip-roof-orientation":{"type":"boolean","default":false,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"}},"layout_line":{"line-cap":{"type":"enum","default":"butt","values":{"butt":1,"round":1,"square":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-join":{"type":"enum","default":"miter","values":{"bevel":1,"round":1,"miter":1,"none":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":1,"parameters":["zoom"]}},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":1,"parameters":["zoom"]}},"line-sort-key":{"type":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","default":0,"expression":{"parameters":["feature","line-progress","zoom"]},"property-type":"data-driven"},"line-elevation-reference":{"type":"enum","default":"none","values":{"none":1,"sea":1,"ground":1,"hd-road-markup":1},"expression":1},"line-cross-slope":{"type":"number","expression":1},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"line-width-unit":{"type":"enum","default":"pixels","values":{"pixels":1,"meters":1},"expression":{"parameters":["zoom"]}},"line-elevation-ground-scale":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","line-progress","zoom"]},"transition":1,"property-type":"data-driven"}},"layout_symbol":{"symbol-placement":{"type":"enum","default":"point","values":{"point":1,"line":1,"line-center":1},"expression":{"parameters":["zoom"]}},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":1,"parameters":["zoom"]}},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-sort-key":{"type":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","default":"auto","values":{"auto":1,"viewport-y":1,"source":1},"expression":{"parameters":["zoom"]}},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-elevation-reference":{"type":"enum","default":"ground","values":{"sea":1,"ground":1,"hd-road-markup":1},"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","default":"auto","values":{"map":1,"viewport":1,"auto":1},"expression":{"parameters":["zoom"]}},"icon-size":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"icon-size-scale-range":{"type":"array","default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"length":2,"value":"number","expression":1},"icon-text-fit":{"type":"enum","default":"none","values":{"none":1,"width":1,"height":1,"both":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","default":[0,0,0,0],"length":4,"value":"number","expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","expression":{"parameters":["feature","zoom"]},"use-theme":1,"property-type":"data-driven","appearance":1,"tokens":1},"icon-rotate":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]}},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-offset":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"icon-anchor":{"type":"enum","default":"center","values":{"center":1,"left"
vendor: 23,040 bytes, line 2
2:1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","default":"auto","values":{"map":1,"viewport":1,"auto":1},"expression":{"parameters":["zoom"]}},"text-pitch-alignment":{"type":"enum","default":"auto","values":{"map":1,"viewport":1,"auto":1},"expression":{"parameters":["zoom"]}},"text-rotation-alignment":{"type":"enum","default":"auto","values":{"map":1,"viewport":1,"auto":1},"expression":{"parameters":["zoom"]}},"text-field":{"type":"formatted","default":"","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven","tokens":1},"text-font":{"type":"array","default":["Open Sans Regular","Arial Unicode MS Regular"],"value":"string","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"text-size-scale-range":{"type":"array","default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"length":2,"value":"number","expression":1},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-justify":{"type":"enum","default":"center","values":{"auto":1,"left":1,"center":1,"right":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"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","default":"center","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":["feature","zoom"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":1,"parameters":["zoom"]}},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]}},"text-rotate":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]}},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"text-transform":{"type":"enum","default":"none","values":{"none":1,"uppercase":1,"lowercase":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-offset":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"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","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_raster":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_raster-particle":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_hillshade":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"expression":{"parameters":["distance-from-center","feature","pitch","zoom"]},"property-type":"data-driven"},"filter_fill":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_hillshade":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_raster":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_raster-particle":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_clip":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_model":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_line":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_circle":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_fill-extrusion":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_building":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_heatmap":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"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_stop":{"type":"array","minimum":0,"maximum":24,"length":2,"value":["number","color"]},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1}},"camera":{"camera-projection":{"type":"enum","default":"perspective","values":{"perspective":1,"orthographic":1}}},"colorTheme":{"data":{"type":"string","expression":1}},"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","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"use-theme":1},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"projection":{"name":{"type":"enum","default":"mercator","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1}},"center":{"type":"array","minimum":[-180,-90],"maximum":[180,90],"length":2,"value":"number"},"parallels":{"type":"array","minimum":[-90,-90],"maximum":[90,90],"length":2,"value":"number"}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"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,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"fill-outline-color":{"type":"color","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"fill-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1},"fill-z-offset":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"transition":1,"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","expression":{"interpolated":1,"parameters":["feature","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","expression":{"interpolated":1,"parameters":["feature","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","default":"flat","values":{"terrain":1,"flat":1}},"fill-extrusion-base-alignment":{"type":"enum","default":"terrain","values":{"terrain":1,"flat":1}},"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":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1},"fill-extrusion-flood-light-wall-radius":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-flood-light-ground-radius":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"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":1},"fill-extrusion-front-cutoff":{"type":"array","default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]}},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"parameters":[]},"transition":1},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"use-theme":1,"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":1,"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":1,"parameters":["measure-light","zoom"]}},"building-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"building-front-cutoff":{"type":"array","default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]}},"building-flood-light-color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"building-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1},"building-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"line-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"line-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","line-progress","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"}
vendor: 19,042 bytes, line 2
2,"line-blur":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-dasharray":{"type":"array","minimum":0,"value":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"line-gradient":{"type":"color","expression":{"interpolated":1,"parameters":["line-progress"]},"use-theme":1},"line-trim-offset":{"type":"array","default":[0,0],"minimum":[0,0],"maximum":[1,1],"length":2,"value":"number"},"line-trim-fade-range":{"type":"array","default":[0,0],"minimum":[0,0],"maximum":[1,1],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"line-trim-color":{"type":"color","default":"transparent","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["line-progress","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-border-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"line-border-gradient":{"type":"color","expression":{"interpolated":1,"parameters":["line-progress"]},"use-theme":1},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"line-blend-mode":{"type":"enum","default":"default","values":{"default":1,"multiply":1,"additive":1},"expression":{"parameters":["zoom"]}},"line-blend-additive-clamp":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]}},"line-cutout-depth":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"circle-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"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"],"expression":{"interpolated":1,"parameters":["heatmap-density"]},"use-theme":1},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven","appearance":1},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven","appearance":1},"icon-halo-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"appearance":1},"icon-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven","appearance":1,"overridable":1},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven","appearance":1},"text-halo-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-halo-blur":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"appearance":1},"text-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":1},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":1},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":1},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"placement-priority":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["distance-from-center","feature","feature-state","measure-light","pitch","zoom"]},"property-type":"data-driven","appearance":1},"placement-group":{"type":"string","expression":{"parameters":["distance-from-center","feature","feature-state","measure-light","pitch","zoom"]},"property-type":"data-driven","appearance":1}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-color":{"type":"color","expression":{"interpolated":1,"parameters":["raster-value"]},"use-theme":1},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-color-range":{"type":"array","length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-color-scale":{"type":"enum","default":"linear","values":{"linear":1,"log":1},"expression":{"parameters":[]}},"raster-hue-rotate":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-resampling":{"type":"enum","default":"linear","values":{"linear":1,"nearest":1},"expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-elevation-reference":{"type":"enum","default":"sea","values":{"sea":1,"ground":1},"expression":1}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","expression":{"interpolated":1,"parameters":["raster-particle-speed"]},"use-theme":1},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":1,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"hillshade-shadow-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"hillshade-accent-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1}},"paint_background":{"background-pitch-alignment":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1}},"paint_sky":{"sky-type":{"type":"enum","default":"atmosphere","values":{"gradient":1,"atmosphere":1},"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","minimum":[0,0],"maximum":[360,180],"length":2,"value":"number","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","default":[0,0],"minimum":[0,0],"maximum":[360,180],"length":2,"value":"number","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"],"expression":{"interpolated":1,"parameters":["sky-radial-progress"]},"use-theme":1},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":1},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":1},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"model-rotation":{"type":"array","default":[0,0,0],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"model-scale":{"type":"array","default":[1,1,1],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"model-translation":{"type":"array","default":[0,0,0],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"model-color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"model-color-mix-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"transition":1,"property-type":"data-driven"},"model-type":{"type":"enum","default":"common-3d","values":{"common-3d":1,"location-indicator":1}},"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":1,"parameters":["zoom"]},"transition":1},"model-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"transition":1,"property-type":"data-driven"},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"transition":1,"property-type":"data-driven"},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"model-front-cutoff":{"type":"array","default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]}},"model-elevation-reference":{"type":"enum","default":"ground","values":{"sea":1,"ground":1,"hd-road-markup":1},"expression":1},"model-line-cutout-mode":{"type":"enum","default":"enabled","values":{"enabled":1,"disabled":1,"enabled-above-cutout":1},"expression":1}},"promoteId":{"*":{"type":"*"}}}
2\');function io(e){if(Array.isArray(e))return e.map(io);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){const t={},i=e;for(const e in i)t[e]=io(i[e]);return t}return function(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}(e)}function ro(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(const t of e.slice(1))if(!ro(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}function no(e,t="",i=null,r="fill"){if(null==e)return{filter:()=>!0,needGeometry:!1,needFeature:!1};ro(e)||(e=ho(e));const n=e;let o=!0;try{o=function(e){if(!so(e))return e;let t=io(e);return ao(t),t=oo(t),t}(n)}catch(e){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(n,null,2)}\\n        `)}let a=null,s=null;if("background"!==r&&"sky"!==r&&"slot"!==r){s=to[`filter_${r}`];const e=Ur(o,s,t,i);if("error"===e.result)throw new Error(e.value.map(e=>`${e.key}: ${e.message}`).join(", "));a=(t,i,r)=>e.value.evaluate(t,i,{},r)}let l=null,u=null;if(o!==n){const e=Ur(n,s,t,i);if("error"===e.result)throw new Error(e.value.map(e=>`${e.key}: ${e.message}`).join(", "));l=(t,i,r,n,o)=>e.value.evaluate(t,i,{},r,void 0,void 0,n,o),u=!Jt(e.value.expression)}return{filter:a,dynamicFilter:l||void 0,needGeometry:co(o),needFeature:!!u}}function oo(e){if(!Array.isArray(e))return e;const t=function(e){if(lo.has(e[0]))for(let t=1;t<e.length;t++)if(so(e[t]))return!0;return e}(e);return!0===t?t:t.map(e=>oo(e))}function ao(e){let t=!1;const i=[];if("case"===e[0]){for(let r=1;r<e.length-1;r+=2)t=t||so(e[r]),i.push(e[r+1]);i.push(e.at(-1))}else if("match"===e[0]){t=t||so(e[1]);for(let t=2;t<e.length-1;t+=2)i.push(e[t+1]);i.push(e.at(-1))}else if("step"===e[0]){t=t||so(e[1]);for(let t=1;t<e.length-1;t+=2)i.push(e[t+1])}t&&(e.length=0,e.push("any",...i));for(let t=1;t<e.length;t++)ao(e[t])}function so(e){if(!Array.isArray(e))return!1;if("pitch"===(t=e[0])||"distance-from-center"===t)return!0;var t;for(let t=1;t<e.length;t++)if(so(e[t]))return!0;return!1}const lo=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function uo(e,t){return e<t?-1:e>t?1:0}function co(e){if(!Array.isArray(e))return!1;if("within"===e[0]||"distance"===e[0])return!0;for(let t=1;t<e.length;t++)if(co(e[t]))return!0;return!1}function ho(e){if(!e)return!0;const t=e[0];return e.length<=1?"any"!==t:"=="===t?po(e[1],e[2],"=="):"!="===t?_o(po(e[1],e[2],"==")):"<"===t||">"===t||"<="===t||">="===t?po(e[1],e[2],t):"any"===t?(i=e.slice(1),["any"].concat(i.map(ho))):"all"===t?["all"].concat(e.slice(1).map(ho)):"none"===t?["all"].concat(e.slice(1).map(ho).map(_o)):"in"===t?fo(e[1],e.slice(2)):"!in"===t?_o(fo(e[1],e.slice(2))):"has"===t?mo(e[1]):"!has"!==t||_o(mo(e[1]));var i}function po(e,t,i){switch(e){case"$type":return[`filter-type-${i}`,t];case"$id":return[`filter-id-${i}`,t];default:return[`filter-${i}`,e,t]}}function fo(e,t){if(0===t.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(e=>typeof e!=typeof t[0])?["filter-in-large",e,["literal",t.sort(uo)]]:["filter-in-small",e,["literal",t]]}}function mo(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function _o(e){return["!",e]}function go(e,t){return t?`${e}\x1f${t}`:e}function yo(e){const t=e.indexOf("\x1f
vendor: 104,278 bytes, line 2
2");return t>=0?e.slice(t+1):""}let xo,vo=1;const bo=()=>xo||(xo=new Properties({"icon-size":new DataDrivenProperty(to.layout_symbol["icon-size"]),"icon-image":new DataDrivenProperty(to.layout_symbol["icon-image"]),"icon-rotate":new DataDrivenProperty(to.layout_symbol["icon-rotate"]),"icon-offset":new DataDrivenProperty(to.layout_symbol["icon-offset"]),"text-size":new DataDrivenProperty(to.layout_symbol["text-size"]),"text-rotate":new DataDrivenProperty(to.layout_symbol["text-rotate"]),"text-offset":new DataDrivenProperty(to.layout_symbol["text-offset"])}));let wo;const Ao=()=>wo||(wo=new Properties({"icon-opacity":new DataDrivenProperty(to.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new DataDrivenProperty(to.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new DataDrivenProperty(to.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new DataDrivenProperty(to.paint_symbol["text-emissive-strength"]),"icon-color":new DataDrivenProperty(to.paint_symbol["icon-color"]),"icon-halo-color":new DataDrivenProperty(to.paint_symbol["icon-halo-color"]),"icon-halo-width":new DataDrivenProperty(to.paint_symbol["icon-halo-width"]),"icon-halo-blur":new DataDrivenProperty(to.paint_symbol["icon-halo-blur"]),"icon-translate":new DataDrivenProperty(to.paint_symbol["icon-translate"]),"text-opacity":new DataDrivenProperty(to.paint_symbol["text-opacity"]),"text-occlusion-opacity":new DataDrivenProperty(to.paint_symbol["text-occlusion-opacity"]),"text-color":new DataDrivenProperty(to.paint_symbol["text-color"],{runtimeType:ut,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new DataDrivenProperty(to.paint_symbol["text-halo-color"]),"text-halo-width":new DataDrivenProperty(to.paint_symbol["text-halo-width"]),"text-halo-blur":new DataDrivenProperty(to.paint_symbol["text-halo-blur"]),"text-translate":new DataDrivenProperty(to.paint_symbol["text-translate"]),"symbol-z-offset":new DataDrivenProperty(to.paint_symbol["symbol-z-offset"]),"placement-priority":new DataDrivenProperty(to.paint_symbol["placement-priority"]),"placement-group":new DataDrivenProperty(to.paint_symbol["placement-group"]),"icon-color-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"})}));class SymbolAppearance{constructor(e,t,i,r,n,o){this._conditionSpec=e,this._propertiesSpec=i;const a=Ur(e,to.appearance.condition);if("success"===a.result&&(this.condition=a.value),this.name=t,i){this.layoutProperties=new PossiblyEvaluated(bo()),this.unevaluatedLayout=new Layout(bo(),r,n,o),this.paintProperties=new PossiblyEvaluated(Ao()),this.unevaluatedPaint=new Layout(Ao(),r,n,"");for(const e in i)e in this.unevaluatedLayout._values?this.unevaluatedLayout.setValue(e,i[e]):e in this.unevaluatedPaint._values&&this.unevaluatedPaint.setValue(e,i[e])}}isActive(e){return!(this.condition||!e.isHidden||"hidden"!==this.name)||this.condition.evaluate(e.globals,e.feature,e.featureState,e.canonical)}getCondition(){return this.condition}getName(){return this.name}getLayoutProperty(e){return this.layoutProperties.get(e)}getPaintProperty(e){return this.paintProperties.get(e)}getUnevaluatedLayoutProperties(){return this.unevaluatedLayout}getUnevaluatedLayoutProperty(e){return this.unevaluatedLayout._values[e]}getUnevaluatedPaintProperty(e){return this.unevaluatedPaint._values[e]}recalculate(e,t,i){this.unevaluatedLayout&&(this.layoutProperties=this.unevaluatedLayout.possiblyEvaluate(e,void 0,t,i)),this.unevaluatedPaint&&(this.paintProperties=this.unevaluatedPaint.possiblyEvaluate(e,void 0,t,""))}serialize(){const e={};e.condition=this.condition.expression.serialize(),this.name&&(e.name=this.name);const t={...this.unevaluatedLayout?this.unevaluatedLayout.serialize():{},...this.unevaluatedPaint?this.unevaluatedPaint.serialize():{}};return Object.keys(t).length>0&&(e.properties=t),e}hasIconLayoutProperties(){const e=this.hasLayoutProperty("icon-image"),t=this.hasLayoutProperty("icon-size"),i=this.hasLayoutProperty("icon-offset"),r=this.hasLayoutProperty("icon-rotate");return e||t||i||r}hasTextLayoutProperties(){const e=this.hasLayoutProperty("text-size"),t=this.hasLayoutProperty("text-offset"),i=this.hasLayoutProperty("text-rotate");return e||t||i}hasIconPaintProperties(){return!!this.unevaluatedPaint&&Object.keys(this.unevaluatedPaint._values).filter(e=>!e.endsWith("-use-theme")).some(e=>(e.startsWith("icon-")||"symbol-z-offset"===e)&&this.hasPaintProperty(e))}hasTextPaintProperties(){return!!this.unevaluatedPaint&&Object.keys(this.unevaluatedPaint._values).filter(e=>!e.endsWith("-use-theme")).some(e=>(e.startsWith("text-")||"symbol-z-offset"===e)&&this.hasPaintProperty(e))}hasLayoutProperty(e){return this.unevaluatedLayout&&void 0!==this.unevaluatedLayout._values[e].value}hasPaintProperty(e){return this.unevaluatedPaint&&void 0!==this.unevaluatedPaint._values[e].value}}const Eo="-transition",Io=new Set(["fill","line","background","hillshade","raster"]);class StyleLayer extends Evented{constructor(e,t,i,r,n,o){if(super(),this.id=e.id,this.fqid=go(this.id,i),this.runtimeLayerUID=vo++,this.type=e.type,this.scope=i,this.lut=r,this.options=n,this.iconImageUseTheme=o,this.appearances=new Array,this.appearancesVersion=0,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,"custom"!==e.type&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type&&"background"!==e.type&&"sky"!==e.type&&"slot"!==e.type&&"placement-group"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),e.slot&&(this.slot=e.slot),e.appearances&&this.setAppearances(e.appearances),t.layout&&(this._unevaluatedLayout=new Layout(t.layout,this.scope,n,this.iconImageUseTheme)),t.paint)){this._transitionablePaint=new Transitionable(t.paint,this.scope,n);for(const t in e.paint)this.setPaintProperty(t,e.paint[t]);for(const t in e.layout)this.setLayoutProperty(t,e.layout[t]);this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new PossiblyEvaluated(t.paint)}}onAdd(e){}onRemove(e){}placeSymbols(e,t,i,r,n){}isDraped(e){return!this.is3D(!0)&&Io.has(this.type)}getLayoutProperty(e){return"visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,t){if("custom"===this.type&&"visibility"===e)return void(this.visibility=t);const i=this._unevaluatedLayout;i._properties.properties[e]&&(i.setValue(e,t),"visibility"===e&&this.possiblyEvaluateVisibility())}setAppearances(e){this.appearances=[],e.forEach(e=>{this.appearances.push(new SymbolAppearance(e.condition,e.name,e.properties,this.scope,this.options,this.iconImageUseTheme))}),this.appearancesVersion++}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(e){return e.endsWith(Eo)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}isPaintProperty(e){return!!this._transitionablePaint._properties.properties[e]}setPaintProperty(e,t){const i=this._transitionablePaint,r=i._properties.properties;if(e.endsWith(Eo)){const n=e.slice(0,-11);return r[n]&&i.setTransition(n,t||void 0),!1}if(!r[e])return!1;const n=i._values[e],o=n.value.isDataDriven(),a=n.value;i.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);const s=i._values[e].value,l=s.isDataDriven(),u=e.endsWith("pattern")||"line-dasharray"===e;return l||o||u||this._handleOverridablePaintPropertyUpdate(e,a,s)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,t,i){return null}_handleOverridablePaintPropertyUpdate(e,t,i){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||"none"===this.visibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t,this.iconImageUseTheme)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){const e={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&&(e.appearances=this.appearances.map(e=>e.serialize())),function(e,t){const i={};for(const r in e)t.call(this,e[r],r,e)&&(i[r]=e[r]);return i}(e,(e,t)=>!(void 0===e||"layout"===t&&!Object.keys(e).length||"paint"===t&&!Object.keys(e).length))}is3D(e){return!1}hasElevation(){return!1}mayUse(e){return!1}prepare(){return Promise.resolve()}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 e in this.paint._values){const t=this.paint.get(e);if(t instanceof PossiblyEvaluatedPropertyValue&&zr(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}for(const e of this.appearances)if(!Kt(e.condition.expression))return!0;return!1}compileFilter(e){this._filterCompiled||(this._featureFilter=no(this.filter,this.scope,e),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}dynamicFilterNeedsGeometry(){return this._featureFilter.needGeometry}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(e){this._stats&&("shadow"===e.renderPass?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}getAppearances(){return this.appearances}queryRenderedFeatures(e,t,i){return{}}queryRadius(e){}queryIntersectsFeature(e,t,i,r,n,o,a,s,l,u){}}function So(e,t,i){if(!e._unevaluatedLayout)return!1;const r=e._unevaluatedLayout.getValue(t);return void 0!==r&&("string"!=typeof r||i(r))}function Do(e,t,i=2){const r=t&&t.length,n=r?t[0]*i:e.length;let o=Po(e,0,n,i,!0);const a=[];if(!o||o.next===o.prev)return a;let s,l,u;if(r&&(o=function(e,t,i,r){const n=[];for(let i=0,o=t.length;i<o;i++){const a=Po(e,t[i]*r,i<o-1?t[i+1]*r:e.length,r,!1);a===a.next&&(a.steiner=!0),n.push(ko(a))}n.sort(Fo);for(let e=0;e<n.length;e++)i=Bo(n[e],i);return i}(e,t,o,i)),e.length>80*i){s=e[0],l=e[1];let t=s,r=l;for(let o=i;o<n;o+=i){const i=e[o],n=e[o+1];i<s&&(s=i),n<l&&(l=n),i>t&&(t=i),n>r&&(r=n)}u=Math.max(t-s,r-l),u=0!==u?32767/u:0}return zo(o,a,i,s,l,u,0),a}function Po(e,t,i,r,n){let o;if(n===function(e,t,i,r){let n=0;for(let o=t,a=i-r;o<i;o+=r)n+=(e[a]-e[o])*(e[o+1]+e[a+1]),a=o;return n}(e,t,i,r)>0)for(let n=t;n<i;n+=r)o=Yo(n/r|0,e[n],e[n+1],o);else for(let n=i-r;n>=t;n-=r)o=Yo(n/r|0,e[n],e[n+1],o);return o&&Ho(o,o.next)&&(Jo(o),o=o.next),o}function To(e,t){if(!e)return e;t||(t=e);let i,r=e;do{if(i=!1,r.steiner||!Ho(r,r.next)&&0!==jo(r.prev,r,r.next))r=r.next;else{if(Jo(r),r=t=r.prev,r===r.next)break;i=!0}}while(i||r!==t);return t}function zo(e,t,i,r,n,o,a){if(!e)return;!a&&o&&function(e,t,i,r){let n=e;do{0===n.z&&(n.z=Vo(n.x,n.y,t,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){let t,i=1;do{let r,n=e;e=null;let o=null;for(t=0;n;){t++;let a=n,s=0;for(let e=0;e<i&&(s++,a=a.nextZ,a);e++);let l=i;for(;s>0||l>0&&a;)0!==s&&(0===l||!a||n.z<=a.z)?(r=n,n=n.nextZ,s--):(r=a,a=a.nextZ,l--),o?o.nextZ=r:e=r,r.prevZ=o,o=r;n=a}o.nextZ=null,i*=2}while(t>1)}(n)}(e,r,n,o);let s=e;for(;e.prev!==e.next;){const l=e.prev,u=e.next;if(o?Co(e,r,n,o):Mo(e))t.push(l.i,e.i,u.i),Jo(e),e=u.next,s=u.next;else if((e=u)===s){a?1===a?zo(e=Ro(To(e),t),t,i,r,n,o,2):2===a&&Lo(e,t,i,r,n,o):zo(To(e),t,i,r,n,o,1);break}}}function Mo(e){const t=e.prev,i=e,r=e.next;if(jo(t,i,r)>=0)return!1;const n=t.x,o=i.x,a=r.x,s=t.y,l=i.y,u=r.y,c=Math.min(n,o,a),h=Math.min(s,l,u),d=Math.max(n,o,a),p=Math.max(s,l,u);let f=r.next;for(;f!==t;){if(f.x>=c&&f.x<=d&&f.y>=h&&f.y<=p&&Uo(n,s,o,l,a,u,f.x,f.y)&&jo(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function Co(e,t,i,r){const n=e.prev,o=e,a=e.next;if(jo(n,o,a)>=0)return!1;const s=n.x,l=o.x,u=a.x,c=n.y,h=o.y,d=a.y,p=Math.min(s,l,u),f=Math.min(c,h,d),m=Math.max(s,l,u),_=Math.max(c,h,d),g=Vo(p,f,t,i,r),y=Vo(m,_,t,i,r);let x=e.prevZ,v=e.nextZ;for(;x&&x.z>=g&&v&&v.z<=y;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=_&&x!==n&&x!==a&&Uo(s,c,l,h,u,d,x.x,x.y)&&jo(x.prev,x,x.next)>=0)return!1;if(x=x.prevZ,v.x>=p&&v.x<=m&&v.y>=f&&v.y<=_&&v!==n&&v!==a&&Uo(s,c,l,h,u,d,v.x,v.y)&&jo(v.prev,v,v.next)>=0)return!1;v=v.nextZ}for(;x&&x.z>=g;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=_&&x!==n&&x!==a&&Uo(s,c,l,h,u,d,x.x,x.y)&&jo(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;v&&v.z<=y;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=_&&v!==n&&v!==a&&Uo(s,c,l,h,u,d,v.x,v.y)&&jo(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function Ro(e,t){let i=e;do{const r=i.prev,n=i.next.next;!Ho(r,n)&&$o(r,i,i.next,n)&&qo(r,n)&&qo(n,r)&&(t.push(r.i,i.i,n.i),Jo(i),Jo(i.next),i=e=n),i=i.next}while(i!==e);return To(i)}function Lo(e,t,i,r,n,o){let a=e;do{let e=a.next.next;for(;e!==a.prev;){if(a.i!==e.i&&Go(a,e)){let s=Zo(a,e);return a=To(a,a.next),s=To(s,s.next),zo(a,t,i,r,n,o,0),void zo(s,t,i,r,n,o,0)}e=e.next}a=a.next}while(a!==e)}function Fo(e,t){let i=e.x-t.x;return 0===i&&(i=e.y-t.y,0===i)&&(i=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)),i}function Bo(e,t){const i=function(e,t){let i=t;const r=e.x,n=e.y;let o,a=-1/0;if(Ho(e,i))return i;do{if(Ho(e,i.next))return i.next;if(n<=i.y&&n>=i.next.y&&i.next.y!==i.y){const e=i.x+(n-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(e<=r&&e>a&&(a=e,o=i.x<i.next.x?i:i.next,e===r))return o}i=i.next}while(i!==t);if(!o)return null;const s=o,l=o.x,u=o.y;let c=1/0;i=o;do{if(r>=i.x&&i.x>=l&&r!==i.x&&No(n<u?r:a,n,l,u,n<u?a:r,n,i.x,i.y)){const t=Math.abs(n-i.y)/(r-i.x);qo(i,e)&&(t<c||t===c&&(i.x>o.x||i.x===o.x&&Oo(o,i)))&&(o=i,c=t)}i=i.next}while(i!==s);return o}(e,t);if(!i)return t;const r=Zo(i,e);return To(r,r.next),To(i,i.next)}function Oo(e,t){return jo(e.prev,e,t.prev)<0&&jo(t.next,e,e.next)<0}function Vo(e,t,i,r,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function ko(e){let t=e,i=e;do{(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next}while(t!==e);return i}function No(e,t,i,r,n,o,a,s){return(n-a)*(t-s)>=(e-a)*(o-s)&&(e-a)*(r-s)>=(i-a)*(t-s)&&(i-a)*(o-s)>=(n-a)*(r-s)}function Uo(e,t,i,r,n,o,a,s){return!(e===a&&t===s)&&No(e,t,i,r,n,o,a,s)}function Go(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&$o(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(qo(e,t)&&qo(t,e)&&function(e,t){let i=e,r=!1;const n=(e.x+t.x)/2,o=(e.y+t.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&n<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==e);return r}(e,t)&&(jo(e.prev,e,t.prev)||jo(e,t.prev,t))||Ho(e,t)&&jo(e.prev,e,e.next)>0&&jo(t.prev,t,t.next)>0)}function jo(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function Ho(e,t){return e.x===t.x&&e.y===t.y}function $o(e,t,i,r){const n=Xo(jo(e,t,i)),o=Xo(jo(e,t,r)),a=Xo(jo(i,r,e)),s=Xo(jo(i,r,t));return n!==o&&a!==s||!(0!==n||!Wo(e,i,t))||!(0!==o||!Wo(e,r,t))||!(0!==a||!Wo(i,e,r))||!(0!==s||!Wo(i,t,r))}function Wo(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function Xo(e){return e>0?1:e<0?-1:0}function qo(e,t){return jo(e.prev,e,e.next)<0?jo(e,t,e.next)>=0&&jo(e,e.prev,t)>=0:jo(e,t,e.prev)<0||jo(e,e.next,t)<0}function Zo(e,t){const i=Ko(e.i,e.x,e.y),r=Ko(t.i,t.x,t.y),n=e.next,o=t.prev;return e.next=t,t.prev=e,i.next=n,n.prev=i,r.next=i,i.prev=r,o.next=r,r.prev=o,r}function Yo(e,t,i,r){const n=Ko(e,t,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function Jo(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Ko(e,t,i){return{i:e,x:t,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Qo(e,t,i=1){if(!e)return null;const r="string"==typeof e?ResolvedImage.from(e).getPrimary():e.getPrimary(),n="string"==typeof e?null:e.getSecondary();for(const e of[r,n]){if(!e)continue;const r=e.id.toString();t.has(r)||t.set(r,[]),e.scaleSelf(i),t.get(r).push(e)}return{primary:r.toString(),secondary:n?n.toString():null}}function ea(e,t,i,r){const n=r.patternDependencies;let o=!1;for(const r of t){const t=r.paint.get(`${e}-pattern`);t.isConstant()||(o=!0),Qo(t.constantOr(null),n,i)&&(o=!0)}return o}function ta(e,t,i,r,n,o){const a=o.patternDependencies;for(const s of t){const t=s.paint.get(`${e}-pattern`).value;if("constant"!==t.kind){const e=Qo(t.evaluate({zoom:r},i,{},void 0,o.availableImages),a,n);if(!e)continue;const{primary:l,secondary:u}=e;l&&(i.patterns[s.id]=[l,u].filter(Boolean))}}return i}const ia=Xt/Math.PI/2,ra=-ia,na=ia;function oa(e,t,i,r=ia){return i=ye(i),[e*Math.sin(i)*r,-t*r,e*Math.cos(i)*r]}function aa(e,t,i){return oa(Math.cos(ye(e)),Math.sin(ye(e)),t,i)}const sa=6371008.8,la=2*Math.PI*sa;class LngLat{constructor(e,t){if(isNaN(e)||isNaN(t))throw new Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new LngLat(we(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const t=Math.PI/180,i=this.lat*t,r=e.lat*t,n=Math.sin(i)*Math.sin(r)+Math.cos(i)*Math.cos(r)*Math.cos((e.lng-this.lng)*t);return sa*Math.acos(Math.min(n,1))}toBounds(e=0){const t=360*e/40075017,i=t/Math.cos(Math.PI/180*this.lat);return new LngLatBounds({lng:this.lng-i,lat:this.lat-t},{lng:this.lng+i,lat:this.lat+t})}toEcef(e){return aa(this.lat,this.lng,ia+e*ia/sa)}static convert(e){if(e instanceof LngLat)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new LngLat(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new LngLat(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class LngLatBounds{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):Array.isArray(e)&&4===e.length?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1]))}setNorthEast(e){return this._ne=e instanceof LngLat?new LngLat(e.lng,e.lat):LngLat.convert(e),this}setSouthWest(e){return this._sw=e instanceof LngLat?new LngLat(e.lng,e.lat):LngLat.convert(e),this}extend(e){const t=this._sw,i=this._ne;let r,n;if(e instanceof LngLat)r=e,n=e;else{if(!(e instanceof LngLatBounds))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(LngLatBounds.convert(e)):this.extend(LngLat.convert(e)):"object"==typeof e&&null!==e&&Object.hasOwn(e,"lat")&&(Object.hasOwn(e,"lon")||Object.hasOwn(e,"lng"))?this.extend(LngLat.convert(e)):this;if(r=e._sw,n=e._ne,!r||!n)return this}return t||i?(t.lng=Math.min(r.lng,t.lng),t.lat=Math.min(r.lat,t.lat),i.lng=Math.max(n.lng,i.lng),i.lat=Math.max(n.lat,i.lat)):(this._sw=new LngLat(r.lng,r.lat),this._ne=new LngLat(n.lng,n.lat)),this}getCenter(){return new LngLat((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 LngLat(this.getWest(),this.getNorth())}getSouthEast(){return new LngLat(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:t,lat:i}=LngLat.convert(e);let r=this._sw.lng<=t&&t<=this._ne.lng;return this._sw.lng>this._ne.lng&&(r=this._sw.lng>=t&&t>=this._ne.lng),this._sw.lat<=i&&i<=this._ne.lat&&r}static convert(e){if(e)return e instanceof LngLatBounds?e:new LngLatBounds(e)}}function ua(e){return la*Math.cos(e*Math.PI/180)}function ca(e,t){return e/ua(t)}const ha=85.051129;function da(e){return Math.cos(ye(ve(e,-85.051129,ha)))}function pa(e,t){const i=ve(t,0,25.5),r=Math.pow(2,i);return da(e)*la/(512*r)}function fa(e,t=0){const i=Math.exp(Math.PI*(1-(e.y+t/Xt)/(1<<e.z)*2));return 80150034*i/(i*i+1)/Xt/(1<<e.z)}class MercatorCoordinate{constructor(e,t,i=0){this.x=+e,this.y=+t,this.z=+i}static fromLngLat(e,t=0){const i=LngLat.convert(e);return new MercatorCoordinate(Ct(i.lng),Rt(i.lat),ca(t,i.lat))}toLngLat(){return new LngLat(Lt(this.x),Ft(this.y))}toAltitude(){return this.z*ua(Ft(this.y))}meterInMercatorCoordinateUnits(){return 1/la*(e=Ft(this.y),1/Math.cos(e*Math.PI/180));var e}}function ma(e,t,i,r,n,o,a,s,l){const u=(t+r)/2,c=(i+n)/2,h=new K(u,c);s(h),function(e,t,i,r,n,o){const a=i-n,s=r-o;return Math.abs((r-t)*a-(i-e)*s)/Math.hypot(a,s)}(h.x,h.y,o.x,o.y,a.x,a.y)>=l?(ma(e,t,i,u,c,o,h,s,l),ma(e,u,c,r,n,h,a,s,l)):e.push(a)}function _a(e,t,i){let r=e[0],n=r.x,o=r.y;t(r);const a=[r];for(let s=1;s<e.length;s++){const l=e[s],{x:u,y:c}=l;t(l),ma(a,n,o,u,c,r,l,t,i),n=u,o=c,r=l}return a}function ga(e,t,i,r){if(r(t,i)){const n=t.add(i)._mult(.5);ga(e,t,n,r),ga(e,n,i,r)}else e.push(i)}function ya(e,t){let i=e[0];const r=[i];for(let n=1;n<e.length;n++){const o=e[n];ga(r,i,o,t),i=o}return r}const xa=Math.pow(2,14)-1,va=-xa-1;function ba(e,t){const i=Math.round(e.x*t),r=Math.round(e.y*t);return e.x=ve(i,va,xa),e.y=ve(r,va,xa),(i<e.x||i>e.x+1||r<e.y||r>e.y+1)&&ze("Geometry exceeds allowed extent, reduce your vector tile buffer size"),e}function wa(e,t,i){const r=e.loadGeometry(),n=e.extent,o=Xt/n;if(t&&i&&i.projection.isReprojectedInTileSpace){const o=1<<t.z,{scale:a,x:s,y:l,projection:u}=i,c=e=>{const i=Lt((t.x+e.x/n)/o),r=Ft((t.y+e.y/n)/o),c=u.project(i,r);e.x=(c.x*a-s)*n,e.y=(c.y*a-l)*n};for(let t=0;t<r.length;t++)if(1!==e.type)r[t]=_a(r[t],c,1);else{const e=[];for(const i of r[t])i.x<0||i.x>=n||i.y<0||i.y>=n||(c(i),e.push(i));r[t]=e}}for(const e of r)for(const t of e)ba(t,o);return r}function Aa(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?wa(e):[]}}const Ea={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Struct{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}const Ia=new ArrayBuffer(0);class StructArray{constructor(){this._reallocCount=0,this.capacity=0,this.length=0}static serialize(e,t){return e._trim(),t&&e.arrayBuffer&&t.add(e.arrayBuffer),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,e.arrayBuffer?t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement:(t.capacity=0,t.arrayBuffer=Ia),t._refreshViews(),t}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}resizeExact(e){this.reserveExact(e),this.length=e}reserve(e){e>this.capacity&&this._allocate(Math.max(e,Math.floor(5*this.capacity),128))}reserveExact(e){(e>this.capacity||!this.arrayBuffer)&&this._allocate(e)}_allocate(e){this._reallocCount++,this.capacity=e,this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}reserveForAdditional(e){this.reserve(this.length+e)}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...e){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...e){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 Sa(e,t=1){let i=0,r=0;return{members:e.map(e=>{const n=Ea[e.type].BYTES_PER_ELEMENT,o=i=Da(i,Math.max(t,n)),a=e.components||1;return r=Math.max(r,n),i+=n*a,{name:e.name,type:e.type,components:a,offset:o,normalized:e.normalized}}),size:Da(i,Math.max(r,t)),alignment:t}}function Da(e,t){return Math.ceil(e/t)*t}class StructArrayLayout2i4 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const r=2*e;return this.int16[r+0]=t,this.int16[r+1]=i,e}}StructArrayLayout2i4.prototype.bytesPerElement=4,rn(StructArrayLayout2i4,"StructArrayLayout2i4");class StructArrayLayout3i6 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=3*e;return this.int16[n+0]=t,this.int16[n+1]=i,this.int16[n+2]=r,e}}StructArrayLayout3i6.prototype.bytesPerElement=6,rn(StructArrayLayout3i6,"StructArrayLayout3i6");class StructArrayLayout2i2ui8 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=4*e;return this.int16[o+0]=t,this.int16[o+1]=i,this.uint16[o+2]=r,this.uint16[o+3]=n,e}}StructArrayLayout2i2ui8.prototype.bytesPerElement=8,rn(StructArrayLayout2i2ui8,"StructArrayLayout2i2ui8");class StructArrayLayout1f4 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.float32[1*e+0]=t,e}}StructArrayLayout1f4.prototype.bytesPerElement=4,rn(StructArrayLayout1f4,"StructArrayLayout1f4");class StructArrayLayout2i1f8 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=4*e,o=2*e;return this.int16[n+0]=t,this.int16[n+1]=i,this.float32[o+1]=r,e}}StructArrayLayout2i1f8.prototype.bytesPerElement=8,rn(StructArrayLayout2i1f8,"StructArrayLayout2i1f8");class StructArrayLayout3i8 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=4*e;return this.int16[n+0]=t,this.int16[n+1]=i,this.int16[n+2]=r,e}}StructArrayLayout3i8.prototype.bytesPerElement=8,rn(StructArrayLayout3i8,"StructArrayLayout3i8");class StructArrayLayout4i8 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=4*e;return this.int16[o+0]=t,this.int16[o+1]=i,this.int16[o+2]=r,this.int16[o+3]=n,e}}StructArrayLayout4i8.prototype.bytesPerElement=8,rn(StructArrayLayout4i8,"StructArrayLayout4i8");class StructArrayLayout5i10 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n)}emplace(e,t,i,r,n,o){const a=5*e;return this.int16[a+0]=t,this.int16[a+1]=i,this.int16[a+2]=r,this.int16[a+3]=n,this.int16[a+4]=o,e}}StructArrayLayout5i10.prototype.bytesPerElement=10,rn(StructArrayLayout5i10,"StructArrayLayout5i10");class StructArrayLayout2i4ub1f12 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,a){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,o,a)}emplace(e,t,i,r,n,o,a,s){const l=6*e,u=12*e,c=3*e;return this.int16[l+0]=t,this.int16[l+1]=i,this.uint8[u+4]=r,this.uint8[u+5]=n,this.uint8[u+6]=o,this.uint8[u+7]=a,this.float32[c+2]=s,e}}StructArrayLayout2i4ub1f12.prototype.bytesPerElement=12,rn(StructArrayLayout2i4ub1f12,"StructArrayLayout2i4ub1f12");class StructArrayLayout3f12 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=3*e;return this.float32[n+0]=t,this.float32[n+1]=i,this.float32[n+2]=r,e}}StructArrayLayout3f12.prototype.bytesPerElement=12,rn(StructArrayLayout3f12,"StructArrayLayout3f12");class StructArrayLayout4ui1f12 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n)}emplace(e,t,i,r,n,o){const a=6*e,s=3*e;return this.uint16[a+0]=t,this.uint16[a+1]=i,this.uint16[a+2]=r,this.uint16[a+3]=n,this.float32[s+2]=o,e}}StructArrayLayout4ui1f12.prototype.bytesPerElement=12,rn(StructArrayLayout4ui1f12,"StructArrayLayout4ui1f12");class StructArrayLayout4ui8 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=4*e;return this.uint16[o+0]=t,this.uint16[o+1]=i,this.uint16[o+2]=r,this.uint16[o+3]=n,e}}StructArrayLayout4ui8.prototype.bytesPerElement=8,rn(StructArrayLayout4ui8,"StructArrayLayout4ui8");class StructArrayLayout6i12 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n,o)}emplace(e,t,i,r,n,o,a){const s=6*e;return this.int16[s+0]=t,this.int16[s+1]=i,this.int16[s+2]=r,this.int16[s+3]=n,this.int16[s+4]=o,this.int16[s+5]=a,e}}StructArrayLayout6i12.prototype.bytesPerElement=12,rn(StructArrayLayout6i12,"StructArrayLayout6i12");class StructArrayLayout4i4ui4i24 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,a,s,l,u,c,h){const d=this.length;return this.resize(d+1),this.emplace(d,e,t,i,r,n,o,a,s,l,u,c,h)}emplace(e,t,i,r,n,o,a,s,l,u,c,h,d){const p=12*e;return this.int16[p+0]=t,this.int16[p+1]=i,this.int16[p+2]=r,this.int16[p+3]=n,this.uint16[p+4]=o,this.uint16[p+5]=a,this.uint16[p+6]=s,this.uint16[p+7]=l,this.int16[p+8]=u,this.int16[p+9]=c,this.int16[p+10]=h,this.int16[p+11]=d,e}}StructArrayLayout4i4ui4i24.prototype.bytesPerElement=24,rn(StructArrayLayout4i4ui4i24,"StructArrayLayout4i4ui4i24");class StructArrayLayout3i3f20 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n,o)}emplace(e,t,i,r,n,o,a){const s=10*e,l=5*e;return this.int16[s+0]=t,this.int16[s+1]=i,this.int16[s+2]=r,this.float32[l+2]=n,this.float32[l+3]=o,this.float32[l+4]=a,e}}StructArrayLayout3i3f20.prototype.bytesPerElement=20,rn(StructArrayLayout3i3f20,"StructArrayLayout3i3f20");class StructArrayLayout4f16 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=4*e;return this.float32[o+0]=t,this.float32[o+1]=i,this.float32[o+2]=r,this.float32[o+3]=n,e}}StructArrayLayout4f16.prototype.bytesPerElement=16,rn(StructArrayLayout4f16,"StructArrayLayout4f16");class StructArrayLayout1ul4 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint32[1*e+0]=t,e}}StructArrayLayout1ul4.prototype.bytesPerElement=4,rn(StructArrayLayout1ul4,"StructArrayLayout1ul4");class StructArrayLayout2ui4 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const r=2*e;return this.uint16[r+0]=t,this.uint16[r+1]=i,e}}StructArrayLayout2ui4.prototype.bytesPerElement=4,rn(StructArrayLayout2ui4,"StructArrayLayout2ui4");class StructArrayLayout5i4f1i1ul2ui40 extends StructArray{_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(e,t,i,r,n,o,a,s,l,u,c,h,d){const p=this.length;return this.resize(p+1),this.emplace(p,e,t,i,r,n,o,a,s,l,u,c,h,d)}emplace(e,t,i,r,n,o,a,s,l,u,c,h,d,p){const f=20*e,m=10*e;return this.int16[f+0]=t,this.int16[f+1]=i,this.int16[f+2]=r,this.int16[f+3]=n,this.int16[f+4]=o,this.float32[m+3]=a,this.float32[m+4]=s,this.float32[m+5]=l,this.float32[m+6]=u,this.int16[f+14]=c,this.uint32[m+8]=h,this.uint16[f+18]=d,this.uint16[f+19]=p,e}}StructArrayLayout5i4f1i1ul2ui40.prototype.bytesPerElement=40,rn(StructArrayLayout5i4f1i1ul2ui40,"StructArrayLayout5i4f1i1ul2ui40");class StructArrayLayout3i2i2i16 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,a){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,o,a)}emplace(e,t,i,r,n,o,a,s){const l=8*e;return this.int16[l+0]=t,this.int16[l+1]=i,this.int16[l+2]=r,this.int16[l+4]=n,this.int16[l+5]=o,this.int16[l+6]=a,this.int16[l+7]=s,e}}StructArrayLayout3i2i2i16.prototype.bytesPerElement=16,rn(StructArrayLayout3i2i2i16,"StructArrayLayout3i2i2i16");class StructArrayLayout2f1f2i16 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n)}emplace(e,t,i,r,n,o){const a=4*e,s=8*e;return this.float32[a+0]=t,this.float32[a+1]=i,this.float32[a+2]=r,this.int16[s+6]=n,this.int16[s+7]=o,e}}StructArrayLayout2f1f2i16.prototype.bytesPerElement=16,rn(StructArrayLayout2f1f2i16,"StructArrayLayout2f1f2i16");class StructArrayLayout2ub4f20 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n,o)}emplace(e,t,i,r,n,o,a){const s=20*e,l=5*e;return this.uint8[s+0]=t,this.uint8[s+1]=i,this.float32[l+1]=r,this.float32[l+2]=n,this.float32[l+3]=o,this.float32[l+4]=a,e}}StructArrayLayout2ub4f20.prototype.bytesPerElement=20,rn(StructArrayLayout2ub4f20,"StructArrayLayout2ub4f20");class StructArrayLayout3ui6 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=3*e;return this.uint16[n+0]=t,this.uint16[n+1]=i,this.uint16[n+2]=r,e}}StructArrayLayout3ui6.prototype.bytesPerElement=6,rn(StructArrayLayout3ui6,"StructArrayLayout3ui6");class StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60 extends StructArray{_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(e,t,i,r,n,o,a,s,l,u,c,h,d,p,f,m,_,g,y,x,v){const b=this.length;return this.resize(b+1),this.emplace(b,e,t,i,r,n,o,a,s,l,u,c,h,d,p,f,m,_,g,y,x,v)}emplace(e,t,i,r,n,o,a,s,l,u,c,h,d,p,f,m,_,g,y,x,v,b){const w=30*e,A=15*e,E=60*e;return this.int16[w+0]=t,this.int16[w+1]=i,this.int16[w+2]=r,this.float32[A+2]=n,this.float32[A+3]=o,this.uint16[w+8]=a,this.uint16[w+9]=s,this.uint32[A+5]=l,this.uint32[A+6]=u,this.uint32[A+7]=c,this.uint16[w+16]=h,this.uint16[w+17]=d,this.uint16[w+18]=p,this.float32[A+10]=f,this.float32[A+11]=m,this.uint8[E+48]=_,this.uint8[E+49]=g,this.uint8[E+50]=y,this.uint32[A+13]=x,this.int16[w+28]=v,this.uint8[E+58]=b,e}}StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60.prototype.bytesPerElement=60,rn(StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class StructArrayLayout2f9i15ui1ul4f1ub1ui80 extends StructArray{_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(e,t,i,r,n,o,a,s,l,u,c,h,d,p,f,m,_,g,y,x,v,b,w,A,E,I,D,P,T,z,M,C,R){const L=this.length;return this.resize(L+1),this.emplace(L,e,t,i,r,n,o,a,s,l,u,c,h,d,p,f,m,_,g,y,x,v,b,w,A,E,I,D,P,T,z,M,C,R)}emplace(e,t,i,r,n,o,a,s,l,u,c,h,d,p,f,m,_,g,y,x,v,b,w,A,E,I,D,P,T,z,M,C,R,L){const F=20*e,B=40*e,O=80*e;return this.float32[F+0]=t,this.float32[F+1]=i,this.int16[B+4]=r,this.int16[B+5]=n,this.int16[B+6]=o,this.int16[B+7]=a,this.int16[B+8]=s,this.int16[B+9]=l,this.int16[B+10]=u,this.int16[B+11]=c,this.int16[B+12]=h,this.uint16[B+13]=d,this.uint16[B+14]=p,this.uint16[B+15]=f,this.uint16[B+16]=m,this.uint16[B+17]=_,this.uint16[B+18]=g,this.uint16[B+19]=y,this.uint16[B+20]=x,this.uint16[B+21]=v,this.uint16[B+22]=b,this.uint16[B+23]=w,this.uint16[B+24]=A,this.uint16[B+25]=E,this.uint16[B+26]=I,this.uint16[B+27]=D,this.uint32[F+14]=P,this.float32[F+15]=T,this.float32[F+16]=z,this.float32[F+17]=M,this.float32[F+18]=C,this.uint8[O+76]=R,this.uint16[B+39]=L,e}}StructArrayLayout2f9i15ui1ul4f1ub1ui80.prototype.bytesPerElement=80,rn(StructArrayLayout2f9i15ui1ul4f1ub1ui80,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class StructArrayLayout6f24 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n,o)}emplace(e,t,i,r,n,o,a){const s=6*e;return this.float32[s+0]=t,this.float32[s+1]=i,this.float32[s+2]=r,this.float32[s+3]=n,this.float32[s+4]=o,this.float32[s+5]=a,e}}StructArrayLayout6f24.prototype.bytesPerElement=24,rn(StructArrayLayout6f24,"StructArrayLayout6f24");class StructArrayLayout5f20 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n)}emplace(e,t,i,r,n,o){const a=5*e;return this.float32[a+0]=t,this.float32[a+1]=i,this.float32[a+2]=r,this.float32[a+3]=n,this.float32[a+4]=o,e}}StructArrayLayout5f20.prototype.bytesPerElement=20,rn(StructArrayLayout5f20,"StructArrayLayout5f20");class StructArrayLayout7f28 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,a){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,o,a)}emplace(e,t,i,r,n,o,a,s){const l=7*e;return this.float32[l+0]=t,this.float32[l+1]=i,this.float32[l+2]=r,this.float32[l+3]=n,this.float32[l+4]=o,this.float32[l+5]=a,this.float32[l+6]=s,e}}StructArrayLayout7f28.prototype.bytesPerElement=28,rn(StructArrayLayout7f28,"StructArrayLayout7f28");class StructArrayLayout11f44 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,a,s,l,u,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,t,i,r,n,o,a,s,l,u,c)}emplace(e,t,i,r,n,o,a,s,l,u,c,h){const d=11*e;return this.float32[d+0]=t,this.float32[d+1]=i,this.float32[d+2]=r,this.float32[d+3]=n,this.float32[d+4]=o,this.float32[d+5]=a,this.float32[d+6]=s,this.float32[d+7]=l,this.float32[d+8]=u,this.float32[d+9]=c,this.float32[d+10]=h,e}}StructArrayLayout11f44.prototype.bytesPerElement=44,rn(StructArrayLayout11f44,"StructArrayLayout11f44");class StructArrayLayout9f36 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,a,s,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,t,i,r,n,o,a,s,l)}emplace(e,t,i,r,n,o,a,s,l,u){const c=9*e;return this.float32[c+0]=t,this.float32[c+1]=i,this.float32[c+2]=r,this.float32[c+3]=n,this.float32[c+4]=o,this.float32[c+5]=a,this.float32[c+6]=s,this.float32[c+7]=l,this.float32[c+8]=u,e}}StructArrayLayout9f36.prototype.bytesPerElement=36,rn(StructArrayLayout9f36,"StructArrayLayout9f36");class StructArrayLayout2f8 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const r=2*e;return this.float32[r+0]=t,this.float32[r+1]=i,e}}StructArrayLayout2f8.prototype.bytesPerElement=8,rn(StructArrayLayout2f8,"StructArrayLayout2f8");class StructArrayLayout1ul3ui12 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=6*e;return this.uint32[3*e+0]=t,this.uint16[o+2]=i,this.uint16[o+3]=r,this.uint16[o+4]=n,e}}StructArrayLayout1ul3ui12.prototype.bytesPerElement=12,rn(StructArrayLayout1ul3ui12,"StructArrayLayout1ul3ui12");class StructArrayLayout1ui2 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint16[1*e+0]=t,e}}StructArrayLayout1ui2.prototype.bytesPerElement=2,rn(StructArrayLayout1ui2,"StructArrayLayout1ui2");class StructArrayLayout4b4 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int8=new Int8Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=4*e;return this.int8[o+0]=t,this.int8[o+1]=i,this.int8[o+2]=r,this.int8[o+3]=n,e}}StructArrayLayout4b4.prototype.bytesPerElement=4,rn(StructArrayLayout4b4,"StructArrayLayout4b4");class StructArrayLayout16f64 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,a,s,l,u,c,h,d,p,f,m){const _=this.length;return this.resize(_+1),this.emplace(_,e,t,i,r,n,o,a,s,l,u,c,h,d,p,f,m)}emplace(e,t,i,r,n,o,a,s,l,u,c,h,d,p,f,m,_){const g=16*e;return this.float32[g+0]=t,this.float32[g+1]=i,this.float32[g+2]=r,this.float32[g+3]=n,this.float32[g+4]=o,this.float32[g+5]=a,this.float32[g+6]=s,this.float32[g+7]=l,this.float32[g+8]=u,this.float32[g+9]=c,this.float32[g+10]=h,this.float32[g+11]=d,this.float32[g+12]=p,this.float32[g+13]=f,this.float32[g+14]=m,this.float32[g+15]=_,e}}StructArrayLayout16f64.prototype.bytesPerElement=64,rn(StructArrayLayout16f64,"StructArrayLayout16f64");class StructArrayLayout1i2 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.int16[1*e+0]=t,e}}StructArrayLayout1i2.prototype.bytesPerElement=2,rn(StructArrayLayout1i2,"StructArrayLayout1i2");class StructArrayLayout1ub1 extends StructArray{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint8[1*e+0]=t,e}}StructArrayLayout1ub1.prototype.bytesPerElement=1,rn(StructArrayLayout1ub1,"StructArrayLayout1ub1");class CollisionBoxStruct extends Struct{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]}}CollisionBoxStruct.prototype.size=40;class CollisionBoxArray extends StructArrayLayout5i4f1i1ul2ui40{get(e){return new CollisionBoxStruct(this,e)}}rn(CollisionBoxArray,"CollisionBoxArray");class PlacedSymbolStruct extends Struct{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(e){this._structArray.uint8[this._pos1+49]=e}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e}}PlacedSymbolStruct.prototype.size=60;class PlacedSymbolArray extends StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60{get(e){return new PlacedSymbolStruct(this,e)}}rn(PlacedSymbolArray,"PlacedSymbolArray");class SymbolInstanceStruct extends Struct{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(e){this._structArray.uint32[this._pos4+14]=e}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(e){this._structArray.float32[this._pos4+18]=e}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}SymbolInstanceStruct.prototype.size=80;class SymbolInstanceArray extends StructArrayLayout2f9i15ui1ul4f1ub1ui80{get(e){return new SymbolInstanceStruct(this,e)}}rn(SymbolInstanceArray,"SymbolInstanceArray");class GlyphOffsetArray extends StructArrayLayout1f4{getoffsetX(e){return this.float32[1*e+0]}}rn(GlyphOffsetArray,"GlyphOffsetArray");class SymbolLineVertexArray extends StructArrayLayout2i4{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}rn(SymbolLineVertexArray,"SymbolLineVertexArray");class FeatureIndexStruct extends Struct{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]}}FeatureIndexStruct.prototype.size=12;class FeatureIndexArray extends StructArrayLayout1ul3ui12{get(e){return new FeatureIndexStruct(this,e)}}rn(FeatureIndexArray,"FeatureIndexArray");class FillExtrusionCentroidArray extends StructArrayLayout2ui4{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}rn(FillExtrusionCentroidArray,"FillExtrusionCentroidArray");class FillExtrusionWallStruct extends Struct{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]}}FillExtrusionWallStruct.prototype.size=6;class FillExtrusionWallArray extends StructArrayLayout3i6{get(e){return new FillExtrusionWallStruct(this,e)}}rn(FillExtrusionWallArray,"FillExtrusionWallArray");const Pa=Sa([{name:"a_pos",components:2,type:"Int16"}],4),Ta=Sa([{name:"a_road_z_offset",components:1,type:"Float32"}],4),za=Sa([{name:"a_pos",components:2,type:"Int16"},{name:"a_height",components:1,type:"Float32"}],4),Ma=Sa([{name:"a_pos_normal_3",components:3,type:"Int16"}],4);class SegmentVector{constructor(e=[]){this.segments=e}_prepareSegment(e,t,i,r,n){let o=this.segments.at(-1);return e>SegmentVector.MAX_VERTEX_ARRAY_LENGTH&&ze(`Max vertices per segment is ${SegmentVector.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!o||o.vertexLength+e>SegmentVector.MAX_VERTEX_ARRAY_LENGTH||o.sortKey!==r||void 0!==n&&o&&void 0!==o.batchIndex&&o.batchIndex!==n)&&(o={vertexOffset:t,primitiveOffset:i,vertexLength:0,primitiveLength:0},void 0!==r&&(o.sortKey=r),void 0!==n&&(o.batchIndex=n),this.segments.push(o)),o}prepareSegment(e,t,i,r,n){return this._prepareSegment(e,t.length,i.length,r,n)}get(){return this.segments}destroy(){for(const e of this.segments)for(const t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,i,r){return new SegmentVector([{vertexOffset:e,primitiveOffset:t,vertexLength:i,primitiveLength:r,vaos:{},sortKey:0}])}}function Ca(e,t){return 256*(e=ve(Math.floor(e),0,255))+ve(Math.floor(t),0,255)}SegmentVector.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,rn(SegmentVector,"SegmentVector");const Ra=Sa([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),La=Sa([{name:"a_pattern_b",components:4,type:"Uint16"}]),Fa=Sa([{name:"a_dash",components:4,type:"Uint16"}]);function Ba(e,t=0){const i=3432918353,r=461845907,n=e.length,o=n-(3&n);let a,s=0|t,l=0;for(;l<o;)a=255&e.charCodeAt(l)|(255&e.charCodeAt(l+1))<<8|(255&e.charCodeAt(l+2))<<16|(255&e.charCodeAt(l+3))<<24,l+=4,a=Math.imul(a,i),a=a<<15|a>>>17,a=Math.imul(a,r),s^=a,s=s<<13|s>>>19,s=Math.imul(s,5)+3864292196|0;a=0;const u=3&n;return u>0&&(u>=3&&(a^=(255&e.charCodeAt(l+2))<<16),u>=2&&(a^=(255&e.charCodeAt(l+1))<<8),a^=255&e.charCodeAt(l),a=Math.imul(a,i),a=a<<15|a>>>17,a=Math.imul(a,r),s^=a),s^=n,s^=s>>>16,s=Math.imul(s,2246822507),s^=s>>>13,s=Math.imul(s,3266489909),s^=s>>>16,s>>>0}class FeaturePositionMap{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(e,t,i,r){this.ids.push(Oa(e)),this.positions.push(t,i,r)}eachPosition(e,t){const i=Oa(e);let r=0,n=this.ids.length-1;for(;r<n;){const e=r+n>>1;this.ids[e]>=i?n=e:r=e+1}for(;this.ids[r]===i;)t(this.positions[3*r],this.positions[3*r+1],this.positions[3*r+2]),r++}static serialize(e,t){const i=new Float64Array(e.ids),r=new Uint32Array(e.positions);return Va(i,r,0,i.length-1),t&&(t.add(i.buffer),t.add(r.buffer)),{ids:i,positions:r}}static deserialize(e){const t=new FeaturePositionMap;let i;t.ids=e.ids,t.positions=e.positions;for(const e of t.ids)e!==i&&t.uniqueIds.push(e),i=e;return t.indexed=!0,t}}function Oa(e){const t=+e;return Number.isSafeInteger(t)?t:Ba(String(e))}function Va(e,t,i,r){for(;i<r;){const n=e[i+r>>1];let o=i-1,a=r+1;for(;;){do{o++}while(e[o]<n);do{a--}while(e[a]>n);if(o>=a)break;ka(e,o,a),ka(t,3*o,3*a),ka(t,3*o+1,3*a+1),ka(t,3*o+2,3*a+2)}a-i<r-a?(Va(e,t,i,a),i=a+1):(Va(e,t,a+1,r),r=a)}}function ka(e,t,i){const r=e[t];e[t]=e[i],e[i]=r}rn(FeaturePositionMap,"FeaturePositionMap");class Uniform{constructor(e){this.gl=e.gl,this.initialized=!1}fetchUniformLocation(e,t){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(e,t),this.initialized=!0),!!this.location}set(e,t,i){throw new Error("Uniform#set() must be implemented by each concrete Uniform")}}class Uniform1f extends Uniform{constructor(e){super(e),this.current=0}set(e,t,i){this.fetchUniformLocation(e,t)&&this.current!==i&&(this.current=i,this.gl.uniform1f(this.location,i))}}class Uniform4ui extends Uniform{constructor(e){super(e),this.current=[0,0,0,0]}set(e,t,i){this.fetchUniformLocation(e,t)&&(i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]&&i[3]===this.current[3]||(this.current=i,this.gl.uniform4ui(this.location,i[0],i[1],i[2],i[3])))}}class UniformColor extends Uniform{constructor(e){super(e),this.current=Color.transparent.toPremultipliedRenderColor(null)}set(e,t,i){this.fetchUniformLocation(e,t)&&(i.r===this.current.r&&i.g===this.current.g&&i.b===this.current.b&&i.a===this.current.a||(this.current=i,this.gl.uniform4f(this.location,i.r,i.g,i.b,i.a)))}}function Na(e){return[Ca(255*e.r,255*e.g),Ca(255*e.b,255*e.a)]}function Ua(e,t,i,r,n,o,a,s){return!!e&&("composite"===e.kind||"source"===e.kind?"none"===e.evaluate(new EvaluationParameters(0,{brightness:o,worldview:s}),t,i,n,r,a):"none"===e.value)}class ConstantBinder{constructor(e,t,i,r){this.value=e,this.uniformNames=t.map(e=>`u_${e}`),this.type=i,this.context=r}setUniform(e,t,i,r,n){const o=r.constantOr(this.value);t.set(e,n,o instanceof Color?o.toPremultipliedRenderColor(this.lutExpression&&"constant"===this.lutExpression.kind&&"none"===this.lutExpression.value?null:this.context.lut):o)}getBinding(e,t){return"color"===this.type?new UniformColor(e):new Uniform1f(e)}}class PatternConstantBinder{constructor(e,t){this.uniformNames=t.map(e=>`u_${e}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(e,t){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br),this.patternTransition=t?t.tl.concat(t.br):this.pattern}setUniform(e,t,i,r,n){let o=null;"u_pattern"!==n&&"u_dash"!==n||(o=this.pattern),"u_pattern_b"===n&&(o=this.patternTransition),"u_pixel_ratio"===n&&(o=this.pixelRatio),o&&t.set(e,n,o)}getBinding(e,t){return"u_pattern"===t||"u_pattern_b"===t||"u_dash"===t?new Uniform4ui(e):new Uniform1f(e)}}class SourceExpressionBinder{constructor(e,t,i,r){this.expression=e,this.type=i,this.maxValue=0,this.paintVertexAttributes=t.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===i?2:1,offset:0})),this.paintVertexArray=new r}populatePaintArray(e,t,i,r,n,o,a,s){const l=this.paintVertexArray.length,u="composite"===this.expression.kind||"source"===this.expression.kind?this.expression.evaluate(new EvaluationParameters(0,{brightness:o,worldview:s}),t,{},n,r,a):"constant"===this.expression.kind&&this.expression.value,c=Ua(this.lutExpression,t,{},r,n,o,a,s);this.paintVertexArray.resize(e),this._setPaintValue(l,e,u,c?null:this.context.lut)}updatePaintArray(e,t,i,r,n,o,a,s){const l="composite"===this.expression.kind||"source"===this.expression.kind?this.expression.evaluate({zoom:0,brightness:a,worldview:s},i,r,void 0,n):"constant"===this.expression.kind&&this.expression.value,u=Ua(this.lutExpression,i,r,n,void 0,a,void 0,s);this._setPaintValue(e,t,l,u?null:this.context.lut)}_setPaintValue(e,t,i,r){if("color"===this.type){const n=Na(i.toPremultipliedRenderColor(r));for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,n[0],n[1])}else{for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,i);this.maxValue=Math.max(this.maxValue,Math.abs(i))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.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 CompositeExpressionBinder{constructor(e,t,i,r,n,o){this.expression=e,this.uniformNames=t.map(e=>`u_${e}_t`),this.type=i,this.useIntegerZoom=r,this.context=n,this.maxValue=0,this.paintVertexAttributes=t.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===i?4:2,offset:0})),this.paintVertexArray=new o}populatePaintArray(e,t,i,r,n,o,a,s){const l=this.expression.evaluate(new EvaluationParameters(this.context.zoom,{brightness:o,worldview:s}),t,{},n,r,a),u=this.expression.evaluate(new EvaluationParameters(this.context.zoom+1,{brightness:o,worldview:s}),t,{},n,r,a),c=Ua(this.lutExpression,t,{},r,n,o,a,s),h=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(h,e,l,u,c?null:this.context.lut)}updatePaintArray(e,t,i,r,n,o,a,s){const l=this.expression.evaluate({zoom:this.context.zoom,brightness:a,worldview:s},i,r,void 0,n),u=this.expression.evaluate({zoom:this.context.zoom+1,brightness:a,worldview:s},i,r,void 0,n),c=Ua(this.lutExpression,i,r,n,void 0,a,void 0,s);this._setPaintValue(e,t,l,u,c?null:this.context.lut)}_setPaintValue(e,t,i,r,n){if("color"===this.type){const o=Na(i.toPremultipliedRenderColor(n)),a=Na(r.toPremultipliedRenderColor(n));for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,o[0],o[1],a[0],a[1])}else{for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,i,r);this.maxValue=Math.max(this.maxValue,Math.abs(i),Math.abs(r))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,t,i,r,n){const o=this.useIntegerZoom?Math.floor(i.zoom):i.zoom,a=ve(this.expression.interpolationFactor(o,this.context.zoom,this.context.zoom+1),0,1);t.set(e,n,a)}getBinding(e,t){return new Uniform1f(e)}}class PatternCompositeBinder{constructor(e,t,i,r,n){this.expression=e,this.layerId=n,this.paintVertexAttributes=("array"===i?Fa:Ra).members;for(let e=0;e<t.length;++e);this.paintVertexArray=new r,this.paintTransitionVertexArray=new StructArrayLayout4ui8}populatePaintArray(e,t,i,r){const n=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValues(n,e,t.patterns&&t.patterns[this.layerId],i)}updatePaintArray(e,t,i,r,n,o,a){this._setPaintValues(e,t,i.patterns&&i.patterns[this.layerId],o)}_setPaintValues(e,t,i,r){if(!r||!i)return;const n=r[i[0]],o=r[i[1]];if(n){if(n){const{tl:i,br:r,pixelRatio:o}=n;for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,i[0],i[1],r[0],r[1],o)}if(o){this.paintTransitionVertexArray.resize(this.paintVertexArray.length);const{tl:i,br:r}=o;for(let n=e;n<t;n++)this.paintTransitionVertexArray.emplace(n,i[0],i[1],r[0],r[1])}}}upload(e){const t=this.expression.isStateDependent||!this.expression.isLightConstant;this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,t)),this.paintTransitionVertexArray&&this.paintTransitionVertexArray.length&&(this.paintTransitionVertexBuffer=e.createVertexBuffer(this.paintTransitionVertexArray,La.members,t))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy(),this.paintTransitionVertexBuffer&&this.paintTransitionVertexBuffer.destroy()}}class ProgramConfiguration{constructor(e,t,i=()=>!0){this.binders={},this._buffers=[],this.context=t;const r=[],n=e;for(const o in e.paint._values){const a=n.paint.get(o);if(o.endsWith("-use-theme"))continue;if(!i(o))continue;if(!(a instanceof PossiblyEvaluatedPropertyValue&&zr(a.property.specification)))continue;const s=ja(o,e.type),l=a.value,u=a.property.specification.type,c=!!a.property.useIntegerZoom,h="line-dasharray"===o||o.endsWith("pattern"),d=n.paint.get(`${o}-use-theme`),p="line-dasharray"===o&&"constant"!==n.layout.get("line-cap").value.kind||d&&"constant"!==d.value.kind;if("constant"!==l.kind||p)if("source"===l.kind||p||h){const t=Wa(o,u,"source");this.binders[o]=h?new PatternCompositeBinder(l,s,u,t,e.id):new SourceExpressionBinder(l,s,u,t),r.push(`/a_${o}`)}else{const e=Wa(o,u,"composite");this.binders[o]=new CompositeExpressionBinder(l,s,u,c,t,e),r.push(`/z_${o}`)}else this.binders[o]=h?new PatternConstantBinder(l.value,s):new ConstantBinder(l.value,s,u,t),r.push(`/u_${o}`);d&&(this.binders[o].lutExpression=d.value)}this.cacheKey=r.sort().join("")}updateExpressions(e){const t=e;for(const e in this.binders){const i=this.binders[e];if(i instanceof SourceExpressionBinder||i instanceof CompositeExpressionBinder||i instanceof PatternCompositeBinder){const r=t.paint.get(e);i.expression=r.value}}}getMaxValue(e){const t=this.binders[e];return t instanceof SourceExpressionBinder||t instanceof CompositeExpressionBinder?t.maxValue:0}populatePaintArrays(e,t,i,r,n,o,a,s){for(const l in this.binders){const u=this.binders[l];u.context=this.context,(u instanceof SourceExpressionBinder||u instanceof CompositeExpressionBinder||u instanceof PatternCompositeBinder)&&u.populatePaintArray(e,t,i,r,n,o,a,s)}}setConstantPatternPositions(e,t){for(const i in this.binders){const r=this.binders[i];r instanceof PatternConstantBinder&&r.setConstantPatternPositions(e,t)}}getPatternTransitionVertexBuffer(e){const t=this.binders[e];return t instanceof PatternCompositeBinder?t.paintTransitionVertexBuffer:null}updatePaintArrays(e,t,i,r,n,o,a,s,l,u){let c=!1;const h=Object.keys(e),d=0!==h.length&&!s,p=d?h:t.uniqueIds;this.context.lut=n.lut;for(const s in this.binders){const h=this.binders[s];if(h.context=this.context,(h instanceof SourceExpressionBinder||h instanceof CompositeExpressionBinder||h instanceof PatternCompositeBinder)&&h.expression&&h.expression.kind&&"constant"!==h.expression.kind&&(!0===h.expression.isStateDependent||!1===h.expression.isLightConstant)){const f=n.paint.get(s);h.expression=f.value;for(const i of p){const n=e[i.toString()];t.eachPosition(i,(e,t,i)=>{const s=r.feature(e);h.updatePaintArray(t,i,s,n,o,a,l,u)})}if(!d)for(const t of i.uniqueIds){const n=e[t.toString()];i.eachPosition(t,(e,t,i)=>{const s=r.feature(e);h.updatePaintArray(t,i,s,n,o,a,l,u)})}c=!0}}return c}defines(){const e=[];for(const t in this.binders){const i=this.binders[t];(i instanceof ConstantBinder||i instanceof PatternConstantBinder)&&e.push(...i.uniformNames.map(e=>`#define HAS_UNIFORM_${e}`))}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){const t=[];for(const i in this.binders){const r=this.binders[i];if(r instanceof ConstantBinder||r instanceof PatternConstantBinder||r instanceof CompositeExpressionBinder)for(const n of r.uniformNames)t.push({name:n,property:i,binding:r.getBinding(e,n)})}return t}setUniforms(e,t,i,r,n){for(const{name:t,property:o,binding:a}of i)this.binders[o].setUniform(e,a,n,r.get(o),t)}updatePaintBuffers(){this._buffers=[];for(const e in this.binders){const t=this.binders[e];(t instanceof SourceExpressionBinder||t instanceof CompositeExpressionBinder||t instanceof PatternCompositeBinder)&&t.paintVertexBuffer&&this._buffers.push(t.paintVertexBuffer),t instanceof PatternCompositeBinder&&t.paintTransitionVertexBuffer&&this._buffers.push(t.paintTransitionVertexBuffer)}}upload(e){for(const t in this.binders){const i=this.binders[t];(i instanceof SourceExpressionBinder||i instanceof CompositeExpressionBinder||i instanceof PatternCompositeBinder)&&i.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const t=this.binders[e];(t instanceof SourceExpressionBinder||t instanceof CompositeExpressionBinder||t instanceof PatternCompositeBinder)&&t.destroy()}}}class ProgramConfigurationSet{constructor(e,t,i=()=>!0){this.programConfigurations={};for(const r of e)this.programConfigurations[r.id]=new ProgramConfiguration(r,t,i);this.needsUpload=!1,this._featureMap=new FeaturePositionMap,this._featureMapWithoutIds=new FeaturePositionMap,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,t,i,r,n,o,a,s,l){for(const i in this.programConfigurations)this.programConfigurations[i].populatePaintArrays(e,t,r,n,o,a,s,l);void 0!==t.id?this._featureMap.add(t.id,i,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,i,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,i,r,n,o,a,s){for(const l of i)this.needsUpload=this.programConfigurations[l.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,t,l,r,n,o,a||0,s)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}updateExpressions(e){const t=new Set;for(const i of e){const e=this.programConfigurations[i.id];e&&(e.updateExpressions(i),t.add(i.id))}for(const e in this.programConfigurations)t.has(e)||delete this.programConfigurations[e]}}const Ga={"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 ja(e,t){return Ga[e]||[e.replace(`${t}-`,"").replace(/-/g,"_")]}const Ha={"line-pattern":{source:StructArrayLayout4ui1f12,composite:StructArrayLayout4ui1f12},"fill-pattern":{source:StructArrayLayout4ui1f12,composite:StructArrayLayout4ui1f12},"fill-extrusion-pattern":{source:StructArrayLayout4ui1f12,composite:StructArrayLayout4ui1f12},"line-dasharray":{source:StructArrayLayout4ui8,composite:StructArrayLayout4ui8}},$a={color:{source:StructArrayLayout2f8,composite:StructArrayLayout4f16},number:{source:StructArrayLayout1f4,composite:StructArrayLayout2f8}};function Wa(e,t,i){const r=Ha[e];return r&&r[i]||$a[t][i]}rn(ConstantBinder,"ConstantBinder"),rn(PatternConstantBinder,"PatternConstantBinder"),rn(SourceExpressionBinder,"SourceExpressionBinder",{omit:["expression"]}),rn(PatternCompositeBinder,"PatternCompositeBinder",{omit:["expression"]}),rn(CompositeExpressionBinder,"CompositeExpressionBinder",{omit:["expression"]}),rn(ProgramConfiguration,"ProgramConfiguration",{omit:["_buffers"]}),rn(ProgramConfigurationSet,"ProgramConfigurationSet");class FillBufferData{constructor(e,t,i){this.layoutVertexArray=new StructArrayLayout2i4,this.indexArray=new StructArrayLayout3ui6,this.lineIndexArray=new StructArrayLayout2ui4,this.triangleSegments=new SegmentVector,this.lineSegments=new SegmentVector,this.programConfigurations=new ProgramConfigurationSet(e,{zoom:t,lut:i}),this.uploaded=!1}update(e,t,i,r,n,o,a,s){this.programConfigurations.updatePaintArrays(e,t,n,i,r,o,a,s)}isEmpty(){return 0===this.layoutVertexArray.length}needsUpload(){return this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Pa.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.lineIndexBuffer=e.createIndexBuffer(this.lineIndexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy())}populatePaintArrays(e,t,i,r,n,o,a){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,t,i,r,n,o,void 0,a)}}rn(FillBufferData,"FillBufferData");class FillBucket{constructor(e){this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=e.lut,this.bufferData=new FillBufferData(e.layers,e.zoom,e.lut),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.projection=e.projection,this.sourceLayerIndex=e.sourceLayerIndex,this.sourceLayerName=e.sourceLayerName||"",this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,t){}updateAppearances(e,t,i,r){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,i,r){this.hasPattern=ea("fill",this.layers,this.pixelRatio,t);const n=this.layers[0].layout.get("fill-sort-key"),o=[];for(const{feature:a,id:s,index:l,sourceLayerIndex:u}of e){const e=this.layers[0]._featureFilter.needGeometry,c=Aa(a,e);if(!this.layers[0]._featureFilter.filter(new EvaluationParameters(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),c,i))continue;const h=n?n.evaluate(c,{},i,t.availableImages):void 0,d={id:s,properties:a.properties,type:a.type,sourceLayerIndex:u,index:l,geometry:e?c.geometry:wa(a,i,r),patterns:{},sortKey:h};o.push(d)}n&&o.sort((e,t)=>e.sortKey-t.sortKey);for(const r of o){const{geometry:n,index:o,sourceLayerIndex:a}=r;if(this.hasPattern){const e=ta("fill",this.layers,r,this.zoom,this.pixelRatio,t);this.patternFeatures.push(e)}else this.addFeature(r,n,o,i,{},t.availableImages,t.brightness,t.elevationFeatures);t.featureIndex.insert(e[o].feature,n,o,a,this.index)}!this.hasPattern&&this.hdExt&&this.hdExt.buildFrcSegments(this)}update(e,t,i,r,n,o,a){this.bufferData.update(e,t,i,r,n,o,a,this.worldview),this.hdExt&&this.hdExt.update(e,t,i,r,n,o,a,this.worldview)}updateExpressions(e){this.bufferData.programConfigurations.updateExpressions(e),this.hdExt&&this.hdExt.updateExpressions(e)}addFeatures(e,t,i,r,n,o){for(const n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,t,i,r,o,e.elevationFeatures);this.hdExt&&this.hdExt.buildFrcSegments(this)}isEmpty(){return this.bufferData.isEmpty()&&(!this.hdExt||this.hdExt.isEmpty())}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||null!=this.hdExt&&this.hdExt.needsUpload()}upload(e){this.bufferData.upload(e),this.hdExt&&this.hdExt.upload(e)}destroy(){this.bufferData.destroy(),this.hdExt&&this.hdExt.destroy()}addFeature(e,t,i,r,n,o=[],a,s){const l=this.hdExt?this.hdExt.trackFeatureFrc(e.properties):null,u=this.bufferData.indexArray.length,c=ae(t,500);null!=this.hdExt&&this.hdExt.handleFeature(e,c,i,r,s,this)||this.addGeometry(c,this.bufferData),this.bufferData.populatePaintArrays(e,i,n,o,r,a,this.worldview),this.hdExt&&this.hdExt.populatePaintArrays(e,i,n,o,r,a,this.worldview),this.hdExt&&this.hdExt.recordFeatureRange(this,u,this.bufferData.indexArray.length,l)}addGeometry(e,t,i,r){let n=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,a=null;i&&(a=i.elevationSampler.constantElevation(i.elevation,i.bias),null!=a&&(n=a,o=a));const s=i?t:null,l=(e,t,r)=>{if(null!=i)if(t.push(e),null!=a)s.elevatedLayoutVertexArray.emplaceBack(a),r.push(a);else{const t=i.elevationSampler.pointElevation(e,i.elevation,i.bias);s.elevatedLayoutVertexArray.emplaceBack(t),r.push(t),n=Math.min(n,t),o=Math.max(o,t)}};for(const n of e){let e=0;for(const t of n)e+=t.length;const o=t.triangleSegments.prepareSegment(e,t.layoutVertexArray,t.indexArray),a=o.vertexLength,s=[],u=[],c=[],h=[],d=[],p=t.layoutVertexArray.length;for(const e of n){if(0===e.length)continue;e!==n[0]&&u.push(s.length/2);const r=t.lineSegments.prepareSegment(e.length,t.layoutVertexArray,t.lineIndexArray),o=r.vertexLength;i&&d.push(t.layoutVertexArray.length-p),l(e[0],c,h),t.layoutVertexArray.emplaceBack(e[0].x,e[0].y),t.lineIndexArray.emplaceBack(o+e.length-1,o),s.push(e[0].x),s.push(e[0].y);for(let i=1;i<e.length;i++)l(e[i],c,h),t.layoutVertexArray.emplaceBack(e[i].x,e[i].y),t.lineIndexArray.emplaceBack(o+i-1,o+i),s.push(e[i].x),s.push(e[i].y);r.vertexLength+=e.length,r.primitiveLength+=e.length}const f=Do(s,u);for(let e=0;e<f.length;e+=3)t.indexArray.emplaceBack(a+f[e],a+f[e+1],a+f[e+2]);if(f.length>0&&i&&r){const e=i.elevation.isTunnel(),t=i.elevation.safeArea,n=r.addVertices(c,h);r.addTriangles(f,n,e);const o=d.length;if(o>0){for(let a=0;a<o-1;a++)r.addRenderableRing(i.index,d[a]+n,d[a+1]-d[a],e,t,i.featureInfo);r.addRenderableRing(i.index,d[o-1]+n,c.length-d[o-1],e,t,i.featureInfo)}}o.vertexLength+=e,o.primitiveLength+=f.length/3}return[n,o]}}rn(FillBucket,"FillBucket",{omit:["layers","patternFeatures"]});const Xa=Sa([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),qa=Sa([{name:"a_z_offset_width",components:4,type:"Float32"}],4),Za=Sa([{name:"a_elevation_id_col",components:3,type:"Float32"}],4),Ya=Sa([{name:"a_elevation_ground_scale",components:1,type:"Float32"}],4),{members:Ja}=Xa,Ka=Sa([{name:"a_packed",components:3,type:"Float32"}]),{members:Qa}=Ka,es=Sa([{name:"a_pattern_data",components:3,type:"Float32"}]),{members:ts}=es;class VectorTileFeature{constructor(e,t,i,r,n){for(this.properties=Object.create(null),this.extent=i,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=r,this._values=n;e.pos<t;){const t=e.readVarint();if(8===t)this.id=e.readVarint();else if(18===t){const t=e.readVarint()+e.pos;for(;e.pos<t;){const t=r[e.readVarint()],i=n[e.readVarint()];this.properties[t]=i}}else 24===t?this.type=e.readVarint():34===t?(this._geometry=e.pos,e.skip(t)):e.skip(t)}}loadGeometry(){if(this._geometry<0)throw new Error("feature has no geometry");const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos,i=[];let r,n=1,o=0,a=0,s=0;for(;e.pos<t;){if(o<=0){const t=e.readVarint();if(n=7&t,o=t>>3,0===o)continue}if(o--,1===n)a+=e.readSVarint(),s+=e.readSVarint(),r&&i.push(r),r=[new K(a,s)];else if(2===n)a+=e.readSVarint(),s+=e.readSVarint(),r&&r.push(new K(a,s));else{if(7!==n)throw new Error(`unknown command ${n}`);r&&r.push(r[0].clone())}}return r&&i.push(r),i}bbox(){if(this._geometry<0)throw new Error("feature has no geometry");const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos;let i=1,r=0,n=0,o=0,a=1/0,s=-1/0,l=1/0,u=-1/0;for(;e.pos<t;){if(r<=0){const t=e.readVarint();if(i=7&t,r=t>>3,0===r)continue}if(r--,1===i||2===i)n+=e.readSVarint(),o+=e.readSVarint(),n<a&&(a=n),n>s&&(s=n),o<l&&(l=o),o>u&&(u=o);else if(7!==i)throw new Error(`unknown command ${i}`)}return[a,l,s,u]}toGeoJSON(e,t,i){const r=this.extent*Math.pow(2,i),n=this.extent*e,o=this.extent*t,a=this.loadGeometry();function s(e){return[360*(e.x+n)/r-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+o)/r)*Math.PI))-90]}function l(e){return e.map(s)}let u;if(1===this.type){const e=[];for(const t of a)e.push(t[0]);const t=l(e);u=1===e.length?{type:"Point",coordinates:t[0]}:{type:"MultiPoint",coordinates:t}}else if(2===this.type){const e=a.map(l);u=1===e.length?{type:"LineString",coordinates:e[0]}:{type:"MultiLineString",coordinates:e}}else{if(3!==this.type)throw new Error("unknown feature type");{const e=function(e){const t=e.length;if(t<=1)return[e];const i=[];let r,n;for(let o=0;o<t;o++){const t=is(e[o]);0!==t&&(void 0===n&&(n=t<0),n===t<0?(r&&i.push(r),r=[e[o]]):r&&r.push(e[o]))}return r&&i.push(r),i}(a),t=[];for(const i of e)t.push(i.map(l));u=1===t.length?{type:"Polygon",coordinates:t[0]}:{type:"MultiPolygon",coordinates:t}}}const c={type:"Feature",geometry:u,properties:this.properties};return null!=this.id&&(c.id=this.id),c}}function is(e){let t=0;for(let i,r,n=0,o=e.length,a=o-1;n<o;a=n++)i=e[n],r=e[a],t+=(r.x-i.x)*(i.y+r.y);return t}VectorTileFeature.types=["Unknown","Point","LineString","Polygon"];class VectorTileLayer{constructor(e,t){for(this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],void 0===t&&(t=e.length);e.pos<t;){const t=e.readVarint();10===t?this.name=e.readString():18===t?(this._features.push(e.pos),e.skip(t)):26===t?this._keys.push(e.readString()):34===t?this._values.push(rs(e)):40===t?this.extent=e.readVarint():120===t?this.version=e.readVarint():e.skip(t)}this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const t=this._pbf.readVarint()+this._pbf.pos;return new VectorTileFeature(this._pbf,t,this.extent,this._keys,this._values)}}function rs(e){let t=null;const i=e.readVarint()+e.pos;for(;e.pos<i;){const i=e.readVarint();t=10===i?e.readString():21===i?e.readFloat():25===i?e.readDouble():32===i?e.readVarint(!0):40===i?e.readVarint():48===i?e.readSVarint():56===i?e.readBoolean():(e.skip(i),null)}if(null==t)throw new Error("unknown feature value");return t}class VectorTile{constructor(e,t=e.length){const i=Object.create(null);for(;e.pos<t;){const t=e.readVarint();if(26===t){const t=new VectorTileLayer(e,e.readVarint()+e.pos);t.length&&(i[t.name]=t)}else e.skip(t)}this.layers=i}}function ns(e,t){for(let i=0;i<e.length;i++)if(ms(t,e[i]))return!0;for(let i=0;i<t.length;i++)if(ms(e,t[i]))return!0;return!!ls(e,t)}function os(e,t,i){return!!ms(e,t)||!!ds(t,e,i)}function as(e,t){if(1===e.length)return fs(t,e[0]);for(let i=0;i<t.length;i++){const r=t[i];for(let t=0;t<r.length;t++)if(ms(e,r[t]))return!0}for(let i=0;i<e.length;i++)if(fs(t,e[i]))return!0;for(let i=0;i<t.length;i++)if(ls(e,t[i]))return!0;return!1}function ss(e,t,i){if(e.length>1){if(ls(e,t))return!0;for(let r=0;r<t.length;r++)if(ds(t[r],e,i))return!0}for(let r=0;r<e.length;r++)if(ds(e[r],t,i))return!0;return!1}function ls(e,t){if(0===e.length||0===t.length)return!1;for(let i=0;i<e.length-1;i++){const r=e[i],n=e[i+1];for(let e=0;e<t.length-1;e++)if(us(r,n,t[e],t[e+1]))return!0}return!1}function us(e,t,i,r){return Me(e,i,r)!==Me(t,i,r)&&Me(e,t,i)!==Me(e,t,r)}function cs(e,t,i){return(e.x-i.x)*(t.y-i.y)-(e.y-i.y)*(t.x-i.x)}function hs(e,t,i,r){const n=cs(e,t,r),o=cs(e,t,i);if(Math.sign(n)===Math.sign(o))return;const a=cs(i,r,e),s=a+o-n;return Math.sign(a)!==Math.sign(s)?[a/(a-s),o/(o-n)]:void 0}function ds(e,t,i){const r=i*i;if(1===t.length)return e.distSqr(t[0])<r;for(let i=1;i<t.length;i++)if(ps(e,t[i-1],t[i])<r)return!0;return!1}function ps(e,t,i){const r=t.distSqr(i);if(0===r)return e.distSqr(t);const n=((e.x-t.x)*(i.x-t.x)+(e.y-t.y)*(i.y-t.y))/r;return e.distSqr(n<0?t:n>1?i:i.sub(t)._mult(n)._add(t))}function fs(e,t){let i,r,n,o=!1;for(let a=0;a<e.length;a++){i=e[a];for(let e=0,a=i.length-1;e<i.length;a=e++)r=i[e],n=i[a],r.y>t.y!=n.y>t.y&&t.x<(n.x-r.x)*(t.y-r.y)/(n.y-r.y)+r.x&&(o=!o)}return o}function ms(e,t){let i=!1;for(let r=0,n=e.length-1;r<e.length;n=r++){const o=e[r],a=e[n];o.y>t.y!=a.y>t.y&&t.x<(a.x-o.x)*(t.y-o.y)/(a.y-o.y)+o.x&&(i=!i)}return i}function _s(e,t,i){const r=i[0],n=i[2];if(e.x<r.x&&t.x<r.x||e.x>n.x&&t.x>n.x||e.y<r.y&&t.y<r.y||e.y>n.y&&t.y>n.y)return!1;const o=Me(e,t,i[0]);return o!==Me(e,t,i[1])||o!==Me(e,t,i[2])||o!==Me(e,t,i[3])}function gs(e,t,i,r,n,o){let a=t.y-e.y,s=e.x-t.x;if(o=o||0){const e=a*a+s*s;if(0===e)return!0;const t=Math.sqrt(e);a/=t,s/=t}return!((i.x-e.x)*a+(i.y-e.y)*s-o<0||(r.x-e.x)*a+(r.y-e.y)*s-o<0||(n.x-e.x)*a+(n.y-e.y)*s-o<0)}function ys(e,t,i,r,n,o,a){return!(gs(e,t,r,n,o,a)||gs(t,i,r,n,o,a)||gs(i,e,r,n,o,a)||gs(r,n,e,t,i,a)||gs(n,o,e,t,i,a)||gs(o,r,e,t,i,a))}class Point3D extends K{constructor(e,t,i){super(e,t),this.z=i}}class Point4D extends Point3D{constructor(e,t,i,r){super(e,t,i),this.w=r}}function xs(e,t,i,r){const n="x"===i?"y":"x",o=(r-e[i])/(t[i]-e[i]);e[n]=Math.round(e[n]+(t[n]-e[n])*o),e[i]=r,Object.hasOwn(e,"z")&&(e.z=rt(e.z,t.z,o)),Object.hasOwn(e,"w")&&(e.w=rt(e.w,t.w,o))}function vs(e,t,i,r){const n=i,o=r;for(const i of["x","y"]){let r=e,a=t;r[i]>=a[i]&&(r=t,a=e),r[i]<n&&a[i]>n&&xs(r,a,i,n),r[i]<o&&a[i]>o&&xs(a,r,i,o)}}function bs(e,t,i,r,n,o){const a=[];for(let s=0;s<e.length;s++){const l=e[s];let u;const c=a.length;let h=0;for(let e=0;e<l.length-1;e++){let c=l[e],d=l[e+1],p=0;const f=h;let m,_;o&&(p=Math.hypot(d.x-c.x,d.y-c.y),h+=p,m=c,_=d),c.x<t&&d.x<t||(c.x<t?c=new K(t,c.y+(t-c.x)/(d.x-c.x)*(d.y-c.y))._round():d.x<t&&(d=new K(t,c.y+(t-c.x)/(d.x-c.x)*(d.y-c.y))._round()),c.y<i&&d.y<i||(c.y<i?c=new K(c.x+(i-c.y)/(d.y-c.y)*(d.x-c.x),i)._round():d.y<i&&(d=new K(c.x+(i-c.y)/(d.y-c.y)*(d.x-c.x),i)._round()),c.x>=r&&d.x>=r||(c.x>=r?c=new K(r,c.y+(r-c.x)/(d.x-c.x)*(d.y-c.y))._round():d.x>=r&&(d=new K(r,c.y+(r-c.x)/(d.x-c.x)*(d.y-c.y))._round()),c.y>=n&&d.y>=n||(c.y>=n?c=new K(c.x+(n-c.y)/(d.y-c.y)*(d.x-c.x),n)._round():d.y>=n&&(d=new K(c.x+(n-c.y)/(d.y-c.y)*(d.x-c.x),n)._round()),u&&c.equals(u.at(-1))||(u=[c],a.push(u),o&&o.push({progress:{min:f+As(m,_,c)*p,max:1},parentIndex:s,prevPoint:m,nextPoint:_})),u.push(d),o&&(o.at(-1).progress.max=f+As(m,_,d)*p,o.at(-1).nextPoint=_)))))}if(o&&h>0)for(let e=c;e<a.length;e++)o[e].progress.min/=h,o[e].progress.max/=h}return a}function ws(e,t,i,r,n){if(e.length<2)return void r.push(e);const o=[];for(;t.valid();){const[i,r]=t.get();for(let t=0;t<e.length-1;t++){const n=e[t],a=e[t+1],s=hs(n,a,i,r);if(s){const[e]=s,i=new K(rt(n.x,a.x,e),rt(n.y,a.y,e));o.push({t:t+e,distance:0,point:i})}}t.next()}if(0===o.length)return void r.push(e);o.sort((e,t)=>e.t-t.t);let a=0,s=0,l=[];for(r.push(l);a!==e.length;){if(s===o.length){for(;a!==e.length;)0!==l.length&&l.at(-1).equals(e[a])||l.push(e[a]),a++;break}o[s].t<=a?(0!==l.length&&l.at(-1).equals(o[s].point)||l.push(o[s].point),Math.trunc(o[s].t),s++):(0!==l.length&&l.at(-1).equals(e[a])||l.push(e[a]),a++)}}function As(e,t,i){return e.x!==t.x?(i.x-e.x)/(t.x-e.x):e.y!==t.y?(i.y-e.y)/(t.y-e.y):0}function Es(e,{width:t,height:i},r,n){if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==t*i*r)throw new RangeError("mismatched image size")}else n=new Uint8Array(t*i*r);return e.width=t,e.height=i,e.data=n,e}function Is(e,t,i){const{width:r,height:n}=t;r===e.width&&n===e.height||(Ss(e,t,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,r),height:Math.min(e.height,n)},i,null),e.width=r,e.height=n,e.data=t.data)}function Ss(e,t,i,r,n,o,a,s){if(0===n.width||0===n.height)return t;if(n.width>e.width||n.height>e.height||i.x>e.width-n.width||i.y>e.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>t.width||n.height>t.height||r.x>t.width-n.width||r.y>t.height-n.height)throw new RangeError("out of range destination coordinates for image copy");const l=e.data,u=t.data,c=4===o&&s;for(let s=0;s<n.height;s++){const h=((i.y+s)*e.width+i.x)*o,d=((r.y+s)*t.width+r.x)*o;if(c)for(let e=0;e<n.width;e++){const t=h+e*o+3,i=d+e*o;u[i+0]=255,u[i+1]=255,u[i+2]=255,u[i+3]=l[t]}else if(a)for(let e=0;e<n.width;e++){const t=h+e*o,i=d+e*o,r=new Color(l[t+0]/255,l[t+1]/255,l[t+2]/255,l[t+3]).toNonPremultipliedRenderColor(a).toArray();u[i+0]=r[0],u[i+1]=r[1],u[i+2]=r[2],u[i+3]=r[3]}else for(let e=0;e<n.width*o;e++)u[d+e]=l[h+e]}return t}class AlphaImage{constructor(e,t){Es(this,e,1,t)}resize(e){Is(this,new AlphaImage(e),1)}clone(){return new AlphaImage({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,i,r,n){Ss(e,t,i,r,n,1,null)}}class RGBAImage{constructor(e,t){Es(this,e,4,t)}resize(e){Is(this,new RGBAImage(e),4)}replace(e,t){t?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new RGBAImage({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,i,r,n,o,a){Ss(e,t,i,r,n,4,o,a)}}class Float32Image{constructor(e,t){this.width=e.width,this.height=e.height,this.data=t instanceof Uint8Array?new Float32Array(t.buffer):t}}rn(AlphaImage,"AlphaImage"),rn(RGBAImage,"RGBAImage");class LineAtlas{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.image=new AlphaImage({width:e,height:t}),this.positions={},this.uploaded=!1}getDash(e,t){const i=this.getKey(e,t);return this.positions[i]}trim(){const e=this.width,t=this.height=(i=this.nextRow)<=1?1:Math.pow(2,Math.ceil(Math.log2(i)));var i;this.image.resize({width:e,height:t})}getKey(e,t){return e.join(",")+t}getDashRanges(e,t,i){const r=[];let n=e.length%2==1?-e.at(-1)*i:0,o=e[0]*i,a=!0;r.push({left:n,right:o,isDash:a,zeroLength:0===e[0]});let s=e[0];for(let t=1;t<e.length;t++){a=!a;const l=e[t];n=s*i,s+=l,o=s*i,r.push({left:n,right:o,isDash:a,zeroLength:0===l})}return r}addRoundDash(e,t,i){const r=t/2;for(let t=-i;t<=i;t++){const n=this.width*(this.nextRow+i+t);let o=0,a=e[o];for(let s=0;s<this.width;s++){s/a.right>1&&(a=e[++o]);const l=Math.abs(s-a.left),u=Math.abs(s-a.right),c=Math.min(l,u);let h;const d=t/i*(r+1);if(a.isDash){const e=r-Math.abs(d);h=Math.sqrt(c*c+e*e)}else h=r-Math.sqrt(c*c+d*d);this.image.data[n+s]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(e,t){for(let t=e.length-1;t>=0;--t){const i=e[t],r=e[t+1];i.zeroLength?e.splice(t,1):r&&r.isDash===i.isDash&&(r.left=i.left,e.splice(t,1))}const i=e[0],r=e.at(-1);i.isDash===r.isDash&&(i.left=r.left-this.width,r.right=i.right+this.width);const n=this.width*this.nextRow;let o=0,a=e[o];for(let i=0;i<this.width;i++){i/a.right>1&&(a=e[++o]);const r=Math.abs(i-a.left),s=Math.abs(i-a.right),l=Math.min(r,s);this.image.data[n+i]=Math.max(0,Math.min(255,(a.isDash?l:-l)+t+128))}}addDash(e,t){const i=this.getKey(e,t);if(this.positions[i])return this.positions[i];const r="round"===t,n=r?7:0,o=2*n+1;if(this.nextRow+o>this.height)return ze("LineAtlas out of space"),null;0===e.length&&e.push(1);let a=0;for(let t=0;t<e.length;t++)e[t]<0&&(ze("Negative value is found in line dasharray, replacing values with 0"),e[t]=0),a+=e[t];if(0!==a){const i=this.width/a,o=this.getDashRanges(e,this.width,i);r?this.addRoundDash(o,i,n):this.addRegularDash(o,"square"===t?.5*i:0)}const s=this.nextRow+n;let l=0;if(0!==a){const e=this.width*s;for(let t=0;t<this.width;t++)this.image.data[e+t]>=128&&l++}const u=Math.round(l/this.width*4095);this.nextRow+=o;const c=Math.floor(a),h={tl:[s,n|u<<4],br:[c,Math.round(65535*(a-c))]};return this.positions[i]=h,h}}rn(LineAtlas,"LineAtlas");const Ds="3d_elevation_id",Ps="level",Ts="hd_road_elevation",zs=VectorTileFeature.types,Ms=Math.cos(Math.PI/180*37.5),Cs=Math.cos(Math.PI/180*5);class LineBucket{constructor(e){this.evaluationGlobals={zoom:0,lineProgress:void 0},this.elevationType="none",this.isSeaLevelReference=!1,this.showElevationIdDebug=!1,this.terrainEnabled=!1,this.zoom=e.zoom,this.evaluationGlobals.zoom=this.zoom,this.overscaling=e.overscaling,this.pixelRatio=e.pixelRatio,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.borderGradients={},this.layers.forEach(e=>{this.gradients[e.id]={},this.borderGradients[e.id]={}}),this.layoutVertexArray=new StructArrayLayout2i4ub1f12,this.layoutVertexArray2=new StructArrayLayout3f12,this.patternVertexArray=new StructArrayLayout3f12,this.indexArray=new StructArrayLayout3ui6,this.programConfigurations=new ProgramConfigurationSet(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new SegmentVector,this.sourceLayerName=e.sourceLayerName||"",this.maxLineLength=0,this.zOffsetVertexArray=new StructArrayLayout4f16,this.elevationIdColVertexArray=new StructArrayLayout3f12,this.elevationGroundScaleVertexArray=new StructArrayLayout1f4,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.tessellationStep=e.tessellationStep?e.tessellationStep:128,this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,t){}updateAppearances(e,t,i,r){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,i,r){this.showElevationIdDebug=t.showElevationIdDebug,this.terrainEnabled=t.terrainEnabled,this.hasPattern=ea("line",this.layers,this.pixelRatio,t);const n=this.layers[0].layout.get("line-sort-key");this.tileToMeter=fa(i);const o=this.layers[0].layout.get("line-elevation-reference");if("hd-road-markup"===o)this.elevationType="road";else{const e=this.layers[0].layout.get("line-z-offset"),t=e.isConstant()&&!e.constantOr(0);this.elevationType="sea"!==o&&"ground"!==o&&t?"none":"offset","offset"===this.elevationType&&"none"===o&&ze(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`),this.isSeaLevelReference="sea"===o}const a=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope="offset"===this.elevationType&&void 0!==a;const s=[];for(const{feature:o,id:a,index:l,sourceLayerIndex:u}of e){const e=this.layers[0]._featureFilter.needGeometry,c=Aa(o,e);if(!this.layers[0]._featureFilter.filter(new EvaluationParameters(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),c,i))continue;const h=n?n.evaluate(c,{},i):void 0,d={id:a,properties:o.properties,type:o.type,sourceLayerIndex:u,index:l,geometry:e?c.geometry:wa(o,i,r),patterns:{},sortKey:h};s.push(d)}n&&s.sort((e,t)=>e.sortKey-t.sortKey);const{lineAtlas:l,featureIndex:u}=t,c=this.addConstantDashes(l);for(const r of s){const{geometry:n,index:o,sourceLayerIndex:a}=r;if(c&&this.addFeatureDashes(r,l),this.hasPattern){const e=ta("line",this.layers,r,this.zoom,this.pixelRatio,t);this.patternFeatures.push(e)}else this.addFeature(r,n,o,i,l.positions,t.availableImages,t.brightness,t.elevationFeatures,t.elevationParams,t.crossSourceElevationEnabled);u.insert(e[o].feature,n,o,a,this.index)}!this.hasPattern&&this.hdExt&&this.hdExt.buildFrcSegments(this),this.hdExt&&this.hdExt.endPopulate()}addConstantDashes(e){let t=!1;for(const i of this.layers){const r=i.paint.get("line-dasharray").value,n=i.layout.get("line-cap").value;if("constant"!==r.kind||"constant"!==n.kind)t=!0;else{const t=n.value,i=r.value;if(!i)continue;e.addDash(i,t)}}return t}addFeatureDashes(e,t){const i=this.zoom;for(const r of this.layers){const n=r.paint.get("line-dasharray").value,o=r.layout.get("line-cap").value;if("constant"===n.kind&&"constant"===o.kind)continue;let a,s;if("constant"===n.kind){if(a=n.value,!a)continue}else a=n.evaluate({zoom:i},e);s="constant"===o.kind?o.value:o.evaluate({zoom:i},e),t.addDash(a,s),e.patterns[r.id]=[t.getKey(a,s)]}}update(e,t,i,r,n,o,a,s,l){this.programConfigurations.updatePaintArrays(e,t,n,i,r,o,a,l)}updateExpressions(e){this.programConfigurations.updateExpressions(e)}addFeatures(e,t,i,r,n,o){for(const n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,t,i,r,o,e.elevationFeatures,e.elevationParams,e.crossSourceElevationEnabled);this.hdExt&&(this.hdExt.buildFrcSegments(this),this.hdExt.endPopulate())}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Qa)),0!==this.patternVertexArray.length&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,ts)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,qa.members,!0)),!this.elevationIdColVertexBuffer&&this.elevationIdColVertexArray.length>0&&(this.elevationIdColVertexBuffer=e.createVertexBuffer(this.elevationIdColVertexArray,Za.members,!0)),!this.elevationGroundScaleVertexBuffer&&this.elevationGroundScaleVertexArray.length>0&&(this.elevationGroundScaleVertexBuffer=e.createVertexBuffer(this.elevationGroundScaleVertexArray,Ya.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ja),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.elevationIdColVertexBuffer&&this.elevationIdColVertexBuffer.destroy(),this.elevationGroundScaleVertexBuffer&&this.elevationGroundScaleVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e,t){let i,r;if(t&&t>0?(i=`mapbox_clip_start_${t}`,r=`mapbox_clip_end_${t}`):(i="mapbox_clip_start",r="mapbox_clip_end"),e.properties&&Object.hasOwn(e.properties,i)&&Object.hasOwn(e.properties,r))return{start:+e.properties[i],end:+e.properties[r]}}addFeature(e,t,i,r,n,o,a,s,l,u){const c=this.layers[0].layout,h=this.hdExt?this.hdExt.trackFeatureFrc(e.properties):null,d=this.indexArray.length,p=c.get("line-join").evaluate(e,{}),f=c.get("line-cap").evaluate(e,{}),m=c.get("line-miter-limit"),_=c.get("line-round-limit");this.lineClips=this.lineFeatureClips(e),this.lineFeature=e;const g=!(!e.properties||!Object.hasOwn(e.properties,"mapbox_line_metrics"))&&e.properties.mapbox_line_metrics;this.zOffsetValue=c.get("line-z-offset").value;const y=this.layers[0].paint,x=y.get("line-width").value;"constant"!==x.kind&&!1===x.isLineProgressConstant&&(this.variableWidthValue=x);const v=y.get("line-emissive-strength").value;if("constant"!==v.kind&&!1===v.isLineProgressConstant&&(this.variableEmissiveStrengthValue=v),this.isSeaLevelReference){const e=c.get("line-elevation-ground-scale").value;"constant"===e.kind&&0===e.value||(this.elevationGroundScaleValue=e)}if(null==this.hdExt||!this.hdExt.handleFeature(e,t,r,s,l,!!u,p,f,m,_,this))for(let i=0;i<t.length;i++)this.addLine(t[i],e,r,p,f,m,_,void 0,g&&i>0?i:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,o,r,a,void 0,this.worldview),this.hdExt&&this.hdExt.recordFeatureRange(this,d,this.indexArray.length,h)}fillNonElevatedRoadSegment(e){for(let t=Math.max(e,this.zOffsetVertexArray.length);t<this.layoutVertexArray.length;t++)this.zOffsetVertexArray.emplaceBack(0,0,0,0),this.showElevationIdDebug&&this.elevationIdColVertexArray.emplaceBack(0,0,0)}addLine(e,t,i,r,n,o,a,s,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(t,l):this.lineClips;const u="none"===r;this.patternJoinNone=this.hasPattern&&u,this.currentLineJoinType=r,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[];const c=s&&s.progress.min>0,h=s&&s.progress.max<1;if(this.lineClips){let i={min:this.lineClips.start,max:this.lineClips.end},r=1;if(s){const e=this.lineClips.end-this.lineClips.start;i=function(e,t,i){return{min:Be(e.min,t,i),max:Be(e.max,t,i)}}(s.progress,{min:0,max:1},i),e>0&&(r=(i.max-i.min)/e)}const n=+t.properties.mapbox_clip_feature_len,o=+t.properties.mapbox_clip_seg_len;if(Number.isNaN(n)||Number.isNaN(o)){for(let t=0;t<e.length-1;t++)this.totalDistance+=e[t].dist(e[t+1]);const t=this.totalDistance/(i.max-i.min);this.totalFeatureLength=Number.isFinite(t)?t:0,this.lineClips.start=i.min,this.lineClips.end=i.max,this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}else this.totalFeatureLength=n,this.totalDistance=o*r,this.lineClips.start=i.min,this.lineClips.end=i.max,this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance);this.lineClipsArray.push(this.lineClips),this.updateScaledDistance()}const d="Polygon"===zs[t.type];let p=e.length;for(;p>=2&&e[p-1].equals(e[p-2]);)p--;let f=0;for(;f<p-1&&e[f].equals(e[f+1]);)f++;if(p<(d?3:2))return;"bevel"===r&&(o=1.05);const m=this.segments.prepareSegment(10*p,this.layoutVertexArray,this.indexArray);let _,g,y,x,v,b,w,A;s&&s.prevDir&&(b=s.prevDir.perp()),s&&s.nextDir&&(w=s.nextDir.perp()),this.e1=this.e2=-1,d&&(_=e[p-2],v=e[f].sub(_)._unit()._perp());for(let t=f;t<p;t++){if(y=t===p-1?d?e[f+1]:void 0:e[t+1],y&&e[t].equals(y))continue;v&&(x=v),_&&(g=_),_=e[t],A=this.evaluateLineProgressFeatures(g?g.dist(_):0),v=y?y.sub(_)._unit()._perp():x,x=x||v;const i=g&&y;let s=i?r:d||u?"butt":n;const l=x.x*v.x+x.y*v.y;if(u){const e=function(e){if(e.patternJoinNone){const t=e.segmentPoints.length/2,i=e.lineSoFar-e.segmentStart;for(let r=0;r<t;++r){const t=e.segmentPoints[2*r+1],n=Math.round(e.segmentPoints[2*r])+.5+.25*t;e.patternVertexArray.emplaceBack(n,i,e.segmentStart),e.patternVertexArray.emplaceBack(n,i,e.segmentStart)}e.segmentPoints.length=0}e.e1=e.e2=-1};if(i&&l<Cs){this.updateDistance(g,_),this.addCurrentVertex(_,x,1,1,m,A),e(this),this.addCurrentVertex(_,v,-1,-1,m,A);continue}if(g){if(!y){this.updateDistance(g,_),this.addCurrentVertex(_,x,1,1,m,A),e(this);continue}s="miter"}}let E=x.add(v);0===E.x&&0===E.y||E._unit();const I=E.x*v.x+E.y*v.y,D=0!==I?1/I:1/0,P=2*Math.sqrt(2-2*I),T=I<Ms&&g&&y,z=x.x*v.y-x.y*v.x>0,M=this.overscaling<=16?122880/(512*this.overscaling):0;if(i&&"round"===s)if(D<a)s="miter";else if(D<=2){const e=Rs(_,-10,8202);s="offset"===this.elevationType&&(e||this.hasCrossSlope)?"miter":"fakeround"}if("miter"===s&&D>o&&(s="bevel"),"bevel"===s&&(D>2&&(s="flipbevel"),D<o&&(s="miter")),g&&!("miter"===s&&T)&&this.updateDistance(g,_),"miter"===s)if(T){const e=_.dist(g);if(e>2*M){const t=_.sub(_.sub(g)._mult(M/e)._round());this.updateDistance(g,t),this.addCurrentVertex(t,x,0,0,m,A),g=t}this.updateDistance(g,_),E._mult(D),this.addCurrentVertex(_,E,0,0,m,A);const t=_.dist(y);if(t>2*M){const e=_.add(y.sub(_)._mult(M/t)._round());this.updateDistance(_,e),this.addCurrentVertex(e,v,0,0,m,A),_=e}}else E._mult(D),this.addCurrentVertex(_,E,0,0,m,A);else if("flipbevel"===s){if(D>100)E=v.mult(-1);else{const e=D*x.add(v).mag()/x.sub(v).mag();E._perp()._mult(e*(z?-1:1))}this.addCurrentVertex(_,E,0,0,m,A),this.addCurrentVertex(_,E.mult(-1),0,0,m,A)}else if("bevel"===s||"fakeround"===s){const e=_.dist(g);let t=1;if("offset"===this.elevationType&&"bevel"===s&&"round"!==this.currentLineJoinType&&!this.patternJoinNone&&null!=A&&g&&y){const i=4*M;e<i&&(t=Math.max(0,e/i))}null!=A&&g&&this.addCurrentVertex(_,w||x,-t,-t,m,A);const i=e<=1*M&&"bevel"!==s,r=i?1:D,n=E.mult(z?1:-1);n._mult(r);const o=v.mult(z?-1:1),a=x.mult(z?-1:1),u=this.evaluateLineProgressFeatures(this.distance);if(null==A&&(this.addHalfVertex(_,n.x,n.y,!1,!z,0,m,u),i||this.addHalfVertex(_,n.x+2*a.x,n.y+2*a.y,!1,z,0,m,u)),"fakeround"===s){const e=Math.round(180*P/Math.PI/20);this.addHalfVertex(_,a.x,a.y,!1,z,0,m,u);for(let t=0;t<e;t++){let i=t/e;if(.5!==i){const e=i-.5;i+=i*e*(i-1)*((1.0904+l*(l*(3.55645-1.43519*l)-3.2452))*e*e+(.848013+l*(.215638*l-1.06021)))}const r=o.sub(a)._mult(i)._add(a)._unit();this.addHalfVertex(_,r.x,r.y,!1,z,0,m,u)}this.addHalfVertex(_,o.x,o.y,!1,z,0,m,u)}i||null!=A||this.addHalfVertex(_,n.x+2*o.x,n.y+2*o.y,!1,z,0,m,u),null!=A&&y&&this.addCurrentVertex(_,b||v,t,t,m,A)}else if("butt"===s)this.addCurrentVertex(_,E,0,0,m,A);else if("square"===s){if(!g){const e=c?0:-1;this.addCurrentVertex(_,E,e,e,m,A)}if(this.addCurrentVertex(_,E,0,0,m,A),g){const e=h?0:1;this.addCurrentVertex(_,E,e,e,m,A)}}else if("round"===s){if(g){const e=!i&&w?w:x;this.addCurrentVertex(_,e,0,0,m,A),!i&&h||this.addCurrentVertex(_,e,1,1,m,A,!0)}if(y){const e=!i&&b?b:v;!i&&c||this.addCurrentVertex(_,e,-1,-1,m,A,!0),this.addCurrentVertex(_,e,0,0,m,A)}}}}addVerticesTo(e,t,i,r,n,o,a,s,l,u){const c=(t.w-e.w)/this.tessellationStep|0;let h=0;const d=this.scaledDistance;if(c>1){this.lineSoFar=e.w;const i=(t.x-e.x)/c,r=(t.y-e.y)/c,n=(t.z-e.z)/c,o=(t.w-e.w)/c,a=t.x-e.x,s=t.y-e.y,d=Math.sqrt(a*a+s*s);if(0===d)return;const p=-s/d,f=a/d,m=p,_=f,g=-p,y=-f;for(let t=1;t<c;++t){e.x+=i,e.y+=r,e.z+=n,this.lineSoFar+=o,h+=o;const t=this.evaluateLineProgressFeatures(this.prevDistance+h);this.scaledDistance=(this.prevDistance+h)/this.totalDistance,this.addHalfVertex(e,m,_,u,!1,0,l,t),this.addHalfVertex(e,g,y,u,!0,0,l,t)}}this.lineSoFar=t.w,this.scaledDistance=d;const p=this.evaluateLineProgressFeatures(this.distance);this.addHalfVertex(t,i,r,u,!1,a,l,p),this.addHalfVertex(t,n,o,u,!0,-s,l,p)}evaluateLineProgressFeatures(e){if(!this.variableWidthValue&&!this.variableEmissiveStrengthValue&&"offset"!==this.elevationType)return null;this.evaluationGlobals.lineProgress=0,this.lineClips?this.evaluationGlobals.lineProgress=Math.min(1,(this.totalFeatureLength*this.lineClips.start+e)/this.totalFeatureLength):ze(`line-progress evaluation for ${this.layerIds[0]} requires enabling 
2\'lineMetrics\
vendor: 29,659 bytes, line 2
2' for the source.`);let t=0;this.variableWidthValue&&"constant"!==this.variableWidthValue.kind&&(t=this.variableWidthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,t*=.5);let i=0;this.variableEmissiveStrengthValue&&"constant"!==this.variableEmissiveStrengthValue.kind&&(i=this.variableEmissiveStrengthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0);const r=this.evaluateElevationGroundScale();return"offset"!==this.elevationType?{zOffset:0,variableWidth:t,elevationGroundScale:r,variableEmissiveStrength:i}:"constant"===this.zOffsetValue.kind?{zOffset:this.zOffsetValue.value,variableWidth:t,elevationGroundScale:r,variableEmissiveStrength:i}:{zOffset:this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,variableWidth:t,elevationGroundScale:r,variableEmissiveStrength:i}}evaluateElevationGroundScale(){return this.elevationGroundScaleValue?"constant"===this.elevationGroundScaleValue.kind?this.elevationGroundScaleValue.value:this.elevationGroundScaleValue.evaluate(this.evaluationGlobals,this.lineFeature)||0:0}addCurrentVertex(e,t,i,r,n,o,a=!1){const s=t.x+t.y*i,l=t.y-t.x*i,u=t.y*r-t.x,c=-t.y-t.x*r;if(null!=o){const t="offset"===this.elevationType,h="offset"===this.elevationType?2:10,d=-h,p=Xt+h,f=o.zOffset,m=new Point4D(e.x,e.y,f,this.lineSoFar),_=!!t&&Rs(e,d,p),g=this.lineSoFar,y=this.distance;if(this.currentVertex)if(_){const t=this.currentVertexIsOutside,o=this.currentVertex,h=new Point4D(e.x,e.y,f,this.lineSoFar);if(vs(o,h,d,p),!Rs(h,d,p)){if(t){this.e1=this.e2=-1,this.distance-=o.dist(m),this.lineSoFar=o.w;const e=this.evaluateLineProgressFeatures(o.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(o,s,l,a,!1,i,n,e),this.addHalfVertex(o,u,c,a,!0,-r,n,e),this.prevDistance=this.distance}this.distance=this.prevDistance+o.dist(h),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(o,h,s,l,u,c,i,r,n,a),this.distance=y,this.scaledDistance=this.distance/this.totalDistance}}else{const e=this.currentVertex;if(this.currentVertexIsOutside){vs(e,m,d,p),this.e1=this.e2=-1,this.distance-=e.dist(m),this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=e.w;const t=this.evaluateLineProgressFeatures(e.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(e,s,l,a,!1,i,n,t),this.addHalfVertex(e,u,c,a,!0,-r,n,t),this.prevDistance=this.distance,this.distance=y,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo(e,m,s,l,u,c,i,r,n,a)}else _||(this.addHalfVertex(e,s,l,a,!1,i,n,o),this.addHalfVertex(e,u,c,a,!0,-r,n,o));this.currentVertex=m,this.currentVertexIsOutside=_,this.lineSoFar=g}else this.addHalfVertex(e,s,l,a,!1,i,n,o),this.addHalfVertex(e,u,c,a,!0,-r,n,o)}addHalfVertex({x:e,y:t},i,r,n,o,a,s,l){if(this.patternJoinNone&&(0===this.segmentPoints.length&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),o||this.segmentPoints.push(this.lineSoFar-this.segmentStart,a)),this.layoutVertexArray.emplaceBack((e<<1)+(n?1:0),(t<<1)+(o?1:0),Math.round(63*i)+128,Math.round(63*r)+128,1+(0===a?0:a<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips){const e=rt(this.lineClips.start,this.lineClips.end,this.scaledDistance);this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,e)}const u=s.vertexLength++;if(this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),s.primitiveLength++),o?this.e2=u:this.e1=u,null!=l&&(this.zOffsetVertexArray.emplaceBack(l.zOffset,l.variableWidth,l.variableWidth,l.variableEmissiveStrength),this.showElevationIdDebug&&this.elevationIdColVertexArray.emplaceBack(0,0,0)),this.elevationGroundScaleValue){const e=l?l.elevationGroundScale:this.evaluateElevationGroundScale();this.elevationGroundScaleVertexArray.emplaceBack(e)}}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(e,t){this.prevDistance=this.distance,this.distance+=e.dist(t),this.updateScaledDistance()}}function Rs(e,t,i){return e.x<t||e.x>i||e.y<t||e.y>i}rn(LineBucket,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const Ls=Sa([{name:"a_pos",components:2,type:"Int16"}],4),Fs=Sa([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),Bs=Sa([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class CircleBucket{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new StructArrayLayout2i4,this.indexArray=new StructArrayLayout3ui6,this.segments=new SegmentVector,this.programConfigurations=new ProgramConfigurationSet(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,t){}updateAppearances(e,t,i,r){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,i,r){const n=this.layers[0],o=[];let a=null;"circle"===n.type&&(a=n.layout.get("circle-sort-key"));for(const{feature:n,id:s,index:l,sourceLayerIndex:u}of e){const e=this.layers[0]._featureFilter.needGeometry,c=Aa(n,e);if(!this.layers[0]._featureFilter.filter(new EvaluationParameters(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),c,i))continue;const h=a?a.evaluate(c,{},i):void 0,d={id:s,properties:n.properties,type:n.type,sourceLayerIndex:u,index:l,geometry:e?c.geometry:wa(n,i,r),patterns:{},sortKey:h};o.push(d)}a&&o.sort((e,t)=>e.sortKey-t.sortKey);let s=null;"globe"===r.projection.name&&(this.globeExtVertexArray=new StructArrayLayout6i12,s=r.projection);for(const r of o){const{geometry:n,index:o,sourceLayerIndex:a}=r,l=e[o].feature;this.addFeature(r,n,o,t.availableImages,i,s,t.brightness,t.elevationFeatures),t.featureIndex.insert(l,n,o,a,this.index)}this.hdExt&&this.hdExt.finalize()}update(e,t,i,r,n,o,a){this.programConfigurations.updatePaintArrays(e,t,n,i,r,o,a,this.worldview)}updateExpressions(e){this.programConfigurations.updateExpressions(e)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ls.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Bs.members)),this.hdExt&&this.hdExt.upload(e)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.hdExt&&this.hdExt.destroy())}addFeature(e,t,i,r,n,o,a,s){this.hdExt&&this.hdExt.beginFeature(e,s,n);for(const i of t)for(const t of i){const i=t.x,r=t.y;if(i<0||i>=Xt||r<0||r>=Xt)continue;if(o){const e=o.projectTilePoint(i,r,n),t=o.upVector(n,i,r);this.addGlobeExtVertex(e,t),this.addGlobeExtVertex(e,t),this.addGlobeExtVertex(e,t),this.addGlobeExtVertex(e,t)}const a=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),s=a.vertexLength;this.addCircleVertex(i,r,-1,-1),this.addCircleVertex(i,r,1,-1),this.addCircleVertex(i,r,1,1),this.addCircleVertex(i,r,-1,1),this.hdExt&&this.hdExt.writeVertexQuad(i,r),this.indexArray.emplaceBack(s,s+1,s+2),this.indexArray.emplaceBack(s,s+2,s+3),a.vertexLength+=4,a.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{},r,n,a,void 0,this.worldview)}addCircleVertex(e,t,i,r){this.layoutVertexArray.emplaceBack(2*e+(i+1)/2,2*t+(r+1)/2)}addGlobeExtVertex(e,t){const i=16384;this.globeExtVertexArray.emplaceBack(e.x,e.y,e.z,t[0]*i,t[1]*i,t[2]*i)}}rn(CircleBucket,"CircleBucket",{omit:["layers"]});const Os=Sa([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Vs=Sa([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),ks=Sa([{name:"a_projected_pos",components:4,type:"Float32"}],4);Sa([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Ns=Sa([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),Us=Sa([{name:"a_feature_index",components:1,type:"Float32"}],4),Gs=Sa([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),js=Sa([{name:"a_texb",components:2,type:"Uint16"}]),Hs=Sa([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),$s=Sa([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);Sa([{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 Ws=Sa([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4);Sa([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),Sa([{name:"triangle",components:3,type:"Uint16"}]),Sa([{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"}]),Sa([{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"}]),Sa([{type:"Float32",name:"offsetX"}]),Sa([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);const Xs=new Float32Array(1),qs=new Uint32Array(Xs.buffer);function Zs(e){return Xs[0]=e,qs[0]}const Ys=class _SymbolPropertiesUBO{static getBlockIndices(e){let t=_SymbolPropertiesUBO._blockIndicesTemplate;if(!t){t=_SymbolPropertiesUBO._blockIndicesTemplate=new Uint32Array(e);for(let i=0;i<e;i++)t[i]=i}return t}constructor(e,t,i,r){this.batchIndex=t,this.headerBuffer=null,this.propertiesBuffer=null,this.blockIndicesBuffer=null,this.context=e||null,this.propsDwords=i,this.totalBytes=4*this.propsDwords,this.headerData=r,this.propertiesData=new Float32Array(this.propsDwords),this._headerDirty=!0,this._propsDirtyMin=-1,this._propsDirtyMax=-1,this._blockIndicesDirty=!0,e&&this._initBuffers(e)}_initBuffers(e){const t=e.gl;if(this.totalBytes>e.maxUniformBlockSize)throw new Error(`UBO size ${this.totalBytes} exceeds device limit ${e.maxUniformBlockSize}`);t.isContextLost()||(this.headerBuffer=t.createBuffer(),t.bindBuffer(t.UNIFORM_BUFFER,this.headerBuffer),t.bufferData(t.UNIFORM_BUFFER,_SymbolPropertiesUBO.HEADER_BYTES,t.DYNAMIC_DRAW),this.propertiesBuffer=t.createBuffer(),t.bindBuffer(t.UNIFORM_BUFFER,this.propertiesBuffer),t.bufferData(t.UNIFORM_BUFFER,this.totalBytes,t.DYNAMIC_DRAW),this.blockIndicesBuffer=t.createBuffer(),t.bindBuffer(t.UNIFORM_BUFFER,this.blockIndicesBuffer),t.bufferData(t.UNIFORM_BUFFER,this.totalBytes,t.DYNAMIC_DRAW),t.bindBuffer(t.UNIFORM_BUFFER,null))}markHeaderDirty(){this._headerDirty=!0}writeDataDrivenBlock(e,t){const i=this.headerData,r=4*i[2];if(0===r)return;const n=t*r;if(n+r>this.propertiesData.length)throw new Error(`UBO write out of bounds: feature index ${t} exceeds propertiesData capacity`);const o=i[0];for(let t=0;t<9;t++)o&1<<t&&this._copyFromFlat(n+4*i[3+t],t,e);(-1===this._propsDirtyMin||n<this._propsDirtyMin)&&(this._propsDirtyMin=n);const a=n+r;a>this._propsDirtyMax&&(this._propsDirtyMax=a)}rightSizeForTransfer(){const e=-1===this._propsDirtyMax?0:this._propsDirtyMax;e<this.propertiesData.length&&(this.propertiesData=this.propertiesData.slice(0,e))}_copyFromFlat(e,t,i){let r=4;(t<2||8===t)&&(r=this.headerData[1]>>>t&1?8:4);const n=_SymbolPropertiesUBO.EVAL_FLAT_OFFSETS[t];this.propertiesData.set(i.subarray(n,n+r),e)}upload(e){this.context||(this.context=e);const t=e.gl;this.headerBuffer&&this.propertiesBuffer&&this.blockIndicesBuffer||this._initBuffers(e);let i=!1;if(this._headerDirty&&(t.bindBuffer(t.UNIFORM_BUFFER,this.headerBuffer),t.bufferSubData(t.UNIFORM_BUFFER,0,this.headerData),this._headerDirty=!1,i=!0),-1!==this._propsDirtyMin){const e=this._propsDirtyMin,r=this._propsDirtyMax;t.bindBuffer(t.UNIFORM_BUFFER,this.propertiesBuffer),t.bufferSubData(t.UNIFORM_BUFFER,4*e,this.propertiesData,e,r-e),this._propsDirtyMin=-1,this._propsDirtyMax=-1,i=!0}this._blockIndicesDirty&&(t.bindBuffer(t.UNIFORM_BUFFER,this.blockIndicesBuffer),t.bufferSubData(t.UNIFORM_BUFFER,0,_SymbolPropertiesUBO.getBlockIndices(this.propsDwords)),this._blockIndicesDirty=!1,i=!0),i&&t.bindBuffer(t.UNIFORM_BUFFER,null)}bind(e,t){const i=e.gl,r=(e,r,n)=>{if(!r)return;const o=i.getUniformBlockIndex(t,e);o!==i.INVALID_INDEX&&(i.uniformBlockBinding(t,o,n),i.bindBufferBase(i.UNIFORM_BUFFER,n,r))},n=3*this.batchIndex;r("SymbolPaintPropertiesHeaderUniform",this.headerBuffer,n),r("SymbolPaintPropertiesUniform",this.propertiesBuffer,n+1),r("SymbolPaintPropertiesIndexUniform",this.blockIndicesBuffer,n+2)}destroy(){if(this.context){const e=this.context.gl;this.headerBuffer&&(e.deleteBuffer(this.headerBuffer),this.headerBuffer=null),this.propertiesBuffer&&(e.deleteBuffer(this.propertiesBuffer),this.propertiesBuffer=null),this.blockIndicesBuffer&&(e.deleteBuffer(this.blockIndicesBuffer),this.blockIndicesBuffer=null)}}};Ys.HEADER_DWORDS=16,Ys.HEADER_BYTES=64,Ys.EVAL_FLAT_OFFSETS=[0,8,16,20,24,28,32,36,40],Ys.EVAL_FLAT_TOTAL=48,Ys._blockIndicesTemplate=null;let Js=Ys;function Ks(e,t,i,r,n,o,a,s){return!!e&&("constant"===e.kind?"none"===e.value:"none"===e.evaluate({zoom:0,brightness:o,worldview:s},t,i,n,r,a))}function Qs(e){if(!(e instanceof PossiblyEvaluatedPropertyValue))return!1;const t=e.value;return("source"===t.kind||"composite"===t.kind)&&t.isStateDependent}rn(Js,"SymbolPropertiesUBO",{omit:["headerBuffer","propertiesBuffer","blockIndicesBuffer"]});const el=["icon","text"].map(e=>[`${e}-color`,`${e}-halo-color`,`${e}-opacity`,`${e}-halo-width`,`${e}-halo-blur`,`${e}-emissive-strength`,`${e}-occlusion-opacity`,"symbol-z-offset",`${e}-translate`]),tl=new Float32Array(Js.EVAL_FLAT_TOTAL),il=[0,0],rl=new WeakMap;class SymbolPropertyBinderUBO{constructor(e,t,i,r,n="",o,a){this.layer=e,this.zoom=t,this.lut=i,this.isText=r,this.worldview=n,this.maxUniformBufferBindings=o||24,this.uboSizeDwords=a||4096,this.allFeatureVtIndices=[],this.allFeatureIds=[],this.allFormattedSections=[],this.featureVertexRangesFromId=null,this.featureVertexRangesFromVtIndex=null,this.ubos=[],this.featureCount=0,this.cachedConstantUniforms=null,this.cachedConstantRenderZoom=null,this.cachedConstantBrightness=void 0,this.cachedConstantPaint=null,this.activeAppearanceByVtIndex=null,this.zoomDependency=new Uint8Array(9),this.sharedZoomRanges=new Float32Array(18),this._zoomRangeScratch=new Float32Array(2),this._floorZoom=Math.floor(this.zoom),this.header=new Uint32Array(Js.HEADER_DWORDS),this.updateHeader(),this.isAllConstant=0===this.header[0];const s=4*this.header[2];this.maxFeaturesPerBatch=0===s?Number.MAX_SAFE_INTEGER:Math.floor(this.uboSizeDwords/s)}updateHeader(){const e=this.layer.paint;let t=0,i=0,r=0,n=0,o=!0;const a=this._floorZoom,s=el[+this.isText];for(let l=0;l<9;l++){const u=s[l],c=l<2,h=e.get(u),d=!(!h||"function"!=typeof h.isConstant||h.isConstant()),p=this._appearancesHavePaintProperties(u);if(!d&&!p){const e=this._layerUnevaluated(u);e&&e.expression&&"camera"===e.expression.kind&&(r|=1<<l);continue}t|=1<<l;const f=this._collectZoomSignatures(u,a),m=f.hasZoom,_=f.differs,g=8===l;this.zoomDependency[l]=_?2:m?1:0;const y=_||g&&m;y&&(i|=1<<l);const x=h&&h.value;x&&!1===x.isLightConstant&&(o=!1),this.header[3+l]=n,n+=y?2:1,m&&!_&&f.representative&&(this._computeZoomRange(f.representative,a,this.sharedZoomRanges,2*l),c&&(this.header[12+2*l]=Zs(this.sharedZoomRanges[2*l]),this.header[12+2*l+1]=Zs(this.sharedZoomRanges[2*l+1])))}this.header[0]=t,this.header[1]=i,this.header[2]=n,this.isLightConstant=o,this.cameraMask=r}_recomputeSharedRanges(){const e=this._floorZoom,t=el[+this.isText];let i=0,r=!1;for(let n=0;n<9;n++){const o=t[n],a=this.zoomDependency[n];if(this.header[0]&1<<n){if(0!==a&&2!==a){const t=this._collectZoomSignatures(o,e);t.representative&&(this._computeZoomRange(t.representative,e,this.sharedZoomRanges,2*n),n<2&&(this.header[12+2*n]=Zs(this.sharedZoomRanges[2*n]),this.header[12+2*n+1]=Zs(this.sharedZoomRanges[2*n+1]),r=!0))}}else{const e=this._layerUnevaluated(o);e&&e.expression&&"camera"===e.expression.kind&&(i|=1<<n)}}if(this.cameraMask=i,r)for(const e of this.ubos)e.markHeaderDirty()}_collectZoomSignatures(e,t){let i=!1,r=!1,n=null,o=0,a=0;const s=e=>{if(!e)return;this._computeZoomRange(e,t,this._zoomRangeScratch,0);const s=this._zoomRangeScratch[0],l=this._zoomRangeScratch[1];i?s===o&&l===a||(r=!0):(i=!0,o=s,a=l,n=e)};s(this._zoomExprOf(this._layerUnevaluated(e)));for(const t of this.layer.getAppearances()||[])t.hasPaintProperty(e)&&s(this._zoomExprOf(t.getUnevaluatedPaintProperty(e)));return{hasZoom:i,differs:r,representative:n}}evaluateAllProperties(e,t,i,r,n,o,a){const s={brightness:n,worldview:this.worldview},l={feature:e,featureState:t,canonical:i,availableImages:r,params:new EvaluationParameters(this.zoom,s),paramsNext:new EvaluationParameters(this.zoom+1,s),formattedSection:o,activeAppearance:a},u=el[+this.isText];for(let e=0;e<9;e++){const t=u[e],i=e<2,r=8===e,n=this.zoomDependency[e],o=0!==n,a=2===n,s=Js.EVAL_FLAT_OFFSETS[e],c=s+(i||r?4:2);i?this._evaluateColorValue(t,e,o,a,c,l,s):r?this._evaluateTranslateValue(t,e,o,a,c,l,s):this._evaluateFloatValue(t,e,o,a,c,l,s)}return tl}_resolveProp(e,t,i=!1,r){const n=this.layer.paint,o=n.get(e),a=e,s=!(!t||!t.hasPaintProperty(a)),l=s?r&&o&&o.property.overrides&&o.property.overrides.hasOverride(r)?o:t.paintProperties.get(a):n.get(e);if(i||!l||"function"!=typeof l.isConstant||!l.isConstant())return l;const u=s?t.getUnevaluatedPaintProperty(a):this._layerUnevaluated(e);return this._unbakeCamera(l,u)}_unbakeCamera(e,t){const i=t&&t.expression;if(!i||"camera"!==i.kind)return e;let r=rl.get(t);return r||(r=new PossiblyEvaluatedPropertyValue(e.property,i,e.parameters,e.iconImageUseTheme),rl.set(t,r)),r}_layerUnevaluated(e){const t=this.layer._transitionablePaint._values[e];return t&&t.value}_zoomExprOf(e){const t=e&&e.expression;return!t||"composite"!==t.kind&&"camera"!==t.kind?null:t}_evalAt(e,t,i){return e.property.evaluate(e.value,t,i.feature,i.featureState,i.canonical,i.availableImages,e.iconImageUseTheme,i.formattedSection)}_evaluateColorValue(e,t,i,r,n,o,a){const s=this._resolveProp(e,o.activeAppearance,!1,o.formattedSection);if(this._writePropertyZoomRange(t,i,r,s,n),!s)return tl[a]=0,tl[a+1]=0,tl[a+2]=0,void(tl[a+3]=1);const l=this._resolveProp(`${e}-use-theme`,o.activeAppearance,!0),u=Ks(l&&"string"!=typeof l?l.value:void 0,o.feature,o.featureState,o.availableImages,o.canonical,o.params.brightness,o.formattedSection,this.worldview)?null:this.lut,c=(s.isConstant()?s.constantOr(Color.transparent):this._evalAt(s,o.params,o)||Color.transparent).toNonPremultipliedRenderColor(u);if(tl[a]=Ca(255*c.r,255*c.g),tl[a+1]=Ca(255*c.b,255*c.a),i){const e=(this._evalAt(s,o.paramsNext,o)||Color.transparent).toNonPremultipliedRenderColor(u);tl[a+2]=Ca(255*e.r,255*e.g),tl[a+3]=Ca(255*e.b,255*e.a)}else tl[a+2]=tl[a],tl[a+3]=tl[a+1]}_computeZoomRange(e,t,i,r){let n=0,o=1;const a=!e||"composite"!==e.kind&&"camera"!==e.kind?null:e.zoomStops;if(a&&a.length>0)if(null==e.interpolationType){n=o=1;for(const e of a)if(e>t&&e<t+1){n=o=e-t;break}}else a[0]>t&&a[0]<t+1&&(n=a[0]-t);i[r]=n,i[r+1]=o}_writeZoomRange(e,t){this._computeZoomRange(e&&e.value,this._floorZoom,tl,t)}_writePropertyZoomRange(e,t,i,r,n){i?this._writeZoomRange(r,n):t?(tl[n]=this.sharedZoomRanges[2*e],tl[n+1]=this.sharedZoomRanges[2*e+1]):(tl[n]=0,tl[n+1]=0)}_evaluateFloatValue(e,t,i,r,n,o,a){const s=e.endsWith("opacity")?1:0,l=this._resolveProp(e,o.activeAppearance);this._writePropertyZoomRange(t,i,r,l,n);const u=(l?l.isConstant()?l.constantOr(s):this._evalAt(l,o.params,o):s)??s;if(tl[a]=u,i){const e=this._evalAt(l,o.paramsNext,o);tl[a+1]=e??s}else tl[a+1]=u}_evaluateTranslateValue(e,t,i,r,n,o,a){const s=this._resolveProp(e,o.activeAppearance);this._writePropertyZoomRange(t,i,r,s,n);const l=!!s&&"function"==typeof s.isConstant&&!s.isConstant(),u=s?"function"!=typeof s.isConstant?s:l?this._evalAt(s,o.params,o):s.constantOr(il):void 0;if(tl[a]=u?u[0]:0,tl[a+1]=u?u[1]:0,i){const e=l?this._evalAt(s,o.paramsNext,o):u;tl[a+2]=e?e[0]:0,tl[a+3]=e?e[1]:0}else tl[a+2]=tl[a],tl[a+3]=tl[a+1]}_appearancesHavePaintProperties(e){return this.layer.getAppearances().some(t=>t.hasPaintProperty(e))}hasStateDependentPaint(e){const t=e.paint,i=el[+this.isText];for(const e of i)if(Qs(t.get(e)))return!0;for(const t of e.getAppearances()||[])for(const e of i){const i=e;if(t.hasPaintProperty(i)&&Qs(t.paintProperties.get(i)))return!0}return!1}hasPerFeatureTranslate(){return!!(256&this.header[0])}getCurrentBatchIndex(){return 0===this.maxFeaturesPerBatch?0:Math.floor(this.featureCount/this.maxFeaturesPerBatch)}_writeFeatureBlock(e,t){const i=this.isAllConstant?0:e;let r=Math.floor(i/this.maxFeaturesPerBatch),n=i%this.maxFeaturesPerBatch;this._batchExceedsDeviceLimit(r)&&(r=0,n=0);const o=this.ubos[r];return!!o&&(o.writeDataDrivenBlock(t,n),!0)}_batchExceedsDeviceLimit(e){return 3*e+2>=this.maxUniformBufferBindings}_reevaluateAt(e,t,i,r,n,o){if(!t)return;const a=this.allFeatureVtIndices[e],s=t.feature(a);if(!s)return;const l=this.allFeatureIds[e],u=null!=l&&n[l]||{},c={type:s.type,id:l,properties:s.properties||{},geometry:[]},h=this.activeAppearanceByVtIndex?this.activeAppearanceByVtIndex.get(a):void 0,d=this.evaluateAllProperties(c,u,i,r,o,(this.allFormattedSections?this.allFormattedSections[e]:void 0)||void 0,h);this._writeFeatureBlock(e,d)}_ensureRangeMaps(){if(!this.featureVertexRangesFromId){this.featureVertexRangesFromId=new Map,this.featureVertexRangesFromVtIndex=new Map;for(let e=0;e<this.allFeatureVtIndices.length;e++){const t=this.allFeatureIds[e];if(null!=t){let i=this.featureVertexRangesFromId.get(t);i||this.featureVertexRangesFromId.set(t,i=[]),i.push(e)}const i=this.allFeatureVtIndices[e];let r=this.featureVertexRangesFromVtIndex.get(i);r||this.featureVertexRangesFromVtIndex.set(i,r=[]),r.push(e)}}}populateUBO(e,t,i,r,n,o){const a=e.id,s=this.header,l=this.evaluateAllProperties(e,{},i,r,n,o);let u,c;this.isAllConstant?(u=0,c=0===this.featureCount,c&&(this.featureCount=1)):(u=this.featureCount++,c=!0);let h=Math.floor(u/this.maxFeaturesPerBatch),d=u%this.maxFeaturesPerBatch;return c&&(this._batchExceedsDeviceLimit(h)?(ze(`Too many symbol features: batch ${h} requires binding points up to ${3*h+2}, device limit ${this.maxUniformBufferBindings}. Some features will render incorrectly.`),h=0,d=0):(this.ubos[h]||(this.ubos[h]=new Js(null,h,this.uboSizeDwords,s)),this.ubos[h].writeDataDrivenBlock(l,d))),this.allFeatureVtIndices.push(t),this.allFeatureIds.push(a),this.allFormattedSections.push(o||null),d}updateFeatures(e,t,i,r,n,o,a){this.layer=t,this.cachedConstantUniforms=null,this._ensureRangeMaps();for(const t of e){const e=this.featureVertexRangesFromId.get(t);if(e)for(const t of e)this._reevaluateAt(t,i,r,n,o,a)}}updateDynamicExpressions(e,t,i,r,n,o){if(this.layer=e,this.cachedConstantUniforms=null,this._recomputeSharedRanges(),0!==this.header[0])for(let e=0;e<this.allFeatureVtIndices.length;e++)this._reevaluateAt(e,t,i,r,n,o)}updateFeaturePaintForAppearance(e,t,i,r,n,o,a){if(!this.layer)return!1;if(this.activeAppearanceByVtIndex||(this.activeAppearanceByVtIndex=new Map),this.activeAppearanceByVtIndex.set(e,a||null),0===this.header[0])return!1;this._ensureRangeMaps();const s=this.featureVertexRangesFromVtIndex.get(e);if(!s)return!1;let l=!1;for(const e of s){const s=this.evaluateAllProperties(t,i,r,n,o,(this.allFormattedSections?this.allFormattedSections[e]:void 0)||void 0,a);l=this._writeFeatureBlock(e,s)||l}return l}getConstantUniformValues(e,t){const i=!!this.cameraMask;if(this.cachedConstantUniforms&&this.cachedConstantPaint===this.layer.paint&&this.cachedConstantBrightness===t&&(!i||this.cachedConstantRenderZoom===e))return this.cachedConstantUniforms;const r=this.layer.paint,n=i?new EvaluationParameters(e,{brightness:t,worldview:this.worldview}):null,o={type:1,id:void 0,properties:{},geometry:[]},a=el[+this.isText],s=e=>{const i=a[e],s=r.get(i);if(!s)return[0,0,0,1];const l=r.get(`${i}-use-theme`),u=Ks(l&&"string"!=typeof l?l.value:void 0,o,{},[],void 0,t,void 0,this.worldview)?null:this.lut;return(this.cameraMask&1<<e&&n?s.property.evaluate(s.value,n,o,{},void 0,[])||Color.transparent:s.constantOr(Color.transparent)).toNonPremultipliedRenderColor(u).toArray01()},l=(e,t)=>{const i=r.get(a[e]);return i?this.cameraMask&1<<e&&n?i.property.evaluate(i.value,n,o,{},void 0,[])??t:i.constantOr(t):t},u={fill_np_color:s(0),halo_np_color:s(1),opacity:l(2,1),halo_width:l(3,0),halo_blur:l(4,0),emissive_strength:l(5,0),occlusion_opacity:l(6,1),z_offset:l(7,0)};return this.cachedConstantUniforms=u,this.cachedConstantRenderZoom=e,this.cachedConstantBrightness=t,this.cachedConstantPaint=this.layer.paint,u}finalize(){for(const e of this.ubos)e.rightSizeForTransfer()}upload(e){for(const t of this.ubos)t.upload(e)}bind(e,t,i=0){this.ubos[i]&&this.ubos[i].bind(e,t)}destroy(){for(const e of this.ubos)e.destroy();this.ubos=[],this.featureVertexRangesFromId=null,this.featureVertexRangesFromVtIndex=null,this.allFeatureVtIndices=[],this.allFeatureIds=[],this.featureCount=0,this.maxFeaturesPerBatch=0}}rn(SymbolPropertyBinderUBO,"SymbolPropertyBinderUBO",{omit:["layer","cachedConstantUniforms","cachedConstantRenderZoom","cachedConstantBrightness","cachedConstantPaint","activeAppearanceByVtIndex","featureVertexRangesFromId","featureVertexRangesFromVtIndex"]});const nl=24;function ol(e,t,i){return e.sections.forEach(e=>{e.text=function(e,t,i){const r=t.layout.get("text-transform").evaluate(i,{});return"uppercase"===r?e=e.toLocaleUpperCase():"lowercase"===r&&(e=e.toLocaleLowerCase()),eo.applyArabicShaping&&(e=eo.applyArabicShaping(e)),e}(e.text,t,i)}),e}const al={horizontal:1,vertical:2,horizontalOnly:3};function sl(e){let t=.5,i=.5;switch(e){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(e){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:t,verticalAlign:i}}function ll(e,t,i,r){const{horizontalAlign:n,verticalAlign:o}=sl(r),a=i[0]-e.displaySize[0]*n,s=i[1]-e.displaySize[1]*o;return{imagePrimary:e,imageSecondary:t,top:s,bottom:s+e.displaySize[1],left:a,right:a+e.displaySize[0]}}function ul(e,t,i,r,n,o){const a=e.imagePrimary;let s;if(a.content){const e=a.content,t=a.pixelRatio||1;s=[e[0]/t,e[1]/t,a.displaySize[0]-e[2]/t,a.displaySize[1]-e[3]/t]}const l=t.left*o,u=t.right*o;let c,h,d,p;"width"===i||"both"===i?(p=n[0]+l-r[3],h=n[0]+u+r[1]):(p=n[0]+(l+u-a.displaySize[0])/2,h=p+a.displaySize[0]);const f=t.top*o,m=t.bottom*o;return"height"===i||"both"===i?(c=n[1]+f-r[0],d=n[1]+m+r[2]):(c=n[1]+(f+m-a.displaySize[1])/2,d=c+a.displaySize[1]),{imagePrimary:a,imageSecondary:void 0,top:c,right:h,bottom:d,left:p,collisionPadding:s}}const cl={"!":"
2\ufe15","#":"\uff03",$:"\uff04","%":"\uff05","&":"\uff06","(":"\ufe35",")":"\ufe36","*":"\uff0a","+":"\uff0b",",":"\ufe10","-":"\ufe32",".":"\u30fb","/":"\uff0f",":":"\ufe13",";":"\ufe14","<":"\ufe3f","=":"\uff1d",">":"\ufe40","?":"\ufe16","@":"\uff20","[":"\ufe47","\\\\":"\uff3c","]":"\ufe48","^":"\uff3e",_:"\ufe33","`":"\uff40","{":"\ufe37","|":"\u2015","}":"\ufe38","~":"\uff5e","\xa2":"\uffe0","\xa3":"\uffe1","\xa5":"\uffe5","\xa6":"\uffe4","\xac":"\uffe2","\xaf":"\uffe3","\u2013":"\ufe32","\u2014":"\ufe31","\u2018":"\ufe43","\u2019":"\ufe44","\u201c":"\ufe41","\u201d":"\ufe42","\u2026":"\ufe19","\u2027":"\u30fb","\u20a9":"\uffe6","\u3001":"\ufe11","\u3002":"\ufe12","\u3008":"\ufe3f","\u3009":"\ufe40","\u300a":"\ufe3d","\u300b":"\ufe3e","\u300c":"\ufe41","\u300d":"\ufe42","\u300e":"\ufe43","\u300f":"\ufe44","\u3010":"\ufe3b","\u3011":"\ufe3c","\u3014":"\ufe39","\u3015":"\ufe3a","\u3016":"\ufe17","\u3017":"\ufe18","\uff01":"\ufe15","\uff08":"\ufe35","\uff09":"\ufe36","\uff0c":"\ufe10","\uff0d":"\ufe32","\uff0e":"\u30fb","\uff1a":"\ufe13","\uff1b":"\ufe14","\uff1c":"\ufe3f","\uff1e":"\ufe40","\uff1f":"\ufe16","\uff3b":"\ufe47","\uff3d":"\ufe48","\uff3f":"\ufe33","\uff5b":"\ufe37","\uff5c":"\u2015","\uff5d":"\ufe38","\uff5f":"\ufe35","\uff60":"\ufe36","\uff61":"\ufe12","\uff62":"\ufe41","\uff63":"\ufe42"};function hl(e){return"\ufe36"===e||"\ufe48"===e||"\ufe38"===e||"\ufe44"===e||"\ufe42"===e||"\ufe3e"===e||"\ufe3c"===e||"\ufe3a"===e||"\ufe18"===e||"\ufe40"===e||"\ufe10"===e||"\ufe13"===e||"\ufe14"===e||"\uff40"===e||"\uffe3"===e||"\ufe11"===e||"\ufe12"===e}function dl(e){return"\ufe35"===e||"\ufe47"===e||"\ufe37"===e||"\ufe43"===e||"\ufe41"===e||"\ufe3d"===e||"\ufe3b"===e||"\ufe39"===e||"\ufe17"===e||"\ufe3f
vendor: 34,855 bytes, line 2
2"===e}const pl=128;function fl(e,t,i,r){const{expression:n}=t;if("constant"===n.kind)return{kind:"constant",layoutSize:n.evaluate(new EvaluationParameters(e+1,{worldview:i}),void 0,void 0,void 0,r)};if("source"===n.kind)return{kind:"source"};{const{zoomStops:t,interpolationType:o}=n;let a=0;for(;a<t.length&&t[a]<=e;)a++;a=Math.max(0,a-1);let s=a;for(;s<t.length&&t[s]<e+1;)s++;s=Math.min(t.length-1,s);const l=t[a],u=t[s];return"composite"===n.kind?{kind:"composite",minZoom:l,maxZoom:u,interpolationType:o}:{kind:"camera",minZoom:l,maxZoom:u,minSize:n.evaluate(new EvaluationParameters(l,{worldview:i}),void 0,void 0,void 0,r),maxSize:n.evaluate(new EvaluationParameters(u,{worldview:i}),void 0,void 0,void 0,r),interpolationType:o}}}function ml(e,{uSize:t,uSizeT:i},{lowerSize:r,upperSize:n}){return"source"===e.kind?r/pl:"composite"===e.kind?rt(r/pl,n/pl,i):t}function _l(e,t,i=1){let r=0,n=0;if("constant"===e.kind)n=e.layoutSize*i;else if("source"!==e.kind){const{interpolationType:o,minZoom:a,maxZoom:s}=e,l=o?ve(Interpolate.interpolationFactor(o,t,a,s),0,1):0;"camera"===e.kind?n=rt(e.minSize,e.maxSize,l)*i:r=l*i}return{uSizeT:r,uSize:n}}const gl=Number.POSITIVE_INFINITY,yl=Math.sqrt(2),xl=32640;function vl(e,[t,i]){let r=0,n=0;if(i===gl){t<0&&(t=0);const i=t/yl;switch(e){case"top-right":case"top-left":n=i-7;break;case"bottom-right":case"bottom-left":n=7-i;break;case"bottom":n=7-t;break;case"top":n=t-7}switch(e){case"top-right":case"bottom-right":r=-i;break;case"top-left":case"bottom-left":r=i;break;case"left":r=t;break;case"right":r=-t}}else{switch(t=Math.abs(t),i=Math.abs(i),e){case"top-right":case"top-left":case"top":n=i-7;break;case"bottom-right":case"bottom-left":case"bottom":n=7-i}switch(e){case"top-right":case"bottom-right":case"right":r=-t;break;case"top-left":case"bottom-left":case"left":r=t}}return[r,n]}function bl(e,t,i,r,n,o,a){const s=e.hasLayoutProperty(n)?t.getAppearanceValueAndResolveTokens(e,n,i,r,[]):null;return(Array.isArray(o)?Array.isArray(s):typeof s==typeof o)?a?a(s):s:o}function wl(e,t,i,r,n,o,a,s){return{appearanceIconOffset:bl(e,t,i,r,"icon-offset",n),appearanceIconRotate:bl(e,t,i,r,"icon-rotate",o),appearanceIconSize:bl(e,t,i,r,"icon-size",a,e=>e*s)}}function Al(e,t,i,r,n,o,a){const s=bl(e,t,i,r,"text-offset",n,([e,t])=>[e*nl,t*nl]);return{appearanceTextOffset:s,appearanceTextRotate:bl(e,t,i,r,"text-rotate",o),appearanceTextSize:bl(e,t,i,r,"text-size",a)}}function El(e,t,i,r,n,o,a,s,l,u){if(!e)return;const c=function(e,t,i,r,n,o,a){if("camera"===e.kind)return e.maxSize;if("composite"===e.kind){const r=t.possiblyEvaluate(new EvaluationParameters(e.maxZoom,{worldview:o}),i,a).evaluate(n,{},i,a),s=t.possiblyEvaluate(new EvaluationParameters(e.minZoom,{worldview:o}),i,a).evaluate(n,{},i,a);return Math.max(r,s)}return t.possiblyEvaluate(new EvaluationParameters(r,{worldview:o}),i,a).evaluate(n,{},i,a)}(t,i,r,n,o,l,u);return e.scaleSelf(c*s*a)}function Il(e,t,i,r,n,o,a,s,l,u){return{iconPrimary:El(e.getPrimary(),t,i,r,n,o,a,s,l,u),iconSecondary:El(e.getSecondary(),t,i,r,n,o,a,s,l,u)}}function Sl(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Dl(e,t){return e*t/24}function Pl(e,t,i,r,n,o){let a=null;return"source"===t.kind?(a=[pl*i*r],a[0]>xl&&ze(`${e}: Value for "text-size" or "icon-size" is >= 255. Reduce your "text-size" or "icon-size".`)):"composite"===t.kind&&(a=[pl*n*r,pl*o*r],(a[0]>xl||a[1]>xl)&&ze(`${e}: Value for "text-size" or "icon-size" is >= 255. Reduce your "text-size" or "icon-size".`)),a}Sa([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),Sa([{name:"a_pos_3",components:3,type:"Int16"}]),Sa([{name:"a_pos",type:"Int16",components:2}]);class Ray2D{constructor(e,t){this.pos=e,this.dir=t}intersectsPlane(e,t,i){const r=J(t,this.dir);if(Math.abs(r)<1e-6)return!1;const n=((e[0]-this.pos[0])*t[0]+(e[1]-this.pos[1])*t[1])/r;return i[0]=this.pos[0]+this.dir[0]*n,i[1]=this.pos[1]+this.dir[1]*n,!0}}class Ray{constructor(e,t){this.pos=e,this.dir=t}intersectsPlane(e,t,i){const r=I(t,this.dir);if(Math.abs(r)<1e-6)return!1;const n=((e[0]-this.pos[0])*t[0]+(e[1]-this.pos[1])*t[1]+(e[2]-this.pos[2])*t[2])/r;return i[0]=this.pos[0]+this.dir[0]*n,i[1]=this.pos[1]+this.dir[1]*n,i[2]=this.pos[2]+this.dir[2]*n,!0}closestPointOnSphere(t,i,r){if(function(t,i){var r=t[0],n=t[1],o=t[2],a=i[0],s=i[1],l=i[2];return Math.abs(r-a)<=e*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-s)<=e*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(o-l)<=e*Math.max(1,Math.abs(o),Math.abs(l))}(this.pos,t)||0===i)return r[0]=r[1]=r[2]=0,!1;const[n,o,a]=this.dir,s=this.pos[0]-t[0],l=this.pos[1]-t[1],u=this.pos[2]-t[2],c=n*n+o*o+a*a,h=2*(s*n+l*o+u*a),d=h*h-4*c*(s*s+l*l+u*u-i*i);if(d<0){const e=Math.max(-h/2,0),t=s+n*e,c=l+o*e,d=u+a*e,p=Math.hypot(t,c,d);return r[0]=t*i/p,r[1]=c*i/p,r[2]=d*i/p,!1}{const e=(-h-Math.sqrt(d))/(2*c);if(e<0){const e=Math.hypot(s,l,u);return r[0]=s*i/e,r[1]=l*i/e,r[2]=u*i/e,!1}return r[0]=s+n*e,r[1]=l+o*e,r[2]=u+a*e,!0}}}function Tl(e,t,i,r){const n=t[0],o=t[1],a=t[2],s=i[0],l=i[1],u=i[2];let c=1/0,h=-1/0;for(let t=0;t<e.length;t++){const i=e[t],r=(i[0]-n)*s+(i[1]-o)*l+(i[2]-a)*u;r<c&&(c=r),r>h&&(h=r)}return r[0]=c,r[1]=h,r}function zl(e,t){let i=!0;for(let r=0;r<e.planes.length;r++){const n=e.planes[r];let o=0;for(let e=0;e<t.length;e++)o+=+(I(n,t[e])+n[3]>=0);if(0===o)return 0;o!==t.length&&(i=!1)}return i?2:1}const Ml=[0,0];function Cl(e,t){for(const i of e.projections){const r=Tl(t,e.points[0],i.axis,Ml);if(i.projection[1]<r[0]||i.projection[0]>r[1])return 0}return 1}class Aabb{static fromPoints(e){const t=[1/0,1/0,1/0],i=[-1/0,-1/0,-1/0];for(const r of e)g(t,t,r),y(i,i,r);return new Aabb(t,i)}static fromTileIdAndHeight(e,t,i){const r=1<<e.canonical.z,n=e.canonical.x,o=e.canonical.y;return new Aabb([n/r,o/r,t],[(n+1)/r,(o+1)/r,i])}static applyTransform(e,t){const i=e.getCorners();for(let e=0;e<i.length;++e)T(i[e],i[e],t);return Aabb.fromPoints(i)}static applyTransformFast(e,t){const i=[t[12],t[13],t[14]],r=[...i];for(let n=0;n<3;n++)for(let o=0;o<3;o++){const a=t[4*o+n],s=a*e.min[o],l=a*e.max[o];i[n]+=Math.min(s,l),r[n]+=Math.max(s,l)}return new Aabb(i,r)}static projectAabbCorners(e,t){const i=e.getCorners();for(let e=0;e<i.length;++e)T(i[e],i[e],t);return i}constructor(e,t){this.min=e,this.max=t,this.center=x([],m([],this.min,this.max),.5)}quadrant(e){const t=[e%2==0,e<2],i=h(this.min),r=h(this.max);for(let e=0;e<t.length;e++)i[e]=t[e]?this.min[e]:this.center[e],r[e]=t[e]?this.center[e]:this.max[e];return r[2]=this.max[2],new Aabb(i,r)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}distanceZ(e){return Math.max(Math.min(this.max[2],e[2]),this.min[2])-e[2]}getCorners(){const e=this.min,t=this.max;return[[e[0],e[1],e[2]],[t[0],e[1],e[2]],[t[0],t[1],e[2]],[e[0],t[1],e[2]],[e[0],e[1],t[2]],[t[0],e[1],t[2]],[t[0],t[1],t[2]],[e[0],t[1],t[2]]]}intersects(e){return this.intersectsAabb(e.bounds)?zl(e,this.getCorners()):0}intersectsFlat(e){return this.intersectsAabb(e.bounds)?zl(e,[[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(e,t){return t||this.intersects(e)?Cl(e,this.getCorners()):0}intersectsPreciseFlat(e,t){return t||this.intersectsFlat(e)?Cl(e,[[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(e){for(let t=0;t<3;++t)if(this.min[t]>e.max[t]||e.min[t]>this.max[t])return!1;return!0}intersectsAabbXY(e){return!(this.min[0]>e.max[0]||e.min[0]>this.max[0]||this.min[1]>e.max[1]||e.min[1]>this.max[1])}encapsulate(e){for(let t=0;t<3;t++)this.min[t]=Math.min(this.min[t],e.min[t]),this.max[t]=Math.max(this.max[t],e.max[t])}encapsulatePoint(e){for(let t=0;t<3;t++)this.min[t]=Math.min(this.min[t],e[t]),this.max[t]=Math.max(this.max[t],e[t])}closestPoint(e){return[Math.max(Math.min(this.max[0],e[0]),this.min[0]),Math.max(Math.min(this.max[1],e[1]),this.min[1]),Math.max(Math.min(this.max[2],e[2]),this.min[2])]}}rn(Aabb,"Aabb");const Rl=[new Aabb([ra,ra,ra],[na,na,na]),new Aabb([ra,ra,ra],[0,0,na]),new Aabb([0,ra,ra],[na,0,na]),new Aabb([ra,0,ra],[0,na,na]),new Aabb([0,0,ra],[na,na,na])];function Ll(e,t,i,r=!0){const n=x([],e._camera.position,e.worldSize),o=[t,i,1,1];var a,s,l;F(o,o,e.pixelMatrixInverse),(a=o)[0]=(s=o)[0]*(l=1/o[3]),a[1]=s[1]*l,a[2]=s[2]*l,a[3]=s[3]*l;const u=E([],R([],o,n)),c=e.globeMatrix,h=[c[12],c[13],c[14]],p=R([],h,n),f=d(p),_=E([],p),g=e.worldSize/(2*Math.PI),y=I(_,u),v=Math.asin(g/f);if(v<Math.acos(y)){if(!r)return null;const e=[],t=[];x(e,u,f/y),E(t,R(t,e,p)),E(u,m(u,p,x(u,t,Math.tan(v)*f)))}const b=[];new Ray(n,u).closestPointOnSphere(h,g,b);const w=E([],Fe(c,0)),A=E([],Fe(c,1)),D=E([],Fe(c,2)),P=I(w,b),T=I(A,b),z=I(D,b),M=xe(Math.asin(-T/g));let C=xe(Math.atan2(P,z));C=e.center.lng+function(e,t){const i=(t-e+180)%360-180;return i<-180?i+360:i}(e.center.lng,C);const L=Ct(C),B=ve(Rt(M),0,1);return new MercatorCoordinate(L,B)}function Fl(e){if(e.z<=1)return Rl[e.z+2*e.y+e.x];const t=function({x:e,y:t,z:i},r=!1){const n=1/(1<<i),o=new LngLat(Lt(e*n),t===(1<<i)-1&&r?-90:Ft((t+1)*n)),a=new LngLat(Lt((e+1)*n),0===t&&r?90:Ft(t*n));return new LngLatBounds(o,a)}(e),i=function(e,t=ia){const i=ye(e.getNorth()),r=ye(e.getSouth()),n=Math.cos(i),o=Math.cos(r),a=Math.sin(i),s=Math.sin(r),l=e.getWest(),u=e.getEast();return[oa(o,s,l,t),oa(o,s,u,t),oa(n,a,u,t),oa(n,a,l,t)]}(t);return Aabb.fromPoints(i)}function Bl(e,t,i){return x(e,e,1-i),v(e,e,t,i)}function Ol(e,t,i,r){const n=1<<i.z,o=(e/Xt+i.x)/n;return aa(Ft((t/Xt+i.y)/n),Lt(o),r)}function Vl({min:e,max:t}){return 16383/Math.max(t[0]-e[0],t[1]-e[1],t[2]-e[2])}const kl=new Float64Array(16);function Nl(e){const t=Vl(e),i=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}(kl,[t,t,t]);return a(i,i,A([],e.min))}function Ul(e){const t=Xt/(2*Math.PI);return e/(2*Math.PI)/t}function Gl(e){return be(5,6,e)}function jl(e,t){const i=e.fovAboveCenter,r=e.elevation?e.elevation.getMinElevationBelowMSL()*t:0,n=Math.min(r,e.isOrthographic?-10*t:0),o=(e._camera.position[2]*e.worldSize-n)/Math.cos(e._pitch),a=Math.sin(i)*o/Math.sin(Math.max(Math.PI/2-e._pitch-i,.01));let s=Math.sin(e._pitch)*a+o;const l=o*(1/e._horizonShift);if(!e.elevation||0===e.elevation.exaggeration()){let t=Math.max(e.zoom-17,0);e.isOrthographic&&(t/=10),s*=1+t}return Math.min(1.01*s,l)}class CanonicalTileID{constructor(e,t,i){this.z=e,this.x=t,this.y=i,this.key=Hl(0,e,e,t,i)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}isChildOf(e){const t=this.z-e.z;return 0===e.z||e.z<this.z&&e.x===this.x>>t&&e.y===this.y>>t}url(e,t){const i=function(e,t,i){const r=2**i,n=2*Math.PI*6378137,o=n*(e/r-.5),a=n*(.5-(t+1)/r);return`${o},${a},${o+n/r},${a+n/r}`}(this.x,this.y,this.z),r=function(e,t,i){let r,n="";for(let o=e;o>0;o--)r=1<<o-1,n+=(t&r?1:0)+(i&r?2:0);return n}(this.z,this.x,this.y);return e[(this.x+this.y)%e.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"===t?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",r).replace("{bbox-epsg-3857}",i)}toString(){return`${this.z}/${this.x}/${this.y}`}}class UnwrappedTileID{constructor(e,t){this.wrap=e,this.canonical=t,this.key=Hl(e,t.z,t.z,t.x,t.y)}}class OverscaledTileID{constructor(e,t,i,r,n){this.overscaledZ=e,this.wrap=t,this.canonical=new CanonicalTileID(i,+r,+n),this.key=0===t&&e===i?this.canonical.key:Hl(t,e,i,r,n)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){const t=this.canonical.z-e;return e>this.canonical.z?new OverscaledTileID(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new OverscaledTileID(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}calculateScaledKey(e,t=!0){if(this.overscaledZ===e&&t)return this.key;if(e>this.canonical.z)return Hl(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y);{const i=this.canonical.z-e;return Hl(this.wrap*+t,e,e,this.canonical.x>>i,this.canonical.y>>i)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;const t=this.canonical.z-e.canonical.z;return 0===e.overscaledZ||e.overscaledZ<this.overscaledZ&&e.canonical.z<this.canonical.z&&e.canonical.x===this.canonical.x>>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new OverscaledTileID(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const t=this.canonical.z+1,i=2*this.canonical.x,r=2*this.canonical.y;return[new OverscaledTileID(t,this.wrap,t,i,r),new OverscaledTileID(t,this.wrap,t,i+1,r),new OverscaledTileID(t,this.wrap,t,i,r+1),new OverscaledTileID(t,this.wrap,t,i+1,r+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new OverscaledTileID(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new OverscaledTileID(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new UnwrappedTileID(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function Hl(e,t,i,r,n){const o=1<<Math.min(i,22);let a=o*(n%o)+r%o;return e&&i<22&&(a+=o*o*((e<0?-2*e-1:2*e)%(1<<2*(22-i)))),16*(32*a+i)+(t-i)}function $l(e,t){if(!t.isReprojectedInTileSpace)return{scale:1<<e.z,x:e.x,y:e.y,x2:e.x+1,y2:e.y+1,projection:t};const i=Math.pow(2,-e.z),r=e.x*i,n=(e.x+1)*i,o=e.y*i,a=(e.y+1)*i,s=Lt(r),l=Lt(n),u=Ft(o),c=Ft(a),h=t.project(s,u),d=t.project(l,u),p=t.project(l,c),f=t.project(s,c);let m=Math.min(h.x,d.x,p.x,f.x),_=Math.min(h.y,d.y,p.y,f.y),g=Math.max(h.x,d.x,p.x,f.x),y=Math.max(h.y,d.y,p.y,f.y);const x=i/16;function v(e,i,r,n,o,a){const s=(r+o)/2,l=(n+a)/2,u=t.project(Lt(s),Ft(l)),c=Math.max(0,m-u.x,_-u.y,u.x-g,u.y-y);m=Math.min(m,u.x),g=Math.max(g,u.x),_=Math.min(_,u.y),y=Math.max(y,u.y),c>x&&(v(e,u,r,n,s,l),v(u,i,s,l,o,a))}v(h,d,r,o,n,o),v(d,p,n,o,n,a),v(p,f,n,a,r,a),v(f,h,r,a,r,o),m-=x,_-=x,g+=x,y+=x;const b=1/Math.max(g-m,y-_);return{scale:b,x:m*b,y:_*b,x2:g*b,y2:y*b,projection:t}}rn(CanonicalTileID,"CanonicalTileID"),rn(OverscaledTileID,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});const Wl=r(new Float32Array(16));class Projection{constructor(e){this.spec=e,this.name=e.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(e,t){return{x:0,y:0,z:0}}unproject(e,t){return new LngLat(0,0)}projectTilePoint(e,t,i){return{x:e,y:t,z:0}}locationPoint(e,t,i,r=!0){return e._coordinatePoint(e.locationCoordinate(t,i),r)}pixelsPerMeter(e,t){return ca(1,e)*t}pixelSpaceConversion(e,t,i){return 1}farthestPixelDistance(e){return jl(e,e.pixelsPerMeter)}pointCoordinate(e,t,i,r){const n=e.horizonLineFromTop(!1),o=new K(t,Math.max(n,i));return e.rayIntersectionCoordinate(e.pointRayIntersection(o,r))}pointCoordinate3D(e,t,i){const r=new K(t,i);if(e.elevation)return e.elevation.pointCoordinate(r);{const t=this.pointCoordinate(e,r.x,r.y,0);return[t.x,t.y,t.z]}}isPointAboveHorizon(e,t){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,t.x,t.y);const i=e.horizonLineFromTop();return t.y<i}createInversionMatrix(e,t){return Wl}createTileMatrix(e,t,i){let n,o,l;const u=i.canonical,c=r(new Float64Array(16));if(this.isReprojectedInTileSpace){const r=$l(u,this);n=1,o=r.x+i.wrap*r.scale,l=r.y,s(c,c,[n/r.scale,n/r.scale,e.pixelsPerMeter/t])}else n=t/e.zoomScale(u.z),o=(u.x+Math.pow(2,u.z)*i.wrap)*n,l=u.y*n;return a(c,c,[o,l,0]),s(c,c,[n/Xt,n/Xt,1]),c}upVector(e,t,i){return[0,0,1]}upVectorScale(e,t,i){return{metersToTile:1}}}class Albers extends Projection{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];const[t,i]=this.parallels=e.parallels||[29.5,45.5],r=Math.sin(ye(t));this.n=(r+Math.sin(ye(i)))/2,this.c=1+r*(2*this.n-r),this.r0=Math.sqrt(this.c)/this.n}project(e,t){const{n:i,c:r,r0:n}=this,o=ye(e-this.center[0]),a=ye(t),s=Math.sqrt(r-2*i*Math.sin(a))/i;return{x:s*Math.sin(o*i),y:s*Math.cos(o*i)-n,z:0}}unproject(e,t){const{n:i,c:r,r0:n}=this,o=n+t;let a=Math.atan2(e,Math.abs(o))*Math.sign(o);o*i<0&&(a-=Math.PI*Math.sign(e)*Math.sign(o));const s=ye(this.center[0])*i;a=we(a,-Math.PI-s,Math.PI-s);const l=ve(xe(a/i)+this.center[0],-180,180),u=Math.asin(ve((r-(e*e+o*o)*i*i)/(2*i),-1,1)),c=ve(xe(u),-85.051129,ha);return new LngLat(l,c)}}const Xl=1.340264,ql=-.081106,Zl=893e-6,Yl=.003796,Jl=Math.sqrt(3)/2;class EqualEarth extends Projection{project(e,t){t=t/180*Math.PI,e=e/180*Math.PI;const i=Math.asin(Jl*Math.sin(t)),r=i*i,n=r*r*r;return{x:.5*(e*Math.cos(i)/(Jl*(Xl+3*ql*r+n*(7*Zl+9*Yl*r)))/Math.PI+.5),y:1-.5*(i*(Xl+ql*r+n*(Zl+Yl*r))/Math.PI+1),z:0}}unproject(e,t){e=(2*e-.5)*Math.PI;let i=t=(2*(1-t)-1)*Math.PI,r=i*i,n=r*r*r;for(let e,o,a,s=0;s<12&&(o=i*(Xl+ql*r+n*(Zl+Yl*r))-t,a=Xl+3*ql*r+n*(7*Zl+9*Yl*r),e=o/a,i=ve(i-e,-Math.PI/3,Math.PI/3),r=i*i,n=r*r*r,!(Math.abs(e)<1e-12));++s);const o=Jl*e*(Xl+3*ql*r+n*(7*Zl+9*Yl*r))/Math.cos(i),a=Math.asin(Math.sin(i)/Jl),s=ve(180*o/Math.PI,-180,180),l=ve(180*a/Math.PI,-85.051129,ha);return new LngLat(s,l)}}class Equirectangular extends Projection{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0}project(e,t){return{x:.5+e/360,y:.5-t/360,z:0}}unproject(e,t){const i=360*(e-.5),r=ve(360*(.5-t),-85.051129,ha);return new LngLat(i,r)}}const Kl=Math.PI/2;function Ql(e){return Math.tan((Kl+e)/2)}class LambertConformalConic extends Projection{constructor(e){super(e),this.center=e.center||[0,30];const[t,i]=this.parallels=e.parallels||[30,30];let r=ye(t),n=ye(i);this.southernCenter=r+n<0,this.southernCenter&&(r=-r,n=-n);const o=Math.cos(r),a=Ql(r);this.n=r===n?Math.sin(r):Math.log(o/Math.cos(n))/Math.log(Ql(n)/a),this.f=o*Math.pow(Ql(r),this.n)/this.n}project(e,t){t=ye(t),this.southernCenter&&(t=-t),e=ye(e-this.center[0]);const i=1e-6,{n:r,f:n}=this;n>0?t<-Kl+i&&(t=-Kl+i):t>Kl-i&&(t=Kl-i);const o=n/Math.pow(Ql(t),r);let a=o*Math.sin(r*e),s=n-o*Math.cos(r*e);return a=.5*(a/Math.PI+.5),s=.5*(s/Math.PI+.5),{x:a,y:this.southernCenter?s:1-s,z:0}}unproject(e,t){e=(2*e-.5)*Math.PI,this.southernCenter&&(t=1-t),t=(2*(1-t)-.5)*Math.PI;const{n:i,f:r}=this,n=r-t,o=Math.sign(n),a=Math.sign(i)*Math.sqrt(e*e+n*n);let s=Math.atan2(e,Math.abs(n))*o;n*i<0&&(s-=Math.PI*Math.sign(e)*o);const l=ve(xe(s/i)+this.center[0],-180,180),u=ve(xe(2*Math.atan(Math.pow(r/a,1/i))-Kl),-85.051129,ha);return new LngLat(l,this.southernCenter?-u:u)}}class Mercator extends Projection{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(e,t){return{x:Ct(e),y:Rt(t),z:0}}unproject(e,t){const i=Lt(e),r=Ft(t);return new LngLat(i,r)}}const eu=ye(ha);class NaturalEarth extends Projection{project(e,t){const i=(t=ye(t))*t,r=i*i;return{x:.5*((e=ye(e))*(.8707-.131979*i+r*(r*(.003971*i-.001529*r)-.013791))/Math.PI+.5),y:1-.5*(t*(1.007226+i*(.015085+r*(.028874*i-.044475-.005916*r)))/Math.PI+1),z:0}}unproject(e,t){e=(2*e-.5)*Math.PI;let i=t=(2*(1-t)-1)*Math.PI,r=25,n=0,o=i*i;do{o=i*i;const e=o*o;n=(i*(1.007226+o*(.015085+e*(.028874*o-.044475-.005916*e)))-t)/(1.007226+o*(.045255+e*(.259866*o-.311325-.005916*11*e))),i=ve(i-n,-eu,eu)}while(Math.abs(n)>1e-6&&--r>0);o=i*i;const a=ve(xe(e/(.8707+o*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979))),-180,180),s=xe(i);return new LngLat(a,s)}}const tu=ye(ha);class WinkelTripel extends Projection{project(e,t){t=ye(t),e=ye(e);const i=Math.cos(t),r=2/Math.PI,n=Math.acos(i*Math.cos(e/2)),o=Math.sin(n)/n,a=.5*(e*r+2*i*Math.sin(e/2)/o)||0,s=.5*(t+Math.sin(t)/o)||0;return{x:.5*(a/Math.PI+.5),y:1-.5*(s/Math.PI+1),z:0}}unproject(e,t){let i=e=(2*e-.5)*Math.PI,r=t=(2*(1-t)-1)*Math.PI,n=25;const o=1e-6;let a=0,s=0;do{const n=Math.cos(r),o=Math.sin(r),l=2*o*n,u=o*o,c=n*n,h=Math.cos(i/2),d=Math.sin(i/2),p=2*h*d,f=d*d,m=1-c*h*h,_=m?1/m:0,g=m?Math.acos(n*h)*Math.sqrt(1/m):0,y=.5*(2*g*n*d+2*i/Math.PI)-e,x=.5*(g*o+r)-t,v=.5*_*(c*f+g*n*h*u)+1/Math.PI,b=_*(p*l/4-g*o*d),w=.125*_*(l*d-g*o*c*p),A=.5*_*(u*h+g*f*n)+.5,E=b*w-A*v;a=(x*b-y*A)/E,s=(y*w-x*v)/E,i=ve(i-a,-Math.PI,Math.PI),r=ve(r-s,-tu,tu)}while((Math.abs(a)>o||Math.abs(s)>o)&&--n>0);return new LngLat(xe(i),xe(r))}}class CylindricalEqualArea extends Projection{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(ye(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,t){const{scale:i,cosPhi:r}=this;return{x:ye(e)*r*i+.5,y:-Math.sin(ye(t))/r*i+.5,z:0}}unproject(e,t){const{scale:i,cosPhi:r}=this,n=-(t-.5)/i,o=ve(xe((e-.5)/i)/r,-180,180),a=Math.asin(ve(n*r,-1,1)),s=ve(xe(a),-85.051129,ha);return new LngLat(o,s)}}class Globe extends Mercator{constructor(e){super(e),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(e,t,i){const r=Ol(e,t,i);return T(r,r,Nl(Fl(i))),{x:r[0],y:r[1],z:r[2]}}locationPoint(e,t,i){const n=aa(t.lat,t.lng),a=E([],n),s=i?e._centerAltitude+i:e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(t),e._centerAltitude):e._centerAltitude;v(n,n,a,ca(1,0)*Xt*s);const l=r(new Float64Array(16));return o(l,e.pixelMatrix,e.globeMatrix),T(n,n,l),new K(n[0],n[1])}pixelsPerMeter(e,t){return ca(1,0)*t}pixelSpaceConversion(e,t,i){const r=ca(1,e)*t,n=rt(ca(1,45)*t,r,i);return this.pixelsPerMeter(e,t)/n}createTileMatrix(e,t,i){const r=function(e){const t=1/Vl(e);return function(e,t){e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1}(kl,e.min),s(kl,kl,[t,t,t])}(Fl(i.canonical));return o(new Float64Array(16),e.globeMatrix,r)}createInversionMatrix(e,t){const{center:i}=e,r=Nl(Fl(t));return u(r,r,ye(i.lng)),l(r,r,ye(i.lat)),s(r,r,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(r)}pointCoordinate(e,t,i,r){return Ll(e,t,i,!0)||new MercatorCoordinate(0,0)}pointCoordinate3D(e,t,i){const r=this.pointCoordinate(e,t,i,0);return[r.x,r.y,r.z]}isPointAboveHorizon(e,t){return!Ll(e,t.x,t.y,!1)}farthestPixelDistance(e){const t=function(e,t){const i=e.cameraToCenterDistance,r=e._centerAltitude*t,n=e._camera,o=e._camera.forward(),a=m([],x([],o,-i),[0,0,r]),s=e.worldSize/(2*Math.PI),l=[0,0,-s],u=e.width/e.height,c=Math.tan(e.fovAboveCenter),h=x([],n.up(),c),p=x([],n.right(),c*u),f=E([],m([],m([],o,h),p)),_=[];let g;if(new Ray(a,f).closestPointOnSphere(l,s,_)){const t=m([],_,l),i=R([],t,a);g=Math.cos(e.fovAboveCenter)*d(i)}else{const e=R([],a,l),t=R([],l,a);E(t,t);const i=d(e)-s;g=Math.sqrt(i*(i+2*s));const r=Math.acos(g/(s+i))-Math.acos(I(o,t));g*=Math.cos(r)}return 1.01*g}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),i=Gl(e.zoom);if(i>0){const r=jl(e,ca(1,e.center.lat)*e.worldSize),n=e.worldSize/(2*Math.PI),o=Math.max(e.width,e.height)/e.worldSize*Math.PI;return rt(t,r+n*(1-Math.cos(o)),Math.pow(i,10))}return t}upVector(e,t,i){return Ol(t,i,e,1)}upVectorScale(e){return{metersToTile:(t=Vl(Fl(e)),t*ia/sa)};var t}}function iu(e){const t=e.parallels,i=!!t&&Math.abs(t[0]+t[1])<.01;switch(e.name){case"mercator":return new Mercator(e);case"equirectangular":return new Equirectangular(e);case"naturalEarth":return new NaturalEarth(e);case"equalEarth":return new EqualEarth(e);case"winkelTripel":return new WinkelTripel(e);case"albers":return i?new CylindricalEqualArea(e):new Albers(e);case"lambertConformalConic":return i?new CylindricalEqualArea(e):new LambertConformalConic(e);case"globe":return new Globe(e)}throw new Error(`Invalid projection name: ${e.name}`)}const ru=Number.MAX_SAFE_INTEGER;function nu(e,t,i,r){return e.order<t||e.order===ru||!(e.clipMask&i)||function(e,t){if(0===t.length)return!1;let i=e;for(;""!==i;){if(t.includes(i))return!1;i=yo(i)}return!0}(r,e.clipScope)}function ou(e,t){return e.x-t.x||e.y-t.y}function au(e,t){return 0===ou(e.min,t.min)&&0===ou(e.max,t.max)}function su(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(e[i].sourceId!==t[i].sourceId||!au(e[i],t[i])||e[i].order!==t[i].order||e[i].clipMask!==t[i].clipMask||!Q(e[i].clipScope,t[i].clipScope))return!1;return!0}function lu(e,t,i,r,n,o,a){const s=e.indices,l=e.vertices,u=[];for(let c=r;c<r+n;c+=3){const r=t[i[c+0]+o],n=t[i[c+1]+o],h=t[i[c+2]+o],d=Math.min(r.x,n.x,h.x),p=Math.max(r.x,n.x,h.x),f=Math.min(r.y,n.y,h.y),m=Math.max(r.y,n.y,h.y);u.length=0,e.grid.query(new K(d,f),new K(p,m),u);for(let e=0;e<u.length;e++){const t=u[e];if(ys(l[s[3*t+0]],l[s[3*t+1]],l[s[3*t+2]],r,n,h,a))return!0}}return!1}function uu(e,t,i,r){const n=Math.pow(2,r.z-i.z);return new K((e+i.x*Xt)*n-r.x*Xt,(t+i.y*Xt)*n-r.y*Xt)}function cu(e,t){const i=[];t.grid.queryPoint(e,i);const r=t.indices,n=t.vertices;for(let t=0;t<i.length;t++){const o=i[t];if(ms([n[r[3*o+0]],n[r[3*o+1]],n[r[3*o+2]]],e))return!0}return!1}class Elevation{isDataAvailableAtPoint(e){const t=this._source();if(this.isUsingMockSource()||!t||e.y<0||e.y>1)return!1;const i=t.getSource().maxzoom,r=1<<i,n=Math.floor(e.x),o=Math.floor((e.x-n)*r),a=Math.floor(e.y*r),s=this.findDEMTileFor(new OverscaledTileID(i,n,i,o,a));return!(!s||!s.dem)}getAtPointOrZero(e,t=0){return this.getAtPoint(e,t)||0}getAtPoint(e,t,i=!0){if(this.isUsingMockSource())return null;t??=null;const r=this._source();if(!r)return t;if(e.y<0||e.y>1)return t;const n=r.getSource().maxzoom,o=1<<n,a=Math.floor(e.x),s=e.x-a,l=new OverscaledTileID(n,a,n,Math.floor(s*o),Math.floor(e.y*o)),u=this.findDEMTileFor(l);if(!u||!u.dem)return t;const c=u.dem,h=1<<u.tileID.canonical.z,d=(s*h-u.tileID.canonical.x)*c.dim,p=(e.y*h-u.tileID.canonical.y)*c.dim,f=Math.floor(d),m=Math.floor(p);return(i?this.exaggeration():1)*rt(rt(c.get(f,m),c.get(f,m+1),p-m),rt(c.get(f+1,m),c.get(f+1,m+1),p-m),d-f)}static getAtTileOffset(e,t,i,r){const n=1<<e.canonical.z;return r?r.pointElevation(t):i?i.getAtPointOrZero(new MercatorCoordinate(e.wrap+(e.canonical.x+t.x/Xt)/n,(e.canonical.y+t.y/Xt)/n)):0}static getAtTileOffsetFunc(e,t,i,r){return(n,o,a)=>{const s=this.getAtTileOffset(e,n,o,a),l=r.upVector(e.canonical,n.x,n.y);return x(l,l,s*r.upVectorScale(e.canonical,t,i).metersToTile),l}}getForTilePoints(e,t,i,r){if(this.isUsingMockSource())return!1;const n=DEMSampler.create(this,e,r);return!!n&&(t.forEach(e=>{e[2]=this.exaggeration()*n.getElevationAt(e[0],e[1],i,!0)}),!0)}getMinMaxForTile(e){if(this.isUsingMockSource())return null;const t=this.findDEMTileFor(e);if(!t||!t.dem)return null;const i=t.dem.tree,r=t.tileID,n=1<<e.canonical.z-r.canonical.z;let o=e.canonical.x/n-r.canonical.x,a=e.canonical.y/n-r.canonical.y,s=0;for(let t=0;t<e.canonical.z-r.canonical.z&&!i.leaves[s];t++){o*=2,a*=2;const e=2*Math.floor(a)+Math.floor(o);s=i.childOffsets[s]+e,o%=1,a%=1}return{min:this.exaggeration()*i.minimums[s],max:this.exaggeration()*i.maximums[s]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(e,t,i){throw new Error("Pure virtual method called.")}pointCoordinate(e){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(e){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){const e=this.visibleDemTiles;if(0===e.length)return null;let t=!1,i=Number.MAX_VALUE,r=Number.MIN_VALUE;for(const n of e){const e=this.getMinMaxForTile(n.tileID);e&&(i=Math.min(i,e.min),r=Math.max(r,e.max),t=!0)}return t?{min:i,max:r}:null}}class DEMSampler{constructor(e,t,i){this._demTile=e,this._dem=this._demTile.dem,this._scale=t,this._offset=i}static create(e,t,i){const r=i||e.findDEMTileFor(t);if(!r||!r.dem)return;const n=r.dem,o=r.tileID,a=1<<t.canonical.z-o.canonical.z;return new DEMSampler(r,n.dim/Xt/a,[(t.canonical.x/a-o.canonical.x)*n.dim,(t.canonical.y/a-o.canonical.y)*n.dim])}tileCoordToPixel(e,t){const i=t*this._scale+this._offset[1];return new K(Math.floor(e*this._scale+this._offset[0]),Math.floor(i))}getElevationAt(e,t,i,r){const n=e*this._scale+this._offset[0],o=t*this._scale+this._offset[1],a=Math.floor(n),s=Math.floor(o),l=this._dem;return r=!!r,i?rt(rt(l.get(a,s,r),l.get(a,s+1,r),o-s),rt(l.get(a+1,s,r),l.get(a+1,s+1,r),o-s),n-a):l.get(a,s,r)}getElevationAtPixel(e,t,i){return this._dem.get(e,t,!!i)}getMeterToDEM(e){return(1<<this._demTile.tileID.canonical.z)*ca(1,e)*this._dem.stride}}function hu(e,t,i,r){return t.name===r?i.calculateProjMatrix(e.toUnwrapped()):function(e,t,i){const r=t.createTileMatrix(e,e.worldSize,i.toUnwrapped());return o(new Float32Array(16),e.projMatrix,r)}(i,t,e)}const du=4294967296,pu=1/du,fu="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");class PbfReader{constructor(e){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.type=0,this._valueStart=-1,this.length=this.buf.length}readFields(e,t,i=this.length){let r;for(;r=this.nextField(i);)e(r,t,this);return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*du;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*du;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const t=this.buf,i=t[this.pos++];if(i<128)return i;let r,n=127&i;return r=t[this.pos++],n|=(127&r)<<7,r<128?n:(r=t[this.pos++],n|=(127&r)<<14,r<128?n:(r=t[this.pos++],n|=(127&r)<<21,r<128?n:(r=t[this.pos],n|=(15&r)<<28,function(e,t,i){const r=i.buf;let n,o;if(o=r[i.pos++],n=(112&o)>>4,o<128)return mu(e,n,t);if(o=r[i.pos++],n|=(127&o)<<3,o<128)return mu(e,n,t);if(o=r[i.pos++],n|=(127&o)<<10,o<128)return mu(e,n,t);if(o=r[i.pos++],n|=(127&o)<<17,o<128)return mu(e,n,t);if(o=r[i.pos++],n|=(127&o)<<24,o<128)return mu(e,n,t);if(o=r[i.pos++],n|=(1&o)<<31,o<128)return mu(e,n,t);throw new Error("Expected varint not more than 10 bytes")}(n,e,this))))}readSVarint(){const e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return Boolean(this.readVarint())}readString(){const e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&fu?fu.decode(this.buf.subarray(t,e)):function(e,t,i){let r="",n=t;for(;n<i;){const t=e[n];let o,a,s,l=null,u=t>239?4:t>223?3:t>191?2:1;if(n+u>i)break;1===u?t<128&&(l=t):2===u?(o=e[n+1],128==(192&o)&&(l=(31&t)<<6|63&o,l<=127&&(l=null))):3===u?(o=e[n+1],a=e[n+2],128==(192&o)&&128==(192&a)&&(l=(15&t)<<12|(63&o)<<6|63&a,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===u&&(o=e[n+1],a=e[n+2],s=e[n+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(l=(15&t)<<18|(63&o)<<12|(63&a)<<6|63&s,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,u=1):l>65535&&(l-=65536,r+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),r+=String.fromCharCode(l),n+=u}return r}(this.buf,t,e)}readBytes(){const e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}nextField(e=this.length){if(this.pos===this._valueStart&&this.skip(this.type),this.pos>=e)return 0;const t=this.readVarint();return this.type=7&t,this._valueStart=this.pos,t>>>3}skip(e){const t=7&e;if(0===t)for(;this.buf[this.pos++]>127;);else if(2===t)this.pos=this.readVarint()+this.pos;else if(5===t)this.pos+=4;else{if(1!==t)throw new Error(`Unimplemented type: ${t}`);this.pos+=8}}}class PbfWriter{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.length=this.buf.length}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){const e=new Uint8Array(t);e.set(this.buf),this.buf=e,this.dataView=new DataView(e.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*pu),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*pu),!0),this.pos+=8}writeVarint(e){if((e=+e||0)>=0&&e<128)return this.pos>=this.length&&this.realloc(1),void(this.buf[this.pos++]=e);e>268435455||e<0?function(e,t){let i,r;if(e>=0?(i=e%4294967296|0,r=e/4294967296|0):(i=~(-e%4294967296),r=~(-e/4294967296),4294967295^i?i=i+1|0:(i=0,r=r+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn
2\
vendor: 31,331 bytes, line 2
2't fit into 10 bytes");t.realloc(10),function(e,t,i){i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,i.buf[i.pos]=127&(e>>>=7)}(i,0,t),function(e,t){const i=(7&e)<<4;t.buf[t.pos++]|=i|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(r,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))}writeSVarint(e){this.writeVarint(e<0?2*-e-1:2*e)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(4*e.length),this.pos++;const t=this.pos;this.pos=function(e,t,i){for(let r,n,o=0;o<t.length;o++){if(r=t.charCodeAt(o),r>55295&&r<57344){if(!n){r>56319||o+1===t.length?(e[i++]=239,e[i++]=191,e[i++]=189):n=r;continue}if(r<56320){e[i++]=239,e[i++]=191,e[i++]=189,n=r;continue}r=n-55296<<10|r-56320|65536,n=null}else n&&(e[i++]=239,e[i++]=191,e[i++]=189,n=null);r<128?e[i++]=r:(r<2048?e[i++]=r>>6|192:(r<65536?e[i++]=r>>12|224:(e[i++]=r>>18|240,e[i++]=r>>12&63|128),e[i++]=r>>6&63|128),e[i++]=63&r|128)}return i}(this.buf,e,this.pos);const i=this.pos-t;i>=128&&_u(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const t=e.length;this.writeVarint(t),this.realloc(t),this.buf.set(e,this.pos),this.pos+=t}writeRawMessage(e,t){this.pos++;const i=this.pos;e(t,this);const r=this.pos-i;r>=128&&_u(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r}writeMessage(e,t,i){this.writeTag(e,2),this.writeRawMessage(t,i)}writePackedVarint(e,t){t.length&&this.writeMessage(e,gu,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,yu,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,bu,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,xu,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,vu,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,wu,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,Au,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,Eu,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,Iu,t)}writeBytesField(e,t){this.writeTag(e,2),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,5),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,5),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,1),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,1),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,0),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,0),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,2),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,5),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,1),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}}function mu(e,t,i){return i?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function _u(e,t,i){const r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));i.realloc(r),i.buf.copyWithin(e+r,e,i.pos)}function gu(e,t){const i=e.length;let r=t.buf,n=t.pos,o=t.length;for(let a=0;a<i;a++){let i=e[a];if(i<0||n+10>o)t.pos=n,t.writeVarint(i),r=t.buf,n=t.pos,o=t.length;else{for(;i>127;)r[n++]=i%128|128,i=Math.floor(i/128);r[n++]=i}}t.pos=n}function yu(e,t){for(let i=0;i<e.length;i++)t.writeSVarint(e[i])}function xu(e,t){for(let i=0;i<e.length;i++)t.writeFloat(e[i])}function vu(e,t){for(let i=0;i<e.length;i++)t.writeDouble(e[i])}function bu(e,t){for(let i=0;i<e.length;i++)t.writeBoolean(e[i])}function wu(e,t){for(let i=0;i<e.length;i++)t.writeFixed32(e[i])}function Au(e,t){for(let i=0;i<e.length;i++)t.writeSFixed32(e[i])}function Eu(e,t){for(let i=0;i<e.length;i++)t.writeFixed64(e[i])}function Iu(e,t){for(let i=0;i<e.length;i++)t.writeSFixed64(e[i])}function Su(e){let t=0,i=0;for(const r of e)t+=r.w*r.h,i=Math.max(i,r.w);e.sort((e,t)=>t.h-e.h);const r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),i),h:1/0}];let n=0,o=0;for(const t of e)for(let e=r.length-1;e>=0;e--){const i=r[e];if(!(t.w>i.w||t.h>i.h)){if(t.x=i.x,t.y=i.y,o=Math.max(o,t.y+t.h),n=Math.max(n,t.x+t.w),t.w===i.w&&t.h===i.h){const t=r.pop();t&&e<r.length&&(r[e]=t)}else t.h===i.h?(i.x+=t.w,i.w-=t.w):t.w===i.w?(i.y+=t.h,i.h-=t.h):(r.push({x:i.x+t.w,y:i.y,w:i.w-t.w,h:t.h}),i.y+=t.h,i.h-=t.h);break}}return{w:n,h:o,fill:t/(n*o)||0}}function Du(e,t){return e.id<t.id?-1:e.id>t.id?1:e.version<t.version?-1:e.version>t.version?1:e.sx<t.sx?-1:e.sx>t.sx?1:e.sy<t.sy?-1:e.sy>t.sy?1:0}function Pu(e){let t=0;for(let i=0;i<e.length;i++)t=(t<<5)-t+e.charCodeAt(i),t&=t;return t}function Tu(e,t){return(e<<5)-e+t}function zu(e,t,i,r){for(const[n]of e.entries()){const e=r&&r.get(n)||ImageVariant.parse(n),o=e.id.toString(),a=t.get(o)||0;i.push({id:n,version:a,sx:e.sx,sy:e.sy})}}class AtlasContentDescriptor{constructor(e,t,i,r,n="",o){this.scope=n,this.iconDescriptors=[],this.patternDescriptors=[],this.requiresMipMaps=t.size>0,zu(e,i,this.iconDescriptors,o),zu(t,i,this.patternDescriptors,o),this.iconDescriptors.sort(Du),this.patternDescriptors.sort(Du);let a=0;a=Tu(a,Pu(n)),a=Tu(a,1);const s=r?r.data:"";s&&(a=Tu(a,Pu(s))),a=Tu(a,1);for(const e of this.iconDescriptors)a=Tu(a,Pu(e.id)),a=Tu(a,e.version),a=Tu(a,e.sx),a=Tu(a,e.sy);a=Tu(a,1);for(const e of this.patternDescriptors)a=Tu(a,Pu(e.id)),a=Tu(a,e.version),a=Tu(a,e.sx),a=Tu(a,e.sy);this.hash=a}subsetOf(e){return this.scope===e.scope&&this.isSubsetArray(this.iconDescriptors,e.iconDescriptors,Du)&&this.isSubsetArray(this.patternDescriptors,e.patternDescriptors,Du)}isSubsetArray(e,t,i){let r=0,n=0;if(e.length>t.length)return!1;for(;r<e.length&&n<t.length;){const o=i(e[r],t[n]);if(0===o)r++,n++;else{if(o<0)return!1;n++}}return r===e.length}}function Mu(e){switch(e){case WebGL2RenderingContext.RGBA8:case WebGL2RenderingContext.RGBA16F: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 Cu(e){switch(e){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.RGBA16F:return WebGL2RenderingContext.HALF_FLOAT;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}}rn(AtlasContentDescriptor,"AtlasContentDescriptor");class Texture{constructor(e,t,i,r){this.context=e,this.format=i,this.useMipmap=r&&r.useMipmap,this.texture=e.gl.createTexture(),this.update(t,{premultiply:r&&r.premultiply})}update(e,t){const i=e&&e instanceof HTMLVideoElement&&0===e.width?e.videoWidth:e.width,r=e&&e instanceof HTMLVideoElement&&0===e.height?e.videoHeight:e.height,{context:n}=this,{gl:o}=n,{x:a,y:s}=t&&t.position?t.position:{x:0,y:0},l=a+i,u=s+r;this.size&&(this.size[0]!==l||this.size[1]!==u)&&(!t||void 0===t.recreateWhenResize||t.recreateWhenResize)&&(o.bindTexture(o.TEXTURE_2D,null),o.deleteTexture(this.texture),this.texture=o.createTexture(),this.size=null),o.bindTexture(o.TEXTURE_2D,this.texture),n.pixelStoreUnpackFlipY.set(!1),n.pixelStoreUnpack.set(1),n.pixelStoreUnpackPremultiplyAlpha.set(this.format===o.RGBA8&&(!t||!1!==t.premultiply));const c=e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap;if(!this.size&&l>0&&u>0){const e=this.useMipmap?Math.floor(Math.log2(Math.max(l,u)))+1:1;o.texStorage2D(o.TEXTURE_2D,e,this.format,l,u),this.size=[l,u]}this.size&&(c?o.texSubImage2D(o.TEXTURE_2D,0,a,s,Mu(this.format),Cu(this.format),e):"data"in e&&e.data&&o.texSubImage2D(o.TEXTURE_2D,0,a,s,i,r,Mu(this.format),Cu(this.format),e.data)),this.useMipmap&&o.generateMipmap(o.TEXTURE_2D)}bind(e,t,i=!1){const{context:r}=this,{gl:n}=r;n.bindTexture(n.TEXTURE_2D,this.texture),e!==this.minFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,this.useMipmap&&!i?e===n.NEAREST?n.NEAREST_MIPMAP_NEAREST:n.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),t!==this.wrapS&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,t),this.wrapS=t)}bindExtraParam(e,t,i,r,n){const{context:o}=this,{gl:a}=o;a.bindTexture(a.TEXTURE_2D,this.texture),t!==this.magFilter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,t),this.magFilter=t),e!==this.minFilter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,this.useMipmap?e===a.NEAREST?a.NEAREST_MIPMAP_NEAREST:a.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),i!==this.wrapS&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,i),this.wrapS=i),r!==this.wrapT&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,r),this.wrapT=r),n!==this.compareMode&&(n?(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_COMPARE_MODE,a.COMPARE_REF_TO_TEXTURE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_COMPARE_FUNC,n)):a.texParameteri(a.TEXTURE_2D,a.TEXTURE_COMPARE_MODE,a.NONE),this.compareMode=n)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class ImagePosition{static getImagePositionScale(e,t,i){if(t&&e){const{sx:t,sy:i}=e;return{x:t,y:i}}return{x:i,y:i}}constructor(e,t,i,r){this.paddedRect=e;const{pixelRatio:n,version:o,stretchX:a,stretchY:s,content:l,sdf:u,usvg:c}=t;this.pixelRatio=n,this.stretchX=a,this.stretchY=s,this.content=l,this.version=o,this.padding=i,this.sdf=u,this.usvg=c,this.scale=ImagePosition.getImagePositionScale(r,c,n)}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 Ru(e,t,i){const r=ImageVariant.parse(e),n=function(e,t,i=[1,1]){return{x:0,y:0,w:(e.data?e.data.width:e.width*i[0])+2*t,h:(e.data?e.data.height:e.height*i[1])+2*t}}(t,i,[r.sx,r.sy]);return{bin:n,imagePosition:new ImagePosition(n,t,i,r),imageVariant:r}}function Lu(e,t){const i=[];for(const[r,n]of e.entries()){const e=ImageVariant.parse(r);e&&(i.push({key:r,value:n,variant:e}),t&&t.set(r,e))}i.sort((e,t)=>{const i=e.variant.id.toString().localeCompare(t.variant.id.toString());return 0!==i?i:e.variant.sx!==t.variant.sx?e.variant.sx-t.variant.sx:e.variant.sy!==t.variant.sy?e.variant.sy-t.variant.sy:e.key.localeCompare(t.key)});const r=new Map;for(const e of i)r.set(e.key,e.value);return r}class ImageAtlasReference{constructor(e){this.sourceAtlasHash=e}}class ImageAtlas{constructor(e,t,i,r,n=""){const o=new Map,a=new Map;this.haveRenderCallbacks=[];const s=[],l=void 0!==r,u=l?new Map:void 0,c=l?Lu(e,u):e,h=l?Lu(t,u):t;this.addImages(c,o,1,s),this.addImages(h,a,2,s);const{w:d,h:p}=Su(s),f=new RGBAImage({width:d||1,height:p||1});for(const[e,t]of c.entries()){const i=o.get(e).paddedRect;RGBAImage.copy(t.data,f,{x:0,y:0},{x:i.x+1,y:i.y+1},t.data,null,t.sdf)}for(const[e,t]of h.entries()){const r=a.get(e),n=r.paddedRect;let o=r.padding;const s=n.x+o,l=n.y+o,u=t.data.width,c=t.data.height;o=o>1?o-1:o,RGBAImage.copy(t.data,f,{x:0,y:0},{x:s,y:l},t.data,i),RGBAImage.copy(t.data,f,{x:0,y:c-o},{x:s,y:l-o},{width:u,height:o},i),RGBAImage.copy(t.data,f,{x:0,y:0},{x:s,y:l+c},{width:u,height:o},i),RGBAImage.copy(t.data,f,{x:u-o,y:0},{x:s-o,y:l},{width:o,height:c},i),RGBAImage.copy(t.data,f,{x:0,y:0},{x:s+u,y:l},{width:o,height:c},i),RGBAImage.copy(t.data,f,{x:u-o,y:c-o},{x:s-o,y:l-o},{width:o,height:o},i),RGBAImage.copy(t.data,f,{x:0,y:c-o},{x:s+u,y:l-o},{width:o,height:o},i),RGBAImage.copy(t.data,f,{x:0,y:0},{x:s+u,y:l+c},{width:o,height:o},i),RGBAImage.copy(t.data,f,{x:u-o,y:0},{x:s-o,y:l+c},{width:o,height:o},i)}this.lut=i,this.image=f,this.iconPositions=o,this.patternPositions=a,l&&(this.contentDescriptor=new AtlasContentDescriptor(c,h,r,i,n,u))}addImages(e,t,i,r){for(const[n,o]of e.entries()){const{bin:e,imagePosition:a,imageVariant:s}=Ru(n,o,i);t.set(n,a),r.push(e),o.hasRenderCallback&&this.haveRenderCallbacks.push(s.id)}}patchUpdatedImages(e,t,i,r){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(t=>e.hasImage(t,i)),e.dispatchRenderCallbacks(this.haveRenderCallbacks,i);for(const n of e.getUpdatedImages(i)){for(const r of this.iconPositions.keys()){const o=ImageVariant.parse(r);if(ImageId.isEqual(o.id,n)){const o=e.getImage(n,i);this.patchUpdatedImage(this.iconPositions.get(r),o,t,null)}}for(const o of this.patternPositions.keys()){const a=ImageVariant.parse(o);if(ImageId.isEqual(a.id,n)){const a=e.getImage(n,i);this.patchUpdatedImage(this.patternPositions.get(o),a,t,r||this.lut)}}}}patchUpdatedImage(e,t,i,r=null){if(!e||!t)return;if(e.version===t.version)return;e.version=t.version;const[n,o]=e.tl,a=e.sdf;if(this.lut||a){const e={width:t.data.width,height:t.data.height},s=new RGBAImage(e);RGBAImage.copy(t.data,s,{x:0,y:0},{x:0,y:0},e,r,a),i.update(s,{position:{x:n,y:o},recreateWhenResize:!1})}else i.update(t.data,{position:{x:n,y:o},recreateWhenResize:!1})}}rn(ImagePosition,"ImagePosition"),rn(ImageAtlas,"ImageAtlas",{omit:["lut"]}),rn(ImageAtlasReference,"ImageAtlasReference");const Fu=new Float64Array(256);for(let e=0;e<256;e++){const t=.5-Math.pow(e/255,1/2.2);Fu[e]=t*Math.abs(t)}function Bu(e,t){return e+t[1]-t[0]}function Ou(e,t,i,r,n=1){const o=[],a=e.imagePrimary,s=a.pixelRatio,l=a.paddedRect.w-2,u=a.paddedRect.h-2,c=(e.right-e.left)*n,h=(e.bottom-e.top)*n,d=a.stretchX||[[0,l]],p=a.stretchY||[[0,u]],f=d.reduce(Bu,0),m=p.reduce(Bu,0),_=l-f,g=u-m;let y=0,x=f,v=0,b=m,w=0,A=_,E=0,I=g;if(a.content&&r){const e=a.content;y=ku(d,0,e[0]),v=ku(p,0,e[1]),x=ku(d,e[0],e[2]),b=ku(p,e[1],e[3]),w=e[0]-y,E=e[1]-v,A=e[2]-e[0]-x,I=e[3]-e[1]-b}const D=(r,o,l,u)=>{const d=Gu(r.stretch-y,x,c,e.left*n),p=ju(r.fixed-w,A,r.stretch,f),_=Gu(o.stretch-v,b,h,e.top*n),g=ju(o.fixed-E,I,o.stretch,m),D=Gu(l.stretch-y,x,c,e.left*n),P=ju(l.fixed-w,A,l.stretch,f),T=Gu(u.stretch-v,b,h,e.top*n),z=ju(u.fixed-E,I,u.stretch,m),M=new K(d,_),C=new K(D,_),R=new K(D,T),L=new K(d,T),F=new K(p/s,g/s),B=new K(P/s,z/s),O=t*Math.PI/180;if(O){const e=Math.sin(O),t=Math.cos(O),i=[t,-e,e,t];M._matMult(i),C._matMult(i),L._matMult(i),R._matMult(i)}const V=r.stretch+r.fixed,k=l.stretch+l.fixed,N=o.stretch+o.fixed,U=u.stretch+u.fixed,G=e.imageSecondary;return{tl:M,tr:C,bl:L,br:R,texPrimary:{x:a.paddedRect.x+1+V,y:a.paddedRect.y+1+N,w:k-V,h:U-N},texSecondary:G?{x:G.paddedRect.x+1+V,y:G.paddedRect.y+1+N,w:k-V,h:U-N}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:F,pixelOffsetBR:B,minFontScaleX:A/s/c,minFontScaleY:I/s/h,isSDF:i}};if(a.stretchX||a.stretchY){const e=Nu(d,_,f),t=Nu(p,g,m);for(let i=0;i<e.length-1;i++){const r=e[i],n=e[i+1];for(let e=0;e<t.length-1;e++)o.push(D(r,t[e],n,t[e+1]))}}else o.push(D({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:u+1}));return o}function Vu(e,t){const i=e.stretchY||[[0,e.paddedRect.h-2]];return e.stretchX||e.stretchY?Uu(e.stretchX||[[0,e.paddedRect.w-2]])*Uu(i):1}function ku(e,t,i){let r=0;for(const n of e)r+=Math.max(t,Math.min(i,n[1]))-Math.max(t,Math.min(i,n[0]));return r}function Nu(e,t,i){const r=[{fixed:-1,stretch:0}];for(const[t,i]of e){const e=r.at(-1);r.push({fixed:t-e.stretch,stretch:e.stretch}),r.push({fixed:t-e.stretch,stretch:e.stretch+(i-t)})}return r.push({fixed:t+1,stretch:i}),r}function Uu(e){return 2*e.length+1}function Gu(e,t,i,r){return e/t*i+r}function ju(e,t,i,r){return e-t*i/r}function Hu(e,t,i,r){const n=t+e.positionedLines[r].lineOffset;return 0===r?i+n/2:i+(n+(t+e.positionedLines[r-1].lineOffset))/2}function $u(e,t,i,r,n,o,a,s,l,u=1){const c=[];if(0===t.positionedLines.length)return c;const h=(void 0!==l?l:r.layout.get("text-rotate").evaluate(o,{}))*Math.PI/180,d=function(e){const t=e[0],i=e[1],r=t*i;return r>0?[t,-i]:r<0?[-t,i]:0===t?[i,t]:[i,-t]}(i);let p=Math.abs(t.top-t.bottom);for(const e of t.positionedLines)p-=e.lineOffset;const f=t.positionedLines.length,m=p/f;let _=t.top-i[1];for(let e=0;e<f;++e){const r=t.positionedLines[e];_=Hu(t,m,_,e);for(const e of r.positionedGlyphs){if(!e.rect)continue;const r=e.rect||{};let o=4,l=!0,p=1,f=0;if(e.image){const t=a.get(e.image.toString());if(!t)continue;l=!1,p=t.pixelRatio,o=1/p,t.usvg||(p/=u)}const m=(n||s)&&e.vertical,g=e.metrics.advance*e.scale/2,y=e.metrics,x=e.rect;if(null===x)continue;s&&t.verticalizable&&(f=e.image?g-e.metrics.width*e.scale/2:0);const v=n?[e.x+g,e.y]:[0,0];let b=[0,0],w=[0,0],A=!1;n||(m?(w=[e.x+g+d[0],e.y+d[1]-f],A=!0):b=[e.x+g+i[0],e.y+i[1]-f]);const E=x.w*e.scale/(p*(e.localGlyph?2:1)),I=x.h*e.scale/(p*(e.localGlyph?2:1));let D,P,T,z;if(m){const t=e.y-_,i=new K(-g,g-t),r=-Math.PI/2,n=new K(...w);D=new K(-g+b[0],b[1]),D._rotateAround(r,i)._add(n),D.x+=-t+g,D.y-=(y.left-o)*e.scale;const a=e.image?y.advance*e.scale:nl*e.scale,s=String.fromCodePoint(e.glyph);hl(s)?D.x+=(1-o)*e.scale:dl(s)?D.x+=a-y.height*e.scale+(-o-1)*e.scale:D.x+=e.image||y.width+2*o===x.w&&y.height+2*o===x.h?(a-I)/2:(a-(y.height+2*o)*e.scale)/2,P=new K(D.x,D.y-E),T=new K(D.x+I,D.y),z=new K(D.x+I,D.y-E)}else{const t=(y.left-o)*e.scale-g+b[0],i=(-y.top-o)*e.scale+b[1],r=t+E,n=i+I;D=new K(t,i),P=new K(r,i),T=new K(t,n),z=new K(r,n)}if(h){let e;e=n?new K(0,0):A?new K(d[0],d[1]):new K(i[0],i[1]),D._rotateAround(h,e),P._rotateAround(h,e),T._rotateAround(h,e),z._rotateAround(h,e)}const M=new K(0,0),C=new K(0,0);c.push({tl:D,tr:P,bl:T,br:z,texPrimary:r,texSecondary:void 0,writingMode:t.writingMode,glyphOffset:v,sectionIndex:e.sectionIndex,isSDF:l,pixelOffsetTL:M,pixelOffsetBR:C,minFontScaleX:0,minFontScaleY:0})}}return c}Fu[255]=-1e20;class FeatureAppearances{constructor(e,t){this.lastParams=null,this.lastAllFeaturesIndex=-2,this.appearancesVersion=t,this.appearances=e;const i=e.map(e=>function(e){if(!e.condition)return{featureDependent:!1,stateDependent:!1,zoomDependent:!1,pitchDependent:!1,brightnessDependent:!1,worldviewDependent:!1};const t=e.condition.expression;return{featureDependent:!Jt(t),stateDependent:!Kt(t),zoomDependent:!ei(t,["zoom"]),pitchDependent:!ei(t,["pitch"]),brightnessDependent:!ei(t,["brightness","measure-light"]),worldviewDependent:!ei(t,["worldview"])}}(e));this.anyFeatureDependent=i.some(e=>e.featureDependent),this.anyStateDependent=i.some(e=>e.stateDependent)}update(e,t){const i=this.lastParams,r=!i||i.zoom!==e.zoom||i.pitch!==(e.pitch||0)||i.brightness!==(e.brightness||0)||i.worldview!==e.worldview;this.lastParams={zoom:e.zoom,pitch:e.pitch||0,brightness:e.brightness||0,worldview:e.worldview};const n=t&&this.anyStateDependent;if(!r&&!n&&-2!==this.lastAllFeaturesIndex)return{kind:"no-changes"};if(!this.anyFeatureDependent&&!n){const t=this.evaluateAllFeatures(e);return t===this.lastAllFeaturesIndex?{kind:"no-changes"}:(this.lastAllFeaturesIndex=t,{kind:"all-features",appearanceIndex:t})}return{kind:"per-feature"}}evaluateAllFeatures(e){for(let t=0;t<this.appearances.length;t++){const i=this.appearances[t];if(i.condition&&i.condition.evaluate(e,void 0,void 0,void 0))return t}return-1}}const Wu=VectorTileFeature.types,Xu=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function qu(e,t,i,r,n,o,a,s,l,u,c,h,d){const p=s?Math.min(xl,Math.round(s[0])):0,f=s?Math.min(xl,Math.round(s[1])):0;e.emplaceBack(t,i,Math.round(32*r),Math.round(32*n),o,a,(p<<1)+(l?1:0),0+(f<<1),16*u,16*c,256*h,256*d)}function Zu(e,t,i){e.emplaceBack(t,i)}function Yu(e,t,i,r,n,o,a){e.emplaceBack(t,i,r,n,o,a)}function Ju(e,t,i,r,n){e.emplaceBack(t,i,r,n),e.emplaceBack(t,i,r,n),e.emplaceBack(t,i,r,n),e.emplaceBack(t,i,r,n)}function Ku(e){for(const t of e.sections)if(qn(t.text))return!0;return!1}const Qu=12,ec={};class SymbolBuffers{constructor(e){this.layoutVertexArray=new StructArrayLayout4i4ui4i24,this.indexArray=new StructArrayLayout3ui6,this.programConfigurations=e,this.segments=new SegmentVector,this.dynamicLayoutVertexArray=new StructArrayLayout4f16,this.opacityVertexArray=new StructArrayLayout1ul4,this.placedSymbolArray=new PlacedSymbolArray,this.iconTransitioningVertexArray=new StructArrayLayout2ui4,this.globeExtVertexArray=new StructArrayLayout3i3f20,this.zOffsetVertexArray=new StructArrayLayout1f4,this.orientationVertexArray=new StructArrayLayout6f24,this.symbolInstanceIndices=[],this.uboBinder=null,this.featureIdArray=new StructArrayLayout1f4,this.featureIdBuffer=null,this.cachedBatchIndices=null,this.cachedBatchSegments=null}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length&&0===this.iconTransitioningVertexArray.length}getBatchGrouping(e){const t=e.get().length===this.segments.get().length;if(t&&this.cachedBatchIndices&&this.cachedBatchSegments)return{batchIndices:this.cachedBatchIndices,batchSegments:this.cachedBatchSegments};const i=new Map;for(const t of e.get()){const e=void 0!==t.batchIndex?t.batchIndex:0;i.has(e)||i.set(e,[]),i.get(e).push(t)}const r=Array.from(i.keys()).sort((e,t)=>e-t),n=new Map;for(const e of r){const t=i.get(e);n.set(e,new SegmentVector(t))}return t&&(this.cachedBatchIndices=r,this.cachedBatchSegments=n),{batchIndices:r,batchSegments:n}}snapshotSymbolVertexData(e,t){const i=e*Qu;return this.layoutVertexArray.uint16.slice(i,i+t*Qu)}restoreSymbolVertexData(e,t){this.layoutVertexArray.uint16.set(t,e*Qu)}snapshotIconTransitioningVertexData(e,t){const i=2*e;return this.iconTransitioningVertexArray.uint16.slice(i,i+2*t)}restoreIconTransitioningVertexData(e,t){this.iconTransitioningVertexArray.uint16.set(t,2*e)}updateSymbolVertexData(e,t,i,r,n,o,a,s,l,u,c,h,d){const p=this.layoutVertexArray.uint16,f=e*Qu;p[f]=t,p[f+1]=i,p[f+2]=r,p[f+3]=n,p[f+4]=o,p[f+5]=a,p[f+6]=s,p[f+7]=l,p[f+8]=u,p[f+9]=c,p[f+10]=h,p[f+11]=d}upload(e,t,i,r,n,o){this.isEmpty()||(i&&(this.cachedBatchIndices=null,this.cachedBatchSegments=null,this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Os.members,!!o),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,ks.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Xu,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,js.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Vs.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||n)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,Ns.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=e.createVertexBuffer(this.orientationVertexArray,Gs.members,!0)),this.opacityVertexBuffer.itemSize=1,this.featureIdArray.length>0&&(this.featureIdBuffer=e.createVertexBuffer(this.featureIdArray,Us.members,!1))),(i||r)&&(this.programConfigurations.upload(e),this.uboBinder&&this.uboBinder.upload(e)))}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(),this.featureIdBuffer&&this.featureIdBuffer.destroy(),this.uboBinder&&this.uboBinder.destroy())}}rn(SymbolBuffers,"SymbolBuffers",{omit:["cachedBatchIndices","cachedBatchSegments"]});class CollisionBuffers{constructor(e,t,i){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new i,this.segments=new SegmentVector,this.collisionVertexArray=new StructArrayLayout2ub4f20,this.collisionVertexArrayExt=new StructArrayLayout4f16}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Hs.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,$s.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}rn(CollisionBuffers,"CollisionBuffers");class SymbolBucket{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.placementIdRangeStart=null,this.placementVariantVisible=[],this.collisionCircleArray=[],this.placementInvProjMatrix=r([]),this.placementViewportMatrix=r([]);const t=this.layers[0]._unevaluatedLayout._values;this.worldview=e.worldview,this.localizable=e.localizable,this.maxUniformBufferBindings=e.maxUniformBufferBindings,this.maxUniformBlockSizeDwords=e.maxUniformBlockSizeDwords,this.textSizeData=fl(this.zoom,t["text-size"],this.worldview,e.availableImages),this.iconSizeData=fl(this.zoom,t["icon-size"],this.worldview,e.availableImages);const i=this.layers[0].layout,n=i.get("symbol-sort-key"),o=i.get("symbol-z-order");this.lut=e.lut,this.canOverlap=i.get("text-allow-overlap")||i.get("icon-allow-overlap")||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==o&&void 0!==n.constantOr(1),this.sortFeaturesByY=("viewport-y"===o||"auto"===o&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=i.get("text-writing-mode").map(e=>al[e]),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.sourceID=e.sourceID,this.projection=e.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=!1,this.elevationType="none",this.activeReplacements=[],this.replacementUpdateTime=0,this.hasAnySecondaryIcon=!1,this.hasAppearances=null,this.featureAppearances=null,this.featureAppearanceData=new Map}hasAnyAppearanceLayoutProperty(e){const t=this.layers[0].getAppearances();if(!t||0===t.length)return!1;const i=Array.isArray(e)?e:[e];return t.some(e=>i.some(t=>e.hasLayoutProperty(t)))}getAppearanceFeatureData(e){return this.featureAppearanceData.get(e)}createArrays(){this.text=new SymbolBuffers(new ProgramConfigurationSet(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("text")||e.startsWith("symbol"))),this.icon=new SymbolBuffers(new ProgramConfigurationSet(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("icon")||e.startsWith("symbol"))),this.text.uboBinder=new SymbolPropertyBinderUBO(this.layers[0],this.zoom,this.lut,!0,"",this.maxUniformBufferBindings,this.maxUniformBlockSizeDwords),this.icon.uboBinder=new SymbolPropertyBinderUBO(this.layers[0],this.zoom,this.lut,!1,"",this.maxUniformBufferBindings,this.maxUniformBlockSizeDwords),this.glyphOffsetArray=new GlyphOffsetArray,this.lineVertexArray=new SymbolLineVertexArray,this.symbolInstances=new SymbolInstanceArray}calculateGlyphDependencies(e,t,i,r,n){for(const i of e){const e=i.codePointAt(0);if(void 0===e)break;if(t[e]=!0,r&&n&&e<=65535){const e=cl[i];e&&(t[e.charCodeAt(0)]=!0)}}}calculateEffectiveAppearanceIconSize(e,t,i,r,n,o,a){if(!e.hasLayoutProperty("icon-size"))return a*o;let s=1;const l=e.getUnevaluatedLayoutProperty("icon-size"),u=fl(this.zoom,l,this.worldview,n),c=_l(u,t);if("constant"!==u.kind&&"camera"!==u.kind||(s=c.uSize),"composite"===u.kind){const{minZoom:e,maxZoom:t}=u,o=l.possiblyEvaluate(new EvaluationParameters(e,{worldview:this.worldview}),r),a=l.possiblyEvaluate(new EvaluationParameters(t,{worldview:this.worldview}),r),h=o.evaluate(i,{},r,n);s=h+(a.evaluate(i,{},r,n)-h)*c.uSizeT}return"source"===u.kind&&(s=l.possiblyEvaluate(new EvaluationParameters(this.zoom,{worldview:this.worldview}),r).evaluate(i,{},r,n)),s*o}updateFootprints(e,t){}hideSymbolVariant(e,t){this._setSymbolVariantVisibility(e,!1)}showSymbolVariant(e,t){this._setSymbolVariantVisibility(e,!0)}_initPlacementOpacities(){const e=e=>{const t=e.layoutVertexArray.length/4;for(let i=0;i<t;i++)e.opacityVertexArray.emplaceBack(0)};this.hasTextData()&&e(this.text),this.hasIconData()&&e(this.icon)}_setSymbolVariantVisibility(e,t){const i=e.symbolId.symbolId-this.placementIdRangeStart,r=this.symbolInstances.get(i);this.placementVariantVisible[i]=t;const n=t?4294967295:0,o=(e,t)=>{if(t<0)return;const i=e.placedSymbolArray.get(t),r=i.vertexStartIndex/4;for(let t=0;t<i.numGlyphs;t++)e.opacityVertexArray.emplace(r+t,n);e.opacityVertexBuffer&&e.opacityVertexBuffer.updateData(e.opacityVertexArray)};this.hasTextData()&&o(this.text,this.defaultPlacedTextSymbolIndex(r,i)),this.hasIconData()&&o(this.icon,r.placedIconSymbolIndex)}resetPlacementVisibility(){if(null===this.placementIdRangeStart)return;this.placementVariantVisible.fill(!1);const e=e=>{for(let t=0;t<e.opacityVertexArray.length;t++)e.opacityVertexArray.emplace(t,0);e.opacityVertexBuffer&&e.opacityVertexBuffer.updateData(e.opacityVertexArray)};this.hasTextData()&&e(this.text),this.hasIconData()&&e(this.icon)}addToPlacement(e,t,i,r,n,o,a,s,l,u,c,h){if(0===this.symbolInstances.length)return;if(h&&this.updateReplacement(a.tileID,h),!this.collisionArrays){if(!a.collisionBoxArray)return;this.deserializeCollisionBoxes(a.collisionBoxArray)}null===this.placementIdRangeStart&&(this.placementIdRangeStart=t.allocateRange(i,this.symbolInstances.length),this.placementVariantVisible=new Array(this.symbolInstances.length).fill(!1),this._initPlacementOpacities());const p=this.placementIdRangeStart,f=this.layers[0];if(f.appearances&&f.appearances.length>0)return void ze("new placement: symbol appearances are not supported yet; hiding symbols");if("point"!==f.layout.get("symbol-placement"))return void ze("new placement: along-line symbol placement is not supported yet; hiding symbols");const m=!!f.layout.get("text-variable-anchor"),_=this.getProjection(),g="globe"!==_.name;g||ze("new placement: globe projection is not supported yet; hiding symbols");const y=a.tileID.toUnwrapped(),x=n.pitch>0,v={collisionRules:{},insertIntoCollisionGrid:!0},b=n.zoom,w=_l(this.iconSizeData,b),A=_l(this.textSizeData,b),E=f.paint.get("symbol-z-offset"),I="sea"===f.layout.get("symbol-elevation-reference"),D=!E.isConstant(),P=D?0:E.evaluate(null,{}),z=n.elevation,M=3*u,C=e=>{if(!e)return M;const t=l.get(go(e,f.scope));return void 0!==t?t:(ze(`global placement: placement-group "${e}" does not match any placement-group layer; using the layer
2\
vendor: 239,284 bytes, line 2
2's implicit group`),M)},R=f.paint.get("placement-priority"),L=f.paint.get("placement-group"),B=!R.isConstant(),O=!L.isConstant(),V=B?0:R.evaluate(null,{}),k=O?M:C(L.evaluate(null,{})),N=B||O,U=D||N?a.latestFeatureIndex:null;U&&U.loadVTLayers();const G=U?U.sourceLayerCoder.decode(this.sourceLayerIndex):"",j=(e,t,i)=>{let r;if("road"===this.elevationType)r=I?i:i+Elevation.getAtTileOffset(a.tileID,new K(e.tileAnchorX,e.tileAnchorY),z,null);else{const n=this.hdExt?this.hdExt.elevationFeatures[t.elevationFeatureIndex]:void 0;r=I?i:i+Elevation.getAtTileOffset(a.tileID,new K(e.tileAnchorX,e.tileAnchorY),z,n)}if(r+=t.zOffset,!r)return{x:e.projectedAnchorX,y:e.projectedAnchorY,z:e.projectedAnchorZ,elevated:!1};const[o,s,l]=_.upVector(a.tileID.canonical,e.tileAnchorX,e.tileAnchorY),u=_.upVectorScale(a.tileID.canonical,n.center.lat,n.worldSize).metersToTile;return{x:e.projectedAnchorX+o*r*u,y:e.projectedAnchorY+s*r*u,z:e.projectedAnchorZ+l*r*u,elevated:!0}},$=(t,i,a,l)=>{if(!t)return;const{x:u,y:c,z:h,elevated:p}=j(t,i,a),f=function(e,t,i,r,n,o,a,s,l){const u=[t,i,r,1];let c=!1;r||n.pitch>0?(F(u,u,e),s&&"globe"!==o.name&&(c=function(e,t,i,r,n,o){const a=[t,i,r];return T(a,a,o.calculateFogTileMatrix(n)),function(e,t,i){const r=be(45,65,i),[n,o]=e.range;let a=1-Math.min(1,Math.exp((t-n)/(o-n)*-6));return a*=a*a,a=Math.min(1,1.00747*a),a*r*e.alpha}(e,d(a),o.pitch)}(s,t,i,r,l,n)>.9)):function(e,t,i){const r=t[0],n=t[1];e[0]=i[0]*r+i[4]*n+i[12],e[1]=i[1]*r+i[5]*n+i[13],e[3]=i[3]*r+i[7]*n+i[15]}(u,u,e);const h=u[3];return{x:(u[0]/h+1)/2*n.width,y:(-u[1]/h+1)/2*n.height,perspectiveRatio:Math.min(.5+n.getCameraToCenterDistance(o)/h*.5,1.5),occluded:a&&u[2]>h||c}}(r,u,c,h,n,_,x||p,s,y);if(f.occluded||f.perspectiveRatio<=.55)return;const m=l(),g=o*f.perspectiveRatio,v=(t.x1*m-t.padding)*g+f.x,b=(t.y1*m-t.padding)*g+f.y,w=(t.x2*m+t.padding)*g+f.x,A=(t.y2*m+t.padding)*g+f.y;v<w&&b<A&&e.addGeometry({kind:"box",left:v,top:b,right:w,bottom:A})};for(let t=0;t<this.symbolInstances.length;t++){const r=this.symbolInstances.get(t);if(r.hasIconTextFit){ze("new placement: icon-text-fit is not supported yet; skipping symbols");continue}if(m&&(r.numHorizontalGlyphVertices>0||r.numVerticalGlyphVertices>0)){ze("new placement: text-variable-anchor is not supported yet; skipping symbols");continue}if(r.numVerticalGlyphVertices>0){ze("new placement: vertical text-writing-mode is not supported yet; skipping symbols");continue}const n=this.collisionArrays[t];if(!n.iconBox&&!n.textBox)continue;let o=!1;for(const e of this.activeReplacements)if(!nu(e,u,2,f.scope)&&!(e.min.x>r.tileAnchorX||r.tileAnchorX>e.max.x||e.min.y>r.tileAnchorY||r.tileAnchorY>e.max.y)&&(o=cu(uu(r.tileAnchorX,r.tileAnchorY,a.tileID.canonical,e.footprintTileId.canonical),e.footprint),o))break;const s={symbolId:{styleLayerId:i,symbolIdOrigin:1,symbolId:p+t},variantIdx:0},l=U?U.loadFeature({featureIndex:r.featureIndex,sourceLayerIndex:this.sourceLayerIndex,bucketIndex:this.index,layoutVertexArrayOffset:0}):null,h=N&&l&&U?U.getId(l,G):void 0,d=void 0!==h&&c[String(h)]||ec,_=B&&l?R.evaluate(l,d):V,y=O&&l?C(L.evaluate(l,d)):k;if(e.startSymbolVariantProcessing(s,{placementSubgroupOrder:y,symbolPlacementPriority:_,symbolVariantVisibility:this.placementVariantVisible[t]?2:0,symbolPlacementType:1,styleLayerOrder:u,symbolDisplayOrder:0},v),g&&!o){const e=D&&l?E.evaluate(l,{}):P;$(n.iconBox,r,e,()=>this.getSymbolInstanceIconSize(w,b,r.placedIconSymbolIndex)),$(n.textBox,r,e,()=>this.getSymbolInstanceTextSize(A,r,b,t))}e.finishVariantProcessing()}}updateReplacement(e,t){if(t.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=t.updateTime;const i=t.getReplacementRegionsForTile(e.toUnwrapped(),!0);return!su(this.activeReplacements,i)&&(this.activeReplacements=i,!0)}getResolvedImageFromTokens(e){return"string"==typeof e?ResolvedImage.build(e):e}populate(e,t,i,r){const n=this.layers[0],o=n.layout,a="globe"===this.projection.name,s=o.get("text-font"),l=o.get("text-field"),u=o.get("icon-image"),[c,h]=o.get("icon-size-scale-range"),d=ve(t.scaleFactor||1,c,h),[p,f]=o.get("text-size-scale-range"),m=ve(t.scaleFactor||1,p,f),_=("constant"!==l.value.kind||l.value.value instanceof Formatted&&!l.value.value.isEmpty()||l.value.value.toString().length>0)&&("constant"!==s.value.kind||s.value.value.length>0),g="constant"!==u.value.kind||!!u.value.value||Object.keys(u.parameters).length>0,y=this.hasAnyAppearanceLayoutProperty("icon-image"),x=o.get("symbol-sort-key");if(this.features=[],this.featureAppearanceData=new Map,!_&&!g&&!y)return;const v=t.iconDependencies,b=t.glyphDependencies,w=t.availableImages,A=new EvaluationParameters(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),E=e=>{const t=e.id.toString();v.has(t)?v.get(t).push(e):v.set(t,[e])};for(const t of e){const{feature:e,id:l,index:u,sourceLayerIndex:c}=t,h=n._featureFilter.needGeometry,p=Aa(e,h);if(!n._featureFilter.filter(A,p,i))continue;if(h||(p.geometry=wa(e,i,r)),a&&1!==e.type&&i.z<=5){const e=p.geometry,t=.98078528056,r=(e,r)=>I(Ol(e.x,e.y,i,1),Ol(r.x,r.y,i,1))<t;for(let t=0;t<e.length;t++)e[t]=ya(e[t],r)}let f,D;if(_){const e=n.getValueAndResolveTokens("text-field",p,i,w),t=Formatted.factory(e);Ku(t)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===Qn()||this.hasRTLText&&eo.isParsed())&&(f=ol(t,n,p))}if(g){const e=n.getValueAndResolveTokens("icon-image",p,i,w);D=this.getResolvedImageFromTokens(e)}const P=this.layers[0];let T=!1;if(!D&&y){const e=P.getAppearances();for(const t of e)if(t.getLayoutProperty("icon-image")){const e=P.getAppearanceValueAndResolveTokens(t,"icon-image",p,i,w);if(e){D=this.getResolvedImageFromTokens(e),T=!0;break}}}if(!f&&!D)continue;const z=this.sortFeaturesByKey?x.evaluate(p,{},i):void 0,M={id:l,text:f,icon:D,index:u,sourceLayerIndex:c,geometry:p.geometry,properties:e.properties,type:Wu[e.type],sortKey:z};if(this.features.push(M),this.featureAppearanceData.set(u,{id:l,properties:e.properties,usesAppearanceIconAsPlaceholder:T}),D){const e=P._unevaluatedLayout._values,{iconPrimary:t,iconSecondary:r}=Il(D,this.iconSizeData,e["icon-size"],i,this.zoom,M,this.pixelRatio,d,this.worldview,w);E(t),r&&(this.hasAnySecondaryIcon=!0,E(r))}const C=P.getAppearances();if(0!==C.length&&C.forEach(e=>{if(!e.getLayoutProperty("icon-image"))return;const{iconPrimary:t,iconSecondary:r}=this.getCombinedIconVariants(e,P,p,i,w,M,d);t&&(E(t),r&&(this.hasAnySecondaryIcon=!0,E(r)))}),f){const e=s.evaluate(p,{},i).join(","),t="map"===o.get("text-rotation-alignment")&&"point"!==o.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.includes(al.vertical);for(const i of f.sections)if(i.image){const e=i.image.getPrimary().scaleSelf(this.pixelRatio*m),t=e.id.toString(),r=v.get(t)||[];r.push(e),v.set(t,r)}else{const r=Vn(f.toString()),n=i.fontStack||e,o=b[n]=b[n]||{};this.calculateGlyphDependencies(i.text,o,t,this.allowVerticalPlacement,r)}}}"line"===o.get("symbol-placement")&&(this.features=function(e){const t={},i={},r=[];let n=0;function o(t){r.push(e[t]),n++}function a(e,t,n){const o=i[e];return delete i[e],i[t]=o,r[o].geometry[0].pop(),r[o].geometry[0]=r[o].geometry[0].concat(n[0]),o}function s(e,i,n){const o=t[i];return delete t[i],t[e]=o,r[o].geometry[0].shift(),r[o].geometry[0]=n[0].concat(r[o].geometry[0]),o}function l(e,t,i){const r=i?t[0].at(-1):t[0][0];return`${e}:${r.x}:${r.y}`}for(let u=0;u<e.length;u++){const c=e[u],h=c.geometry,d=c.text?c.text.toString():null;if(!d||h.length>1){o(u);continue}const p=l(d,h,!1),f=l(d,h,!0);if(p in i&&f in t&&i[p]!==t[f]){const e=s(p,f,h),n=a(p,f,r[e].geometry);delete t[p],delete i[f],i[l(d,r[n].geometry,!0)]=n,r[e].geometry=null}else p in i?a(p,f,h):f in t?s(p,f,h):(o(u),t[p]=n-1,i[f]=n-1)}return r.filter(e=>e.geometry)}(this.features)),"hd-road-markup"===o.get("symbol-elevation-reference")?(this.elevationType="road",this.hdExt&&(this.hdExt.configureCrossSource(i,t.elevationParams,t.crossSourceElevationEnabled,t.terrainEnabled),t.elevationFeatures&&t.elevationFeatures.length>0&&this.hdExt.addElevationFeatures(t.elevationFeatures,i))):o.get("symbol-z-elevate")&&(this.elevationType="offset"),"none"!==this.elevationType&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((e,t)=>e.sortKey-t.sortKey)}getCombinedIconVariants(e,t,i,r,n,o,a){let s;if(e.hasLayoutProperty("icon-image")){const o=t.getAppearanceValueAndResolveTokens(e,"icon-image",i,r,n);s=this.getResolvedImageFromTokens(o)}else{const e=t.getValueAndResolveTokens("icon-image",i,r,n);s=this.getResolvedImageFromTokens(e)}if(s){const i=e.hasLayoutProperty("icon-size")?e.getUnevaluatedLayoutProperty("icon-size"):t._unevaluatedLayout._values["icon-size"],l=fl(this.zoom,i,this.worldview,n),{iconPrimary:u,iconSecondary:c}=Il(s,l,i,r,this.zoom,o,this.pixelRatio,a,this.worldview,n);return{iconPrimary:u,iconSecondary:c}}return{iconPrimary:void 0,iconSecondary:void 0}}getCombinedIconPrimary(e,t,i,r,n,o,a){return this.getCombinedIconVariants(e,t,i,r,n,o,a).iconPrimary}updateSymbolInstanceIconVertices(e,t,i,r,n,o){const{canonical:a,availableImages:s,globalProperties:l,layer:u,iconScaleFactor:c,featureState:h,layoutIconOffset:d,layoutIconSize:p,layoutIconRotate:f}=o;if(e.placedIconSymbolIndex<0)return{vertexOffsetDelta:0,hasChanges:!1};if(t.activeAppearanceIndex===i)return{vertexOffsetDelta:e.numIconVertices,hasChanges:!1};const m=i>=0?u.appearances[i]:null;if(m){const i={sortKey:void 0,text:void 0,icon:null,index:e.featureIndex,sourceLayerIndex:e.featureIndex,geometry:[],properties:t.properties,type:"Point",id:t.id},{iconPrimary:o,iconSecondary:_}=this.getCombinedIconVariants(m,u,r,a,s,i,c);if(!o)return{vertexOffsetDelta:0,hasChanges:!1};const g=o.toString(),y=this.iconAtlasPositions&&this.iconAtlasPositions.get(g);if(y){const{appearanceIconOffset:i,appearanceIconRotate:o}=wl(m,u,r,a,d,f,p,c),g=u.layout.get("icon-anchor").evaluate(r,h,a);let x=ll(y,_?this.iconAtlasPositions&&this.iconAtlasPositions.get(_.toString()):void 0,i,g);const v=y.sdf,b=u.layout.get("icon-text-fit").constantOr("none");"none"!==b&&t.textShaping&&t.iconTextFitPadding&&t.fontScale&&(x=ul(x,t.textShaping,b,t.iconTextFitPadding,i,t.fontScale));const w=this.calculateEffectiveAppearanceIconSize(m,l.zoom,r,a,s,c,p),A=0,E=1+(Math.min(xl,Math.round(w*pl))<<1),I=Ou(x,o,v,"none"!==b,c),D=this.icon.iconTransitioningVertexArray.length>0;t.isUsingAppearanceIconVertexData||(t.isUsingAppearanceIconVertexData=!0,t.layoutBasedIconVertexData=this.icon.snapshotSymbolVertexData(n,e.numIconVertices),D&&(t.layoutBasedIconTransitioningVertexData=this.icon.snapshotIconTransitioningVertexData(n,e.numIconVertices)));const P=Math.floor(e.numIconVertices/4),T=Math.min(I.length,P);let z=n;const M=D?this.icon.iconTransitioningVertexArray.uint16:null;for(let i=0;i<T;++i){const r=I[i],n=t.layoutBasedIconVertexData[0]||e.tileAnchorX,o=t.layoutBasedIconVertexData[1]||e.tileAnchorY,a=16*r.pixelOffsetTL.x,s=16*r.pixelOffsetTL.y,l=16*r.pixelOffsetBR.x,u=16*r.pixelOffsetBR.y,c=16*r.minFontScaleX,h=16*r.minFontScaleY;if(this.icon.updateSymbolVertexData(z,n,o,Math.round(32*r.tl.x),Math.round(32*r.tl.y),r.texPrimary.x,r.texPrimary.y,A,E,a,s,c,h),this.icon.updateSymbolVertexData(z+1,n,o,Math.round(32*r.tr.x),Math.round(32*r.tr.y),r.texPrimary.x+r.texPrimary.w,r.texPrimary.y,A,E,l,s,c,h),this.icon.updateSymbolVertexData(z+2,n,o,Math.round(32*r.bl.x),Math.round(32*r.bl.y),r.texPrimary.x,r.texPrimary.y+r.texPrimary.h,A,E,a,u,c,h),this.icon.updateSymbolVertexData(z+3,n,o,Math.round(32*r.br.x),Math.round(32*r.br.y),r.texPrimary.x+r.texPrimary.w,r.texPrimary.y+r.texPrimary.h,A,E,l,u,c,h),M){const e=r.texSecondary?r.texSecondary:r.texPrimary,t=2*z;M[t]=e.x,M[t+1]=e.y,M[t+2]=e.x+e.w,M[t+3]=e.y,M[t+4]=e.x,M[t+5]=e.y+e.h,M[t+6]=e.x+e.w,M[t+7]=e.y+e.h}z+=4}const C=e.numIconVertices-4*T;for(let e=0;e<C;++e)this.icon.updateSymbolVertexData(z+e,0,0,0,0,0,0,0,0,0,0,0,0);return{vertexOffsetDelta:e.numIconVertices,hasChanges:!0}}}else{if(t.usesAppearanceIconAsPlaceholder)return this.icon.updateSymbolVertexData(n,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(n+1,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(n+2,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(n+3,0,0,0,0,0,0,0,0,0,0,0,0),{vertexOffsetDelta:e.numIconVertices,hasChanges:!0};if(t.isUsingAppearanceIconVertexData)return this.icon.restoreSymbolVertexData(n,t.layoutBasedIconVertexData),t.layoutBasedIconTransitioningVertexData&&this.icon.restoreIconTransitioningVertexData(n,t.layoutBasedIconTransitioningVertexData),t.isUsingAppearanceIconVertexData=!1,{vertexOffsetDelta:t.layoutBasedIconVertexData.length/Qu,hasChanges:!0}}return{vertexOffsetDelta:e.numIconVertices,hasChanges:!1}}updateSymbolInstanceTextVertices(e,t,i,r,n,o){const{canonical:a,layer:s,textScaleFactor:l,imageMap:u,featureState:c,layoutTextOffset:h,layoutTextSize:d,layoutTextRotate:p,layoutMinZoomSize:f,layoutMaxZoomSize:m,layoutTextSizeMinZoom:_,layoutTextSizeMaxZoom:g,availableImages:y}=o,x=e.numHorizontalGlyphVertices>0||e.numVerticalGlyphVertices>0;if(!x)return{vertexOffsetDelta:x?e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices:0,hasChanges:!1};if(t.activeAppearanceIndex===i)return{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!1};const v=i>=0?s.appearances[i]:null;if(v&&t.textShaping){const{appearanceTextOffset:i,appearanceTextRotate:o,appearanceTextSize:x}=Al(v,s,r,a,h,p,d);t.fontScale=Dl(x,t.textScaleFactor);const b=v.getUnevaluatedLayoutProperty("text-size");let w=this.textSizeData,A=_,E=g;v.hasLayoutProperty("text-size")&&(w=fl(this.zoom,b,this.worldview,y),A="composite"===this.textSizeData.kind?this.textSizeData.minZoom:0,E="composite"===this.textSizeData.kind?this.textSizeData.maxZoom:0);const I=t.textShaping.bottom-h[1],D=t.textShaping.left-h[0],P=t.textShaping.right-h[0];t.textShaping.top=i[1]+(t.textShaping.top-h[1]),t.textShaping.bottom=i[1]+I,t.textShaping.left=i[0]+D,t.textShaping.right=i[0]+P;const T=$u(0,t.textShaping,i,s,!1,r,u,this.allowVerticalPlacement,o),z=x&&"composite"===w.kind?b.possiblyEvaluate(new EvaluationParameters(A,{}),a).evaluate(r,c,a):f,M=x&&"composite"===w.kind?b.possiblyEvaluate(new EvaluationParameters(E,{}),a).evaluate(r,c,a):m,C=Pl(v.name,w,x,l,z,M),R=Array.isArray(C)?C[1]:x,L=0,F=1+(Math.min(xl,Math.round(R*pl))<<1);t.isUsingAppearanceTextVertexData||(t.isUsingAppearanceTextVertexData=!0,t.layoutBasedTextVertexData=this.text.snapshotSymbolVertexData(n,e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices));for(let t=0;t<T.length&&t<(e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices)/4;++t){const i=T[t],r=i.glyphOffset[1],o=e.tileAnchorX,a=e.tileAnchorY,s=n+4*t;this.text.updateSymbolVertexData(s,o,a,Math.round(32*i.tl.x),Math.round(32*(r+i.tl.y)),i.texPrimary.x,i.texPrimary.y,L,F,i.pixelOffsetTL.x,i.pixelOffsetTL.y,i.minFontScaleX,i.minFontScaleY),this.text.updateSymbolVertexData(s+1,o,a,Math.round(32*i.tr.x),Math.round(32*(r+i.tr.y)),i.texPrimary.x+i.texPrimary.w,i.texPrimary.y,L,F,i.pixelOffsetBR.x,i.pixelOffsetTL.y,i.minFontScaleX,i.minFontScaleY),this.text.updateSymbolVertexData(s+2,o,a,Math.round(32*i.bl.x),Math.round(32*(r+i.bl.y)),i.texPrimary.x,i.texPrimary.y+i.texPrimary.h,L,F,i.pixelOffsetTL.x,i.pixelOffsetBR.y,i.minFontScaleX,i.minFontScaleY),this.text.updateSymbolVertexData(s+3,o,a,Math.round(32*i.br.x),Math.round(32*(r+i.br.y)),i.texPrimary.x+i.texPrimary.w,i.texPrimary.y+i.texPrimary.h,L,F,i.pixelOffsetBR.x,i.pixelOffsetBR.y,i.minFontScaleX,i.minFontScaleY)}return{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!0}}return t.isUsingAppearanceTextVertexData?(this.text.restoreSymbolVertexData(n,t.layoutBasedTextVertexData),t.isUsingAppearanceTextVertexData=!1,{vertexOffsetDelta:t.layoutBasedTextVertexData.length/Qu,hasChanges:!0}):{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!1}}updateExpressions(e){this.text&&this.text.programConfigurations.updateExpressions(e),this.icon&&this.icon.programConfigurations.updateExpressions(e)}update(e,t,i,r,n,o,a,s){if(this.text.uboBinder||this.text.programConfigurations.updatePaintArrays(e,t,n,i,r,o,a,this.worldview),this.icon.uboBinder||this.icon.programConfigurations.updatePaintArrays(e,t,n,i,r,o,a,this.worldview),s)if(o)for(const r of[this.text.uboBinder,this.icon.uboBinder])r&&!r.isLightConstant&&r.updateDynamicExpressions(n[0],t,s,i,e,a);else if(Object.keys(e).length>0){const r=n[0],o=[this.text.uboBinder,this.icon.uboBinder].filter(e=>e&&e.hasStateDependentPaint(r));if(o.length>0){const n=new Set(Object.keys(e).map(e=>{const t=Number(e);return!isNaN(t)&&Number.isSafeInteger(t)&&String(t)===e?t:e}));for(const l of o)l.updateFeatures(n,r,t,s,i,e,a)}}}updateZOffset(){const e=(e,t,r)=>{i+=t,i>e.length&&e.resize(i);for(let n=-t;n<0;n++)e.emplace(n+i,r)},t=(e,t,i)=>{r+=t,r>e.length&&e.resize(r);for(let n=-t;n<0;n++)e.emplace(n+r,i)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let i=0,r=0;for(let i=0;i<this.symbolInstances.length;i++){const r=this.symbolInstances.get(i),{numHorizontalGlyphVertices:n,numVerticalGlyphVertices:o,numIconVertices:a}=r,s=r.zOffset,l=a>0;if((n>0||o>0)&&(e(this.text.zOffsetVertexArray,n,s),e(this.text.zOffsetVertexArray,o,s)),l){const{placedIconSymbolIndex:e,verticalPlacedIconSymbolIndex:i}=r;e>=0&&t(this.icon.zOffsetVertexArray,a,s),i>=0&&t(this.icon.zOffsetVertexArray,r.numVerticalIconVertices,s)}}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(e,t,i,r,n){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),null===this.hasAppearances&&(this.hasAppearances=this.layers.some(e=>e.appearances&&e.appearances.length>0)),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),this.uploaded=!0}updateAppearances(e,t,i,r,n,o=!1){const a={hasLayoutChanges:!1,hasUboChanges:!1};if(!e||!i||!this.featureAppearanceData)return a;const s=t||{},l=this.icon.layoutVertexArray&&this.icon.layoutVertexArray.length>0&&this.icon.layoutVertexArray.arrayBuffer,u=this.text.layoutVertexArray&&this.text.layoutVertexArray.length>0&&this.text.layoutVertexArray.arrayBuffer;if(!l&&!u)return a;const c=this.layers[0],h=c.layout;this.featureAppearances&&this.featureAppearances.appearancesVersion===c.appearancesVersion||(this.featureAppearances=new FeatureAppearances(c.appearances,c.appearancesVersion));const d=this.featureAppearances.update(r,o);if("no-changes"===d.kind)return a;let p=1,f=0,m=!1,_=!1;if(l){const[e,t]=h.get("icon-size-scale-range");p=ve(1,e,t)}let g=1,y=0,x=!1;if(u){const[e,t]=h.get("text-size-scale-range");g=ve(1,e,t)}const v=new Map;if(n&&i)for(const e of i){const t=n.getImage(e,c.scope);if(t){const i=new ImageVariant(e.toString());v.set(i.toString(),t)}}const b=[this.text.uboBinder,this.icon.uboBinder];for(let t=0;t<this.symbolInstances.length;t++){const n=this.symbolInstances.get(t),o=this.getAppearanceFeatureData(n.featureIndex);if(!o)continue;const a=o.id,w=void 0!==a?s[String(a)]:void 0,A={type:"Point",id:o.id,properties:o.properties,geometry:[]};let E;if("all-features"===d.kind)E=d.appearanceIndex;else{const t=c.appearances?c.appearances.findIndex(t=>t.isActive({globals:r,feature:A,canonical:e,featureState:w})):-1;E=t>=0?t:-1}const I=o.activeAppearanceIndex!==E;if(u){const t=h.get("text-size"),r="composite"===this.textSizeData.kind?this.textSizeData.minZoom:0,a="composite"===this.textSizeData.kind?this.textSizeData.maxZoom:0,s={canonical:e,layer:c,featureState:w,availableImages:i,textScaleFactor:g,imageMap:v,layoutTextOffset:h.get("text-offset").evaluate(A,w,e).map(e=>e*nl),layoutTextSize:t.evaluate(A,w,e),layoutTextRotate:h.get("text-rotate").evaluate(A,w,e),layoutMinZoomSize:t.evaluate(A,{zoom:r},e),layoutMaxZoomSize:t.evaluate(A,{zoom:a},e),layoutTextSizeMinZoom:r,layoutTextSizeMaxZoom:a},l=this.updateSymbolInstanceTextVertices(n,o,E,A,y,s);y+=l.vertexOffsetDelta,x=x||l.hasChanges}if(l){const t={canonical:e,layer:c,featureState:w,availableImages:i,globalProperties:r,iconScaleFactor:p,layoutIconOffset:h.get("icon-offset").evaluate(A,w,e),layoutIconSize:h.get("icon-size").evaluate(A,w,e,i),layoutIconRotate:h.get("icon-rotate").evaluate(A,w,e)},a=this.updateSymbolInstanceIconVertices(n,o,E,A,f,t);f+=a.vertexOffsetDelta,m=m||a.hasChanges}if(I){const t=n.featureIndex,o=r?r.brightness:null,a=w||{},s=E>=0?c.appearances[E]:null;for(const r of b)r&&(r.layer=c,_=r.updateFeaturePaintForAppearance(t,A,a,e,i,o,s)||_)}o.activeAppearanceIndex=E}return m&&this.icon.layoutVertexBuffer&&null!==this.icon.layoutVertexArray.arrayBuffer&&this.icon.layoutVertexArray.length===this.icon.layoutVertexBuffer.length&&this.icon.layoutVertexBuffer.updateData(this.icon.layoutVertexArray),m&&this.icon.iconTransitioningVertexBuffer&&this.icon.iconTransitioningVertexArray.length>0&&this.icon.iconTransitioningVertexArray.length===this.icon.iconTransitioningVertexBuffer.length&&this.icon.iconTransitioningVertexBuffer.updateData(this.icon.iconTransitioningVertexArray),x&&this.text.layoutVertexBuffer&&null!==this.text.layoutVertexArray.arrayBuffer&&this.text.layoutVertexArray.length===this.text.layoutVertexBuffer.length&&this.text.layoutVertexBuffer.updateData(this.text.layoutVertexArray),{hasLayoutChanges:m||x,hasUboChanges:_}}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=iu(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){const i=this.lineVertexArray.length;if(void 0!==e.segment)for(const{x:e,y:i}of t)this.lineVertexArray.emplaceBack(e,i);return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(e,t,i,r,n,o,a,s,l,u,c,h,d,p,f,m,_,g){const y=e.indexArray,x=e.layoutVertexArray,v=e.globeExtVertexArray,b=g,w=e.uboBinder?e.uboBinder.getCurrentBatchIndex():void 0,A=e.segments.prepareSegment(4*b,x,y,this.canOverlap?o.sortKey:void 0,w),E=this.glyphOffsetArray.length,I=A.vertexLength,D=this.allowVerticalPlacement&&a===al.vertical?Math.PI/2:0,P=o.text&&o.text.sections;let T=x.length,z=-1;for(let r=0;r<t.length;r++){const{tl:n,tr:a,bl:u,br:c,texPrimary:h,texSecondary:_,pixelOffsetTL:g,pixelOffsetBR:b,minFontScaleX:w,minFontScaleY:E,glyphOffset:I,isSDF:M,sectionIndex:C}=t[r],R=A.vertexLength,L=I[1];if(qu(x,l.x,l.y,n.x,L+n.y,h.x,h.y,i,M,g.x,g.y,w,E),qu(x,l.x,l.y,a.x,L+a.y,h.x+h.w,h.y,i,M,b.x,g.y,w,E),qu(x,l.x,l.y,u.x,L+u.y,h.x,h.y+h.h,i,M,g.x,b.y,w,E),qu(x,l.x,l.y,c.x,L+c.y,h.x+h.w,h.y+h.h,i,M,b.x,b.y,w,E),s){const{x:t,y:i,z:r}=s.anchor,[n,o,a]=s.up;Yu(v,t,i,r,n,o,a),Yu(v,t,i,r,n,o,a),Yu(v,t,i,r,n,o,a),Yu(v,t,i,r,n,o,a),Ju(e.dynamicLayoutVertexArray,t,i,r,D)}else Ju(e.dynamicLayoutVertexArray,l.x,l.y,l.z,D);if(m){const t=_||h;Zu(e.iconTransitioningVertexArray,t.x,t.y),Zu(e.iconTransitioningVertexArray,t.x+t.w,t.y),Zu(e.iconTransitioningVertexArray,t.x,t.y+t.h),Zu(e.iconTransitioningVertexArray,t.x+t.w,t.y+t.h)}if(y.emplaceBack(R,R+1,R+2),y.emplaceBack(R+1,R+2,R+3),A.vertexLength+=4,A.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(I[0]),(r===t.length-1||C!==t[r+1].sectionIndex)&&(e.uboBinder||e.programConfigurations.populatePaintArrays(x.length,o,o.index,{},d,p,f,P&&P[C],this.worldview),e.uboBinder)){const t=e.uboBinder.populateUBO(o,o.index,p,d,f,P&&P[C]);z=t;const i=x.length-T;for(let r=0;r<i;r++)e.featureIdArray.emplaceBack(t);T=x.length}}const M=g-t.length;if(0!==M&&(this._addNullVertices(M,x,i,s,v,e,m,A,y),e.uboBinder&&z>=0)){const t=4*M;for(let i=0;i<t;i++)e.featureIdArray.emplaceBack(z)}const C=s?s.anchor:l;e.placedSymbolArray.emplaceBack(C.x,C.y,C.z,l.x,l.y,E,this.glyphOffsetArray.length-E,I,u,c,l.segment,i?i[0]:0,i?i[1]:0,r[0],r[1],a,0,0,0,h,0),e.symbolInstanceIndices.push(_)}_addNullVertices(e,t,i,r,n,o,a,s,l){for(let u=0;u<e;u++){for(let e=0;e<4;e++)qu(t,0,0,0,0,0,0,i,!1,0,0,0,0),r?(Yu(n,0,0,0,0,0,0),Ju(o.dynamicLayoutVertexArray,0,0,0,0)):Ju(o.dynamicLayoutVertexArray,0,0,0,0),a&&Zu(o.iconTransitioningVertexArray,0,0);const e=s.vertexLength;l.emplaceBack(e,e+1,e+2),l.emplaceBack(e+1,e+2,e+3),s.vertexLength+=4,s.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(0)}}_commitLayoutVertex(e,t,i,r,n,o,a){e.emplaceBack(t,i,r,n,o,Math.round(a.x),Math.round(a.y))}_addCollisionDebugVertices(e,t,i,r,n,o,a){const s=i.segments.prepareSegment(4,i.layoutVertexArray,i.indexArray),l=s.vertexLength,u=a.tileAnchorX,c=a.tileAnchorY;for(let e=0;e<4;e++)i.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(i.collisionVertexArrayExt,t,e.padding,a.zOffset),this._commitLayoutVertex(i.layoutVertexArray,r,n,o,u,c,new K(e.x1,e.y1)),this._commitLayoutVertex(i.layoutVertexArray,r,n,o,u,c,new K(e.x2,e.y1)),this._commitLayoutVertex(i.layoutVertexArray,r,n,o,u,c,new K(e.x2,e.y2)),this._commitLayoutVertex(i.layoutVertexArray,r,n,o,u,c,new K(e.x1,e.y2)),s.vertexLength+=4;const h=i.indexArray;h.emplaceBack(l,l+1),h.emplaceBack(l+1,l+2),h.emplaceBack(l+2,l+3),h.emplaceBack(l+3,l),s.primitiveLength+=4}_addTextDebugCollisionBoxes(e,t,i,r,n,o){for(let a=r;a<n;a++){const r=i.get(a),n=this.getSymbolInstanceTextSize(e,o,t,a);this._addCollisionDebugVertices(r,n,this.textCollisionBox,r.projectedAnchorX,r.projectedAnchorY,r.projectedAnchorZ,o)}}_addIconDebugCollisionBoxes(e,t,i,r,n,o){for(let a=r;a<n;a++){const r=i.get(a),n=this.getSymbolInstanceIconSize(e,t,o.placedIconSymbolIndex);this._addCollisionDebugVertices(r,n,this.iconCollisionBox,r.projectedAnchorX,r.projectedAnchorY,r.projectedAnchorZ,o)}}generateCollisionDebugBuffers(e,t,i){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new CollisionBuffers(StructArrayLayout3i2i2i16,Ws.members,StructArrayLayout2ui4),this.iconCollisionBox=new CollisionBuffers(StructArrayLayout3i2i2i16,Ws.members,StructArrayLayout2ui4);const r=_l(this.iconSizeData,e),n=_l(this.textSizeData,e,i);for(let i=0;i<this.symbolInstances.length;i++){const o=this.symbolInstances.get(i);this._addTextDebugCollisionBoxes(n,e,t,o.textBoxStartIndex,o.textBoxEndIndex,o),this._addTextDebugCollisionBoxes(n,e,t,o.verticalTextBoxStartIndex,o.verticalTextBoxEndIndex,o),this._addIconDebugCollisionBoxes(r,e,t,o.iconBoxStartIndex,o.iconBoxEndIndex,o),this._addIconDebugCollisionBoxes(r,e,t,o.verticalIconBoxStartIndex,o.verticalIconBoxEndIndex,o)}}defaultPlacedTextSymbolIndex(e,t){return e.rightJustifiedTextSymbolIndex>=0?e.rightJustifiedTextSymbolIndex:e.centerJustifiedTextSymbolIndex>=0?e.centerJustifiedTextSymbolIndex:e.leftJustifiedTextSymbolIndex>=0?e.leftJustifiedTextSymbolIndex:e.verticalPlacedTextSymbolIndex>=0?e.verticalPlacedTextSymbolIndex:t}getSymbolInstanceTextSize(e,t,i,r){const n=this.defaultPlacedTextSymbolIndex(t,r),o=this.text.placedSymbolArray.get(n),a=ml(this.textSizeData,e,o)/nl;return this.tilePixelRatio*a}getSymbolInstanceIconSize(e,t,i){const r=this.icon.placedSymbolArray.get(i),n=ml(this.iconSizeData,e,r);return this.tilePixelRatio*n}_commitDebugCollisionVertexUpdate(e,t,i,r){e.emplaceBack(t,-i,-i,r),e.emplaceBack(t,i,-i,r),e.emplaceBack(t,i,i,r),e.emplaceBack(t,-i,i,r)}_updateTextDebugCollisionBoxes(e,t,i,r,n,o,a){for(let a=r;a<n;a++){const r=i.get(a),n=this.getSymbolInstanceTextSize(e,o,t,a);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,n,r.padding,o.zOffset)}}_updateIconDebugCollisionBoxes(e,t,i,r,n,o,a){for(let a=r;a<n;a++){const r=i.get(a),n=this.getSymbolInstanceIconSize(e,t,o.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,n,r.padding,o.zOffset)}}updateCollisionDebugBuffers(e,t,i,r){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const n=_l(this.iconSizeData,e,r),o=_l(this.textSizeData,e,i);for(let a=0;a<this.symbolInstances.length;a++){const s=this.symbolInstances.get(a);this._updateTextDebugCollisionBoxes(o,e,t,s.textBoxStartIndex,s.textBoxEndIndex,s,i),this._updateTextDebugCollisionBoxes(o,e,t,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s,i),this._updateIconDebugCollisionBoxes(n,e,t,s.iconBoxStartIndex,s.iconBoxEndIndex,s,r),this._updateIconDebugCollisionBoxes(n,e,t,s.verticalIconBoxStartIndex,s.verticalIconBoxEndIndex,s,r)}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(e,t,i,r,n,o,a,s,l){const u={};if(t<i){const{x1:i,y1:r,x2:n,y2:o,padding:a,projectedAnchorX:s,projectedAnchorY:l,projectedAnchorZ:c,tileAnchorX:h,tileAnchorY:d,featureIndex:p}=e.get(t);u.textBox={x1:i,y1:r,x2:n,y2:o,padding:a,projectedAnchorX:s,projectedAnchorY:l,projectedAnchorZ:c,tileAnchorX:h,tileAnchorY:d},u.textFeatureIndex=p}if(r<n){const{x1:t,y1:i,x2:n,y2:o,padding:a,projectedAnchorX:s,projectedAnchorY:l,projectedAnchorZ:c,tileAnchorX:h,tileAnchorY:d,featureIndex:p}=e.get(r);u.verticalTextBox={x1:t,y1:i,x2:n,y2:o,padding:a,projectedAnchorX:s,projectedAnchorY:l,projectedAnchorZ:c,tileAnchorX:h,tileAnchorY:d},u.verticalTextFeatureIndex=p}if(o<a){const{x1:t,y1:i,x2:r,y2:n,padding:a,projectedAnchorX:s,projectedAnchorY:l,projectedAnchorZ:c,tileAnchorX:h,tileAnchorY:d,featureIndex:p}=e.get(o);u.iconBox={x1:t,y1:i,x2:r,y2:n,padding:a,projectedAnchorX:s,projectedAnchorY:l,projectedAnchorZ:c,tileAnchorX:h,tileAnchorY:d},u.iconFeatureIndex=p}if(s<l){const{x1:t,y1:i,x2:r,y2:n,padding:o,projectedAnchorX:a,projectedAnchorY:l,projectedAnchorZ:c,tileAnchorX:h,tileAnchorY:d,featureIndex:p}=e.get(s);u.verticalIconBox={x1:t,y1:i,x2:r,y2:n,padding:o,projectedAnchorX:a,projectedAnchorY:l,projectedAnchorZ:c,tileAnchorX:h,tileAnchorY:d},u.verticalIconFeatureIndex=p}return u}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){const i=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,i.textBoxStartIndex,i.textBoxEndIndex,i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i.iconBoxStartIndex,i.iconBoxEndIndex,i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(e,t){const i=e.placedSymbolArray.get(t),r=i.vertexStartIndex+4*i.numGlyphs;for(let t=i.vertexStartIndex;t<r;t+=4)e.indexArray.emplaceBack(t,t+1,t+2),e.indexArray.emplaceBack(t+1,t+2,t+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const t=Math.sin(e),i=Math.cos(e),r=[],n=[],o=[];for(let e=0;e<this.symbolInstances.length;++e){o.push(e);const a=this.symbolInstances.get(e);r.push(0|Math.round(t*a.tileAnchorX+i*a.tileAnchorY)),n.push(a.featureIndex)}return o.sort((e,t)=>r[e]-r[t]||n[t]-n[e]),o}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let e=0;e<this.symbolInstances.length;++e)this.symbolInstanceIndexesSortedZOffset.push(e)}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort((e,t)=>this.symbolInstances.get(t).zOffset-this.symbolInstances.get(e).zOffset)}addToSortKeyRanges(e,t){const i=this.sortKeyRanges.at(-1);i&&i.sortKey===t?i.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e)if(this.text.segments.get().length>1||this.icon.segments.get().length>1)this.sortFeaturesByY=!1;else{this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const e of this.symbolInstanceIndexes){const t=this.symbolInstances.get(e);this.featureSortOrder.push(t.featureIndex);const{rightJustifiedTextSymbolIndex:i,centerJustifiedTextSymbolIndex:r,leftJustifiedTextSymbolIndex:n,verticalPlacedTextSymbolIndex:o,placedIconSymbolIndex:a,verticalPlacedIconSymbolIndex:s}=t;i>=0&&this.addIndicesForPlacedSymbol(this.text,i),r>=0&&r!==i&&this.addIndicesForPlacedSymbol(this.text,r),n>=0&&n!==r&&n!==i&&this.addIndicesForPlacedSymbol(this.text,n),o>=0&&this.addIndicesForPlacedSymbol(this.text,o),a>=0&&this.addIndicesForPlacedSymbol(this.icon,a),s>=0&&this.addIndicesForPlacedSymbol(this.icon,s)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}rn(SymbolBucket,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),SymbolBucket.addDynamicAttributes=Ju;class ElevatedFillBufferData extends FillBufferData{constructor(e,t,i){super(e,t,i),this.elevatedLayoutVertexArray=new StructArrayLayout1f4}upload(e){const t=this.uploaded;super.upload(e),!t&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,Ta.members))}destroy(){this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),super.destroy()}}rn(ElevatedFillBufferData,"ElevatedFillBufferData");class ElevationPortalGraph{constructor(){this.portals=[]}static isOnBorder(e,t){return e<=0&&t<=0||e>=Xt&&t>=Xt}static evaluate(e){if(0===e.length)return new ElevationPortalGraph;let t=[];for(const i of e)t.push(...i.portals);if(0===t.length)return new ElevationPortalGraph;for(const e of t){const t=e.va,i=e.vb;(ElevationPortalGraph.isOnBorder(t.x,i.x)||ElevationPortalGraph.isOnBorder(t.y,i.y))&&(e.type="border")}const i=t.filter(e=>"unevaluated"!==e.type),r=t.filter(e=>"unevaluated"===e.type);if(0===r.length)return new ElevationPortalGraph;r.sort((e,t)=>e.hash===t.hash?e.isTunnel===t.isTunnel?0:e.isTunnel?-1:1:e.hash<t.hash?1:-1),t=i.concat(r);let n=i.length,o=n,a=n;do{if(o++,o===t.length||t[n].hash!==t[o].hash){if(o-n===2){a<n&&(t[a]=t[n],t[n]=null);const e=t[a],i=t[o-1];e.type=e.isTunnel!==i.isTunnel?"tunnel":"polygon",e.connection={a:e.connection.a,b:i.connection.a},a++}n=o}}while(n!==t.length);return t.splice(a),t.sort((e,t)=>e.hash<t.hash?1:-1),{portals:t}}}rn(ElevationPortalGraph,"ElevationPortalGraph");class MeshBuilder{constructor(e,t,i){this.outPositions=e,this.outNormals=t,this.outIndices=i,this.vertexLookup=new Map}addVertex(e,t,i){let r=e[2];null!=i&&(r*=i);const n=`${e[0]},${e[1]},${e[2]},${t[0]},${t[1]},${t[2]}`,o=this.vertexLookup.get(n);if(null!=o)return o;const a=this.outPositions.length;this.vertexLookup.set(n,a);const s=Math.trunc(16384*t[0]),l=Math.trunc(16384*t[1]),u=Math.trunc(16384*t[2]);return this.outPositions.emplaceBack(e[0],e[1],r),this.outNormals.emplaceBack(s,l,u),a}addTriangle(e,t,i){this.outIndices.emplaceBack(e,t,i)}addTriangles(e,t,i,r=0){if(0===e.length)return;const n=c(),o=c();for(let a=0;a<e.length;a+=3){const s=t[e[a+0]],l=t[e[a+1]],u=t[e[a+2]],c=i[e[a+1]]+r,h=i[e[a+2]]+r;f(n,s.x,s.y,i[e[a+0]]+r);const d=this.addVertex(n,o);f(n,l.x,l.y,c);const p=this.addVertex(n,o);f(n,u.x,u.y,h);const m=this.addVertex(n,o);this.outIndices.emplaceBack(d,p,m)}}addQuad(e,t,i,r,n,o){const a=this.addVertex(e,n,o),s=this.addVertex(t,n,o),l=this.addVertex(i,n,o),u=this.addVertex(r,n,o);this.addTriangle(a,s,l),this.addTriangle(l,u,a)}getVertexCount(){return this.outPositions.length}clearVertexLookup(){this.vertexLookup.clear()}}class ElevatedStructures{constructor(e,t,i,r){this.unevaluatedPortals=new ElevationPortalGraph,this.bridgeFeatureSections=[],this.tunnelFeatureSections=[],this.vertexHashLookup=new Map,this.unevalVertices=[],this.unevalHeights=[],this.unevalTriangles=[],this.unevalTunnelTriangles=[],this.unevalEdges=[],this.vertexPositions=new StructArrayLayout2i1f8,this.vertexNormals=new StructArrayLayout3i8,this.indexArray=new StructArrayLayout3ui6,this.tileToMeters=fa(e),this.bridgeProgramConfigurations=new ProgramConfigurationSet(t,{zoom:i,lut:r},e=>"fill-tunnel-structure-color"!==e),this.tunnelProgramConfigurations=new ProgramConfigurationSet(t,{zoom:i,lut:r},e=>"fill-bridge-guard-rail-color"!==e)}addVertices(e,t){const i=this.unevalVertices.length;for(let i=0;i<e.length;i++)this.unevalVertices.push(e[i]),this.unevalHeights.push(t[i]);return i}addTriangles(e,t,i){const r=i?this.unevalTunnelTriangles:this.unevalTriangles;for(const i of e)r.push(i+t)}addRenderableRing(e,t,i,r,n,o){const a=[new K(n.min.x,n.min.y),new K(n.max.x,n.min.y),new K(n.max.x,n.max.y),new K(n.min.x,n.max.y)];for(let s=0;s<i-1;s++){const i=t+s,l=i+1,u=this.unevalVertices[i],c=this.unevalVertices[l];if(!(u.x>=n.min.x&&u.x<=n.max.x&&u.y>=n.min.y&&u.y<=n.max.y||c.x>=n.min.x&&c.x<=n.max.x&&c.y>=n.min.y&&c.y<=n.max.y||_s(u,c,a)))continue;if(this.isOnBorder(u.x,c.x)||this.isOnBorder(u.y,c.y))continue;const h=ElevatedStructures.computeEdgeHash(this.unevalVertices[i],this.unevalVertices[l]);let d,p=this.vertexHashLookup.get(ElevatedStructures.computePosHash(u));null!=p?d=p.next:(p=this.vertexHashLookup.get(ElevatedStructures.computePosHash(c)),d=null!=p?p.prev:h),this.unevalEdges.push({polygonIdx:e,a:i,b:l,hash:h,portalHash:d,isTunnel:r,type:"unevaluated",featureInfo:o})}}addPortalCandidates(e,t,i,r,n){if(0!==t.length){this.vertexHashLookup.clear();for(const n of t){if(0===n.length)continue;const t=n[0];let o=ElevatedStructures.computeEdgeHash(t[t.length-2],t.at(-1));for(let n=0;n<t.length-1;n++){const a=t[n+0],s=t[n+1],l=j(s.x-a.x,s.y-a.y),u=Z(l);if(0===u)continue;let c="unevaluated";const h=r.pointElevation(a),d=r.pointElevation(s);Math.abs(h)<.01&&Math.abs(d)<.01?c="entrance":(this.isOnBorder(a.x,s.x)||this.isOnBorder(a.y,s.y))&&(c="border");const p=ElevatedStructures.computeEdgeHash(a,s);this.unevaluatedPortals.portals.push({connection:{a:e,b:void 0},va:a,vb:s,vab:l,length:u,hash:p,isTunnel:i,type:c});const f=ElevatedStructures.computePosHash(a);this.vertexHashLookup.has(f)||this.vertexHashLookup.set(f,{prev:o,next:p}),o=p}}}}construct(e){if(0===this.unevalVertices.length)return;const t=()=>({vertexOffset:0,primitiveOffset:this.indexArray.length}),i=e=>{e.primitiveLength=this.indexArray.length-e.primitiveOffset},r=new MeshBuilder(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(e.portals,this.unevalEdges);const n=t(),o=t(),a=t(),s=(e,t)=>{e.sort((e,i)=>e.type===t&&i.type!==t?-1:e.type!==t&&i.type===t?1:0);const i=e.findIndex(e=>e.type!==t);return i>=0?i:e.length};let l=0;this.unevalEdges.length>0&&(l=s(this.unevalEdges,"none"),this.constructBridgeStructures(r,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:l},this.tileToMeters)),i(a);const u=t(),c=t();if(this.unevalEdges.length>0){const e=this.unevalEdges.splice(l),t=s(e,"tunnel")+l;this.unevalEdges.push(...e),this.constructTunnelStructures(r,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:l},{min:l,max:t})}i(u),r.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),i(c),r.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),i(o),r.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights,4),i(n),this.maskSegments=SegmentVector.simpleSegment(0,c.primitiveOffset,0,c.primitiveLength),this.depthSegments=SegmentVector.simpleSegment(0,o.primitiveOffset,0,o.primitiveLength),this.renderableBridgeSegments=SegmentVector.simpleSegment(0,a.primitiveOffset,0,a.primitiveLength),this.renderableTunnelSegments=SegmentVector.simpleSegment(0,u.primitiveOffset,0,u.primitiveLength),this.shadowCasterSegments=SegmentVector.simpleSegment(0,n.primitiveOffset,0,n.primitiveLength)}update(e,t,i,r,n,o,a,s){this.bridgeProgramConfigurations.updatePaintArrays(e,t,n,i,r,o,a,s),this.tunnelProgramConfigurations.updatePaintArrays(e,t,n,i,r,o,a,s)}upload(e){this.vertexBuffer||0===this.vertexPositions.length||0===this.vertexNormals.length||0===this.indexArray.length||(this.vertexBuffer=e.createVertexBuffer(this.vertexPositions,za.members),this.vertexBufferNormal=e.createVertexBuffer(this.vertexNormals,Ma.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.bridgeProgramConfigurations.upload(e),this.tunnelProgramConfigurations.upload(e))}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(e,t,i,r,n){const o=(o,a)=>{for(let s=0;s<a.length-1;s++){const l=a[s].featureIndex,u=a[s+1].vertexStart,c=e.feature(l);o.populatePaintArrays(u,c,l,{},i,t,r,void 0,n)}};o(this.bridgeProgramConfigurations,this.bridgeFeatureSections),o(this.tunnelProgramConfigurations,this.tunnelFeatureSections)}computeVertexConnections(e,t,i,r,n){const o=new Map;for(let a=r;a<n;a++){const r=i[a],n=r.a,s=r.b,l=ElevatedStructures.computePosHash(e[n]),u=ElevatedStructures.computePosHash(e[s]);let c=o.get(l);c||(c={},o.set(l,c));let h=o.get(u);h||(h={},o.set(u,h)),t[n]<=0&&t[s]<=0||(c.to=s,h.from=n)}return o}isTerminalVertex(e,t){const i=ElevatedStructures.computePosHash(this.unevalVertices[e]),r=t.get(i);return!r||!r.from||!r.to}constructBridgeStructures(e,t,i,r,n,o){e.clearVertexLookup();const a=this.computeVertexConnections(t,i,r,n.min,n.max),s=1/o,l=.5*s,u=(e,r)=>f(e,t[r].x,t[r].y,i[r]*s),h=c(),d=c(),p=c(),_=c(),g=c(),y=(e,i)=>{const r=a.get(ElevatedStructures.computePosHash(t[i])),n=r.from,o=r.to;if(!n||!o)return;u(h,n),u(d,i),u(p,o),function(e){e[0]=0,e[1]=0,e[2]=0}(_),M(h,d)||(R(g,d,h),E(_,g)),M(p,d)||(R(g,p,d),m(_,_,E(g,g)));const s=L(_);return s>0?x(e,_,1/s):void 0};let v=Number.POSITIVE_INFINITY;this.sortSubarray(r,n.min,n.max,(e,t)=>e.featureInfo.featureIndex-t.featureInfo.featureIndex);const b=c(),w=c(),I=c(),P=c(),T=c(),z=c(),C=c(),F=c(),B=c(),O=[c(),c(),c(),c()],V=[c(),c(),c(),c()],k=[{coord:new K(0,0),height:0},{coord:new K(0,0),height:0}],N=(e,t)=>e>t;for(let u=n.min;u<n.max;u++){const n=r[u];if(!n.featureInfo.guardRailEnabled)continue;if(!this.prepareEdgePoints(k,t,i,n,N))continue;const[c,h]=k;if(f(b,c.coord.x,c.coord.y,s*c.height),f(w,h.coord.x,h.coord.y,s*h.height),M(b,w))continue;R(I,w,b),E(I,I);const d=y(F,n.a)||I,p=y(B,n.b)||I;f(P,d[1],-d[0],0),E(P,P),f(T,p[1],-p[0],0),E(T,T),D(F,P,d),E(z,F),D(F,T,p),E(C,F),m(O[0],b,x(F,R(F,P,z),l)),m(O[1],b,x(F,m(F,P,z),l)),m(O[2],b,x(F,z,l)),O[3]=b,m(V[0],w,x(F,R(F,T,C),l)),m(V[1],w,x(F,m(F,T,C),l)),m(V[2],w,x(F,C,l)),V[3]=w,v=this.addFeatureSection(n.featureInfo.featureIndex,v,this.bridgeFeatureSections,e);const _=e.addVertex(O[0],P,o),g=e.addVertex(O[1],P,o),L=e.addVertex(V[0],T,o),U=e.addVertex(V[1],T,o);e.addTriangle(_,g,L),e.addTriangle(g,U,L);const G=e.addVertex(O[1],z,o),j=e.addVertex(O[2],z,o),$=e.addVertex(V[1],C,o),W=e.addVertex(V[2],C,o);e.addTriangle(G,j,$),e.addTriangle(j,W,$),A(P,P),A(T,T);const X=e.addVertex(O[2],P,o),q=e.addVertex(O[3],P,o),Z=e.addVertex(V[2],T,o),Y=e.addVertex(V[3],T,o);e.addTriangle(X,q,Z),e.addTriangle(q,Y,Z);const J=this.isTerminalVertex(n.a,a),K=this.isTerminalVertex(n.b,a);c.height<.01&&J&&e.addQuad(O[3],O[2],O[1],O[0],A(d,d),o),h.height<.01&&K&&e.addQuad(V[0],V[1],V[2],V[3],p,o)}this.bridgeFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}constructTunnelStructures(e,t,i,r,n,o){e.clearVertexLookup();let a=Number.POSITIVE_INFINITY;const s=(e,t)=>e.featureInfo.featureIndex-t.featureInfo.featureIndex;this.sortSubarray(r,n.min,n.max,s),this.sortSubarray(r,o.min,o.max,s);const l=e=>E(e,e),u=[{coord:new K(0,0),height:0},{coord:new K(0,0),height:0}],h=(e,t)=>e<t,d=c(),p=c(),m=c(),_=c(),g=c();for(let o=n.min;o<n.max;o++){if(!this.prepareEdgePoints(u,t,i,r[o],h))continue;const[n,s]=u,c=l(f(g,-(s.coord.y-n.coord.y),s.coord.x-n.coord.x,0));a=this.addFeatureSection(r[o].featureInfo.featureIndex,a,this.tunnelFeatureSections,e),e.addQuad(f(d,n.coord.x,n.coord.y,n.height),f(p,s.coord.x,s.coord.y,s.height),f(m,s.coord.x,s.coord.y,r[o].isTunnel?s.height+4:0),f(_,n.coord.x,n.coord.y,r[o].isTunnel?n.height+4:0),c)}for(let n=o.min;n<o.max;n++){const o=r[n];o.isTunnel&&([o.a,o.b]=[o.b,o.a]);const s=t[o.a],u=t[o.b],c=l(f(g,-(u.y-s.y),u.x-s.x,0));a=this.addFeatureSection(o.featureInfo.featureIndex,a,this.tunnelFeatureSections,e),e.addQuad(f(d,u.x,u.y,0),f(p,s.x,s.y,0),f(m,s.x,s.y,i[o.a]+4),f(_,u.x,u.y,i[o.b]+4),c),e.addQuad(f(d,s.x,s.y,0),f(p,u.x,u.y,0),f(m,u.x,u.y,i[o.b]+4),f(_,s.x,s.y,i[o.a]+4),c)}this.tunnelFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}setElevatedPoint(e,t,i,r){e.coord.x=t,e.coord.y=i,e.height=r}prepareEdgePoints(e,t,i,r,n){let o=t[r.a].x,a=t[r.a].y,s=t[r.b].x,l=t[r.b].y,u=i[r.a],c=i[r.b];const h=n(u,0),d=n(c,0);if(h&&d)return this.setElevatedPoint(e[0],o,a,u),this.setElevatedPoint(e[1],s,l,c),!0;if(!h&&!d)return!1;if(h){if(!d){const e=c/(c-u);s=rt(s,o,e),l=rt(l,a,e),c=rt(c,u,e)}}else{const e=u/(u-c);o=rt(o,s,e),a=rt(a,l,e),u=rt(u,c,e)}return this.setElevatedPoint(e[0],o,a,u),this.setElevatedPoint(e[1],s,l,c),!0}prepareEdges(e,t){if(0===t.length)return;t.sort((e,t)=>e.hash===t.hash?t.polygonIdx-e.polygonIdx:t.hash>e.hash?1:-1);let i=0,r=0,n=0,o=t[i].polygonIdx;do{r++,(r===t.length||t[i].hash!==t[r].hash)&&((1===r-i||t[r-1].polygonIdx!==o)&&(n<i&&(t[n]=t[i],t[i]=null),t[n].type="none",n++),i=r,i!==t.length&&(o=t[i].polygonIdx))}while(i!==t.length);if(t.splice(n),0!==t.length&&0!==e.length){t.sort((e,t)=>e.portalHash<t.portalHash?1:-1);let i=0,r=0;for(;i!==t.length&&r!==e.length;){const n=t[i],o=e[r];n.portalHash>o.hash?i++:o.hash>n.portalHash?r++:(n.type=o.type,i++)}}}isOnBorder(e,t){return e<=0&&t<=0||e>=Xt&&t>=Xt}addFeatureSection(e,t,i,r){return e!==t&&(t=e,i.push({featureIndex:e,vertexStart:r.getVertexCount()}),r.clearVertexLookup()),t}sortSubarray(e,t,i,r){const n=e.slice(t,i);n.sort(r),e.splice(t,n.length,...n)}static computeEdgeHash(e,t){return(e.y===t.y&&e.x>t.x||e.y>t.y)&&([e,t]=[t,e]),BigInt(ElevatedStructures.computePosHash(e))<<32n|BigInt(ElevatedStructures.computePosHash(t))}static computePosHash(e){return((65535&e.x)<<16|65535&e.y)>>>0}}class PropertyParser{constructor(){this._valid=!1}reset(e){return this.feature=e,this._valid=!0,this._geometry=e.loadGeometry(),0!==this._geometry.length&&0!==this._geometry[0].length||(this._valid=!1),this}geometry(e,t){return this._valid&&e(t(this._geometry)),this}require(e,t,i){return this.get(e,!0,t,i)}optional(e,t,i){return this.get(e,!1,t,i)}success(){return this._valid}get(e,t,i,r){const n=Object.hasOwn(this.feature.properties,e)?+this.feature.properties[e]:void 0;return this._valid&&void 0!==n&&!Number.isNaN(n)?i(r?r(n):n):t&&(this._valid=!1),this}}class VersionSchema{constructor(e,t){this.featureFunc=e,this.vertexFunc=t}parseFeature(e,t,i){return this.featureFunc(e,t,i)}parseVertex(e,t,i){return this.vertexFunc(e,t,i)}}const tc=new VersionSchema((e,t,i)=>e.reset(t).require(Ds,e=>{i.id=e}).optional("fixed_height_relative",e=>{i.constantHeight=e},ElevationFeatureParser.decodeRelativeHeight).geometry(e=>{i.bounds=e},fe).success(),(e,t,i)=>e.reset(t).require(Ds,e=>{i.id=e}).require("elevation_idx",e=>{i.idx=e}).require("extent",e=>{i.extent=e}).require("height_relative",e=>{i.height=e},ElevationFeatureParser.decodeRelativeHeight).geometry(e=>{i.position=e},ElevationFeatureParser.getPoint).success()),ic=new VersionSchema((e,t,i)=>e.reset(t).require(Ds,e=>{i.id=e}).optional("fixed_height",e=>{i.constantHeight=e},ElevationFeatureParser.decodeMetricHeight).geometry(e=>{i.bounds=e},fe).success(),(e,t,i)=>e.reset(t).require(Ds,e=>{i.id=e}).require("elevation_idx",e=>{i.idx=e}).require("extent",e=>{i.extent=e}).require("height",e=>{i.height=e},ElevationFeatureParser.decodeMetricHeight).geometry(e=>{i.position=e},ElevationFeatureParser.getPoint).success());class ElevationFeatureParser{static getPoint(e){return j(e[0][0].x,e[0][0].y)}static decodeRelativeHeight(e){return 1e-4*e*5}static decodeMetricHeight(e){return 1e-4*e}static getVersionSchema(e){return e?"1.0.1"===e?ic:void 0:tc}static parse(e){const t=[],i=[],r=e.length,n=new PropertyParser;for(let o=0;o<r;o++){const r=e.feature(o),a=r.properties.version,s=ElevationFeatureParser.getVersionSchema(a);if(void 0===s){ze(`Unknown elevation feature version number ${a||"(unknown)"}`);continue}const l=r.properties.type;if(!l)continue;const u=VectorTileFeature.types[r.type];if("Point"===u&&"curve_point"===l){const e={};s.parseVertex(n,r,e)&&t.push(e)}else if("Polygon"===u&&"curve_meta"===l){const e={};s.parseFeature(n,r,e)&&i.push(e)}}return{vertices:t,features:i}}}const rc=[G(),G(),G(),G(),G(),G(),G()],nc=G(),oc=G();function ac(e){return[e[0],e[1]]}function sc(e){return j(e[0],e[1])}class EdgeIterator{constructor(e,t,i=null){this.feature=e,this.metersToTile=t,this.sampler=i,this.index=0}get(){const e=this.feature.vertices[this.index],t=this.feature.vertexProps[this.index].dir,i=t[1],r=-t[0],n=(e.extent+1)*this.metersToTile,o=this.sampler?this.sampler.pointTransform(e.position):e.position;return[new K(Math.trunc(o[0]+i*n),Math.trunc(o[1]+r*n)),new K(Math.trunc(o[0]-i*n),Math.trunc(o[1]-r*n))]}next(){this.index++}valid(){return this.index<this.feature.vertices.length}}class ElevationFeature{constructor(e,t,i,r,n,o){if(this.vertices=new Array,this.vertexProps=new Array,this.edges=new Array,this.edgeProps=new Array,this.id=e,this.heightRange={min:i,max:i},this.safeArea=t,this.constantHeight=i,null==this.constantHeight&&(null!=this.constantHeight||0!==r.length)){this.vertices=r,this.edges=n;for(let e=0;e<this.vertices.length;e++)this.vertices[e].index=void 0!==this.vertices[e].index?this.vertices[e].index:e;this.edges=this.edges.filter(e=>{return e.a<this.vertices.length&&e.b<this.vertices.length&&!((t=this.vertices[e.a].position)[0]===(i=this.vertices[e.b].position)[0]&&t[1]===i[1]);var t,i}),this.heightRange={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};for(const e of this.vertices)this.vertexProps.push({dir:j(0,0)}),this.heightRange.min=Math.min(this.heightRange.min,e.height),this.heightRange.max=Math.max(this.heightRange.max,e.height);for(const e of this.edges){const t=this.vertices[e.a].position,i=this.vertices[e.b].position,r=X(G(),i,t),n=Z(r),o=q(G(),r,1/n);this.edgeProps.push({vec:r,dir:o,len:n});const a=this.vertexProps[e.a].dir,s=this.vertexProps[e.b].dir;W(a,a,o),W(s,s,o)}for(const e of this.vertexProps)0===e.dir[0]&&0===e.dir[1]||Y(e.dir,e.dir);this.tessellate(o)}}pointElevation(e){if(null!=this.constantHeight)return this.constantHeight;const t=this.getClosestEdge(e);if(null==t)return 0;const[i,r]=t;return rt(this.vertices[this.edges[i].a].height,this.vertices[this.edges[i].b].height,r)}computeSlopeNormal(e,t){const i=this.getClosestEdge(e);if(!i)return p(0,0,1);const r=i[0],n=this.edges[r],o=this.edgeProps[r].vec,a=p(o[0],o[1],(this.vertices[n.b].height-this.vertices[n.a].height)*t),s=p(a[1],-a[0],0);D(s,s,a);const l=d(s);return l>0?x(s,s,1/l):f(s,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(e){if(0===this.edges.length)return;let t=0,i=Number.POSITIVE_INFINITY,r=0;const[n,o,a,s,l,u,c]=rc;$(c,e.x,e.y);const h=new Ray2D(c,null);for(let e=0;e<this.edges.length;e++){const d=this.edges[e],p=this.edgeProps[e].dir;h.dir=p;const f=this.vertices[d.a].position,m=this.vertices[d.b].position,_=h.intersectsPlane(f,this.vertexProps[d.a].dir,n),g=h.intersectsPlane(m,this.vertexProps[d.b].dir,o);if(!_||!g)continue;X(a,o,n),X(s,c,n);const y=J(a,a),x=y>0?J(s,a)/y:0,v=ve(x,0,1),b=Math.abs((x-v)*this.edgeProps[e].len);X(l,c,f),$(u,p[1],-p[0]);const w=b+Math.abs(J(l,u));w<i&&(t=e,i=w,r=v)}return[t,r]}tessellate(e){const t=c(),i=c(),r=c(),n=c();for(let o=this.edges.length-1;o>=0;--o){const a=this.edges[o].a,s=this.edges[o].b,{position:l,height:u,extent:c}=this.vertices[a],{position:h,height:d,extent:m}=this.vertices[s],_=this.vertexProps[a].dir,g=this.vertexProps[s].dir;if(f(t,l[0]/e,l[1]/e,u),f(i,h[0]/e,h[1]/e,d),f(r,_[1],-_[0],0),x(r,r,c),f(n,g[1],-g[0],0),x(n,n,m),this.distSqLines(p(t[0]+.5*r[0],t[1]+.5*r[1],t[2]+.5*r[2]),p(i[0]-.5*n[0],i[1]-.5*n[1],i[2]-.5*n[2]),p(t[0]-.5*r[0],t[1]-.5*r[1],t[2]-.5*r[2]),p(i[0]+.5*n[0],i[1]+.5*n[1],i[2]+.5*n[2]))<=.0025000000000000005)continue;const y=this.vertices.length,v=W(G(),l,h);this.vertices.push({position:q(v,v,.5),height:.5*(u+d),extent:.5*(c+m),index:.5*((void 0!==this.vertices[a].index?this.vertices[a].index:a)+(void 0!==this.vertices[s].index?this.vertices[s].index:s))});const b=W(G(),_,g);this.vertexProps.push({dir:Y(b,b)}),this.edges.splice(o,1),this.edgeProps.splice(o,1),this.edges.push({a,b:y}),this.edges.push({a:y,b:s});const w=X(G(),this.vertices[y].position,l),A=Z(w),E={vec:w,dir:q(G(),w,1/A),len:A};this.edgeProps.push(E),this.edgeProps.push(E)}}distSqLines(e,t,i,r){const n=_(c(),t,e),o=_(c(),r,i),a=_(c(),e,i),s=I(n,n),l=I(n,o),u=I(n,a),h=I(o,o),d=I(o,a),p=s*h-l*l;if(0===p)return w(P(n,i,r,I(a,o)/I(o,o)),e);const f=(s*d-l*u)/p;return w(P(n,e,t,(l*d-u*h)/p),P(o,i,r,f))}static serialize(e,t){const i={id:e.id,heightRange:{min:e.heightRange.min,max:e.heightRange.max},safeArea:(r=e.safeArea,{min:{x:r.min.x,y:r.min.y},max:{x:r.max.x,y:r.max.y}})};var r;return null!=e.constantHeight?(i.constantHeight=e.constantHeight,i):0===e.vertices.length?(i.vertices=[],i.vertexProps=[],i.edges=[],i.edgeProps=[],i):(i.vertices=e.vertices.map(e=>({position:ac(e.position),height:e.height,extent:e.extent,index:e.index})),i.vertexProps=e.vertexProps.map(e=>({dir:ac(e.dir)})),i.edges=e.edges.map(e=>({a:e.a,b:e.b})),i.edgeProps=e.edgeProps.map(e=>({vec:ac(e.vec),dir:ac(e.dir),len:e.len})),i)}static deserialize(e){const t=function(e){return{min:new K(e.min.x,e.min.y),max:new K(e.max.x,e.max.y)}}(e.safeArea);if(null!=e.constantHeight)return new ElevationFeature(e.id,t,e.constantHeight);if(!e.vertices||0===e.vertices.length){const i=Object.create(ElevationFeature.prototype);return i.id=e.id,i.constantHeight=void 0,i.heightRange={min:e.heightRange.min,max:e.heightRange.max},i.safeArea=t,i.vertices=[],i.vertexProps=[],i.edges=[],i.edgeProps=[],i}const i=Object.create(ElevationFeature.prototype);return i.id=e.id,i.constantHeight=void 0,i.heightRange={min:e.heightRange.min,max:e.heightRange.max},i.safeArea=t,i.vertices=e.vertices.map(e=>({position:sc(e.position),height:e.height,extent:e.extent,index:e.index})),i.vertexProps=(e.vertexProps||[]).map(e=>({dir:sc(e.dir)})),i.edges=(e.edges||[]).map(e=>({a:e.a,b:e.b})),i.edgeProps=(e.edgeProps||[]).map(e=>({vec:sc(e.vec),dir:sc(e.dir),len:e.len})),i}}class ElevationFeatures{static parseFrom(e,t){const i=ElevationFeatureParser.parse(e);if(!i)return[];let{vertices:r,features:n}=i;const o=1/fa(t);n.sort((e,t)=>e.id-t.id),r.sort((e,t)=>e.id-t.id||e.idx-t.idx),r=r.filter((e,t,i)=>t===i.findIndex(t=>t.id===e.id&&t.idx===e.idx));const a=new Array;let s=0;const l=r.length;for(const e of n){if(e.constantHeight){a.push(new ElevationFeature(e.id,e.bounds,e.constantHeight));continue}for(;s!==l&&r[s].id<e.id;)s++;if(s===l||r[s].id!==e.id)continue;const t=new Array,i=new Array,n=s;for(;s!==l&&r[s].id===e.id;){const e=r[s];if(t.push({position:e.position,height:e.height,extent:e.extent,index:e.idx}),s!==n&&r[s-1].idx===e.idx-1){const e=s-n;i.push({a:e-1,b:e})}s++}a.push(new ElevationFeature(e.id,e.bounds,void 0,t,i,o))}return a}}class ElevationFeatureSampler{constructor(e,t){this.zScale=1,this.xOffset=0,this.yOffset=0,e.equals(t)||(this.zScale=Math.pow(2,t.z-e.z),this.xOffset=(e.x*this.zScale-t.x)*Xt,this.yOffset=(e.y*this.zScale-t.y)*Xt)}pointTransform(e){return j(e[0]*this.zScale+this.xOffset,e[1]*this.zScale+this.yOffset)}pointTransformInPlace(e){e[0]=e[0]*this.zScale+this.xOffset,e[1]=e[1]*this.zScale+this.yOffset}constantElevation(e,t){if(null!=e.constantHeight)return this.computeBiasedHeight(e.constantHeight,t)}pointElevation(e,t,i){const r=this.constantElevation(t,i);return null!=r?r:(e.x=e.x*this.zScale+this.xOffset,e.y=e.y*this.zScale+this.yOffset,this.computeBiasedHeight(t.pointElevation(e),i))}computeBiasedHeight(e,t){return t<=0?e:e+t*be(0,t,e>=0?e:Math.abs(.5*e))}}function lc(e){if(0===e)return[0,0,0];const t=gr(e);return[t(),t(),t()]}function uc(e,t){let i=0,r=e.length-1;for(;i<=r;){const n=i+r>>1;e[n].feature.id<t?i=n+1:r=n-1}return i<e.length&&e[i].feature.id===t?i:-1}function cc(e,t,i,r){if(!e.properties)return;const n=+e.properties[Ds];if(Number.isNaN(n))return;if(t){const e=t.find(e=>e.id===n);if(e&&r)return{tileId:r,feature:e}}if(!i||0===i.length)return;const o=uc(i,n);if(!(o<0)){if(r)for(let e=o;e<i.length&&i[e].feature.id===n;e++)if(i[e].tileId.key===r.key)return i[e];return i[o]}}function hc(e,t){return e>t?1:e<t?-1:0}rn(ElevationFeature,"ElevationFeature");class SplayTree{constructor(e=hc,t=!1){this._compare=e,this._root=null,this._size=0,this._noDuplicates=!!t}rotateLeft(e){var t=e.right;t&&(e.right=t.left,t.left&&(t.left.parent=e),t.parent=e.parent),e.parent?e===e.parent.left?e.parent.left=t:e.parent.right=t:this._root=t,t&&(t.left=e),e.parent=t}rotateRight(e){var t=e.left;t&&(e.left=t.right,t.right&&(t.right.parent=e),t.parent=e.parent),e.parent?e===e.parent.left?e.parent.left=t:e.parent.right=t:this._root=t,t&&(t.right=e),e.parent=t}_splay(e){for(;e.parent;){var t=e.parent;t.parent?t.left===e&&t.parent.left===t?(this.rotateRight(t.parent),this.rotateRight(t)):t.right===e&&t.parent.right===t?(this.rotateLeft(t.parent),this.rotateLeft(t)):t.left===e&&t.parent.right===t?(this.rotateRight(t),this.rotateLeft(t)):(this.rotateLeft(t),this.rotateRight(t)):t.left===e?this.rotateRight(t):this.rotateLeft(t)}}splay(e){for(var t,i,r,n,o;e.parent;)(i=(t=e.parent).parent)&&i.parent?((r=i.parent).left===i?r.left=e:r.right=e,e.parent=r):(e.parent=null,this._root=e),n=e.left,o=e.right,e===t.left?(i&&(i.left===t?(t.right?(i.left=t.right,i.left.parent=i):i.left=null,t.right=i,i.parent=t):(n?(i.right=n,n.parent=i):i.right=null,e.left=i,i.parent=e)),o?(t.left=o,o.parent=t):t.left=null,e.right=t,t.parent=e):(i&&(i.right===t?(t.left?(i.right=t.left,i.right.parent=i):i.right=null,t.left=i,i.parent=t):(o?(i.left=o,o.parent=i):i.left=null,e.right=i,i.parent=e)),n?(t.right=n,n.parent=t):t.right=null,e.left=t,t.parent=e)}replace(e,t){e.parent?e===e.parent.left?e.parent.left=t:e.parent.right=t:this._root=t,t&&(t.parent=e.parent)}minNode(e=this._root){if(e)for(;e.left;)e=e.left;return e}maxNode(e=this._root){if(e)for(;e.right;)e=e.right;return e}insert(e,t){var i=this._root,r=null,n=this._compare;if(this._noDuplicates)for(;i;){if(r=i,0===n(i.key,e))return;i=n(i.key,e)<0?i.right:i.left}else for(;i;)r=i,i=n(i.key,e)<0?i.right:i.left;return i={key:e,data:t,left:null,right:null,parent:r},r?n(r.key,i.key)<0?r.right=i:r.left=i:this._root=i,this.splay(i),this._size++,i}find(e){for(var t=this._root,i=this._compare;t;){var r=i(t.key,e);if(r<0)t=t.right;else{if(!(r>0))return t;t=t.left}}return null}contains(e){for(var t=this._root,i=this._compare;t;){var r=i(e,t.key);if(0===r)return!0;t=r<0?t.left:t.right}return!1}remove(e){var t=this.find(e);if(!t)return!1;if(this.splay(t),t.left)if(t.right){var i=this.minNode(t.right);i.parent!==t&&(this.replace(i,i.right),i.right=t.right,i.right.parent=i),this.replace(t,i),i.left=t.left,i.left.parent=i}else this.replace(t,t.left);else this.replace(t,t.right);return this._size--,!0}removeNode(e){if(!e)return!1;if(this.splay(e),e.left)if(e.right){var t=this.minNode(e.right);t.parent!==e&&(this.replace(t,t.right),t.right=e.right,t.right.parent=t),this.replace(e,t),t.left=e.left,t.left.parent=t}else this.replace(e,e.left);else this.replace(e,e.right);return this._size--,!0}erase(e){var t=this.find(e);if(t){this.splay(t);var i=t.left,r=t.right,n=null;i&&(i.parent=null,n=this.maxNode(i),this.splay(n),this._root=n),r&&(i?n.right=r:this._root=r,r.parent=n),this._size--}}pop(){var e=this._root,t=null;if(e){for(;e.left;)e=e.left;t={key:e.key,data:e.data},this.remove(e.key)}return t}next(e){var t=e;if(t)if(t.right)for(t=t.right;t&&t.left;)t=t.left;else for(t=e.parent;t&&t.right===e;)e=t,t=t.parent;return t}prev(e){var t=e;if(t)if(t.left)for(t=t.left;t&&t.right;)t=t.right;else for(t=e.parent;t&&t.left===e;)e=t,t=t.parent;return t}forEach(e){for(var t=this._root,i=[],r=!1,n=0;!r;)t?(i.push(t),t=t.left):i.length>0?(e(t=i.pop(),n++),t=t.right):r=!0;return this}range(e,t,i,r){const n=[],o=this._compare;let a,s=this._root;for(;0!==n.length||s;)if(s)n.push(s),s=s.left;else{if(s=n.pop(),a=o(s.key,t),a>0)break;if(o(s.key,e)>=0&&i.call(r,s))return this;s=s.right}return this}keys(){for(var e=this._root,t=[],i=[],r=!1;!r;)e?(t.push(e),e=e.left):t.length>0?(e=t.pop(),i.push(e.key),e=e.right):r=!0;return i}values(){for(var e=this._root,t=[],i=[],r=!1;!r;)e?(t.push(e),e=e.left):t.length>0?(e=t.pop(),i.push(e.data),e=e.right):r=!0;return i}at(e){for(var t=this._root,i=[],r=!1,n=0;!r;)if(t)i.push(t),t=t.left;else if(i.length>0){if(t=i.pop(),n===e)return t;n++,t=t.right}else r=!0;return null}load(e=[],t=[],i=!1){if(0!==this._size)throw new Error("bulk-load: tree is not empty");const r=e.length;return i&&pc(e,t,0,r-1,this._compare),this._root=dc(null,e,t,0,r),this._size=r,this}min(){var e=this.minNode(this._root);return e?e.key:null}max(){var e=this.maxNode(this._root);return e?e.key:null}isEmpty(){return null===this._root}get size(){return this._size}static createTree(e,t,i,r,n){return new SplayTree(i,n).load(e,t,r)}}function dc(e,t,i,r,n){const o=n-r;if(o>0){const a=r+Math.floor(o/2),s={key:t[a],data:i[a],parent:e};return s.left=dc(s,t,i,r,a),s.right=dc(s,t,i,a+1,n),s}return null}function pc(e,t,i,r,n){if(i>=r)return;const o=e[i+r>>1];let a=i-1,s=r+1;for(;;){do{a++}while(n(e[a],o)<0);do{s--}while(n(e[s],o)>0);if(a>=s)break;let i=e[a];e[a]=e[s],e[s]=i,i=t[a],t[a]=t[s],t[s]=i}pc(e,t,i,s,n),pc(e,t,s+1,r,n)}const fc=11102230246251565e-32,mc=134217729,_c=(3+8*fc)*fc;function gc(e,t,i,r,n){let o,a,s,l,u=t[0],c=r[0],h=0,d=0;c>u==c>-u?(o=u,u=t[++h]):(o=c,c=r[++d]);let p=0;if(h<e&&d<i)for(c>u==c>-u?(a=u+o,s=o-(a-u),u=t[++h]):(a=c+o,s=o-(a-c),c=r[++d]),o=a,0!==s&&(n[p++]=s);h<e&&d<i;)c>u==c>-u?(a=o+u,l=a-o,s=o-(a-l)+(u-l),u=t[++h]):(a=o+c,l=a-o,s=o-(a-l)+(c-l),c=r[++d]),o=a,0!==s&&(n[p++]=s);for(;h<e;)a=o+u,l=a-o,s=o-(a-l)+(u-l),u=t[++h],o=a,0!==s&&(n[p++]=s);for(;d<i;)a=o+c,l=a-o,s=o-(a-l)+(c-l),c=r[++d],o=a,0!==s&&(n[p++]=s);return 0===o&&0!==p||(n[p++]=o),p}function yc(e){return new Float64Array(e)}const xc=yc(4),vc=yc(8),bc=yc(12),wc=yc(16),Ac=yc(4);function Ec(e,t,i){null===t?(e.inOut=!1,e.otherInOut=!0):(e.isSubject===t.isSubject?(e.inOut=!t.inOut,e.otherInOut=t.otherInOut):(e.inOut=!t.otherInOut,e.otherInOut=t.isVertical()?!t.inOut:t.inOut),t&&(e.prevInResult=!Ic(t,i)||t.isVertical()?t.prevInResult:t)),e.resultTransition=Ic(e,i)?function(e,t){let i,r=!e.inOut,n=!e.otherInOut;switch(t){case 0:i=r&&n;break;case 1:i=r||n;break;case 3:i=r!==n;break;case 2:i=e.isSubject?r&&!n:n&&!r}return i?1:-1}(e,i):0}function Ic(e,t){switch(e.type){case 0:switch(t){case 0:return!e.otherInOut;case 1:return e.otherInOut;case 2:return e.isSubject&&e.otherInOut||!e.isSubject&&!e.otherInOut;case 3:return!0}break;case 2:return 0===t||1===t;case 3:return 2===t;case 1:return!1}return!1}class S{constructor(e,t,i,r,n){this.left=t,this.point=e,this.otherEvent=i,this.isSubject=r??!1,this.type=n||0,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0}isBelow(e){const t=this.point,i=this.otherEvent.point;return this.left?(t[0]-e[0])*(i[1]-e[1])-(i[0]-e[0])*(t[1]-e[1])>0:(i[0]-e[0])*(t[1]-e[1])-(t[0]-e[0])*(i[1]-e[1])>0}isAbove(e){return!this.isBelow(e)}isVertical(){return this.point[0]===this.otherEvent.point[0]}get inResult(){return 0!==this.resultTransition}clone(){const e=new S(this.point,this.left,this.otherEvent,this.isSubject,this.type);return e.contourId=this.contourId,e.resultTransition=this.resultTransition,e.prevInResult=this.prevInResult,e.isExteriorRing=this.isExteriorRing,e.inOut=this.inOut,e.otherInOut=this.otherInOut,e}}function Sc(e,t){return e[0]===t[0]&&e[1]===t[1]}function Dc(e,t,i){const r=function(e,t,i,r,n,o){const a=(t-o)*(i-n),s=(e-n)*(r-o),l=a-s;if(0===a||0===s||a>0!=s>0)return l;const u=Math.abs(a+s);return Math.abs(l)>=33306690738754716e-32*u?l:-function(e,t,i,r,n,o,a){let s,l,u,c,h,d,p,f,m,_,g,y,x,v,b,w,A,E;const I=e-n,D=i-n,P=t-o,T=r-o;v=I*T,d=mc*I,p=d-(d-I),f=I-p,d=mc*T,m=d-(d-T),_=T-m,b=f*_-(v-p*m-f*m-p*_),w=P*D,d=mc*P,p=d-(d-P),f=P-p,d=mc*D,m=d-(d-D),_=D-m,A=f*_-(w-p*m-f*m-p*_),g=b-A,h=b-g,xc[0]=b-(g+h)+(h-A),y=v+g,h=y-v,x=v-(y-h)+(g-h),g=x-w,h=x-g,xc[1]=x-(g+h)+(h-w),E=y+g,h=E-y,xc[2]=y-(E-h)+(g-h),xc[3]=E;let z=function(e,t){let i=t[0];for(let e=1;e<4;e++)i+=t[e];return i}(0,xc),M=22204460492503146e-32*a;if(z>=M||-z>=M)return z;if(h=e-I,s=e-(I+h)+(h-n),h=i-D,u=i-(D+h)+(h-n),h=t-P,l=t-(P+h)+(h-o),h=r-T,c=r-(T+h)+(h-o),0===s&&0===l&&0===u&&0===c)return z;if(M=11093356479670487e-47*a+_c*Math.abs(z),z+=I*c+T*s-(P*u+D*l),z>=M||-z>=M)return z;v=s*T,d=mc*s,p=d-(d-s),f=s-p,d=mc*T,m=d-(d-T),_=T-m,b=f*_-(v-p*m-f*m-p*_),w=l*D,d=mc*l,p=d-(d-l),f=l-p,d=mc*D,m=d-(d-D),_=D-m,A=f*_-(w-p*m-f*m-p*_),g=b-A,h=b-g,Ac[0]=b-(g+h)+(h-A),y=v+g,h=y-v,x=v-(y-h)+(g-h),g=x-w,h=x-g,Ac[1]=x-(g+h)+(h-w),E=y+g,h=E-y,Ac[2]=y-(E-h)+(g-h),Ac[3]=E;const C=gc(4,xc,4,Ac,vc);v=I*c,d=mc*I,p=d-(d-I),f=I-p,d=mc*c,m=d-(d-c),_=c-m,b=f*_-(v-p*m-f*m-p*_),w=P*u,d=mc*P,p=d-(d-P),f=P-p,d=mc*u,m=d-(d-u),_=u-m,A=f*_-(w-p*m-f*m-p*_),g=b-A,h=b-g,Ac[0]=b-(g+h)+(h-A),y=v+g,h=y-v,x=v-(y-h)+(g-h),g=x-w,h=x-g,Ac[1]=x-(g+h)+(h-w),E=y+g,h=E-y,Ac[2]=y-(E-h)+(g-h),Ac[3]=E;const R=gc(C,vc,4,Ac,bc);v=s*c,d=mc*s,p=d-(d-s),f=s-p,d=mc*c,m=d-(d-c),_=c-m,b=f*_-(v-p*m-f*m-p*_),w=l*u,d=mc*l,p=d-(d-l),f=l-p,d=mc*u,m=d-(d-u),_=u-m,A=f*_-(w-p*m-f*m-p*_),g=b-A,h=b-g,Ac[0]=b-(g+h)+(h-A),y=v+g,h=y-v,x=v-(y-h)+(g-h),g=x-w,h=x-g,Ac[1]=x-(g+h)+(h-w),E=y+g,h=E-y,Ac[2]=y-(E-h)+(g-h),Ac[3]=E;const L=gc(R,bc,4,Ac,wc);return wc[L-1]}(e,t,i,r,n,o,u)}(e[0],e[1],t[0],t[1],i[0],i[1]);return r>0?-1:r<0?1:0}function Pc(e,t){const i=e.point,r=t.point;return i[0]>r[0]?1:i[0]<r[0]?-1:i[1]!==r[1]?i[1]>r[1]?1:-1:function(e,t,i){return e.left!==t.left?e.left?1:-1:0!==Dc(i,e.otherEvent.point,t.otherEvent.point)?e.isBelow(t.otherEvent.point)?-1:1:!e.isSubject&&t.isSubject?1:-1}(e,t,i)}function Tc(e,t,i){const r=new S(t,!1,e,e.isSubject),n=new S(t,!0,e.otherEvent,e.isSubject);return Sc(e.point,e.otherEvent.point)&&console.warn("what is that, a collapsed segment?",e),r.contourId=n.contourId=e.contourId,Pc(n,e.otherEvent)>0&&(e.otherEvent.left=!0,n.left=!1),e.otherEvent.otherEvent=n,e.otherEvent=r,i.push(n),i.push(r),i}function zc(e,t){return e[0]*t[1]-e[1]*t[0]}function Mc(e,t){return e[0]*t[0]+e[1]*t[1]}function Cc(e,t,i){const r=function(e,t,i,r){const n=[t[0]-e[0],t[1]-e[1]],o=[r[0]-i[0],r[1]-i[1]];function a(e,t,i){return[e[0]+t*i[0],e[1]+t*i[1]]}const s=[i[0]-e[0],i[1]-e[1]];let l=zc(n,o),u=l*l;const c=Mc(n,n);if(u>0){const t=zc(s,o)/l;if(t<0||t>1)return null;const r=zc(s,n)/l;return r<0||r>1?null:0===t||1===t?[a(e,t,n)]:0===r||1===r?[a(i,r,o)]:[a(e,t,n)]}if(l=zc(s,n),u=l*l,u>0)return null;const h=Mc(n,s)/c,d=h+Mc(n,o)/c,p=Math.min(h,d),f=Math.max(h,d);return p<=1&&f>=0?1===p?[a(e,p>0?p:0,n)]:0===f?[a(e,f<1?f:1,n)]:[a(e,p>0?p:0,n),a(e,f<1?f:1,n)]:null}(e.point,e.otherEvent.point,t.point,t.otherEvent.point),n=r?r.length:0;if(0===n||1===n&&(Sc(e.point,t.point)||Sc(e.otherEvent.point,t.otherEvent.point))||2===n&&e.isSubject===t.isSubject)return 0;if(1===n)return!Sc(e.point,r[0])&&!Sc(e.otherEvent.point,r[0])&&Tc(e,r[0],i),!Sc(t.point,r[0])&&!Sc(t.otherEvent.point,r[0])&&Tc(t,r[0],i),1;const o=[];let a=!1,s=!1;return Sc(e.point,t.point)?a=!0:1===Pc(e,t)?o.push(t,e):o.push(e,t),Sc(e.otherEvent.point,t.otherEvent.point)?s=!0:1===Pc(e.otherEvent,t.otherEvent)?o.push(t.otherEvent,e.otherEvent):o.push(e.otherEvent,t.otherEvent),a&&s||a?(t.type=1,e.type=t.inOut===e.inOut?2:3,a&&!s&&Tc(o[1].otherEvent,o[0].point,i),2):s?(Tc(o[0],o[1].point,i),3):o[0]!==o[3].otherEvent?(Tc(o[0],o[1].point,i),Tc(o[1],o[2].point,i),3):(Tc(o[0],o[1].point,i),Tc(o[3].otherEvent,o[2].point,i),3)}function Rc(e,t){if(e===t)return 0;if(0!==Dc(e.point,e.otherEvent.point,t.point)||0!==Dc(e.point,e.otherEvent.point,t.otherEvent.point))return Sc(e.point,t.point)?e.isBelow(t.otherEvent.point)?-1:1:e.point[0]===t.point[0]?e.point[1]<t.point[1]?-1:1:1===Pc(e,t)?t.isAbove(e.point)?-1:1:e.isBelow(t.point)?-1:1;if(e.isSubject!==t.isSubject)return e.isSubject?-1:1;{let i=e.point,r=t.point;if(i[0]===r[0]&&i[1]===r[1])return i=e.otherEvent.point,r=t.otherEvent.point,i[0]===r[0]&&i[1]===r[1]?0:(e.contourId??0)>(t.contourId??0)?1:-1}return 1===Pc(e,t)?1:-1}class H{constructor(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null}isExterior(){return null==this.holeOf}}function Lc(e,t,i,r){let n,o=e+1,a=t[e].point;const s=t.length;for(o<s&&(n=t[o].point);o<s&&n[0]===a[0]&&n[1]===a[1];){if(!i[o])return o;o++,o<s&&(n=t[o].point)}for(o=e-1;i[o]&&o>r;)o--;return o}function Fc(e,t,i){const r=new H;if(null!=e.prevInResult){const n=e.prevInResult,o=n.outputContourId;if(n.resultTransition>0){const e=t[o];if(null!=e.holeOf){const n=e.holeOf;t[n].holeIds.push(i),r.holeOf=n,r.depth=t[o].depth}else t[o].holeIds.push(i),r.holeOf=o,r.depth=t[o].depth+1}else r.holeOf=null,r.depth=t[o].depth}else r.holeOf=null,r.depth=0;return r}const Bc=Math.max,Oc=Math.min;let Vc=0;function kc(e,t,i,r,n,o){let a,s,l,u,c,h;for(a=0,s=e.length-1;a<s;a++){if(l=e[a],u=e[a+1],c=new S(l,!1,void 0,t),h=new S(u,!1,c,t),c.otherEvent=h,l[0]===u[0]&&l[1]===u[1])continue;c.contourId=h.contourId=i,o||(c.isExteriorRing=!1,h.isExteriorRing=!1),Pc(c,h)>0?h.left=!0:c.left=!0;const s=l[0],d=l[1];n[0]=Oc(n[0],s),n[1]=Oc(n[1],d),n[2]=Bc(n[2],s),n[3]=Bc(n[3],d),r.push(c),r.push(h)}}const Nc=[];function Uc(e,t,i){let r=e,n=t;"number"==typeof e[0][0][0]&&(r=[e]),"number"==typeof t[0][0][0]&&(n=[t]);let o=function(e,t,i){let r=null;return e.length*t.length===0&&(0===i?r=Nc:2===i?r=e:(1===i||3===i)&&(r=0===e.length?t:e)),r}(r,n,i);if(o)return o===Nc?null:o;const a=[1/0,1/0,-1/0,-1/0],s=[1/0,1/0,-1/0,-1/0],l=function(e,t,i,r,n){const o=new TinyQueue(void 0,Pc);let a,s,l,u,c,h;for(l=0,u=e.length;l<u;l++)for(a=e[l],c=0,h=a.length;c<h;c++)s=0===c,s&&Vc++,kc(a[c],!0,Vc,o,i,s);for(l=0,u=t.length;l<u;l++)for(a=t[l],c=0,h=a.length;c<h;c++)s=0===c,2===n&&(s=!1),s&&Vc++,kc(a[c],!1,Vc,o,r,s);return o}(r,n,a,s,i);if(o=function(e,t,i,r,n){let o=null;return(i[0]>r[2]||r[0]>i[2]||i[1]>r[3]||r[1]>i[3])&&(0===n?o=Nc:2===n?o=e:(1===n||3===n)&&(o=e.concat(t))),o}(r,n,a,s,i),o)return o===Nc?null:o;const u=function(e,t,i,r,n,o){const a=new SplayTree(Rc),s=[],l=Math.min(r[2],n[2]);let u,c,h;for(;0!==e.length;){let t=e.pop();if(s.push(t),0===o&&t.point[0]>l||2===o&&t.point[0]>r[2])break;if(t.left){c=u=a.insert(t),h=a.minNode(),u=u!==h?a.prev(u):null,c=a.next(c);const i=u?u.key:null;let r;if(Ec(t,i,o),c&&2===Cc(t,c.key,e)&&(Ec(t,i,o),Ec(c.key,t,o)),u&&2===Cc(u.key,t,e)){let e=u;e=e!==h?a.prev(e):null,r=e?e.key:null,Ec(i,r,o),Ec(t,i,o)}}else t=t.otherEvent,c=u=a.find(t),u&&c&&(u=u!==h?a.prev(u):null,c=a.next(c),a.remove(t),c&&u&&Cc(u.key,c.key,e))}return s}(l,0,0,a,s,i),c=function(e){let t,i;const r=function(e){let t,i,r,n,o;const a=[];for(i=0,r=e.length;i<r;i++)t=e[i],(t.left&&t.inResult||!t.left&&t.otherEvent.inResult)&&a.push(t);let s=!1;for(;!s;)for(s=!0,i=0,r=a.length;i<r;i++)i+1<r&&1===Pc(a[i],a[i+1])&&(n=a[i],a[i]=a[i+1],a[i+1]=n,s=!1);for(i=0,r=a.length;i<r;i++)t=a[i],t.otherPos=i;for(i=0,r=a.length;i<r;i++)t=a[i],t.left||(o=t.otherPos,t.otherPos=t.otherEvent.otherPos,t.otherEvent.otherPos=o);return a}(e),n={},o=[];for(t=0,i=r.length;t<i;t++){if(n[t])continue;const e=o.length,i=Fc(r[t],o,e),a=t=>{n[t]=!0,t<r.length&&r[t]&&(r[t].outputContourId=e)};let s=t,l=t;for(i.points.push(r[t].point);a(s),s=r[s].otherPos,a(s),i.points.push(r[s].point),s=Lc(s,r,n,l),!(s==l||s>=r.length)&&r[s];);o.push(i)}return o}(u),h=[];for(let e=0;e<c.length;e++){let t=c[e];if(t.isExterior()){let e=[t.points];for(let i=0;i<t.holeIds.length;i++)e.push(c[t.holeIds[i]].points);h.push(e)}}return h}function Gc(e,t){const i=Uc(Hc(e),Hc([t]),0);return null==i?[]:Wc(i)}function jc(e,t,i=0){const r=65536;let n=Hc(e,r);const o=[];for(;t.valid();t.next()){const[e,n]=t.get();let a=e.x*r,s=e.y*r,l=n.x*r,u=n.y*r;const c=l-a,h=u-s,d=Math.hypot(c,h);if(0===d)continue;a-=c*i,s-=h*i,l+=c*i,u+=h*i;const p=Math.trunc(h/d*3),f=-Math.trunc(c/d*3);o.push([[[a,s],[l,u],[l+p,u+f],[a+p,s+f],[a,s]]])}return o.length>0&&(n=Uc(n,o,2)),Wc(n,1/r,.001)}function Hc(e,t=1){return[e.map(e=>e.map(e=>[e.x*t,e.y*t]))]}function $c(e,t){const i=Math.floor(e)+.5;return Math.abs(e-i)<=t?Math.round(i):Math.round(e)}class VertexCanonicalizer{constructor(e){this.xs=[],this.ys=[],this.ixs=[],this.iys=[],this.buckets=new Map,this.tolerance=e}canonicalize(e,t){const i=this.tolerance,r=Math.floor(e/i),n=Math.floor(t/i);for(let o=-1;o<=1;o++){const a=this.buckets.get(r+o);if(a)for(let o=-1;o<=1;o++){const s=a.get(n+o);if(s)for(const o of s)if(Math.abs(this.xs[o]-e)<=i&&Math.abs(this.ys[o]-t)<=i){const i=this.ixs[o],a=this.iys[o];return this.xs[o]===e&&this.ys[o]===t||this.store(e,t,i,a,r,n),[i,a]}}}const o=$c(e,i),a=$c(t,i);return this.store(e,t,o,a,r,n),[o,a]}store(e,t,i,r,n,o){const a=this.xs.length;this.xs.push(e),this.ys.push(t),this.ixs.push(i),this.iys.push(r);let s=this.buckets.get(n);s||(s=new Map,this.buckets.set(n,s));let l=s.get(o);l||(l=[],s.set(o,l)),l.push(a)}}function Wc(e,t=1,i){const r=null!=i?new VertexCanonicalizer(i):null;return e.map(e=>e.map((e,i)=>{const n=e.map(e=>{const i=e[0]*t,n=e[1]*t;if(r){const[e,t]=r.canonicalize(i,n);return new K(e,t)}return new K(Math.round(i),Math.round(n))});return i>0&&n.reverse(),n}))}class FrcSegmentData{constructor(){this.frcCoverage=new Set,this.featureTriSegments=[],this.frcPerLevel=new Map,this.frcNonRoadSegments=new SegmentVector}empty(){return 0===this.frcCoverage.size}}function Xc(e,t,i){if(0===e.frcCoverage.size||0===e.featureTriSegments.length)return;const r=i.get(),n=t.uint16,o=[];e.featureTriSegments.sort((e,t)=>e.segIdx!==t.segIdx?e.segIdx-t.segIdx:null===e.frc&&null===t.frc?0:null===e.frc?-1:null===t.frc?1:t.frc-e.frc);const a=new Map;let s=0,l=e.featureTriSegments[0].frc,u={vertexOffset:r[s].vertexOffset,primitiveOffset:0,vertexLength:r[s].vertexLength,primitiveLength:0,vaos:{},sortKey:void 0};const c=()=>{u.primitiveLength>0&&(a.has(l)||a.set(l,[]),a.get(l).push({...u}))};for(const t of e.featureTriSegments){t.segIdx!==s&&(c(),s=t.segIdx,l=t.frc,u={vertexOffset:r[s].vertexOffset,primitiveOffset:o.length/3,vertexLength:r[s].vertexLength,primitiveLength:0,vaos:{},sortKey:void 0}),t.frc!==l&&(c(),l=t.frc,u={...u,primitiveOffset:o.length/3,primitiveLength:0});for(let e=t.start;e<t.end;e++)o.push(n[e]);u.primitiveLength+=(t.end-t.start)/3}c();for(let e=0;e<o.length;e++)n[e]=o[e];for(const[t,i]of a)null!==t?e.frcPerLevel.set(t,new SegmentVector(i)):e.frcNonRoadSegments=new SegmentVector(i);e.featureTriSegments=[]}rn(FrcSegmentData,"FrcSegmentData");const qc={motorway:0,motorway_link:0,trunk:1,trunk_link:1,primary:2,primary_link:2,secondary:3,secondary_link:3,tertiary:4,tertiary_link:4,unclassified:5,unclassified_link:5,street:6,street_limited:6,residential:6,service:7,living_street:7,pedestrian:8,track:8,path:8,footway:8,cycleway:8,sidewalk:8,crossing:8};function Zc(e){for(const t of["class","incident_class"]){const i=e[t];if("string"!=typeof i)continue;const r=qc[i];if(void 0!==r)return r}return null}function Yc(e,t){const i=Zc(e);return null!==i&&!!(t&1<<i)}function Jc(e,t,i){for(const r of e)if(r.startsWith("(")){const e=r.indexOf(")");if(-1===e)continue;if(r.slice(1,e)===t&&r.slice(e+1)===i)return!0}else if(r===i)return!0;return!1}class FillHDExtension{constructor(e,t,i){this.elevationMode=t,t&&(this.elevationBufferData=new ElevatedFillBufferData(e.layers,e.zoom,e.lut)),i&&(this.frcData=new FrcSegmentData)}isEmpty(){const e=!this.elevationBufferData||this.elevationBufferData.isEmpty(),t=!this.frcData||this.frcData.empty();return e&&t}needsUpload(){return!!this.elevationBufferData&&this.elevationBufferData.needsUpload()}trackFeatureFrc(e){if(!this.frcData)return null;const t=Zc(e||{});return null!==t&&this.frcData.frcCoverage.add(t),t}recordFeatureRange(e,t,i,r){if(!this.frcData||i<=t)return;const n=e.bufferData.triangleSegments.get();this.frcData.featureTriSegments.push({start:3*t,end:3*i,segIdx:n.length>0?n.length-1:0,frc:r})}buildFrcSegments(e){this.frcData&&!this.frcData.empty()&&Xc(this.frcData,e.bufferData.indexArray,e.bufferData.triangleSegments)}handleFeature(e,t,i,r,n,o){const a=new Array;if(!this.elevationMode)return!1;const s=cc(e,n,void 0,r);if(!s)return!1;{const e=this.clipPolygonsToTile(t,1);e.length>0&&a.push({polygons:e,elevationFeature:s.feature,elevationTileID:s.tileId})}const l={guardRailEnabled:o.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(e,{},r),featureIndex:i};for(const t of a)if(t.elevationFeature){if("hd-road-base"===this.elevationMode){this.elevatedStructures||(this.elevatedStructures=new ElevatedStructures(t.elevationTileID,o.layers,o.zoom,o.lut));const i=t.elevationFeature.isTunnel();let r=0;Object.hasOwn(e.properties,Ps)&&(r=+e.properties[Ps]),this.elevatedStructures.addPortalCandidates(t.elevationFeature.id,t.polygons,i,t.elevationFeature,r)}null==t.elevationFeature.constantHeight&&(t.polygons=this.prepareElevatedPolygons(t.polygons,t.elevationFeature,t.elevationTileID));const n=new ElevationFeatureSampler(r,t.elevationTileID);this.addElevatedGeometry(o,t.polygons,n,t.elevationFeature,"hd-road-base"===this.elevationMode?0:.05,i,l)}return!0}populatePaintArrays(e,t,i,r,n,o,a){this.elevationBufferData&&this.elevationBufferData.populatePaintArrays(e,t,i,r,n,o,a)}update(e,t,i,r,n,o,a,s){this.elevationBufferData&&this.elevationBufferData.update(e,t,i,r,n,o,a,s),this.elevatedStructures&&this.elevatedStructures.update(e,t,i,r,n,o,a,s)}updateExpressions(e){this.elevationBufferData&&this.elevationBufferData.programConfigurations.updateExpressions(e),this.elevatedStructures&&(this.elevatedStructures.bridgeProgramConfigurations.updateExpressions(e),this.elevatedStructures.tunnelProgramConfigurations.updateExpressions(e))}upload(e){this.elevationBufferData&&this.elevationBufferData.upload(e),this.elevatedStructures&&this.elevatedStructures.upload(e)}destroy(){this.elevationBufferData&&this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}setEvaluatedPortalGraph(e,t,i,r,n,o){this.elevatedStructures&&(this.elevatedStructures.construct(e),this.elevatedStructures.populatePaintArrays(t,i,r,n,o))}addElevatedGeometry(e,t,i,r,n,o,a){const s={elevation:r,elevationSampler:i,bias:n,index:o,featureInfo:a},[l,u]=e.addGeometry(t,this.elevationBufferData,s,this.elevatedStructures);null==this.elevationBufferData.heightRange?this.elevationBufferData.heightRange={min:l,max:u}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,l),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,u))}prepareElevatedPolygons(e,t,i){const r=1/fa(i),n=[];for(const i of e){const e=jc(i,new EdgeIterator(t,r),.1);n.push(...e)}return n}clipPolygonsToTile(e,t){const i=-t,r=-t,n=Xt+t,o=Xt+t;let a=0;const s=[],l=[];for(;a<e.length;a++){const t=e[a],u=fe(t);(u.min.x>=i&&u.max.x<=n&&u.min.y>=r&&u.max.y<=o?s:l).push(t)}if(s.length===e.length)return e;const u=[new K(i,r),new K(n,r),new K(n,o),new K(i,o),new K(i,r)],c=s;for(const e of l)c.push(...Gc(e,u));return c}}function Kc(e,t){return e.nextPoint.sub(t.at(-2)).unit()}function Qc(e,t){return t[1].sub(e.prevPoint).unit()}rn(FillHDExtension,"FillHDExtension"),rn(ElevatedStructures,"ElevatedStructures");class LineHDExtension{constructor(e,t){this.elevationEnabled=e,this.hasDeferredElevationFeatures=!1,t&&(this.frcData=new FrcSegmentData)}isEmpty(){const e=!this.elevationEnabled||void 0===this.heightRange,t=!this.frcData||this.frcData.empty();return e&&t}trackFeatureFrc(e){if(!this.frcData)return null;const t=Zc(e||{});return null!==t&&this.frcData.frcCoverage.add(t),t}recordFeatureRange(e,t,i,r){if(!this.frcData||i<=t)return;const n=e.segments.get();this.frcData.featureTriSegments.push({start:3*t,end:3*i,segIdx:n.length>0?n.length-1:0,frc:r})}buildFrcSegments(e){this.frcData&&!this.frcData.empty()&&Xc(this.frcData,e.indexArray,e.segments)}handleFeature(e,t,i,r,n,o,a,s,l,u,c){if(!this.elevationEnabled)return!1;if(!c.terrainEnabled){const h=cc(e,r,n?n.registry:void 0,i),d=null!=e.properties&&Object.hasOwn(e.properties,Ds)&&!Number.isNaN(+e.properties[Ds]);if(!h&&d&&o&&(!n||!n.allProvidersReady))return this.hasDeferredElevationFeatures=!0,!0;if(h){let r=h.feature,o=h.tileId;if(!h.tileId.equals(i)){const t=this.mergedFeatureCache?this.mergedFeatureCache.get(r.id):void 0;if(t)r=t,o=i;else{const t=function(e,t,i){if(!e.properties||!t||0===t.length)return[];const r=+e.properties[Ds];if(Number.isNaN(r))return[];const n=uc(t,r);if(n<0)return[];const o=[];for(let e=n;e<t.length&&t[e].feature.id===r;e++){const r=t[e];(r.tileId.isChildOf(i)||i.isChildOf(r.tileId)||null!=r.feature.constantHeight)&&o.push(r)}return o}(e,n?n.registry:void 0,i);t.length>1&&(r=function(e,t){const i=t.slice().sort((e,t)=>t.tileId.z-e.tileId.z),r=new K(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),n=new K(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY),o=[];for(const t of i){const i=new ElevationFeatureSampler(t.tileId,e);for(const e of t.feature.vertices)o.push({position:i.pointTransform(e.position),height:e.height,extent:e.extent,index:e.index});const a=t.feature.safeArea;nc[0]=a.min.x,nc[1]=a.min.y,oc[0]=a.max.x,oc[1]=a.max.y,i.pointTransformInPlace(nc),i.pointTransformInPlace(oc),r.x=Math.min(r.x,nc[0],oc[0]),r.y=Math.min(r.y,nc[1],oc[1]),n.x=Math.max(n.x,nc[0],oc[0]),n.y=Math.max(n.y,nc[1],oc[1])}const a={min:r,max:n};if(null!=i[0].feature.constantHeight)return new ElevationFeature(i[0].feature.id,a,i[0].feature.constantHeight);o.sort((e,t)=>e.index-t.index);const s=[];for(const e of o)0!==s.length&&s.at(-1).index===e.index||s.push(e);const l=[];for(let e=1;e<s.length;e++)s[e].index-s[e-1].index<=1&&l.push({a:e-1,b:e});const u=1/fa(e);return new ElevationFeature(i[0].feature.id,a,void 0,s,l,u)}(i,t),o=i,this.mergedFeatureCache||(this.mergedFeatureCache=new Map),this.mergedFeatureCache.set(r.id,r))}}const d=bs(t,-1,-1,8193,8193),p=this.prepareElevatedLines(d,r,o,i);for(const t of p){const n=c.layoutVertexArray.length;c.addLine(t,e,i,a,s,l,u);const h=new ElevationFeatureSampler(i,o),d=c.showElevationIdDebug?lc(r.id):null;for(let e=n;e<c.layoutVertexArray.length;e++){const t=new K(c.layoutVertexArray.int16[6*e]>>1,c.layoutVertexArray.int16[6*e+1]>>1),i=h.pointElevation(t,r,.05);this.updateHeightRange(i),e<c.zOffsetVertexArray.length?c.zOffsetVertexArray.float32[4*e]=i:c.zOffsetVertexArray.emplaceBack(i,0,0,0),d?e<c.elevationIdColVertexArray.length?(c.elevationIdColVertexArray.float32[3*e]=d[0],c.elevationIdColVertexArray.float32[3*e+1]=d[1],c.elevationIdColVertexArray.float32[3*e+2]=d[2]):c.elevationIdColVertexArray.emplaceBack(d[0],d[1],d[2]):c.showElevationIdDebug&&(e<c.elevationIdColVertexArray.length?(c.elevationIdColVertexArray.float32[3*e]=0,c.elevationIdColVertexArray.float32[3*e+1]=0,c.elevationIdColVertexArray.float32[3*e+2]=0):c.elevationIdColVertexArray.emplaceBack(0,0,0))}}return!0}if(d&&o&&n&&n.allProvidersReady&&n.hasCoveringTile)return!0}const h=!(!e.properties||!Object.hasOwn(e.properties,"mapbox_line_metrics"))&&e.properties.mapbox_line_metrics,d=c.layoutVertexArray.length,p=[],f=bs(t,-1,-1,8193,8193,p);for(let t=0;t<f.length;t++){const r=f[t],n=p[t],o={progress:{min:n.progress.min,max:n.progress.max},nextDir:Kc(n,r),prevDir:Qc(n,r)};c.addLine(r,e,i,a,s,l,u,o,h&&n.parentIndex>0?n.parentIndex:null)}return c.fillNonElevatedRoadSegment(d),!0}prepareElevatedLines(e,t,i,r){if(null!=t.constantHeight)return e;const n=[],o=1/fa(r),a=i.equals(r)?null:new ElevationFeatureSampler(i,r);for(const i of e)ws(i,new EdgeIterator(t,o,a),0,n);return n}updateHeightRange(e){this.heightRange?(this.heightRange.min=Math.min(this.heightRange.min,e),this.heightRange.max=Math.max(this.heightRange.max,e)):this.heightRange={min:e,max:e}}endPopulate(){this.mergedFeatureCache=void 0}}rn(LineHDExtension,"LineHDExtension");class CircleHDExtension{constructor(){this.elevatedLayoutVertexArray=new StructArrayLayout1f4,this.hasElevation=!1}beginFeature(e,t,i){const r=cc(e,t,void 0,i);this.currentFeatureElevation=r?r.feature:void 0}writeVertexQuad(e,t){const i=this.currentFeatureElevation?this.currentFeatureElevation.pointElevation(new K(e,t)):0;this.hasElevation=this.hasElevation||0!==i;for(let e=0;e<4;e++)this.elevatedLayoutVertexArray.emplaceBack(i)}finalize(){this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}upload(e){this.elevatedLayoutVertexArray&&!this.elevatedLayoutVertexBuffer&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,Fs.members))}destroy(){this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy()}}rn(CircleHDExtension,"CircleHDExtension");const eh=(e,t,i,r)=>{for(let n=0;n<t;n++)e.emplaceBack(i[0],i[1],i[2],r[0],r[1],r[2])};class SymbolHDExtension{constructor(){this.elevationFeatures=[],this.elevationFeatureTileIds=[],this.elevationFeatureIdToIndex=new Map,this.elevationStateComplete=!1,this.hasDeferredElevationFeatures=!1,this.elevationParams=null,this.crossSourceElevationEnabled=!1,this.terrainEnabled=!1}configureCrossSource(e,t,i,r){this.consumerCanonical=e,this.elevationParams=t,this.crossSourceElevationEnabled=i,this.terrainEnabled=r}addElevationFeatures(e,t){for(const i of e)this.elevationFeatureIdToIndex.set(i.id,this.elevationFeatures.length),this.elevationFeatures.push(i),this.elevationFeatureTileIds.push(t)}resolveRoadElevation(e,t){const i=this.elevationFeatureIdToIndex.get(t);if(void 0!==i)return i;if(this.terrainEnabled||!this.crossSourceElevationEnabled)return 65535;const r=cc(e,void 0,this.elevationParams?this.elevationParams.registry:void 0,this.consumerCanonical);if(r){const e=this.elevationFeatures.length;return this.elevationFeatureIdToIndex.set(t,e),this.elevationFeatures.push(r.feature),this.elevationFeatureTileIds.push(r.tileId),e}return this.elevationParams&&this.elevationParams.allProvidersReady?65535:(this.hasDeferredElevationFeatures=!0,"defer")}getElevationFeatureSampler(e,t){if(t.equals(e))return new ElevationFeatureSampler(e,t);this.elevationFeatureSamplerCache||(this.elevationFeatureSamplerCache=new Map);let i=this.elevationFeatureSamplerCache.get(t.key);return i||(i=new ElevationFeatureSampler(e,t),this.elevationFeatureSamplerCache.set(t.key,i)),i}isCrossTileRoadElevation(e,t){if(65535===e||e>=this.elevationFeatures.length)return!1;const i=this.elevationFeatureTileIds[e];return null!=i&&!i.equals(t)}getRoadFeatureHeightAtAnchor(e,t,i){if(65535===e||e>=this.elevationFeatures.length)return null;const r=this.elevationFeatures[e],n=this.elevationFeatureTileIds[e];return n.equals(i)?r.pointElevation(t):this.getElevationFeatureSampler(i,n).pointElevation(new K(t.x,t.y),r,0)}sampleRoadFeatureHeight(e,t,i){const r=this.getRoadFeatureHeightAtAnchor(e,t,i);return null===r?void 0:r}clearWorkerState(){this.consumerCanonical=void 0,this.elevationParams=null,this.crossSourceElevationEnabled=!1,this.terrainEnabled=!1,this.elevationFeatureIdToIndex.clear()}updateRoadElevation(e,t){if(this.elevationStateComplete)return;this.elevationStateComplete=!0,e.hasAnyZOffset=!1;let i=!1;const r=fa(t),n=1/r;let o=!1,a=!1;for(let s=0;s<e.symbolInstances.length;s++){const l=e.symbolInstances.get(s),u=p(1,0,0),c=p(0,1,0),{numHorizontalGlyphVertices:h,numVerticalGlyphVertices:d,numIconVertices:f,numVerticalIconVertices:m}=l,_=h>0||d>0,g=f>0,y=l.elevationFeatureIndex,x=y<this.elevationFeatures.length?this.elevationFeatures[y]:void 0;if(x){const s=new K(l.tileAnchorX,l.tileAnchorY),h=this.sampleRoadFeatureHeight(y,s,t),d=void 0!==h?.075+h:.075;l.zOffset!==d&&(i=!0,l.zOffset=d),0!==d&&(e.hasAnyZOffset=!0);const f=x.computeSlopeNormal(s,n),m=U(B(),p(0,0,1),f);z(u,u,m),z(c,c,m),u[2]*=r,c[2]*=r,1===u[0]&&0===u[1]&&0===u[2]&&0===c[0]&&1===c[1]&&0===c[2]||(o=o||_,a=a||g)}if(_&&(eh(e.text.orientationVertexArray,h,u,c),eh(e.text.orientationVertexArray,d,u,c)),g){const{placedIconSymbolIndex:t,verticalPlacedIconSymbolIndex:i}=l;t>=0&&eh(e.icon.orientationVertexArray,f,u,c),i>=0&&eh(e.icon.orientationVertexArray,m,u,c)}}o||(e.text.orientationVertexArray=void 0),a||(e.icon.orientationVertexArray=void 0),i&&(e.zOffsetBuffersNeedUpload=!0,e.zOffsetSortDirty=!0)}getRoadFeatureHeightForPlacedSymbol(e,t,i,r,n){const o=e.symbolInstances.get(t.symbolInstanceIndices[i]);return this.getRoadFeatureHeightAtAnchor(o.elevationFeatureIndex,r,n)}getElevationFeatureForPlacedSymbol(e,t,i){const r=e.symbolInstances.get(t.symbolInstanceIndices[i]).elevationFeatureIndex;if(r<this.elevationFeatures.length)return this.elevationFeatures[r]}makeRoadSymbolElevationParams(e,t,i,r,n,o,a,s,l){const u=this.getElevationFeatureForPlacedSymbol(e,t,i),c=void 0!==u?u:null,h=e.symbolInstances.get(t.symbolInstanceIndices[i]);return this.isCrossTileRoadElevation(h.elevationFeatureIndex,r.canonical)?{getElevation:n=>{const o=this.getRoadFeatureHeightForPlacedSymbol(e,t,i,n,r.canonical);return function(e,t,i,r,n,o){const a=r.upVector(t,i.x,i.y);return x(a,a,e*r.upVectorScale(t,n,o).metersToTile),[a[0],a[1],a[2]]}(null!==o?o:0,r.canonical,n,a,s,l)},elevation:o,elevationFeature:null}:{getElevation:n,elevation:o,elevationFeature:c}}}rn(SymbolHDExtension,"SymbolHDExtension",{omit:["consumerCanonical","elevationParams","crossSourceElevationEnabled","terrainEnabled","hasDeferredElevationFeatures","elevationFeatureIdToIndex"]});let th=null,ih=null,rh=null,nh=null;const oh=5120,ah=5121,sh=5122,lh=5123,uh=5125,ch=5126,hh={[oh]:Int8Array,[ah]:Uint8Array,[sh]:Int16Array,[lh]:Uint16Array,[uh]:Uint32Array,[ch]:Float32Array},dh={[oh]:"DT_INT8",[ah]:"DT_UINT8",[sh]:"DT_INT16",[lh]:"DT_UINT16",[uh]:"DT_UINT32",[ch]:"DT_FLOAT32"},ph={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function fh(e,t,i){const r=i.json.bufferViews.length,n=i.buffers.length;t.bufferView=r,i.json.bufferViews[r]={buffer:n,byteLength:e.byteLength},i.buffers[n]=e}const mh="KHR_draco_mesh_compression";function _h(e,t){const i=e.extensions&&e.extensions[mh];if(!i)return;const r=new th.Decoder,n=Ah(t,i.bufferView),o=new th.Mesh;if(!r.DecodeArrayToMesh(n,n.byteLength,o))throw new Error("Failed to decode Draco mesh");const a=t.json.accessors[e.indices],s=hh[a.componentType],l=a.count*s.BYTES_PER_ELEMENT,u=th._malloc(l);s===Uint16Array?r.GetTrianglesUInt16Array(o,l,u):r.GetTrianglesUInt32Array(o,l,u),fh(th.memory.buffer.slice(u,u+l),a,t),th._free(u);for(const n of Object.keys(i.attributes)){const a=r.GetAttributeByUniqueId(o,i.attributes[n]),s=t.json.accessors[e.attributes[n]],l=dh[s.componentType],u=s.count*ph[s.type]*hh[s.componentType].BYTES_PER_ELEMENT,c=th._malloc(u);r.GetAttributeDataArrayForAllPoints(o,a,th[l],u,c),fh(th.memory.buffer.slice(c,c+u),s,t),th._free(c)}r.destroy(),o.destroy(),delete e.extensions[mh]}const gh="EXT_meshopt_compression";function yh(e,t){if(!e.extensions||!e.extensions[gh])return;const i=e.extensions[gh],r=new Uint8Array(t.buffers[i.buffer],i.byteOffset||0,i.byteLength||0),n=new Uint8Array(i.count*i.byteStride);rh.decodeGltfBuffer(n,i.count,i.byteStride,r,i.mode,i.filter),e.buffer=t.buffers.length,e.byteOffset=0,t.buffers[e.buffer]=n.buffer,delete e.extensions[gh]}const xh=1179937895,vh=new TextDecoder("utf8");function bh(e,t){return new URL(e,t).href}async function wh(e,t,i,r,n){const o=await fetch(bh(e.uri,r),{signal:n}),a=await o.arrayBuffer();t.buffers[i]=a}function Ah(e,t){const i=e.json.bufferViews[t];return new Uint8Array(e.buffers[i.buffer],i.byteOffset||0,i.byteLength)}async function Eh(e,t,i,r,n){if(e.uri){const o=bh(e.uri,r),a=await fetch(o,{signal:n}),s=await a.blob(),l=await createImageBitmap(s);t.images[i]=l}else if(void 0!==e.bufferView){const r=Ah(t,e.bufferView),n=new Blob([r],{type:e.mimeType}),o=await createImageBitmap(n);t.images[i]=o}}async function Ih(e,t=0,i,r){const n={json:null,images:[],buffers:[]};if(new Uint32Array(e,t,1)[0]===xh){const i=new Uint32Array(e,t);let r=2;const o=(i[r++]>>2)-3,a=i[r++]>>2;if(r++,n.json=JSON.parse(vh.decode(i.subarray(r,r+a))),r+=a,r<o){const o=i[r++];r++;const a=t+(r<<2);n.buffers[0]=e.slice(a,a+o)}}else n.json=JSON.parse(vh.decode(new Uint8Array(e,t)));const{buffers:o,images:a,meshes:s,extensionsUsed:l,bufferViews:u}=n.json;if(o){const e=[];for(let t=0;t<o.length;t++){const a=o[t];a.uri?e.push(wh(a,n,t,i,r)):n.buffers[t]||(n.buffers[t]=null)}await Promise.all(e)}r&&r.throwIfAborted();const c=[],h=l&&l.includes(mh),d=l&&l.includes(gh);if(h&&c.push(function(){if(!th)return null!=ih||(ih=function(e){let t,i=null;function r(){t=new Uint8Array(i.buffer)}function n(){throw new Error("Unexpected Draco error.")}return WebAssembly.instantiateStreaming(e,{a:{a:n,d:function(e,i,r){return t.copyWithin(e,i,i+r)},c:function(e){const n=t.length,o=Math.max(e>>>0,Math.ceil(1.2*n)),a=Math.ceil((o-n)/65536);try{return i.grow(a),r(),!0}catch(e){return!1}},b:n}}).then(e=>{const{Rb:n,Qb:o,P:a,T:s,X:l,Ja:u,La:c,Qa:h,Va:d,Wa:p,eb:f,jb:m,f:_,e:g,yb:y,zb:x,Ab:v,Bb:b,Db:w,Gb:A}=e.instance.exports;i=g;const E=(()=>{let e=0,i=0,r=0,a=0;return s=>{r&&(n(a),n(e),i+=r,r=e=0),e||(i+=128,e=o(i));const l=s.length+7&-8;let u=e;l>=i&&(r=l,u=a=o(l));for(let e=0;e<s.length;e++)t[u+e]=s[e];return u}})();return r(),_(),{memory:g,_free:n,_malloc:o,Mesh:class Mesh{constructor(){this.ptr=a()}destroy(){s(this.ptr)}},Decoder:class Decoder{constructor(){this.ptr=u()}destroy(){m(this.ptr)}DecodeArrayToMesh(e,t,i){const r=E(e),n=c(this.ptr,r,t,i.ptr);return!!l(n)}GetAttributeByUniqueId(e,t){return{ptr:h(this.ptr,e.ptr,t)}}GetTrianglesUInt16Array(e,t,i){d(this.ptr,e.ptr,t,i)}GetTrianglesUInt32Array(e,t,i){p(this.ptr,e.ptr,t,i)}GetAttributeDataArrayForAllPoints(e,t,i,r,n){f(this.ptr,e.ptr,t.ptr,i,r,n)}},DT_INT8:y(),DT_UINT8:x(),DT_INT16:v(),DT_UINT16:b(),DT_UINT32:w(),DT_FLOAT32:A()}})}(fetch(new URL(We.DRACO_URL,We.API_URL).href)).then(e=>{th=e,ih=null})),ih}()),d&&c.push(function(){var e;if(!rh)return null!=nh||(nh=(e=fetch(function(){if("object"!=typeof WebAssembly)throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer");return new URL(function(){if(void 0===Ve){if("object"!=typeof WebAssembly)return!1;const e=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]);Ve=WebAssembly.validate(e)}return Ve}()?We.MESHOPT_SIMD_URL:We.MESHOPT_URL,We.API_URL).href}()),WebAssembly.instantiateStreaming(e,{}).then(e=>{const{sbrk:t,memory:i,meshopt_decodeVertexBuffer:r,meshopt_decodeIndexBuffer:n,meshopt_decodeIndexSequence:o,meshopt_decodeFilterOct:a,meshopt_decodeFilterQuat:s,meshopt_decodeFilterExp:l}=e.instance.exports,u={ATTRIBUTES:r,TRIANGLES:n,INDICES:o},c={OCTAHEDRAL:a,QUATERNION:s,EXPONENTIAL:l};return e.instance.exports.__wasm_call_ctors(),{decodeGltfBuffer(e,r,n,o,a,s){const l=r+3&-4,h=t(l*n),d=t(o.length),p=new Uint8Array(i.buffer);p.set(o,d);const f=u[a](h,r,n,d,o.length);if(0===f&&c[s]&&c[s](h,l,n),e.set(p.subarray(h,h+r*n)),t(h-t(0)),0!==f)throw new Error(`Malformed buffer data: ${f}`)}}})).then(e=>{rh=e,nh=null})),nh}()),a)for(let e=0;e<a.length;e++)c.push(Eh(a[e],n,e,i,r));if(c.length&&await Promise.all(c),r&&r.throwIfAborted(),h&&s)for(const{primitives:e}of s)for(const t of e)_h(t,n);if(d&&s&&u)for(const e of u)yh(e,n);return n}class TriangleGridIndex{constructor(e,t,i,r){if(this.triangleCount=t.length/3,this.min=new K(0,0),this.max=new K(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],0===this.triangleCount||0===e.length)return;const[n,o]=[e[0].clone(),e[0].clone()];for(let t=1;t<e.length;++t){const i=e[t];n.x=Math.min(n.x,i.x),n.y=Math.min(n.y,i.y),o.x=Math.max(o.x,i.x),o.y=Math.max(o.y,i.y)}if(r){const e=Math.ceil(Math.max(o.x-n.x,o.y-n.y)/r);i=Math.max(i,e)}if(0===i)return;this.min=n,this.max=o;const a=this.max.sub(this.min);a.x=Math.max(a.x,1),a.y=Math.max(a.y,1);const s=Math.max(a.x,a.y)/i;this.cellsX=Math.max(1,Math.ceil(a.x/s)),this.cellsY=Math.max(1,Math.ceil(a.y/s)),this.xScale=1/s,this.yScale=1/s;const l=[];for(let i=0;i<this.triangleCount;i++){const r=e[t[3*i+0]].sub(this.min),n=e[t[3*i+1]].sub(this.min),o=e[t[3*i+2]].sub(this.min),a=Sh(Math.floor(Math.min(r.x,n.x,o.x)),this.xScale,this.cellsX),u=Sh(Math.floor(Math.max(r.x,n.x,o.x)),this.xScale,this.cellsX),c=Sh(Math.floor(Math.min(r.y,n.y,o.y)),this.yScale,this.cellsY),h=Sh(Math.floor(Math.max(r.y,n.y,o.y)),this.yScale,this.cellsY),d=new K(0,0),p=new K(0,0),f=new K(0,0),m=new K(0,0);for(let e=c;e<=h;++e){d.y=p.y=e*s,f.y=m.y=(e+1)*s;for(let t=a;t<=u;++t)d.x=f.x=t*s,p.x=m.x=(t+1)*s,(ys(r,n,o,d,p,m)||ys(r,n,o,d,m,f))&&l.push({cellIdx:e*this.cellsX+t,triIdx:i})}}if(0===l.length)return;l.sort((e,t)=>e.cellIdx-t.cellIdx||e.triIdx-t.triIdx);let u=0;for(;u<l.length;){const e=l[u].cellIdx,t={start:this.payload.length,len:0};for(;u<l.length&&l[u].cellIdx===e;)++t.len,this.payload.push(l[u++].triIdx);this.cells[e]=t}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(e,t){if(0===this.triangleCount||0===this.cells.length)return;if(e.x>this.max.x||this.min.x>e.x||e.y>this.max.y||this.min.y>e.y)return;const i=Sh(e.x-this.min.x,this.xScale,this.cellsX),r=Sh(e.y-this.min.y,this.yScale,this.cellsY),n=this.cells[r*this.cellsX+i];if(n){this._lazyInitLookup();for(let e=0;e<n.len;e++){const i=this.payload[n.start+e],r=Math.floor(i/8),o=1<<i%8;if(!(this.lookup[r]&o)&&(this.lookup[r]|=o,t.push(i),t.length===this.triangleCount))return}}}query(e,t,i){if(0===this.triangleCount||0===this.cells.length)return;if(e.x>this.max.x||this.min.x>t.x)return;if(e.y>this.max.y||this.min.y>t.y)return;this._lazyInitLookup();const r=Sh(e.x-this.min.x,this.xScale,this.cellsX),n=Sh(t.x-this.min.x,this.xScale,this.cellsX),o=Sh(e.y-this.min.y,this.yScale,this.cellsY),a=Sh(t.y-this.min.y,this.yScale,this.cellsY);for(let e=o;e<=a;e++)for(let t=r;t<=n;t++){const r=this.cells[e*this.cellsX+t];if(r)for(let e=0;e<r.len;e++){const t=this.payload[r.start+e],n=Math.floor(t/8),o=1<<t%8;if(!(this.lookup[n]&o)&&(this.lookup[n]|=o,i.push(t),i.length===this.triangleCount))return}}}}function Sh(e,t,i){return Math.max(0,Math.min(i-1,Math.floor(e*t)))}rn(TriangleGridIndex,"TriangleGridIndex");const Dh=Sa([{name:"a_pos_3f",components:3,type:"Float32"}]),Ph=Sa([{name:"a_color_3f",components:3,type:"Float32"}]),Th=Sa([{name:"a_color_4f",components:4,type:"Float32"}]),zh=Sa([{name:"a_uv_2f",components:2,type:"Float32"}]),Mh=Sa([{name:"a_uv_2f",components:2,type:"Uint16",normalized:!0}]),Ch=Sa([{name:"a_normal_4n",components:4,type:"Int8",normalized:!0}]),Rh=Sa([{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"}]),Lh=Sa([{name:"a_feature",components:2,type:"Uint16"}]),Fh=new Float64Array([1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1]);function Bh(e,t,i){r(e),function(e,t,i){var r=Math.sin(i),n=Math.cos(i),o=t[0],a=t[1],s=t[2],l=t[3],u=t[4],c=t[5],h=t[6],d=t[7];t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*n+u*r,e[1]=a*n+c*r,e[2]=s*n+h*r,e[3]=l*n+d*r,e[4]=u*n-o*r,e[5]=c*n-a*r,e[6]=h*n-s*r,e[7]=d*n-l*r}(e,e,ye(t[2])),l(e,e,ye(t[0])),u(e,e,ye(t[1])),s(e,e,i),o(e,e,Fh)}function Oh(e,t,i,r,n,o,a,s){const l=[i[0]-t[0],i[1]-t[1],0],u=[r[0]-t[0],r[1]-t[1],0];if(d(l)<1e-12||d(u)<1e-12)return O(e);const c=D([],l,u);E(c,c),_(u,r,t),l[2]=(o-n)*s,u[2]=(a-n)*s;const h=l;return D(h,l,u),E(h,h),U(e,c,h)}function Vh(e,t,i=!1){const n=Gl(t.zoom),c=function(e,t,i){const n=t.worldSize,l=[e[12],e[13],e[14]],u=Ft(l[1]/n),c=Lt(l[0]/n),h=r([]),d=ca(1,u)*n,p=ca(1,0)*n*pa(u,t.zoom),f=1/Ul(n);let _=p*f;if(i){const e=function(e,t,i,r,n=1/0){const o=e.range;if(!o)return 0;const a=Math.min(n,Math.max(i,r)),s=Math.log2(a/1024);return be(o[0]+s,o[1]+s,t)}(t.projection,t.zoom,t.width,t.height,1024);_=f*t.projection.pixelSpaceConversion(t.center.lat,n,e)}const g=aa(u,c);m(g,g,x([],E([],g),d*_*l[2]));const y=function(e){const t=[e[0],e[1],e[2]];let i=[0,1,0];const r=D([],i,t);return D(i,t,r),0===function(e){var t=e[0],i=e[1],r=e[2];return t*t+i*i+r*r}(i)&&(i=[0,1,0],D(r,t,i)),E(r,r),E(i,i),E(t,t),[r[0],r[1],r[2],0,i[0],i[1],i[2],0,t[0],t[1],t[2],0,e[0],e[1],e[2],1]}(g);s(h,h,[_,_,_*d]),a(h,h,[-l[0],-l[1],-l[2]]);const v=o([],t.globeMatrix,y);return o(v,v,h),o(v,v,e),v}(e,t,i);if(n>0){const i=function(e,t){const i=t.worldSize,n=ca(1,0)*i*pa(t.center.lat,t.zoom)/Ul(i),c=ca(1,t.center.lat)*i,h=r([]);u(h,h,ye(t.center.lng)),l(h,h,ye(t.center.lat)),a(h,h,[0,0,ia]),s(h,h,[n,n,n*c]);const d=t.point;return a(h,h,[-d.x,-d.y,0]),o(h,h,e),o(h,t.globeMatrix,h)}(e,t);return function(e,t,i){const r=(e,t,i)=>{const r=d(e),n=d(t),o=Bl(e,t,i);return x(o,o,1/d(o)*rt(r,n,i))},n=r([e[0],e[1],e[2]],[t[0],t[1],t[2]],i),o=r([e[4],e[5],e[6]],[t[4],t[5],t[6]],i),a=r([e[8],e[9],e[10]],[t[8],t[9],t[10]],i),s=Bl([e[12],e[13],e[14]],[t[12],t[13],t[14]],i);return[n[0],n[1],n[2],0,o[0],o[1],o[2],0,a[0],a[1],a[2],0,s[0],s[1],s[2],1]}(c,i,n)}return c}function kh(e,t,i,r){const n=Aabb.projectAabbCorners(r,i);let o=Number.MAX_VALUE;for(let e=0;e<n.length;++e){const i=n[e];i[0]=(.5*i[0]+.5)*t.width,i[1]=(.5-.5*i[1])*t.height,i[2]<o&&(o=i[2])}const a=function(e){const t=[];let i=0;for(let t=1;t<e.length;t++)(e[t][0]<e[i][0]||e[t][0]===e[i][0]&&e[t][1]<e[i][1])&&(i=t);let r,n=i;const o=new Uint8Array(e.length);do{if(o[n])break;t.push(new K(e[n][0],e[n][1])),o[n]=1,r=(n+1)%e.length;for(let t=0;t<e.length;t++){if(e[t][0]===e[r][0]&&e[t][1]===e[r][1]||e[t][0]===e[n][0]&&e[t][1]===e[n][1])continue;const i=[e[t][0]-e[n][0],e[t][1]-e[n][1]],o=[e[r][0]-e[n][0],e[r][1]-e[n][1]],a=i[0]*o[1]-i[1]*o[0];(a>0||0===a&&i[0]*o[0]+i[1]*o[1]>=0&&i[0]*i[0]+i[1]*i[1]>o[0]*o[0]+o[1]*o[1])&&(r=t)}n=r}while(n!==i);return t.length>0&&t.push(t[0]),t}(n);if(ns(e,a))return o}const Nh=64,Uh=["","wall","door","roof","window","lamp","logo"];function Gh(e,t,i,n,l,u,c,h,d,p=!1){const f=i.zoom,m=i.project(n),_=pa(n.lat,f),g=1/_;r(e),a(e,e,[m.x+c[0]*g,m.y+c[1]*g,c[2]]);let y=1,x=1;const v=i.worldSize;if(p){if("mercator"===i.projection.name){let e=0;i.elevation&&(e=i.elevation.getAtPointOrZero(new MercatorCoordinate(m.x/v,m.y/v),0));const t=F([],[m.x,m.y,e,1],i.projMatrix)[3]/i.cameraToCenterDistance;y=t,x=t*pa(i.center.lat,f)}else if("globe"===i.projection.name){const t=Vh(e,i),r=[0,0,0,1];F(r,r,o([],i.projMatrix,t));const a=r[3]/i.cameraToCenterDistance,s=Gl(f),l=i.projection.pixelsPerMeter(n.lat,v)*pa(n.lat,f),u=i.projection.pixelsPerMeter(i.center.lat,v)*pa(i.center.lat,f);y=a/rt(l,da(i.center.lat),s),x=a*_/l,y*=u,x*=u}}else y=g;s(e,e,[y,y,x]);const b=[...e],w=t.orientation,A=[];if(Bh(A,[w[0]+(l?l[0]:0),w[1]+(l?l[1]:0),w[2]+(l?l[2]:0)],u),o(e,b,A),h&&i.elevation){let r=0;const a=[];if(d&&i.elevation){r=function(e,t,i,r,n){const o=t.elevation;if(!o)return 0;const a=Aabb.projectAabbCorners(i,r),s=ca(1,n.lat)*t.worldSize,l=function(e,t){const i=[0,0,1],r=[{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 n of r){const r=e[n.corners[0]],o=e[n.corners[1]],a=e[n.corners[2]],s=[o[0]-r[0],o[1]-r[1],t*(o[2]-r[2])],l=D(s,s,[a[0]-r[0],a[1]-r[1],t*(a[2]-r[2])]);E(l,l),n.dotProductWithUp=I(l,i)}return r.sort((e,t)=>e.dotProductWithUp-t.dotProductWithUp),r[0].corners}(a,s),u=a[l[0]],c=a[l[1]],h=a[l[2]],d=a[l[3]],p=o.getAtPointOrZero(new MercatorCoordinate(u[0]/t.worldSize,u[1]/t.worldSize),0),f=o.getAtPointOrZero(new MercatorCoordinate(c[0]/t.worldSize,c[1]/t.worldSize),0),m=o.getAtPointOrZero(new MercatorCoordinate(h[0]/t.worldSize,h[1]/t.worldSize),0),_=o.getAtPointOrZero(new MercatorCoordinate(d[0]/t.worldSize,d[1]/t.worldSize),0),g=(p+_)/2,y=(f+m)/2;return g>y?f<m?Oh(e,c,d,u,f,_,p,s):Oh(e,h,u,d,m,p,_,s):p<_?Oh(e,u,c,h,p,f,m,s):Oh(e,d,h,c,_,m,f,s),Math.max(g,y)}(a,i,t.aabb,e,n);const s=o([],function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],a=i+i,s=r+r,l=n+n,u=i*a,c=r*a,h=r*s,d=n*a,p=n*s,f=n*l,m=o*a,_=o*s,g=o*l;return e[0]=1-h-f,e[1]=c+g,e[2]=d-_,e[3]=0,e[4]=c-g,e[5]=1-u-f,e[6]=p+m,e[7]=0,e[8]=d+_,e[9]=p-m,e[10]=1-u-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}([],a),A);o(e,b,s)}else r=i.elevation.getAtPointOrZero(new MercatorCoordinate(m.x/v,m.y/v),0);0!==r&&(e[14]+=r)}}function jh(e,t,i=!1){e.uploaded||(e.gfxTexture=new Texture(t,e.image,i?t.gl.R8:t.gl.RGBA8,{useMipmap:e.sampler.minFilter>=t.gl.NEAREST_MIPMAP_NEAREST}),e.uploaded=!0,e.image=null)}function Hh(e,t,i){e.indexBuffer=t.createIndexBuffer(e.indexArray,!1,!0),e.vertexBuffer=t.createVertexBuffer(e.vertexArray,Dh.members,!1,!0),e.normalArray&&(e.normalBuffer=t.createVertexBuffer(e.normalArray,Ch.members,!1,!0)),e.texcoordArray&&(e.texcoordBuffer=t.createVertexBuffer(e.texcoordArray,(8===e.texcoordArray.bytesPerElement?zh:Mh).members,!1,!0)),e.colorArray&&(e.colorBuffer=t.createVertexBuffer(e.colorArray,(12===e.colorArray.bytesPerElement?Ph:Th).members,!1,!0)),e.featureArray&&(e.featureBuffer=t.createVertexBuffer(e.featureArray,Lh.members,!1,!0)),e.segments=SegmentVector.simpleSegment(0,0,e.vertexArray.length,e.indexArray.length);const r=e.material;r.pbrMetallicRoughness.baseColorTexture&&jh(r.pbrMetallicRoughness.baseColorTexture,t),r.pbrMetallicRoughness.metallicRoughnessTexture&&jh(r.pbrMetallicRoughness.metallicRoughnessTexture,t),r.normalTexture&&jh(r.normalTexture,t),r.occlusionTexture&&jh(r.occlusionTexture,t,i),r.emissionTexture&&jh(r.emissionTexture,t)}function $h(e,t,i){if(e.meshes)for(const r of e.meshes)Hh(r,t,i);if(e.lodMeshes)for(const r of e.lodMeshes)Hh(r,t,i);if(e.children)for(const r of e.children)$h(r,t,i)}function Wh(e){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()}function Xh(e){if(e.meshes)for(const t of e.meshes)Wh(t);if(e.lodMeshes)for(const t of e.lodMeshes)Wh(t);if(e.children)for(const t of e.children)Xh(t)}function qh(e){var t;e.vertexBuffer&&(e.vertexBuffer.destroy(),e.indexBuffer.destroy(),e.normalBuffer&&e.normalBuffer.destroy(),e.texcoordBuffer&&e.texcoordBuffer.destroy(),e.colorBuffer&&e.colorBuffer.destroy(),e.featureBuffer&&e.featureBuffer.destroy(),e.segments.destroy(),e.material&&((t=e.material).pbrMetallicRoughness.baseColorTexture&&t.pbrMetallicRoughness.baseColorTexture.gfxTexture&&t.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),t.pbrMetallicRoughness.metallicRoughnessTexture&&t.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&t.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),t.normalTexture&&t.normalTexture.gfxTexture&&t.normalTexture.gfxTexture.destroy(),t.emissionTexture&&t.emissionTexture.gfxTexture&&t.emissionTexture.gfxTexture.destroy(),t.occlusionTexture&&t.occlusionTexture.gfxTexture&&t.occlusionTexture.gfxTexture.destroy()))}function Zh(e){if(e.meshes)for(const t of e.meshes)qh(t);if(e.lodMeshes)for(const t of e.lodMeshes)qh(t);if(e.footprintDebugMesh&&(e.footprintDebugMesh.vertexBuffer.destroy(),e.footprintDebugMesh.indexBuffer.destroy(),e.footprintDebugMesh.segments.destroy()),e.children)for(const t of e.children)Zh(t)}function Yh(e,t,i,r){return e[0]<=r[0]&&t[0]>=i[0]&&e[1]<=r[1]&&t[1]>=i[1]&&e[2]<=r[2]&&t[2]>=i[2]}function Jh(e,t,i,r,n,o,a,s,l,u,c){const h=.5*(u[0]+c[0]),d=.5*(u[1]+c[1]),p=.5*(u[2]+c[2]),f=.5*(c[0]-u[0]),m=.5*(c[1]-u[1]),_=.5*(c[2]-u[2]),g=e-h,y=t-d,x=i-p,v=r-h,b=n-d,w=o-p,A=a-h,E=s-d,I=l-p,D=v-g,P=b-y,T=w-x,z=A-v,M=E-b,C=I-w,R=g-A,L=y-E,F=x-I;let B,O,V,k,N,U;if(B=x*P-y*T,O=w*P-b*T,V=I*P-E*T,k=Math.min(B,O,V),N=Math.max(B,O,V),U=Math.abs(T)*m+Math.abs(P)*_,k>U||N<-U)return!1;if(B=x*M-y*C,O=w*M-b*C,V=I*M-E*C,k=Math.min(B,O,V),N=Math.max(B,O,V),U=Math.abs(C)*m+Math.abs(M)*_,k>U||N<-U)return!1;if(B=x*L-y*F,O=w*L-b*F,V=I*L-E*F,k=Math.min(B,O,V),N=Math.max(B,O,V),U=Math.abs(F)*m+Math.abs(L)*_,k>U||N<-U)return!1;if(B=g*T-x*D,O=v*T-w*D,V=A*T-I*D,k=Math.min(B,O,V),N=Math.max(B,O,V),U=Math.abs(T)*f+Math.abs(D)*_,k>U||N<-U)return!1;if(B=g*C-x*z,O=v*C-w*z,V=A*C-I*z,k=Math.min(B,O,V),N=Math.max(B,O,V),U=Math.abs(C)*f+Math.abs(z)*_,k>U||N<-U)return!1;if(B=g*F-x*R,O=v*F-w*R,V=A*F-I*R,k=Math.min(B,O,V),N=Math.max(B,O,V),U=Math.abs(F)*f+Math.abs(R)*_,k>U||N<-U)return!1;if(B=y*D-g*P,O=b*D-v*P,V=E*D-A*P,k=Math.min(B,O,V),N=Math.max(B,O,V),U=Math.abs(P)*f+Math.abs(D)*m,k>U||N<-U)return!1;if(B=y*z-g*M,O=b*z-v*M,V=E*z-A*M,k=Math.min(B,O,V),N=Math.max(B,O,V),U=Math.abs(M)*f+Math.abs(z)*m,k>U||N<-U)return!1;if(B=y*R-g*L,O=b*R-v*L,V=E*R-A*L,k=Math.min(B,O,V),N=Math.max(B,O,V),U=Math.abs(L)*f+Math.abs(R)*m,k>U||N<-U)return!1;if(k=Math.min(g,v,A),N=Math.max(g,v,A),k>f||N<-f)return!1;if(k=Math.min(y,b,E),N=Math.max(y,b,E),k>m||N<-m)return!1;if(k=Math.min(x,w,I),N=Math.max(x,w,I),k>_||N<-_)return!1;const G=P*C-T*M,j=T*z-D*C,$=D*M-P*z,W=-(G*g+j*y+$*x);return U=f*Math.abs(G)+m*Math.abs(j)+_*Math.abs($),!(Math.abs(W)>U)}const Kh=[];class ModelBVH{serializeFromGltf(e,t,i,r){if(e.length<7)return;let n=0;if(109!==e[n++]||98!==e[n++]||120!==e[n++]||98!==e[n++]||118!==e[n++]||104!==e[n++])return;if(43!==e[n++])return;const o=new DataView(e.buffer,e.byteOffset),a=o.getUint16(n,!0);if(n+=2,0===a)return;this._nodes=[];let s=0;for(let e=0;e<a;e++){const e=[t[3*s],t[3*s+1],t[3*s+2]],r=[i[3*s],i[3*s+1],i[3*s+2]];s++;const a=o.getUint16(n,!0);n+=2;let l=0,u=0;65535===a&&(l=o.getUint16(n,!0),n+=2,u=o.getUint32(n,!0),n+=4),this._nodes.push({aabbMin:e,aabbMax:r,backChild:a,indexCount:l,indexOffset:u})}const l=o.getUint32(n,!0);this._indices=r.slice(0,l)}setVertices(e){this._vertices=e}findHighestPoint(e,t){if(!this._nodes||0===this._nodes.length)return null;if(!Yh(this._nodes[0].aabbMin,this._nodes[0].aabbMax,e,t))return null;const i=Kh;i.length=0,i.push(0);let r=-1/0;for(;i.length>0;){const n=i.pop(),o=this._nodes[n];if(o.aabbMax[2]<=r)continue;if(65535===o.backChild){for(let i=0;i<o.indexCount;i+=3){const n=3*this._indices[o.indexOffset+i],a=3*this._indices[o.indexOffset+i+1],s=3*this._indices[o.indexOffset+i+2];Jh(this._vertices[n],this._vertices[n+1],this._vertices[n+2],this._vertices[a],this._vertices[a+1],this._vertices[a+2],this._vertices[s],this._vertices[s+1],this._vertices[s+2],e,t)&&(r=Math.max(r,this._vertices[n+2],this._vertices[a+2],this._vertices[s+2]))}continue}const a=n+1,s=o.backChild,l=this._nodes[a],u=this._nodes[s],c=Yh(l.aabbMin,l.aabbMax,e,t),h=Yh(u.aabbMin,u.aabbMax,e,t);c&&h?l.aabbMax[2]<u.aabbMax[2]?(i.push(a),i.push(s)):(i.push(s),i.push(a)):c?i.push(a):h&&i.push(s)}return r>=0?r:null}}function Qh(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}function ed(e,t){const i=e.json.bufferViews[t.bufferView],r=hh[t.componentType];return new r(e.buffers[i.buffer],(t.byteOffset||0)+(i.byteOffset||0),t.count*(i.byteStride&&i.byteStride!==ph[t.type]*r.BYTES_PER_ELEMENT?i.byteStride/r.BYTES_PER_ELEMENT:ph[t.type]))}function td(e,t,i,r){const n=ed(e,t),o=n instanceof Float32Array?n:new Uint32Array(n.buffer,n.byteOffset,t.count),a=new StructArrayLayout2ui4;a.reserveExact(t.count);let s=-1;for(let e=0;e<t.count;e++){const t=i?o[e]>>>16|o[e]<<16:o[e],r=65535&t,n=t>>>16;s=s<0&&2==(15&n)?r:s,a.emplaceBack(r,n)}r.featureArray=a,s>=0&&(r.doorVertexColor=s)}function id(e,t,i,r,n=!0){const o=hh[t.componentType],a=ph[t.type],s=n?Qh(o):1,l=e.json.bufferViews[t.bufferView],u=l.byteStride?l.byteStride/o.BYTES_PER_ELEMENT:a,c=t.count*u;for(let e=0,t=0;e<c;e+=u,t+=a)for(let n=0;n<a;n++)i[t+n]=r[e+n]*s}function rd(e,t,i){const r=e.indices,n=e.attributes,o={};o.indexArray=new StructArrayLayout3ui6;const a=t.json.accessors[r],s=ed(t,a);o.indexArray.resizeExact(a.count/3),o.indexArray.uint16.set(s),o.vertexArray=new StructArrayLayout3f12;const l=t.json.accessors[n.POSITION],u=ed(t,l);o.vertexArray.resizeExact(l.count),o.vertexArray.float32.set(u),o.aabb=new Aabb(l.min,l.max);const[c,h,d]=l.min,[p,f,m]=l.max;if(o.centroid=[.5*(c+p),.5*(h+f),.5*(d+m)],void 0!==n.COLOR_0){const e=t.json.accessors[n.COLOR_0],i=ph[e.type],r=ed(t,e);o.colorArray=3===i?new StructArrayLayout3f12:new StructArrayLayout4f16,o.colorArray.resizeExact(e.count),id(t,e,o.colorArray.float32,r)}if(void 0!==n.NORMAL){o.normalArray=new StructArrayLayout4b4;const e=t.json.accessors[n.NORMAL];o.normalArray.resizeExact(e.count);const i=ed(t,e);!function(e,t,i,r){const n=hh[t.componentType],o=Qh(n),a=e.json.bufferViews[t.bufferView],s=ph[t.type],l=i.length/t.count,u=a.byteStride?a.byteStride/n.BYTES_PER_ELEMENT:s,c=t.count*u;for(let e=0,t=0;e<c;e+=u,t+=l)for(let n=0;n<s;n++)i[t+n]=Math.round(127*Math.min(1,Math.max(-1,r[e+n]*o)))}(t,e,o.normalArray.int8,i)}if(void 0!==n.TEXCOORD_0&&i.length>0){const e=t.json.accessors[n.TEXCOORD_0],i=ed(t,e);e.normalized&&hh[e.componentType]===Uint16Array?(o.texcoordArray=new StructArrayLayout2ui4,o.texcoordArray.resizeExact(e.count),id(t,e,o.texcoordArray.uint16,i,!1)):(o.texcoordArray=new StructArrayLayout2f8,o.texcoordArray.resizeExact(e.count),id(t,e,o.texcoordArray.float32,i))}const _=!(!t.json.extensionsUsed||!t.json.extensionsUsed.includes("EXT_meshopt_compression"));void 0!==n._FEATURE_ID_RGBA4444&&_&&td(t,t.json.accessors[n._FEATURE_ID_RGBA4444],!1,o),void 0!==n._FEATURE_RGBA4444&&td(t,t.json.accessors[n._FEATURE_RGBA4444],!_,o),o.hasFeatureData=!!o.featureArray;const g=e.material;return o.material=function(e,t){const{emissiveFactor:i=[0,0,0],alphaMode:r="OPAQUE",alphaCutoff:n=.5,normalTexture:o,occlusionTexture:a,emissiveTexture:s,doubleSided:l,name:u}=e,{baseColorFactor:c=[1,1,1,1],metallicFactor:h=1,roughnessFactor:d=1,baseColorTexture:p,metallicRoughnessTexture:f}=e.pbrMetallicRoughness||{},m=a?t[a.index]:void 0;if(a&&a.extensions&&a.extensions.KHR_texture_transform&&m){const e=a.extensions.KHR_texture_transform;m.offsetScale=[e.offset[0],e.offset[1],e.scale[0],e.scale[1]]}return{name:u,pbrMetallicRoughness:{baseColorFactor:new Color(...c),metallicFactor:h,roughnessFactor:d,baseColorTexture:p?t[p.index]:void 0,metallicRoughnessTexture:f?t[f.index]:void 0},doubleSided:l,emissiveFactor:new Color(...i),alphaMode:r,alphaCutoff:n,normalTexture:o?t[o.index]:void 0,occlusionTexture:m,emissionTexture:s?t[s.index]:void 0,defined:void 0===e.defined}}(void 0!==g?t.json.materials[g]:{defined:!1},i),o}function nd(e,i,r){const{matrix:n,rotation:o,translation:a,scale:s,mesh:l,extras:u,children:c,name:h}=e,d={};var p,f;if(d.name=h,d.localMatrix=n||function(e,t,i,r){var n=t[0],o=t[1],a=t[2],s=t[3],l=n+n,u=o+o,c=a+a,h=n*l,d=n*u,p=n*c,f=o*u,m=o*c,_=a*c,g=s*l,y=s*u,x=s*c,v=r[0],b=r[1],w=r[2];return e[0]=(1-(f+_))*v,e[1]=(d+x)*v,e[2]=(p-y)*v,e[3]=0,e[4]=(d-x)*b,e[5]=(1-(h+_))*b,e[6]=(m+g)*b,e[7]=0,e[8]=(p+y)*w,e[9]=(m-g)*w,e[10]=(1-(h+f))*w,e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1,e}([],o||[0,0,0,1],a||[0,0,0],s||[1,1,1]),d.globalMatrix=(p=d.localMatrix,(f=new t(16))[0]=p[0],f[1]=p[1],f[2]=p[2],f[3]=p[3],f[4]=p[4],f[5]=p[5],f[6]=p[6],f[7]=p[7],f[8]=p[8],f[9]=p[9],f[10]=p[10],f[11]=p[11],f[12]=p[12],f[13]=p[13],f[14]=p[14],f[15]=p[15],f),void 0!==l){d.meshes=r[l];const e=d.anchor=[0,0];for(const t of d.meshes){const{min:i,max:r}=t.aabb;e[0]+=i[0]+r[0],e[1]+=i[1]+r[1]}e[0]=Math.floor(e[0]/d.meshes.length/2),e[1]=Math.floor(e[1]/d.meshes.length/2)}if(u&&(u.id&&(d.id=u.id),u.lights&&(d.lights=function(e){if(!e.length)return[];const t=function(e){const t=atob(e),i=new Uint8Array(t.length);for(let e=0;e<t.length;e++)i[e]=t.codePointAt(e);return i}(e),i=[],r=t.length/24,n=new Uint16Array(t.buffer),o=new Float32Array(t.buffer);for(let e=0;e<r;e++){const t=n[2*e*6]/30,r=n[2*e*6+1]/30,a=n[2*e*6+10]/100,s=o[6*e+1],l=o[6*e+2],u=o[6*e+3],c=o[6*e+4],h=u-s,d=c-l,p=Math.hypot(h,d);i.push({pos:[s+.5*h,l+.5*d,r],normal:[d/p,-h/p,0],width:p,height:t,depth:a,points:[s,l,u,c]})}return i}(u.lights)),u.MAPBOX_geometry_bloom&&(d.isGeometryBloom=u.MAPBOX_geometry_bloom),u.MAPBOX_zoom_min&&(d.minZoom=u.MAPBOX_zoom_min),u.MAPBOX_zoom_max&&(d.maxZoom=u.MAPBOX_zoom_max)),c){const e=[];for(const t of c)e.push(nd(i.json.nodes[t],i,r));d.children=e}if(e.extensions&&e.extensions.mbx_bvh&&(d.meshBVH=function(e,t,i){const r=t.binaryAccessor,n=t.positionMinAccessor,o=t.positionMaxAccessor,a=t.indexAccessor;if(!(Number.isInteger(r)&&Number.isInteger(n)&&Number.isInteger(o)&&Number.isInteger(a)))return null;const s=e.json.accessors;if(r>=s.length||n>=s.length||o>=s.length||a>=s.length)return null;const l=s[r],u=s[n],c=s[o],h=s[a];if(void 0===l.bufferView||void 0===u.bufferView||void 0===c.bufferView||void 0===h.bufferView)return null;const d=e.json.bufferViews;if(l.bufferView>=d.length||u.bufferView>=d.length||c.bufferView>=d.length||h.bufferView>=d.length)return null;const p=d[l.bufferView],f=d[u.bufferView],m=d[c.bufferView],_=d[h.bufferView];if(p.buffer>=e.buffers.length||f.buffer>=e.buffers.length||m.buffer>=e.buffers.length||_.buffer>=e.buffers.length)return null;const g=(e,t,i)=>e>=0&&e<=i&&t<=i-e,y=l.byteOffset||0,x=u.byteOffset||0,v=c.byteOffset||0,b=h.byteOffset||0;if(!(g(y,0,p.byteLength)&&g(x,3*u.count*4,f.byteLength)&&g(v,3*c.count*4,m.byteLength)&&g(b,4*h.count,_.byteLength)))return null;const w=new Uint8Array(e.buffers[p.buffer],(p.byteOffset||0)+y,p.byteLength-y),A=new Float32Array(e.buffers[f.buffer],(f.byteOffset||0)+x,3*u.count),E=new Float32Array(e.buffers[m.buffer],(m.byteOffset||0)+v,3*c.count),I=new Uint32Array(e.buffers[_.buffer],(_.byteOffset||0)+b,h.count),D=new ModelBVH;if(D.serializeFromGltf(w,A,E,I),void 0!==i&&e.json.meshes&&e.json.meshes[i]){const t=e.json.meshes[i].primitives[0];if(t&&void 0!==t.attributes.POSITION&&t.attributes.POSITION<s.length){const i=s[t.attributes.POSITION];if(void 0!==i.bufferView&&i.bufferView<d.length){const t=d[i.bufferView];if(t.buffer<e.buffers.length){const r=i.byteOffset||0,n=t.byteStride?t.byteStride/4:3;if(g(r,i.count*n*4,t.byteLength)){const o=(t.byteOffset||0)+r;if(3===n)D.setVertices(new Float32Array(e.buffers[t.buffer],o,3*i.count));else{const r=new Float32Array(e.buffers[t.buffer],o,i.count*n),a=new Float32Array(3*i.count);for(let e=0;e<i.count;e++)a[3*e]=r[e*n],a[3*e+1]=r[e*n+1],a[3*e+2]=r[e*n+2];D.setVertices(a)}}}}}}return D}(i,e.extensions.mbx_bvh,l)),!d.meshBVH&&d.children)for(const e of d.children)if(e.meshBVH){d.meshBVH=e.meshBVH;break}return d}function od(e){if(0===e.vertices.length||0===e.indices.length)return null;const t=new TriangleGridIndex(e.vertices,e.indices,8,256),[i,r]=[t.min.clone(),t.max.clone()];return{vertices:e.vertices,indices:e.indices,grid:t,min:i,max:r}}function ad(e){if(!e.extras||!e.extras.ground)return null;const t=e.extras.ground;if(!t||!Array.isArray(t)||0===t.length)return null;const i=t[0];if(!i||!Array.isArray(i)||0===i.length)return null;const r=[];for(const e of i){if(!Array.isArray(e)||2!==e.length)continue;const t=e[0],i=e[1];"number"==typeof t&&"number"==typeof i&&r.push(new K(t,i))}if(r.length<3)return null;r.length>1&&r.at(-1).equals(r[0])&&r.pop();let n=0;for(let e=0;e<r.length;e++){const t=r[e],i=r[(e+1)%r.length],o=r[(e+2)%r.length];n+=(t.x-i.x)*(o.y-i.y)-(o.x-i.x)*(t.y-i.y)}n>0&&r.reverse();const o=Do(r.flatMap(e=>[e.x,e.y]),[]);return 0===o.length?null:{vertices:r,indices:o}}function sd(e,t){const i=[],r=[];let n=0;const o=[];for(const a of e){n=i.length;const e=a.vertexArray.float32,s=a.indexArray.uint16;for(let r=0;r<a.vertexArray.length;r++)o[0]=e[3*r+0],o[1]=e[3*r+1],o[2]=e[3*r+2],T(o,o,t),i.push(new K(o[0],o[1]));for(let e=0;e<3*a.indexArray.length;e++)r.push(s[e]+n)}if(r.length%3!=0)return null;for(let e=0;e<r.length;e+=3){const t=i[r[e+0]],n=i[r[e+1]],o=i[r[e+2]];(t.x-n.x)*(o.y-n.y)-(o.x-n.x)*(t.y-n.y)>0&&([r[e+1],r[e+2]]=[r[e+2],r[e+1]])}return{vertices:i,indices:r}}function ld(e,t){for(let i=0;i<e.length;i++)if(e[i].name===t)return i;return-1}function ud(e,t){const i=function(e){const t=function(e,t){const i=[],r=WebGL2RenderingContext;if(e.json.textures)for(const n of e.json.textures){const o={magFilter:r.LINEAR,minFilter:r.NEAREST,wrapS:r.REPEAT,wrapT:r.REPEAT};void 0!==n.sampler&&Object.assign(o,e.json.samplers[n.sampler]),i.push({image:t[n.source],sampler:o,uploaded:!1})}return i}(e,e.images),i=function(e,t){const i=[];if(!e.json.meshes)return i;for(const r of e.json.meshes){const n=[];for(const i of r.primitives)n.push(rd(i,e,t));i.push(n)}return i}(e,t),{scenes:r,scene:n,nodes:o}=e.json;let a=r?ld(r,"Default Scene"):-1;a<0&&(a=n||0);const s=r&&r[a]?r[a].nodes||[]:[...o.keys()],l=[];for(const t of s)l.push(nd(o[t],e,i));!function(e,t,i){const r={},n=new Set;for(let o=0;o<e.length;o++){const e=i[t[o]];if(!e.extras)continue;const a=e.extras["mapbox:footprint:version"],s=e.extras["mapbox:footprint:id"];(a||s)&&n.add(o),"1.0.0"===a&&s&&(r[s]=o)}for(let o=0;o<e.length;o++){if(n.has(o))continue;const a=e[o],s=i[t[o]];if(!s.extras)continue;let l=null;a.id in r&&(l=sd(e[r[a.id]].meshes,a.localMatrix)),l||(l=ad(s)),l&&(a.footprint=od(l))}if(n.size>0){const t=Array.from(n.values()).sort((e,t)=>e-t);for(let i=t.length-1;i>=0;i--)e.splice(t[i],1)}}(l,s,e.json.nodes);const u=r?ld(r,"LOD"):-1;if(u>=0){const t=r[u].nodes,n=new Map;for(const r of t){const t=nd(o[r],e,i);t.id&&n.set(t.id,t)}for(const e of l)if(e.id){const t=n.get(e.id);t&&t.meshes&&(e.lodMeshes=t.meshes,t.meshBVH&&(e.meshBVH=t.meshBVH))}}return l}(e);for(const e of i){if(!e.meshBVH)for(const t of e.meshes)cd(t);if(e.lights){let i=65535;for(const t of e.meshes)void 0!==t.doorVertexColor&&(i=t.doorVertexColor,e.lightsStyleAabb=t.aabb);e.lightMeshIndex=e.meshes.length,e.meshes.push(dd(e.lights,t,i))}}return i}function cd(e){e.heightmap=new Float32Array(4096),e.heightmap.fill(-1);const t=e.vertexArray.float32,i=e.aabb.min[0]-1,r=e.aabb.min[1]-1,n=Nh/(e.aabb.max[0]-i+2),o=Nh/(e.aabb.max[1]-r+2);for(let a=0;a<t.length;a+=3){const s=t[a+2],l=(t[a+0]-i)*n|0,u=(t[a+1]-r)*o|0;s>e.heightmap[u*Nh+l]&&(e.heightmap[u*Nh+l]=s)}}function hd(e,t,i,r,n){i.reserve(i.length+4*e.length),r.reserve(r.length+10*e.length),n.reserve(n.length+10*e.length);let o=r.length;for(const a of e){const e=Math.min(10,Math.max(4,1.3*a.height))*t,s=[-a.normal[1],a.normal[0],0],l=Math.min(.29,.1*a.width/a.depth),u=a.width-2*a.depth*t*(l+.01),c=v([],a.pos,s,u/2),h=v([],a.pos,s,-u/2),d=[c[0],c[1],c[2]+a.height],p=[h[0],h[1],h[2]+a.height],f=v([],a.normal,s,l);x(f,f,e);const _=v([],a.normal,s,-l);x(_,_,e),m(f,c,f),m(_,h,_),c[2]+=.1,h[2]+=.1,r.emplaceBack(f[0],f[1],f[2]),r.emplaceBack(_[0],_[1],_[2]),r.emplaceBack(c[0],c[1],c[2]),r.emplaceBack(h[0],h[1],h[2]),r.emplaceBack(d[0],d[1],d[2]),r.emplaceBack(p[0],p[1],p[2]),r.emplaceBack(c[0],c[1],c[2]),r.emplaceBack(h[0],h[1],h[2]),r.emplaceBack(f[0],f[1],f[2]),r.emplaceBack(_[0],_[1],_[2]);const g=u/e/2;n.emplaceBack(-g-l,-1,g,.8),n.emplaceBack(g+l,-1,g,.8),n.emplaceBack(-g,0,g,1.3),n.emplaceBack(g,0,g,1.3),n.emplaceBack(g+l,-.8,g,.7),n.emplaceBack(g+l,-.8,g,.7),n.emplaceBack(0,0,g,1.3),n.emplaceBack(0,0,g,1.3),n.emplaceBack(g+l,-1.2,g,.8),n.emplaceBack(g+l,-1.2,g,.8),i.emplaceBack(6+o,4+o,8+o),i.emplaceBack(7+o,9+o,5+o),i.emplaceBack(0+o,1+o,2+o),i.emplaceBack(1+o,3+o,2+o),o+=10}}function dd(e,t,i){const r={};r.indexArray=new StructArrayLayout3ui6,r.vertexArray=new StructArrayLayout3f12,r.colorArray=new StructArrayLayout4f16,r.indexArray.reserveExact(4*e.length),r.vertexArray.reserveExact(10*e.length),r.colorArray.reserveExact(10*e.length),hd(e,t,r.indexArray,r.vertexArray,r.colorArray),r.featureArray=new StructArrayLayout2ui4,r.featureArray.reserveExact(r.vertexArray.length);for(let e=0;e<r.vertexArray.length;e++)r.featureArray.emplaceBack(i,2);r.hasFeatureData=!0;const n={defined:!0};n.emissiveFactor=Color.black;const o={};return o.baseColorFactor=Color.white,n.pbrMetallicRoughness=o,r.material=n,r.aabb=new Aabb([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),r}rn(ModelBVH,"ModelBVH");const pd=Sa([{name:"a_pos_3f",components:3,type:"Float32"}]),fd=Sa([{name:"a_normal_3",components:3,type:"Int16"}]),md=Sa([{name:"a_centroid_3",components:3,type:"Int16"}]),_d=Sa([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),gd=Sa([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),yd=Sa([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),xd=Sa([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),vd=Sa([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),bd=Sa([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Int16"}]),wd=Sa([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),Ad=Sa([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),Ed=Sa([{name:"a_flood_light_ground_radius",components:1,type:"Float32"}]),Id=Sa([{name:"a_centroid_pos",components:2,type:"Uint16"}]),Sd=Sa([{name:"a_join_normal_inside",components:3,type:"Int16"}]),Dd=Sa([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),Pd=Sa([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:Td}=wd;function zd(e,t,i,r){const n=[],o=0===r?(e,t,i,r,n,o)=>{e.push(new K(o,i+(o-t)/(r-t)*(n-i)))}:(e,t,i,r,n,o)=>{e.push(new K(t+(o-i)/(n-i)*(r-t),o))};for(const a of e){const e=[];for(const n of a){if(n.length<=2)continue;const a=[];for(let e=0;e<n.length-1;e++){const s=n[e].x,l=n[e].y,u=n[e+1].x,c=n[e+1].y,h=0===r?s:l,d=0===r?u:c;h<t?d>t&&o(a,s,l,u,c,t):h>i?d<i&&o(a,s,l,u,c,i):a.push(n[e]),d<t&&h>=t&&o(a,s,l,u,c,t),d>i&&h<=i&&o(a,s,l,u,c,i)}let s=n.at(-1);const l=0===r?s.x:s.y;l>=t&&l<=i&&a.push(s),a.length&&(s=a.at(-1),a[0].x===s.x&&a[0].y===s.y||a.push(a[0]),e.push(a))}e.length&&n.push(e)}return n}const Md=[new K(0,0),new K(Xt,0),new K(Xt,Xt),new K(0,Xt)];function Cd(e,t){const i=[];let r=[];if(!t||e.length<2)return[e];if(2===e.length)return _s(e[0],e[1],Md)?[e]:[];for(let t=0;t<e.length+2;t++){const n=0===t?e.at(-1):e[(t-1)%e.length],o=e[t%e.length],a=e[(t+1)%e.length],s=_s(n,o,Md),l=_s(o,a,Md),u=s||l;u&&r.push(o),u&&l||r.length>0&&(r.length>1&&i.push(r),r=[])}return r.length>1&&i.push(r),i}const Rd=VectorTileFeature.types,Ld=["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"],Fd=["fill-extrusion-flood-light-ground-radius"],Bd=Math.pow(2,13),Od=Math.pow(2,15)-1,Vd=new K(0,1),kd=2147483648,Nd=1073741824;function Ud(e,t,i,r,n,o,a,s){e.emplaceBack((t<<1)+a,(i<<1)+o,(Math.floor(r*Bd)<<1)+n,Math.round(s))}function Gd(e,t,i){e.emplaceBack(t.x*Xt,t.y*Xt,i?1:0)}function jd(e,t,i,r,n,o){e.emplaceBack(t.x,t.y,(i.x<<1)+r,(i.y<<1)+n,o)}function Hd(e,t,i){const r=16384;e.emplaceBack(t.x,t.y,t.z,i[0]*r,i[1]*r,i[2]*r)}class FootprintSegment{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class FootprintSegmentArray{constructor(){this.data=[]}get length(){return this.data.length}push(e){this.data.push(e)}get(e){return this.data[e]}static serialize(e,t){const i=e.data.length,r=new Uint32Array(4*i),n=[];n.length=i;for(let t=0;t<i;t++){const i=e.data[t],o=4*t;r[o]=i.vertexOffset,r[o+1]=i.vertexCount,r[o+2]=i.indexOffset,r[o+3]=i.indexCount,n[t]=i.ringIndices}return t&&t.add(r.buffer),{scalars:r,rings:n}}static deserialize(e){const{scalars:t,rings:i}=e,r=t.length/4,n=new FootprintSegmentArray,o=[];o.length=r,n.data=o;for(let e=0;e<r;e++){const r=4*e,o=new FootprintSegment;o.vertexOffset=t[r],o.vertexCount=t[r+1],o.indexOffset=t[r+2],o.indexCount=t[r+3],o.ringIndices=i[e],n.data[e]=o}return n}}class PartData{constructor(){this.centroidXY=new K(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 K(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new K(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0,this.groupCentroidPos=new K(0,0)}span(){return new K(this.max.x-this.min.x,this.max.y-this.min.y)}}class PartDataArray{constructor(){this.data=[],this.buffer=null}get length(){return this.data.length}push(e){this.data.push(e)}get(e){return this.data[e]}find(e){return this.data.find(e)}[Symbol.iterator](){return this.data[Symbol.iterator]()}static serialize(e,t){const i=e.data.length,r=new Float64Array(15*i);for(let t=0;t<i;t++){const i=e.data[t],n=15*t;r[n]=i.centroidXY.x,r[n+1]=i.centroidXY.y,r[n+2]=i.min.x,r[n+3]=i.min.y,r[n+4]=i.max.x,r[n+5]=i.max.y,r[n+6]=i.groupCentroidPos.x,r[n+7]=i.groupCentroidPos.y,r[n+8]=i.vertexArrayOffset,r[n+9]=i.vertexCount,r[n+10]=i.groundVertexArrayOffset,r[n+11]=i.groundVertexCount,r[n+12]=i.footprintSegLen,r[n+13]=i.height,r[n+14]=i.buildingId}return t&&t.add(r.buffer),{buffer:r}}static deserialize(e){const t=e.buffer,i=t.length/15,r=new PartDataArray;r.buffer=t;const n=[];n.length=i,r.data=n;let o=0;for(let e=0;e<i;e++){const i=15*e,n=new PartData;n.centroidXY=new K(t[i],t[i+1]),n.min=new K(t[i+2],t[i+3]),n.max=new K(t[i+4],t[i+5]),n.groupCentroidPos=new K(t[i+6],t[i+7]),n.vertexArrayOffset=t[i+8],n.vertexCount=t[i+9],n.groundVertexArrayOffset=t[i+10],n.groundVertexCount=t[i+11],n.footprintSegLen=t[i+12],n.height=t[i+13],n.buildingId=t[i+14],n.footprintSegIdx=o,o+=n.footprintSegLen,r.data[e]=n}return r}}class BorderCentroidData{constructor(){this.acc=new K(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(e,t){e.min.x===Number.MAX_VALUE&&(e.min.x=e.max.x=t.x,e.min.y=e.max.y=t.y)}appendEdge(e,t,i){this.accCount++,this.acc._add(t);let r=!!this.borders;t.x<e.min.x?(e.min.x=t.x,r=!0):t.x>e.max.x&&(e.max.x=t.x,r=!0),t.y<e.min.y?(e.min.y=t.y,r=!0):t.y>e.max.y&&(e.max.y=t.y,r=!0),((0===t.x||t.x===Xt)&&t.x===i.x)!=((0===t.y||t.y===Xt)&&t.y===i.y)&&this.processBorderOverlap(t,i),r&&this.checkBorderIntersection(t,i)}checkBorderIntersection(e,t){t.x<0!=e.x<0&&this.addBorderIntersection(0,rt(t.y,e.y,(0-t.x)/(e.x-t.x))),t.x>Xt!=e.x>Xt&&this.addBorderIntersection(1,rt(t.y,e.y,(Xt-t.x)/(e.x-t.x))),t.y<0!=e.y<0&&this.addBorderIntersection(2,rt(t.x,e.x,(0-t.y)/(e.y-t.y))),t.y>Xt!=e.y>Xt&&this.addBorderIntersection(3,rt(t.x,e.x,(Xt-t.y)/(e.y-t.y)))}addBorderIntersection(e,t){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 i=this.borders[e];t<i[0]&&(i[0]=t),t>i[1]&&(i[1]=t)}processBorderOverlap(e,t){if(e.x===t.x){if(e.y===t.y)return;const i=0===e.x?0:1;this.addBorderIntersection(i,t.y),this.addBorderIntersection(i,e.y)}else{const i=0===e.y?2:3;this.addBorderIntersection(i,t.x),this.addBorderIntersection(i,e.x)}}centroid(){return 0===this.accCount?new K(0,0):new K(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((e,t)=>e+ +(t[0]!==Number.MAX_VALUE),0):0}}function $d(e,t){const i=e.add(t)._unit(),r=ve(e.x*i.x+e.y*i.y,-1,1);var n,o,a;return a=Math.acos(r),Math.min(4,Math.max(-4,Math.tan(a)))/4*Od*((n=e).x*(o=t).y-n.y*o.x<0?-1:1)}const Wd=[e=>e.x<0,e=>e.x>Xt,e=>e.y<0,e=>e.y>Xt];function Xd(e,t,i,r){const n=[4];if(0===r)return n;i._mult(r);const o=e.sub(i),a=t.sub(i),s=[e,t,o,a];for(let e=0;e<4;e++)for(const t of s)if(Wd[e](t)){n.push(e);break}return n}class GroundEffect{constructor(e){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new StructArrayLayout5i10,this.indexArray=new StructArrayLayout3ui6,this.programConfigurations=new ProgramConfigurationSet(e.layers,{zoom:e.zoom,lut:e.lut},e=>Fd.includes(e)),this._segments=new SegmentVector,this.hiddenByLandmarkVertexArray=new StructArrayLayout1ub1,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new SegmentVector}getDefaultSegment(){return this.regionSegments[4]}hasData(){return 0!==this.vertexArray.length}addData(e,t,i,r=!1){const n=e.length;if(n>2){let o=Math.max(0,this._segments.get().length-1);const a=this._segments._prepareSegment(4*n,this.vertexArray.length,2*this._segmentToGroundQuads[o].length);let s;o!==this._segments.get().length-1&&(o++,this._segmentToGroundQuads[o]=[],this._segmentToRegionTriCounts[o]=[0,0,0,0,0]);{const t=e[0],i=e[1];s=$d(t.sub(e[n-1])._perp()._unit(),i.sub(t)._perp()._unit())}for(let l=0;l<n;l++){const u=l===n-1?0:l+1,c=e[l],h=e[u],d=e[u===n-1?0:u+1],p=h.sub(c)._perp()._unit(),f=$d(p,d.sub(h)._perp()._unit()),m=s,_=f;if(ep(c,h,t)||r&&tp(c,t)&&tp(h,t)){s=f;continue}const g=a.vertexLength;jd(this.vertexArray,c,h,1,1,m),jd(this.vertexArray,c,h,1,0,m),jd(this.vertexArray,c,h,0,1,_),jd(this.vertexArray,c,h,0,0,_),a.vertexLength+=4;const y=Xd(c,h,p,i);for(const e of y)this._segmentToGroundQuads[o].push({id:g,region:e}),this._segmentToRegionTriCounts[o][e]+=2,a.primitiveLength+=2;s=f}}}prepareBorderSegments(){if(!this.hasData())return;const e=this._segments.get(),t=e.length;for(let e=0;e<t;e++)this._segmentToGroundQuads[e].sort((e,t)=>e.region-t.region);for(let i=0;i<t;i++){const t=this._segmentToGroundQuads[i],r=e[i],n=this._segmentToRegionTriCounts[i];n.reduce((e,t)=>e+t,0);let o=0;for(let e=0;e<=4;e++){const t=n[e];if(0!==t){let i=this.regionSegments[e];i||(i=this.regionSegments[e]=new SegmentVector);const n={vertexOffset:r.vertexOffset,primitiveOffset:r.primitiveOffset+o,vertexLength:r.vertexLength,primitiveLength:t};i.get().push(n)}o+=t}for(let e=0;e<t.length;e++){const i=t[e].id;this.indexArray.emplaceBack(i,i+1,i+3),this.indexArray.emplaceBack(i,i+3,i+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(e,t,i,r,n,o,a){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,e,t,i,r,n,o,void 0,a)}upload(e){this.hasData()&&(this.vertexBuffer=e.createVertexBuffer(this.vertexArray,Ad.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),null!=this.groundRadiusArray&&(this.groundRadiusBuffer=e.createVertexBuffer(this.groundRadiusArray,Ed.members)))}uploadPaintProperties(e){this.hasData()&&this.programConfigurations.upload(e)}update(e,t,i,r,n,o,a,s){this.hasData()&&this.programConfigurations.updatePaintArrays(e,t,i,r,n,o,a,s)}updateHiddenByLandmark(e){this.updateHiddenByLandmarkRange(e.groundVertexArrayOffset,e.groundVertexCount,!!(e.flags&kd||e.flags&Nd))}updateHiddenByLandmarkRange(e,t,i){if(!this.hasData())return;const r=t+e;if(0!==t){for(let t=e;t<r;++t)this.hiddenByLandmarkVertexArray.emplace(t,i?1:0);this._needsHiddenByLandmarkUpdate=!0}}uploadHiddenByLandmark(e){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,Dd.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 e=0;e<=4;e++){const t=this.regionSegments[e];t&&t.destroy()}}}}class FillExtrusionBucket{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.pixelRatio=e.pixelRatio,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=new PartDataArray,this.footprintIndices=new StructArrayLayout3ui6,this.footprintVertices=new StructArrayLayout2i4,this.footprintSegments=new FootprintSegmentArray,this.layoutVertexArray=new StructArrayLayout4i8,this.centroidVertexArray=new FillExtrusionCentroidArray,this.wallVertexArray=new FillExtrusionWallArray,this.indexArray=new StructArrayLayout3ui6,this.programConfigurations=new ProgramConfigurationSet(e.layers,{zoom:e.zoom,lut:e.lut},e=>Ld.includes(e)),this.segments=new SegmentVector,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.groundEffect=new GroundEffect(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.buildingGroups=new Map,this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,t){}updateAppearances(e,t,i,r){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,i,r){this.features=[],this.hasPattern=ea("fill-extrusion",this.layers,this.pixelRatio,t),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=fa(i),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:n,id:o,index:a,sourceLayerIndex:s}of e){const e=this.layers[0]._featureFilter.needGeometry,l=Aa(n,e);if(!this.layers[0]._featureFilter.filter(new EvaluationParameters(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),l,i))continue;const u={id:o,sourceLayerIndex:s,index:a,geometry:e?l.geometry:wa(n,i,r),properties:n.properties,type:n.type,patterns:{}},c=this.layoutVertexArray.length,h="Polygon"===Rd[u.type];if(this.hasPattern)this.features.push({featureId:n.id,feature:ta("fill-extrusion",this.layers,u,this.zoom,this.pixelRatio,t)});else if(this.wallMode)for(const e of u.geometry)for(const o of Cd(e,h))this.addFeature(n.id,u,[o],a,i,{},t.availableImages,r,t.brightness);else this.addFeature(n.id,u,u.geometry,a,i,{},t.availableImages,r,t.brightness);t.featureIndex.insert(n,u.geometry,a,s,this.index,c)}this._finalizeBuildingGroups(),this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,t,i,r,n,o){for(const{featureId:e,feature:a}of this.features){const s="Polygon"===Rd[a.type],{geometry:l}=a;if(this.wallMode)for(const u of l)for(const l of Cd(u,s))this.addFeature(e,a,[l],a.index,t,i,r,n,o);else this.addFeature(e,a,l,a.index,t,i,r,n,o)}this._finalizeBuildingGroups(),this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles()}update(e,t,i,r,n,o,a){this.programConfigurations.updatePaintArrays(e,t,n,i,r,o,a,this.worldview),this.groundEffect.update(e,t,n,i,r,o,a,this.worldview)}updateExpressions(e){this.programConfigurations.updateExpressions(e),this.groundEffect.programConfigurations.updateExpressions(e)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Td),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,Sd.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,Pd.members,!0)),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}uploadCentroid(e){this.groundEffect.uploadHiddenByLandmark(e),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Id.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(e,t,i,r,n,o,a,s,l){const u=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(t,{})/this.tileToMeter,c=[new K(0,0),new K(Xt,Xt)],h=s.projection,d="globe"===h.name,p=this.wallMode||"Polygon"===Rd[t.type],f=new BorderCentroidData;f.centroidDataIndex=this.centroidData.length;const m=new PartData;m.buildingId=e,t.properties&&Object.hasOwn(t.properties,"building_id")&&(m.buildingId=Number(t.properties.building_id)),f.buildingId=m.buildingId;const _=this.layers[0].paint.get("fill-extrusion-base").evaluate(t,{},n)<=0,g=this.layers[0].paint.get("fill-extrusion-height").evaluate(t,{},n);let y;if(m.height=g,m.vertexArrayOffset=this.layoutVertexArray.length,m.groundVertexArrayOffset=this.groundEffect.vertexArray.length,d&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new StructArrayLayout6i12),this.wallMode){if(d)return void ze("Non zero fill-extrusion-line-width is not yet supported on globe.");if(1!==i.length)return;y=function(e){const t=e[0].x===e.at(-1).x&&e[0].y===e.at(-1).y,i=function(e){let t=0;const i=e.length;for(let r=0;r<i;r++)t+=(e[(r+1)%i].x-e[r].x)*(e[(r+1)%i].y+e[r].y);return t>=0}(e);i||(e=e.reverse());const r={geometry:[],joinNormals:[],indices:[]},n=[],o=[],a=[];let s=e.length;for(;s>=2&&e[s-1].equals(e[s-2]);)s--;if(s<(t?3:2))return r;let l,u,c,h,d,p=0;for(;p<s-1&&e[p].equals(e[p+1]);)p++;t&&(l=e[s-2],d=e[p].sub(l)._unit()._perp());for(let i=p;i<s;i++){if(c=i===s-1?t?e[p+1]:void 0:e[i+1],c&&e[i].equals(c))continue;d&&(h=d),l&&(u=l),l=e[i],d=c?c.sub(l)._unit()._perp():h,h=h||d;let r=h.add(d);0===r.x&&0===r.y||r._unit();const f=r.x*d.x+r.y*d.y,m=0!==f?1/f:1/0,_=h.x*d.y-h.y*d.x>0;let g="miter";const y=2;"miter"===g&&m>y&&(g="bevel"),"bevel"===g&&(m>100&&(g="flipbevel"),m<y&&(g="miter"));const x=(e,t,i,r)=>{const s=new K(e.x,e.y),l=new K(e.x,e.y);s.x+=t.x*r,s.y+=t.y*r,l.x-=t.x*Math.max(i,1),l.y-=t.y*Math.max(i,1),a.push(t),n.push(s),o.push(l)};if("miter"===g)r._mult(m),x(l,r,0,0);else if("flipbevel"===g)r=d.mult(-1),x(l,r,0,0),x(l,r.mult(-1),0,0);else{const e=-Math.sqrt(m*m-1),t=_?e:0,i=_?0:e;u&&x(l,h,t,i),c&&x(l,d,t,i)}}r.geometry=[...n,...o.reverse(),n[0]],r.joinNormals=[...a,...a.reverse(),a.at(-1)];const f=r.geometry.length-1;for(let e=0;e<f/2;e++)if(e+1<f/2){let t=e,i=e+1,n=f-1-e,o=f-2-e;t=0===t?f-1:t-1,i=0===i?f-1:i-1,n=0===n?f-1:n-1,o=0===o?f-1:o-1,r.indices.push(n),r.indices.push(i),r.indices.push(t),r.indices.push(n),r.indices.push(o),r.indices.push(i)}return r}(i[0]),i=[y.geometry]}const x=(e,t)=>e<(t.length-1)/2||e===t.length-1,v=this.wallMode?[i]:ae(i,500);for(let e=v.length-1;e>=0;e--){const t=v[e];(0===t.length||ip(t[0]))&&v.splice(e,1)}let b;if(d)b=op(v,c,n);else{b=[];for(const e of v)b.push({polygon:e,bounds:c})}const w=p?this.edgeRadius:0,A=w>0&&this.zoom<17,E=(e,t)=>{if(0===e.length)return!1;const i=e.at(-1);return t.x===i.x&&t.y===i.y};for(const{polygon:e,bounds:t}of b){let i=0,r=0;for(const t of e)p&&!t[0].equals(t.at(-1))&&t.push(t[0]),r+=p?t.length-1:t.length;const o=this.segments.prepareSegment((p?5:4)*r,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},s=new FootprintSegment;if(s.vertexOffset=this.footprintVertices.length,s.indexOffset=3*this.footprintIndices.length,s.ringIndices=[],p){const r=[],a=[];i=o.vertexLength;for(let i=0;i<e.length;i++){const l=e[i];l.length&&0!==i&&a.push(r.length/2);const c=[];let p,f;p=l[1].sub(l[0])._perp()._unit(),s.ringIndices.push(l.length-1);for(let e=1;e<l.length;e++){const t=l[e],i=l[e===l.length-1?1:e+1],a=t.clone();if(w){f=Zd(t,i,p);const e=Yd(p,f),r=Jd(p,f),n=w*Math.min(4,1/r);a.x+=n*e.x,a.y+=n*e.y,a.x=Math.round(a.x),a.y=Math.round(a.y),p=f}if(!_||0!==w&&!A||E(c,a)||c.push(a),Ud(this.layoutVertexArray,a.x,a.y,0,0,1,1,0),this.wallMode){const t=x(e,l);Gd(this.wallVertexArray,y.joinNormals[e],!t)}o.vertexLength++,this.footprintVertices.emplaceBack(t.x,t.y),r.push(t.x,t.y),d&&Hd(this.layoutVertexExtArray,h.projectTilePoint(a.x,a.y,n),h.upVector(n,a.x,a.y))}_&&(0===w||A)&&(0!==c.length&&E(c,c[0])&&c.pop(),this.groundEffect.addData(c,t,u))}const l=this.wallMode?y.indices:Do(r,a);for(let e=0;e<l.length;e+=3)this.footprintIndices.emplaceBack(s.vertexOffset+l[e+0],s.vertexOffset+l[e+1],s.vertexOffset+l[e+2]),this.indexArray.emplaceBack(i+l[e],i+l[e+2],i+l[e+1]),o.primitiveLength++;s.indexCount+=l.length,s.vertexCount+=this.footprintVertices.length-s.vertexOffset}for(let r=0;r<e.length;r++){const a=e[r];f.startRing(m,a[0]);let s=a.length>4&&rp(a[a.length-2],a[0],a[1]),l=w?Kd(a[a.length-2],a[0],a[1],w):0;const c=[];let g,v,b;v=a[1].sub(a[0])._perp()._unit();let A=!0;for(let e=1,r=0;e<a.length;e++){let u=a[e-1],p=a[e];const I=a[e===a.length-1?1:e+1];if(f.appendEdge(m,p,u),ep(p,u,t)){w&&(v=I.sub(p)._perp()._unit(),A=!A);continue}const D=p.sub(u)._perp(),P=D.x/(Math.abs(D.x)+Math.abs(D.y)),T=D.y>0?1:0,z=u.dist(p);if(r+z>32768&&(r=0),w){b=Zd(p,I,v);let e=Qd(u,p,I,Jd(v,b),w);isNaN(e)&&(e=0);const t=qd(u,p,new K(0,0));u=u.add(t.mult(l))._round(),p=p.add(t.mult(-e))._round(),l=e,v=b,_&&this.zoom>=17&&(E(c,u)||c.push(u),E(c,p)||c.push(p))}const M=o.vertexLength,C=a.length>4&&rp(u,p,I);let R=np(r,s,A);if(Ud(this.layoutVertexArray,u.x,u.y,P,T,0,0,R),Ud(this.layoutVertexArray,u.x,u.y,P,T,0,1,R),this.wallMode){const t=x(e-1,a),i=y.joinNormals[e-1];Gd(this.wallVertexArray,i,t),Gd(this.wallVertexArray,i,t)}if(r+=z,R=np(r,C,!A),s=C,Ud(this.layoutVertexArray,p.x,p.y,P,T,0,0,R),Ud(this.layoutVertexArray,p.x,p.y,P,T,0,1,R),this.wallMode){const t=x(e,a),i=y.joinNormals[e];Gd(this.wallVertexArray,i,t),Gd(this.wallVertexArray,i,t)}if(o.vertexLength+=4,this.indexArray.emplaceBack(M+0,M+1,M+2),this.indexArray.emplaceBack(M+1,M+3,M+2),o.primitiveLength+=2,w){const r=i+(1===e?a.length-2:e-2),n=1===e?i:r+1;if(this.indexArray.emplaceBack(M+1,r,M+3),this.indexArray.emplaceBack(r,n,M+3),o.primitiveLength+=2,void 0===g&&(g=M),!ep(I,a[e],t)){const t=e===a.length-1?g:o.vertexLength;this.indexArray.emplaceBack(M+2,M+3,t),this.indexArray.emplaceBack(M+3,t+1,t),this.indexArray.emplaceBack(M+3,n,t+1),o.primitiveLength+=3}A=!A}if(d){const e=this.layoutVertexExtArray,t=h.projectTilePoint(u.x,u.y,n),i=h.projectTilePoint(p.x,p.y,n),r=h.upVector(n,u.x,u.y),o=h.upVector(n,p.x,p.y);Hd(e,t,r),Hd(e,t,r),Hd(e,i,o),Hd(e,i,o)}}p&&(i+=a.length-1),_&&w&&this.zoom>=17&&(0!==c.length&&E(c,c[0])&&c.pop(),this.groundEffect.addData(c,t,u,w>0))}this.footprintSegments.push(s),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?Vd:this.encodeCentroid(f,m),t.properties&&Object.hasOwn(t.properties,"building_id")){const e=m.buildingId;let t=this.buildingGroups.get(e);t||(t={accX:0,accY:0,accCount:0,mergedMin:new K(Number.MAX_VALUE,Number.MAX_VALUE),mergedMax:new K(-Number.MAX_VALUE,-Number.MAX_VALUE),partIndices:[]},this.buildingGroups.set(e,t)),t.accX+=f.acc.x,t.accY+=f.acc.y,t.accCount+=f.accCount,t.mergedMin.x=Math.min(t.mergedMin.x,m.min.x),t.mergedMin.y=Math.min(t.mergedMin.y,m.min.y),t.mergedMax.x=Math.max(t.mergedMax.x,m.max.x),t.mergedMax.y=Math.max(t.mergedMax.y,m.max.y),t.partIndices.push(this.centroidData.length)}if(this.centroidData.push(m),f.borders){this.featuresOnBorder.push(f);const e=this.featuresOnBorder.length-1;for(let t=0;t<f.borders.length;t++)f.borders[t][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[t].push(e)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,o,a,n,l,void 0,this.worldview),this.groundEffect.addPaintPropertiesData(t,r,o,a,n,l,this.worldview),this.maxHeight=Math.max(this.maxHeight,g)}}_finalizeBuildingGroups(){for(const[,e]of this.buildingGroups){if(0===e.partIndices.length)continue;const t=new BorderCentroidData;t.acc=new K(e.accX,e.accY),t.accCount=e.accCount;const i=new PartData;i.min=e.mergedMin,i.max=e.mergedMax;const r=this.encodeCentroid(t,i),n=t.centroid();for(const t of e.partIndices){const i=this.centroidData.get(t);i.centroidXY.x===Vd.x&&i.centroidXY.y===Vd.y||(i.centroidXY=r),i.min=e.mergedMin,i.max=e.mergedMax,i.groupCentroidPos=n}}this.buildingGroups.clear()}sortBorders(){for(let e=0;e<this.borderFeatureIndices.length;e++)this.borderFeatureIndices[e].sort((t,i)=>this.featuresOnBorder[t].borders[e][0]-this.featuresOnBorder[i].borders[e][0])}splitToSubtiles(){const e=[];for(let t=0;t<this.centroidData.length;t++){const i=this.centroidData.get(t),r=+(i.min.y+i.max.y>Xt),n=2*r+(+(i.min.x+i.max.x>Xt)^r);for(let r=0;r<i.polygonSegLen;r++){const o=i.polygonSegIdx+r;e.push({centroidIdx:t,subtile:n,polygonSegmentIdx:o,triangleSegmentIdx:this.polygonSegments[o].triangleSegIdx})}}const t=new StructArrayLayout3ui6;e.sort((e,t)=>e.triangleSegmentIdx===t.triangleSegmentIdx?e.subtile-t.subtile:e.triangleSegmentIdx-t.triangleSegmentIdx);let i=0,r=0,n=0;for(const t of e){if(t.triangleSegmentIdx!==i)break;n++}const o=e.length;for(;r!==e.length;){i=e[r].triangleSegmentIdx;let a=0,s=r,l=r;for(let t=s;t<n&&e[t].subtile===a;t++)l++;for(;s!==n;){const r=e[s];a=r.subtile;const o=this.centroidData.get(r.centroidIdx).min.clone(),u=this.centroidData.get(r.centroidIdx).max.clone(),c={vertexOffset:this.segments.segments[i].vertexOffset,primitiveOffset:t.length,vertexLength:this.segments.segments[i].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let i=s;i<l;i++){const r=e[i],n=this.polygonSegments[r.polygonSegmentIdx],a=this.centroidData.get(r.centroidIdx).min,s=this.centroidData.get(r.centroidIdx).max,l=this.indexArray.uint16;for(let e=n.triangleArrayOffset;e<n.triangleArrayOffset+n.triangleCount;e++)t.emplaceBack(l[3*e],l[3*e+1],l[3*e+2]);c.primitiveLength+=n.triangleCount,o.x=Math.min(o.x,a.x),o.y=Math.min(o.y,a.y),u.x=Math.max(u.x,s.x),u.y=Math.max(u.y,s.y)}c.primitiveLength>0&&this.triangleSubSegments.push({segment:c,min:o,max:u}),s=l;for(let t=s;t<n&&e[t].subtile===e[s].subtile;t++)l++}r=n;for(let t=r;t<o&&e[t].triangleSegmentIdx===e[r].triangleSegmentIdx;t++)n++}t._trim(),this.indexArray=t}getVisibleSegments(e,t,i){const r=new SegmentVector;if(this.wallMode){for(const e of this.triangleSubSegments)r.segments.push(e.segment);return r}let n=0,o=0;const a=1<<e.canonical.z;if(t){const i=t.getMinMaxForTile(e);i&&(n=i.min,o=i.max)}o+=this.maxHeight;const s=e.toUnwrapped();let l;const u=[s.canonical.x/a+s.wrap,s.canonical.y/a],c=[(s.canonical.x+1)/a+s.wrap,(s.canonical.y+1)/a],h=(e,t,i)=>[rt(e[0],t[0],i[0]),rt(e[1],t[1],i[1])],d=[],p=[];for(const e of this.triangleSubSegments){d[0]=e.min.x/Xt,d[1]=e.min.y/Xt,p[0]=e.max.x/Xt,p[1]=e.max.y/Xt;const t=h(u,c,d),a=h(u,c,p);if(0===new Aabb([t[0],t[1],n],[a[0],a[1],o]).intersectsPrecise(i)){l&&(r.segments.push(l),l=void 0);continue}const s=e.segment;l&&l.vertexOffset!==s.vertexOffset&&(r.segments.push(l),l=void 0),l?(l.vertexLength+=s.vertexLength,l.primitiveLength+=s.primitiveLength):l={vertexOffset:s.vertexOffset,primitiveLength:s.primitiveLength,vertexLength:s.vertexLength,primitiveOffset:s.primitiveOffset,sortKey:void 0,vaos:{}}}return l&&r.segments.push(l),r}encodeCentroid(e,t){const i=e.centroid(),r=t.span(),n=Math.min(7,Math.round(r.x*this.tileToMeter/10)),o=Math.min(6,Math.round(r.y*this.tileToMeter/10));return new K(ve(i.x,1,8191)<<3|n,ve(i.y,1,8191)<<3|o)}encodeBorderCentroid(e){if(!e.borders)return new K(0,0);const t=e.borders,i=Number.MAX_VALUE;if(t[0][0]!==i||t[1][0]!==i){const e=t[0][0]!==i?0:1;return new K(6|(t[0][0]!==i?0:65528),(t[e][0]+t[e][1])/2<<3|6)}{const e=t[2][0]!==i?2:3;return new K((t[e][0]+t[e][1])/2<<3|6,6|(t[2][0]!==i?0:65528))}}showCentroid(e,t){const i=this.centroidData.get(e.centroidDataIndex);if(i.flags&=kd,"keep"!==t||7&~i.centroidXY.y){if(0!==i.groupCentroidPos.x||0!==i.groupCentroidPos.y){const e=i.span(),t=Math.min(7,Math.round(e.x*this.tileToMeter/10)),r=Math.min(6,Math.round(e.y*this.tileToMeter/10));i.centroidXY=new K(ve(i.groupCentroidPos.x,1,8191)<<3|t,ve(i.groupCentroidPos.y,1,8191)<<3|r)}else i.centroidXY=new K(0,0);this.writeCentroidToBuffer(i)}else this.writeCentroidToBuffer(i)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);const t=e.vertexArrayOffset,i=e.vertexCount+e.vertexArrayOffset,r=-1073741824&e.flags?Vd:e.centroidXY,n=this.centroidVertexArray.geta_centroid_pos0(t);if(this.centroidVertexArray.geta_centroid_pos1(t)!==r.y||n!==r.x){for(let e=t;e<i;++e)this.centroidVertexArray.emplace(e,r.x,r.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const e of this.centroidData)this.writeCentroidToBuffer(e)}updateReplacement(e,t,i){if(t.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=t.updateTime;const r=t.getReplacementRegionsForTile(e.toUnwrapped());if(su(this.activeReplacements,r))return;if(this.activeReplacements=r,0===this.centroidVertexArray.length)this.createCentroidsBuffer();else for(const e of this.centroidData)e.flags&=1073741823;const n=[];for(const t of this.activeReplacements){if(t.order<i)continue;const r=Math.max(1,Math.pow(2,t.footprintTileId.canonical.z-e.canonical.z));if(t.footprint.buildingIds)for(const e of this.centroidData)e.flags&kd||e.flags&Nd||t.min.x>e.max.x||e.min.x>t.max.x||t.min.y>e.max.y||e.min.y>t.max.y||t.footprint.buildingIds.has(e.buildingId)&&(e.flags|=0!==t.clipMask?-1073741824:kd);else for(const i of this.centroidData)if(!(i.flags&kd||i.flags&Nd||t.min.x>i.max.x||i.min.x>t.max.x||t.min.y>i.max.y||i.min.y>t.max.y))for(let o=0;o<i.footprintSegLen;o++){const a=this.footprintSegments.get(i.footprintSegIdx+o);if(n.length=0,ap(this.footprintVertices,a.vertexOffset,a.vertexCount,t.footprintTileId.canonical,e.canonical,n),lu(t.footprint,n,this.footprintIndices.uint16,a.indexOffset,a.indexCount,-a.vertexOffset,-r)){i.flags|=0!==t.clipMask?-1073741824:kd;break}}}for(const e of this.centroidData)this.writeCentroidToBuffer(e);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(e,t,i){let r=!1;for(let n=0;n<i.footprintSegLen;n++){const o=this.footprintSegments.get(i.footprintSegIdx+n);let a=0;for(const i of o.ringIndices){for(let n=a,s=i+a-1;n<i+a;s=n++){const i=this.footprintVertices.int16[2*(n+o.vertexOffset)+0],a=this.footprintVertices.int16[2*(n+o.vertexOffset)+1],l=this.footprintVertices.int16[2*(s+o.vertexOffset)+1];a>t!=l>t&&e<(this.footprintVertices.int16[2*(s+o.vertexOffset)+0]-i)*(t-a)/(l-a)+i&&(r=!r)}a=i}}return r}getHeightAtTileCoord(e,t){let i=Number.NEGATIVE_INFINITY,r=!0;const n=4*(e+Xt)*Xt+(t+Xt);if(Object.hasOwn(this.partLookup,n)){const e=this.partLookup[n];return e?{height:e.height,hidden:!!(e.flags&kd)}:void 0}const o=this.centroidData.buffer,a=this.centroidData.length;for(let s=0;s<a;s++){const a=15*s;if(e>o[a+4]||o[a+2]>e||t>o[a+5]||o[a+3]>t)continue;const l=o[a+13];if(l<=i)continue;const u=this.centroidData.get(s);this.footprintContainsPoint(e,t,u)&&(i=l,this.partLookup[n]=u,r=!!(u.flags&kd))}if(i!==Number.NEGATIVE_INFINITY)return{height:i,hidden:r};this.partLookup[n]=void 0}}function qd(e,t,i){return e.equals(t)?i:t.sub(e)._unit()}function Zd(e,t,i){return e.equals(t)?i:t.sub(e)._perp()._unit()}function Yd(e,t){const i=e.add(t),r=i.mag();return 0===r?e:i.div(r)}function Jd(e,t){const i=Yd(e,t);return e.x*i.x+e.y*i.y}function Kd(e,t,i,r){let n,o;return e.equals(t)?(o=Zd(t,i,new K(0,0)),n=o):(n=t.sub(e)._perp()._unit(),o=Zd(t,i,n)),Qd(e,t,i,Jd(n,o),r)}function Qd(e,t,i,r,n){const o=Math.sqrt(1-r*r);return Math.min(e.dist(t)/3,t.dist(i)/3,n*o/r)}function ep(e,t,i){return e.x<i[0].x&&t.x<i[0].x||e.x>i[1].x&&t.x>i[1].x||e.y<i[0].y&&t.y<i[0].y||e.y>i[1].y&&t.y>i[1].y}function tp(e,t){return e.x<t[0].x||e.x>t[1].x||e.y<t[0].y||e.y>t[1].y}function ip(e){return e.every(e=>e.x<=0)||e.every(e=>e.x>=Xt)||e.every(e=>e.y<=0)||e.every(e=>e.y>=Xt)}function rp(e,t,i){if(e.x<0||e.x>=Xt||t.x<0||t.x>=Xt||i.x<0||i.x>=Xt)return!1;const r=i.sub(t),n=r.perp(),o=e.sub(t);return(r.x*o.x+r.y*o.y)/Math.sqrt((r.x*r.x+r.y*r.y)*(o.x*o.x+o.y*o.y))>-.866&&n.x*o.x+n.y*o.y<0}function np(e,t,i){const r=t?2|e:-3&e;return i?1|r:-2&r}function op(e,t,i){const r=1<<i.z,n=Lt(i.x/r),o=Lt((i.x+1)/r),a=Ft(i.y/r),s=Ft((i.y+1)/r);return function(e,t,i,r,n=0,o){const a=[];if(!e.length||!i||!r)return a;const s=(e,t)=>{for(const i of e)a.push({polygon:i,bounds:t})},l=Math.ceil(Math.log2(i)),u=Math.ceil(Math.log2(r)),c=l-u,h=[];for(let e=0;e<Math.abs(c);e++)h.push(c>0?0:1);for(let e=0;e<Math.min(l,u);e++)h.push(0),h.push(1);let d=e;if(d=zd(d,t[0].y-n,t[1].y+n,1),d=zd(d,t[0].x-n,t[1].x+n,0),!d.length)return a;const p=[];for(h.length?p.push({polygons:d,bounds:t,depth:0}):s(d,t);p.length;){const e=p.pop(),t=e.depth,i=h[t],r=e.bounds[0],a=e.bounds[1],l=0===i?r.x:r.y,u=0===i?a.x:a.y,c=o?o(i,l,u):.5*(l+u),d=zd(e.polygons,l-n,c+n,i),f=zd(e.polygons,c-n,u+n,i);if(d.length){const e=[r,new K(0===i?c:a.x,1===i?c:a.y)];h.length>t+1?p.push({polygons:d,bounds:e,depth:t+1}):s(d,e)}if(f.length){const e=[new K(0===i?c:r.x,1===i?c:r.y),a];h.length>t+1?p.push({polygons:f,bounds:e,depth:t+1}):s(f,e)}}return a}(e,t,Math.ceil((o-n)/11.25),Math.ceil((a-s)/11.25),1,(e,t,n)=>{if(0===e)return.5*(t+n);{const e=Ft((i.y+t/Xt)/r);return(Rt(.5*(Ft((i.y+n/Xt)/r)+e))*r-i.y)*Xt}})}function ap(e,t,i,r,n,o){const a=Math.pow(2,r.z-n.z);for(let s=0;s<i;s++){let i=e.int16[2*(s+t)+0],l=e.int16[2*(s+t)+1];i=(i+n.x*Xt)*a-r.x*Xt,l=(l+n.y*Xt)*a-r.y*Xt,o.push(new K(i,l))}}rn(FillExtrusionBucket,"FillExtrusionBucket",{omit:["layers","features"]}),rn(PartData,"PartData"),rn(PartDataArray,"PartDataArray"),rn(FootprintSegmentArray,"FootprintSegmentArray"),rn(BorderCentroidData,"BorderCentroidData"),rn(GroundEffect,"GroundEffect");const sp=4096;class BuildingGen{constructor(e){this.module=e,this.memoryStack=this.module.malloc(sp),this.memoryStackNextFree=this.memoryStack}createIntArray(e){const t=this.memoryStackNextFree;return this.memoryStackNextFree+=e.length*Int32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>sp?-1:(new Int32Array(this.module.heap32.buffer,t,e.length).set(e),t)}createFloatArray(e){const t=this.memoryStackNextFree;return this.memoryStackNextFree+=e.length*Float32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>sp?-1:(new Float32Array(this.module.heapF32.buffer,t,e.length).set(e),t)}readStringBuffer(e){let t="";for(;0!==this.module.heapU8[e];)t+=String.fromCharCode(this.module.heapU8[e]),++e;return t}setStyle(e){const t=e.normalScale;this.module.setStyle(t[0],t[1],t[2],e.tileToMeters)}setAOOptions(e,t){this.module.setAOOptions(e?1:0,t)}setMetricOptions(e,t){this.module.setMetricOptions(e?1:0,t)}setStructuralOptions(e){this.module.setStructuralOptions(e?1:0)}setFacadeOptions(e,t){this.module.setFacadeOptions(e,t?1:0)}setFauxFacadeOptions(e,t,i){this.module.setFauxFacadeOptions(e?1:0,t?1:0,i)}setFacadeClassifierOptions(e){this.module.setFacadeClassifierOptions(e)}generateMesh(e,t){this.memoryStackNextFree=this.memoryStack;for(const t of e){const e=this.createIntArray(t.ringIndices),i=this.createFloatArray(t.coordinates);if(-1===e||-1===i)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFeature(t.id,t.sourceId,t.minHeight,t.height,t.roofType,i,e,t.ringIndices.length-1)}for(const e of t){let t;t=e.entrances?JSON.parse(e.entrances):[];const i=this.createFloatArray(t),r=this.createFloatArray(e.coordinates);if(-1===i||-1===r)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFacade(e.sourceId,e.crossPerc,e.distanceToRoad,i,t.length,r,e.coordinates.length)}if(!this.module.generateMesh()){const e=this.module.getLastError();return this.readStringBuffer(e)}const i=this.module.getMeshCount(),r=new Array(i);for(let e=0;e<i;e++){const t=this.module.getPositionsPtr(e),i=this.module.getPositionsLength(e),n=new Float32Array(this.module.heapF32.buffer,t,i),o=this.module.getNormalsPtr(e),a=this.module.getNormalsLength(e),s=new Float32Array(this.module.heapF32.buffer,o,a),l=this.module.getAOPtr(e),u=this.module.getAOLength(e),c=new Float32Array(this.module.heapF32.buffer,l,u),h=this.module.getUVPtr(e),d=this.module.getUVLength(e),p=new Float32Array(this.module.heapF32.buffer,h,d),f=this.module.getFauxFacadePtr(e),m=this.module.getFauxFacadeLength(e),_=new Uint8Array(this.module.heapU8.buffer,f,m),g=this.module.getIndicesPtr(e),y=this.module.getIndicesLength(e),x=new Int16Array(this.module.heap16.buffer,g,y),v=this.module.getBuildingPart(e);r[e]={positions:n,normals:s,ao:c,uv:p,isFauxFacade:_,indices:x,buildingPart:v}}const n=this.module.getRingCount(),o=[];for(let e=0;e<n;e++){const t=this.module.getRingPtr(e),i=this.module.getRingLength(e),r=new Float32Array(this.module.heapF32.buffer,t,i);o.push(r)}return{meshes:r,outerRingLength:this.module.getOuterRingLength(),modifiedPolygonRings:o}}}const lp=VectorTileFeature.types,up=32767;function cp(e,t){const i=Xt+t;for(const r of e)for(const e of r)if(e.x<-t||e.x>i||e.y<-t||e.y>i)return!1;return!0}function hp(e){switch(e){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: ${e}`)}}let dp,pp,fp=null,mp=null,_p=null;class BuildingBloomGeometry{constructor(){this.layoutVertexArray=new StructArrayLayout3f12,this.layoutAttenuationArray=new StructArrayLayout4f16,this.layoutColorArray=new StructArrayLayout2ui4,this.indexArray=new StructArrayLayout3ui6,this.indexArrayForConflation=new StructArrayLayout3ui6,this.segmentsBucket=new SegmentVector}}class BuildingGeometry{constructor(e){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new SegmentVector,this.entranceBloom=new BuildingBloomGeometry;const t=66560;this.layoutVertexArray=new StructArrayLayout3f12,this.layoutVertexArray.reserve(t),this.layoutNormalArray=new StructArrayLayout3i6,this.layoutNormalArray.reserve(t),this.layoutCentroidArray=new StructArrayLayout3i6,this.layoutCentroidArray.reserve(t),this.layoutColorArray=new StructArrayLayout2ui4,this.layoutColorArray.reserve(t),this.layoutFloodLightDataArray=new StructArrayLayout1i2,this.layoutFloodLightDataArray.reserve(t),this.layoutAOArray=new StructArrayLayout1ub1,this.layoutAOArray.reserve(t),this.indexArray=new StructArrayLayout3ui6,this.indexArray.reserve(66560),this.indexArrayForConflation=new StructArrayLayout3ui6,this.segmentsBucket=new SegmentVector,this.entranceBloom=new BuildingBloomGeometry,e&&(this.layoutFacadePaintArray=new StructArrayLayout2ui4,this.layoutFacadeDataArray=new StructArrayLayout4ui8,this.layoutFacadeVerticalRangeArray=new StructArrayLayout2ui4)}reserve(e,t,i){this.layoutVertexArray.reserveForAdditional(e),this.layoutCentroidArray.reserveForAdditional(e),this.layoutFloodLightDataArray.reserveForAdditional(e),this.layoutNormalArray.reserveForAdditional(e),this.layoutAOArray.reserveForAdditional(e),this.layoutColorArray.reserveForAdditional(e),this.indexArray.reserveForAdditional(t),i&&(this.layoutFacadePaintArray.reserveForAdditional(e),this.layoutFacadeDataArray.reserveForAdditional(e),this.layoutFacadeVerticalRangeArray.reserveForAdditional(e))}}class BuildingBucket{constructor(e){this.requiresHDRuntime=!0,this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.footprintsVertices=new StructArrayLayout2f8,this.footprintsIndices=new StructArrayLayout1ui2,this.footprintsMin=new K(1/0,1/0),this.footprintsMax=new K(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new BuildingGeometry(!1),this.buildingWithFacade=new BuildingGeometry(!0),this.indexArrayForConflationUploaded=!1,this.featureFootprintLookup=new Map,this.buildingIds=new Set,this.footprintLookup={},this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.worldview=e.worldview,this.lut=e.lut,this.programConfigurations=new ProgramConfigurationSet(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.projection=e.projection,this.groundEffect=new GroundEffect(e),this.groundEffect.groundRadiusArray=new StructArrayLayout1f4,this.hasAppearances=null}updateFootprints(e,t){const i=new TriangleGridIndex([],[],1),r={vertices:[],indices:new Uint32Array(0),grid:i,min:this.footprintsMin,max:this.footprintsMax,buildingIds:this.buildingIds};t.push({footprint:r,id:e})}updateAppearances(e,t,i,r){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,i,r){if(!_p)return;const n=fa(i);this.tileToMeter=n,this.brightness=t.brightness,_p.setStyle({normalScale:[1,-1,n],tileToMeters:n}),_p.setAOOptions(!1,.3),_p.setMetricOptions(!1,16),_p.setStructuralOptions(!0),_p.setFacadeClassifierOptions(3);const o=new Map,a=new Map;let s=0;for(const{feature:t}of e){if("LineString"!==lp[t.type]){o.set(t.id,t.properties.source_id);continue}const e=this.layers[0]._featureFilter.needGeometry;if(e&&!this.layers[0]._featureFilter.filter(new EvaluationParameters(this.zoom),t,i))continue;const n=Aa(t,e);if(!e&&!this.layers[0]._featureFilter.filter(new EvaluationParameters(this.zoom),n,i))continue;const l=e?n.geometry:wa(t,i,r),u=[];for(const e of l)for(const t of e)u.push(t.x),u.push(t.y);const c={coordinates:u,crossPerc:t.properties.cross_perc,distanceToRoad:t.properties.distance_to_road,entrances:t.properties.entrances,sourceId:0},h=t.properties.source_id;let d=a.get(h);d||(d=[],a.set(h,d)),d.push(c),++s}this.maxHeight=0;const l=new Array,u=new Set,c=e=>{null!=e&&u.add(e)},h=(e,t)=>{null!=e&&l.push({buildingId:e,footprintIndex:t})},d=64*(e.length-s),p=d/2;this.buildingWithFacade.reserve(d,p,!0),this.buildingWithoutFacade.reserve(2*d,2*p,!1),this.footprintsIndices.reserve(16*(e.length-s)),this.footprintsVertices.reserve(8*(e.length-s));for(const{feature:s,id:l,index:d,sourceLayerIndex:p}of e){if("LineString"===lp[s.type])continue;const e=this.layers[0]._featureFilter.needGeometry;if(e&&!this.layers[0]._featureFilter.filter(new EvaluationParameters(this.zoom),s,i))continue;let f=null;if(s.properties&&Object.hasOwn(s.properties,"building_id")&&(f=Number(s.properties.building_id),u.has(f)))continue;const m=Aa(s,e);if(!e&&!this.layers[0]._featureFilter.filter(new EvaluationParameters(this.zoom),m,i))continue;const _=e?m.geometry:wa(s,i,r),g=ae(_,500);let y=!1;for(const e of g)if(1!==e.length){y=!0;break}if(y){c(f);continue}if(!cp(_,163)){c(f);continue}const x=this.layers[0],v=hp(x.layout.get("building-roof-shape").evaluate(s,{},i)),b=x.layout.get("building-base").evaluate(s,{},i),w=x.layout.get("building-height").evaluate(s,{},i),A=x.layout.get("building-flood-light-ground-radius").evaluate(s,{},i),E=x.paint.get("building-ambient-occlusion-intensity"),I=A/this.tileToMeter;s.properties["building-part"]="roof";const D=x.paint.get("building-color").evaluate(s,{},this.canonical).toPremultipliedRenderColor(this.lut),P=x.paint.get("building-emissive-strength").evaluate(s,{},this.canonical);s.properties["building-part"]="wall";const T=x.paint.get("building-color").evaluate(s,{},this.canonical).toPremultipliedRenderColor(this.lut),z=x.paint.get("building-emissive-strength").evaluate(s,{},this.canonical);s.properties["building-part"]="window";const M=x.paint.get("building-color").evaluate(s,{},this.canonical).toPremultipliedRenderColor(this.lut),C=x.paint.get("building-emissive-strength").evaluate(s,{},this.canonical);s.properties["building-part"]="door";const R=x.paint.get("building-color").evaluate(s,{},this.canonical).toPremultipliedRenderColor(this.lut),L=x.paint.get("building-emissive-strength").evaluate(s,{},this.canonical);let F=x.layout.get("building-flood-light-wall-radius").evaluate(s,{},i);F=ve(F,0,2048);const B=F/2048*up,O=o.get(l),V=a.get(O)||[],k=0!==V.length&&x.layout.get("building-facade").evaluate(s,{},i);_p.setFacadeOptions(4,!0),_p.setFauxFacadeOptions(k,!1,1);let N=0,U=0,G=0,j=0,$=0,W=0,X=0,q=0,Z=0,Y=0,J=0;if(k){let e=Math.round(x.layout.get("building-facade-floors").evaluate(s,{},i));if(0===b){e=Math.max(1,e-(V.length>0?1:0));let t=4;if(w>100){const e=[10,13,15];t=e[s.id?s.id%e.length:0]}else w<=10&&(t=3);_p.setFacadeOptions(t,!0),$=(w<15?1.3:1.61803)*t/n}else $=b/n;W=w/n,$=Math.min($,W),G=x.layout.get("building-facade-unit-width").evaluate(s,{},i)/n,j=(W-$)/e,_p.setFauxFacadeOptions(!0,!0,G);const t=x.layout.get("building-facade-window").evaluate(s,{},i);N=t[0],U=t[1],X=Math.floor(65535*Math.min(1,$/Xt)),q=Math.floor(65535*Math.min(1,W/Xt)),Z=Math.floor(255*N)<<8|Math.floor(255*U),Y=Math.floor(65535*Math.min(1,G/Xt)),J=Math.floor(65535*Math.min(1,j/Xt))}const Q=Array(g.length),ee={x:1/0,y:1/0},te={x:-1/0,y:-1/0},ie={x:0,y:0};let re=0;for(let e=0;e<g.length;e++){const t=g[e];if(t.length>0){const i=[],r=Array(t.length+1);r[0]=0;for(let e=0;e<t.length;e++){const n=t[e];for(let e=0;e<n.length;e++){const t=n[n.length-e-1];ee.x=Math.min(ee.x,t.x),ee.y=Math.min(ee.y,t.y),te.x=Math.max(te.x,t.x),te.y=Math.max(te.y,t.y),ie.x+=t.x,ie.y+=t.y,re++,i.push(t.x),i.push(t.y)}r[e+1]=i.length}Q[e]={id:s.id?s.id:0,height:w,minHeight:b,sourceId:0,roofType:v,coordinates:i,ringIndices:r}}}ie.x/=re||1,ie.y/=re||1;const ne=_p.generateMesh(Q,V);if("string"==typeof ne){ze(`Unable to generate building ${s.id}: ${ne}`),c(f);continue}if(0===ne.meshes.length||0===ne.modifiedPolygonRings.length){c(f);continue}const oe=k?this.buildingWithFacade:this.buildingWithoutFacade;let se=0;for(const e of ne.meshes)se+=e.positions.length/3;const le=oe.segmentsBucket.prepareSegment(se,oe.layoutVertexArray,oe.indexArray),ue=[];let ce=null,he=0,de=-1;const pe=oe.layoutVertexArray.length,fe=pe+se;oe.layoutVertexArray.resize(fe),oe.layoutCentroidArray.resize(fe),oe.layoutNormalArray.resize(fe),oe.layoutAOArray.resize(fe),oe.layoutColorArray.resize(fe),oe.layoutFloodLightDataArray.resize(fe),k&&(oe.layoutFacadePaintArray.resize(fe),oe.layoutFacadeDataArray.resize(fe),oe.layoutFacadeVerticalRangeArray.resize(fe));const me=oe.indexArray.length;let _e=0,ge=pe;for(const e of ne.meshes){let t,i;if(1===e.buildingPart)t=D,i=P;else if(0===e.buildingPart)t=T,i=z;else if(2===e.buildingPart)t=M,i=C;else{if(3!==e.buildingPart)continue;t=R,i=L}if(i=ve(i,0,1),3===e.buildingPart){const t=new Array;for(let i=0;i<e.positions.length;i+=12){const r=e.positions[i+0],n=e.positions[i+1],o=e.positions[i+3],a=e.positions[i+4],s=e.positions[i+2],l=e.positions[i+8]-s,u=1,c=o-r,h=a-n,d=Math.hypot(c,h);t.push({pos:[r+.5*c,n+.5*h,s],normal:[h/d,-c/d,0],width:d,height:l,depth:u,points:[r,n,o,a]})}const i=oe.entranceBloom.segmentsBucket.prepareSegment(10*t.length,oe.entranceBloom.layoutVertexArray,oe.entranceBloom.indexArray),r=oe.entranceBloom.layoutVertexArray.length;he=oe.entranceBloom.indexArray.length,hd(t,.5/this.tileToMeter,oe.entranceBloom.indexArray,oe.entranceBloom.layoutVertexArray,oe.entranceBloom.layoutAttenuationArray);const n=oe.entranceBloom.layoutVertexArray.length-r;de=oe.entranceBloom.indexArray.length-he;for(let e=0;e<n;e++)oe.entranceBloom.layoutColorArray.emplaceBack(255*R.r<<8|255*R.g,255*R.b<<8|51*L);i.vertexLength+=n,i.primitiveLength+=de,ce={part:e.buildingPart,vertexOffset:r,vertexLength:n}}oe.layoutVertexArray.float32.set(e.positions,3*ge);const r=e.positions.length/3;for(let n=0;n<r;++n){const r=3*n;_e=Math.max(_e,e.positions[r+2]);const o=e.normals[r+1]*up,a=e.normals[r+2]*up,s=3*(ge+n);oe.layoutNormalArray.int16[s]=e.normals[r]*up,oe.layoutNormalArray.int16[s+1]=o,oe.layoutNormalArray.int16[s+2]=a;const l=e.ao[n];oe.layoutAOArray.uint8[ge+n]=255*l;const u=1+(l-1)*E,c=255*t.b*u<<8|255*i;oe.layoutColorArray.uint16[2*(ge+n)]=255*t.r*u<<8|255*t.g*u,oe.layoutColorArray.uint16[2*(ge+n)+1]=c}const n=Math.min(8191,Math.max(0,Math.floor(ie.x))),o=Math.min(8191,Math.max(0,Math.floor(ie.y))),a=Math.floor(w),s=20,l=4*n+Math.min(3,Math.round((te.x-ee.x)*this.tileToMeter/s)),u=4*o+Math.min(3,Math.round((te.y-ee.y)*this.tileToMeter/s));for(let e=0;e<r;++e){const t=3*(ge+e);oe.layoutCentroidArray.int16[t]=l,oe.layoutCentroidArray.int16[t+1]=u,oe.layoutCentroidArray.int16[t+2]=a}if(oe.layoutFloodLightDataArray.int16.fill(0===e.buildingPart?B:0,ge,ge+r),k){const t=255*M.r<<8|255*M.g,i=255*M.b<<8|255*C;for(let e=0;e<r;++e){const r=2*(ge+e);oe.layoutFacadePaintArray.uint16[r]=t,oe.layoutFacadePaintArray.uint16[r+1]=i}for(let t=0;t<r;++t)if(e.isFauxFacade[t]){const i=Math.min(65535,Math.floor(e.uv[2*t]*ne.outerRingLength));oe.layoutFacadeDataArray.emplace(ge+t,1|i,Z,Y,J),oe.layoutFacadeVerticalRangeArray.emplace(ge+t,X,q)}else oe.layoutFacadeDataArray.emplace(ge+t,0,0,0,0),oe.layoutFacadeVerticalRangeArray.emplace(ge+t,0,0)}const c=le.vertexLength,h=e.indices.length/3,d=oe.indexArray.length;oe.indexArray.resize(d+h);for(let t=0;t<h;++t){const i=3*t,r=3*d+i;oe.indexArray.uint16[r]=c+e.indices[i],oe.indexArray.uint16[r+1]=c+e.indices[i+1],oe.indexArray.uint16[r+2]=c+e.indices[i+2]}1!==e.buildingPart&&0!==e.buildingPart&&2!==e.buildingPart&&3!==e.buildingPart||ue.push({part:e.buildingPart,vertexOffset:ge,vertexLength:e.positions.length/3}),ge+=r,le.vertexLength+=r,le.primitiveLength+=e.indices.length/3}this.maxHeight=Math.max(this.maxHeight,_e);const ye=oe.indexArray.length-me,xe=this.footprintsIndices.length,be=this.footprintsVertices.length,we=[],Ae=new K(1/0,1/0),Ee=new K(-1/0,-1/0),Ie=b<=0,Se=this.groundEffect.vertexArray.length;for(const e of ne.modifiedPolygonRings){const t=[],i=new K(1/0,1/0),r=new K(-1/0,-1/0);for(let n=0;n<e.length;n+=2){const o=e.length-n-2;i.x=Math.min(i.x,e[o]),i.y=Math.min(i.y,e[o+1]),r.x=Math.max(r.x,e[o]),r.y=Math.max(r.y,e[o+1]);const a=new K(e[o],e[o+1]);Ie&&t.push(a),we.push(a.x,a.y),this.footprintsVertices.emplaceBack(a.x,a.y)}Ae.x=Math.min(Ae.x,i.x),Ae.y=Math.min(Ae.y,i.y),Ee.x=Math.max(Ee.x,r.x),Ee.y=Math.max(Ee.y,r.y),Ie&&this.groundEffect.addData(t,[i,r],I)}const De=this.groundEffect.vertexArray.length-Se;this.groundEffect.groundRadiusArray.reserveForAdditional(De);for(let e=0;e<De;e++)this.groundEffect.groundRadiusArray.emplaceBack(A);(ee.x<0||te.x>Xt||ee.y<0||te.y>Xt)&&this.featuresOnBorder.push({featureId:s.id,footprintIndex:this.footprints.length});{const e=Do(we,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+e.length),this.footprintsIndices.uint16.set(e,xe),this.buildingIds.add(f??s.id),this.footprintsMin.x=Math.min(this.footprintsMin.x,Ae.x),this.footprintsMin.y=Math.min(this.footprintsMin.y,Ae.y),this.footprintsMax.x=Math.max(this.footprintsMax.x,Ee.x),this.footprintsMax.y=Math.max(this.footprintsMax.y,Ee.y);const t={footprintVertexOffset:be,footprintVertexLength:this.footprintsVertices.length-be,footprintIndexOffset:xe,footprintIndexLength:this.footprintsIndices.length-xe,min:Ae,max:Ee,hiddenFlags:0,indicesOffset:me,indicesLength:ye,bloomIndicesOffset:he,bloomIndicesLength:de,groundEffectVertexOffset:Se,groundEffectVertexLength:De,hasFauxFacade:k,height:_e,promoteId:l,feature:m,parts:ue,buildingBloom:ce},i=this.footprints.length;void 0!==s.id&&this.featureFootprintLookup.set(s.id,i),h(f,i),this.footprints.push(t)}this.programConfigurations.populatePaintArrays(oe.layoutVertexArray.length,s,d,{},t.availableImages,i,t.brightness),this.groundEffect.addPaintPropertiesData(s,d,{},t.availableImages,i,t.brightness),t.featureIndex.insert(s,_,d,p,this.index,pe)}l.forEach(({buildingId:e,footprintIndex:t})=>{u.has(e)&&(this.footprints[t].hiddenFlags|=4)});const f=new Set;this.buildingIds.forEach((e,t,i)=>{u.has(e)||f.add(e)}),this.buildingIds=f,this.groundEffect.prepareBorderSegments()}update(e,t,i,r,n,o,a){this.programConfigurations.updatePaintArrays(e,t,n,i,r,o,a),this.groundEffect.update(e,t,n,i,r,o,a),this.evaluate(this.layers[0],e),this.colorBufferUploaded=!1}updateExpressions(e){this.programConfigurations.updateExpressions(e),this.groundEffect.programConfigurations.updateExpressions(e)}isEmpty(){return 0===this.buildingWithoutFacade.layoutVertexArray.length&&0===this.buildingWithFacade.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){const t=t=>{t.layoutVertexBuffer=e.createVertexBuffer(t.layoutVertexArray,pd.members),t.layoutNormalBuffer=e.createVertexBuffer(t.layoutNormalArray,fd.members),t.layoutCentroidBuffer=e.createVertexBuffer(t.layoutCentroidArray,md.members),t.layoutFloodLightDataBuffer=e.createVertexBuffer(t.layoutFloodLightDataArray,bd.members),t.layoutFacadeDataArray&&t.layoutFacadeDataArray.length&&(t.layoutFacadeDataBuffer=e.createVertexBuffer(t.layoutFacadeDataArray,yd.members)),t.layoutFacadeVerticalRangeArray&&t.layoutFacadeVerticalRangeArray.length&&(t.layoutFacadeVerticalRangeBuffer=e.createVertexBuffer(t.layoutFacadeVerticalRangeArray,xd.members)),t.entranceBloom.layoutVertexArray.length&&(t.entranceBloom.layoutVertexBuffer=e.createVertexBuffer(t.entranceBloom.layoutVertexArray,pd.members),t.entranceBloom.layoutAttenuationBuffer=e.createVertexBuffer(t.entranceBloom.layoutAttenuationArray,vd.members)),this.uploadUpdatedColorBuffer(e),this.uploadUpdatedIndexBuffer(e)};this.uploaded||(t(this.buildingWithoutFacade),t(this.buildingWithFacade),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){const e=e=>{e.layoutVertexBuffer&&(e.layoutVertexBuffer.destroy(),e.layoutNormalBuffer.destroy(),e.layoutColorBuffer.destroy(),e.segmentsBucket.destroy(),e.indexBuffer&&e.indexBuffer.destroy(),e.entranceBloom.layoutVertexBuffer&&(e.entranceBloom.layoutVertexBuffer.destroy(),e.entranceBloom.layoutColorBuffer.destroy(),e.entranceBloom.layoutAttenuationBuffer.destroy(),e.entranceBloom.indexBuffer.destroy(),e.entranceBloom.segmentsBucket.destroy()))};e(this.buildingWithoutFacade),e(this.buildingWithFacade),this.groundEffect.destroy(),this.programConfigurations.destroy()}updateFootprintHiddenFlags(e,t,i=!0){let r=!1;const n=i?t:0,o=0|(i?-1:~t);0===this.groundEffect.hiddenByLandmarkVertexArray.length&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const t of e){const e=this.footprints[t],i=e.hiddenFlags&o|n;e.hiddenFlags!==i&&(e.hiddenFlags=i,r=!0,this.groundEffect.updateHiddenByLandmarkRange(e.groundEffectVertexOffset,e.groundEffectVertexLength,0!==e.hiddenFlags))}return r&&(this.indexArrayForConflationUploaded=!1),r}uploadUpdatedIndexBuffer(e){if(this.groundEffect.uploadHiddenByLandmark(e),this.indexArrayForConflationUploaded)return;const t=e=>{0!==e.indexArray.length&&(e.indexArrayForConflation.resize(e.indexArray.length),e.indexArrayForConflation.uint16.set(e.indexArray.uint16),e.entranceBloom.indexArrayForConflation.resize(e.entranceBloom.indexArray.length),e.entranceBloom.indexArrayForConflation.uint16.set(e.entranceBloom.indexArray.uint16))};t(this.buildingWithoutFacade),t(this.buildingWithFacade);for(const e of this.footprints){const t=e.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,i=e.indicesOffset+e.indicesLength;if(0!==e.hiddenFlags){for(let r=e.indicesOffset;r<i;r++)t.indexArrayForConflation.uint16[3*r+0]=0,t.indexArrayForConflation.uint16[3*r+1]=0,t.indexArrayForConflation.uint16[3*r+2]=0;const r=e.bloomIndicesOffset+e.bloomIndicesLength;for(let i=e.bloomIndicesOffset;i<r;i++)t.entranceBloom.indexArrayForConflation.uint16[3*i+0]=0,t.entranceBloom.indexArrayForConflation.uint16[3*i+1]=0,t.entranceBloom.indexArrayForConflation.uint16[3*i+2]=0}}const i=t=>{0!==t.indexArray.length&&(t.indexBuffer?t.indexBuffer.updateData(t.indexArrayForConflation):t.indexBuffer=e.createIndexBuffer(t.indexArrayForConflation,!0),t.entranceBloom.indexBuffer?t.entranceBloom.indexBuffer.updateData(t.entranceBloom.indexArrayForConflation):t.entranceBloom.indexBuffer=e.createIndexBuffer(t.entranceBloom.indexArrayForConflation,!0))};i(this.buildingWithoutFacade),i(this.buildingWithFacade),this.indexArrayForConflationUploaded=!0}uploadUpdatedColorBuffer(e){const t=t=>{t.layoutColorBuffer?t.layoutColorBuffer.updateData(t.layoutColorArray):t.layoutColorBuffer=e.createVertexBuffer(t.layoutColorArray,_d.members,!0),t.layoutFacadePaintArray&&(t.layoutFacadePaintBuffer?t.layoutFacadePaintBuffer.updateData(t.layoutFacadePaintArray):t.layoutFacadePaintBuffer=e.createVertexBuffer(t.layoutFacadePaintArray,gd.members,!0)),t.entranceBloom.layoutColorBuffer?t.entranceBloom.layoutColorBuffer.updateData(t.entranceBloom.layoutColorArray):t.entranceBloom.layoutColorBuffer=e.createVertexBuffer(t.entranceBloom.layoutColorArray,_d.members,!0)};t(this.buildingWithoutFacade),t(this.buildingWithFacade),this.colorBufferUploaded=!0}evaluate(e,t){const i=e.paint.get("building-ambient-occlusion-intensity");for(const r of this.footprints){if(4&r.hiddenFlags)continue;const n=t[r.promoteId],o=r.feature;o.properties["building-part"]="roof";const a=e.paint.get("building-color").evaluate(o,n,this.canonical).toPremultipliedRenderColor(this.lut),s=e.paint.get("building-emissive-strength").evaluate(o,n,this.canonical);o.properties["building-part"]="wall";const l=e.paint.get("building-color").evaluate(o,n,this.canonical).toPremultipliedRenderColor(this.lut),u=e.paint.get("building-emissive-strength").evaluate(o,n,this.canonical);o.properties["building-part"]="window";const c=e.paint.get("building-color").evaluate(o,n,this.canonical).toPremultipliedRenderColor(this.lut),h=e.paint.get("building-emissive-strength").evaluate(o,n,this.canonical);o.properties["building-part"]="door";const d=e.paint.get("building-color").evaluate(o,n,this.canonical).toPremultipliedRenderColor(this.lut),p=e.paint.get("building-emissive-strength").evaluate(o,n,this.canonical),f=r.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(const e of r.parts){let t,n=a;1===e.part?(n=a,t=s):0===e.part?(n=l,t=u):2===e.part?(n=c,t=h):3===e.part&&(n=d,t=p),t=ve(t,0,1);for(let o=0;o<e.vertexLength;o++){const a=e.vertexOffset+o,s=1+(f.layoutAOArray.uint8[a]/255-1)*i;f.layoutColorArray.emplace(a,n.r*s*255<<8|n.g*s*255,n.b*s*255<<8|255*t),r.hasFauxFacade&&f.layoutFacadePaintArray.emplace(a,255*c.r<<8|255*c.g,255*c.b<<8|255*h)}}const m=r.buildingBloom;if(m)for(let e=0;e<m.vertexLength;e++)f.entranceBloom.layoutColorArray.emplace(m.vertexOffset+e,255*d.r<<8|255*d.g,255*d.b<<8|51*p)}}needsEvaluation(){return!this.colorBufferUploaded}updateReplacement(e,t,i){if(t.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=t.updateTime;const r=t.getReplacementRegionsForTile(e.toUnwrapped());if(su(this.activeReplacements,r))return;this.activeReplacements=r;for(const e of this.footprints)e.hiddenFlags&=-2;const n=[];for(const t of this.activeReplacements){if(t.order<i)continue;const r=Math.max(1,Math.pow(2,t.footprintTileId.canonical.z-e.canonical.z));for(const i of this.footprints)i.min.x>t.max.x||i.max.x<t.min.x||i.min.y>t.max.y||i.max.y<t.min.y||(n.length=0,yp(this.footprintsVertices,i.footprintVertexOffset,i.footprintVertexLength,t.footprintTileId.canonical,e.canonical,n),lu(t.footprint,n,this.footprintsIndices.uint16,i.footprintIndexOffset,i.footprintIndexLength,0,-r)&&(i.hiddenFlags|=1))}0===this.groundEffect.hiddenByLandmarkVertexArray.length&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const e of this.footprints)this.groundEffect.updateHiddenByLandmarkRange(e.groundEffectVertexOffset,e.groundEffectVertexLength,0!==e.hiddenFlags);this.indexArrayForConflationUploaded=!1}getFootprint(e){if(void 0!==e.id){const t=this.featureFootprintLookup.get(e.id);return this.footprints[t]}return null}getHeightAtTileCoord(e,t){let i=Number.NEGATIVE_INFINITY,r=!0;const n=4*(e+Xt)*Xt+(t+Xt);if(Object.hasOwn(this.footprintLookup,n)){const e=this.footprintLookup[n];return e?{height:e.height,hidden:0!==e.hiddenFlags}:void 0}const o=new K(e,t);for(const a of this.footprints)e>a.max.x||a.min.x>e||t>a.max.y||a.min.y>t||a.height<=i||gp(o,this.footprintsVertices.float32.subarray(2*a.footprintVertexOffset,2*(a.footprintVertexOffset+a.footprintVertexLength)),this.footprintsIndices.uint16.subarray(a.footprintIndexOffset,a.footprintIndexOffset+a.footprintIndexLength))&&(i=a.height,this.footprintLookup[n]=a,r=0!==a.hiddenFlags);if(i!==Number.NEGATIVE_INFINITY)return{height:i,hidden:r};this.footprintLookup[n]=void 0}}function gp(e,t,i){for(let r=0;r<i.length;r+=3){const n=i[r],o=i[r+1],a=i[r+2],s=t[2*n+0],l=t[2*n+1],u=t[2*o+0],c=t[2*o+1],h=t[2*a+0],d=t[2*a+1],p=(s-h)*(e.y-d)-(l-d)*(e.x-h),f=(u-s)*(e.y-l)-(c-l)*(e.x-s);if(p<0!=f<0&&0!==p&&0!==f)continue;const m=(h-u)*(e.y-c)-(d-c)*(e.x-u);if(0===m||m<0==p+f<=0)return!0}return!1}function yp(e,t,i,r,n,o){const a=Math.pow(2,r.z-n.z);for(let s=0;s<i;s++){let i=e.float32[2*(s+t)+0],l=e.float32[2*(s+t)+1];i=(i+n.x*Xt)*a-r.x*Xt,l=(l+n.y*Xt)*a-r.y*Xt,o.push(new K(i,l))}}function xp(e,t){if(Object.hasOwn(e.layers,Ts))return ElevationFeatures.parseFrom(e.layers[Ts],t)}function vp({buckets:e,data:t,sourceLayerCoder:i,canonical:r,options:n}){if(!n.elevationFeatures||0===n.elevationFeatures.length)return;const o=[];for(const t of Object.values(e))if(t instanceof FillBucket&&t.hdExt){const e=t.hdExt.getUnevaluatedPortalGraph();e&&o.push(e)}const a=ElevationPortalGraph.evaluate(o);for(const o of Object.values(e))if(o instanceof FillBucket&&o.hdExt){const e=t.layers[i.decode(o.sourceLayerIndex)];o.hdExt.setEvaluatedPortalGraph(a,e,r,n.availableImages,n.brightness,o.worldview)}}rn(BuildingBucket,"BuildingBucket",{omit:["layers"]}),rn(BuildingGeometry,"BuildingGeometry"),rn(BuildingBloomGeometry,"BuildingBloomGeometry");class FrcCoveragePolygon{constructor(e=0,t=[]){this.frcMask=e,this.rings=t}hasGeometry(){return this.rings.length>0&&this.rings[0].length>0}}function bp(e){const t=[];for(let i=0;i<e.length;i++){const r=e.feature(i),n=r.properties.frc_mask;if(null==n)continue;const o=Number(n);if(!o)continue;const a=r.loadGeometry();if(a.length>0){let e=!1;for(const t of a[0])if(t.x<0||t.x>Xt||t.y<0||t.y>Xt){e=!0;break}if(e)continue}const s=1===a.length&&5===a[0].length&&a[0].some(e=>e.x<=0&&e.y<=0)&&a[0].some(e=>e.x>=Xt&&e.y<=0)&&a[0].some(e=>e.x>=Xt&&e.y>=Xt)&&a[0].some(e=>e.x<=0&&e.y>=Xt);t.push(new FrcCoveragePolygon(o,s?[]:a))}return t}function wp(e,t,i,r,n){const o=Zc(t);if(null===o)return!1;let a=i.x,s=i.y;const l=n??r.z;if(r.z!==l){const e=1<<r.z-l,t=Xt/e;a=r.x%e*t+i.x/e,s=r.y%e*t+i.y/e}for(const t of e)if(t.hasGeometry()&&t.frcMask&1<<o&&he([a,s],t.rings.map(e=>e.map(e=>[e.x,e.y]))))return!0;return!1}rn(FrcCoveragePolygon,"FrcCoveragePolygon");class IndoorActiveFloorStrategy{static calculate(e,t,i){const r=new Set,n=new Map,o=new Set,a=new Set;for(const i of Object.values(e))for(const[e,s]of Object.entries(i.floors)){o.add(e),s.isDefault&&a.add(e),s.conflicts&&n.set(e,s.conflicts);const i=e===t,l=s.connections&&t&&s.connections.has(t);(i||l)&&r.add(e)}const s=e=>{const t=n.get(e)||new Set;for(const i of r)if((n.get(i)||new Set).has(e)||t.has(i))return!0;return!1};if(i)for(const e of i)o.has(e)&&(s(e)||r.add(e));for(const e of a)r.has(e)||s(e)||r.add(e);return r}}function Ap(e,t,i,r){const n=t.indoorState.activeFloorsVisible;if(!t.sourceLayers)return n?t.indoorState.activeFloors:void 0;const o=function(e,t){if(!e)return ze("No source layers defined in indoor specification"),t;if(0===e.size)return t;const i=e.difference(t);for(const e of i)ze(`Missing source layer required in indoor specification: ${e}`);return t.intersection(t)}(t.sourceLayers,new Set(Object.keys(e.layers))),a=t.indoorState,s=function(e,t,i,r,n){const o={};for(const i of t){const t=e.layers[i];if(t)for(let e=0;e<t.length;e++){const i=t.feature(e);if(Tp(i)){const{id:e,center:t}=Sp(i);Ep(o,e,t);continue}if(zp(i)){const e=Dp(i,n);Ip(o,e.buildings,e.id,e)}}else ze(`indoor source layer not found: ${i}`)}return{buildings:o,activeFloors:IndoorActiveFloorStrategy.calculate(o,r,i)}}(e,o,a.activeFloors,a.selectedFloorId,r);return i.notify("setIndoorData",s),n?s.activeFloors:void 0}function Ep(e,t,i){e[t]?i&&(e[t].center=i):e[t]={floorIds:new Set,center:i||[0,0],floors:{}}}function Ip(e,t,i,r){for(const n of t)Ep(e,n),e[n].floors[i]=r,e[n].floorIds.add(i)}function Sp(e){return{id:e.properties.id.toString(),center:[e.properties.center_lon||0,e.properties.center_lat||0]}}function Dp(e,t){const i=e.properties.id.toString(),r=!!e.properties.is_default&&e.properties.is_default,n=e.properties.connected_floor_ids?new Set(e.properties.connected_floor_ids.toString().split(";")):new Set,o=e.properties.conflicted_floor_ids?new Set(e.properties.conflicted_floor_ids.toString().split(";")):new Set,a=e.properties.structure_ids?new Set(e.properties.structure_ids.toString().split(";")):new Set,s=e.properties.name.toString(),l=e.properties.z_index,u=function(e,t){const i=e.loadGeometry();if(!i||0===i.length)return;const r=i.map(i=>i.map(i=>_i(i,t,e.extent)));return 0===r.length?void 0:{type:"Polygon",coordinates:[r[0]]}}(e,t);return{id:i,isDefault:r,connections:n,conflicts:o,buildings:a,name:s,zIndex:l,geometry:u}}function Pp(e,t){return t.every(t=>e.properties&&null!=e.properties[t])}function Tp(e){return Pp(e,["type","id","name"])&&"structure"===e.properties.type}function zp(e){return Pp(e,["type","id","name","z_index"])&&"floor"===e.properties.type}function Mp(e,t){e instanceof FillBucket?function(e,t){const i=e.layers[0].layout.get("fill-elevation-reference"),r="hd-road-base"===i||"hd-road-markup"===i?i:null,n=!!t&&t.length>0&&Jc(t,e.layers[0].source,e.sourceLayerName);(r||n)&&(e.hdExt=new FillHDExtension(e,r,n))}(e,t):e instanceof LineBucket?function(e,t){const i="hd-road-markup"===e.layers[0].layout.get("line-elevation-reference"),r=!!t&&t.length>0&&Jc(t,e.layers[0].source,e.sourceLayerName);(i||r)&&(e.hdExt=new LineHDExtension(i,r))}(e,t):e instanceof CircleBucket?function(e){const t=e.layers[0];"circle"===t.type&&"hd-road-markup"===t.layout.get("circle-elevation-reference")&&(e.hdExt=new CircleHDExtension)}(e):e instanceof SymbolBucket&&function(e){"hd-road-markup"===e.layers[0].layout.get("symbol-elevation-reference")&&(e.hdExt=new SymbolHDExtension)}(e)}function Cp(e){for(const t in e){const i=e[t];if(i instanceof LineBucket&&i.hdExt&&i.hdExt.hasDeferredElevationFeatures)return!0;if(i instanceof SymbolBucket&&i.hdExt&&i.hdExt.hasDeferredElevationFeatures)return!0}return!1}async function Rp(){}function Lp(e,t,i){const r=t.paint.get(e).value;return"constant"===r.kind?r.value:i.programConfigurations.get(t.id).getMaxValue(e)}function Fp(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function Bp(e,t,i,r,n){if(!t[0]&&!t[1])return e;const o=K.convert(t)._mult(n);"viewport"===i&&o._rotate(-r);const a=[];for(let t=0;t<e.length;t++)a.push(e[t].sub(o));return a}function Op(e,t,i,r){const n=K.convert(e)._mult(r);return"viewport"===t&&n._rotate(-i),n}function Vp(e,t,i,r,n,o,a,s,l){if(o&&e.queryGeometry.isAboveHorizon)return!1;o&&(l*=e.pixelToTileUnitsFactor);const u=e.tileID.canonical,c=i.projection.upVectorScale(u,i.center.lat,i.worldSize).metersToTile;for(const h of t)for(const t of h){const h=t.add(s),d=n&&i.elevation?i.elevation.exaggeration()*n.getElevationAt(h.x,h.y,!0):0,p=i.projection.projectTilePoint(h.x,h.y,u);if(d>0){const e=i.projection.upVector(u,h.x,h.y);p.x+=e[0]*c*d,p.y+=e[1]*c*d,p.z+=e[2]*c*d}const f=o?h:kp(p.x,p.y,p.z,r),m=o?e.tilespaceRays.map(e=>Gp(e,d)):e.queryGeometry.screenGeometry,_=F([],[p.x,p.y,p.z,1],r);if(!a&&o?l*=_[3]/i.cameraToCenterDistance:a&&!o&&(l*=i.cameraToCenterDistance/_[3]),o){const e=Ft((t.y/Xt+u.y)/(1<<u.z));l/=i.projection.pixelsPerMeter(e,1)/ca(1,e)}if(os(m,f,l))return!0}return!1}function kp(e,t,i,r){const n=F([],[e,t,i,1],r);return new K(n[0]/n[3],n[1]/n[3])}i();const Np=p(0,0,0),Up=p(0,0,1);function Gp(e,t){const i=c();return Np[2]=t,e.intersectsPlane(Np,Up,i),new K(i[0],i[1])}class HeatmapBucket extends CircleBucket{}let jp,Hp;rn(HeatmapBucket,"HeatmapBucket",{omit:["layers"]});const $p=(e,t,i,r)=>rt(t,i,"log"===r?(Math.pow(10,e)-1)/9:e);function Wp(e){const{expression:t,evaluationKey:i,resolution:r=256,clips:n,scale:o="linear",lut:a=null}=e,s=n?n.length:1,l=e.image||new RGBAImage({width:r,height:s}),u={},c=(e,r,n)=>{u[i]=n;const o=t.evaluate(u),s=o?.toNonPremultipliedRenderColor(a)??null;s&&(l.data[e+r+0]=Math.floor(255*s.r),l.data[e+r+1]=Math.floor(255*s.g),l.data[e+r+2]=Math.floor(255*s.b),l.data[e+r+3]=Math.floor(255*s.a))};for(let e=0,t=0;e<s;++e,t+=4*r){const i=n?.[e].start??0,a=n?.[e].end??1;for(let e=0,n=0;e<r;e++,n+=4)c(t,n,$p(e/(r-1),i,a,o))}return l}let Xp,qp,Zp,Yp,Jp,Kp,Qp,ef,tf,rf,nf,of,af;class ClipBucket{constructor(e){this.zoom=e.zoom,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.footprints=[],this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,t){for(const i of this.footprints)t.push({footprint:i,id:e})}updateAppearances(e,t,i,r){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,i,r){const n=[];for(const{feature:o,id:a,index:s,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,u=Aa(o,e);if(!this.layers[0]._featureFilter.filter(new EvaluationParameters(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),u,i))continue;const c={id:a,properties:o.properties,type:o.type,sourceLayerIndex:l,index:s,geometry:e?u.geometry:wa(o,i,r),patterns:{}};n.push(c)}for(const r of n){const{geometry:n,index:o,sourceLayerIndex:a}=r;this.addFeature(r,n,o,i,{},t.availableImages,t.brightness),t.featureIndex.insert(e[o].feature,n,o,a,this.index)}}isEmpty(){return 0===this.footprints.length}uploadPending(){return!1}upload(e){}update(e,t,i,r,n,o,a){}destroy(){}addFeature(e,t,i,r,n,o=[],a){for(const e of ae(t,2)){const t=[],i=[],r=[],n=new K(1/0,1/0),o=new K(-1/0,-1/0);for(const a of e)if(0!==a.length){a!==e[0]&&r.push(i.length/2);for(let e=0;e<a.length;e++)i.push(a[e].x),i.push(a[e].y),t.push(a[e]),n.x=Math.min(n.x,a[e].x),n.y=Math.min(n.y,a[e].y),o.x=Math.max(o.x,a[e].x),o.y=Math.max(o.y,a[e].y)}const a=Do(i,r),s=new TriangleGridIndex(t,a,8,256);this.footprints.push({vertices:t,indices:a,grid:s,min:n,max:o})}}}function sf(e,t){return e.x*t.x+e.y*t.y}function lf(e,t){if(1===e.length){let i=0;const r=t[i++];let n;for(;!n||r.equals(n);)if(n=t[i++],!n)return 1/0;for(;i<t.length;i++){const o=t[i],a=e[0],s=n.sub(r),l=o.sub(r),u=a.sub(r),c=sf(s,s),h=sf(s,l),d=sf(l,l),p=sf(u,s),f=sf(u,l),m=c*d-h*h,_=(d*p-h*f)/m,g=(c*f-h*p)/m,y=r.z*(1-_-g)+n.z*_+o.z*g;if(isFinite(y))return y}return 1/0}{let e=1/0;for(const i of t)e=Math.min(e,i.z);return e}}function uf(e,t,i){let r=1/0;as(i,t)&&(r=lf(i,t[0]));for(let n=0;n<t.length;n++){const o=t[n],a=e[n];for(let e=0;e<o.length-1;e++){const t=o[e],n=[t,o[e+1],a[e+1],a[e],t];ns(i,n)&&(r=Math.min(r,lf(i,n)))}}return r!==1/0&&r}function cf(e,t,i,r,n,o,a,s,l,u,c){return"globe"===e.projection.name?function(e,t,i,r,n,o,a,s,l,u,c){const h=[],d=[],p=e.projection.upVectorScale(c,e.center.lat,e.worldSize).metersToTile,f=[0,0,0,1],m=[0,0,0,1],_=(e,t,i,r)=>{e[0]=t,e[1]=i,e[2]=r,e[3]=1},g=function(){const e=Math.PI/32,t=Math.tan(e),i=sa;return i*Math.sqrt(1+2*t*t)-i}();i>0&&(i+=g),r+=g;for(const g of t){const t=[],y=[];for(const h of g){const d=h.x+n.x,g=h.y+n.y,x=e.projection.projectTilePoint(d,g,c),v=e.projection.upVector(c,h.x,h.y);let b=i,w=r;if(a){const e=hf(d,g,i,r,a,s,l,u);b+=e.base,w+=e.top}0!==i?_(f,x.x+v[0]*p*b,x.y+v[1]*p*b,x.z+v[2]*p*b):_(f,x.x,x.y,x.z),_(m,x.x+v[0]*p*w,x.y+v[1]*p*w,x.z+v[2]*p*w),T(f,f,o),T(m,m,o),t.push(new Point3D(f[0],f[1],f[2])),y.push(new Point3D(m[0],m[1],m[2]))}h.push(t),d.push(y)}return[h,d]}(e,t,i,r,n,o,a,s,l,u,c):a?function(e,t,i,r,n,o,a,s,l){const u=[],c=[],h=[0,0,0,1];for(const d of e){const e=[],p=[];for(const u of d){const c=u.x+r.x,d=u.y+r.y,f=hf(c,d,t,i,o,a,s,l);h[0]=c,h[1]=d,h[2]=f.base,h[3]=1,F(h,h,n),h[3]=Math.max(h[3],1e-5);const m=new Point3D(h[0]/h[3],h[1]/h[3],h[2]/h[3]);h[0]=c,h[1]=d,h[2]=f.top,h[3]=1,F(h,h,n),h[3]=Math.max(h[3],1e-5);const _=new Point3D(h[0]/h[3],h[1]/h[3],h[2]/h[3]);e.push(m),p.push(_)}u.push(e),c.push(p)}return[u,c]}(t,i,r,n,o,a,s,l,u):function(e,t,i,r,n){const o=[],a=[],s=n[8]*t,l=n[9]*t,u=n[10]*t,c=n[11]*t,h=n[8]*i,d=n[9]*i,p=n[10]*i,f=n[11]*i;for(const t of e){const e=[],i=[];for(const o of t){const t=o.x+r.x,a=o.y+r.y,m=n[0]*t+n[4]*a+n[12],_=n[1]*t+n[5]*a+n[13],g=n[2]*t+n[6]*a+n[14],y=n[3]*t+n[7]*a+n[15],x=m+s,v=_+l,b=g+u,w=Math.max(y+c,1e-5),A=m+h,E=_+d,I=g+p,D=Math.max(y+f,1e-5);e.push(new Point3D(x/w,v/w,b/w)),i.push(new Point3D(A/D,E/D,I/D))}o.push(e),a.push(i)}return[o,a]}(t,i,r,n,o)}function hf(e,t,i,r,n,o,a,s){const l=a*n.getElevationAt(e,t,!0,!0),u=0!==o[0],c=u?0===o[1]?a*(o[0]/7-450):a*function(e,t,i){const r=Math.floor(t[0]/8),n=Math.floor(t[1]/8),o=10*(t[0]-8*r),a=10*(t[1]-8*n),s=e.getElevationAt(r,n,!0,!0),l=e.getMeterToDEM(i),u=Math.floor(.5*(o*l-1)),c=Math.floor(.5*(a*l-1)),h=e.tileCoordToPixel(r,n),d=2*u+1,p=2*c+1,f=function(e,t,i,r,n){return[e.getElevationAtPixel(t,i,!0),e.getElevationAtPixel(t+n,i,!0),e.getElevationAtPixel(t,i+n,!0),e.getElevationAtPixel(t+r,i+n,!0)]}(e,h.x-u,h.y-c,d,p),m=Math.abs(f[0]-f[1]),_=Math.abs(f[2]-f[3]),g=Math.abs(f[0]-f[2])+Math.abs(f[1]-f[3]),y=Math.min(.25,.5*l*(m+_)/d),x=Math.min(.25,.5*l*g/p);return s+Math.max(y*o,x*a)}(n,o,s):l;return{base:l+(0===i?-1:i),top:u?Math.max(c+r,l+i+2):l+r}}rn(ClipBucket,"ClipBucket",{omit:["layers"]});const df=()=>af||(af={layout:nf||(nf=new Properties({"line-cap":new DataDrivenProperty(to.layout_line["line-cap"]),"line-join":new DataDrivenProperty(to.layout_line["line-join"]),"line-miter-limit":new DataConstantProperty(to.layout_line["line-miter-limit"]),"line-round-limit":new DataConstantProperty(to.layout_line["line-round-limit"]),"line-sort-key":new DataDrivenProperty(to.layout_line["line-sort-key"]),"line-z-offset":new DataDrivenProperty(to.layout_line["line-z-offset"]),"line-elevation-reference":new DataConstantProperty(to.layout_line["line-elevation-reference"]),"line-cross-slope":new DataConstantProperty(to.layout_line["line-cross-slope"]),visibility:new DataConstantProperty(to.layout_line.visibility),"line-width-unit":new DataConstantProperty(to.layout_line["line-width-unit"]),"line-elevation-ground-scale":new DataDrivenProperty(to.layout_line["line-elevation-ground-scale"])})),paint:of||(of=new Properties({"line-opacity":new DataDrivenProperty(to.paint_line["line-opacity"]),"line-color":new DataDrivenProperty(to.paint_line["line-color"]),"line-translate":new DataConstantProperty(to.paint_line["line-translate"]),"line-translate-anchor":new DataConstantProperty(to.paint_line["line-translate-anchor"]),"line-width":new DataDrivenProperty(to.paint_line["line-width"]),"line-gap-width":new DataDrivenProperty(to.paint_line["line-gap-width"]),"line-offset":new DataDrivenProperty(to.paint_line["line-offset"]),"line-blur":new DataDrivenProperty(to.paint_line["line-blur"]),"line-dasharray":new DataDrivenProperty(to.paint_line["line-dasharray"]),"line-pattern":new DataDrivenProperty(to.paint_line["line-pattern"]),"line-pattern-cross-fade":new DataConstantProperty(to.paint_line["line-pattern-cross-fade"]),"line-gradient":new ColorRampProperty(to.paint_line["line-gradient"]),"line-trim-offset":new DataConstantProperty(to.paint_line["line-trim-offset"]),"line-trim-fade-range":new DataConstantProperty(to.paint_line["line-trim-fade-range"]),"line-trim-color":new DataConstantProperty(to.paint_line["line-trim-color"]),"line-emissive-strength":new DataDrivenProperty(to.paint_line["line-emissive-strength"]),"line-border-width":new DataDrivenProperty(to.paint_line["line-border-width"]),"line-border-color":new DataDrivenProperty(to.paint_line["line-border-color"]),"line-border-gradient":new ColorRampProperty(to.paint_line["line-border-gradient"]),"line-occlusion-opacity":new DataConstantProperty(to.paint_line["line-occlusion-opacity"]),"line-blend-mode":new DataConstantProperty(to.paint_line["line-blend-mode"]),"line-blend-additive-clamp":new DataConstantProperty(to.paint_line["line-blend-additive-clamp"]),"line-cutout-depth":new DataConstantProperty(to.paint_line["line-cutout-depth"]),"line-color-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"}),"line-border-gradient-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"})}))},af);class LineFloorwidthProperty extends DataDrivenProperty{possiblyEvaluate(e,t){return t=new EvaluationParameters(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,transition:t.transition,worldview:t.worldview}),super.possiblyEvaluate(e,t)}evaluate(e,t,i,r){return t={...t,zoom:Math.floor(t.zoom)},super.evaluate(e,t,i,r)}}let pf,ff,mf,_f;function gf(e,t){return t>0?t+2*e:e}function yf(e,t){return t.replace(/{([^{}]+)}/g,(t,i)=>i in e?String(e[i]):"")}class FormatSectionOverride{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:ot,this.defaultValue=e}evaluate(e){if(e.formattedSection){const t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}rn(FormatSectionOverride,"FormatSectionOverride",{omit:["defaultValue"]});const xf={};function vf(e){return"constant"!==e.value.kind&&e.value.isStateDependent}const bf=()=>_f||(_f={layout:ff||(ff=new Properties({"symbol-placement":new DataConstantProperty(to.layout_symbol["symbol-placement"]),"symbol-spacing":new DataConstantProperty(to.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new DataConstantProperty(to.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new DataDrivenProperty(to.layout_symbol["symbol-sort-key"]),"symbol-z-order":new DataConstantProperty(to.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new DataConstantProperty(to.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new DataConstantProperty(to.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new DataConstantProperty(to.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new DataConstantProperty(to.layout_symbol["icon-ignore-placement"]),"icon-optional":new DataConstantProperty(to.layout_symbol["icon-optional"]),"icon-rotation-alignment":new DataConstantProperty(to.layout_symbol["icon-rotation-alignment"]),"icon-size":new DataDrivenProperty(to.layout_symbol["icon-size"]),"icon-size-scale-range":new DataConstantProperty(to.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new DataDrivenProperty(to.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new DataDrivenProperty(to.layout_symbol["icon-text-fit-padding"]),"icon-image":new DataDrivenProperty(to.layout_symbol["icon-image"]),"icon-image-use-theme":new DataConstantProperty({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new DataDrivenProperty(to.layout_symbol["icon-rotate"]),"icon-padding":new DataConstantProperty(to.layout_symbol["icon-padding"]),"icon-keep-upright":new DataConstantProperty(to.layout_symbol["icon-keep-upright"]),"icon-offset":new DataDrivenProperty(to.layout_symbol["icon-offset"]),"icon-anchor":new DataDrivenProperty(to.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new DataConstantProperty(to.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new DataConstantProperty(to.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new DataConstantProperty(to.layout_symbol["text-rotation-alignment"]),"text-field":new DataDrivenProperty(to.layout_symbol["text-field"]),"text-font":new DataDrivenProperty(to.layout_symbol["text-font"]),"text-size":new DataDrivenProperty(to.layout_symbol["text-size"]),"text-size-scale-range":new DataConstantProperty(to.layout_symbol["text-size-scale-range"]),"text-max-width":new DataDrivenProperty(to.layout_symbol["text-max-width"]),"text-line-height":new DataDrivenProperty(to.layout_symbol["text-line-height"]),"text-letter-spacing":new DataDrivenProperty(to.layout_symbol["text-letter-spacing"]),"text-justify":new DataDrivenProperty(to.layout_symbol["text-justify"]),"text-radial-offset":new DataDrivenProperty(to.layout_symbol["text-radial-offset"]),"text-variable-anchor":new DataConstantProperty(to.layout_symbol["text-variable-anchor"]),"text-anchor":new DataDrivenProperty(to.layout_symbol["text-anchor"]),"text-max-angle":new DataConstantProperty(to.layout_symbol["text-max-angle"]),"text-writing-mode":new DataConstantProperty(to.layout_symbol["text-writing-mode"]),"text-rotate":new DataDrivenProperty(to.layout_symbol["text-rotate"]),"text-padding":new DataConstantProperty(to.layout_symbol["text-padding"]),"text-keep-upright":new DataConstantProperty(to.layout_symbol["text-keep-upright"]),"text-transform":new DataDrivenProperty(to.layout_symbol["text-transform"]),"text-offset":new DataDrivenProperty(to.layout_symbol["text-offset"]),"text-allow-overlap":new DataConstantProperty(to.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new DataConstantProperty(to.layout_symbol["text-ignore-placement"]),"text-optional":new DataConstantProperty(to.layout_symbol["text-optional"]),visibility:new DataConstantProperty(to.layout_symbol.visibility)})),paint:mf||(mf=new Properties({"icon-opacity":new DataDrivenProperty(to.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new DataDrivenProperty(to.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new DataDrivenProperty(to.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new DataDrivenProperty(to.paint_symbol["text-emissive-strength"]),"icon-color":new DataDrivenProperty(to.paint_symbol["icon-color"]),"icon-halo-color":new DataDrivenProperty(to.paint_symbol["icon-halo-color"]),"icon-halo-width":new DataDrivenProperty(to.paint_symbol["icon-halo-width"]),"icon-halo-blur":new DataDrivenProperty(to.paint_symbol["icon-halo-blur"]),"icon-translate":new DataConstantProperty(to.paint_symbol["icon-translate"]),"icon-translate-anchor":new DataConstantProperty(to.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new DataConstantProperty(to.paint_symbol["icon-image-cross-fade"]),"text-opacity":new DataDrivenProperty(to.paint_symbol["text-opacity"]),"text-occlusion-opacity":new DataDrivenProperty(to.paint_symbol["text-occlusion-opacity"]),"text-color":new DataDrivenProperty(to.paint_symbol["text-color"],{runtimeType:ut,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new DataDrivenProperty(to.paint_symbol["text-halo-color"]),"text-halo-width":new DataDrivenProperty(to.paint_symbol["text-halo-width"]),"text-halo-blur":new DataDrivenProperty(to.paint_symbol["text-halo-blur"]),"text-translate":new DataConstantProperty(to.paint_symbol["text-translate"]),"text-translate-anchor":new DataConstantProperty(to.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new DataConstantProperty(to.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new DataConstantProperty(to.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new DataConstantProperty(to.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new DataConstantProperty(to.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new DataDrivenProperty(to.paint_symbol["symbol-z-offset"]),"placement-priority":new DataDrivenProperty(to.paint_symbol["placement-priority"]),"placement-group":new DataDrivenProperty(to.paint_symbol["placement-group"]),"icon-color-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"})}))},_f);class SymbolStyleLayer extends StyleLayer{constructor(e,t,i,n){super(e,bf(),t,i,n,e.layout?e.layout["icon-image-use-theme"]:null),this._colorAdjustmentMatrix=r([]),this.hasOcclusionOpacityProperties=void 0!==e.paint&&("icon-occlusion-opacity"in e.paint||"text-occlusion-opacity"in e.paint)}_handleSpecialPaintPropertyUpdate(e){"icon-occlusion-opacity"!==e&&"text-occlusion-opacity"!==e||(this.hasOcclusionOpacityProperties=!0)}recalculate(e,t){super.recalculate(e,t),this.appearances&&this.appearances.forEach(i=>{i.recalculate(e,t,this.iconImageUseTheme)}),0!==this.appearances.length&&delete this.layout._values["text-variable-anchor"],"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 i=this.layout.get("text-writing-mode");if(i){const e=[];for(const t of i)e.includes(t)||e.push(t);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(e,t,r,n){return this._saturation===e&&this._contrast===t&&this._brightnessMin===r&&this._brightnessMax===n||(this._colorAdjustmentMatrix=function(e,t,r,n){e=function(e){return e>0?1-1/(1.001-e):-e}(e),t=function(e){return e>0?1/(1.001-e):1+e}(t);const a=i(),s=e/3,l=1-2*s,u=[l,s,s,0,s,l,s,0,s,s,l,0,0,0,0,1],c=.5-.5*t,h=n-r;return o(a,[h,0,0,0,0,h,0,0,0,0,h,0,r,r,r,1],[t,0,0,0,0,t,0,0,0,0,t,0,c,c,c,1]),o(a,a,u),a}(e,t,r,n),this._saturation=e,this._contrast=t,this._brightnessMin=r,this._brightnessMax=n),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,t,i,r){const n=this.layout.get(e).evaluate(t,{},i,r),o=this._unevaluatedLayout._values[e];return o.isDataDriven()||Nr(o.value)||!n?n:yf(t.properties,n)}getAppearanceValueAndResolveTokens(e,t,i,r,n){const o=e.getLayoutProperty(t);if(!o)return;const a=o.evaluate(i,{},r,n),s=e.getUnevaluatedLayoutProperties()._values[t];return s.isDataDriven()||Nr(s.value)||!a||"string"!=typeof a?a:yf(i.properties,a)}createBucket(e){return new SymbolBucket(e)}placeSymbols(e,t,i,r,n){const{globalPlacement:o,idRangeAllocator:a,transform:s,buildingIndex:l,fogState:u,groupOrders:c,replacementSource:h}=e,d=this.runtimeLayerUID,p=vf(this.paint.get("placement-group"))||vf(this.paint.get("placement-priority"))?r._state.getState(this.sourceLayer||"_geojsonTileLayer"):xf;for(const e of t){const t=e.getBucket(this);if(!t||this.fqid!==t.layerIds[0])continue;"offset"===t.elevationType&&l?l.updateZOffset(t,e.tileID):"road"===t.elevationType&&t.hdExt&&t.hdExt.updateRoadElevation(t,e.tileID.canonical),t.updateZOffset(),o.startSymbolSourceProcessing(t);const r=hu(e.tileID,t.getProjection(),s,s.projection.name);t.addToPlacement(o,a,d,r,s,e.tileSize/Xt,e,u,c,i,p,n?h:null),o.finishSourceProcessing()}}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of bf().paint.overridableProperties){if(!SymbolStyleLayer.hasPaintOverride(this.layout,e))continue;const t=this.paint.get(e),i=new FormatSectionOverride(t),r=new StyleExpression(i,t.property.specification,this.scope,this.options,this.layout.get("icon-image-use-theme"));let n=null;n="constant"===t.value.kind||"source"===t.value.kind?new ZoomConstantExpression("source",r):new ZoomDependentExpression("composite",r,t.value.zoomStops,t.value.interpolationType),this.paint._values[e]=new PossiblyEvaluatedPropertyValue(t.property,n,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,i){return!(!this.layout||t.isDataDriven()||i.isDataDriven())&&SymbolStyleLayer.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){const i=e.get("text-field"),r=bf().paint.properties[t];let n=!1;const o=e=>{for(const t of e)if(r.overrides&&r.overrides.hasOverride(t))return void(n=!0)};if("constant"===i.value.kind&&i.value.value instanceof Formatted)o(i.value.value.sections);else if("source"===i.value.kind){const e=t=>{n||(t instanceof Literal&&Et(t.value)===pt?o(t.value.sections):t instanceof FormatExpression?o(t.sections):t.eachChild(e))},t=i.value;t._styleExpression&&e(t._styleExpression.expression)}return n}getProgramIds(){return["symbol"]}getDefaultProgramParams(e,t,i){return{config:new ProgramConfiguration(this,{zoom:t,lut:i}),overrideFog:!1}}hasElevation(){return this.layout&&"hd-road-markup"===this.layout.get("symbol-elevation-reference")}mayUse(e){return"HD"===e&&So(this,"symbol-elevation-reference",e=>"hd-road-markup"===e)}prepare(){return this.mayUse("HD")?Rp():Promise.resolve()}}let wf,Af,Ef,If,Sf,Df,Pf,Tf,zf,Mf,Cf,Rf;class CustomStyleLayer extends StyleLayer{constructor(e,t){super(e,{},t,null),this.implementation=e,e.slot&&(this.slot=e.slot)}is3D(e){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}isDraped(e){return void 0!==this.implementation.renderToTile}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(e){this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)}onRemove(e){this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)}}function Lf(e,t,i){const r=[0,0,1],n=O([]);return function(e,t,i){i*=.5;var r=t[0],n=t[1],o=t[2],a=t[3],s=Math.sin(i),l=Math.cos(i);e[0]=r*l-o*s,e[1]=n*l+a*s,e[2]=o*l+r*s,e[3]=a*l-n*s}(n,n,i?-ye(e)+Math.PI:ye(e)),function(e,t,i){i*=.5;var r=t[0],n=t[1],o=t[2],a=t[3],s=Math.sin(i),l=Math.cos(i);e[0]=r*l+a*s,e[1]=n*l+o*s,e[2]=o*l-n*s,e[3]=a*l-r*s}(n,n,-ye(t)),z(r,r,n),E(r,r)}class ModelFeature{constructor(e,t){this.feature=e,this.instancedDataOffset=t,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class PerModelAttributes{constructor(){this.maxScale=1,this.maxXYTranslationDistance=0,this.instancedDataArray=new StructArrayLayout16f64,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}colorForInstance(e){const t=16*e,i=this.instancedDataArray.float32;let r=Math.floor(i[t+2]);const n=1.05*(i[t+2]-r);return r/=100,[i[t]%1*1.05,i[t+1]%1*1.05,n,r]}tileCoordinatesForInstance(e){const t=16*e,i=this.instancedDataArray.float32;let r=i[t+0];return r=r>Xt?r-Xt:r,new K(Math.trunc(r),Math.trunc(i[t+1]))}translationForInstance(e){const t=16*e,i=this.instancedDataArray.float32;return[i[t+4],i[t+5],i[t+6]]}rotationScaleForInstance(e){const t=16*e,i=this.instancedDataArray.float32;return[i[t+7],i[t+8],i[t+9],i[t+10],i[t+11],i[t+12],i[t+13],i[t+14],i[t+15]]}transformForInstance(e){const t=16*e,i=this.instancedDataArray.float32;return[i[t+7],i[t+8],i[t+9],i[t+4],i[t+10],i[t+11],i[t+12],i[t+5],i[t+13],i[t+14],i[t+15],i[t+6],0,0,0,1]}}class ModelBucket{constructor(e){this.requiresStandardRuntime=!0,this.zoom=e.zoom,this.canonical=e.canonical,this.overscaledZ=this.canonical.z+Math.log2(e.overscaling),this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.projection=e.projection,this.index=e.index,this.worldview=e.worldview,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.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=e.styleDefinedModelURLs,this.hasAppearances=null}updateFootprints(e,t){}updateAppearances(e,t,i,r){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,i,r){this.tileToMeter=fa(i);const n=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);const o="hd-road-markup"===this.layers[0].paint.get("model-elevation-reference")?t.elevationFeatures:void 0;for(const{feature:a,id:s,index:l,sourceLayerIndex:u}of e){const e=s??(a.properties&&Object.hasOwn(a.properties,"id")?a.properties.id:void 0),c=Aa(a,n);if(!this.layers[0]._featureFilter.filter(new EvaluationParameters(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),c,i))continue;const h={id:e,sourceLayerIndex:u,index:l,geometry:n?c.geometry:wa(a,i,r),properties:a.properties,type:a.type,patterns:{}},d=this.addFeature(h,h.geometry,c,o,i);d&&t.featureIndex.insert(a,h.geometry,l,u,this.index,this.instancesPerModel[d].instancedDataArray.length,256)}this.lookup=null}evaluateQueryRenderedFeaturePadding(){const e=this.layers[0].modelManager,t=this.layers[0].scope;let i=0;for(const r of this.modelUris){const n=e.getModel(r,t);if(!n)continue;const o=this.instancesPerModel[r];if(o){const e=.5*b(n.aabb.max,n.aabb.min)*o.maxScale+o.maxXYTranslationDistance,t=Math.min(Xt,Math.max(e/this.tileToMeter,256));i=Math.max(t,i)}}return i}update(e,t,i,r){for(const t in this.instancesPerModel){const i=this.instancesPerModel[t];for(const t in e)Object.hasOwn(i.idToFeaturesIndex,t)&&(this.evaluate(i.features[i.idToFeaturesIndex[t]],e[t],i,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(const t in this.instancesPerModel){const i=this.instancesPerModel[t];for(const t of i.features){const r=this.layers[0],n=t.feature,o=this.canonical,a=r.paint.get("model-rotation").evaluate(n,{},o),s=r.paint.get("model-scale").evaluate(n,{},o),l=r.paint.get("model-translation").evaluate(n,{},o);M(t.rotation,a)&&M(t.scale,s)&&M(t.translation,l)||(this.evaluate(t,t.featureStates,i,!0),e=!0)}}return e}updateReplacement(e,t,i,r){if(t.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=t.updateTime;const n=t.getReplacementRegionsForTile(e.toUnwrapped(),!0);if(su(this.activeReplacements,n))return!1;this.activeReplacements=n;let o=!1;for(const t in this.instancesPerModel){const n=this.instancesPerModel[t],a=n.instancedDataArray;for(const t of n.features){const n=t.instancedDataOffset,s=t.instancedDataCount;for(let t=0;t<s;t++){const s=16*(t+n);let l=a.float32[s+0];const u=l>Xt;l=u?l-Xt:l;const c=Math.floor(l),h=Math.floor(a.float32[s+1]);let d=!1;for(const t of this.activeReplacements)if(!nu(t,i,1,r)&&!(t.min.x>c||c>t.max.x||t.min.y>h||h>t.max.y)&&(d=cu(uu(c,h,e.canonical,t.footprintTileId.canonical),t.footprint),d))break;a.float32[s]=d?l+Xt:l,o=o||d!==u}}}return o}isEmpty(){for(const e in this.instancesPerModel)if(0!==this.instancesPerModel[e].instancedDataArray.length)return!1;return!0}uploadPending(){return!this.uploaded}upload(e){if(!this.uploaded)for(const t in this.instancesPerModel){const i=this.instancesPerModel[t];i.instancedDataArray.length<0||0===i.instancedDataArray.length||(i.instancedDataBuffer?i.instancedDataBuffer.updateData(i.instancedDataArray):i.instancedDataBuffer=e.createVertexBuffer(i.instancedDataArray,Rh.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(e){for(const e in this.instancesPerModel){const t=this.instancesPerModel[e];0!==t.instancedDataArray.length&&t.instancedDataBuffer&&t.instancedDataBuffer.destroy()}const t=this.layers[0].modelManager;if(e&&t&&this.modelUris&&this.modelsRequested)for(const e of this.modelUris)t.removeModel(e,"",!0)}addFeature(e,t,i,r,n){const o=this.layers[0],a=o.layout.get("model-id"),s=o.layout.get("model-allow-density-reduction"),l=a.evaluate(i,{},this.canonical);if(!l)return ze(`modelId is not evaluated for layer ${o.id} and it is not going to get rendered.`),l;!l.includes("://")&&!this.styleDefinedModelURLs[l]||this.modelUris.includes(l)||this.modelUris.push(l),this.instancesPerModel[l]||(this.instancesPerModel[l]=new PerModelAttributes);const u=this.instancesPerModel[l],c=u.instancedDataArray,h=new ModelFeature(i,c.length);let d;if(r){const t=cc(e,r,void 0,n);d=t?t.feature:void 0}for(const e of t)for(const t of e){if(t.x<0||t.x>=Xt||t.y<0||t.y>=Xt)continue;if(0!==this.lookupDim&&s){const e=(this.lookupDim-1)/Xt,i=this.lookupDim*(t.y*e|0)+t.x*e|0;if(this.lookup){if(0!==this.lookup[i])continue;this.lookup[i]=1}}this.instanceCount++;const e=c.length;if(c.resize(e+1),r){u.instancesRoadElevation||(u.instancesRoadElevation=[]);const e=d?d.pointElevation(new K(t.x,t.y)):0;u.instancesRoadElevation.push(e)}u.instancesEvaluatedElevation.push(0),c.float32[16*e]=t.x,c.float32[16*e+1]=t.y}return h.instancedDataCount=u.instancedDataArray.length-h.instancedDataOffset,h.instancedDataCount>0&&(e.id&&(u.idToFeaturesIndex[e.id]=u.features.length),u.features.push(h),this.evaluate(h,{},u,!1)),l}getModelUris(){return this.modelUris}evaluate(e,t,i,r){const n=this.layers[0],o=e.feature,a=this.canonical,s=e.rotation=n.paint.get("model-rotation").evaluate(o,t,a),l=e.scale=n.paint.get("model-scale").evaluate(o,t,a),u=e.translation=n.paint.get("model-translation").evaluate(o,t,a),{r:c,g:h,b:d}=n.paint.get("model-color").evaluate(o,t,a),p=n.paint.get("model-color-mix-intensity").evaluate(o,t,a),f=[];this.maxVerticalOffset<u[2]&&(this.maxVerticalOffset=u[2]);const m=u[0]*u[0]+u[1]*u[1],_=m>0?Math.sqrt(m):0;i.maxScale=Math.max(Math.max(i.maxScale,l[0]),Math.max(l[1],l[2])),i.maxXYTranslationDistance=Math.max(i.maxXYTranslationDistance,_),this.maxScale=Math.max(Math.max(this.maxScale,l[0]),Math.max(l[1],l[2])),Bh(f,s,l);const g=Math.round(100*p)+d/1.05;for(let t=0;t<e.instancedDataCount;++t){const n=e.instancedDataOffset+t,o=16*n,s=i.instancedDataArray.float32;let l=0;r&&(l=s[o+6]-i.instancesEvaluatedElevation[n]);const d=0|s[o+1];s[o]=(0|s[o])+c/1.05,s[o+1]=d+h/1.05,s[o+2]=g,s[o+3]=1/(a.z>10?this.tileToMeter:fa(a,d)),s[o+4]=u[0],s[o+5]=u[1],s[o+6]=u[2]+(i.instancesRoadElevation?i.instancesRoadElevation[n]:0)+l,s[o+7]=f[0],s[o+8]=f[1],s[o+9]=f[2],s[o+10]=f[4],s[o+11]=f[5],s[o+12]=f[6],s[o+13]=f[8],s[o+14]=f[9],s[o+15]=f[10],i.instancesEvaluatedElevation[n]=u[2]}}}rn(ModelBucket,"ModelBucket",{omit:["layers"]}),rn(PerModelAttributes,"PerModelAttributes"),rn(ModelFeature,"ModelFeature");const Ff=new WeakMap;class ModelPartStyleUBO{constructor(e,t){const i=e.gl;if(this.context=e,this.buffer=i.createBuffer(),!this.buffer)throw new Error("Failed to create model part style UBO buffer");i.bindBuffer(i.UNIFORM_BUFFER,this.buffer),i.bufferData(i.UNIFORM_BUFFER,t,i.DYNAMIC_DRAW),i.bindBuffer(i.UNIFORM_BUFFER,null)}update(e){const t=this.context.gl;t.bindBuffer(t.UNIFORM_BUFFER,this.buffer),t.bufferSubData(t.UNIFORM_BUFFER,0,e),t.bindBuffer(t.UNIFORM_BUFFER,null)}bind(e,t){let i=Ff.get(t);if(void 0===i){const r=e.gl,n=r.getUniformBlockIndex(t,"ModelPartStyleUniform");i=n!==r.INVALID_INDEX,i&&r.uniformBlockBinding(t,n,0),Ff.set(t,i)}if(!i)return;const r=e.gl;r.bindBufferBase(r.UNIFORM_BUFFER,0,this.buffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),this.buffer=null)}}const Bf=new Float32Array(262144),Of=new Uint8Array(262144),Vf=[0,0,0],kf=[0,0,0];function Nf(e){let t=0;if(e.meshes)for(const i of e.meshes)t=Math.max(t,i.aabb.max[2]);if(e.children)for(const i of e.children)t=Math.max(t,Nf(i));return t}function Uf(e,t,i){if(e.meshes)for(const r of e.meshes){if(r.aabb.min[0]===1/0)continue;const n=Aabb.applyTransform(r.aabb,e.globalMatrix);i.insert(t,n.min[0],n.min[1],n.max[0],n.max[1])}if(e.children)for(const r of e.children)Uf(r,t,i)}class Tiled3dModelFeature{constructor(e){this.node=e,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.partStyle=new Float32Array(112),this.partStyleUBO=null,this.needsPartStyleUBO=!1,this.cameraCollisionOpacity=1,this.targetLod=-1,this.feature={type:"Point",id:e.id,geometry:[],properties:{height:Nf(e)}},this.aabb=this._getLocalBounds(),this.state=null}_getLocalBounds(){if(!this.node.meshes)return new Aabb([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0;const t=new Aabb([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const i of this.node.meshes)this.node.lightMeshIndex!==e&&(i.transformedAabb=Aabb.applyTransformFast(i.aabb,this.node.globalMatrix),t.encapsulate(i.transformedAabb)),e++;this.aabb=t}return this.aabb}}class Tiled3dModelBucket{constructor(e,t,i,r,n,o,a,s){this.requiresStandardRuntime=!0,this.isTiled3dModelBucket=!0,this.id=i,this.layers=e,this.layerIds=this.layers.map(e=>e.fqid),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.modelTraits|=1,this.uploaded=!1,this.hasPattern=!1,r&&(this.modelTraits|=4),n&&(this.modelTraits|=8),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=o,this.worldview=s,this.dirty=!0,this.needsPartStyleUBOs=!1,this.filter=null,this.nodesInfo=[];for(const e of t)this.nodesInfo.push(new Tiled3dModelFeature(e)),Uf(e,a.featureIndexArray.length,a.grid),a.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,a.bucketLayerIDs.length-1,0);this.states={},this.hasAppearances=null}updateFootprints(e,t){for(const i of this.getNodesInfo()){const r=i.node;r.footprint&&t.push({footprint:r.footprint,id:e})}}updateAppearances(e,t,i,r){return{hasLayoutChanges:!1,hasUboChanges:!1}}update(e){const t=0!==Object.keys(e).length;if(t&&!this.stateDependentLayers.length)return;const i=t?this.stateDependentLayers:this.layers;if(!Q(e,this.states))for(const t of i)this.evaluate(t,e);this.states=structuredClone(e)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsPartStyleUBOs}upload(e){if(this.needsPartStyleUBOs&&(this.createPartStyleUBOs(e),this.needsPartStyleUBOs=!1),!this.uploaded){const t=this.getNodesInfo();for(const i of t)$h(i.node,e,!0);for(const e of t)Xh(e.node);this.uploaded=!0}}createPartStyleUBOs(e){for(const t of this.getNodesInfo())t.needsPartStyleUBO&&(t.partStyleUBO=new ModelPartStyleUBO(e,t.partStyle),t.needsPartStyleUBO=!1)}needsReEvaluation(e,t,i){const r=e.transform.projectionOptions,n=e.style.getBrightness(),o=this.brightness!==n;if(!this.uploaded||this.dirty||r.name!==this.projection.name||Gf(i.paint.get("model-color").value,o)||Gf(i.paint.get("model-color-mix-intensity").value,o)||Gf(i.paint.get("model-roughness").value,o)||Gf(i.paint.get("model-emissive-strength").value,o)||Gf(i.paint.get("model-height-based-emissive-strength-multiplier").value,o)){this.projection=r,this.brightness=n;const e=this.getNodesInfo();for(const t of e)t.state=null;return!0}return!1}evaluateTransform(e,t){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;const i=this.getNodesInfo(),r=this.id.canonical;for(const e of i){const i=e.feature;e.evaluatedTranslation=t.paint.get("model-translation").evaluate(i,{},r),e.evaluatedScale=t.paint.get("model-scale").evaluate(i,{},r)}}evaluate(e,t){const i=this.getNodesInfo();for(const r of i){if(!r.node.meshes)continue;const i=r.feature,n=t&&t[i.id];if(Q(n,r.state))continue;r.state=structuredClone(n);const o=r.node.meshes&&r.node.meshes[0].hasFeatureData,a=this.id.canonical;if(r.hasTranslucentParts=!1,o){for(let t=0;t<Uh.length;t++){const o=Uh[t];o.length&&(i.properties.part=o);const s=e.paint.get("model-color").evaluate(i,n,a).toPremultipliedRenderColor(null),l=e.paint.get("model-color-mix-intensity").evaluate(i,n,a);r.evaluatedColor[t]=[s.r,s.g,s.b,l],r.evaluatedRMEA[t][0]=e.paint.get("model-roughness").evaluate(i,n,a),r.evaluatedRMEA[t][2]=e.paint.get("model-emissive-strength").evaluate(i,n,a),r.evaluatedRMEA[t][3]=s.a,r.emissionHeightBasedParams[t]=e.paint.get("model-height-based-emissive-strength-multiplier").evaluate(i,n,a),!r.hasTranslucentParts&&s.a<1&&(r.hasTranslucentParts=!0)}delete i.properties.part}else r.evaluatedRMEA[0][2]=e.paint.get("model-emissive-strength").evaluate(i,n,a);r.evaluatedTranslation=e.paint.get("model-translation").evaluate(i,n,a),r.evaluatedScale=e.paint.get("model-scale").evaluate(i,n,a),o&&(Hf(r),r.partStyleUBO?r.partStyleUBO.update(r.partStyle):(r.needsPartStyleUBO=!0,this.needsPartStyleUBOs=!0))}this.dirty=!1}elevationUpdate(e,t,i,r){const n=e.findDEMTileFor(i);if(n&&(n.tileID.canonical!==this.terrainTile||t!==this.terrainExaggeration)){if(n.dem&&n.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=n.tileID.overscaledZ;const t=DEMSampler.create(e,i,n);if(!t)return;4&this.modelTraits&&this.updateDEM(e,t,i,r);for(const e of this.getNodesInfo()){const i=e.node;if(!i.footprint||!i.footprint.vertices||!i.footprint.vertices.length)continue;const r=i.footprint.vertices;let n=t.getElevationAt(r[0].x,r[0].y,!0,!0);for(let e=1;e<r.length;e++)n=Math.min(n,t.getElevationAt(r[e].x,r[e].y,!0,!0));i.elevation=n}}this.terrainTile=n.tileID.canonical,this.terrainExaggeration=t}}updateDEM(e,t,i,r){let n=t._dem._modifiedForSources[r];if(void 0===n&&(t._dem._modifiedForSources[r]=[],n=t._dem._modifiedForSources[r]),n.includes(i.canonical))return;const o=t._dem.dim;n.push(i.canonical);let a=!1;for(const e of this.getNodesInfo()){const i=e.node;if(!i.footprint||!i.footprint.grid)continue;const r=i.footprint.grid,n=t.tileCoordToPixel(r.min.x,r.min.y),s=t.tileCoordToPixel(r.max.x,r.max.y),l=Math.min(Math.min(o-s.y,n.x),Math.min(n.y,o-s.x));if(l<0)continue;const u=ve(l,2,5);let c=Math.max(0,n.x-u),h=Math.max(0,n.y-u),d=Math.min(s.x+u,o-1),p=Math.min(s.y+u,o-1);for(let e=h;e<=p;++e)for(let t=c;t<=d;++t)Of[e*o+t]=255;let f=0,m=0;for(let e=0;e<r.cellsY;++e)for(let i=0;i<r.cellsX;++i){if(!r.cells[e*r.cellsX+i])continue;const n=t.tileCoordToPixel(r.min.x+i/r.xScale,r.min.y+e/r.yScale),a=t.tileCoordToPixel(r.min.x+(i+1)/r.xScale,r.min.y+(e+1)/r.yScale);for(let e=n.y;e<=Math.min(a.y+1,o-1);++e)for(let i=n.x;i<=Math.min(a.x+1,o-1);++i)255===Of[e*o+i]&&(Of[e*o+i]=0,f+=t.getElevationAtPixel(i,e),m++)}const _=f/m;c=Math.max(1,n.x-u),h=Math.max(1,n.y-u),d=Math.min(s.x+u,o-2),p=Math.min(s.y+u,o-2),a=!0;for(let e=h;e<=p;++e)for(let i=c;i<=d;++i)0===Of[e*o+i]&&(Bf[e*o+i]=t._dem.set(i,e,_));for(let e=1;e<u;++e){c=Math.max(1,n.x-e),h=Math.max(1,n.y-e),d=Math.min(s.x+e,o-2),p=Math.min(s.y+e,o-2);for(let i=h;i<=p;++i)for(let r=c;r<=d;++r){const n=i*o+r;if(255===Of[n]){let a=0,s=0,l=-1,c=-1;for(let t=-1;t<=1;++t)for(let n=-1;n<=1;++n){const u=(i+t)*o+r+n;if(Of[u]>=e)continue;const h=Bf[u],d=Math.abs(h);d>s&&(a=h,s=d,l=n,c=t)}if(s>.1){const o=1-(e+.5*Math.abs(l*c))/u;let s=t._dem.get(r,i)+a*o;const h=t._dem.get(r+l,i+c),d=t._dem.get(r-l,i-c,!0);(s-h)*(s-d)>0&&(s=(h+d)/2),Bf[n]=t._dem.set(r,i,s),Of[n]=e}}}}}a&&(t._demTile.needsDEMTextureUpload=!0,t._dem._timestamp=$e.now())}setFilter(e){this.filter=e?no(e):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(e=>this.filter.filter(new EvaluationParameters(this.id.overscaledZ,{worldview:this.worldview}),e.feature,this.id.canonical)):this.nodesInfo}destroy(){const e=this.getNodesInfo();for(const t of e)Xh(t.node),Zh(t.node),t.partStyleUBO&&(t.partStyleUBO.destroy(),t.partStyleUBO=null)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,t){if(t.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=t.updateTime;const i=t.getReplacementRegionsForTile(e.toUnwrapped());for(const e of this.getNodesInfo()){const t=e.node.footprint;e.hiddenByReplacement=!!t&&!i.some(e=>e.footprint===t)}}getHeightAtTileCoord(e,t){const i=[0,0,0],o=r([]);for(const r of this.getNodesInfo()){const a=r.node.meshes[0],s=a.transformedAabb;if(e<s.min[0]||t<s.min[1]||e>s.max[0]||t>s.max[1])continue;if(!0===r.node.hidden)return{height:1/0,maxHeight:r.feature.properties.height,hidden:!1,verticalScale:r.evaluatedScale[2]};if(n(o,r.node.globalMatrix),i[0]=e,i[1]=t,i[2]=0,T(i,i,o),r.node.meshBVH){const e=i[0],t=i[1];Vf[0]=e-1,Vf[1]=t-1,Vf[2]=-1e3,kf[0]=e+1,kf[1]=t+1,kf[2]=1e3;const n=r.node.meshBVH.findHighestPoint(Vf,kf);if(null!==n)return{height:n,maxHeight:r.feature.properties.height,hidden:r.hiddenByReplacement,verticalScale:r.evaluatedScale[2]};continue}if(!a.heightmap)continue;const l=(i[0]-a.aabb.min[0])/(a.aabb.max[0]-a.aabb.min[0])*Nh|0,u=Math.min(63,(i[1]-a.aabb.min[1])/(a.aabb.max[1]-a.aabb.min[1])*Nh|0)*Nh+Math.min(63,l),c=a.heightmap[u];if(c<0&&r.node.footprint){const i=[];if(r.node.footprint.grid.query(new K(e,t),new K(e,t),i),i.length>0)return{height:void 0,maxHeight:r.feature.properties.height,hidden:r.hiddenByReplacement,verticalScale:r.evaluatedScale[2]};continue}if(r.hiddenByReplacement)return;return{height:c,maxHeight:r.feature.properties.height,hidden:!1,verticalScale:r.evaluatedScale[2]}}}}function Gf(e,t){return e instanceof ZoomConstantExpression&&!e.isLightConstant&&t}function jf(e,t){e[t+4]=16*Math.floor(15*e[t+4])/255,e[t+5]=16*Math.floor(15*e[t+5])/255,e[t+6]=Math.min(Math.floor(127.5*e[t+6]+.5),255)/255*2,e[t+7]=Math.floor(255*e[t+7])/255;const i=Math.floor(255*e[t+10])/256,r=Math.floor(255*(e[t+10]+e[t+11]))/256;e[t+10]=i,e[t+11]=r-i}function Hf(e){const t=e.partStyle;for(let i=0;i<Uh.length;i++){const r=e.evaluatedColor[i],n=e.evaluatedRMEA[i],o=e.emissionHeightBasedParams[i],a=ve(o[0],0,1),s=ve(o[1],0,1),l=16*i;t[l]=r[0],t[l+1]=r[1],t[l+2]=r[2],t[l+3]=ve(r[3],0,1),t[l+4]=n[0],t[l+5]=n[1],t[l+6]=ve(n[2],0,2),t[l+7]=n[3],a!==s?(t[l+8]=a,t[l+9]=s,t[l+10]=ve(o[2],0,1),t[l+11]=ve(o[3],0,1)-t[l+10],t[l+12]=Math.pow(10,ve(o[4],-1,1))):(t[l+8]=0,t[l+9]=1,t[l+10]=1,t[l+11]=0,t[l+12]=1),jf(t,l)}}rn(Tiled3dModelBucket,"Tiled3dModelBucket",{omit:["layers"]}),rn(Tiled3dModelFeature,"Tiled3dModelFeature",{omit:["partStyleUBO"]});class DictionaryCoder{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){const i=e[t];this._stringToNumber[i]=t,this._numberToString[t]=i}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}const $f=["id","tile","layer","source","sourceLayer","state"];class Feature{constructor(e,t,i,r,n){this.type="Feature",this._vectorTileFeature=e,this._z=t,this._x=i,this._y=r,this.properties=e?e.properties:{},this.id=n}clone(){const e=new Feature(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(e.state={...this.state}),this.layer&&(e.layer={...this.layer}),this.source&&(e.source=this.source),this.sourceLayer&&(e.sourceLayer=this.sourceLayer),e}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(e){this._geometry=e}toJSON(){const e={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const t of $f)void 0!==this[t]&&(e[t]=this[t]);return e}}new Float32Array(r([]));const Wf=7680;class StencilMode{constructor(e,t,i,r,n,o){this.test=e,this.ref=t,this.mask=i,this.fail=r,this.depthFail=n,this.pass=o}}StencilMode.disabled=new StencilMode({func:519,mask:0},0,0,Wf,Wf,Wf);const Xf=770,qf=771;class ColorMode{constructor(e,t,i,r){this.blendFunction=e,this.blendColor=t.toNonPremultipliedRenderColor(null),this.mask=i,this.blendEquation=r}}ColorMode.Replace=[1,0,1,0],ColorMode.disabled=new ColorMode(ColorMode.Replace,Color.transparent,[!1,!1,!1,!1]),ColorMode.unblended=new ColorMode(ColorMode.Replace,Color.transparent,[!0,!0,!0,!0]),ColorMode.alphaBlended=new ColorMode([1,qf,1,qf],Color.transparent,[!0,!0,!0,!0]),ColorMode.alphaBlendedNonPremultiplied=new ColorMode([Xf,qf,Xf,qf],Color.transparent,[!0,!0,!0,!0]),ColorMode.multiply=new ColorMode([774,0,774,0],Color.transparent,[!0,!0,!0,!0]),ColorMode.multiplyAccumulateAlpha=new ColorMode([774,0,1,qf],Color.transparent,[!0,!0,!0,!0]),ColorMode.additive=new ColorMode([1,1,1,1],Color.transparent,[!0,!0,!0,!0]),ColorMode.additiveAlphaWeighted=new ColorMode([Xf,1,773,1],Color.transparent,[!0,!0,!0,!0]),ColorMode.additiveAlphaWeightedUnboundedAlpha=new ColorMode([Xf,1,1,1],Color.transparent,[!0,!0,!0,!0]);class DepthMode{constructor(e,t,i){this.func=e,this.mask=t,this.range=i}}DepthMode.ReadOnly=!1,DepthMode.ReadWrite=!0,DepthMode.disabled=new DepthMode(519,DepthMode.ReadOnly,[0,1]);const Zf=1029,Yf=2305;class CullFaceMode{constructor(e,t,i){this.enable=e,this.mode=t,this.frontFace=i}}function Jf(e,t,i,r){const n=1<<e.z;t.lat=Ft((r/Xt+e.y)/n),t.lng=Lt((i/Xt+e.x)/n)}CullFaceMode.disabled=new CullFaceMode(!1,Zf,Yf),CullFaceMode.backCCW=new CullFaceMode(!0,Zf,Yf),CullFaceMode.backCW=new CullFaceMode(!0,Zf,2304),CullFaceMode.frontCW=new CullFaceMode(!0,1028,2304),CullFaceMode.frontCCW=new CullFaceMode(!0,1028,Yf),new Float64Array(16),new Float64Array(16),new Float64Array(16),new Float64Array(16),new Float64Array(16),new Float64Array(16),new Float64Array(16),new Float32Array(16),new Float64Array(16),new Float32Array(16),new Aabb([0,0,0],[Xt,Xt,0]);var Kf="\
2\n#define FLIP_VIEWPORT_UV_Y(uv)\\n#ifdef DUAL_SOURCE_BLENDING\\nlayout(location=0,index=0) out vec4 glFragColor;layout(location=0,index=1) out vec4 glFragColorSrc1;\\n#elif defined(FLOAT_RENDER_TARGET)\\nlayout(location=0) out highp vec4 glFragColor;\\n#else\\nlayout(location=0) out vec4 glFragColor;\\n#endif\\n#ifdef USE_MRT1\\nlayout(location=1) out vec4 out_Target1;\\n#endif\\nhighp float unpack_depth(highp vec4 rgba_depth)\\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}const float DITHER_THRESHOLDS[16]=float[16](\\n1.0/17.0, 9.0/17.0, 3.0/17.0,11.0/17.0,13.0/17.0, 5.0/17.0,15.0/17.0, 7.0/17.0,4.0/17.0,12.0/17.0, 2.0/17.0,10.0/17.0,16.0/17.0, 8.0/17.0,14.0/17.0, 6.0/17.0\\n);int viewport_dither_index(vec2 fragCoordXY) {return (int(fragCoordXY.x) % 4)*4+(int(fragCoordXY.y) % 4);}\\n#ifdef DEBUG_WIREFRAME\\n#define HANDLE_WIREFRAME_DEBUG \\\\\\nglFragColor=vec4(0.7,0.0,0.0,0.7); \\\\\\ngl_FragDepth=gl_FragCoord.z-0.0001;\\n#else\\n#define HANDLE_WIREFRAME_DEBUG\\n#endif\\n#ifdef RENDER_CUTOFF\\nuniform highp vec4 u_cutoff_params;in float v_cutoff_opacity;\\n#endif\\nvec4 textureLodCustom(sampler2D image,highp vec2 pos,highp vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 premultiplyColor(vec3 nonPremultipliedColor,float a) {return vec4(nonPremultipliedColor*a,a);}vec3 unpremultiplyColor(vec4 premultipliedColor) {if (premultipliedColor.a > 0.0) {return premultipliedColor.rgb/premultipliedColor.a;}return premultipliedColor.rgb;}vec3 applyLUT(highp sampler3D lut,vec3 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return texture(lut,uvw).rgb;}vec4 applyLUT(highp sampler3D lut,vec4 premultipliedColor) {return premultiplyColor(applyLUT(lut,unpremultiplyColor(premultipliedColor)),premultipliedColor.a);}void storeEmissiveColor(vec4 color,float emissiveStrength) {\\n#ifdef DUAL_SOURCE_BLENDING\\nglFragColorSrc1=vec4(vec3(0.0),emissiveStrength);\\n#else\\n#ifdef USE_MRT1 \\n#ifdef USE_MRT1_RGBA\\nout_Target1=vec4(color.rgb*emissiveStrength,color.a);\\n#else\\nout_Target1=vec4(emissiveStrength*color.a,0.0,0.0,glFragColor.a);\\n#endif\\n#endif\\n#endif\\n}",Qf="\\n#define EXTENT 8192.0\\n#define RAD_TO_DEG 180.0/PI\\n#define DEG_TO_RAD PI/180.0\\n#define GLOBE_RADIUS EXTENT/PI/2.0\\nfloat wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}\\n#ifdef PROJECTION_GLOBE_VIEW\\nvec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\\n#ifndef PROJECTED_POS_ON_VIEWPORT\\nfloat tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;\\n#else\\nreturn vec3(0.0);\\n#endif\\n}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}\\n#endif\\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec4 decode_color(const vec2 encodedColor) {return vec4(\\nunpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const vec2 units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);
2return (units_to_pixels*pos+offset)/pattern_size;}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {return get_pattern_pos(pixel_coord_upper,pixel_coord_lower,pattern_size,vec2(tile_units_to_pixels),pos);}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}\\n#ifdef RENDER_CUTOFF\\nuniform vec4 u_cutoff_params;out float v_cutoff_opacity;\\n#endif\\nconst vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(ivec2 posWithComposedSkirt)\\n{float skirt=float(float(posWithComposedSkirt.x) >=skirtOffset);vec2 pos=vec2(posWithComposedSkirt)-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}\\n#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_id) attrib\\n#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_id) attrib\\n#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_id) attrib\\n#define DECLARE_MATERIAL_TABLE_INFO\\n",em="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",tm="\\n#define ELEVATION_SCALE 7.0\\n#define ELEVATION_OFFSET 450.0\\n#ifdef PROJECTION_GLOBE_VIEW\\nuniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;\\n#endif\\nvec3 elevationVector(vec2 pos) {\\n#ifdef PROJECTION_GLOBE_VIEW\\nvec2 uv=pos/EXTENT;vec3 up=normalize(mix(\\nmix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;\\n#else\\nreturn vec3(0,0,1);\\n#endif\\n}\\n#ifdef TERRAIN\\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float currentElevation(vec2 apos) {\\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r;\\n#else\\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\\n#endif\\n}float prevElevation(vec2 apos) {\\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r;\\n#else\\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\\n#endif\\n}vec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}\\n#endif\\nfloat elevation(vec2 apos) {\\n#ifdef TERRAIN\\n#ifdef TERRAIN_VERTEX_MORPHING\\nfloat nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);\\n#else\\nreturn currentElevation(apos);\\n#endif\\n#else\\nreturn 0.0;\\n#endif\\n}\\n#ifdef DEPTH_OCCLUSION\\nuniform highp sampler2D u_depth;uniform highp vec2 u_depth_size_inv;uniform highp vec2 u_depth_range_unpack;uniform highp float u_occluder_half_size;uniform highp float u_occlusion_depth_offset;\\n#ifdef DEPTH_D24\\nfloat unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}vec4 unpack_depth4(vec4 depth) {return depth*u_depth_range_unpack.x+vec4(u_depth_range_unpack.y);}\\n#else\\nhighp float unpack_depth_rgba(vec4 rgba_depth)\\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}\\n#endif\\nbool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;\\n#ifdef DEPTH_D24\\nfloat depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r);\\n#else\\nfloat depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5));\\n#endif\\nreturn coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_
2size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5;\\n#ifdef DEPTH_D24\\nhighp vec4 depth=vec4(\\ntexture(u_depth,uv-df.xz).r,texture(u_depth,uv+df.xz).r,texture(u_depth,uv-df.zy).r,texture(u_depth,uv+df.zy).r\\n);depth=unpack_depth4(depth);\\n#else\\nhighp vec4 depth=vec4(\\nunpack_depth_rgba(texture(u_depth,uv-df.xz)),unpack_depth_rgba(texture(u_depth,uv+df.xz)),unpack_depth_rgba(texture(u_depth,uv-df.zy)),unpack_depth_rgba(texture(u_depth,uv+df.zy))\\n);\\n#endif\\nreturn depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5;int NX=3;int NY=4;highp vec2 df=u_occluder_half_size*u_depth_size_inv;highp vec2 oneStep=2.0*u_occluder_half_size*u_depth_size_inv/vec2(NX-1,NY-1);highp float res=0.0;for (int y=0; y < NY;++y) {for (int x=0; x < NX;++x) {\\n#ifdef DEPTH_D24\\nhighp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r);\\n#else\\nhighp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)));\\n#endif\\nres+=1.0-clamp(300.0*(coord.z+u_occlusion_depth_offset-depth),0.0,1.0);}}res=clamp(2.0*res/float(NX*NY)-0.5,0.0,1.0);return res;}highp float occlusionFade(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec4 depth=getCornerDepths(coord.xy);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z+u_occlusion_depth_offset)-depth),0.0,1.0));}\\n#else\\nbool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; }\\n#endif",im="#ifdef FOG\\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}\\n#endif",rm="#ifdef FOG\\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;FLIP_VIEWPORT_UV_Y(uv);highp vec3 ray_dir=mix(\\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}
2vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {return color;}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\\n#endif",nm="\\n#ifdef LIGHTING_3D_MODE\\nuniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);}\\n#endif",om="#ifdef RASTER_ARRAY\\nuniform highp sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}
2vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0)\\n);}vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0)\\n);}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}\\n#endif",am="#ifdef RENDER_SHADOWS\\nuniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {vec3 transformed_normal=vec3(-normal.xy,normal.z);float NDotL=dot(normalize(transformed_normal),u_shadow_direction);float dotScale=min(1.0-NDotL,1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];}\\n#endif",sm="#ifdef RENDER_SHADOWS\\nprecision highp sampler2DShadow;uniform sampler2DShadow u_shadowmap_0;uniform sampler2DShadow u_shadowmap_1;uniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;highp vec2 shadow_map_ndc_to_uv(highp vec2 ndc_xy) {return ndc_xy*0.5+0.5;}highp vec3 shadow_map_ndc_to_sample_space(highp vec3 ndc) {return vec3(shadow_map_ndc_to_uv(ndc.xy),ndc.z*0.5+0.5);}float shadow_sample(sampler2DShadow shadowmap,highp vec3 pos,highp float bias) {highp vec3 coord=vec3(shadow_map_ndc_to_uv(pos.xy),pos.z*0.5+0.5-bias);return texture(shadowmap,coord);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {light_view_pos0.xyz/=light_view_pos0.w;\\n#ifdef SHADOWS_SINGLE_CASCADE\\nvec2 abs_bounds=abs(light_view_pos0.xy);if (abs_bounds.x >=1.0 || abs_bounds.y >=1.0) {return 0.0;}return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);\\n#else\\nlight_view_pos1.xyz/=light_view_pos1.w;vec4 abs_bounds=abs(vec4(light_view_pos0.xy,light_view_pos1.xy));if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}float occlusion1=shadow_sample(u_shadowmap_1,light_view_pos1.xyz,bias);return clamp(mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth)),0.0,1.0);\\n#endif\\n}highp float calculate_shadow_bias(float NDotL) {\\n#ifdef NORMAL_OFFSET\\nreturn 0.5*u_shadow_bias.x;\\n#else\\nreturn 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z));\\n#endif\\n}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_opacity(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,float shadow_opacity) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias)*shadow_opacity;return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}highp vec2 compute_receiver_plane_depth_bias(highp vec3 pos_dx,highp vec3 pos_dy)\\n{highp vec2 biasUV=vec2(\\npos_dy.y*pos_dx.z-pos_dx.y*pos_dy.z,pos_dx.x*pos_dy.z-pos_dy.x*pos_dx.z);biasUV*=1.0/((pos_dx.x*pos_dy.y)-(pos_dx.y*pos_dy.x));return biasUV;}float shadowed_light_factor_plane_bias(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {highp vec3 light_view_pos0_xyz=shadow_map_ndc_to_sample_space(light_view_pos0.xyz/light_view_pos0.w);highp vec3 light_view_pos0_ddx=dFdx(light_view_pos0_xyz);highp vec3 light_view_pos0_ddy=dFdy(light_view_pos0_xyz);highp vec2 plane_depth_bias=compute_receiver_plane_depth_bias(light_view_pos0_ddx,light_view_pos0_ddy);highp float bias=dot(vec2(u_shadow_texel_size,u_shadow_texel_size),plane_depth_bias)+0.0001;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);}\\n#endif";const lm=/^#include\\s+"([^"]+)"\\s*\\r?\\n/gm,um=/#pragma mapbox: ([\\w\\-]+) ([\\w]+) ([\\w]+) ([\\w]+)/g,cm=/\\b[A-Za-z_][A-Za-z0-9_]*\\b/g,hm=new Set(["ifdef","ifndef","elif","
2if","defined"]),dm=new Set;mm("\\n#define EPSILON 0.0000001\\n#define PI 3.141592653589793\\n#ifdef RENDER_CUTOFF\\nfloat cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);}\\n#endif",dm),mm(Qf,dm),mm(Kf,dm);const pm={"_prelude_fog.vertex.glsl":im,"_prelude_terrain.vertex.glsl":tm,"_prelude_shadow.vertex.glsl":am,"_prelude_material_table.vertex.glsl":"","_prelude_fog.fragment.glsl":rm,"_prelude_shadow.fragment.glsl":sm,"_prelude_lighting.glsl":nm,"_prelude_raster_array.glsl":om,"_prelude_indicator_cutout.fragment.glsl":"\\nvec4 applyCutout(vec4 color,float height) {return color;}","_prelude_feature_cutout.fragment.glsl":"// feature cutout (gl-native only)\\n","_prelude_feature_cutout.vertex.glsl":"// feature cutout (gl-native only)\\n"},fm={};function mm(e,t){const i=e.split("\\n");for(let e of i){if(e=e.trimStart(),"#"!==e[0])continue;if(!e.includes("if"))continue;if(e.startsWith("#endif"))continue;const i=e.match(cm);if(i)for(const e of i)hm.has(e)||t.add(e)}}function _m(e){return new Set(["uint","int","uvec2","ivec2","uvec3","ivec3","uvec4","ivec4"]).has(e)}function gm(e,t){const i=new Set,r=[],n=[];e=e.replace(lm,(e,t)=>(n.push(t),"")),t=t.replace(lm,(e,t)=>(r.push(t),""));let o=new Set(dm);mm(e,o),mm(t,o);for(const e of[...r,...n])fm[e]||(fm[e]=new Set,mm(pm[e],fm[e])),o=new Set([...o,...fm[e]]);return{fragmentSource:e=e.replace(um,(e,t,r,n,o)=>(i.add(o),"define"===t?`\\n#ifndef HAS_UNIFORM_u_${o}\\n${_m(n)?"flat ":""}in ${r} ${n} ${o};\\n#else\\nuniform ${r} ${n} u_${o};\\n#endif\\n`:"initialize"===t?`\\n#ifdef HAS_UNIFORM_u_${o}\\n    ${r} ${n} ${o} = u_${o};\\n#endif\\n`:"define-attribute"===t?`\\n#ifdef HAS_ATTRIBUTE_a_${o}\\n    in ${r} ${n} ${o};\\n#endif\\n`:"initialize-attribute"===t?"":void 0)),vertexSource:t=t.replace(um,(e,t,r,n,o)=>{const a=`MATERIAL_ATTRIBUTE_OFFSET_${o}`,s="float"===n?"vec2":n,l=`GET_ATTRIBUTE_${s}(a_${o}, materialInfo, ${a})`,u=o.includes("color")?"color":s;return"define-attribute-vertex-shader-only"===t?`\\n#ifdef HAS_ATTRIBUTE_a_${o}\\nin ${r} ${n} a_${o};\\n#endif\\n`:i.has(o)?"define"===t?`\\n#ifndef HAS_UNIFORM_u_${o}\\nuniform lowp float u_${o}_t;\\n    #if !defined(${a})\\n        in ${r} ${s} a_${o};\\n    #endif\\n${_m(n)?"flat ":""}out ${r} ${n} ${o};\\n#else\\nuniform ${r} ${n} u_${o};\\n#endif\\n`:"initialize"===t?"vec4"===u||"uvec4"===u?`\\n#ifndef HAS_UNIFORM_u_${o}\\n    ${o} = a_${o};\\n#else\\n    ${r} ${n} ${o} = u_${o};\\n#endif\\n`:`\\n#if !defined(HAS_UNIFORM_u_${o})\\n    #ifdef ${a}\\n        ${o} = unpack_mix_${u}(${l}, u_${o}_t);\\n    #else\\n        ${o} = unpack_mix_${u}(a_${o}, u_${o}_t);\\n    #endif\\n#else\\n    ${r} ${n} ${o} = u_${o};\\n#endif\\n`:"define-attribute"===t?`\\n#ifdef HAS_ATTRIBUTE_a_${o}\\n    in ${r} ${n} a_${o};\\n    out ${r} ${n} ${o};\\n#endif\\n`:"initialize-attribute"===t?`\\n#ifdef HAS_ATTRIBUTE_a_${o}\\n    ${o} = a_${o};\\n#endif\\n`:void 0:"define"===t?`\\n#ifndef HAS_UNIFORM_u_${o}\\nuniform lowp float u_${o}_t;\\n    #if !defined(${a})\\n        in ${r} ${s} a_${o};\\n    #endif\\n#else\\nuniform ${r} ${n} u_${o};\\n#endif\\n`:"define-instanced"===t?"mat4"===u?`\\n#ifdef INSTANCED_ARRAYS\\nin vec4 a_${o}0;\\nin vec4 a_${o}1;\\nin vec4 a_${o}2;\\nin vec4 a_${o}3;\\n#else\\nuniform ${r} ${n} u_${o};\\n#endif\\n`:`\\n#ifdef INSTANCED_ARRAYS\\nin ${r} ${s} a_${o};\\n#else\\nuniform ${r} ${n} u_${o};\\n#endif\\n`:"initialize-attribute-custom"===t?`\\n#ifdef HAS_ATTRIBUTE_a_${o}\\n    ${r} ${n} ${o} = a_${o};\\n#endif\\n`:"vec4"===u||"uvec4"===u?`\\n#ifndef HAS_UNIFORM_u_${o}\\n    #ifdef ${a}\\n        ${r} ${n} ${o} = ${l};\\n    #else\\n        ${r} ${n} ${o} = a_${o};\\n    #endif\\n#else\\n    ${r} ${n} ${o} = u_${o};\\n#endif\\n`:`\\n#ifndef HAS_UNIFORM_u_${o}\\n    #ifdef ${a}\\n        ${r} ${n} ${o} = unpack_mix_${u}(${l}, u_${o}_t);\\n    #else\\n        ${r} ${n} ${o} = unpack_mix_${u}(a_${o}, u_${o}_t);\\n    #endif\\n#else\\n    ${r} ${n} ${o} = u_${o};\\n#endif\\n`}),usedDefines:o,vertexIncludes:r,fragmentIncludes:n}}gm("",tm),gm(rm,im),gm(sm,am),gm(om,""),gm(nm,nm),gm("precision mediump float;","precision highp float;"),gm(Kf,Qf),gm("\\n#if defined(GL_EXT_blend_func_extended) && defined(DUAL_SOURCE_BLENDING)\\n#extension GL_EXT_blend_func_extended : require\\n#endif",""),gm(\'#include "_prelude_fog.fragment.glsl"\\n#include "_prelude_feature_cutout.fragment.glsl"\\nuniform vec4 u_color;uniform float u_opacity;uniform mediump float u_emissive_strength;\\n#ifdef LIGHTING_3D_MODE\\nin vec4 v_color;\\n#endif\\nvoid main() {vec4 out_color;\\n#ifdef LIGHTING_3D_MODE\\nout_color=v_color;\\n#else\\nout_color=u_color;\\n#endif\\n#ifdef FOG\\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\\n#endif\\nglFragColor=out_color*u_opacity;storeEmissiveColor(glFragColor,u_emissive_strength);\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}\',\'#include "_prelude_fog.vertex.glsl"\\n#include "_prelude_lighting.glsl"\\nin ivec2 a_pos;uniform mat4 u_matrix;uniform mediump float u_emissive_strength;\\n#ifdef LIGHTING_3D_MODE\\nuniform mediump vec4 u_color;out vec4 v_color;\\n#endif\\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0,1);\\n#ifdef LIGHTING_3D_MODE\\nv_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength);\\n#endif\\n#ifdef FOG\\nv_fog_pos=fog_position(vec2(a_pos));\\n#endif\\n}\'),gm(\'#include "_prelude_fog.fragment.glsl"\\n#include "_prelude_lighting.glsl"\\nuniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in highp vec2 v_pos;void main() {highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos);\\n#ifdef LIGHTING_3D_MODE\\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\\n#endif\\n#ifdef FOG\\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\\n#endif\\nglFragColor=out_color*u_opacity;storeEmissiveColor(glFragColor,u_emissive_strength);\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}\',\'#include "_prelude_fog.vertex.glsl"\\nuniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec2 u_pattern_units_to_pixels;in ivec2 a_pos;out highp vec2 v_pos;void main() {vec2 pos=vec2(a_pos);gl_Position=u_matrix*vec4(pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_pattern_units_to_pixels,pos);\\n#ifdef FOG\\nv_fog_pos=fog_position(pos);\\n#endif\\n}\'),gm(\'#include "_prelude_fog.fragment.glsl"\\n#include "_prelude_lighting.glsl"\\nin vec3 v_data;in float v_visibility;\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define mediump float radius\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define highp vec4 stroke_color\\n#pragma mapbox: define mediump float stroke_width\\n#pragma mapbox: define lowp float stroke_opacity\\nuniform float u_emissive_strength;void main() {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize mediump float radius\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize highp vec4 stroke_color\\n#pragma mapbox: initialize mediump float stroke_width\\n#pragma mapbox: initialize lowp float stroke_opacity\\nvec2 extrude=v_data.xy;float blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);
2float antialiase_blur_opacity=smoothstep(0.0,antialiasblur,extrude_length-1.0);float opacity_t=blur_positive==1.0 ? \\nsmoothstep(0.0,-antialiased_blur,1.0-extrude_length) : \\nsmoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_opacity;float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(\\nantialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)\\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\\n#ifdef LIGHTING_3D_MODE\\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\\n#endif\\n#ifdef FOG\\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\\n#endif\\nglFragColor=out_color*(v_visibility*opacity_t);\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\n}\',\'#include "_prelude_fog.vertex.glsl"\\n#include "_prelude_terrain.vertex.glsl"\\n#define NUM_VISIBILITY_RINGS 2\\n#define INV_SQRT2 0.70710678\\n#define ELEVATION_BIAS 0.0001\\n#define NUM_SAMPLES_PER_RING 16\\nuniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in ivec2 a_pos;\\n#ifdef PROJECTION_GLOBE_VIEW\\nin ivec4 a_pos_3;in ivec4 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\\n#endif\\n#ifdef ELEVATED_ROADS\\nin float a_circle_z_offset;\\n#endif\\nout vec3 v_data;out float v_visibility;\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define mediump float radius\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define highp vec4 stroke_color\\n#pragma mapbox: define mediump float stroke_width\\n#pragma mapbox: define lowp float stroke_opacity\\nvec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1.0,-1.0),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1.0,-1.0),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1.0,1.0),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1.0,1.0),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {\\n#if defined(TERRAIN)\\nreturn elevation(pos)+ELEVATION_BIAS;\\n#else\\nreturn 0.0;\\n#endif\\n}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);\\n#ifdef PITCH_WITH_MAP\\n#ifdef PROJECTION_GLOBE_VIEW\\nreturn u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );\\n#else\\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\\n#endif\\n#else\\nreturn projected_center+vec4(sample_offset,0,0);\\n#endif\\n}float get_sample_step() {\\n#ifdef PITCH_WITH_MAP\\nreturn 2.0*PI/float(NUM_SAMPLES_PER_RING);\\n#else\\nreturn PI/float(NUM_SAMPLES_PER_RING);\\n#endif\\n}void main() {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize mediump float radius\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize highp vec4 stroke_color\\n#pragma mapbox: initialize mediump float stroke_width\\n#pragma mapbox: initialize lowp float stroke_opacity\\nvec2 pos2=vec2(a_pos);vec2 extrude=vec2(mod(pos2,2.0)*2.0-1.0);vec2 circle_center=floor(pos2*0.5);float height=circle_elevation(circle_center);vec4 world_center;mat3 surface_vectors;\\n#ifdef PROJECTION_GLOBE_VIEW\\nsurface_vectors=globe_mercator_surface_vectors(vec3(a_pos_normal_3)/16384.0,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*height;vec3 globe_pos=vec3(a_pos_3)+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*height;vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);
2\\n#else \\nsurface_vectors=mat3(1.0);world_center=vec4(circle_center,height,1);\\n#endif\\n#ifdef ELEVATED_ROADS\\nworld_center.z+=a_circle_z_offset+ELEVATION_BIAS;\\n#endif\\nvec4 projected_center=u_matrix*world_center;float view_scale=0.0;\\n#ifdef PITCH_WITH_MAP\\n#ifdef SCALE_WITH_MAP\\nview_scale=1.0;\\n#else\\nview_scale=projected_center.w/u_camera_to_center_distance;\\n#endif\\n#else\\n#ifdef SCALE_WITH_MAP\\nview_scale=u_camera_to_center_distance;\\n#else\\nview_scale=projected_center.w;\\n#endif\\n#endif\\ngl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;\\n#ifdef TERRAIN\\nfloat step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;\\n#ifdef PITCH_WITH_MAP\\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center;\\n#else\\nocclusion_world_center=world_center;occlusion_projected_center=projected_center;\\n#endif\\nfor(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);\\n#else\\nvisibility=1.0;\\n#endif\\n#ifdef PROJECTION_GLOBE_VIEW\\nvisibility=1.0;\\n#endif\\nv_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);\\n#ifdef FOG\\nv_fog_pos=fog_position(world_center.xyz);\\n#endif\\n}\'),gm("void main() {glFragColor=vec4(1.0);}","in ivec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),gm(\'#include "_prelude_fog.fragment.glsl"\\nuniform highp float u_intensity;in vec2 v_extrude;\\n#pragma mapbox: define highp float weight\\n#define GAUSS_COEF 0.3989422804014327\\nvoid main() {\\n#pragma mapbox: initialize highp float weight\\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);glFragColor=vec4(val,1.0,1.0,1.0);\\n#ifdef FOG\\nif (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}\\n#endif\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}\',\'#include "_prelude_terrain.vertex.glsl"\\n#include "_prelude_fog.vertex.glsl"\\nuniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_intensity;in ivec2 a_pos;\\n#ifdef PROJECTION_GLOBE_VIEW\\nin ivec4 a_pos_3;in ivec4 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\\n#endif\\nout vec2 v_extrude;\\n#pragma mapbox: define highp float weight\\n#pragma mapbox: define mediump float radius\\nconst highp float ZERO=1.0/255.0/16.0;\\n#define GAUSS_COEF 0.3989422804014327\\nvoid main() {\\n#pragma mapbox: initialize highp float weight\\n#pragma mapbox: initialize mediump float radius\\nvec2 unscaled_extrude=vec2(mod(vec2(a_pos),2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(vec2(a_pos)*0.5);vec3 pos;\\n#ifdef PROJECTION_GLOBE_VIEW\\nvec3 pos_normal_3=vec3(a_pos_normal_3)/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=vec3(a_pos_3)+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\\n#else\\npos=vec3(tilePos+extrude,elevation(tilePos));\\n#endif\\ngl_Position=u_matrix*vec4(pos,1);\\n#ifdef FOG\\nv_fog_pos=fog_position(pos);\\n#endif\\n}\'),gm("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));glFragColor=color*u_opacity;\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(0.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}","in ivec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=vec2(a_pos)*0.5+0.5;}"),gm("in float v_placed;in float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",\'#include "_prelude_terrain.vertex.glsl"\\nin ivec4 a_pos;in ivec2 a_anchor_pos;in ivec2 a_extrude;in uvec2 a_placed;in vec2 a_shift;in vec2 a_elevation_from_sea;in float a_size_scale;in vec2 a_padding;in float a_auto_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;\\n#ifdef PROJECTION_GLOBE_VIEW\\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform float u_zoom_transition;\\n#endif\\nout float v_placed;out float v_notUsed;void main() {vec2 anchor_pos=vec2(a_anchor_pos);float feature_elevation=a_elevation_from_sea.x+a_auto_z_offset;float terrain_elevation=(a_elevation_from_sea.y==1.0 ? 0.0 : elevation(anchor_pos));vec3 proj_pos=vec3(a_pos)+elevationVector(anchor_pos)*(feature_elevation+terrain_elevation);\\n#ifdef PROJECTION_GLOBE_VIEW\\n#ifndef PROJECTED_POS_ON_VIEWPORT\\nvec3 globe_pos=proj_pos;vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,anchor_pos,u_tile_id,u_merc_center);proj_pos=mix_globe_mercator(globe_pos,mercator_pos,u_zoom_transition);\\n#endif\\n#endif\\nvec4 projectedPoint=u_matrix*vec4(proj_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(\\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(vec2(a_extrude)*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=float(a_placed.x);v_notUsed=float(a_placed.y);}\'),gm("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);glFragColor=color*alpha*opacity_t;}","in vec2 a_pos_2f;in float a_radius;in ivec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd  =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz  /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;int vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(\\nmix(-1.0,1.0,float(vertexIdx >=2)),mix(-1.0,1.0,float(vertexIdx >=1 && vertexIdx <=2)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(\\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=float(a_flags.x);gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),gm("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}",\'#include "_prelude_terrain.vertex.glsl"\\nin ivec2 a_pos;\\n#ifdef PROJECTION_GLOBE_VIEW\\nin ivec4 a_pos_3;\\n#endif\\nout vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {vec2 pos=vec2(a_pos);float h=elevation(pos);v_uv=pos/8192.0;
2\\n#ifdef PROJECTION_GLOBE_VIEW\\ngl_Position=u_matrix*vec4(vec3(a_pos_3)+elevationVector(pos)*h,1);\\n#else\\ngl_Position=u_matrix*vec4(pos*u_overlay_scale,h,1);\\n#endif\\n}\'),gm(\'#include "_prelude_fog.fragment.glsl"\\n#include "_prelude_lighting.glsl"\\n#include "_prelude_shadow.fragment.glsl"\\n#include "_prelude_indicator_cutout.fragment.glsl"\\n#include "_prelude_feature_cutout.fragment.glsl"\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define lowp float opacity\\nuniform float u_emissive_strength;uniform lowp float u_opacity_multiplier;\\n#ifdef RENDER_SHADOWS\\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\\n#endif\\n#ifdef ELEVATED_ROADS\\nin highp float v_road_z_offset;\\n#endif\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize lowp float opacity\\nvec2 cutout_factors=vec2(0.0);vec4 out_color=color;\\n#ifdef LIGHTING_3D_MODE\\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\\n#ifdef RENDER_SHADOWS\\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\\n#endif\\n#endif\\n#ifdef FOG\\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\\n#endif\\nout_color*=(opacity*u_opacity_multiplier);glFragColor=out_color;storeEmissiveColor(glFragColor,u_emissive_strength);\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}\',\'#include "_prelude_fog.vertex.glsl"\\n#include "_prelude_shadow.vertex.glsl"\\nin ivec2 a_pos;\\n#ifdef ELEVATED_ROADS\\nin float a_road_z_offset;out highp float v_road_z_offset;\\n#endif\\n#ifdef RENDER_SHADOWS\\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\\n#endif\\nuniform mat4 u_matrix;uniform lowp float u_opacity_multiplier;\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define highp float z_offset\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize highp float z_offset\\n#ifdef ELEVATED_ROADS\\nz_offset+=a_road_z_offset;v_road_z_offset=z_offset;\\n#endif\\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);\\n#ifdef RENDER_SHADOWS\\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\\n#ifdef NORMAL_OFFSET\\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\\n#endif\\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\\n#endif\\n#ifdef FOG\\nv_fog_pos=fog_position(vec2(a_pos));\\n#endif\\n}\'),gm(\'#include "_prelude_fog.fragment.glsl"\\n#include "_prelude_lighting.glsl"\\n#include "_prelude_shadow.fragment.glsl"\\n#include "_prelude_feature_cutout.fragment.glsl"\\nin highp vec2 v_pos;uniform float u_emissive_strength;uniform lowp float u_opacity_multiplier;\\n#ifdef ELEVATED_ROADS\\nin highp float v_road_z_offset;\\n#endif\\n#ifdef RENDER_SHADOWS\\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\\n#endif\\n#pragma mapbox: define highp vec4 outline_color\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 outline_color\\n#pragma mapbox: initialize lowp float opacity\\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;vec2 cutout_factors=vec2(0.0);\\n#ifdef LIGHTING_3D_MODE\\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\\n#ifdef RENDER_SHADOWS\\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\\n#endif\\n#endif\\n#ifdef FOG\\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\\n#endif\\nglFragColor=out_color*(alpha*opacity*u_opacity_multiplier);storeEmissiveColor(glFragColor,u_emissive_strength);\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}\',\'#include "_prelude_fog.vertex.glsl"\\n#include "_prelude_shadow.vertex.glsl"\\nin ivec2 a_pos;\\n#ifdef ELEVATED_ROADS\\nin float a_road_z_offset;out highp float v_road_z_offset;\\n#endif\\n#ifdef RENDER_SHADOWS\\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\\n#endif\\nuniform mat4 u_matrix;uniform vec2 u_world;uniform lowp float u_opacity_multiplier;out highp vec2 v_pos;\\n#pragma mapbox: define highp vec4 outline_color\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define highp float z_offset\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 outline_color\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize highp float z_offset\\n#ifdef ELEVATED_ROADS\\nz_offset+=a_road_z_offset;v_road_z_offset=z_offset;\\n#endif\\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\\n#ifdef RENDER_SHADOWS\\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\\n#ifdef NORMAL_OFFSET\\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\\n#endif\\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\\n#endif\\n#ifdef FOG\\nv_fog_pos=fog_position(vec2(a_pos));\\n#endif\\n}\'),gm(\'#include "_prelude_fog.fragment.glsl"\\n#include "_prelude_lighting.glsl"\\n#include "_prelude_shadow.fragment.glsl"\\n#include "_prelude_feature_cutout.fragment.glsl"\\nuniform vec2 u_texsize;uniform sampler2D u_image;\\n#ifdef FILL_PATTERN_TRANSITION\\nuniform float u_pattern_transition;\\n#endif\\nuniform float u_emissive_strength;uniform lowp float u_opacity_multiplier;\\n#ifdef APPLY_LUT_ON_GPU\\nuniform highp sampler3D u_lutTexture;\\n#endif\\n#ifdef RENDER_SHADOWS\\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\\n#endif\\n#ifdef ELEVATED_ROADS\\nin highp float v_road_z_offset;\\n#endif\\nin highp vec2 v_pos;in highp vec2 v_pos_world;\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp uvec4 pattern\\n#ifdef FILL_PATTERN_TRANSITION\\n#pragma mapbox: define mediump uvec4 pattern_b\\n#endif\\nvoid main() {\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump uvec4 pattern\\n#ifdef FILL_PATTERN_TRANSITION\\n#pragma mapbox: initialize mediump uvec4 pattern_b\\n#endif\\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\\n#ifdef APPLY_LUT_ON_GPU\\nout_color=applyLUT(u_lutTexture,out_color);\\n#endif\\n#ifdef FILL_PATTERN_TRANSITION\\nvec2 pattern_b_tl=vec2(pattern_b.xy);vec2 pattern_b_br=vec2(pattern_b.zw);highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;\\n#endif\\nvec2 cutout_factors=vec2(0.0);\\n#ifdef LIGHTING_3D_MODE\\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\\n#ifdef RENDER_SHADOWS\\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\\n#endif\\n#endif\\n#ifdef FOG\\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\\n#endif\\nglFragColor=out_color*(alpha*opacity*u_opacity_multiplier);storeEmissiveColor(glFragColor,u_emissive_strength);\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}\',\'#include "_prelude_fog.vertex.glsl"\\n#include "_prelude_shadow.vertex.glsl"\\nuniform mat4 u_matrix;uniform vec2 u_world;uniform lowp float u_opacity_multiplier;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in ivec2 a_pos;\\n#ifdef ELEVATED_ROADS\\nin float a_road_z_offset;out highp float v_road_z_offset;\\n#endif\\n#ifdef RENDER_SHADOWS\\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\\n#endif\\nout highp vec2 v_pos;out highp vec2 v_pos_world;\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp uvec4 pattern\\n#ifdef FILL_PATTERN_TRANSITION\\n#pragma mapbox: define mediump uvec4 pattern_b\\n#endif\\n#pragma mapbox: define lowp float pixel_ratio\\n#pragma mapbox: define highp float z_offset\\nvoid main() {\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump uvec4 pattern\\n#ifdef FILL_PATTERN_TRANSITION\\n#pragma mapbox: initialize mediump uvec4 pattern_b\\n#endif\\n#pragma mapbox: initialize lowp float pixel_ratio\\n#pragma mapbox: initialize highp float z_offset\\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);\\n#ifdef ELEVATED_ROADS\\nz_offset+=a_road_z_offset;v_road_z_offset=z_offset;\\n#endif\\nfloat hidden=float(opacity==0.0);vec2 pos=vec2(a_pos);gl_Position=mix(u_matrix*vec4(pos,z_offset,1),AWAY,hidden);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\\n#ifdef RENDER_SHADOWS\\nvec3 shd_pos0=vec3(pos,z_offset);vec3 shd_pos1=vec3(pos,z_offset);\\n#ifdef NORMAL_OFFSET\\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\\n#endif\\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\\n#endif\\n#ifdef FOG\\nv_fog_pos=fog_position(pos);\\n#endif\\n}\'),gm(\'#include "_prelude_fog.fragment.glsl"\\n#include "_prelude_lighting.glsl"\\n#include "_prelude_shadow.fragment.glsl"\\n#include "_prelude_feature_cutout.fragment.glsl"\\nuniform vec2 u_texsize;uniform sampler2D u_image;\\n#ifdef FILL_PATTERN_TRANSITION\\nuniform float u_pattern_transition;\\n#endif\\nin highp vec2 v_pos;uniform float u_emissive_strength;uniform lowp float u_opacity_multiplier;\\n#ifdef RENDER_SHADOWS\\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\\n#endif\\n#ifdef ELEVATED_ROADS\\nin highp float v_road_z_offset;\\n#endif\\n#ifdef APPLY_LUT_ON_GPU\\nuniform highp sampler3D u_lutTexture;\\n#endif\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp uvec4 pattern\\n#ifdef FILL_PATTERN_TRANSITION\\n#pragma mapbox: define mediump uvec4 pattern_b\\n#endif\\nvoid main() {\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump uvec4 pattern\\n#ifdef FILL_PATTERN_TRANSITION\\n#pragma mapbox: initialize mediump uvec4 pattern_b\\n#endif\\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\\n#ifdef APPLY_LUT_ON_GPU\\nout_color=applyLUT(u_lutTexture,out_color);\\n#endif\\n#ifdef FILL_PATTERN_TRANSITION\\nvec2 pattern_b_tl=vec2(pattern_b.xy);vec2 pattern_b_br=vec2(pattern_b.zw);highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;\\n#endif\\nvec2 cutout_factors=vec2(0.0);\\n#ifdef LIGHTING_3D_MODE\\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\\n#ifdef RENDER_SHADOWS\\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);\\n#ifdef ELEVATED_ROADS\\nout_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\\n#else\\nout_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\\n#endif\\n#endif\\n#endif\\n#ifdef FOG\\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\\n#endif\\nglFragColor=out_color*(opacity*u_opacity_multiplier);storeEmissiveColor(glFragColor,u_emissive_strength);\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}\',\'#include "_prelude_fog.vertex.glsl"\\n#include "_prelude_shadow.vertex.glsl"\\nuniform mat4 u_matrix;uniform lowp float u_opacity_multiplier;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in ivec2 a_pos;\\n#ifdef ELEVATED_ROADS\\nin float a_road_z_offset;out highp float v_road_z_offset;\\n#endif\\n#ifdef RENDER_SHADOWS\\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\\n#endif\\nout highp vec2 v_pos;\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp uvec4 pattern\\n#ifdef FILL_PATTERN_TRANSITION\\n#pragma mapbox: define mediump uvec4 pattern_b\\n#endif\\n#pragma mapbox: define lowp float pixel_ratio\\n#pragma mapbox: define highp float z_offset\\nvoid main() {\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump uvec4 pattern\\n#pragma mapbox: initialize lowp float pixel_ratio\\n#pragma mapbox: initialize highp float z_offset\\n#ifdef FILL_PATTERN_TRANSITION\\n#pragma mapbox: initialize mediump uvec4 pattern_b\\n#endif\\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;\\n#ifdef ELEVATED_ROADS\\nz_offset+=a_road_z_offset;v_road_z_offset=z_offset;\\n#endif\\nfloat hidden=float(opacity==0.0);vec2 pos=vec2(a_pos);gl_Position=mix(u_matrix*vec4(pos,z_offset,1),AWAY,hidden);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);\\n#ifdef RENDER_SHADOWS\\nvec3 shd_pos0=vec3(pos,z_offset);vec3 shd_pos1=vec3(pos,z_offset);\\n#ifdef NORMAL_OFFSET\\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\\n#endif\\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\\n#endif\\n#ifdef FOG\\nv_fog_pos=fog_position(pos);\\n#endif\\n}\'),gm("uniform highp sampler2D u_image;uniform float u_opacity;uniform int u_blend_mode;uniform highp float u_max_density;in vec2 v_pos;\\n#define ADDITIVE 1\\nvoid main() {vec4 color=texture(u_image,v_pos);if (u_blend_mode==ADDITIVE) {if (color.a <=0.0) {discard;}highp float density=color.a;vec3 avgColor=color.rgb/max(density,0.001);highp float n=density/max(u_max_density,0.001);highp float t=sqrt(n/(n+1.0));glFragColor=vec4(avgColor*t,t);} else {vec3 multiplyFactor=color.rgb*u_opacity+(1.0-u_opacity);glFragColor=vec4(multiplyFactor,1.0);}\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(0.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}","in ivec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=vec2(a_pos)*0.5+0.5;}"),gm("uniform highp sampler2D u_image;uniform vec2 u_texel_size;uniform bool u_first_pass;in vec2 v_pos;void main() {vec2 o=u_texel_size*0.5;vec4 s0=texture(u_image,v_pos+vec2(-o.x,-o.y));vec4 s1=texture(u_image,v_pos+
2vec2( o.x,-o.y));vec4 s2=texture(u_image,v_pos+vec2(-o.x, o.y));vec4 s3=texture(u_image,v_pos+vec2( o.x, o.y));float r0; float g0;float r1; float g1;float r2; float g2;float r3; float g3;if (u_first_pass) {float a0=s0.a;float a1=s1.a;float a2=s2.a;float a3=s3.a;r0=a0; g0=a0 > 0.0 ? 1.0 : 0.0;r1=a1; g1=a1 > 0.0 ? 1.0 : 0.0;r2=a2; g2=a2 > 0.0 ? 1.0 : 0.0;r3=a3; g3=a3 > 0.0 ? 1.0 : 0.0;} else {r0=s0.r; g0=s0.g;r1=s1.r; g1=s1.g;r2=s2.r; g2=s2.g;r3=s3.r; g3=s3.g;}glFragColor=vec4((r0+r1+r2+r3)*0.25,(g0+g1+g2+g3)*0.25,0.0,0.0);}","in ivec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=vec2(a_pos)*0.5+0.5;}"),gm(\'#include "_prelude_fog.fragment.glsl"\\n#include "_prelude_shadow.fragment.glsl"\\n#include "_prelude_lighting.glsl"\\n#include "_prelude_indicator_cutout.fragment.glsl"\\n#include "_prelude_feature_cutout.fragment.glsl"\\nin vec4 v_color;in vec4 v_flat;\\n#if defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\\nin float v_dither_opacity;\\n#endif\\n#ifdef RENDER_SHADOWS\\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;\\n#endif\\nuniform lowp float u_opacity;\\n#ifdef FAUX_AO\\nuniform lowp vec2 u_ao;in vec2 v_ao;\\n#endif\\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\\nin vec4 v_roof_color;\\n#endif\\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\\nin highp vec3 v_normal;\\n#endif\\nuniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;\\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\\nin float v_flood_radius;in float v_has_floodlight;\\n#endif\\nin float v_height;\\n#pragma mapbox: define highp float emissive_strength\\nvoid main() {\\n#pragma mapbox: initialize highp float emissive_strength\\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\\nvec3 normal=normalize(v_normal);\\n#endif\\nfloat z;vec4 color=v_color;\\n#ifdef ZERO_ROOF_RADIUS\\nz=float(normal.z > 0.00001);\\n#ifdef LIGHTING_3D_MODE\\nnormal=mix(normal,vec3(0.0,0.0,1.0),z);\\n#else\\ncolor=mix(v_color,v_roof_color,z);\\n#endif\\n#endif\\nfloat h=max(0.0,v_height);float ao_shade=1.0;\\n#ifdef FAUX_AO\\nfloat intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;\\n#ifdef ZERO_ROOF_RADIUS\\nconcave*=(1.0-z);\\n#endif\\nfloat x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave);\\n#ifdef LIGHTING_3D_MODE\\n#ifdef FLOOD_LIGHT\\ncolor.rgb*=mix(ao_shade,1.0,v_has_floodlight);\\n#else\\ncolor.rgb*=ao_shade;\\n#endif\\n#else\\ncolor.rgb*=ao_shade;\\n#endif\\n#endif\\n#ifdef LIGHTING_3D_MODE\\nfloat flood_radiance=0.0;\\n#ifdef FLOOD_LIGHT\\nflood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;\\n#endif\\n#ifdef RENDER_SHADOWS\\n#ifdef FLOOD_LIGHT\\nfloat ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance);\\n#else\\nfloat shadowed_lighting_factor;\\n#ifdef RENDER_CUTOFF\\nshadowed_lighting_factor=shadowed_light_factor_normal_opacity(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;}\\n#else\\nshadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);\\n#endif\\ncolor.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);\\n#endif\\n#else\\ncolor.rgb=apply_lighting(color.rgb,normal);\\n#ifdef FLOOD_LIGHT\\ncolor.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);\\n#endif\\n#endif\\ncolor.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity;\\n#endif\\n#ifdef FOG\\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));\\n#endif\\n#if defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\\nif (v_dither_opacity < 1.0) {int index=viewport_dither_index(gl_FragCoord.xy);if (v_dither_opacity < DITHER_THRESHOLDS[index]) {discard;}}\\n#endif\\nglFragColor=color;\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}\',\'#include "_prelude_fog.vertex.glsl"\\n#include "_prelude_terrain.vertex.glsl"\\n#include "_prelude_shadow.vertex.glsl"\\n#include "_prelude_lighting.glsl"\\n#include "_prelude_material_table.vertex.glsl"\\n#include "_prelude_feature_cutout.vertex.glsl"\\nuniform mat4 u_matrix;\\n#ifndef LIGHTING_3D_MODE\\nuniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;\\n#endif\\nuniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;uniform float u_width_scale;in ivec4 a_pos_normal_ed;\\n#if defined(HAS_CENTROID) || defined(TERRAIN)\\nin uvec2 a_centroid_pos;\\n#endif\\n#ifdef RENDER_WALL_MODE\\nin ivec4 a_join_normal_inside;\\n#endif\\n#ifdef PROJECTION_GLOBE_VIEW\\nin ivec4 a_pos_3;in ivec4 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\\n#endif\\n#ifdef TERRAIN\\nuniform int u_height_type;uniform int u_base_type;\\n#endif\\nuniform highp float u_vertical_scale;\\n#if defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\\n#ifdef RENDER_FRONT_CUTOFF\\
2nuniform vec3 u_front_cutoff_params;\\n#endif\\nout float v_dither_opacity;\\n#endif\\nout vec4 v_color;out vec4 v_flat;\\n#ifdef RENDER_SHADOWS\\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;\\n#endif\\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\\nout vec4 v_roof_color;\\n#endif\\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\\nout highp vec3 v_normal;\\n#endif\\n#ifdef FAUX_AO\\nuniform lowp vec2 u_ao;out vec2 v_ao;\\n#endif\\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\\nout float v_flood_radius;out float v_has_floodlight;\\n#endif\\nout float v_height;vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}\\n#pragma mapbox: define highp float base\\n#pragma mapbox: define highp float height\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define highp float flood_light_wall_radius\\n#pragma mapbox: define highp float line_width\\n#pragma mapbox: define highp float emissive_strength\\nvoid main() {DECLARE_MATERIAL_TABLE_INFO\\n#pragma mapbox: initialize highp float base\\n#pragma mapbox: initialize highp float height\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize highp float flood_light_wall_radius\\n#pragma mapbox: initialize highp float line_width\\n#pragma mapbox: initialize highp float emissive_strength\\nbase*=u_vertical_scale;height*=u_vertical_scale;vec4 top_up_ny_start=vec4(a_pos_normal_ed & 1);vec4 pos_nx=vec4(a_pos_normal_ed >> 1);float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny_start.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny_start.z-1.0)*(1.0-abs(x_normal)),0.0));\\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\\nv_normal=normal;\\n#endif\\nbase=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny_start.y==0.0 && top_up_ny_start.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny_start.x;vec2 centroid_pos=vec2(0.0);\\n#if defined(HAS_CENTROID) || defined(TERRAIN)\\ncentroid_pos=vec2(a_centroid_pos);\\n#endif\\nfloat ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos;\\n#ifdef TERRAIN\\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);bool is_elevation_encoded=centroid_pos.y==0.0 || (centroid_pos.y > 0.0 && (int(centroid_pos.y) & 7)==7);c_ele=is_flat_height || is_flat_base ? (is_elevation_encoded ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;\\n#else\\nh=t > 0.0 ? height : base;\\n#endif\\npos=vec3(pos_nx.xy,h);\\n#ifdef PROJECTION_GLOBE_VIEW\\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(vec3(a_pos_normal_3)/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=vec3(a_pos_3)+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\\n#endif\\nfloat cutoff=1.0;vec3 scaled_pos=pos;\\n#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\\nvec2 centroid_decoded=pos.xy;bool isBorderCentroid=false;if (centroid_pos.x > 0.0 && centroid_pos.y > 0.0) {int iy=int(centroid_pos.y);int spanYbits=iy & 7;if (spanYbits==7) {isBorderCentroid=true;int borderID=(iy >> 3) & 3;float coordAlongBorder=float(iy >> 5)*4.0;if (borderID==0) centroid_decoded=vec2(0.0,coordAlongBorder);else if (borderID==1) centroid_decoded=vec2(EXTENT,coordAlongBorder);else if (borderID==2) centroid_decoded=vec2(coordAlongBorder,0.0);else centroid_decoded=vec2(coordAlongBorder,EXTENT);} else {centroid_decoded=floor(centroid_pos/8.0);}}\\n#endif\\n#if defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\\nfloat frontCutoffOpacity=1.0;
2float routeFade=0.0;\\n#endif\\n#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)\\nvec4 ground=u_matrix*vec4(centroid_decoded,ele,1.0);\\n#endif\\n#ifdef RENDER_CUTOFF\\ncutoff=cutoff_opacity(u_cutoff_params,ground.z);if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_random/8.0;vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale);\\n#endif\\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0));\\n#ifdef RENDER_FRONT_CUTOFF\\nif (centroid_pos.x > 0.0 && centroid_pos.y > 0.0) {hidden=max(hidden,float(ground.w <=0.0));float ndc_y=ground.y/max(ground.w,0.001);float threshold=u_front_cutoff_params.x*2.0-1.0;float range_ndc=u_front_cutoff_params.y*2.0;if (!isBorderCentroid) {hidden=max(hidden,float(ndc_y < threshold-range_ndc));}float t=clamp((ndc_y-(threshold-range_ndc))/max(range_ndc,0.001),0.0,1.0);frontCutoffOpacity=mix(u_front_cutoff_params.z,1.0,t);}\\n#endif\\n#if defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\\nv_dither_opacity=1.0;\\n#ifdef RENDER_FRONT_CUTOFF\\nv_dither_opacity=min(v_dither_opacity,frontCutoffOpacity);\\n#endif\\n#endif\\n#ifdef RENDER_WALL_MODE\\nvec3 join_normal_inside=vec3(a_join_normal_inside);vec2 wall_offset=u_width_scale*line_width*(join_normal_inside.xy/EXTENT);scaled_pos.xy+=(1.0-join_normal_inside.z)*wall_offset*0.5;scaled_pos.xy-=join_normal_inside.z*wall_offset*0.5;\\n#endif\\ngl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h;\\n#ifdef RENDER_SHADOWS\\nvec3 shd_pos0=pos;vec3 shd_pos1=pos;\\n#ifdef NORMAL_OFFSET\\nvec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\\n#endif\\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);\\n#endif\\nfloat NdotL=0.0;float colorvalue=0.0;\\n#ifndef LIGHTING_3D_MODE\\ncolorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=(\\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\\n#endif\\n#ifdef FAUX_AO\\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\\n#ifdef TERRAIN\\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(ce
2ntroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\\n#endif\\nv_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny_start.y)*u_ao[0]);\\n#ifdef PROJECTION_GLOBE_VIEW\\ntop_height+=u_height_lift;\\n#endif\\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\\n#endif\\n#ifdef LIGHTING_3D_MODE\\n#ifdef FLOOD_LIGHT\\nfloat is_wall=1.0-float(t > 0.0 && top_up_ny_start.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale;\\n#endif\\nv_color=vec4(color.rgb,1.0);float ndotl=calculate_NdotL(normal);v_flat.rgb=sRGBToLinear(color.rgb);v_flat.rgb=v_flat.rgb*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);v_flat=vec4(linearTosRGB(v_flat.rgb),1.0);\\n#else\\nv_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;\\n#endif\\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\\nfloat roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity;\\n#endif\\n#ifdef FOG\\nv_fog_pos=fog_position(pos);\\n#endif\\n}\'),gm(\'#include "_prelude_fog.fragment.glsl"\\n#include "_prelude_lighting.glsl"\\n#include "_prelude_indicator_cutout.fragment.glsl"\\nuniform vec2 u_texsize;uniform sampler2D u_image;\\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\\nuniform float u_pattern_transition;\\n#endif\\n#ifdef FAUX_AO\\nuniform lowp vec2 u_ao;in vec3 v_ao;\\n#endif\\n#ifdef LIGHTING_3D_MODE\\nin vec3 v_normal;\\n#endif\\n#ifdef APPLY_LUT_ON_GPU\\nuniform highp sampler3D u_lutTexture;\\n#endif\\nin highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity;\\n#pragma mapbox: define highp float base\\n#pragma mapbox: define highp float height\\n#pragma mapbox: define mediump uvec4 pattern\\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\\n#pragma mapbox: define mediump uvec4 pattern_b\\n#endif\\n#pragma mapbox: define highp float pixel_ratio\\nvoid main() {\\n#pragma mapbox: initialize highp float base\\n#pragma mapbox: initialize highp float height\\n#pragma mapbox: initialize mediump uvec4 pattern\\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\\n#pragma mapbox: initialize mediump uvec4 pattern_b\\n#endif\\n#pragma mapbox: initialize highp float pixel_ratio\\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\\n#ifdef APPLY_LUT_ON_GPU\\nout_color=applyLUT(u_lutTexture,out_color);\\n#endif\\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\\nvec2 pattern_b_tl=vec2(pattern_b.xy);vec2 pattern_b_br=vec2(pattern_b.zw);highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;\\n#endif\\n#ifdef LIGHTING_3D_MODE\\nout_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;\\n#else\\nout_color=out_color*v_lighting;\\n#endif\\n#ifdef FAUX_AO\\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;\\n#endif\\n#ifdef FOG\\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\\n#endif\\nglFragColor=out_color;\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}\',\'#include "_prelude_fog.vertex.glsl"\\n#include "_prelude_terrain.vertex.glsl"\\n#include "_prelude_lighting.glsl"\\n#include "_prelude_material_table.vertex.glsl"\\nuniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_width_scale;\\n#ifndef LIGHTING_3D_MODE\\nuniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;\\n#endif\\nin ivec4 a_pos_normal_ed;\\n#if defined(HAS_CENTROID) || defined(TERRAIN)\\nin uvec2 a_centroid_pos;\\n#endif\\n#ifdef RENDER_WALL_MODE\\nin ivec4 a_join_normal_inside;\\n#endif\\n#ifdef PROJECTION_GLOBE_VIEW\\nin ivec4 a_pos_3;in ivec4 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\\n#endif\\n#ifdef TERRAIN\\nuniform int u_height_type;uniform int u_base_type;\\n#endif\\nout highp vec2 v_pos;out vec4 v_lighting;\\n#ifdef FAUX_AO\\nuniform lowp vec2 u_ao;out vec3 v_ao;\\n#endif\\n#ifdef LIGHTING_3D_MODE\\nout vec3 v_normal;\\n#endif\\n#pragma mapbox: define highp float base\\n#pragma mapbox: define highp float height\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define mediump uvec4 pattern\\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\\n#pragma mapbox: define mediump uvec4 pattern_b\\n#endif\\n#pragma mapbox: define highp float pixel_ratio\\n#pragma mapbox: define highp float line_width\\nvoid main() {DECLARE_MATERIAL_TABLE_INFO\\n#pragma mapbox: initialize highp float base\\n#pragma mapbox: initialize highp float height\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize mediump uvec4 pattern\\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\\n#pragma mapbox: initialize mediump uvec4 pattern_b\\n#endif\\n#pragma mapbox: initialize highp float pixel_ratio\\n#pragma mapbox: initialize highp float line_width\\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);vec4 top_up_ny_start=vec4(a_pos_normal_ed & 1);vec4 pos_nx=vec4(a_pos_normal_ed >> 1);float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny_start.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny_start.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=float(a_pos_normal_ed.w);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;
2base=max(0.0,base);height=max(0.0,height);float t=top_up_ny_start.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);\\n#if defined(HAS_CENTROID) || defined(TERRAIN)\\ncentroid_pos=vec2(a_centroid_pos);\\n#endif\\nfloat ele=0.0;float h=z;vec3 p;float c_ele;\\n#ifdef TERRAIN\\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);bool is_elevation_encoded=centroid_pos.y==0.0 || (centroid_pos.y > 0.0 && int(centroid_pos.y)-(int(centroid_pos.y)/8)*8==7);c_ele=is_flat_height || is_flat_base ? (is_elevation_encoded ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;p=vec3(pos_nx.xy,h);\\n#else\\np=vec3(pos_nx.xy,z);\\n#endif\\n#ifdef PROJECTION_GLOBE_VIEW\\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(vec3(a_pos_normal_3)/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=vec3(a_pos_3)+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\\n#endif\\n#ifdef RENDER_WALL_MODE\\nvec3 join_normal_inside=vec3(a_join_normal_inside);vec2 wall_offset=u_width_scale*line_width*(join_normal_inside.xy/EXTENT);p.xy+=(1.0-join_normal_inside.z)*wall_offset*0.5;p.xy-=join_normal_inside.z*wall_offset*0.5;\\n#endif\\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0\\n? pos_nx.xy\\n: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;\\n#ifdef LIGHTING_3D_MODE\\nNdotL=calculate_NdotL(normal);\\n#else\\nNdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);\\n#endif\\nif (normal.y !=0.0) {float r=0.84;\\n#ifndef LIGHTING_3D_MODE\\nr=mix(0.7,0.98,1.0-u_lightintensity);\\n#endif\\nNdotL*=(\\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\\n#ifdef FAUX_AO\\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\\n#ifdef TERRAIN\\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(ce
2ntroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\\n#endif\\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny_start.y)*u_ao[0]);\\n#ifdef PROJECTION_GLOBE_VIEW\\ntop_height+=u_height_lift;\\n#endif\\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\\n#endif\\n#ifdef LIGHTING_3D_MODE\\nv_normal=normal;\\n#else\\nv_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\\n#endif\\n#ifdef FOG\\nv_fog_pos=fog_position(p);\\n#endif\\n}\'),gm("precision highp float;uniform highp sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2(\\n(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)\\n)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4(\\nderiv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}","uniform mat4 u_matrix;uniform vec2 u_dimension;in ivec2 a_pos;in uvec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(vec2(a_texture_pos)/8192.0)*scale+epsilon;}"),gm(\'#include "_prelude_fog.fragment.glsl"\\n#include "_prelude_lighting.glsl"\\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);glFragColor=accent_color*(1.0-shade_color.a)+shade_color;\\n#ifdef LIGHTING_3D_MODE\\nglFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);\\n#endif\\n#ifdef FOG\\nglFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));\\n#endif\\nstoreEmissiveColor(glFragColor,u_emissive_strength);\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}\',\'#include "_prelude_fog.vertex.glsl"\\nuniform mat4 u_matrix;in ivec2 a_pos;in uvec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=vec2(a_texture_pos)/8192.0;\\n#ifdef FOG\\nv_fog_pos=fog_position(vec2(a_pos));\\n#endif\\n}\'),gm(\'#include "_prelude_fog.fragment.glsl"\\n#include "_prelude_lighting.glsl"\\n#include "_prelude_shadow.fragment.glsl"\\n#include "_prelude_indicator_cutout.fragment.glsl"\\n#include "_prelude_feature_cutout.fragment.glsl"\\nuniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform float u_alpha_discard_threshold;uniform lowp float u_opacity_multiplier;uniform bool u_clip_to_tile_borders;in vec4 v_width2_dilute;in vec2 v_normal;in float v_gamma_scale;in vec2 v_tile_pos;\\n#ifdef ELEVATED_ROADS\\nin highp float v_road_z_offset;\\n#endif\\n#ifdef VARIABLE_LINE_WIDTH\\nin float stub_side;\\n#endif\\n#ifdef RENDER_LINE_DASH\\nuniform sampler2D u_dash_image;uniform highp float u_floor_width_scale;in highp vec2 v_tex;\\n#endif\\n#ifdef DEBUG_ELEVATION_ID\\nin vec3 v_elevation_id_col;\\n#endif\\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_BORDER_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\\nin highp vec3 v_uv;\\n#endif\\n#ifdef RENDER_LINE_GRADIENT\\nuniform sampler2D u_gradient_image;\\n#endif\\n#ifdef RENDER_LINE_BORDER_GRADIENT\\nuniform sampler2D u_border_gradient_image;\\n#endif\\n#ifdef RENDER_LINE_TRIM_OFFSET\\nuniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform highp vec2 u_trim_gradient_mix_range;uniform lowp vec4 u_trim_color;\\n#endif\\n#ifdef RENDER_SHADOWS\\nuniform bool u_emissive_in_shadows;uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\\n#endif\\nfloat luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define lowp float floorwidth\\n#pragma mapbox: define mediump uvec4 dash\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define mediump float side_z_offset\\n#pragma mapbox: define lowp float border_width\\n#pragma mapbox: define lowp vec4 border_color\\n#pragma mapbox: define lowp float emissive_strength\\nfloat linearstep(float edge0,float edge1,float x) {return  
2clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize lowp float floorwidth\\n#pragma mapbox: initialize mediump uvec4 dash\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump float side_z_offset\\n#pragma mapbox: initialize lowp float border_width\\n#pragma mapbox: initialize lowp vec4 border_color\\n#pragma mapbox: initialize lowp float emissive_strength\\nfloat dist=length(v_normal)*v_width2_dilute.x;float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;\\n#ifdef RENDER_LINE_BORDER\\n#ifndef VARIABLE_LINE_WIDTH\\nANTIALIASING*=8.0;\\n#endif\\n#endif\\n#ifdef VARIABLE_LINE_WIDTH\\nblur=mix(blur,0.0,stub_side);\\n#endif\\nfloat diluted_opacity=opacity*v_width2_dilute.z;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2_dilute.y-blur2),v_width2_dilute.x-dist)/blur2,0.0,1.0);float pxStep;float delta;\\n#ifdef RENDER_LINE_BORDER\\n#ifndef VARIABLE_LINE_WIDTH\\npxStep=fwidth(dist);float out_edge=v_width2_dilute.x-dist;float in_edge=dist-(v_width2_dilute.y-2.0*ANTIALIASING);delta=v_width2_dilute.y > 0.0 ? min(in_edge,out_edge) : out_edge;float edge=ANTIALIASING;alpha=delta > 0.0 ? smoothstep(edge-pxStep,u_width_scale*blur+edge+pxStep,delta) : 0.0;\\n#endif\\n#endif\\n#ifdef RENDER_LINE_DASH\\nhighp float dash_w=float(dash.w);highp float dash_len=float(dash.z)+dash_w/65535.0;float sdfgamma=ANTIALIASING/float(dash_len);float scaled_floorwidth=(floorwidth*u_floor_width_scale);float periods_per_pixel=fwidth(v_tex.x);float dash_coverage=float(dash.y >> 4u)/4095.0;float fade=linearstep(0.25,0.5,periods_per_pixel);float gamma=max(sdfgamma/scaled_floorwidth,0.5*periods_per_pixel);if (fade >=1.0) {alpha*=dash_coverage;} else if (periods_per_pixel < 0.1) {float sdfdist=texture(u_dash_image,v_tex).r;alpha*=linearstep(0.5-gamma,0.5+gamma,sdfdist);} else {float span=min(periods_per_pixel,1.0);float tap_offset=span*0.25;float sdf0=texture(u_dash_image,vec2(v_tex.x-tap_offset,v_tex.y)).r;float sdf1=texture(u_dash_image,vec2(v_tex.x+tap_offset,v_tex.y)).r;alpha*=mix(0.5*(\\nlinearstep(0.5-gamma,0.5+gamma,sdf0)+linearstep(0.5-gamma,0.5+gamma,sdf1)\\n),dash_coverage,fade);}\\n#endif\\nhighp vec4 out_color;\\n#ifdef RENDER_LINE_GRADIENT\\nout_color=texture(u_gradient_image,v_uv.xy);\\n#else\\nout_color=color;\\n#endif\\nfloat trim_alpha=1.0;\\n#ifdef RENDER_LINE_TRIM_OFFSET\\nhighp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);highp float gradient_trim_color_mix_factor=0.0;\\n#ifdef RENDER_LINE_GRADIENT\\ngradient_trim_color_mix_factor=smoothstep(u_trim_gradient_mix_range.x,u_trim_gradient_mix_range.y,line_progress);\\n#endif\\nhighp vec4 trim_color=mix(u_trim_color,out_color,gradient_trim_color_mix_factor);out_color=mix(u_trim_gradient_mix_range.x < 1.0 ? color : out_color,trim_color,transition_factor);trim_alpha=1.0-transition_factor;}\\n#endif\\nif (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}}\\n#ifdef RENDER_LINE_BORDER\\n#ifndef VARIABLE_LINE_WIDTH\\nfloat edge2=border_width*u_width_scale+ANTIALIASING;float alpha2=smoothstep(edge2-pxStep,edge2+pxStep,delta);if (alpha2 < 1.) {\\n#ifdef RENDER_LINE_BORDER_GRADIENT\\nvec4 border_gradient_color=texture(u_border_gradient_image,v_uv.xy);out_color=mix(border_gradient_color*trim_alpha,out_color,alpha2);\\n#else\\nif (border_color.a==0.0) {\\n#ifndef RENDER_LINE_GRADIENT\\nfloat Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-alpha2));} else {out_color.rgb*=(0.6+0.4*alpha2);}\\n#else\\nout_color.rgb*=(0.6+0.4*alpha2);\\n#endif\\n} else {out_color=mix(border_color*trim_alpha,out_color,alpha2);}\\n#endif\\nout_color*=v_width2_dilute.w;}\\n#endif\\n#endif\\nvec2 cutout_factors=vec2(0.0);\\n#ifdef LIGHTING_3D_MODE\\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\\n#ifdef RENDER_SHADOWS\\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);light=u_emissive_in_shadows ? mix(light,1.0,emissive_strength) : light;\\n#ifdef ELEVATED_ROADS\\nout_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\\n#else\\nout_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\\n#endif\\n#endif\\n#endif\\n#ifdef FOG\\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\\n#endif\\nout_color*=(alpha*diluted_opacity*u_opacity_multiplier);\\n#ifdef LINE_BLEND_ADDITIVE\\n{float cov=alpha*diluted_opacity;glFragColor=vec4(cov > 0.0 ? out_color.rgb/cov : vec3(0.0),cov);}\\n#else\\n#ifdef LINE_BLEND_MULTIPLY\\nglFragColor=vec4(out_color.rgb+(1.0-out_color.a),1.0);\\n#else\\nglFragColor=out_color;\\n#endif\\n#endif\\nstoreEmissiveColor(glFragColor,emissive_strength);\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\n#ifdef DEBUG_ELEVATION_ID\\nglFragColor=vec4(v_elevation_id_col,1.0);\\n#endif\\nif (u_clip_to_tile_borders) {if (v_tile_pos.x > 1.0 || v_tile_pos.y > 1.0 || v_tile_pos.x < 0.0 || v_tile_pos.y < 0.0) {discard;}}HANDLE_WIREFRAME_DEBUG;}\',\'#include "_prelude_fog.vertex.glsl"\\n#include "_prelude_shadow.vertex.glsl"\\n#include "_prelude_terrain.vertex.glsl"\\n#define EXTRUDE_SCALE 0.015873016\\nin ivec2 a_pos_normal;in uvec4 a_data;\\n#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH) || defined(VARIABLE_LINE_EMISSIVE_STRENGTH)\\nin vec4 a_z_offset_width;\\n#endif\\n#ifdef DEBUG_ELEVATION_ID\\nin vec3 a_elevation_id_col;\\n#endif\\n#ifdef DEBUG_ELEVATION_ID\\nout vec3 v_elevation_id_col;\\n#endif\\n#ifdef ELEVATION_GROUND_SCALE\\nin float a_elevation_ground_scale;\\n#endif\\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_BORDER_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) || defined(RENDER_LINE_CURVE)\\nin highp vec3 a_packed;\\n#endif\\n#ifdef RENDER_LINE_DASH\\nin float a_linesofar;\\n#endif\\nuniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_z_offset;uniform highp float u_road_view_depth_bias;uniform highp vec4 u_road_clip_to_view;\\n#ifdef ELEVATED\\nuniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {\\n#ifdef ELEVATION_REFERENCE_SEA\\nreturn 0.0;\\n#else\\nreturn elevation(apos);\\n#endif\\n}\\n#endif\\nout vec2 v_normal;out vec4 v_width2_dilute;out float v_gamma_scale;out vec2 v_tile_pos;\\n#ifdef ELEVATED_ROADS\\nout highp float v_road_z_offset;\\n#endif\\n#ifdef VARIABLE_LINE_WIDTH\\nout float stub_side;uniform float u_width_addition;\\n#endif\\n#ifdef RENDER_LINE_DASH\\nuniform highp float u_floor_width_scale;uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out highp vec2 v_tex;\\n#endif\\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_BORDER_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\\nout highp vec3 v_uv;\\n#endif\\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_BORDER_GRADIENT)\\nuniform float u_image_height;\\n#endif\\n#ifdef RENDER_SHADOWS\\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\\n#endif\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define lowp float floorwidth\\n#pragma mapbox: define mediump uvec4 dash\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define mediump float gapwidth\\n#pragma mapbox: define lowp float offset\\n#pragma mapbox: define mediump float width\\n#pragma mapbox: define mediump float side_z_offset\\n#pragma mapbox: define lowp float border_width\\n#pragma mapbox: define lowp vec4 border_color\\n#pragma mapbox: define lowp float emissive_strength\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize lowp float floorwidth\\n#pragma mapbox: initialize mediump uvec4 dash\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump float gapwidth\\n#pragma mapbox: initialize lowp float offset\\n#pragma mapbox: initialize mediump float width\\n#pragma mapbox: initialize mediump float side_z_offset\\n#pragma mapbox: initialize lowp float border_width\\n#pragma mapbox: initialize lowp vec4 border_color\\n#pragma mapbox: initialize lowp float emissive_strength\\n#ifdef VARIABLE_LINE_EMISSIVE_STRENGTH\\nemissive_strength=a_z_offset_width.w;\\n#endif\\nfloat a_z_offset=u_z_offset;\\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\\na_z_offset+=a_z_offset_width.x;
2\\n#endif\\n#ifdef DEBUG_ELEVATION_ID\\nv_elevation_id_col=a_elevation_id_col;\\n#endif\\nhighp float line_progress=0.0;\\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_BORDER_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) || defined(RENDER_LINE_CURVE)\\nline_progress=a_packed[2];\\n#endif\\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;\\n#ifdef RENDER_LINE_BORDER\\n#ifndef VARIABLE_LINE_WIDTH\\nANTIALIASING*=8.0;\\n#endif\\n#endif\\nvec2 a_extrude=vec2(a_data.xy)-128.0;float a_direction=float(a_data.z & 3u)-1.0;vec2 pos_normal=vec2(a_pos_normal);vec2 pos=floor(pos_normal*0.5);mediump vec2 normal=pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;offset=-1.0*offset*u_width_scale;bool left=normal.y==1.0;gapwidth=gapwidth/2.0;float halfwidth;float dilute_scale=1.0;float dilute_border_scale=1.0;float symmetric_outset=0.0;\\n#ifdef VARIABLE_LINE_WIDTH\\nfloat left_width=a_z_offset_width.y;float right_width=a_z_offset_width.z;bool zero_right_width=border_width==0.0 && right_width==0.0;halfwidth=left ? left_width : right_width;halfwidth+=u_width_addition*(zero_right_width ? (left ? 1.0 : 0.0) : 0.5); \\nhalfwidth*=u_width_scale;if (side_z_offset !=0.0) {float left_f=step(1.0,normal.y);float is_negative=step(side_z_offset,0.0);float apply=mix(1.0-left_f,left_f,is_negative);a_extrude*=apply;a_z_offset+=abs(side_z_offset)*apply;v_normal*=apply;}offset=border_width > 0.0 ? (left_width+right_width+u_width_addition)*u_width_scale : offset;halfwidth=border_width > 0.0 ? border_width*u_width_scale*0.5 : halfwidth;symmetric_outset=zero_right_width ? u_width_scale*(left_width+u_width_addition) : halfwidth;stub_side=zero_right_width ?-normal.y : 0.0;v_normal=!left && zero_right_width ? vec2(0.0) : v_normal;ANTIALIASING=!left && zero_right_width ? 0.0 : ANTIALIASING;\\n#else\\nhalfwidth=(u_width_scale*width)/2.0;\\n#endif\\nfloat inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth > 0.0 ? ANTIALIASING : 0.0);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;\\n#ifdef ELEVATED_ROADS\\nv_road_z_offset=a_z_offset;v_tile_pos=pos+offset2*u_pixels_to_tile_units;gl_Position=u_matrix*vec4(v_tile_pos,a_z_offset,1.0);\\n#else\\n#ifdef ELEVATED\\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;float scaled_z_offset=a_z_offset;\\n#ifdef ELEVATION_GROUND_SCALE\\nscaled_z_offset=a_z_offset*mix(1.0,u_exaggeration,a_elevation_ground_scale);\\n#endif\\n#ifdef CROSS_SLOPE_VERTICAL\\nfloat top=pos_normal.y-2.0*floor(pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+scaled_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);\\n#else\\n#ifdef CROSS_SLOPE_HORIZONTAL\\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+scaled_z_offset;\\n#else\\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+scaled_z_offset;\\n#endif\\n#endif\\nv_tile_pos=offset_pos;gl_Position=u_matrix*vec4(v_tile_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);\\n#else\\nv_tile_pos=pos+offset2*u_pixels_to_tile_units;gl_Position=u_matrix*vec4(v_tile_pos,0.0,1.0);\\n#endif\\n#endif\\n#ifndef ELEVATED\\n#ifndef VARIABLE_LINE_WIDTH\\n#ifndef RENDER_TO_TEXTURE\\nfloat base_w=gl_Position.w;vec2 screen_width=abs(projected_extrude.xy/base_w*u_units_to_pixels);float max_extrude_component=max(screen_width.x,screen_width.y);if (width >=1.0 && base_w > 0.0 && max_extrude_component > 0.0001) {float min_pixel=1.05;if (max_extrude_component < min_pixel) {vec2 abs_pos=abs(gl_Position.xy);float is_out=max(abs_pos.x,abs_pos.y)/base_w;dilute_scale=mix(max_extrude_component/min_pixel,1.0,smoothstep(2.5,4.5,is_out));projected_extrude/=dilute_scale;}else if (gapwidth > 0.0) {float visible_ratio=(halfwidth+ANTIALIASING)/outset;vec2 visible_screen_width=screen_width*visible_ratio;float max_visible_component=max(visible_screen_width.x,visible_screen_width.y);dilute_scale=min(1.0,max_visible_component/min_pixel);}else\\n{\\n#ifdef RENDER_LINE_BORDER\\nfloat border_ratio=(border_width*u_width_scale+ANTIALIASING)/outset;screen_width*=border_ratio;float max_border_component=max(screen_width.x,screen_width.y);dilute_border_scale=min(1.0,max_border_component/min_pixel);\\n#endif\\n}}\\n#endif\\n#endif\\nv_tile_pos=(v_tile_pos+extrude)/EXTENT;\\n#ifdef ELEVATED_ROADS\\ngl_Position=gl_Position+projected_extrude;\\n#ifdef VARIABLE_LINE_WIDTH\\n#ifndef ELEVATED\\nhighp float road_view_depth_bias=u_road_view_depth_bias*smoothstep(-0.5,0.0,a_z_offset);if (road_view_depth_bias > 0.0) {highp float z_in=gl_Position.z/gl_Position.w*0.5+0.5;highp float a=u_road_clip_to_view.x;highp float b=u_road_clip_to_view.y;highp float c=u_road_clip_to_view.z;highp float d=u_road_clip_to_view.w;highp float view=(a*z_in+b)/(c*z_in+d);highp float view_new=view+road_view_depth_bias;highp float z_new=(view_new*d-b)/(a-view_new*c);z_new=clamp(z_new,0.0,1.0);gl_Position.z=(z_new*2.0-1.0)*gl_Position.w;}\\n#endif\\n#endif\\n#else\\ngl_Position=mix(gl_Position+projected_extrude,AWAY,hidden);\\n#endif\\n#endif\\n#ifdef ELEVATED_ROADS\\n#ifdef RENDER_SHADOWS\\nvec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;\\n#ifdef NORMAL_OFFSET\\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\\n#endif\\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\\n#endif\\n#endif\\n#ifndef RENDER_TO_TEXTURE\\nfloat epsilon=0.0001;float extrude_length_without_perspective=max(length(dist),epsilon);float extrude_length_with_perspective=max(length(projected_extrude_xy/gl_Position.w*u_units_to_pixels),epsilon);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));\\n#else\\nv_gamma_scale=1.0;\\n#endif\\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_BORDER_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\\nhighp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];\\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_BORDER_GRADIENT)\\nhighp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec3(a_uv_x,a_split_index*texel_height-half_texel_height,line_progress);\\n#else\\nv_uv=vec3(a_uv_x,0.0,line_progress);\\n#endif\\n#endif\\n#ifdef RENDER_LINE_DASH\\nvec4 dashf=vec4(dash);highp float dash_w=float(dash.w);highp float totalLength=float(dash.z)+dash_w/65535.0;float scale=totalLength==0.0 ? 0.0 : u_tile_units_to_pixels/totalLength;float dash_half_height=float(dash.y & 15u);v_tex=vec2(a_linesofar*scale/(floorwidth*u_floor_width_scale),(-normal.y*dash_half_height+dashf.x+0.5)/u_texsize.y);\\n#endif\\nv_width2_dilute=vec4(outset,inset,dilute_scale,dilute_border_scale);\\n#ifdef VARIABLE_LINE_WIDTH\\nv_width2_dilute.x=symmetric_outset;\\n#endif\\n#ifdef FOG\\nv_fog_pos=fog_position(pos);\\n#endif\\n}\'),gm(\'#include "_prelude_fog.fragment.glsl"\\n#include "_prelude_lighting.glsl"\\n#include "_prelude_shadow.fragment.glsl"\\n#include "_prelude_indicator_cutout.fragment.glsl"\\nuniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;
2uniform highp float u_alpha_discard_threshold;uniform lowp float u_opacity_multiplier;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;uniform sampler2D u_image;\\n#ifdef APPLY_LUT_ON_GPU\\nuniform highp sampler3D u_lutTexture;\\n#endif\\n#ifdef LINE_PATTERN_TRANSITION\\nuniform float u_pattern_transition;\\n#endif\\nin vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width;\\n#ifdef RENDER_LINE_TRIM_OFFSET\\nin highp vec3 v_uv;\\n#endif\\n#ifdef ELEVATED_ROADS\\nin highp float v_road_z_offset;\\n#endif\\n#ifdef LINE_JOIN_NONE\\nin vec2 v_pattern_data;\\n#endif\\n#ifdef RENDER_SHADOWS\\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\\n#endif\\n#pragma mapbox: define mediump uvec4 pattern\\n#ifdef LINE_PATTERN_TRANSITION\\n#pragma mapbox: define mediump uvec4 pattern_b\\n#endif\\n#pragma mapbox: define mediump float pixel_ratio\\n#pragma mapbox: define mediump float blur\\n#pragma mapbox: define mediump float opacity\\n#pragma mapbox: define lowp float emissive_strength\\nvoid main() {\\n#pragma mapbox: initialize mediump uvec4 pattern\\n#ifdef LINE_PATTERN_TRANSITION\\n#pragma mapbox: initialize mediump uvec4 pattern_b\\n#endif\\n#pragma mapbox: initialize mediump float pixel_ratio\\n#pragma mapbox: initialize mediump float blur\\n#pragma mapbox: initialize mediump float opacity\\n#pragma mapbox: initialize lowp float emissive_strength\\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;highp float pattern_size=display_size.x/u_tile_units_to_pixels;float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);highp float pattern_x=v_linesofar/pattern_size*aspect;highp float x=mod(pattern_x,1.0);highp float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;highp vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));highp vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos);\\n#ifdef APPLY_LUT_ON_GPU\\ncolor=applyLUT(u_lutTexture,color);\\n#endif\\n#ifdef LINE_PATTERN_TRANSITION\\nvec2 pattern_b_tl=vec2(pattern_b.xy);vec2 pattern_b_br=vec2(pattern_b.zw);highp vec2 pos_b=mix(pattern_b_tl*texel_size-texel_size,pattern_b_br*texel_size+texel_size,vec2(x,y));vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);color=color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;\\n#endif\\n#ifdef RENDER_LINE_TRIM_OFFSET\\nhighp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);color=mix(color,color.a*u_trim_color,transition_factor);}\\n#endif\\n#ifdef LINE_JOIN_NONE\\nhighp float pattern_len=pattern_size/aspect;highp float segment_phase=pattern_len-mod(v_linesofar-v_pattern_data.x+pattern_len,pattern_len);highp float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;highp float visible_end=floor((v_pattern_data.y-segment_phase)/pattern_len)*pattern_len+segment_phase;visible_end+=step(pattern_len*0.5,v_pattern_data.y-visible_end)*pattern_len;if (v_pattern_data.x < visible_start || v_pattern_data.x >=visible_end) {color=vec4(0.0);}\\n#endif\\n#ifdef LIGHTING_3D_MODE\\ncolor=apply_lighting_with_emission_ground(color,emissive_strength);\\n#ifdef RENDER_SHADOWS\\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);\\n#ifdef ELEVATED_ROADS\\ncolor.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\\n#else\\ncolor.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\\n#endif\\n#endif\\n#endif\\n#ifdef FOG\\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\\n#endif\\ncolor*=(alpha*opacity*u_opacity_multiplier);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}}glFragColor=color;storeEmissiveColor(glFragColor,emissive_strength);\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}\',\'#include "_prelude_fog.vertex.glsl"\\n#include "_prelude_shadow.vertex.glsl"\\n#include "_prelude_terrain.vertex.glsl"\\n#define scale 0.015873016\\nin ivec2 a_pos_normal;in uvec4 a_data;\\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\\nin vec4 a_z_offset_width;\\n#endif\\n#ifdef ELEVATION_GROUND_SCALE\\nin float a_elevation_ground_scale;\\n#endif\\n#ifdef RENDER_LINE_TRIM_OFFSET\\nin highp vec3 a_packed;\\n#endif\\nin highp float a_linesofar;\\n#ifdef LINE_JOIN_NONE\\nin highp vec3 a_pattern_data;out vec2 v_pattern_data;\\n#endif\\nuniform mat4 u_matrix;uniform float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_floor_width_scale;\\n#ifdef ELEVATED\\nuniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {\\n#ifdef ELEVATION_REFERENCE_SEA\\nreturn 0.0;\\n#else\\nreturn elevation(apos);\\n#endif\\n}\\n#endif\\nout vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width;\\n#ifdef RENDER_LINE_TRIM_OFFSET\\nout highp vec3 v_uv;\\n#endif\\n#ifdef ELEVATED_ROADS\\nout highp float v_road_z_offset;\\n#endif\\n#ifdef RENDER_SHADOWS\\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\\n#endif\\n#pragma mapbox: define mediump float blur\\n#pragma mapbox: define mediump float opacity\\n#pragma mapbox: define mediump float offset\\n#pragma mapbox: define mediump float gapwidth\\n#pragma mapbox: define mediump float width\\n#pragma mapbox: define mediump float floorwidth\\n#pragma mapbox: define mediump uvec4 pattern\\n#ifdef LINE_PATTERN_TRANSITION\\n#pragma mapbox: define mediump uvec4 pattern_b\\n#endif\\n#pragma mapbox: define mediump float pixel_ratio\\n#pragma mapbox: define lowp float emissive_strength\\nvoid main() {\\n#pragma mapbox: initialize mediump float blur\\n#pragma mapbox: initialize mediump float opacity\\n#pragma mapbox: initialize mediump float offset\\n#pragma mapbox: initialize mediump float gapwidth\\n#pragma mapbox: initialize mediump float width\\n#pragma mapbox: initialize mediump float floorwidth\\n#pragma mapbox: initialize mediump uvec4 pattern\\n#ifdef LINE_PATTERN_TRANSITION\\n#pragma mapbox: initialize mediump uvec4 pattern_b\\n#endif\\n#pragma mapbox: initialize mediump float pixel_ratio\\n#pragma mapbox: initialize lowp float emissive_strength\\nfloat a_z_offset;\\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\\na_z_offset=a_z_offset_width.x;\\n#endif\\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(a_data.xy)-128.0;float a_direction=float(a_data.z & 3u)-1.0;vec2 pos_normal=vec2(a_pos_normal);vec2 pos=floor(pos_normal*0.5);vec2 normal=pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=(u_width_scale*width)/2.0;offset=-1.0*offset*u_width_scale;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);vec2 dist=outset*a_extrude*scale;float u=0.5*a_direction;float t=1.0-abs(u);vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;
2vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;\\n#ifdef ELEVATED_ROADS\\nv_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude;\\n#else\\n#ifdef ELEVATED\\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;float scaled_z_offset=a_z_offset;\\n#ifdef ELEVATION_GROUND_SCALE\\nscaled_z_offset=a_z_offset*mix(1.0,u_exaggeration,a_elevation_ground_scale);\\n#endif\\n#ifdef CROSS_SLOPE_VERTICAL\\nfloat top=pos_normal.y-2.0*floor(pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+scaled_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);\\n#else\\n#ifdef CROSS_SLOPE_HORIZONTAL\\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+scaled_z_offset;\\n#else\\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+scaled_z_offset;\\n#endif\\n#endif\\ngl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);\\n#else\\ngl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);\\n#endif\\n#endif\\n#ifdef ELEVATED_ROADS\\n#ifdef RENDER_SHADOWS\\nvec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;\\n#ifdef NORMAL_OFFSET\\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\\n#endif\\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\\n#endif\\n#endif\\n#ifndef RENDER_TO_TEXTURE\\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude_xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));\\n#else\\nv_gamma_scale=1.0;\\n#endif\\n#ifdef RENDER_LINE_TRIM_OFFSET\\nhighp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress);\\n#endif\\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale);\\n#ifdef LINE_JOIN_NONE\\nv_width=(floorwidth*u_floor_width_scale)+ANTIALIASING;mediump float pixels_to_tile_units=1.0/u_tile_units_to_pixels;mediump float pixel_ratio_inverse=1.0/pixel_ratio;mediump float aspect=v_width/(float(pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=float(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y);\\n#endif\\n#ifdef FOG\\nv_fog_pos=fog_position(pos);\\n#endif\\n}\'),gm(\'#include "_prelude_fog.fragment.glsl"\\n#include "_prelude_lighting.glsl"\\n#include "_prelude_raster_array.glsl"\\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth;\\n#ifdef PROJECTION_GLOBE_VIEW\\nin float v_split_fade;\\n#endif\\nuniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength;\\n#ifndef RASTER_ARRAY\\nuniform highp sampler2D u_image0;uniform sampler2D u_image1;\\n#endif\\n#ifdef RASTER_COLOR\\nuniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;uniform highp float u_color_ramp_size;\\n#endif\\nvoid main() {vec4 color0,color1,color;vec2 value;\\n#ifdef RASTER_COLOR\\n#ifdef RASTER_ARRAY\\n#ifdef RASTER_ARRAY_LINEAR\\nvalue=mix(\\nraTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\\n);\\n#else\\nvalue=mix(\\nraTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\\n);\\n#endif\\nif (value.y > 0.0) value.x/=value.y;\\n#ifdef RASTER_COLOR_SCALE_LOG\\nfloat N=u_color_ramp_size;float vNorm=max((value.x-0.5/N)*N/(N-1.0),0.0);vNorm=log(vNorm*(10.0-1.0)+1.0)/log(10.0);value.x=0.5/N+vNorm*(N-1.0)/N;\\n#endif\\n#else\\ncolor=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a);\\n#endif\\ncolor=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y;\\n#else\\ncolor0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);\\n#endif\\ncolor.a*=u_opacity;\\n#ifdef GLOBE_POLES\\ncolor.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition);\\n#endif\\nvec3 rgb=color.rgb;rgb=vec3(\\ndot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);\\n#ifdef LIGHTING_3D_MODE\\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb;\\n#endif\\n#ifdef FOG\\nhighp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));\\n#endif\\nglFragColor=vec4(out_color*color.a,color.a);\\n#ifdef PROJECTION_GLOBE_VIEW\\nglFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade));
2\\n#endif\\n#ifdef RENDER_CUTOFF\\nglFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth);\\n#endif\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nstoreEmissiveColor(glFragColor,u_emissive_strength);HANDLE_WIREFRAME_DEBUG;}\',\'#include "_prelude_fog.vertex.glsl"\\n#include "_prelude_terrain.vertex.glsl"\\nuniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\\n#ifdef ELEVATED\\nuniform lowp float u_zbias_factor;\\n#endif\\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\\n#ifdef GLOBE_POLES\\nin vec3 a_globe_pos;in vec2 a_uv;\\n#else\\nin ivec2 a_pos;in uvec2 a_texture_pos;\\n#endif\\nout vec2 v_pos0;out vec2 v_pos1;out float v_depth;\\n#ifdef PROJECTION_GLOBE_VIEW\\nout float v_split_fade;\\n#endif\\nvoid main() {vec2 uv;\\n#ifdef GLOBE_POLES\\nvec3 globe_pos=a_globe_pos;uv=a_uv;float ele=u_raster_elevation;\\n#ifdef ELEVATION_REFERENCE_GROUND\\nele+=elevation(uv*EXTENT);\\n#endif\\nglobe_pos+=normalize(globe_pos)*ele*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos,1.0);\\n#ifdef FOG\\nv_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);\\n#endif\\n#else\\nvec4 world_pos;\\n#ifdef PROJECTION_GLOBE_VIEW\\nvec2 texture_pos=vec2(a_texture_pos);uv=texture_pos/8192.0;vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);  \\nfloat tiles=u_grid_matrix[0][2];
2if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}float ele=u_raster_elevation;\\n#ifdef ELEVATION_REFERENCE_GROUND\\nele+=elevation(uv*EXTENT)-decomposed_pos_and_skirt.z;\\n#endif\\nvec4 merc_world_pos=vec4(0.0);   \\nv_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,ele,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*ele*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);world_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);\\n#ifdef FOG\\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\\n#endif\\n#else\\nfloat ele=0.0;vec2 decodedPos=vec2(a_pos);\\n#ifdef ELEVATION_REFERENCE_GROUND\\nvec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;decodedPos=decomposedPosAndSkirt.xy;uv=decodedPos/8192.0;ele=elevation(decodedPos)-skirt;\\n#else\\nuv=vec2(a_texture_pos)/8192.0;\\n#endif\\nworld_pos=vec4(decodedPos,(u_raster_elevation+ele),1.0);\\n#ifdef FOG\\nv_fog_pos=fog_position(decodedPos);\\n#endif\\n#endif\\nfloat w=1.0+dot(uv*EXTENT,u_perspective_transform);gl_Position=u_matrix*world_pos*w;\\n#endif\\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1;\\n#ifdef ELEVATED\\nfloat z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor);gl_Position.z-=(gl_Position.w*zbias);\\n#endif\\n#ifdef RENDER_CUTOFF\\nv_depth=gl_Position.z;\\n#endif\\n}\'),gm(\'#include "_prelude_lighting.glsl"\\n#include "_prelude_shadow.fragment.glsl"\\n#include "_prelude_indicator_cutout.fragment.glsl"\\n#include "_prelude_feature_cutout.fragment.glsl"\\n#define SDF_PX 8.0\\n#define SDF 1.0\\n#define ICON 0.0\\nuniform sampler2D u_texture;\\n#ifdef RENDER_TEXT_AND_SYMBOL\\nuniform sampler2D u_texture_icon;\\n#endif\\nuniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_sdf;uniform lowp float u_scale_factor;uniform lowp float u_opacity_multiplier;\\n#ifdef ICON_TRANSITION\\nuniform float u_icon_transition;\\n#endif\\n#ifdef COLOR_ADJUSTMENT\\nuniform mat4 u_color_adj_mat;\\n#endif\\n#ifdef RENDER_SHADOWS\\nin highp float v_z_offset;\\n#endif\\nin vec2 v_tex_a;\\n#ifdef ICON_TRANSITION\\nin vec2 v_tex_b;\\n#endif\\nin float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity;\\n#ifdef RENDER_TEXT_AND_SYMBOL\\nin float is_sdf;in vec2 v_tex_a_icon;\\n#endif\\n#ifdef RENDER_SHADOWS\\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\\n#endif\\n#ifdef APPLY_LUT_ON_GPU\\nuniform highp sampler3D u_lutTexture;\\n#endif\\nin lowp float v_opacity;in lowp vec4 v_fill_np_color;in lowp vec4 v_halo_np_color;in lowp float v_halo_width;in lowp float v_halo_blur;\\n#ifdef LIGHTING_3D_MODE\\nin lowp float v_emissive_strength;\\n#endif\\nvoid main() {lowp float opacity=v_opacity;lowp vec4 fill_color=vec4(0.0);lowp vec4 halo_color=vec4(0.0);lowp float halo_width=0.0;lowp float halo_blur=0.0;if (u_is_sdf) {fill_color=vec4(v_fill_np_color.rgb*v_fill_np_color.a,v_fill_np_color.a);halo_color=vec4(v_halo_np_color.rgb*v_halo_np_color.a,v_halo_np_color.a);halo_width=v_halo_width;halo_blur=v_halo_blur;}lowp float emissive_strength=0.0;\\n#ifdef LIGHTING_3D_MODE\\nemissive_strength=v_emissive_strength;\\n#endif\\nvec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2];\\n#ifdef RENDER_TEXT_AND_SYMBOL\\nif (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity*u_opacity_multiplier;
2glFragColor=texture(u_texture_icon,tex_icon)*alpha;\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nreturn;}\\n#endif\\nvec2 cutout_factors=vec2(0.0);if (u_is_sdf) {float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_gamma_scale_size_fade_opacity.x;float size=v_gamma_scale_size_fade_opacity.y;float fontScale=u_is_text ? size/24.0 : size;out_color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {out_color=halo_color;gamma=(halo_blur*u_scale_factor*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width*u_scale_factor/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,v_tex_a).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);out_color*=alpha;} else {\\n#ifdef ICON_TRANSITION\\nvec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b);\\n#else\\nout_color=texture(u_texture,v_tex_a);\\n#endif\\n#ifdef APPLY_LUT_ON_GPU\\nout_color=applyLUT(u_lutTexture,out_color);\\n#endif\\n#ifdef COLOR_ADJUSTMENT\\nout_color=u_color_adj_mat*out_color;\\n#endif\\n}out_color*=opacity*fade_opacity*u_opacity_multiplier;\\n#ifdef LIGHTING_3D_MODE\\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\\n#ifdef RENDER_SHADOWS\\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);\\n#ifdef TERRAIN\\nout_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\\n#else\\nout_color.rgb*=mix(v_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\\n#endif\\n#endif\\n#endif\\nglFragColor=out_color;\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}\',\'#include "_prelude_terrain.vertex.glsl"\\n#include "_prelude_shadow.vertex.glsl"\\n#define USING_APPEARANCE 1.0\\nin ivec4 a_pos_offset;in uvec4 a_tex_size;in ivec4 a_pixeloffset;in vec4 a_projected_pos;in uint a_fade_opacity;\\n#ifdef Z_OFFSET\\nin float a_auto_z_offset;\\n#endif\\n#ifdef PROJECTION_GLOBE_VIEW\\nin ivec4 a_globe_anchor;in vec3 a_globe_normal;\\n#endif\\n#ifdef ICON_TRANSITION\\nin uvec2 a_texb;\\n#endif\\n#ifdef ELEVATED_ROADS\\nin vec3 a_x_axis;in vec3 a_y_axis;uniform float u_normal_scale;\\n#endif\\n#ifdef RENDER_SHADOWS\\nout highp float v_z_offset;\\n#endif\\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;\\n#ifdef RENDER_SHADOWS\\nuniform mat4 u_inv_matrix;\\n#endif\\nuniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_elevation_from_sea;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;\\n#ifdef PROJECTION_GLOBE_VIEW\\nuniform vec3 u_up_vector;\\n#endif\\n#ifdef RENDER_TEXT_AND_SYMBOL\\nuniform vec2 u_texsize_icon;\\n#endif\\nuniform bool u_is_halo;\\n#ifdef PROJECTION_GLOBE_VIEW\\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\\n#endif\\nout vec2 v_tex_a;\\n#ifdef ICON_TRANSITION\\nout vec2 v_tex_b;\\n#endif\\nout float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity;\\n#ifdef RENDER_TEXT_AND_SYMBOL\\nout float is_sdf;out vec2 v_tex_a_icon;\\n#endif\\n#ifdef RENDER_SHADOWS\\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\\n#endif\\n#ifndef MAX_UBO_SIZE_VEC4\\n#define MAX_UBO_SIZE_VEC4 1024u\\n#endif\\n#define SPP_HEADER_SIZE_VEC4 4u\\nstruct SymbolPaintProperties {vec4 fill_np_color;vec4 halo_np_color;float opacity;float halo_width;float halo_blur;float emissive_strength;float occlusion_opacity;float z_offset;vec2 translate;};uniform lowp vec4 u_spp_fill_np_color;uniform lowp vec4 u_spp_halo_np_color;uniform lowp float u_spp_opacity;uniform lowp float u_spp_halo_width;uniform lowp float u_spp_halo_blur;uniform lowp float u_spp_emissive_strength;uniform lowp float u_spp_occlusion_opacity;uniform highp float u_spp_z_offset;uniform lowp vec2 u_spp_translate_rotation;uniform highp float u_spp_zoom_fraction;in float a_feature_index;layout(std140) uniform SymbolPaintPropertiesHeaderUniform {uvec4 header[SPP_HEADER_SIZE_VEC4];} u_spp_header;layout(std140) uniform SymbolPaintPropertiesUniform {vec4 properties[MAX_UBO_SIZE_VEC4];} u_spp_properties;layout(std140) uniform SymbolPaintPropertiesIndexUniform {uvec4 block_indices[MAX_UBO_SIZE_VEC4];} u_spp_index;out lowp float v_opacity;out lowp vec4 v_fill_np_color;out lowp vec4 v_halo_np_color;out lowp float v_halo_width;out lowp float v_halo_blur;\\n#ifdef LIGHTING_3D_MODE\\nout lowp float v_emissive_strength;\\n#endif\\nfloat zoomFactor(float zm,float zM) {if (zm==zM) return u_spp_zoom_fraction-zm >=0.0 ? 1.0 : 0.0;return clamp((u_spp_zoom_fraction-zm)/(zM-zm),0.0,1.0);}vec4 readColor(uint base,bool isDataDriven,uint offsetVec4,uint dzr,vec2 headerZoom,vec4 fallbackValue) {if (!isDataDriven) return fallbackValue;vec4 value=u_spp_properties.properties[base+offsetVec4];vec2 blockZoom=u_spp_properties.properties[base+offsetVec4+dzr].xy;vec2 zr=mix(headerZoom,blockZoom,float(dzr));return unpack_mix_color(value,zoomFactor(zr.x,zr.y));}uint uvec4At(uvec4 v,uint index) {return (index==0u) ? v.x :\\n(index==1u) ? v.y :\\n(index==2u) ? v.z : v.w;}
2float readScalar(uint base,bool isDataDriven,uint offsetVec4,float fallbackValue) {if (!isDataDriven) return fallbackValue;vec4 slot=u_spp_properties.properties[base+offsetVec4];return unpack_mix_vec2(slot.xy,zoomFactor(slot.z,slot.w));}vec2 readTranslate(uint base,bool isDataDriven,uint offsetVec4,uint dzr) {if (!isDataDriven) return vec2(0.0);vec4 value=u_spp_properties.properties[base+offsetVec4];vec2 blockZoom=u_spp_properties.properties[base+offsetVec4+dzr].xy;float t=zoomFactor(blockZoom.x,blockZoom.y)*float(dzr);return mix(value.xy,value.zw,t);}SymbolPaintProperties readSymbolPaintProperties() {uint dataDrivenMask=u_spp_header.header[0][0];uint dzrMask       =u_spp_header.header[0][1];uint blockSizeVec4 =u_spp_header.header[0][2];uint fillColorDzr=dzrMask & 1u;uint haloColorDzr=(dzrMask >> 1u) & 1u;vec2 fillColorHeaderZoom=uintBitsToFloat(u_spp_header.header[3].xy);vec2 haloColorHeaderZoom=uintBitsToFloat(u_spp_header.header[3].zw);uint featureIndex=uint(a_feature_index);uvec4 indexSlot=u_spp_index.block_indices[featureIndex/4u];uint base=uvec4At(indexSlot,featureIndex % 4u)*blockSizeVec4;SymbolPaintProperties props;props.fill_np_color    =readColor(base,(dataDrivenMask & (1u << 0u)) !=0u,u_spp_header.header[0][3],fillColorDzr,fillColorHeaderZoom,u_spp_fill_np_color);props.halo_np_color    =readColor(base,(dataDrivenMask & (1u << 1u)) !=0u,u_spp_header.header[1][0],haloColorDzr,haloColorHeaderZoom,u_spp_halo_np_color);props.opacity          =readScalar(base,(dataDrivenMask & (1u << 2u)) !=0u,u_spp_header.header[1][1],u_spp_opacity);props.halo_width       =readScalar(base,(dataDrivenMask & (1u << 3u)) !=0u,u_spp_header.header[1][2],u_spp_halo_width);props.halo_blur        =readScalar(base,(dataDrivenMask & (1u << 4u)) !=0u,u_spp_header.header[1][3],u_spp_halo_blur);props.emissive_strength=readScalar(base,(dataDrivenMask & (1u << 5u)) !=0u,u_spp_header.header[2][0],u_spp_emissive_strength);props.occlusion_opacity=readScalar(base,(dataDrivenMask & (1u << 6u)) !=0u,u_spp_header.header[2][1],u_spp_occlusion_opacity);props.z_offset         =readScalar(base,(dataDrivenMask & (1u << 7u)) !=0u,u_spp_header.header[2][2],u_spp_z_offset);uint translateDzr=(dzrMask >> 8u) & 1u;props.translate        =readTranslate(base,(dataDrivenMask & (1u << 8u)) !=0u,u_spp_header.header[2][3],translateDzr);return props;}vec2 unpack_opacity(uint packedOpacity) {return vec2(float(packedOpacity/2u)/127.0,float(packedOpacity & 1u));}void main() {SymbolPaintProperties paint_properties=readSymbolPaintProperties();lowp float opacity=paint_properties.opacity;v_opacity=opacity;v_fill_np_color=paint_properties.fill_np_color;v_halo_np_color=paint_properties.halo_np_color;v_halo_width=paint_properties.halo_width;v_halo_blur=paint_properties.halo_blur;\\n#ifdef LIGHTING_3D_MODE\\nv_emissive_strength=paint_properties.emissive_strength;\\n#endif\\nlowp float occlusion_opacity=paint_properties.occlusion_opacity;highp float z_offset=paint_properties.z_offset;vec2 a_pos=vec2(a_pos_offset.xy);vec2 a_offset=vec2(a_pos_offset.zw);vec2 a_tex=vec2(a_tex_size.xy);vec2 a_size=vec2(a_tex_size.zw);float a_size_min=floor(a_size[0]*0.5);float a_size_max= floor(a_size[1]*0.5);float a_apperance=a_size[1]-2.0*a_size_max;vec2 a_pxoffset=vec2(a_pixeloffset.xy);vec2 a_min_font_scale=vec2(a_pixeloffset.zw)/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (a_apperance==USING_APPEARANCE) {size=a_size_max/128.0;} else if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size_max,u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=u_elevation_from_sea ? z_offset : z_offset+elevation(tile_anchor);\\n#ifdef Z_OFFSET\\ne+=a_auto_z_offset;\\n#endif\\nvec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe;\\n#ifdef PROJECTION_GLOBE_VIEW\\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=vec3(a_globe_anchor)+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\\n#else\\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\\n#endif\\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\\ncamera_to_anchor_distance/u_camera_to_center_distance :\\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;vec2 a;\\n#ifdef PROJECTION_GLOBE_VIEW\\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);
2offsetprojected_point=u_matrix*vec4(vec3(a_globe_anchor)+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w;\\n#else\\noffsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w;\\n#endif\\nvec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\\n#ifdef PROJECTION_GLOBE_VIEW\\n#ifdef PROJECTED_POS_ON_VIEWPORT\\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0);\\n#else\\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz,mercator_pos,u_zoom_transition)+h;projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\\n#endif\\n#else\\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\\n#endif\\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);\\n#ifdef TERRAIN\\n#ifdef PITCH_WITH_MAP_TERRAIN\\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\\n#endif\\n#endif\\n#ifdef Z_OFFSET\\nz+=u_pitch_with_map ? a_auto_z_offset+z_offset : 0.0;\\n#else\\nz+=u_pitch_with_map ? z_offset : 0.0;\\n#endif\\nfloat occlusion_fade=globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float out_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));\\n#ifdef DEPTH_OCCLUSION\\nfloat depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier;\\n#endif\\nfloat alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);vec3 pos;\\n#ifdef PROJECTION_GLOBE_VIEW\\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y;\\n#else\\n#ifdef ELEVATED_ROADS\\nvec3 xAxis=vec3(a_x_axis.xy,a_x_axis.z*u_normal_scale);vec3 yAxis=vec3(a_y_axis.xy,a_y_axis.z*u_normal_scale);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y;\\n#else\\npos=vec3(projected_pos.xy/projected_pos.w+offset,z);\\n#endif\\n#endif\\ngl_Position=mix(u_coord_matrix*vec4(pos,1.0),AWAY,hidden);{vec2 tr=paint_properties.translate;vec2 rotated_tr=vec2(\\nu_spp_translate_rotation.x*tr.x-u_spp_translate_rotation.y*tr.y,u_spp_translate_rotation.y*tr.x+u_spp_translate_rotation.x*tr.y\\n);gl_Position.xy+=(u_coord_matrix*vec4(rotated_tr,0.0,0.0)).xy;}float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_gamma_scale_size_fade_opacity=vec3(gamma_scale,size,out_fade_opacity);v_tex_a=a_tex/u_texsize;\\n#ifdef RENDER_TEXT_AND_SYMBOL\\nis_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon;\\n#endif\\n#ifdef ICON_TRANSITION\\nv_tex_b=vec2(a_texb)/u_texsize;\\n#endif\\n#ifdef RENDER_SHADOWS\\nvec4 shd_pos=u_inv_matrix*vec4(pos,1.0);vec3 shd_pos0=shd_pos.xyz;vec3 shd_pos1=shd_pos.xyz;\\n#ifdef NORMAL_OFFSET\\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\\n#endif\\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\\n#endif\\n#ifdef RENDER_SHADOWS\\nv_z_offset=e;\\n#endif\\n}\'),gm(\'#include "_prelude_fog.fragment.glsl"\\nin lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(\\ncos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(e
2nd-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb;\\n#ifdef FOG\\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\\n#endif\\nsky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity);\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\n}\',em),gm(\'#include "_prelude_fog.fragment.glsl"\\nin highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture(u_color_ramp,vec2(progress,0.5));\\n#ifdef FOG\\ncolor.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;\\n#endif\\ncolor*=u_opacity;glFragColor=color;\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\n}\',em),gm("\\nin highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float;\\n#define BETA_R                  vec3(5.5e-6,13.0e-6,22.4e-6)\\n#define BETA_M                  vec3(21e-6,21e-6,21e-6)\\n#define MIE_G                   0.76\\n#define DENSITY_HEIGHT_SCALE_R  8000.0\\n#define DENSITY_HEIGHT_SCALE_M  1200.0\\
2n#define PLANET_RADIUS           6360e3\\n#define ATMOSPHERE_RADIUS       6420e3\\n#define SAMPLE_STEPS            10\\n#define DENSITY_STEPS           4\\nfloat ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}","in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(e
2nd-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),gm(\'#include "_prelude_fog.fragment.glsl"\\nuniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_atmosphere_fog_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;\\n#ifdef PROJECTION_GLOBE_VIEW\\nglobe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {\\n#ifdef ALPHA_PASS\\nglFragColor=vec4(0,0,0,0);return;\\n#else\\nglFragColor=vec4(0,0,0,1);return;\\n#endif\\n}\\n#endif\\nhighp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?\\n0.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;\\n#ifdef PROJECTION_GLOBE_VIEW\\nhighp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?\\nPI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);\\n#else\\nhorizon_angle=horizon_angle_mercator;\\n#endif\\nhorizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_atmosphere_fog_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_atmosphere_fog_color.rgb;vec3 color_stop_1=u_high_color.rgb;vec3 color_stop_2=u_space_color.rgb;\\n#ifdef ALPHA_PASS\\nfloat a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a);\\n#else\\nvec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;glFragColor=vec4(c*t,t);\\n#endif\\n}\',"in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(\\nmix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(\\nmix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}"),gm("in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv)\\n{float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}","\\nin vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}"),gm("uniform vec4 u_color;void main() {glFragColor=u_color;}",\'#include "_prelude_terrain.vertex.glsl"\\nin highp vec2 a_offset_xy;uniform highp vec3 u_anchorPos;uniform mat4 u_matrix;uniform vec2 u_screenSizePx;uniform vec2 u_occluderSizePx;void main() {vec3 world_pos=u_anchorPos;\\n#ifdef TERRAIN\\nfloat e=elevation(world_pos.xy);world_pos.z+=e;\\n#endif\\nvec4 projected_point=u_matrix*vec4(world_pos,1.0);projected_point.xy+=projected_point.w*a_offset_xy*0.5*u_occluderSizePx/u_screenSizePx;gl_Position=projected_point;}\'),gm(\'#include "_prelude_fog.fragment.glsl"\\n#include "_prelude_shadow.fragment.glsl"\\n#include "_prelude_lighting.glsl"\\n#include "_prelude_indicator_cutout.fragment.glsl"\\n#include "_prelude_feature_cutout.fragment.glsl"\\nuniform float u_opacity;\\n#ifdef DITHERED_DISCARD\\nuniform float u_dithered_discard_threshold;\\n#endif\\n#ifndef LIGHTING_3D_MODE\\nuniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;\\n#endif\\nuniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix;\\n#ifdef RENDER_SHADOWS\\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows;\\n#endif\\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\\nuniform vec4 u_occlusionTextureTransform;\\n#endif\\n#pragma mapbox: define-attribute highp vec4 normal_4n\\n#pragma mapbox: define-attribute highp vec3 color_3f\\n#pragma mapbox: define-attribute highp vec4 color_4f\\n#pragma mapbox: define-attribute highp vec2 uv_2f\\n#pragma mapbox: initialize-attribute highp vec4 normal_4n\\n#pragma mapbox: initialize-attribute highp vec3 color_3f\\n#pragma mapbox: initialize-attribute highp vec4 color_4f\\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\\n#ifdef HAS_ATTRIBUTE_a_feature\\nin lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;\\n#endif\\n#ifdef HAS_TEXTURE_u_baseColorTexture\\nuniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;
2uniform float u_alphaCutoff;\\n#endif\\n#ifdef HAS_TEXTURE_u_metallicRoughnessTexture\\nuniform sampler2D u_metallicRoughnessTexture;\\n#endif\\n#ifdef HAS_TEXTURE_u_occlusionTexture\\nuniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;\\n#endif\\n#ifdef HAS_TEXTURE_u_normalTexture\\nuniform sampler2D u_normalTexture;\\n#endif\\n#ifdef HAS_TEXTURE_u_emissionTexture\\nuniform sampler2D u_emissionTexture;\\n#endif\\n#ifdef APPLY_LUT_ON_GPU\\nuniform highp sampler3D u_lutTexture;\\n#endif\\n#define saturate(_x) clamp(_x,0.,1.)\\nvec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor)\\n{\\n#ifdef LIGHTING_3D_MODE\\nvec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;\\n#ifdef RENDER_SHADOWS\\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\\n#else\\nlighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));\\n#endif\\nreturn apply_lighting(albedo,transformed_normal,lighting_factor);\\n#else\\nvec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-lightColor),vec3(1.0));return c3;\\n#endif\\n}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;\\n#ifdef HAS_ATTRIBUTE_a_color_3f\\nalbedo*=vec4(color_3f,1.0);\\n#endif\\n#ifdef HAS_ATTRIBUTE_a_feature\\n#else\\n#ifdef HAS_ATTRIBUTE_a_color_4f\\nalbedo*=color_4f;\\n#endif\\n#endif\\n#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f)\\nvec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}}\\n#ifdef UNPREMULT_TEXTURE_IN_SHADER\\ntexColor=vec4(unpremultiplyColor(texColor),1.0);\\n#endif\\nif(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;}\\n#endif\\nvec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a);\\n#ifdef APPLY_LUT_ON_GPU\\ncolor=applyLUT(u_lutTexture,color);\\n#endif\\nreturn color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) {\\n#ifdef HAS_TEXTURE_u_normalTexture\\nhighp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y;highp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res;\\n#else\\nreturn mat3(1.0);\\n#endif\\n}highp vec3 getNormal(){highp vec3 n;\\n#ifdef HAS_ATTRIBUTE_a_normal_4n\\nn=normalize(normal_4n.xyz);\\n#else\\nhighp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z));n=normalize(cross(fdx,fdy))*-1.0;\\n#endif\\n#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\\nvec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap);\\n#endif\\nreturn n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor;\\n#ifdef HAS_ATTRIBUTE_a_feature\\nmat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;\\n#endif\\n#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\\nvec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;\\n#endif\\nconst float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness)\\n{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);
2float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH)\\n{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)\\n{float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness)\\n{highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV)\\n{float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat)\\n{\\n#ifdef LIGHTING_3D_MODE\\nreturn mat.diffuseColor;\\n#else\\nreturn mat.diffuseColor/PI;\\n#endif\\n}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)\\n{vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal)\\n{vec3 env_light=vec3(0.65,0.65,0.65);\\n#ifdef LIGHTING_3D_MODE\\nfloat ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;\\n#endif\\nvec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor)\\n{highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor;\\n#ifdef RENDER_SHADOWS\\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\\n#else\\nlighting_factor=NdotL;\\n#endif\\nvec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*light
2Color;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;\\n#if !defined(LIGHTING_3D_MODE)\\nconst vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL);\\n#endif\\ncolor*=intensityFactor;return color;}void main() {vec3 lightDir;vec3 lightColor;\\n#ifdef LIGHTING_3D_MODE\\nlightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;\\n#else\\nlightDir=u_lightpos;lightColor=u_lightcolor;\\n#endif\\nvec4 finalColor;\\n#ifdef DIFFUSE_SHADED\\nvec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor);\\n#ifdef HAS_TEXTURE_u_occlusionTexture\\nfloat ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;\\n#endif\\nfinalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity;\\n#else\\nMaterial mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;\\n#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\\nvec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy;\\n#else\\nvec2 uv=uv_2f;\\n#endif\\nao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao;\\n#endif\\nvec4 emissive=u_emissiveFactor;\\n#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\\nemissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);\\n#endif\\n#ifdef APPLY_LUT_ON_GPU\\nfloat emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength;\\n#endif\\ncolor+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;\\n#ifdef HAS_ATTRIBUTE_a_feature\\nfloat resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);vec3 color_mix=v_color_mix.rgb;\\n#ifdef APPLY_LUT_ON_GPU\\ncolor_mix=applyLUT(u_lutTexture,color_mix);\\n#endif\\ncolor=mix(color,color_mix,min(1.0,resEmission));\\n#ifdef HAS_ATTRIBUTE_a_color_4f\\nfloat distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.
2y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance);\\n#endif\\n#endif\\nvec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);\\n#endif\\n#ifdef DITHERED_DISCARD\\nif (abs(u_dithered_discard_threshold) < 1.0) {float ditherValue=fract(52.9829189*fract(0.06711056*gl_FragCoord.x+0.00583715*gl_FragCoord.y));float compareValue=mix(1.0-ditherValue,ditherValue,step(0.0,u_dithered_discard_threshold));if (abs(u_dithered_discard_threshold) < compareValue) {discard;}}\\n#endif\\n#ifdef FOG\\nfinalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));\\n#endif\\n#ifdef RENDER_CUTOFF\\nfinalColor*=v_cutoff_opacity;\\n#endif\\nglFragColor=finalColor;\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}\',\'#include "_prelude_fog.vertex.glsl"\\n#include "_prelude_shadow.vertex.glsl"\\n#include "_prelude_feature_cutout.vertex.glsl"\\nin vec3 a_pos_3f;\\n#pragma mapbox: define-attribute highp vec4 normal_4n\\n#pragma mapbox: define-attribute highp vec2 uv_2f\\n#pragma mapbox: define-attribute highp vec3 color_3f\\n#pragma mapbox: define-attribute highp vec4 color_4f\\n#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 feature\\n#define MODEL_PART_COUNT 7u\\n#define MODEL_PART_STYLE_SIZE_VEC4 28u\\n#ifdef HAS_ATTRIBUTE_a_feature\\nstruct ModelPartStyle {vec4 color_mix;vec4 rmea;vec4 gradient;float gradient_power;};layout(std140) uniform ModelPartStyleUniform {vec4 part_style[MODEL_PART_STYLE_SIZE_VEC4];} u_model_part_style;uniform vec4 u_model_mesh_params;\\n#endif\\nuniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;\\n#ifdef INSTANCED_ARRAYS\\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\\n#else\\nuniform highp mat4 u_normal_matrix;\\n#endif\\n#ifdef RENDER_SHADOWS\\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows;\\n#endif\\nout vec4 v_position_height;out lowp vec4 v_color_mix;\\n#ifdef HAS_ATTRIBUTE_a_feature\\nout lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;\\n#endif\\nvec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}\\n#ifdef HAS_ATTRIBUTE_a_feature\\nuint decodeModelPartId(uvec2 feature) {uint partId=feature.y & 0xFu;return partId < MODEL_PART_COUNT ? partId : 0u;}vec4 decodeModelVertexColor(uvec2 feature) {uvec4 nibbles=uvec4(feature.x >> 12u,feature.x >> 8u,feature.x >> 4u,feature.x) & 0xFu;return vec4(nibbles*17u)/255.0;}ModelPartStyle readModelPartStyle(uint partId) {uint base=partId*4u;ModelPartStyle style;style.color_mix=u_model_part_style.part_style[base];style.rmea=u_model_part_style.part_style[base+1u];style.gradient=u_model_part_style.part_style[base+2u];style.gradient_power=u_model_part_style.part_style[base+3u].x;return style;}vec3 modelAlbedo(ModelPartStyle style,vec4 vertexColor) {float ambientOcclusion=mix(1.0,vertexColor.a,u_model_mesh_params.z);return ambientOcclusion*mix(vertexColor.rgb,style.color_mix.rgb,style.color_mix.a);}vec4 resolveModelEmissiveGradient(ModelPartStyle style,float height) {float begin=u_model_mesh_params.x+u_model_mesh_params.y*style.gradient.x;float span=u_model_mesh_params.y*(style.gradient.y-style.gradient.x);return vec4((height-begin)/span,style.gradient_power,style.gradient.z,style.gradient.w);}\\n#endif\\nvoid main() {\\n#pragma mapbox: initialize-attribute highp vec4 normal_4n\\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\\n#pragma mapbox: initialize-attribute highp vec3 color_3f\\n#pragma mapbox: initialize-attribute highp vec4 color_4f\\n#pragma mapbox: initialize-attribute-custom highp uvec2 feature\\nhighp mat4 normal_matrix;\\n#ifdef INSTANCED_ARRAYS\\nnormal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\\n#else\\nnormal_matrix=u_normal_matrix;\\n#endif\\nvec3 local_pos;mat3 rs;\\n#ifdef MODEL_POSITION_ON_GPU\\nvec3 pos_color=normal_matrix[0].xyz;
2vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float hidden=float(pos_a.x > EXTENT);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=mix(u_matrix*pos,AWAY,hidden);pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos;\\n#else\\nlocal_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a);\\n#endif\\nv_position_height.w=a_pos_3f.z;\\n#ifdef HAS_ATTRIBUTE_a_feature\\nModelPartStyle part_style=readModelPartStyle(decodeModelPartId(feature));v_color_mix=vec4(modelAlbedo(part_style,decodeModelVertexColor(feature)),1.0);v_roughness_metallic_emissive_alpha=part_style.rmea;v_height_based_emission_params=resolveModelEmissiveGradient(part_style,a_pos_3f.z);\\n#endif\\n#ifdef FOG\\nv_fog_pos=fog_position(local_pos);\\n#endif\\n#ifdef RENDER_CUTOFF\\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\\n#endif\\n#ifdef HAS_ATTRIBUTE_a_normal_4n\\n#ifdef MODEL_POSITION_ON_GPU\\nfloat x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_4n=vec4(rs*((u_lighting_matrix*vec4(normal_4n.xyz,0.0)).xyz/squared_scale),0.0);normal_4n=normalize(normal_4n);\\n#else\\nnormal_4n=vec4((normal_matrix*vec4(normal_4n.xyz,0)).xyz,0.0);\\n#endif\\n#endif\\n#ifdef HAS_ATTRIBUTE_a_feature\\n#ifdef HAS_ATTRIBUTE_a_color_4f\\nv_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0);\\n#endif\\n#endif\\n#ifdef RENDER_SHADOWS\\nvec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0);\\n#ifdef NORMAL_OFFSET\\n#ifdef HAS_ATTRIBUTE_a_normal_4n\\n#ifdef MODEL_POSITION_ON_GPU\\nvec3 offset=shadow_normal_offset(vec3(-normal_4n.xy,normal_4n.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\\n#else\\nvec3 offset=shadow_normal_offset_model(normal_4n.xyz);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\\n#endif\\n#endif\\n#endif\\nv_pos_light_view_0=u_light_matrix_0*shadow_pos;v_pos_light_view_1=u_light_matrix_1*shadow_pos;v_depth_shadows=gl_Position.w;\\n#endif\\n}\'),gm("void main() {}","in vec3 a_pos_3f;uniform mat4 u_matrix;\\n#ifdef MODEL_POSITION_ON_GPU\\n#ifdef INSTANCED_ARRAYS\\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\\n#else\\nuniform highp mat4 u_instance;\\n#endif\\nuniform highp mat4 u_node_matrix;\\n#endif\\nvoid main() {\\n#ifdef MODEL_POSITION_ON_GPU\\nhighp mat4 instance;\\n#ifdef INSTANCED_ARRAYS\\ninstance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\\n#else\\ninstance=u_instance;\\n#endif\\nvec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float hidden=float(pos_a.x > EXTENT);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;
2rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=mix(u_matrix*pos,AWAY,hidden);\\n#else\\ngl_Position=u_matrix*vec4(a_pos_3f,1);\\n#endif\\n}"),gm("void main() {}",\'#include "_prelude_terrain.vertex.glsl"\\n#include "_prelude_material_table.vertex.glsl"\\nuniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale;\\n#ifdef TERRAIN\\nuniform int u_height_type;uniform int u_base_type;\\n#endif\\nin ivec4 a_pos_normal_ed;\\n#if defined(HAS_CENTROID) || defined(TERRAIN)\\nin uvec2 a_centroid_pos;\\n#endif\\n#ifdef RENDER_WALL_MODE\\nin ivec4 a_join_normal_inside;\\n#endif\\n#pragma mapbox: define highp float base\\n#pragma mapbox: define highp float height\\n#pragma mapbox: define highp float line_width\\n#pragma mapbox: define highp vec4 color\\nvoid main() {DECLARE_MATERIAL_TABLE_INFO\\n#pragma mapbox: initialize highp float base\\n#pragma mapbox: initialize highp float height\\n#pragma mapbox: initialize highp float line_width\\n#pragma mapbox: initialize highp vec4 color\\nbase*=u_vertical_scale;height*=u_vertical_scale;vec3 top_up_ny=vec3(a_pos_normal_ed.xyz & 1);vec3 pos_nx=vec3(a_pos_normal_ed.xyz >> 1);base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\\n#if defined(HAS_CENTROID) || defined(TERRAIN)\\ncentroid_pos=vec2(a_centroid_pos);\\n#endif\\nvec3 pos;\\n#ifdef TERRAIN\\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;float ele=elevation(pos_nx.xy);bool is_elevation_encoded=centroid_pos.y==0.0 || (centroid_pos.y > 0.0 && int(centroid_pos.y)-(int(centroid_pos.y)/8)*8==7);float c_ele=is_flat_height || is_flat_base ? (is_elevation_encoded ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);float h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);\\n#else\\npos=vec3(pos_nx.xy,t > 0.0 ? height : base);\\n#endif\\n#ifdef RENDER_WALL_MODE\\nvec3 join_normal_inside=vec3(a_join_normal_inside);vec2 wall_offset=u_width_scale*line_width*(join_normal_inside.xy/EXTENT);pos.xy+=(1.0-join_normal_inside.z)*wall_offset*0.5;pos.xy-=join_normal_inside.z*wall_offset*0.5;\\n#endif\\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);}\'),gm("uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size;\\n#ifdef SDF_SUBPASS\\nin highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);}\\n#ifdef FOG\\nin highp float v_fog;\\n#endif\\n#endif\\nvoid main() {\\n#ifdef CLEAR_SUBPASS\\nvec4 color=vec4(1.0);\\n#ifdef CLEAR_FROM_TEXTURE\\ncolor=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size));\\n#endif\\nglFragColor=color;\\n#else\\n#ifdef SDF_SUBPASS\\nhighp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0;\\n#ifdef FOG\\nfog=v_fog;\\n#endif\\n#ifdef RENDER_CUTOFF\\nfog*=v_cutoff_opacity;\\n#endif\\nglFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog));
2\\n#else\\n#ifdef USE_MRT1\\nout_Target1=vec4(1.0-texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)).a,0.0,0.0,0.0);\\n#else\\nvec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass);\\n#ifdef OVERDRAW_INSPECTOR\\ncolor=vec4(1.0);\\n#endif\\nglFragColor=color;\\n#endif\\n#endif\\nHANDLE_WIREFRAME_DEBUG;\\n#endif\\n}",\'#include "_prelude_fog.vertex.glsl"\\nin highp ivec4 a_pos_end;in highp int a_angular_offset_factor;in highp uint a_hidden_by_landmark;\\n#ifdef SDF_SUBPASS\\nout highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;\\n#ifdef FOG\\nout highp float v_fog;\\n#endif\\n#endif\\nuniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp float u_dynamic_offset;uniform highp vec2 u_ao;\\n#pragma mapbox: define highp float flood_light_ground_radius\\nconst float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {\\n#pragma mapbox: initialize highp float flood_light_ground_radius\\nvec4 pos_end=vec4(a_pos_end);vec2 p=pos_end.xy;vec2 q=floor(pos_end.zw*0.5);vec2 start_bottom=pos_end.zw-q*2.0;float fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=float(a_angular_offset_factor)/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(u_dynamic_offset,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp;\\n#ifdef SDF_SUBPASS\\nv_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius);\\n#ifdef FOG\\nv_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos);\\n#endif\\n#endif\\nfloat hidden_by_landmark=0.0;\\n#ifdef HAS_CENTROID\\nhidden_by_landmark=float(a_hidden_by_landmark);\\n#endif\\nfloat isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0));\\n#ifdef RENDER_CUTOFF\\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\\n#endif\\n}\'),gm(\'#include "_prelude_shadow.fragment.glsl"\\n#include "_prelude_indicator_cutout.fragment.glsl"\\n#include "_prelude_feature_cutout.fragment.glsl"\\nprecision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\\n#ifdef FOG\\nin float v_fog_opacity;\\n#endif\\nvoid main() {float light=shadowed_light_factor_plane_bias(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light);\\n#ifdef RENDER_CUTOFF\\nshadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w));\\n#endif\\n#ifdef FOG\\nshadow=mix(shadow,vec3(1.0),v_fog_opacity);\\n#endif\\nglFragColor=vec4(shadow,1.0);}\',\'#include "_prelude_fog.vertex.glsl"\\nuniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in ivec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;\\n#ifdef FOG\\nout float v_fog_opacity;\\n#endif\\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0);\\n#ifdef FOG\\nv_fog_pos=fog_position(vec2(a_pos));v_fog_opacity=fog(v_fog_pos);\\n#endif\\n}\'),i(),new Float32Array(16),new Float32Array(16);const ym="NO_ACCESS_TOKEN",xm=/^(\\w+):\\/\\/([^/?]*)(\\/[^?]+)?\
vendor: 67,310 bytes, line 2
2\??(.+)?/;function vm(e){const t=e.match(xm);if(!t)throw new Error("Unable to parse URL object");return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&"):[]}}function bm(e){const t=e.params.length?`?${e.params.join("&")}`:"";return`${e.protocol}://${e.authority}${e.path}${t}`}const wm="mapbox.eventData";function Am(e){if(!e)return null;const t=e.split(".");if(!t||3!==t.length)return null;try{return JSON.parse(decodeURIComponent(atob(t[1]).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join("")))}catch(e){return null}}function Em(e){return!(!We.EVENTS_URL||!e&&!We.ACCESS_TOKEN)}let Im="other";class TelemetryEvent{constructor(e){this.type=e,this.anonId=null,this.anonIdTimestamp=null,this.eventData={},this.queue=[],this.pendingRequest=!1}getStorageKey(e){const t=Am(We.ACCESS_TOKEN);let i="";return i=t&&t.u?btoa(encodeURIComponent(t.u).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(Number("0x"+t)))):We.ACCESS_TOKEN||"",e?`${wm}.${e}:${i}`:`${wm}:${i}`}fetchEventData(){const e=Le("localStorage"),t=this.getStorageKey(),i=this.getStorageKey("uuid"),r=this.getStorageKey("uuidTimestamp");if(e)try{const e=localStorage.getItem(t);e&&(this.eventData=JSON.parse(e));const n=localStorage.getItem(i);n&&(this.anonId=n);const o=localStorage.getItem(r);o&&(this.anonIdTimestamp=Number(o));const a=Date.now()-864e5;(!this.anonIdTimestamp||this.anonIdTimestamp<a)&&this.refreshUUID()}catch(e){ze("Unable to read from LocalStorage")}}refreshUUID(){this.anonId=Ae(),this.anonIdTimestamp=Date.now()}saveEventData(){const e=Le("localStorage"),t=this.getStorageKey(),i=this.getStorageKey("uuid"),r=this.getStorageKey("uuidTimestamp"),n=this.anonId,o=this.anonIdTimestamp;if(e&&n)try{localStorage.setItem(i,n),Object.keys(this.eventData).length>=1&&localStorage.setItem(t,JSON.stringify(this.eventData)),o&&localStorage.setItem(r,o.toString())}catch(e){ze("Unable to write to LocalStorage")}}processRequests(){}postEvent(e,t,i,r){if(!We.EVENTS_URL)return;const n=vm(We.EVENTS_URL);n.params.push(`access_token=${r||We.ACCESS_TOKEN||""}`);const o={event:this.type,created:new Date(e).toISOString()},a=t?Object.assign(o,t):o,s={url:bm(n),headers:{"Content-Type":"text/plain"},body:JSON.stringify([a])};this.pendingRequest=!0,async function(e){return Qr(Object.assign(e,{method:"POST"}),void 0)}(s).then(()=>{this.pendingRequest=!1,i(null),this.saveEventData(),this.processRequests()}).catch(e=>{this.pendingRequest=!1,i(e),this.saveEventData(),this.processRequests()})}queueRequest(e,t){this.queue.push({...e,customAccessToken:t}),this.processRequests()}}class MetricsEvent extends TelemetryEvent{constructor(e){super("metrics"),e&&(this.data=e)}postMetricsEvent(e){if(!Em(e))return;this.anonId||this.fetchEventData(),Ee(this.anonId)||this.refreshUUID();const t={...this.data,sessionId:this.anonId};this.queueRequest({timestamp:Date.now(),payload:t},e)}processRequests(){if(this.pendingRequest||0===this.queue.length)return;const{timestamp:e,payload:t,customAccessToken:i}=this.queue.shift();this.postEvent(e,t,()=>{},i)}}const Sm=new class TurnstileEvent extends TelemetryEvent{constructor(e){super("appUserTurnstile"),this._customAccessToken=e}postTurnstileEvent(e,t){Em(t)&&Array.isArray(e)&&e.some(e=>function(e){return 0===e.indexOf("mapbox:")}(e)||Xe(e))&&this.queueRequest({timestamp:Date.now()},t)}processRequests(){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.anonIdTimestamp&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const e=Am(We.ACCESS_TOKEN),t=e?e.u:We.ACCESS_TOKEN;let i=t!==this.eventData.tokenU;Ee(this.anonId)||(this.refreshUUID(),i=!0);const{timestamp:r,customAccessToken:n}=this.queue.shift();if(this.eventData.lastSuccess){const e=new Date(this.eventData.lastSuccess),t=new Date(r),n=(r-this.eventData.lastSuccess)/864e5;i=i||n>=1||n<-1||e.getDate()!==t.getDate()}else i=!0;i?this.postEvent(r,{version:"2.2",sdkIdentifier:"mapbox-gl-js",sdkVersion:Oe,skuId:"01","enabled.telemetry":!1,userId:this.anonId,bundleFormat:"csp",bundleDistribution:Im},e=>{e||(this.eventData.lastSuccess=r,this.eventData.tokenU=t)},n):this.processRequests()}},Dm=(Sm.postTurnstileEvent.bind(Sm),new class MapLoadEvent extends TelemetryEvent{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(e,t,i,r){this.skuToken=t,this.errorCb=r,We.EVENTS_URL&&(i||We.ACCESS_TOKEN?this.queueRequest({id:e,timestamp:Date.now()},i):this.errorCb(new Error(ym)))}processRequests(){if(this.pendingRequest||0===this.queue.length)return;const{id:e,timestamp:t,customAccessToken:i}=this.queue.shift();e&&this.success[e]||(this.anonId&&this.anonIdTimestamp||this.fetchEventData(),Ee(this.anonId)||this.refreshUUID(),this.postEvent(t,{version:"2.2",sdkIdentifier:"mapbox-gl-js",sdkVersion:Oe,skuId:"01",skuToken:this.skuToken,userId:this.anonId,bundleFormat:"csp",bundleDistribution:Im},t=>{t?this.errorCb(t):e&&(this.success[e]=!0)},i))}remove(){this.errorCb=null}});Dm.postMapLoadEvent.bind(Dm);const Pm=new class StyleLoadEvent extends TelemetryEvent{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(e){let t=this.mapInstanceIdMap.get(e);return t||(t=Ae(),this.mapInstanceIdMap.set(e,t)),t}getEventId(e){const t=this.eventIdPerMapInstanceMap.get(e)||0;return this.eventIdPerMapInstanceMap.set(e,t+1),t}postStyleLoadEvent(e,t){const{map:i,style:r,importedStyles:n}=t;if(!Em(e))return;const o=this.getMapInstanceId(i),a={mapInstanceId:o,eventId:this.getEventId(o),style:r};n.length&&(a.importedStyles=n),this.queueRequest({timestamp:Date.now(),payload:a},e)}processRequests(){if(this.pendingRequest||0===this.queue.length)return;const{timestamp:e,payload:t,customAccessToken:i}=this.queue.shift();this.postEvent(e,t,()=>{},i)}};Pm.postStyleLoadEvent.bind(Pm);const Tm=new MetricsEvent({attributes:[{name:"maps/js/layer-animations/style-with-appearances"}]});Tm.postMetricsEvent.bind(Tm);const zm=new MetricsEvent({attributes:[{name:"maps/js/layer-animations/runtime-appearances"}]});zm.postMetricsEvent.bind(zm);const Mm=new class PerformanceEvent extends TelemetryEvent{constructor(){super("gljs.performance")}postPerformanceEvent(e,t){Em(e)&&this.queueRequest({timestamp:Date.now(),performanceData:t},e)}processRequests(){if(this.pendingRequest||0===this.queue.length)return;const{timestamp:e,performanceData:t,customAccessToken:i}=this.queue.shift(),r=function(e){const t=performance.getEntriesByType("resource"),i=performance.getEntriesByType("mark"),r=function(e){const t={};if(e)for(const i in e)if("other"!==i)for(const r of e[i]){const e=`${i}ResolveRangeMin`,n=`${i}ResolveRangeMax`,o=`${i}RequestCount`,a=`${i}RequestCachedCount`;t[e]=Math.min(t[e]||1/0,r.startTime),t[n]=Math.max(t[n]||-1/0,r.responseEnd);const s=e=>{void 0===t[e]&&(t[e]=0),++t[e]};void 0!==r.transferSize&&0===r.transferSize&&s(a),s(o)}return t}(function(e,t){const i={};if(e)for(const r of e){const e=t(r);void 0===i[e]&&(i[e]=[]),i[e].push(r)}return i}(t,Ke)),n=window.devicePixelRatio,o=navigator.connection||navigator.mozConnection||navigator.webkitConnection,a=o?o.effectiveType:void 0,s={counters:[],metadata:[],attributes:[]},l=(e,t,i)=>{null!=i&&e.push({name:t,value:i.toString()})};for(const e in r)l(s.counters,e,r[e]);if(e.interactionRange[0]!==1/0&&e.interactionRange[1]!==-1/0&&(l(s.counters,"interactionRangeMin",e.interactionRange[0]),l(s.counters,"interactionRangeMax",e.interactionRange[1])),i)for(const e of Object.values(Je)){const t=i.find(t=>t.name===e);t&&l(s.counters,e,t.startTime)}return l(s.counters,"visibilityHidden",e.visibilityHidden),l(s.attributes,"style",function(e){if(e)for(const t of e){const e=t.name.split("?")[0];if(Ye(e)){const t=e.split("/").slice(-2);if(2===t.length)return`mapbox://styles/${t[0]}/${t[1]}`}}}(t)),l(s.attributes,"terrainEnabled",e.terrainEnabled?"true":"false"),l(s.attributes,"fogEnabled",e.fogEnabled?"true":"false"),l(s.attributes,"projection",e.projection),l(s.attributes,"zoom",e.zoom),l(s.metadata,"devicePixelRatio",n),l(s.metadata,"connectionEffectiveType",a),l(s.metadata,"navigatorUserAgent",navigator.userAgent),l(s.metadata,"screenWidth",window.screen.width),l(s.metadata,"screenHeight",window.screen.height),l(s.metadata,"windowWidth",window.innerWidth),l(s.metadata,"windowHeight",window.innerHeight),l(s.metadata,"mapWidth",e.width/n),l(s.metadata,"mapHeight",e.height/n),l(s.metadata,"webglRenderer",e.renderer),l(s.metadata,"webglVendor",e.vendor),l(s.metadata,"sdkVersion",Oe),l(s.metadata,"sdkIdentifier","mapbox-gl-js"),s}(t);for(const e of r.metadata);for(const e of r.counters);for(const e of r.attributes);this.postEvent(e,r,()=>{},i)}};Mm.postPerformanceEvent.bind(Mm);const Cm=new class MapSessionAPI extends TelemetryEvent{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(e,t,i,r){if(!We.API_URL||!We.SESSION_PATH)return;const n=vm(We.API_URL+We.SESSION_PATH);n.params.push(`sku=${t||""}`),n.params.push(`access_token=${r||We.ACCESS_TOKEN||""}`);const o={url:bm(n),headers:{"Content-Type":"text/plain"}};this.pendingRequest=!0,async function(e){return Qr(Object.assign(e,{method:"GET"}),void 0)}(o).then(()=>{this.pendingRequest=!1,i(null),this.saveEventData(),this.processRequests()}).catch(e=>{this.pendingRequest=!1,i(e),this.saveEventData(),this.processRequests()})}getSessionAPI(e,t,i,r){this.skuToken=t,this.errorCb=r,We.EVENTS_URL&&We.SESSION_PATH&&We.API_URL&&(i||We.ACCESS_TOKEN?this.queueRequest({id:e,timestamp:Date.now()},i):this.errorCb(new Error(ym)))}processRequests(){if(this.pendingRequest||0===this.queue.length)return;const{id:e,timestamp:t,customAccessToken:i}=this.queue.shift();e&&this.success[e]||this.getSession(t,this.skuToken,t=>{t?this.errorCb(t):e&&(this.success[e]=!0)},i)}remove(){this.errorCb=null}};Cm.getSessionAPI.bind(Cm);const Rm=function(e,t,i,r){const n=i.getSource();if(!n||"model"!==n.type)return{};const a=n,s={};s[e.id]=[];const l=s[e.id];let u=0;for(const n of a.models){const a=i.getFeatureState(e.sourceLayer,n.id),s={type:"Unknown",id:n.id,properties:n.featureProperties},c=e.paint.get("model-rotation").evaluate(s,a),h=e.paint.get("model-scale").evaluate(s,a),d=e.paint.get("model-translation").evaluate(s,a),p=e.paint.get("model-elevation-reference");let f=[];Gh(f,n,r,n.position,c,h,d,"ground"===p,"ground"===p,!1),"globe"===r.projection.name&&(f=Vh(f,r));const m=o([],r.projMatrix,f),_=kh(t.isPointQuery()?t.screenBounds:t.screenGeometry,r,m,n.aabb);if(null!=_){const t=new Feature(void 0,0,0,0,n.id);t.layer=e.layer,t.properties=structuredClone(n.featureProperties),t.properties.layer=e.id,t.properties.uri=n.uri,t.properties.orientation=n.orientation,t.sourceLayer=e.sourceLayer,t.geometry={type:"Point",coordinates:[n.position.lng,n.position.lat]},t.state=a,t.source=e.source,l.push({featureIndex:u,feature:t,intersectionZ:_})}++u}return s},Lm=function(e,t,i,r,n,a){if(!e.modelManager)return!1;const s=e.modelManager,l=t.tile.getBucket(e);if(!(l&&l instanceof ModelBucket))return!1;for(const r in l.instancesPerModel){const u=l.instancesPerModel[r],c=void 0!==i.id?i.id:i.properties&&Object.hasOwn(i.properties,"id")?i.properties.id:void 0;if(Object.hasOwn(u.idToFeaturesIndex,c)){const i=u.features[u.idToFeaturesIndex[c]],h=s.getModel(r,a||e.scope);if(!h)return!1;let d=[];const p=new LngLat(0,0),f=l.canonical;let m=Number.MAX_VALUE;for(let e=0;e<i.instancedDataCount;++e){const r=16*(i.instancedDataOffset+e),a=u.instancedDataArray.float32,s=[a[r+4],a[r+5],a[r+6]];Jf(f,p,Math.floor(a[r]),Math.floor(a[r+1])),Gh(d,h,n,p,i.rotation,i.scale,s,!1,!1,!1),"globe"===n.projection.name&&(d=Vh(d,n));const l=o([],n.projMatrix,d),c=t.queryGeometry,_=kh(c.isPointQuery()?c.screenBounds:c.screenGeometry,n,l,h.aabb);null!=_&&(m=Math.min(_,m))}return m!==Number.MAX_VALUE&&m}}return!1},Fm=function(e,t,i,r){const n=e.getNodesInfo()[t];if(!n||n.hiddenByReplacement||!n.node.meshes)return;let l=Number.MAX_VALUE;const u=n.node,c=i.tile,h=r.calculatePosMatrix(c.tileID.toUnwrapped(),r.worldSize),d=n.evaluatedScale;let p=0;r.elevation&&u.elevation&&(p=u.elevation*r.elevation.exaggeration()),a(h,h,[(u.anchor?u.anchor[0]:0)*(d[0]-1),(u.anchor?u.anchor[1]:0)*(d[1]-1),p]),s(h,h,d);const f=i.queryGeometry,m=f.isPointQuery()?f.screenBounds:f.screenGeometry,_=function(e){const t=o([],h,e.globalMatrix);o(t,r.expandedFarZProjMatrix,t);for(let i=0;i<e.meshes.length;++i){const n=e.meshes[i];if(i===e.lightMeshIndex)continue;const o=kh(m,r,t,n.aabb);null!=o&&(l=Math.min(o,l))}if(e.children)for(const t of e.children)_(t)};if(_(u),l===Number.MAX_VALUE)return;const g=new LngLat(0,0);return Jf(c.tileID.canonical,g,n.node.anchor[0],n.node.anchor[1]),{intersectionZ:l,position:g,feature:n.feature}};class FeatureIndex{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new GridIndex(Xt,Xt,512),this.featureIndexArray=new FeatureIndexArray,this.promoteId=t,this.is3DTile=!1,this.serializedLayersCache=new Map}insert(e,t,i,r,n,o=0,a=0){const s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,r,n,o);const l=this.grid;for(let e=0;e<t.length;e++){const i=t[e],r=[1/0,1/0,-1/0,-1/0];for(let e=0;e<i.length;e++){const t=i[e];r[0]=Math.min(r[0],t.x),r[1]=Math.min(r[1],t.y),r[2]=Math.max(r[2],t.x),r[3]=Math.max(r[3],t.y)}0!==a&&(r[0]-=a,r[1]-=a,r[2]+=a,r[3]+=a),r[0]<Xt&&r[1]<Xt&&r[2]>=0&&r[3]>=0&&l.insert(s,r[0],r[1],r[2],r[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new VectorTile(new PbfReader(this.rawTileData)).layers,this.sourceLayerCoder=new DictionaryCoder(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const e in this.vtLayers)this.vtFeatures[e]=[]}return this.vtLayers}query(e,t){const{tilespaceGeometry:i,transform:r,tileTransform:n,pixelPosMatrix:o,availableImages:a,worldview:s}=t;this.loadVTLayers(),this.serializedLayersCache.clear();const l=t.queryRadius?t.queryRadius:0,u=i.bufferedTilespaceBounds,c=this.grid.queryKeys(u.min.x,u.min.y,u.max.x,u.max.y,(e,t,r,n)=>{const o=function(e,t,i,r,n){for(const o of e)if(t<=o.x&&i<=o.y&&r>=o.x&&n>=o.y)return!0;const o=[new K(t,i),new K(t,n),new K(r,n),new K(r,i)];if(e.length>2)for(const t of o)if(ms(e,t))return!0;for(let t=0;t<e.length-1;t++)if(_s(e[t],e[t+1],o))return!0;return!1}(i.bufferedTilespaceGeometry,e-l,t-l,r+l,n+l);return o});c.sort(Om);let h=null;r.elevation&&c.length>0&&(h=DEMSampler.create(r.elevation,this.tileID));const d={};let p;for(let l=0;l<c.length;l++){const u=c[l];if(u===p)continue;p=u;const f=this.featureIndexArray.get(u);let m=null;this.is3DTile?this.loadMatchingModelFeature(d,f,e,i,r,s):this.loadMatchingFeature(d,f,e,a,s,(e,a,s,l=0)=>(m||(m=wa(e,this.tileID.canonical,n)),a.queryIntersectsFeature(i,e,s,m,this.z,r,o,h,l,t.scope)))}return d}loadMatchingFeature(e,t,i,r,n,o){const{featureIndex:a,bucketIndex:s,sourceLayerIndex:l,layoutVertexArrayOffset:u}=t,c=this.bucketLayerIDs[s],h=i.layers,d=Object.keys(h);if(d.length&&!Pe(d,c))return;const p=i.sourceCache,f=this.sourceLayerCoder.decode(l),m=this.vtLayers[f].feature(a),_=this.getId(m,f);for(let t=0;t<c.length;t++){const i=c[t];if(!h[i])continue;const{styleLayer:s,targets:l}=h[i];let d={};void 0!==_&&(d=p.getFeatureState(s.sourceLayer,_));const f=!o||o(m,s,d,u);if(!f)continue;const g=new Feature(m,this.z,this.x,this.y,_);g.tile=this.tileID.canonical,g.state=d;let y=this.serializedLayersCache.get(i);y||(y=s.serialize(),y.id=i,this.serializedLayersCache.set(i,y)),g.source=y.source,g.sourceLayer=y["source-layer"],g.layer={...y},g.layer.paint=Bm(y.paint,s.paint,m,d,r),g.layer.layout=Bm(y.layout,s.layout,m,d,r);const x=new EvaluationParameters(this.tileID.overscaledZ,{worldview:n});let v=!1;for(const e of l){this.updateFeatureProperties(g,e);const{filter:t}=e;if(t)if(m.properties=g.properties,t.needGeometry){const e=Aa(m,!0);if(!t.filter(x,e,this.tileID.canonical))continue}else if(!t.filter(x,m))continue;v=!0,e.targetId&&this.addFeatureVariant(g,e)}v&&this.appendToResult(e,i,a,g,f)}}loadMatchingModelFeature(e,t,i,r,n,o){const{featureIndex:a,bucketIndex:s}=t,l=this.bucketLayerIDs[s],u=i.layers,c=Object.keys(u);if(!c.length||Pe(c,l))for(let t=0;t<l.length;t++){const s=l[t],{styleLayer:c,targets:h}=u[s];if("model"!==c.type)continue;const d=r.tile,p=d.getBucket(c);if(!p||!p.isTiled3dModelBucket)continue;if(!Fm)continue;const f=Fm(p,a,r,n);if(!f)continue;const{z:m,x:_,y:g}=d.tileID.canonical,{feature:y,intersectionZ:x,position:v}=f;let b={};void 0!==y.id&&(b=i.sourceCache.getFeatureState(c.sourceLayer,y.id));const w=new Feature({},m,_,g,y.id);w.tile=this.tileID.canonical,w.state=b,w.properties=y.properties,w.geometry={type:"Point",coordinates:[v.lng,v.lat]};let A=this.serializedLayersCache.get(s);A||(A=c.serialize(),A.id=s,this.serializedLayersCache.set(s,A)),w.source=A.source,w.sourceLayer=A["source-layer"],w.layer={...A};const E=new EvaluationParameters(this.tileID.overscaledZ,{worldview:o});let I=!1;for(const e of h){this.updateFeatureProperties(w,e);const{filter:t}=e;if(t)if(y.properties=w.properties,t.needGeometry){if(!t.filter(E,y,this.tileID.canonical))continue}else if(!t.filter(E,y))continue;I=!0,e.targetId&&this.addFeatureVariant(w,e)}I&&this.appendToResult(e,s,a,w,x)}}updateFeatureProperties(e,t,i){if(t.properties){const r={};for(const n in t.properties){const o=t.properties[n].evaluate({zoom:this.z},e._vectorTileFeature,e.state,e.tile,i);null!=o&&(r[n]=o)}e.properties=r}}addFeatureVariant(e,t,i){const r={target:t.target,namespace:t.namespace,uniqueFeatureID:t.uniqueFeatureID};t.properties&&(r.properties=e.properties),e.variants=e.variants||{},e.variants[t.targetId]=e.variants[t.targetId]||[],e.variants[t.targetId].push(r)}appendToResult(e,t,i,r,n){let o=e[t];void 0===o&&(o=e[t]=[]),o.push({featureIndex:i,feature:r,intersectionZ:n})}lookupSymbolFeatures(e,t,i,r,n,o){const a={};this.loadVTLayers();for(const s of e)this.loadMatchingFeature(a,{bucketIndex:t,sourceLayerIndex:i,featureIndex:s,layoutVertexArrayOffset:0},r,n,o);return a}loadFeature(e){const{featureIndex:t,sourceLayerIndex:i}=e;this.loadVTLayers();const r=this.sourceLayerCoder.decode(i),n=this.vtFeatures[r];if(n[t])return n[t];const o=this.vtLayers[r].feature(t);return n[t]=o,o}hasLayer(e){for(const t of this.bucketLayerIDs)for(const i of t)if(e===i)return!0;return!1}getId(e,t){let i=e.id;if(this.promoteId){const r=Array.isArray(this.promoteId)||"object"!=typeof this.promoteId?this.promoteId:this.promoteId[t];if(null!=r)if(Array.isArray(r)){if(!this.promoteIdExpression){const e=Ur(r);if("success"!==e.result){const t=e.value.map(e=>`${e.key}: ${e.message}`).join(", ");return void ze(`Failed to create expression for promoteId: ${t}`)}this.promoteIdExpression=e.value}i=this.promoteIdExpression.evaluate({zoom:0},e)}else i=e.properties[r];"boolean"==typeof i&&(i=Number(i))}return i}}function Bm(e,t,i,r,n){return Se(e,(e,o)=>{const a=t instanceof PossiblyEvaluated?t.get(o):null;return a&&a.evaluate?a.evaluate(i,r,void 0,n):a})}function Om(e,t){return t-e}rn(FeatureIndex,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});class Tiled3dWorkerTile{constructor(e,t,i){this.tileID=new OverscaledTileID(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.tileZoom=e.tileZoom,this.uid=e.uid,this.zoom=e.zoom,this.canonical=e.tileID.canonical,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=e.projection,this.brightness=t,this.worldview=i}async parse(e,t,i){this.status="parsing";const r=new OverscaledTileID(i.tileID.overscaledZ,i.tileID.wrap,i.tileID.canonical.z,i.tileID.canonical.x,i.tileID.canonical.y),n=[],o=t.familiesBySource[i.source],a=new FeatureIndex(r,i.promoteId);a.bucketLayerIDs=[],a.is3DTile=!0;const s=await function(e){let t=0;if(new Uint32Array(e,0,1)[0]!==xh){const i=new Uint32Array(e,0,7),[,,r,n,o,a]=i;t=i.byteLength+n+o+a+o,(r!==e.byteLength||t>=e.byteLength)&&ze("Invalid b3dm header information.")}return Ih(e,t)}(e),l=s.json.extensionsUsed&&s.json.extensionsUsed.includes("MAPBOX_mesh_features")||s.json.asset.extras&&s.json.asset.extras.MAPBOX_mesh_features,u=s.json.extensionsUsed&&s.json.extensionsUsed.includes("EXT_meshopt_compression"),c=new EvaluationParameters(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(const e in o)for(const t of o[e]){const e=t[0];a.bucketLayerIDs.push(t.map(e=>go(e.id,e.scope))),e.recalculate(c,[]);const o=ud(s,1/fa(i.tileID.canonical)),h=new Tiled3dModelBucket(t,o,r,l,u,this.brightness,a,this.worldview);n.push(h),h.evaluate(e)}return this.status="done",{buckets:n,featureIndex:a,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null}}}class Tiled3dModelWorkerSource{constructor({actor:e,layerIndex:t,availableImages:i,availableModels:r,brightness:n,worldview:o}){this.actor=e,this.layerIndex=t,this.availableImages=i,this.availableModels=r,this.brightness=n,this.loading={},this.loaded={},this.worldview=o}async loadTile(e){const t=e.uid,i=new AbortController,r=this.loading[t]=new Tiled3dWorkerTile(e,this.brightness,this.worldview);r.abort=()=>i.abort();const n=(e,t)=>{const i=r.reloadCallback;i&&(delete r.reloadCallback,i(e,t))};let o;try{o=(await en(e.request,i.signal)).data}catch(e){if(delete this.loading[t],r.status="done",this.loaded[t]=r,i.signal.aborted)return null;throw e}if(delete this.loading[t],!o||0===o.byteLength)return r.status="done",this.loaded[t]=r,null;try{const i=await r.parse(o,this.layerIndex,e);return this.loaded[t]=r,n(null,i),i}catch(e){throw this.loaded[t]=r,n(e),e}}async reloadTile(e){const t=this.loaded&&this.loaded[e.uid];if(t)return t.projection=e.projection,t.brightness=e.brightness,"parsing"===t.status&&await new Promise((e,i)=>{t.reloadCallback=t=>{t?i(t):e()}}),this.loadTile(e)}abortTile(e){const t=e.uid,i=this.loading[t];i&&(i.abort&&i.abort(),delete this.loading[t])}removeTile(e){const t=this.loaded,i=e.uid;t&&t[i]&&delete t[i]}}async function Vm(){return Promise.resolve()}const km={circle:class CircleStyleLayer extends StyleLayer{constructor(e,t,i,r){super(e,{layout:dp||(dp=new Properties({"circle-sort-key":new DataDrivenProperty(to.layout_circle["circle-sort-key"]),"circle-elevation-reference":new DataConstantProperty(to.layout_circle["circle-elevation-reference"]),visibility:new DataConstantProperty(to.layout_circle.visibility)})),paint:pp||(pp=new Properties({"circle-radius":new DataDrivenProperty(to.paint_circle["circle-radius"]),"circle-color":new DataDrivenProperty(to.paint_circle["circle-color"]),"circle-blur":new DataDrivenProperty(to.paint_circle["circle-blur"]),"circle-opacity":new DataDrivenProperty(to.paint_circle["circle-opacity"]),"circle-translate":new DataConstantProperty(to.paint_circle["circle-translate"]),"circle-translate-anchor":new DataConstantProperty(to.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new DataConstantProperty(to.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new DataConstantProperty(to.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new DataDrivenProperty(to.paint_circle["circle-stroke-width"]),"circle-stroke-color":new DataDrivenProperty(to.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new DataDrivenProperty(to.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new DataConstantProperty(to.paint_circle["circle-emissive-strength"]),"circle-color-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"}),"circle-stroke-color-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r)}createBucket(e){return new CircleBucket(e)}queryRadius(e){const t=e;return Lp("circle-radius",this,t)+Lp("circle-stroke-width",this,t)+Fp(this.paint.get("circle-translate"))}queryIntersectsFeature(e,t,i,r,n,o,a,s){const l=Op(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),u=this.paint.get("circle-radius").evaluate(t,i)+this.paint.get("circle-stroke-width").evaluate(t,i);return Vp(e,r,o,a,s,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),l,u)}getProgramIds(){return["circle"]}getDefaultProgramParams(e,t,i){const r=(e=>{const t=[];return"map"===e.paint.get("circle-pitch-alignment")&&t.push("PITCH_WITH_MAP"),"map"===e.paint.get("circle-pitch-scale")&&t.push("SCALE_WITH_MAP"),t})(this);return{config:new ProgramConfiguration(this,{zoom:t,lut:i}),defines:r,overrideFog:!1}}is3D(e){return!e&&!!this.layout&&"none"!==this.layout.get("circle-elevation-reference")}hasElevation(){return this.layout&&"none"!==this.layout.get("circle-elevation-reference")}mayUse(e){return"HD"===e&&So(this,"circle-elevation-reference",e=>"hd-road-markup"===e)}prepare(){return this.mayUse("HD")?Rp():Promise.resolve()}},heatmap:class HeatmapStyleLayer extends StyleLayer{createBucket(e){return new HeatmapBucket(e)}constructor(e,t,i,r){super(e,{layout:jp||(jp=new Properties({visibility:new DataConstantProperty(to.layout_heatmap.visibility)})),paint:Hp||(Hp=new Properties({"heatmap-radius":new DataDrivenProperty(to.paint_heatmap["heatmap-radius"]),"heatmap-weight":new DataDrivenProperty(to.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new DataConstantProperty(to.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ColorRampProperty(to.paint_heatmap["heatmap-color"]),"heatmap-opacity":new DataConstantProperty(to.paint_heatmap["heatmap-opacity"]),"heatmap-color-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"heatmap-color"===e&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Wp({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(e){return Lp("heatmap-radius",this,e)}queryIntersectsFeature(e,t,i,r,n,o,a,s){const l=this.paint.get("heatmap-radius").evaluate(t,i);return Vp(e,r,o,a,s,!0,!0,new K(0,0),l)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(e,t,i){return"heatmap"===e?{config:new ProgramConfiguration(this,{zoom:t,lut:i}),overrideFog:!1}:{}}},hillshade:class HillshadeStyleLayer extends StyleLayer{constructor(e,t,i,r){super(e,{layout:Xp||(Xp=new Properties({visibility:new DataConstantProperty(to.layout_hillshade.visibility)})),paint:qp||(qp=new Properties({"hillshade-illumination-direction":new DataConstantProperty(to.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new DataConstantProperty(to.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new DataConstantProperty(to.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new DataConstantProperty(to.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new DataConstantProperty(to.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new DataConstantProperty(to.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new DataConstantProperty(to.paint_hillshade["hillshade-emissive-strength"]),"hillshade-shadow-color-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"}),"hillshade-highlight-color-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"}),"hillshade-accent-color-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r)}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(e,t,i){return{overrideFog:!1}}},fill:class FillStyleLayer extends StyleLayer{constructor(e,t,i,r){super(e,{layout:Zp||(Zp=new Properties({"fill-sort-key":new DataDrivenProperty(to.layout_fill["fill-sort-key"]),visibility:new DataConstantProperty(to.layout_fill.visibility),"fill-elevation-reference":new DataConstantProperty(to.layout_fill["fill-elevation-reference"]),"fill-construct-bridge-guard-rail":new DataDrivenProperty(to.layout_fill["fill-construct-bridge-guard-rail"])})),paint:Yp||(Yp=new Properties({"fill-antialias":new DataConstantProperty(to.paint_fill["fill-antialias"]),"fill-opacity":new DataDrivenProperty(to.paint_fill["fill-opacity"]),"fill-color":new DataDrivenProperty(to.paint_fill["fill-color"]),"fill-outline-color":new DataDrivenProperty(to.paint_fill["fill-outline-color"]),"fill-translate":new DataConstantProperty(to.paint_fill["fill-translate"]),"fill-translate-anchor":new DataConstantProperty(to.paint_fill["fill-translate-anchor"]),"fill-pattern":new DataDrivenProperty(to.paint_fill["fill-pattern"]),"fill-pattern-cross-fade":new DataConstantProperty(to.paint_fill["fill-pattern-cross-fade"]),"fill-emissive-strength":new DataConstantProperty(to.paint_fill["fill-emissive-strength"]),"fill-z-offset":new DataDrivenProperty(to.paint_fill["fill-z-offset"]),"fill-bridge-guard-rail-color":new DataDrivenProperty(to.paint_fill["fill-bridge-guard-rail-color"]),"fill-tunnel-structure-color":new DataDrivenProperty(to.paint_fill["fill-tunnel-structure-color"]),"fill-color-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"}),"fill-outline-color-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"}),"fill-bridge-guard-rail-color-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"}),"fill-tunnel-structure-color-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r)}getProgramIds(){const e=this.paint.get("fill-pattern"),t=e&&e.constantOr(1),i=[t?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&i.push(t&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),i}getDefaultProgramParams(e,t,i){return{config:new ProgramConfiguration(this,{zoom:t,lut:i}),overrideFog:!1}}recalculate(e,t){super.recalculate(e,t);const i=this.paint._values["fill-outline-color"];"constant"===i.value.kind&&void 0===i.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new FillBucket(e)}queryRadius(){return Fp(this.paint.get("fill-translate"))}queryIntersectsFeature(e,t,i,r,n,o){return!e.queryGeometry.isAboveHorizon&&as(Bp(e.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),r)}isTileClipped(){return 0===this.paint.get("fill-z-offset").constantOr(1)}is3D(e){if(0!==this.paint.get("fill-z-offset").constantOr(1))return!0;const t=this.layout&&"none"!==this.layout.get("fill-elevation-reference");return null!=e?t&&!e:t}hasElevation(){return this.layout&&"none"!==this.layout.get("fill-elevation-reference")}mayUse(e){return"HD"===e&&So(this,"fill-elevation-reference",e=>"none"!==e)}prepare(){return this.mayUse("HD")?Rp():Promise.resolve()}hasShadowPass(){return this.layout&&"none"!==this.layout.get("fill-elevation-reference")}},"fill-extrusion":class FillExtrusionStyleLayer extends StyleLayer{constructor(e,t,i,r){super(e,{layout:Qp||(Qp=new Properties({visibility:new DataConstantProperty(to["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new DataConstantProperty(to["layout_fill-extrusion"]["fill-extrusion-edge-radius"]),"source-max-zoom":new DataConstantProperty(to["layout_fill-extrusion"]["source-max-zoom"])})),paint:ef||(ef=new Properties({"fill-extrusion-opacity":new DataConstantProperty(to["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new DataDrivenProperty(to["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new DataConstantProperty(to["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new DataConstantProperty(to["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new DataDrivenProperty(to["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-pattern-cross-fade":new DataConstantProperty(to["paint_fill-extrusion"]["fill-extrusion-pattern-cross-fade"]),"fill-extrusion-height":new DataDrivenProperty(to["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new DataDrivenProperty(to["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new DataConstantProperty(to["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new DataConstantProperty(to["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new DataConstantProperty(to["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new DataConstantProperty(to["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new DataConstantProperty(to["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new DataConstantProperty(to["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new DataConstantProperty(to["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new DataConstantProperty(to["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new DataConstantProperty(to["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new DataConstantProperty(to["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new DataDrivenProperty(to["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new DataDrivenProperty(to["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new DataConstantProperty(to["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new DataConstantProperty(to["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new DataConstantProperty(to["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new DataConstantProperty(to["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-front-cutoff":new DataConstantProperty(to["paint_fill-extrusion"]["fill-extrusion-front-cutoff"]),"fill-extrusion-emissive-strength":new DataDrivenProperty(to["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new DataDrivenProperty(to["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new DataConstantProperty(to["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]),"fill-extrusion-color-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"}),"fill-extrusion-flood-light-color-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(e){return new FillExtrusionBucket(e)}queryRadius(){return Fp(this.paint.get("fill-extrusion-translate"))}is3D(e){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(e,t,i,r,n,o,a,s,l){const u=Op(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),c=this.paint.get("fill-extrusion-height").evaluate(t,i),h=this.paint.get("fill-extrusion-base").evaluate(t,i),d=[0,0],p=s&&o.elevation,f=o.elevation?o.elevation.exaggeration():1,m=e.tile.getBucket(this);if(m instanceof FillExtrusionBucket){const e=m.centroidData.find(e=>l>=e.vertexArrayOffset&&l<e.vertexArrayOffset+e.vertexCount);if(e&&e.flags&Nd)return!1;if(p){const e=m.centroidVertexArray,t=l+1;t<e.length&&(d[0]=e.geta_centroid_pos0(t),d[1]=e.geta_centroid_pos1(t))}}if(0===d[0]&&1===d[1])return!1;"globe"===o.projection.name&&(r=op([r],[new K(0,0),new K(Xt,Xt)],e.tileID.canonical).map(e=>e.polygon).flat());const _=p?s:null,[g,y]=cf(o,r,h,c,u,a,_,d,f,o.center.lat,e.tileID.canonical),x=e.queryGeometry;return uf(g,y,x.isPointQuery()?x.screenBounds:x.screenGeometry)}},building:class BuildingStyleLayer extends StyleLayer{constructor(e,t,i,r){super(e,{layout:tf||(tf=new Properties({visibility:new DataConstantProperty(to.layout_building.visibility),"building-facade":new DataDrivenProperty(to.layout_building["building-facade"]),"building-facade-floors":new DataDrivenProperty(to.layout_building["building-facade-floors"]),"building-facade-unit-width":new DataDrivenProperty(to.layout_building["building-facade-unit-width"]),"building-facade-window":new DataDrivenProperty(to.layout_building["building-facade-window"]),"building-roof-shape":new DataDrivenProperty(to.layout_building["building-roof-shape"]),"building-height":new DataDrivenProperty(to.layout_building["building-height"]),"building-base":new DataDrivenProperty(to.layout_building["building-base"]),"building-flood-light-wall-radius":new DataDrivenProperty(to.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new DataDrivenProperty(to.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new DataDrivenProperty(to.layout_building["building-flip-roof-orientation"])})),paint:rf||(rf=new Properties({"building-opacity":new DataConstantProperty(to.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new DataConstantProperty(to.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new DataConstantProperty(to.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new DataConstantProperty(to.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new DataConstantProperty(to.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new DataConstantProperty(to.paint_building["building-vertical-scale"]),"building-cast-shadows":new DataConstantProperty(to.paint_building["building-cast-shadows"]),"building-color":new DataDrivenProperty(to.paint_building["building-color"]),"building-emissive-strength":new DataDrivenProperty(to.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new DataConstantProperty(to.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new DataConstantProperty(to.paint_building["building-cutoff-fade-range"]),"building-front-cutoff":new DataConstantProperty(to.paint_building["building-front-cutoff"]),"building-flood-light-color":new DataConstantProperty(to.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new DataConstantProperty(to.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new DataConstantProperty(to.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}mayUse(e){return"HD"===e}prepare(){return async function(){return function(){if(!Ce(self))return null;if(null!=_p||null!=mp)return null;if(null!=fp)return fp;const e=fetch(new URL(We.BUILDING_GEN_URL,We.API_URL).href);return fp=function(e){let t,i,r,n,o;function a(){t=new Uint8Array(o.buffer),i=new Int16Array(o.buffer),r=new Int32Array(o.buffer),n=new Float32Array(o.buffer)}function s(){throw new Error("Unexpected BuildingGen error.")}const l=()=>{},u={a:{a:s,f:function(e){const i=t.length,r=Math.max(e>>>0,Math.ceil(1.2*i)),n=Math.ceil((r-i)/65536);try{return o.grow(n),a(),!0}catch(e){return!1}},g:s,b:l,c:l,d:l,e:l}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(e,u):e.then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,u))).then(e=>{const s=e.instance.exports;return(0,s.g)(),o=s.f,a(),new BuildingGen({setStyle:s.h,setAOOptions:s.i,setMetricOptions:s.j,setStructuralOptions:s.k,setFacadeOptions:s.l,setFauxFacadeOptions:s.m,setFacadeClassifierOptions:s.n,addFeature:s.o,addFacade:s.p,generateMesh:s.q,getLastError:s.r,getOuterRingLength:s.s,getMeshCount:s.t,getPositionsPtr:s.u,getPositionsLength:s.v,getNormalsPtr:s.w,getNormalsLength:s.x,getAOPtr:s.y,getAOLength:s.z,getUVPtr:s.A,getUVLength:s.B,getFauxFacadePtr:s.C,getFauxFacadeLength:s.D,getIndicesPtr:s.E,getIndicesLength:s.F,getBuildingPart:s.G,getRingCount:s.H,getRingPtr:s.I,getRingLength:s.J,malloc:s.K,free:s.L,heapU8:t,heap16:i,heap32:r,heapF32:n})})}(e).then(e=>{fp=null,_p=e}).catch(e=>{ze("Could not load building-gen"),fp=null,mp=e}),fp}()}()}createBucket(e){return new BuildingBucket(e)}cutoffRange(){return this.paint.get("building-cutoff-fade-range")}hasShadowPass(){return this.paint.get("building-cast-shadows")}hasLightBeamPass(){return!0}canCastShadows(){return!0}is3D(e){return!0}queryRadius(e){return 0}queryIntersectsFeature(e,t,i,r,n,o,a,s,l,u){let c=this.layout.get("building-height").evaluate(t,i);const h=this.layout.get("building-base").evaluate(t,i),d=e.tile.getBucket(this).getFootprint(t);if(d){if(0!==d.hiddenFlags)return!1;c=d.height}const[p,f]=cf(o,r,h,c,new K(0,0),a,null,[0,0],1,o.center.lat,e.tileID.canonical),m=e.queryGeometry;return uf(p,f,m.isPointQuery()?m.screenBounds:m.screenGeometry)}},line:class LineStyleLayer extends StyleLayer{constructor(e,t,i,r){const n=df();super(e,n,t,i,r),n.layout&&(this.layout=new PossiblyEvaluated(n.layout)),this.gradientVersion=0,this.borderGradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1,this.lineBlendFbos=null,this.lineBlendDensityReadback=null}_handleSpecialPaintPropertyUpdate(e){if("line-gradient"===e){const e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof Step,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}else if("line-gradient-use-theme"===e)this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER;else if("line-border-gradient"===e){const e=this._transitionablePaint._values["line-border-gradient"].value.expression;this.borderStepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof Step,this.borderGradientVersion=(this.borderGradientVersion+1)%Number.MAX_SAFE_INTEGER}else"line-border-gradient-use-theme"===e&&(this.borderGradientVersion=(this.borderGradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}borderGradientExpression(){return this._transitionablePaint._values["line-border-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}emissiveStrengthExpression(){return this._transitionablePaint._values["line-emissive-strength"].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values["line-floorwidth"]=(()=>{if(pf)return pf;const e=df();return pf=new LineFloorwidthProperty(e.paint.properties["line-width"].specification),pf.useIntegerZoom=!0,pf})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new LineBucket(e)}getProgramIds(){const e=[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"];return"default"!==this.paint.get("line-blend-mode")&&e.push("lineBlendComposite"),e}getDefaultProgramParams(e,t,i){if("lineBlendComposite"===e)return{};const r=(e=>{const t=[];(function(e){const t=e.paint.get("line-dasharray").value;return"constant"!==t.kind||t.value})(e)&&t.push("RENDER_LINE_DASH"),e.paint.get("line-gradient")&&t.push("RENDER_LINE_GRADIENT"),"multiply"===e.paint.get("line-blend-mode")&&t.push("LINE_BLEND_MULTIPLY"),"additive"===e.paint.get("line-blend-mode")&&t.push("LINE_BLEND_ADDITIVE");const i=e.paint.get("line-trim-offset");0===i[0]&&0===i[1]||t.push("RENDER_LINE_TRIM_OFFSET");const r=0!==e.paint.get("line-border-width").constantOr(1);r&&t.push("RENDER_LINE_BORDER"),r&&e.paint.get("line-border-gradient")&&t.push("RENDER_LINE_BORDER_GRADIENT");const n="none"===e.layout.get("line-join").constantOr("miter"),o=!!e.paint.get("line-pattern").constantOr(1);return n&&o&&t.push("LINE_JOIN_NONE"),t})(this);return{config:new ProgramConfiguration(this,{zoom:t,lut:i}),defines:r,overrideFog:!1}}queryRadius(e){const t=e,i=gf(Lp("line-width",this,t),Lp("line-gap-width",this,t)),r=Lp("line-offset",this,t);return i/2+Math.abs(r)+Fp(this.paint.get("line-translate"))}queryIntersectsFeature(e,t,i,r,n,o){if(e.queryGeometry.isAboveHorizon)return!1;const a=Bp(e.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),s=e.pixelToTileUnitsFactor/2*gf(this.paint.get("line-width").evaluate(t,i),this.paint.get("line-gap-width").evaluate(t,i)),l=this.paint.get("line-offset").evaluate(t,i);return l&&(r=function(e,t){const i=[],r=new K(0,0);for(let n=0;n<e.length;n++){const o=e[n],a=[];for(let e=0;e<o.length;e++){const i=o[e],n=o[e+1],s=0===e?r:i.sub(o[e-1])._unit()._perp(),l=e===o.length-1?r:n.sub(i)._unit()._perp(),u=s._add(l)._unit();u._mult(1/(u.x*l.x+u.y*l.y)),a.push(u._mult(t)._add(i))}i.push(a)}return i}(r,l*e.pixelToTileUnitsFactor)),function(e,t,i){for(let r=0;r<t.length;r++){const n=t[r];if(e.length>=3)for(let t=0;t<n.length;t++)if(ms(e,n[t]))return!0;if(ss(e,n,i))return!0}return!1}(a,r,s)}isTileClipped(){return this.hasNonElevatedBuckets}isDraped(e){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")}mayUse(e){return"HD"===e?So(this,"line-elevation-reference",e=>"hd-road-markup"===e):"Lite"===e&&function(e){if(!e._unevaluatedLayout)return!1;const t=e._unevaluatedLayout.getValue("line-elevation-reference");if(void 0!==t&&("string"!=typeof t||"none"!==t))return!0;const i=e._unevaluatedLayout.getValue("line-z-offset");return void 0!==i&&("number"!=typeof i||0!==i)}(this)}prepare(){return this.mayUse("HD")?Rp():Promise.resolve()}hasOffscreenPass(){return"default"!==this.paint.get("line-blend-mode")&&0!==this.paint.get("line-opacity").constantOr(1)&&0!==this.paint.get("line-width").constantOr(1)&&"none"!==this.visibility}resize(){this._destroyLineBlendFbo()}onRemove(e){this._destroyLineBlendFbo(e.painter&&e.painter.context&&e.painter.context.gl||void 0)}_clear(){this._destroyLineBlendFbo()}_destroyLineBlendFbo(e){this.lineBlendFbos&&(this.lineBlendFbos.destroy(),this.lineBlendFbos=null),e&&this.lineBlendDensityReadback&&this.lineBlendDensityReadback.destroy(e),this.lineBlendDensityReadback=null}},symbol:SymbolStyleLayer,background:class BackgroundStyleLayer extends StyleLayer{constructor(e,t,i,r){super(e,{layout:wf||(wf=new Properties({visibility:new DataConstantProperty(to.layout_background.visibility)})),paint:Af||(Af=new Properties({"background-pitch-alignment":new DataConstantProperty(to.paint_background["background-pitch-alignment"]),"background-color":new DataConstantProperty(to.paint_background["background-color"]),"background-pattern":new DataConstantProperty(to.paint_background["background-pattern"]),"background-opacity":new DataConstantProperty(to.paint_background["background-opacity"]),"background-emissive-strength":new DataConstantProperty(to.paint_background["background-emissive-strength"]),"background-color-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(e,t,i){return{overrideFog:!1}}is3D(e){return"viewport"===this.paint.get("background-pitch-alignment")}},raster:class RasterStyleLayer extends StyleLayer{constructor(e,t,i,r){super(e,{layout:Ef||(Ef=new Properties({visibility:new DataConstantProperty(to.layout_raster.visibility)})),paint:If||(If=new Properties({"raster-opacity":new DataConstantProperty(to.paint_raster["raster-opacity"]),"raster-color":new ColorRampProperty(to.paint_raster["raster-color"]),"raster-color-mix":new DataConstantProperty(to.paint_raster["raster-color-mix"]),"raster-color-range":new DataConstantProperty(to.paint_raster["raster-color-range"]),"raster-color-scale":new DataConstantProperty(to.paint_raster["raster-color-scale"]),"raster-hue-rotate":new DataConstantProperty(to.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new DataConstantProperty(to.paint_raster["raster-brightness-min"]),"raster-brightness-max":new DataConstantProperty(to.paint_raster["raster-brightness-max"]),"raster-saturation":new DataConstantProperty(to.paint_raster["raster-saturation"]),"raster-contrast":new DataConstantProperty(to.paint_raster["raster-contrast"]),"raster-resampling":new DataConstantProperty(to.paint_raster["raster-resampling"]),"raster-fade-duration":new DataConstantProperty(to.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new DataConstantProperty(to.paint_raster["raster-emissive-strength"]),"raster-array-band":new DataConstantProperty(to.paint_raster["raster-array-band"]),"raster-elevation":new DataConstantProperty(to.paint_raster["raster-elevation"]),"raster-elevation-reference":new DataConstantProperty(to.paint_raster["raster-elevation-reference"]),"raster-color-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r),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(e){const t=e?e._source:null;return(!t||"image"!==t.type&&"video"!==t.type&&"canvas"!==t.type||!t.onNorthPole&&!t.onSouthPole)&&0===this.paint.get("raster-elevation")}_handleSpecialPaintPropertyUpdate(e){"raster-color"!==e&&"raster-color-range"!==e&&"raster-color-scale"!==e||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}updateColorRamp(e){if(!this.hasColorMap())return;if(!this._curRampRange)return;const t=this._transitionablePaint._values["raster-color"].value.expression,[i,r]=e||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];if(isNaN(i)&&isNaN(r))return;if(i===this._curRampRange[0]&&r===this._curRampRange[1])return;const n=this._transitionablePaint._values["raster-color-scale"].value.expression.evaluate({zoom:0});this.colorRamp=Wp({expression:t,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:i,end:r}],resolution:1024,scale:n}),this.colorRampTexture=null,this._curRampRange=[i,r]}is3D(e){return this.paint.get("raster-elevation")>0}},"raster-particle":class RasterParticleStyleLayer extends StyleLayer{constructor(e,t,i,r){super(e,{layout:Sf||(Sf=new Properties({visibility:new DataConstantProperty(to["layout_raster-particle"].visibility)})),paint:Df||(Df=new Properties({"raster-particle-array-band":new DataConstantProperty(to["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new DataConstantProperty(to["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new ColorRampProperty(to["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new DataConstantProperty(to["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new DataConstantProperty(to["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new DataConstantProperty(to["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new DataConstantProperty(to["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new DataConstantProperty(to["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r),this._updateColorRamp(),this.lastInvalidatedAt=$e.now()}mayUse(e){return"HD"===e}_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(e){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(e){return!1}_handleSpecialPaintPropertyUpdate(e){"raster-particle-color"!==e&&"raster-particle-max-speed"!==e||(this._updateColorRamp(),this._invalidateAnimationState()),"raster-particle-count"===e&&this._invalidateAnimationState()}_updateColorRamp(){if(!this.hasColorMap())return;const e=this._transitionablePaint._values["raster-particle-color"].value.expression,t=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=Wp({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:t}],resolution:256}),this.colorRampTexture=null}_invalidateAnimationState(){this.lastInvalidatedAt=$e.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}},sky:class SkyLayer extends StyleLayer{constructor(e,t,i,r){super(e,{layout:Pf||(Pf=new Properties({visibility:new DataConstantProperty(to.layout_sky.visibility)})),paint:Tf||(Tf=new Properties({"sky-type":new DataConstantProperty(to.paint_sky["sky-type"]),"sky-atmosphere-sun":new DataConstantProperty(to.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new DataConstantProperty(to.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new DataConstantProperty(to.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new DataConstantProperty(to.paint_sky["sky-gradient-radius"]),"sky-gradient":new ColorRampProperty(to.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new DataConstantProperty(to.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new DataConstantProperty(to.paint_sky["sky-atmosphere-color"]),"sky-opacity":new DataConstantProperty(to.paint_sky["sky-opacity"]),"sky-gradient-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r),this._updateColorRamp()}_clear(){this.skyboxFbo&&(this.skyboxFbo.destroy(),this.skyboxFbo=null),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this._skyboxInvalidated=!0}_handleSpecialPaintPropertyUpdate(e){"sky-gradient"===e?this._updateColorRamp():"sky-atmosphere-sun"!==e&&"sky-atmosphere-halo-color"!==e&&"sky-atmosphere-color"!==e&&"sky-atmosphere-sun-intensity"!==e||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=Wp({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(e){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const t=e.style.light.properties.get("position");return this._lightPosition.azimuthal!==t.azimuthal||this._lightPosition.polar!==t.polar}return!1}getCenter(e,t){if("atmosphere"===this.paint.get("sky-type")){const i=this.paint.get("sky-atmosphere-sun"),r=!i,n=e.style.light,o=n.properties.get("position");return r&&"viewport"===n.properties.get("anchor")&&ze("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),r?Lf(o.azimuthal,90-o.polar,t):Lf(i[0],90-i[1],t)}const i=this.paint.get("sky-gradient-center");return Lf(i[0],90-i[1],t)}isSky(){return!0}markSkyboxValid(e){this._skyboxInvalidated=!1,this._lightPosition=e.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const e=this.paint.get("sky-type");return"atmosphere"===e?["skyboxCapture","skybox"]:"gradient"===e?["skyboxGradient"]:null}},slot:class SlotStyleLayer extends StyleLayer{constructor(e,t,i,r){super(e,{paint:zf||(zf=new Properties({}))},t,null)}},"placement-group":class PlacementGroupStyleLayer extends StyleLayer{constructor(e,t,i,r){super(e,{paint:Mf||(Mf=new Properties({}))},t,i,r)}},model:class ModelStyleLayer extends StyleLayer{constructor(e,t,i,r){super(e,{layout:Cf||(Cf=new Properties({visibility:new DataConstantProperty(to.layout_model.visibility),"model-id":new DataDrivenProperty(to.layout_model["model-id"]),"model-allow-density-reduction":new DataConstantProperty(to.layout_model["model-allow-density-reduction"])})),paint:Rf||(Rf=new Properties({"model-opacity":new DataDrivenProperty(to.paint_model["model-opacity"]),"model-rotation":new DataDrivenProperty(to.paint_model["model-rotation"]),"model-scale":new DataDrivenProperty(to.paint_model["model-scale"]),"model-translation":new DataDrivenProperty(to.paint_model["model-translation"]),"model-color":new DataDrivenProperty(to.paint_model["model-color"]),"model-color-mix-intensity":new DataDrivenProperty(to.paint_model["model-color-mix-intensity"]),"model-type":new DataConstantProperty(to.paint_model["model-type"]),"model-cast-shadows":new DataConstantProperty(to.paint_model["model-cast-shadows"]),"model-receive-shadows":new DataConstantProperty(to.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new DataConstantProperty(to.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new DataDrivenProperty(to.paint_model["model-emissive-strength"]),"model-roughness":new DataDrivenProperty(to.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new DataDrivenProperty(to.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new DataConstantProperty(to.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new DataConstantProperty(to.paint_model["model-front-cutoff"]),"model-elevation-reference":new DataConstantProperty(to.paint_model["model-elevation-reference"]),"model-line-cutout-mode":new DataConstantProperty(to.paint_model["model-line-cutout-mode"]),"model-color-use-theme":new DataDrivenProperty({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r),this.layer=e,this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}mayUse(e){return"Standard"===e}prepare(){return Vm()}createBucket(e){return new ModelBucket(e)}getProgramIds(){return["model"]}is3D(e){return!0}hasShadowPass(){return this.paint.get("model-cast-shadows")}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(e){return e.isTiled3dModelBucket?8191:0}queryRenderedFeatures(e,t,i){return Rm?Rm(this,e,t,i):{}}queryIntersectsFeature(e,t,i,r,n,o,a,s,l,u){return!!Lm&&Lm(this,e,t,0,o,u)}_handleOverridablePaintPropertyUpdate(e,t,i){return!(!this.layout||t.isDataDriven()||i.isDataDriven()||"model-color"!==e&&"model-color-mix-intensity"!==e&&"model-rotation"!==e&&"model-scale"!==e&&"model-translation"!==e&&"model-emissive-strength"!==e)}_isPropertyZoomDependent(e){const t=this._transitionablePaint._values[e];return null!=t&&null!=t.value&&null!=t.value.expression&&t.value.expression instanceof ZoomDependentExpression}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}},clip:class ClipStyleLayer extends StyleLayer{constructor(e,t,i,r){super(e,{layout:Jp||(Jp=new Properties({"clip-layer-types":new DataConstantProperty(to.layout_clip["clip-layer-types"]),"clip-layer-scope":new DataConstantProperty(to.layout_clip["clip-layer-scope"]),visibility:new DataConstantProperty(to.layout_clip.visibility)})),paint:Kp||(Kp=new Properties({}))},t,i,r)}recalculate(e,t){super.recalculate(e,t)}createBucket(e){return new ClipBucket(e)}is3D(e){return!0}}};function Nm(e,t,i,r){return"custom"===e.type?new CustomStyleLayer(e,t):new km[e.type](e,t,i,r)}var Um=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Gm(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e||null==e)return JSON.stringify(e);if(Array.isArray(e)){let t="[";for(const i of e)t+=`${Gm(i)},`;return`${t}]`}let t="{";for(const i of Object.keys(e).sort())t+=`${i}:${Gm(e[i])},`;return`${t}}`}function jm(e){let t="";for(const i of Um)t+=`/${Gm(e[i])}`;return t}function Hm(e,t){return function e(i){return"string"==typeof i&&i===t||(Array.isArray(i)?i.some(e):!(!i||"object"!=typeof i)&&Object.values(i).some(e))}(e)}class StyleLayerIndex{constructor(e){this.keyCache=Object.create(null),this._layers=Object.create(null),this._layerConfigs=Object.create(null),e&&this.replace(e)}replace(e,t){this._layerConfigs=Object.create(null),this._layers=Object.create(null),this.update(e,[],t)}update(e,t,i){this._options=i;for(const t of e)this._layerConfigs[t.id]=t,(this._layers[t.id]=Nm(t,this.scope,null,this._options)).compileFilter(i),this.keyCache[t.id]&&delete this.keyCache[t.id];for(const e of t)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource=Object.create(null);const r=function(e,t){const i=Object.create(null);for(let r=0;r<e.length;r++){const n=e[r];let o=t&&t[n.id];o||("symbol"===n.type?o=n.id:(o=jm(n),"line"===n.type&&n.paint&&(Hm(n.paint["line-width"],"line-progress")&&(o+=`/${Gm(n.paint["line-width"])}`),Hm(n.paint["line-emissive-strength"],"line-progress")&&(o+=`/${Gm(n.paint["line-emissive-strength"])}`)))),t&&(t[n.id]=o);let a=i[o];a||(a=i[o]=[]),a.push(n)}const r=[];for(const e in i)r.push(i[e]);return r}(Object.values(this._layerConfigs),this.keyCache);for(const e of r){const t=e.map(e=>this._layers[e.id]),i=t[0];if("none"===i.visibility)continue;const r=i.source||"";let n=this.familiesBySource[r];n||(n=this.familiesBySource[r]=Object.create(null));const o=i.sourceLayer||"_geojsonTileLayer";let a=n[o];a||(a=n[o]=[]),a.push(t)}}}class Anchor extends K{constructor(e,t,i,r,n){super(e,t),this.angle=r,this.z=i,void 0!==n&&(this.segment=n)}clone(){return new Anchor(this.x,this.y,this.z,this.angle,this.segment)}}function $m(e,t,i,r,n){if(void 0===t.segment)return!0;let o=t,a=t.segment+1,s=0;for(;s>-i/2;){if(a--,a<0)return!1;s-=e[a].dist(o),o=e[a]}s+=e[a].dist(e[a+1]),a++;const l=[];let u=0;for(;s<i/2;){const t=e[a],i=e[a+1];if(!i)return!1;let o=e[a-1].angleTo(t)-t.angleTo(i);for(o=Math.abs((o+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:s,angleDelta:o}),u+=o;s-l[0].distance>r;)u-=l.shift().angleDelta;if(u>n)return!1;a++,s+=t.dist(i)}return!0}function Wm(e){let t=0;for(let i=0;i<e.length-1;i++)t+=e[i].dist(e[i+1]);return t}function Xm(e,t,i){return e?.6*t*i:0}function qm(e,t){return Math.max(e?e.right-e.left:0,t?t.right-t.left:0)}function Zm(e,t,i,r,n,o){const a=Xm(i,n,o),s=qm(i,r)*o;let l=0;const u=Wm(e)/2;for(let i=0;i<e.length-1;i++){const r=e[i],n=e[i+1],o=r.dist(n);if(l+o>u){const c=(u-l)/o,h=rt(r.x,n.x,c),d=rt(r.y,n.y,c),p=new Anchor(h,d,0,n.angleTo(r),i);return!a||$m(e,p,s,a,t)?p:void 0}l+=o}}function Ym(e,t,i,r,n,o,a,s,l){const u=Xm(r,o,a),c=qm(r,n),h=c*a,d=0===e[0].x||e[0].x===l||0===e[0].y||e[0].y===l;return t-h<t/4&&(t=h+t/4),Jm(e,d?t/2*s%t:(c/2+2*o)*a*s%t,t,u,i,h,d,!1,l)}function Jm(e,t,i,r,n,o,a,s,l){const u=o/2,c=Wm(e);let h=0,d=t-i,p=[];for(let t=0;t<e.length-1;t++){const a=e[t],s=e[t+1],f=a.dist(s),m=s.angleTo(a);for(;d+i<h+f;){d+=i;const _=(d-h)/f,g=rt(a.x,s.x,_),y=rt(a.y,s.y,_);if(g>=0&&g<l&&y>=0&&y<l&&d-u>=0&&d+u<=c){const i=new Anchor(g,y,0,m,t);r&&!$m(e,i,o,r,n)||p.push(i)}}h+=f}return s||p.length||a||(p=Jm(e,h/2,i,r,n,o,a,!0,l)),p}rn(Anchor,"Anchor");class SectionOptions{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(e,t){const i=new SectionOptions;return i.scale=e||1,i.fontStack=t,i}static forImage(e){const t=new SectionOptions;return t.image=e,t}}class TaggedString{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,t,i,r=1){const n=new TaggedString;for(let o=0;o<e.sections.length;o++){const a=e.sections[o];a.image?n.addImageSection(a,i,r):n.addTextSection(a,t)}return n}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSections(){return this.sections}getSectionIndex(e){return this.sectionIndex[e]}getCodePoint(e){return this.text.codePointAt(e)}verticalizePunctuation(e){this.text=function(e,t){let i="";for(let r=0;r<e.length;r++){const n=e.charCodeAt(r+1)||null,o=e.charCodeAt(r-1)||null;i+=!t&&(n&&Hn(n)&&!cl[e[r+1]]||o&&Hn(o)&&!cl[e[r-1]])||!cl[e[r]]?e[r]:cl[e[r]]}return i}(this.text,e)}trim(){let e=0;for(let t=0;t<this.text.length&&e_[this.text.charCodeAt(t)];t++)e++;let t=this.text.length;for(let i=this.text.length-1;i>=0&&i>=e&&e_[this.text.charCodeAt(i)];i--)t--;this.text=this.text.substring(e,t),this.sectionIndex=this.sectionIndex.slice(e,t)}substring(e,t){const i=new TaggedString;return i.text=this.text.substring(e,t),i.sectionIndex=this.sectionIndex.slice(e,t),i.sections=this.sections,i}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,t)=>Math.max(e,this.sections[t].scale),0)}addTextSection(e,t){this.text+=e.text,this.sections.push(SectionOptions.forText(e.scale,e.fontStack||t));const i=this.sections.length-1;for(let t=0;t<e.text.length;++t)this.sectionIndex.push(i)}addImageSection(e,t,i=1){const r=e.image?e.image.getPrimary():null;if(!r)return void ze("Can
2\'t add FormattedSection with an empty image.");r.scaleSelf(t*i);const n=this.getNextImageSectionCharCode();n?(this.text+=String.fromCodePoint(n),this.sections.push(SectionOptions.forImage(r)),this.sectionIndex.push(this.sections.length-1)):ze("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Km(e,t){if(!e.image)return!1;const i=t.get(e.image.toString());return!!i&&i.sdf}function Qm(e,t,i,r,n,o,a,s,l,u,c,h,d,p,f,m=1,_=1){const g=TaggedString.fromFeature(e,n,m,_);h===al.vertical&&g.verticalizePunctuation(d);const y=g.toString();if(function(e,t){const i=e.sections.findIndex(e=>Km(e,t));if(-1===i)return;ze(`SDF image ${e.sections[i].image.id.name} is not supported in text-field`);const r=e.sections.map(e=>Km(e,t));let n="";const o=[];for(let t=0;t<e.length();t++){const i=e.sectionIndex[t];r[i]||(n+=e.text[t],o.push(i))}e.text=n,e.sectionIndex=o}(g,r),0===g.length())return;let x=[];const v=function(e,t,i,r,n,o,a){if(!e)return[];const s=[],l=function(e,t,i,r,n,o,a){let s=0;for(let i=0;i<e.length();i++){const l=e.getSection(i);s+=i_(e.getCodePoint(i),l,r,n,t,o,a)}return s/Math.max(1,Math.ceil(s/i))}(e,t,i,r,n,o,a),u=e.text.includes("\u200b
vendor: 77,657 bytes, line 2
2");let c=0;for(let i=0;i<e.length();i++){const h=e.getSection(i),d=e.getCodePoint(i);if(e_[d]||(c+=i_(d,h,r,n,t,o,a)),i<e.length()-1){const t=Un(d);(t_[d]||t||h.image)&&s.push(o_(i+1,c,l,s,n_(d,e.getCodePoint(i+1),t&&u),!1))}}return a_(o_(e.length(),c,l,s,0,!0))}(g,u,o,t,r,p,_),{processBidirectionalText:b,processStyledBidirectionalText:w}=eo;if(b&&1===g.sections.length){const e=b(g.toString(),v);for(const t of e){const e=new TaggedString;e.text=t,e.sections=g.sections;for(let i=0;i<t.length;i++)e.sectionIndex.push(0);x.push(e)}}else if(w){const e=w(g.text,g.sectionIndex,v);for(const t of e){const e=new TaggedString;e.text=t[0],e.sectionIndex=t[1],e.sections=g.sections,x.push(e)}}else x=function(e,t){const i=[],r=e.text;let n=0;for(const r of t)i.push(e.substring(n,r)),n=r;return n<r.length&&i.push(e.substring(n,r.length)),i}(g,v);const A=[],E={positionedLines:A,text:y,top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:h,iconsInText:!1,verticalizable:!1,hasBaseline:!1};return function(e,t,i,r,n,o,a,s,l,u,c,h,d){let p=0,f=0,m=0;const _="right"===s?1:"left"===s?0:.5;let g=!1;for(const e of n){const i=e.getSections();for(const e of i){if(e.image)continue;const i=t[e.fontStack];if(i&&(g=void 0!==i.ascender&&void 0!==i.descender,!g))break}if(!g)break}let y=0;for(const a of n){a.trim();const n=a.getMaxScale(),s=(n-1)*nl,x={positionedGlyphs:[],lineOffset:0};e.positionedLines[y]=x;const v=x.positionedGlyphs;let b=0;if(!a.length()){f+=o,++y;continue}let w=0,A=0;for(let o=0;o<a.length();o++){const s=a.getSection(o),m=a.getSectionIndex(o),_=a.getCodePoint(o);let y=s.scale,x=null,E=null,I=null,D=nl,P=0,T=l;T===al.vertical&&jn(_)&&(T=al.horizontal);const z=!(T===al.horizontal||!c&&!Gn(_)||c&&(e_[_]||$n(_)));if(s.image){const t=r.get(s.image.toString());if(!t)continue;I=s.image,e.iconsInText=!0,E=t.paddedRect;const i=t.displaySize,o=i[0]*d,a=i[1]*d;y=y*nl/h,x={width:o,height:a,left:0,top:-3,advance:z?a:o,localGlyph:!1},P=g?-x.height*y:n*nl-17-a*y,D=x.advance;const l=(z?o:a)*y-nl*n;l>0&&l>b&&(b=l)}else{const e=i[s.fontStack];if(!e)continue;e[_]&&(E=e[_]);const r=t[s.fontStack];if(!r)continue;const o=r.glyphs[_];if(!o)continue;if(x=o.metrics,D=8203!==_?nl:0,g){const e=void 0!==r.ascender?Math.abs(r.ascender):0,t=void 0!==r.descender?Math.abs(r.descender):0,i=(e+t)*y;w<i&&(w=i,A=(e-t)/2*y),P=-e*y}else P=(n-y)*nl-17}v.push({glyph:_,image:I,x:p,y:f+P,vertical:z,scale:y,localGlyph:x.localGlyph,fontStack:s.fontStack,sectionIndex:m,metrics:x,rect:E}),z?(e.verticalizable=!0,p+=D*y+u):p+=x.advance*y+u}0!==v.length&&(m=Math.max(p-u,m),g?s_(v,_,b,A,o*n/2):s_(v,_,b,0,o/2)),p=0;const E=o*n+b;x.lineOffset=Math.max(b,s),f+=E,++y}const x=f,{horizontalAlign:v,verticalAlign:b}=sl(a);(function(e,t,i,r,n,o){const a=(t-i)*n,s=-o*r;for(const t of e)for(const e of t.positionedGlyphs)e.x+=a,e.y+=s})(e.positionedLines,_,v,b,m,x),e.top+=-b*x,e.bottom=e.top+x,e.left+=-v*m,e.right=e.left+m,e.hasBaseline=g}(E,t,i,r,x,a,s,l,h,u,d,f,_),function(e){for(const t of e)if(0!==t.positionedGlyphs.length)return!1;return!0}(A)?void 0:E}const e_={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},t_={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 i_(e,t,i,r,n,o,a){if(t.image){const e=r.get(t.image.toString());return e?e.displaySize[0]*a*t.scale*nl/o+n:0}{const r=i[t.fontStack],o=r&&r.glyphs[e];return o?o.metrics.advance*t.scale+n:0}}function r_(e,t,i,r){const n=Math.pow(e-t,2);return r?e<t?n/2:2*n:n+Math.abs(i)*i}function n_(e,t,i){let r=0;return 10===e&&(r-=1e4),i&&(r+=150),40!==e&&65288!==e||(r+=50),41!==t&&65289!==t||(r+=50),r}function o_(e,t,i,r,n,o){let a=null,s=r_(t,i,n,o);for(const e of r){const r=r_(t-e.x,i,n,o)+e.badness;r<=s&&(a=e,s=r)}return{index:e,x:t,priorBreak:a,badness:s}}function a_(e){return e?a_(e.priorBreak).concat(e.index):[]}function s_(e,t,i,r,n){if(!(t||i||r||n))return;const o=e.length-1,a=e[o],s=(a.x+a.metrics.advance*a.scale)*t;for(let t=0;t<=o;t++)e[t].x-=s,e[t].y+=i+r+n}function l_(e,t=1,i=!1){let r=1/0,n=1/0,o=-1/0,a=-1/0;const s=e[0];for(let e=0;e<s.length;e++){const t=s[e];(!e||t.x<r)&&(r=t.x),(!e||t.y<n)&&(n=t.y),(!e||t.x>o)&&(o=t.x),(!e||t.y>a)&&(a=t.y)}const l=Math.min(o-r,a-n);let u=l/2;const c=new TinyQueue([],u_);if(0===l)return new K(r,n);for(let t=r;t<o;t+=l)for(let i=n;i<a;i+=l)c.push(new Cell(t+u,i+u,u,e));let h=function(e){let t=0,i=0,r=0;const n=e[0];for(let e=0,o=n.length,a=o-1;e<o;a=e++){const o=n[e],s=n[a],l=o.x*s.y-s.x*o.y;i+=(o.x+s.x)*l,r+=(o.y+s.y)*l,t+=3*l}return new Cell(i/t,r/t,0,e)}(e),d=c.length;for(;c.length;){const r=c.pop();(r.d>h.d||!h.d)&&(h=r,i&&console.log("found best %d after %d probes",Math.round(1e4*r.d)/1e4,d)),r.max-h.d<=t||(u=r.h/2,c.push(new Cell(r.p.x-u,r.p.y-u,u,e)),c.push(new Cell(r.p.x+u,r.p.y-u,u,e)),c.push(new Cell(r.p.x-u,r.p.y+u,u,e)),c.push(new Cell(r.p.x+u,r.p.y+u,u,e)),d+=4)}return i&&(console.log(`num probes: ${d}`),console.log(`best distance: ${h.d}`)),h.p}function u_(e,t){return t.max-e.max}class Cell{constructor(e,t,i,r){this.p=new K(e,t),this.h=i,this.d=function(e,t){let i=!1,r=1/0;for(let n=0;n<t.length;n++){const o=t[n];for(let t=0,n=o.length,a=n-1;t<n;a=t++){const n=o[t],s=o[a];n.y>e.y!=s.y>e.y&&e.x<(s.x-n.x)*(e.y-n.y)/(s.y-n.y)+n.x&&(i=!i),r=Math.min(r,ps(e,n,s))}}return(i?1:-1)*Math.sqrt(r)}(this.p,r),this.max=this.d+this.h*Math.SQRT2}}const c_=Object.keys;function h_(e){return void 0!==e.imagePrimary&&void 0!==e.top&&void 0!==e.bottom&&void 0!==e.left&&void 0!==e.right}function d_(e){return!e.imagePrimary.stretchX}function p_(e){return!e.imagePrimary.stretchY}function f_(e){return{width:e.right-e.left,height:e.bottom-e.top}}const m_=Number.POSITIVE_INFINITY;function __(e,t,i,r,n,o){const a=h_(e)&&e.collisionPadding?e.collisionPadding:[0,0,0,0],s={top:e.top-a[1],bottom:e.bottom+a[3],left:e.left-a[0],right:e.right+a[2],scaled:!1};return void 0!==r&&function(e,t){e.top*=t,e.bottom*=t,e.left*=t,e.right*=t,e.scaled=!0}(s,r),o&&(s.left+=o[0],s.right+=o[0],s.top+=o[1],s.bottom+=o[1]),i&&function(e,t,i){if(!t)return;const r=ye(t),n=new K(i?i[0]:0,i?i[1]:0),o=new K(e.left,e.top),a=new K(e.right,e.top),s=new K(e.left,e.bottom),l=new K(e.right,e.bottom);o._rotateAround(r,n),a._rotateAround(r,n),s._rotateAround(r,n),l._rotateAround(r,n),e.left=Math.min(o.x,a.x,s.x,l.x),e.right=Math.max(o.x,a.x,s.x,l.x),e.top=Math.min(o.y,a.y,s.y,l.y),e.bottom=Math.max(o.y,a.y,s.y,l.y)}(s,i,n),t?{top:Math.min(t.top,s.top),bottom:Math.max(t.bottom,s.bottom),left:Math.min(t.left,s.left),right:Math.max(t.right,s.right),scaled:t.scaled||s.scaled}:s}function g_(e,t,i,r,n,o,a,s=1,l,u,c,h,d,p,f,m,_){e.createArrays(),e.tilePixelRatio=Xt/(512*e.overscaling),e.compareText={},e.iconsNeedLinear=!1;const g=e.layers[0].layout,y=e.layers[0]._unevaluatedLayout._values,x={};x.scaleFactor=s,x.textSizeScaleRange=g.get("text-size-scale-range"),x.iconSizeScaleRange=g.get("icon-size-scale-range");const[v,b]=x.textSizeScaleRange,[w,A]=x.iconSizeScaleRange;x.textScaleFactor=ve(x.scaleFactor,v,b),x.iconScaleFactor=ve(x.scaleFactor,w,A);const E=y["text-size"],I=y["icon-size"];if("composite"===e.textSizeData.kind){const{minZoom:t,maxZoom:i}=e.textSizeData;x.compositeTextSizes=[E.possiblyEvaluate(new EvaluationParameters(t,{worldview:c}),o),E.possiblyEvaluate(new EvaluationParameters(i,{worldview:c}),o)]}if("composite"===e.iconSizeData.kind){const{minZoom:t,maxZoom:i}=e.iconSizeData;x.compositeIconSizes=[I.possiblyEvaluate(new EvaluationParameters(t,{worldview:c}),o,h),I.possiblyEvaluate(new EvaluationParameters(i,{worldview:c}),o,h)]}x.layoutTextSize=E.possiblyEvaluate(new EvaluationParameters(a+1,{worldview:c}),o),x.layoutIconSize=I.possiblyEvaluate(new EvaluationParameters(a+1,{worldview:c}),o,h),x.textMaxSize=E.possiblyEvaluate(new EvaluationParameters(18,{worldview:c}),o);const D=g.get("symbol-placement"),P="map"===g.get("text-rotation-alignment")&&"point"!==D,T=g.get("text-size");let z=!1;const M=[],C=null!=d&&0!==d;for(const a of e.features){if(C&&a.properties&&m&&m(a.properties,d))continue;let s=65535;if(e.hdExt&&a.properties&&Object.hasOwn(a.properties,Ds)){const t=+a.properties[Ds];if(!Number.isNaN(t)){const i=e.hdExt.resolveRoadElevation(a,t);if("defer"===i)continue;s=i}}const p=g.get("text-font").evaluate(a,{},o).join(","),f=T.evaluate(a,{},o)*x.textScaleFactor,_=x.layoutTextSize.evaluate(a,{},o)*x.textScaleFactor,v=x.layoutIconSize.evaluate(a,{},o,h)*x.iconScaleFactor,b={horizontal:{},vertical:void 0},w=a.text;let A,E=[0,0];if(w){const r=w.toString(),s=g.get("text-letter-spacing").evaluate(a,{},o)*nl,u=g.get("text-line-height").evaluate(a,{},o)*nl,c=kn(r)?s:0,h=g.get("text-anchor").evaluate(a,{},o),d=g.get("text-variable-anchor");if(!d){const e=g.get("text-radial-offset").evaluate(a,{},o);if(e)E=vl(h,[e*nl,m_]);else{const e=g.get("text-offset").evaluate(a,{},o);E=[e[0]*nl,e[1]*nl]}}let m=P?"center":g.get("text-justify").evaluate(a,{},o);const y="point"===D,v=y?g.get("text-max-width").evaluate(a,{},o)*nl:1/0,A=o=>{e.allowVerticalPlacement&&Vn(r)&&(b.vertical=Qm(w,t,i,n,p,v,u,h,o,c,E,al.vertical,!0,_,f,l,x.textScaleFactor))};if(!P&&d){const e="auto"===m?d.map(e=>Sl(e)):[m];let r=!1;for(let o=0;o<e.length;o++){const a=e[o];if(!b.horizontal[a])if(r)b.horizontal[a]=b.horizontal[0];else{const e=Qm(w,t,i,n,p,v,u,"center",a,c,E,al.horizontal,!1,_,f,l,x.textScaleFactor);e&&(b.horizontal[a]=e,r=1===e.positionedLines.length)}}A("left")}else{if("auto"===m&&(m=Sl(h)),y||g.get("text-writing-mode").includes("horizontal")||!Vn(r)){const e=Qm(w,t,i,n,p,v,u,h,m,c,E,al.horizontal,!1,_,f,l,x.textScaleFactor);e&&(b.horizontal[m]=e)}A(y?"left":m)}}let I,R,L,F,B,O,V=!1;const k=g.get("icon-text-fit").evaluate(a,{},o);if(a.icon&&a.icon.hasPrimary()){const t=Il(a.icon,e.iconSizeData,y["icon-size"],o,e.zoom,a,l,x.iconScaleFactor,c,h);I=t.iconPrimary,L=t.iconSecondary;const i=I.toString();if(R=r.get(i),R&&(B=g.get("icon-offset").evaluate(a,{},o),O=g.get("icon-anchor").evaluate(a,{},o),A=ll(n.get(i),L?n.get(L.toString()):void 0,B,O),V=R.sdf,void 0===e.sdfIcons?e.sdfIcons=R.sdf:e.sdfIcons!==R.sdf&&ze("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(R.pixelRatio!==e.pixelRatio||0!==g.get("icon-rotate").constantOr(1))&&(e.iconsNeedLinear=!0)),L){const e=L.toString();F=r.get(e)}}z=z||!(!a.icon||!a.icon.hasSecondary());const N=M_(b.horizontal)||b.vertical;e.iconsInText||(e.iconsInText=!!N&&N.iconsInText);const U=Dl(_,x.textScaleFactor),{defaultShapedIcon:G,verticallyShapedIcon:j}=P_(e,A,g,a,o,b,U,B,k);"none"!==k&&A&&(d_(A)||p_(A))&&(w_(R,I,A,G,k,u,r,n),w_(F,L,A,G,k,u,r,n),j&&(w_(R,I,A,j,k,u,r,n),w_(F,L,A,j,k,u,r,n))),A=G;const{iconBBox:$,iconVerticalBBox:W,textBBox:X,textVerticalBBox:q}=y_(e,A,j,g,a,o,v,B,x,n,O,b,_,E,h);M.push({feature:a,shapedTextOrientations:b,shapedText:N,shapedIcon:A,iconPrimary:I,iconSecondary:L,iconOffset:B,iconAnchor:O,verticallyShapedIcon:j,layoutTextSize:_,layoutIconSize:v,textOffset:E,isSDFIcon:V,iconTextFit:k,iconCollisionBounds:$,iconVerticalCollisionBounds:W,textCollisionBounds:X,textVerticalCollisionBounds:q,elevationFeatureIndex:s})}return e.hdExt&&e.hdExt.clearWorkerState(),{featureData:M,sizes:x,hasAnySecondaryIcon:z,textAlongLine:P,symbolPlacement:D,coverageFrcMask:d,coveragePolygons:p,coverageTileZoom:f,isFeatureCoveredByFrcMask:m,symbolAnchorInFrcCoverage:_}}function y_(e,t,i,r,n,o,a,s,l,u,c,h,d,p,f){const m=e.layers[0],_=m.appearances;if(0===_.length)return{iconBBox:null,iconVerticalBBox:null,textBBox:null,textVerticalBBox:null};const g={iconBBox:null,iconVerticalBBox:null},y={textBBox:null,textVerticalBBox:null},{baseIconRotate:x,baseTextRotate:v,iconScaleFactor:b}=function(e,t,i){const r=e.get("icon-rotate").evaluate(t,{},i),n=e.get("text-rotate").evaluate(t,{},i),[o,a]=e.get("icon-size-scale-range");return{baseIconRotate:r,baseTextRotate:n,iconScaleFactor:ve(1,o,a)}}(r,n,o);t&&(g.iconBBox=__(t,g.iconBBox,x),i)&&(g.iconVerticalBBox=__(i,g.iconVerticalBBox,x+90));const w=M_(h.horizontal);w&&(y.textBBox=__(w,y.textBBox,v,1,p)),h.vertical&&(y.textVerticalBBox=__(h.vertical,y.textVerticalBBox,v+90,1,p));for(const i of _)i.hasIconLayoutProperties()&&x_(g,e,m,i,n,o,s,x,a,l,t,u,b,c,f),i.hasTextLayoutProperties()&&b_(y,m,i,n,o,p,v,d,w,h.vertical);return{iconBBox:g.iconBBox,iconVerticalBBox:g.iconVerticalBBox,textBBox:y.textBBox,textVerticalBBox:y.textVerticalBBox}}function x_(e,t,i,r,n,o,a,s,l,u,c,h,d,p,f){const{appearanceIconOffset:m,appearanceIconRotate:_,appearanceIconSize:g}=wl(r,i,n,o,a,s,l,u.iconScaleFactor);let y=null,x=null,v=null;r.hasLayoutProperty("icon-image")?v=v_(t,i,r,n,o,h,d,f):c&&(v=c.imagePrimary),v&&(y=ll(v,null,m,p),t.allowVerticalPlacement&&(x=y));const b=l>0?g/l:1;y&&(e.iconBBox=__(y,e.iconBBox,_,1!==b?b:void 0)),x&&(e.iconVerticalBBox=__(x,e.iconVerticalBBox,_+90,1!==b?b:void 0))}function v_(e,t,i,r,n,o,a,s){let l=null;const u=t.getAppearanceValueAndResolveTokens(i,"icon-image",r,n,s);if(u){const c=e.getResolvedImageFromTokens(u),h=i.hasLayoutProperty("icon-size")?i.getUnevaluatedLayoutProperty("icon-size"):t._unevaluatedLayout._values["icon-size"],d=Il(c,fl(e.zoom,h,e.worldview,s),h,n,e.zoom,r,e.pixelRatio,a,e.worldview,s);l=o.get(d.iconPrimary.toString())}return l}function b_(e,t,i,r,n,o,a,s,l,u){const{appearanceTextOffset:c,appearanceTextRotate:h,appearanceTextSize:d}=Al(i,t,r,n,o,a,s),p=d/s,f=[(c[0]-o[0])*p,(c[1]-o[1])*p],m=0!==f[0]||0!==f[1];l&&(e.textBBox=__(l,e.textBBox,h,p,c,m?f:void 0)),u&&(e.textVerticalBBox=__(u,e.textVerticalBBox,h+90,p,c,m?f:void 0))}function w_(e,t,i,r,n,o,a,s){if(!e||!e.usvg)return;const l=f_(i),u=f_(r),c="both"!==n&&"width"!==n||!d_(i)?1:u.width/l.width,h="both"!==n&&"height"!==n||!p_(i)?1:u.height/l.height;t.scaleSelf(c,h);const d=t.toString();o.set(d,t),a.set(d,e);const{imagePosition:p}=Ru(d,e,1);s.set(d,p)}function A_(e,t,i){if(!t)return;const r=i.get(e.toString()),n=i.get(t.toString());r&&n&&(r.paddedRect.w===n.paddedRect.w&&r.paddedRect.h===n.paddedRect.h||ze(`Mismatch in icon variant sizes: ${e.toString()} and ${t.toString()}`),r.usvg!==n.usvg&&ze(`Mismatch in icon variant image types: ${e.id} and ${t.id}`))}function E_(e,t,i,r,n,o,a,s,l,u){e.iconAtlasPositions=u.iconPositions;const{featureData:c,sizes:h,textAlongLine:d,symbolPlacement:p,coveragePolygons:f,coverageTileZoom:m,symbolAnchorInFrcCoverage:_}=t,g=t.hasAnySecondaryIcon||e.hasAnySecondaryIcon;for(const t of c){const{shapedIcon:i,verticallyShapedIcon:o,feature:c,shapedTextOrientations:y,shapedText:x,layoutTextSize:v,textOffset:b,isSDFIcon:w,iconPrimary:A,iconSecondary:E,iconTextFit:I,iconOffset:D,iconCollisionBounds:P,iconVerticalCollisionBounds:T,textCollisionBounds:z,elevationFeatureIndex:M}=t;I_(i,u.iconPositions,A,E),I_(o,u.iconPositions,A,E),S_(y,u.iconPositions),A_(A,E,u.iconPositions),(x||i)&&T_(e,c,y,i,o,l,h,v,0,b,w,r,n,a,s,g,I,D,d,p,P,T,z,0,0,f,m,_,M)}i&&e.generateCollisionDebugBuffers(o,e.collisionBoxArray,h.textScaleFactor),e.text.uboBinder&&e.text.uboBinder.finalize(),e.icon.uboBinder&&e.icon.uboBinder.finalize()}function I_(e,t,i,r){if(!e)return;const n=t.get(i.toString());if(n&&(e.imagePrimary=n),r){const i=t.get(r.toString());e.imageSecondary=i}}function S_(e,t){for(const i in e.horizontal)D_(e.horizontal[i],t);D_(e.vertical,t)}function D_(e,t){if(e)for(const i of e.positionedLines)for(const e of i.positionedGlyphs)if(null!==e.image){const i=e.image.toString();e.rect=t.get(i).paddedRect}}function P_(e,t,i,r,n,o,a,s,l){const u=M_(o.horizontal)||o.vertical,c=i.get("icon-text-fit-padding").evaluate(r,{},n);let h,d=t;return t&&"none"!==l&&(e.allowVerticalPlacement&&o.vertical&&(h=ul(t,o.vertical,l,c,s,a)),u&&(d=ul(t,u,l,c,s,a))),{defaultShapedIcon:d,verticallyShapedIcon:h}}function T_(e,t,i,r,n,o,a,s,l,u,c,h,d,p,f,m,_,g,y,x,v,b,w,A,E,I,D,P,T=65535){let z=a.textMaxSize.evaluate(t,{},d);void 0===z?z=s*a.textScaleFactor:z*=a.textScaleFactor;const M=e.layers[0].layout,C=Dl(s,a.textScaleFactor),R=M_(i.horizontal)||i.vertical,L=e.hasAnyAppearanceLayoutProperty(["text-size","text-offset","text-rotate"]),F=e.getAppearanceFeatureData(t.index);("none"!==_||L)&&F&&(F.textShaping=R,F.iconTextFitPadding=M.get("icon-text-fit-padding").evaluate(t,{},d),F.fontScale=C,F.textScaleFactor=a.textScaleFactor);const B="globe"===p.name,O=e.tilePixelRatio*z/24,V=($=e.overscaling,e.zoom>18&&$>2&&($>>=1),Math.max(Xt/(512*$),1)*M.get("symbol-spacing")),k=M.get("text-padding")*e.tilePixelRatio,N=M.get("icon-padding")*e.tilePixelRatio,U=ye(M.get("text-max-angle")),G="map"===M.get("icon-rotation-alignment")&&"point"!==x,j=V/2;var $;!1===e.hasAnyIconTextFit&&"none"!==_&&(e.hasAnyIconTextFit=!0);const W=(s,l,x)=>{if(l.x<0||l.x>=Xt||l.y<0||l.y>=Xt)return;if(I&&I.length>0&&t.properties&&P&&P(I,t.properties,l,d,D))return;let A=null;if(B){const{x:e,y:t,z:i}=p.projectTilePoint(l.x,l.y,x);A={anchor:new Anchor(e,t,i,0,void 0),up:p.upVector(x,l.x,l.y)}}!function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,f,m,_,g,y,x,v,b,w,A,E,I,D,P,T,z,M,C){const R=e.addToLineVertexArray(t,r);let L,F,B,O,V,k,N,U=0,G=0,j=0,$=0,W=-1,X=-1;const q={};let Z=Ba("");const Y=i?i.anchor:t,J="none"!==P;let K=0,Q=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")){const e=l.layout.get("text-offset").evaluate(v,{},E);K=e[0]*nl,Q=e[1]*nl}else K=l.layout.get("text-radial-offset").evaluate(v,{},E)*nl,Q=m_;if(e.allowVerticalPlacement&&n.vertical){const e=n.vertical;if(f)k=R_(e),s&&(N=R_(s));else{const i=l.layout.get("text-rotate").evaluate(v,{},E)+90;B=C_(u,Y,t,c,h,d,e,p,i,m,C),s&&(O=C_(u,Y,t,c,h,d,s,g,i,null,M))}}if(o){const r=l.layout.get("icon-rotate").evaluate(v,{},E),n=Ou(o,r,w,J,b.iconScaleFactor),a=s?Ou(s,r,w,J,b.iconScaleFactor):void 0;F=C_(u,Y,t,c,h,d,o,g,r,null,z);const p=function(e,t,i,r,n,o,a,s,l){const u=e.layers[0],c=u.appearances;let h=t.length;if(i&&(h=Math.max(h,i.length)),0===c.length)return h;const[d,p]=r.get("icon-size-scale-range"),f=ve(1,d,p);for(const t of c)if(t.hasLayoutProperty("icon-image")){const i=v_(e,u,t,n,o,a,f,l);i&&(h=Math.max(h,Vu(i)))}return h}(e,n,a,l.layout,v,E,e.iconAtlasPositions,0,A);U=4*p;const f=l.layout.get("icon-size").evaluate(v,{},E,A),m=b.compositeIconSizes?b.compositeIconSizes[0].evaluate(v,{},E,A):0,_=b.compositeIconSizes?b.compositeIconSizes[1].evaluate(v,{},E,A):0,P=Pl(e.layerIds[0],e.iconSizeData,f,o.imagePrimary.usvg?1:b.iconScaleFactor,m,_);e.addSymbols(e.icon,n,P,x,y,v,void 0,i,t,R.lineStartIndex,R.lineLength,-1,A,E,I,D,e.symbolInstances.length,p),W=e.icon.placedSymbolArray.length-1,a&&(G=4*p,e.addSymbols(e.icon,a,P,x,y,v,al.vertical,i,t,R.lineStartIndex,R.lineLength,-1,A,E,I,D,e.symbolInstances.length,p),X=e.icon.placedSymbolArray.length-1)}for(const r in n.horizontal){const o=r,s=n.horizontal[o];L||(Z=Ba(s.text),f?V=R_(s):L=C_(u,Y,t,c,h,d,s,p,l.layout.get("text-rotate").evaluate(v,{},E),m,C));const _=1===s.positionedLines.length;if(j+=z_(e,i,t,s,a,l,f,v,m,R,n.vertical?al.horizontal:al.horizontalOnly,_?c_(n.horizontal):[o],q,W,b,A,E,e.symbolInstances.length,I),_)break}n.vertical&&($+=z_(e,i,t,n.vertical,a,l,f,v,m,R,al.vertical,["vertical"],q,X,b,A,E,e.symbolInstances.length,I));let ee=-1;const te=(e,t)=>e?Math.max(e,t):t;ee=te(V,ee),ee=te(k,ee),ee=te(N,ee);const ie=ee>-1?1:0;e.glyphOffsetArray.length>=65535&&ze("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==v.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,v.sortKey),e.symbolInstances.emplaceBack(t.x,t.y,Y.x,Y.y,Y.z,q.right>=0?q.right:-1,q.center>=0?q.center:-1,q.left>=0?q.left:-1,q.vertical>=0?q.vertical:-1,W,X,Z,void 0!==L?L:e.collisionBoxArray.length,void 0!==L?L+1:e.collisionBoxArray.length,void 0!==B?B:e.collisionBoxArray.length,void 0!==B?B+1:e.collisionBoxArray.length,void 0!==F?F:e.collisionBoxArray.length,void 0!==F?F+1:e.collisionBoxArray.length,O||e.collisionBoxArray.length,O?O+1:e.collisionBoxArray.length,c,j,$,U,G,ie,0,K,Q,ee,0,J?1:0,T)}(e,l,A,s,i,r,o,n,e.layers[0],e.collisionBoxArray,t.index,t.sourceLayerIndex,e.index,k,y,u,0,N,G,g,t,a,c,h,d,f,m,_,T,v,b,w)};if("line"===x)for(const n of bs(t.geometry,0,0,Xt,Xt)){const t=Ym(n,V,U,i.vertical||R,r,24,O,e.overscaling,Xt);for(const i of t)R&&L_(e,R.text,j,i)||W(n,i,d)}else if("line-center"===x){for(const e of t.geometry)if(e.length>1){const t=Zm(e,U,i.vertical||R,r,24,O);t&&W(e,t,d)}}else if("Polygon"===t.type)for(const e of ae(t.geometry,0)){const t=l_(e,16);W(e[0],new Anchor(t.x,t.y,0,0,void 0),d)}else if("LineString"===t.type)for(const e of t.geometry)W(e,new Anchor(e[0].x,e[0].y,0,0,void 0),d);else if("Point"===t.type)for(const e of t.geometry)for(const t of e)W([t],new Anchor(t.x,t.y,0,0,void 0),d)}function z_(e,t,i,r,n,o,a,s,l,u,c,h,d,p,f,m,_,g,y){const x=$u(0,r,l,o,a,s,n,e.allowVerticalPlacement,void 0,f.textScaleFactor),v=o.layout.get("text-size").evaluate(s,{},_),b=f.compositeTextSizes?f.compositeTextSizes[0].evaluate(s,{},_):0,w=f.compositeTextSizes?f.compositeTextSizes[1].evaluate(s,{},_):0,A=Pl(e.layerIds[0],e.textSizeData,v,f.textScaleFactor,b,w);e.addSymbols(e.text,x,A,l,a,s,c,t,i,u.lineStartIndex,u.lineLength,p,m,_,y,!1,g,x.length);for(const t of h)d[t]=e.text.placedSymbolArray.length-1;return 4*x.length}function M_(e){for(const t in e)return e[t];return null}function C_(e,t,i,r,n,o,a,s,l,u,c){let h,d,p,f;if(h=c?c.top:a.top,d=c?c.bottom:a.bottom,p=c?c.left:a.left,f=c?c.right:a.right,h_(a)&&a.collisionPadding){const e=a.collisionPadding;p-=e[0],h-=e[1],f+=e[2],d+=e[3]}if(l){const e=new K(p,h),t=new K(f,h),i=new K(p,d),r=new K(f,d),n=ye(l);let o=new K(0,0);u&&(o=new K(u[0],u[1])),e._rotateAround(n,o),t._rotateAround(n,o),i._rotateAround(n,o),r._rotateAround(n,o),p=Math.min(e.x,t.x,i.x,r.x),f=Math.max(e.x,t.x,i.x,r.x),h=Math.min(e.y,t.y,i.y,r.y),d=Math.max(e.y,t.y,i.y,r.y)}return e.emplaceBack(t.x,t.y,t.z,i.x,i.y,p,h,f,d,s,r,n,o),e.length-1}function R_(e){h_(e)&&e.collisionPadding&&(e.top-=e.collisionPadding[1],e.bottom+=e.collisionPadding[3]);const t=e.bottom-e.top;return t>0?Math.max(10,t):null}function L_(e,t,i,r){const n=e.compareText;if(t in n){const e=n[t];for(let t=e.length-1;t>=0;t--)if(r.dist(e[t])<i)return!0}else n[t]=[];return n[t].push(r),!1}class GlyphAtlas{constructor(e){const t={},i=[];for(const r in e){const n=e[r],o=t[r]={};for(const e in n.glyphs){const t=n.glyphs[+e];if(!t||0===t.bitmap.width||0===t.bitmap.height)continue;const r=t.metrics.localGlyph?2:1,a={x:0,y:0,w:t.bitmap.width+2*r,h:t.bitmap.height+2*r};i.push(a),o[e]=a}}const{w:r,h:n}=Su(i),o=new AlphaImage({width:r||1,height:n||1});for(const i in e){const r=e[i];for(const e in r.glyphs){const n=r.glyphs[+e];if(!n||0===n.bitmap.width||0===n.bitmap.height)continue;const a=t[i][e],s=n.metrics.localGlyph?2:1;AlphaImage.copy(n.bitmap,o,{x:0,y:0},{x:a.x+s,y:a.y+s},n.bitmap)}}this.image=o,this.positions=t}}function F_(e){for(const t of e){if(null!=t.hdExt)return!0;if(t.requiresHDRuntime)return!0}return!1}function B_(e){for(const t of e)if(t.requiresStandardRuntime)return!0;return!1}function O_(e,t,i){const r=null!=e&&!!Jc&&Jc(e.sourceLayers,t,i);return{applies:r,frcMask:r&&e?e.frcMask:null,polygons:r&&e?e.polygons:null,tileZoom:r&&e?e.tileZoom:null}}rn(GlyphAtlas,"GlyphAtlas");class WorkerTile{constructor(e){this.tileID=new OverscaledTileID(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.tileZoom=e.tileZoom,this.uid=e.uid,this.zoom=e.zoom,this.lut=e.lut,this.canonical=e.tileID.canonical,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.scope=e.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.showElevationIdDebug=e.showElevationIdDebug,this.collectResourceTiming=!!e.request&&e.request.collectResourceTiming,this.promoteId=e.promoteId,this.renderSourceType=e.renderSourceType,this.frcCoverage=e.frcCoverage||null,this.elevation=e.elevation||null,this.crossSourceElevationEnabled=!!e.crossSourceElevationEnabled,this.terrainEnabled=!!e.terrainEnabled,this.deferRoadStructure=!1,this.tileTransform=$l(e.tileID.canonical,e.projection),this.projection=e.projection,this.worldview=e.worldview,this.localizableLayerIds=e.localizableLayerIds,this.brightness=e.brightness,this.extraShadowCaster=!!e.extraShadowCaster,this.tessellationStep=e.tessellationStep,this.scaleFactor=e.scaleFactor,this.worldview=e.worldview,this.indoor=e.indoor}isLayerActiveForTile(e){return!(1===this.renderSourceType&&"symbol"!==e.type||2===this.renderSourceType&&"fill-extrusion"!==e.type||0===this.renderSourceType&&("symbol"===e.type||"fill-extrusion"===e.type)||e.minzoom&&this.zoom<Math.floor(e.minzoom)||e.maxzoom&&this.zoom>=e.maxzoom||"none"===e.visibility)}parse(e,t,i,r,n,o){this._parseAfterHD(e,t,i,r,n,o)}_parseAfterHD(e,t,i,r,n,o){let a;if(this.status="parsing",this.data=e,3===this.renderSourceType){const t=e.layers.hd_road_coverage;a=t&&bp?bp(t):[]}this.collisionBoxArray=new CollisionBoxArray;const s=new DictionaryCoder(Object.keys(e.layers).sort()),l=new FeatureIndex(this.tileID,this.promoteId);l.bucketLayerIDs=[];const u={},c=new LineAtlas(256,256),h={featureIndex:l,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:c,availableImages:i,brightness:this.brightness,scaleFactor:this.scaleFactor,showElevationIdDebug:this.showElevationIdDebug,elevationFeatures:void 0,elevationParams:this.elevation,crossSourceElevationEnabled:this.crossSourceElevationEnabled,terrainEnabled:this.terrainEnabled,activeFloors:void 0};this.indoor&&Ap&&(h.activeFloors=Ap(e,this.indoor,n,this.canonical));const d=[],p=t.familiesBySource[this.source];if(this.deferRoadStructure=!1,3!==this.renderSourceType&&null!=this.frcCoverage&&!this.frcCoverage.resolved&&null===this.frcCoverage.frcMask)for(const e in p)if(Jc&&Jc(this.frcCoverage.sourceLayers,this.source,e)){this.deferRoadStructure=!0;break}for(const t in p){const n=e.layers[t];if(!n)continue;let o=!1,a=!1,c=!1,f=!1;for(const e of p[t])"symbol"===e[0].type?o=!0:"fill-extrusion"===e[0].type?a=!0:c=!0,e[0].is3D()&&"model"!==e[0].type&&(f=!0);if(this.extraShadowCaster&&!f)continue;if(1===this.renderSourceType&&!o)continue;if(2===this.renderSourceType&&!a)continue;if((0===this.renderSourceType||3===this.renderSourceType)&&!c)continue;const m=null!=this.frcCoverage&&!!Jc&&Jc(this.frcCoverage.sourceLayers,this.source,t);if(this.deferRoadStructure&&m)continue;1===n.version&&ze(`Vector tile source "${this.source}" layer "${t}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const _=s.encode(t),g=[],y=this.localizableLayerIds&&this.localizableLayerIds.has(t);let x=!1;for(let e=0,i=0;e<n.length;e++){const r=n.feature(e),o=l.getId(r,t),a=r.properties?r.properties.worldview:null;if(y&&this.worldview&&"string"==typeof a)if("all"===a)r.properties.$localized=!0;else{if(!a.split(",").includes(this.worldview))continue;r.properties.$localized=!0,r.properties.worldview=this.worldview}!x&&r.properties&&Object.hasOwn(r.properties,Ds)&&(x=!0),m&&this.frcCoverage&&this.frcCoverage.frcMask&&r.properties&&Yc&&Yc(r.properties,this.frcCoverage.frcMask)||(g.push({feature:r,id:o,index:i,sourceLayerIndex:_}),i++)}x&&!h.elevationFeatures&&xp&&(h.elevationFeatures=xp(e,this.canonical));for(const e of p[t]){const n=e[0];if(this.extraShadowCaster&&(!n.is3D()||"model"===n.type))continue;if(1===this.renderSourceType&&"symbol"!==n.type)continue;if(2===this.renderSourceType&&"fill-extrusion"!==n.type)continue;if(!(0!==this.renderSourceType&&3!==this.renderSourceType||"symbol"!==n.type&&"fill-extrusion"!==n.type))continue;if(!this.isLayerActiveForTile(n))continue;const o=l.bucketLayerIDs.length;l.bucketLayerIDs.push(e.map(e=>go(e.id,e.scope)));const a=()=>{V_(e,this.zoom,h.brightness,i,this.worldview,h.activeFloors);const a=u[n.id]=n.createBucket({index:o,layers:e,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:_,sourceLayerName:t,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:r,worldview:this.worldview,localizable:y,availableImages:i,maxUniformBufferBindings:this.maxUniformBufferBindings,maxUniformBlockSizeDwords:this.maxUniformBlockSizeDwords});Mp&&Mp(a,this.frcCoverage?this.frcCoverage.sourceLayers:null),a.populate(g,h,this.tileID.canonical,this.tileTransform)};n.mayUse("HD")||n.mayUse("Standard")?d.push(n.prepare().then(()=>a())):a()}}const f=()=>{c.trim();const t=!(!h.elevationFeatures||!h.elevationFeatures.some(e=>e.heightRange.min<0));let r,d,p,f,m,_,g,y=h.elevationFeatures;this.crossSourceElevationEnabled&&xp&&(y=y||xp(e,this.canonical)||[]);const x={type:"maybePrepare",renderSourceType:this.renderSourceType,zoom:this.zoom},v=()=>{if(r)return this.status="done",o(r);if(this.extraShadowCaster){this.status="done";const e=Object.values(u).filter(e=>!e.isEmpty());o(null,{buckets:e,containsHdExt:F_(e),containsStandardExt:B_(e),featureIndex:l,collisionBoxArray:null,hasTunnelGeometry:t,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:h.brightness,hasDeferredElevationFeatures:!!Cp&&Cp(u),parsedElevationFeatures:y,glyphMap:null,iconMap:null,glyphPositions:null})}else if(d&&p&&f&&g){const e=void 0,t=new GlyphAtlas(d),r=new Map;for(const[e,t]of p.entries()){const{imagePosition:i}=Ru(e,t,1);r.set(e,i)}const o={};for(const e in u){const n=u[e];if(n instanceof SymbolBucket){V_(n.layers,this.zoom,h.brightness,i,this.worldview,h.activeFloors);const a=O_(this.frcCoverage,this.source,n.layers[0].sourceLayer);o[e]=g_(n,d,t.positions,p,r,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,m,this.worldview,i,a.frcMask,a.polygons,a.tileZoom,Yc||null,wp||null)}}m.size||_.size?this.rasterizeTask=n.sendCancelable("rasterizeImages",{scope:this.scope,iconTasks:m,patternTasks:_},{},(i,r)=>{if(!i)for(const[e,t]of r.entries())p.has(e)&&p.set(e,Object.assign(p.get(e),{data:t})),f.has(e)&&f.set(e,Object.assign(f.get(e),{data:t}));b(o,t,e,g)}):b(o,t,e,g)}},b=(e,r,s,d)=>{const m=p.size>0||f.size>0,_=Object.keys(e).length>0;if(!m&&!_){this.status="done";const e=Object.values(u).filter(e=>!e.isEmpty());return void o(null,{buckets:e,containsHdExt:F_(e),containsStandardExt:B_(e),featureIndex:l,collisionBoxArray:this.collisionBoxArray,hasTunnelGeometry:t,glyphAtlasImage:r.image,lineAtlas:c,imageAtlas:null,brightness:h.brightness,hasDeferredRoadStructure:this.deferRoadStructure,frcCoveragePolygons:a,hasDeferredElevationFeatures:!!Cp&&Cp(u),parsedElevationFeatures:y})}const g=(n,s)=>{for(const t in u){const r=u[t];if(t in e)E_(r,e[t],this.showCollisionBoxes,i,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,p,s);else if(r.hasPattern&&(r instanceof LineBucket||r instanceof FillBucket||r instanceof FillExtrusionBucket)){V_(r.layers,this.zoom,h.brightness,i,this.worldview,h.activeFloors);const e=Object.fromEntries(s.patternPositions);r.addFeatures(h,this.tileID.canonical,e,i,this.tileTransform,this.brightness)}}this.status="done";const d=Object.values(u).filter(e=>!e.isEmpty());o(null,{buckets:d,containsHdExt:F_(d),containsStandardExt:B_(d),featureIndex:l,collisionBoxArray:this.collisionBoxArray,hasTunnelGeometry:t,glyphAtlasImage:r.image,lineAtlas:c,imageAtlas:n,brightness:h.brightness,hasDeferredRoadStructure:this.deferRoadStructure,frcCoveragePolygons:a,hasDeferredElevationFeatures:!!Cp&&Cp(u),parsedElevationFeatures:y})};if(m){const e=new Map,t=Lu(p,e),i=Lu(f,e),r=new AtlasContentDescriptor(t,i,d,this.lut,this.scope,e);n.send("checkAtlasCache",{descriptor:r,scope:this.scope}).then(e=>{let t,i;if(e)t=new ImageAtlasReference(e.sourceHash),i=e;else{const e=new ImageAtlas(p,f,this.lut,d,this.scope);t=e,i=e}g(t,i)}).catch(e=>{"AbortError"!==e.name&&ze(`[Worker] Error checking atlas cache: ${e.message}`);const t=new ImageAtlas(p,f,this.lut,d,this.scope);g(t,t)})}else g(null,{iconPositions:new Map,patternPositions:new Map})};if(!this.extraShadowCaster){const e=Se(h.glyphDependencies,e=>Object.keys(e).map(Number));Object.keys(e).length?n.send("getGlyphs",{uid:this.uid,stacks:e},{metadata:x}).then(e=>{r||(d=e,v())}).catch(e=>{r||(r=e,v())}):d={},g=new Map;const t=Array.from(h.iconDependencies.keys()).map(e=>ImageId.parse(e)),i=Array.from(h.patternDependencies.keys()).map(e=>ImageId.parse(e));t.length||i.length?n.send("getImages",{icons:t,patterns:i,source:this.source,scope:this.scope,tileID:this.tileID},{metadata:x}).then(e=>{if(!r){p=new Map,f=new Map,m=this.updateImageMapAndGetImageTaskQueue(p,e.images,h.iconDependencies),_=this.updateImageMapAndGetImageTaskQueue(f,e.images,h.patternDependencies);for(const[t,i]of e.versions.entries())g.set(t,i);v()}}).catch(e=>{r||(r=e,v())}):(p=new Map,f=new Map,m=new Map,_=new Map)}vp&&vp({buckets:u,data:e,sourceLayerCoder:s,canonical:this.tileID.canonical,options:h}),v()};d.length>0?Promise.allSettled(d).then(f).catch(o):f()}updateParameters(e){this.scaleFactor=e.scaleFactor,this.showCollisionBoxes=e.showCollisionBoxes,this.showElevationIdDebug=e.showElevationIdDebug,this.projection=e.projection,this.brightness=e.brightness,this.tileTransform=$l(e.tileID.canonical,e.projection),this.extraShadowCaster=e.extraShadowCaster,this.lut=e.lut,this.worldview=e.worldview,this.indoor=e.indoor,this.frcCoverage=e.frcCoverage||null,this.elevation=e.elevation||null,this.crossSourceElevationEnabled=!!e.crossSourceElevationEnabled,this.terrainEnabled=!!e.terrainEnabled}updateImageMapAndGetImageTaskQueue(e,t,i){const r=new Map;for(const n of t.keys()){const o=i.get(n)||[];for(const i of o){const n=i.toString(),o=t.get(i.id.toString());o.usvg?r.has(n)||(r.set(n,i),e.set(n,{...o})):e.set(n,o)}}return r}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.abort()}}function V_(e,t,i,r,n,o){const a=new EvaluationParameters(t,{brightness:i,worldview:n,activeFloors:o});for(const t of e)t.recalculate(a,r)}class DedupedRequest{constructor(e){this.entries={},this.scheduler=e}request(e,t,i,r){const n=this.entries[e]=this.entries[e]||{callbacks:[]};if(n.result){const[e,i]=n.result;return this.scheduler?this.scheduler.add(()=>{r(e,i)},t):r(e,i),()=>{}}return n.callbacks.push(r),n.cancel||(n.cancel=i((i,r)=>{n.result=[i,r];for(const e of n.callbacks)this.scheduler?this.scheduler.add(()=>{e(i,r)},t):e(i,r);setTimeout(()=>delete this.entries[e],3e3)})),()=>{n.result||(n.callbacks=n.callbacks.filter(e=>e!==r),n.callbacks.length||(n.cancel(),delete this.entries[e]))}}}function k_(e,t,i){const r=JSON.stringify(e.request);return e.data&&(this.deduped.entries[r]={result:[null,e.data]}),this.deduped.request(r,{type:"parseTile",renderSourceType:e.renderSourceType,zoom:e.tileZoom},t=>{const r=new AbortController;return en(e.request,r.signal).then(({data:e,headers:r})=>{t(null,{rawData:e,vectorTile:i?void 0:new VectorTile(new PbfReader(e)),headers:r})}).catch(e=>{r.signal.aborted||(function(e){return"object"==typeof e&&null!==e&&"status"in e&&404===e.status}(e)?t(null,null):t(e))}),()=>{r.abort(),t(null,null)}},t)}class VectorTileWorkerSource extends Evented{constructor({actor:e,layerIndex:t,availableImages:i,availableModels:r,isSpriteLoaded:n,tileProvider:o,brightness:a,maxUniformBufferBindings:s,maxUniformBlockSizeDwords:l}){super(),this.actor=e,this.layerIndex=t,this.availableImages=i,this.availableModels=r,this.loadVectorData=k_,this.tileProvider=o,this.loading={},this.loaded={},this.deduped=new DedupedRequest(e.scheduler),this.isSpriteLoaded=n,this.scheduler=e.scheduler,this.brightness=a,this.maxUniformBufferBindings=s,this.maxUniformBlockSizeDwords=l}loadTileData(e,t){if(!this.tileProvider)return this.loadVectorData(e,t);const i=new AbortController;return this.loadTileWithProvider(this.tileProvider,e,i,t),()=>i.abort()}async loadTileWithProvider(e,t,i,r){const{z:n,x:o,y:a}=t.tileID.canonical;try{const s=await e.loadTile({z:n,x:o,y:a},{request:t.request,signal:i.signal});if(i.signal.aborted)return;if(null==s){const e=new Error("Tile not found");return e.status=404,r(e)}if(null==s.data)return r(null,null);if(s.data instanceof ImageBitmap)return r(new Error("Vector tiles require ArrayBuffer data"));const l=new Headers;s.expires&&l.set("expires",s.expires),s.cacheControl&&l.set("cache-control",s.cacheControl),r(null,{rawData:s.data,headers:l})}catch(e){if(i.signal.aborted)return;r(e instanceof Error?e:new Error(String(e)))}}_fetchTileData(e,t){return new Promise((i,r)=>{e.abort=this.loadTileData(t,(e,t)=>{e?r(e):i(t)})})}async _parse(e,t){const i=!this.isSpriteLoaded;return i&&await this.once("isSpriteLoaded"),new Promise((r,n)=>{const o=()=>e.parse(e.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(e,t)=>{e?n(e):r(t)});i&&this.scheduler?this.scheduler.add(o,{type:"parseTile",renderSourceType:t.renderSourceType,zoom:t.tileZoom}):o()})}async loadTile(e){const t=e.uid,i=e&&e.request,r=i&&i.collectResourceTiming,n=this.loading[t]=new WorkerTile(e);n.maxUniformBufferBindings=this.maxUniformBufferBindings,n.maxUniformBlockSizeDwords=this.maxUniformBlockSizeDwords;const o=(e,t)=>{const i=n.reloadCallback;i&&(delete n.reloadCallback,e||!t?i(e,null):n.parse(n.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,i))};let a,s;try{a=await this._fetchTileData(n,e)}catch(e){s=e}const l=!this.loading[t];if(delete this.loading[t],n.cancelRasterize(),s||l||!a){if(n.status="done",l||(this.loaded[t]=n),s)throw s;return null}const u=a.rawData;let c;n.vectorTile=a.vectorTile||new VectorTile(new PbfReader(u)),this.loaded=this.loaded||{},this.loaded[t]=n;try{c=await this._parse(n,e)}catch(e){throw o(e),e}if(!c)return o(null,null),null;const h={};if(r){const e=Qe(i);e.length>0&&(h.resourceTiming=JSON.parse(JSON.stringify(e)))}const d={rawTileData:u.slice(0),headers:a.headers,...c,...h};return o(null,c),d}async reloadTile(e){const t=this.loaded,i=e.uid;if(t&&t[i])return new Promise((r,n)=>{const o=t[i];o.updateParameters(e);const a=(e,t)=>{const i=o.reloadCallback;i&&(delete o.reloadCallback,o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,i)),e?n(e):r(t)};"parsing"===o.status?o.reloadCallback=a:"done"===o.status?o.vectorTile?o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,a):a():r(void 0)})}abortTile(e){const t=e.uid,i=this.loading[t];i&&(i.abort&&i.abort(),delete this.loading[t])}removeTile(e){const t=this.loaded,i=e.uid;t&&t[i]&&delete t[i]}}class MipLevel{constructor(e){this.size=e,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(e,t){const i=this.toIdx(e,t);return{min:this.minimums[i],max:this.maximums[i]}}isLeaf(e,t){return this.leaves[this.toIdx(e,t)]}toIdx(e,t){return t*this.size+e}}function N_(e,t,i,r){let n=0,o=Number.MAX_VALUE;for(let a=0;a<3;a++)if(Math.abs(r[a])<1e-15){if(i[a]<e[a]||i[a]>t[a])return null}else{const s=1/r[a];let l=(e[a]-i[a])*s,u=(t[a]-i[a])*s;if(l>u){const e=l;l=u,u=e}if(l>n&&(n=l),u<o&&(o=u),n>o)return null}return n}function U_(e,t,i,r,n,o,a,s,l,u,c){const h=r-e,d=n-t,p=o-i,f=a-e,m=s-t,_=l-i,g=c[1]*_-c[2]*m,y=c[2]*f-c[0]*_,x=c[0]*m-c[1]*f,v=h*g+d*y+p*x;if(Math.abs(v)<1e-15)return null;const b=1/v,w=u[0]-e,A=u[1]-t,E=u[2]-i,I=(w*g+A*y+E*x)*b;if(I<0||I>1)return null;const D=A*p-E*d,P=E*h-w*p,T=w*d-A*h,z=(c[0]*D+c[1]*P+c[2]*T)*b;return z<0||I+z>1?null:(f*D+m*P+_*T)*b}function G_(e,t,i,r,n,o,a,s,l){const u=1<<i,c=o-r,h=a-n,d=(e+1)/u*c+r,p=(t+0)/u*h+n,f=(t+1)/u*h+n;s[0]=(e+0)/u*c+r,s[1]=p,l[0]=d,l[1]=f}class DemMinMaxQuadTree{constructor(e){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=e,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const t=function(e){const t=e.dim,i=Math.ceil(Math.log2(t/8)),r=[];let n=Math.ceil(Math.pow(2,i));const o=(e,t,i,r,n)=>{const o=r?1:0,a=(e+1)*i-o,s=t*i,l=(t+1)*i-o;n[0]=e*i,n[1]=s,n[2]=a,n[3]=l};let a=new MipLevel(n);const s=1/n,{floatView:l,stride:u}=e,c=[];for(let i=0;i<n*n;i++){const r=Math.floor(i/n),h=i%n;o(h,r,s,!1,c);const d=H_(c[0],c[1],e),p=H_(c[2],c[1],e),f=H_(c[2],c[3],e),m=H_(c[0],c[3],e),_=Math.min(d,p,f,m),g=Math.max(0,8*h-1),y=Math.min(t-1,8*(h+1)),x=Math.max(0,8*r-1),v=Math.min(t-1,8*(r+1));let b=-1/0;for(let e=x;e<=v;e++){const t=(e+1)*u;for(let e=g;e<=y;e++){const i=l[t+e+1];i>b&&(b=i)}}a.minimums.push(_),a.maximums.push(b),a.leaves.push(1)}for(r.push(a),n/=2;n>=1;n/=2){const e=r.at(-1);a=new MipLevel(n);for(let t=0;t<n*n;t++){o(t%n,Math.floor(t/n),2,!0,c);const i=e.getElevation(c[0],c[1]),r=e.getElevation(c[2],c[1]),s=e.getElevation(c[2],c[3]),l=e.getElevation(c[0],c[3]),u=e.isLeaf(c[0],c[1]),h=e.isLeaf(c[2],c[1]),d=e.isLeaf(c[2],c[3]),p=e.isLeaf(c[0],c[3]),f=Math.min(i.min,r.min,s.min,l.min),m=Math.max(i.max,r.max,s.max,l.max),_=u&&h&&d&&p;a.maximums.push(m),a.minimums.push(f),a.leaves.push(m-f<=5&&_?1:0)}r.push(a)}return r}(this.dem),i=t.length-1,r=t[i];this._addNode(r.minimums[0],r.maximums[0],r.leaves[0]),this._construct(t,0,0,i,0)}raycastRoot(e,t,i,r,n,o,a=1){return N_([e,t,-100],[i,r,this.maximums[0]*a],n,o)}raycast(e,t,i,r,n,o,a=1){if(!this.nodeCount)return null;const s=this.raycastRoot(e,t,i,r,n,o,a);if(null==s)return null;const l=[],u=[],c=[],h=[],d=[{idx:0,t:s,nodex:0,nodey:0,depth:0}];for(;d.length>0;){const{idx:s,t:p,nodex:f,nodey:m,depth:_}=d.pop();if(this.leaves[s]){G_(f,m,_,e,t,i,r,c,h);const s=1<<_,l=f/s,u=(f+1)/s,d=m/s,g=(m+1)/s,{dim:y,floatView:x,stride:b}=this.dem,w=Math.floor(l*y),A=Math.ceil(u*y),E=Math.floor(d*y),I=A-w,D=Math.ceil(g*y)-E;if(I<=0||D<=0)continue;const P=c[0],T=c[1],z=(h[0]-P)/I,M=(h[1]-T)/D,C=Math.max(0,p),R=n[0]+o[0]*C,L=n[1]+o[1]*C,F=Math.abs(o[0])>1e-10,B=Math.abs(o[1])>1e-10,O=o[0]>=0?1:-1,V=o[1]>=0?1:-1;let k=Math.max(0,Math.min(I-1,Math.floor((R-P)/z))),N=Math.max(0,Math.min(D-1,Math.floor((L-T)/M)));const U=F?Math.abs(z/o[0]):Number.MAX_VALUE,G=B?Math.abs(M/o[1]):Number.MAX_VALUE;let j=F?C+(P+(o[0]>=0?k+1:k)*z-R)/o[0]:Number.MAX_VALUE,$=B?C+(T+(o[1]>=0?N+1:N)*M-L)/o[1]:Number.MAX_VALUE;const W=(e,t)=>x[(t+1)*b+e+1]*a;let X=W(w+k,E+N),q=W(w+k+1,E+N),Z=W(w+k,E+N+1),Y=W(w+k+1,E+N+1),J=null;for(let e=0;e<I+D;e++){const e=Math.min(j,$);if(o[2]>=0||n[2]+o[2]*e<=Math.max(X,q,Z,Y)){const e=P+k*z,t=e+z,i=T+N*M,r=i+M,a=U_(t,i,q,e,i,X,e,r,Z,n,o),s=U_(e,r,Z,t,r,Y,t,i,q,n,o);null!=a&&a>=0&&(null===J||a<J)&&(J=a),null!=s&&s>=0&&(null===J||s<J)&&(J=s)}const t=j<$;if(t?(k+=O,j+=U):(N+=V,$+=G),k<0||k>=I||N<0||N>=D)break;if(null!==J&&e>J)break;t?O>0?(X=q,Z=Y,q=W(w+k+1,E+N),Y=W(w+k+1,E+N+1)):(q=X,Y=Z,X=W(w+k,E+N),Z=W(w+k,E+N+1)):V>0?(X=Z,q=Y,Z=W(w+k,E+N+1),Y=W(w+k+1,E+N+1)):(Z=X,Y=q,X=W(w+k,E+N),q=W(w+k+1,E+N))}if(null!==J)return J||0;const K=v([],n,o,p),Q=(K[0]-c[0])/(h[0]-c[0]),ee=(K[1]-c[1])/(h[1]-c[1]),te=H_(l,d,this.dem)*a,ie=H_(u,d,this.dem)*a,re=H_(u,g,this.dem)*a;if(j_(te,ie,H_(l,g,this.dem)*a,re,Q,ee)>=K[2])return p;continue}let g=0;for(let d=0;d<this._siblingOffset.length;d++){G_((f<<1)+this._siblingOffset[d][0],(m<<1)+this._siblingOffset[d][1],_+1,e,t,i,r,c,h),c[2]=-100,h[2]=this.maximums[this.childOffsets[s]+d]*a;const p=N_(c,h,n,o);if(null!=p){const e=p;l[d]=e;let t=!1;for(let i=0;i<g&&!t;i++)e>=l[u[i]]&&(u.splice(i,0,d),t=!0);t||(u[g]=d),g++}}for(let e=0;e<g;e++){const t=u[e];d.push({idx:this.childOffsets[s]+t,t:l[t],nodex:(f<<1)+this._siblingOffset[t][0],nodey:(m<<1)+this._siblingOffset[t][1],depth:_+1})}}return null}_addNode(e,t,i){return this.minimums.push(e),this.maximums.push(t),this.leaves.push(i),this.childOffsets.push(0),this.nodeCount++}_construct(e,t,i,r,n){if(1===e[r].isLeaf(t,i))return;this.childOffsets[n]||(this.childOffsets[n]=this.nodeCount);const o=r-1,a=e[o];let s=0,l=0;for(let e=0;e<this._siblingOffset.length;e++){const r=2*t+this._siblingOffset[e][0],n=2*i+this._siblingOffset[e][1],o=a.getElevation(r,n),u=a.isLeaf(r,n),c=this._addNode(o.min,o.max,u);u&&(s|=1<<e),l||(l=c)}for(let r=0;r<this._siblingOffset.length;r++)s&1<<r||this._construct(e,2*t+this._siblingOffset[r][0],2*i+this._siblingOffset[r][1],o,l+r)}}function j_(e,t,i,r,n,o){return rt(rt(e,i,o),rt(t,r,o),n)}function H_(e,t,i){const r=i.dim,n=ve(e*r-.5,0,r-1),o=ve(t*r-.5,0,r-1),a=Math.floor(n),s=Math.floor(o),l=Math.min(a+1,r-1),u=Math.min(s+1,r-1);return j_(i.get(a,s),i.get(l,s),i.get(a,u),i.get(l,u),n-a,o-s)}const $_={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function W_(e,t,i){return(256*e*256+256*t+i)/10-1e4}function X_(e,t,i){return 256*e+t+i/256-32768}class DEMData{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(e,t,i,r=!1){if(this.uid=e,t.height!==t.width)throw new RangeError("DEM tiles must be square");if(i&&"mapbox"!==i&&"terrarium"!==i)return void ze(`"${i}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=t.height;const n=this.dim=t.height-2,o=new Uint32Array(t.data.buffer);if(this.pixels=new Uint8Array(t.data.buffer),this.floatView=new Float32Array(t.data.buffer),this.borderReady=r,this._modifiedForSources={},!r){for(let e=0;e<n;e++)o[this._idx(-1,e)]=o[this._idx(0,e)],o[this._idx(n,e)]=o[this._idx(n-1,e)],o[this._idx(e,-1)]=o[this._idx(e,0)],o[this._idx(e,n)]=o[this._idx(e,n-1)];o[this._idx(-1,-1)]=o[this._idx(0,0)],o[this._idx(n,-1)]=o[this._idx(n-1,0)],o[this._idx(-1,n)]=o[this._idx(0,n-1)],o[this._idx(n,n)]=o[this._idx(n-1,n-1)]}const a="terrarium"===i?X_:W_;for(let e=0;e<o.length;++e){const t=4*e;this.floatView[e]=a(this.pixels[t],this.pixels[t+1],this.pixels[t+2])}this._timestamp=$e.now()}_buildQuadTree(){this._tree=new DemMinMaxQuadTree(this)}get(e,t,i=!1){i&&(e=ve(e,-1,this.dim),t=ve(t,-1,this.dim));const r=this._idx(e,t);return this.floatView[r]}set(e,t,i){const r=this._idx(e,t),n=this.floatView[r];return this.floatView[r]=i,i-n}static getUnpackVector(e){return $_[e]}_idx(e,t){if(e<-1||e>=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(t+1)*this.stride+(e+1)}static pack(e,t){const i=[0,0,0,0],r=DEMData.getUnpackVector(t);let n=Math.floor((e+r[3])/r[2]);return i[2]=n%256,n=Math.floor(n/256),i[1]=n%256,n=Math.floor(n/256),i[0]=n,i}getPixels(){return new Float32Image({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,t,i){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let r=t*this.dim,n=t*this.dim+this.dim,o=i*this.dim,a=i*this.dim+this.dim;switch(t){case-1:r=n-1;break;case 1:n=r+1}switch(i){case-1:o=a-1;break;case 1:a=o+1}const s=-t*this.dim,l=-i*this.dim;for(let t=o;t<a;t++)for(let i=r;i<n;i++){const r=4*this._idx(i,t),n=4*this._idx(i+s,t+l);this.pixels[r+0]=e.pixels[n+0],this.pixels[r+1]=e.pixels[n+1],this.pixels[r+2]=e.pixels[n+2],this.pixels[r+3]=e.pixels[n+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}rn(DEMData,"DEMData"),rn(DemMinMaxQuadTree,"DemMinMaxQuadTree",{omit:["dem"]});class RasterDEMTileWorkerSource{constructor(e){this.tileProvider=e.tileProvider,this.loading={}}async loadTile(e){const t=e.uid,i=new AbortController;if(this.loading[t]={cancel:()=>i.abort()},this.tileProvider)return this.loadTileWithProvider(this.tileProvider,t,e,i);try{const{data:r,headers:n}=await en(e.request,i.signal);if(!r)return null;const o=await this.decodeTile(t,r,e.encoding);return o.headers=n,o}catch(e){if(i.signal.aborted)return null;throw e}finally{delete this.loading[t]}}async decodeTile(e,t,i){const r=t instanceof ImageBitmap?t:await createImageBitmap(new Blob([new Uint8Array(t)],{type:"image/png"}));var n;const o=1-(r.width-((n=r.width)<=1?1:Math.pow(2,Math.floor(Math.log2(n)))))/2,a=o<1,s=this.getImageData(r,o);return r.close(),{dem:new DEMData(e,s,i,a),borderReady:a}}async loadTileWithProvider(e,t,i,r){const{z:n,x:o,y:a}=i.tileID.canonical;try{const s=await e.loadTile({z:n,x:o,y:a},{request:i.request,signal:r.signal});if(r.signal.aborted)return null;if(null==s){const e=new Error("Tile not found");throw e.status=404,e}if(null==s.data)return null;const l=await this.decodeTile(t,s.data,i.encoding);if(r.signal.aborted)return null;const u=new Headers;return s.expires&&u.set("expires",s.expires),s.cacheControl&&u.set("cache-control",s.cacheControl),l.headers=u,l}catch(e){if(r.signal.aborted)return null;throw e}finally{delete this.loading[t]}}async reloadTile(e){}abortTile(e){const t=e.uid,i=this.loading[t];i&&(i.cancel(),delete this.loading[t])}removeTile(e){}getImageData(e,t){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);const i=this.offscreenCanvasContext.getImageData(-t,-t,e.width+2*t,e.height+2*t);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),i}}const q_=VectorTileFeature.prototype.toGeoJSON;class FeatureWrapper{constructor(e){this._feature=e,this.extent=Xt,this.type=4===e.type?1:e.type,this.properties=e.tags||{},"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))}loadGeometry(){const e=this._feature,t=[];if(4===e.type)t.push([new K(e.x,e.y)]);else if(1===e.type)for(let i=0;i<e.geometry.length;i+=2)t.push([new K(e.geometry[i],e.geometry[i+1])]);else for(const i of e.geometry){const e=[];for(let t=0;t<i.length;t+=2)e.push(new K(i[t],i[t+1]));t.push(e)}return t}toGeoJSON(e,t,i){return q_.call(this,e,t,i)}}class LayerWrapper{constructor(e,t){this.name=e,this.extent=Xt,this.length=t.length,this._jsonFeatures=t}feature(e){return new FeatureWrapper(this._jsonFeatures[e])}}class GeoJSONWrapper{constructor(e){this.layers={},this.extent=Xt;for(const t of Object.keys(e))this.layers[t]=new LayerWrapper(t,e[t])}}const Z_=64/4096;class GeoJSONRT{constructor(){this.features=new Map}clear(){this.features.clear()}load(e=[],t){for(const i of e){const e=i.id;if(null==e)continue;const r=this.features.get(e);if(r&&this.updateCache(r,t),i.geometry){const r=J_(i);this.updateCache(r,t),this.features.set(e,r)}else this.features.delete(e)}}updateCache(e,t){for(const{canonical:i,uid:r}of Object.values(t)){const{z:n,x:o,y:a}=i;Y_(e,Math.pow(2,n),o,a)&&delete t[r]}}getTileRaw(e,t,i){const r=Math.pow(2,e),n=[];for(const e of this.features.values())Y_(e,r,t,i)&&n.push(ig(e,r,t,i));return{features:n}}getFeatures(){return[...this.features.values()]}}function Y_({minX:e,minY:t,maxX:i,maxY:r},n,o,a){return e<(o+1+Z_)/n&&t<(a+1+Z_)/n&&i>(o-Z_)/n&&r>(a-Z_)/n}function J_(e){const{id:t,geometry:i,properties:r}=e;if("GeometryCollection"===i.type)throw new Error("GeometryCollection not supported in dynamic mode.");const{type:n,coordinates:o}=i,a={id:t,type:1,geometry:[],tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},s=a.geometry;if("Point"===n)K_(o,s,a);else if("MultiPoint"===n)for(const e of o)K_(e,s,a);else if("LineString"===n)a.type=2,Q_(o,s,a);else if("MultiLineString"===n)a.type=2,eg(o,s,a);else if("Polygon"===n)a.type=3,eg(o,s,a,!0);else{if("MultiPolygon"!==n)throw new Error("Input data is not a valid GeoJSON object.");a.type=3;for(const e of o)eg(e,s,a,!0)}return a}function K_([e,t],i,r){const n=Ct(e);let o=Rt(t);o=o<0?0:o>1?1:o,i.push(n,o),r.minX=Math.min(r.minX,n),r.minY=Math.min(r.minY,o),r.maxX=Math.max(r.maxX,n),r.maxY=Math.max(r.maxY,o)}function Q_(e,t,i,r=!1,n=!1){const o=[];for(const t of e)K_(t,o,i);t.push(o),r&&function(e,t){let i=0;for(let t=0,r=e.length,n=r-2;t<r;n=t,t+=2)i+=(e[t]-e[n])*(e[t+1]+e[n+1]);if(i>0===t)for(let t=0,i=e.length;t<i/2;t+=2){const r=e[t],n=e[t+1];e[t]=e[i-2-t],e[t+1]=e[i-1-t],e[i-2-t]=r,e[i-1-t]=n}}(o,n)}function eg(e,t,i,r=!1){for(let n=0;n<e.length;n++)Q_(e[n],t,i,r,0===n)}function tg(e,t,i){return Math.round(Xt*(e*t-i))}function ig(e,t,i,r){const{id:n,type:o,geometry:a,tags:s}=e;if(1===o){const e=a;if(2===e.length)return{id:n,type:4,x:tg(e[0],t,i),y:tg(e[1],t,r),tags:s};const o=new Int32Array(e.length);for(let n=0;n<e.length;n+=2)o[n]=tg(e[n],t,i),o[n+1]=tg(e[n+1],t,r);return{id:n,type:1,geometry:o,tags:s}}const l=[];if(2===o){const e=[];for(const n of a)rg(n,t,i,r,e);for(const t of e)l.push(new Int32Array(t))}else for(const e of a)ng(e,t,i,r,l);return{id:n,type:o,geometry:l,tags:s}}function rg(e,t,i,r,n){const o=-128,a=8320;let s;for(let l=0;l<e.length-2;l+=2){let u=tg(e[l+0],t,i),c=tg(e[l+1],t,r),h=tg(e[l+2],t,i),d=tg(e[l+3],t,r);const p=h-u,f=d-c;u<o&&h<o||(u<o?(c+=Math.round(f*((o-u)/p)),u=o):h<o&&(d=c+Math.round(f*((o-u)/p)),h=o),c<o&&d<o||(c<o?(u+=Math.round(p*((o-c)/f)),c=o):d<o&&(h=u+Math.round(p*((o-c)/f)),d=o),u>=a&&h>=a||(u>=a?(c+=Math.round(f*((a-u)/p)),u=a):h>=a&&(d=c+Math.round(f*((a-u)/p)),h=a),c>=a&&d>=a||(c>=a?(u+=Math.round(p*((a-c)/f)),c=a):d>=a&&(h=u+Math.round(p*((a-c)/f)),d=a),s&&u===s.at(-2)&&c===s.at(-1)||(s=[u,c],n.push(s)),s.push(h,d)))))}}function ng(e,t,i,r,n){const o=(i-Z_)/t,a=(r-Z_)/t,s=(i+1+Z_)/t,l=(r+1+Z_)/t;function u(e,t){let i=0;return e<o?i|=1:e>s&&(i|=2),t<a?i|=4:t>l&&(i|=8),i}let c=[];for(let t=1;t<=8;t*=2){let i=e.at(-2),r=e.at(-1),n=!(u(i,r)&t);for(let h=0;h<e.length;h+=2){const d=e[h],p=e[h+1],f=!(u(d,p)&t);f!==n&&(8&t?c.push(i+(d-i)*(l-r)/(p-r),l):4&t?c.push(i+(d-i)*(a-r)/(p-r),a):2&t?c.push(s,r+(p-r)*(s-i)/(d-i)):1&t&&c.push(o,r+(p-r)*(o-i)/(d-i))),f&&c.push(d,p),i=d,r=p,n=f}if(!(e=c).length||8===t)break;c=[]}if(!c.length)return;const h=new Int32Array(c.length);for(let e=0;e<c.length;e+=2)h[e]=tg(c[e],t,i),h[e+1]=tg(c[e+1],t,r);n.push(h)}function og({name:e,features:t},i){i.writeStringField(1,e),i.writeVarintField(5,Xt);const r=new Map,n=new Map,o={keys:r,values:n,feature:null};for(const e of t)o.feature=e,i.writeMessage(2,ag,o);for(const e of r.keys())i.writeStringField(3,e);for(const e of n.keys())i.writeMessage(4,hg,e)}function ag(e,t){const i=e.feature;void 0!==i.id&&Number.isSafeInteger(+i.id)&&t.writeVarintField(1,+i.id),i.tags&&t.writeMessage(2,sg,e),t.writeVarintField(3,4===i.type?1:i.type),t.writeMessage(4,cg,i)}function sg({keys:e,values:t,feature:i},r){const n=i.tags;for(const i of Object.keys(n)){let o=n[i];if(null===o)continue;let a=e.get(i);void 0===a&&(a=e.size,e.set(i,a)),r.writeVarint(a);const s=typeof o;"string"!==s&&"boolean"!==s&&"number"!==s&&(o=JSON.stringify(o));let l=t.get(o);void 0===l&&(l=t.size,t.set(o,l)),r.writeVarint(l)}}function lg(e,t){return(t<<3)+(7&e)}function ug(e){return e<<1^e>>31}function cg(e,t){if(4===e.type)return t.writeVarint(lg(1,1)),t.writeVarint(ug(e.x)),void t.writeVarint(ug(e.y));let i=0,r=0;if(1===e.type){const{geometry:n}=e;t.writeVarint(lg(1,n.length>>1));for(let e=0;e<n.length;e+=2){const o=n[e]-i,a=n[e+1]-r;t.writeVarint(ug(o)),t.writeVarint(ug(a)),i+=o,r+=a}}else{const n=3===e.type;for(const o of e.geometry){if(0===o.length)continue;t.writeVarint(lg(1,1));const e=(o.length>>1)-(n?1:0);for(let n=0;n<e;n++){1===n&&t.writeVarint(lg(2,e-1));const a=o[2*n]-i,s=o[2*n+1]-r;t.writeVarint(ug(a)),t.writeVarint(ug(s)),i+=a,r+=s}n&&t.writeVarint(lg(7,1))}}}function hg(e,t){const i=typeof e;"string"===i?t.writeStringField(1,e):"boolean"===i?t.writeBooleanField(7,e):"number"===i&&(e%1!=0?t.writeDoubleField(3,e):e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e))}const dg=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],pg=new Uint32Array(96);class KDBush{static from(e){if(!e||void 0===e.byteLength||e.buffer)throw new Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");const[t,i]=new Uint8Array(e,0,2);if(219!==t)throw new Error("Data does not appear to be in a KDBush format.");const r=i>>4;if(1!==r)throw new Error(`Got v${r} data when expected v1.`);const n=dg[15&i];if(!n)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(e,2,1),[a]=new Uint32Array(e,4,1);return new KDBush(a,o,n,void 0,e)}constructor(e,t=64,i=Float64Array,r=ArrayBuffer,n){if(isNaN(e)||e<0)throw new Error(`Unexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const o=dg.indexOf(this.ArrayType),a=2*e*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-s%8)%8;if(o<0)throw new Error(`Unexpected typed array class: ${i}.`);if(n)this.data=n,this.ids=new this.IndexArrayType(n,8,e),this.coords=new i(n,8+s+l,2*e),this._pos=2*e,this._finished=!0;else{const n=this.data=new r(8+a+s+l);this.ids=new this.IndexArrayType(n,8,e),this.coords=new i(n,8+s+l,2*e),this._pos=0,this._finished=!1,new Uint8Array(n,0,2).set([219,16+o]),new Uint16Array(n,2,1)[0]=t,new Uint32Array(n,4,1)[0]=e}}add(e,t){const i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=t,i}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return fg(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,i,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:o,nodeSize:a}=this;pg[0]=0,pg[1]=n.length-1,pg[2]=0;let s=3;const l=[];for(;s>0;){const u=pg[--s],c=pg[--s],h=pg[--s];if(c-h<=a){for(let a=h;a<=c;a++){const s=o[2*a],u=o[2*a+1];s>=e&&s<=i&&u>=t&&u<=r&&l.push(n[a])}continue}const d=h+c>>1,p=o[2*d],f=o[2*d+1];p>=e&&p<=i&&f>=t&&f<=r&&l.push(n[d]),(0===u?e<=p:t<=f)&&(pg[s++]=h,pg[s++]=d-1,pg[s++]=1-u),(0===u?i>=p:r>=f)&&(pg[s++]=d+1,pg[s++]=c,pg[s++]=1-u)}return l}within(e,t,i){const r=[];return this.withinInto(e,t,i,r),r}withinInto(e,t,i,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:o,nodeSize:a}=this;pg[0]=0,pg[1]=n.length-1,pg[2]=0;let s=3,l=0;const u=i*i;for(;s>0;){const c=pg[--s],h=pg[--s],d=pg[--s];if(h-d<=a){for(let i=d;i<=h;i++)yg(o[2*i],o[2*i+1],e,t)<=u&&(r[l++]=n[i]);continue}const p=d+h>>1,f=o[2*p],m=o[2*p+1];yg(f,m,e,t)<=u&&(r[l++]=n[p]),(0===c?e-i<=f:t-i<=m)&&(pg[s++]=d,pg[s++]=p-1,pg[s++]=1-c),(0===c?e+i>=f:t+i>=m)&&(pg[s++]=p+1,pg[s++]=h,pg[s++]=1-c)}return l}}function fg(e,t,i,r,n,o){if(n-r<=i)return;const a=r+n>>1;mg(e,t,a,r,n,o),fg(e,t,i,r,a-1,1-o),fg(e,t,i,a+1,n,1-o)}function mg(e,t,i,r,n,o){for(;n>r;){if(n-r>600){const a=n-r+1,s=i-r+1,l=Math.log(a),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(a-u)/a)*(s-a/2<0?-1:1);mg(e,t,i,Math.max(r,Math.floor(i-s*u/a+c)),Math.min(n,Math.floor(i+(a-s)*u/a+c)),o)}const a=t[2*i+o];let s=r,l=n;for(_g(e,t,r,i),t[2*n+o]>a&&_g(e,t,r,n);s<l;){for(_g(e,t,s,l),s++,l--;t[2*s+o]<a;)s++;for(;t[2*l+o]>a;)l--}t[2*r+o]===a?_g(e,t,r,l):(l++,_g(e,t,l,n)),l<=i&&(r=l+1),i<=l&&(n=l-1)}}function _g(e,t,i,r){gg(e,i,r),gg(t,2*i,2*r),gg(t,2*i+1,2*r+1)}function gg(e,t,i){const r=e[t];e[t]=e[i],e[i]=r}function yg(e,t,i,r){const n=e-i,o=t-r;return n*n+o*o}const xg={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},vg=1073741824,bg=1/vg,wg=e=>(e-.5)*vg,Ag=e=>e*bg+.5;class Supercluster{constructor(e){const t=this.options=Object.assign(Object.create(xg),e);t.maxZoom=Math.min(t.maxZoom,30),t.minZoom=Math.min(t.minZoom,t.maxZoom),this.trees=new Array(t.maxZoom+1),this.stride=t.reduce?7:6,this.clusterProps=[]}load(e){const{log:t,minZoom:i,maxZoom:r}=this.options;t&&console.time("total time");const n=r+1,o=`z${n}: ${e.length} points`;t&&console.time(o);const a=this.stride;let s=e.length;for(const t of e){const e=t.geometry;e&&"MultiPoint"===e.type&&(s+=e.coordinates.length-1)}this.numPoints=s;const l=this.props=new Array(s),u=this.coords=new Float64Array(2*s);let c=null;const h=new Int32Array(s*a);let d=0,p=0;for(const t of e){const e=t.geometry;if(!e){p++;continue}const i=e.coordinates,r="MultiPoint"===e.type;for(let e=0,o=r?i.length:1;e<o;e++,p++){const[o,f]=r?i[e]:i,m=Ig(o),_=Sg(f);u[2*p]=m,u[2*p+1]=_,h[d]=wg(m),h[d+1]=wg(_),h[d+2]=n,h[d+3]=p,h[d+4]=-1,h[d+5]=1,l[p]=t.properties,void 0!==t.id&&(c||(c=new Array(s)),c[p]=t.id),d+=a}}this.ids=c;let f=d===h.length?h:h.subarray(0,d),m=d/a;this.trees[r+1]=this._createTree(f,m),t&&console.timeEnd(o);let _=null;for(let e=r;e>=i;e--){const i=performance.now(),r=_||new Int32Array(m*a);_=null;const n=this._cluster(f,m,e,r);n===m?(this.trees[e]=this.trees[e+1],_=r):(this.trees[e]=this._createTree(r,n),f=r,m=n),t&&console.log(`z${e}: ${this.trees[e].numItems} clusters in ${(performance.now()-i).toFixed(2)}ms`)}return t&&console.timeEnd("total time"),this}getClusters(e,t){let i=((e[0]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,e[1]));let n=180===e[2]?180:((e[2]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)i=-180,n=180;else if(i>n){const e=this.getClusters([i,r,180,o],t),a=this.getClusters([-180,r,n,o],t);return e.concat(a)}const a=this.trees[this._limitZoom(t)],s=a.range(wg(Ig(i)),wg(Sg(o)),wg(Ig(n)),wg(Sg(r))),l=a.data,u=[];for(const e of s)u.push(this._featureJSON(l,this.stride*e));return u}getChildren(e){const t=this._getOriginId(e),i=this._getOriginZoom(e),r="No cluster with the specified id.",n=this.trees[i];if(!n)throw new Error(r);const o=n.data;if(t>=n.numItems)throw new Error(r);const a=this.options.radius/(this.options.extent*Math.pow(2,i-1)),s=n.within(o[t*this.stride],o[t*this.stride+1],a*vg),l=[];for(const t of s){const i=t*this.stride;o[i+4]===e&&l.push(this._featureJSON(o,i))}if(0===l.length)throw new Error(r);return l}getLeaves(e,t,i){const r=[];return this._appendLeaves(r,e,t=t||10,i=i||0,0),r}getTile(e,t,i){return this._getTile(e,t,i,!1)}getTileRaw(e,t,i){return this._getTile(e,t,i,!0)}_getTile(e,t,i,r){const n=this.trees[this._limitZoom(e)],o=Math.pow(2,e),{extent:a,radius:s}=this.options,l=s/a,u=wg((i-l)/o),c=wg((i+1+l)/o),h={features:[]};return this._addTileFeatures(n.range(wg((t-l)/o),u,wg((t+1+l)/o),c),n.data,t,i,o,h,r),0===t&&this._addTileFeatures(n.range(wg(1-l/o),u,wg(1),c),n.data,o,i,o,h,r),t===o-1&&this._addTileFeatures(n.range(wg(0),u,wg(l/o),c),n.data,-1,i,o,h,r),h.features.length?h:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){const i=this.getChildren(e);if(t++,1!==i.length)break;e=i[0].properties.cluster_id}return t}_appendLeaves(e,t,i,r,n){const o=this.getChildren(t);for(const t of o){const o=t.properties;if(o&&o.cluster?n+o.point_count<=r?n+=o.point_count:n=this._appendLeaves(e,o.cluster_id,i,r,n):n<r?n++:e.push(t),e.length===i)break}return n}_createTree(e,t){const i=new KDBush(t,this.options.nodeSize,Int32Array),r=this.stride;for(let n=0;n<t;n++)i.add(e[n*r],e[n*r+1]);return i.finish(),i.data=e,i}_addTileFeatures(e,t,i,r,n,o,a){for(const s of e){const e=s*this.stride,l=t[e+5]>1;let u,c,h;if(l)u=Eg(t,e,this.clusterProps),c=Ag(t[e]),h=Ag(t[e+1]);else{const i=t[e+3];u=this.props[i],c=this.coords[2*i],h=this.coords[2*i+1]}const d=Math.round(this.options.extent*(c*n-i)),p=Math.round(this.options.extent*(h*n-r)),f=a?{type:4,x:d,y:p,tags:u}:{type:1,geometry:[[d,p]],tags:u},m=t[e+3],_=l||this.options.generateId?m:this.ids?this.ids[m]:void 0;void 0!==_&&(f.id=_),o.features.push(f)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t,i,r){const{radius:n,extent:o,reduce:a,minPoints:s,maxZoom:l}=this.options,u=n/(o*(1<<i))*vg,c=l+1,h=this.trees[i+1],d=this.stride,p=t*d,f=new Uint32Array(t);let m=0;for(let t=0;t<p;t+=d){if(e[t+2]<=i)continue;e[t+2]=i;const n=e[t],o=e[t+1],l=h.withinInto(n,o,u,f),p=e[t+5];let _=p;for(let t=0;t<l;t++){const r=f[t]*d;e[r+2]>i&&(_+=e[r+5])}if(_>p&&_>=s){let s,u=n*p,h=o*p,g=-1;const y=(t/d<<5)+(i+1)+this.numPoints;for(let r=0;r<l;r++){const n=f[r]*d;if(e[n+2]<=i)continue;e[n+2]=i;const o=e[n+5];u+=e[n]*o,h+=e[n+1]*o,e[n+4]=y,a&&(s||(s=this._map(e,t,!0),g=this.clusterProps.length,this.clusterProps.push(s)),a(s,this._map(e,n)))}e[t+4]=y,r[m]=u/_,r[m+1]=h/_,r[m+2]=c,r[m+3]=y,r[m+4]=-1,r[m+5]=_,a&&(r[m+6]=g),m+=d}else{for(let i=0;i<d;i++)r[m+i]=e[t+i];if(m+=d,_>1)for(let t=0;t<l;t++){const n=f[t]*d;if(!(e[n+2]<=i)){e[n+2]=i;for(let t=0;t<d;t++)r[m+t]=e[n+t];m+=d}}}}return m/d}_getOriginId(e){return e-this.numPoints>>5}_getOriginZoom(e){return(e-this.numPoints)%32}_featureJSON(e,t){const i=e[t+3],r=e[t+5]>1,n=r?i:this.ids?this.ids[i]:void 0,o={type:"Feature",properties:r?Eg(e,t,this.clusterProps):this.props[i],geometry:{type:"Point",coordinates:r?[Dg(Ag(e[t])),Pg(Ag(e[t+1]))]:[Dg(this.coords[2*i]),Pg(this.coords[2*i+1])]}};return void 0!==n&&(o.id=n),o}_map(e,t,i){if(e[t+5]>1){const r=this.clusterProps[e[t+6]];return i?Object.assign({},r):r}const r=this.props[e[t+3]],n=this.options.map(r);return i&&n===r?Object.assign({},n):n}}function Eg(e,t,i){const r=e[t+5],n=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?Math.round(r/100)/10+"k":r,o=e[t+6],a=-1===o?{}:Object.assign({},i[o]);return Object.assign(a,{cluster:!0,cluster_id:e[t+3],point_count:r,point_count_abbreviated:n})}function Ig(e){return e/360+.5}function Sg(e){const t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function Dg(e){return 360*(e-.5)}function Pg(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}const Tg=2147483647;function zg(e,t,i,r){return{id:e,type:4,x:t,y:i,tags:r}}function Mg(e,t,i,r){const n={id:e,type:t,geometry:i,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(1===t)Cg(n,i,0,i.length);else{const e=3===t;for(let t=0;t<i.length;){const r=t+2,o=r+3*i[t];(!e||i[t+1]>=0)&&Cg(n,i,r,o),t=o}}return n}function Cg(e,t,i,r){for(let n=i;n<r;n+=3){const i=t[n],r=t[n+1];i<e.minX&&(e.minX=i),r<e.minY&&(e.minY=r),i>e.maxX&&(e.maxX=i),r>e.maxY&&(e.maxY=r)}}function Rg(e,t,i,r){let n=r;const o=t+(i-t>>1);let a,s=i-t;const l=e[t],u=e[t+1],c=e[i],h=e[i+1];for(let r=t+3;r<i;r+=3){const t=Lg(e[r],e[r+1],l,u,c,h);if(t>n)a=r,n=t;else if(t===n){const e=Math.abs(r-o);e<s&&(a=r,s=e)}}if(n>r){const o=a;o-t>3&&Rg(e,t,o,r),e[o+2]=Math.min(Math.sqrt(n),Tg),i-o>3&&Rg(e,o,i,r)}}function Lg(e,t,i,r,n,o){let a=n-i,s=o-r;if(0!==a||0!==s){const l=((e-i)*a+(t-r)*s)/(a*a+s*s);l>1?(i=n,r=o):l>0&&(i+=a*l,r+=s*l)}return a=e-i,s=t-r,a*a+s*s}const Fg="Input data is not a valid GeoJSON object.";function Bg(e,t,i,r){const n=t.geometry;if(!n)return;const o="GeometryCollection"===n.type?n.geometries:n.coordinates;if(!o)throw new Error(Fg);if(!o.length)return;const a=i.tolerance*i.worldScale/((1<<i.maxZoom)*i.extent),s=a*a,l=t.properties,u=i.CoordArray,c=i.worldScale,h=i.originShift,d=i.useInt32;let p=t.id;if(i.promoteId?p=t.properties?.[i.promoteId]:i.generateId&&(p=r||0),"Point"===n.type)e.push(zg(p,jg(n.coordinates[0],c,h),Hg(n.coordinates[1],c,h),l));else if("MultiPoint"===n.type){const t=n.coordinates,r=new u(3*t.length);for(let e=0;e<t.length;e++)r[3*e]=Gg(jg(t[e][0],c,h),d),r[3*e+1]=Gg(Hg(t[e][1],c,h),d);kg(e,p,1,r,l,i)}else if("LineString"===n.type)Ng(e,p,n.coordinates,l,s,i);else if("MultiLineString"===n.type&&i.lineMetrics)for(const t of n.coordinates)Ng(e,p,t,l,s,i);else if("MultiLineString"===n.type||"Polygon"===n.type||"MultiPolygon"===n.type){const t="MultiLineString"!==n.type,r="MultiPolygon"===n.type?n.coordinates:[n.coordinates];let o=0;for(const e of r)o+=Og(e);const a=new u(o);let f=0;for(const e of r)for(let i=0;i<e.length;i++)f=Ug(a,f,e[i],s,t,t&&0===i,c,h,d);kg(e,p,t?3:2,a,l,i)}else{if("GeometryCollection"!==n.type)throw new Error(Fg);for(const o of n.geometries)Bg(e,{id:p,geometry:o,properties:t.properties},i,r)}}function Og(e){let t=0;for(const i of e)i.length>0&&(t+=2+3*i.length);return t}let Vg=0;function kg(e,t,i,r,n,o,a){const s=Mg(t,i,r,n);2===i&&o.lineMetrics&&(s.start=0,s.end=s.size=a),e.push(s)}function Ng(e,t,i,r,n,o){const a=new o.CoordArray(2+3*i.length);Ug(a,0,i,n,!1,!1,o.worldScale,o.originShift,o.useInt32),kg(e,t,2,a,r,o,Vg)}function Ug(e,t,i,r,n,o,a,s,l){if(0===i.length)return t;const u=t,c=t+=2;let h=0,d=0,p=0;for(let r=0;r<i.length;r++){const o=Gg(jg(i[r][0],a,s),l),u=Gg(Hg(i[r][1],a,s),l);if(e[t]=o,e[t+1]=u,t+=3,r>0)if(n)p+=(h*u-o*d)/2;else{const e=o-h,t=u-d;p+=Math.sqrt(e*e+t*t)}h=o,d=u}const f=t;if(n&&(o&&p<0||!o&&p>=0)){const t=f-c;for(let i=0;i<t/2;i+=3){const t=c+i,r=f-3-i,n=e[t],o=e[t+1],a=e[t+2];e[t]=e[r],e[t+1]=e[r+1],e[t+2]=e[r+2],e[r]=n,e[r+1]=o,e[r+2]=a}p=-p}const m=f-3;return e[c+2]=Tg,Rg(e,c,m,r),e[m+2]=Tg,e[u]=(f-c)/3,n?e[u+1]=Math.sign(p)*Math.sqrt(Math.abs(p)):(Vg=p,e[u+1]=Math.min(p,Tg)),t}function Gg(e,t){return t?Math.floor(e+.5):e}function jg(e,t,i){return(e/360+.5-i)*t}function Hg(e,t,i){const r=Math.sin(e*Math.PI/180),n=.5-.25*Math.log((1+r)/(1-r))/Math.PI;return((n<0?0:n>1?1:n)-i)*t}function $g(e,t,i,r,n,o,a){if(n>=t&&o<i)return e;if(o<t||n>=i)return null;const s=a.lineMetrics,l=a.CoordArray;let u=null;for(let n=0;n<e.length;n++){const o=e[n],a=o.type;if(4===a){const a=0===r?o.x:o.y;a>=t&&a<i?null!==u&&u.push(o):null===u&&(u=e.slice(0,n));continue}const c=o.geometry,h=0===r?o.minX:o.minY,d=0===r?o.maxX:o.maxY;h>=t&&d<i?null!==u&&u.push(o):d<t||h>=i?null===u&&(u=e.slice(0,n)):(null===u&&(u=e.slice(0,n)),1!==a?Xg(c,a,t,i,r,o,u,s,l):Wg(c,t,i,r,o,u,l))}return null===u?e:u.length?u:null}function Wg(e,t,i,r,n,o,a){let s=0;for(let n=0;n<e.length;n+=3)e[n+r]>=t&&e[n+r]<i&&(s+=3);if(0===s)return;const l=new a(s);let u=0;for(let n=0;n<e.length;n+=3)e[n+r]>=t&&e[n+r]<i&&(l[u]=e[n],l[u+1]=e[n+1],l[u+2]=e[n+2],u+=3);o.push(Mg(n.id,1,l,n.tags))}function Xg(e,t,i,r,n,o,a,s,l){const u=3===t;let c=0;for(let t=0;t<e.length;){const o=t+2+3*e[t];c+=qg(e,t+2,o,i,r,n,u),t=o}if(0===c)return;let h=new l(c);const d=l===Int32Array,p=s&&2===t?[]:null;let f=0;for(let t=0;t<e.length;){const a=t+2+3*e[t];f=Zg(e,t+2,a,e[t+1],h,f,i,r,n,u,d,p,o.start||0),t=a}if(f<c&&(h=h.subarray(0,f)),null!==p)for(let e=0,t=0;e<h.length;t+=2){const i=e+2+3*h[e],r=Mg(o.id,2,h.slice(e,i),o.tags);r.start=p[t],r.end=p[t+1],r.size=o.size,a.push(r),e=i}else a.push(Mg(o.id,t,h,o.tags))}function qg(e,t,i,r,n,o,a){let s=0,l=0,u=0,c=0;for(let h=t;h<i-3;h+=3){const t=e[h+o],i=e[h+3+o];let d=!1;t<r?i>=r&&(u++,c++):t>n?i<=n&&(u++,c++):u++,i<r&&t>=r&&(u++,c++,d=!0),i>n&&t<=n&&(u++,c++,d=!0),!a&&d&&(u>0&&(l+=u,s++),u=0)}const h=e[i-3+o];return h>=r&&h<=n&&u++,a&&u>=2&&c>=1&&u++,u>0&&(l+=u,s++),3*l+2*s}function Zg(e,t,i,r,n,o,a,s,l,u,c,h,d){const p=null!==h;let f=o;n[o]=0,n[o+1]=r;let m=o+=2,_=d,g=_,y=0,x=0;for(let d=t;d<i-3;d+=3){const t=e[d],i=e[d+1],v=e[d+2],b=e[d+3],w=e[d+4],A=0===l?t:i,E=0===l?b:w;let I=!1;if(p&&(y=Math.sqrt((t-b)*(t-b)+(i-w)*(i-w))),A<a?E>=a&&(x=Yg(n,o,t,i,b,w,a,l,c),o+=3,p&&(g=_+y*x)):A>s?E<=s&&(x=Yg(n,o,t,i,b,w,s,l,c),o+=3,p&&(g=_+y*x)):(n[o]=t,n[o+1]=i,n[o+2]=v,o+=3),E<a&&A>=a&&(x=Yg(n,o,t,i,b,w,a,l,c),o+=3,I=!0),E>s&&A<=s&&(x=Yg(n,o,t,i,b,w,s,l,c),o+=3,I=!0),!u&&I){const e=(o-m)/3;e>0&&(n[f]=e,p&&h.push(g,_+y*x),f=o,n[o]=0,n[o+1]=r,m=o+=2)}p&&(_+=y)}const v=i-3,b=e[v],w=e[v+1],A=e[v+2],E=0===l?b:w;E>=a&&E<=s&&(n[o]=b,n[o+1]=w,n[o+2]=A,o+=3),u&&o-m>=6&&(n[o-3]!==n[m]||n[o-2]!==n[m+1])&&(n[o]=n[m],n[o+1]=n[m+1],n[o+2]=n[m+2],o+=3);const I=(o-m)/3;return I>0?(n[f]=I,p&&h.push(g,_)):o=f,o}function Yg(e,t,i,r,n,o,a,s,l){let u;if(0===s){u=(a-i)/(n-i);const s=r+(o-r)*u;e[t]=a,e[t+1]=l?Math.floor(s+.5):s}else{u=(a-r)/(o-r);const s=i+(n-i)*u;e[t]=l?Math.floor(s+.5):s,e[t+1]=a}return e[t+2]=Tg,u}function Jg(e,t){const i=[];for(const r of e){if(4===r.type){i.push(zg(r.id,r.x+t,r.y,r.tags));continue}const e=Kg(r.geometry,r.type,t),n=Mg(r.id,r.type,e,r.tags);void 0!==r.start&&(n.start=r.start,n.end=r.end,n.size=r.size),i.push(n)}return i}function Kg(e,t,i){const r=e.slice();if(1===t)for(let e=0;e<r.length;e+=3)r[e]+=i;else for(let e=0;e<r.length;){const t=e+2+3*r[e];for(let n=e+2;n<t;n+=3)r[n]+=i;e=t}return r}function Qg(e,t,i,r,n){const o=n.extent,a=n.worldScale,s=n.originShift,l=t===n.maxZoom?0:n.tolerance*a/((1<<t)*o),u=1<<t,c=o+n.buffer<=32767?Int16Array:Int32Array,h={features:[],numPoints:0,numSimplified:0,numFeatures:e.length,source:null,x:i,y:r,z:t,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const t of e)ty(h,t,l,n,u,i,r,o,c,a,s);return h}function ey(e,t,i,r,n,o){return Math.round(r*((e/n+o)*t-i))}function ty(e,t,i,r,n,o,a,s,l,u,c){const h=t.type;if(4===h){const i=t.x,r=t.y;i<e.minX&&(e.minX=i),r<e.minY&&(e.minY=r),i>e.maxX&&(e.maxX=i),r>e.maxY&&(e.maxY=r),e.numPoints++,e.numSimplified++;const l={x:ey(i,n,o,s,u,c),y:ey(r,n,a,s,u,c),type:4,tags:t.tags||null};return void 0!==t.id&&(l.id=t.id),void e.features.push(l)}const d=t.geometry;let p;if(t.minX<e.minX&&(e.minX=t.minX),t.minY<e.minY&&(e.minY=t.minY),t.maxX>e.maxX&&(e.maxX=t.maxX),t.maxY>e.maxY&&(e.maxY=t.maxY),1===h){const t=d.length/3;p=new l(2*t);for(let e=0,t=0;e<d.length;e+=3,t+=2)p[t]=ey(d[e],n,o,s,u,c),p[t+1]=ey(d[e+1],n,a,s,u,c);if(e.numPoints+=t,e.numSimplified+=t,!p.length)return}else{p=[];for(let t=0;t<d.length;){const r=t+2,h=r+3*d[t];iy(p,d,r,h,d[t+1],e,i,0,n,o,a,s,l,u,c),t=h}if(!p.length)return}let f=t.tags||null;if(2===h&&r.lineMetrics){f={};for(const e in t.tags)f[e]=t.tags[e];const e=t.start,i=t.end,r=t.size,o=s*n/u;f.mapbox_clip_feature_len=r*o,f.mapbox_clip_seg_len=(i-e)*o,f.mapbox_clip_start=r>0?Math.max(0,e/r):0,f.mapbox_clip_end=i>=r?1:i/r}const m={geometry:p,type:h,tags:f};void 0!==t.id&&(m.id=t.id),e.features.push(m)}function iy(e,t,i,r,n,o,a,s,l,u,c,h,d,p,f){const m=(r-i)/3;if(Math.abs(n)<a)return void(o.numPoints+=m);let _=0;if(0===a)_=m;else for(let e=i;e<r;e+=3)t[e+2]>a&&_++;o.numPoints+=m,o.numSimplified+=_;const g=new d(2*_);let y=0;for(let e=i;e<r;e+=3)(0===a||t[e+2]>a)&&(g[y++]=ey(t[e],l,u,h,p,f),g[y++]=ey(t[e+1],l,c,h,p,f));e.push(g)}const ry={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class GeoJSONVT{constructor(e,t){const i=this.options=Object.assign(Object.create(ry),t),r=i.debug;if(r&&console.time("preprocess data"),i.maxZoom<0||i.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(i.promoteId&&i.generateId)throw new Error("promoteId and generateId cannot be used together.");const n=(i.extent+2*i.buffer)*(1<<i.maxZoom)<4294967296;i.useInt32=n,i.CoordArray=n?Int32Array:Float64Array,i.worldScale=n?i.extent*(1<<i.maxZoom):1,i.originShift=n?.5:0;let o=function(e,t){const i=[];if("FeatureCollection"===e.type)for(let r=0;r<e.features.length;r++)Bg(i,e.features[r],t,r);else Bg(i,"Feature"===e.type?e:{geometry:e,properties:null},t);return i}(e,i);if(this.tiles={},this.tileCoords=[],this.stats={},this.total=0,r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",i.indexMaxZoom,i.indexMaxPoints),console.time("generate tiles")),o=function(e,t){const i=t.worldScale,r=t.originShift,n=t.buffer*i/t.extent,o=-r*i,a=(1-r)*i;let s=e;const l=$g(e,o-i-n,o+n,0,o-i,a+i,t),u=$g(e,a-n,a+i+n,0,o-i,a+i,t);return(l||u)&&(s=$g(e,o-n,a+n,0,o-i,a+i,t)||[],l&&(s=Jg(l,i).concat(s)),u&&(s=s.concat(Jg(u,-i)))),s}(o,i),o.length&&this.splitTile(o,0,0,0),r){const e=this.tiles[0];e&&console.log(`features: ${e.numFeatures}, points: ${e.numPoints}`),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats))}}splitTile(e,t,i,r,n,o,a){const s=[e],l=[t,i,r],u=this.options,c=u.debug;for(;s.length;){r=l.pop(),i=l.pop(),t=l.pop(),e=s.pop();const h=1<<t,d=oy(t,i,r);let p=this.tiles[d];if(p||(c>1&&console.time("creation"),p=this.tiles[d]=Qg(e,t,i,r,u),this.tileCoords.push({z:t,x:i,y:r}),this.stats[t]=(this.stats[t]||0)+1,this.total++,c>1&&(console.log(`tile z${t}-${i}-${r} (features: ${p.numFeatures}, points: ${p.numPoints}, simplified: ${p.numSimplified})`),console.timeEnd("creation"))),p.source=e,null==n){if(t===u.indexMaxZoom||p.numPoints<=u.indexMaxPoints)continue}else{if(t===u.maxZoom||t===n)continue;{const e=n-t;if(i!==o>>e||r!==a>>e)continue}}if(p.source=null,0===e.length)continue;c>1&&console.time("clipping");const f=u.worldScale,m=u.originShift,_=f/h,g=.5*u.buffer*f/(h*u.extent),y=(i/h-m)*f,x=(r/h-m)*f;let v=null,b=null,w=null,A=null;const E=$g(e,y-g,y+_/2+g,0,p.minX,p.maxX,u),I=$g(e,y+_/2-g,y+_+g,0,p.minX,p.maxX,u);E&&(v=$g(E,x-g,x+_/2+g,1,p.minY,p.maxY,u),b=$g(E,x+_/2-g,x+_+g,1,p.minY,p.maxY,u)),I&&(w=$g(I,x-g,x+_/2+g,1,p.minY,p.maxY,u),A=$g(I,x+_/2-g,x+_+g,1,p.minY,p.maxY,u)),c>1&&console.timeEnd("clipping"),s.push(v||[],b||[],w||[],A||[]),l.push(t+1,2*i,2*r,t+1,2*i,2*r+1,t+1,2*i+1,2*r,t+1,2*i+1,2*r+1)}}getTile(e,t,i){const r=this.findTile(e,t,i);return r?function(e){const t=[];for(const i of e.features){let e;e=4===i.type?{type:1,geometry:[[i.x,i.y]],tags:i.tags??null}:1===i.type?{type:1,geometry:ny(i.geometry),tags:i.tags??null}:{type:i.type,geometry:i.geometry.map(ny),tags:i.tags??null},null!=i.id&&(e.id=i.id),t.push(e)}return{features:t}}(r):null}getTileRaw(e,t,i){const r=this.findTile(e,t,i);return r?{features:r.features}:null}findTile(e,t,i){const r=this.options.debug;if((e=+e)<0||e>24)return null;const n=1<<e,o=oy(e,t=(t=+t)+n&n-1,i=+i);if(this.tiles[o])return this.tiles[o];r>1&&console.log("drilling down to z%d-%d-%d",e,t,i);let a,s=e,l=t,u=i;for(;!a&&s>0;)s--,l>>=1,u>>=1,a=this.tiles[oy(s,l,u)];return a&&a.source?(r>1&&(console.log("found parent tile z%d-%d-%d",s,l,u),console.time("drilling down")),this.splitTile(a.source,s,l,u,e,t,i),r>1&&console.timeEnd("drilling down"),this.tiles[o]??null):null}}function ny(e){const t=[];for(let i=0;i<e.length;i+=2)t.push([e[i],e[i+1]]);return t}function oy(e,t,i){return 32*((1<<e)*i+t)+e}function ay(e,t){const i=e.tileID.canonical;if(!this._geoJSONIndex)return void t(null,null);const r=this._geoJSONIndex.getTileRaw(i.z,i.x,i.y);if(!r)return void t(null,null);const n=e=>e.tags&&"3d_elevation_id"in e.tags&&"source"in e.tags&&"elevation"===e.tags.source,o=r.features.filter(n);let a={_geojsonTileLayer:r.features};o.length>0&&(a={_geojsonTileLayer:r.features.filter(e=>!n(e)),hd_road_elevation:o});const s=new GeoJSONWrapper(a),l=function(e){const t=new PbfWriter;for(const i of Object.keys(e))t.writeMessage(3,og,{name:i,features:e[i]});return t.finish()}(a).buffer;t(null,{vectorTile:s,rawData:l,headers:new Headers})}class GeoJSONWorkerSource extends VectorTileWorkerSource{constructor(e){super(e),this.loadVectorData=ay,this._dynamicIndex=new GeoJSONRT}async loadData(e){const t=e&&e.request,i=t&&t.collectResourceTiming;this._geoJSONIndex=null;let r=await new Promise((t,i)=>{this.loadGeoJSON(e,(e,r)=>{e?i(e):t(r)})});if(!r)return{};if("object"!=typeof r)throw new Error(`Input data given to 
2\'${e.source}\' is not a valid GeoJSON object.`);if(e.filter){const t=Ur(e.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===t.result)throw new Error(t.value.map(e=>`${e.key}: ${e.message}`).join(", "));r.features=r.features.filter(e=>t.value.evaluate({zoom:0},e))}e.dynamic?("Feature"===r.type&&(r={type:"FeatureCollection",features:[r]}),e.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(r.features,this.loaded),e.cluster&&(r.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=e.cluster?new Supercluster(function({superclusterOptions:e,clusterProperties:t}){if(!t||!e)return e;const i={},r={},n={accumulated:null,zoom:0},o={properties:null},a=Object.keys(t);for(const e of a){const[n,o]=t[e],a=Ur(o),s=Ur("string"==typeof n?[n,["accumulated"],["get",e]]:n);i[e]=a.value,r[e]=s.value}return e.map=e=>{o.properties=e;const t={};for(const e of a)t[e]=i[e].evaluate(n,o);return t},e.reduce=(e,t)=>{o.properties=t;
vendor: 5,510 bytes, line 2
2for(const t of a)n.accumulated=e[t],e[t]=r[t].evaluate(n,o)},e}(e)).load(r.features):e.dynamic?this._dynamicIndex:new GeoJSONVT(r,e.geojsonVtOptions);const n={};if(i){const i=Qe(t);i&&(n.resourceTiming={},n.resourceTiming[e.source]=JSON.parse(JSON.stringify(i)))}return n}async reloadTile(e){const t=this.loaded;if(t&&t[e.uid]){if(e.partial)return;return super.reloadTile(e)}return this.loadTile(e)}loadGeoJSON(e,t){if(e.request)(async function(e,t){return Qr(Object.assign(e,{type:"json"}),t)})(e.request).then(({data:e})=>t(null,e)).catch(e=>t(e));else{if("string"!=typeof e.data)return t(new Error(`Input data given to \'${e.source}\' is not a valid GeoJSON object.`));setTimeout(()=>{try{return t(null,JSON.parse(e.data))}catch(i){return t(new Error(`Input data given to \'${e.source}\' is not a valid GeoJSON object.`))}},0)}}getClusterExpansionZoom(e){return this._geoJSONIndex.getClusterExpansionZoom(e.clusterId)}getClusterChildren(e){return this._geoJSONIndex.getChildren(e.clusterId)}getClusterLeaves(e){return this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset)}}class LRUCache{constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;const t=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,t),t}put(e,t){this.cache.has(e)?this.cache.delete(e):this.cache.size===this.capacity&&this.cache.delete(this.cache.keys().next().value),this.cache.set(e,t)}delete(e){this.cache.delete(e)}}function sy(e,t){const i={};let r;for(;r=e.nextField(t);)1===r?(i.delta_filter=ly(e,e.readVarint()+e.pos),i.filter="delta_filter"):2===r?(e.readVarint(),i.filter="zigzag_filter"):3===r?(e.readVarint(),i.filter="bitshuffle_filter"):4===r&&(e.readVarint(),i.filter="byteshuffle_filter");return i}function ly(e,t){const i={blockSize:0};let r;for(;r=e.nextField(t);)1===r&&(i.blockSize=e.readVarint());return i}function uy(e,t){const i={};let r;for(;r=e.nextField(t);)1===r?(e.readVarint(),i.codec="gzip_data"):2===r?(e.readVarint(),i.codec="jpeg_image"):3===r?(e.readVarint(),i.codec="webp_image"):4===r&&(e.readVarint(),i.codec="png_image");return i}function cy(e,t){const i={firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]};let r,n=0,o=0;for(;r=e.nextField(t);)1===r?i.firstByte=e.readFixed64():2===r?i.lastByte=e.readFixed64():3===r?i.filters.push(sy(e,e.readVarint()+e.pos)):4===r?i.codec=uy(e,e.readVarint()+e.pos):5===r?o=e.readFloat():6===r?n=e.readFloat():7===r?i.bands.push(e.readString()):8===r?i.offset=e.readDouble():9===r&&(i.scale=e.readDouble());return 0===i.offset&&(i.offset=o),0===i.scale&&(i.scale=n),i}function hy(e,t){const i={version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]};let r;for(;r=e.nextField(t);)1===r?i.version=e.readVarint():2===r?i.name=e.readString():3===r?i.units=e.readString():4===r?i.tileSize=e.readVarint():5===r?i.buffer=e.readVarint():6===r?i.pixelFormat=e.readVarint():7===r&&i.dataIndex.push(cy(e,e.readVarint()+e.pos));return i}function dy(e,t,i){let r;for(;r=e.nextField(t);)if(1===r){let t=0;const r=e.readVarint()+e.pos;for(;e.pos<r;)i[t++]=e.readVarint()}return i}function py(e,t){if(4!==t.length)throw new Error(`Expected data of dimension 4 but got ${t.length}.`);let i=t[3];for(let r=2;r>=1;r--){const n=1===r?1:0,o=2===r?1:0;for(let r=0;r<t[0];r++){const a=t[1]*r;for(let r=n;r<t[1];r++){const n=t[2]*(r+a);for(let r=o;r<t[2];r++){const o=t[3]*(r+n);for(let r=0;r<t[3];r++){const t=o+r;e[t]+=e[t-i]}}}}i*=t[r]}return e}function fy(e){for(let t=0,i=e.length;t<i;t++)e[t]=e[t]>>>1^-(1&e[t]);return e}function my(e,t){switch(t){case"uint32":return e;case"uint16":for(let t=0;t<e.length;t+=2){const i=e[t],r=e[t+1];e[t]=(240&i)>>4|(61440&i)>>8|(240&r)<<4|61440&r,e[t+1]=15&i|(3840&i)>>4|(15&r)<<8|(3840&r)<<4}return e;case"uint8":for(let t=0;t<e.length;t+=4){const i=e[t],r=e[t+1],n=e[t+2],o=e[t+3];e[t+0]=(192&i)>>6|(192&r)>>4|(192&n)>>2|192&o,e[t+1]=(48&i)>>4|(48&r)>>2|48&n|(48&o)<<2,e[t+2]=(12&i)>>2|12&r|(12&n)<<2|(12&o)<<4,e[t+3]=3&i|(3&r)<<2|(3&n)<<4|(3&o)<<6}return e;default:throw new Error(`Invalid pixel format, "${t}"`)}}rn(LRUCache,"LRUCache");var _y=Uint8Array,gy=Uint16Array,yy=Int32Array,xy=new _y([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]),vy=new _y([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]),by=new _y([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),wy=function(e,t){for(var i=new gy(31),r=0;r<31;++r)i[r]=t+=1<<e[r-1];var n=new yy(i[30]);for(r=1;r<30;++r)for(var o=i[r];o<i[r+1];++o)n[o]=o-i[r]<<5|r;return{b:i,r:n}},Ay=wy(xy,2),Ey=Ay.b,Iy=Ay.r;Ey[28]=258,Iy[258]=28;for(var Sy=wy(vy,0).b,Dy=new gy(32768),Py=0;Py<32768;++Py){var Ty=(43690&Py)>>1|(21845&Py)<<1;Dy[Py]=((65280&(Ty=(61680&(Ty=(52428&Ty)>>2|(13107&Ty)<<2))>>4|(3855&Ty)<<4))>>8|(255&Ty)<<8)>>1}var zy=function(e,t,i){for(var r=e.length,n=0,o=new gy(t);n<r;++n)e[n]&&++o[e[n]-1];var a,s=new gy(t);for(n=1;n<t;++n)s[n]=s[n-1]+o[n-1]<<1;a=new gy(1<<t);var l=15-t;for(n=0;n<r;++n)if(e[n])for(var u=n<<4|e[n],c=t-e[n],h=s[e[n]-1]++<<c,d=h|(1<<c)-1;h<=d;++h)a[Dy[h]>>l]=u;return a},My=new _y(288);for(Py=0;Py<144;++Py)My[Py]=8;for(Py=144;Py<256;++Py)My[Py]=9;for(Py=256;Py<280;++Py)My[Py]=7;for(Py=280;Py<288;++Py)My[Py]=8;var Cy=new _y(32);for(Py=0;Py<32;++Py)Cy[Py]=5;var Ry=zy(My,9),Ly=zy(Cy,5),Fy=function(e){for(var t=e[0],i=1;i<e.length;++i)e[i]>t&&(t=e[i]);return t},By=function(e,t,i){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&i},Oy=function(e,t){var i=t/8|0;return(e[i]|e[i+1]<<8|e[i+2]<<16)>>(7&t)},Vy=function(e){return(e+7)/8|0}
vendor: 3,767 bytes, line 2
2,ky=["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"],Ny=function(e,t,i){var r=new Error(t||ky[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,Ny),!i)throw r;return r},Uy=new _y(0);var Gy="undefined"!=typeof TextDecoder&&new TextDecoder;try{Gy.decode(Uy,{stream:!0})}catch(e){}const jy={gzip_data:"gzip"};class MRTError extends Error{constructor(e){super(e),this.name="MRTError"}}const Hy={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},$y={uint32:1,uint16:2,uint8:4},Wy={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let Xy;class MapboxRasterTile{constructor(e=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=e}getLayer(e){const t=this.layers[e];if(!t)throw new MRTError(`Layer \'${e}\' not found`);return t}getHeaderLength(e){const t=new Uint8Array(e),i=new DataView(e);if(13!==t[0])throw new MRTError("File is not a valid MRT.");return i.getUint32(1,!0)}parseHeader(e){const t=new Uint8Array(e),i=this.getHeaderLength(e);if(t.length<i)throw new MRTError(`Expected header with length >= ${i} but got buffer of length ${t.length}`);const r=function(e){const t={headerLength:0,x:0,y:0,z:0,layers:[]};let i;for(;i=e.nextField(void 0);)1===i?t.headerLength=e.readFixed32():2===i?t.x=e.readVarint():3===i?t.y=e.readVarint():4===i?t.z=e.readVarint():5===i&&t.layers.push(hy(e,e.readVarint()+e.pos));return t}(new Xy(t.subarray(0,i)));if(!isNaN(this.x)&&(this.x!==r.x||this.y!==r.y||this.z!==r.z))throw new MRTError(`Invalid attempt to parse header ${r.z}/${r.x}/${r.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=r.x,this.y=r.y,this.z=r.z;for(const e of r.layers)this.layers[e.name]=new MapboxRasterLayer(e,{cacheSize:this._cacheSize});return this}createDecodingTask(e){const t=[],i=this.getLayer(e.layerName);for(let r of e.blockIndices){const n=i.dataIndex[r],o=n.firstByte-e.firstByte,a=n.lastByte-e.firstByte;if(i._blocksInProgress.has(r))continue;const s={layerName:i.name,firstByte:o,lastByte:a,pixelFormat:i.pixelFormat,blockIndex:r,blockShape:[n.bands.length].concat(i.bandShape),buffer:i.buffer,codec:n.codec.codec,filters:n.filters.map(e=>e.filter)};i._blocksInProgress.add(r),t.push(s)}return new MRTDecodingBatch(t,()=>{t.forEach(e=>i._blocksInProgress.delete(e.blockIndex))},(e,r)=>{if(t.forEach(e=>i._blocksInProgress.delete(e.blockIndex)),e)throw e;r.forEach(e=>{this.getLayer(e.layerName).processDecodedData(e)})})}}class MapboxRasterLayer{constructor({version:e,name:t,units:i,tileSize:r,pixelFormat:n,buffer:o,dataIndex:a},s){if(this.version=e,1!==this.version)throw new MRTError(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=t,this.units=i,this.tileSize=r,this.buffer=o,this.pixelFormat=Hy[n],this.dataIndex=a,this.bandShape=[r+2*o,r+2*o,$y[this.pixelFormat]],this._decodedBlocks=new LRUCache(s?s.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return $y[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:e})=>e).flat()}processDecodedData(e){const t=e.blockIndex.toString();this._decodedBlocks.get(t)||this._decodedBlocks.put(t,e.data)}getBlockForBand(e){let t=0;switch(typeof e){case"string":for(const[i,r]of this.dataIndex.entries()){for(const[n,o]of r.bands.entries())if(o===e)return{bandIndex:t+n,blockIndex:i,blockBandIndex:n};t+=r.bands.length}break;case"number":for(const[i,r]of this.dataIndex.entries()){if(e>=t&&e<t+r.bands.length)return{bandIndex:e,blockIndex:i,blockBandIndex:e-t};t+=r.bands.length}break;default:throw new MRTError(`Invalid band \\`${JSON.stringify(e)}\
vendor: 9,098 bytes, line 2
2\`. Expected string or integer.`)}return{blockIndex:-1,blockBandIndex:-1}}getDataRange(e){let t=1/0,i=-1/0;const r=[],n=new Set;for(const o of e){const{blockIndex:e}=this.getBlockForBand(o);if(e<0)throw new MRTError(`Invalid band: ${JSON.stringify(o)}`);const a=this.dataIndex[e];r.includes(e)||r.push(e),n.add(e),t=Math.min(t,a.firstByte),i=Math.max(i,a.lastByte)}if(n.size>this.cacheSize)throw new MRTError(`Number of blocks to decode (${n.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:t,lastByte:i,blockIndices:r}}hasBand(e){const{blockIndex:t}=this.getBlockForBand(e);return t>=0}hasDataForBand(e){const{blockIndex:t}=this.getBlockForBand(e);return t>=0&&!!this._decodedBlocks.get(t.toString())}getBandView(e){const{blockIndex:t,blockBandIndex:i}=this.getBlockForBand(e);if(t<0)throw new MRTError(`Band not found: ${JSON.stringify(e)}`);const r=this._decodedBlocks.get(t.toString());if(!r)throw new MRTError(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);const n=this.dataIndex[t],o=this.bandShape.reduce((e,t)=>e*t,1),a=i*o,s=r.subarray(a,a+o);return{data:s,bytes:new Uint8Array(s.buffer).subarray(s.byteOffset,s.byteOffset+s.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:n.offset,scale:n.scale}}}MapboxRasterTile.setPbf=function(e){Xy=e};class MRTDecodingBatch{constructor(e,t,i){this.tasks=e,this._onCancel=t,this._onComplete=i,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,t){this._finalized||(this._onComplete(e,t),this._finalized=!0)}}MapboxRasterTile.performDecoding=function(e,t){const i=new Uint8Array(e);return Promise.all(t.tasks.map(e=>{const{layerName:t,firstByte:r,lastByte:n,pixelFormat:o,blockShape:a,blockIndex:s,filters:l,codec:u}=e,c=i.subarray(r,n+1),h=new Uint32Array(a[0]*a[1]*a[2]);let d;if("gzip_data"!==u)throw new MRTError(`Unhandled codec: ${u}`);return d=function(e,t){if(!globalThis.DecompressionStream&&"gzip_data"===t)return Promise.resolve((a=function(e){31==e[0]&&139==e[1]&&8==e[2]||Ny(6,"invalid gzip data");var t=e[3],i=10;4&t&&(i+=2+(e[10]|e[11]<<8));for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[i++]);return i+(2&t)}(i=e),a+8>i.length&&Ny(6,"invalid gzip data"),function(e,t,i,r){var n=e.length;if(!n||t.f&&!t.l)return i||new _y(0);var o=!i,a=o||2!=t.i,s=t.i;o&&(i=new _y(3*n));var l=function(e){var t=i.length;if(e>t){var r=new _y(Math.max(2*t,e));r.set(i),i=r}},u=t.f||0,c=t.p||0,h=t.b||0,d=t.l,p=t.d,f=t.m,m=t.n,_=8*n;do{if(!d){u=By(e,c,1);var g=By(e,c+1,3);if(c+=3,!g){var y=e[(z=Vy(c)+4)-4]|e[z-3]<<8,x=z+y;if(x>n){s&&Ny(0);break}a&&l(h+y),i.set(e.subarray(z,x),h),t.b=h+=y,t.p=c=8*x,t.f=u;continue}if(1==g)d=Ry,p=Ly,f=9,m=5;else if(2==g){var v=By(e,c,31)+257,b=By(e,c+10,15)+4,w=v+By(e,c+5,31)+1;c+=14;for(var A=new _y(w),E=new _y(19),I=0;I<b;++I)E[by[I]]=By(e,c+3*I,7);c+=3*b;var D=Fy(E),P=(1<<D)-1,T=zy(E,D);for(I=0;I<w;){var z,M=T[By(e,c,P)];if(c+=15&M,(z=M>>4)<16)A[I++]=z;else{var C=0,R=0;for(16==z?(R=3+By(e,c,3),c+=2,C=A[I-1]):17==z?(R=3+By(e,c,7),c+=3):18==z&&(R=11+By(e,c,127),c+=7);R--;)A[I++]=C}}var L=A.subarray(0,v),F=A.subarray(v);f=Fy(L),m=Fy(F),d=zy(L,f),p=zy(F,m)}else Ny(1);if(c>_){s&&Ny(0);break}}a&&l(h+131072);for(var B=(1<<f)-1,O=(1<<m)-1,V=c;;V=c){var k=(C=d[Oy(e,c)&B])>>4;if((c+=15&C)>_){s&&Ny(0);break}if(C||Ny(2),k<256)i[h++]=k;else{if(256==k){V=c,d=null;break}var N=k-254;k>264&&(N=By(e,c,(1<<(j=xy[I=k-257]))-1)+Ey[I],c+=j);var U=p[Oy(e,c)&O],G=U>>4;if(U||Ny(3),c+=15&U,F=Sy[G],G>3){var j=vy[G];F+=Oy(e,c)&(1<<j)-1,c+=j}if(c>_){s&&Ny(0);break}a&&l(h+131072);var $=h+N;if(h<F){var W=0-F,X=Math.min(F,$);for(W+h<0&&Ny(3);h<X;++h)i[h]=r[W+h]}for(;h<$;++h)i[h]=i[h-F]}}t.l=d,t.p=V,t.b=h,t.f=u,d&&(u=1,t.m=f,t.d=p,t.n=m)}while(!u);return h!=i.length&&o?function(e,t,i){return(null==i||i>e.length)&&(i=e.length),new _y(e.subarray(0,i))}(i,0,h):i.subarray(0,h)}(i.subarray(a,-8),{i:2},new _y(((n=i)[(o=n.length)-4]|n[o-3]<<8|n[o-2]<<16|n[o-1]<<24)>>>0),r)));var i,r,n,o,a;const s=jy[t];if(!s)throw new Error(`Unhandled codec: ${t}`);const l=new globalThis.DecompressionStream(s);return new Response(new Blob([e]).stream().pipeThrough(l)).arrayBuffer().then(e=>new Uint8Array(e))}(c,u).then(e=>(function(e,t){let i;for(;i=e.nextField();)if(2===i)dy(e,e.readVarint()+e.pos,t);else if(3===i)throw new Error("Not implemented")}(new Xy(e),h),new(0,Wy[o])(h.buffer))),d.then(e=>{for(let t=l.length-1;t>=0;t--)switch(l[t]){case"delta_filter":py(e,a);break;case"zigzag_filter":fy(e);break;case"bitshuffle_filter":my(e,o);break;default:throw new MRTError(`Unhandled filter "${l[t]}"`)}return{layerName:t,blockIndex:s,data:e}}).catch(e=>{throw e})}))},rn(MRTDecodingBatch,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),rn(MapboxRasterTile,"MapboxRasterTile"),rn(MapboxRasterLayer,"MapboxRasterLayer",{omit:["_blocksInProgress"]}),MapboxRasterTile.setPbf(PbfReader);class RasterArrayWorkerTile{constructor(e){this._mrt=new MapboxRasterTile(e.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=e.uid,this.tileID=e.tileID,this.source=e.source}async parse(e){const t=this._mrt;this.status="parsing",this._entireBuffer=e,t.parseHeader(e),this._isHeaderLoaded=!0;const i=[];for(const r in t.layers){const n=t.getLayer(r),o=n.getDataRange(n.getBandList()),a=t.createDecodingTask(o),s=e.slice(o.firstByte,o.lastByte+1);i.push(MapboxRasterTile.performDecoding(s,a).then(e=>a.complete(null,e)).catch(e=>a.complete(e,null)))}return await Promise.allSettled(i),t}}class RasterArrayTileWorkerSource{constructor({actor:e}){this.actor=e,this.loading={},this.loaded={}}async loadTile(e){const t=e.uid,i=new AbortController,r=this.loading[t]=new RasterArrayWorkerTile(e);r.abort=()=>i.abort();try{const{data:n,headers:o}=await en(e.request,i.signal);return n?(this.loaded[t]=r,{mrt:await r.parse(n),headers:o}):(r.status="done",this.loaded[t]=r,null)}catch(e){if(i.signal.aborted)return null;throw r.status="done",this.loaded[t]=r,e}finally{delete this.loading[t]}}async reloadTile(e){}abortTile(e){const t=e.uid,i=this.loading[t];i&&(i.abort&&i.abort(),delete this.loading[t])}removeTile(e){const t=e.uid;this.loaded[t]&&delete this.loaded[t]}async decodeRasterArray(e){return MapboxRasterTile.performDecoding(e.buffer,e.task)}}const qy=new Map,Zy=new Map;Ce(self)&&(self.worker=new class MapWorker{constructor(e){this.self=e,this.actor=new Actor(e,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=iu({name:"mercator"}),this.workerSourceTypes={vector:VectorTileWorkerSource,geojson:GeoJSONWorkerSource,"raster-dem":RasterDEMTileWorkerSource},this.workerSources={},this.self.registerRTLTextPlugin=e=>{if(eo.isParsed())throw new Error("RTL text plugin already registered.");eo.setState({pluginStatus:Yn,pluginURL:eo.getPluginURL()}),eo.applyArabicShaping=e.applyArabicShaping,eo.processBidirectionalText=e.processBidirectionalText,eo.processStyledBidirectionalText=e.processStyledBidirectionalText;for(const{resolve:e}of this.rtlPluginParsingListeners)e(!0);this.rtlPluginParsingListeners=[]}}clearCaches(e,t){delete this.layerIndexes[e],delete this.availableImages[e],delete this.availableModels[e],delete this.workerSources[e],delete this.isSpriteLoaded[e]}checkIfReady(e,t){}spriteLoaded(e,t){const{scope:i}=t;if(this.isSpriteLoaded[e]||(this.isSpriteLoaded[e]={}),this.isSpriteLoaded[e][i]=!0,this.workerSources[e]&&this.workerSources[e][i])for(const t in this.workerSources[e][i]){const r=this.workerSources[e][i][t];for(const e in r){const t=r[e];t instanceof VectorTileWorkerSource&&(t.isSpriteLoaded=!0,t.fire(new Event("isSpriteLoaded")))}}}setImages(e,t){this.availableImages[e]||(this.availableImages[e]={});const{scope:i,images:r}=t;if(this.availableImages[e][i]=r,t.isSpriteLoaded&&this.spriteLoaded(e,{scope:i}),this.workerSources[e]&&this.workerSources[e][i])for(const t in this.workerSources[e][i]){const n=this.workerSources[e][i][t];for(const e in n)n[e].availableImages=r}}setModels(e,{scope:t,models:i}){if(this.availableModels[e]||(this.availableModels[e]={}),this.availableModels[e][t]=i,this.workerSources[e]&&this.workerSources[e][t])for(const r in this.workerSources[e][t]){const n=this.workerSources[e][t][r];for(const e in n)n[e].availableModels=i}}setProjection(e,t){this.projections[e]=iu(t)}setGlobalParams(e,t){if(this.referrer=t.referrer,Object.assign(We,t.config),t.contextOptions){const{maxBindingPoints:e,maxUniformBlockSizeDwords:i}=t.contextOptions;this.maxUniformBufferBindings=e,this.maxUniformBlockSizeDwords=i}}upsertRenderParams(e,t){void 0!==t.brightness&&(this.brightness=t.brightness),void 0!==t.worldview&&(this.worldview=t.worldview)}setLayers(e,t){this.getLayerIndex(e,t.scope).replace(t.layers,t.options)}updateLayers(e,t){this.getLayerIndex(e,t.scope).update(t.layers,t.removedIds,t.options)}async loadTile(e,t){if(t.projection=this.projections[e]||this.defaultProjection,"batched-model"===t.type&&!this.workerSourceTypes["batched-model"]){if(await Vm(),!Tiled3dModelWorkerSource)throw new Error(
2\'Could not load Standard module for "batched-model" source.\');this.workerSourceTypes["batched-model"]=Tiled3dModelWorkerSource}return"raster-array"===t.type&&await this.ensureRasterArrayWorkerSource(),this.getWorkerSource(e,t).loadTile(t)}async ensureRasterArraySource(e,t){await this.ensureRasterArrayWorkerSource()}async ensureRasterArrayWorkerSource(){if(!this.workerSourceTypes["raster-array"]){if(await async function(){return Promise.resolve()}(),!RasterArrayTileWorkerSource)throw new Error(\'Could not load raster-array module for "raster-array" source.\');this.workerSourceTypes["raster-array"]=RasterArrayTileWorkerSource}}async decodeRasterArray(e,t){return await this.ensureRasterArrayWorkerSource(),this.getWorkerSource(e,t).decodeRasterArray(t)}reloadTile(e,t){return t.projection=this.projections[e]||this.defaultProjection,this.getWorkerSource(e,t).reloadTile(t)}abortTile(e,t){const i=this.getExistingWorkerSource(e,t);return i?i.abortTile(t):void 0}removeTile(e,t){const i=this.getExistingWorkerSource(e,t);return i?i.removeTile(t):void 0}getExistingWorkerSource(e,t){const{type:i,source:r,scope:n}=t,o=this.workerSources[e];if(o&&o[n]&&o[n][i])return o[n][i][r]}async removeSource(e,t){const{type:i,source:r,scope:n}=t,o=this.workerSources[e]&&this.workerSources[e][n]&&this.workerSources[e][n][i],a=o&&o[r];a&&(delete o[r],a.removeSource&&await a.removeSource({source:r}))}async loadTileProvider(e,t){const i=await async function(e,t){const i=Zy.get(e);if(i)return i;const r=qy.get(e);if(void 0!==r)return r;const n=import(\n/* webpackIgnore: true */\n/* @vite-ignore */\nt).catch(t=>{throw new Error(`TileProvider "${e}" failed to load: ${t instanceof Error?t.message:String(t)}`)}).then(t=>{const i=t.default;if("function"!=typeof i)throw new Error(`TileProvider "${e}" module must default-export a class`);if("function"!=typeof i.prototype.loadTile)throw new Error(`TileProvider "${e}" class must have a loadTile method`);return Zy.set(e,i),i}).finally(()=>{qy.delete(e)});return qy.set(e,n),n}(t.name,t.url),r=new i(t.options);return this.getWorkerSource(e,{type:t.type,source:t.source,scope:t.scope},r),r.load&&t.request?r.load({request:t.request}):null}async syncRTLPluginState(e,t){if(eo.isParsed())return!0;if(eo.isParsing())return new Promise((e,t)=>{this.rtlPluginParsingListeners.push({resolve:e,reject:t})});eo.setState(t);const i=eo.getPluginURL();if(!eo.isLoaded()||eo.isParsed()||eo.isParsing())return!1;eo.setState({pluginStatus:Zn,pluginURL:i});try{return await(import(\n/* webpackIgnore: true */\n/* @vite-ignore */\ni)),!!eo.isParsed()||new Promise((e,t)=>{this.rtlPluginParsingListeners.push({resolve:e,reject:t})})}catch(e){eo.setState({pluginStatus:"error",pluginURL:i});for(const{reject:t}of this.rtlPluginParsingListeners)t(e);throw this.rtlPluginParsingListeners=[],e}}getAvailableImages(e,t){this.availableImages[e]||(this.availableImages[e]={});let i=this.availableImages[e][t];return i||(i=[]),i}getAvailableModels(e,t){this.availableModels[e]||(this.availableModels[e]={});let i=this.availableModels[e][t];return i||(i={}),i}getLayerIndex(e,t){this.layerIndexes[e]||(this.layerIndexes[e]={});let i=this.layerIndexes[e][t];return i||(i=this.layerIndexes[e][t]=new StyleLayerIndex,i.scope=t),i}getWorkerSource(e,t,i){const{type:r,source:n,scope:o}=t,a=this.workerSources;if(a[e]||(a[e]={}),a[e][o]||(a[e][o]={}),a[e][o][r]||(a[e][o][r]={}),this.isSpriteLoaded[e]||(this.isSpriteLoaded[e]={}),this.getExistingWorkerSource(e,t))i&&(a[e][o][r][n].tileProvider=i);else{const t=this.actor.getWorkerSourceActor(e),s=this.workerSourceTypes[r];if(!s)throw new Error(`Unknown worker source type "${r}".`);a[e][o][r][n]=new s({actor:t,layerIndex:this.getLayerIndex(e,o),availableImages:this.getAvailableImages(e,o),availableModels:this.getAvailableModels(e,o),isSpriteLoaded:this.isSpriteLoaded[e][o],tileProvider:i,brightness:this.brightness,worldview:this.worldview,maxUniformBufferBindings:this.maxUniformBufferBindings,maxUniformBlockSizeDwords:this.maxUniformBlockSizeDwords})}return a[e][o][r][n]}enforceCacheSizeLimit(e,t){!function(e){qr(),null!=Xr&&Xr.then(t=>{t.keys().then(i=>{for(let r=0;r<i.length-e;r++)t.delete(i[r]).catch(e=>ze(e.message))}).catch(e=>ze(e.message))}).catch(e=>ze(e.message))}(t)}}(self))}();\n//# sourceMappingURL=mapbox-gl-csp-worker.js.map\n'])});function n(){var e,t,i="function"==typeof Symbol?Symbol:{},r=i.iterator||"@@iterator",a=i.toStringTag||"@@toStringTag";function s(i,r,n,a){var s=r&&r.prototype instanceof c?r:c,u=Object.create(s.prototype);return o(u,"_invoke",function(i,r,n){var o,a,s,c=0,u=n||[],h=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,i){return o=t,a=0,s=e,d.n=i,l}};function p(i,r){for(a=i,s=r,t=0;!h&&c&&!n&&t<u.length;t++){var n,o=u[t],p=d.p,f=o[2];i>3?(n=f===r)&&(s=o[(a=o[4])?5:(a=3,3)],o[4]=o[5]=e):o[0]<=p&&((n=i<2&&p<o[1])?(a=0,d.v=r,d.n=o[1]):p<f&&(n=i<3||o[0]>r||r>f)&&(o[4]=i,o[5]=r,d.n=f,a=0))}if(n||i>1)return l;throw h=!0,r}return function(n,u,f){if(c>1)throw TypeError("Generator is already running");for(h&&1===u&&p(u,f),a=u,s=f;(t=a<2?e:s)||!h;){o||(a?a<3?(a>1&&(d.n=-1),p(a,s)):d.n=s:d.v=s);try{if(c=2,o){if(a||(n="next"),t=o[n]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");
2if(!t.done)return t;s=t.value,a<2&&(a=0)}else 1===a&&(t=o.return)&&t.call(o),a<2&&(s=TypeError("The iterator does not provide a '"+n+"' method"),a=1);o=e}else if((t=(h=d.n<0)?s:i.call(r,d))!==l)break}catch(t){o=e,a=1,s=t}finally{c=1}}return{value:t,done:h}}}(i,n,a),!0),u}var l={};function c(){}function u(){}function h(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(o(t={},r,function(){return this}),t),p=h.prototype=c.prototype=Object.create(d);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,o(e,a,"GeneratorFunction")),e.prototype=Object.create(p),e}return u.prototype=h,o(p,"constructor",h),o(h,"constructor",u),u.displayName="GeneratorFunction",o(h,a,"GeneratorFunction"),o(p),o(p,a,"Generator"),o(p,r,function(){return this}),o(p,"toString",function(){return"[object Generator]"}),(n=function(){return{w:s,m:f}})()}function o(e,t,i,r){var n=Object.defineProperty;try{n({},"",{})}catch(e){n=0}o=function(e,t,i,r){function a(t,i){o(e,t,function(e){return this._invoke(t,i,e)})}t?n?n(e,t,{value:i,enumerable:!r,configurable:!r,writable:!r}):e[t]=i:(a("next",0),a("throw",1),a("return",2))},o(e,t,i,r)}function a(e,t,i,r,n,o,a){try{var s=e[o](a),l=s.value}catch(e){return void i(e)}s.done?t(l):Promise.resolve(l).then(r,n)}function s(e){return function(){var t=this,i=arguments;return new Promise(function(r,n){var o=e.apply(t,i);function s(e){a(o,r,n,s,l,"next",e)}function l(e){a(o,r,n,s,l,"throw",e)}s(void 0)})}}var l=i(34153),c=r(),u=new Blob([c.default||c],{type:"text/javascript"}),h=URL.createObjectURL(u);function d(e){if(!e)return"";var t=document.createElement("div");return t.textContent=e,t.innerHTML}l.workerUrl=h;var p={icp_large:"#3cceb7",icp_medium:"#2948a0",growth:"#f1b241",enterprise:"#ef3dc0",provider:"#707f9c"};function f(e){return{type:"FeatureCollection",features:e.map(function(e){return{type:"Feature",geometry:{type:"Point",coordinates:[e.lng,e.lat]},properties:{id:e.id,name:e.name,segment:e.segment,employee_count:e.employee_count||0,therapist_count:e.therapist_count||0,disciplines:(e.disciplines||[]).join(", "),state:e.state||""}}})}}function m(e,t,i,r){var o=document.querySelector('meta[name="mapbox-token"]'),a=o?o.content:"";if(!a)return e.innerHTML='<div class="d-flex align-items-center justify-content-center h-100 text-muted"><p>Mapbox access token not configured. Add <code>mapbox.access_token</code> to Rails credentials (or set the <code>MAPBOX_ACCESS_TOKEN</code> env var) and restart the server.</p></div>',{destroy:function(){},applyFilters:function(){}};l.accessToken=a;var c=new l.Map({container:e,style:"mapbox://styles/mapbox/light-v11",center:[-98.5795,39.8283],zoom:3.5,attributionControl:!0});c.addControl(new l.NavigationControl,"top-left");var u=[],h=!1,m=i||{};function _(e){if(m=e,h){var t=function(e,t){return e.filter(function(e){return(!t.state||e.state===t.state)&&(!t.segment||e.segment===t.segment)&&!(t.discipline&&!function(e,t){return!t||(e.discipline_ids||[]).includes(t)}(e,t.discipline))&&!(t.q&&!e.name.toLowerCase().includes(t.q.toLowerCase()))})}(u,e),i=f(t),r=c.getSource("organizations");r&&r.setData(i)}}function g(e){var t=u.find(function(t){return t.id===e});t&&t.lat&&t.lng&&(c.flyTo({center:[t.lng,t.lat],zoom:8,duration:1e3}),new l.Popup({offset:15,maxWidth:"250px"}).setLngLat([t.lng,t.lat]).setHTML("\n        <strong>".concat(d(t.name),'</strong><br>\n        <span style="color: ').concat(p[t.segment]||"#707f9c",'">\n          ').concat(d((t.segment||"").replace(/_/g," ").toUpperCase()),"\n        </span><br>\n        <small>").concat(d(t.state||"")," &middot; ").concat(t.therapist_count||0," therapists</small>\n      ")).addTo(c))}return c.on("load",s(n().m(function i(){var o,a,s,y;return n().w(function(i){for(;;)switch(i.p=i.n){case 0:return i.p=0,i.n=1,fetch(t);case 1:if((o=i.v).ok){i.n=2;break}throw new Error("Failed to load map data: ".concat(o.status));case 2:return i.n=3,o.json();case 3:if(a=i.v,u=a,a&&0!==a.length){i.n=4;break}return e.querySelector(".mapboxgl-canvas-container").insertAdjacentHTML("beforeend",'<div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 10; background: white; padding: 16px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.15);"><p class="mb-0 text-muted">No geocoded locations available. Addresses need latitude/longitude data.</p></div>'),i.a(2);case 4:s=f(a),c.addSource("organizations",{type:"geojson",data:s,cluster:!0,clusterMa
2xZoom:14,clusterRadius:50}),h=!0,c.addLayer({id:"clusters",type:"circle",source:"organizations",filter:["has","point_count"],paint:{"circle-color":["step",["get","point_count"],"#3cceb7",5,"#2948a0",10,"#f1b241",25,"#ef3dc0"],"circle-radius":["step",["get","point_count"],18,5,22,10,28,25,35],"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}}),c.addLayer({id:"cluster-count",type:"symbol",source:"organizations",filter:["has","point_count"],layout:{"text-field":["get","point_count_abbreviated"],"text-font":["DIN Offc Pro Medium","Arial Unicode MS Bold"],"text-size":12},paint:{"text-color":"#ffffff"}}),c.addLayer({id:"unclustered-point",type:"circle",source:"organizations",filter:["!",["has","point_count"]],paint:{"circle-color":["match",["get","segment"],"icp_large",p.icp_large,"icp_medium",p.icp_medium,"growth",p.growth,"enterprise",p.enterprise,"provider",p.provider,p.provider],"circle-radius":7,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}}),c.on("click","clusters",function(e){var t=c.queryRenderedFeatures(e.point,{layers:["clusters"]}),i=t[0].properties.cluster_id;c.getSource("organizations").getClusterExpansionZoom(i,function(e,i){e||c.easeTo({center:t[0].geometry.coordinates,zoom:i})})}),c.on("click","unclustered-point",function(t){var i=t.features[0];new l.Popup({offset:15,maxWidth:"250px"}).setLngLat(i.geometry.coordinates).setHTML("\n            <strong>".concat(d(i.properties.name),'</strong><br>\n            <span style="color: ').concat(p[i.properties.segment]||"#707f9c",'">\n              ').concat(d((i.properties.segment||"").replace("_"," ").toUpperCase()),"\n            </span><br>\n            <small>").concat(d(i.properties.state)," &middot; ").concat(i.properties.therapist_count," therapists</small>\n            ").concat(i.properties.disciplines?"<br><small>".concat(d(i.properties.disciplines),"</small>"):"","\n          ")).addTo(c);var r=new CustomEvent("icp-universe-map:org-clicked",{bubbles:!0,detail:{orgId:i.properties.id}});e.dispatchEvent(r)}),c.on("mouseenter","clusters",function(){c.getCanvas().style.cursor="pointer"}),c.on("mouseleave","clusters",function(){c.getCanvas().style.cursor=""}),c.on("mouseenter","unclustered-point",function(){c.getCanvas().style.cursor="pointer"}),c.on("mouseleave","unclustered-point",function(){c.getCanvas().style.cursor=""}),Object.values(m).some(function(e){return e})&&_(m),r&&g(r),i.n=6;break;case 5:i.p=5,y=i.v,console.error("Failed to load map data:",y);case 6:return i.a(2)}},i,null,[[0,5]])}))),{applyFilters:_,selectOrg:g,resize:function(){c&&c.resize()},destroy:function(){c&&c.remove()}}}},34153(e){var t;t=function(){const e={antialias:!1,alpha:!0,stencil:!0,depth:!0};let t,i;function r(t){const i=document.createElement("canvas"),r=Object.create(e);r.failIfMajorPerformanceCaveat=t;const n=i.getContext("webgl2",r);if(!n)return!1;let o;try{o=n.createShader(n.VERTEX_SHADER)}catch(e){return!1}return!(!o||n.isContextLost())&&(n.shaderSource(o,"void main() {}"),n.compileShader(o),!0===n.getShaderParameter(o,n.COMPILE_STATUS))}var n="3.31.0",o=1e-6,a="undefined"!=typeof Float32Array?Float32Array:Array;function s(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],a=i*o-n*r;return a?(e[0]=o*(a=1/a),e[1]=-r*a,e[2]=-n*a,e[3]=i*a,e):null}function l(){var e=new a(9);return a!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function c(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}function u(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],a=t[4],s=t[5],l=t[6],c=t[7],u=t[8];return e[0]=a*u-s*c,e[1]=n*c-r*u,e[2]=r*s-n*a,e[3]=s*l-o*u,e[4]=i*u-n*l,e[5]=n*o-i*s,e[6]=o*c-a*l,e[7]=r*l-i*c,e[8]=i*a-r*o,e}function h(e,t,i){var r=t[0],n=t[1],o=t[2],a=t[3],s=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=i[0],p=i[1],f=i[2],m=i[3],_=i[4],g=i[5],y=i[6],x=i[7],v=i[8];return e[0]=d*r+p*a+f*c,e[1]=d*n+p*s+f*u,e[2]=d*o+p*l+f*h,e[3]=m*r+_*a+g*c,e[4]=m*n+_*s+g*u,e[5]=m*o+_*l+g*h,e[6]=y*r+x*a+v*c,e[7]=y*n+x*s+v*u,e[8]=y*o+x*l+v*h,e}function d(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=i,e[2]=0,e[3]=-i,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function p(){var e=new a(16);return a!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function f(e){var t=new a(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function m(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function _(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10
vendor: 4,308 bytes, line 2
2]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function g(e,t){if(e===t){var i=t[1],r=t[2],n=t[3],o=t[6],a=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=i,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=o,e[11]=t[14],e[12]=n,e[13]=a,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function y(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],a=t[4],s=t[5],l=t[6],c=t[7],u=t[8],h=t[9],d=t[10],p=t[11],f=t[12],m=t[13],_=t[14],g=t[15],y=i*s-r*a,x=i*l-n*a,v=i*c-o*a,b=r*l-n*s,w=r*c-o*s,E=n*c-o*l,A=u*m-h*f,I=u*_-d*f,S=u*g-p*f,T=h*_-d*m,D=h*g-p*m,M=d*g-p*_,P=y*M-x*D+v*T+b*S-w*I+E*A;return P?(e[0]=(s*M-l*D+c*T)*(P=1/P),e[1]=(n*D-r*M-o*T)*P,e[2]=(m*E-_*w+g*b)*P,e[3]=(d*w-h*E-p*b)*P,e[4]=(l*S-a*M-c*I)*P,e[5]=(i*M-n*S+o*I)*P,e[6]=(_*v-f*E-g*x)*P,e[7]=(u*E-d*v+p*x)*P,e[8]=(a*D-s*S+c*A)*P,e[9]=(r*S-i*D-o*A)*P,e[10]=(f*w-m*v+g*y)*P,e[11]=(h*v-u*w-p*y)*P,e[12]=(s*I-a*T-l*A)*P,e[13]=(i*T-r*I+n*A)*P,e[14]=(m*x-f*b-_*y)*P,e[15]=(u*b-h*x+d*y)*P,e):null}function x(e,t,i){var r=t[0],n=t[1],o=t[2],a=t[3],s=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=t[9],p=t[10],f=t[11],m=t[12],_=t[13],g=t[14],y=t[15],x=i[0],v=i[1],b=i[2],w=i[3];return e[0]=x*r+v*s+b*h+w*m,e[1]=x*n+v*l+b*d+w*_,e[2]=x*o+v*c+b*p+w*g,e[3]=x*a+v*u+b*f+w*y,e[4]=(x=i[4])*r+(v=i[5])*s+(b=i[6])*h+(w=i[7])*m,e[5]=x*n+v*l+b*d+w*_,e[6]=x*o+v*c+b*p+w*g,e[7]=x*a+v*u+b*f+w*y,e[8]=(x=i[8])*r+(v=i[9])*s+(b=i[10])*h+(w=i[11])*m,e[9]=x*n+v*l+b*d+w*_,e[10]=x*o+v*c+b*p+w*g,e[11]=x*a+v*u+b*f+w*y,e[12]=(x=i[12])*r+(v=i[13])*s+(b=i[14])*h+(w=i[15])*m,e[13]=x*n+v*l+b*d+w*_,e[14]=x*o+v*c+b*p+w*g,e[15]=x*a+v*u+b*f+w*y,e}function v(e,t,i){var r,n,o,a,s,l,c,u,h,d,p,f,m=i[0],_=i[1],g=i[2];return t===e?(e[12]=t[0]*m+t[4]*_+t[8]*g+t[12],e[13]=t[1]*m+t[5]*_+t[9]*g+t[13],e[14]=t[2]*m+t[6]*_+t[10]*g+t[14],e[15]=t[3]*m+t[7]*_+t[11]*g+t[15]):(n=t[1],o=t[2],a=t[3],s=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=t[9],p=t[10],f=t[11],e[0]=r=t[0],e[1]=n,e[2]=o,e[3]=a,e[4]=s,e[5]=l,e[6]=c,e[7]=u,e[8]=h,e[9]=d,e[10]=p,e[11]=f,e[12]=r*m+s*_+h*g+t[12],e[13]=n*m+l*_+d*g+t[13],e[14]=o*m+c*_+p*g+t[14],e[15]=a*m+u*_+f*g+t[15]),e}function b(e,t,i){var r=i[0],n=i[1],o=i[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function w(e,t,i){var r=Math.sin(i),n=Math.cos(i),o=t[4],a=t[5],s=t[6],l=t[7],c=t[8],u=t[9],h=t[10],d=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*n+c*r,e[5]=a*n+u*r,e[6]=s*n+h*r,e[7]=l*n+d*r,e[8]=c*n-o*r,e[9]=u*n-a*r,e[10]=h*n-s*r,e[11]=d*n-l*r,e}function E(e,t,i){var r=Math.sin(i),n=Math.cos(i),o=t[0],a=t[1],s=t[2],l=t[3],c=t[8],u=t[9],h=t[10],d=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*n-c*r,e[1]=a*n-u*r,e[2]=s*n-h*r,e[3]=l*n-d*r,e[8]=o*r+c*n,e[9]=a*r+u*n,e[10]=s*r+h*n,e[11]=l*r+d*n,e}function A(e,t,i){var r=Math.sin(i),n=Math.cos(i),o=t[0],a=t[1],s=t[2],l=t[3],c=t[4],u=t[5],h=t[6],d=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*n+c*r,e[1]=a*n+u*r,e[2]=s*n+h*r,e[3]=l*n+d*r,e[4]=c*n-o*r,e[5]=u*n-a*r,e[6]=h*n-s*r,e[7]=d*n-l*r,e}function I(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}function S(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function T(e,t,i){var r,n,a,s=i[0],l=i[1],c=i[2],u=Math.sqrt(s*s+l*l+c*c);return u<o?null:(s*=u=1/u,l*=u,c*=u,r=Math.sin(t),n=Math.cos(t),e[0]=s*s*(a=1-n)+n,e[1]=l*s*a+c*r,e[2]=c*s*a-l*r,e[3]=0,e[4]=s*l*a-c*r,e[5]=l*l*a+n,e[6]=c*l*a+s*r,e[7]=0,e[8]=s*c*a+l*r,e[9]=l*c*a-s*r,e[10]=c*c*a+n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function D(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=r,e[6]=i,e[7]=0,e[8]=0,e[9]=-i,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function M(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=0,e[2]=-i,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=i,e[9]=0,e[10
vendor: 22,642 bytes, line 2
2]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function P(e,t){var i=t[0],r=t[1],n=t[2],o=t[4],a=t[5],s=t[6],l=t[8],c=t[9],u=t[10];return e[0]=Math.sqrt(i*i+r*r+n*n),e[1]=Math.sqrt(o*o+a*a+s*s),e[2]=Math.sqrt(l*l+c*c+u*u),e}function C(e,t){var i=new a(3);P(i,t);var r=1/i[0],n=1/i[1],o=1/i[2],s=t[0]*r,l=t[1]*n,c=t[2]*o,u=t[4]*r,h=t[5]*n,d=t[6]*o,p=t[8]*r,f=t[9]*n,m=t[10]*o,_=s+h+m,g=0;return _>0?(g=2*Math.sqrt(_+1),e[3]=.25*g,e[0]=(d-f)/g,e[1]=(p-c)/g,e[2]=(l-u)/g):s>h&&s>m?(g=2*Math.sqrt(1+s-h-m),e[3]=(d-f)/g,e[0]=.25*g,e[1]=(l+u)/g,e[2]=(p+c)/g):h>m?(g=2*Math.sqrt(1+h-s-m),e[3]=(p-c)/g,e[0]=(l+u)/g,e[1]=.25*g,e[2]=(d+f)/g):(g=2*Math.sqrt(1+m-s-h),e[3]=(l-u)/g,e[0]=(p+c)/g,e[1]=(d+f)/g,e[2]=.25*g),e}function R(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],a=i+i,s=r+r,l=n+n,c=i*a,u=r*a,h=r*s,d=n*a,p=n*s,f=n*l,m=o*a,_=o*s,g=o*l;return e[0]=1-h-f,e[1]=u+g,e[2]=d-_,e[3]=0,e[4]=u-g,e[5]=1-c-f,e[6]=p+m,e[7]=0,e[8]=d+_,e[9]=p-m,e[10]=1-c-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}var z=function(e,t,i,r,n){var o=1/Math.tan(t/2);if(e[0]=o/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=n&&n!==1/0){var a=1/(r-n);e[10]=(n+r)*a,e[14]=2*n*r*a}else e[10]=-1,e[14]=-2*r;return e},L=function(e,t,i,r,n,o,a){var s=1/(t-i),l=1/(r-n),c=1/(o-a);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+i)*s,e[13]=(n+r)*l,e[14]=(a+o)*c,e[15]=1,e},F=x;function O(){var e=new a(3);return a!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function B(e){var t=new a(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function k(e){var t=e[0],i=e[1],r=e[2];return Math.sqrt(t*t+i*i+r*r)}function V(e,t,i){var r=new a(3);return r[0]=e,r[1]=t,r[2]=i,r}function N(e,t,i,r){return e[0]=t,e[1]=i,e[2]=r,e}function U(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e}function j(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e}function G(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e}function H(e,t,i){return e[0]=Math.min(t[0],i[0]),e[1]=Math.min(t[1],i[1]),e[2]=Math.min(t[2],i[2]),e}function $(e,t,i){return e[0]=Math.max(t[0],i[0]),e[1]=Math.max(t[1],i[1]),e[2]=Math.max(t[2],i[2]),e}function W(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function q(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e}function Z(e,t){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2];return Math.sqrt(i*i+r*r+n*n)}function X(e,t){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2];return i*i+r*r+n*n}function Y(e){var t=e[0],i=e[1],r=e[2];return t*t+i*i+r*r}function K(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function J(e,t){var i=t[0],r=t[1],n=t[2],o=i*i+r*r+n*n;return o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e}function Q(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function ee(e,t,i){var r=t[0],n=t[1],o=t[2],a=i[0],s=i[1],l=i[2];return e[0]=n*l-o*s,e[1]=o*a-r*l,e[2]=r*s-n*a,e}function te(e,t,i,r){var n=t[0],o=t[1],a=t[2];return e[0]=n+r*(i[0]-n),e[1]=o+r*(i[1]-o),e[2]=a+r*(i[2]-a),e}function ie(e,t,i){var r=t[0],n=t[1],o=t[2],a=i[3]*r+i[7]*n+i[11]*o+i[15];return e[0]=(i[0]*r+i[4]*n+i[8]*o+i[12])/(a=a||1),e[1]=(i[1]*r+i[5]*n+i[9]*o+i[13])/a,e[2]=(i[2]*r+i[6]*n+i[10]*o+i[14])/a,e}function re(e,t,i){var r=t[0],n=t[1],o=t[2];return e[0]=r*i[0]+n*i[3]+o*i[6],e[1]=r*i[1]+n*i[4]+o*i[7],e[2]=r*i[2]+n*i[5]+o*i[8],e}function ne(e,t,i){var r=i[0],n=i[1],o=i[2],a=i[3],s=t[0],l=t[1],c=t[2],u=n*c-o*l,h=o*s-r*c,d=r*l-n*s;return e[0]=s+a*(u+=u)+n*(d+=d)-o*(h+=h),e[1]=l+a*h+o*u-r*d,e[2]=c+a*d+r*h-n*u,e}function oe(e){return e[0]=0,e[1]=0,e[2]=0,e}function ae(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}var se=j,le=G,ce=function(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e[2]=t[2]/i[2],e},ue=k;function he(){var e=new a(4);return a!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function de(e,t,i,r){var n=new a(4);return n[0]=e,n[1]=t,n[2]=i,n[3]=r,n}function pe(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e}function fe(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],a=i*i+r*r+n*n+o*o;return a>0&&(a=1/Math.sqrt(a)),e[0]=i*a,e[1]=r*a,e[2]=n*a,e[3]=o*a,e}function me(e,t,i){var r=t[0],n=t[1],o=t[2],a=t[3];return e[0]=i[0]*r+i[4]*n+i[8]*o+i[12]*a,e[1]=i[1]*r+i[5]*n+i[9]*o+i[13]*a,e[2]=i[2]*r+i[6]*n+i[10]*o+i[14]*a,e[3]=i[3]*r+i[7]*n+i[11]*o+i[15]*a,e}function _e(){var e=new a(4);return a!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function ge(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function ye(e,t){var i=2*Math.acos(t[3]),r=Math.sin(i/2);return r>o?(e[0]=t[0]/r,e[1]=t[1]/r,e[2]=t[2]/r):(e[0]=1,e[1]=0,e[2]=0),i}function xe(e,t,i){i*=.5;var r=t[0],n=t[1],o=t[2],a=t[3],s=Math.sin(i),l=Math.cos(i);return e[0]=r*l+a*s,e[1]=n*l+o*s,e[2]=o*l-n*s,e[3]=a*l-r*s,e}function ve(e,t,i){i*=.5;var r=t[0],n=t[1],o=t[2],a=t[3],s=Math.sin(i),l=Math.cos(i);return e[0]=r*l-o*s,e[1]=n*l+a*s,e[2]=o*l+r*s,e[3]=a*l-n*s,e}function be(e,t,i){i*=.5;var r=t[0],n=t[1],o=t[2],a=t[3],s=Math.sin(i),l=Math.cos(i);return e[0]=r*l+n*s,e[1]=n*l-r*s,e[2]=o*l+a*s,e[3]=a*l-o*s,e}O(),he();var we,Ee,Ae,Ie=fe,Se=(we=O(),Ee=V(1,0,0),Ae=V(0,1,0),function(e,t,i){var r=Q(t,i);return r<-.999999?(ee(we,Ee,t),ue(we)<1e-6&&ee(we,Ae,t),J(we,we),function(e,t,i){i*=.5;var r=Math.sin(i);e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(i)}(e,we,Math.PI),e):r>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(ee(we,t,i),e[0]=we[0],e[1]=we[1],e[2]=we[2],e[3]=1+r,Ie(e,e))});function Te(){var e=new a(2);return a!=Float32Array&&(e[0]=0,e[1]=0),e}function De(e,t){var i=new a(2);return i[0]=e,i[1]=t,i}function Me(e,t,i){return e[0]=t,e[1]=i,e}function Pe(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e}function Ce(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e}function Re(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e}function ze(e){var t=e[0],i=e[1];return Math.sqrt(t*t+i*i)}function Le(e,t){var i=t[0],r=t[1],n=i*i+r*r;return n>0&&(n=1/Math.sqrt(n)),e[0]=t[0]*n,e[1]=t[1]*n,e}function Fe(e,t){return e[0]*t[0]+e[1]*t[1]}_e(),_e(),l();var Oe=Ce;function Be(e,t,i,r){const n=3*e,o=3*(i-e)-n,a=1-n-o,s=3*t,l=3*(r-t)-s,c=1-s-l;return function(e,t=1e-6){if(e<=0)return 0;if(e>=1)return 1;let i=e;for(let h=0;h<8;h++){const r=((a*i+o)*i+n)*i-e;if(Math.abs(r)<t)return((c*i+l)*i+s)*i;const u=(3*a*i+2*o)*i+n;if(Math.abs(u)<1e-6)break;i-=r/u}let r=0,u=1;i=e;for(let s=0;s<20;s++){const s=((a*i+o)*i+n)*i;if(Math.abs(s-e)<t)break;e>s?r=i:u=i,i=.5*(r+u)}return((c*i+l)*i+s)*i}}function ke(e,t){this.x=e,this.y=t}function Ve(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!Ve(e[i],t[i]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==t){if("object"!=typeof t)return!1;const i=e,r=t;if(Object.keys(i).length!==Object.keys(r).length)return!1;for(const e in i)if(!Ve(i[e],r[e]))return!1;return!0}return e===t}function Ne(e,t,i=0,r=e.length-1,n=je){for(;r>i;){if(r-i>600){const o=r-i+1,a=t-i+1,s=Math.log(o),l=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*l*(o-l)/o)*(a-o/2<0?-1:1);Ne(e,t,Math.max(i,Math.floor(t-a*l/o+c)),Math.min(r,Math.floor(t+(o-a)*l/o+c)),n)}const o=e[t];let a=i,s=r;for(Ue(e,i,t),n(e[r],o)>0&&Ue(e,i,r);a<s;){for(Ue(e,a,s),a++,s--;n(e[a],o)<0;)a++;for(;n(e[s],o)>0;)s--}0===n(e[i],o)?Ue(e,i,s):(s++,Ue(e,s,r)),s<=t&&(i=s+1),t<=s&&(r=s-1)}}function Ue(e,t,i){const r=e[t];e[t]=e[i],e[i]=r}function je(e,t){return e<t?-1:e>t?1:0}function Ge(e){let t=0;for(let i,r,n=0,o=e.length,a=o-1;n<o;a=n++)i=e[n],r=e[a],t+=(r.x-i.x)*(i.y+r.y);return t}function He(e,t){return t.area-e.area}function $e(e){const t=e.length;if(t<3)return!0;const i=e[0];let r=0,n=0,o=1;for(;o<t&&(r=e[o].x-i.x,n=e[o].y-i.y,0===r&&0===n);o++);if(o===t)return!0;for(;o<t;o++)if(r*(e[o].y-i.y)-n*(e[o].x-i.x)!==0)return!1;return!0}function We(e,t){const i=e.length,r=[];let n,o;for(let a=0;a<i;a++){const t=Ge(e[a]);0===t&&$e(e[a])||(e[a].area=Math.abs(t),void 0===o&&(o=t<0),o===t<0?(n&&r.push(n),n=[e[a]]):n.push(e[a]))}if(n&&r.push(n),t>1)for(let a=0;a<r.length;a++){const e=r[a];e.length<=t||(Ne(e,t,1,e.length-1,He),r[a]=e.slice(0,t))}return r}function qe(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function Ze(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function Xe(e,t,i){const r=e[0]-t[0],n=e[1]-t[1],o=e[0]-i[0],a=e[1]-i[1];return r*a-o*n===0&&r*o<=0&&n*a<=0}function Ye(e,t,i){return t[1]>e[1]!=i[1]>e[1]&&e[0]<(i[0]-t[0])*(e[1]-t[1])/(i[1]-t[1])+t[0]}function Ke(e,t,i=!1){let r=!1;for(let n=0,o=t.length;n<o;n++){const o=t[n];for(let t=0,n=o.length,a=n-1;t<n;a=t++){const n=o[a],s=o[t];if(Xe(e,n,s))return i;Ye(e,n,s)&&(r=!r)}}return r}function Je(e,t,i,r){const n=r[0]-i[0],o=r[1]-i[1],a=(e[0]-i[0])*o-n*(e[1]-i[1]),s=(t[0]-i[0])*o-n*(t[1]-i[1]);return a>0&&s<0||a<0&&s>0}function Qe(e,t,i,r){return 0!==(n=[r[0]-i[0],r[1]-i[1]])[0]*(o=[t[0]-e[0],t[1]-e[1]])[1]-n[1]*o[0]&&!(!Je(e,t,i,r)||!Je(i,r,e,t));var n,o}function et(e){const t=new ke(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),i=new ke(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const r of e[0])t.x>r.x&&(t.x=r.x),t.y>r.y&&(t.y=r.y),i.x<r.x&&(i.x=r.x),i.y<r.y&&(i.y=r.y);return{min:t,max:i}}Te(),ke.prototype={clone(){return new ke(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){const t=e.x-this.x,i=e.y-this.y;return t*t+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){const t=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=t,this},_add(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){const e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){const t=Math.cos(e),i=Math.sin(e),r=i*this.x+t*this.y;return this.x=t*this.x-i*this.y,this.y=r,this},_rotateAround(e,t){const i=Math.cos(e),r=Math.sin(e),n=t.y+r*(this.x-t.x)+i*(this.y-t.y);return this.x=t.x+i*(this.x-t.x)-r*(this.y-t.y),this.y=n,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:ke},ke.convert=function(e){if(e instanceof ke)return e;if(Array.isArray(e))return new ke(+e[0],+e[1]);if(void 0!==e.x&&void 0!==e.y)return new ke(+e.x,+e.y);throw new Error("Expected [x, y] or {x, y} point format")};const tt=Math.PI/180,it=180/Math.PI,rt=/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function nt(e){return e*tt}function ot(e){return e*it}const at=[[0,0],[1,0],[1,1],[0,1]];function st(e){if(e<=0)return 0;if(e>=1)return 1;const t=e*e,i=t*e;return 4*(e<.5?i:3*(e-t)+i-.75)}function lt(e){let t=1/0,i=1/0,r=-1/0,n=-1/0;for(const o of e)t=Math.min(t,o.x),i=Math.min(i,o.y),r=Math.max(r,o.x),n=Math.max(n,o.y);return{min:new ke(t,i),max:new ke(r,n)}}function ct(e,t,i=0,r=!0){const n=new ke(i,i),o=e.sub(n),a=t.add(n),s=[o,new ke(a.x,o.y),a,new ke(o.x,a.y)];return r&&s.push(o.clone()),s}const ut=Be(.25,.1,.25,1);function ht(e,t,i){return Math.min(i,Math.max(t,e))}function dt(e,t,i){return(i=ht((i-e)/(t-e),0,1))*i*(3-2*i)}function pt(e,t,i){const r=i-t,n=((e-t)%r+r)%r+t;return n===t?i:n}function ft(e,t,i){if(!e.length)return i(null,[]);let r=e.length;const n=new Array(e.length);let o=null;e.forEach((e,a)=>{t(e,(e,t)=>{e&&(o=e),n[a]=t,0===--r&&i(o,n)})})}function mt(e,t){const i={};for(let r=0;r<t.length;r++){const n=t[r];n in e&&(i[n]=e[n])}return i}let _t=1;function gt(){return _t++}function yt(){return function e(t){return t?(t^Math.random()*(16>>t/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,e)}()}function xt(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log2(e)))}function vt(e){return!!e&&rt.test(e)}function bt(e,t){e.forEach(e=>{t[e]&&(t[e]=t[e].bind(t))})}function wt(e,t,i){const r={};for(const n in e)r[n]=t.call(this,e[n],n,e);return r}function Et(e,t,i){const r={};for(const n in e)t.call(this,e[n],n,e)&&(r[n]=e[n]);return r}function At(e){return Array.isArray(e)?e.map(At):"object"==typeof e&&e?wt(e,At):e}function It(e,t){for(let i=0;i<e.length;i++)if(t.includes(e[i]))return!0;return!1}const St={};function Tt(e){St[e]||("undefined"!=typeof console&&console.warn(e),St[e]=!0)}function Dt(e,t,i){return(i.y-e.y)*(t.x-e.x)>(t.y-e.y)*(i.x-e.x)}function Mt([e,t,i]){const r=nt(t+90),n=nt(i);return{x:e*Math.cos(r)*Math.sin(n),y:e*Math.sin(r)*Math.sin(n),z:e*Math.cos(n),azimuthal:t,polar:i}}function Pt(e,t,i){const r=Math.sqrt(e*e+t*t+i*i),n=r>0?Math.acos(i/r)*it:0;let o=0!==e||0!==t?Math.atan2(-t,-e)*it+90:0;return o<0&&(o+=360),[r,o,n]}function Ct(e){return("undefined"!=typeof self||void 0!==e)&&"undefined"!=typeof WorkerGlobalScope&&(void 0!==e?e:self)instanceof WorkerGlobalScope}function Rt(e){const t={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(e,i,r,n)=>{const o=r||n;return t[i]=!o||o.toLowerCase(),""}),t["max-age"]){const e=parseInt(t["max-age"],10);isNaN(e)?delete t["max-age"]:t["max-age"]=e}return t}function zt(e){return e?{cacheControl:e.get("cache-control"),expires:e.get("expires")}:{cacheControl:void 0,expires:void 0}}function Lt(){return!!document.fullscreenElement||!!document.webkitFullscreenElement}function Ft(e){try{const t=self[e];return t.setItem("_mapbox_test_",1),t.removeItem("_mapbox_test_"),!0}catch(e){return!1}}function Ot(e,t){return[e[4*t],e[4*t+1],e[4*t+2],e[4*t+3]]}function Bt(e,t,i){e[4*t+0]=i[0],e[4*t+1]=i[1],e[4*t+2]=i[2],e[4*t+3]=i[3]}function kt(e,t){return[Math.pow(e[0],2.2)*t,Math.pow(e[1],2.2)*t,Math.pow(e[2],2.2)*t]}function Vt(e){return[Math.pow(e[0],1/2.2),Math.pow(e[1],1/2.2),Math.pow(e[2],1/2.2)]}function Nt(e,t,i,r){for(;t<i;){const n=t+i>>1;e[n]<r?t=n+1:i=n}return t}function Ut(e,t,i,r){for(;t<i;){const n=t+i>>1;e[n]<=r?t=n+1:i=n}return t}function jt(e){return e>0?1/(1.001-e):1+e}function Gt(e){return e>0?1-1/(1.001-e):-e}function Ht(e,t,i){return(e-t.min)*(i.max-i.min)/(t.max-t.min)+i.min}function $t(e){return e*e*e*e*e}function Wt(e){return e>>>=0,e=Math.imul(2747636419^e,2654435769)>>>0,e=Math.imul(e^e>>>16,2654435769)>>>0,(e=Math.imul(e^e>>>16,2654435769)>>>0)/4294967296}let qt,Zt,Xt,Yt,Kt,Jt;function Qt(){return qt??=self.OffscreenCanvas&&!!new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof self.createImageBitmap,qt}const ei={requestIdleCallback:e=>{if("undefined"!=typeof requestIdleCallback)return requestIdleCallback(e);setTimeout(()=>e({didTimeout:!1,timeRemaining:()=>50}),0)},now:()=>void 0!==Yt?Yt:performance.now(),setNow(e){Yt=e},restoreNow(){Yt=void 0},frame(e){const t=requestAnimationFrame(e);return{cancel:()=>cancelAnimationFrame(t)}},getImageData(e,t=0){const{width:i,height:r}=e;Kt||(Kt=document.createElement("canvas"));const n=Kt.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("failed to create canvas 2d context");return(i>Kt.width||r>Kt.height)&&(Kt.width=i,Kt.height=r),n.clearRect(-t,-t,i+2*t,r+2*t),n.drawImage(e,0,0,i,r),n.getImageData(-t,-t,i+2*t,r+2*t)},resolveURL:e=>(Zt||(Zt=document.createElement("a")),Zt.href=e,Zt.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(Xt??=window.matchMedia("(prefers-reduced-motion: reduce)"),Xt.matches)},hasCanvasFingerprintNoise(){if(void 0!==Jt)return Jt;if(!Qt())return Jt=!1,!1;const e=new OffscreenCanvas(85,1),t=e.getContext("2d",{willReadFrequently:!0});let i=0;for(let n=0;n<e.width;++n)t.fillStyle=`rgba(${i++},${i++},${i++}, 255)`,t.fillRect(n,0,1,1);const r=t.getImageData(0,0,e.width,e.height);i=0;for(let n=0;n<r.data.length;++n)if(n%4!=3&&i++!==r.data[n])return Jt=!0,!0;return Jt=!1,!1}},ti=/firefox/i,ii=/macintosh/i;function ri(e,t,i){const r=document.createElement(e);return null!=t&&(r.className=t),i&&i.appendChild(r),r}function ni(e,t,i){const r=document.createElementNS("http://www.w3.org/2000/svg",e);for(const n of Object.keys(t))r.setAttributeNS(null,n,String(t[n]));return i&&i.appendChild(r),r}const oi="undefined"!=typeof document?document.documentElement&&document.documentElement.style:null,ai=oi&&void 0!==oi.userSelect?"userSelect":"WebkitUserSelect";let si,li;function ci(){oi&&ai&&(si=oi[ai],oi[ai]="none")}function ui(){oi&&ai&&(oi[ai]=si)}function hi(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",hi,!0)}function di(){window.addEventListener("click",hi,!0),window.setTimeout(()=>{window.removeEventListener("click",hi,!0)},0)}function pi(e,t){const i=e.getBoundingClientRect();return _i(e,i,t)}function fi(e,t){const i=e.getBoundingClientRect(),r=[];for(let n=0;n<t.length;n++)r.push(_i(e,i,t[n]));return r}function mi(e){return ti.test(navigator.userAgent)&&ii.test(navigator.userAgent)&&2===e.button&&e.ctrlKey?0:e.button}function _i(e,t,i){const r=e.offsetWidth===t.width?1:e.offsetWidth/t.width;return new ke((i.clientX-t.left)*r,(i.clientY-t.top)*r)}const gi={API_URL:"https://api.mapbox.com",API_URL_REGEX:/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i,API_TILEJSON_REGEX:/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i,API_SPRITE_REGEX:/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i,API_FONTS_REGEX:/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i,API_STYLE_REGEX:/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i,API_CDN_URL_REGEX:/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i,get EVENTS_URL(){if(!gi.API_URL)return null;try{const e=new URL(gi.API_URL);return"api.mapbox.cn"===e.hostname?"https://events.mapbox.cn/events/v2":"api.mapbox.com"===e.hostname?"https://events.mapbox.com/events/v2":null}catch(e){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:"/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MESHOPT_URL:"/mapbox-gl-js/meshopt_base_v1.2.wasm",MESHOPT_SIMD_URL:"/mapbox-gl-js/meshopt_simd_v1.2.wasm",BUILDING_GEN_URL:"/mapbox-gl-js/building-gen/building_gen_v1.2.6.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1",TILE_PROVIDER_URLS:Object.assign(Object.create(null),{pmtiles:"/mapbox-gl-js/plugins/mapbox-gl-pmtiles-provider/v0.0.2/mapbox-gl-pmtiles-provider.js"})};function yi(){return new URL(gi.DRACO_URL,gi.API_URL).href}function xi(){if("object"!=typeof WebAssembly)throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer");return new URL(function(){if(void 0===li){if("object"!=typeof WebAssembly)return!1;const e=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]);li=WebAssembly.validate(e)}return li}()?gi.MESHOPT_SIMD_URL:gi.MESHOPT_URL,gi.API_URL).href}function vi(){return new URL(gi.BUILDING_GEN_URL,gi.API_URL).href}function bi(e,t){const i=e.indexOf("?"),r=i<0?e:e.slice(0,i),n=new URLSearchParams(i<0?"":e.slice(i));for(const[o,a]of Object.entries(t))n.set(o,a);return`${r}?${n}`}function wi(e,t={persistentParams:[]}){const i=e.indexOf("?");if(i<0)return e;const r=new URLSearchParams,n=new URLSearchParams(e.slice(i));for(const a of t.persistentParams){const e=n.get(a);e&&r.set(a,e)}const o=r.toString();return`${e.slice(0,i)}${o.length>0?`?${o}`:""}`}const Ei="mapbox-tiles";let Ai=500,Ii=50;const Si=["language","worldview","jobid"];let Ti;function Di(){try{return caches}catch(e){}}function Mi(){const e=Di();e&&null==Ti&&(Ti=e.open(Ei))}let Pi=1/0;function Ci(e){Pi++,Pi>Ii&&(e.getActor().notify("enforceCacheSizeLimit",Ai),Pi=0)}function Ri(e){return gi.API_URL_REGEX.test(e)}function zi(e){return 0===e.indexOf("mapbox:")}function Li(e){return gi.API_CDN_URL_REGEX.test(e)}function Fi(e){return gi.API_SPRITE_REGEX.test(e)}function Oi(e){return gi.API_STYLE_REGEX.test(e)&&!Fi(e)}const Bi={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"};Object.freeze(Bi);class ki extends Error{constructor(e,t,i){super(),this.url=i,this.statusText=e,this.status=t}get message(){return 401===this.status&&Ri(this.url)?`${this.statusText}: you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/guides/#access-tokens-and-token-scopes`:this.statusText}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}function Vi(e){return"object"==typeof e&&null!==e&&"status"in e&&404===e.status}const Ni=Ct()?()=>self.worker.referrer:()=>("blob:"===location.protocol?parent:self).location.href,Ui=/^\w+:/,ji=/[\r\n]+/;async function Gi(e,t){let i;return i="arrayBuffer"===e.type?await t.arrayBuffer():"json"===e.type?await t.json():await t.text(),{data:i,headers:t.headers}}async function Hi(e,t){return t&&t.throwIfAborted(),(i=e.url).startsWith("file:")||Ni().startsWith("file:")&&!Ui.test(i)?async function(e,t){return new Promise((i,r)=>{const n=new XMLHttpRequest,o=()=>{t.removeEventListener("abort",o),n.abort(),r(t.reason)};t&&t.addEventListener("abort",o),n.open(e.method||"GET",e.url,!0),"arrayBuffer"===e.type&&(n.responseType="arraybuffer");for(const t in e.headers)n.setRequestHeader(t,e.headers[t]);"json"===e.type&&(n.responseType="text",n.setRequestHeader("Accept","application/json")),n.withCredentials="include"===e.credentials,n.onerror=()=>{t&&t.removeEventListener("abort",o),r(new Error(n.statusText))},n.onload=()=>{if(t&&t.removeEventListener("abort",o),(n.status>=200&&n.status<300||0===n.status)&&null!==n.response){let t=n.response;if("json"===e.type)try{t=JSON.parse(n.response)}catch(e){return void r(e)}const o=new Headers;
vendor: 1,751 bytes, line 2
2n.getAllResponseHeaders().trim().split(ji).forEach(e=>{const t=e.split(": "),i=t.shift(),r=t.join(": ");i&&o.set(i,r)}),i({data:t,headers:o})}else r(new ki(n.statusText,n.status,e.url))},n.send(e.body)})}(e,t):async function(e,t){const i=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,referrer:Ni(),referrerPolicy:e.referrerPolicy,signal:t}),r=(n=i.url).indexOf("sku=")>0&&Ri(n);var n;if("json"===e.type&&i.headers.set("Accept","application/json"),r){let r=null;try{r=await async function(e){if(Mi(),null==Ti)return null;const t=await Ti;let i=wi(e.url,{persistentParams:Si});const r=e.headers.get("Range");r&&(i=bi(i,{range:r}));const n=await t.match(i);if(!n)return null;const o=function(e){if(!e)return!1;const t=new Date(e.headers.get("expires")||0),i=Rt(e.headers.get("cache-control")||"");return Number(t)>Date.now()&&!i["no-cache"]}(n);return t.delete(i).catch(e=>Tt(e.message)),o&&t.put(i,n.clone()).catch(e=>Tt(e.message)),{response:n,fresh:o}}(i)}catch(e){"SecurityError"!==e.message&&Tt(e.toString())}if(r&&r.fresh)return t&&t.throwIfAborted(),Gi(e,r.response)}const o=Date.now();let a;try{a=await fetch(i)}catch(t){if("AbortError"===t.name)throw t;throw new Error(`${t.message} ${e.url}`,{cause:t})}if(t&&t.throwIfAborted(),!a.ok)throw new ki(a.statusText,a.status,e.url);const s=r?a.clone():null,l=await Gi(e,a);return s&&async function(e,t,i){if(Mi(),null==Ti)return;const r=Rt(t.headers.get("cache-control")||"");if(r["no-store"])return;const n={status:t.status,statusText:t.statusText,headers:new Headers(t.headers)};r["max-age"]&&n.headers.set("Expires",new Date(i+1e3*r["max-age"]).toUTCString());const o=n.headers.get("expires");if(!o)return;if(new Date(o).getTime()-i<42e4)return;
vendor: 30,696 bytes, line 2
2let a=wi(e.url,{persistentParams:Si});if(206===t.status){const t=e.headers.get("Range");if(!t)return;n.status=200,a=bi(a,{range:t})}const s=new Response(200!==(l=t.status)&&404!==l&&[101,103,204,205,304].includes(l)?null:t.body,n);var l;if(Mi(),null!=Ti)try{const e=await Ti;await e.put(a,s)}catch(e){Tt(e.message)}}(i,s,o),l}(e,t);var i}async function $i(e,t){return Hi(Object.assign(e,{type:"json"}),t)}async function Wi(e,t){return Hi(Object.assign(e,{type:"arrayBuffer"}),t)}function qi(e){const t=document.createElement("a");return t.href=e,t.protocol===location.protocol&&t.host===location.host}let Zi,Xi;async function Yi(e,t){e.headers||(e.headers={}),e.headers.accept="image/webp,*/*";const i=await function(e){return new Promise((t,i)=>{if(e&&e.aborted)return void i(e.reason);const r=()=>{const e=Zi.shift();e?e():Xi--};if(Xi<gi.MAX_PARALLEL_IMAGE_REQUESTS)return Xi++,void t(r);const n=()=>{e&&e.removeEventListener("abort",o),t(r)},o=()=>{const t=Zi.indexOf(n);-1!==t&&Zi.splice(t,1),i(e.reason)};e&&e.addEventListener("abort",o),Zi.push(n)})}(t);try{const{data:i,headers:r}=await Wi(e,t);let n;try{n=await createImageBitmap(new Blob([new Uint8Array(i)],{type:"image/png"}))}catch(e){throw new Error(`Could not load image because of ${e.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`,{cause:e})}return t&&t.throwIfAborted(),{data:n,headers:r}}finally{i()}}Zi=[],Xi=0;const Ki="01",Ji={create:"create",load:"load",fullLoad:"fullLoad"},Qi={mark(e){performance.mark(e)},measure(e,t,i){performance.measure(e,t,i)}};function er(e){const t=e.name.split("?")[0];return Li(t)&&t.includes("mapbox-gl.js")?"javascript":Li(t)&&t.includes("mapbox-gl.css")?"css":function(e){return gi.API_FONTS_REGEX.test(e)}(t)?"fontRange":Fi(t)?"sprite":Oi(t)?"style":function(e){return gi.API_TILEJSON_REGEX.test(e)}(t)?"tilejson":"other"}const tr=/(\.(png|jpg)\d*)(?=$)/,ir=/^.+\/v4\//,rr=/\.[\w]+$/,nr=/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/,or=/^access_token=(.*)$/,ar="NO_ACCESS_TOKEN";class sr{constructor(e,t,i){this._transformRequestFn=e,this._customAccessToken=t,this._silenceAuthErrors=!!i,this._createSkuToken()}_createSkuToken(){const e=function(){let e="";for(let t=0;t<10;t++)e+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",Ki,e].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=e.token,this._skuTokenExpiresAt=e.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}async transformRequest(e,t,i){if(!this._transformRequestFn)return{url:e};const r=i?{signal:i}:{};return await this._transformRequestFn(e,t,r)||{url:e}}normalizeStyleURL(e,t){if(!zi(e))return e;const i=cr(e);return i.params.push(`sdk=js-${n}`),i.path=`/styles/v1${i.path}`,this._makeAPIURL(i,this._customAccessToken||t)}normalizeGlyphsURL(e,t){if(!zi(e))return e;const i=cr(e);return i.path=`/fonts/v1${i.path}`,this._makeAPIURL(i,this._customAccessToken||t)}normalizeModelURL(e,t){if(!zi(e))return e;const i=cr(e);return i.path=`/models/v1${i.path}`,this._makeAPIURL(i,this._customAccessToken||t)}normalizeSourceURL(e,t,i,r){if(!zi(e))return e;const n=cr(e);return n.path=`/v4/${n.authority}.json`,n.params.push("secure"),i&&n.params.push(`language=${i}`),r&&n.params.push(`worldview=${r}`),this._makeAPIURL(n,this._customAccessToken||t)}normalizeIconsetURL(e,t){const i=cr(e);return zi(e)?(i.path=`/styles/v1${i.path}/iconset.pbf`,this._makeAPIURL(i,this._customAccessToken||t)):ur(i)}normalizeSpriteURL(e,t,i,r){const n=cr(e);return zi(e)?(n.path=`/styles/v1${n.path}/sprite${t}${i}`,this._makeAPIURL(n,this._customAccessToken||r)):(n.path+=`${t}${i}`,ur(n))}normalizeTileURL(e,t,i){if(this._isSkuTokenExpired()&&this._createSkuToken(),e&&!zi(e))return e;const r=cr(e);r.path=r.path.replace(tr,(t||i&&"raster"!==r.authority&&512===i?"@2x":"")+".webp"),"raster"===r.authority?r.path=`/${gi.RASTER_URL_PREFIX}${r.path}`:"rasterarrays"===r.authority?r.path=`/${gi.RASTERARRAYS_URL_PREFIX}${r.path}`:"3dtiles"===r.authority?r.path=`/${gi.TILES3D_URL_PREFIX}${r.path}`:(r.path=r.path.replace(ir,"/"),r.path=`/${gi.TILE_URL_VERSION}${r.path}`);const n=this._customAccessToken||function(e){for(const t of e){const e=t.match(or);if(e)return e[1]}return null}(r.params)||gi.ACCESS_TOKEN;return gi.REQUIRE_ACCESS_TOKEN&&n&&this._skuToken&&r.params.push(`sku=${this._skuToken}`),this._makeAPIURL(r,n)}canonicalizeTileURL(e,t){const i=cr(e);if(!nr.test(i.path)||!rr.test(i.path))return e;let r="mapbox://";i.path.startsWith("/raster/v1/")?r+=`raster/${i.path.replace(`/${gi.RASTER_URL_PREFIX}/`,"")}`:i.path.startsWith("/rasterarrays/v1/")?r+=`rasterarrays/${i.path.replace(`/${gi.RASTERARRAYS_URL_PREFIX}/`,"")}`:r+=`tiles/${i.path.replace(`/${gi.TILE_URL_VERSION}/`,"")}`;let n=i.params;return t&&(n=n.filter(e=>!e.match(or))),n.length&&(r+=`?${n.join("&")}`),r}canonicalizeTileset(e,t){const i=!!t&&zi(t),r=[];for(const n of e.tiles||[])Ri(n)?r.push(this.canonicalizeTileURL(n,i)):r.push(n);return r}_makeAPIURL(e,t){const i="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",r=cr(gi.API_URL);if(e.protocol=r.protocol,e.authority=r.authority,"http"===e.protocol){const t=e.params.indexOf("secure");t>=0&&e.params.splice(t,1)}if("/"!==r.path&&(e.path=`${r.path}${e.path}`),!gi.REQUIRE_ACCESS_TOKEN)return ur(e);if(t=t||gi.ACCESS_TOKEN,!this._silenceAuthErrors){if(!t)throw new Error(`An API access token is required to use Mapbox GL. ${i}`);if("s"===t[0])throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${i}`)}return e.params=e.params.filter(e=>!e.includes("access_token")),e.params.push(`access_token=${t||""}`),ur(e)}}const lr=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function cr(e){const t=e.match(lr);if(!t)throw new Error("Unable to parse URL object");return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&"):[]}}function ur(e){const t=e.params.length?`?${e.params.join("&")}`:"";return`${e.protocol}://${e.authority}${e.path}${t}`}const hr="mapbox.eventData";function dr(e){if(!e)return null;const t=e.split(".");if(!t||3!==t.length)return null;try{return JSON.parse(decodeURIComponent(atob(t[1]).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join("")))}catch(e){return null}}function pr(e){return!(!gi.EVENTS_URL||!e&&!gi.ACCESS_TOKEN)}let fr;const mr=/^[\w.+-]+(\/[\w.+-]+)?$/;let _r="other";class gr{constructor(e){this.type=e,this.anonId=null,this.anonIdTimestamp=null,this.eventData={},this.queue=[],this.pendingRequest=!1}getStorageKey(e){const t=dr(gi.ACCESS_TOKEN);let i="";return i=t&&t.u?btoa(encodeURIComponent(t.u).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(Number("0x"+t)))):gi.ACCESS_TOKEN||"",e?`${hr}.${e}:${i}`:`${hr}:${i}`}fetchEventData(){const e=Ft("localStorage"),t=this.getStorageKey(),i=this.getStorageKey("uuid"),r=this.getStorageKey("uuidTimestamp");if(e)try{const e=localStorage.getItem(t);e&&(this.eventData=JSON.parse(e));const n=localStorage.getItem(i);n&&(this.anonId=n);const o=localStorage.getItem(r);o&&(this.anonIdTimestamp=Number(o));const a=Date.now()-864e5;(!this.anonIdTimestamp||this.anonIdTimestamp<a)&&this.refreshUUID()}catch(e){Tt("Unable to read from LocalStorage")}}refreshUUID(){this.anonId=yt(),this.anonIdTimestamp=Date.now()}saveEventData(){const e=Ft("localStorage"),t=this.getStorageKey(),i=this.getStorageKey("uuid"),r=this.getStorageKey("uuidTimestamp"),n=this.anonId,o=this.anonIdTimestamp;if(e&&n)try{localStorage.setItem(i,n),Object.keys(this.eventData).length>=1&&localStorage.setItem(t,JSON.stringify(this.eventData)),o&&localStorage.setItem(r,o.toString())}catch(e){Tt("Unable to write to LocalStorage")}}processRequests(){}postEvent(e,t,i,r){if(!gi.EVENTS_URL)return;const n=cr(gi.EVENTS_URL);n.params.push(`access_token=${r||gi.ACCESS_TOKEN||""}`);const o={event:this.type,created:new Date(e).toISOString()},a=t?Object.assign(o,t):o,s={url:ur(n),headers:{"Content-Type":"text/plain"},body:JSON.stringify([a])};this.pendingRequest=!0,async function(e){return Hi(Object.assign(e,{method:"POST"}),void 0)}(s).then(()=>{this.pendingRequest=!1,i(null),this.saveEventData(),this.processRequests()}).catch(e=>{this.pendingRequest=!1,i(e),this.saveEventData(),this.processRequests()})}queueRequest(e,t){this.queue.push({...e,customAccessToken:t}),this.processRequests()}}class yr extends gr{constructor(e){super("metrics"),e&&(this.data=e)}postMetricsEvent(e){if(!pr(e))return;this.anonId||this.fetchEventData(),vt(this.anonId)||this.refreshUUID();const t={...this.data,sessionId:this.anonId};this.queueRequest({timestamp:Date.now(),payload:t},e)}processRequests(){if(this.pendingRequest||0===this.queue.length)return;const{timestamp:e,payload:t,customAccessToken:i}=this.queue.shift();this.postEvent(e,t,()=>{},i)}}const xr=new class extends gr{constructor(e){super("appUserTurnstile"),this._customAccessToken=e}postTurnstileEvent(e,t){pr(t)&&Array.isArray(e)&&e.some(e=>zi(e)||Ri(e))&&this.queueRequest({timestamp:Date.now()},t)}processRequests(){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.anonIdTimestamp&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const e=dr(gi.ACCESS_TOKEN),t=e?e.u:gi.ACCESS_TOKEN;let i=t!==this.eventData.tokenU;vt(this.anonId)||(this.refreshUUID(),i=!0);const{timestamp:r,customAccessToken:o}=this.queue.shift();if(this.eventData.lastSuccess){const e=new Date(this.eventData.lastSuccess),t=new Date(r),n=(r-this.eventData.lastSuccess)/864e5;i=i||n>=1||n<-1||e.getDate()!==t.getDate()}else i=!0;if(!i)return void this.processRequests();const a={version:"2.2",sdkIdentifier:"mapbox-gl-js",sdkVersion:n,skuId:Ki,"enabled.telemetry":!1,userId:this.anonId,bundleFormat:"csp",bundleDistribution:_r};fr&&(a.sdkInfo=fr),this.postEvent(r,a,e=>{e||(this.eventData.lastSuccess=r,this.eventData.tokenU=t)},o)}},vr=xr.postTurnstileEvent.bind(xr),br=new class extends gr{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(e,t,i,r){this.skuToken=t,this.errorCb=r,gi.EVENTS_URL&&(i||gi.ACCESS_TOKEN?this.queueRequest({id:e,timestamp:Date.now()},i):this.errorCb(new Error(ar)))}processRequests(){if(this.pendingRequest||0===this.queue.length)return;const{id:e,timestamp:t,customAccessToken:i}=this.queue.shift();if(e&&this.success[e])return;this.anonId&&this.anonIdTimestamp||this.fetchEventData(),vt(this.anonId)||this.refreshUUID();const r={version:"2.2",sdkIdentifier:"mapbox-gl-js",sdkVersion:n,skuId:Ki,skuToken:this.skuToken,userId:this.anonId,bundleFormat:"csp",bundleDistribution:_r};fr&&(r.sdkInfo=fr),this.postEvent(t,r,t=>{t?this.errorCb(t):e&&(this.success[e]=!0)},i)}remove(){this.errorCb=null}},wr=br.postMapLoadEvent.bind(br),Er=new class extends gr{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(e){let t=this.mapInstanceIdMap.get(e);return t||(t=yt(),this.mapInstanceIdMap.set(e,t)),t}getEventId(e){const t=this.eventIdPerMapInstanceMap.get(e)||0;return this.eventIdPerMapInstanceMap.set(e,t+1),t}postStyleLoadEvent(e,t){const{map:i,style:r,importedStyles:n}=t;if(!pr(e))return;const o=this.getMapInstanceId(i),a={mapInstanceId:o,eventId:this.getEventId(o),style:r};n.length&&(a.importedStyles=n),this.queueRequest({timestamp:Date.now(),payload:a},e)}processRequests(){if(this.pendingRequest||0===this.queue.length)return;const{timestamp:e,payload:t,customAccessToken:i}=this.queue.shift();this.postEvent(e,t,()=>{},i)}},Ar=Er.postStyleLoadEvent.bind(Er),Ir=new yr({attributes:[{name:"maps/js/layer-animations/style-with-appearances"}]}),Sr=Ir.postMetricsEvent.bind(Ir),Tr=new yr({attributes:[{name:"maps/js/layer-animations/runtime-appearances"}]}),Dr=Tr.postMetricsEvent.bind(Tr),Mr=new class extends gr{constructor(){super("gljs.performance")}postPerformanceEvent(e,t){pr(e)&&this.queueRequest({timestamp:Date.now(),performanceData:t},e)}processRequests(){if(this.pendingRequest||0===this.queue.length)return;const{timestamp:e,performanceData:t,customAccessToken:i}=this.queue.shift(),r=function(e){const t=performance.getEntriesByType("resource"),i=performance.getEntriesByType("mark"),r=function(e){const t={};if(e)for(const i in e)if("other"!==i)for(const r of e[i]){const e=`${i}ResolveRangeMin`,n=`${i}ResolveRangeMax`,o=`${i}RequestCount`,a=`${i}RequestCachedCount`;t[e]=Math.min(t[e]||1/0,r.startTime),t[n]=Math.max(t[n]||-1/0,r.responseEnd);const s=e=>{void 0===t[e]&&(t[e]=0),++t[e]};void 0!==r.transferSize&&0===r.transferSize&&s(a),s(o)}return t}(function(e,t){const i={};if(e)for(const r of e){const e=t(r);void 0===i[e]&&(i[e]=[]),i[e].push(r)}return i}(t,er)),o=window.devicePixelRatio,a=navigator.connection||navigator.mozConnection||navigator.webkitConnection,s=a?a.effectiveType:void 0,l={counters:[],metadata:[],attributes:[]},c=(e,t,i)=>{null!=i&&e.push({name:t,value:i.toString()})};for(const n in r)c(l.counters,n,r[n]);if(e.interactionRange[0]!==1/0&&e.interactionRange[1]!==-1/0&&(c(l.counters,"interactionRangeMin",e.interactionRange[0]),c(l.counters,"interactionRangeMax",e.interactionRange[1])),i)for(const n of Object.values(Ji)){const e=i.find(e=>e.name===n);e&&c(l.counters,n,e.startTime)}return c(l.counters,"visibilityHidden",e.visibilityHidden),c(l.attributes,"style",function(e){if(e)for(const t of e){const e=t.name.split("?")[0];if(Oi(e)){const t=e.split("/").slice(-2);if(2===t.length)return`mapbox://styles/${t[0]}/${t[1]}`}}}(t)),c(l.attributes,"terrainEnabled",e.terrainEnabled?"true":"false"),c(l.attributes,"fogEnabled",e.fogEnabled?"true":"false"),c(l.attributes,"projection",e.projection),c(l.attributes,"zoom",e.zoom),c(l.metadata,"devicePixelRatio",o),c(l.metadata,"connectionEffectiveType",s),c(l.metadata,"navigatorUserAgent",navigator.userAgent),c(l.metadata,"screenWidth",window.screen.width),c(l.metadata,"screenHeight",window.screen.height),c(l.metadata,"windowWidth",window.innerWidth),c(l.metadata,"windowHeight",window.innerHeight),c(l.metadata,"mapWidth",e.width/o),c(l.metadata,"mapHeight",e.height/o),c(l.metadata,"webglRenderer",e.renderer),c(l.metadata,"webglVendor",e.vendor),c(l.metadata,"sdkVersion",n),c(l.metadata,"sdkIdentifier","mapbox-gl-js"),l}(t);for(const n of r.metadata);for(const n of r.counters);for(const n of r.attributes);this.postEvent(e,r,()=>{},i)}},Pr=Mr.postPerformanceEvent.bind(Mr),Cr=new class extends gr{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(e,t,i,r){if(!gi.API_URL||!gi.SESSION_PATH)return;const n=cr(gi.API_URL+gi.SESSION_PATH);n.params.push(`sku=${t||""}`),n.params.push(`access_token=${r||gi.ACCESS_TOKEN||""}`);const o={url:ur(n),headers:{"Content-Type":"text/plain"}};this.pendingRequest=!0,async function(e){return Hi(Object.assign(e,{method:"GET"}),void 0)}(o).then(()=>{this.pendingRequest=!1,i(null),this.saveEventData(),this.processRequests()}).catch(e=>{this.pendingRequest=!1,i(e),this.saveEventData(),this.processRequests()})}getSessionAPI(e,t,i,r){this.skuToken=t,this.errorCb=r,gi.EVENTS_URL&&gi.SESSION_PATH&&gi.API_URL&&(i||gi.ACCESS_TOKEN?this.queueRequest({id:e,timestamp:Date.now()},i):this.errorCb(new Error(ar)))}processRequests(){if(this.pendingRequest||0===this.queue.length)return;const{id:e,timestamp:t,customAccessToken:i}=this.queue.shift();e&&this.success[e]||this.getSession(t,this.skuToken,t=>{t?this.errorCb(t):e&&(this.success[e]=!0)},i)}remove(){this.errorCb=null}},Rr=Cr.getSessionAPI.bind(Cr),zr=new Set;function Lr(e,t){t?zr.add(e):zr.delete(e)}function Fr(e,t=0){const i=3432918353,r=461845907,n=e.length,o=n-(3&n);let a,s=0|t,l=0;for(;l<o;)a=255&e.charCodeAt(l)|(255&e.charCodeAt(l+1))<<8|(255&e.charCodeAt(l+2))<<16|(255&e.charCodeAt(l+3))<<24,l+=4,a=Math.imul(a,i),a=a<<15|a>>>17,a=Math.imul(a,r),s^=a,s=s<<13|s>>>19,s=Math.imul(s,5)+3864292196|0;a=0;const c=3&n;return c>0&&(c>=3&&(a^=(255&e.charCodeAt(l+2))<<16),c>=2&&(a^=(255&e.charCodeAt(l+1))<<8),a^=255&e.charCodeAt(l),a=Math.imul(a,i),a=a<<15|a>>>17,a=Math.imul(a,r),s^=a),s^=n,s^=s>>>16,s=Math.imul(s,2246822507),s^=s>>>13,s=Math.imul(s,3266489909),s^=s>>>16,s>>>0}class Or{constructor(e,...t){Object.assign(this,t[0]||{}),this.type=e}}class Br extends Or{constructor(e,t={}){super("error",{error:e,...t}),this.error=e}}function kr(e,t,i){i[e]&&i[e].includes(t)||(i[e]=i[e]||[],i[e].push(t))}function Vr(e,t,i){if(i[e]){const r=i[e].indexOf(t);-1!==r&&i[e].splice(r,1)}}class Nr{constructor(){this._listeners={},this._oneTimeListeners={}}on(e,t){return kr(e,t,this._listeners),this}off(e,t){return Vr(e,t,this._listeners),Vr(e,t,this._oneTimeListeners),this}once(e,t){return t?(kr(e,t,this._oneTimeListeners),this):new Promise(t=>{this.once(e,t)})}fire(e,t){const i="string"==typeof e?new Or(e,t):e,r=i.type;if(this.listens(r)){i.target=this;const e=this._listeners[r]?this._listeners[r].slice():[];for(const r of e)r.call(this,i);const t=this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[];for(const o of t)Vr(r,o,this._oneTimeListeners),o.call(this,i);const n=this._eventedParent;if(n){const e="function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData;Object.assign(i,e),n.fire(i)}}else i instanceof Br&&console.error(i.error);return this}listens(e){return!!(this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}class Ur{constructor(e){"string"==typeof e?this.name=e:(this.name=e.name,this.iconsetId=e.iconsetId)}static from(e){return new Ur(e)}static toString(e){return e.iconsetId?`${e.name}\x1f${e.iconsetId}`:e.name}static parse(e){const[t,i]=e.split("\x1f");return new Ur({name:t,iconsetId:i})}static isEqual(e,t){return e.name===t.name&&e.iconsetId===t.iconsetId}toString(){return Ur.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}class jr{constructor(){this._changed=!1,this._updatedLayers=Object.create(null),this._removedLayers=Object.create(null),this._updatedSourceCaches=Object.create(null),this._updatedPaintProps=new Set,this._updatedImages=Object.create(null)}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(e,t){this._updatedSourceCaches[e]=t,this.setDirty()}discardSourceCacheUpdate(e){delete this._updatedSourceCaches[e]}updateLayer(e){const t=e.scope;this._updatedLayers[t]=this._updatedLayers[t]||new Set,this._updatedLayers[t].add(e.id),this.setDirty()}removeLayer(e){const t=e.scope;this._removedLayers[t]=this._removedLayers[t]||{},this._updatedLayers[t]=this._updatedLayers[t]||new Set,this._removedLayers[t][e.id]=e,this._updatedLayers[t].delete(e.id),this._updatedPaintProps.delete(e.fqid),this.setDirty()}getRemovedLayer(e){return this._removedLayers[e.scope]?this._removedLayers[e.scope][e.id]:null}discardLayerRemoval(e){this._removedLayers[e.scope]&&delete this._removedLayers[e.scope][e.id]}getLayerUpdatesByScope(){const e={};for(const t in this._updatedLayers)e[t]=e[t]||{},e[t].updatedIds=Array.from(this._updatedLayers[t].values());for(const t in this._removedLayers)e[t]=e[t]||{},e[t].removedIds=Object.keys(this._removedLayers[t]);return e}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(e){this._updatedPaintProps.add(e.fqid),this.setDirty()}getUpdatedImages(e){return this._updatedImages[e]?Array.from(this._updatedImages[e].values()):[]}updateImage(e,t){this._updatedImages[t]=this._updatedImages[t]||new Set,this._updatedImages[t].add(Ur.toString(e)),this.setDirty()}resetUpdatedImages(e){this._updatedImages[e]&&this._updatedImages[e].clear()}reset(){this._changed=!1,this._updatedLayers=Object.create(null),this._removedLayers=Object.create(null),this._updatedSourceCaches=Object.create(null),this._updatedPaintProps.clear(),this._updatedImages=Object.create(null)}}var Gr,Hr={},$r=function(){if(Gr)return Hr;Gr=1;var e={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 t(e){return(e=Math.round(e))<0?0:e>255?255:e}function i(e){return t("%"===e[e.length-1]?parseFloat(e)/100*255:parseInt(e))}function r(e){return(t="%"===e[e.length-1]?parseFloat(e)/100:parseFloat(e))<0?0:t>1?1:t;var t}function n(e,t,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?e+(t-e)*i*6:2*i<1?t:3*i<2?e+(t-e)*(2/3-i)*6:e}try{Hr.parseCSSColor=function(o){var a,s=o.replace(/ /g,"").toLowerCase();if(s in e)return e[s].slice();if("#"===s[0])return 4===s.length?(a=parseInt(s.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===s.length&&(a=parseInt(s.substr(1),16))>=0&&a<=16777215?[(16711680&a)>>16,(65280&a)>>8,255&a,1]:null;var l=s.indexOf("("),c=s.indexOf(")");if(-1!==l&&c+1===s.length){var u=s.substr(0,l),h=s.substr(l+1,c-(l+1)).split(","),d=1;switch(u){case"rgba":if(4!==h.length)return null;d=r(h.pop());case"rgb":return 3!==h.length?null:[i(h[0]),i(h[1]),i(h[2]),d];case"hsla":if(4!==h.length)return null;d=r(h.pop());case"hsl":if(3!==h.length)return null;var p=(parseFloat(h[0])%360+360)%360/360,f=r(h[1]),m=r(h[2]),_=m<=.5?m*(f+1):m+f-m*f,g=2*m-_;return[t(255*n(g,_,p+1/3)),t(255*n(g,_,p)),t(255*n(g,_,p-1/3)),d];default:return null}}return null}}catch(e){}return Hr}();function Wr(e,t,i){return e*(1-i)+t*i}const qr=new Map;class Zr{constructor(e,t,i,r=1){this.r=e,this.g=t,this.b=i,this.a=r}static parse(e){if(!e)return;if(e instanceof Zr)return e;if("string"!=typeof e)return;const t=qr.get(e);if(t)return t;const i=$r.parseCSSColor(e);if(!i)return;const r=new Zr(i[0]/255,i[1]/255,i[2]/255,i[3]);return qr.set(e,r),r}toString(){const{r:e,g:t,b:i,a:r}=this;return`rgba(${Math.round(255*e)},${Math.round(255*t)},${Math.round(255*i)},${r})`}toNonPremultipliedRenderColor(e){const{r:t,g:i,b:r,a:n}=this;return new Yr(e,t,i,r,n)}toPremultipliedRenderColor(e){const{r:t,g:i,b:r,a:n}=this;return new Kr(e,t*n,i*n,r*n,n)}clone(){return new Zr(this.r,this.g,this.b,this.a)}}class Xr{constructor(e,t,i,r,n,o=!1){if(this.premultiplied=!1,this.premultiplied=o,e){const o=e.image.height,a=o*o;this.premultiplied?(t=0===n?0:t/n*(o-1),i=0===n?0:i/n*(o-1),r=0===n?0:r/n*(o-1)):(t*=o-1,i*=o-1,r*=o-1),t=Math.max(0,Math.min(o-1,t)),i=Math.max(0,Math.min(o-1,i)),r=Math.max(0,Math.min(o-1,r));const s=Math.floor(t),l=Math.floor(i),c=Math.floor(r),u=Math.ceil(t),h=Math.ceil(i),d=Math.ceil(r),p=t-s,f=i-l,m=r-c,_=e.image.data,g=4*(s+l*a+c*o),y=4*(s+l*a+d*o),x=4*(s+h*a+c*o),v=4*(s+h*a+d*o),b=4*(u+l*a+c*o),w=4*(u+l*a+d*o),E=4*(u+h*a+c*o),A=4*(u+h*a+d*o);this.r=Wr(Wr(Wr(_[g],_[y],m),Wr(_[x],_[v],m),f),Wr(Wr(_[b],_[w],m),Wr(_[E],_[A],m),f),p)/255*(this.premultiplied?n:1),this.g=Wr(Wr(Wr(_[g+1],_[y+1],m),Wr(_[x+1],_[v+1],m),f),Wr(Wr(_[b+1],_[w+1],m),Wr(_[E+1],_[A+1],m),f),p)/255*(this.premultiplied?n:1),this.b=Wr(Wr(Wr(_[g+2],_[y+2],m),Wr(_[x+2],_[v+2],m),f),Wr(Wr(_[b+2],_[w+2],m),Wr(_[E+2],_[A+2],m),f),p)/255*(this.premultiplied?n:1),this.a=n}else this.r=t,this.g=i,this.b=r,this.a=n}toArray(){const{r:e,g:t,b:i,a:r}=this;return[255*e,255*t,255*i,r]}toHslaArray(){let{r:e,g:t,b:i,a:r}=this;if(this.premultiplied){if(0===r)return[0,0,0,0];const n=1/r;e*=n,t*=n,i*=n}const n=Math.min(Math.max(e,0),1),o=Math.min(Math.max(t,0),1),a=Math.min(Math.max(i,0),1),s=Math.min(n,o,a),l=Math.max(n,o,a),c=l-s,u=.5*(s+l);if(0===c)return[0,0,100*u,r];const h=u>.5?c/(2-l-s):c/(l+s);let d;switch(l){case n:d=60*((o-a)/c+(o<a?6:0));break;case o:d=60*((a-n)/c+2);break;default:d=60*((n-o)/c+4)}return[d,100*h,100*u,r]}toArray01(){const{r:e,g:t,b:i,a:r}=this;return[e,t,i,r]}toArray01Scaled(e){const{r:t,g:i,b:r}=this;return[t*e,i*e,r*e]}toArray01Linear(){const{r:e,g:t,b:i,a:r}=this;return[Math.pow(e,2.2),Math.pow(t,2.2),Math.pow(i,2.2),r]}}class Yr extends Xr{constructor(e,t,i,r,n){super(e,t,i,r,n,!1)}}class Kr extends Xr{constructor(e,t,i,r,n){super(e,t,i,r,n,!0)}}function Jr(e,t,i){return e.map((e,r)=>Wr(e,t[r],i))}Zr.black=new Zr(0,0,0,1),Zr.white=new Zr(1,1,1,1),Zr.transparent=new Zr(0,0,0,0),Zr.red=new Zr(1,0,0,1),Zr.blue=new Zr(0,0,1,1);var Qr=Object.freeze({__proto__:null,array:Jr,color:function(e,t,i){return new Zr(Wr(e.r,t.r,i),Wr(e.g,t.g,i),Wr(e.b,t.b,i),Wr(e.a,t.a,i))},number:Wr});class en extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class tn{constructor(e,t=[]){this.parent=e,this.bindings=Object.create(null);for(const[i,r]of t)this.bindings[i]=r}concat(e){return new tn(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const rn={kind:"null"},nn={kind:"number"},on={kind:"string"},an={kind:"boolean"},sn={kind:"color"},ln={kind:"object"},cn={kind:"value"},un={kind:"collator"},hn={kind:"formatted"},dn={kind:"resolvedImage"};function pn(e,t){return{kind:"array",itemType:e,N:t}}function fn(e){if("array"===e.kind){const t=fn(e.itemType);return"number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}const mn=[rn,nn,on,an,sn,hn,ln,pn(cn),dn];function _n(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!_n(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind)for(const e of mn)if(!_n(e,t))return null}return`Expected ${fn(e)} but found ${fn(t)} instead.`}function gn(e,t){return t.some(t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e)}function yn(e,t){return"array"===e.kind&&"array"===t.kind?e.N===t.N&&yn(e.itemType,t.itemType):e.kind===t.kind}class xn{constructor(e,t,i){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class vn{constructor(e,t,i,r,n){this.text=e.normalize?e.normalize():e,this.image=t,this.scale=i,this.fontStack=r,this.textColor=n}}class bn{constructor(e){this.sections=e}static fromString(e){return new bn([new vn(e,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(e=>0!==e.text.length||!!e.image&&e.image.hasPrimary())}static factory(e){return e instanceof bn?e:bn.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map(e=>e.text).join("")}serialize(){const e=["format"];for(const t of this.sections){if(t.image){const i=t.image.getPrimary().id.toString();e.push(["image",i]);continue}e.push(t.text);const i={};t.fontStack&&(i["text-font"]=["literal",t.fontStack.split(",")]),t.scale&&(i["font-scale"]=t.scale),t.textColor&&(i["text-color"]=["rgba"].concat(t.textColor.toNonPremultipliedRenderColor(null).toArray())),e.push(i)}return e}}class wn{constructor(e,t={}){this.id=Ur.from(e),this.params=t.params,this.sx=t.sx||1,this.sy=t.sy||
vendor: 13,648 bytes, line 2
21}toString(){return JSON.stringify(this)}static parse(e){let t,i,r,n;try{({id:t,params:i,sx:r,sy:n}=JSON.parse(e)||{})}catch(e){return null}return t?new wn(t,{params:i,sx:r,sy:n}):null}scaleSelf(e,t=e){return this.sx*=e,this.sy*=t,this}}class En{constructor(e,t,i,r,n=!1){this.primaryId=Ur.from(e),this.primaryOptions=t,i&&(this.secondaryId=Ur.from(i)),this.secondaryOptions=r,this.available=n}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new wn(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new wn(this.secondaryId,this.secondaryOptions):null}static from(e){return"string"!=typeof e?e:En.build({name:e})}static build(e,t,i,r){return!e||"object"==typeof e&&!("name"in e)?null:new En(e,i,t,r)}}function An(e,t,i,r){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:`Invalid rgba value [${[e,t,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof r?[e,t,i,r]:[e,t,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function In(e){if(null===e)return!0;if("string"==typeof e)return!0;if("boolean"==typeof e)return!0;if("number"==typeof e)return!0;if(e instanceof Zr)return!0;if(e instanceof xn)return!0;if(e instanceof bn)return!0;if(e instanceof En)return!0;if(Array.isArray(e)){for(const t of e)if(!In(t))return!1;return!0}if("object"==typeof e){for(const t in e)if(!In(e[t]))return!1;return!0}return!1}function Sn(e){if(null===e)return rn;if("string"==typeof e)return on;if("boolean"==typeof e)return an;if("number"==typeof e)return nn;if(e instanceof Zr)return sn;if(e instanceof xn)return un;if(e instanceof bn)return hn;if(e instanceof En)return dn;if(Array.isArray(e)){const t=e.length;let i;for(const r of e){const e=Sn(r);if(i){if(i===e)continue;i=cn;break}i=e}return pn(i||cn,t)}return ln}function Tn(e){return null===e?"":"string"==typeof e||"number"==typeof e||"boolean"==typeof e?String(e):e instanceof bn||e instanceof En||e instanceof Zr?e.toString():JSON.stringify(e)}class Dn{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(2!==e.length)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!In(e[1]))return t.error("invalid value");const i=e[1];let r=Sn(i);const n=t.expectedType;return"array"!==r.kind||0!==r.N||!n||"array"!==n.kind||"number"==typeof n.N&&0!==n.N||(r=n),new Dn(r,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof Zr?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof bn?this.value.serialize():this.value}}class Mn{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Pn={string:on,number:nn,boolean:an,object:ln};class Cn{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i,r=1;const n=e[0];if("array"===n){let n,o;if(e.length>2){const i=e[1];if("string"!=typeof i||!(i in Pn)||"object"===i)return t.error('The item type argument of "array" must be one of string, number, boolean',1);n=Pn[i],r++}else n=cn;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);o=e[2],r++}i=pn(n,o)}else i=Pn[n];const o=[];for(;r<e.length;r++){const i=t.parse(e[r],r,cn);if(!i)return null;o.push(i)}return new Cn(i,o)}evaluate(e){for(let t=0;t<this.args.length;t++){const i=this.args[t].evaluate(e);if(!_n(this.type,Sn(i)))return i;if(t===this.args.length-1)throw new Mn(`The expression ${JSON.stringify(this.args[t].serialize())} evaluated to ${fn(Sn(i))} but was expected to be of type ${fn(this.type)}.`)}return null}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=this.type,t=[e.kind];if("array"===e.kind){const i=e.itemType;if("string"===i.kind||"number"===i.kind||"boolean"===i.kind){t.push(i.kind);const r=e.N;("number"==typeof r||this.args.length>1)&&t.push(r)}}return t.concat(this.args.map(e=>e.serialize()))}}class Rn{constructor(e){this.type=hn,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[1];if(!Array.isArray(i)&&"object"==typeof i)return t.error("First argument must be an image or text section.");const r=[];let n=!1;for(let o=1;o<=e.length-1;++o){const i=e[o];if(n&&"object"==typeof i&&!Array.isArray(i)){n=!1;let e=null;if(i["font-scale"]&&(e=t.parseObjectValue(i["font-scale"],o,"font-scale",nn),!e))return null;let a=null;if(i["text-font"]&&(a=t.parseObjectValue(i["text-font"],o,"text-font",pn(on)),!a))return null;let s=null;if(i["text-color"]&&(s=t.parseObjectValue(i["text-color"],o,"text-color",sn),!s))return null;const l=r.at(-1);l.scale=e,l.font=a,l.textColor=s}else{const i=t.parse(e[o],o,cn);if(!i)return null;const a=i.type.kind;if("string"!==a&&"value"!==a&&"null"!==a&&"resolvedImage"!==a)return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,r.push({content:i,scale:null,font:null,textColor:null})}}return new Rn(r)}evaluate(e){return new bn(this.sections.map(t=>{const i=t.content.evaluate(e);return yn(Sn(i),dn)?new vn("",i,null,null,null):new vn(Tn(i),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null)}))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor)}outputDefined(){return!1}serialize(){const e=["format"];for(const t of this.sections){e.push(t.content.serialize());const i={};t.scale&&(i["font-scale"]=t.scale.serialize()),t.font&&(i["text-font"]=t.font.serialize()),t.textColor&&(i["text-color"]=t.textColor.serialize()),e.push(i)}return e}}class zn{constructor(e,t,i,r){this._imageWarnHistory={},this.type=dn,this.namePrimary=e,this.nameSecondary=t,i&&(this.paramsPrimary=i.params,this.iconsetIdPrimary=i.iconset?i.iconset.id:void 0),r&&(this.paramsSecondary=r.params,this.iconsetIdSecondary=r.iconset?r.iconset.id:void 0)}static parse(e,t){if(e.length<2)return t.error("Expected two or more arguments.");let i=1;const r=[];function n(){if(i<e.length){const n=t.parse(e[i],i++,on);return n?(r.push({image:n,options:{}}),!0):(t.error(r.length?"Secondary image variant is not a string.":"No image name provided."),!1)}return!0}function o(){if(i<e.length){const o=e[i];if(null===(n=o)||"object"!=typeof n||Array.isArray(n))return!0;const a=o.params,s=o.iconset,l=t.concat(i);if(!a&&!s)return i++,!0;if(a){if("object"!=typeof a||a.constructor!==Object)return l.error('Image options "params" should be an object'),!1;const e={},t=l.concat(void 0,"params");for(const i in a){if(!i)return t.error("Image parameter name should be non-empty"),!1;const r=t.concat(void 0,i).parse(a[i],void 0,sn,void 0,{typeAnnotation:"coerce"});if(!r)return!1;e[i]=r}r.at(-1).options.params=e}if(s){if("object"!=typeof s||s.constructor!==Object)return l.error('Image options "iconset" should be an object'),!1;if(!s.id)return l.error('Image options "iconset" should have an "id" property'),!1;r.at(-1).options.iconset=s}return i++,!0}var n;return!0}for(let a=0;a<2;a++)if(!n()||!o())return;return new zn(r[0].image,r[1]?r[1].image:void 0,r[0].options,r[1]?r[1].options:void 0)}evaluateParams(e,t){const i={};if(t){for(const r in t)if(t[r])try{i[r]=t[r].evaluate(e)}catch(e){continue}if(0!==Object.keys(i).length)return{params:i}}}evaluate(e){const t={name:this.namePrimary.evaluate(e),iconsetId:this.iconsetIdPrimary},i=this.nameSecondary?{name:this.nameSecondary.evaluate(e),iconsetId:this.iconsetIdSecondary}:void 0,r=En.build(t,i,this.paramsPrimary?this.evaluateParams(e,this.paramsPrimary):void 0,this.paramsSecondary?this.evaluateParams(e,this.paramsSecondary):void 0);if(r&&e.availableImages){const t=r.getPrimary().id;if(r.available=e.availableImages.some(e=>Ur.isEqual(e,t)),r.available){const t=r.getSecondary()?r.getSecondary().id:null;t&&(r.available=e.availableImages.some(e=>Ur.isEqual(e,t)))}}return r}eachChild(e){if(e(this.namePrimary),this.paramsPrimary)for(const t in this.paramsPrimary)this.paramsPrimary[t]&&e(this.paramsPrimary[t]);if(this.nameSecondary&&(e(this.nameSecondary),this.paramsSecondary))for(const t in this.paramsSecondary)this.paramsSecondary[t]&&e(this.paramsSecondary[t])}outputDefined(){return!1}serializeOptions(e,t){const i={};if(t&&(i.iconset={id:t}),e){i.params={};for(const t in e)e[t]&&(i.params[t]=e[t].serialize())}return Object.keys(i).length>0?i:void 0}serialize(){const e=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const t=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);t&&e.push(t)}if(this.nameSecondary&&(e.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const t=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);t&&e.push(t)}return e}}function Ln(e){return On(e)?"string":Bn(e)?"number":kn(e)?"boolean":Array.isArray(e)?"array":null===e?"null":Fn(e)?"object":typeof e}function Fn(e){return null!=e&&!Array.isArray(e)&&"function"!=typeof e&&!(e instanceof String||e instanceof Number||e instanceof Boolean)&&"object"==typeof e}function On(e){return"string"==typeof e||e instanceof String}function Bn(e){return"number"==typeof e||e instanceof Number}function kn(e){return"boolean"==typeof e||e instanceof Boolean}const Vn={"to-boolean":an,"to-color":sn,"to-number":nn,"to-string":on};class Nn{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[0],r=[];let n=rn;if("to-array"===i){if(!Array.isArray(e[1]))return null;const i=e[1].length;if(t.expectedType){if("array"!==t.expectedType.kind)return t.error(`Expected ${t.expectedType.kind} but found array.`);n=pn(t.expectedType.itemType,i)}else{if(!(i>0&&In(e[1][0])))return null;n=pn(Sn(e[1][0]),i)}for(let o=0;o<i;o++){const i=e[1][o];let a;if(Array.isArray(i))a=t.parse(i,void 0,n.itemType);else{const e=Ln(i);if(e!==n.itemType.kind)return t.error(`Expected ${n.itemType.kind} but found ${e}.`);a=t.registry.literal.parse(["literal",void 0===i?null:i],t)}if(!a)return null;r.push(a)}}else{if(("to-boolean"===i||"to-string"===i)&&2!==e.length)return t.error("Expected one argument.");n=Vn[i];for(let i=1;i<e.length;i++){const n=t.parse(e[i],i,cn);if(!n)return null;r.push(n)}}return new Nn(n,r)}evaluate(e){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(e));if("color"===this.type.kind){let t,i;for(const r of this.args){if(t=r.evaluate(e),i=null,t instanceof Zr)return t;if("string"==typeof t){const i=e.parseColor(t);if(i)return i}else if(Array.isArray(t)&&(i=t.length<3||t.length>4?`Invalid rbga value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:An(t[0],t[1],t[2],t[3]),!i))return new Zr(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new Mn(i||`Could not parse color from value '${"string"==typeof t?t:String(JSON.stringify(t))}'`)}if("number"===this.type.kind){let t=null;for(const i of this.args){if(t=i.evaluate(e),null===t)return 0;const r=Number(t);if(!isNaN(r))return r}throw new Mn(`Could not convert ${JSON.stringify(t)} to number.`)}return"formatted"===this.type.kind?bn.fromString(Tn(this.args[0].evaluate(e))):"resolvedImage"===this.type.kind?En.build(Tn(this.args[0].evaluate(e))):"array"===this.type.kind?this.args.map(t=>t.evaluate(e)):Tn(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){if("formatted"===this.type.kind)return new Rn([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new zn(this.args[0]).serialize();const e="array"===this.type.kind?[]:[`to-${this.type.kind}`];return this.eachChild(t=>{e.push(t.serialize())}),e}}const Un=["Unknown","Point","LineString","Polygon"];class jn{constructor(e,t,i){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=e,this.options=t,this.iconImageUseTheme=i}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Un[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(e){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const e=this.featureDistanceData.center,t=this.featureDistanceData.scale,{x:i,y:r}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(i*t-e[0])+this.featureDistanceData.bearing[1]*(r*t-e[1])}return 0}parseColor(e){return Zr.parse(e)}getConfig(e){return this.options?this.options.get(e):null}}class Gn{constructor(e,t,i,r,n){this.name=e,this.type=t,this._evaluate=i,this.args=r,this._overloadIndex=n}evaluate(e){if(!this._evaluate){const e=Gn.definitions[this.name];this._evaluate=Array.isArray(e)?e[2]:e.overloads[this._overloadIndex][1]}return this._evaluate(e,this.args)}
vendor: 6,624 bytes, line 2
2eachChild(e){this.args.forEach(e)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(e=>e.serialize()))}static parse(e,t){const i=e[0],r=Gn.definitions[i];if(!r)return t.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const n=Array.isArray(r)?r[0]:r.type,o=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,a=[];let s=null,l=-1;for(const[c,u]of o){if(Array.isArray(c)&&c.length!==e.length-1)continue;a.push(c),l++,null===s?s=t._forkForSignature():s.errors.length=0;const r=[];let o=!1;for(let t=1;t<e.length;t++){const i=e[t],n=Array.isArray(c)?c[t-1]:c.type,a=s.parse(i,1+r.length,n);if(!a){o=!0;break}r.push(a)}if(!o)if(Array.isArray(c)&&c.length!==r.length)s.error(`Expected ${c.length} arguments, but found ${r.length} instead.`);else{for(let e=0;e<r.length;e++){const t=Array.isArray(c)?c[e]:c.type;s.checkSubtype(t,r[e].type,e+1)}if(0===s.errors.length)return new Gn(i,n,u,r,l)}}if(1===a.length)t.errors.push(...s.errors);else{const i=(a.length?a:o.map(([e])=>e)).map(Hn).join(" | "),r=[];for(let n=1;n<e.length;n++){const i=t.parse(e[n],1+r.length);if(!i)return null;r.push(fn(i.type))}t.error(`Expected arguments of type ${i}, but found (${r.join(", ")}) instead.`)}return null}static register(e,t){Gn.definitions=t;for(const i in t)e[i]=Gn}}function Hn(e){return Array.isArray(e)?`(${e.map(fn).join(", ")})`:`(${fn(e.type)}...)`}class $n{constructor(e,t,i){this.type=un,this.locale=i,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(2!==e.length)return t.error("Expected one argument."),null;const i=e[1];if("object"!=typeof i||Array.isArray(i))return t.error("Collator options argument must be an object."),null;const r=void 0===i["case-sensitive"]?t.parse(!1,1,an):t.parseObjectValue(i["case-sensitive"],1,"case-sensitive",an);if(!r)return null;const n=void 0===i["diacritic-sensitive"]?t.parse(!1,1,an):t.parseObjectValue(i["diacritic-sensitive"],1,"diacritic-sensitive",an);if(!n)return null;let o=null;return i.locale&&(o=t.parseObjectValue(i.locale,1,"locale",on),!o)?null:new $n(r,n,o)}evaluate(e){return new xn(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}serialize(){const e={};return e["case-sensitive"]=this.caseSensitive.serialize(),e["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(e.locale=this.locale.serialize()),["collator",e]}}function Wn(e){return(180+e)/360}function qn(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Zn(e){return 360*e-180}function Xn(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}const Yn=8192;function Kn(e,t){const i=Wn(e[0]),r=qn(e[1]),n=Math.pow(2,t.z);return[Math.round(i*n*Yn),Math.round(r*n*Yn)]}function Jn(e,t){for(let i=0;i<t.length;i++)if(Ke(e,t[i]))return!0;return!1}function Qn(e,t,i){for(const r of i)for(let i=0,n=r.length,o=n-1;i<n;o=i++)if(Qe(e,t,r[o],r[i]))return!0;return!1}function eo(e,t){for(let i=0;i<e.length;++i)if(!Ke(e[i],t))return!1;for(let i=0;i<e.length-1;++i)if(Qn(e[i],e[i+1],t))return!1;return!0}function to(e,t){for(let i=0;i<t.length;i++)if(eo(e,t[i]))return!0;return!1}function io(e,t,i){const r=[];for(let n=0;n<e.length;n++){const o=[];for(let r=0;r<e[n].length;r++){const a=Kn(e[n][r],i);qe(t,a),o.push(a)}r.push(o)}return r}function ro(e,t,i){const r=[];for(let n=0;n<e.length;n++){const o=io(e[n],t,i);r.push(o)}return r}function no(e,t,i,r){if(e[0]<i[0]||e[0]>i[2]){const t=.5*r;let n=e[0]-i[0]>t?-r:i[0]-e[0]>t?r:0;0===n&&(n=e[0]-i[2]>t?-r:i[2]-e[0]>t?r:0),e[0]+=n}qe(t,e)}function oo(e,t,i,r){const n=Math.pow(2,r.z)*Yn,o=[r.x*Yn,r.y*Yn],a=[];if(!e)return a;for(const s of e)for(const e of s){const r=[e.x+o[0],e.y+o[1]];no(r,t,i,n),a.push(r)}return a}function ao(e,t,i,r){const n=Math.pow(2,r.z)*Yn,o=[r.x*Yn,r.y*Yn],a=[];if(!e)return a;for(const l of e){const e=[];for(const i of l){const r=[i.x+o[0],i.y+o[1]];qe(t,r),e.push(r)}a.push(e)}if(t[2]-t[0]<=n/2){(s=t)[0]=s[1]=1/0,s[2]=s[3]=-1/0;for(const e of a)for(const r of e)no(r,t,i,n)}var s;return a}class so{constructor(e,t){this.type=an,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(In(e[1])){const t=e[1];if("FeatureCollection"===t.type)for(let e=0;e<t.features.length;++e){const i=t.features[e].geometry.type;if("Polygon"===i||"MultiPolygon"===i)return new so(t,t.features[e].geometry)}else if("Feature"===t.type){const e=t.geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new so(t,t.geometry)}else if("Polygon"===t.type||"MultiPolygon"===t.type)return new so(t,t)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(!n)return!1;if("Polygon"===t.type){const o=io(t.coordinates,r,n),a=oo(e.geometry(),i,r,n);if(!Ze(i,r))return!1;for(const e of a)if(!Ke(e,o))return!1}if("MultiPolygon"===t.type){const o=ro(t.coordinates,r,n),a=oo(e.geometry(),i,r,n);if(!Ze(i,r))return!1;for(const e of a)if(!Jn(e,o))return!1}return!0}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(!n)return!1;if("Polygon"===t.type){const o=io(t.coordinates,r,n),a=ao(e.geometry(),i,r,n);if(!Ze(i,r))return!1;for(const e of a)if(!eo(e,o))return!1}if("MultiPolygon"===t.type){const o=ro(t.coordinates,r,n),a=ao(e.geometry(),i,r,n);if(!Ze(i,r))return!1;for(const e of a)if(!to(e,o))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}class lo{constructor(e=[],t=(e,t)=>e<t?-1:e>t?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:i}=this,r=t[e];for(;e>0;){const n=e-1>>1,o=t[n];if(i(r,o)>=0)break;t[e]=o,e=n}t[e]=r}_down(e){const{data:t,compare:i}=this,r=this.length>>1,n=t[e];for(;e<r;){let r=1+(e<<1);const o=r+1;if(o<this.length&&i(t[o],t[r])<0&&(r=o),i(t[r],n)>=0)break;t[e]=t[r],e=r}t[e]=n}}var co=8192;
vendor: 16,697 bytes, line 2
2function uo(e,t,i){return[e,t,i].filter(Boolean).join("\x1f")}function ho(e,t){switch(e){case"string":return Tn(t);case"number":return+t;case"boolean":return!!t;case"color":return Zr.parse(t);case"formatted":return bn.fromString(Tn(t));case"resolvedImage":return En.build(Tn(t))}return t}function po(e,t,i,r){return void 0!==r&&(e=r*Math.round(e/r)),void 0!==t&&e<t&&(e=t),void 0!==i&&e>i&&(e=i),e}class fo{constructor(e,t,i,r=!1){this.type=e,this.key=t,this.scope=i,this.featureConstant=r}static parse(e,t){let i=t.expectedType;if(i??=cn,e.length<2||e.length>3)return t.error("Invalid number of arguments for 'config' expression.");const r=t.parse(e[1],1);if(!(r instanceof Dn))return t.error("Key name of 'config' expression must be a string literal.");let n,o=!0;const a=Tn(r.value);if(e.length>=3){const i=t.parse(e[2],2);if(!(i instanceof Dn))return t.error("Scope of 'config' expression must be a string literal.");n=Tn(i.value)}if(t.options){const e=uo(a,n,t._scope),i=t.options.get(e);i&&(o=mo(i.value||i.default))}return new fo(i,a,n,o)}evaluate(e){const t=uo(this.key,this.scope,e.scope),i=e.getConfig(t);if(!i)return null;const{type:r,value:n,values:o,minValue:a,maxValue:s,stepValue:l}=i,c=i.default.evaluate(e);let u=c;if(n){const t=e.scope;e.scope=(t||"").split("\x1f").slice(1).join("\x1f"),u=n.evaluate(e),e.scope=t}return r&&(u=ho(r,u)),void 0===u||void 0===a&&void 0===s&&void 0===l||("number"==typeof u?u=po(u,a,s,l):Array.isArray(u)&&(u=u.map(e=>"number"==typeof e?po(e,a,s,l):e))),void 0!==n&&void 0!==u&&o&&!o.includes(u)&&(u=c,r&&(u=ho(r,u))),(r&&r!==this.type||void 0!==u&&!yn(Sn(u),this.type))&&(u=ho(this.type.kind,u)),u}eachChild(){}outputDefined(){return!1}serialize(){const e=["config",this.key];return this.scope&&e.concat(this.scope),e}}function mo(e){if(e instanceof Gn){if("get"===e.name&&1===e.args.length)return!1;if("feature-state"===e.name)return!1;if("has"===e.name&&1===e.args.length)return!1;if("properties"===e.name||"geometry-type"===e.name||"id"===e.name)return!1;if(e.name.startsWith("filter-"))return!1}if(e instanceof so)return!1;if(e instanceof ta)return!1;if(e instanceof fo)return e.featureConstant;let t=!0;return e.eachChild(e=>{t&&!mo(e)&&(t=!1)}),t}function _o(e){if(e instanceof Gn&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild(e=>{t&&!_o(e)&&(t=!1)}),t}function go(e,t){if(e instanceof Gn&&t.has(e.name))return!1;let i=!0;return e.eachChild(e=>{i&&!go(e,t)&&(i=!1)}),i}function yo(e,t){return go(e,new Set(t))}const xo=1/298.257223563,vo=xo*(2-xo),bo=Math.PI/180;function wo(e){const t=6378.137*bo*1e3,i=Math.cos(e*bo),r=1/(1-vo*(1-i*i)),n=Math.sqrt(r);return[t*n*i,t*n*r*(1-vo)]}function Eo(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}function Ao(e,t,i,r){const n=Eo(e[0]-t[0])*i,o=(e[1]-t[1])*r;return Math.sqrt(n*n+o*o)}function Io(e,t,i,r,n){let o=t[0],a=t[1],s=Eo(i[0]-o)*r,l=(i[1]-a)*n;if(0!==s||0!==l){const t=(Eo(e[0]-o)*r*s+(e[1]-a)*n*l)/(s*s+l*l);t>1?(o=i[0],a=i[1]):t>0&&(o+=s/r*t,a+=l/n*t)}return s=Eo(e[0]-o)*r,l=(e[1]-a)*n,Math.sqrt(s*s+l*l)}function So(e,t){return t.dist-e.dist}function To(e){const t=[1/0,1/0,-1/0,-1/0];if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}function Do(e){return e[1]-e[0]+1}function Mo(e,t){const i=e[1]>=e[0]&&e[1]<t;return i||console.warn("Distance Expression: Index is out of range"),i}function Po(e,t){if(e[0]>e[1])return[null,null];const i=Do(e);if(t){if(2===i)return[e,null];const t=Math.floor(i/2);return[[e[0],e[0]+t],[e[0]+t,e[1]]]}{if(1===i)return[e,null];const t=Math.floor(i/2)-1;return[[e[0],e[0]+t],[e[0]+t+1,e[1]]]}}function Co(e,t){const i=[1/0,1/0,-1/0,-1/0];if(!Mo(t,e.length))return i;for(let r=t[0];r<=t[1];++r)qe(i,e[r]);return i}function Ro(e){const t=[1/0,1/0,-1/0,-1/0];for(let i=0;i<e.length;++i)for(let r=0;r<e[i].length;++r)qe(t,e[i][r]);return t}function zo(e,t,i,r){if(To(e)||To(t))return NaN;let n=0,o=0;return e[2]<t[0]&&(n=t[0]-e[2]),e[0]>t[2]&&(n=e[0]-t[2]),e[1]>t[3]&&(o=e[1]-t[3]),e[3]<t[1]&&(o=t[1]-e[3]),Ao([0,0],[n,o],i,r)}function Lo(e,t,i=8192){const r=Math.pow(2,t.z),n=(e.y/i+t.y)/r;return[Zn((e.x/i+t.x)/r),Xn(n)]}function Fo(e,t){const i=[];for(let r=0;r<e.length;++r)i.push(Lo(e[r],t));return i}function Oo(e,t,i,r){const n=function(e,t,i,r){let n=1/0,o=e[0][0],a=e[0][1];for(let s=0;s<e.length-1;s++){let l=e[s][0],c=e[s][1],u=Eo(e[s+1][0]-l)*i,h=(e[s+1][1]-c)*r,d=0;0===u&&0===h||(d=(Eo(t[0]-l)*i*u+(t[1]-c)*r*h)/(u*u+h*h),d>1?(l=e[s+1][0],c=e[s+1][1]):d>0&&(l+=u/i*d,c+=h/r*d)),u=Eo(t[0]-l)*i,h=(t[1]-c)*r;const p=u*u+h*h;p<n&&(n=p,o=l,a=c)}return[o,a]}(t,e,i,r);return Ao(e,n,i,r)}function Bo(e,t,i,r,n,o){const a=i.slice(r[0],r[1]+1);let s=1/0;for(let l=t[0];l<=t[1];++l)if(0===(s=Math.min(s,Oo(e[l],a,n,o))))return 0;return s}function ko(e,t,i,r,n,o){const a=Math.min(Io(e,i,r,n,o),Io(t,i,r,n,o)),s=Math.min(Io(i,e,t,n,o),Io(r,e,t,n,o));return Math.min(a,s)}function Vo(e,t,i,r,n,o){if(!Mo(t,e.length)||!Mo(r,i.length))return NaN;let a=1/0;for(let s=t[0];s<t[1];++s)for(let t=r[0];t<r[1];++t){if(Qe(e[s],e[s+1],i[t],i[t+1]))return 0;a=Math.min(a,ko(e[s],e[s+1],i[t],i[t+1],n,o))}return a}function No(e,t,i,r,n,o){if(!Mo(t,e.length)||!Mo(r,i.length))return NaN;let a=1/0;for(let s=t[0];s<=t[1];++s)for(let t=r[0];t<=r[1];++t)if(0===(a=Math.min(a,Ao(e[s],i[t],n,o))))return a;return a}function Uo(e,t,i,r){if(Ke(e,t,!0))return 0;let n=1/0;for(const o of t){const t=o.length;if(t<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(o[0]!==o[t-1]&&0===(n=Math.min(n,Io(e,o[t-1],o[0],i,r))))return n;if(0===(n=Math.min(n,Oo(e,o,i,r))))return n}return n}function jo(e,t,i,r,n){if(!Mo(t,e.length))return NaN;for(let a=t[0];a<=t[1];++a)if(Ke(e[a],i,!0))return 0;let o=1/0;for(let a=t[0];a<t[1];++a)for(const t of i)for(let i=0,s=t.length,l=s-1;i<s;l=i++){if(Qe(e[a],e[a+1],t[l],t[i]))return 0;o=Math.min(o,ko(e[a],e[a+1],t[l],t[i],r,n))}return o}function Go(e,t){for(const i of e)for(let e=0;e<=i.length-1;++e)if(Ke(i[e],t,!0))return!0;return!1}function Ho(e,t,i,r,n=1/0){const o=Ro(e),a=Ro(t);if(n!==1/0&&zo(o,a,i,r)>=n)return n;if(Ze(o,a)){if(Go(e,t))return 0}else if(Go(t,e))return 0;let s=n;for(const l of e)for(let e=0,n=l.length,o=n-1;e<n;o=e++)for(const a of t)for(let t=0,n=a.length,c=n-1;t<n;c=t++){if(Qe(l[o],l[e],a[c],a[t]))return 0;s=Math.min(s,ko(l[o],l[e],a[c],a[t],i,r))}return s}function $o(e,t,i,r,n,o,a,s){if(null===a||null===s)return;const l=zo(Co(n,a),Co(o,s),i,r);l<t&&e.push({dist:l,range1:a,range2:s})}function Wo(e,t,i,r,n,o=1/0){let a=Math.min(Ao(e[0],i[0][0],r,n),o);if(0===a)return a;const s=new lo([{dist:0,range1:[0,e.length-1],range2:[0,0]}],So),l=t?50:100,c=Ro(i);for(;s.length;){const o=s.pop();if(o.dist>=a)continue;const u=o.range1;if(Do(u)<=l){if(!Mo(u,e.length))return NaN;if(t){const t=jo(e,u,i,r,n);if(0===(a=Math.min(a,t)))return a}else for(let t=u[0];t<=u[1];++t){const o=Uo(e[t],i,r,n);if(0===(a=Math.min(a,o)))return a}}else{const i=Po(u,t);if(null!==i[0]){const t=zo(Co(e,i[0]),c,r,n);t<a&&s.push({dist:t,range1:i[0],range2:[0,0]})}if(null!==i[1]){const t=zo(Co(e,i[1]),c,r,n);t<a&&s.push({dist:t,range1:i[1],range2:[0,0]})}}}return a}function qo(e,t,i,r,n,o,a=1/0){let s=Math.min(a,Ao(e[0],i[0],n,o));if(0===s)return s;const l=new lo([{dist:0,range1:[0,e.length-1],range2:[0,i.length-1]}],So),c=t?50:100,u=r?50:100;for(;l.length;){const a=l.pop();if(a.dist>=s)continue;const h=a.range1,d=a.range2;if(Do(h)<=c&&Do(d)<=u){if(!Mo(h,e.length)||!Mo(d,i.length))return NaN;if(t&&r?s=Math.min(s,Vo(e,h,i,d,n,o)):t||r?t&&!r?s=Math.min(s,Bo(i,d,e,h,n,o)):!t&&r&&(s=Math.min(s,Bo(e,h,i,d,n,o))):s=Math.min(s,No(e,h,i,d,n,o)),0===s)return s}else{const a=Po(h,t),c=Po(d,r);$o(l,s,n,o,e,i,a[0],c[0]),$o(l,s,n,o,e,i,a[0],c[1]),$o(l,s,n,o,e,i,a[1],c[0]),$o(l,s,n,o,e,i,a[1],c[1])}}return s}function Zo(e,t,i,r,n,o=1/0){let a=o;const s=Co(e,[0,e.length-1]);for(const l of i)if(!(a!==1/0&&zo(s,Co(l,[0,l.length-1]),r,n)>=a)&&(a=Math.min(a,qo(e,t,l,!0,r,n,a)),0===a))return a;return a}function Xo(e,t,i,r,n,o=1/0){let a=o;const s=Co(e,[0,e.length-1]);for(const l of i){if(a!==1/0&&zo(s,Ro(l),r,n)>=a)continue;const i=Wo(e,t,l,r,n,a);if(isNaN(i))return i;if(0===(a=Math.min(a,i)))return a}return a}function Yo(e,t,i){const r=[];for(const a of e)for(const e of a)r.push(Lo(e,t));const[n,o]=wo(r[0][1]);return"Point"===i.type||"MultiPoint"===i.type||"LineString"===i.type?qo(r,!1,"Point"===i.type?[i.coordinates]:i.coordinates,"LineString"===i.type,n,o):"MultiLineString"===i.type?Zo(r,!1,i.coordinates,n,o):"Polygon"===i.type||"MultiPolygon"===i.type?Xo(r,!1,"Polygon"===i.type?[i.coordinates]:i.coordinates,n,o):null}function Ko(e,t,i){const r=[];for(const a of e){const e=[];for(const i of a)e.push(Lo(i,t));r.push(e)}const[n,o]=wo(r[0][0][1]);if("Point"===i.type||"MultiPoint"===i.type||"LineString"===i.type)return Zo("Point"===i.type?[i.coordinates]:i.coordinates,"LineString"===i.type,r,n,o);if("MultiLineString"===i.type){let e=1/0;for(let t=0;t<i.coordinates.length;t++){const a=Zo(i.coordinates[t],!0,r,n,o,e);if(isNaN(a))return a;if(0===(e=Math.min(e,a)))return e}return e}if("Polygon"===i.type||"MultiPolygon"===i.type){let e=1/0;for(let t=0;t<r.length;t++){const a=Xo(r[t],!0,"Polygon"===i.type?[i.coordinates]:i.coordinates,n,o,e);if(isNaN(a))return a;if(0===(e=Math.min(e,a)))return e}return e}return null}function Jo(e,t,i){const r=[];for(const a of We(e,0)){const e=[];for(let i=0;i<a.length;++i)e.push(Fo(a[i],t));r.push(e)}const[n,o]=wo(r[0][0][0][1]);if("Point"===i.type||"MultiPoint"===i.type||"LineString"===i.type)return Xo("Point"===i.type?[i.coordinates]:i.coordinates,"LineString"===i.type,r,n,o);if("MultiLineString"===i.type){let e=1/0;for(let t=0;t<i.coordinates.length;t++){const a=Xo(i.coordinates[t],!0,r,n,o,e);if(isNaN(a))return a;if(0===(e=Math.min(e,a)))return e}return e}return"Polygon"===i.type||"MultiPolygon"===i.type?function(e,t,i,r){let n=1/0;for(const o of e)for(const e of t){const t=Ho(o,e,i,r,n);if(isNaN(t))return t;if(0===(n=Math.min(n,t)))return n}return n}("Polygon"===i.type?[i.coordinates]:i.coordinates,r,n,o):null}function Qo(e){return"Point"===e||"MultiPoint"===e||"LineString"===e||"MultiLineString"===e||"Polygon"===e||"MultiPolygon"===e}function ea(e){if(!In(e)||"object"!=typeof e||null===e||Array.isArray(e))return null;const t=e;if("FeatureCollection"===t.type){if(0===t.features.length)return null;const e=[];for(const i of t.features){if(!Qo(i.geometry.type))return null;e.push(i.geometry)}return e}return"Feature"===t.type?Qo(t.geometry.type)?[t.geometry]:null:Qo(t.type)?[t]:null}class ta{constructor(e){this.type=nn,this.geojson=e}static parse(e,t){if(2!==e.length)return t.error(`'distance' expression requires either one argument, but found ' ${e.length-1} instead.`);const i=e[1],r=In(i)&&!Array.isArray(i),n=t.parse(r?["literal",i]:i,1,cn);if(!n)return null;for(const[o,a]of[[["measure-light"],"brightness"],[["pitch"],"pitch"],[["distance-from-center"],"distance-from-center"]])if(!yo(n,o))return t.error(`'distance' expression may not depend on ${a}.`);return _o(n)?n instanceof Dn&&!ea(n.value)?t.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj]."):new ta(n):t.error("'distance' expression may not depend on feature-state.")}evaluate(e){const t=ea(this.geojson.evaluate(e));if(!t)return console.warn("Distance Expression: could not resolve a valid Point/LineString/Polygon GeoJSON geometry."),null;const i=e.geometry(),r=e.canonicalID();if(null==i||null==r)return console.warn("Distance Expression: requires valid feature and canonical information."),null;const n=e.geometryType(),o="Point"===n?Yo:"LineString"===n?Ko:"Polygon"===n?Jo:null;if(!o)return console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries."),null;let a=1/0;for(const s of t){const e=o(i,r,s);if(null==e||isNaN(e))return e;if(0===(a=Math.min(a,e)))break}return a}eachChild(e){e(this.geojson)}outputDefined(){return!0}serialize(){return["distance",this.geojson.serialize()]}}class ia{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(2!==e.length||"string"!=typeof e[1])return t.error("'var' expression requires exactly one string literal argument.");const i=e[1];return t.scope.has(i)?new ia(i,t.scope.get(i)):t.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class ra{constructor(e,t=[],i,r=new tn,n=[],o,a,s){this.registry=e,this.path=t,this.scope=r,this.errors=n,this.expectedType=i,this._scope=o,this.options=a,this.iconImageUseTheme=s}get key(){let e="";for(let t=0;t<this.path.length;t++){const i=this.path[t];e+="string"==typeof i?`['${i}']`:`[${i}]`}return e}parse(e,t,i,r,n={}){if(t||i){const o=this.expectedType,a=this.scope;r&&(this.scope=this.scope.concat(r)),this.expectedType=i||null;const s="number"==typeof t;s&&this.path.push(t);const l=this._parse(e,n);return s&&this.path.pop(),this.expectedType=o,this.scope=a,l}return this._parse(e,n)}parseObjectValue(e,t,i,r,n,o={}){const a=this.expectedType,s=this.scope;n&&(this.scope=this.scope.concat(n)),this.expectedType=r||null,this.path.push(t),this.path.push(i);const l=this._parse(e,o);return this.path.pop(),this.path.pop(),this.expectedType=a,this.scope=s,l}_parse(e,t){if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const i="string"==typeof e[0]&&Object.hasOwn(this.registry,e[0])?this.registry[e[0]]:void 0;if(i){let r=i.parse(e,this);if(!r)return null;if(this.expectedType){const e=this.expectedType,i=r.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==i.kind)if("color"!==e.kind&&"formatted"!==e.kind&&"resolvedImage"!==e.kind||"value"!==i.kind&&"string"!==i.kind){if(this.checkSubtype(e,i))return null}else r=oa(r,e,t.typeAnnotation||"coerce");else r=oa(r,e,t.typeAnnotation||"assert")}if(!(r instanceof Dn)&&"resolvedImage"!==r.type.kind&&aa(r)){const t=new jn(this._scope,this.options,this.iconImageUseTheme);try{r=new Dn(r.type,r.evaluate(t))}catch(e){return this.error(e.message),null}}return r}return Nn.parse(["to-array",e],this)}return this.error(void 0===e?"'undefined' value invalid. Use null instead.":"object"==typeof e?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,t,i,r){const n=r?this.scope.concat(r):this.scope,o=this.path.slice();return"number"==typeof e&&o.push(e),"string"==typeof t&&o.push(t),new ra(this.registry,o,i||null,n,this.errors,this._scope,this.options,this.iconImageUseTheme)}_forkForSignature(){return new ra(this.registry,this.path.slice(),null,this.scope,[],this._scope,this.options,this.iconImageUseTheme)}error(e,...t){const i=`${this.key}${t.map(e=>`[${e}]`).join("")}`;this.errors.push(new en(i,e))}checkSubtype(e,t,i){const r=_n(e,t);return r&&this.error(r,..."number"==typeof i?[i]:[]),r}}const na=new Set(["zoom","heatmap-density","worldview","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed","is-active-floor"]);function oa(e,t,i){return"assert"===i?new Cn(t,[e]):"coerce"===i?new Nn(t,[e]):e}function aa(e){if(e instanceof ia)return aa(e.boundExpression);if(e instanceof Gn&&"error"===e.name)return!1;if(e instanceof $n)return!1;if(e instanceof so)return!1;if(e instanceof ta)return!1;if(e instanceof fo)return!1;const t=e instanceof Nn||e instanceof Cn;let i=!0;return e.eachChild(e=>{i=t?i&&aa(e):i&&e instanceof Dn}),!!i&&mo(e)&&go(e,na)}function sa(e,t){const i=e.length-1;let r,n,o=0,a=i,s=0;for(;o<=a;)if(s=Math.floor((o+a)/2),r=e[s],n=e[s+1],r<=t){if(s===i||t<n)return s;o=s+1}else{if(!(r>t))throw new Mn("Input is not a number.");a=s-1}return 0}class la{constructor(e,t,i){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[r,n]of i)this.labels.push(r),this.outputs.push(n)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");const i=t.parse(e[1],1,nn);if(!i)return null;const r=[];let n=null;t.expectedType&&"value"!==t.expectedType.kind&&(n=t.expectedType);for(let o=1;o<e.length;o+=2){const i=1===o?-1/0:e[o],a=e[o+1],s=o,l=o+1;if("number"!=typeof i)return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not c
2omputed expressions) for the input values.',s);if(r.length&&r.at(-1)[0]>=i)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',s);const c=t.parse(a,l,n);if(!c)return null;n=n||c.type,r.push([i,c])}return new la(n,i,r)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const r=this.input.evaluate(e);if(r<=t[0])return i[0].evaluate(e);const n=t.length;return r>=t[n-1]?i[n-1].evaluate(e):i[sa(t,r)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){const e=["step",this.input.serialize()];for(let t=0;t<this.labels.length;t++)t>0&&e.push(this.labels[t]),e.push(this.outputs[t].serialize());return e}}const ca=.95047,ua=1.08883,ha=4/29,da=6/29,pa=3*da*da,fa=da*da*da,ma=Math.PI/180,_a=180/Math.PI;function ga(e){return e>fa?Math.pow(e,1/3):e/pa+ha}function ya(e){return e>da?e*e*e:pa*(e-ha)}function xa(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function va(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function ba(e){const t=va(e.r),i=va(e.g),r=va(e.b),n=ga((.4124564*t+.3575761*i+.1804375*r)/ca),o=ga((.2126729*t+.7151522*i+.072175*r)/1);return{l:116*o-16,a:500*(n-o),b:200*(o-ga((.0193339*t+.119192*i+.9503041*r)/ua)),alpha:e.a}}function wa(e){let t=(e.l+16)/116,i=isNaN(e.a)?t:t+e.a/500,r=isNaN(e.b)?t:t-e.b/200;return t=1*ya(t),i=ca*ya(i),r=ua*ya(r),new Zr(xa(3.2404542*i-1.5371385*t-.4985314*r),xa(-.969266*i+1.8760108*t+.041556*r),xa(.0556434*i-.2040259*t+1.0572252*r),e.alpha)}function Ea(e,t,i){const r=t-e;return e+i*(r>180||r<-180?r-360*Math.round(r/360):r)}const Aa={forward:ba,reverse:wa,interpolate:function(e,t,i){return{l:Wr(e.l,t.l,i),a:Wr(e.a,t.a,i),b:Wr(e.b,t.b,i),alpha:Wr(e.alpha,t.alpha,i)}}},Ia={forward:function(e){const{l:t,a:i,b:r}=ba(e),n=Math.atan2(r,i)*_a;return{h:n<0?n+360:n,c:Math.sqrt(i*i+r*r),l:t,alpha:e.a}},reverse:function(e){const t=e.h*ma,i=e.c;return wa({l:e.l,a:Math.cos(t)*i,b:Math.sin(t)*i,alpha:e.alpha})},interpolate:function(e,t,i){return{h:Ea(e.h,t.h,i),c:Wr(e.c,t.c,i),l:Wr(e.l,t.l,i),alpha:Wr(e.alpha,t.alpha,i)}}};var Sa=Object.freeze({__proto__:null,hcl:Ia,lab:Aa});class Ta{constructor(e,t,i,r,n){this.type=e,this.operator=t,this.interpolation=i,this.input=r,this.labels=[],this.outputs=[];for(const[o,a]of n)this.labels.push(o),this.outputs.push(a)}static interpolationFactor(e,t,i,r){let n=0;if("exponential"===e.name)n=Da(t,e.base,i,r);else if("linear"===e.name)n=Da(t,1,i,r);else if("cubic-bezier"===e.name){const o=e.controlPoints;n=Be(o[0],o[1],o[2],o[3])(Da(t,1,i,r))}return n}static parse(e,t){let[i,r,n,...o]=e;if(!Array.isArray(r)||0===r.length)return t.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){const e=r[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:e}}else{if("cubic-bezier"!==r[0])return t.error(`Unknown interpolation type ${String(r[0])}`,1,0);{const e=r.slice(1);if(4!==e.length||e.some(e=>"number"!=typeof e||e<0||e>1))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:e}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length-1>3&&(e.length-1)%2!=0)return t.error("Expected an even number of arguments.");if(n=t.parse(n,2,nn),!n)return null;const a=[];let s=null;"interpolate-hcl"===i||"interpolate-lab"===i?s=sn:t.expectedType&&"value"!==t.expectedType.kind&&(s=t.expectedType);for(let l=0;l<o.length;l+=2){const e=o[l],i=o[l+1],r=l+3,n=l+4;if("number"!=typeof e)return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',r);if(a.length&&a.at(-1)[0]>=e)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',r);const c=t.parse(i,n,s);if(!c)return null;s=s||c.type,a.push([e,c])}return"number"===s.kind||"color"===s.kind||"array"===s.kind&&"number"===s.itemType.kind&&"number"==typeof s.N?new Ta(s,i,r,n,a):t.error(`Type ${fn(s)} is not interpolatable.`)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const r=this.input.evaluate(e);if(r<=t[0])return i[0].evaluate(e);const n=t.length;if(r>=t[n-1])return i[n-1].evaluate(e);const o=sa(t,r),a=Ta.interpolationFactor(this.interpolation,r,t[o],t[o+1]),s=i[o].evaluate(e),l=i[o+1].evaluate(e);return"interpolate"===this.operator?Qr[this.type.kind.toLowerCase()](s,l,a):"interpolate-hcl"===this.operator?Ia.reverse(Ia.interpolate(Ia.forward(s),Ia.forward(l),a)):Aa.reverse(Aa.interpolate(Aa.forward(s),Aa.forward(l),a))}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e;e="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];const t=[this.operator,e,this.input.serialize()];for(let i=0;i<this.labels.length;i++)t.push(this.labels[i],this.outputs[i].serialize());return t}}function Da(e,t,i,r){const n=r-i,o=e-i;return 0===n?0:1===t?o/n:(Math.pow(t,o)-1)/(Math.pow(t,n)-1)}class Ma{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expectected at least one argument."),null;let i=null;const r=t.expectedType;r&&"value"!==r.kind&&(i=r);const n=[];for(const a of e.slice(1)){const e=t.parse(a,1+n.length,i,void 0,{typeAnnotation:"omit"});if(!e)return null;i=i||e.type,n.push(e)}const o=r&&n.some(e=>_n(r,e.type));return new Ma(o?cn:i,n)}evaluate(e){let t,i=null,r=0;for(const n of this.args){if(r++,i=n.evaluate(e),i&&i instanceof En&&!i.available&&(t||(t=i),i=null,r===this.args.length))return t;if(null!==i)break}return i}
vendor: 35,067 bytes, line 2
2eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=["coalesce"];return this.eachChild(t=>{e.push(t.serialize())}),e}}const Pa=/[^a-zA-Z0-9_]/;class Ca{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const i=[];for(let n=1;n<e.length-1;n+=2){const r=e[n];if("string"!=typeof r)return t.error(`Expected string, but found ${typeof r} instead.`,n);if(Pa.test(r))return t.error("Variable names must contain only alphanumeric characters or '_'.",n);const o=t.parse(e[n+1],n+1);if(!o)return null;i.push([r,o])}const r=t.parse(e.at(-1),e.length-1,t.expectedType,i);return r?new Ca(i,r):null}outputDefined(){return this.result.outputDefined()}serialize(){const e=["let"];for(const[t,i]of this.bindings)e.push(t,i.serialize());return e.push(this.result.serialize()),e}}class Ra{constructor(e,t,i){this.type=e,this.index=t,this.input=i}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,nn),r=t.parse(e[2],2,pn(t.expectedType||cn));return i&&r?new Ra(r.type.itemType,i,r):null}evaluate(e){const t=this.index.evaluate(e),i=this.input.evaluate(e);if(t<0)throw new Mn("Array index out of bounds: negative index");if(t>=i.length)throw new Mn("Array index out of bounds: index exceeds array size");if(t!==Math.floor(t))throw new Mn("Array index must be an integer. Use at-interpolated for fractional indices");return i[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class za{constructor(e,t,i){this.type=e,this.index=t,this.input=i}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,nn),r=t.parse(e[2],2,pn(t.expectedType||cn));return i&&r?new za(r.type.itemType,i,r):null}evaluate(e){const t=this.index.evaluate(e),i=this.input.evaluate(e);if(t<0)throw new Mn(`Array index out of bounds: ${t} < 0.`);if(t>i.length-1)throw new Mn(`Array index out of bounds: ${t} > ${i.length-1}.`);if(t===Math.floor(t))return i[t];const r=Math.floor(t),n=Math.ceil(t),o=i[r],a=i[n];if("number"!=typeof o||"number"!=typeof a)throw new Mn(`Cannot interpolate between non-number values at index ${t}.`);return Wr(o,a,t-r)}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class La{constructor(e,t,i,r,n,o){this.inputType=e,this.type=t,this.input=i,this.cases=r,this.outputs=n,this.otherwise=o}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error("Expected an even number of arguments.");let i,r;t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);const n={},o=[];for(let l=2;l<e.length-1;l+=2){let a=e[l];const s=e[l+1];if(Array.isArray(a)||(a=[a]),0===a.length)return t.error("Expected at least one branch label.",l);for(const e of a){if("number"!=typeof e&&"string"!=typeof e)return t.error("Branch labels must be numbers or strings.",l);if("number"==typeof e&&Math.abs(e)>Number.MAX_SAFE_INTEGER)return t.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`,l);if("number"==typeof e&&Math.floor(e)!==e)return t.error("Numeric branch labels must be integer values.",l);if(i){if(t.checkSubtype(i,Sn(e),l))return null}else i=Sn(e);if(void 0!==n[String(e)])return t.error("Branch labels must be unique.",l);n[String(e)]=o.length}const c=t.parse(s,l,r);if(!c)return null;r=r||c.type,o.push(c)}const a=t.parse(e[1],1,cn);if(!a)return null;const s=t.parse(e.at(-1),e.length-1,r);return s?"value"!==a.type.kind&&t.checkSubtype(i,a.type,1)?null:new La(i,r,a,n,o,s):null}evaluate(e){const t=this.input.evaluate(e);return(yn(Sn(t),this.inputType)&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["match",this.input.serialize()],t=Object.keys(this.cases).sort(),i=[],r={};for(const o of t){const e=r[this.cases[o]];void 0===e?(r[this.cases[o]]=i.length,i.push([this.cases[o],[o]])):i[e][1].push(o)}const n=e=>"number"===this.inputType.kind?Number(e):e;for(const[o,a]of i)e.push(1===a.length?n(a[0]):a.map(n)),e.push(this.outputs[o].serialize());return e.push(this.otherwise.serialize()),e}}class Fa{constructor(e,t,i){this.type=e,this.branches=t,this.otherwise=i}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`),null;if(e.length%2!=0)return t.error("Expected an odd number of arguments."),null;let i;t.expectedType&&"value"!==t.expectedType.kind&&(i=t.expectedType);const r=[];for(let o=1;o<e.length-1;o+=2){const n=t.parse(e[o],o,an);if(!n)return null;const a=t.parse(e[o+1],o+1,i);if(!a)return null;r.push([n,a]),i=i||a.type}const n=t.parse(e.at(-1),e.length-1,i);return n?new Fa(i,r,n):null}evaluate(e){for(const[t,i]of this.branches)if(t.evaluate(e))return i.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[t,i]of this.branches)e(t),e(i);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild(t=>{e.push(t.serialize())}),e}}class Oa{constructor(e,t,i,r){this.type=e,this.input=t,this.beginIndex=i,this.endIndex=r}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`),null;const i=t.parse(e[1],1,cn),r=t.parse(e[2],2,nn);if(!i||!r)return null;if(n=i.type,![pn(cn),on,cn].some(e=>e.kind===n.kind))return t.error(`Expected first argument to be of type array or string, but found ${fn(i.type)} instead`),null;var n;if(4===e.length){const n=t.parse(e[3],3,nn);return n?new Oa(i.type,i,r,n):null}return new Oa(i.type,i,r)}evaluate(e){const t=this.input.evaluate(e),i=this.beginIndex.evaluate(e);if(!gn(t,["string","array"]))throw new Mn(`Expected first argument to be of type array or string, but found ${fn(Sn(t))} instead.`);if(this.endIndex){const r=this.endIndex.evaluate(e);return t.slice(i,r)}return t.slice(i)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function Ba(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function ka(e,t,i,r){return 0===r.compare(t,i)}function Va(e,t,i){const r="=="!==e&&"!="!==e;return class n{constructor(e,t,i){this.type=an,this.lhs=e,this.rhs=t,this.collator=i,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");const i=e[0];let o=t.parse(e[1],1,cn);if(!o)return null;if(!Ba(i,o.type))return t.error(`"${i}" comparisons are not supported for type '${fn(o.type)}'.`,1);let a=t.parse(e[2],2,cn);if(!a)return null;if(!Ba(i,a.type))return t.error(`"${i}" comparisons are not supported for type '${fn(a.type)}'.`,2);if(o.type.kind!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return t.error(`Cannot compare types '${fn(o.type)}' and '${fn(a.type)}'.`);r&&("value"===o.type.kind&&"value"!==a.type.kind?o=new Cn(a.type,[o]):"value"!==o.type.kind&&"value"===a.type.kind&&(a=new Cn(o.type,[a])));let s=null;if(4===e.length){if("string"!==o.type.kind&&"string"!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return t.error("Cannot use collator to compare non-string types.");if(s=t.parse(e[3],3,un),!s)return null}return new n(o,a,s)}evaluate(n){const o=this.lhs.evaluate(n),a=this.rhs.evaluate(n);if(r&&this.hasUntypedArgument){const t=Sn(o),i=Sn(a);if(t.kind!==i.kind||"string"!==t.kind&&"number"!==t.kind)throw new Mn(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${i.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){const e=Sn(o),i=Sn(a);if("string"!==e.kind||"string"!==i.kind)return t(n,o,a)}return this.collator?i(n,o,a,this.collator.evaluate(n)):t(n,o,a)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}serialize(){const t=[e];return this.eachChild(e=>{t.push(e.serialize())}),t}}}const Na=Va("==",function(e,t,i){return t===i},ka),Ua=Va("!=",function(e,t,i){return t!==i},function(e,t,i,r){return!ka(0,t,i,r)}),ja=Va("<",function(e,t,i){return t<i},function(e,t,i,r){return r.compare(t,i)<0}),Ga=Va(">",function(e,t,i){return t>i},function(e,t,i,r){return r.compare(t,i)>0}),Ha=Va("<=",function(e,t,i){return t<=i},function(e,t,i,r){return r.compare(t,i)<=0}),$a=Va(">=",function(e,t,i){return t>=i},function(e,t,i,r){return r.compare(t,i)>=0});class Wa{constructor(e,t,i,r,n,o){this.type=on,this.number=e,this.locale=t,this.currency=i,this.unit=r,this.minFractionDigits=n,this.maxFractionDigits=o}static parse(e,t){if(3!==e.length)return t.error("Expected two arguments.");const i=t.parse(e[1],1,nn);if(!i)return null;const r=e[2];if("object"!=typeof r||Array.isArray(r))return t.error("NumberFormat options argument must be an object.");let n=null;if(r.locale&&(n=t.parseObjectValue(r.locale,2,"locale",on),!n))return null;let o=null;if(r.currency&&(o=t.parseObjectValue(r.currency,2,"currency",on),!o))return null;let a=null;if(r.unit&&(a=t.parseObjectValue(r.unit,2,"unit",on),!a))return null;let s=null;if(void 0!==r["min-fraction-digits"]&&(s=t.parseObjectValue(r["min-fraction-digits"],2,"min-fraction-digits",nn),!s))return null;let l=null;return void 0===r["max-fraction-digits"]||(l=t.parseObjectValue(r["max-fraction-digits"],2,"max-fraction-digits",nn),l)?new Wa(i,n,o,a,s,l):null}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class qa{constructor(e){this.type=nn,this.input=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`),null;const i=t.parse(e[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?(t.error(`Expected argument of type string or array, but found ${fn(i.type)} instead.`),null):new qa(i):null}evaluate(e){const t=this.input.evaluate(e);if("string"==typeof t)return t.length;if(Array.isArray(t))return t.length;throw new Mn(`Expected value to be of type string or array, but found ${fn(Sn(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild(t=>{e.push(t.serialize())}),e}}function Za(e){return function(){e=1831565813+(e|=0)|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}const Xa={"==":Na,"!=":Ua,">":Ga,"<":ja,">=":$a,"<=":Ha,array:Cn,at:Ra,"at-interpolated":za,boolean:Cn,case:Fa,coalesce:Ma,collator:$n,format:Rn,image:zn,interpolate:Ta,"interpolate-hcl":Ta,"interpolate-lab":Ta,length:qa,let:Ca,literal:Dn,match:La,number:Cn,"number-format":Wa,object:Cn,slice:Oa,step:la,string:Cn,"to-boolean":Nn,"to-color":Nn,"to-number":Nn,"to-string":Nn,var:ia,within:so,distance:ta,config:fo};function Ya(e,[t,i,r,n]){t=t.evaluate(e),i=i.evaluate(e),r=r.evaluate(e);const o=n?n.evaluate(e):1,a=An(t,i,r,o);if(a)throw new Mn(a);return new Zr(t/255,i/255,r/255,o)}function Ka(e,[t,i,r,n]){t=t.evaluate(e),i=i.evaluate(e),r=r.evaluate(e);const o=n?n.evaluate(e):1,a=function(e,t,i,r){return"number"==typeof e&&e>=0&&e<=360?"number"==typeof t&&t>=0&&t<=100&&"number"==typeof i&&i>=0&&i<=100?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:`Invalid hsla value [${[e,t,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${("number"==typeof r?[e,t,i,r]:[e,t,i]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${("number"==typeof r?[e,t,i,r]:[e,t,i]).join(", ")}]: 'h' must be between 0 and 360.`}(t,i,r,o);if(a)throw new Mn(a);const s=`hsla(${t}, ${i}%, ${r}%, ${o})`,l=Zr.parse(s);if(!l)throw new Mn(`Failed to parse HSLA color: ${s}`);return l}function Ja(e,t){return e in t}function Qa(e,t){const i=t[e];return void 0===i?null:i}function es(e){return{type:e}}function ts(e,t){if(!gn(e,["boolean","string","number","null"]))throw new Mn(`Expected first argument to be of type boolean, string, number or null, but found ${fn(Sn(e))} instead.`);if(!gn(t,["string","array"]))throw new Mn(`Expected second argument to be of type array or string, but found ${fn(Sn(t))} instead.`)}function is(e){if(e instanceof fo)return new Set([e.key]);let t=new Set;return e.eachChild(e=>{t=new Set([...t,...is(e)])}),t}function rs(e){if(e instanceof Gn&&"is-active-floor"===e.name)return!0;let t=!1;return e.eachChild(e=>{!t&&rs(e)&&(t=!0)}),t}function ns(e){return{result:"success",value:e}}function os(e){return{result:"error",value:e}}Gn.register(Xa,{error:[{kind:"error"},[on],(e,[t])=>{throw new Mn(t.evaluate(e))}],typeof:[on,[cn],(e,[t])=>fn(Sn(t.evaluate(e)))],"to-rgba":[pn(nn,4),[sn],(e,[t])=>t.evaluate(e).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[pn(nn,4),[sn],(e,[t])=>t.evaluate(e).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[sn,[nn,nn,nn],Ya],rgba:[sn,[nn,nn,nn,nn],Ya],hsl:[sn,[nn,nn,nn],Ka],hsla:[sn,[nn,nn,nn,nn],Ka],has:{type:an,overloads:[[[on],(e,[t])=>Ja(t.evaluate(e),e.properties())],[[on,ln],(e,[t,i])=>Ja(t.evaluate(e),i.evaluate(e))]]},get:{type:cn,overloads:[[[on],(e,[t])=>Qa(t.evaluate(e),e.properties())],[[on,ln],(e,[t,i])=>Qa(t.evaluate(e),i.evaluate(e))]]},"feature-state":[cn,[on],(e,[t])=>Qa(t.evaluate(e),e.featureState||{})],properties:[ln,[],e=>e.properties()],"geometry-type":[on,[],e=>e.geometryType()],worldview:[on,[],e=>e.globals.worldview||""],"is-active-floor":[an,es(on),(e,t)=>{if(!(e.globals&&e.globals.activeFloors&&e.globals.activeFloors.size>0))return!1;if(0===t.length)return!0;const i=e.globals.activeFloors;return t.some(t=>{const r=t.evaluate(e);return i.has(r)})}],id:[cn,[],e=>e.id()],zoom:[nn,[],e=>e.globals.zoom],pitch:[nn,[],e=>e.globals.pitch||0],"distance-from-center":[nn,[],e=>e.distanceFromCenter()],"measure-light":[nn,[on],(e,[t])=>e.measureLight(t.evaluate(e))],"heatmap-density":[nn,[],e=>e.globals.heatmapDensity||0],"line-progress":[nn,[],e=>e.globals.lineProgress||0],"raster-value":[nn,[],e=>e.globals.rasterValue||0],"raster-particle-speed":[nn,[],e=>e.globals.rasterParticleSpeed||0],"sky-radial-progress":[nn,[],e=>e.globals.skyRadialProgress||0],accumulated:[cn,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[nn,es(nn),(e,t)=>{let i=0;for(const r of t)i+=r.evaluate(e);return i}],"*":[nn,es(nn),(e,t)=>{let i=1;for(const r of t)i*=r.evaluate(e);return i}],"-":{type:nn,overloads:[[[nn,nn],(e,[t,i])=>t.evaluate(e)-i.evaluate(e)],[[nn],(e,[t])=>-t.evaluate(e)]]},"/":[nn,[nn,nn],(e,[t,i])=>t.evaluate(e)/i.evaluate(e)],"%":[nn,[nn,nn],(e,[t,i])=>t.evaluate(e)%i.evaluate(e)],ln2:[nn,[],()=>Math.LN2],pi:[nn,[],()=>Math.PI],e:[nn,[],()=>Math.E],"^":[nn,[nn,nn],(e,[t,i])=>Math.pow(t.evaluate(e),i.evaluate(e))],sqrt:[nn,[nn],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[nn,[nn],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[nn,[nn],(e,[t])=>Math.log(t.evaluate(e))],log2:[nn,[nn],(e,[t])=>Math.log2(t.evaluate(e))],sin:[nn,[nn],(e,[t])=>Math.sin(t.evaluate(e))],cos:[nn,[nn],(e,[t])=>Math.cos(t.evaluate(e))],tan:[nn,[nn],(e,[t])=>Math.tan(t.evaluate(e))],asin:[nn,[nn],(e,[t])=>Math.asin(t.evaluate(e))],acos:[nn,[nn],(e,[t])=>Math.acos(t.evaluate(e))],atan:[nn,[nn],(e,[t])=>Math.atan(t.evaluate(e))],min:[nn,es(nn),(e,t)=>Math.min(...t.map(t=>t.evaluate(e)))],max:[nn,es(nn),(e,t)=>Math.max(...t.map(t=>t.evaluate(e)))],abs:[nn,[nn],(e,[t])=>Math.abs(t.evaluate(e))],round:[nn,[nn],(e,[t])=>{const i=t.evaluate(e);return i<0?-Math.round(-i):Math.round(i)}],floor:[nn,[nn],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[nn,[nn],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[an,[on,cn],(e,[t,i])=>e.properties()[t.value]===i.value],"filter-id-==":[an,[cn],(e,[t])=>e.id()===t.value],"filter-type-==":[an,[on],(e,[t])=>e.geometryType()===t.value],"filter-<":[an,[on,cn],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r<n}],"filter-id-<":[an,[cn],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i<r}],"filter->":[an,[on,cn],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>n}],"filter-id->":[an,[cn],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i>r}],"filter-<=":[an,[on,cn],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r<=n}],"filter-id-<=":[an,[cn],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i<=r}],"filter->=":[an,[on,cn],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>=n}],"filter-id->=":[an,[cn],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i>=r}],"filter-has":[an,[cn],(e,[t])=>t.value in e.properties()],"filter-has-id":[an,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[an,[pn(on)],(e,[t])=>t.value.includes(e.geometryType())],"filter-id-in":[an,[pn(cn)],(e,[t])=>t.value.includes(e.id())],"filter-in-small":[an,[on,pn(cn)],(e,[t,i])=>i.value.includes(e.properties()[t.value])],"filter-in-large":[an,[on,pn(cn)],(e,[t,i])=>function(e,t,i,r){for(;i<=r;){const n=i+r>>1;if(t[n]===e)return!0;t[n]>e?r=n-1:i=n+1}return!1}(e.properties()[t.value],i.value,0,i.value.length-1)],all:{type:an,overloads:[[[an,an],(e,[t,i])=>t.evaluate(e)&&i.evaluate(e)],[es(an),(e,t)=>{for(const i of t)if(!i.evaluate(e))return!1;return!0}]]},any:{type:an,overloads:[[[an,an],(e,[t,i])=>t.evaluate(e)||i.evaluate(e)],[es(an),(e,t)=>{for(const i of t)if(i.evaluate(e))return!0;return!1}]]},"!":[an,[an],(e,[t])=>!t.evaluate(e)],"is-supported-script":[an,[on],(e,[t])=>{const i=e.globals&&e.globals.isSupportedScript;return!i||i(t.evaluate(e))}],upcase:[on,[on],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[on,[on],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[on,es(cn),(e,t)=>t.map(t=>Tn(t.evaluate(e))).join("")],split:[pn(on),[on,on],(e,[t,i])=>t.evaluate(e).split(i.evaluate(e))],in:[an,[cn,cn],(e,[t,i])=>{const r=t.evaluate(e),n=i.evaluate(e);return null!=n&&(ts(r,n),n.includes(r))}],"index-of":{type:nn,overloads:[[[cn,cn],(e,[t,i])=>{const r=t.evaluate(e),n=i.evaluate(e);return ts(r,n),n.indexOf(r)}],[[cn,cn,nn],(e,[t,i,r])=>{const n=t.evaluate(e),o=i.evaluate(e),a=r.evaluate(e);return ts(n,o),o.indexOf(n,a)}]]},"resolved-locale":[on,[un],(e,[t])=>t.evaluate(e).resolvedLocale()],random:[nn,[nn,nn,cn],(e,t)=>{const[i,r,n]=t.map(t=>t.evaluate(e));if(i>r)return i;if(i===r)return i;let o;if("string"==typeof n)o=function(e){let t=0;if(0===e.length)return t;for(let i=0;i<e.length;i++)t=(t<<5)-t+e.charCodeAt(i),t&=t;return t}(n);else{if("number"!=typeof n)throw new Mn(`Invalid seed input: ${n}`);o=n}return i+Za(o)()*(r-i)}]});const as=/^(.*)-transition$/,ss=/^(.*)-use-theme$/;function ls(e,t){return!!e&&!!e.parameters&&e.parameters.includes(t)}function cs(e){return"data-driven"===e["property-type"]}function us(e){return ls(e.expression,"measure-light")}function hs(e){return ls(e.expression,"zoom")}function ds(e){return!!e.expression&&e.expression.interpolated}function ps(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function fs(e){return e}function ms(e,t){const i="color"===t.type,r=e.stops&&"object"==typeof e.stops[0][0],n=r||!(r||void 0!==e.property),o=e.type||(ds(t)?"exponential":"interval");if(i&&((e={...e}).stops&&(e.stops=e.stops.map(e=>[e[0],Zr.parse(e[1])])),e.default=Zr.parse(e.default?e.default:t.default)),e.colorSpace&&"rgb"!==e.colorSpace&&!Sa[e.colorSpace])throw new Error(`Unknown color space: ${e.colorSpace}`);let a,s,l;if("exponential"===o)a=xs;else if("interval"===o)a=ys;else if("categorical"===o){a=gs,s=Object.create(null);for(const t of e.stops)s[t[0]]=t[1];l=typeof e.stops[0][0]}else{if("identity"!==o)throw new Error(`Unknown function type "${o}"`);a=vs}if(r){const i={},r=[];for(let t=0;t<e.stops.length;t++){const n=e.stops[t],o=n[0].zoom;void 0===i[o]&&(i[o]={zoom:o,type:e.type,property:e.property,default:e.default,stops:[]},r.push(o)),i[o].stops.push([n[0].value,n[1]])}const n=[];for(const e of r)n.push([i[e].zoom,ms(i[e],t)]);const o={name:"linear"};return{kind:"composite",interpolationType:o,interpolationFactor:Ta.interpolationFactor.bind(void 0,o),zoomStops:n.map(e=>e[0]),evaluate:({zoom:i},r)=>xs({stops:n,base:e.base},t,i).evaluate(i,r)}}if(n){const i="exponential"===o?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:i,interpolationFactor:Ta.interpolationFactor.bind(void 0,i),zoomStops:e.stops.map(e=>e[0]),evaluate:({zoom:i})=>a(e,t,i,s,l)}}return{kind:"source",evaluate(i,r){const n=r&&r.properties?r.properties[e.property]:void 0;return void 0===n?_s(e.default,t.default):a(e,t,n,s,l)}}}function _s(e,t,i){return void 0!==e?e:void 0!==t?t:void 0!==i?i:void 0}function gs(e,t,i,r,n){return _s(typeof i===n?r[i]:void 0,e.default,t.default)}function ys(e,t,i){if(!Bn(i))return _s(e.default,t.default);const r=e.stops.length;if(1===r)return e.stops[0][1];if(i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[r-1][0])return e.stops[r-1][1];const n=sa(e.stops.map(e=>e[0]),i);return e.stops[n][1]}function xs(e,t,i){const r=void 0!==e.base?e.base:1;if(!Bn(i))return _s(e.default,t.default);const n=e.stops.length;if(1===n)return e.stops[0][1];if(i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[n-1][0])return e.stops[n-1][1];const o=sa(e.stops.map(e=>e[0]),i),a=function(e,t,i,r){const n=r-i,o=e-i;return 0===n?0:1===t?o/n:(Math.pow(t,o)-1)/(Math.pow(t,n)-1)}(i,r,e.stops[o][0],e.stops[o+1][0]),s=e.stops[o][1],l=e.stops[o+1][1];let c=Qr[t.type]||fs;if(e.colorSpace&&"rgb"!==e.colorSpace){const t=Sa[e.colorSpace];c=(e,i)=>t.reverse(t.interpolate(t.forward(e),t.forward(i),a))}return"function"==typeof s.evaluate?{evaluate(...e){const t=s.evaluate.apply(void 0,e),i=l.evaluate.apply(void 0,e);if(void 0!==t&&void 0!==i)return c(t,i,a)}}:c(s,l,a)}function vs(e,t,i){return"color"===t.type?i=Zr.parse(i):"formatted"===t.type?i=bn.fromString(i.toString()):"resolvedImage"===t.type?i=En.build(i.toString()):Ln(i)===t.type||"enum"===t.type&&t.values[i]||(i=void 0),_s(i,e.default,t.default)}class bs{constructor(e,t,i,r,n){this.expression=e,this._warningHistory={},this._scope=i,this._options=r,this._iconImageUseTheme=n,this._evaluator=new jn(i,r,n),this._defaultValue=t?function(e){return"color"===e.type&&(ps(e.default)||Array.isArray(e.default))?new Zr(0,0,0,0):"color"===e.type?Zr.parse(e.default)||null:void 0===e.default?null:e.default}(t):null,this._enumValues=t&&"enum"===t.type?t.values:null,this.configDependencies=is(e),this.isIndoorDependent=rs(e)}evaluateWithoutErrorHandling(e,t,i,r,n,o,a,s){const l=this._evaluator;return l.globals=e,l.feature=t,l.featureState=i,l.canonical=r||null,l.availableImages=n||null,l.formattedSection=o,l.featureTileCoord=a||null,l.featureDistanceData=s||null,this.expression.evaluate(l)}evaluate(e,t,i,r,n,o,a,s,l){this._evaluator||(this._evaluator=new jn(this._scope,this._options,this._iconImageUseTheme)),this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=i||null,this._evaluator.canonical=r||null,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o||null,this._evaluator.featureTileCoord=a||null,this._evaluator.featureDistanceData=s||null,this._evaluator.iconImageUseTheme=l||null;try{const e=this.expression.evaluate(this._evaluator);if(null==e||"number"==typeof e&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new Mn(`Expected value to be one of ${Object.keys(this._enumValues).map(e=>JSON.stringify(e)).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){const t=e;return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${t.message}`)),this._defaultValue}}}function ws(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&Object.hasOwn(Xa,e[0])}function Es(e,t,i,r,n){const o=new ra(Xa,[],t?function(e){const t={color:sn,string:on,number:nn,enum:on,boolean:an,formatted:hn,resolvedImage:dn,object:ln};return"array"===e.type?pn(t[e.value]||cn,e.length):t[e.type]}(t):void 0,void 0,void 0,i,r,n),a=o.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return a?ns(new bs(a,t,i,r,n)):os(o.errors)}function As(e,t={}){const i=t.type&&!t.array&&Array.isArray(e)?{type:t.type,"property-type":"data-constant"}:void 0;return Es(null===e||"object"!=typeof e||Array.isArray(e)?e:["literal",e],i)}class Is{constructor(e,t,i,r){this.kind=e,this._styleExpression=t,this.isLightConstant=i,this.isLineProgressConstant=r,this.isStateDependent="constant"!==e&&!_o(t.expression),this.configDependencies=is(t.expression),this.isIndoorDependent=rs(t.expression)}evaluateWithoutErrorHandling(e,t,i,r,n,o){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,o)}evaluate(e,t,i,r,n,o,a){return this._styleExpression.evaluate(e,t,i,r,n,o,void 0,void 0,a)}}class Ss{constructor(e,t,i,r,n,o){this.kind=e,this.zoomStops=i,this._styleExpression=t,this.isStateDependent="camera"!==e&&!_o(t.expression),this.isIndoorDependent=rs(t.expression),this.isLightConstant=n,this.isLineProgressConstant=o,this.configDependencies=is(t.expression),this.interpolationType=r}evaluateWithoutErrorHandling(e,t,i,r,n,o){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,o)}evaluate(e,t,i,r,n,o){return this._styleExpression.evaluate(e,t,i,r,n,o)}interpolationFactor(e,t,i){return this.interpolationType?Ta.interpolationFactor(this.interpolationType,e,t,i):0}}function Ts(e,t,i,r,n){if("error"===(e=Es(e,t,i,r,n)).result)return e;const o=e.value.expression,a=mo(o);if(!a&&!cs(t))return os([new en("","data expressions not supported")]);const s=yo(o,["zoom","pitch","distance-from-center"]);if(!s&&!hs(t))return os([new en("","zoom expressions not supported")]);const l=yo(o,["measure-light"]);if(!l&&!us(t))return os([new en("","measure-light expression not supported")]);const c=yo(o,["line-progress"]);if(!c&&!function(e){return ls(e.expression,"line-progress")}(t))return os([new en("","line-progress expression not supported")]);const u=t.expression&&t.expression.relaxZoomRestriction,h=Ms(o);return h||s||u?h instanceof en?os([h]):h instanceof Ta&&!ds(t)?os([new en("",'"interpolate" expressions cannot be used with this property')]):ns(h?new Ss(a&&c?"camera":"composite",e.value,h.labels,h instanceof Ta?h.interpolation:void 0,l,c):new Is(a&&c?"constant":"source",e.value,l,c)):os([new en("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class Ds{constructor(e,t){this._parameters=e,this._specification=t,Object.assign(this,ms(this._parameters,this._specification))}static deserialize(e){return new Ds(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Ms(e){let t=null;if(e instanceof Ca)t=Ms(e.result);else if(e instanceof Ma){for(const i of e.args)if(t=Ms(i),t)break}else(e instanceof la||e instanceof Ta)&&e.input instanceof Gn&&"zoom"===e.input.name&&(t=e);return t instanceof en||e.eachChild(e=>{const i=Ms(e);i instanceof en?t=i:t&&i&&t!==i&&(t=new en("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}class Ps{constructor(e,t,i){if(this.boxSeen=new Uint32Array(0),this.circleSeen=new Uint32Array(0),this.generation=0,e instanceof ArrayBuffer){const t=new Int32Array(e);this.width=t[0],this.height=t[1],this.xCellCount=t[2],this.yCellCount=t[3],this.boxUid=t[4],this.circleUid=t[5];const i=this.xCellCount*this.yCellCount,r=[];for(let e=0;e<i;e++){const i=t[6+e],n=t[6+e+1];r.push(i===n?null:t.subarray(i,n))}const n=t[6+i],o=[];for(let e=0;e<i;e++){const i=t[n+e],r=t[n+e+1];o.push(i===r?null:t.subarray(i,r))}let a=t[n+i];this.boxCells=r,this.circleCells=o,this.boxKeys=t.subarray(a,a+this.boxUid),a+=this.boxUid,this.circleKeys=t.subarray(a,a+this.circleUid),a+=this.circleUid,this.bboxes=t.subarray(a,a+4*this.boxUid),a+=4*this.boxUid,this.circles=t.subarray(a,a+3*this.circleUid)}else{this.width=e,this.height=t,this.xCellCount=Math.ceil(e/i),this.yCellCount=Math.ceil(t/i);const r=this.xCellCount*this.yCellCount,n=[],o=[];for(let e=0;e<r;e++)n.push([]),o.push([]);this.boxCells=n,this.circleCells=o,this.boxKeys=[],this.circleKeys=[],this.bboxes=[],this.circles=[],this.boxUid=0,this.circleUid=0}this.xScale=this.xCellCount/this.width,this.yScale=this.yCellCount/this.height}keysLength(){return this.boxKeys.length+this.circleKeys.length}clear(){for(const e of this.boxCells)e&&(e.length=0);for(const e of this.circleCells)e&&(e.length=0);this.circleKeys.length=0,this.boxKeys.length=0,this.bboxes.length=0,this.circles.length=0,this.boxUid=0,this.circleUid=0}insert(e,t,i,r,n){const o=this.boxUid++,a=this._xCell(t),s=this._yCell(i),l=this._xCell(r),c=this._yCell(n);for(let u=a;u<=l;u++)for(let e=s;e<=c;e++)this.boxCells[this.xCellCount*e+u].push(o);this.boxKeys.push(e),this.bboxes.push(t,i,r,n)}insertCircle(e,t,i,r){const n=this.circleUid++,o=this._xCell(t-r),a=this._yCell(i-r),s=this._xCell(t+r),l=this._yCell(i+r);for(let c=o;c<=s;c++)for(let e=a;e<=l;e++)this.circleCells[this.xCellCount*e+c].push(n);this.circleKeys.push(e),this.circles.push(t,i,r)}query(e,t,i,r,n){const o=[];if(i<0||e>this.width||r<0||t>this.height)return o;const a=this._nextGen(),{boxCells:s,circleCells:l,boxKeys:c,circleKeys:u,bboxes:h,circles:d,boxSeen:p,circleSeen:f,xCellCount:m}=this,_=this._xCell(e),g=this._yCell(t),y=this._xCell(i),x=this._yCell(r);for(let v=_;v<=y;v++)for(let _=g;_<=x;_++){const g=m*_+v,y=s[g];if(y)for(let s=0;s<y.length;s++){const l=y[s];if(p[l]===a)continue;p[l]=a;const u=4*l,d=h[u],f=h[u+1],m=h[u+2],_=h[u+3];e<=m&&t<=_&&i>=d&&r>=f&&(!n||n(c[l]))&&o.push({key:c[l],x1:d,y1:f,x2:m,y2:_})}const x=l[g];if(x)for(let s=0;s<x.length;s++){const l=x[s];if(f[l]===a)continue;f[l]=a;const c=3*l,h=d[c],p=d[c+1],m=d[c+2];!this._circleAndRectCollide(h,p,m,e,t,i,r)||n&&!n(u[l])||o.push({key:u[l],x1:h-m,y1:p-m,x2:h+m,y2:p+m})}}return o}queryKeys(e,t,i,r,n){const o=[];if(i<0||e>this.width||r<0||t>this.height)return o;const a=this._nextGen(),{boxCells:s,boxKeys:l,bboxes:c,boxSeen:u,xCellCount:h,xScale:d,yScale:p}=this,f=this._xCell(e),m=this._yCell(t),_=this._xCell(i),g=this._yCell(r);for(let y=f;y<=_;y++)for(let f=m;f<=g;f++){if(n&&!n(y/d,f/p,(y+1)/d,(f+1)/p))continue;const m=s[h*f+y];if(m)for(let s=0;s<m.length;s++){const h=m[s];if(u[h]===a)continue;u[h]=a;const d=4*h,p=c[d],f=c[d+1],_=c[d+2],g=c[d+3];(n?n(p,f,_,g):e<=_&&t<=g&&i>=p&&r>=f)&&o.push(l[h])}}return o}hitTest(e,t,i,r,n){if(i<0||e>this.width||r<0||t>this.height)return!1;const o=this._nextGen(),{boxCells:a,circleCells:s,boxKeys:l,circleKeys:c,bboxes:u,circles:h,boxSeen:d,circleSeen:p,xCellCount:f}=this,m=this._xCell(e),_=this._yCell(t),g=this._xCell(i),y=this._yCell(r);for(let x=m;x<=g;x++)for(let m=_;m<=y;m++){const _=f*m+x,g=a[_];if(g)for(let a=0;a<g.length;a++){const s=g[a];if(d[s]===o)continue;d[s]=o;const c=4*s;if(e<=u[c+2]&&t<=u[c+3]&&i>=u[c]&&r>=u[c+1]&&(!n||n(l[s])))return!0}const y=s[_];if(y)for(let a=0;a<y.length;a++){const s=y[a];if(p[s]===o)continue;p[s]=o;const l=3*s;if(this._circleAndRectCollide(h[l],h[l+1],h[l+2],e,t,i,r)&&(!n||n(c[s])))return!0}}return!1}hitTestCircle(e,t,i,r){const n=e-i,o=t-i,a=e+i,s=t+i;if(a<0||n>this.width||s<0||o>this.height)return!1;const l=this._nextGen(),{boxCells:c,circleCells:u,boxKeys:h,circleKeys:d,bboxes:p,circles:f,boxSeen:m,circleSeen:_,xCellCount:g}=this,y=this._xCell(n),x=this._yCell(o),v=this._xCell(a),b=this._yCell(s);for(let w=y;w<=v;w++)for(let n=x;n<=b;n++){const o=g*n+w,a=c[o];if(a)for(let n=0;n<a.length;n++){const o=a[n];if(m[o]===l)continue;m[o]=l;const s=4*o;if(this._circleAndRectCollide(e,t,i,p[s],p[s+1],p[s+2],p[s+3])&&(!r||r(h[o])))return!0}const s=u[o];if(s)for(let n=0;n<s.length;n++){const o=s[n];if(_[o]===l)continue;_[o]=l;const a=3*o;if(this._circlesCollide(f[a],f[a+1],f[a+2],e,t,i)&&(!r||r(d[o])))return!0}}return!1}static serialize(e,t){const i=e.toArrayBuffer();return t&&t.add(i),{buffer:i}}static deserialize(e){return new Ps(e.buffer)}toArrayBuffer(){const e=this.xCellCount*this.yCellCount;let t=0,i=0;for(let a=0;a<e;a++)t+=this.boxCells[a].length,i+=this.circleCells[a].length;const r=new Int32Array(6+(e+1)+t+(e+1)+i+this.boxUid+this.circleUid+4*this.boxUid+3*this.circleUid);r[0]=this.width,r[1]=this.height,r[2]=this.xCellCount,r[3]=this.yCellCount,r[4]=this.boxUid,r[5]=this.circleUid;let n=6+(e+1);for(let a=0;a<e;a++){r[6+a]=n;const e=this.boxCells[a];r.set(e,n),n+=e.length}r[6+e]=n;const o=n;n+=e+1;for(let a=0;a<e;a++){r[o+a]=n;const e=this.circleCells[a];r.set(e,n),n+=e.length}return r[o+e]=n,r.set(this.boxKeys,n),n+=this.boxUid,r.set(this.circleKeys,n),n+=this.circleUid,r.set(this.bboxes,n),n+=4*this.boxUid,r.set(this.circles,n),r.buffer}_xCell(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_yCell(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_nextGen(){return this.boxSeen.length<this.boxUid&&(this.boxSeen=new Uint32Array(this.boxUid)),this.circleSeen.length<this.circleUid&&(this.circleSeen=new Uint32Array(this.circleUid)),this.generation=this.generation+1>>>0,0===this.generation&&(this.boxSeen.fill(0),this.circleSeen.fill(0),this.generation=1),this.generation}
vendor: 10,254 bytes, line 2
2_circlesCollide(e,t,i,r,n,o){const a=r-e,s=n-t,l=i+o;return l*l>a*a+s*s}_circleAndRectCollide(e,t,i,r,n,o,a){const s=(o-r)/2,l=Math.abs(e-(r+s));if(l>s+i)return!1;const c=(a-n)/2,u=Math.abs(t-(n+c));if(u>c+i)return!1;if(l<=s||u<=c)return!0;const h=l-s,d=u-c;return h*h+d*d<=i*i}}const Cs={};function Rs(e,t,i={}){Object.defineProperty(e,"_classRegistryKey",{value:t,writable:!1}),Cs[t]={klass:e,omit:i.omit||[]}}Rs(Object,"Object"),Rs(Ps,"Grid"),delete ke.prototype.constructor,Rs(Zr,"Color"),Rs(bn,"Formatted"),Rs(vn,"FormattedSection"),Rs(En,"ResolvedImage"),Rs(Ds,"StylePropertyFunction"),Rs(bs,"StyleExpression",{omit:["_evaluator"]}),Rs(Ur,"ImageId"),Rs(wn,"ImageVariant"),Rs(Ss,"ZoomDependentExpression"),Rs(Is,"ZoomConstantExpression"),Rs(Gn,"CompoundExpression",{omit:["_evaluate"]});for(const JF in Xa)Cs[Xa[JF]._classRegistryKey]||Rs(Xa[JF],`Expression${JF}`);function zs(e){return e&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}const Ls={Error:Error,TypeError:TypeError,RangeError:RangeError,SyntaxError:SyntaxError,ReferenceError:ReferenceError,URIError:URIError,EvalError:EvalError},Fs=new Set(["message","stack","cause","errors","name","class"]);function Os(e,t){if(null===e)return null;const i=typeof e;if("object"!==i)return"bigint"===i?{$name:"BigInt",value:e.toString()}:e;if(Array.isArray(e)){const i=e.length,r=[];r.length=i;for(let n=0;n<i;n++)r[n]=Os(e[n],t);return r}if(ArrayBuffer.isView(e))return t&&t.add(e.buffer),e;if(zs(e)||e instanceof ImageBitmap)return t&&t.add(e),e;if(e instanceof ImageData)return t&&t.add(e.data.buffer),e;if(e instanceof Map){const i={$name:"Map",entries:[]};for(const[r,n]of e.entries())i.entries.push(Os(r),Os(n,t));return i}if(e instanceof Headers)return{$name:"Headers",entries:[...e]};if(e instanceof Set){const t={$name:"Set"};let i=0;for(const r of e.values())t[++i]=Os(r);return t}if(e instanceof Date||e instanceof RegExp||e instanceof Boolean||e instanceof Number||e instanceof String)return e;if(e instanceof Error){const i=e,r=i.constructor&&i.constructor.name||"Error",n={$name:"$Error",class:i instanceof ki?"AJAXError":i instanceof DOMException?"DOMException":i instanceof AggregateError?"AggregateError":Ls[r]?r:"Error",name:i.name,message:i.message};i.stack&&(n.stack=i.stack),"cause"in i&&i.cause!==i&&(n.cause=Os(i.cause,t)),i instanceof AggregateError&&(n.errors=i.errors.filter(e=>e!==i).map(e=>Os(e,t)));const o=i;for(const e in o)Object.hasOwn(o,e)&&(Fs.has(e)||(n[e]=Os(o[e],t)));return n}const r=e.constructor||Object,n=r._classRegistryKey;if(!n)throw new Error(`Can't serialize object of unregistered class "${r.name}".`);const o=r.serialize?r.serialize(e,t):{};if(!r.serialize){const i=Cs[n].omit,r=e;for(const e in r)Object.hasOwn(r,e)&&(i.includes(e)||(o[e]=Os(r[e],t)))}if(o.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==n&&(o.$name=n),o}function Bs(e){if(null===e||"object"!=typeof e)return e;if(Array.isArray(e)){for(let t=0;t<e.length;t++)e[t]=Bs(e[t]);return e}if(ArrayBuffer.isView(e)||zs(e)||e instanceof ImageBitmap||e instanceof ImageData||e instanceof Date||e instanceof RegExp||e instanceof Boolean||e instanceof Number||e instanceof String)return e;const t=e.$name||"Object";if("Map"===t){const t=e.entries||[],i=new Map;for(let e=0;e<t.length;e+=2)i.set(Bs(t[e]),Bs(t[e+1]));return i}if("Headers"===t)return new Headers(e.entries);if("Set"===t){const t=new Set;for(const i in e)"$name"!==i&&t.add(Bs(e[i]));return t}if("BigInt"===t)return BigInt(e.value);if("$Error"===t){const t=e.class||"Error",i=e.name||t,r=e.message||"";let n;n="DOMException"===t?new DOMException(r,i):"AggregateError"===t?new AggregateError((e.errors||[]).map(Bs),r):"AJAXError"===t?new ki(e.statusText,e.status,e.url):new(Ls[t]||Error)(r),"DOMException"!==t&&(n.name=i),e.stack&&(n.stack=e.stack),"cause"in e&&(n.cause=Bs(e.cause));const o=n;for(const a in e)Object.hasOwn(e,a)&&("$name"===a||Fs.has(a)||(o[a]=Bs(e[a])));return n}const{klass:i}=Cs[t];if(!i)throw new Error(`Can't deserialize unregistered class "${t}".`);if(i.deserialize)return i.deserialize(e);const r=Object.create(i.prototype);for(const n in e)"$name"!==n&&(r[n]=Bs(e[n]));return r}const ks=e=>e>=12288&&e<=12351,Vs=e=>e>=12352&&e<=12447,Ns=e=>e>=12448&&e<=12543,Us=e=>e>=13312&&e<=19903,js=e=>e>=19968&&e<=40959,Gs=e=>e>=44032&&e<=55215;function Hs(e){for(const t of e)if($s(t.charCodeAt(0)))return!0;return!1}function $s(e){return!(746!==e&&747!==e&&(e<4352||!((e=>e>=12704&&e<=12735)(e)||(e=>e>=12544&&e<=12591)(e)||(e=>e>=65072&&e<=65103)(e)&&!(e>=65097&&e<=65103)||(e=>e>=63744&&e<=64255)(e)||(e=>e>=13056&&e<=13311)(e)||(e=>e>=11904&&e<=12031)(e)||(e=>e>=12736&&e<=12783)(e)||!(!ks(e)||e>=12296&&e<=12305||e>=12308&&e<=12319||12336===e)||Us(e)||js(e)||(e=>e>=12800&&e<=13055)(e)||(e=>e>=12592&&e<=12687)(e)||(e=>e>=43360&&e<=43391)(e)||(e=>e>=55216&&e<=55295)(e)||(e=>e>=4352&&e<=4607)(e)||Gs(e)||Vs(e)||(e=>e>=12272&&e<=12287)(e)||(e=>e>=12688&&e<=12703)(e)||(e=>e>=12032&&e<=12255)(e)||(e=>e>=12784&&e<=12799)(e)||Ns(e)&&12540!==e||!(!(e=>e>=65280&&e<=65519)(e)||65288===e||65289===e||65293===e||e>=65306&&e<=65310||65339===e||65341===e||65343===e||e>=65371&&e<=65503||65507===e||e>=65512&&e<=65519)||!(!(e=>e>=65104&&e<=65135)(e)||e>=65112&&e<=65118||e>=65123&&e<=65126)||(e=>e>=5120&&e<=5759)(e)||(e=>e>=6320&&e<=6399)(e)||(e=>e>=65040&&e<=65055)(e)||(e=>e>=19904&&e<=19967)(e)||(e=>e>=40960&&e<=42127)(e)||(e=>e>=42128&&e<=42191)(e))))}function Ws(e){return e>=1424&&e<=2303||(e=>e>=64336&&e<=65023)(e)||(e=>e>=65136&&e<=65279)(e)}function qs(e,t){return!(!t&&Ws(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||(e=>e>=6016&&e<=6143)(e))}function Zs(e){for(const t of e)if(Ws(t.charCodeAt(0)))return!0;return!1}const Xs="deferred",Ys="loading",Ks="loaded";let Js=null,Qs="unavailable",el=null;const tl=function(e){e&&(Qs="error"),Js&&Js(e)};function il(){rl.fire(new Or("pluginStateChange",{pluginStatus:Qs,pluginURL:el}))}const rl=new Nr,nl=function(){return Qs},ol=function(){if(Qs!==Xs||!el)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Qs=Ys,il(),el&&Wi({url:el}).then(()=>{Qs=Ks,il()}).catch(e=>{tl(e)})},al={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Qs===Ks||null!=al.applyArabicShaping,isLoading:()=>Qs===Ys,setState(e){Qs=e.pluginStatus,el=e.pluginURL},isParsing:()=>"parsing"===Qs,isParsed:()=>"parsed"===Qs,getPluginURL:()=>el},sl=function(){al.isLoading()||al.isLoaded()||"deferred"!==nl()||ol()};class ll{constructor(e,t){this.zoom=e,t?(this.now=t.now,this.fadeDuration=t.fadeDuration,this.transition=t.transition,this.pitch=t.pitch,this.brightness=t.brightness,this.worldview=t.worldview,this.activeFloors=t.activeFloors):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(e){return function(e,t){for(const i of e)if(!qs(i.charCodeAt(0),t))return!1;return!0}(e,al.isLoaded())}}class cl{constructor(e,t,i,r,n){this.property=e,this.value=t,this.expression=function(e,t,i,r,n){if(ps(e))return new Ds(e,t);if(ws(e)||Array.isArray(e)&&e.length>0){const o=Ts(e,t,i,r,n);if("error"===o.result)throw new Error(o.value.map(e=>`${e.key}: ${e.message}`).join(", "));return o.value}{let i=e;return"string"==typeof e&&"color"===t.type&&(i=Zr.parse(e)),{kind:"constant",configDependencies:new Set,isIndoorDependent:!1,evaluate:()=>i}}}(void 0===t?e.specification.default:t,e.specification,i,r,n)}isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(e,t,i,r){return this.property.possiblyEvaluate(this,e,t,i,r)}}class ul{constructor(e,t,i,r){this.property=e,this.value=new cl(e,void 0,t,i,r)}transitioned(e,t){return new dl(this.property,this.value,t,{...e.transition,...this.transition},e.now)}untransitioned(){return new dl(this.property,this.value,null,{},0)}}class hl{constructor(e,t,i,r){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=t,this._options=i,this._iconImageUseTheme=r,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(e){return At(this._values[e].value.value)}setValue(e,t){Object.hasOwn(this._values,e)||(this._values[e]=new ul(this._values[e].property,this._scope,this._options,this._iconImageUseTheme)),this._values[e].value=new cl(this._values[e].property,null===t?void 0:At(t),this._scope,this._options,this._iconImageUseTheme),this._values[e].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].value.expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[e].value.isIndoorDependent())}setTransitionOrValue(e,t){t&&(this._options=t);const i=this._properties.properties;if(e)for(const r in e){const t=e[r];if(r.endsWith("-transition")){const e=r.slice(0,-11);i[e]&&this.setTransition(e,t)}else Object.hasOwn(i,r)&&this.setValue(r,t)}}getTransition(e){return At(this._values[e].transition)}setTransition(e,t){Object.hasOwn(this._values,e)||(this._values[e]=new ul(this._values[e].property)),this._values[e].transition=At(t)||void 0}serialize(){const e={};for(const t of Object.keys(this._values)){const i=this.getValue(t);void 0!==i&&(e[t]=i);const r=this.getTransition(t);void 0!==r&&(e[`${t}-transition`]=r)}return e}transitioned(e,t){const i=new pl(this._properties);for(const r of Object.keys(this._values))i._values[r]=this._values[r].transitioned(e,t._values[r]);return i}untransitioned(){const e=new pl(this._properties);for(const t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}isIndoorDependent(){return this._isIndoorDependent}}class dl{constructor(e,t,i,r,n){const o=r.delay||0,a=r.duration||0;n=n||0,this.property=e,this.value=t,this.begin=n+o,this.end=this.begin+a,e.specification.transition&&(r.delay||r.duration)&&(this.prior=i)}possiblyEvaluate(e,t,i){const r=e.now||0,n=this.value.possiblyEvaluate(e,t,i),o=this.prior;if(o){if(r>this.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(r<this.begin)return o.possiblyEvaluate(e,t,i);{const a=(r-this.begin)/(this.end-this.begin);
vendor: 4,059 bytes, line 2
2return this.property.interpolate(o.possiblyEvaluate(e,t,i),n,st(a))}}return n}}class pl{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,i){const r=new _l(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(e,t,i);return r}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class fl{constructor(e,t,i,r){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._scope=t,this._options=i,this._iconImageUseTheme=r,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(e){return At(this._values[e].value)}setValue(e,t){this._values[e]=new cl(this._values[e].property,null===t?void 0:At(t),this._scope,this._options,this._iconImageUseTheme),this._values[e].expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[e].isIndoorDependent())}serialize(){const e={};for(const t of Object.keys(this._values)){const i=this.getValue(t);void 0!==i&&(e[t]=i)}return e}possiblyEvaluate(e,t,i,r){const n=new _l(this._properties);for(const o of Object.keys(this._values))n._values[o]=this._values[o].possiblyEvaluate(e,t,i,r);return n}isIndoorDependent(){return this._isIndoorDependent}}class ml{constructor(e,t,i,r){this.property=e,this.value=t,this.parameters=i,this.iconImageUseTheme=r}isConstant(){return"constant"===this.value.kind}constantOr(e){return"constant"===this.value.kind?this.value.value:e}evaluate(e,t,i,r,n){return this.property.evaluate(this.value,this.parameters,e,t,i,r,this.iconImageUseTheme,n)}}class _l{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class gl{constructor(e){this.specification=e}possiblyEvaluate(e,t){return e.expression.evaluate(t)}interpolate(e,t,i){const r=Qr[this.specification.type];return r?r(e,t,i):e}}class yl{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,i,r,n){return"constant"===e.expression.kind||"camera"===e.expression.kind?new ml(this,{kind:"constant",value:e.expression.evaluate(t,null,{},i,r,void 0,n)},t):new ml(this,e.expression,t,n)}interpolate(e,t,i){if("constant"!==e.value.kind||"constant"!==t.value.kind)return e;if(void 0===e.value.value||void 0===t.value.value)return new ml(this,{kind:"constant",value:void 0},e.parameters);const r=Qr[this.specification.type];return r?new ml(this,{kind:"constant",value:r(e.value.value,t.value.value,i)},e.parameters):e}evaluate(e,t,i,r,n,o,a,s){return"constant"===e.kind?e.value:e.evaluate(t,i,r,n,o,s,a)}}class xl{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,r){return!!e.expression.evaluate(t,null,{},i,r)}interpolate(){return!1}}class vl{constructor(e){this.specification=e}possiblyEvaluate(e,t){return function([e,t]){const i=Mt([1,e,t]);return{x:i.x,y:i.y,z:i.z}}(e.expression.evaluate(t))}interpolate(e,t,i){return{x:Wr(e.x,t.x,i),y:Wr(e.y,t.y,i),z:Wr(e.z,t.z,i)}}}class bl{constructor(e){this.specification=e}possiblyEvaluate(e,t){return Mt(e.expression.evaluate(t))}interpolate(e,t,i){return{x:Wr(e.x,t.x,i),y:Wr(e.y,t.y,i),z:Wr(e.z,t.z,i),azimuthal:Wr(e.azimuthal,t.azimuthal,i),polar:Wr(e.polar,t.polar,i)}}}class wl{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const t=new ll(0,{});for(const i in e){const r=e[i],n=r.specification;n&&n.overridable&&this.overridableProperties.push(i);const o=this.defaultPropertyValues[i]=new cl(r,void 0),a=this.defaultTransitionablePropertyValues[i]=new ul(r);this.defaultTransitioningPropertyValues[i]=a.untransitioned(),this.defaultPossiblyEvaluatedValues[i]=o.possiblyEvaluate(t)}}}Rs(yl,"DataDrivenProperty"),Rs(gl,"DataConstantProperty"),Rs(xl,"ColorRampProperty");var El=
vendor: 18,779 bytes, line 2
2JSON.parse('{"expression":1,"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"appearance":{"condition":{"type":"boolean","expression":{"interpolated":1,"parameters":["distance-from-center","feature","feature-state","measure-light","pitch","zoom"]},"property-type":"data-driven"},"name":{"type":"string"},"properties":{"type":"*"}},"function":{"type":{"type":"enum","default":"exponential","values":{"identity":1,"exponential":1,"interval":1,"categorical":1}},"default":{"type":"*"},"expression":1,"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"colorSpace":{"type":"enum","default":"rgb","values":{"rgb":1,"lab":1,"hcl":1}}},"$version":8,"$root":{"transition":{"type":"transition"},"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},"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"},"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":{"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1,"object":{}}},"default":{"type":"*","expression":1},"values":{"type":"array","value":"*"},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}},"id":{"type":"string"},"properties":{"type":"properties"}},"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","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"use-theme":1},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"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":1,"parameters":["zoom"]},"transition":1},"shadow-draw-before-layer":{"type":"string"}},"properties_light_ambient":{"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"use-theme":1},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"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","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"use-theme":1},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"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","default":[-180,-85.051129,180,85.051129],"length":4,"value":"number"},"extra_bounds":{"type":"array","value":{"type":"array","length":4,"value":"number"}},"scheme":{"type":"enum","default":"xyz","values":{"xyz":1,"tms":1}},"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","default":[-180,-85.051129,180,85.051129],"length":4,"value":"number"},"extra_bounds":{"type":"array","value":{"type":"array","length":4,"value":"number"}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","default":"xyz","values":{"xyz":1,"tms":1}},"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","default":[-180,-85.051129,180,85.051129],"length":4,"value":"number"},"extra_bounds":{"type":"array","value":{"type":"array","length":4,"value":"number"}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","default":"mapbox","values":{"terrarium":1,"mapbox":1}},"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","default":[-180,-85.051129,180,85.051129],"length":4,"value":"number"},"extra_bounds":{"type":"array","value":{"type":"array","length":4,"value":"number"}},"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,"minimum":0,"maximum":512},"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","default":[0,0,0],"length":3,"value":"number"}},"modelLightOverrides":{"light-ambient-color":{"type":"color"},"light-ambient-intensity":{"type":"number"},"light-directional-color":{"type":"color"},"light-directional-intensity":{"type":"number"}},"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","default":[0,0],"minimum":[-180,-90],"maximum":[180,90],"length":2,"value":"number"},"orientation":{"type":"array","default":[0,0,0],"length":3,"value":"number"},"lightOverrides":{"type":"modelLightOverrides"},"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}},"url":{"type":"string"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"},"models":{"type":"modelSourceModels"}},"layer":{"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"building":{},"raster":{},"raster-particle":{},"hillshade":{},"model":{},"background":{},"sky":{},"slot":{},"placement-group":{},"clip":{}}},"id":{"type":"string"},"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"}},"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","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_sky":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_model":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"model-id":{"type":"string","default":"","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"model-allow-density-reduction":{"type":"boolean","default":true}},"layout_clip":{"clip-layer-types":{"type":"array","default":[],"value":"enum","values":{"model":1,"symbol":1},"expression":1},"clip-layer-scope":{"type":"array","default":[],"value":"string","expression":1},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"fill-elevation-reference":{"type":"enum","default":"none","values":{"none":1,"hd-road-base":1,"hd-road-markup":1},"expression":1},"fill-construct-bridge-guard-rail":{"type":"boolean","default":"true","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"circle-elevation-reference":{"type":"enum","default":"none","values":{"none":1,"hd-road-markup":1},"expression":1},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_heatmap":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_fill-extrusion":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"fill-extrusion-edge-radius":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"source-max-zoom":{"type":"number","minimum":0,"maximum":24}},"layout_building":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"building-facade":{"type":"boolean","default":false,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-floors":{"type":"number","default":3,"minimum":1,"maximum":200,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-unit-width":{"type":"number","default":3.1,"minimum":1,"maximum":20,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-window":{"type":"array","default":[0.9,0.9],"minimum":0.1,"maximum":1,"length":2,"value":"number","expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-roof-shape":{"type":"enum","default":"flat","values":{"flat":1,"hipped":1,"gabled":1,"parapet":1,"mansard":1,"skillion":1,"pyramidal":1},"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-height":{"type":"number","default":0,"minimum":0,"expression":1,"transition":1,"property-type":"data-driven"},"building-base":{"type":"number","default":0,"minimum":0,"expression":1,"transition":1,"property-type":"data-driven"},"building-flood-light-wall-radius":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"building-flood-light-ground-radius":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"building-flip-roof-orientation":{"type":"boolean","default":false,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"}},"layout_line":{"line-cap":{"type":"enum","default":"butt","values":{"butt":1,"round":1,"square":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-join":{"type":"enum","default":"miter","values":{"bevel":1,"round":1,"miter":1,"none":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":1,"parameters":["zoom"]}},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":1,"parameters":["zoom"]}},"line-sort-key":{"type":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","default":0,"expression":{"parameters":["feature","line-progress","zoom"]},"property-type":"data-driven"},"line-elevation-reference":{"type":"enum","default":"none","values":{"none":1,"sea":1,"ground":1,"hd-road-markup":1},"expression":1},"line-cross-slope":{"type":"number","expression":1},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"line-width-unit":{"type":"enum","default":"pixels","values":{"pixels":1,"meters":1},"expression":{"parameters":["zoom"]}},"line-elevation-ground-scale":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","line-progress","zoom"]},"transition":1,"property-type":"data-driven"}},"layout_symbol":{"symbol-placement":{"type":"enum","default":"point","values":{"point":1,"line":1,"line-center":1},"expression":{"parameters":["zoom"]}},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":1,"parameters":["zoom"]}},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-sort-key":{"type":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","default":"auto","values":{"auto":1,"viewport-y":1,"source":1},"expression":{"parameters":["zoom"]}},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-elevation-reference":{"type":"enum","default":"ground","values":{"sea":1,"ground":1,"hd-road-markup":1},"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","default":"auto","values":{"map":1,"viewport":1,"auto":1},"expression":{"parameters":["zoom"]}},"icon-size":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"icon-size-scale-range":{"type":"array","default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"length":2,"value":"number","expression":1},"icon-text-fit":{"type":"enum","default":"none","values":{"none":1,"width":1,"height":1,"both":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","default":[0,0,0,0],"length":4,"value":"number","expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","expression":{"parameters":["feature","zoom"]},"use-theme":1,"property-type":"data-driven","appearance":1,"tokens":1},"icon-rotate":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]}},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-offset":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"icon-anchor":{"type":"enum","default":"center","values":{"center":1,"left"
vendor: 23,040 bytes, line 2
2:1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","default":"auto","values":{"map":1,"viewport":1,"auto":1},"expression":{"parameters":["zoom"]}},"text-pitch-alignment":{"type":"enum","default":"auto","values":{"map":1,"viewport":1,"auto":1},"expression":{"parameters":["zoom"]}},"text-rotation-alignment":{"type":"enum","default":"auto","values":{"map":1,"viewport":1,"auto":1},"expression":{"parameters":["zoom"]}},"text-field":{"type":"formatted","default":"","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven","tokens":1},"text-font":{"type":"array","default":["Open Sans Regular","Arial Unicode MS Regular"],"value":"string","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"text-size-scale-range":{"type":"array","default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"length":2,"value":"number","expression":1},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-justify":{"type":"enum","default":"center","values":{"auto":1,"left":1,"center":1,"right":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"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","default":"center","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":["feature","zoom"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":1,"parameters":["zoom"]}},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]}},"text-rotate":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]}},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"text-transform":{"type":"enum","default":"none","values":{"none":1,"uppercase":1,"lowercase":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-offset":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"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","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_raster":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_raster-particle":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_hillshade":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"expression":{"parameters":["distance-from-center","feature","pitch","zoom"]},"property-type":"data-driven"},"filter_fill":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_hillshade":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_raster":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_raster-particle":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_clip":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_model":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_line":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_circle":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_fill-extrusion":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_building":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_heatmap":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"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_stop":{"type":"array","minimum":0,"maximum":24,"length":2,"value":["number","color"]},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1}},"camera":{"camera-projection":{"type":"enum","default":"perspective","values":{"perspective":1,"orthographic":1}}},"colorTheme":{"data":{"type":"string","expression":1}},"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","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"use-theme":1},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"projection":{"name":{"type":"enum","default":"mercator","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1}},"center":{"type":"array","minimum":[-180,-90],"maximum":[180,90],"length":2,"value":"number"},"parallels":{"type":"array","minimum":[-90,-90],"maximum":[90,90],"length":2,"value":"number"}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"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,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"fill-outline-color":{"type":"color","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"fill-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1},"fill-z-offset":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"transition":1,"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","expression":{"interpolated":1,"parameters":["feature","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","expression":{"interpolated":1,"parameters":["feature","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","default":"flat","values":{"terrain":1,"flat":1}},"fill-extrusion-base-alignment":{"type":"enum","default":"terrain","values":{"terrain":1,"flat":1}},"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":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1},"fill-extrusion-flood-light-wall-radius":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-flood-light-ground-radius":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"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":1},"fill-extrusion-front-cutoff":{"type":"array","default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]}},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"parameters":[]},"transition":1},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"use-theme":1,"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":1,"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":1,"parameters":["measure-light","zoom"]}},"building-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"building-front-cutoff":{"type":"array","default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]}},"building-flood-light-color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"building-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1},"building-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"line-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"line-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","line-progress","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"}
vendor: 19,045 bytes, line 2
2,"line-blur":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-dasharray":{"type":"array","minimum":0,"value":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"line-gradient":{"type":"color","expression":{"interpolated":1,"parameters":["line-progress"]},"use-theme":1},"line-trim-offset":{"type":"array","default":[0,0],"minimum":[0,0],"maximum":[1,1],"length":2,"value":"number"},"line-trim-fade-range":{"type":"array","default":[0,0],"minimum":[0,0],"maximum":[1,1],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"line-trim-color":{"type":"color","default":"transparent","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["line-progress","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-border-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"line-border-gradient":{"type":"color","expression":{"interpolated":1,"parameters":["line-progress"]},"use-theme":1},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"line-blend-mode":{"type":"enum","default":"default","values":{"default":1,"multiply":1,"additive":1},"expression":{"parameters":["zoom"]}},"line-blend-additive-clamp":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]}},"line-cutout-depth":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"circle-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"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"],"expression":{"interpolated":1,"parameters":["heatmap-density"]},"use-theme":1},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven","appearance":1},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven","appearance":1},"icon-halo-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"appearance":1},"icon-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven","appearance":1,"overridable":1},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven","appearance":1},"text-halo-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-halo-blur":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"appearance":1},"text-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":1},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":1},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":1},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"placement-priority":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["distance-from-center","feature","feature-state","measure-light","pitch","zoom"]},"property-type":"data-driven","appearance":1},"placement-group":{"type":"string","expression":{"parameters":["distance-from-center","feature","feature-state","measure-light","pitch","zoom"]},"property-type":"data-driven","appearance":1}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-color":{"type":"color","expression":{"interpolated":1,"parameters":["raster-value"]},"use-theme":1},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-color-range":{"type":"array","length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-color-scale":{"type":"enum","default":"linear","values":{"linear":1,"log":1},"expression":{"parameters":[]}},"raster-hue-rotate":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-resampling":{"type":"enum","default":"linear","values":{"linear":1,"nearest":1},"expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-elevation-reference":{"type":"enum","default":"sea","values":{"sea":1,"ground":1},"expression":1}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","expression":{"interpolated":1,"parameters":["raster-particle-speed"]},"use-theme":1},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":1,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"hillshade-shadow-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"hillshade-accent-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1}},"paint_background":{"background-pitch-alignment":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1}},"paint_sky":{"sky-type":{"type":"enum","default":"atmosphere","values":{"gradient":1,"atmosphere":1},"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","minimum":[0,0],"maximum":[360,180],"length":2,"value":"number","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","default":[0,0],"minimum":[0,0],"maximum":[360,180],"length":2,"value":"number","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"],"expression":{"interpolated":1,"parameters":["sky-radial-progress"]},"use-theme":1},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":1},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":1},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"model-rotation":{"type":"array","default":[0,0,0],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"model-scale":{"type":"array","default":[1,1,1],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"model-translation":{"type":"array","default":[0,0,0],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"model-color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"model-color-mix-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"transition":1,"property-type":"data-driven"},"model-type":{"type":"enum","default":"common-3d","values":{"common-3d":1,"location-indicator":1}},"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":1,"parameters":["zoom"]},"transition":1},"model-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"transition":1,"property-type":"data-driven"},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"transition":1,"property-type":"data-driven"},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"model-front-cutoff":{"type":"array","default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]}},"model-elevation-reference":{"type":"enum","default":"ground","values":{"sea":1,"ground":1,"hd-road-markup":1},"expression":1},"model-line-cutout-mode":{"type":"enum","default":"enabled","values":{"enabled":1,"disabled":1,"enabled-above-cutout":1},"expression":1}},"promoteId":{"*":{"type":"*"}}}');
vendor: 11,584 bytes, line 2
2function Al(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function Il(e){if(Array.isArray(e))return e.map(Il);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){const t={},i=e;for(const e in i)t[e]=Il(i[e]);return t}return Al(e)}function Sl(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(const t of e.slice(1))if(!Sl(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}function Tl(e,t="",i=null,r="fill"){if(null==e)return{filter:()=>!0,needGeometry:!1,needFeature:!1};Sl(e)||(e=Ll(e));const n=e;let o=!0;try{o=function(e){if(!Pl(e))return e;let t=Il(e);return Ml(t),t=Dl(t),t}(n)}catch(e){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(n,null,2)}\n        `)}let a=null,s=null;if("background"!==r&&"sky"!==r&&"slot"!==r){s=El[`filter_${r}`];const e=Es(o,s,t,i);if("error"===e.result)throw new Error(e.value.map(e=>`${e.key}: ${e.message}`).join(", "));a=(t,i,r)=>e.value.evaluate(t,i,{},r)}let l=null,c=null;if(o!==n){const e=Es(n,s,t,i);if("error"===e.result)throw new Error(e.value.map(e=>`${e.key}: ${e.message}`).join(", "));l=(t,i,r,n,o)=>e.value.evaluate(t,i,{},r,void 0,void 0,n,o),c=!mo(e.value.expression)}return{filter:a,dynamicFilter:l||void 0,needGeometry:zl(o),needFeature:!!c}}function Dl(e){if(!Array.isArray(e))return e;const t=function(e){if(Cl.has(e[0]))for(let t=1;t<e.length;t++)if(Pl(e[t]))return!0;return e}(e);return!0===t?t:t.map(e=>Dl(e))}function Ml(e){let t=!1;const i=[];if("case"===e[0]){for(let r=1;r<e.length-1;r+=2)t=t||Pl(e[r]),i.push(e[r+1]);i.push(e.at(-1))}else if("match"===e[0]){t=t||Pl(e[1]);for(let t=2;t<e.length-1;t+=2)i.push(e[t+1]);i.push(e.at(-1))}else if("step"===e[0]){t=t||Pl(e[1]);for(let t=1;t<e.length-1;t+=2)i.push(e[t+1])}t&&(e.length=0,e.push("any",...i));for(let r=1;r<e.length;r++)Ml(e[r])}function Pl(e){if(!Array.isArray(e))return!1;if("pitch"===(t=e[0])||"distance-from-center"===t)return!0;var t;for(let i=1;i<e.length;i++)if(Pl(e[i]))return!0;return!1}const Cl=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function Rl(e,t){return e<t?-1:e>t?1:0}function zl(e){if(!Array.isArray(e))return!1;if("within"===e[0]||"distance"===e[0])return!0;for(let t=1;t<e.length;t++)if(zl(e[t]))return!0;return!1}function Ll(e){if(!e)return!0;const t=e[0];return e.length<=1?"any"!==t:"=="===t?Fl(e[1],e[2],"=="):"!="===t?kl(Fl(e[1],e[2],"==")):"<"===t||">"===t||"<="===t||">="===t?Fl(e[1],e[2],t):"any"===t?(i=e.slice(1),["any"].concat(i.map(Ll))):"all"===t?["all"].concat(e.slice(1).map(Ll)):"none"===t?["all"].concat(e.slice(1).map(Ll).map(kl)):"in"===t?Ol(e[1],e.slice(2)):"!in"===t?kl(Ol(e[1],e.slice(2))):"has"===t?Bl(e[1]):"!has"!==t||kl(Bl(e[1]));var i}function Fl(e,t,i){switch(e){case"$type":return[`filter-type-${i}`,t];case"$id":return[`filter-id-${i}`,t];default:return[`filter-${i}`,e,t]}}function Ol(e,t){if(0===t.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(e=>typeof e!=typeof t[0])?["filter-in-large",e,["literal",t.sort(Rl)]]:["filter-in-small",e,["literal",t]]}}function Bl(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function kl(e){return["!",e]}const Vl="\x1f";function Nl(e){return e.includes(Vl)}function Ul(e,t){return t?`${e}${Vl}${t}`:e}function jl(e){const t=e.indexOf(Vl);return t>=0?e.slice(0,t):e}function Gl(e){const t=e.indexOf(Vl);return t>=0?e.slice(t+1):""}let Hl,$l=1;const Wl=()=>Hl||(Hl=new wl({"icon-size":new yl(El.layout_symbol["icon-size"]),"icon-image":new yl(El.layout_symbol["icon-image"]),"icon-rotate":new yl(El.layout_symbol["icon-rotate"]),"icon-offset":new yl(El.layout_symbol["icon-offset"]),"text-size":new yl(El.layout_symbol["text-size"]),"text-rotate":new yl(El.layout_symbol["text-rotate"]),"text-offset":new yl(El.layout_symbol["text-offset"])}));let ql;const Zl=()=>ql||(ql=new wl({"icon-opacity":new yl(El.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new yl(El.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new yl(El.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new yl(El.paint_symbol["text-emissive-strength"]),"icon-color":new yl(El.paint_symbol["icon-color"]),"icon-halo-color":new yl(El.paint_symbol["icon-halo-color"]),"icon-halo-width":new yl(El.paint_symbol["icon-halo-width"]),"icon-halo-blur":new yl(El.paint_symbol["icon-halo-blur"]),"icon-translate":new yl(El.paint_symbol["icon-translate"]),"text-opacity":new yl(El.paint_symbol["text-opacity"]),"text-occlusion-opacity":new yl(El.paint_symbol["text-occlusion-opacity"]),"text-color":new yl(El.paint_symbol["text-color"],{runtimeType:sn,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new yl(El.paint_symbol["text-halo-color"]),"text-halo-width":new yl(El.paint_symbol["text-halo-width"]),"text-halo-blur":new yl(El.paint_symbol["text-halo-blur"]),"text-translate":new yl(El.paint_symbol["text-translate"]),"symbol-z-offset":new yl(El.paint_symbol["symbol-z-offset"]),"placement-priority":new yl(El.paint_symbol["placement-priority"]),"placement-group":new yl(El.paint_symbol["placement-group"]),"icon-color-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"})}));class Xl{constructor(e,t,i,r,n,o){this._conditionSpec=e,this._propertiesSpec=i;const a=Es(e,El.appearance.condition);if("success"===a.result&&(this.condition=a.value),this.name=t,i){this.layoutProperties=new _l(Wl()),this.unevaluatedLayout=new fl(Wl(),r,n,o),this.paintProperties=new _l(Zl()),this.unevaluatedPaint=new fl(Zl(),r,n,"");for(const e in i)e in this.unevaluatedLayout._values?this.unevaluatedLayout.setValue(e,i[e]):e in this.unevaluatedPaint._values&&this.unevaluatedPaint.setValue(e,i[e])}}isActive(e){return!(this.condition||!e.isHidden||"hidden"!==this.name)||this.condition.evaluate(e.globals,e.feature,e.featureState,e.canonical)}getCondition(){return this.condition}getName(){return this.name}getLayoutProperty(e){return this.layoutProperties.get(e)}getPaintProperty(e){return this.paintProperties.get(e)}getUnevaluatedLayoutProperties(){return this.unevaluatedLayout}getUnevaluatedLayoutProperty(e){return this.unevaluatedLayout._values[e]}getUnevaluatedPaintProperty(e){return this.unevaluatedPaint._values[e]}recalculate(e,t,i){this.unevaluatedLayout&&(this.layoutProperties=this.unevaluatedLayout.possiblyEvaluate(e,void 0,t,i)),this.unevaluatedPaint&&(this.paintProperties=this.unevaluatedPaint.possiblyEvaluate(e,void 0,t,""))}serialize(){const e={};e.condition=this.condition.expression.serialize(),this.name&&(e.name=this.name);const t={...this.unevaluatedLayout?this.unevaluatedLayout.serialize():{},...this.unevaluatedPaint?this.unevaluatedPaint.serialize():{}};return Object.keys(t).length>0&&(e.properties=t),e}hasIconLayoutProperties(){const e=this.hasLayoutProperty("icon-image"),t=this.hasLayoutProperty("icon-size"),i=this.hasLayoutProperty("icon-offset"),r=this.hasLayoutProperty("icon-rotate");return e||t||i||r}hasTextLayoutProperties(){const e=this.hasLayoutProperty("text-size"),t=this.hasLayoutProperty("text-offset"),i=this.hasLayoutProperty("text-rotate");return e||t||i}hasIconPaintProperties(){return!!this.unevaluatedPaint&&Object.keys(this.unevaluatedPaint._values).filter(e=>!e.endsWith("-use-theme")).some(e=>(e.startsWith("icon-")||"symbol-z-offset"===e)&&this.hasPaintProperty(e))}hasTextPaintProperties(){return!!this.unevaluatedPaint&&Object.keys(this.unevaluatedPaint._values).filter(e=>!e.endsWith("-use-theme")).some(e=>(e.startsWith("text-")||"symbol-z-offset"===e)&&this.hasPaintProperty(e))}hasLayoutProperty(e){return this.unevaluatedLayout&&void 0!==this.unevaluatedLayout._values[e].value}hasPaintProperty(e){return this.unevaluatedPaint&&void 0!==this.unevaluatedPaint._values[e].value}}const Yl="-transition",Kl=new Set(["fill","line","background","hillshade","raster"]);class Jl extends Nr{constructor(e,t,i,r,n,o){if(super(),this.id=e.id,this.fqid=Ul(this.id,i),this.runtimeLayerUID=$l++,this.type=e.type,this.scope=i,this.lut=r,this.options=n,this.iconImageUseTheme=o,this.appearances=new Array,this.appearancesVersion=0,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,"custom"!==e.type&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type&&"background"!==e.type&&"sky"!==e.type&&"slot"!==e.type&&"placement-group"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),e.slot&&(this.slot=e.slot),e.appearances&&this.setAppearances(e.appearances),t.layout&&(this._unevaluatedLayout=new fl(t.layout,this.scope,n,this.iconImageUseTheme)),t.paint)){this._transitionablePaint=new hl(t.paint,this.scope,n);for(const t in e.paint)this.setPaintProperty(t,e.paint[t]);for(const t in e.layout)this.setLayoutProperty(t,e.layout[t]);this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new _l(t.paint)}}onAdd(e){}onRemove(e){}placeSymbols(e,t,i,r,n){}isDraped(e){return!this.is3D(!0)&&Kl.has(this.type)}getLayoutProperty(e){return"visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,t){if("custom"===this.type&&"visibility"===e)return void(this.visibility=t);const i=this._unevaluatedLayout;i._properties.properties[e]&&(i.setValue(e,t),"visibility"===e&&this.possiblyEvaluateVisibility())}setAppearances(e){this.appearances=[],e.forEach(e=>{this.appearances.push(new Xl(e.condition,e.name,e.properties,this.scope,this.options,this.iconImageUseTheme))}),this.appearancesVersion++}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(e){return e.endsWith(Yl)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}isPaintProperty(e){return!!this._transitionablePaint._properties.properties[e]}setPaintProperty(e,t){const i=this._transitionablePaint,r=i._properties.properties;if(e.endsWith(Yl)){const n=e.slice(0,-11);return r[n]&&i.setTransition(n,t||void 0),!1}if(!r[e])return!1;const n=i._values[e],o=n.value.isDataDriven(),a=n.value;i.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);const s=i._values[e].value,l=s.isDataDriven(),c=e.endsWith("pattern")||"line-dasharray"===e;return l||o||c||this._handleOverridablePaintPropertyUpdate(e,a,s)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,t,i){return null}_handleOverridablePaintPropertyUpdate(e,t,i){return!1}
vendor: 4,538 bytes, line 2
2isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||"none"===this.visibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t,this.iconImageUseTheme)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){const e={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&&(e.appearances=this.appearances.map(e=>e.serialize())),Et(e,(e,t)=>!(void 0===e||"layout"===t&&!Object.keys(e).length||"paint"===t&&!Object.keys(e).length))}is3D(e){return!1}hasElevation(){return!1}mayUse(e){return!1}prepare(){return Promise.resolve()}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 e in this.paint._values){const t=this.paint.get(e);if(t instanceof ml&&cs(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}for(const e of this.appearances)if(!_o(e.condition.expression))return!0;return!1}compileFilter(e){this._filterCompiled||(this._featureFilter=Tl(this.filter,this.scope,e),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}dynamicFilterNeedsGeometry(){return this._featureFilter.needGeometry}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(e){this._stats&&("shadow"===e.renderPass?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}getAppearances(){return this.appearances}queryRenderedFeatures(e,t,i){return{}}queryRadius(e){}queryIntersectsFeature(e,t,i,r,n,o,a,s,l,c){}}function Ql(e,t,i){if(!e._unevaluatedLayout)return!1;const r=e._unevaluatedLayout.getValue(t);return void 0!==r&&("string"!=typeof r||i(r))}function ec(e,t,i=2){const r=t&&t.length,n=r?t[0]*i:e.length;let o=tc(e,0,n,i,!0);const a=[];if(!o||o.next===o.prev)return a;let s,l,c;if(r&&(o=function(e,t,i,r){const n=[];for(let o=0,a=t.length;o<a;o++){const i=tc(e,t[o]*r,o<a-1?t[o+1]*r:e.length,r,!1);i===i.next&&(i.steiner=!0),n.push(dc(i))}n.sort(lc);for(let o=0;o<n.length;o++)i=cc(n[o],i);return i}(e,t,o,i)),e.length>80*i){s=e[0],l=e[1];let t=s,r=l;for(let o=i;o<n;o+=i){const i=e[o],n=e[o+1];i<s&&(s=i),n<l&&(l=n),i>t&&(t=i),n>r&&(r=n)}c=Math.max(t-s,r-l),c=0!==c?32767/c:0}return rc(o,a,i,s,l,c,0),a}function tc(e,t,i,r,n){let o;if(n===function(e,t,i,r){let n=0;for(let o=t,a=i-r;o<i;o+=r)n+=(e[a]-e[o])*(e[o+1]+e[a+1]),a=o;return n}(e,t,i,r)>0)for(let a=t;a<i;a+=r)o=Ec(a/r|0,e[a],e[a+1],o);else for(let a=i-r;a>=t;a-=r)o=Ec(a/r|0,e[a],e[a+1],o);return o&&gc(o,o.next)&&(Ac(o),o=o.next),o}function ic(e,t){if(!e)return e;t||(t=e);let i,r=e;do{if(i=!1,r.steiner||!gc(r,r.next)&&0!==_c(r.prev,r,r.next))r=r.next;else{if(Ac(r),r=t=r.prev,r===r.next)break;i=!0}}while(i||r!==t);return t}function rc(e,t,i,r,n,o,a){if(!e)return;!a&&o&&function(e,t,i,r){let n=e;do{0===n.z&&(n.z=hc(n.x,n.y,t,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){let t,i=1;do{let r,n=e;e=null;let o=null;for(t=0;n;){t++;let a=n,s=0;for(let e=0;e<i&&(s++,a=a.nextZ,a);e++);let l=i;for(;s>0||l>0&&a;)0!==s&&(0===l||!a||n.z<=a.z)?(r=n,n=n.nextZ,s--):(r=a,a=a.nextZ,l--),o?o.nextZ=r:e=r,r.prevZ=o,o=r;n=a}o.nextZ=null,i*=2}while(t>1)}(n)}(e,r,n,o);let s=e;for(;e.prev!==e.next;){const l=e.prev,c=e.next;if(o?oc(e,r,n,o):nc(e))t.push(l.i,e.i,c.i),Ac(e),e=c.next,s=c.next;else if((e=c)===s){a?1===a?rc(e=ac(ic(e),t),t,i,r,n,o,2):2===a&&sc(e,t,i,r,n,o):rc(ic(e),t,i,r,n,o,1);break}}}function nc(e){const t=e.prev,i=e,r=e.next;if(_c(t,i,r)>=0)return!1;const n=t.x,o=i.x,a=r.x,s=t.y,l=i.y,c=r.y,u=Math.min(n,o,a),h=Math.min(s,l,c),d=Math.max(n,o,a),p=Math.max(s,l,c);let f=r.next;for(;f!==t;){if(f.x>=u&&f.x<=d&&f.y>=h&&f.y<=p&&fc(n,s,o,l,a,c,f.x,f.y)&&_c(f.prev,f,f.next)>=0)return!1;
vendor: 4,863 bytes, line 2
2f=f.next}return!0}function oc(e,t,i,r){const n=e.prev,o=e,a=e.next;if(_c(n,o,a)>=0)return!1;const s=n.x,l=o.x,c=a.x,u=n.y,h=o.y,d=a.y,p=Math.min(s,l,c),f=Math.min(u,h,d),m=Math.max(s,l,c),_=Math.max(u,h,d),g=hc(p,f,t,i,r),y=hc(m,_,t,i,r);let x=e.prevZ,v=e.nextZ;for(;x&&x.z>=g&&v&&v.z<=y;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=_&&x!==n&&x!==a&&fc(s,u,l,h,c,d,x.x,x.y)&&_c(x.prev,x,x.next)>=0)return!1;if(x=x.prevZ,v.x>=p&&v.x<=m&&v.y>=f&&v.y<=_&&v!==n&&v!==a&&fc(s,u,l,h,c,d,v.x,v.y)&&_c(v.prev,v,v.next)>=0)return!1;v=v.nextZ}for(;x&&x.z>=g;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=_&&x!==n&&x!==a&&fc(s,u,l,h,c,d,x.x,x.y)&&_c(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;v&&v.z<=y;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=_&&v!==n&&v!==a&&fc(s,u,l,h,c,d,v.x,v.y)&&_c(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function ac(e,t){let i=e;do{const r=i.prev,n=i.next.next;!gc(r,n)&&yc(r,i,i.next,n)&&bc(r,n)&&bc(n,r)&&(t.push(r.i,i.i,n.i),Ac(i),Ac(i.next),i=e=n),i=i.next}while(i!==e);return ic(i)}function sc(e,t,i,r,n,o){let a=e;do{let e=a.next.next;for(;e!==a.prev;){if(a.i!==e.i&&mc(a,e)){let s=wc(a,e);return a=ic(a,a.next),s=ic(s,s.next),rc(a,t,i,r,n,o,0),void rc(s,t,i,r,n,o,0)}e=e.next}a=a.next}while(a!==e)}function lc(e,t){let i=e.x-t.x;return 0===i&&(i=e.y-t.y,0===i)&&(i=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)),i}function cc(e,t){const i=function(e,t){let i=t;const r=e.x,n=e.y;let o,a=-1/0;if(gc(e,i))return i;do{if(gc(e,i.next))return i.next;if(n<=i.y&&n>=i.next.y&&i.next.y!==i.y){const e=i.x+(n-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(e<=r&&e>a&&(a=e,o=i.x<i.next.x?i:i.next,e===r))return o}i=i.next}while(i!==t);if(!o)return null;const s=o,l=o.x,c=o.y;let u=1/0;i=o;do{if(r>=i.x&&i.x>=l&&r!==i.x&&pc(n<c?r:a,n,l,c,n<c?a:r,n,i.x,i.y)){const t=Math.abs(n-i.y)/(r-i.x);bc(i,e)&&(t<u||t===u&&(i.x>o.x||i.x===o.x&&uc(o,i)))&&(o=i,u=t)}i=i.next}while(i!==s);return o}(e,t);if(!i)return t;const r=wc(i,e);return ic(r,r.next),ic(i,i.next)}function uc(e,t){return _c(e.prev,e,t.prev)<0&&_c(t.next,e,e.next)<0}function hc(e,t,i,r,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function dc(e){let t=e,i=e;do{(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next}while(t!==e);return i}function pc(e,t,i,r,n,o,a,s){return(n-a)*(t-s)>=(e-a)*(o-s)&&(e-a)*(r-s)>=(i-a)*(t-s)&&(i-a)*(o-s)>=(n-a)*(r-s)}function fc(e,t,i,r,n,o,a,s){return!(e===a&&t===s)&&pc(e,t,i,r,n,o,a,s)}function mc(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&yc(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(bc(e,t)&&bc(t,e)&&function(e,t){let i=e,r=!1;const n=(e.x+t.x)/2,o=(e.y+t.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&n<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==e);return r}(e,t)&&(_c(e.prev,e,t.prev)||_c(e,t.prev,t))||gc(e,t)&&_c(e.prev,e,e.next)>0&&_c(t.prev,t,t.next)>0)}function _c(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function gc(e,t){return e.x===t.x&&e.y===t.y}function yc(e,t,i,r){const n=vc(_c(e,t,i)),o=vc(_c(e,t,r)),a=vc(_c(i,r,e)),s=vc(_c(i,r,t));return n!==o&&a!==s||!(0!==n||!xc(e,i,t))||!(0!==o||!xc(e,r,t))||!(0!==a||!xc(i,e,r))||!(0!==s||!xc(i,t,r))}function xc(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function vc(e){return e>0?1:e<0?-1:0}function bc(e,t){return _c(e.prev,e,e.next)<0?_c(e,t,e.next)>=0&&_c(e,e.prev,t)>=0:_c(e,t,e.prev)<0||_c(e,e.next,t)<0}function wc(e,t){const i=Ic(e.i,e.x,e.y),r=Ic(t.i,t.x,t.y),n=e.next,o=t.prev;return e.next=t,t.prev=e,i.next=n,n.prev=i,r.next=i,i.prev=r,o.next=r,r.prev=o,r}function Ec(e,t,i,r){const n=Ic(e,t,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function Ac(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Ic(e,t,i){return{i:e,x:t,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Sc(e,t,i=1){if(!e)return null;const r="string"==typeof e?En.from(e).getPrimary():e.getPrimary(),n="string"==typeof e?null:e.getSecondary();for(const o of[r,n]){if(!o)continue;const e=o.id.toString();t.has(e)||t.set(e,[]),o.scaleSelf(i),t.get(e).push(o)}return{primary:r.toString(),secondary:n?n.toString():null}}function Tc(e,t,i,r){const n=r.patternDependencies;let o=!1;for(const a of t){const t=a.paint.get(`${e}-pattern`);t.isConstant()||(o=!0),Sc(t.constantOr(null),n,i)&&(o=!0)}return o}function Dc(e,t,i,r,n,o){const a=o.patternDependencies;for(const s of t){const t=s.paint.get(`${e}-pattern`).value;if("constant"!==t.kind){const e=Sc(t.evaluate({zoom:r},i,{},void 0,o.availableImages),a,n);if(!e)continue;const{primary:l,secondary:c}=e;
vendor: 4,472 bytes, line 2
2l&&(i.patterns[s.id]=[l,c].filter(Boolean))}}return i}const Mc=co/Math.PI/2,Pc=64,Cc=[Pc,32,16],Rc=-Mc,zc=Mc;function Lc(e,t,i,r=Mc){return i=nt(i),[e*Math.sin(i)*r,-t*r,e*Math.cos(i)*r]}function Fc(e,t,i){return Lc(Math.cos(nt(e)),Math.sin(nt(e)),t,i)}const Oc=6371008.8,Bc=2*Math.PI*Oc;class kc{constructor(e,t){if(isNaN(e)||isNaN(t))throw new Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new kc(pt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const t=Math.PI/180,i=this.lat*t,r=e.lat*t,n=Math.sin(i)*Math.sin(r)+Math.cos(i)*Math.cos(r)*Math.cos((e.lng-this.lng)*t);return Oc*Math.acos(Math.min(n,1))}toBounds(e=0){const t=360*e/40075017,i=t/Math.cos(Math.PI/180*this.lat);return new Vc({lng:this.lng-i,lat:this.lat-t},{lng:this.lng+i,lat:this.lat+t})}toEcef(e){return Fc(this.lat,this.lng,Mc+e*Mc/Oc)}static convert(e){if(e instanceof kc)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new kc(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new kc(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class Vc{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):Array.isArray(e)&&4===e.length?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1]))}setNorthEast(e){return this._ne=e instanceof kc?new kc(e.lng,e.lat):kc.convert(e),this}setSouthWest(e){return this._sw=e instanceof kc?new kc(e.lng,e.lat):kc.convert(e),this}extend(e){const t=this._sw,i=this._ne;let r,n;if(e instanceof kc)r=e,n=e;else{if(!(e instanceof Vc))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(Vc.convert(e)):this.extend(kc.convert(e)):"object"==typeof e&&null!==e&&Object.hasOwn(e,"lat")&&(Object.hasOwn(e,"lon")||Object.hasOwn(e,"lng"))?this.extend(kc.convert(e)):this;if(r=e._sw,n=e._ne,!r||!n)return this}return t||i?(t.lng=Math.min(r.lng,t.lng),t.lat=Math.min(r.lat,t.lat),i.lng=Math.max(n.lng,i.lng),i.lat=Math.max(n.lat,i.lat)):(this._sw=new kc(r.lng,r.lat),this._ne=new kc(n.lng,n.lat)),this}getCenter(){return new kc((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 kc(this.getWest(),this.getNorth())}getSouthEast(){return new kc(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:t,lat:i}=kc.convert(e);let r=this._sw.lng<=t&&t<=this._ne.lng;return this._sw.lng>this._ne.lng&&(r=this._sw.lng>=t&&t>=this._ne.lng),this._sw.lat<=i&&i<=this._ne.lat&&r}static convert(e){if(e)return e instanceof Vc?e:new Vc(e)}}function Nc(e){return Bc*Math.cos(e*Math.PI/180)}function Uc(e,t){return e/Nc(t)}function jc(e,t){return e*Nc(Xn(t))}const Gc=85.051129;function Hc(e){return Math.cos(nt(ht(e,-85.051129,Gc)))}function $c(e,t){const i=ht(t,0,25.5),r=Math.pow(2,i);return Hc(e)*Bc/(512*r)}function Wc(e){return 1/Math.cos(e*Math.PI/180)}function qc(e,t=0){const i=Math.exp(Math.PI*(1-(e.y+t/co)/(1<<e.z)*2));return 80150034*i/(i*i+1)/co/(1<<e.z)}class Zc{constructor(e,t,i=0){this.x=+e,this.y=+t,this.z=+i}static fromLngLat(e,t=0){const i=kc.convert(e);return new Zc(Wn(i.lng),qn(i.lat),Uc(t,i.lat))}toLngLat(){return new kc(Zn(this.x),Xn(this.y))}toAltitude(){return jc(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Bc*Wc(Xn(this.y))}}function Xc(e,t,i,r,n,o,a,s,l){const c=(t+r)/2,u=(i+n)/2,h=new ke(c,u);s(h),function(e,t,i,r,n,o){const a=i-n,s=r-o;return Math.abs((r-t)*a-(i-e)*s)/Math.hypot(a,s)}(h.x,h.y,o.x,o.y,a.x,a.y)>=l?(Xc(e,t,i,c,u,o,h,s,l),Xc(e,c,u,r,n,h,a,s,l)):e.push(a)}function Yc(e,t,i){let r=e[0],n=r.x,o=r.y;t(r);const a=[r];for(let s=1;s<e.length;s++){const l=e[s],{x:c,y:u}=l;t(l),Xc(a,n,o,c,u,r,l,t,i),n=c,o=u,r=l}return a}function Kc(e,t,i,r){if(r(t,i)){const n=t.add(i)._mult(.5);Kc(e,t,n,r),Kc(e,n,i,r)}else e.push(i)}
vendor: 9,246 bytes, line 2
2function Jc(e,t){let i=e[0];const r=[i];for(let n=1;n<e.length;n++){const o=e[n];Kc(r,i,o,t),i=o}return r}const Qc=Math.pow(2,14)-1,eu=-Qc-1;function tu(e,t){const i=Math.round(e.x*t),r=Math.round(e.y*t);return e.x=ht(i,eu,Qc),e.y=ht(r,eu,Qc),(i<e.x||i>e.x+1||r<e.y||r>e.y+1)&&Tt("Geometry exceeds allowed extent, reduce your vector tile buffer size"),e}function iu(e,t,i){const r=e.loadGeometry(),n=e.extent,o=co/n;if(t&&i&&i.projection.isReprojectedInTileSpace){const o=1<<t.z,{scale:a,x:s,y:l,projection:c}=i,u=e=>{const i=Zn((t.x+e.x/n)/o),r=Xn((t.y+e.y/n)/o),u=c.project(i,r);e.x=(u.x*a-s)*n,e.y=(u.y*a-l)*n};for(let t=0;t<r.length;t++)if(1!==e.type)r[t]=Yc(r[t],u,1);else{const e=[];for(const i of r[t])i.x<0||i.x>=n||i.y<0||i.y>=n||(u(i),e.push(i));r[t]=e}}for(const a of r)for(const e of a)tu(e,o);return r}function ru(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?iu(e):[]}}const nu={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class ou{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}const au=new ArrayBuffer(0);class su{constructor(){this._reallocCount=0,this.capacity=0,this.length=0}static serialize(e,t){return e._trim(),t&&e.arrayBuffer&&t.add(e.arrayBuffer),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,e.arrayBuffer?t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement:(t.capacity=0,t.arrayBuffer=au),t._refreshViews(),t}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}resizeExact(e){this.reserveExact(e),this.length=e}reserve(e){e>this.capacity&&this._allocate(Math.max(e,Math.floor(5*this.capacity),128))}reserveExact(e){(e>this.capacity||!this.arrayBuffer)&&this._allocate(e)}_allocate(e){this._reallocCount++,this.capacity=e,this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}reserveForAdditional(e){this.reserve(this.length+e)}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...e){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...e){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 lu(e,t=1){let i=0,r=0;return{members:e.map(e=>{const n=nu[e.type].BYTES_PER_ELEMENT,o=i=cu(i,Math.max(t,n)),a=e.components||1;return r=Math.max(r,n),i+=n*a,{name:e.name,type:e.type,components:a,offset:o,normalized:e.normalized}}),size:cu(i,Math.max(r,t)),alignment:t}}function cu(e,t){return Math.ceil(e/t)*t}class uu extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const r=2*e;return this.int16[r+0]=t,this.int16[r+1]=i,e}}uu.prototype.bytesPerElement=4,Rs(uu,"StructArrayLayout2i4");class hu extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=3*e;return this.int16[n+0]=t,this.int16[n+1]=i,this.int16[n+2]=r,e}}hu.prototype.bytesPerElement=6,Rs(hu,"StructArrayLayout3i6");class du extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=4*e;return this.int16[o+0]=t,this.int16[o+1]=i,this.uint16[o+2]=r,this.uint16[o+3]=n,e}}du.prototype.bytesPerElement=8,Rs(du,"StructArrayLayout2i2ui8");class pu extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.float32[1*e+0]=t,e}}pu.prototype.bytesPerElement=4,Rs(pu,"StructArrayLayout1f4");class fu extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=4*e,o=2*e;return this.int16[n+0]=t,this.int16[n+1]=i,this.float32[o+1]=r,e}}fu.prototype.bytesPerElement=8,Rs(fu,"StructArrayLayout2i1f8");class mu extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=4*e;return this.int16[n+0]=t,this.int16[n+1]=i,this.int16[n+2]=r,e}}mu.prototype.bytesPerElement=8,Rs(mu,"StructArrayLayout3i8");class _u extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=4*e;return this.int16[o+0]=t,this.int16[o+1]=i,this.int16[o+2]=r,this.int16[o+3]=n,e}}_u.prototype.bytesPerElement=8,Rs(_u,"StructArrayLayout4i8");class gu extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n)}emplace(e,t,i,r,n,o){const a=5*e;return this.int16[a+0]=t,this.int16[a+1]=i,this.int16[a+2]=r,this.int16[a+3]=n,this.int16[a+4]=o,e}}gu.prototype.bytesPerElement=10,Rs(gu,"StructArrayLayout5i10");class yu extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,a){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,o,a)}emplace(e,t,i,r,n,o,a,s){const l=6*e,c=12*e,u=3*e;return this.int16[l+0]=t,this.int16[l+1]=i,this.uint8[c+4]=r,this.uint8[c+5]=n,this.uint8[c+6]=o,this.uint8[c+7]=a,this.float32[u+2]=s,e}}yu.prototype.bytesPerElement=12,Rs(yu,"StructArrayLayout2i4ub1f12");class xu extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=3*e;return this.float32[n+0]=t,this.float32[n+1]=i,this.float32[n+2]=r,e}}xu.prototype.bytesPerElement=12,Rs(xu,"StructArrayLayout3f12");class vu extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n)}emplace(e,t,i,r,n,o){const a=6*e,s=3*e;return this.uint16[a+0]=t,this.uint16[a+1]=i,this.uint16[a+2]=r,this.uint16[a+3]=n,this.float32[s+2]=o,e}}vu.prototype.bytesPerElement=12,Rs(vu,"StructArrayLayout4ui1f12");class bu extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=4*e;return this.uint16[o+0]=t,this.uint16[o+1]=i,this.uint16[o+2]=r,this.uint16[o+3]=n,e}}bu.prototype.bytesPerElement=8,Rs(bu,"StructArrayLayout4ui8");class wu extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n,o)}emplace(e,t,i,r,n,o,a){const s=6*e;return this.int16[s+0]=t,this.int16[s+1]=i,this.int16[s+2]=r,this.int16[s+3]=n,this.int16[s+4]=o,this.int16[s+5]=a,e}}wu.prototype.bytesPerElement=12,Rs(wu,"StructArrayLayout6i12");class Eu extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,a,s,l,c,u,h){const d=this.length;return this.resize(d+1),this.emplace(d,e,t,i,r,n,o,a,s,l,c,u,h)}emplace(e,t,i,r,n,o,a,s,l,c,u,h,d){const p=12*e;return this.int16[p+0]=t,this.int16[p+1]=i,this.int16[p+2]=r,this.int16[p+3]=n,this.uint16[p+4]=o,this.uint16[p+5]=a,this.uint16[p+6]=s,this.uint16[p+7]=l,this.int16[p+8]=c,this.int16[p+9]=u,this.int16[p+10]=h,this.int16[p+11]=d,e}}Eu.prototype.bytesPerElement=24,Rs(Eu,"StructArrayLayout4i4ui4i24");class Au extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n,o)}
vendor: 14,658 bytes, line 2
2emplace(e,t,i,r,n,o,a){const s=10*e,l=5*e;return this.int16[s+0]=t,this.int16[s+1]=i,this.int16[s+2]=r,this.float32[l+2]=n,this.float32[l+3]=o,this.float32[l+4]=a,e}}Au.prototype.bytesPerElement=20,Rs(Au,"StructArrayLayout3i3f20");class Iu extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=4*e;return this.float32[o+0]=t,this.float32[o+1]=i,this.float32[o+2]=r,this.float32[o+3]=n,e}}Iu.prototype.bytesPerElement=16,Rs(Iu,"StructArrayLayout4f16");class Su extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint32[1*e+0]=t,e}}Su.prototype.bytesPerElement=4,Rs(Su,"StructArrayLayout1ul4");class Tu extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const r=2*e;return this.uint16[r+0]=t,this.uint16[r+1]=i,e}}Tu.prototype.bytesPerElement=4,Rs(Tu,"StructArrayLayout2ui4");class Du extends su{_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(e,t,i,r,n,o,a,s,l,c,u,h,d){const p=this.length;return this.resize(p+1),this.emplace(p,e,t,i,r,n,o,a,s,l,c,u,h,d)}emplace(e,t,i,r,n,o,a,s,l,c,u,h,d,p){const f=20*e,m=10*e;return this.int16[f+0]=t,this.int16[f+1]=i,this.int16[f+2]=r,this.int16[f+3]=n,this.int16[f+4]=o,this.float32[m+3]=a,this.float32[m+4]=s,this.float32[m+5]=l,this.float32[m+6]=c,this.int16[f+14]=u,this.uint32[m+8]=h,this.uint16[f+18]=d,this.uint16[f+19]=p,e}}Du.prototype.bytesPerElement=40,Rs(Du,"StructArrayLayout5i4f1i1ul2ui40");class Mu extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,a){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,o,a)}emplace(e,t,i,r,n,o,a,s){const l=8*e;return this.int16[l+0]=t,this.int16[l+1]=i,this.int16[l+2]=r,this.int16[l+4]=n,this.int16[l+5]=o,this.int16[l+6]=a,this.int16[l+7]=s,e}}Mu.prototype.bytesPerElement=16,Rs(Mu,"StructArrayLayout3i2i2i16");class Pu extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n)}emplace(e,t,i,r,n,o){const a=4*e,s=8*e;return this.float32[a+0]=t,this.float32[a+1]=i,this.float32[a+2]=r,this.int16[s+6]=n,this.int16[s+7]=o,e}}Pu.prototype.bytesPerElement=16,Rs(Pu,"StructArrayLayout2f1f2i16");class Cu extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n,o)}emplace(e,t,i,r,n,o,a){const s=20*e,l=5*e;return this.uint8[s+0]=t,this.uint8[s+1]=i,this.float32[l+1]=r,this.float32[l+2]=n,this.float32[l+3]=o,this.float32[l+4]=a,e}}Cu.prototype.bytesPerElement=20,Rs(Cu,"StructArrayLayout2ub4f20");class Ru extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=3*e;return this.uint16[n+0]=t,this.uint16[n+1]=i,this.uint16[n+2]=r,e}}Ru.prototype.bytesPerElement=6,Rs(Ru,"StructArrayLayout3ui6");class zu extends su{_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(e,t,i,r,n,o,a,s,l,c,u,h,d,p,f,m,_,g,y,x,v){const b=this.length;return this.resize(b+1),this.emplace(b,e,t,i,r,n,o,a,s,l,c,u,h,d,p,f,m,_,g,y,x,v)}emplace(e,t,i,r,n,o,a,s,l,c,u,h,d,p,f,m,_,g,y,x,v,b){const w=30*e,E=15*e,A=60*e;return this.int16[w+0]=t,this.int16[w+1]=i,this.int16[w+2]=r,this.float32[E+2]=n,this.float32[E+3]=o,this.uint16[w+8]=a,this.uint16[w+9]=s,this.uint32[E+5]=l,this.uint32[E+6]=c,this.uint32[E+7]=u,this.uint16[w+16]=h,this.uint16[w+17]=d,this.uint16[w+18]=p,this.float32[E+10]=f,this.float32[E+11]=m,this.uint8[A+48]=_,this.uint8[A+49]=g,this.uint8[A+50]=y,this.uint32[E+13]=x,this.int16[w+28]=v,this.uint8[A+58]=b,e}}zu.prototype.bytesPerElement=60,Rs(zu,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class Lu extends su{_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(e,t,i,r,n,o,a,s,l,c,u,h,d,p,f,m,_,g,y,x,v,b,w,E,A,I,S,T,D,M,P,C,R){const z=this.length;return this.resize(z+1),this.emplace(z,e,t,i,r,n,o,a,s,l,c,u,h,d,p,f,m,_,g,y,x,v,b,w,E,A,I,S,T,D,M,P,C,R)}emplace(e,t,i,r,n,o,a,s,l,c,u,h,d,p,f,m,_,g,y,x,v,b,w,E,A,I,S,T,D,M,P,C,R,z){const L=20*e,F=40*e,O=80*e;return this.float32[L+0]=t,this.float32[L+1]=i,this.int16[F+4]=r,this.int16[F+5]=n,this.int16[F+6]=o,this.int16[F+7]=a,this.int16[F+8]=s,this.int16[F+9]=l,this.int16[F+10]=c,this.int16[F+11]=u,this.int16[F+12]=h,this.uint16[F+13]=d,this.uint16[F+14]=p,this.uint16[F+15]=f,this.uint16[F+16]=m,this.uint16[F+17]=_,this.uint16[F+18]=g,this.uint16[F+19]=y,this.uint16[F+20]=x,this.uint16[F+21]=v,this.uint16[F+22]=b,this.uint16[F+23]=w,this.uint16[F+24]=E,this.uint16[F+25]=A,this.uint16[F+26]=I,this.uint16[F+27]=S,this.uint32[L+14]=T,this.float32[L+15]=D,this.float32[L+16]=M,this.float32[L+17]=P,this.float32[L+18]=C,this.uint8[O+76]=R,this.uint16[F+39]=z,e}}Lu.prototype.bytesPerElement=80,Rs(Lu,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class Fu extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n,o)}emplace(e,t,i,r,n,o,a){const s=6*e;return this.float32[s+0]=t,this.float32[s+1]=i,this.float32[s+2]=r,this.float32[s+3]=n,this.float32[s+4]=o,this.float32[s+5]=a,e}}Fu.prototype.bytesPerElement=24,Rs(Fu,"StructArrayLayout6f24");class Ou extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n)}emplace(e,t,i,r,n,o){const a=5*e;return this.float32[a+0]=t,this.float32[a+1]=i,this.float32[a+2]=r,this.float32[a+3]=n,this.float32[a+4]=o,e}}Ou.prototype.bytesPerElement=20,Rs(Ou,"StructArrayLayout5f20");class Bu extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,a){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,o,a)}emplace(e,t,i,r,n,o,a,s){const l=7*e;return this.float32[l+0]=t,this.float32[l+1]=i,this.float32[l+2]=r,this.float32[l+3]=n,this.float32[l+4]=o,this.float32[l+5]=a,this.float32[l+6]=s,e}}Bu.prototype.bytesPerElement=28,Rs(Bu,"StructArrayLayout7f28");class ku extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,a,s,l,c,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,t,i,r,n,o,a,s,l,c,u)}emplace(e,t,i,r,n,o,a,s,l,c,u,h){const d=11*e;return this.float32[d+0]=t,this.float32[d+1]=i,this.float32[d+2]=r,this.float32[d+3]=n,this.float32[d+4]=o,this.float32[d+5]=a,this.float32[d+6]=s,this.float32[d+7]=l,this.float32[d+8]=c,this.float32[d+9]=u,this.float32[d+10]=h,e}}ku.prototype.bytesPerElement=44,Rs(ku,"StructArrayLayout11f44");class Vu extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,a,s,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,t,i,r,n,o,a,s,l)}emplace(e,t,i,r,n,o,a,s,l,c){const u=9*e;return this.float32[u+0]=t,this.float32[u+1]=i,this.float32[u+2]=r,this.float32[u+3]=n,this.float32[u+4]=o,this.float32[u+5]=a,this.float32[u+6]=s,this.float32[u+7]=l,this.float32[u+8]=c,e}}Vu.prototype.bytesPerElement=36,Rs(Vu,"StructArrayLayout9f36");class Nu extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const r=2*e;return this.float32[r+0]=t,this.float32[r+1]=i,e}}Nu.prototype.bytesPerElement=8,Rs(Nu,"StructArrayLayout2f8");class Uu extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=6*e;return this.uint32[3*e+0]=t,this.uint16[o+2]=i,this.uint16[o+3]=r,this.uint16[o+4]=n,e}}Uu.prototype.bytesPerElement=12,Rs(Uu,"StructArrayLayout1ul3ui12");class ju extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint16[1*e+0]=t,e}}ju.prototype.bytesPerElement=2,Rs(ju,"StructArrayLayout1ui2");class Gu extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int8=new Int8Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=4*e;return this.int8[o+0]=t,this.int8[o+1]=i,this.int8[o+2]=r,this.int8[o+3]=n,e}}Gu.prototype.bytesPerElement=4,Rs(Gu,"StructArrayLayout4b4");class Hu extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,a,s,l,c,u,h,d,p,f,m){const _=this.length;return this.resize(_+1),this.emplace(_,e,t,i,r,n,o,a,s,l,c,u,h,d,p,f,m)}emplace(e,t,i,r,n,o,a,s,l,c,u,h,d,p,f,m,_){const g=16*e;return this.float32[g+0]=t,this.float32[g+1]=i,this.float32[g+2]=r,this.float32[g+3]=n,this.float32[g+4]=o,this.float32[g+5]=a,this.float32[g+6]=s,this.float32[g+7]=l,this.float32[g+8]=c,this.float32[g+9]=u,this.float32[g+10]=h,this.float32[g+11]=d,this.float32[g+12]=p,this.float32[g+13]=f,this.float32[g+14]=m,this.float32[g+15]=_,e}}Hu.prototype.bytesPerElement=64,Rs(Hu,"StructArrayLayout16f64");class $u extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.int16[1*e+0]=t,e}}$u.prototype.bytesPerElement=2,Rs($u,"StructArrayLayout1i2");class Wu extends su{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint8[1*e+0]=t,e}}Wu.prototype.bytesPerElement=1,Rs(Wu,"StructArrayLayout1ub1");class qu extends ou{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]}}qu.prototype.size=40;class Zu extends Du{get(e){return new qu(this,e)}}Rs(Zu,"CollisionBoxArray");class Xu extends ou{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(e){this._structArray.uint8[this._pos1+49]=e}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e}}Xu.prototype.size=60;class Yu extends zu{get(e){return new Xu(this,e)}}Rs(Yu,"PlacedSymbolArray");class Ku extends ou{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]}
vendor: 20,215 bytes, line 2
2get 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(e){this._structArray.uint32[this._pos4+14]=e}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(e){this._structArray.float32[this._pos4+18]=e}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}Ku.prototype.size=80;class Ju extends Lu{get(e){return new Ku(this,e)}}Rs(Ju,"SymbolInstanceArray");class Qu extends pu{getoffsetX(e){return this.float32[1*e+0]}}Rs(Qu,"GlyphOffsetArray");class eh extends uu{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}Rs(eh,"SymbolLineVertexArray");class th extends ou{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]}}th.prototype.size=12;class ih extends Uu{get(e){return new th(this,e)}}Rs(ih,"FeatureIndexArray");class rh extends Tu{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}Rs(rh,"FillExtrusionCentroidArray");class nh extends ou{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]}}nh.prototype.size=6;class oh extends hu{get(e){return new nh(this,e)}}Rs(oh,"FillExtrusionWallArray");const ah=lu([{name:"a_pos",components:2,type:"Int16"}],4),sh=lu([{name:"a_road_z_offset",components:1,type:"Float32"}],4),lh=lu([{name:"a_pos",components:2,type:"Int16"},{name:"a_height",components:1,type:"Float32"}],4),ch=lu([{name:"a_pos_normal_3",components:3,type:"Int16"}],4);class uh{constructor(e=[]){this.segments=e}_prepareSegment(e,t,i,r,n){let o=this.segments.at(-1);return e>uh.MAX_VERTEX_ARRAY_LENGTH&&Tt(`Max vertices per segment is ${uh.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!o||o.vertexLength+e>uh.MAX_VERTEX_ARRAY_LENGTH||o.sortKey!==r||void 0!==n&&o&&void 0!==o.batchIndex&&o.batchIndex!==n)&&(o={vertexOffset:t,primitiveOffset:i,vertexLength:0,primitiveLength:0},void 0!==r&&(o.sortKey=r),void 0!==n&&(o.batchIndex=n),this.segments.push(o)),o}prepareSegment(e,t,i,r,n){return this._prepareSegment(e,t.length,i.length,r,n)}get(){return this.segments}destroy(){for(const e of this.segments)for(const t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,i,r){return new uh([{vertexOffset:e,primitiveOffset:t,vertexLength:i,primitiveLength:r,vaos:{},sortKey:0}])}}function hh(e,t){return 256*(e=ht(Math.floor(e),0,255))+ht(Math.floor(t),0,255)}uh.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Rs(uh,"SegmentVector");const dh=lu([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),ph=lu([{name:"a_pattern_b",components:4,type:"Uint16"}]),fh=lu([{name:"a_dash",components:4,type:"Uint16"}]);class mh{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(e,t,i,r){this.ids.push(_h(e)),this.positions.push(t,i,r)}eachPosition(e,t){const i=_h(e);let r=0,n=this.ids.length-1;for(;r<n;){const e=r+n>>1;this.ids[e]>=i?n=e:r=e+1}for(;this.ids[r]===i;)t(this.positions[3*r],this.positions[3*r+1],this.positions[3*r+2]),r++}static serialize(e,t){const i=new Float64Array(e.ids),r=new Uint32Array(e.positions);return gh(i,r,0,i.length-1),t&&(t.add(i.buffer),t.add(r.buffer)),{ids:i,positions:r}}static deserialize(e){const t=new mh;let i;t.ids=e.ids,t.positions=e.positions;for(const r of t.ids)r!==i&&t.uniqueIds.push(r),i=r;return t.indexed=!0,t}}function _h(e){const t=+e;return Number.isSafeInteger(t)?t:Fr(String(e))}function gh(e,t,i,r){for(;i<r;){const n=e[i+r>>1];let o=i-1,a=r+1;for(;;){do{o++}while(e[o]<n);do{a--}while(e[a]>n);if(o>=a)break;yh(e,o,a),yh(t,3*o,3*a),yh(t,3*o+1,3*a+1),yh(t,3*o+2,3*a+2)}a-i<r-a?(gh(e,t,i,a),i=a+1):(gh(e,t,a+1,r),r=a)}}function yh(e,t,i){const r=e[t];e[t]=e[i],e[i]=r}Rs(mh,"FeaturePositionMap");class xh{constructor(e){this.gl=e.gl,this.initialized=!1}fetchUniformLocation(e,t){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(e,t),this.initialized=!0),!!this.location}set(e,t,i){throw new Error("Uniform#set() must be implemented by each concrete Uniform")}}class vh extends xh{constructor(e){super(e),this.current=0}set(e,t,i){this.fetchUniformLocation(e,t)&&this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}}class bh extends xh{constructor(e){super(e),this.current=0}set(e,t,i){this.fetchUniformLocation(e,t)&&this.current!==i&&(this.current=i,this.gl.uniform1f(this.location,i))}}class wh extends xh{constructor(e){super(e),this.current=[0,0]}set(e,t,i){this.fetchUniformLocation(e,t)&&(i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1])))}}class Eh extends xh{constructor(e){super(e),this.current=[0,0,0]}set(e,t,i){this.fetchUniformLocation(e,t)&&(i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2])))}}class Ah extends xh{constructor(e){super(e),this.current=[0,0,0,0]}set(e,t,i){this.fetchUniformLocation(e,t)&&(i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]&&i[3]===this.current[3]||(this.current=i,this.gl.uniform4ui(this.location,i[0],i[1],i[2],i[3])))}}class Ih extends xh{constructor(e){super(e),this.current=[0,0,0,0]}set(e,t,i){this.fetchUniformLocation(e,t)&&(i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]&&i[3]===this.current[3]||(this.current=i,this.gl.uniform4f(this.location,i[0],i[1],i[2],i[3])))}}class Sh extends xh{constructor(e){super(e),this.current=Zr.transparent.toPremultipliedRenderColor(null)}set(e,t,i){this.fetchUniformLocation(e,t)&&(i.r===this.current.r&&i.g===this.current.g&&i.b===this.current.b&&i.a===this.current.a||(this.current=i,this.gl.uniform4f(this.location,i.r,i.g,i.b,i.a)))}}class Th extends xh{constructor(e){super(e),this.current=new Float32Array(16)}set(e,t,i){if(!this.fetchUniformLocation(e,t))return;const r=this.current;if(i[12]!==r[12]||i[0]!==r[0])return r.set(i),void this.gl.uniformMatrix4fv(this.location,!1,r);for(let n=1;n<16;n++)if(i[n]!==r[n]){r.set(i),this.gl.uniformMatrix4fv(this.location,!1,r);break}}}class Dh extends xh{constructor(e){super(e),this.current=new Float32Array(9)}set(e,t,i){if(!this.fetchUniformLocation(e,t))return;const r=this.current;for(let n=0;n<9;n++)if(i[n]!==r[n]){r.set(i),this.gl.uniformMatrix3fv(this.location,!1,r);break}}}class Mh extends xh{constructor(e){super(e),this.current=new Float32Array(4)}set(e,t,i){if(!this.fetchUniformLocation(e,t))return;const r=this.current;for(let n=0;n<4;n++)if(i[n]!==r[n]){r.set(i),this.gl.uniformMatrix2fv(this.location,!1,r);break}}}function Ph(e){return[hh(255*e.r,255*e.g),hh(255*e.b,255*e.a)]}function Ch(e,t,i,r,n,o,a,s){return!!e&&("composite"===e.kind||"source"===e.kind?"none"===e.evaluate(new ll(0,{brightness:o,worldview:s}),t,i,n,r,a):"none"===e.value)}class Rh{constructor(e,t,i,r){this.value=e,this.uniformNames=t.map(e=>`u_${e}`),this.type=i,this.context=r}setUniform(e,t,i,r,n){const o=r.constantOr(this.value);t.set(e,n,o instanceof Zr?o.toPremultipliedRenderColor(this.lutExpression&&"constant"===this.lutExpression.kind&&"none"===this.lutExpression.value?null:this.context.lut):o)}getBinding(e,t){return"color"===this.type?new Sh(e):new bh(e)}}class zh{constructor(e,t){this.uniformNames=t.map(e=>`u_${e}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(e,t){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br),this.patternTransition=t?t.tl.concat(t.br):this.pattern}setUniform(e,t,i,r,n){let o=null;"u_pattern"!==n&&"u_dash"!==n||(o=this.pattern),"u_pattern_b"===n&&(o=this.patternTransition),"u_pixel_ratio"===n&&(o=this.pixelRatio),o&&t.set(e,n,o)}getBinding(e,t){return"u_pattern"===t||"u_pattern_b"===t||"u_dash"===t?new Ah(e):new bh(e)}}class Lh{constructor(e,t,i,r){this.expression=e,this.type=i,this.maxValue=0,this.paintVertexAttributes=t.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===i?2:1,offset:0})),this.paintVertexArray=new r}populatePaintArray(e,t,i,r,n,o,a,s){const l=this.paintVertexArray.length,c="composite"===this.expression.kind||"source"===this.expression.kind?this.expression.evaluate(new ll(0,{brightness:o,worldview:s}),t,{},n,r,a):"constant"===this.expression.kind&&this.expression.value,u=Ch(this.lutExpression,t,{},r,n,o,a,s);this.paintVertexArray.resize(e),this._setPaintValue(l,e,c,u?null:this.context.lut)}updatePaintArray(e,t,i,r,n,o,a,s){const l="composite"===this.expression.kind||"source"===this.expression.kind?this.expression.evaluate({zoom:0,brightness:a,worldview:s},i,r,void 0,n):"constant"===this.expression.kind&&this.expression.value,c=Ch(this.lutExpression,i,r,n,void 0,a,void 0,s);this._setPaintValue(e,t,l,c?null:this.context.lut)}_setPaintValue(e,t,i,r){if("color"===this.type){const n=Ph(i.toPremultipliedRenderColor(r));for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,n[0],n[1])}else{for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,i);this.maxValue=Math.max(this.maxValue,Math.abs(i))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.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 Fh{constructor(e,t,i,r,n,o){this.expression=e,this.uniformNames=t.map(e=>`u_${e}_t`),this.type=i,this.useIntegerZoom=r,this.context=n,this.maxValue=0,this.paintVertexAttributes=t.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===i?4:2,offset:0})),this.paintVertexArray=new o}populatePaintArray(e,t,i,r,n,o,a,s){const l=this.expression.evaluate(new ll(this.context.zoom,{brightness:o,worldview:s}),t,{},n,r,a),c=this.expression.evaluate(new ll(this.context.zoom+1,{brightness:o,worldview:s}),t,{},n,r,a),u=Ch(this.lutExpression,t,{},r,n,o,a,s),h=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(h,e,l,c,u?null:this.context.lut)}updatePaintArray(e,t,i,r,n,o,a,s){const l=this.expression.evaluate({zoom:this.context.zoom,brightness:a,worldview:s},i,r,void 0,n),c=this.expression.evaluate({zoom:this.context.zoom+1,brightness:a,worldview:s},i,r,void 0,n),u=Ch(this.lutExpression,i,r,n,void 0,a,void 0,s);this._setPaintValue(e,t,l,c,u?null:this.context.lut)}_setPaintValue(e,t,i,r,n){if("color"===this.type){const o=Ph(i.toPremultipliedRenderColor(n)),a=Ph(r.toPremultipliedRenderColor(n));for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,o[0],o[1],a[0],a[1])}else{for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,i,r);this.maxValue=Math.max(this.maxValue,Math.abs(i),Math.abs(r))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,t,i,r,n){const o=this.useIntegerZoom?Math.floor(i.zoom):i.zoom,a=ht(this.expression.interpolationFactor(o,this.context.zoom,this.context.zoom+1),0,1);t.set(e,n,a)}getBinding(e,t){return new bh(e)}}class Oh{constructor(e,t,i,r,n){this.expression=e,this.layerId=n,this.paintVertexAttributes=("array"===i?fh:dh).members;for(let o=0;o<t.length;++o);this.paintVertexArray=new r,this.paintTransitionVertexArray=new bu}populatePaintArray(e,t,i,r){const n=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValues(n,e,t.patterns&&t.patterns[this.layerId],i)}updatePaintArray(e,t,i,r,n,o,a){this._setPaintValues(e,t,i.patterns&&i.patterns[this.layerId],o)}_setPaintValues(e,t,i,r){if(!r||!i)return;const n=r[i[0]],o=r[i[1]];if(n){if(n){const{tl:i,br:r,pixelRatio:o}=n;for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,i[0],i[1],r[0],r[1],o)}if(o){this.paintTransitionVertexArray.resize(this.paintVertexArray.length);const{tl:i,br:r}=o;for(let n=e;n<t;n++)this.paintTransitionVertexArray.emplace(n,i[0],i[1],r[0],r[1])}}}upload(e){const t=this.expression.isStateDependent||!this.expression.isLightConstant;this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,t)),this.paintTransitionVertexArray&&this.paintTransitionVertexArray.length&&(this.paintTransitionVertexBuffer=e.createVertexBuffer(this.paintTransitionVertexArray,ph.members,t))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy(),this.paintTransitionVertexBuffer&&this.paintTransitionVertexBuffer.destroy()}}class Bh{constructor(e,t,i=()=>!0){this.binders={},this._buffers=[],this.context=t;const r=[],n=e;for(const o in e.paint._values){const a=n.paint.get(o);if(o.endsWith("-use-theme"))continue;if(!i(o))continue;if(!(a instanceof ml&&cs(a.property.specification)))continue;const s=Nh(o,e.type),l=a.value,c=a.property.specification.type,u=!!a.property.useIntegerZoom,h="line-dasharray"===o||o.endsWith("pattern"),d=n.paint.get(`${o}-use-theme`),p="line-dasharray"===o&&"constant"!==n.layout.get("line-cap").value.kind||d&&"constant"!==d.value.kind;if("constant"!==l.kind||p)if("source"===l.kind||p||h){const t=Gh(o,c,"source");this.binders[o]=h?new Oh(l,s,c,t,e.id):new Lh(l,s,c,t),r.push(`/a_${o}`)}else{const e=Gh(o,c,"composite");this.binders[o]=new Fh(l,s,c,u,t,e),r.push(`/z_${o}`)}else this.binders[o]=h?new zh(l.value,s):new Rh(l.value,s,c,t),r.push(`/u_${o}`);d&&(this.binders[o].lutExpression=d.value)}this.cacheKey=r.sort().join("")}updateExpressions(e){const t=e;for(const i in this.binders){const e=this.binders[i];if(e instanceof Lh||e instanceof Fh||e instanceof Oh){const r=t.paint.get(i);e.expression=r.value}}}getMaxValue(e){const t=this.binders[e];return t instanceof Lh||t instanceof Fh?t.maxValue:0}populatePaintArrays(e,t,i,r,n,o,a,s){for(const l in this.binders){const c=this.binders[l];c.context=this.context,(c instanceof Lh||c instanceof Fh||c instanceof Oh)&&c.populatePaintArray(e,t,i,r,n,o,a,s)}}setConstantPatternPositions(e,t){for(const i in this.binders){const r=this.binders[i];r instanceof zh&&r.setConstantPatternPositions(e,t)}}getPatternTransitionVertexBuffer(e){const t=this.binders[e];return t instanceof Oh?t.paintTransitionVertexBuffer:null}updatePaintArrays(e,t,i,r,n,o,a,s,l,c){let u=!1;const h=Object.keys(e),d=0!==h.length&&!s,p=d?h:t.uniqueIds;this.context.lut=n.lut;for(const f in this.binders){const s=this.binders[f];if(s.context=this.context,(s instanceof Lh||s instanceof Fh||s instanceof Oh)&&s.expression&&s.expression.kind&&"constant"!==s.expression.kind&&(!0===s.expression.isStateDependent||!1===s.expression.isLightConstant)){const h=n.paint.get(f);s.expression=h.value;for(const i of p){const n=e[i.toString()];t.eachPosition(i,(e,t,i)=>{const u=r.feature(e);s.updatePaintArray(t,i,u,n,o,a,l,c)})}if(!d)for(const t of i.uniqueIds){const n=e[t.toString()];i.eachPosition(t,(e,t,i)=>{const u=r.feature(e);s.updatePaintArray(t,i,u,n,o,a,l,c)})}u=!0}}return u}defines(){const e=[];for(const t in this.binders){const i=this.binders[t];(i instanceof Rh||i instanceof zh)&&e.push(...i.uniformNames.map(e=>`#define HAS_UNIFORM_${e}`))}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){const t=[];for(const i in this.binders){const r=this.binders[i];if(r instanceof Rh||r instanceof zh||r instanceof Fh)for(const n of r.uniformNames)t.push({name:n,property:i,binding:r.getBinding(e,n)})}return t}setUniforms(e,t,i,r,n){for(const{name:o,property:a,binding:s}of i)this.binders[a].setUniform(e,s,n,r.get(a),o)}updatePaintBuffers(){this._buffers=[];for(const e in this.binders){const t=this.binders[e];(t instanceof Lh||t instanceof Fh||t instanceof Oh)&&t.paintVertexBuffer&&this._buffers.push(t.paintVertexBuffer),t instanceof Oh&&t.paintTransitionVertexBuffer&&this._buffers.push(t.paintTransitionVertexBuffer)}}upload(e){for(const t in this.binders){const i=this.binders[t];(i instanceof Lh||i instanceof Fh||i instanceof Oh)&&i.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const t=this.binders[e];(t instanceof Lh||t instanceof Fh||t instanceof Oh)&&t.destroy()}}}class kh{constructor(e,t,i=()=>!0){this.programConfigurations={};for(const r of e)this.programConfigurations[r.id]=new Bh(r,t,i);this.needsUpload=!1,this._featureMap=new mh,this._featureMapWithoutIds=new mh,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,t,i,r,n,o,a,s,l){for(const c in this.programConfigurations)this.programConfigurations[c].populatePaintArrays(e,t,r,n,o,a,s,l);void 0!==t.id?this._featureMap.add(t.id,i,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,i,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,i,r,n,o,a,s){for(const l of i)this.needsUpload=this.programConfigurations[l.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,t,l,r,n,o,a||0,s)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}updateExpressions(e){const t=new Set;for(const i of e){const e=this.programConfigurations[i.id];e&&(e.updateExpressions(i),t.add(i.id))}for(const i in this.programConfigurations)t.has(i)||delete this.programConfigurations[i]}}const Vh={"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":["ga
2pwidth"],"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 Nh(e,t){return Vh[e]||[e.replace(`${t}-`,"").replace(/-/g,"_")]}const Uh={"line-pattern":{source:vu,composite:vu},"fill-pattern":{source:vu,composite:vu},"fill-extrusion-pattern":{source:vu,composite:vu},"line-dasharray":{source:bu,composite:bu}},jh={color:{source:Nu,composite:Iu},number:{source:pu,composite:Nu}};function Gh(e,t,i){const r=Uh[e];return r&&r[i]||jh[t][i]}Rs(Rh,"ConstantBinder"),Rs(zh,"PatternConstantBinder"),Rs(Lh,"SourceExpressionBinder",{omit:["expression"]}),Rs(Oh,"PatternCompositeBinder",{omit:["expression"]}),Rs(Fh,"CompositeExpressionBinder",{omit:["expression"]}),Rs(Bh,"ProgramConfiguration",{omit:["_buffers"]}),Rs(kh,"ProgramConfigurationSet");class Hh{constructor(e,t,i){this.layoutVertexArray=new uu,this.indexArray=new Ru,this.lineIndexArray=new Tu,this.triangleSegments=new uh,this.lineSegments=new uh,this.programConfigurations=new kh(e,{zoom:t,lut:i}),this.uploaded=!1}update(e,t,i,r,n,o,a,s){this.programConfigurations.updatePaintArrays(e,t,n,i,r,o,a,s)}isEmpty(){return 0===this.layoutVertexArray.length}needsUpload(){return this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ah.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.lineIndexBuffer=e.createIndexBuffer(this.lineIndexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy())}populatePaintArrays(e,t,i,r,n,o,a){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,t,i,r,n,o,void 0,a)}}Rs(Hh,"FillBufferData");class $h{constructor(e){this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=e.lut,this.bufferData=new Hh(e.layers,e.zoom,e.lut),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.projection=e.projection,this.sourceLayerIndex=e.sourceLayerIndex,this.sourceLayerName=e.sourceLayerName||"",this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,t){}updateAppearances(e,t,i,r){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,i,r){this.hasPattern=Tc("fill",this.layers,this.pixelRatio,t);const n=this.layers[0].layout.get("fill-sort-key"),o=[];for(const{feature:a,id:s,index:l,sourceLayerIndex:c}of e){const e=this.layers[0]._featureFilter.needGeometry,u=ru(a,e);if(!this.layers[0]._featureFilter.filter(new ll(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),u,i))continue;const h=n?n.evaluate(u,{},i,t.availableImages):void 0,d={id:s,properties:a.properties,type:a.type,sourceLayerIndex:c,index:l,geometry:e?u.geometry:iu(a,i,r),patterns:{},sortKey:h};o.push(d)}n&&o.sort((e,t)=>
vendor: 1,303 bytes, line 2
2e.sortKey-t.sortKey);for(const a of o){const{geometry:r,index:n,sourceLayerIndex:o}=a;if(this.hasPattern){const e=Dc("fill",this.layers,a,this.zoom,this.pixelRatio,t);this.patternFeatures.push(e)}else this.addFeature(a,r,n,i,{},t.availableImages,t.brightness,t.elevationFeatures);t.featureIndex.insert(e[n].feature,r,n,o,this.index)}!this.hasPattern&&this.hdExt&&this.hdExt.buildFrcSegments(this)}update(e,t,i,r,n,o,a){this.bufferData.update(e,t,i,r,n,o,a,this.worldview),this.hdExt&&this.hdExt.update(e,t,i,r,n,o,a,this.worldview)}updateExpressions(e){this.bufferData.programConfigurations.updateExpressions(e),this.hdExt&&this.hdExt.updateExpressions(e)}addFeatures(e,t,i,r,n,o){for(const a of this.patternFeatures)this.addFeature(a,a.geometry,a.index,t,i,r,o,e.elevationFeatures);this.hdExt&&this.hdExt.buildFrcSegments(this)}isEmpty(){return this.bufferData.isEmpty()&&(!this.hdExt||this.hdExt.isEmpty())}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||null!=this.hdExt&&this.hdExt.needsUpload()}upload(e){this.bufferData.upload(e),this.hdExt&&this.hdExt.upload(e)}destroy(){this.bufferData.destroy(),this.hdExt&&this.hdExt.destroy()}addFeature(e,t,i,r,n,o=[],a,s){const l=this.hdExt?this.hdExt.trackFeatureFrc(e.properties):null,c=this.bufferData.indexArray.length,u=We(t,500);
vendor: 11,670 bytes, line 2
2null!=this.hdExt&&this.hdExt.handleFeature(e,u,i,r,s,this)||this.addGeometry(u,this.bufferData),this.bufferData.populatePaintArrays(e,i,n,o,r,a,this.worldview),this.hdExt&&this.hdExt.populatePaintArrays(e,i,n,o,r,a,this.worldview),this.hdExt&&this.hdExt.recordFeatureRange(this,c,this.bufferData.indexArray.length,l)}addGeometry(e,t,i,r){let n=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,a=null;i&&(a=i.elevationSampler.constantElevation(i.elevation,i.bias),null!=a&&(n=a,o=a));const s=i?t:null,l=(e,t,r)=>{if(null!=i)if(t.push(e),null!=a)s.elevatedLayoutVertexArray.emplaceBack(a),r.push(a);else{const t=i.elevationSampler.pointElevation(e,i.elevation,i.bias);s.elevatedLayoutVertexArray.emplaceBack(t),r.push(t),n=Math.min(n,t),o=Math.max(o,t)}};for(const c of e){let e=0;for(const t of c)e+=t.length;const n=t.triangleSegments.prepareSegment(e,t.layoutVertexArray,t.indexArray),o=n.vertexLength,a=[],s=[],u=[],h=[],d=[],p=t.layoutVertexArray.length;for(const r of c){if(0===r.length)continue;r!==c[0]&&s.push(a.length/2);const e=t.lineSegments.prepareSegment(r.length,t.layoutVertexArray,t.lineIndexArray),n=e.vertexLength;i&&d.push(t.layoutVertexArray.length-p),l(r[0],u,h),t.layoutVertexArray.emplaceBack(r[0].x,r[0].y),t.lineIndexArray.emplaceBack(n+r.length-1,n),a.push(r[0].x),a.push(r[0].y);for(let i=1;i<r.length;i++)l(r[i],u,h),t.layoutVertexArray.emplaceBack(r[i].x,r[i].y),t.lineIndexArray.emplaceBack(n+i-1,n+i),a.push(r[i].x),a.push(r[i].y);e.vertexLength+=r.length,e.primitiveLength+=r.length}const f=ec(a,s);for(let i=0;i<f.length;i+=3)t.indexArray.emplaceBack(o+f[i],o+f[i+1],o+f[i+2]);if(f.length>0&&i&&r){const e=i.elevation.isTunnel(),t=i.elevation.safeArea,n=r.addVertices(u,h);r.addTriangles(f,n,e);const o=d.length;if(o>0){for(let a=0;a<o-1;a++)r.addRenderableRing(i.index,d[a]+n,d[a+1]-d[a],e,t,i.featureInfo);r.addRenderableRing(i.index,d[o-1]+n,u.length-d[o-1],e,t,i.featureInfo)}}n.vertexLength+=e,n.primitiveLength+=f.length/3}return[n,o]}}Rs($h,"FillBucket",{omit:["layers","patternFeatures"]});const Wh=lu([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),qh=lu([{name:"a_z_offset_width",components:4,type:"Float32"}],4),Zh=lu([{name:"a_elevation_id_col",components:3,type:"Float32"}],4),Xh=lu([{name:"a_elevation_ground_scale",components:1,type:"Float32"}],4),{members:Yh}=Wh,Kh=lu([{name:"a_packed",components:3,type:"Float32"}]),{members:Jh}=Kh,Qh=lu([{name:"a_pattern_data",components:3,type:"Float32"}]),{members:ed}=Qh;class td{constructor(e,t,i,r,n){for(this.properties=Object.create(null),this.extent=i,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=r,this._values=n;e.pos<t;){const t=e.readVarint();if(8===t)this.id=e.readVarint();else if(18===t){const t=e.readVarint()+e.pos;for(;e.pos<t;){const t=r[e.readVarint()],i=n[e.readVarint()];this.properties[t]=i}}else 24===t?this.type=e.readVarint():34===t?(this._geometry=e.pos,e.skip(t)):e.skip(t)}}loadGeometry(){if(this._geometry<0)throw new Error("feature has no geometry");const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos,i=[];let r,n=1,o=0,a=0,s=0;for(;e.pos<t;){if(o<=0){const t=e.readVarint();if(n=7&t,o=t>>3,0===o)continue}if(o--,1===n)a+=e.readSVarint(),s+=e.readSVarint(),r&&i.push(r),r=[new ke(a,s)];else if(2===n)a+=e.readSVarint(),s+=e.readSVarint(),r&&r.push(new ke(a,s));else{if(7!==n)throw new Error(`unknown command ${n}`);r&&r.push(r[0].clone())}}return r&&i.push(r),i}bbox(){if(this._geometry<0)throw new Error("feature has no geometry");const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos;let i=1,r=0,n=0,o=0,a=1/0,s=-1/0,l=1/0,c=-1/0;for(;e.pos<t;){if(r<=0){const t=e.readVarint();if(i=7&t,r=t>>3,0===r)continue}if(r--,1===i||2===i)n+=e.readSVarint(),o+=e.readSVarint(),n<a&&(a=n),n>s&&(s=n),o<l&&(l=o),o>c&&(c=o);else if(7!==i)throw new Error(`unknown command ${i}`)}return[a,l,s,c]}toGeoJSON(e,t,i){const r=this.extent*Math.pow(2,i),n=this.extent*e,o=this.extent*t,a=this.loadGeometry();function s(e){return[360*(e.x+n)/r-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+o)/r)*Math.PI))-90]}function l(e){return e.map(s)}let c;if(1===this.type){const e=[];for(const i of a)e.push(i[0]);const t=l(e);c=1===e.length?{type:"Point",coordinates:t[0]}:{type:"MultiPoint",coordinates:t}}else if(2===this.type){const e=a.map(l);c=1===e.length?{type:"LineString",coordinates:e[0]}:{type:"MultiLineString",coordinates:e}}else{if(3!==this.type)throw new Error("unknown feature type");{const e=function(e){const t=e.length;if(t<=1)return[e];const i=[];let r,n;for(let o=0;o<t;o++){const t=id(e[o]);0!==t&&(void 0===n&&(n=t<0),n===t<0?(r&&i.push(r),r=[e[o]]):r&&r.push(e[o]))}return r&&i.push(r),i}(a),t=[];for(const i of e)t.push(i.map(l));c=1===t.length?{type:"Polygon",coordinates:t[0]}:{type:"MultiPolygon",coordinates:t}}}const u={type:"Feature",geometry:c,properties:this.properties};return null!=this.id&&(u.id=this.id),u}}function id(e){let t=0;for(let i,r,n=0,o=e.length,a=o-1;n<o;a=n++)i=e[n],r=e[a],t+=(r.x-i.x)*(i.y+r.y);return t}td.types=["Unknown","Point","LineString","Polygon"];class rd{constructor(e,t){for(this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],void 0===t&&(t=e.length);e.pos<t;){const t=e.readVarint();10===t?this.name=e.readString():18===t?(this._features.push(e.pos),e.skip(t)):26===t?this._keys.push(e.readString()):34===t?this._values.push(nd(e)):40===t?this.extent=e.readVarint():120===t?this.version=e.readVarint():e.skip(t)}this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const t=this._pbf.readVarint()+this._pbf.pos;return new td(this._pbf,t,this.extent,this._keys,this._values)}}function nd(e){let t=null;const i=e.readVarint()+e.pos;for(;e.pos<i;){const i=e.readVarint();t=10===i?e.readString():21===i?e.readFloat():25===i?e.readDouble():32===i?e.readVarint(!0):40===i?e.readVarint():48===i?e.readSVarint():56===i?e.readBoolean():(e.skip(i),null)}if(null==t)throw new Error("unknown feature value");return t}class od{constructor(e,t=e.length){const i=Object.create(null);for(;e.pos<t;){const t=e.readVarint();if(26===t){const t=new rd(e,e.readVarint()+e.pos);t.length&&(i[t.name]=t)}else e.skip(t)}this.layers=i}}function ad(e,t){for(let i=0;i<e.length;i++)if(gd(t,e[i]))return!0;for(let i=0;i<t.length;i++)if(gd(e,t[i]))return!0;return!!ud(e,t)}function sd(e,t,i){return!!gd(e,t)||!!fd(t,e,i)}function ld(e,t){if(1===e.length)return _d(t,e[0]);for(let i=0;i<t.length;i++){const r=t[i];for(let t=0;t<r.length;t++)if(gd(e,r[t]))return!0}for(let i=0;i<e.length;i++)if(_d(t,e[i]))return!0;for(let i=0;i<t.length;i++)if(ud(e,t[i]))return!0;return!1}function cd(e,t,i){if(e.length>1){if(ud(e,t))return!0;for(let r=0;r<t.length;r++)if(fd(t[r],e,i))return!0}for(let r=0;r<e.length;r++)if(fd(e[r],t,i))return!0;return!1}function ud(e,t){if(0===e.length||0===t.length)return!1;for(let i=0;i<e.length-1;i++){const r=e[i],n=e[i+1];for(let e=0;e<t.length-1;e++)if(hd(r,n,t[e],t[e+1]))return!0}return!1}function hd(e,t,i,r){return Dt(e,i,r)!==Dt(t,i,r)&&Dt(e,t,i)!==Dt(e,t,r)}function dd(e,t,i){return(e.x-i.x)*(t.y-i.y)-(e.y-i.y)*(t.x-i.x)}function pd(e,t,i,r){const n=dd(e,t,r),o=dd(e,t,i);if(Math.sign(n)===Math.sign(o))return;const a=dd(i,r,e),s=a+o-n;return Math.sign(a)!==Math.sign(s)?[a/(a-s),o/(o-n)]:void 0}function fd(e,t,i){const r=i*i;if(1===t.length)return e.distSqr(t[0])<r;for(let n=1;n<t.length;n++)if(md(e,t[n-1],t[n])<r)return!0;return!1}function md(e,t,i){const r=t.distSqr(i);if(0===r)return e.distSqr(t);const n=((e.x-t.x)*(i.x-t.x)+(e.y-t.y)*(i.y-t.y))/r;return e.distSqr(n<0?t:n>1?i:i.sub(t)._mult(n)._add(t))}function _d(e,t){let i,r,n,o=!1;for(let a=0;a<e.length;a++){i=e[a];for(let e=0,a=i.length-1;e<i.length;a=e++)r=i[e],n=i[a],r.y>t.y!=n.y>t.y&&t.x<(n.x-r.x)*(t.y-r.y)/(n.y-r.y)+r.x&&(o=!o)}return o}function gd(e,t){let i=!1;for(let r=0,n=e.length-1;r<e.length;n=r++){const o=e[r],a=e[n];o.y>t.y!=a.y>t.y&&t.x<(a.x-o.x)*(t.y-o.y)/(a.y-o.y)+o.x&&(i=!i)}return i}function yd(e,t,i,r,n){for(const a of e)if(t<=a.x&&i<=a.y&&r>=a.x&&n>=a.y)return!0;const o=[new ke(t,i),new ke(t,n),new ke(r,n),new ke(r,i)];if(e.length>2)for(const a of o)if(gd(e,a))return!0;for(let a=0;a<e.length-1;a++)if(xd(e[a],e[a+1],o))return!0;return!1}function xd(e,t,i){const r=i[0],n=i[2];if(e.x<r.x&&t.x<r.x||e.x>n.x&&t.x>n.x||e.y<r.y&&t.y<r.y||e.y>n.y&&t.y>n.y)return!1;const o=Dt(e,t,i[0]);return o!==Dt(e,t,i[1])||o!==Dt(e,t,i[2])||o!==Dt(e,t,i[3])}function vd(e,t,i,r,n,o){let a=t.y-e.y,s=e.x-t.x;if(o=o||0){const e=a*a+s*s;if(0===e)return!0;const t=Math.sqrt(e);a/=t,s/=t}return!((i.x-e.x)*a+(i.y-e.y)*s-o<0||(r.x-e.x)*a+(r.y-e.y)*s-o<0||(n.x-e.x)*a+(n.y-e.y)*s-o<0)}function bd(e,t,i,r,n,o,a){return!(vd(e,t,r,n,o,a)||vd(t,i,r,n,o,a)||vd(i,e,r,n,o,a)||vd(r,n,e,t,i,a)||vd(n,o,e,t,i,a)||vd(o,r,e,t,i,a))}class wd extends ke{constructor(e,t,i){super(e,t),this.z=i}}class Ed extends wd{constructor(e,t,i,r){super(e,t,i),this.w=r}}function Ad(e,t,i,r){const n="x"===i?"y":"x",o=(r-e[i])/(t[i]-e[i]);e[n]=Math.round(e[n]+(t[n]-e[n])*o),e[i]=r,Object.hasOwn(e,"z")&&(e.z=Wr(e.z,t.z,o)),Object.hasOwn(e,"w")&&(e.w=Wr(e.w,t.w,o))}function Id(e,t,i,r){const n=i,o=r;for(const a of["x","y"]){let i=e,r=t;i[a]>=r[a]&&(i=t,r=e),i[a]<n&&r[a]>n&&Ad(i,r,a,n),i[a]<o&&r[a]>o&&Ad(r,i,a,o)}}function Sd(e,t,i,r,n,o){const a=[];for(let s=0;s<e.length;s++){const l=e[s];let c;const u=a.length;let h=0;for(let e=0;e<l.length-1;e++){let u=l[e],d=l[e+1],p=0;const f=h;let m,_;o&&(p=Math.hypot(d.x-u.x,d.y-u.y),h+=p,m=u,_=d),u.x<t&&d.x<t||(u.x<t?u=new ke(t,u.y+(t-u.x)/(d.x-u.x)*(d.y-u.y))._round():d.x<t&&(d=new ke(t,u.y+(t-u.x)/(d.x-u.x)*(d.y-u.y))._round()),u.y<i&&d.y<i||(u.y<i?u=new ke(u.x+(i-u.y)/(d.y-u.y)*(d.x-u.x),i)._round():d.y<i&&(d=new ke(u.x+(i-u.y)/(d.y-u.y)*(d.x-u.x),i)._round()),u.x>=r&&d.x>=r||(u.x>=r?u=new ke(r,u.y+(r-u.x)/(d.x-u.x)*(d.y-u.y))._round():d.x>=r&&(d=new ke(r,u.y+(r-u.x)/(d.x-u.x)*(d.y-u.y))._round()),u.y>=n&&d.y>=n||(u.y>=n?u=new ke(u.x+(n-u.y)/(d.y-u.y)*(d.x-u.x),n)._round():d.y>=n&&(d=new ke(u.x+(n-u.y)/(d.y-u.y)*(d.x-u.x),n)._round()),c&&u.equals(c.at(-1))||(c=[u],a.push(c),o&&o.push({progress:{min:f+Dd(m,_,u)*p,max:1},parentIndex:s,prevPoint:m,nextPoint:_})),c.push(d),o&&(o.at(-1).progress.max=f+Dd(m,_,d)*p,o.at(-1).nextPoint=_)))))}if(o&&h>0)for(let e=u;e<a.length;e++)o[e].progress.min/=h,o[e].progress.max/=h}return a}function Td(e,t,i,r,n){if(e.length<2)return void r.push(e);const o=[];for(;t.valid();){const[i,r]=t.get();for(let t=0;t<e.length-1;t++){const n=e[t],a=e[t+1],s=pd(n,a,i,r);if(s){const[e]=s,i=new ke(Wr(n.x,a.x,e),Wr(n.y,a.y,e));o.push({t:t+e,distance:0,point:i})}}t.next()}if(0===o.length)return void r.push(e);o.sort((e,t)=>e.t-t.t);let a=0,s=0,l=[];for(r.push(l);a!==e.length;){if(s===o.length){for(;a!==e.length;)0!==l.length&&l.at(-1).equals(e[a])||l.push(e[a]),a++;break}o[s].t<=a?(0!==l.length&&l.at(-1).equals(o[s].point)||l.push(o[s].point),Math.trunc(o[s].t),s++):(0!==l.length&&l.at(-1).equals(e[a])||l.push(e[a]),a++)}}function Dd(e,t,i){return e.x!==t.x?(i.x-e.x)/(t.x-e.x):e.y!==t.y?(i.y-e.y)/(t.y-e.y):0}function Md(e,{width:t,height:i},r,n){if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==t*i*r)throw new RangeError("mismatched image size")}else n=new Uint8Array(t*i*r);return e.width=t,e.height=i,e.data=n,e}function Pd(e,t,i){const{width:r,height:n}=t;r===e.width&&n===e.height||(Cd(e,t,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,r),height:Math.min(e.height,n)},i,null),e.width=r,e.height=n,e.data=t.data)}
vendor: 4,435 bytes, line 2
2function Cd(e,t,i,r,n,o,a,s){if(0===n.width||0===n.height)return t;if(n.width>e.width||n.height>e.height||i.x>e.width-n.width||i.y>e.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>t.width||n.height>t.height||r.x>t.width-n.width||r.y>t.height-n.height)throw new RangeError("out of range destination coordinates for image copy");const l=e.data,c=t.data,u=4===o&&s;for(let h=0;h<n.height;h++){const s=((i.y+h)*e.width+i.x)*o,d=((r.y+h)*t.width+r.x)*o;if(u)for(let e=0;e<n.width;e++){const t=s+e*o+3,i=d+e*o;c[i+0]=255,c[i+1]=255,c[i+2]=255,c[i+3]=l[t]}else if(a)for(let e=0;e<n.width;e++){const t=s+e*o,i=d+e*o,r=new Zr(l[t+0]/255,l[t+1]/255,l[t+2]/255,l[t+3]).toNonPremultipliedRenderColor(a).toArray();c[i+0]=r[0],c[i+1]=r[1],c[i+2]=r[2],c[i+3]=r[3]}else for(let e=0;e<n.width*o;e++)c[d+e]=l[s+e]}return t}class Rd{constructor(e,t){Md(this,e,1,t)}resize(e){Pd(this,new Rd(e),1)}clone(){return new Rd({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,i,r,n){Cd(e,t,i,r,n,1,null)}}class zd{constructor(e,t){Md(this,e,4,t)}resize(e){Pd(this,new zd(e),4)}replace(e,t){t?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new zd({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,i,r,n,o,a){Cd(e,t,i,r,n,4,o,a)}}class Ld{constructor(e,t){this.width=e.width,this.height=e.height,this.data=t instanceof Uint8Array?new Float32Array(t.buffer):t}}Rs(Rd,"AlphaImage"),Rs(zd,"RGBAImage"),Rs(class{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.image=new Rd({width:e,height:t}),this.positions={},this.uploaded=!1}getDash(e,t){const i=this.getKey(e,t);return this.positions[i]}trim(){const e=this.width,t=this.height=xt(this.nextRow);this.image.resize({width:e,height:t})}getKey(e,t){return e.join(",")+t}getDashRanges(e,t,i){const r=[];let n=e.length%2==1?-e.at(-1)*i:0,o=e[0]*i,a=!0;r.push({left:n,right:o,isDash:a,zeroLength:0===e[0]});let s=e[0];for(let l=1;l<e.length;l++){a=!a;const t=e[l];n=s*i,s+=t,o=s*i,r.push({left:n,right:o,isDash:a,zeroLength:0===t})}return r}addRoundDash(e,t,i){const r=t/2;for(let n=-i;n<=i;n++){const t=this.width*(this.nextRow+i+n);let o=0,a=e[o];for(let s=0;s<this.width;s++){s/a.right>1&&(a=e[++o]);const l=Math.abs(s-a.left),c=Math.abs(s-a.right),u=Math.min(l,c);let h;const d=n/i*(r+1);if(a.isDash){const e=r-Math.abs(d);h=Math.sqrt(u*u+e*e)}else h=r-Math.sqrt(u*u+d*d);this.image.data[t+s]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(e,t){for(let s=e.length-1;s>=0;--s){const t=e[s],i=e[s+1];t.zeroLength?e.splice(s,1):i&&i.isDash===t.isDash&&(i.left=t.left,e.splice(s,1))}const i=e[0],r=e.at(-1);i.isDash===r.isDash&&(i.left=r.left-this.width,r.right=i.right+this.width);const n=this.width*this.nextRow;let o=0,a=e[o];for(let s=0;s<this.width;s++){s/a.right>1&&(a=e[++o]);const i=Math.abs(s-a.left),r=Math.abs(s-a.right),l=Math.min(i,r);this.image.data[n+s]=Math.max(0,Math.min(255,(a.isDash?l:-l)+t+128))}}addDash(e,t){const i=this.getKey(e,t);if(this.positions[i])return this.positions[i];const r="round"===t,n=r?7:0,o=2*n+1;if(this.nextRow+o>this.height)return Tt("LineAtlas out of space"),null;0===e.length&&e.push(1);let a=0;for(let d=0;d<e.length;d++)e[d]<0&&(Tt("Negative value is found in line dasharray, replacing values with 0"),e[d]=0),a+=e[d];if(0!==a){const i=this.width/a,o=this.getDashRanges(e,this.width,i);r?this.addRoundDash(o,i,n):this.addRegularDash(o,"square"===t?.5*i:0)}const s=this.nextRow+n;let l=0;if(0!==a){const e=this.width*s;for(let t=0;t<this.width;t++)this.image.data[e+t]>=128&&l++}const c=Math.round(l/this.width*4095);this.nextRow+=o;const u=Math.floor(a),h={tl:[s,n|c<<4],br:[u,Math.round(65535*(a-u))]};return this.positions[i]=h,h}},"LineAtlas");const Fd="3d_elevation_id",Od="level",Bd=td.types,kd=Math.cos(Math.PI/180*37.5),Vd=Math.cos(Math.PI/180*5);class Nd{constructor(e){this.evaluationGlobals={zoom:0,lineProgress:void 0},this.elevationType="none",this.isSeaLevelReference=!1,this.showElevationIdDebug=!1,this.terrainEnabled=!1,this.zoom=e.zoom,this.evaluationGlobals.zoom=this.zoom,this.overscaling=e.overscaling,this.pixelRatio=e.pixelRatio,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.borderGradients={}
vendor: 15,714 bytes, line 2
2,this.layers.forEach(e=>{this.gradients[e.id]={},this.borderGradients[e.id]={}}),this.layoutVertexArray=new yu,this.layoutVertexArray2=new xu,this.patternVertexArray=new xu,this.indexArray=new Ru,this.programConfigurations=new kh(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new uh,this.sourceLayerName=e.sourceLayerName||"",this.maxLineLength=0,this.zOffsetVertexArray=new Iu,this.elevationIdColVertexArray=new xu,this.elevationGroundScaleVertexArray=new pu,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.tessellationStep=e.tessellationStep?e.tessellationStep:128,this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,t){}updateAppearances(e,t,i,r){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,i,r){this.showElevationIdDebug=t.showElevationIdDebug,this.terrainEnabled=t.terrainEnabled,this.hasPattern=Tc("line",this.layers,this.pixelRatio,t);const n=this.layers[0].layout.get("line-sort-key");this.tileToMeter=qc(i);const o=this.layers[0].layout.get("line-elevation-reference");if("hd-road-markup"===o)this.elevationType="road";else{const e=this.layers[0].layout.get("line-z-offset"),t=e.isConstant()&&!e.constantOr(0);this.elevationType="sea"!==o&&"ground"!==o&&t?"none":"offset","offset"===this.elevationType&&"none"===o&&Tt(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`),this.isSeaLevelReference="sea"===o}const a=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope="offset"===this.elevationType&&void 0!==a;const s=[];for(const{feature:h,id:d,index:p,sourceLayerIndex:f}of e){const e=this.layers[0]._featureFilter.needGeometry,o=ru(h,e);if(!this.layers[0]._featureFilter.filter(new ll(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),o,i))continue;const a=n?n.evaluate(o,{},i):void 0,l={id:d,properties:h.properties,type:h.type,sourceLayerIndex:f,index:p,geometry:e?o.geometry:iu(h,i,r),patterns:{},sortKey:a};s.push(l)}n&&s.sort((e,t)=>e.sortKey-t.sortKey);const{lineAtlas:l,featureIndex:c}=t,u=this.addConstantDashes(l);for(const h of s){const{geometry:r,index:n,sourceLayerIndex:o}=h;if(u&&this.addFeatureDashes(h,l),this.hasPattern){const e=Dc("line",this.layers,h,this.zoom,this.pixelRatio,t);this.patternFeatures.push(e)}else this.addFeature(h,r,n,i,l.positions,t.availableImages,t.brightness,t.elevationFeatures,t.elevationParams,t.crossSourceElevationEnabled);c.insert(e[n].feature,r,n,o,this.index)}!this.hasPattern&&this.hdExt&&this.hdExt.buildFrcSegments(this),this.hdExt&&this.hdExt.endPopulate()}addConstantDashes(e){let t=!1;for(const i of this.layers){const r=i.paint.get("line-dasharray").value,n=i.layout.get("line-cap").value;if("constant"!==r.kind||"constant"!==n.kind)t=!0;else{const t=n.value,i=r.value;if(!i)continue;e.addDash(i,t)}}return t}addFeatureDashes(e,t){const i=this.zoom;for(const r of this.layers){const n=r.paint.get("line-dasharray").value,o=r.layout.get("line-cap").value;if("constant"===n.kind&&"constant"===o.kind)continue;let a,s;if("constant"===n.kind){if(a=n.value,!a)continue}else a=n.evaluate({zoom:i},e);s="constant"===o.kind?o.value:o.evaluate({zoom:i},e),t.addDash(a,s),e.patterns[r.id]=[t.getKey(a,s)]}}update(e,t,i,r,n,o,a,s,l){this.programConfigurations.updatePaintArrays(e,t,n,i,r,o,a,l)}updateExpressions(e){this.programConfigurations.updateExpressions(e)}addFeatures(e,t,i,r,n,o){for(const a of this.patternFeatures)this.addFeature(a,a.geometry,a.index,t,i,r,o,e.elevationFeatures,e.elevationParams,e.crossSourceElevationEnabled);this.hdExt&&(this.hdExt.buildFrcSegments(this),this.hdExt.endPopulate())}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Jh)),0!==this.patternVertexArray.length&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,ed)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,qh.members,!0)),!this.elevationIdColVertexBuffer&&this.elevationIdColVertexArray.length>0&&(this.elevationIdColVertexBuffer=e.createVertexBuffer(this.elevationIdColVertexArray,Zh.members,!0)),!this.elevationGroundScaleVertexBuffer&&this.elevationGroundScaleVertexArray.length>0&&(this.elevationGroundScaleVertexBuffer=e.createVertexBuffer(this.elevationGroundScaleVertexArray,Xh.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Yh),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.elevationIdColVertexBuffer&&this.elevationIdColVertexBuffer.destroy(),this.elevationGroundScaleVertexBuffer&&this.elevationGroundScaleVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e,t){let i,r;if(t&&t>0?(i=`mapbox_clip_start_${t}`,r=`mapbox_clip_end_${t}`):(i="mapbox_clip_start",r="mapbox_clip_end"),e.properties&&Object.hasOwn(e.properties,i)&&Object.hasOwn(e.properties,r))return{start:+e.properties[i],end:+e.properties[r]}}addFeature(e,t,i,r,n,o,a,s,l,c){const u=this.layers[0].layout,h=this.hdExt?this.hdExt.trackFeatureFrc(e.properties):null,d=this.indexArray.length,p=u.get("line-join").evaluate(e,{}),f=u.get("line-cap").evaluate(e,{}),m=u.get("line-miter-limit"),_=u.get("line-round-limit");this.lineClips=this.lineFeatureClips(e),this.lineFeature=e;const g=!(!e.properties||!Object.hasOwn(e.properties,"mapbox_line_metrics"))&&e.properties.mapbox_line_metrics;this.zOffsetValue=u.get("line-z-offset").value;const y=this.layers[0].paint,x=y.get("line-width").value;"constant"!==x.kind&&!1===x.isLineProgressConstant&&(this.variableWidthValue=x);const v=y.get("line-emissive-strength").value;if("constant"!==v.kind&&!1===v.isLineProgressConstant&&(this.variableEmissiveStrengthValue=v),this.isSeaLevelReference){const e=u.get("line-elevation-ground-scale").value;"constant"===e.kind&&0===e.value||(this.elevationGroundScaleValue=e)}if(null==this.hdExt||!this.hdExt.handleFeature(e,t,r,s,l,!!c,p,f,m,_,this))for(let b=0;b<t.length;b++)this.addLine(t[b],e,r,p,f,m,_,void 0,g&&b>0?b:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,o,r,a,void 0,this.worldview),this.hdExt&&this.hdExt.recordFeatureRange(this,d,this.indexArray.length,h)}fillNonElevatedRoadSegment(e){for(let t=Math.max(e,this.zOffsetVertexArray.length);t<this.layoutVertexArray.length;t++)this.zOffsetVertexArray.emplaceBack(0,0,0,0),this.showElevationIdDebug&&this.elevationIdColVertexArray.emplaceBack(0,0,0)}addLine(e,t,i,r,n,o,a,s,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(t,l):this.lineClips;const c="none"===r;this.patternJoinNone=this.hasPattern&&c,this.currentLineJoinType=r,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[];const u=s&&s.progress.min>0,h=s&&s.progress.max<1;if(this.lineClips){let i={min:this.lineClips.start,max:this.lineClips.end},r=1;if(s){const e=this.lineClips.end-this.lineClips.start;i=function(e,t,i){return{min:Ht(e.min,t,i),max:Ht(e.max,t,i)}}(s.progress,{min:0,max:1},i),e>0&&(r=(i.max-i.min)/e)}const n=+t.properties.mapbox_clip_feature_len,o=+t.properties.mapbox_clip_seg_len;if(Number.isNaN(n)||Number.isNaN(o)){for(let i=0;i<e.length-1;i++)this.totalDistance+=e[i].dist(e[i+1]);const t=this.totalDistance/(i.max-i.min);this.totalFeatureLength=Number.isFinite(t)?t:0,this.lineClips.start=i.min,this.lineClips.end=i.max,this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}else this.totalFeatureLength=n,this.totalDistance=o*r,this.lineClips.start=i.min,this.lineClips.end=i.max,this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance);this.lineClipsArray.push(this.lineClips),this.updateScaledDistance()}const d="Polygon"===Bd[t.type];let p=e.length;for(;p>=2&&e[p-1].equals(e[p-2]);)p--;let f=0;for(;f<p-1&&e[f].equals(e[f+1]);)f++;if(p<(d?3:2))return;"bevel"===r&&(o=1.05);const m=this.segments.prepareSegment(10*p,this.layoutVertexArray,this.indexArray);let _,g,y,x,v,b,w,E;s&&s.prevDir&&(b=s.prevDir.perp()),s&&s.nextDir&&(w=s.nextDir.perp()),this.e1=this.e2=-1,d&&(_=e[p-2],v=e[f].sub(_)._unit()._perp());for(let A=f;A<p;A++){if(y=A===p-1?d?e[f+1]:void 0:e[A+1],y&&e[A].equals(y))continue;v&&(x=v),_&&(g=_),_=e[A],E=this.evaluateLineProgressFeatures(g?g.dist(_):0),v=y?y.sub(_)._unit()._perp():x,x=x||v;const t=g&&y;let i=t?r:d||c?"butt":n;const s=x.x*v.x+x.y*v.y;if(c){const e=function(e){if(e.patternJoinNone){const t=e.segmentPoints.length/2,i=e.lineSoFar-e.segmentStart;for(let r=0;r<t;++r){const t=e.segmentPoints[2*r+1],n=Math.round(e.segmentPoints[2*r])+.5+.25*t;e.patternVertexArray.emplaceBack(n,i,e.segmentStart),e.patternVertexArray.emplaceBack(n,i,e.segmentStart)}e.segmentPoints.length=0}e.e1=e.e2=-1};if(t&&s<Vd){this.updateDistance(g,_),this.addCurrentVertex(_,x,1,1,m,E),e(this),this.addCurrentVertex(_,v,-1,-1,m,E);continue}if(g){if(!y){this.updateDistance(g,_),this.addCurrentVertex(_,x,1,1,m,E),e(this);continue}i="miter"}}let l=x.add(v);0===l.x&&0===l.y||l._unit();const I=l.x*v.x+l.y*v.y,S=0!==I?1/I:1/0,T=2*Math.sqrt(2-2*I),D=I<kd&&g&&y,M=x.x*v.y-x.y*v.x>0,P=this.overscaling<=16?122880/(512*this.overscaling):0;if(t&&"round"===i)if(S<a)i="miter";else if(S<=2){const e=Ud(_,-10,8202);i="offset"===this.elevationType&&(e||this.hasCrossSlope)?"miter":"fakeround"}if("miter"===i&&S>o&&(i="bevel"),"bevel"===i&&(S>2&&(i="flipbevel"),S<o&&(i="miter")),g&&!("miter"===i&&D)&&this.updateDistance(g,_),"miter"===i)if(D){const e=_.dist(g);if(e>2*P){const t=_.sub(_.sub(g)._mult(P/e)._round());this.updateDistance(g,t),this.addCurrentVertex(t,x,0,0,m,E),g=t}this.updateDistance(g,_),l._mult(S),this.addCurrentVertex(_,l,0,0,m,E);const t=_.dist(y);if(t>2*P){const e=_.add(y.sub(_)._mult(P/t)._round());this.updateDistance(_,e),this.addCurrentVertex(e,v,0,0,m,E),_=e}}else l._mult(S),this.addCurrentVertex(_,l,0,0,m,E);else if("flipbevel"===i){if(S>100)l=v.mult(-1);else{const e=S*x.add(v).mag()/x.sub(v).mag();l._perp()._mult(e*(M?-1:1))}this.addCurrentVertex(_,l,0,0,m,E),this.addCurrentVertex(_,l.mult(-1),0,0,m,E)}else if("bevel"===i||"fakeround"===i){const e=_.dist(g);let t=1;if("offset"===this.elevationType&&"bevel"===i&&"round"!==this.currentLineJoinType&&!this.patternJoinNone&&null!=E&&g&&y){const i=4*P;e<i&&(t=Math.max(0,e/i))}null!=E&&g&&this.addCurrentVertex(_,w||x,-t,-t,m,E);const r=e<=1*P&&"bevel"!==i,n=r?1:S,o=l.mult(M?1:-1);o._mult(n);const a=v.mult(M?-1:1),c=x.mult(M?-1:1),u=this.evaluateLineProgressFeatures(this.distance);if(null==E&&(this.addHalfVertex(_,o.x,o.y,!1,!M,0,m,u),r||this.addHalfVertex(_,o.x+2*c.x,o.y+2*c.y,!1,M,0,m,u)),"fakeround"===i){const e=Math.round(180*T/Math.PI/20);this.addHalfVertex(_,c.x,c.y,!1,M,0,m,u);for(let t=0;t<e;t++){let i=t/e;if(.5!==i){const e=i-.5;i+=i*e*(i-1)*((1.0904+s*(s*(3.55645-1.43519*s)-3.2452))*e*e+(.848013+s*(.215638*s-1.06021)))}const r=a.sub(c)._mult(i)._add(c)._unit();this.addHalfVertex(_,r.x,r.y,!1,M,0,m,u)}this.addHalfVertex(_,a.x,a.y,!1,M,0,m,u)}r||null!=E||this.addHalfVertex(_,o.x+2*a.x,o.y+2*a.y,!1,M,0,m,u),null!=E&&y&&this.addCurrentVertex(_,b||v,t,t,m,E)}else if("butt"===i)this.addCurrentVertex(_,l,0,0,m,E);else if("square"===i){if(!g){const e=u?0:-1;this.addCurrentVertex(_,l,e,e,m,E)}if(this.addCurrentVertex(_,l,0,0,m,E),g){const e=h?0:1;this.addCurrentVertex(_,l,e,e,m,E)}}else if("round"===i){if(g){const e=!t&&w?w:x;this.addCurrentVertex(_,e,0,0,m,E),!t&&h||this.addCurrentVertex(_,e,1,1,m,E,!0)}if(y){const e=!t&&b?b:v;!t&&u||this.addCurrentVertex(_,e,-1,-1,m,E,!0),this.addCurrentVertex(_,e,0,0,m,E)}}}}addVerticesTo(e,t,i,r,n,o,a,s,l,c){const u=(t.w-e.w)/this.tessellationStep|0;let h=0;const d=this.scaledDistance;if(u>1){this.lineSoFar=e.w;const i=(t.x-e.x)/u,r=(t.y-e.y)/u,n=(t.z-e.z)/u,o=(t.w-e.w)/u,a=t.x-e.x,s=t.y-e.y,d=Math.sqrt(a*a+s*s);if(0===d)return;const p=-s/d,f=a/d,m=p,_=f,g=-p,y=-f;for(let t=1;t<u;++t){e.x+=i,e.y+=r,e.z+=n,this.lineSoFar+=o,h+=o;const t=this.evaluateLineProgressFeatures(this.prevDistance+h);this.scaledDistance=(this.prevDistance+h)/this.totalDistance,this.addHalfVertex(e,m,_,c,!1,0,l,t),this.addHalfVertex(e,g,y,c,!0,0,l,t)}}this.lineSoFar=t.w,this.scaledDistance=d;const p=this.evaluateLineProgressFeatures(this.distance);this.addHalfVertex(t,i,r,c,!1,a,l,p),this.addHalfVertex(t,n,o,c,!0,-s,l,p)}evaluateLineProgressFeatures(e){if(!this.variableWidthValue&&!this.variableEmissiveStrengthValue&&"offset"!==this.elevationType)return null;this.evaluationGlobals.lineProgress=0,this.lineClips?this.evaluationGlobals.lineProgress=Math.min(1,(this.totalFeatureLength*this.lineClips.start+e)/this.totalFeatureLength):Tt(`line-progress evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`);let t=0;this.variableWidthValue&&"constant"!==this.variableWidthValue.kind&&(t=this.variableWidthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,t*=.5);let i=0;this.variableEmissiveStrengthValue&&"constant"!==this.variableEmissiveStrengthValue.kind&&(i=this.variableEmissiveStrengthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0);const r=this.evaluateElevationGroundScale();return"offset"!==this.elevationType?{zOffset:0,variableWidth:t,elevationGroundScale:r,variableEmissiveStrength:i}:"constant"===this.zOffsetValue.kind?{zOffset:this.zOffsetValue.value,variableWidth:t,elevationGroundScale:r,variableEmissiveStrength:i}:{zOffset:this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,variableWidth:t,elevationGroundScale:r,variableEmissiveStrength:i}}evaluateElevationGroundScale(){return this.elevationGroundScaleValue?"constant"===this.elevationGroundScaleValue.kind?this.elevationGroundScaleValue.value:this.elevationGroundScaleValue.evaluate(this.evaluationGlobals,this.lineFeature)||0:0}addCurrentVertex(e,t,i,r,n,o,a=!1){const s=t.x+t.y*i,l=t.y-t.x*i,c=t.y*r-t.x,u=-t.y-t.x*r;if(null!=o){const t="offset"===this.elevationType,h="offset"===this.elevationType?2:10,d=-h,p=co+h,f=o.zOffset,m=new Ed(e.x,e.y,f,this.lineSoFar),_=!!t&&Ud(e,d,p),g=this.lineSoFar,y=this.distance;if(this.currentVertex)if(_){const t=this.currentVertexIsOutside,o=this.currentVertex,h=new Ed(e.x,e.y,f,this.lineSoFar);if(Id(o,h,d,p),!Ud(h,d,p)){if(t){this.e1=this.e2=-1,this.distance-=o.dist(m),this.lineSoFar=o.w;const e=this.evaluateLineProgressFeatures(o.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(o,s,l,a,!1,i,n,e),this.addHalfVertex(o,c,u,a,!0,-r,n,e),this.prevDistance=this.distance}this.distance=this.prevDistance+o.dist(h),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(o,h,s,l,c,u,i,r,n,a),this.distance=y,this.scaledDistance=this.distance/this.totalDistance}}else{const e=this.currentVertex;if(this.currentVertexIsOutside){Id(e,m,d,p),this.e1=this.e2=-1,this.distance-=e.dist(m),this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=e.w;const t=this.evaluateLineProgressFeatures(e.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(e,s,l,a,!1,i,n,t),this.addHalfVertex(e,c,u,a,!0,-r,n,t),this.prevDistance=this.distance,this.distance=y,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo(e,m,s,l,c,u,i,r,n,a)}else _||(this.addHalfVertex(e,s,l,a,!1,i,n,o),this.addHalfVertex(e,c,u,a,!0,-r,n,o));
vendor: 9,284 bytes, line 2
2this.currentVertex=m,this.currentVertexIsOutside=_,this.lineSoFar=g}else this.addHalfVertex(e,s,l,a,!1,i,n,o),this.addHalfVertex(e,c,u,a,!0,-r,n,o)}addHalfVertex({x:e,y:t},i,r,n,o,a,s,l){if(this.patternJoinNone&&(0===this.segmentPoints.length&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),o||this.segmentPoints.push(this.lineSoFar-this.segmentStart,a)),this.layoutVertexArray.emplaceBack((e<<1)+(n?1:0),(t<<1)+(o?1:0),Math.round(63*i)+128,Math.round(63*r)+128,1+(0===a?0:a<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips){const e=Wr(this.lineClips.start,this.lineClips.end,this.scaledDistance);this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,e)}const c=s.vertexLength++;if(this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,c),s.primitiveLength++),o?this.e2=c:this.e1=c,null!=l&&(this.zOffsetVertexArray.emplaceBack(l.zOffset,l.variableWidth,l.variableWidth,l.variableEmissiveStrength),this.showElevationIdDebug&&this.elevationIdColVertexArray.emplaceBack(0,0,0)),this.elevationGroundScaleValue){const e=l?l.elevationGroundScale:this.evaluateElevationGroundScale();this.elevationGroundScaleVertexArray.emplaceBack(e)}}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(e,t){this.prevDistance=this.distance,this.distance+=e.dist(t),this.updateScaledDistance()}}function Ud(e,t,i){return e.x<t||e.x>i||e.y<t||e.y>i}Rs(Nd,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const jd=lu([{name:"a_pos",components:2,type:"Int16"}],4),Gd=lu([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),Hd=lu([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class $d{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new uu,this.indexArray=new Ru,this.segments=new uh,this.programConfigurations=new kh(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,t){}updateAppearances(e,t,i,r){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,i,r){const n=this.layers[0],o=[];let a=null;"circle"===n.type&&(a=n.layout.get("circle-sort-key"));for(const{feature:l,id:c,index:u,sourceLayerIndex:h}of e){const e=this.layers[0]._featureFilter.needGeometry,n=ru(l,e);if(!this.layers[0]._featureFilter.filter(new ll(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),n,i))continue;const s=a?a.evaluate(n,{},i):void 0,d={id:c,properties:l.properties,type:l.type,sourceLayerIndex:h,index:u,geometry:e?n.geometry:iu(l,i,r),patterns:{},sortKey:s};o.push(d)}a&&o.sort((e,t)=>e.sortKey-t.sortKey);let s=null;"globe"===r.projection.name&&(this.globeExtVertexArray=new wu,s=r.projection);for(const l of o){const{geometry:r,index:n,sourceLayerIndex:o}=l,a=e[n].feature;this.addFeature(l,r,n,t.availableImages,i,s,t.brightness,t.elevationFeatures),t.featureIndex.insert(a,r,n,o,this.index)}this.hdExt&&this.hdExt.finalize()}update(e,t,i,r,n,o,a){this.programConfigurations.updatePaintArrays(e,t,n,i,r,o,a,this.worldview)}updateExpressions(e){this.programConfigurations.updateExpressions(e)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,jd.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Hd.members)),this.hdExt&&this.hdExt.upload(e)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.hdExt&&this.hdExt.destroy())}addFeature(e,t,i,r,n,o,a,s){this.hdExt&&this.hdExt.beginFeature(e,s,n);for(const l of t)for(const t of l){const i=t.x,r=t.y;if(i<0||i>=co||r<0||r>=co)continue;if(o){const e=o.projectTilePoint(i,r,n),t=o.upVector(n,i,r);this.addGlobeExtVertex(e,t),this.addGlobeExtVertex(e,t),this.addGlobeExtVertex(e,t),this.addGlobeExtVertex(e,t)}const a=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),s=a.vertexLength;this.addCircleVertex(i,r,-1,-1),this.addCircleVertex(i,r,1,-1),this.addCircleVertex(i,r,1,1),this.addCircleVertex(i,r,-1,1),this.hdExt&&this.hdExt.writeVertexQuad(i,r),this.indexArray.emplaceBack(s,s+1,s+2),this.indexArray.emplaceBack(s,s+2,s+3),a.vertexLength+=4,a.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{},r,n,a,void 0,this.worldview)}addCircleVertex(e,t,i,r){this.layoutVertexArray.emplaceBack(2*e+(i+1)/2,2*t+(r+1)/2)}addGlobeExtVertex(e,t){const i=16384;this.globeExtVertexArray.emplaceBack(e.x,e.y,e.z,t[0]*i,t[1]*i,t[2]*i)}}Rs($d,"CircleBucket",{omit:["layers"]});const Wd=lu([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),qd=lu([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),Zd=lu([{name:"a_projected_pos",components:4,type:"Float32"}],4);lu([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Xd=lu([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),Yd=lu([{name:"a_feature_index",components:1,type:"Float32"}],4),Kd=lu([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),Jd=lu([{name:"a_texb",components:2,type:"Uint16"}]),Qd=lu([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),ep=lu([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);lu([{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 tp=lu([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),ip=lu([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);lu([{name:"triangle",components:3,type:"Uint16"}]),lu([{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"}]),lu([{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"}
vendor: 14,689 bytes, line 2
2]),lu([{type:"Float32",name:"offsetX"}]),lu([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);const rp=new Float32Array(1),np=new Uint32Array(rp.buffer);function op(e){return rp[0]=e,np[0]}const ap=class e{static getBlockIndices(t){let i=e._blockIndicesTemplate;if(!i){i=e._blockIndicesTemplate=new Uint32Array(t);for(let e=0;e<t;e++)i[e]=e}return i}constructor(e,t,i,r){this.batchIndex=t,this.headerBuffer=null,this.propertiesBuffer=null,this.blockIndicesBuffer=null,this.context=e||null,this.propsDwords=i,this.totalBytes=4*this.propsDwords,this.headerData=r,this.propertiesData=new Float32Array(this.propsDwords),this._headerDirty=!0,this._propsDirtyMin=-1,this._propsDirtyMax=-1,this._blockIndicesDirty=!0,e&&this._initBuffers(e)}_initBuffers(t){const i=t.gl;if(this.totalBytes>t.maxUniformBlockSize)throw new Error(`UBO size ${this.totalBytes} exceeds device limit ${t.maxUniformBlockSize}`);i.isContextLost()||(this.headerBuffer=i.createBuffer(),i.bindBuffer(i.UNIFORM_BUFFER,this.headerBuffer),i.bufferData(i.UNIFORM_BUFFER,e.HEADER_BYTES,i.DYNAMIC_DRAW),this.propertiesBuffer=i.createBuffer(),i.bindBuffer(i.UNIFORM_BUFFER,this.propertiesBuffer),i.bufferData(i.UNIFORM_BUFFER,this.totalBytes,i.DYNAMIC_DRAW),this.blockIndicesBuffer=i.createBuffer(),i.bindBuffer(i.UNIFORM_BUFFER,this.blockIndicesBuffer),i.bufferData(i.UNIFORM_BUFFER,this.totalBytes,i.DYNAMIC_DRAW),i.bindBuffer(i.UNIFORM_BUFFER,null))}markHeaderDirty(){this._headerDirty=!0}writeDataDrivenBlock(e,t){const i=this.headerData,r=4*i[2];if(0===r)return;const n=t*r;if(n+r>this.propertiesData.length)throw new Error(`UBO write out of bounds: feature index ${t} exceeds propertiesData capacity`);const o=i[0];for(let s=0;s<9;s++)o&1<<s&&this._copyFromFlat(n+4*i[3+s],s,e);(-1===this._propsDirtyMin||n<this._propsDirtyMin)&&(this._propsDirtyMin=n);const a=n+r;a>this._propsDirtyMax&&(this._propsDirtyMax=a)}rightSizeForTransfer(){const e=-1===this._propsDirtyMax?0:this._propsDirtyMax;e<this.propertiesData.length&&(this.propertiesData=this.propertiesData.slice(0,e))}_copyFromFlat(t,i,r){let n=4;(i<2||8===i)&&(n=this.headerData[1]>>>i&1?8:4);const o=e.EVAL_FLAT_OFFSETS[i];this.propertiesData.set(r.subarray(o,o+n),t)}upload(t){this.context||(this.context=t);const i=t.gl;this.headerBuffer&&this.propertiesBuffer&&this.blockIndicesBuffer||this._initBuffers(t);let r=!1;if(this._headerDirty&&(i.bindBuffer(i.UNIFORM_BUFFER,this.headerBuffer),i.bufferSubData(i.UNIFORM_BUFFER,0,this.headerData),this._headerDirty=!1,r=!0),-1!==this._propsDirtyMin){const e=this._propsDirtyMin,t=this._propsDirtyMax;i.bindBuffer(i.UNIFORM_BUFFER,this.propertiesBuffer),i.bufferSubData(i.UNIFORM_BUFFER,4*e,this.propertiesData,e,t-e),this._propsDirtyMin=-1,this._propsDirtyMax=-1,r=!0}this._blockIndicesDirty&&(i.bindBuffer(i.UNIFORM_BUFFER,this.blockIndicesBuffer),i.bufferSubData(i.UNIFORM_BUFFER,0,e.getBlockIndices(this.propsDwords)),this._blockIndicesDirty=!1,r=!0),r&&i.bindBuffer(i.UNIFORM_BUFFER,null)}bind(e,t){const i=e.gl,r=(e,r,n)=>{if(!r)return;const o=i.getUniformBlockIndex(t,e);o!==i.INVALID_INDEX&&(i.uniformBlockBinding(t,o,n),i.bindBufferBase(i.UNIFORM_BUFFER,n,r))},n=3*this.batchIndex;r("SymbolPaintPropertiesHeaderUniform",this.headerBuffer,n),r("SymbolPaintPropertiesUniform",this.propertiesBuffer,n+1),r("SymbolPaintPropertiesIndexUniform",this.blockIndicesBuffer,n+2)}destroy(){if(this.context){const e=this.context.gl;this.headerBuffer&&(e.deleteBuffer(this.headerBuffer),this.headerBuffer=null),this.propertiesBuffer&&(e.deleteBuffer(this.propertiesBuffer),this.propertiesBuffer=null),this.blockIndicesBuffer&&(e.deleteBuffer(this.blockIndicesBuffer),this.blockIndicesBuffer=null)}}};ap.HEADER_DWORDS=16,ap.HEADER_BYTES=64,ap.EVAL_FLAT_OFFSETS=[0,8,16,20,24,28,32,36,40],ap.EVAL_FLAT_TOTAL=48,ap._blockIndicesTemplate=null;let sp=ap;function lp(e,t,i,r,n,o,a,s){return!!e&&("constant"===e.kind?"none"===e.value:"none"===e.evaluate({zoom:0,brightness:o,worldview:s},t,i,n,r,a))}function cp(e){if(!(e instanceof ml))return!1;const t=e.value;return("source"===t.kind||"composite"===t.kind)&&t.isStateDependent}Rs(sp,"SymbolPropertiesUBO",{omit:["headerBuffer","propertiesBuffer","blockIndicesBuffer"]});const up=["icon","text"].map(e=>[`${e}-color`,`${e}-halo-color`,`${e}-opacity`,`${e}-halo-width`,`${e}-halo-blur`,`${e}-emissive-strength`,`${e}-occlusion-opacity`,"symbol-z-offset",`${e}-translate`]),hp=new Float32Array(sp.EVAL_FLAT_TOTAL),dp=[0,0],pp=new WeakMap;class fp{constructor(e,t,i,r,n="",o,a){this.layer=e,this.zoom=t,this.lut=i,this.isText=r,this.worldview=n,this.maxUniformBufferBindings=o||24,this.uboSizeDwords=a||4096,this.allFeatureVtIndices=[],this.allFeatureIds=[],this.allFormattedSections=[],this.featureVertexRangesFromId=null,this.featureVertexRangesFromVtIndex=null,this.ubos=[],this.featureCount=0,this.cachedConstantUniforms=null,this.cachedConstantRenderZoom=null,this.cachedConstantBrightness=void 0,this.cachedConstantPaint=null,this.activeAppearanceByVtIndex=null,this.zoomDependency=new Uint8Array(9),this.sharedZoomRanges=new Float32Array(18),this._zoomRangeScratch=new Float32Array(2),this._floorZoom=Math.floor(this.zoom),this.header=new Uint32Array(sp.HEADER_DWORDS),this.updateHeader(),this.isAllConstant=0===this.header[0];const s=4*this.header[2];this.maxFeaturesPerBatch=0===s?Number.MAX_SAFE_INTEGER:Math.floor(this.uboSizeDwords/s)}updateHeader(){const e=this.layer.paint;let t=0,i=0,r=0,n=0,o=!0;const a=this._floorZoom,s=up[+this.isText];for(let l=0;l<9;l++){const c=s[l],u=l<2,h=e.get(c),d=!(!h||"function"!=typeof h.isConstant||h.isConstant()),p=this._appearancesHavePaintProperties(c);if(!d&&!p){const e=this._layerUnevaluated(c);e&&e.expression&&"camera"===e.expression.kind&&(r|=1<<l);continue}t|=1<<l;const f=this._collectZoomSignatures(c,a),m=f.hasZoom,_=f.differs,g=8===l;this.zoomDependency[l]=_?2:m?1:0;const y=_||g&&m;y&&(i|=1<<l);const x=h&&h.value;x&&!1===x.isLightConstant&&(o=!1),this.header[3+l]=n,n+=y?2:1,m&&!_&&f.representative&&(this._computeZoomRange(f.representative,a,this.sharedZoomRanges,2*l),u&&(this.header[12+2*l]=op(this.sharedZoomRanges[2*l]),this.header[12+2*l+1]=op(this.sharedZoomRanges[2*l+1])))}this.header[0]=t,this.header[1]=i,this.header[2]=n,this.isLightConstant=o,this.cameraMask=r}_recomputeSharedRanges(){const e=this._floorZoom,t=up[+this.isText];let i=0,r=!1;for(let n=0;n<9;n++){const o=t[n],a=this.zoomDependency[n];if(this.header[0]&1<<n){if(0!==a&&2!==a){const t=this._collectZoomSignatures(o,e);t.representative&&(this._computeZoomRange(t.representative,e,this.sharedZoomRanges,2*n),n<2&&(this.header[12+2*n]=op(this.sharedZoomRanges[2*n]),this.header[12+2*n+1]=op(this.sharedZoomRanges[2*n+1]),r=!0))}}else{const e=this._layerUnevaluated(o);e&&e.expression&&"camera"===e.expression.kind&&(i|=1<<n)}}if(this.cameraMask=i,r)for(const n of this.ubos)n.markHeaderDirty()}_collectZoomSignatures(e,t){let i=!1,r=!1,n=null,o=0,a=0;const s=e=>{if(!e)return;this._computeZoomRange(e,t,this._zoomRangeScratch,0);const s=this._zoomRangeScratch[0],l=this._zoomRangeScratch[1];i?s===o&&l===a||(r=!0):(i=!0,o=s,a=l,n=e)};s(this._zoomExprOf(this._layerUnevaluated(e)));for(const l of this.layer.getAppearances()||[])l.hasPaintProperty(e)&&s(this._zoomExprOf(l.getUnevaluatedPaintProperty(e)));return{hasZoom:i,differs:r,representative:n}}evaluateAllProperties(e,t,i,r,n,o,a){const s={brightness:n,worldview:this.worldview},l={feature:e,featureState:t,canonical:i,availableImages:r,params:new ll(this.zoom,s),paramsNext:new ll(this.zoom+1,s),formattedSection:o,activeAppearance:a},c=up[+this.isText];for(let u=0;u<9;u++){const e=c[u],t=u<2,i=8===u,r=this.zoomDependency[u],n=0!==r,o=2===r,a=sp.EVAL_FLAT_OFFSETS[u],s=a+(t||i?4:2);t?this._evaluateColorValue(e,u,n,o,s,l,a):i?this._evaluateTranslateValue(e,u,n,o,s,l,a):this._evaluateFloatValue(e,u,n,o,s,l,a)}return hp}_resolveProp(e,t,i=!1,r){const n=this.layer.paint,o=n.get(e),a=e,s=!(!t||!t.hasPaintProperty(a)),l=s?r&&o&&o.property.overrides&&o.property.overrides.hasOverride(r)?o:t.paintProperties.get(a):n.get(e);if(i||!l||"function"!=typeof l.isConstant||!l.isConstant())return l;const c=s?t.getUnevaluatedPaintProperty(a):this._layerUnevaluated(e);return this._unbakeCamera(l,c)}_unbakeCamera(e,t){const i=t&&t.expression;if(!i||"camera"!==i.kind)return e;let r=pp.get(t);return r||(r=new ml(e.property,i,e.parameters,e.iconImageUseTheme),pp.set(t,r)),r}_layerUnevaluated(e){const t=this.layer._transitionablePaint._values[e];return t&&t.value}_zoomExprOf(e){const t=e&&e.expression;return!t||"composite"!==t.kind&&"camera"!==t.kind?null:t}_evalAt(e,t,i){return e.property.evaluate(e.value,t,i.feature,i.featureState,i.canonical,i.availableImages,e.iconImageUseTheme,i.formattedSection)}_evaluateColorValue(e,t,i,r,n,o,a){const s=this._resolveProp(e,o.activeAppearance,!1,o.formattedSection);if(this._writePropertyZoomRange(t,i,r,s,n),!s)return hp[a]=0,hp[a+1]=0,hp[a+2]=0,void(hp[a+3]=1);const l=this._resolveProp(`${e}-use-theme`,o.activeAppearance,!0),c=lp(l&&"string"!=typeof l?l.value:void 0,o.feature,o.featureState,o.availableImages,o.canonical,o.params.brightness,o.formattedSection,this.worldview)?null:this.lut,u=(s.isConstant()?s.constantOr(Zr.transparent):this._evalAt(s,o.params,o)||Zr.transparent).toNonPremultipliedRenderColor(c);if(hp[a]=hh(255*u.r,255*u.g),hp[a+1]=hh(255*u.b,255*u.a),i){const e=(this._evalAt(s,o.paramsNext,o)||Zr.transparent).toNonPremultipliedRenderColor(c);hp[a+2]=hh(255*e.r,255*e.g),hp[a+3]=hh(255*e.b,255*e.a)}else hp[a+2]=hp[a],hp[a+3]=hp[a+1]}_computeZoomRange(e,t,i,r){let n=0,o=1;const a=!e||"composite"!==e.kind&&"camera"!==e.kind?null:e.zoomStops;if(a&&a.length>0)if(null==e.interpolationType){n=o=1;for(const e of a)if(e>t&&e<t+1){n=o=e-t;break}}else a[0]>t&&a[0]<t+1&&(n=a[0]-t);i[r]=n,i[r+1]=o}_writeZoomRange(e,t){this._computeZoomRange(e&&e.value,this._floorZoom,hp,t)}_writePropertyZoomRange(e,t,i,r,n){i?this._writeZoomRange(r,n):t?(hp[n]=this.sharedZoomRanges[2*e],hp[n+1]=this.sharedZoomRanges[2*e+1]):(hp[n]=0,hp[n+1]=0)}_evaluateFloatValue(e,t,i,r,n,o,a){const s=e.endsWith("opacity")?1:0,l=this._resolveProp(e,o.activeAppearance);this._writePropertyZoomRange(t,i,r,l,n);const c=(l?l.isConstant()?l.constantOr(s):this._evalAt(l,o.params,o):s)??s;if(hp[a]=c,i){const e=this._evalAt(l,o.paramsNext,o);hp[a+1]=e??s}else hp[a+1]=c}_evaluateTranslateValue(e,t,i,r,n,o,a){const s=this._resolveProp(e,o.activeAppearance);this._writePropertyZoomRange(t,i,r,s,n);const l=!!s&&"function"==typeof s.isConstant&&!s.isConstant(),c=s?"function"!=typeof s.isConstant?s:l?this._evalAt(s,o.params,o):s.constantOr(dp):void 0;if(hp[a]=c?c[0]:0,hp[a+1]=c?c[1]:0,i){const e=l?this._evalAt(s,o.paramsNext,o):c;hp[a+2]=e?e[0]:0,hp[a+3]=e?e[1]:0}else hp[a+2]=hp[a],hp[a+3]=hp[a+1]}_appearancesHavePaintProperties(e){return this.layer.getAppearances().some(t=>t.hasPaintProperty(e))}hasStateDependentPaint(e){const t=e.paint,i=up[+this.isText];for(const r of i)if(cp(t.get(r)))return!0;for(const r of e.getAppearances()||[])for(const e of i){const t=e;if(r.hasPaintProperty(t)&&cp(r.paintProperties.get(t)))return!0}return!1}hasPerFeatureTranslate(){return!!(256&this.header[0])}getCurrentBatchIndex(){return 0===this.maxFeaturesPerBatch?0:Math.floor(this.featureCount/this.maxFeaturesPerBatch)}_writeFeatureBlock(e,t){const i=this.isAllConstant?0:e;let r=Math.floor(i/this.maxFeaturesPerBatch),n=i%this.maxFeaturesPerBatch;this._batchExceedsDeviceLimit(r)&&(r=0,n=0);const o=this.ubos[r];return!!o&&(o.writeDataDrivenBlock(t,n),!0)}_batchExceedsDeviceLimit(e){return 3*e+2>=this.maxUniformBufferBindings}_reevaluateAt(e,t,i,r,n,o){if(!t)return;const a=this.allFeatureVtIndices[e],s=t.feature(a);if(!s)return;const l=this.allFeatureIds[e],c=null!=l&&n[l]||{},u={type:s.type,id:l,properties:s.properties||{},geometry:[]},h=this.activeAppearanceByVtIndex?this.activeAppearanceByVtIndex.get(a):void 0,d=this.evaluateAllProperties(u,c,i,r,o,(this.allFormattedSections?this.allFormattedSections[e]:void 0)||void 0,h);this._writeFeatureBlock(e,d)}_ensureRangeMaps(){if(!this.featureVertexRangesFromId){this.featureVertexRangesFromId=new Map,this.featureVertexRangesFromVtIndex=new Map;for(let e=0;e<this.allFeatureVtIndices.length;e++){const t=this.allFeatureIds[e];if(null!=t){let i=this.featureVertexRangesFromId.get(t);i||this.featureVertexRangesFromId.set(t,i=[]),i.push(e)}const i=this.allFeatureVtIndices[e];let r=this.featureVertexRangesFromVtIndex.get(i);r||this.featureVertexRangesFromVtIndex.set(i,r=[]),r.push(e)}}}populateUBO(e,t,i,r,n,o){const a=e.id,s=this.header,l=this.evaluateAllProperties(e,{},i,r,n,o);let c,u;this.isAllConstant?(c=0,u=0===this.featureCount,u&&(this.featureCount=1)):(c=this.featureCount++,u=!0);let h=Math.floor(c/this.maxFeaturesPerBatch),d=c%this.maxFeaturesPerBatch;return u&&(this._batchExceedsDeviceLimit(h)?(Tt(`Too many symbol features: batch ${h} requires binding points up to ${3*h+2}, device limit ${this.maxUniformBufferBindings}. Some features will render incorrectly.`),h=0,d=0):(this.ubos[h]||(this.ubos[h]=new sp(null,h,this.uboSizeDwords,s)),this.ubos[h].writeDataDrivenBlock(l,d))),this.allFeatureVtIndices.push(t),this.allFeatureIds.push(a),this.allFormattedSections.push(o||null),d}updateFeatures(e,t,i,r,n,o,a){this.layer=t,this.cachedConstantUniforms=null,this._ensureRangeMaps();for(const s of e){const e=this.featureVertexRangesFromId.get(s);if(e)for(const t of e)this._reevaluateAt(t,i,r,n,o,a)}}updateDynamicExpressions(e,t,i,r,n,o){if(this.layer=e,this.cachedConstantUniforms=null,this._recomputeSharedRanges(),0!==this.header[0])for(let a=0;a<this.allFeatureVtIndices.length;a++)this._reevaluateAt(a,t,i,r,n,o)}updateFeaturePaintForAppearance(e,t,i,r,n,o,a){if(!this.layer)return!1;if(this.activeAppearanceByVtIndex||(this.activeAppearanceByVtIndex=new Map),this.activeAppearanceByVtIndex.set(e,a||null),0===this.header[0])return!1;this._ensureRangeMaps();const s=this.featureVertexRangesFromVtIndex.get(e);if(!s)return!1;let l=!1;for(const c of s){const e=this.evaluateAllProperties(t,i,r,n,o,(this.allFormattedSections?this.allFormattedSections[c]:void 0)||void 0,a);l=this._writeFeatureBlock(c,e)||l}return l}getConstantUniformValues(e,t){const i=!!this.cameraMask;if(this.cachedConstantUniforms&&this.cachedConstantPaint===this.layer.paint&&this.cachedConstantBrightness===t&&(!i||this.cachedConstantRenderZoom===e))return this.cachedConstantUniforms;const r=this.layer.paint,n=i?new ll(e,{brightness:t,worldview:this.worldview}):null,o={type:1,id:void 0,properties:{},geometry:[]},a=up[+this.isText],s=e=>{const i=a[e],s=r.get(i);if(!s)return[0,0,0,1];const l=r.get(`${i}-use-theme`),c=lp(l&&"string"!=typeof l?l.value:void 0,o,{},[],void 0,t,void 0,this.worldview)?null:this.lut;
vendor: 29,065 bytes, line 2
2return(this.cameraMask&1<<e&&n?s.property.evaluate(s.value,n,o,{},void 0,[])||Zr.transparent:s.constantOr(Zr.transparent)).toNonPremultipliedRenderColor(c).toArray01()},l=(e,t)=>{const i=r.get(a[e]);return i?this.cameraMask&1<<e&&n?i.property.evaluate(i.value,n,o,{},void 0,[])??t:i.constantOr(t):t},c={fill_np_color:s(0),halo_np_color:s(1),opacity:l(2,1),halo_width:l(3,0),halo_blur:l(4,0),emissive_strength:l(5,0),occlusion_opacity:l(6,1),z_offset:l(7,0)};return this.cachedConstantUniforms=c,this.cachedConstantRenderZoom=e,this.cachedConstantBrightness=t,this.cachedConstantPaint=this.layer.paint,c}finalize(){for(const e of this.ubos)e.rightSizeForTransfer()}upload(e){for(const t of this.ubos)t.upload(e)}bind(e,t,i=0){this.ubos[i]&&this.ubos[i].bind(e,t)}destroy(){for(const e of this.ubos)e.destroy();this.ubos=[],this.featureVertexRangesFromId=null,this.featureVertexRangesFromVtIndex=null,this.allFeatureVtIndices=[],this.allFeatureIds=[],this.featureCount=0,this.maxFeaturesPerBatch=0}}Rs(fp,"SymbolPropertyBinderUBO",{omit:["layer","cachedConstantUniforms","cachedConstantRenderZoom","cachedConstantBrightness","cachedConstantPaint","activeAppearanceByVtIndex","featureVertexRangesFromId","featureVertexRangesFromVtIndex"]});const mp=24;function _p(e,t,i){return e.sections.forEach(e=>{e.text=function(e,t,i){const r=t.layout.get("text-transform").evaluate(i,{});return"uppercase"===r?e=e.toLocaleUpperCase():"lowercase"===r&&(e=e.toLocaleLowerCase()),e}(e.text,t,i)}),e}const gp={horizontal:1,vertical:2,horizontalOnly:3};function yp(e){let t=.5,i=.5;switch(e){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(e){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:t,verticalAlign:i}}const xp={"!":"\ufe15","#":"\uff03",$:"\uff04","%":"\uff05","&":"\uff06","(":"\ufe35",")":"\ufe36","*":"\uff0a","+":"\uff0b",",":"\ufe10","-":"\ufe32",".":"\u30fb","/":"\uff0f",":":"\ufe13",";":"\ufe14","<":"\ufe3f","=":"\uff1d",">":"\ufe40","?":"\ufe16","@":"\uff20","[":"\ufe47","\\":"\uff3c","]":"\ufe48","^":"\uff3e",_:"\ufe33","`":"\uff40","{":"\ufe37","|":"\u2015","}":"\ufe38","~":"\uff5e","\xa2":"\uffe0","\xa3":"\uffe1","\xa5":"\uffe5","\xa6":"\uffe4","\xac":"\uffe2","\xaf":"\uffe3","\u2013":"\ufe32","\u2014":"\ufe31","\u2018":"\ufe43","\u2019":"\ufe44","\u201c":"\ufe41","\u201d":"\ufe42","\u2026":"\ufe19","\u2027":"\u30fb","\u20a9":"\uffe6","\u3001":"\ufe11","\u3002":"\ufe12","\u3008":"\ufe3f","\u3009":"\ufe40","\u300a":"\ufe3d","\u300b":"\ufe3e","\u300c":"\ufe41","\u300d":"\ufe42","\u300e":"\ufe43","\u300f":"\ufe44","\u3010":"\ufe3b","\u3011":"\ufe3c","\u3014":"\ufe39","\u3015":"\ufe3a","\u3016":"\ufe17","\u3017":"\ufe18","\uff01":"\ufe15","\uff08":"\ufe35","\uff09":"\ufe36","\uff0c":"\ufe10","\uff0d":"\ufe32","\uff0e":"\u30fb","\uff1a":"\ufe13","\uff1b":"\ufe14","\uff1c":"\ufe3f","\uff1e":"\ufe40","\uff1f":"\ufe16","\uff3b":"\ufe47","\uff3d":"\ufe48","\uff3f":"\ufe33","\uff5b":"\ufe37","\uff5c":"\u2015","\uff5d":"\ufe38","\uff5f":"\ufe35","\uff60":"\ufe36","\uff61":"\ufe12","\uff62":"\ufe41","\uff63":"\ufe42"};function vp(e){return"\ufe36"===e||"\ufe48"===e||"\ufe38"===e||"\ufe44"===e||"\ufe42"===e||"\ufe3e"===e||"\ufe3c"===e||"\ufe3a"===e||"\ufe18"===e||"\ufe40"===e||"\ufe10"===e||"\ufe13"===e||"\ufe14"===e||"\uff40"===e||"\uffe3"===e||"\ufe11"===e||"\ufe12"===e}function bp(e){return"\ufe35"===e||"\ufe47"===e||"\ufe37"===e||"\ufe43"===e||"\ufe41"===e||"\ufe3d"===e||"\ufe3b"===e||"\ufe39"===e||"\ufe17"===e||"\ufe3f"===e}const wp=128;function Ep(e,t,i,r){const{expression:n}=t;if("constant"===n.kind)return{kind:"constant",layoutSize:n.evaluate(new ll(e+1,{worldview:i}),void 0,void 0,void 0,r)};if("source"===n.kind)return{kind:"source"};{const{zoomStops:t,interpolationType:o}=n;let a=0;for(;a<t.length&&t[a]<=e;)a++;a=Math.max(0,a-1);let s=a;for(;s<t.length&&t[s]<e+1;)s++;s=Math.min(t.length-1,s);const l=t[a],c=t[s];return"composite"===n.kind?{kind:"composite",minZoom:l,maxZoom:c,interpolationType:o}:{kind:"camera",minZoom:l,maxZoom:c,minSize:n.evaluate(new ll(l,{worldview:i}),void 0,void 0,void 0,r),maxSize:n.evaluate(new ll(c,{worldview:i}),void 0,void 0,void 0,r),interpolationType:o}}}function Ap(e,{uSize:t,uSizeT:i},{lowerSize:r,upperSize:n}){return"source"===e.kind?r/wp:"composite"===e.kind?Wr(r/wp,n/wp,i):t}function Ip(e,t,i=1){let r=0,n=0;if("constant"===e.kind)n=e.layoutSize*i;else if("source"!==e.kind){const{interpolationType:o,minZoom:a,maxZoom:s}=e,l=o?ht(Ta.interpolationFactor(o,t,a,s),0,1):0;"camera"===e.kind?n=Wr(e.minSize,e.maxSize,l)*i:r=l*i}return{uSizeT:r,uSize:n}}const Sp=Number.POSITIVE_INFINITY,Tp=Math.sqrt(2),Dp=32640;function Mp(e,[t,i]){let r=0,n=0;if(i===Sp){t<0&&(t=0);const i=t/Tp;switch(e){case"top-right":case"top-left":n=i-7;break;case"bottom-right":case"bottom-left":n=7-i;break;case"bottom":n=7-t;break;case"top":n=t-7}switch(e){case"top-right":case"bottom-right":r=-i;break;case"top-left":case"bottom-left":r=i;break;case"left":r=t;break;case"right":r=-t}}else{switch(t=Math.abs(t),i=Math.abs(i),e){case"top-right":case"top-left":case"top":n=i-7;break;case"bottom-right":case"bottom-left":case"bottom":n=7-i}switch(e){case"top-right":case"bottom-right":case"right":r=-t;break;case"top-left":case"bottom-left":case"left":r=t}}return[r,n]}function Pp(e,t,i,r,n,o,a){const s=e.hasLayoutProperty(n)?t.getAppearanceValueAndResolveTokens(e,n,i,r,[]):null;return(Array.isArray(o)?Array.isArray(s):typeof s==typeof o)?a?a(s):s:o}function Cp(e,t,i,r,n,o,a,s,l,c){if(!e)return;const u=function(e,t,i,r,n,o,a){if("camera"===e.kind)return e.maxSize;if("composite"===e.kind){const r=t.possiblyEvaluate(new ll(e.maxZoom,{worldview:o}),i,a).evaluate(n,{},i,a),s=t.possiblyEvaluate(new ll(e.minZoom,{worldview:o}),i,a).evaluate(n,{},i,a);return Math.max(r,s)}return t.possiblyEvaluate(new ll(r,{worldview:o}),i,a).evaluate(n,{},i,a)}(t,i,r,n,o,l,c);return e.scaleSelf(u*s*a)}function Rp(e,t,i,r,n,o,a,s,l,c){return{iconPrimary:Cp(e.getPrimary(),t,i,r,n,o,a,s,l,c),iconSecondary:Cp(e.getSecondary(),t,i,r,n,o,a,s,l,c)}}const zp=lu([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:Lp}=zp,Fp=lu([{name:"a_pos_3",components:3,type:"Int16"}]);var Op=lu([{name:"a_pos",type:"Int16",components:2}]);class Bp{constructor(e,t){this.pos=e,this.dir=t}intersectsPlane(e,t,i){const r=Fe(t,this.dir);if(Math.abs(r)<1e-6)return!1;const n=((e[0]-this.pos[0])*t[0]+(e[1]-this.pos[1])*t[1])/r;return i[0]=this.pos[0]+this.dir[0]*n,i[1]=this.pos[1]+this.dir[1]*n,!0}}class kp{constructor(e,t){this.pos=e,this.dir=t}intersectsPlane(e,t,i){const r=Q(t,this.dir);if(Math.abs(r)<1e-6)return!1;const n=((e[0]-this.pos[0])*t[0]+(e[1]-this.pos[1])*t[1]+(e[2]-this.pos[2])*t[2])/r;return i[0]=this.pos[0]+this.dir[0]*n,i[1]=this.pos[1]+this.dir[1]*n,i[2]=this.pos[2]+this.dir[2]*n,!0}closestPointOnSphere(e,t,i){if(function(e,t){var i=e[0],r=e[1],n=e[2],a=t[0],s=t[1],l=t[2];return Math.abs(i-a)<=o*Math.max(1,Math.abs(i),Math.abs(a))&&Math.abs(r-s)<=o*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(n-l)<=o*Math.max(1,Math.abs(n),Math.abs(l))}(this.pos,e)||0===t)return i[0]=i[1]=i[2]=0,!1;const[r,n,a]=this.dir,s=this.pos[0]-e[0],l=this.pos[1]-e[1],c=this.pos[2]-e[2],u=r*r+n*n+a*a,h=2*(s*r+l*n+c*a),d=h*h-4*u*(s*s+l*l+c*c-t*t);if(d<0){const e=Math.max(-h/2,0),o=s+r*e,u=l+n*e,d=c+a*e,p=Math.hypot(o,u,d);return i[0]=o*t/p,i[1]=u*t/p,i[2]=d*t/p,!1}{const e=(-h-Math.sqrt(d))/(2*u);if(e<0){const e=Math.hypot(s,l,c);return i[0]=s*t/e,i[1]=l*t/e,i[2]=c*t/e,!1}return i[0]=s+r*e,i[1]=l+n*e,i[2]=c+a*e,!0}}}class Vp{constructor(e,t,i,r,n){this.TL=e,this.TR=t,this.BR=i,this.BL=r,this.horizon=n}static fromInvProjectionMatrix(e,t,i){const r=[-1,1,1],n=[1,1,1],o=[1,-1,1],a=[-1,-1,1],s=ie(r,r,e),l=ie(n,n,e),c=ie(o,o,e),u=ie(a,a,e);return new Vp(s,l,c,u,t/i)}}function Np(e,t,i,r){const n=t[0],o=t[1],a=t[2],s=i[0],l=i[1],c=i[2];let u=1/0,h=-1/0;for(let d=0;d<e.length;d++){const t=e[d],i=(t[0]-n)*s+(t[1]-o)*l+(t[2]-a)*c;i<u&&(u=i),i>h&&(h=i)}return r[0]=u,r[1]=h,r}function Up(e,t){let i=!0;for(let r=0;r<e.planes.length;r++){const n=e.planes[r];let o=0;for(let e=0;e<t.length;e++)o+=+(Q(n,t[e])+n[3]>=0);if(0===o)return 0;o!==t.length&&(i=!1)}return i?2:1}const jp=[0,0];function Gp(e,t){for(const i of e.projections){const r=Np(t,e.points[0],i.axis,jp);if(i.projection[1]<r[0]||i.projection[0]>r[1])return 0}return 1}function Hp(e,t){const i=t[0],r=t[1],n=t[2],o=t[3];for(let a=0;a<e.length;a++){const t=e[a];if(i*t[0]+r*t[1]+n*t[2]+o>=0)return!0}return!1}class $p{constructor(e,t){this.points=e||new Array(8).fill([0,0,0]),this.planes=t||new Array(6).fill([0,0,0,0]),this.bounds=Wp.fromPoints(this.points),this.projections=[],this.frustumEdges=[se([],this.points[2],this.points[3]),se([],this.points[0],this.points[3]),se([],this.points[4],this.points[0]),se([],this.points[5],this.points[1]),se([],this.points[6],this.points[2]),se([],this.points[7],this.points[3])];for(const i of this.frustumEdges){const e=[0,-i[2],i[1]],t=[i[2],0,-i[0]];this.projections.push({axis:e,projection:Np(this.points,this.points[0],e,[0,0])}),this.projections.push({axis:t,projection:Np(this.points,this.points[0],t,[0,0])})}}static fromInvProjectionMatrix(e,t,i,r){const n=Math.pow(2,i),o=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(i=>{const o=me([],i,e),a=1/o[3]/t*n;return(s=o)[0]=(l=o)[0]*(c=[a,a,r?1/o[3]:a,a])[0],s[1]=l[1]*c[1],s[2]=l[2]*c[2],s[3]=l[3]*c[3],s;var s,l,c}),a=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(e=>{const t=J([],ee([],se([],o[e[0]],o[e[1]]),se([],o[e[2]],o[e[1]]))),i=-Q(t,o[e[1]]);return t.concat(i)}),s=[];for(let l=0;l<o.length;l++)s.push([o[l][0],o[l][1],o[l][2]]);return new $p(s,a)}intersectsPrecise(e,t,i){for(let s=0;s<t.length;s++)if(!Hp(e,t[s]))return 0;for(let s=0;s<this.planes.length;s++)if(!Hp(e,this.planes[s]))return 0;const r=this.points,n=r[0][0],o=r[0][1],a=r[0][2];for(const s of i)for(const t of this.frustumEdges){const i=s[1]*t[2]-s[2]*t[1],l=s[2]*t[0]-s[0]*t[2],c=s[0]*t[1]-s[1]*t[0];if(0===i&&0===l&&0===c)continue;let u=1/0,h=-1/0;for(let e=0;e<r.length;e++){const t=r[e],s=(t[0]-n)*i+(t[1]-o)*l+(t[2]-a)*c;s<u&&(u=s),s>h&&(h=s)}let d=1/0,p=-1/0;for(let t=0;t<e.length;t++){const r=e[t],s=(r[0]-n)*i+(r[1]-o)*l+(r[2]-a)*c;s<d&&(d=s),s>p&&(p=s)}if(u>p||d>h)return 0}return 1}containsPoint(e){for(const t of this.planes){const i=t[3];if(Q([t[0],t[1],t[2]],e)+i<0)return!1}return!0}}class Wp{static fromPoints(e){const t=[1/0,1/0,1/0],i=[-1/0,-1/0,-1/0];for(const r of e)H(t,t,r),$(i,i,r);return new Wp(t,i)}static fromTileIdAndHeight(e,t,i){const r=1<<e.canonical.z,n=e.canonical.x,o=e.canonical.y;return new Wp([n/r,o/r,t],[(n+1)/r,(o+1)/r,i])}static applyTransform(e,t){const i=e.getCorners();for(let r=0;r<i.length;++r)ie(i[r],i[r],t);return Wp.fromPoints(i)}static applyTransformFast(e,t){const i=[t[12],t[13],t[14]],r=[...i];for(let n=0;n<3;n++)for(let o=0;o<3;o++){const a=t[4*o+n],s=a*e.min[o],l=a*e.max[o];i[n]+=Math.min(s,l),r[n]+=Math.max(s,l)}return new Wp(i,r)}static projectAabbCorners(e,t){const i=e.getCorners();for(let r=0;r<i.length;++r)ie(i[r],i[r],t);return i}constructor(e,t){this.min=e,this.max=t,this.center=W([],U([],this.min,this.max),.5)}quadrant(e){const t=[e%2==0,e<2],i=B(this.min),r=B(this.max);for(let n=0;n<t.length;n++)i[n]=t[n]?this.min[n]:this.center[n],r[n]=t[n]?this.center[n]:this.max[n];return r[2]=this.max[2],new Wp(i,r)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}distanceZ(e){return Math.max(Math.min(this.max[2],e[2]),this.min[2])-e[2]}getCorners(){const e=this.min,t=this.max;return[[e[0],e[1],e[2]],[t[0],e[1],e[2]],[t[0],t[1],e[2]],[e[0],t[1],e[2]],[e[0],e[1],t[2]],[t[0],e[1],t[2]],[t[0],t[1],t[2]],[e[0],t[1],t[2]]]}intersects(e){return this.intersectsAabb(e.bounds)?Up(e,this.getCorners()):0}intersectsFlat(e){return this.intersectsAabb(e.bounds)?Up(e,[[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(e,t){return t||this.intersects(e)?Gp(e,this.getCorners()):0}intersectsPreciseFlat(e,t){return t||this.intersectsFlat(e)?Gp(e,[[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(e){for(let t=0;t<3;++t)if(this.min[t]>e.max[t]||e.min[t]>this.max[t])return!1;return!0}intersectsAabbXY(e){return!(this.min[0]>e.max[0]||e.min[0]>this.max[0]||this.min[1]>e.max[1]||e.min[1]>this.max[1])}encapsulate(e){for(let t=0;t<3;t++)this.min[t]=Math.min(this.min[t],e.min[t]),this.max[t]=Math.max(this.max[t],e.max[t])}encapsulatePoint(e){for(let t=0;t<3;t++)this.min[t]=Math.min(this.min[t],e[t]),this.max[t]=Math.max(this.max[t],e[t])}closestPoint(e){return[Math.max(Math.min(this.max[0],e[0]),this.min[0]),Math.max(Math.min(this.max[1],e[1]),this.min[1]),Math.max(Math.min(this.max[2],e[2]),this.min[2])]}}function qp(e){return e*Mc/Oc}Rs(Wp,"Aabb");const Zp=[new Wp([Rc,Rc,Rc],[zc,zc,zc]),new Wp([Rc,Rc,Rc],[0,0,zc]),new Wp([0,Rc,Rc],[zc,0,zc]),new Wp([Rc,0,Rc],[0,zc,zc]),new Wp([0,0,Rc],[zc,zc,zc])];function Xp(e,t,i,r=!0){const n=W([],e._camera.position,e.worldSize),o=[t,i,1,1];me(o,o,e.pixelMatrixInverse),pe(o,o,1/o[3]);const a=J([],se([],o,n)),s=e.globeMatrix,l=[s[12],s[13],s[14]],c=se([],l,n),u=k(c),h=J([],c),d=e.worldSize/(2*Math.PI),p=Q(h,a),f=Math.asin(d/u);if(f<Math.acos(p)){if(!r)return null;const e=[],t=[];W(e,a,u/p),J(t,se(t,e,c)),J(a,U(a,c,W(a,t,Math.tan(f)*u)))}const m=[];new kp(n,a).closestPointOnSphere(l,d,m);const _=J([],Ot(s,0)),g=J([],Ot(s,1)),y=J([],Ot(s,2)),x=Q(_,m),v=Q(g,m),b=Q(y,m),w=ot(Math.asin(-v/d));let E=ot(Math.atan2(x,b));E=e.center.lng+function(e,t){const i=(t-e+180)%360-180;return i<-180?i+360:i}(e.center.lng,E);const A=Wn(E),I=ht(qn(w),0,1);return new Zc(A,I)}class Yp{constructor(e,t,i){this.a=se([],e,i),this.b=se([],t,i),this.center=i;const r=J([],this.a),n=J([],this.b);this.angle=Math.acos(Q(r,n))}}function Kp(e,t){if(0===e.angle)return null;let i;return i=0===e.a[t]?1/e.angle*.5*Math.PI:1/e.angle*Math.atan(e.b[t]/e.a[t]/Math.sin(e.angle)-1/Math.tan(e.angle)),i<0||i>1?null:function(e,t,i,r){const n=Math.sin(i);return e*(Math.sin((1-r)*i)/n)+t*(Math.sin(r*i)/n)}(e.a[t],e.b[t],e.angle,ht(i,0,1))+e.center[t]}function Jp(e){if(e.z<=1)return Zp[e.z+2*e.y+e.x];const t=of(nf(e));return Wp.fromPoints(t)}function Qp(e,t,i){return W(e,e,1-i),q(e,e,t,i)}function ef(e,t){const i=mf(t.zoom);if(0===i)return Jp(e);const r=nf(e),n=of(r),o=Wn(r.getWest())*t.worldSize,a=Wn(r.getEast())*t.worldSize,s=qn(r.getNorth())*t.worldSize,l=qn(r.getSouth())*t.worldSize,c=[o,s,0],u=[a,s,0],h=[o,l,0],d=[a,l,0],p=y([],t.globeMatrix);return ie(c,c,p),ie(u,u,p),ie(h,h,p),ie(d,d,p),n[0]=Qp(n[0],h,i),n[1]=Qp(n[1],d,i),n[2]=Qp(n[2],u,i),n[3]=Qp(n[3],c,i),Wp.fromPoints(n)}function tf(e,t,i){for(const r of e)ie(r,r,t),W(r,r,i)}function rf(e,t,i,r){const n=t/e.worldSize,o=e.globeMatrix;if(i.z<=1){const e=Jp(i).getCorners();return tf(e,o,n),Wp.fromPoints(e)}const a=nf(i,r),s=of(a,Mc+qp(e._tileCoverLift));tf(s,o,n);const l=Number.MAX_VALUE,c=[-l,-l,-l],u=[l,l,l];if(a.contains(e.center)){for(const e of s)H(u,u,e),$(c,c,e);c[2]=0;const t=e.point,i=[t.x*n,t.y*n,0];return H(u,u,i),$(c,c,i),new Wp(u,c)}if(e._tileCoverLift>0){for(const e of s)H(u,u,e),$(c,c,e);return new Wp(u,c)}const h=[o[12]*n,o[13]*n,o[14]*n],d=a.getCenter(),p=ht(e.center.lat,-85.051129,Gc),f=ht(d.lat,-85.051129,Gc),m=Wn(e.center.lng),_=qn(p);let g=m-Wn(d.lng);const y=_-qn(f);g>.5?g-=1:g<-.5&&(g+=1);let x=0;Math.abs(g)>Math.abs(y)?x=g>=0?1:3:(x=y>=0?0:2,q(h,h,[o[4]*n,o[5]*n,o[6]*n],-Math.sin(nt(y>=0?a.getSouth():a.getNorth()))*Mc));const v=s[x],b=s[(x+1)%4],w=new Yp(v,b,h),E=[Kp(w,0)||v[0],Kp(w,1)||v[1],Kp(w,2)||v[2]],A=mf(e.zoom);if(A>0){const r=function({x:e,y:t,z:i},r,n,o,a){const s=1/(1<<i);let l=e*s,c=l+s,u=t*s,h=u+s,d=0;const p=(l+c)/2-o;return p>.5?d=-1:p<-.5&&(d=1),l=((l+d)*r-(o*=r))*n+o,c=((c+d)*r-o)*n+o,u=(u*r-(a*=r))*n+a,h=(h*r-a)*n+a,[[l,h,0],[c,h,0],[c,u,0],[l,u,0]]}(i,t,e._pixelsPerMercatorPixel,m,_);for(let e=0;e<s.length;e++)Qp(s[e],r[e],A);const n=U([],r[x],r[(x+1)%4]);W(n,n,.5),Qp(E,n,A)}for(const I of s)H(u,u,I),$(c,c,I);return u[2]=Math.min(v[2],b[2]),H(u,u,E),$(c,c,E),new Wp(u,c)}function nf({x:e,y:t,z:i},r=!1){const n=1/(1<<i),o=new kc(Zn(e*n),t===(1<<i)-1&&r?-90:Xn((t+1)*n)),a=new kc(Zn((e+1)*n),0===t&&r?90:Xn(t*n));return new Vc(o,a)}function of(e,t=Mc){const i=nt(e.getNorth()),r=nt(e.getSouth()),n=Math.cos(i),o=Math.cos(r),a=Math.sin(i),s=Math.sin(r),l=e.getWest(),c=e.getEast();return[Lc(o,s,l,t),Lc(o,s,c,t),Lc(n,a,c,t),Lc(n,a,l,t)]}function af(e,t,i,r){const n=1<<i.z,o=(e/co+i.x)/n;return Fc(Xn((t/co+i.y)/n),Zn(o),r)}function sf({min:e,max:t}){return 16383/Math.max(t[0]-e[0],t[1]-e[1],t[2]-e[2])}const lf=new Float64Array(16);function cf(e){const t=sf(e),i=S(lf,[t,t,t]);return v(i,i,K([],e.min))}function uf(e){const t=1/sf(e);return I(lf,e.min),b(lf,lf,[t,t,t])}function hf(e){const t=co/(2*Math.PI);return e/(2*Math.PI)/t}function df(e,t){return co/(512*Math.pow(2,e))*sf(Jp(t))}function pf(e,t,i,r,n){const o=hf(i),a=[e,t,-i/(2*Math.PI)],s=_(new Float64Array(16));return v(s,s,a),b(s,s,[o,o,o]),w(s,s,nt(-n)),E(s,s,nt(-r)),s}function ff(e){const t=e.pixelsPerMeter,i=t/Uc(1,e.center.lat),r=_(new Float64Array(16));return v(r,r,[e.point.x,e.point.y,0]),b(r,r,[i,i,t]),Float32Array.from(r)}function mf(e){return dt(5,6,e)}function _f(e,t,i){const r=_(new Float64Array(16)),n=(t/(1<<e)-.5)*Math.PI*2;return E(r,i.globeMatrix,n),Float32Array.from(r)}function gf(e,t,i){const r=mf(i.zoom),n=e.style.map._antialias,o=e.terrain&&e.terrain.exaggeration()>0;return 0===r&&!n&&!o}function yf(e,t,i,r){const n=t.getNorth(),o=t.getSouth(),a=t.getWest(),s=t.getEast(),l=1<<e.z,c=s-a,u=n-o,d=c/Pc,p=-u/Cc[i],f=[0,d,0,p,0,0,n,a,0];if(e.z>0){const e=180/r;h(f,f,[e/c+1,0,0,0,e/u+1,0,-.5*e/d,.5*e/p,1])}return f[2]=l,f[5]=e.x,f[8]=e.y,f}function xf(e){const t=80.051129;e=ht(e,-80.051129,t)/t*90;const i=Math.pow(Math.abs(Math.sin(nt(e))),3);return Math.round(i*(Cc.length-1))}function vf(e){const t=[0,0,0],i=_(new Float64Array(16));return x(i,e.pixelMatrix,e.globeMatrix),ie(t,t,i),new ke(t[0],t[1])}function bf(e,t){const i=Fc(t.lat,t.lng),r=function(e){const t=Fc(e._center.lat,e._center.lng);let i=ee([],V(0,1,0),t);const r=T([],-e.angle,t);i=ie(i,i,r),T(r,-e._pitch,i);const n=J([],t);return W(n,n,qp(e.cameraToCenterDistance/e.pixelsPerMeter)),ie(n,n,r),U([],t,n)}(e);return a=(n=j([],r,i))[0],s=n[1],l=n[2],c=(o=i)[0],u=o[1],h=o[2],p=(d=Math.sqrt((a*a+s*s+l*l)*(c*c+u*u+h*h)))&&Q(n,o)/d,Math.acos(Math.min(Math.max(p,-1),1));var n,o,a,s,l,c,u,h,d,p}function wf(e,t){return bf(e,t)>Math.PI/2*1.01}const Ef=nt(85),Af=Math.cos(Ef),If=Math.sin(Ef);class Sf{constructor(e){this._createGrid(e),this._createPoles(e)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const e of this._poleSegments)e.destroy();for(const e of this._gridSegments)e.withSkirts.destroy(),e.withoutSkirts.destroy()}_fillGridMeshWithLods(e,t){const i=new uu,r=new Ru,n=[],o=e+1+2,a=t[0]+1,s=t[0]+1+(1+t.length),l=(e,t,i)=>{let r=e===o-1?e-2:0===e?e:e-1;return r+=i?24575:0,[r,t]};for(let c=0;c<o;++c)i.emplaceBack(...l(c,0,!0));for(let c=0;c<a;++c)for(let e=0;e<o;++e)i.emplaceBack(...l(e,c,(0===e||e===o-1)&&!0));for(let c=0;c<t.length;++c){const e=t[c];for(let t=0;t<o;++t)i.emplaceBack(...l(t,e,!0))}for(let c=0;c<t.length;++c){const e=r.length,a=t[c]+1+2,l=new Ru;for(let i=0;i<a-1;i++){const e=i===a-2,n=e?o*(s-t.length+c-i):o;for(let t=0;t<o-1;t++){const a=i*o+t;0===i||e||0===t||t===o-2?(l.emplaceBack(a+1,a,a+n),l.emplaceBack(a+n,a+n+1,a+1)):(r.emplaceBack(a+1,a,a+n),r.emplaceBack(a+n,a+n+1,a+1))}}const u=uh.simpleSegment(0,e,i.length,r.length-e);for(let t=0;t<l.uint16.length;t+=3)r.emplaceBack(l.uint16[t],l.uint16[t+1],l.uint16[t+2]);const h=uh.simpleSegment(0,e,i.length,r.length-e);n.push({withoutSkirts:u,withSkirts:h})}return{vertices:i,indices:r,segments:n}}_createGrid(e){const t=this._fillGridMeshWithLods(Pc,Cc);this._gridSegments=t.segments,this._gridBuffer=e.createVertexBuffer(t.vertices,Op.members),this._gridIndexBuffer=e.createIndexBuffer(t.indices,!0)}_createPoles(e){const t=new Ru;for(let a=0;a<=Pc;a++)t.emplaceBack(0,a+1,a+2);this._poleIndexBuffer=e.createIndexBuffer(t,!0);const i=new Ou,r=new Ou,n=new Ou,o=new Ou;this._poleSegments=[];for(let a=0,s=0;a<6;a++){const e=360/(1<<a);i.emplaceBack(0,-Mc,0,.5,0),r.emplaceBack(0,-Mc,0,.5,1),n.emplaceBack(0,-Mc,0,.5,.5),o.emplaceBack(0,-Mc,0,.5,.5);for(let t=0;t<=Pc;t++){let a=t/Pc,s=0;const l=Wr(0,e,a),[c,u,h]=Lc(Af,If,l,Mc);i.emplaceBack(c,u,h,a,s),r.emplaceBack(c,u,h,a,1-s);const d=nt(l);a=.5+.5*Math.sin(d),s=.5+.5*Math.cos(d),n.emplaceBack(c,u,h,a,s),o.emplaceBack(c,u,h,a,1-s)}this._poleSegments.push(uh.simpleSegment(s,0,66,64)),s+=66}this._poleNorthVertexBuffer=e.createVertexBuffer(i,Lp,!1),this._poleSouthVertexBuffer=e.createVertexBuffer(r,Lp,!1),this._texturedPoleNorthVertexBuffer=e.createVertexBuffer(n,Lp,!1),this._texturedPoleSouthVertexBuffer=e.createVertexBuffer(o,Lp,!1)}getGridBuffers(e,t){return[this._gridBuffer,this._gridIndexBuffer,t?this._gridSegments[e].withSkirts:this._gridSegments[e].withoutSkirts]}getPoleBuffers(e,t){return[t?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,t?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[e]]}}function Tf(e,t){const i=e.fovAboveCenter,r=e.elevation?e.elevation.getMinElevationBelowMSL()*t:0,n=Math.min(r,e.isOrthographic?-10*t:0),o=(e._camera.position[2]*e.worldSize-n)/Math.cos(e._pitch),a=Math.sin(i)*o/Math.sin(Math.max(Math.PI/2-e._pitch-i,.01));let s=Math.sin(e._pitch)*a+o;const l=o*(1/e._horizonShift);if(!e.elevation||0===e.elevation.exaggeration()){let t=Math.max(e.zoom-17,0);e.isOrthographic&&(t/=10),s*=1+t}return Math.min(1.01*s,l)}class Df{constructor(e,t,i){this.z=e,this.x=t,this.y=i,this.key=Cf(0,e,e,t,i)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}isChildOf(e){const t=this.z-e.z;return 0===e.z||e.z<this.z&&e.x===this.x>>t&&e.y===this.y>>t}url(e,t){const i=function(e,t,i){const r=2**i,n=2*Math.PI*6378137,o=n*(e/r-.5),a=n*(.5-(t+1)/r);return`${o},${a},${o+n/r},${a+n/r}`}(this.x,this.y,this.z),r=function(e,t,i){let r,n="";for(let o=e;o>0;o--)r=1<<o-1,n+=(t&r?1:0)+(i&r?2:0);return n}(this.z,this.x,this.y);return e[(this.x+this.y)%e.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"===t?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",r).replace("{bbox-epsg-3857}",i)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Mf{constructor(e,t){this.wrap=e,this.canonical=t,this.key=Cf(e,t.z,t.z,t.x,t.y)}}class Pf{constructor(e,t,i,r,n){this.overscaledZ=e,this.wrap=t,this.canonical=new Df(i,+r,+n),this.key=0===t&&e===i?this.canonical.key:Cf(t,e,i,r,n)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){const t=this.canonical.z-e;return e>this.canonical.z?new Pf(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Pf(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}calculateScaledKey(e,t=!0){if(this.overscaledZ===e&&t)return this.key;if(e>this.canonical.z)return Cf(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y);{const i=this.canonical.z-e;return Cf(this.wrap*+t,e,e,this.canonical.x>>i,this.canonical.y>>i)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;const t=this.canonical.z-e.canonical.z;return 0===e.overscaledZ||e.overscaledZ<this.overscaledZ&&e.canonical.z<this.canonical.z&&e.canonical.x===this.canonical.x>>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new Pf(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const t=this.canonical.z+1,i=2*this.canonical.x,r=2*this.canonical.y;return[new Pf(t,this.wrap,t,i,r),new Pf(t,this.wrap,t,i+1,r),new Pf(t,this.wrap,t,i,r+1),new Pf(t,this.wrap,t,i+1,r+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Pf(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Pf(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Mf(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function Cf(e,t,i,r,n){const o=1<<Math.min(i,22);let a=o*(n%o)+r%o;return e&&i<22&&(a+=o*o*((e<0?-2*e-1:2*e)%(1<<2*(22-i)))),16*(32*a+i)+(t-i)}const Rf=[e=>{let t=e.canonical.x-1,i=e.wrap;return t<0&&(t=(1<<e.canonical.z)-1,i--),new Pf(e.overscaledZ,i,e.canonical.z,t,e.canonical.y)},e=>{let t=e.canonical.x+1,i=e.wrap;return t===1<<e.canonical.z&&(t=0,i++),new Pf(e.overscaledZ,i,e.canonical.z,t,e.canonical.y)},e=>new Pf(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,(0===e.canonical.y?1<<e.canonical.z:e.canonical.y)-1),e=>new Pf(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y===(1<<e.canonical.z)-1?0:e.canonical.y+1)];function zf(e,t){if(!t.isReprojectedInTileSpace)return{scale:1<<e.z,x:e.x,y:e.y,x2:e.x+1,y2:e.y+1,projection:t};const i=Math.pow(2,-e.z),r=e.x*i,n=(e.x+1)*i,o=e.y*i,a=(e.y+1)*i,s=Zn(r),l=Zn(n),c=Xn(o),u=Xn(a),h=t.project(s,c),d=t.project(l,c),p=t.project(l,u),f=t.project(s,u);let m=Math.min(h.x,d.x,p.x,f.x),_=Math.min(h.y,d.y,p.y,f.y),g=Math.max(h.x,d.x,p.x,f.x),y=Math.max(h.y,d.y,p.y,f.y);const x=i/16;function v(e,i,r,n,o,a){const s=(r+o)/2,l=(n+a)/2,c=t.project(Zn(s),Xn(l)),u=Math.max(0,m-c.x,_-c.y,c.x-g,c.y-y);m=Math.min(m,c.x),g=Math.max(g,c.x),_=Math.min(_,c.y),y=Math.max(y,c.y),u>x&&(v(e,c,r,n,s,l),v(c,i,s,l,o,a))}v(h,d,r,o,n,o),v(d,p,n,o,n,a),v(p,f,n,a,r,a),v(f,h,r,a,r,o),m-=x,_-=x,g+=x,y+=x;const b=1/Math.max(g-m,y-_);return{scale:b,x:m*b,y:_*b,x2:g*b,y2:y*b,projection:t}}function Lf(e,t,i,r,n,o,a,s,l){if("globe"===l.name)return rf(e,t,new Df(i,r,n),!1);const c=zf({z:i,x:r,y:n},l);return new Wp([(o+c.x/c.scale)*t,t*(c.y/c.scale),a],[(o+c.x2/c.scale)*t,t*(c.y2/c.scale),s])}function Ff(e,{x:t,y:i},r=0){return new ke(((t-r)*e.scale-e.x)*co,(i*e.scale-e.y)*co)}function Of(e,t,i=0){return V(((t.x-i)*e.scale-e.x)*co,(t.y*e.scale-e.y)*co,jc(t.z,t.y))}Rs(Df,"CanonicalTileID"),Rs(Pf,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});const Bf=_(new Float32Array(16));class kf{constructor(e){this.spec=e,this.name=e.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(e,t){return{x:0,y:0,z:0}}unproject(e,t){return new kc(0,0)}projectTilePoint(e,t,i){return{x:e,y:t,z:0}}locationPoint(e,t,i,r=!0){return e._coordinatePoint(e.locationCoordinate(t,i),r)}pixelsPerMeter(e,t){return Uc(1,e)*t}pixelSpaceConversion(e,t,i){return 1}farthestPixelDistance(e){return Tf(e,e.pixelsPerMeter)}pointCoordinate(e,t,i,r){const n=e.horizonLineFromTop(!1),o=new ke(t,Math.max(n,i));return e.rayIntersectionCoordinate(e.pointRayIntersection(o,r))}pointCoordinate3D(e,t,i){const r=new ke(t,i);if(e.elevation)return e.elevation.pointCoordinate(r);{const t=this.pointCoordinate(e,r.x,r.y,0);return[t.x,t.y,t.z]}}isPointAboveHorizon(e,t){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,t.x,t.y);const i=e.horizonLineFromTop();return t.y<i}createInversionMatrix(e,t){return Bf}createTileMatrix(e,t,i){let r,n,o;const a=i.canonical,s=_(new Float64Array(16));if(this.isReprojectedInTileSpace){const l=zf(a,this);r=1,n=l.x+i.wrap*l.scale,o=l.y,b(s,s,[r/l.scale,r/l.scale,e.pixelsPerMeter/t])}else r=t/e.zoomScale(a.z),n=(a.x+Math.pow(2,a.z)*i.wrap)*r,o=a.y*r;return v(s,s,[n,o,0]),b(s,s,[r/co,r/co,1]),s}upVector(e,t,i){return[0,0,1]}upVectorScale(e,t,i){return{metersToTile:1}}}class Vf extends kf{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];const[t,i]=this.parallels=e.parallels||[29.5,45.5],r=Math.sin(nt(t));this.n=(r+Math.sin(nt(i)))/2,this.c=1+r*(2*this.n-r),this.r0=Math.sqrt(this.c)/this.n}project(e,t){const{n:i,c:r,r0:n}=this,o=nt(e-this.center[0]),a=nt(t),s=Math.sqrt(r-2*i*Math.sin(a))/i;return{x:s*Math.sin(o*i),y:s*Math.cos(o*i)-n,z:0}}unproject(e,t){const{n:i,c:r,r0:n}=this,o=n+t;let a=Math.atan2(e,Math.abs(o))*Math.sign(o);o*i<0&&(a-=Math.PI*Math.sign(e)*Math.sign(o));const s=nt(this.center[0])*i;a=pt(a,-Math.PI-s,Math.PI-s);const l=ht(ot(a/i)+this.center[0],-180,180),c=Math.asin(ht((r-(e*e+o*o)*i*i)/(2*i),-1,1)),u=ht
vendor: 5,305 bytes, line 2
2(ot(c),-85.051129,Gc);return new kc(l,u)}}const Nf=1.340264,Uf=-.081106,jf=893e-6,Gf=.003796,Hf=Math.sqrt(3)/2;class $f extends kf{project(e,t){t=t/180*Math.PI,e=e/180*Math.PI;const i=Math.asin(Hf*Math.sin(t)),r=i*i,n=r*r*r;return{x:.5*(e*Math.cos(i)/(Hf*(Nf+3*Uf*r+n*(7*jf+9*Gf*r)))/Math.PI+.5),y:1-.5*(i*(Nf+Uf*r+n*(jf+Gf*r))/Math.PI+1),z:0}}unproject(e,t){e=(2*e-.5)*Math.PI;let i=t=(2*(1-t)-1)*Math.PI,r=i*i,n=r*r*r;for(let c,u,h,d=0;d<12&&(u=i*(Nf+Uf*r+n*(jf+Gf*r))-t,h=Nf+3*Uf*r+n*(7*jf+9*Gf*r),c=u/h,i=ht(i-c,-Math.PI/3,Math.PI/3),r=i*i,n=r*r*r,!(Math.abs(c)<1e-12));++d);const o=Hf*e*(Nf+3*Uf*r+n*(7*jf+9*Gf*r))/Math.cos(i),a=Math.asin(Math.sin(i)/Hf),s=ht(180*o/Math.PI,-180,180),l=ht(180*a/Math.PI,-85.051129,Gc);return new kc(s,l)}}class Wf extends kf{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0}project(e,t){return{x:.5+e/360,y:.5-t/360,z:0}}unproject(e,t){const i=360*(e-.5),r=ht(360*(.5-t),-85.051129,Gc);return new kc(i,r)}}const qf=Math.PI/2;function Zf(e){return Math.tan((qf+e)/2)}class Xf extends kf{constructor(e){super(e),this.center=e.center||[0,30];const[t,i]=this.parallels=e.parallels||[30,30];let r=nt(t),n=nt(i);this.southernCenter=r+n<0,this.southernCenter&&(r=-r,n=-n);const o=Math.cos(r),a=Zf(r);this.n=r===n?Math.sin(r):Math.log(o/Math.cos(n))/Math.log(Zf(n)/a),this.f=o*Math.pow(Zf(r),this.n)/this.n}project(e,t){t=nt(t),this.southernCenter&&(t=-t),e=nt(e-this.center[0]);const i=1e-6,{n:r,f:n}=this;n>0?t<-qf+i&&(t=-qf+i):t>qf-i&&(t=qf-i);const o=n/Math.pow(Zf(t),r);let a=o*Math.sin(r*e),s=n-o*Math.cos(r*e);return a=.5*(a/Math.PI+.5),s=.5*(s/Math.PI+.5),{x:a,y:this.southernCenter?s:1-s,z:0}}unproject(e,t){e=(2*e-.5)*Math.PI,this.southernCenter&&(t=1-t),t=(2*(1-t)-.5)*Math.PI;const{n:i,f:r}=this,n=r-t,o=Math.sign(n),a=Math.sign(i)*Math.sqrt(e*e+n*n);let s=Math.atan2(e,Math.abs(n))*o;n*i<0&&(s-=Math.PI*Math.sign(e)*o);const l=ht(ot(s/i)+this.center[0],-180,180),c=ht(ot(2*Math.atan(Math.pow(r/a,1/i))-qf),-85.051129,Gc);return new kc(l,this.southernCenter?-c:c)}}class Yf extends kf{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(e,t){return{x:Wn(e),y:qn(t),z:0}}unproject(e,t){const i=Zn(e),r=Xn(t);return new kc(i,r)}}const Kf=nt(Gc);class Jf extends kf{project(e,t){const i=(t=nt(t))*t,r=i*i;return{x:.5*((e=nt(e))*(.8707-.131979*i+r*(r*(.003971*i-.001529*r)-.013791))/Math.PI+.5),y:1-.5*(t*(1.007226+i*(.015085+r*(.028874*i-.044475-.005916*r)))/Math.PI+1),z:0}}unproject(e,t){e=(2*e-.5)*Math.PI;let i=t=(2*(1-t)-1)*Math.PI,r=25,n=0,o=i*i;do{o=i*i;const e=o*o;n=(i*(1.007226+o*(.015085+e*(.028874*o-.044475-.005916*e)))-t)/(1.007226+o*(.045255+e*(.259866*o-.311325-.005916*11*e))),i=ht(i-n,-Kf,Kf)}while(Math.abs(n)>1e-6&&--r>0);o=i*i;const a=ht(ot(e/(.8707+o*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979))),-180,180),s=ot(i);return new kc(a,s)}}const Qf=nt(Gc);class em extends kf{project(e,t){t=nt(t),e=nt(e);const i=Math.cos(t),r=2/Math.PI,n=Math.acos(i*Math.cos(e/2)),o=Math.sin(n)/n,a=.5*(e*r+2*i*Math.sin(e/2)/o)||0,s=.5*(t+Math.sin(t)/o)||0;return{x:.5*(a/Math.PI+.5),y:1-.5*(s/Math.PI+1),z:0}}unproject(e,t){let i=e=(2*e-.5)*Math.PI,r=t=(2*(1-t)-1)*Math.PI,n=25;const o=1e-6;let a=0,s=0;do{const n=Math.cos(r),o=Math.sin(r),l=2*o*n,c=o*o,u=n*n,h=Math.cos(i/2),d=Math.sin(i/2),p=2*h*d,f=d*d,m=1-u*h*h,_=m?1/m:0,g=m?Math.acos(n*h)*Math.sqrt(1/m):0,y=.5*(2*g*n*d+2*i/Math.PI)-e,x=.5*(g*o+r)-t,v=.5*_*(u*f+g*n*h*c)+1/Math.PI,b=_*(p*l/4-g*o*d),w=.125*_*(l*d-g*o*u*p),E=.5*_*(c*h+g*f*n)+.5,A=b*w-E*v;a=(x*b-y*E)/A,s=(y*w-x*v)/A,i=ht(i-a,-Math.PI,Math.PI),r=ht(r-s,-Qf,Qf)}while((Math.abs(a)>o||Math.abs(s)>o)&&--n>0);return new kc(ot(i),ot(r))}}class tm extends kf{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(nt(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,t){const{scale:i,cosPhi:r}=this;return{x:nt(e)*r*i+.5,y:-Math.sin(nt(t))/r*i+.5,z:0}}unproject(e,t){const{scale:i,cosPhi:r}=this,n=-(t-.5)/i,o=ht(ot((e-.5)/i)/r,-180,180),a=Math.asin(ht(n*r,-1,1)),s=ht(ot(a),-85.051129,Gc);return new kc(o,s)}}class im extends Yf{constructor(e){super(e),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(e,t,i){const r=af(e,t,i);return ie(r,r,cf(Jp(i))),{x:r[0],y:r[1],z:r[2]}}locationPoint(e,t,i){const r=Fc(t.lat,t.lng),n=J([],r),o=i?e._centerAltitude+i:e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(t),e._centerAltitude):e._centerAltitude;q(r,r,n,Uc(1,0)*co*o);const a=_(new Float64Array(16));return x(a,e.pixelMatrix,e.globeMatrix),ie(r,r,a),new ke(r[0],r[1])}pixelsPerMeter(e,t){return Uc(1,0)*t}pixelSpaceConversion(e,t,i){const r=Uc(1,e)*t,n=Wr(Uc(1,45)*t,r,i);return this.pixelsPerMeter(e,t)/n}createTileMatrix(e,t,i){const r=uf(Jp(i.canonical));return x(new Float64Array(16),e.globeMatrix,r)}createInversionMatrix(e,t){const{center:i}=e,r=cf(Jp(t));return E(r,r,nt(i.lng)),w(r,r,nt(i.lat)),b(r,r,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(r)}
vendor: 5,194 bytes, line 2
2pointCoordinate(e,t,i,r){return Xp(e,t,i,!0)||new Zc(0,0)}pointCoordinate3D(e,t,i){const r=this.pointCoordinate(e,t,i,0);return[r.x,r.y,r.z]}isPointAboveHorizon(e,t){return!Xp(e,t.x,t.y,!1)}farthestPixelDistance(e){const t=function(e,t){const i=e.cameraToCenterDistance,r=e._centerAltitude*t,n=e._camera,o=e._camera.forward(),a=U([],W([],o,-i),[0,0,r]),s=e.worldSize/(2*Math.PI),l=[0,0,-s],c=e.width/e.height,u=Math.tan(e.fovAboveCenter),h=W([],n.up(),u),d=W([],n.right(),u*c),p=J([],U([],U([],o,h),d)),f=[];let m;if(new kp(a,p).closestPointOnSphere(l,s,f)){const t=U([],f,l),i=se([],t,a);m=Math.cos(e.fovAboveCenter)*k(i)}else{const e=se([],a,l),t=se([],l,a);J(t,t);const i=k(e)-s;m=Math.sqrt(i*(i+2*s));const r=Math.acos(m/(s+i))-Math.acos(Q(o,t));m*=Math.cos(r)}return 1.01*m}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),i=mf(e.zoom);if(i>0){const r=Tf(e,Uc(1,e.center.lat)*e.worldSize),n=e.worldSize/(2*Math.PI),o=Math.max(e.width,e.height)/e.worldSize*Math.PI;return Wr(t,r+n*(1-Math.cos(o)),Math.pow(i,10))}return t}upVector(e,t,i){return af(t,i,e,1)}upVectorScale(e){return{metersToTile:qp(sf(Jp(e)))}}}function rm(e){const t=e.parallels,i=!!t&&Math.abs(t[0]+t[1])<.01;switch(e.name){case"mercator":return new Yf(e);case"equirectangular":return new Wf(e);case"naturalEarth":return new Jf(e);case"equalEarth":return new $f(e);case"winkelTripel":return new em(e);case"albers":return i?new tm(e):new Vf(e);case"lambertConformalConic":return i?new tm(e):new Xf(e);case"globe":return new im(e)}throw new Error(`Invalid projection name: ${e.name}`)}const nm=Number.MAX_SAFE_INTEGER,om=nm-1;function am(e,t,i,r){return e.order<t||e.order===nm||!(e.clipMask&i)||function(e,t){if(0===t.length)return!1;let i=e;for(;""!==i;){if(t.includes(i))return!1;i=Gl(i)}return!0}(r,e.clipScope)}class sm{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new ke(1/0,1/0),max:new ke(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(e,t=!1){const i=dm(new ke(0,0),new ke(co,co),e),r=[];if(t&&!um(i,this._globalClipBounds))return r;for(const n of this._activeRegions){if(n.hiddenByOverlap)continue;if(!um(i,n))continue;const t=pm(n.min,n.max,e);r.push({min:t.min,max:t.max,sourceId:this._sourceIds[n.priority],footprint:n.footprint,footprintTileId:n.tileId,order:n.order,clipMask:n.clipMask,clipScope:n.clipScope})}return r}setSources(e){this._setSources(e.map(e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{const t=[];for(const i of e.cache.getVisibleCoordinates()){const r=e.cache.getTile(i).buckets[e.layer];r&&r.updateFootprints(i.toUnwrapped(),t)}return t},getOrder:()=>e.order,getClipMask:()=>e.clipMask,getClipScope:()=>e.clipScope})))}_addSource(e){const t=e.getFootprints();if(0===t.length)return;const i=e.getOrder(),r=e.getClipMask(),n=e.getClipScope();for(const o of t){if(!o.footprint)continue;const e=dm(o.footprint.min,o.footprint.max,o.id);this._activeRegions.push({min:e.min,max:e.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:o.id,footprint:o.footprint,order:i,clipMask:r,clipScope:n})}this._sourceIds.push(e.getSourceId())}_computeReplacement(){this._activeRegions.sort((e,t)=>e.priority-t.priority||lm(e.min,t.min)||lm(e.max,t.max)||e.order-t.order||e.clipMask-t.clipMask||function(e,t){const i=(e,t)=>e+t;return e.length-t.length||e.reduce(i,"").localeCompare(t.reduce(i,""))}(e.clipScope,t.clipScope));let e=this._activeRegions.length!==this._prevRegions.length;if(!e){let t=0;for(;!e&&t!==this._activeRegions.length;){const i=this._activeRegions[t],r=this._prevRegions[t];e=i.priority!==r.priority||!cm(i,r)||i.order!==r.order||i.clipMask!==r.clipMask||!Ve(i.clipScope,r.clipScope),this._activeRegions[t].hiddenByOverlap=r.hiddenByOverlap,++t}}if(e){++this._updateTime;for(const t of this._activeRegions)t.order!==nm&&(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 e=e=>{const t=this._activeRegions;if(e>=t.length)return e;const i=t[e].priority;for(;e<t.length&&t[e].priority===i;)++e;return e};if(this._sourceIds.length>1){let t=0,i=e(t);for(;t!==i;){let r=t;const n=t;for(;r!==i;){const e=this._activeRegions[r];e.hiddenByOverlap=!1;for(let t=0;t<n;t++){const i=this._activeRegions[t];if(!i.hiddenByOverlap&&e.order===nm&&um(e,i)&&(e.hiddenByOverlap=mm(e.footprint,e.tileId,i.footprint,i.tileId),e.hiddenByOverlap))break}++r}t=i,i=e(t)}}}}_setSources(e){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let t=e.length-1;t>=0;t--)this._addSource(e[t]);this._computeReplacement()}}function lm(e,t){return e.x-t.x||e.y-t.y}function cm(e,t){return 0===lm(e.min,t.min)&&0===lm(e.max,t.max)}function um(e,t){return!(e.min.x>t.max.x||e.max.x<t.min.x||e.min.y>t.max.y||e.max.y<t.min.y)}function hm(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;
vendor: 4,342 bytes, line 2
2i++)if(e[i].sourceId!==t[i].sourceId||!cm(e[i],t[i])||e[i].order!==t[i].order||e[i].clipMask!==t[i].clipMask||!Ve(e[i].clipScope,t[i].clipScope))return!1;return!0}function dm(e,t,i){const r=1/co,n=1/(1<<i.canonical.z),o=(t.x*r+i.canonical.x)*n+i.wrap,a=(t.y*r+i.canonical.y)*n;return{min:new ke((e.x*r+i.canonical.x)*n+i.wrap,(e.y*r+i.canonical.y)*n),max:new ke(o,a)}}function pm(e,t,i){const r=1<<i.canonical.z,n=((t.x-i.wrap)*r-i.canonical.x)*co,o=(t.y*r-i.canonical.y)*co;return{min:new ke(((e.x-i.wrap)*r-i.canonical.x)*co,(e.y*r-i.canonical.y)*co),max:new ke(n,o)}}function fm(e,t,i,r,n,o,a){const s=e.indices,l=e.vertices,c=[];for(let u=r;u<r+n;u+=3){const r=t[i[u+0]+o],n=t[i[u+1]+o],h=t[i[u+2]+o],d=Math.min(r.x,n.x,h.x),p=Math.max(r.x,n.x,h.x),f=Math.min(r.y,n.y,h.y),m=Math.max(r.y,n.y,h.y);c.length=0,e.grid.query(new ke(d,f),new ke(p,m),c);for(let e=0;e<c.length;e++){const t=c[e];if(bd(l[s[3*t+0]],l[s[3*t+1]],l[s[3*t+2]],r,n,h,a))return!0}}return!1}function mm(e,t,i,r){if(!e||!i)return!1;let n=e.vertices;if(!t.canonical.equals(r.canonical)||t.wrap!==r.wrap){if(i.vertices.length<e.vertices.length)return mm(i,r,e,t);const o=t.canonical,a=r.canonical,s=Math.pow(2,a.z-o.z);n=e.vertices.map(e=>new ke((e.x+o.x*co)*s-a.x*co,(e.y+o.y*co)*s-a.y*co))}return fm(i,n,e.indices,0,e.indices.length,0,0)}function _m(e,t,i,r){const n=Math.pow(2,r.z-i.z);return new ke((e+i.x*co)*n-r.x*co,(t+i.y*co)*n-r.y*co)}function gm(e,t){const i=[];t.grid.queryPoint(e,i);const r=t.indices,n=t.vertices;for(let o=0;o<i.length;o++){const t=i[o];if(gd([n[r[3*t+0]],n[r[3*t+1]],n[r[3*t+2]]],e))return!0}return!1}function ym(e,t,i){const r=t[0],n=t[1];return e[0]=i[0]*r+i[4]*n+i[12],e[1]=i[1]*r+i[5]*n+i[13],e[3]=i[3]*r+i[7]*n+i[15],e}class xm{isDataAvailableAtPoint(e){const t=this._source();if(this.isUsingMockSource()||!t||e.y<0||e.y>1)return!1;const i=t.getSource().maxzoom,r=1<<i,n=Math.floor(e.x),o=Math.floor((e.x-n)*r),a=Math.floor(e.y*r),s=this.findDEMTileFor(new Pf(i,n,i,o,a));return!(!s||!s.dem)}getAtPointOrZero(e,t=0){return this.getAtPoint(e,t)||0}getAtPoint(e,t,i=!0){if(this.isUsingMockSource())return null;t??=null;const r=this._source();if(!r)return t;if(e.y<0||e.y>1)return t;const n=r.getSource().maxzoom,o=1<<n,a=Math.floor(e.x),s=e.x-a,l=new Pf(n,a,n,Math.floor(s*o),Math.floor(e.y*o)),c=this.findDEMTileFor(l);if(!c||!c.dem)return t;const u=c.dem,h=1<<c.tileID.canonical.z,d=(s*h-c.tileID.canonical.x)*u.dim,p=(e.y*h-c.tileID.canonical.y)*u.dim,f=Math.floor(d),m=Math.floor(p);return(i?this.exaggeration():1)*Wr(Wr(u.get(f,m),u.get(f,m+1),p-m),Wr(u.get(f+1,m),u.get(f+1,m+1),p-m),d-f)}static getAtTileOffset(e,t,i,r){const n=1<<e.canonical.z;return r?r.pointElevation(t):i?i.getAtPointOrZero(new Zc(e.wrap+(e.canonical.x+t.x/co)/n,(e.canonical.y+t.y/co)/n)):0}static getAtTileOffsetFunc(e,t,i,r){return(n,o,a)=>{const s=this.getAtTileOffset(e,n,o,a),l=r.upVector(e.canonical,n.x,n.y);return W(l,l,s*r.upVectorScale(e.canonical,t,i).metersToTile),l}}getForTilePoints(e,t,i,r){if(this.isUsingMockSource())return!1;const n=vm.create(this,e,r);return!!n&&(t.forEach(e=>{e[2]=this.exaggeration()*n.getElevationAt(e[0],e[1],i,!0)}),!0)}getMinMaxForTile(e){if(this.isUsingMockSource())return null;const t=this.findDEMTileFor(e);if(!t||!t.dem)return null;const i=t.dem.tree,r=t.tileID,n=1<<e.canonical.z-r.canonical.z;let o=e.canonical.x/n-r.canonical.x,a=e.canonical.y/n-r.canonical.y,s=0;for(let l=0;l<e.canonical.z-r.canonical.z&&!i.leaves[s];l++){o*=2,a*=2;const e=2*Math.floor(a)+Math.floor(o);s=i.childOffsets[s]+e,o%=1,a%=1}return{min:this.exaggeration()*i.minimums[s],max:this.exaggeration()*i.maximums[s]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(e,t,i){throw new Error("Pure virtual method called.")}pointCoordinate(e){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(e){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){const e=this.visibleDemTiles;if(0===e.length)return null;let t=!1,i=Number.MAX_VALUE,r=Number.MIN_VALUE;for(const n of e){const e=this.getMinMaxForTile(n.tileID);
vendor: 6,305 bytes, line 2
2e&&(i=Math.min(i,e.min),r=Math.max(r,e.max),t=!0)}return t?{min:i,max:r}:null}}class vm{constructor(e,t,i){this._demTile=e,this._dem=this._demTile.dem,this._scale=t,this._offset=i}static create(e,t,i){const r=i||e.findDEMTileFor(t);if(!r||!r.dem)return;const n=r.dem,o=r.tileID,a=1<<t.canonical.z-o.canonical.z;return new vm(r,n.dim/co/a,[(t.canonical.x/a-o.canonical.x)*n.dim,(t.canonical.y/a-o.canonical.y)*n.dim])}tileCoordToPixel(e,t){const i=t*this._scale+this._offset[1];return new ke(Math.floor(e*this._scale+this._offset[0]),Math.floor(i))}getElevationAt(e,t,i,r){const n=e*this._scale+this._offset[0],o=t*this._scale+this._offset[1],a=Math.floor(n),s=Math.floor(o),l=this._dem;return r=!!r,i?Wr(Wr(l.get(a,s,r),l.get(a,s+1,r),o-s),Wr(l.get(a+1,s,r),l.get(a+1,s+1,r),o-s),n-a):l.get(a,s,r)}getElevationAtPixel(e,t,i){return this._dem.get(e,t,!!i)}getMeterToDEM(e){return(1<<this._demTile.tileID.canonical.z)*Uc(1,e)*this._dem.stride}}const bm=.05;function wm(e,t,i){const r=dt(45,65,i),[n,o]=e.range;let a=1-Math.min(1,Math.exp((t-n)/(o-n)*-6));return a*=a*a,a=Math.min(1,1.00747*a),a*r*e.alpha}function Em(e,t,i,r,n,o){const a=[t,i,r];return ie(a,a,o.calculateFogTileMatrix(n)),wm(e,k(a),o.pitch)}function Am(e,t,i,r,n){return wm(e,k(ie([],[t,i,r],n.mercatorFogMatrix)),n.pitch)}function Im(e,t,i,r,n,o,a){const s=[[i,r,0],[n,r,0],[n,o,0],[i,o,0]];let l=Number.MAX_VALUE,c=-Number.MAX_VALUE;for(const u of s){const e=k(ie([],u,t));l=Math.min(l,e),c=Math.max(c,e)}return[wm(e,l,a.pitch),wm(e,c,a.pitch)]}function Sm(e,t,i){const r=t.createTileMatrix(e,e.worldSize,i.toUnwrapped());return x(new Float32Array(16),e.projMatrix,r)}function Tm(e,t,i){if(t.projection.name===i.projection.name)return e.projMatrix;const r=i.clone();return r.setProjection(t.projection),Sm(r,t.getProjection(),e)}function Dm(e,t,i){return t.name===i.projection.name?e.projMatrix:Sm(i,t,e)}function Mm(e,t,i,r){return t.name===r?i.calculateProjMatrix(e.toUnwrapped()):Sm(i,t,e)}function Pm(e){return 3*e}const Cm=4294967296,Rm="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");class zm{constructor(e){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.type=0,this._valueStart=-1,this.length=this.buf.length}readFields(e,t,i=this.length){let r;for(;r=this.nextField(i);)e(r,t,this);return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Cm;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Cm;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const t=this.buf,i=t[this.pos++];if(i<128)return i;let r,n=127&i;return r=t[this.pos++],n|=(127&r)<<7,r<128?n:(r=t[this.pos++],n|=(127&r)<<14,r<128?n:(r=t[this.pos++],n|=(127&r)<<21,r<128?n:(r=t[this.pos],n|=(15&r)<<28,function(e,t,i){const r=i.buf;let n,o;if(o=r[i.pos++],n=(112&o)>>4,o<128)return Lm(e,n,t);if(o=r[i.pos++],n|=(127&o)<<3,o<128)return Lm(e,n,t);if(o=r[i.pos++],n|=(127&o)<<10,o<128)return Lm(e,n,t);if(o=r[i.pos++],n|=(127&o)<<17,o<128)return Lm(e,n,t);if(o=r[i.pos++],n|=(127&o)<<24,o<128)return Lm(e,n,t);if(o=r[i.pos++],n|=(1&o)<<31,o<128)return Lm(e,n,t);throw new Error("Expected varint not more than 10 bytes")}(n,e,this))))}readSVarint(){const e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return Boolean(this.readVarint())}readString(){const e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&Rm?Rm.decode(this.buf.subarray(t,e)):function(e,t,i){let r="",n=t;for(;n<i;){const t=e[n];let o,a,s,l=null,c=t>239?4:t>223?3:t>191?2:1;if(n+c>i)break;1===c?t<128&&(l=t):2===c?(o=e[n+1],128==(192&o)&&(l=(31&t)<<6|63&o,l<=127&&(l=null))):3===c?(o=e[n+1],a=e[n+2],128==(192&o)&&128==(192&a)&&(l=(15&t)<<12|(63&o)<<6|63&a,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===c&&(o=e[n+1],a=e[n+2],s=e[n+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(l=(15&t)<<18|(63&o)<<12|(63&a)<<6|63&s,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,c=1):l>65535&&(l-=65536,r+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),r+=String.fromCharCode(l),n+=c}return r}(this.buf,t,e)}readBytes(){const e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}nextField(e=this.length){if(this.pos===this._valueStart&&this.skip(this.type),this.pos>=e)return 0;const t=this.readVarint();return this.type=7&t,this._valueStart=this.pos,t>>>3}skip(e){const t=7&e;if(0===t)for(;this.buf[this.pos++]>127;);else if(2===t)this.pos=this.readVarint()+this.pos;else if(5===t)this.pos+=4;else{if(1!==t)throw new Error(`Unimplemented type: ${t}`);this.pos+=8}}}function Lm(e,t,i){return i?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function Fm(e,t,i){let r;for(;r=e.nextField(t);)3===r?i.glyphs.push(Om(e,e.readVarint()+e.pos)):4===r?i.ascender=e.readSVarint():5===r&&(i.descender=e.readSVarint())}
vendor: 4,177 bytes, line 2
2function Om(e,t){let i,r,n=0,o=0,a=0,s=0,l=0,c=0;for(;r=e.nextField(t);)1===r?n=e.readVarint():2===r?i=e.readBytes():3===r?o=e.readVarint():4===r?a=e.readVarint():5===r?s=e.readSVarint():6===r?l=e.readSVarint():7===r&&(c=e.readVarint());return{id:n,bitmap:new Rd({width:o+6,height:a+6},i),metrics:{width:o,height:a,left:s,top:l,advance:c}}}function Bm(e){let t=0,i=0;for(const a of e)t+=a.w*a.h,i=Math.max(i,a.w);e.sort((e,t)=>t.h-e.h);const r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),i),h:1/0}];let n=0,o=0;for(const a of e)for(let e=r.length-1;e>=0;e--){const t=r[e];if(!(a.w>t.w||a.h>t.h)){if(a.x=t.x,a.y=t.y,o=Math.max(o,a.y+a.h),n=Math.max(n,a.x+a.w),a.w===t.w&&a.h===t.h){const t=r.pop();t&&e<r.length&&(r[e]=t)}else a.h===t.h?(t.x+=a.w,t.w-=a.w):a.w===t.w?(t.y+=a.h,t.h-=a.h):(r.push({x:t.x+a.w,y:t.y,w:t.w-a.w,h:a.h}),t.y+=a.h,t.h-=a.h);break}}return{w:n,h:o,fill:t/(n*o)||0}}function km(e,t){return e.id<t.id?-1:e.id>t.id?1:e.version<t.version?-1:e.version>t.version?1:e.sx<t.sx?-1:e.sx>t.sx?1:e.sy<t.sy?-1:e.sy>t.sy?1:0}function Vm(e){let t=0;for(let i=0;i<e.length;i++)t=(t<<5)-t+e.charCodeAt(i),t&=t;return t}function Nm(e,t){return(e<<5)-e+t}function Um(e,t,i,r){for(const[n]of e.entries()){const e=r&&r.get(n)||wn.parse(n),o=e.id.toString(),a=t.get(o)||0;i.push({id:n,version:a,sx:e.sx,sy:e.sy})}}class jm{constructor(e,t,i,r,n="",o){this.scope=n,this.iconDescriptors=[],this.patternDescriptors=[],this.requiresMipMaps=t.size>0,Um(e,i,this.iconDescriptors,o),Um(t,i,this.patternDescriptors,o),this.iconDescriptors.sort(km),this.patternDescriptors.sort(km);let a=0;a=Nm(a,Vm(n)),a=Nm(a,1);const s=r?r.data:"";s&&(a=Nm(a,Vm(s))),a=Nm(a,1);for(const l of this.iconDescriptors)a=Nm(a,Vm(l.id)),a=Nm(a,l.version),a=Nm(a,l.sx),a=Nm(a,l.sy);a=Nm(a,1);for(const l of this.patternDescriptors)a=Nm(a,Vm(l.id)),a=Nm(a,l.version),a=Nm(a,l.sx),a=Nm(a,l.sy);this.hash=a}subsetOf(e){return this.scope===e.scope&&this.isSubsetArray(this.iconDescriptors,e.iconDescriptors,km)&&this.isSubsetArray(this.patternDescriptors,e.patternDescriptors,km)}isSubsetArray(e,t,i){let r=0,n=0;if(e.length>t.length)return!1;for(;r<e.length&&n<t.length;){const o=i(e[r],t[n]);if(0===o)r++,n++;else{if(o<0)return!1;n++}}return r===e.length}}function Gm(e){switch(e){case WebGL2RenderingContext.RGBA8:case WebGL2RenderingContext.RGBA16F: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 Hm(e){switch(e){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.RGBA16F:return WebGL2RenderingContext.HALF_FLOAT;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}}Rs(jm,"AtlasContentDescriptor");class $m{constructor(e,t,i,r){this.context=e,this.format=i,this.useMipmap=r&&r.useMipmap,this.texture=e.gl.createTexture(),this.update(t,{premultiply:r&&r.premultiply})}update(e,t){const i=e&&e instanceof HTMLVideoElement&&0===e.width?e.videoWidth:e.width,r=e&&e instanceof HTMLVideoElement&&0===e.height?e.videoHeight:e.height,{context:n}=this,{gl:o}=n,{x:a,y:s}=t&&t.position?t.position:{x:0,y:0},l=a+i,c=s+r;this.size&&(this.size[0]!==l||this.size[1]!==c)&&(!t||void 0===t.recreateWhenResize||t.recreateWhenResize)&&(o.bindTexture(o.TEXTURE_2D,null),o.deleteTexture(this.texture),this.texture=o.createTexture(),this.size=null),o.bindTexture(o.TEXTURE_2D,this.texture),n.pixelStoreUnpackFlipY.set(!1),n.pixelStoreUnpack.set(1),n.pixelStoreUnpackPremultiplyAlpha.set(this.format===o.RGBA8&&(!t||!1!==t.premultiply));const u=e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap;if(!this.size&&l>
vendor: 14,404 bytes, line 2
20&&c>0){const e=this.useMipmap?Math.floor(Math.log2(Math.max(l,c)))+1:1;o.texStorage2D(o.TEXTURE_2D,e,this.format,l,c),this.size=[l,c]}this.size&&(u?o.texSubImage2D(o.TEXTURE_2D,0,a,s,Gm(this.format),Hm(this.format),e):"data"in e&&e.data&&o.texSubImage2D(o.TEXTURE_2D,0,a,s,i,r,Gm(this.format),Hm(this.format),e.data)),this.useMipmap&&o.generateMipmap(o.TEXTURE_2D)}bind(e,t,i=!1){const{context:r}=this,{gl:n}=r;n.bindTexture(n.TEXTURE_2D,this.texture),e!==this.minFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,this.useMipmap&&!i?e===n.NEAREST?n.NEAREST_MIPMAP_NEAREST:n.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),t!==this.wrapS&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,t),this.wrapS=t)}bindExtraParam(e,t,i,r,n){const{context:o}=this,{gl:a}=o;a.bindTexture(a.TEXTURE_2D,this.texture),t!==this.magFilter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,t),this.magFilter=t),e!==this.minFilter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,this.useMipmap?e===a.NEAREST?a.NEAREST_MIPMAP_NEAREST:a.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),i!==this.wrapS&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,i),this.wrapS=i),r!==this.wrapT&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,r),this.wrapT=r),n!==this.compareMode&&(n?(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_COMPARE_MODE,a.COMPARE_REF_TO_TEXTURE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_COMPARE_FUNC,n)):a.texParameteri(a.TEXTURE_2D,a.TEXTURE_COMPARE_MODE,a.NONE),this.compareMode=n)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class Wm{constructor(e,t,i,r){this.context=e,this.format=r,this.size=i,this.texture=e.gl.createTexture();const[n,o,a]=this.size,{gl:s}=e;s.bindTexture(s.TEXTURE_3D,this.texture),e.pixelStoreUnpackFlipY.set(!1),e.pixelStoreUnpack.set(1),e.pixelStoreUnpackPremultiplyAlpha.set(!1),"data"in t&&t.data&&s.texImage3D(s.TEXTURE_3D,0,this.format,n,o,a,0,Gm(this.format),Hm(this.format),t.data)}bind(e,t){const{context:i}=this,{gl:r}=i;r.bindTexture(r.TEXTURE_3D,this.texture),e!==this.minFilter&&(r.texParameteri(r.TEXTURE_3D,r.TEXTURE_MAG_FILTER,e),r.texParameteri(r.TEXTURE_3D,r.TEXTURE_MIN_FILTER,e),this.minFilter=e),t!==this.wrapS&&(r.texParameteri(r.TEXTURE_3D,r.TEXTURE_WRAP_S,t),r.texParameteri(r.TEXTURE_3D,r.TEXTURE_WRAP_T,t),this.wrapS=t)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class qm{constructor(e,t){this.context=e,this.texture=t}bind(e,t){const{context:i}=this,{gl:r}=i;r.bindTexture(r.TEXTURE_2D,this.texture),e!==this.minFilter&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,e),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,e),this.minFilter=e),t!==this.wrapS&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,t),this.wrapS=t)}}class Zm{static getImagePositionScale(e,t,i){if(t&&e){const{sx:t,sy:i}=e;return{x:t,y:i}}return{x:i,y:i}}constructor(e,t,i,r){this.paddedRect=e;const{pixelRatio:n,version:o,stretchX:a,stretchY:s,content:l,sdf:c,usvg:u}=t;this.pixelRatio=n,this.stretchX=a,this.stretchY=s,this.content=l,this.version=o,this.padding=i,this.sdf=c,this.usvg=u,this.scale=Zm.getImagePositionScale(r,u,n)}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 Xm(e,t,i){const r=wn.parse(e),n=function(e,t,i=[1,1]){return{x:0,y:0,w:(e.data?e.data.width:e.width*i[0])+2*t,h:(e.data?e.data.height:e.height*i[1])+2*t}}(t,i,[r.sx,r.sy]);return{bin:n,imagePosition:new Zm(n,t,i,r),imageVariant:r}}function Ym(e,t){const i=[];for(const[n,o]of e.entries()){const e=wn.parse(n);e&&(i.push({key:n,value:o,variant:e}),t&&t.set(n,e))}i.sort((e,t)=>{const i=e.variant.id.toString().localeCompare(t.variant.id.toString());return 0!==i?i:e.variant.sx!==t.variant.sx?e.variant.sx-t.variant.sx:e.variant.sy!==t.variant.sy?e.variant.sy-t.variant.sy:e.key.localeCompare(t.key)});const r=new Map;for(const n of i)r.set(n.key,n.value);return r}class Km{constructor(e){this.cache=new Map,this.textures=new Map,this.textureAccessTimes=new Map,this.textureMemoryUsed=0,this.maxTextureMemory=1024*(e&&e.maxTextureMemoryMB?e.maxTextureMemoryMB:256)*1024,this.currentFrameAtlases=new Set,this.finalizationRegistry=new FinalizationRegistry(e=>{this.cache.delete(e),this.clearExpiredTextures()})}beginFrame(){this.currentFrameAtlases.clear()}calculateTextureMemory(e){return e.image?Math.ceil(e.image.width*e.image.height*4*(e.patternPositions.size>0?1.33:1)):0}evictTexture(e){const t=this.textures.get(e);if(t){const i=this.calculateTextureMemory(e);t.destroy(),this.textures.delete(e),this.textureAccessTimes.delete(e),this.textureMemoryUsed-=i,e.uploaded=!1}}evictTexturesIfNeeded(e){for(;this.textureMemoryUsed+e>this.maxTextureMemory&&this.textures.size>0;){let e=null,t=1/0;for(const[i]of this.textures.entries()){if(this.currentFrameAtlases.has(i))continue;const r=this.textureAccessTimes.get(i)||0;r<t&&(t=r,e=i)}if(!e)break;this.evictTexture(e)}}findCachedAtlas(e){const t=this.cache.get(e.hash);if(t){const i=t.deref();if(i&&i.contentDescriptor&&this.isMipmapCompatible(e,i.contentDescriptor))return i}for(const[,i]of this.cache.entries()){const t=i.deref();if(t&&t.contentDescriptor){const i=e.subsetOf(t.contentDescriptor),r=this.isMipmapCompatible(e,t.contentDescriptor);if(i&&r)return t}}}getTextureForAtlas(e,t,i){this.textureAccessTimes.set(e,performance.now()),this.currentFrameAtlases.add(e);let r=this.textures.get(e);if(r)return r;if(e.image){const n=this.calculateTextureMemory(e);return this.evictTexturesIfNeeded(n),r=new $m(t,e.image,i,{useMipmap:!!e.patternPositions.size}),this.textures.set(e,r),this.textureMemoryUsed+=n,r}return null}clearExpiredTextures(){for(const[e]of this.textures.entries())if(!this.isAtlasCached(e)){const t=this.textures.get(e);if(t){const i=this.calculateTextureMemory(e);t.destroy(),this.textureMemoryUsed-=i}this.textures.delete(e),this.textureAccessTimes.delete(e)}}isAtlasCached(e){if(!e.contentDescriptor)return!1;const t=this.cache.get(e.contentDescriptor.hash);return!!t&&t.deref()===e}getOrCache(e){if(!("image"in e)){const t=this.cache.get(e.sourceAtlasHash);if(t){const e=t.deref();if(e)return e}return Tt("ImageAtlasReference points to GC'd atlas - atlas may have been evicted"),null}if(!e.contentDescriptor)return e;const t=e.contentDescriptor,i=t.hash,r=this.cache.get(i);if(r){const e=r.deref();if(e&&e.contentDescriptor&&this.isMipmapCompatible(t,e.contentDescriptor))return e}return this.cache.set(i,new WeakRef(e)),this.finalizationRegistry.register(e,i,e),e}isMipmapCompatible(e,t){return!e.requiresMipMaps||t.requiresMipMaps}destroyTextures(){for(const e of this.textures.values())e&&e.destroy();this.textures.clear(),this.textureAccessTimes.clear(),this.textureMemoryUsed=0}clear(){for(const e of this.textures.values())e&&e.destroy();this.cache.clear(),this.textures.clear(),this.textureAccessTimes.clear(),this.textureMemoryUsed=0}}Rs(Zm,"ImagePosition"),Rs(class{constructor(e,t,i,r,n=""){const o=new Map,a=new Map;this.haveRenderCallbacks=[];const s=[],l=void 0!==r,c=l?new Map:void 0,u=l?Ym(e,c):e,h=l?Ym(t,c):t;this.addImages(u,o,1,s),this.addImages(h,a,2,s);const{w:d,h:p}=Bm(s),f=new zd({width:d||1,height:p||1});for(const[m,_]of u.entries()){const e=o.get(m).paddedRect;zd.copy(_.data,f,{x:0,y:0},{x:e.x+1,y:e.y+1},_.data,null,_.sdf)}for(const[m,_]of h.entries()){const e=a.get(m),t=e.paddedRect;let r=e.padding;const n=t.x+r,o=t.y+r,s=_.data.width,l=_.data.height;r=r>1?r-1:r,zd.copy(_.data,f,{x:0,y:0},{x:n,y:o},_.data,i),zd.copy(_.data,f,{x:0,y:l-r},{x:n,y:o-r},{width:s,height:r},i),zd.copy(_.data,f,{x:0,y:0},{x:n,y:o+l},{width:s,height:r},i),zd.copy(_.data,f,{x:s-r,y:0},{x:n-r,y:o},{width:r,height:l},i),zd.copy(_.data,f,{x:0,y:0},{x:n+s,y:o},{width:r,height:l},i),zd.copy(_.data,f,{x:s-r,y:l-r},{x:n-r,y:o-r},{width:r,height:r},i),zd.copy(_.data,f,{x:0,y:l-r},{x:n+s,y:o-r},{width:r,height:r},i),zd.copy(_.data,f,{x:0,y:0},{x:n+s,y:o+l},{width:r,height:r},i),zd.copy(_.data,f,{x:s-r,y:0},{x:n-r,y:o+l},{width:r,height:r},i)}this.lut=i,this.image=f,this.iconPositions=o,this.patternPositions=a,l&&(this.contentDescriptor=new jm(u,h,r,i,n,c))}addImages(e,t,i,r){for(const[n,o]of e.entries()){const{bin:e,imagePosition:a,imageVariant:s}=Xm(n,o,i);t.set(n,a),r.push(e),o.hasRenderCallback&&this.haveRenderCallbacks.push(s.id)}}patchUpdatedImages(e,t,i,r){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(t=>e.hasImage(t,i)),e.dispatchRenderCallbacks(this.haveRenderCallbacks,i);for(const n of e.getUpdatedImages(i)){for(const r of this.iconPositions.keys()){const o=wn.parse(r);if(Ur.isEqual(o.id,n)){const o=e.getImage(n,i);this.patchUpdatedImage(this.iconPositions.get(r),o,t,null)}}for(const o of this.patternPositions.keys()){const a=wn.parse(o);if(Ur.isEqual(a.id,n)){const a=e.getImage(n,i);this.patchUpdatedImage(this.patternPositions.get(o),a,t,r||this.lut)}}}}patchUpdatedImage(e,t,i,r=null){if(!e||!t)return;if(e.version===t.version)return;e.version=t.version;const[n,o]=e.tl,a=e.sdf;if(this.lut||a){const e={width:t.data.width,height:t.data.height},s=new zd(e);zd.copy(t.data,s,{x:0,y:0},{x:0,y:0},e,r,a),i.update(s,{position:{x:n,y:o},recreateWhenResize:!1})}else i.update(t.data,{position:{x:n,y:o},recreateWhenResize:!1})}},"ImageAtlas",{omit:["lut"]}),Rs(class{constructor(e){this.sourceAtlasHash=e}},"ImageAtlasReference");class Jm{constructor(e){this.pendingRequests=new Map,this.cachedRanges=new Map,this.fontstackCompositing=e&&e.fontstackCompositing||"client"}loadGlyphRange(e,t,i,r,n){if("server"===this.fontstackCompositing)return void Jm.loadGlyphRange(e,t,i,r,n);const o=e.split(",").map(e=>e.trim()).filter(e=>e.length>0);0!==o.length?1!==o.length?this._loadMultipleFonts(o,t,i,r,n):this._loadFont(o[0],t,i,r,n):n(new Error("Empty fontstack"))}_loadMultipleFonts(e,t,i,r,n){const o=e.map(()=>null),a={completed:0,firstError:null,callbackCalled:!1},s=(t,i,r)=>{if(!a.callbackCalled&&(i&&!a.firstError&&(a.firstError=i),r&&(o[t]=r),a.completed++,a.completed===e.length)){a.callbackCalled=!0;const e=o.filter(e=>null!==e);if(0===e.length)return void n(a.firstError||new Error("All fonts failed to load"));const t=this._composeGlyphs(e);n(null,t)}};for(let l=0;l<e.length;l++)this._loadFont(e[l],t,i,r,(e,t)=>{s(l,e,t)})}_loadFont(e,t,i,r,n){const o=`${e}:${t}`;if(this.cachedRanges.has(o)){const e=this.cachedRanges.get(o);return void ei.frame(()=>n(null,e))}const a=this.pendingRequests.get(o);a?a.push(n):(this.pendingRequests.set(o,[n]),Jm.loadGlyphRange(e,t,i,r,(e,t)=>{e||this.cachedRanges.set(o,t||null);const i=this.pendingRequests.get(o);if(this.pendingRequests.delete(o),i)for(const r of i)r(e,t)}))}_composeGlyphs(e){const t={};let i,r;for(const n of e)if(void 0===i&&void 0!==n.ascender&&(i=n.ascender),void 0===r&&void 0!==n.descender&&(r=n.descender),n.glyphs)for(const e in n.glyphs)void 0===t[e]&&(t[e]=n.glyphs[e]);return{glyphs:t,ascender:i,descender:r}}}Jm.loadGlyphRange=async function(e,t,i,r,n){const o=256*t,a=o+255;let s;try{const t=await r.transformRequest(r.normalizeGlyphsURL(i).replace("{fontstack}",e).replace("{range}",`${o}-${a}`),Bi.Glyphs),{data:n}=await Wi(t),l={},c=function(e){return function(e){const t={glyphs:[]};let i;for(;i=e.nextField();)1===i&&Fm(e,e.readVarint()+e.pos,t);return t}(new zm(e))}(n);for(const e of c.glyphs)l[e.id]=e;s={glyphs:l,ascender:c.ascender,descender:c.descender}}catch(e){return n(e)}n(null,s)};const Qm=1e20,e_=new Float64Array(256);for(let JF=0;JF<256;JF++){const e=.5-Math.pow(JF/255,1/2.2);e_[JF]=e*Math.abs(e)}function t_(e,t,i,r,n,o,a,s,l){for(let c=t;c<t+r;c++)i_(e,i*o+c,o,n,a,s,l);for(let c=i;c<i+n;c++)i_(e,c*o+t,1,r,a,s,l)}function i_(e,t,i,r,n,o,a){o[0]=0,a[0]=-Qm,a[1]=Qm,n[0]=e[t];for(let s=1,l=0,c=0;s<r;s++){n[s]=e[t+s*i];const r=s*s;do{const e=o[l];c=(n[s]-n[e]+r-e*e)/(s-e)/2}while(c<=a[l]&&--l>-1);l++,o[l]=s,a[l]=c,a[l+1]=Qm}for(let s=0,l=0;s<r;s++){for(;a[l+1]<s;)l++;const r=o[l],c=s-r;e[t+s*i]=n[r]+c*c}}e_[255]=-Qm;const r_=/bold/i,n_=/medium/i,o_=/light/i;class a_{constructor(e,t,i,r){this.requestManager=e,this.localGlyphMode=t,this.localFontFamily=i,this.url="",this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}},this.glyphLoader=new Jm({fontstackCompositing:r})}setURL(e){this.url=e}prefetchRange(e,t){const i=this.url||gi.GLYPHS_URL;if(!i)return;let r=this.entries[e];r||(r=this.entries[e]={glyphs:{},requests:{},ranges:{}}),r.ranges[t]||r.requests[t]||(r.requests[t]=[],this.glyphLoader.loadGlyphRange(e,t,i,this.requestManager,(e,i)=>{if(i){r.ascender=i.ascender,r.descender=i.descender;for(const e in i.glyphs)this._doesCharSupportLocalGlyph(+e)||(r.glyphs[+e]=i.glyphs[+e]);r.ranges[t]=!0}for(const n of r.requests[t]||[])n(e,i);delete r.requests[t]}))}getGlyphs(e,t){const i=[],r=this.url||gi.GLYPHS_URL;for(const n in e)for(const t of e[n])i.push({stack:n,id:t});ft(i,({stack:e,id:t},i)=>{let n=this.entries[e];n||(n=this.entries[e]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let o=n.glyphs[t];if(void 0!==o)return void i(null,{stack:e,id:t,glyph:o});if(o=this._tinySDF(n,e,t),o)return n.glyphs[t]=o,void i(null,{stack:e,id:t,glyph:o});const a=Math.floor(t/256);if(256*a>65535)return Tt("glyphs > 65535 not supported"),void i(null,{stack:e,id:t,glyph:o});if(n.ranges[a])return void i(null,{stack:e,id:t,glyph:o});let s=n.requests[a];s||(s=n.requests[a]=[],this.glyphLoader.loadGlyphRange(e,a,r,this.requestManager,(e,t)=>{if(t){n.ascender=t.ascender,n.descender=t.descender;for(const e in t.glyphs)this._doesCharSupportLocalGlyph(+e)||(n.glyphs[+e]=t.glyphs[+e]);n.ranges[a]=!0}for(const i of s)i(e,t);delete n.requests[a]})),s.push((r,n)=>{r?i(r):n&&i(null,{stack:e,id:t,glyph:n.glyphs[t]||null})})},(e,i)=>{if(e)t(e);else if(i){const e={};for(const{stack:t,id:r,glyph:n}of i)void 0===e[t]&&(e[t]={}),void 0===e[t].glyphs&&(e[t].glyphs={}),e[t].glyphs[r]=n&&{id:n.id,bitmap:n.bitmap.clone(),metrics:n.metrics},e[t].ascender=this.entries[t].ascender,e[t].descender=this.entries[t].descender;t(null,e)}})}_doesCharSupportLocalGlyph(e){return 0!==this.localGlyphMode&&(2===this.localGlyphMode?!!this.localFontFamily:!!this.localFontFamily&&
vendor: 9,761 bytes, line 2
2(js(e)||Gs(e)||Vs(e)||Ns(e)||ks(e)||Us(e)||(t=e)>=131072&&t<=173791||(e=>e>=66736&&e<=66815)(e)));var t}_tinySDF(e,t,i){const r=this.localFontFamily;if(!r||!this._doesCharSupportLocalGlyph(i))return;let n=e.tinySDF;if(!n){let i="400";r_.test(t)?i="900":n_.test(t)?i="500":o_.test(t)&&(i="200"),n=e.tinySDF=new a_.TinySDF({fontFamily:r,fontWeight:i,fontSize:48,buffer:6,radius:16}),n.fontWeight=i}const o=n.fontWeight;if(this.localGlyphs[o][i])return this.localGlyphs[o][i];const a=String.fromCodePoint(i),{data:s,width:l,height:c,glyphWidth:u,glyphHeight:h,glyphLeft:d,glyphTop:p,glyphAdvance:f}=n.draw(a);return this.localGlyphs[o][i]={id:i,bitmap:new Rd({width:l,height:c},s),metrics:{width:u/2,height:h/2,left:d/2,top:p/2-27,advance:f/2,localGlyph:!0}}}}function s_(e,t){return e+t[1]-t[0]}function l_(e,t,i){let r=0;for(const n of e)r+=Math.max(t,Math.min(i,n[1]))-Math.max(t,Math.min(i,n[0]));return r}function c_(e,t,i){const r=[{fixed:-1,stretch:0}];for(const[n,o]of e){const e=r.at(-1);r.push({fixed:n-e.stretch,stretch:e.stretch}),r.push({fixed:n-e.stretch,stretch:e.stretch+(o-n)})}return r.push({fixed:t+1,stretch:i}),r}function u_(e,t,i,r){return e/t*i+r}function h_(e,t,i,r){return e-t*i/r}function d_(e,t,i,r){const n=t+e.positionedLines[r].lineOffset;return 0===r?i+n/2:i+(n+(t+e.positionedLines[r-1].lineOffset))/2}a_.TinySDF=class{constructor({fontSize:e=24,buffer:t=3,radius:i=8,cutoff:r=.25,fontFamily:n="sans-serif",fontWeight:o="normal",fontStyle:a="normal",lang:s=null}={}){this.buffer=t,this.radius=i,this.cutoff=r,this.lang=s;const l=this.size=e+4*t,c=this._createCanvas(l),u=this.ctx=c.getContext("2d",{willReadFrequently:!0});u.font=`${a} ${o} ${e}px ${n}`,u.textBaseline="alphabetic",u.textAlign="left",u.fillStyle="black",this.gridOuter=new Float64Array(l*l),this.gridInner=new Float64Array(l*l),this.f=new Float64Array(l),this.z=new Float64Array(l+1),this.v=new Uint16Array(l)}_createCanvas(e){if("undefined"!=typeof OffscreenCanvas)return new OffscreenCanvas(e,e);const t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){const{width:t,actualBoundingBoxAscent:i,actualBoundingBoxDescent:r,actualBoundingBoxLeft:n,actualBoundingBoxRight:o}=this.ctx.measureText(e),a=Math.ceil(i),s=Math.floor(-n),l=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o)-s)),c=Math.max(0,Math.min(this.size-this.buffer,a+Math.ceil(r))),u=l+2*this.buffer,h=c+2*this.buffer,d=Math.max(u*h,0),p=new Uint8ClampedArray(d),f={data:p,width:u,height:h,glyphWidth:l,glyphHeight:c,glyphTop:a,glyphLeft:s,glyphAdvance:t};if(0===l||0===c)return f;const{ctx:m,buffer:_,gridInner:g,gridOuter:y}=this;this.lang&&(m.lang=this.lang),m.clearRect(_,_,l,c),m.fillText(e,_-s,_+a);const x=m.getImageData(_,_,l,c);y.fill(Qm,0,d),g.fill(0,0,d);let v=3;for(let A=0;A<c;A++){let e=(A+_)*u+_;for(let t=0;t<l;t++,v+=4,e++){const t=x.data[v];if(0===t)continue;const i=e_[t];y[e]=Math.max(0,i),g[e]=Math.max(0,-i)}}t_(y,0,0,u,h,u,this.f,this.v,this.z);const b=Math.min(_,1);t_(g,_-b,_-b,l+2*b,c+2*b,u,this.f,this.v,this.z);const w=255/this.radius,E=255*(1-this.cutoff);for(let A=0;A<d;A++){const e=Math.sqrt(y[A])-Math.sqrt(g[A]);p[A]=Math.round(E-w*e)}return f}};class p_{constructor(e,t){this.lastParams=null,this.lastAllFeaturesIndex=-2,this.appearancesVersion=t,this.appearances=e;const i=e.map(e=>function(e){if(!e.condition)return{featureDependent:!1,stateDependent:!1,zoomDependent:!1,pitchDependent:!1,brightnessDependent:!1,worldviewDependent:!1};const t=e.condition.expression;return{featureDependent:!mo(t),stateDependent:!_o(t),zoomDependent:!yo(t,["zoom"]),pitchDependent:!yo(t,["pitch"]),brightnessDependent:!yo(t,["brightness","measure-light"]),worldviewDependent:!yo(t,["worldview"])}}(e));this.anyFeatureDependent=i.some(e=>e.featureDependent),this.anyStateDependent=i.some(e=>e.stateDependent)}update(e,t){const i=this.lastParams,r=!i||i.zoom!==e.zoom||i.pitch!==(e.pitch||0)||i.brightness!==(e.brightness||0)||i.worldview!==e.worldview;this.lastParams={zoom:e.zoom,pitch:e.pitch||0,brightness:e.brightness||0,worldview:e.worldview};const n=t&&this.anyStateDependent;if(!r&&!n&&-2!==this.lastAllFeaturesIndex)return{kind:"no-changes"};if(!this.anyFeatureDependent&&!n){const t=this.evaluateAllFeatures(e);return t===this.lastAllFeaturesIndex?{kind:"no-changes"}:(this.lastAllFeaturesIndex=t,{kind:"all-features",appearanceIndex:t})}return{kind:"per-feature"}}evaluateAllFeatures(e){for(let t=0;t<this.appearances.length;t++){const i=this.appearances[t];if(i.condition&&i.condition.evaluate(e,void 0,void 0,void 0))return t}return-1}}const f_=td.types,m_=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function __(e,t,i,r,n,o,a,s,l,c,u,h,d){const p=s?Math.min(Dp,Math.round(s[0])):0,f=s?Math.min(Dp,Math.round(s[1])):0;e.emplaceBack(t,i,Math.round(32*r),Math.round(32*n),o,a,(p<<1)+(l?1:0),0+(f<<1),16*c,16*u,256*h,256*d)}function g_(e,t,i){e.emplaceBack(t,i)}function y_(e,t,i,r,n,o,a){e.emplaceBack(t,i,r,n,o,a)}function x_(e,t,i,r,n){const o=5*t+2;e.float32[o+0]=i,e.float32[o+1]=r,e.float32[o+2]=n}function v_(e,t,i,r,n){e.emplaceBack(t,i,r,n),e.emplaceBack(t,i,r,n),e.emplaceBack(t,i,r,n),e.emplaceBack(t,i,r,n)}function b_(e){for(const t of e.sections)if(Zs(t.text))return!0;return!1}const w_=12,E_={};class A_{constructor(e){this.layoutVertexArray=new Eu,this.indexArray=new Ru,this.programConfigurations=e,this.segments=new uh,this.dynamicLayoutVertexArray=new Iu,this.opacityVertexArray=new Su,this.placedSymbolArray=new Yu,this.iconTransitioningVertexArray=new Tu,this.globeExtVertexArray=new Au,this.zOffsetVertexArray=new pu,this.orientationVertexArray=new Fu,this.symbolInstanceIndices=[],this.uboBinder=null,this.featureIdArray=new pu,this.featureIdBuffer=null,this.cachedBatchIndices=null,this.cachedBatchSegments=null}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length&&0===this.iconTransitioningVertexArray.length}getBatchGrouping(e){const t=e.get().length===this.segments.get().length;if(t&&this.cachedBatchIndices&&this.cachedBatchSegments)return{batchIndices:this.cachedBatchIndices,batchSegments:this.cachedBatchSegments};const i=new Map;for(const o of e.get()){const e=void 0!==o.batchIndex?o.batchIndex:0;i.has(e)||i.set(e,[]),i.get(e).push(o)}const r=Array.from(i.keys()).sort((e,t)=>e-t),n=new Map;for(const o of r){const e=i.get(o);n.set(o,new uh(e))}return t&&(this.cachedBatchIndices=r,this.cachedBatchSegments=n),{batchIndices:r,batchSegments:n}}snapshotSymbolVertexData(e,t){const i=e*w_;return this.layoutVertexArray.uint16.slice(i,i+t*w_)}restoreSymbolVertexData(e,t){this.layoutVertexArray.uint16.set(t,e*w_)}snapshotIconTransitioningVertexData(e,t){const i=2*e;return this.iconTransitioningVertexArray.uint16.slice(i,i+2*t)}restoreIconTransitioningVertexData(e,t){this.iconTransitioningVertexArray.uint16.set(t,2*e)}updateSymbolVertexData(e,t,i,r,n,o,a,s,l,c,u,h,d){const p=this.layoutVertexArray.uint16,f=e*w_;p[f]=t,p[f+1]=i,p[f+2]=r,p[f+3]=n,p[f+4]=o,p[f+5]=a,p[f+6]=s,p[f+7]=l,p[f+8]=c,p[f+9]=u,p[f+10]=h,p[f+11]=d}upload(e,t,i,r,n,o){this.isEmpty()||(i&&(this.cachedBatchIndices=null,this.cachedBatchSegments=null,this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Wd.members,!!o),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Zd.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,m_,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,Jd.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,qd.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||n)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,Xd.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=e.createVertexBuffer(this.orientationVertexArray,Kd.members,!0)),this.opacityVertexBuffer.itemSize=1,this.featureIdArray.length>0&&(this.featureIdBuffer=e.createVertexBuffer(this.featureIdArray,Yd.members,!1))),(i||r)&&(this.programConfigurations.upload(e),this.uboBinder&&this.uboBinder.upload(e)))}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(),this.featureIdBuffer&&this.featureIdBuffer.destroy(),this.uboBinder&&this.uboBinder.destroy())}}Rs(A_,"SymbolBuffers",{omit:["cachedBatchIndices","cachedBatchSegments"]});class I_{constructor(e,t,i){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new i,this.segments=new uh,this.collisionVertexArray=new Cu,this.collisionVertexArrayExt=new Iu}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Qd.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,ep.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.de
vendor: 11,903 bytes, line 2
2stroy())}}Rs(I_,"CollisionBuffers");class S_{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.placementIdRangeStart=null,this.placementVariantVisible=[],this.collisionCircleArray=[],this.placementInvProjMatrix=_([]),this.placementViewportMatrix=_([]);const t=this.layers[0]._unevaluatedLayout._values;this.worldview=e.worldview,this.localizable=e.localizable,this.maxUniformBufferBindings=e.maxUniformBufferBindings,this.maxUniformBlockSizeDwords=e.maxUniformBlockSizeDwords,this.textSizeData=Ep(this.zoom,t["text-size"],this.worldview,e.availableImages),this.iconSizeData=Ep(this.zoom,t["icon-size"],this.worldview,e.availableImages);const i=this.layers[0].layout,r=i.get("symbol-sort-key"),n=i.get("symbol-z-order");this.lut=e.lut,this.canOverlap=i.get("text-allow-overlap")||i.get("icon-allow-overlap")||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==n&&void 0!==r.constantOr(1),this.sortFeaturesByY=("viewport-y"===n||"auto"===n&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=i.get("text-writing-mode").map(e=>gp[e]),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.sourceID=e.sourceID,this.projection=e.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=!1,this.elevationType="none",this.activeReplacements=[],this.replacementUpdateTime=0,this.hasAnySecondaryIcon=!1,this.hasAppearances=null,this.featureAppearances=null,this.featureAppearanceData=new Map}hasAnyAppearanceLayoutProperty(e){const t=this.layers[0].getAppearances();if(!t||0===t.length)return!1;const i=Array.isArray(e)?e:[e];return t.some(e=>i.some(t=>e.hasLayoutProperty(t)))}getAppearanceFeatureData(e){return this.featureAppearanceData.get(e)}createArrays(){this.text=new A_(new kh(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("text")||e.startsWith("symbol"))),this.icon=new A_(new kh(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("icon")||e.startsWith("symbol"))),this.text.uboBinder=new fp(this.layers[0],this.zoom,this.lut,!0,"",this.maxUniformBufferBindings,this.maxUniformBlockSizeDwords),this.icon.uboBinder=new fp(this.layers[0],this.zoom,this.lut,!1,"",this.maxUniformBufferBindings,this.maxUniformBlockSizeDwords),this.glyphOffsetArray=new Qu,this.lineVertexArray=new eh,this.symbolInstances=new Ju}calculateGlyphDependencies(e,t,i,r,n){for(const o of e){const e=o.codePointAt(0);if(void 0===e)break;if(t[e]=!0,r&&n&&e<=65535){const e=xp[o];e&&(t[e.charCodeAt(0)]=!0)}}}calculateEffectiveAppearanceIconSize(e,t,i,r,n,o,a){if(!e.hasLayoutProperty("icon-size"))return a*o;let s=1;const l=e.getUnevaluatedLayoutProperty("icon-size"),c=Ep(this.zoom,l,this.worldview,n),u=Ip(c,t);if("constant"!==c.kind&&"camera"!==c.kind||(s=u.uSize),"composite"===c.kind){const{minZoom:e,maxZoom:t}=c,o=l.possiblyEvaluate(new ll(e,{worldview:this.worldview}),r),a=l.possiblyEvaluate(new ll(t,{worldview:this.worldview}),r),h=o.evaluate(i,{},r,n);s=h+(a.evaluate(i,{},r,n)-h)*u.uSizeT}return"source"===c.kind&&(s=l.possiblyEvaluate(new ll(this.zoom,{worldview:this.worldview}),r).evaluate(i,{},r,n)),s*o}updateFootprints(e,t){}hideSymbolVariant(e,t){this._setSymbolVariantVisibility(e,!1)}showSymbolVariant(e,t){this._setSymbolVariantVisibility(e,!0)}_initPlacementOpacities(){const e=e=>{const t=e.layoutVertexArray.length/4;for(let i=0;i<t;i++)e.opacityVertexArray.emplaceBack(0)};this.hasTextData()&&e(this.text),this.hasIconData()&&e(this.icon)}_setSymbolVariantVisibility(e,t){const i=e.symbolId.symbolId-this.placementIdRangeStart,r=this.symbolInstances.get(i);this.placementVariantVisible[i]=t;const n=t?4294967295:0,o=(e,t)=>{if(t<0)return;const i=e.placedSymbolArray.get(t),r=i.vertexStartIndex/4;for(let o=0;o<i.numGlyphs;o++)e.opacityVertexArray.emplace(r+o,n);e.opacityVertexBuffer&&e.opacityVertexBuffer.updateData(e.opacityVertexArray)};this.hasTextData()&&o(this.text,this.defaultPlacedTextSymbolIndex(r,i)),this.hasIconData()&&o(this.icon,r.placedIconSymbolIndex)}resetPlacementVisibility(){if(null===this.placementIdRangeStart)return;this.placementVariantVisible.fill(!1);const e=e=>{for(let t=0;t<e.opacityVertexArray.length;t++)e.opacityVertexArray.emplace(t,0);e.opacityVertexBuffer&&e.opacityVertexBuffer.updateData(e.opacityVertexArray)};this.hasTextData()&&e(this.text),this.hasIconData()&&e(this.icon)}addToPlacement(e,t,i,r,n,o,a,s,l,c,u,h){if(0===this.symbolInstances.length)return;if(h&&this.updateReplacement(a.tileID,h),!this.collisionArrays){if(!a.collisionBoxArray)return;this.deserializeCollisionBoxes(a.collisionBoxArray)}null===this.placementIdRangeStart&&(this.placementIdRangeStart=t.allocateRange(i,this.symbolInstances.length),this.placementVariantVisible=new Array(this.symbolInstances.length).fill(!1),this._initPlacementOpacities());const d=this.placementIdRangeStart,p=this.layers[0];if(p.appearances&&p.appearances.length>0)return void Tt("new placement: symbol appearances are not supported yet; hiding symbols");if("point"!==p.layout.get("symbol-placement"))return void Tt("new placement: along-line symbol placement is not supported yet; hiding symbols");const f=!!p.layout.get("text-variable-anchor"),m=this.getProjection(),_="globe"!==m.name;_||Tt("new placement: globe projection is not supported yet; hiding symbols");const g=a.tileID.toUnwrapped(),y=n.pitch>0,x={collisionRules:{},insertIntoCollisionGrid:!0},v=n.zoom,b=Ip(this.iconSizeData,v),w=Ip(this.textSizeData,v),E=p.paint.get("symbol-z-offset"),A="sea"===p.layout.get("symbol-elevation-reference"),I=!E.isConstant(),S=I?0:E.evaluate(null,{}),T=n.elevation,D=Pm(c),M=e=>{if(!e)return D;const t=l.get(Ul(e,p.scope));return void 0!==t?t:(Tt(`global placement: placement-group "${e}" does not match any placement-group layer; using the layer's implicit group`),D)},P=p.paint.get("placement-priority"),C=p.paint.get("placement-group"),R=!P.isConstant(),z=!C.isConstant(),L=R?0:P.evaluate(null,{}),F=z?D:M(C.evaluate(null,{})),O=R||z,B=I||O?a.latestFeatureIndex:null;B&&B.loadVTLayers();const k=B?B.sourceLayerCoder.decode(this.sourceLayerIndex):"",V=(e,t,i)=>{let r;if("road"===this.elevationType)r=A?i:i+xm.getAtTileOffset(a.tileID,new ke(e.tileAnchorX,e.tileAnchorY),T,null);else{const n=this.hdExt?this.hdExt.elevationFeatures[t.elevationFeatureIndex]:void 0;r=A?i:i+xm.getAtTileOffset(a.tileID,new ke(e.tileAnchorX,e.tileAnchorY),T,n)}if(r+=t.zOffset,!r)return{x:e.projectedAnchorX,y:e.projectedAnchorY,z:e.projectedAnchorZ,elevated:!1};const[o,s,l]=m.upVector(a.tileID.canonical,e.tileAnchorX,e.tileAnchorY),c=m.upVectorScale(a.tileID.canonical,n.center.lat,n.worldSize).metersToTile;return{x:e.projectedAnchorX+o*r*c,y:e.projectedAnchorY+s*r*c,z:e.projectedAnchorZ+l*r*c,elevated:!0}},N=(t,i,a,l)=>{if(!t)return;const{x:c,y:u,z:h,elevated:d}=V(t,i,a),p=function(e,t,i,r,n,o,a,s,l){const c=[t,i,r,1];let u=!1;r||n.pitch>0?(me(c,c,e),s&&"globe"!==o.name&&(u=Em(s,t,i,r,l,n)>.9)):ym(c,c,e);const h=c[3];return{x:(c[0]/h+1)/2*n.width,y:(-c[1]/h+1)/2*n.height,perspectiveRatio:Math.min(.5+n.getCameraToCenterDistance(o)/h*.5,1.5),occluded:a&&c[2]>h||u}}(r,c,u,h,n,m,y||d,s,g);if(p.occluded||p.perspectiveRatio<=.55)return;const f=l(),_=o*p.perspectiveRatio,x=(t.x1*f-t.padding)*_+p.x,v=(t.y1*f-t.padding)*_+p.y,b=(t.x2*f+t.padding)*_+p.x,w=(t.y2*f+t.padding)*_+p.y;x<b&&v<w&&e.addGeometry({kind:"box",left:x,top:v,right:b,bottom:w})};for(let U=0;U<this.symbolInstances.length;U++){const t=this.symbolInstances.get(U);if(t.hasIconTextFit){Tt("new placement: icon-text-fit is not supported yet; skipping symbols");continue}if(f&&(t.numHorizontalGlyphVertices>0||t.numVerticalGlyphVertices>0)){Tt("new placement: text-variable-anchor is not supported yet; skipping symbols");continue}if(t.numVerticalGlyphVertices>0){Tt("new placement: vertical text-writing-mode is not supported yet; skipping symbols");continue}const r=this.collisionArrays[U];if(!r.iconBox&&!r.textBox)continue;let n=!1;for(const e of this.activeReplacements)if(!am(e,c,2,p.scope)&&!(e.min.x>t.tileAnchorX||t.tileAnchorX>e.max.x||e.min.y>t.tileAnchorY||t.tileAnchorY>e.max.y)&&(n=gm(_m(t.tileAnchorX,t.tileAnchorY,a.tileID.canonical,e.footprintTileId.canonical),e.footprint),n))break;const o={symbolId:{styleLayerId:i,symbolIdOrigin:1,symbolId:d+U},variantIdx:0},s=B?B.loadFeature({featureIndex:t.featureIndex,sourceLayerIndex:this.sourceLayerIndex,bucketIndex:this.index,layoutVertexArrayOffset:0}):null,l=O&&s&&B?B.getId(s,k):void 0,h=void 0!==l&&u[String(l)]||E_,m=R&&s?P.evaluate(s,h):L,g=z&&s?M(C.evaluate(s,h)):F;if(e.startSymbolVariantProcessing(o,{placementSubgroupOrder:g,symbolPlacementPriority:m,symbolVariantVisibility:this.placementVariantVisible[U]?2:0,symbolPlacementType:1,styleLayerOrder:c,symbolDisplayOrder:0},x),_&&!n){const e=I&&s?E.evaluate(s,{}):S;N(r.iconBox,t,e,()=>this.getSymbolInstanceIconSize(b,v,t.placedIconSymbolIndex)),N(r.textBox,t,e,()=>this.getSymbolInstanceTextSize(w,t,v,U))}e.finishVariantProcessing()}}updateReplacement(e,t){if(t.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=t.updateTime;const i=t.getReplacementRegionsForTile(e.toUnwrapped(),!0);return!hm(this.activeReplacements,i)&&(this.activeReplacements=i,!0)}getResolvedImageFromTokens(e){return"string"==typeof e?En.build(e):e}populate(e,t,i,r){const n=this.layers[0],o=n.layout,a="globe"===this.projection.name,s=o.get("text-font"),l=o.get("text-field"),c=o.get("icon-image"),[u,h]=o.get("icon-size-scale-range"),d=ht(t.scaleFactor||1,u,h),[p,f]=o.get("text-size-scale-range"),m=ht(t.scaleFactor||1,p,f),_=("constant"!==l.value.kind||l.value.value instanceof bn&&!l.value.value.isEmpty()||l.value.value.toString().length>0)&&("constant"!==s.value.kind||s.value.value.length>0),g="constant"!==c.value.kind||!!c.value.value||Object.keys(c.parameters).length>0,y=this.hasAnyAppearanceLayoutProperty("icon-image"),x=o.get("symbol-sort-key");if(this.features=[],this.featureAppearanceData=new Map,!_&&!g&&!y)return;const v=t.iconDependencies,b=t.glyphDependencies,w=t.availableImages,E=new ll(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),A=e=>{const t=e.id.toString();v.has(t)?v.get(t).push(e):v.set(t,[e])};for(const I of e){const{feature:e,id:t,index:l,sourceLayerIndex:c}=I,u=n._featureFilter.needGeometry,h=ru(e,u);if(!n._featureFilter.filter(E,h,i))continue;if(u||(h.geometry=iu(e,i,r)),a&&1!==e.type&&i.z<=5){const e=h.geometry,t=.98078528056,r=(e,r)=>Q(af(e.x,e.y,i,1),af(r.x,r.y,i,1))<t;for(let i=0;i<e.length;i++)e[i]=Jc(e[i],r)}let p,f;if(_){const e=n.getValueAndResolveTokens("text-field",h,i,w),t=bn.factory(e);b_(t)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===nl()||this.hasRTLText&&al.isParsed())&&(p=_p(t,n,h))}if(g){const e=n.getValueAndResolveTokens("icon-image",h,i,w);f=this.getResolvedImageFromTokens(e)}const S=this.layers[0];let T=!1;if(!f&&y){const e=S.getAppearances();for(const t of e)if(t.getLayoutProperty("icon-image")){const e=S.getAppearanceValueAndResolveTokens(t,"icon-image",h,i,w);if(e){f=this.getResolvedImageFromTokens(e),T=!0;break}}}if(!p&&!f)continue;const D=this.sortFeaturesByKey?x.evaluate(h,{},i):void 0,M={id:t,text:p,icon:f,index:l,sourceLayerIndex:c,geometry:h.geometry,properties:e.properties,type:f_[e.type],sortKey:D};if(this.features.push(M),this.featureAppearanceData.set(l,{id:t,properties:e.properties,usesAppearanceIconAsPlaceholder:T}),f){const e=S._unevaluatedLayout._values,{iconPrimary:t,iconSecondary:r}=Rp(f,this.iconSizeData,e["icon-size"],i,this.zoom,M,this.pixelRatio,d,this.worldview,w);A(t),r&&(this.hasAnySecondaryIcon=!0,A(r))}const P=S.getAppearances();
vendor: 2,036 bytes, line 2
2if(0!==P.length&&P.forEach(e=>{if(!e.getLayoutProperty("icon-image"))return;const{iconPrimary:t,iconSecondary:r}=this.getCombinedIconVariants(e,S,h,i,w,M,d);t&&(A(t),r&&(this.hasAnySecondaryIcon=!0,A(r)))}),p){const e=s.evaluate(h,{},i).join(","),t="map"===o.get("text-rotation-alignment")&&"point"!==o.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.includes(gp.vertical);for(const i of p.sections)if(i.image){const e=i.image.getPrimary().scaleSelf(this.pixelRatio*m),t=e.id.toString(),r=v.get(t)||[];r.push(e),v.set(t,r)}else{const r=Hs(p.toString()),n=i.fontStack||e,o=b[n]=b[n]||{};this.calculateGlyphDependencies(i.text,o,t,this.allowVerticalPlacement,r)}}}"line"===o.get("symbol-placement")&&(this.features=function(e){const t={},i={},r=[];let n=0;function o(t){r.push(e[t]),n++}function a(e,t,n){const o=i[e];return delete i[e],i[t]=o,r[o].geometry[0].pop(),r[o].geometry[0]=r[o].geometry[0].concat(n[0]),o}function s(e,i,n){const o=t[i];return delete t[i],t[e]=o,r[o].geometry[0].shift(),r[o].geometry[0]=n[0].concat(r[o].geometry[0]),o}function l(e,t,i){const r=i?t[0].at(-1):t[0][0];return`${e}:${r.x}:${r.y}`}for(let c=0;c<e.length;c++){const u=e[c],h=u.geometry,d=u.text?u.text.toString():null;if(!d||h.length>1){o(c);continue}const p=l(d,h,!1),f=l(d,h,!0);if(p in i&&f in t&&i[p]!==t[f]){const e=s(p,f,h),n=a(p,f,r[e].geometry);delete t[p],delete i[f],i[l(d,r[n].geometry,!0)]=n,r[e].geometry=null}else p in i?a(p,f,h):f in t?s(p,f,h):(o(c),t[p]=n-1,i[f]=n-1)}return r.filter(e=>e.geometry)}(this.features)),"hd-road-markup"===o.get("symbol-elevation-reference")?(this.elevationType="road",this.hdExt&&(this.hdExt.configureCrossSource(i,t.elevationParams,t.crossSourceElevationEnabled,t.terrainEnabled),t.elevationFeatures&&t.elevationFeatures.length>0&&this.hdExt.addElevationFeatures(t.elevationFeatures,i))):o.get("symbol-z-elevate")&&(this.elevationType="offset"),"none"!==this.elevationType&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((e,t)=>
vendor: 12,829 bytes, line 2
2e.sortKey-t.sortKey)}getCombinedIconVariants(e,t,i,r,n,o,a){let s;if(e.hasLayoutProperty("icon-image")){const o=t.getAppearanceValueAndResolveTokens(e,"icon-image",i,r,n);s=this.getResolvedImageFromTokens(o)}else{const e=t.getValueAndResolveTokens("icon-image",i,r,n);s=this.getResolvedImageFromTokens(e)}if(s){const i=e.hasLayoutProperty("icon-size")?e.getUnevaluatedLayoutProperty("icon-size"):t._unevaluatedLayout._values["icon-size"],l=Ep(this.zoom,i,this.worldview,n),{iconPrimary:c,iconSecondary:u}=Rp(s,l,i,r,this.zoom,o,this.pixelRatio,a,this.worldview,n);return{iconPrimary:c,iconSecondary:u}}return{iconPrimary:void 0,iconSecondary:void 0}}getCombinedIconPrimary(e,t,i,r,n,o,a){return this.getCombinedIconVariants(e,t,i,r,n,o,a).iconPrimary}updateSymbolInstanceIconVertices(e,t,i,r,n,o){const{canonical:a,availableImages:s,globalProperties:l,layer:c,iconScaleFactor:u,featureState:h,layoutIconOffset:d,layoutIconSize:p,layoutIconRotate:f}=o;if(e.placedIconSymbolIndex<0)return{vertexOffsetDelta:0,hasChanges:!1};if(t.activeAppearanceIndex===i)return{vertexOffsetDelta:e.numIconVertices,hasChanges:!1};const m=i>=0?c.appearances[i]:null;if(m){const i={sortKey:void 0,text:void 0,icon:null,index:e.featureIndex,sourceLayerIndex:e.featureIndex,geometry:[],properties:t.properties,type:"Point",id:t.id},{iconPrimary:o,iconSecondary:_}=this.getCombinedIconVariants(m,c,r,a,s,i,u);if(!o)return{vertexOffsetDelta:0,hasChanges:!1};const g=o.toString(),y=this.iconAtlasPositions&&this.iconAtlasPositions.get(g);if(y){const{appearanceIconOffset:i,appearanceIconRotate:o}=function(e,t,i,r,n,o,a,s){return{appearanceIconOffset:Pp(e,t,i,r,"icon-offset",n),appearanceIconRotate:Pp(e,t,i,r,"icon-rotate",o),appearanceIconSize:Pp(e,t,i,r,"icon-size",a,e=>e*s)}}(m,c,r,a,d,f,p,u),g=c.layout.get("icon-anchor").evaluate(r,h,a);let x=function(e,t,i,r){const{horizontalAlign:n,verticalAlign:o}=yp(r),a=i[0]-e.displaySize[0]*n,s=i[1]-e.displaySize[1]*o;return{imagePrimary:e,imageSecondary:t,top:s,bottom:s+e.displaySize[1],left:a,right:a+e.displaySize[0]}}(y,_?this.iconAtlasPositions&&this.iconAtlasPositions.get(_.toString()):void 0,i,g);const v=y.sdf,b=c.layout.get("icon-text-fit").constantOr("none");"none"!==b&&t.textShaping&&t.iconTextFitPadding&&t.fontScale&&(x=function(e,t,i,r,n,o){const a=e.imagePrimary;let s;if(a.content){const e=a.content,t=a.pixelRatio||1;s=[e[0]/t,e[1]/t,a.displaySize[0]-e[2]/t,a.displaySize[1]-e[3]/t]}const l=t.left*o,c=t.right*o;let u,h,d,p;"width"===i||"both"===i?(p=n[0]+l-r[3],h=n[0]+c+r[1]):(p=n[0]+(l+c-a.displaySize[0])/2,h=p+a.displaySize[0]);const f=t.top*o,m=t.bottom*o;return"height"===i||"both"===i?(u=n[1]+f-r[0],d=n[1]+m+r[2]):(u=n[1]+(f+m-a.displaySize[1])/2,d=u+a.displaySize[1]),{imagePrimary:a,imageSecondary:void 0,top:u,right:h,bottom:d,left:p,collisionPadding:s}}(x,t.textShaping,b,t.iconTextFitPadding,i,t.fontScale));const w=this.calculateEffectiveAppearanceIconSize(m,l.zoom,r,a,s,u,p),E=0,A=1+(Math.min(Dp,Math.round(w*wp))<<1),I=function(e,t,i,r,n=1){const o=[],a=e.imagePrimary,s=a.pixelRatio,l=a.paddedRect.w-2,c=a.paddedRect.h-2,u=(e.right-e.left)*n,h=(e.bottom-e.top)*n,d=a.stretchX||[[0,l]],p=a.stretchY||[[0,c]],f=d.reduce(s_,0),m=p.reduce(s_,0),_=l-f,g=c-m;let y=0,x=f,v=0,b=m,w=0,E=_,A=0,I=g;if(a.content&&r){const e=a.content;y=l_(d,0,e[0]),v=l_(p,0,e[1]),x=l_(d,e[0],e[2]),b=l_(p,e[1],e[3]),w=e[0]-y,A=e[1]-v,E=e[2]-e[0]-x,I=e[3]-e[1]-b}const S=(r,o,l,c)=>{const d=u_(r.stretch-y,x,u,e.left*n),p=h_(r.fixed-w,E,r.stretch,f),_=u_(o.stretch-v,b,h,e.top*n),g=h_(o.fixed-A,I,o.stretch,m),S=u_(l.stretch-y,x,u,e.left*n),T=h_(l.fixed-w,E,l.stretch,f),D=u_(c.stretch-v,b,h,e.top*n),M=h_(c.fixed-A,I,c.stretch,m),P=new ke(d,_),C=new ke(S,_),R=new ke(S,D),z=new ke(d,D),L=new ke(p/s,g/s),F=new ke(T/s,M/s),O=t*Math.PI/180;if(O){const e=Math.sin(O),t=Math.cos(O),i=[t,-e,e,t];P._matMult(i),C._matMult(i),z._matMult(i),R._matMult(i)}const B=r.stretch+r.fixed,k=l.stretch+l.fixed,V=o.stretch+o.fixed,N=c.stretch+c.fixed,U=e.imageSecondary;return{tl:P,tr:C,bl:z,br:R,texPrimary:{x:a.paddedRect.x+1+B,y:a.paddedRect.y+1+V,w:k-B,h:N-V},texSecondary:U?{x:U.paddedRect.x+1+B,y:U.paddedRect.y+1+V,w:k-B,h:N-V}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:L,pixelOffsetBR:F,minFontScaleX:E/s/u,minFontScaleY:I/s/h,isSDF:i}};if(a.stretchX||a.stretchY){const e=c_(d,_,f),t=c_(p,g,m);for(let i=0;i<e.length-1;i++){const r=e[i],n=e[i+1];for(let e=0;e<t.length-1;e++)o.push(S(r,t[e],n,t[e+1]))}}else o.push(S({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:c+1}));return o}(x,o,v,"none"!==b,u),S=this.icon.iconTransitioningVertexArray.length>0;t.isUsingAppearanceIconVertexData||(t.isUsingAppearanceIconVertexData=!0,t.layoutBasedIconVertexData=this.icon.snapshotSymbolVertexData(n,e.numIconVertices),S&&(t.layoutBasedIconTransitioningVertexData=this.icon.snapshotIconTransitioningVertexData(n,e.numIconVertices)));const T=Math.floor(e.numIconVertices/4),D=Math.min(I.length,T);let M=n;const P=S?this.icon.iconTransitioningVertexArray.uint16:null;for(let r=0;r<D;++r){const i=I[r],n=t.layoutBasedIconVertexData[0]||e.tileAnchorX,o=t.layoutBasedIconVertexData[1]||e.tileAnchorY,a=16*i.pixelOffsetTL.x,s=16*i.pixelOffsetTL.y,l=16*i.pixelOffsetBR.x,c=16*i.pixelOffsetBR.y,u=16*i.minFontScaleX,h=16*i.minFontScaleY;if(this.icon.updateSymbolVertexData(M,n,o,Math.round(32*i.tl.x),Math.round(32*i.tl.y),i.texPrimary.x,i.texPrimary.y,E,A,a,s,u,h),this.icon.updateSymbolVertexData(M+1,n,o,Math.round(32*i.tr.x),Math.round(32*i.tr.y),i.texPrimary.x+i.texPrimary.w,i.texPrimary.y,E,A,l,s,u,h),this.icon.updateSymbolVertexData(M+2,n,o,Math.round(32*i.bl.x),Math.round(32*i.bl.y),i.texPrimary.x,i.texPrimary.y+i.texPrimary.h,E,A,a,c,u,h),this.icon.updateSymbolVertexData(M+3,n,o,Math.round(32*i.br.x),Math.round(32*i.br.y),i.texPrimary.x+i.texPrimary.w,i.texPrimary.y+i.texPrimary.h,E,A,l,c,u,h),P){const e=i.texSecondary?i.texSecondary:i.texPrimary,t=2*M;P[t]=e.x,P[t+1]=e.y,P[t+2]=e.x+e.w,P[t+3]=e.y,P[t+4]=e.x,P[t+5]=e.y+e.h,P[t+6]=e.x+e.w,P[t+7]=e.y+e.h}M+=4}const C=e.numIconVertices-4*D;for(let e=0;e<C;++e)this.icon.updateSymbolVertexData(M+e,0,0,0,0,0,0,0,0,0,0,0,0);return{vertexOffsetDelta:e.numIconVertices,hasChanges:!0}}}else{if(t.usesAppearanceIconAsPlaceholder)return this.icon.updateSymbolVertexData(n,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(n+1,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(n+2,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(n+3,0,0,0,0,0,0,0,0,0,0,0,0),{vertexOffsetDelta:e.numIconVertices,hasChanges:!0};if(t.isUsingAppearanceIconVertexData)return this.icon.restoreSymbolVertexData(n,t.layoutBasedIconVertexData),t.layoutBasedIconTransitioningVertexData&&this.icon.restoreIconTransitioningVertexData(n,t.layoutBasedIconTransitioningVertexData),t.isUsingAppearanceIconVertexData=!1,{vertexOffsetDelta:t.layoutBasedIconVertexData.length/w_,hasChanges:!0}}return{vertexOffsetDelta:e.numIconVertices,hasChanges:!1}}updateSymbolInstanceTextVertices(e,t,i,r,n,o){const{canonical:a,layer:s,textScaleFactor:l,imageMap:c,featureState:u,layoutTextOffset:h,layoutTextSize:d,layoutTextRotate:p,layoutMinZoomSize:f,layoutMaxZoomSize:m,layoutTextSizeMinZoom:_,layoutTextSizeMaxZoom:g,availableImages:y}=o,x=e.numHorizontalGlyphVertices>0||e.numVerticalGlyphVertices>0;if(!x)return{vertexOffsetDelta:x?e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices:0,hasChanges:!1};if(t.activeAppearanceIndex===i)return{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!1};const v=i>=0?s.appearances[i]:null;if(v&&t.textShaping){const{appearanceTextOffset:i,appearanceTextRotate:o,appearanceTextSize:x}=function(e,t,i,r,n,o,a){const s=Pp(e,t,i,r,"text-offset",n,([e,t])=>[e*mp,t*mp]);return{appearanceTextOffset:s,appearanceTextRotate:Pp(e,t,i,r,"text-rotate",o),appearanceTextSize:Pp(e,t,i,r,"text-size",a)}}(v,s,r,a,h,p,d);t.fontScale=function(e,t){return e*t/24}(x,t.textScaleFactor);const b=v.getUnevaluatedLayoutProperty("text-size");let w=this.textSizeData,E=_,A=g;v.hasLayoutProperty("text-size")&&(w=Ep(this.zoom,b,this.worldview,y),E="composite"===this.textSizeData.kind?this.textSizeData.minZoom:0,A="composite"===this.textSizeData.kind?this.textSizeData.maxZoom:0);const I=t.textShaping.bottom-h[1],S=t.textShaping.left-h[0],T=t.textShaping.right-h[0];t.textShaping.top=i[1]+(t.textShaping.top-h[1]),t.textShaping.bottom=i[1]+I,t.textShaping.left=i[0]+S,t.textShaping.right=i[0]+T;const D=function(e,t,i,r,n,o,a,s,l,c=1){const u=[];if(0===t.positionedLines.length)return u;const h=(void 0!==l?l:r.layout.get("text-rotate").evaluate(o,{}))*Math.PI/180,d=function(e){const t=e[0],i=e[1],r=t*i;return r>0?[t,-i]:r<0?[-t,i]:0===t?[i,t]:[i,-t]}(i);let p=Math.abs(t.top-t.bottom);for(const g of t.positionedLines)p-=g.lineOffset;const f=t.positionedLines.length,m=p/f;let _=t.top-i[1];for(let g=0;g<f;++g){const e=t.positionedLines[g];_=d_(t,m,_,g);for(const r of e.positionedGlyphs){if(!r.rect)continue;const e=r.rect||{};let n=4,o=!0,l=1,p=0;if(r.image){const e=a.get(r.image.toString());if(!e)continue;o=!1,l=e.pixelRatio,n=1/l,e.usvg||(l/=c)}const f=s&&r.vertical,m=r.metrics.advance*r.scale/2,g=r.metrics,y=r.rect;if(null===y)continue;s&&t.verticalizable&&(p=r.image?m-r.metrics.width*r.scale/2:0);const x=[0,0];let v=[0,0],b=[0,0],w=!1;f?(b=[r.x+m+d[0],r.y+d[1]-p],w=!0):v=[r.x+m+i[0],r.y+i[1]-p];const E=y.w*r.scale/(l*(r.localGlyph?2:1)),A=y.h*r.scale/(l*(r.localGlyph?2:1));let I,S,T,D;if(f){const e=r.y-_,t=new ke(-m,m-e),i=-Math.PI/2,o=new ke(...b);I=new ke(-m+v[0],v[1]),I._rotateAround(i,t)._add(o),I.x+=-e+m,I.y-=(g.left-n)*r.scale;const a=r.image?g.advance*r.scale:mp*r.scale,s=String.fromCodePoint(r.glyph);vp(s)?I.x+=(1-n)*r.scale:bp(s)?I.x+=a-g.height*r.scale+(-n-1)*r.scale:I.x+=r.image||g.width+2*n===y.w&&g.height+2*n===y.h?(a-A)/2:(a-(g.height+2*n)*r.scale)/2,S=new ke(I.x,I.y-E),T=new ke(I.x+A,I.y),D=new ke(I.x+A,I.y-E)}else{const e=(g.left-n)*r.scale-m+v[0],t=(-g.top-n)*r.scale+v[1],i=e+E,o=t+A;I=new ke(e,t),S=new ke(i,t),T=new ke(e,o),D=new ke(i,o)}if(h){let e;e=w?new ke(d[0],d[1]):new ke(i[0],i[1]),I._rotateAround(h,e),S._rotateAround(h,e),T._rotateAround(h,e),D._rotateAround(h,e)}const M=new ke(0,0),P=new ke(0,0);u.push({tl:I,tr:S,bl:T,br:D,texPrimary:e,texSecondary:void 0,writingMode:t.writingMode,glyphOffset:x,sectionIndex:r.sectionIndex,isSDF:o,pixelOffsetTL:M,pixelOffsetBR:P,minFontScaleX:0,minFontScaleY:0})}}return u}(0,t.textShaping,i,s,0,r,c,this.allowVerticalPlacement,o),M=x&&"composite"===w.kind?b.possiblyEvaluate(new ll(E,{}),a).evaluate(r,u,a):f,P=x&&"composite"===w.kind?b.possiblyEvaluate(new ll(A,{}),a).evaluate(r,u,a):m,C=function(e,t,i,r,n,o){let a=null;return"source"===t.kind?(a=[wp*i*r],a[0]>Dp&&Tt(`${e}: Value for "text-size" or "icon-size" is >= 255. Reduce your "text-size" or "icon-size".`)):"composite"===t.kind&&(a=[wp*n*r,wp*o*r],(a[0]>Dp||a[1]>Dp)&&Tt(`${e}: Value for "text-size" or "icon-size" is >= 255. Reduce your "text-size" or "icon-size".`)),a}(v.name,w,x,l,M,P),R=Array.isArray(C)?C[1]:x,z=0,L=1+(Math.min(Dp,Math.round(R*wp))<<1);t.isUsingAppearanceTextVertexData||(t.isUsingAppearanceTextVertexData=!0,t.layoutBasedTextVertexData=this.text.snapshotSymbolVertexData(n,e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices));for(let t=0;t<D.length&&t<(e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices)/4;++t){const i=D[t],r=i.glyphOffset[1],o=e.tileAnchorX,a=e.tileAnchorY,s=n+4*t;this.text.updateSymbolVertexData(s,o,a,Math.round(32*i.tl.x),Math.round(32*(r+i.tl.y)),i.texPrimary.x,i.texPrimary.y,z,L,i.pixelOffsetTL.x,i.pixelOffsetTL.y,i.minFontScaleX,i.minFontScaleY),this.text.updateSymbolVertexData(s+1,o,a,Math.round(32*i.tr.x),Math.round(32*(r+i.tr.y)),i.texPrimary.x+i.texPrimary.w,i.texPrimary.y,z,L,i.pixelOffsetBR.x,i.pixelOffsetTL.y,i.minFontScaleX,i.minFontScaleY),this.text.updateSymbolVertexData(s+2,o,a,Math.round(32*i.bl.x),Math.round(32*(r+i.bl.y)),i.texPrimary.x,i.texPrimary.y+i.texPrimary.h,z,L,i.pixelOffsetTL.x,i.pixelOffsetBR.y,i.minFontScaleX,i.minFontScaleY),this.text.updateSymbolVertexData(s+3,o,a,Math.round(32*i.br.x),Math.round(32*(r+i.br.y)),i.texPrimary.x+i.texPrimary.w,i.texPrimary.y+i.texPrimary.h,z,L,i.pixelOffsetBR.x,i.pixelOffsetBR.y,i.minFontScaleX,i.minFontScaleY)}return{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!0}}return t.isUsingAppearanceTextVertexData?(this.text.restoreSymbolVertexData(n,t.layoutBasedTextVertexData),t.isUsingAppearanceTextVertexData=!1,{vertexOffsetDelta:t.layoutBasedTextVertexData.length/w_,hasChanges:!0}):{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!1}}updateExpressions(e){this.text&&this.text.programConfigurations.updateExpressions(e),this.icon&&this.icon.programConfigurations.updateExpressions(e)}
vendor: 15,457 bytes, line 2
2update(e,t,i,r,n,o,a,s){if(this.text.uboBinder||this.text.programConfigurations.updatePaintArrays(e,t,n,i,r,o,a,this.worldview),this.icon.uboBinder||this.icon.programConfigurations.updatePaintArrays(e,t,n,i,r,o,a,this.worldview),s)if(o)for(const l of[this.text.uboBinder,this.icon.uboBinder])l&&!l.isLightConstant&&l.updateDynamicExpressions(n[0],t,s,i,e,a);else if(Object.keys(e).length>0){const r=n[0],o=[this.text.uboBinder,this.icon.uboBinder].filter(e=>e&&e.hasStateDependentPaint(r));if(o.length>0){const n=new Set(Object.keys(e).map(e=>{const t=Number(e);return!isNaN(t)&&Number.isSafeInteger(t)&&String(t)===e?t:e}));for(const l of o)l.updateFeatures(n,r,t,s,i,e,a)}}}updateZOffset(){const e=(e,t,r)=>{i+=t,i>e.length&&e.resize(i);for(let n=-t;n<0;n++)e.emplace(n+i,r)},t=(e,t,i)=>{r+=t,r>e.length&&e.resize(r);for(let n=-t;n<0;n++)e.emplace(n+r,i)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let i=0,r=0;for(let n=0;n<this.symbolInstances.length;n++){const i=this.symbolInstances.get(n),{numHorizontalGlyphVertices:r,numVerticalGlyphVertices:o,numIconVertices:a}=i,s=i.zOffset,l=a>0;if((r>0||o>0)&&(e(this.text.zOffsetVertexArray,r,s),e(this.text.zOffsetVertexArray,o,s)),l){const{placedIconSymbolIndex:e,verticalPlacedIconSymbolIndex:r}=i;e>=0&&t(this.icon.zOffsetVertexArray,a,s),r>=0&&t(this.icon.zOffsetVertexArray,i.numVerticalIconVertices,s)}}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(e,t,i,r,n){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),null===this.hasAppearances&&(this.hasAppearances=this.layers.some(e=>e.appearances&&e.appearances.length>0)),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),this.uploaded=!0}updateAppearances(e,t,i,r,n,o=!1){const a={hasLayoutChanges:!1,hasUboChanges:!1};if(!e||!i||!this.featureAppearanceData)return a;const s=t||{},l=this.icon.layoutVertexArray&&this.icon.layoutVertexArray.length>0&&this.icon.layoutVertexArray.arrayBuffer,c=this.text.layoutVertexArray&&this.text.layoutVertexArray.length>0&&this.text.layoutVertexArray.arrayBuffer;if(!l&&!c)return a;const u=this.layers[0],h=u.layout;this.featureAppearances&&this.featureAppearances.appearancesVersion===u.appearancesVersion||(this.featureAppearances=new p_(u.appearances,u.appearancesVersion));const d=this.featureAppearances.update(r,o);if("no-changes"===d.kind)return a;let p=1,f=0,m=!1,_=!1;if(l){const[e,t]=h.get("icon-size-scale-range");p=ht(1,e,t)}let g=1,y=0,x=!1;if(c){const[e,t]=h.get("text-size-scale-range");g=ht(1,e,t)}const v=new Map;if(n&&i)for(const w of i){const e=n.getImage(w,u.scope);if(e){const t=new wn(w.toString());v.set(t.toString(),e)}}const b=[this.text.uboBinder,this.icon.uboBinder];for(let w=0;w<this.symbolInstances.length;w++){const t=this.symbolInstances.get(w),n=this.getAppearanceFeatureData(t.featureIndex);if(!n)continue;const o=n.id,a=void 0!==o?s[String(o)]:void 0,E={type:"Point",id:n.id,properties:n.properties,geometry:[]};let A;if("all-features"===d.kind)A=d.appearanceIndex;else{const t=u.appearances?u.appearances.findIndex(t=>t.isActive({globals:r,feature:E,canonical:e,featureState:a})):-1;A=t>=0?t:-1}const I=n.activeAppearanceIndex!==A;if(c){const r=h.get("text-size"),o="composite"===this.textSizeData.kind?this.textSizeData.minZoom:0,s="composite"===this.textSizeData.kind?this.textSizeData.maxZoom:0,l={canonical:e,layer:u,featureState:a,availableImages:i,textScaleFactor:g,imageMap:v,layoutTextOffset:h.get("text-offset").evaluate(E,a,e).map(e=>e*mp),layoutTextSize:r.evaluate(E,a,e),layoutTextRotate:h.get("text-rotate").evaluate(E,a,e),layoutMinZoomSize:r.evaluate(E,{zoom:o},e),layoutMaxZoomSize:r.evaluate(E,{zoom:s},e),layoutTextSizeMinZoom:o,layoutTextSizeMaxZoom:s},c=this.updateSymbolInstanceTextVertices(t,n,A,E,y,l);y+=c.vertexOffsetDelta,x=x||c.hasChanges}if(l){const o={canonical:e,layer:u,featureState:a,availableImages:i,globalProperties:r,iconScaleFactor:p,layoutIconOffset:h.get("icon-offset").evaluate(E,a,e),layoutIconSize:h.get("icon-size").evaluate(E,a,e,i),layoutIconRotate:h.get("icon-rotate").evaluate(E,a,e)},s=this.updateSymbolInstanceIconVertices(t,n,A,E,f,o);f+=s.vertexOffsetDelta,m=m||s.hasChanges}if(I){const n=t.featureIndex,o=r?r.brightness:null,s=a||{},l=A>=0?u.appearances[A]:null;for(const t of b)t&&(t.layer=u,_=t.updateFeaturePaintForAppearance(n,E,s,e,i,o,l)||_)}n.activeAppearanceIndex=A}return m&&this.icon.layoutVertexBuffer&&null!==this.icon.layoutVertexArray.arrayBuffer&&this.icon.layoutVertexArray.length===this.icon.layoutVertexBuffer.length&&this.icon.layoutVertexBuffer.updateData(this.icon.layoutVertexArray),m&&this.icon.iconTransitioningVertexBuffer&&this.icon.iconTransitioningVertexArray.length>0&&this.icon.iconTransitioningVertexArray.length===this.icon.iconTransitioningVertexBuffer.length&&this.icon.iconTransitioningVertexBuffer.updateData(this.icon.iconTransitioningVertexArray),x&&this.text.layoutVertexBuffer&&null!==this.text.layoutVertexArray.arrayBuffer&&this.text.layoutVertexArray.length===this.text.layoutVertexBuffer.length&&this.text.layoutVertexBuffer.updateData(this.text.layoutVertexArray),{hasLayoutChanges:m||x,hasUboChanges:_}}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=rm(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){const i=this.lineVertexArray.length;if(void 0!==e.segment)for(const{x:r,y:n}of t)this.lineVertexArray.emplaceBack(r,n);return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(e,t,i,r,n,o,a,s,l,c,u,h,d,p,f,m,_,g){const y=e.indexArray,x=e.layoutVertexArray,v=e.globeExtVertexArray,b=g,w=e.uboBinder?e.uboBinder.getCurrentBatchIndex():void 0,E=e.segments.prepareSegment(4*b,x,y,this.canOverlap?o.sortKey:void 0,w),A=this.glyphOffsetArray.length,I=E.vertexLength,S=this.allowVerticalPlacement&&a===gp.vertical?Math.PI/2:0,T=o.text&&o.text.sections;let D=x.length,M=-1;for(let R=0;R<t.length;R++){const{tl:r,tr:n,bl:a,br:c,texPrimary:u,texSecondary:h,pixelOffsetTL:_,pixelOffsetBR:g,minFontScaleX:b,minFontScaleY:w,glyphOffset:A,isSDF:I,sectionIndex:P}=t[R],C=E.vertexLength,z=A[1];if(__(x,l.x,l.y,r.x,z+r.y,u.x,u.y,i,I,_.x,_.y,b,w),__(x,l.x,l.y,n.x,z+n.y,u.x+u.w,u.y,i,I,g.x,_.y,b,w),__(x,l.x,l.y,a.x,z+a.y,u.x,u.y+u.h,i,I,_.x,g.y,b,w),__(x,l.x,l.y,c.x,z+c.y,u.x+u.w,u.y+u.h,i,I,g.x,g.y,b,w),s){const{x:t,y:i,z:r}=s.anchor,[n,o,a]=s.up;y_(v,t,i,r,n,o,a),y_(v,t,i,r,n,o,a),y_(v,t,i,r,n,o,a),y_(v,t,i,r,n,o,a),v_(e.dynamicLayoutVertexArray,t,i,r,S)}else v_(e.dynamicLayoutVertexArray,l.x,l.y,l.z,S);if(m){const t=h||u;g_(e.iconTransitioningVertexArray,t.x,t.y),g_(e.iconTransitioningVertexArray,t.x+t.w,t.y),g_(e.iconTransitioningVertexArray,t.x,t.y+t.h),g_(e.iconTransitioningVertexArray,t.x+t.w,t.y+t.h)}if(y.emplaceBack(C,C+1,C+2),y.emplaceBack(C+1,C+2,C+3),E.vertexLength+=4,E.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(A[0]),(R===t.length-1||P!==t[R+1].sectionIndex)&&(e.uboBinder||e.programConfigurations.populatePaintArrays(x.length,o,o.index,{},d,p,f,T&&T[P],this.worldview),e.uboBinder)){const t=e.uboBinder.populateUBO(o,o.index,p,d,f,T&&T[P]);M=t;const i=x.length-D;for(let r=0;r<i;r++)e.featureIdArray.emplaceBack(t);D=x.length}}const P=g-t.length;if(0!==P&&(this._addNullVertices(P,x,i,s,v,e,m,E,y),e.uboBinder&&M>=0)){const t=4*P;for(let i=0;i<t;i++)e.featureIdArray.emplaceBack(M)}const C=s?s.anchor:l;e.placedSymbolArray.emplaceBack(C.x,C.y,C.z,l.x,l.y,A,this.glyphOffsetArray.length-A,I,c,u,l.segment,i?i[0]:0,i?i[1]:0,r[0],r[1],a,0,0,0,h,0),e.symbolInstanceIndices.push(_)}_addNullVertices(e,t,i,r,n,o,a,s,l){for(let c=0;c<e;c++){for(let s=0;s<4;s++)__(t,0,0,0,0,0,0,i,!1,0,0,0,0),r?(y_(n,0,0,0,0,0,0),v_(o.dynamicLayoutVertexArray,0,0,0,0)):v_(o.dynamicLayoutVertexArray,0,0,0,0),a&&g_(o.iconTransitioningVertexArray,0,0);const e=s.vertexLength;l.emplaceBack(e,e+1,e+2),l.emplaceBack(e+1,e+2,e+3),s.vertexLength+=4,s.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(0)}}_commitLayoutVertex(e,t,i,r,n,o,a){e.emplaceBack(t,i,r,n,o,Math.round(a.x),Math.round(a.y))}_addCollisionDebugVertices(e,t,i,r,n,o,a){const s=i.segments.prepareSegment(4,i.layoutVertexArray,i.indexArray),l=s.vertexLength,c=a.tileAnchorX,u=a.tileAnchorY;for(let d=0;d<4;d++)i.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(i.collisionVertexArrayExt,t,e.padding,a.zOffset),this._commitLayoutVertex(i.layoutVertexArray,r,n,o,c,u,new ke(e.x1,e.y1)),this._commitLayoutVertex(i.layoutVertexArray,r,n,o,c,u,new ke(e.x2,e.y1)),this._commitLayoutVertex(i.layoutVertexArray,r,n,o,c,u,new ke(e.x2,e.y2)),this._commitLayoutVertex(i.layoutVertexArray,r,n,o,c,u,new ke(e.x1,e.y2)),s.vertexLength+=4;const h=i.indexArray;h.emplaceBack(l,l+1),h.emplaceBack(l+1,l+2),h.emplaceBack(l+2,l+3),h.emplaceBack(l+3,l),s.primitiveLength+=4}_addTextDebugCollisionBoxes(e,t,i,r,n,o){for(let a=r;a<n;a++){const r=i.get(a),n=this.getSymbolInstanceTextSize(e,o,t,a);this._addCollisionDebugVertices(r,n,this.textCollisionBox,r.projectedAnchorX,r.projectedAnchorY,r.projectedAnchorZ,o)}}_addIconDebugCollisionBoxes(e,t,i,r,n,o){for(let a=r;a<n;a++){const r=i.get(a),n=this.getSymbolInstanceIconSize(e,t,o.placedIconSymbolIndex);this._addCollisionDebugVertices(r,n,this.iconCollisionBox,r.projectedAnchorX,r.projectedAnchorY,r.projectedAnchorZ,o)}}generateCollisionDebugBuffers(e,t,i){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new I_(Mu,tp.members,Tu),this.iconCollisionBox=new I_(Mu,tp.members,Tu);const r=Ip(this.iconSizeData,e),n=Ip(this.textSizeData,e,i);for(let o=0;o<this.symbolInstances.length;o++){const i=this.symbolInstances.get(o);this._addTextDebugCollisionBoxes(n,e,t,i.textBoxStartIndex,i.textBoxEndIndex,i),this._addTextDebugCollisionBoxes(n,e,t,i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i),this._addIconDebugCollisionBoxes(r,e,t,i.iconBoxStartIndex,i.iconBoxEndIndex,i),this._addIconDebugCollisionBoxes(r,e,t,i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex,i)}}defaultPlacedTextSymbolIndex(e,t){return e.rightJustifiedTextSymbolIndex>=0?e.rightJustifiedTextSymbolIndex:e.centerJustifiedTextSymbolIndex>=0?e.centerJustifiedTextSymbolIndex:e.leftJustifiedTextSymbolIndex>=0?e.leftJustifiedTextSymbolIndex:e.verticalPlacedTextSymbolIndex>=0?e.verticalPlacedTextSymbolIndex:t}getSymbolInstanceTextSize(e,t,i,r){const n=this.defaultPlacedTextSymbolIndex(t,r),o=this.text.placedSymbolArray.get(n),a=Ap(this.textSizeData,e,o)/mp;return this.tilePixelRatio*a}getSymbolInstanceIconSize(e,t,i){const r=this.icon.placedSymbolArray.get(i),n=Ap(this.iconSizeData,e,r);return this.tilePixelRatio*n}_commitDebugCollisionVertexUpdate(e,t,i,r){e.emplaceBack(t,-i,-i,r),e.emplaceBack(t,i,-i,r),e.emplaceBack(t,i,i,r),e.emplaceBack(t,-i,i,r)}_updateTextDebugCollisionBoxes(e,t,i,r,n,o,a){for(let s=r;s<n;s++){const r=i.get(s),n=this.getSymbolInstanceTextSize(e,o,t,s);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,n,r.padding,o.zOffset)}}_updateIconDebugCollisionBoxes(e,t,i,r,n,o,a){for(let s=r;s<n;s++){const r=i.get(s),n=this.getSymbolInstanceIconSize(e,t,o.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,n,r.padding,o.zOffset)}}updateCollisionDebugBuffers(e,t,i,r){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const n=Ip(this.iconSizeData,e,r),o=Ip(this.textSizeData,e,i);for(let a=0;a<this.symbolInstances.length;a++){const s=this.symbolInstances.get(a);this._updateTextDebugCollisionBoxes(o,e,t,s.textBoxStartIndex,s.textBoxEndIndex,s,i),this._updateTextDebugCollisionBoxes(o,e,t,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s,i),this._updateIconDebugCollisionBoxes(n,e,t,s.iconBoxStartIndex,s.iconBoxEndIndex,s,r),this._updateIconDebugCollisionBoxes(n,e,t,s.verticalIconBoxStartIndex,s.verticalIconBoxEndIndex,s,r)}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(e,t,i,r,n,o,a,s,l){const c={};if(t<i){const{x1:i,y1:r,x2:n,y2:o,padding:a,projectedAnchorX:s,projectedAnchorY:l,projectedAnchorZ:u,tileAnchorX:h,tileAnchorY:d,featureIndex:p}=e.get(t);c.textBox={x1:i,y1:r,x2:n,y2:o,padding:a,projectedAnchorX:s,projectedAnchorY:l,projectedAnchorZ:u,tileAnchorX:h,tileAnchorY:d},c.textFeatureIndex=p}if(r<n){const{x1:t,y1:i,x2:n,y2:o,padding:a,projectedAnchorX:s,projectedAnchorY:l,projectedAnchorZ:u,tileAnchorX:h,tileAnchorY:d,featureIndex:p}=e.get(r);c.verticalTextBox={x1:t,y1:i,x2:n,y2:o,padding:a,projectedAnchorX:s,projectedAnchorY:l,projectedAnchorZ:u,tileAnchorX:h,tileAnchorY:d},c.verticalTextFeatureIndex=p}if(o<a){const{x1:t,y1:i,x2:r,y2:n,padding:a,projectedAnchorX:s,projectedAnchorY:l,projectedAnchorZ:u,tileAnchorX:h,tileAnchorY:d,featureIndex:p}=e.get(o);c.iconBox={x1:t,y1:i,x2:r,y2:n,padding:a,projectedAnchorX:s,projectedAnchorY:l,projectedAnchorZ:u,tileAnchorX:h,tileAnchorY:d},c.iconFeatureIndex=p}if(s<l){const{x1:t,y1:i,x2:r,y2:n,padding:o,projectedAnchorX:a,projectedAnchorY:l,projectedAnchorZ:u,tileAnchorX:h,tileAnchorY:d,featureIndex:p}=e.get(s);c.verticalIconBox={x1:t,y1:i,x2:r,y2:n,padding:o,projectedAnchorX:a,projectedAnchorY:l,projectedAnchorZ:u,tileAnchorX:h,tileAnchorY:d},c.verticalIconFeatureIndex=p}return c}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){const i=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,i.textBoxStartIndex,i.textBoxEndIndex,i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i.iconBoxStartIndex,i.iconBoxEndIndex,i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(e,t){const i=e.placedSymbolArray.get(t),r=i.vertexStartIndex+4*i.numGlyphs;for(let n=i.vertexStartIndex;n<r;n+=4)e.indexArray.emplaceBack(n,n+1,n+2),e.indexArray.emplaceBack(n+1,n+2,n+3)}
vendor: 10,069 bytes, line 2
2getSortedSymbolIndexes(e){if(this.sortedAngle===e&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const t=Math.sin(e),i=Math.cos(e),r=[],n=[],o=[];for(let a=0;a<this.symbolInstances.length;++a){o.push(a);const e=this.symbolInstances.get(a);r.push(0|Math.round(t*e.tileAnchorX+i*e.tileAnchorY)),n.push(e.featureIndex)}return o.sort((e,t)=>r[e]-r[t]||n[t]-n[e]),o}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let e=0;e<this.symbolInstances.length;++e)this.symbolInstanceIndexesSortedZOffset.push(e)}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort((e,t)=>this.symbolInstances.get(t).zOffset-this.symbolInstances.get(e).zOffset)}addToSortKeyRanges(e,t){const i=this.sortKeyRanges.at(-1);i&&i.sortKey===t?i.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e)if(this.text.segments.get().length>1||this.icon.segments.get().length>1)this.sortFeaturesByY=!1;else{this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const e of this.symbolInstanceIndexes){const t=this.symbolInstances.get(e);this.featureSortOrder.push(t.featureIndex);const{rightJustifiedTextSymbolIndex:i,centerJustifiedTextSymbolIndex:r,leftJustifiedTextSymbolIndex:n,verticalPlacedTextSymbolIndex:o,placedIconSymbolIndex:a,verticalPlacedIconSymbolIndex:s}=t;i>=0&&this.addIndicesForPlacedSymbol(this.text,i),r>=0&&r!==i&&this.addIndicesForPlacedSymbol(this.text,r),n>=0&&n!==r&&n!==i&&this.addIndicesForPlacedSymbol(this.text,n),o>=0&&this.addIndicesForPlacedSymbol(this.text,o),a>=0&&this.addIndicesForPlacedSymbol(this.icon,a),s>=0&&this.addIndicesForPlacedSymbol(this.icon,s)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}Rs(S_,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),S_.addDynamicAttributes=v_;class T_ extends Hh{constructor(e,t,i){super(e,t,i),this.elevatedLayoutVertexArray=new pu}upload(e){const t=this.uploaded;super.upload(e),!t&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,sh.members))}destroy(){this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),super.destroy()}}Rs(T_,"ElevatedFillBufferData");class D_{constructor(){this.portals=[]}static isOnBorder(e,t){return e<=0&&t<=0||e>=co&&t>=co}static evaluate(e){if(0===e.length)return new D_;let t=[];for(const s of e)t.push(...s.portals);if(0===t.length)return new D_;for(const s of t){const e=s.va,t=s.vb;(D_.isOnBorder(e.x,t.x)||D_.isOnBorder(e.y,t.y))&&(s.type="border")}const i=t.filter(e=>"unevaluated"!==e.type),r=t.filter(e=>"unevaluated"===e.type);if(0===r.length)return new D_;r.sort((e,t)=>e.hash===t.hash?e.isTunnel===t.isTunnel?0:e.isTunnel?-1:1:e.hash<t.hash?1:-1),t=i.concat(r);let n=i.length,o=n,a=n;do{if(o++,o===t.length||t[n].hash!==t[o].hash){if(o-n===2){a<n&&(t[a]=t[n],t[n]=null);const e=t[a],i=t[o-1];e.type=e.isTunnel!==i.isTunnel?"tunnel":"polygon",e.connection={a:e.connection.a,b:i.connection.a},a++}n=o}}while(n!==t.length);return t.splice(a),t.sort((e,t)=>e.hash<t.hash?1:-1),{portals:t}}}Rs(D_,"ElevationPortalGraph");class M_{constructor(e,t,i){this.outPositions=e,this.outNormals=t,this.outIndices=i,this.vertexLookup=new Map}addVertex(e,t,i){let r=e[2];null!=i&&(r*=i);const n=`${e[0]},${e[1]},${e[2]},${t[0]},${t[1]},${t[2]}`,o=this.vertexLookup.get(n);if(null!=o)return o;const a=this.outPositions.length;this.vertexLookup.set(n,a);const s=Math.trunc(16384*t[0]),l=Math.trunc(16384*t[1]),c=Math.trunc(16384*t[2]);return this.outPositions.emplaceBack(e[0],e[1],r),this.outNormals.emplaceBack(s,l,c),a}addTriangle(e,t,i){this.outIndices.emplaceBack(e,t,i)}addTriangles(e,t,i,r=0){if(0===e.length)return;const n=O(),o=O();for(let a=0;a<e.length;a+=3){const s=t[e[a+0]],l=t[e[a+1]],c=t[e[a+2]],u=i[e[a+1]]+r,h=i[e[a+2]]+r;N(n,s.x,s.y,i[e[a+0]]+r);const d=this.addVertex(n,o);N(n,l.x,l.y,u);const p=this.addVertex(n,o);N(n,c.x,c.y,h);const f=this.addVertex(n,o);this.outIndices.emplaceBack(d,p,f)}}addQuad(e,t,i,r,n,o){const a=this.addVertex(e,n,o),s=this.addVertex(t,n,o),l=this.addVertex(i,n,o),c=this.addVertex(r,n,o);this.addTriangle(a,s,l),this.addTriangle(l,c,a)}getVertexCount(){return this.outPositions.length}clearVertexLookup(){this.vertexLookup.clear()}}class P_{constructor(e,t,i,r){this.unevaluatedPortals=new D_,this.bridgeFeatureSections=[],this.tunnelFeatureSections=[],this.vertexHashLookup=new Map,this.unevalVertices=[],this.unevalHeights=[],this.unevalTriangles=[],this.unevalTunnelTriangles=[],this.unevalEdges=[],this.vertexPositions=new fu,this.vertexNormals=new mu,this.indexArray=new Ru,this.tileToMeters=qc(e),this.bridgeProgramConfigurations=new kh(t,{zoom:i,lut:r},e=>"fill-tunnel-structure-color"!==e),this.tunnelProgramConfigurations=new kh(t,{zoom:i,lut:r},e=>"fill-bridge-guard-rail-color"!==e)}addVertices(e,t){const i=this.unevalVertices.length;for(let r=0;r<e.length;r++)this.unevalVertices.push(e[r]),this.unevalHeights.push(t[r]);return i}addTriangles(e,t,i){const r=i?this.unevalTunnelTriangles:this.unevalTriangles;for(const n of e)r.push(n+t)}addRenderableRing(e,t,i,r,n,o){const a=[new ke(n.min.x,n.min.y),new ke(n.max.x,n.min.y),new ke(n.max.x,n.max.y),new ke(n.min.x,n.max.y)];for(let s=0;s<i-1;s++){const i=t+s,l=i+1,c=this.unevalVertices[i],u=this.unevalVertices[l];if(!(c.x>=n.min.x&&c.x<=n.max.x&&c.y>=n.min.y&&c.y<=n.max.y||u.x>=n.min.x&&u.x<=n.max.x&&u.y>=n.min.y&&u.y<=n.max.y||xd(c,u,a)))continue;if(this.isOnBorder(c.x,u.x)||this.isOnBorder(c.y,u.y))continue;const h=P_.computeEdgeHash(this.unevalVertices[i],this.unevalVertices[l]);let d,p=this.vertexHashLookup.get(P_.computePosHash(c));null!=p?d=p.next:(p=this.vertexHashLookup.get(P_.computePosHash(u)),d=null!=p?p.prev:h),this.unevalEdges.push({polygonIdx:e,a:i,b:l,hash:h,portalHash:d,isTunnel:r,type:"unevaluated",featureInfo:o})}}addPortalCandidates(e,t,i,r,n){if(0!==t.length){this.vertexHashLookup.clear();for(const n of t){if(0===n.length)continue;const t=n[0];let o=P_.computeEdgeHash(t[t.length-2],t.at(-1));for(let n=0;n<t.length-1;n++){const a=t[n+0],s=t[n+1],l=De(s.x-a.x,s.y-a.y),c=ze(l);if(0===c)continue;let u="unevaluated";const h=r.pointElevation(a),d=r.pointElevation(s);Math.abs(h)<.01&&Math.abs(d)<.01?u="entrance":(this.isOnBorder(a.x,s.x)||this.isOnBorder(a.y,s.y))&&(u="border");const p=P_.computeEdgeHash(a,s);this.unevaluatedPortals.portals.push({connection:{a:e,b:void 0},va:a,vb:s,vab:l,length:c,hash:p,isTunnel:i,type:u});const f=P_.computePosHash(a);this.vertexHashLookup.has(f)||this.vertexHashLookup.set(f,{prev:o,next:p}),o=p}}}}construct(e){if(0===this.unevalVertices.length)return;const t=()=>({vertexOffset:0,primitiveOffset:this.indexArray.length}),i=e=>{e.primitiveLength=this.indexArray.length-e.primitiveOffset},r=new M_(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(e.portals,this.unevalEdges);const n=t(),o=t(),a=t(),s=(e,t)=>{e.sort((e,i)=>e.type===t&&i.type!==t?-1:e.type!==t&&i.type===t?1:0);const i=e.findIndex(e=>e.type!==t);return i>=0?i:e.length};let l=0;this.unevalEdges.length>0&&(l=s(this.unevalEdges,"none"),this.constructBridgeStructures(r,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:l},this.tileToMeters)),i(a);const c=t(),u=t();if(this.unevalEdges.length>0){const e=this.unevalEdges.splice(l),t=s(e,"tunnel")+l;this.unevalEdges.push(...e),this.constructTunnelStructures(r,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:l},{min:l,max:t})}i(c),r.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),i(u),r.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),i(o),r.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights,4),i(n),this.maskSegments=uh.simpleSegment(0,u.primitiveOffset,0,u.primitiveLength),this.depthSegments=uh.simpleSegment(0,o.primitiveOffset,0,o.primitiveLength),this.renderableBridgeSegments=uh.simpleSegment(0,a.primitiveOffset,0,a.primitiveLength),this.renderableTunnelSegments=uh.simpleSegment(0,c.primitiveOffset,0,c.primitiveLength),this.shadowCasterSegments=uh.simpleSegment(0,n.primitiveOffset,0,n.primitiveLength)}update(e,t,i,r,n,o,a,s){this.bridgeProgramConfigurations.updatePaintArrays(e,t,n,i,r,o,a,s),this.tunnelProgramConfigurations.updatePaintArrays(e,t,n,i,r,o,a,s)}upload(e){this.vertexBuffer||0===this.vertexPositions.length||0===this.vertexNormals.length||0===this.indexArray.length||(this.vertexBuffer=e.createVertexBuffer(this.vertexPositions,lh.members),this.vertexBufferNormal=e.createVertexBuffer(this.vertexNormals,ch.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.bridgeProgramConfigurations.upload(e),this.tunnelProgramConfigurations.upload(e))}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(e,t,i,r,n){const o=(o,a)=>{for(let s=0;s<a.length-1;s++){const l=a[s].featureIndex,c=a[s+1].vertexStart,u=e.feature(l);o.populatePaintArrays(c,u,l,{},i,t,r,void 0,n)}};o(this.bridgeProgramConfigurations,this.bridgeFeatureSections),o(this.tunnelProgramConfigurations,this.tunnelFeatureSections)}computeVertexConnections(e,t,i,r,n){const o=new Map;for(let a=r;a<n;a++){const r=i[a],n=r.a,s=r.b,l=P_.computePosHash(e[n]),c=P_.computePosHash(e[s]);let u=o.get(l);u||(u={},o.set(l,u));let h=o.get(c);h||(h={}
vendor: 4,190 bytes, line 2
2,o.set(c,h)),t[n]<=0&&t[s]<=0||(u.to=s,h.from=n)}return o}isTerminalVertex(e,t){const i=P_.computePosHash(this.unevalVertices[e]),r=t.get(i);return!r||!r.from||!r.to}constructBridgeStructures(e,t,i,r,n,o){e.clearVertexLookup();const a=this.computeVertexConnections(t,i,r,n.min,n.max),s=1/o,l=.5*s,c=(e,r)=>N(e,t[r].x,t[r].y,i[r]*s),u=O(),h=O(),d=O(),p=O(),f=O(),m=(e,i)=>{const r=a.get(P_.computePosHash(t[i])),n=r.from,o=r.to;if(!n||!o)return;c(u,n),c(h,i),c(d,o),oe(p),ae(u,h)||(se(f,h,u),J(p,f)),ae(d,h)||(se(f,d,h),U(p,p,J(f,f)));const s=ue(p);return s>0?W(e,p,1/s):void 0};let _=Number.POSITIVE_INFINITY;this.sortSubarray(r,n.min,n.max,(e,t)=>e.featureInfo.featureIndex-t.featureInfo.featureIndex);const g=O(),y=O(),x=O(),v=O(),b=O(),w=O(),E=O(),A=O(),I=O(),S=[O(),O(),O(),O()],T=[O(),O(),O(),O()],D=[{coord:new ke(0,0),height:0},{coord:new ke(0,0),height:0}],M=(e,t)=>e>t;for(let P=n.min;P<n.max;P++){const n=r[P];if(!n.featureInfo.guardRailEnabled)continue;if(!this.prepareEdgePoints(D,t,i,n,M))continue;const[c,u]=D;if(N(g,c.coord.x,c.coord.y,s*c.height),N(y,u.coord.x,u.coord.y,s*u.height),ae(g,y))continue;se(x,y,g),J(x,x);const h=m(A,n.a)||x,d=m(I,n.b)||x;N(v,h[1],-h[0],0),J(v,v),N(b,d[1],-d[0],0),J(b,b),ee(A,v,h),J(w,A),ee(A,b,d),J(E,A),U(S[0],g,W(A,se(A,v,w),l)),U(S[1],g,W(A,U(A,v,w),l)),U(S[2],g,W(A,w,l)),S[3]=g,U(T[0],y,W(A,se(A,b,E),l)),U(T[1],y,W(A,U(A,b,E),l)),U(T[2],y,W(A,E,l)),T[3]=y,_=this.addFeatureSection(n.featureInfo.featureIndex,_,this.bridgeFeatureSections,e);const p=e.addVertex(S[0],v,o),f=e.addVertex(S[1],v,o),C=e.addVertex(T[0],b,o),R=e.addVertex(T[1],b,o);e.addTriangle(p,f,C),e.addTriangle(f,R,C);const z=e.addVertex(S[1],w,o),L=e.addVertex(S[2],w,o),F=e.addVertex(T[1],E,o),O=e.addVertex(T[2],E,o);e.addTriangle(z,L,F),e.addTriangle(L,O,F),K(v,v),K(b,b);const B=e.addVertex(S[2],v,o),k=e.addVertex(S[3],v,o),V=e.addVertex(T[2],b,o),j=e.addVertex(T[3],b,o);e.addTriangle(B,k,V),e.addTriangle(k,j,V);const G=this.isTerminalVertex(n.a,a),H=this.isTerminalVertex(n.b,a);c.height<.01&&G&&e.addQuad(S[3],S[2],S[1],S[0],K(h,h),o),u.height<.01&&H&&e.addQuad(T[0],T[1],T[2],T[3],d,o)}this.bridgeFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}constructTunnelStructures(e,t,i,r,n,o){e.clearVertexLookup();let a=Number.POSITIVE_INFINITY;const s=(e,t)=>e.featureInfo.featureIndex-t.featureInfo.featureIndex;this.sortSubarray(r,n.min,n.max,s),this.sortSubarray(r,o.min,o.max,s);const l=e=>J(e,e),c=[{coord:new ke(0,0),height:0},{coord:new ke(0,0),height:0}],u=(e,t)=>e<t,h=O(),d=O(),p=O(),f=O(),m=O();for(let _=n.min;_<n.max;_++){if(!this.prepareEdgePoints(c,t,i,r[_],u))continue;const[n,o]=c,s=l(N(m,-(o.coord.y-n.coord.y),o.coord.x-n.coord.x,0));a=this.addFeatureSection(r[_].featureInfo.featureIndex,a,this.tunnelFeatureSections,e),e.addQuad(N(h,n.coord.x,n.coord.y,n.height),N(d,o.coord.x,o.coord.y,o.height),N(p,o.coord.x,o.coord.y,r[_].isTunnel?o.height+4:0),N(f,n.coord.x,n.coord.y,r[_].isTunnel?n.height+4:0),s)}for(let _=o.min;_<o.max;_++){const n=r[_];n.isTunnel&&([n.a,n.b]=[n.b,n.a]);const o=t[n.a],s=t[n.b],c=l(N(m,-(s.y-o.y),s.x-o.x,0));a=this.addFeatureSection(n.featureInfo.featureIndex,a,this.tunnelFeatureSections,e),e.addQuad(N(h,s.x,s.y,0),N(d,o.x,o.y,0),N(p,o.x,o.y,i[n.a]+4),N(f,s.x,s.y,i[n.b]+4),c),e.addQuad(N(h,o.x,o.y,0),N(d,s.x,s.y,0),N(p,s.x,s.y,i[n.b]+4),N(f,o.x,o.y,i[n.a]+4),c)}this.tunnelFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}setElevatedPoint(e,t,i,r){e.coord.x=t,e.coord.y=i,e.height=r}prepareEdgePoints(e,t,i,r,n){let o=t[r.a].x,a=t[r.a].y,s=t[r.b].x,l=t[r.b].y,c=i[r.a],u=i[r.b];const h=n(c,0),d=n(u,0);if(h&&d)return this.setElevatedPoint(e[0],o,a,c),this.setElevatedPoint(e[1],s,l,u),!0;if(!h&&!d)return!1;if(h){if(!d){const e=u/(u-c);s=Wr(s,o,e),l=Wr(l,a,e),u=Wr(u,c,e)}}else{const e=c/(c-u);o=Wr(o,s,e),a=Wr(a,l,e),c=Wr(c,u,e)}return this.setElevatedPoint(e[0],o,a,c),this.setElevatedPoint(e[1],s,l,u),!0}prepareEdges(e,t){if(0===t.length)return;t.sort((e,t)=>e.hash===t.hash?t.polygonIdx-e.polygonIdx:t.hash>e.hash?1:-1);let i=0,r=0,n=0,o=t[i].polygonIdx;do{r++,(r===t.length||t[i].hash!==t[r].hash)&&((1===r-i||t[r-1].pol
vendor: 4,224 bytes, line 2
2ygonIdx!==o)&&(n<i&&(t[n]=t[i],t[i]=null),t[n].type="none",n++),i=r,i!==t.length&&(o=t[i].polygonIdx))}while(i!==t.length);if(t.splice(n),0!==t.length&&0!==e.length){t.sort((e,t)=>e.portalHash<t.portalHash?1:-1);let i=0,r=0;for(;i!==t.length&&r!==e.length;){const n=t[i],o=e[r];n.portalHash>o.hash?i++:o.hash>n.portalHash?r++:(n.type=o.type,i++)}}}isOnBorder(e,t){return e<=0&&t<=0||e>=co&&t>=co}addFeatureSection(e,t,i,r){return e!==t&&(t=e,i.push({featureIndex:e,vertexStart:r.getVertexCount()}),r.clearVertexLookup()),t}sortSubarray(e,t,i,r){const n=e.slice(t,i);n.sort(r),e.splice(t,n.length,...n)}static computeEdgeHash(e,t){return(e.y===t.y&&e.x>t.x||e.y>t.y)&&([e,t]=[t,e]),BigInt(P_.computePosHash(e))<<32n|BigInt(P_.computePosHash(t))}static computePosHash(e){return((65535&e.x)<<16|65535&e.y)>>>0}}const C_=[Te(),Te(),Te(),Te(),Te(),Te(),Te()],R_=Te(),z_=Te();function L_(e){return[e[0],e[1]]}function F_(e){return De(e[0],e[1])}class O_{constructor(e,t,i=null){this.feature=e,this.metersToTile=t,this.sampler=i,this.index=0}get(){const e=this.feature.vertices[this.index],t=this.feature.vertexProps[this.index].dir,i=t[1],r=-t[0],n=(e.extent+1)*this.metersToTile,o=this.sampler?this.sampler.pointTransform(e.position):e.position;return[new ke(Math.trunc(o[0]+i*n),Math.trunc(o[1]+r*n)),new ke(Math.trunc(o[0]-i*n),Math.trunc(o[1]-r*n))]}next(){this.index++}valid(){return this.index<this.feature.vertices.length}}class B_{constructor(e,t,i,r,n,o){if(this.vertices=new Array,this.vertexProps=new Array,this.edges=new Array,this.edgeProps=new Array,this.id=e,this.heightRange={min:i,max:i},this.safeArea=t,this.constantHeight=i,null==this.constantHeight&&(null!=this.constantHeight||0!==r.length)){this.vertices=r,this.edges=n;for(let e=0;e<this.vertices.length;e++)this.vertices[e].index=void 0!==this.vertices[e].index?this.vertices[e].index:e;this.edges=this.edges.filter(e=>{return e.a<this.vertices.length&&e.b<this.vertices.length&&!((t=this.vertices[e.a].position)[0]===(i=this.vertices[e.b].position)[0]&&t[1]===i[1]);var t,i}),this.heightRange={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};for(const e of this.vertices)this.vertexProps.push({dir:De(0,0)}),this.heightRange.min=Math.min(this.heightRange.min,e.height),this.heightRange.max=Math.max(this.heightRange.max,e.height);for(const e of this.edges){const t=this.vertices[e.a].position,i=this.vertices[e.b].position,r=Ce(Te(),i,t),n=ze(r),o=Re(Te(),r,1/n);this.edgeProps.push({vec:r,dir:o,len:n});const a=this.vertexProps[e.a].dir,s=this.vertexProps[e.b].dir;Pe(a,a,o),Pe(s,s,o)}for(const e of this.vertexProps)0===e.dir[0]&&0===e.dir[1]||Le(e.dir,e.dir);this.tessellate(o)}}pointElevation(e){if(null!=this.constantHeight)return this.constantHeight;const t=this.getClosestEdge(e);if(null==t)return 0;const[i,r]=t;return Wr(this.vertices[this.edges[i].a].height,this.vertices[this.edges[i].b].height,r)}computeSlopeNormal(e,t){const i=this.getClosestEdge(e);if(!i)return V(0,0,1);const r=i[0],n=this.edges[r],o=this.edgeProps[r].vec,a=V(o[0],o[1],(this.vertices[n.b].height-this.vertices[n.a].height)*t),s=V(a[1],-a[0],0);ee(s,s,a);const l=k(s);return l>0?W(s,s,1/l):N(s,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(e){if(0===this.edges.length)return;let t=0,i=Number.POSITIVE_INFINITY,r=0;const[n,o,a,s,l,c,u]=C_;Me(u,e.x,e.y);const h=new Bp(u,null);for(let d=0;d<this.edges.length;d++){const e=this.edges[d],p=this.edgeProps[d].dir;h.dir=p;const f=this.vertices[e.a].position,m=this.vertices[e.b].position,_=h.intersectsPlane(f,this.vertexProps[e.a].dir,n),g=h.intersectsPlane(m,this.vertexProps[e.b].dir,o);if(!_||!g)continue;Ce(a,o,n),Ce(s,u,n);const y=Fe(a,a),x=y>0?Fe(s,a)/y:0,v=ht(x,0,1),b=Math.abs((x-v)*this.edgeProps[d].len);Ce(l,u,f),Me(c,p[1],-p[0]);const w=b+Math.abs(Fe(l,c));w<i&&(t=d,i=w,r=v)}return[t,r]}tessellate(e){const t=O(),i=O(),r=O(),n=O();for(let o=this.edges.length-1;o>=0;--o){const a=this.edges[o].a,s=this.edges[o].b,{position:l,height:c,extent:u}=this.vertices[a],{position:h,height:d,extent:p}=this.vertices[s],f=this.vertexProps[a].dir,m=this.vertexProps[s].dir;if(N(t,l[0]/e,l[1]/e,c),N(i,h[0]/e,h[1]/e,d),N(r,f[1],-f[0],0),W(r,r,u),N(n,m[1],-m[0],0
vendor: 4,721 bytes, line 2
2),W(n,n,p),this.distSqLines(V(t[0]+.5*r[0],t[1]+.5*r[1],t[2]+.5*r[2]),V(i[0]-.5*n[0],i[1]-.5*n[1],i[2]-.5*n[2]),V(t[0]-.5*r[0],t[1]-.5*r[1],t[2]-.5*r[2]),V(i[0]+.5*n[0],i[1]+.5*n[1],i[2]+.5*n[2]))<=.0025000000000000005)continue;const _=this.vertices.length,g=Pe(Te(),l,h);this.vertices.push({position:Re(g,g,.5),height:.5*(c+d),extent:.5*(u+p),index:.5*((void 0!==this.vertices[a].index?this.vertices[a].index:a)+(void 0!==this.vertices[s].index?this.vertices[s].index:s))});const y=Pe(Te(),f,m);this.vertexProps.push({dir:Le(y,y)}),this.edges.splice(o,1),this.edgeProps.splice(o,1),this.edges.push({a:a,b:_}),this.edges.push({a:_,b:s});const x=Ce(Te(),this.vertices[_].position,l),v=ze(x),b={vec:x,dir:Re(Te(),x,1/v),len:v};this.edgeProps.push(b),this.edgeProps.push(b)}}distSqLines(e,t,i,r){const n=j(O(),t,e),o=j(O(),r,i),a=j(O(),e,i),s=Q(n,n),l=Q(n,o),c=Q(n,a),u=Q(o,o),h=Q(o,a),d=s*u-l*l;if(0===d)return X(te(n,i,r,Q(a,o)/Q(o,o)),e);const p=(s*h-l*c)/d;return X(te(n,e,t,(l*h-c*u)/d),te(o,i,r,p))}static serialize(e,t){const i={id:e.id,heightRange:{min:e.heightRange.min,max:e.heightRange.max},safeArea:(r=e.safeArea,{min:{x:r.min.x,y:r.min.y},max:{x:r.max.x,y:r.max.y}})};var r;return null!=e.constantHeight?(i.constantHeight=e.constantHeight,i):0===e.vertices.length?(i.vertices=[],i.vertexProps=[],i.edges=[],i.edgeProps=[],i):(i.vertices=e.vertices.map(e=>({position:L_(e.position),height:e.height,extent:e.extent,index:e.index})),i.vertexProps=e.vertexProps.map(e=>({dir:L_(e.dir)})),i.edges=e.edges.map(e=>({a:e.a,b:e.b})),i.edgeProps=e.edgeProps.map(e=>({vec:L_(e.vec),dir:L_(e.dir),len:e.len})),i)}static deserialize(e){const t=function(e){return{min:new ke(e.min.x,e.min.y),max:new ke(e.max.x,e.max.y)}}(e.safeArea);if(null!=e.constantHeight)return new B_(e.id,t,e.constantHeight);if(!e.vertices||0===e.vertices.length){const i=Object.create(B_.prototype);return i.id=e.id,i.constantHeight=void 0,i.heightRange={min:e.heightRange.min,max:e.heightRange.max},i.safeArea=t,i.vertices=[],i.vertexProps=[],i.edges=[],i.edgeProps=[],i}const i=Object.create(B_.prototype);return i.id=e.id,i.constantHeight=void 0,i.heightRange={min:e.heightRange.min,max:e.heightRange.max},i.safeArea=t,i.vertices=e.vertices.map(e=>({position:F_(e.position),height:e.height,extent:e.extent,index:e.index})),i.vertexProps=(e.vertexProps||[]).map(e=>({dir:F_(e.dir)})),i.edges=(e.edges||[]).map(e=>({a:e.a,b:e.b})),i.edgeProps=(e.edgeProps||[]).map(e=>({vec:F_(e.vec),dir:F_(e.dir),len:e.len})),i}}class k_{constructor(e,t){this.zScale=1,this.xOffset=0,this.yOffset=0,e.equals(t)||(this.zScale=Math.pow(2,t.z-e.z),this.xOffset=(e.x*this.zScale-t.x)*co,this.yOffset=(e.y*this.zScale-t.y)*co)}pointTransform(e){return De(e[0]*this.zScale+this.xOffset,e[1]*this.zScale+this.yOffset)}pointTransformInPlace(e){e[0]=e[0]*this.zScale+this.xOffset,e[1]=e[1]*this.zScale+this.yOffset}constantElevation(e,t){if(null!=e.constantHeight)return this.computeBiasedHeight(e.constantHeight,t)}pointElevation(e,t,i){const r=this.constantElevation(t,i);return null!=r?r:(e.x=e.x*this.zScale+this.xOffset,e.y=e.y*this.zScale+this.yOffset,this.computeBiasedHeight(t.pointElevation(e),i))}computeBiasedHeight(e,t){return t<=0?e:e+t*dt(0,t,e>=0?e:Math.abs(.5*e))}}function V_(e){if(0===e)return[0,0,0];const t=Za(e);return[t(),t(),t()]}function N_(e,t){let i=0,r=e.length-1;for(;i<=r;){const n=i+r>>1;e[n].feature.id<t?i=n+1:r=n-1}return i<e.length&&e[i].feature.id===t?i:-1}function U_(e,t,i,r){if(!e.properties)return;const n=+e.properties[Fd];if(Number.isNaN(n))return;if(t){const e=t.find(e=>e.id===n);if(e&&r)return{tileId:r,feature:e}}if(!i||0===i.length)return;const o=N_(i,n);if(!(o<0)){if(r)for(let e=o;e<i.length&&i[e].feature.id===n;e++)if(i[e].tileId.key===r.key)return i[e];return i[o]}}function j_(e,t){return e>t?1:e<t?-1:0}Rs(B_,"ElevationFeature");class G_{constructor(e=j_,t=!1){this._compare=e,this._root=null,this._size=0,this._noDuplicates=!!t}rotateLeft(e){var t=e.right;t&&(e.right=t.left,t.left&&(t.left.parent=e),t.parent=e.parent),e.parent?e===e.parent.left?e.parent.left=t:e.parent.right=t:this._root=t,t&&(t.left=e),e.parent=t}rotateRight(e){var t=e.left;t&&(e.left=t.right,t.right&&(t.right.parent=e),t.parent=e.parent),e.parent?e===e.parent.left?e.parent.left=t:e.parent.right=t:this._root=t,t&&(t.right=e),e.parent=t}_splay(e){for(;e.parent;){var t=e.parent;t.parent?t.left===e&&t.parent.left===t?(this.rotateRight(t.parent),this.rotateRight(t)):t.right===e&&t.parent.right===t?(this.rotateLeft(t.parent),this.rotateLeft(t)):t.left===e&&t.parent.right===t?(this.rotateRight(t),this.rotateLeft(t)):(this.rotateLeft(t),this.rotateRight(t)):t.left===e?this.rotateRight(t):this.rotateLeft(t)}}splay(e){for(var t,i,r,n,o;e.parent;
vendor: 16,268 bytes, line 2
2)(i=(t=e.parent).parent)&&i.parent?((r=i.parent).left===i?r.left=e:r.right=e,e.parent=r):(e.parent=null,this._root=e),n=e.left,o=e.right,e===t.left?(i&&(i.left===t?(t.right?(i.left=t.right,i.left.parent=i):i.left=null,t.right=i,i.parent=t):(n?(i.right=n,n.parent=i):i.right=null,e.left=i,i.parent=e)),o?(t.left=o,o.parent=t):t.left=null,e.right=t,t.parent=e):(i&&(i.right===t?(t.left?(i.right=t.left,i.right.parent=i):i.right=null,t.left=i,i.parent=t):(o?(i.left=o,o.parent=i):i.left=null,e.right=i,i.parent=e)),n?(t.right=n,n.parent=t):t.right=null,e.left=t,t.parent=e)}replace(e,t){e.parent?e===e.parent.left?e.parent.left=t:e.parent.right=t:this._root=t,t&&(t.parent=e.parent)}minNode(e=this._root){if(e)for(;e.left;)e=e.left;return e}maxNode(e=this._root){if(e)for(;e.right;)e=e.right;return e}insert(e,t){var i=this._root,r=null,n=this._compare;if(this._noDuplicates)for(;i;){if(r=i,0===n(i.key,e))return;i=n(i.key,e)<0?i.right:i.left}else for(;i;)r=i,i=n(i.key,e)<0?i.right:i.left;return i={key:e,data:t,left:null,right:null,parent:r},r?n(r.key,i.key)<0?r.right=i:r.left=i:this._root=i,this.splay(i),this._size++,i}find(e){for(var t=this._root,i=this._compare;t;){var r=i(t.key,e);if(r<0)t=t.right;else{if(!(r>0))return t;t=t.left}}return null}contains(e){for(var t=this._root,i=this._compare;t;){var r=i(e,t.key);if(0===r)return!0;t=r<0?t.left:t.right}return!1}remove(e){var t=this.find(e);if(!t)return!1;if(this.splay(t),t.left)if(t.right){var i=this.minNode(t.right);i.parent!==t&&(this.replace(i,i.right),i.right=t.right,i.right.parent=i),this.replace(t,i),i.left=t.left,i.left.parent=i}else this.replace(t,t.left);else this.replace(t,t.right);return this._size--,!0}removeNode(e){if(!e)return!1;if(this.splay(e),e.left)if(e.right){var t=this.minNode(e.right);t.parent!==e&&(this.replace(t,t.right),t.right=e.right,t.right.parent=t),this.replace(e,t),t.left=e.left,t.left.parent=t}else this.replace(e,e.left);else this.replace(e,e.right);return this._size--,!0}erase(e){var t=this.find(e);if(t){this.splay(t);var i=t.left,r=t.right,n=null;i&&(i.parent=null,n=this.maxNode(i),this.splay(n),this._root=n),r&&(i?n.right=r:this._root=r,r.parent=n),this._size--}}pop(){var e=this._root,t=null;if(e){for(;e.left;)e=e.left;t={key:e.key,data:e.data},this.remove(e.key)}return t}next(e){var t=e;if(t)if(t.right)for(t=t.right;t&&t.left;)t=t.left;else for(t=e.parent;t&&t.right===e;)e=t,t=t.parent;return t}prev(e){var t=e;if(t)if(t.left)for(t=t.left;t&&t.right;)t=t.right;else for(t=e.parent;t&&t.left===e;)e=t,t=t.parent;return t}forEach(e){for(var t=this._root,i=[],r=!1,n=0;!r;)t?(i.push(t),t=t.left):i.length>0?(e(t=i.pop(),n++),t=t.right):r=!0;return this}range(e,t,i,r){const n=[],o=this._compare;let a,s=this._root;for(;0!==n.length||s;)if(s)n.push(s),s=s.left;else{if(s=n.pop(),a=o(s.key,t),a>0)break;if(o(s.key,e)>=0&&i.call(r,s))return this;s=s.right}return this}keys(){for(var e=this._root,t=[],i=[],r=!1;!r;)e?(t.push(e),e=e.left):t.length>0?(e=t.pop(),i.push(e.key),e=e.right):r=!0;return i}values(){for(var e=this._root,t=[],i=[],r=!1;!r;)e?(t.push(e),e=e.left):t.length>0?(e=t.pop(),i.push(e.data),e=e.right):r=!0;return i}at(e){for(var t=this._root,i=[],r=!1,n=0;!r;)if(t)i.push(t),t=t.left;else if(i.length>0){if(t=i.pop(),n===e)return t;n++,t=t.right}else r=!0;return null}load(e=[],t=[],i=!1){if(0!==this._size)throw new Error("bulk-load: tree is not empty");const r=e.length;return i&&$_(e,t,0,r-1,this._compare),this._root=H_(null,e,t,0,r),this._size=r,this}min(){var e=this.minNode(this._root);return e?e.key:null}max(){var e=this.maxNode(this._root);return e?e.key:null}isEmpty(){return null===this._root}get size(){return this._size}static createTree(e,t,i,r,n){return new G_(i,n).load(e,t,r)}}function H_(e,t,i,r,n){const o=n-r;if(o>0){const a=r+Math.floor(o/2),s={key:t[a],data:i[a],parent:e};return s.left=H_(s,t,i,r,a),s.right=H_(s,t,i,a+1,n),s}return null}function $_(e,t,i,r,n){if(i>=r)return;const o=e[i+r>>1];let a=i-1,s=r+1;for(;;){do{a++}while(n(e[a],o)<0);do{s--}while(n(e[s],o)>0);if(a>=s)break;let i=e[a];e[a]=e[s],e[s]=i,i=t[a],t[a]=t[s],t[s]=i}$_(e,t,i,s,n),$_(e,t,s+1,r,n)}const W_=11102230246251565e-32,q_=134217729,Z_=(3+8*W_)*W_;function X_(e,t,i,r,n){let o,a,s,l,c=t[0],u=r[0],h=0,d=0;u>c==u>-c?(o=c,c=t[++h]):(o=u,u=r[++d]);let p=0;if(h<e&&d<i)for(u>c==u>-c?(a=c+o,s=o-(a-c),c=t[++h]):(a=u+o,s=o-(a-u),u=r[++d]),o=a,0!==s&&(n[p++]=s);h<e&&d<i;)u>c==u>-c?(a=o+c,l=a-o,s=o-(a-l)+(c-l),c=t[++h]):(a=o+u,l=a-o,s=o-(a-l)+(u-l),u=r[++d]),o=a,0!==s&&(n[p++]=s);for(;h<e;)a=o+c,l=a-o,s=o-(a-l)+(c-l),c=t[++h],o=a,0!==s&&(n[p++]=s);for(;d<i;)a=o+u,l=a-o,s=o-(a-l)+(u-l),u=r[++d],o=a,0!==s&&(n[p++]=s);return 0===o&&0!==p||(n[p++]=o),p}function Y_(e){return new Float64Array(e)}const K_=Y_(4),J_=Y_(8),Q_=Y_(12),eg=Y_(16),tg=Y_(4);function ig(e,t,i){null===t?(e.inOut=!1,e.otherInOut=!0):(e.isSubject===t.isSubject?(e.inOut=!t.inOut,e.otherInOut=t.otherInOut):(e.inOut=!t.otherInOut,e.otherInOut=t.isVertical()?!t.inOut:t.inOut),t&&(e.prevInResult=!rg(t,i)||t.isVertical()?t.prevInResult:t)),e.resultTransition=rg(e,i)?function(e,t){let i,r=!e.inOut,n=!e.otherInOut;switch(t){case 0:i=r&&n;break;case 1:i=r||n;break;case 3:i=r!==n;break;case 2:i=e.isSubject?r&&!n:n&&!r}return i?1:-1}(e,i):0}function rg(e,t){switch(e.type){case 0:switch(t){case 0:return!e.otherInOut;case 1:return e.otherInOut;case 2:return e.isSubject&&e.otherInOut||!e.isSubject&&!e.otherInOut;case 3:return!0}break;case 2:return 0===t||1===t;case 3:return 2===t;case 1:return!1}return!1}class ng{constructor(e,t,i,r,n){this.left=t,this.point=e,this.otherEvent=i,this.isSubject=r??!1,this.type=n||0,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0}isBelow(e){const t=this.point,i=this.otherEvent.point;return this.left?(t[0]-e[0])*(i[1]-e[1])-(i[0]-e[0])*(t[1]-e[1])>0:(i[0]-e[0])*(t[1]-e[1])-(t[0]-e[0])*(i[1]-e[1])>0}isAbove(e){return!this.isBelow(e)}isVertical(){return this.point[0]===this.otherEvent.point[0]}get inResult(){return 0!==this.resultTransition}clone(){const e=new ng(this.point,this.left,this.otherEvent,this.isSubject,this.type);return e.contourId=this.contourId,e.resultTransition=this.resultTransition,e.prevInResult=this.prevInResult,e.isExteriorRing=this.isExteriorRing,e.inOut=this.inOut,e.otherInOut=this.otherInOut,e}}function og(e,t){return e[0]===t[0]&&e[1]===t[1]}function ag(e,t,i){const r=function(e,t,i,r,n,o){const a=(t-o)*(i-n),s=(e-n)*(r-o),l=a-s;if(0===a||0===s||a>0!=s>0)return l;const c=Math.abs(a+s);return Math.abs(l)>=33306690738754716e-32*c?l:-function(e,t,i,r,n,o,a){let s,l,c,u,h,d,p,f,m,_,g,y,x,v,b,w,E,A;const I=e-n,S=i-n,T=t-o,D=r-o;v=I*D,d=q_*I,p=d-(d-I),f=I-p,d=q_*D,m=d-(d-D),_=D-m,b=f*_-(v-p*m-f*m-p*_),w=T*S,d=q_*T,p=d-(d-T),f=T-p,d=q_*S,m=d-(d-S),_=S-m,E=f*_-(w-p*m-f*m-p*_),g=b-E,h=b-g,K_[0]=b-(g+h)+(h-E),y=v+g,h=y-v,x=v-(y-h)+(g-h),g=x-w,h=x-g,K_[1]=x-(g+h)+(h-w),A=y+g,h=A-y,K_[2]=y-(A-h)+(g-h),K_[3]=A;let M=function(e,t){let i=t[0];for(let r=1;r<4;r++)i+=t[r];return i}(0,K_),P=22204460492503146e-32*a;if(M>=P||-M>=P)return M;if(h=e-I,s=e-(I+h)+(h-n),h=i-S,c=i-(S+h)+(h-n),h=t-T,l=t-(T+h)+(h-o),h=r-D,u=r-(D+h)+(h-o),0===s&&0===l&&0===c&&0===u)return M;if(P=11093356479670487e-47*a+Z_*Math.abs(M),M+=I*u+D*s-(T*c+S*l),M>=P||-M>=P)return M;v=s*D,d=q_*s,p=d-(d-s),f=s-p,d=q_*D,m=d-(d-D),_=D-m,b=f*_-(v-p*m-f*m-p*_),w=l*S,d=q_*l,p=d-(d-l),f=l-p,d=q_*S,m=d-(d-S),_=S-m,E=f*_-(w-p*m-f*m-p*_),g=b-E,h=b-g,tg[0]=b-(g+h)+(h-E),y=v+g,h=y-v,x=v-(y-h)+(g-h),g=x-w,h=x-g,tg[1]=x-(g+h)+(h-w),A=y+g,h=A-y,tg[2]=y-(A-h)+(g-h),tg[3]=A;const C=X_(4,K_,4,tg,J_);v=I*u,d=q_*I,p=d-(d-I),f=I-p,d=q_*u,m=d-(d-u),_=u-m,b=f*_-(v-p*m-f*m-p*_),w=T*c,d=q_*T,p=d-(d-T),f=T-p,d=q_*c,m=d-(d-c),_=c-m,E=f*_-(w-p*m-f*m-p*_),g=b-E,h=b-g,tg[0]=b-(g+h)+(h-E),y=v+g,h=y-v,x=v-(y-h)+(g-h),g=x-w,h=x-g,tg[1]=x-(g+h)+(h-w),A=y+g,h=A-y,tg[2]=y-(A-h)+(g-h),tg[3]=A;const R=X_(C,J_,4,tg,Q_);v=s*u,d=q_*s,p=d-(d-s),f=s-p,d=q_*u,m=d-(d-u),_=u-m,b=f*_-(v-p*m-f*m-p*_),w=l*c,d=q_*l,p=d-(d-l),f=l-p,d=q_*c,m=d-(d-c),_=c-m,E=f*_-(w-p*m-f*m-p*_),g=b-E,h=b-g,tg[0]=b-(g+h)+(h-E),y=v+g,h=y-v,x=v-(y-h)+(g-h),g=x-w,h=x-g,tg[1]=x-(g+h)+(h-w),A=y+g,h=A-y,tg[2]=y-(A-h)+(g-h),tg[3]=A;const z=X_(R,Q_,4,tg,eg);return eg[z-1]}(e,t,i,r,n,o,c)}(e[0],e[1],t[0],t[1],i[0],i[1]);return r>0?-1:r<0?1:0}function sg(e,t){const i=e.point,r=t.point;return i[0]>r[0]?1:i[0]<r[0]?-1:i[1]!==r[1]?i[1]>r[1]?1:-1:function(e,t,i){return e.left!==t.left?e.left?1:-1:0!==ag(i,e.otherEvent.point,t.otherEvent.point)?e.isBelow(t.otherEvent.point)?-1:1:!e.isSubject&&t.isSubject?1:-1}(e,t,i)}function lg(e,t,i){const r=new ng(t,!1,e,e.isSubject),n=new ng(t,!0,e.otherEvent,e.isSubject);return og(e.point,e.otherEvent.point)&&console.warn("what is that, a collapsed segment?",e),r.contourId=n.contourId=e.contourId,sg(n,e.otherEvent)>0&&(e.otherEvent.left=!0,n.left=!1),e.otherEvent.otherEvent=n,e.otherEvent=r,i.push(n),i.push(r),i}function cg(e,t){return e[0]*t[1]-e[1]*t[0]}function ug(e,t){return e[0]*t[0]+e[1]*t[1]}function hg(e,t,i){const r=function(e,t,i,r){const n=[t[0]-e[0],t[1]-e[1]],o=[r[0]-i[0],r[1]-i[1]];function a(e,t,i){return[e[0]+t*i[0],e[1]+t*i[1]]}const s=[i[0]-e[0],i[1]-e[1]];let l=cg(n,o),c=l*l;const u=ug(n,n);if(c>0){const t=cg(s,o)/l;if(t<0||t>1)return null;const r=cg(s,n)/l;return r<0||r>1?null:0===t||1===t?[a(e,t,n)]:0===r||1===r?[a(i,r,o)]:[a(e,t,n)]}if(l=cg(s,n),c=l*l,c>0)return null;const h=ug(n,s)/u,d=h+ug(n,o)/u,p=Math.min(h,d),f=Math.max(h,d);return p<=1&&f>=0?1===p?[a(e,p>0?p:0,n)]:0===f?[a(e,f<1?f:1,n)]:[a(e,p>0?p:0,n),a(e,f<1?f:1,n)]:null}(e.point,e.otherEvent.point,t.point,t.otherEvent.point),n=r?r.length:0;if(0===n||1===n&&(og(e.point,t.point)||og(e.otherEvent.point,t.otherEvent.point))||2===n&&e.isSubject===t.isSubject)return 0;if(1===n)return!og(e.point,r[0])&&!og(e.otherEvent.point,r[0])&&lg(e,r[0],i),!og(t.point,r[0])&&!og(t.otherEvent.point,r[0])&&lg(t,r[0],i),1;const o=[];let a=!1,s=!1;return og(e.point,t.point)?a=!0:1===sg(e,t)?o.push(t,e):o.push(e,t),og(e.otherEvent.point,t.otherEvent.point)?s=!0:1===sg(e.otherEvent,t.otherEvent)?o.push(t.otherEvent,e.otherEvent):o.push(e.otherEvent,t.otherEvent),a&&s||a?(t.type=1,e.type=t.inOut===e.inOut?2:3,a&&!s&&lg(o[1].otherEvent,o[0].point,i),2):s?(lg(o[0],o[1].point,i),3):o[0]!==o[3].otherEvent?(lg(o[0],o[1].point,i),lg(o[1],o[2].point,i),3):(lg(o[0],o[1].point,i),lg(o[3].otherEvent,o[2].point,i),3)}function dg(e,t){if(e===t)return 0;if(0!==ag(e.point,e.otherEvent.point,t.point)||0!==ag(e.point,e.otherEvent.point,t.otherEvent.point))return og(e.point,t.point)?e.isBelow(t.otherEvent.point)?-1:1:e.point[0]===t.point[0]?e.point[1]<t.point[1]?-1:1:1===sg(e,t)?t.isAbove(e.point)?-1:1:e.isBelow(t.point)?-1:1;if(e.isSubject!==t.isSubject)return e.isSubject?-1:1;{let i=e.point,r=t.point;if(i[0]===r[0]&&i[1]===r[1])return i=e.otherEvent.point,r=t.otherEvent.point,i[0]===r[0]&&i[1]===r[1]?0:(e.contourId??0)>(t.contourId??0)?1:-1}return 1===sg(e,t)?1:-1}class pg{constructor(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null}isExterior(){return null==this.holeOf}}function fg(e,t,i,r){let n,o=e+1,a=t[e].point;const s=t.length;for(o<s&&(n=t[o].point);o<s&&n[0]===a[0]&&n[1]===a[1];){if(!i[o])return o;o++,o<s&&(n=t[o].point)}for(o=e-1;i[o]&&o>r;)o--;return o}function mg(e,t,i){const r=new pg;if(null!=e.prevInResult){const n=e.prevInResult,o=n.outputContourId;if(n.resultTransition>0){const e=t[o];if(null!=e.holeOf){const n=e.holeOf;t[n].holeIds.push(i),r.holeOf=n,r.depth=t[o].depth}else t[o].holeIds.push(i),r.holeOf=o,r.depth=t[o].depth+1}else r.holeOf=null,r.depth=t[o].depth}else r.holeOf=null,r.depth=0;return r}const _g=Math.max,gg=Math.min;let yg=0;function xg(e,t,i,r,n,o){let a,s,l,c,u,h;for(a=0,s=e.length-1;a<s;a++){if(l=e[a],c=e[a+1],u=new ng(l,!1,void 0,t),h=new ng(c,!1,u,t),u.otherEvent=h,l[0]===c[0]&&l[1]===c[1])continue;u.contourId=h.contourId=i,o||(u.isExteriorRing=!1,h.isExteriorRing=!1),sg(u,h)>0?h.left=!0:u.left=!0;const s=l[0],d=l[1];n[0]=gg(n[0],s),n[1]=gg(n[1],d),n[2]=_g(n[2],s),n[3]=_g(n[3],d),r.push(u),r.push(h)}}const vg=[];function bg(e,t,i){let r=e,n=t;"number"==typeof e[0][0][0]&&(r=[e]),"number"==typeof t[0][0][0]&&(n=[t]);let o=function(e,t,i){let r=null;return e.length*t.length===0&&(0===i?r=vg:2===i?r=e:(1===i||3===i)&&(r=0===e.length?t:e)),r}(r,n,i);if(o)return o===vg?null:o;const a=[1/0,1/0,-1/0,-1/0],s=[1/0,1/0,-1/0,-1/0],l=function(e,t,i,r,n){const o=new lo(void 0,sg);let a,s,l,c,u,h;for(l=0,c=e.length;l<c;l++)for(a=e[l],u=0,h=a.length;u<h;u++)s=0===u,s&&yg++,xg(a[u],!0,yg,o,i,s);for(l=0,c=t.length;l<c;l++)for(a=t[l],u=0,h=a.length;u<h;u++)s=0===u,2===n&&(s=!1),s&&yg++,xg(a[u],!1,yg,o,r,s);return o}(r,n,a,s,i);if(o=function(e,t,i,r,n){let o=null;return(i[0]>r[2]||r[0]>i[2]||i[1]>r[3]||r[1]>i[3])&&(0===n?o=vg:2===n?o=e:(1===n||3===n)&&(o=e.concat(t))),o}(r,n,a,s,i),o)return o===vg?null:o;const c=function(e,t,i,r,n,o){const a=new G_(dg),s=[],l=Math.min(r[2],n[2]);let c,u,h;for(;0!==e.length;){let t=e.pop();if(s.push(t),0===o&&t.point[0]>l||2===o&&t.point[0]>r[2])break;if(t.left){u=c=a.insert(t),h=a.minNode(),c=c!==h?a.prev(c):null,u=a.next(u);const i=c?c.key:null;let r;if(ig(t,i,o),u&&2===hg(t,u.key,e)&&(ig(t,i,o),ig(u.key,t,o)),c&&2===hg(c.key,t,e)){let e=c;e=e!==h?a.prev(e):null,r=e?e.key:null,ig(i,r,o),ig(t,i,o)}}else t=t.otherEvent,u=c=a.find(t),c&&u&&(c=c!==h?a.prev(c):null,u=a.next(u),a.remove(t),u&&c&&hg(c.key,u.key,e))}return s}(l,0,0,a,s,i),u=function(e){let t,i;const r=function(e){let t,i,r,n,o;const a=[];for(i=0,r=e.length;i<r;i++)t=e[i],(t.left&&t.inResult||!t.left&&t.otherEvent.inResult)&&a.push(t);let s=!1;for(;!s;)for(s=!0,i=0,r=a.length;i<r;i++)i+1<r&&1===sg(a[i],a[i+1])&&(n=a[i],a[i]=a[i+1],a[i+1]=n,s=!1);for(i=0,r=a.length;i<r;i++)t=a[i],t.otherPos=i;for(i=0,r=a.length;i<r;i++)t=a[i],t.left||(o=t.otherPos,t.otherPos=t.otherEvent.otherPos,t.otherEvent.otherPos=o);return a}(e),n={},o=[];for(t=0,i=r.length;t<i;t++){if(n[t])continue;const e=o.length,i=mg(r[t],o,e),a=t=>{n[t]=!0,t<r.length&&r[t]&&(r[t].outputContourId=e)};let s=t,l=t;for(i.points.push(r[t].point);a(s),s=r[s].otherPos,a(s),i.points.push(r[s].point),s=fg(s,r,n,l),!(s==l||s>=r.length)&&r[s];);o.push(i)}return o}(c),h=[];for(let d=0;d<u.length;d++){let e=u[d];if(e.isExterior()){let t=[e.points];for(let i=0;i<e.holeIds.length;i++)t.push(u[e.holeIds[i]].points);h.push(t)}}return h}function wg(e,t){const i=bg(Ag(e),Ag([t]),0);return null==i?[]:Tg(i)}function Eg(e,t,i=0){const r=65536;let n=Ag(e,r);const o=[];for(;t.valid();t.next()){const[e,n]=t.get();let a=e.x*r,s=e.y*r,l=n.x*r,c=n.y*r;const u=l-a,h=c-s,d=Math.hypot(u,h);if(0===d)continue;a-=u*i,s-=h*i,l+=u*i,c+=h*i;const p=Math.trunc(h/d*3),f=-Math.trunc(u/d*3);o.push([[[a,s],[l,c],[l+p,c+f],[a+p,s+f],[a,s]]])}return o.length>0&&(n=bg(n,o,2)),Tg(n,1/r,.001)}function Ag(e,t=1){return[e.map(e=>e.map(e=>[e.x*t,e.y*t]))]}function Ig(e,t){const i=Math.floor(e)+.5;return Math.abs(e-i)<=t?Math.round(i):Math.round(e)}class Sg{constructor(e){this.xs=[],this.ys=[],this.ixs=[],this.iys=[],this.buckets=new Map,this.tolerance=e}canonicalize(e,t){const i=this.tolerance,r=Math.floor(e/i),n=Math.floor(t/i);for(let s=-1;s<=1;s++){const o=this.buckets.get(r+s);if(o)for(let a=-1;a<=1;a++){const s=o.get(n+a);if(s)for(const o of s)if(Math.abs(this.xs[o]-e)<=i&&Math.abs(this.ys[o]-t)<=i){const i=this.ixs[o],a=this.iys[o];return this.xs[o]===e&&this.ys[o]===t||this.store(e,t,i,a,r,n),[i,a]}}}const o=Ig(e,i),a=Ig(t,i);return this.store(e,t,o,a,r,n),[o,a]}store(e,t,i,r,n,o){const a=this.xs.length;this.xs.push(e),this.ys.push(t),this.ixs.push(i),this.iys.push(r);let s=this.buckets.get(n);s||(s=new Map,this.buckets.set(n,s));let l=s.get(o);l||(l=[],s.set(o,l)),l.push(a)}}function Tg(e,t=1,i){const r=null!=i?new Sg(i):null;return e.map(e=>e.map((e,i)=>{const n=e.map(e=>{const i=e[0]*t,n=e[1]*t;if(r){const[e,t]=r.canonicalize(i,n);return new ke(e,t)}return new ke(Math.round(i),Math.round(n))});return i>0&&n.reverse(),n}))}class Dg{constructor(){this.frcCoverage=new Set,this.featureTriSegments=[],this.frcPerLevel=new Map,this.frcNonRoadSegments=new uh}empty(){return 0===this.frcCoverage.size}}function Mg(e,t,i){if(0===e.frcCoverage.size||0===e.featureTriSegments.length)return;const r=i.get(),n=t.uint16,o=[];e.featureTriSegments.sort((e,t)=>
vendor: 51,529 bytes, line 2
2e.segIdx!==t.segIdx?e.segIdx-t.segIdx:null===e.frc&&null===t.frc?0:null===e.frc?-1:null===t.frc?1:t.frc-e.frc);const a=new Map;let s=0,l=e.featureTriSegments[0].frc,c={vertexOffset:r[s].vertexOffset,primitiveOffset:0,vertexLength:r[s].vertexLength,primitiveLength:0,vaos:{},sortKey:void 0};const u=()=>{c.primitiveLength>0&&(a.has(l)||a.set(l,[]),a.get(l).push({...c}))};for(const h of e.featureTriSegments){h.segIdx!==s&&(u(),s=h.segIdx,l=h.frc,c={vertexOffset:r[s].vertexOffset,primitiveOffset:o.length/3,vertexLength:r[s].vertexLength,primitiveLength:0,vaos:{},sortKey:void 0}),h.frc!==l&&(u(),l=h.frc,c={...c,primitiveOffset:o.length/3,primitiveLength:0});for(let e=h.start;e<h.end;e++)o.push(n[e]);c.primitiveLength+=(h.end-h.start)/3}u();for(let h=0;h<o.length;h++)n[h]=o[h];for(const[h,d]of a)null!==h?e.frcPerLevel.set(h,new uh(d)):e.frcNonRoadSegments=new uh(d);e.featureTriSegments=[]}Rs(Dg,"FrcSegmentData");const Pg={motorway:0,motorway_link:0,trunk:1,trunk_link:1,primary:2,primary_link:2,secondary:3,secondary_link:3,tertiary:4,tertiary_link:4,unclassified:5,unclassified_link:5,street:6,street_limited:6,residential:6,service:7,living_street:7,pedestrian:8,track:8,path:8,footway:8,cycleway:8,sidewalk:8,crossing:8};function Cg(e){for(const t of["class","incident_class"]){const i=e[t];if("string"!=typeof i)continue;const r=Pg[i];if(void 0!==r)return r}return null}function Rg(e,t){return e.nextPoint.sub(t.at(-2)).unit()}function zg(e,t){return t[1].sub(e.prevPoint).unit()}Rs(class{constructor(e,t,i){this.elevationMode=t,t&&(this.elevationBufferData=new T_(e.layers,e.zoom,e.lut)),i&&(this.frcData=new Dg)}isEmpty(){const e=!this.elevationBufferData||this.elevationBufferData.isEmpty(),t=!this.frcData||this.frcData.empty();return e&&t}needsUpload(){return!!this.elevationBufferData&&this.elevationBufferData.needsUpload()}trackFeatureFrc(e){if(!this.frcData)return null;const t=Cg(e||{});return null!==t&&this.frcData.frcCoverage.add(t),t}recordFeatureRange(e,t,i,r){if(!this.frcData||i<=t)return;const n=e.bufferData.triangleSegments.get();this.frcData.featureTriSegments.push({start:3*t,end:3*i,segIdx:n.length>0?n.length-1:0,frc:r})}buildFrcSegments(e){this.frcData&&!this.frcData.empty()&&Mg(this.frcData,e.bufferData.indexArray,e.bufferData.triangleSegments)}handleFeature(e,t,i,r,n,o){const a=new Array;if(!this.elevationMode)return!1;const s=U_(e,n,void 0,r);if(!s)return!1;{const e=this.clipPolygonsToTile(t,1);e.length>0&&a.push({polygons:e,elevationFeature:s.feature,elevationTileID:s.tileId})}const l={guardRailEnabled:o.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(e,{},r),featureIndex:i};for(const c of a)if(c.elevationFeature){if("hd-road-base"===this.elevationMode){this.elevatedStructures||(this.elevatedStructures=new P_(c.elevationTileID,o.layers,o.zoom,o.lut));const t=c.elevationFeature.isTunnel();let i=0;Object.hasOwn(e.properties,Od)&&(i=+e.properties[Od]),this.elevatedStructures.addPortalCandidates(c.elevationFeature.id,c.polygons,t,c.elevationFeature,i)}null==c.elevationFeature.constantHeight&&(c.polygons=this.prepareElevatedPolygons(c.polygons,c.elevationFeature,c.elevationTileID));const t=new k_(r,c.elevationTileID);this.addElevatedGeometry(o,c.polygons,t,c.elevationFeature,"hd-road-base"===this.elevationMode?0:.05,i,l)}return!0}populatePaintArrays(e,t,i,r,n,o,a){this.elevationBufferData&&this.elevationBufferData.populatePaintArrays(e,t,i,r,n,o,a)}update(e,t,i,r,n,o,a,s){this.elevationBufferData&&this.elevationBufferData.update(e,t,i,r,n,o,a,s),this.elevatedStructures&&this.elevatedStructures.update(e,t,i,r,n,o,a,s)}updateExpressions(e){this.elevationBufferData&&this.elevationBufferData.programConfigurations.updateExpressions(e),this.elevatedStructures&&(this.elevatedStructures.bridgeProgramConfigurations.updateExpressions(e),this.elevatedStructures.tunnelProgramConfigurations.updateExpressions(e))}upload(e){this.elevationBufferData&&this.elevationBufferData.upload(e),this.elevatedStructures&&this.elevatedStructures.upload(e)}destroy(){this.elevationBufferData&&this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}setEvaluatedPortalGraph(e,t,i,r,n,o){this.elevatedStructures&&(this.elevatedStructures.construct(e),this.elevatedStructures.populatePaintArrays(t,i,r,n,o))}addElevatedGeometry(e,t,i,r,n,o,a){const s={elevation:r,elevationSampler:i,bias:n,index:o,featureInfo:a},[l,c]=e.addGeometry(t,this.elevationBufferData,s,this.elevatedStructures);null==this.elevationBufferData.heightRange?this.elevationBufferData.heightRange={min:l,max:c}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,l),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,c))}prepareElevatedPolygons(e,t,i){const r=1/qc(i),n=[];for(const o of e){const e=Eg(o,new O_(t,r),.1);n.push(...e)}return n}clipPolygonsToTile(e,t){const i=-t,r=-t,n=co+t,o=co+t;let a=0;const s=[],l=[];for(;a<e.length;a++){const t=e[a],c=et(t);(c.min.x>=i&&c.max.x<=n&&c.min.y>=r&&c.max.y<=o?s:l).push(t)}if(s.length===e.length)return e;const c=[new ke(i,r),new ke(n,r),new ke(n,o),new ke(i,o),new ke(i,r)],u=s;for(const h of l)u.push(...wg(h,c));return u}},"FillHDExtension"),Rs(P_,"ElevatedStructures"),Rs(class{constructor(e,t){this.elevationEnabled=e,this.hasDeferredElevationFeatures=!1,t&&(this.frcData=new Dg)}isEmpty(){const e=!this.elevationEnabled||void 0===this.heightRange,t=!this.frcData||this.frcData.empty();return e&&t}trackFeatureFrc(e){if(!this.frcData)return null;const t=Cg(e||{});return null!==t&&this.frcData.frcCoverage.add(t),t}recordFeatureRange(e,t,i,r){if(!this.frcData||i<=t)return;const n=e.segments.get();this.frcData.featureTriSegments.push({start:3*t,end:3*i,segIdx:n.length>0?n.length-1:0,frc:r})}buildFrcSegments(e){this.frcData&&!this.frcData.empty()&&Mg(this.frcData,e.indexArray,e.segments)}handleFeature(e,t,i,r,n,o,a,s,l,c,u){if(!this.elevationEnabled)return!1;if(!u.terrainEnabled){const h=U_(e,r,n?n.registry:void 0,i),d=null!=e.properties&&Object.hasOwn(e.properties,Fd)&&!Number.isNaN(+e.properties[Fd]);if(!h&&d&&o&&(!n||!n.allProvidersReady))return this.hasDeferredElevationFeatures=!0,!0;if(h){let r=h.feature,o=h.tileId;if(!h.tileId.equals(i)){const t=this.mergedFeatureCache?this.mergedFeatureCache.get(r.id):void 0;if(t)r=t,o=i;else{const t=function(e,t,i){if(!e.properties||!t||0===t.length)return[];const r=+e.properties[Fd];if(Number.isNaN(r))return[];const n=N_(t,r);if(n<0)return[];const o=[];for(let a=n;a<t.length&&t[a].feature.id===r;a++){const e=t[a];(e.tileId.isChildOf(i)||i.isChildOf(e.tileId)||null!=e.feature.constantHeight)&&o.push(e)}return o}(e,n?n.registry:void 0,i);t.length>1&&(r=function(e,t){const i=t.slice().sort((e,t)=>t.tileId.z-e.tileId.z),r=new ke(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),n=new ke(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY),o=[];for(const u of i){const t=new k_(u.tileId,e);for(const e of u.feature.vertices)o.push({position:t.pointTransform(e.position),height:e.height,extent:e.extent,index:e.index});const i=u.feature.safeArea;R_[0]=i.min.x,R_[1]=i.min.y,z_[0]=i.max.x,z_[1]=i.max.y,t.pointTransformInPlace(R_),t.pointTransformInPlace(z_),r.x=Math.min(r.x,R_[0],z_[0]),r.y=Math.min(r.y,R_[1],z_[1]),n.x=Math.max(n.x,R_[0],z_[0]),n.y=Math.max(n.y,R_[1],z_[1])}const a={min:r,max:n};if(null!=i[0].feature.constantHeight)return new B_(i[0].feature.id,a,i[0].feature.constantHeight);o.sort((e,t)=>e.index-t.index);const s=[];for(const u of o)0!==s.length&&s.at(-1).index===u.index||s.push(u);const l=[];for(let u=1;u<s.length;u++)s[u].index-s[u-1].index<=1&&l.push({a:u-1,b:u});const c=1/qc(e);return new B_(i[0].feature.id,a,void 0,s,l,c)}(i,t),o=i,this.mergedFeatureCache||(this.mergedFeatureCache=new Map),this.mergedFeatureCache.set(r.id,r))}}const d=Sd(t,-1,-1,8193,8193),p=this.prepareElevatedLines(d,r,o,i);for(const t of p){const n=u.layoutVertexArray.length;u.addLine(t,e,i,a,s,l,c);const h=new k_(i,o),d=u.showElevationIdDebug?V_(r.id):null;for(let e=n;e<u.layoutVertexArray.length;e++){const t=new ke(u.layoutVertexArray.int16[6*e]>>1,u.layoutVertexArray.int16[6*e+1]>>1),i=h.pointElevation(t,r,.05);this.updateHeightRange(i),e<u.zOffsetVertexArray.length?u.zOffsetVertexArray.float32[4*e]=i:u.zOffsetVertexArray.emplaceBack(i,0,0,0),d?e<u.elevationIdColVertexArray.length?(u.elevationIdColVertexArray.float32[3*e]=d[0],u.elevationIdColVertexArray.float32[3*e+1]=d[1],u.elevationIdColVertexArray.float32[3*e+2]=d[2]):u.elevationIdColVertexArray.emplaceBack(d[0],d[1],d[2]):u.showElevationIdDebug&&(e<u.elevationIdColVertexArray.length?(u.elevationIdColVertexArray.float32[3*e]=0,u.elevationIdColVertexArray.float32[3*e+1]=0,u.elevationIdColVertexArray.float32[3*e+2]=0):u.elevationIdColVertexArray.emplaceBack(0,0,0))}}return!0}if(d&&o&&n&&n.allProvidersReady&&n.hasCoveringTile)return!0}const h=!(!e.properties||!Object.hasOwn(e.properties,"mapbox_line_metrics"))&&e.properties.mapbox_line_metrics,d=u.layoutVertexArray.length,p=[],f=Sd(t,-1,-1,8193,8193,p);for(let m=0;m<f.length;m++){const t=f[m],r=p[m],n={progress:{min:r.progress.min,max:r.progress.max},nextDir:Rg(r,t),prevDir:zg(r,t)};u.addLine(t,e,i,a,s,l,c,n,h&&r.parentIndex>0?r.parentIndex:null)}return u.fillNonElevatedRoadSegment(d),!0}prepareElevatedLines(e,t,i,r){if(null!=t.constantHeight)return e;const n=[],o=1/qc(r),a=i.equals(r)?null:new k_(i,r);for(const s of e)Td(s,new O_(t,o,a),0,n);return n}updateHeightRange(e){this.heightRange?(this.heightRange.min=Math.min(this.heightRange.min,e),this.heightRange.max=Math.max(this.heightRange.max,e)):this.heightRange={min:e,max:e}}endPopulate(){this.mergedFeatureCache=void 0}},"LineHDExtension"),Rs(class{constructor(){this.elevatedLayoutVertexArray=new pu,this.hasElevation=!1}beginFeature(e,t,i){const r=U_(e,t,void 0,i);this.currentFeatureElevation=r?r.feature:void 0}writeVertexQuad(e,t){const i=this.currentFeatureElevation?this.currentFeatureElevation.pointElevation(new ke(e,t)):0;this.hasElevation=this.hasElevation||0!==i;for(let r=0;r<4;r++)this.elevatedLayoutVertexArray.emplaceBack(i)}finalize(){this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}upload(e){this.elevatedLayoutVertexArray&&!this.elevatedLayoutVertexBuffer&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,Gd.members))}destroy(){this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy()}},"CircleHDExtension");const Lg=(e,t,i,r)=>{for(let n=0;n<t;n++)e.emplaceBack(i[0],i[1],i[2],r[0],r[1],r[2])};Rs(class{constructor(){this.elevationFeatures=[],this.elevationFeatureTileIds=[],this.elevationFeatureIdToIndex=new Map,this.elevationStateComplete=!1,this.hasDeferredElevationFeatures=!1,this.elevationParams=null,this.crossSourceElevationEnabled=!1,this.terrainEnabled=!1}configureCrossSource(e,t,i,r){this.consumerCanonical=e,this.elevationParams=t,this.crossSourceElevationEnabled=i,this.terrainEnabled=r}addElevationFeatures(e,t){for(const i of e)this.elevationFeatureIdToIndex.set(i.id,this.elevationFeatures.length),this.elevationFeatures.push(i),this.elevationFeatureTileIds.push(t)}resolveRoadElevation(e,t){const i=this.elevationFeatureIdToIndex.get(t);if(void 0!==i)return i;if(this.terrainEnabled||!this.crossSourceElevationEnabled)return 65535;const r=U_(e,void 0,this.elevationParams?this.elevationParams.registry:void 0,this.consumerCanonical);if(r){const e=this.elevationFeatures.length;return this.elevationFeatureIdToIndex.set(t,e),this.elevationFeatures.push(r.feature),this.elevationFeatureTileIds.push(r.tileId),e}return this.elevationParams&&this.elevationParams.allProvidersReady?65535:(this.hasDeferredElevationFeatures=!0,"defer")}getElevationFeatureSampler(e,t){if(t.equals(e))return new k_(e,t);this.elevationFeatureSamplerCache||(this.elevationFeatureSamplerCache=new Map);let i=this.elevationFeatureSamplerCache.get(t.key);return i||(i=new k_(e,t),this.elevationFeatureSamplerCache.set(t.key,i)),i}isCrossTileRoadElevation(e,t){if(65535===e||e>=this.elevationFeatures.length)return!1;const i=this.elevationFeatureTileIds[e];return null!=i&&!i.equals(t)}getRoadFeatureHeightAtAnchor(e,t,i){if(65535===e||e>=this.elevationFeatures.length)return null;const r=this.elevationFeatures[e],n=this.elevationFeatureTileIds[e];return n.equals(i)?r.pointElevation(t):this.getElevationFeatureSampler(i,n).pointElevation(new ke(t.x,t.y),r,0)}sampleRoadFeatureHeight(e,t,i){const r=this.getRoadFeatureHeightAtAnchor(e,t,i);return null===r?void 0:r}clearWorkerState(){this.consumerCanonical=void 0,this.elevationParams=null,this.crossSourceElevationEnabled=!1,this.terrainEnabled=!1,this.elevationFeatureIdToIndex.clear()}updateRoadElevation(e,t){if(this.elevationStateComplete)return;this.elevationStateComplete=!0,e.hasAnyZOffset=!1;let i=!1;const r=qc(t),n=1/r;let o=!1,a=!1;for(let s=0;s<e.symbolInstances.length;s++){const l=e.symbolInstances.get(s),c=V(1,0,0),u=V(0,1,0),{numHorizontalGlyphVertices:h,numVerticalGlyphVertices:d,numIconVertices:p,numVerticalIconVertices:f}=l,m=h>0||d>0,_=p>0,g=l.elevationFeatureIndex,y=g<this.elevationFeatures.length?this.elevationFeatures[g]:void 0;if(y){const s=new ke(l.tileAnchorX,l.tileAnchorY),h=this.sampleRoadFeatureHeight(g,s,t),d=void 0!==h?.075+h:.075;l.zOffset!==d&&(i=!0,l.zOffset=d),0!==d&&(e.hasAnyZOffset=!0);const p=y.computeSlopeNormal(s,n),f=Se(_e(),V(0,0,1),p);ne(c,c,f),ne(u,u,f),c[2]*=r,u[2]*=r,1===c[0]&&0===c[1]&&0===c[2]&&0===u[0]&&1===u[1]&&0===u[2]||(o=o||m,a=a||_)}if(m&&(Lg(e.text.orientationVertexArray,h,c,u),Lg(e.text.orientationVertexArray,d,c,u)),_){const{placedIconSymbolIndex:t,verticalPlacedIconSymbolIndex:i}=l;t>=0&&Lg(e.icon.orientationVertexArray,p,c,u),i>=0&&Lg(e.icon.orientationVertexArray,f,c,u)}}o||(e.text.orientationVertexArray=void 0),a||(e.icon.orientationVertexArray=void 0),i&&(e.zOffsetBuffersNeedUpload=!0,e.zOffsetSortDirty=!0)}getRoadFeatureHeightForPlacedSymbol(e,t,i,r,n){const o=e.symbolInstances.get(t.symbolInstanceIndices[i]);return this.getRoadFeatureHeightAtAnchor(o.elevationFeatureIndex,r,n)}getElevationFeatureForPlacedSymbol(e,t,i){const r=e.symbolInstances.get(t.symbolInstanceIndices[i]).elevationFeatureIndex;if(r<this.elevationFeatures.length)return this.elevationFeatures[r]}makeRoadSymbolElevationParams(e,t,i,r,n,o,a,s,l){const c=this.getElevationFeatureForPlacedSymbol(e,t,i),u=void 0!==c?c:null,h=e.symbolInstances.get(t.symbolInstanceIndices[i]);return this.isCrossTileRoadElevation(h.elevationFeatureIndex,r.canonical)?{getElevation:n=>{const o=this.getRoadFeatureHeightForPlacedSymbol(e,t,i,n,r.canonical);return function(e,t,i,r,n,o){const a=r.upVector(t,i.x,i.y);return W(a,a,e*r.upVectorScale(t,n,o).metersToTile),[a[0],a[1],a[2]]}(null!==o?o:0,r.canonical,n,a,s,l)},elevation:o,elevationFeature:null}:{getElevation:n,elevation:o,elevationFeature:u}}},"SymbolHDExtension",{omit:["consumerCanonical","elevationParams","crossSourceElevationEnabled","terrainEnabled","hasDeferredElevationFeatures","elevationFeatureIdToIndex"]});let Fg=null,Og=null,Bg=null,kg=null;const Vg=5120,Ng=5121,Ug=5122,jg=5123,Gg=5125,Hg=5126,$g={[Vg]:Int8Array,[Ng]:Uint8Array,[Ug]:Int16Array,[jg]:Uint16Array,[Gg]:Uint32Array,[Hg]:Float32Array},Wg={[Vg]:"DT_INT8",[Ng]:"DT_UINT8",[Ug]:"DT_INT16",[jg]:"DT_UINT16",[Gg]:"DT_UINT32",[Hg]:"DT_FLOAT32"},qg={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function Zg(e,t,i){const r=i.json.bufferViews.length,n=i.buffers.length;t.bufferView=r,i.json.bufferViews[r]={buffer:n,byteLength:e.byteLength},i.buffers[n]=e}const Xg="KHR_draco_mesh_compression";function Yg(e,t){const i=e.extensions&&e.extensions[Xg];if(!i)return;const r=new Fg.Decoder,n=iy(t,i.bufferView),o=new Fg.Mesh;if(!r.DecodeArrayToMesh(n,n.byteLength,o))throw new Error("Failed to decode Draco mesh");const a=t.json.accessors[e.indices],s=$g[a.componentType],l=a.count*s.BYTES_PER_ELEMENT,c=Fg._malloc(l);s===Uint16Array?r.GetTrianglesUInt16Array(o,l,c):r.GetTrianglesUInt32Array(o,l,c),Zg(Fg.memory.buffer.slice(c,c+l),a,t),Fg._free(c);for(const u of Object.keys(i.attributes)){const n=r.GetAttributeByUniqueId(o,i.attributes[u]),a=t.json.accessors[e.attributes[u]],s=Wg[a.componentType],l=a.count*qg[a.type]*$g[a.componentType].BYTES_PER_ELEMENT,c=Fg._malloc(l);r.GetAttributeDataArrayForAllPoints(o,n,Fg[s],l,c),Zg(Fg.memory.buffer.slice(c,c+l),a,t),Fg._free(c)}r.destroy(),o.destroy(),delete e.extensions[Xg]}const Kg="EXT_meshopt_compression";function Jg(e,t){if(!e.extensions||!e.extensions[Kg])return;const i=e.extensions[Kg],r=new Uint8Array(t.buffers[i.buffer],i.byteOffset||0,i.byteLength||0),n=new Uint8Array(i.count*i.byteStride);Bg.decodeGltfBuffer(n,i.count,i.byteStride,r,i.mode,i.filter),e.buffer=t.buffers.length,e.byteOffset=0,t.buffers[e.buffer]=n.buffer,delete e.extensions[Kg]}const Qg=new TextDecoder("utf8");function ey(e,t){return new URL(e,t).href}async function ty(e,t,i,r,n){const o=await fetch(ey(e.uri,r),{signal:n}),a=await o.arrayBuffer();t.buffers[i]=a}function iy(e,t){const i=e.json.bufferViews[t];return new Uint8Array(e.buffers[i.buffer],i.byteOffset||0,i.byteLength)}async function ry(e,t,i,r,n){if(e.uri){const o=ey(e.uri,r),a=await fetch(o,{signal:n}),s=await a.blob(),l=await createImageBitmap(s);t.images[i]=l}else if(void 0!==e.bufferView){const r=iy(t,e.bufferView),n=new Blob([r],{type:e.mimeType}),o=await createImageBitmap(n);t.images[i]=o}}async function ny(e,t){const{data:i}=await Wi({url:e},t);return async function(e,t=0,i,r){const n={json:null,images:[],buffers:[]};if(1179937895===new Uint32Array(e,t,1)[0]){const i=new Uint32Array(e,t);let r=2;const o=(i[r++]>>2)-3,a=i[r++]>>2;if(r++,n.json=JSON.parse(Qg.decode(i.subarray(r,r+a))),r+=a,r<o){const o=i[r++];r++;const a=t+(r<<2);n.buffers[0]=e.slice(a,a+o)}}else n.json=JSON.parse(Qg.decode(new Uint8Array(e,t)));const{buffers:o,images:a,meshes:s,extensionsUsed:l,bufferViews:c}=n.json;if(o){const e=[];for(let t=0;t<o.length;t++){const a=o[t];a.uri?e.push(ty(a,n,t,i,r)):n.buffers[t]||(n.buffers[t]=null)}await Promise.all(e)}r&&r.throwIfAborted();const u=[],h=l&&l.includes(Xg),d=l&&l.includes(Kg);if(h&&u.push(function(){if(!Fg)return null!=Og||(Og=function(e){let t,i=null;function r(){t=new Uint8Array(i.buffer)}function n(){throw new Error("Unexpected Draco error.")}return WebAssembly.instantiateStreaming(e,{a:{a:n,d:function(e,i,r){return t.copyWithin(e,i,i+r)},c:function(e){const n=t.length,o=Math.max(e>>>0,Math.ceil(1.2*n)),a=Math.ceil((o-n)/65536);try{return i.grow(a),r(),!0}catch(e){return!1}},b:n}}).then(e=>{const{Rb:n,Qb:o,P:a,T:s,X:l,Ja:c,La:u,Qa:h,Va:d,Wa:p,eb:f,jb:m,f:_,e:g,yb:y,zb:x,Ab:v,Bb:b,Db:w,Gb:E}=e.instance.exports;i=g;const A=(()=>{let e=0,i=0,r=0,a=0;return s=>{r&&(n(a),n(e),i+=r,r=e=0),e||(i+=128,e=o(i));const l=s.length+7&-8;let c=e;l>=i&&(r=l,c=a=o(l));for(let e=0;e<s.length;e++)t[c+e]=s[e];return c}})();return r(),_(),{memory:g,_free:n,_malloc:o,Mesh:class{constructor(){this.ptr=a()}destroy(){s(this.ptr)}},Decoder:class{constructor(){this.ptr=c()}destroy(){m(this.ptr)}DecodeArrayToMesh(e,t,i){const r=A(e),n=u(this.ptr,r,t,i.ptr);return!!l(n)}GetAttributeByUniqueId(e,t){return{ptr:h(this.ptr,e.ptr,t)}}GetTrianglesUInt16Array(e,t,i){d(this.ptr,e.ptr,t,i)}GetTrianglesUInt32Array(e,t,i){p(this.ptr,e.ptr,t,i)}GetAttributeDataArrayForAllPoints(e,t,i,r,n){f(this.ptr,e.ptr,t.ptr,i,r,n)}},DT_INT8:y(),DT_UINT8:x(),DT_INT16:v(),DT_UINT16:b(),DT_UINT32:w(),DT_FLOAT32:E()}})}(fetch(yi())).then(e=>{Fg=e,Og=null})),Og}()),d&&u.push(function(){var e;if(!Bg)return null!=kg||(kg=(e=fetch(xi()),WebAssembly.instantiateStreaming(e,{}).then(e=>{const{sbrk:t,memory:i,meshopt_decodeVertexBuffer:r,meshopt_decodeIndexBuffer:n,meshopt_decodeIndexSequence:o,meshopt_decodeFilterOct:a,meshopt_decodeFilterQuat:s,meshopt_decodeFilterExp:l}=e.instance.exports,c={ATTRIBUTES:r,TRIANGLES:n,INDICES:o},u={OCTAHEDRAL:a,QUATERNION:s,EXPONENTIAL:l};return e.instance.exports.__wasm_call_ctors(),{decodeGltfBuffer(e,r,n,o,a,s){const l=r+3&-4,h=t(l*n),d=t(o.length),p=new Uint8Array(i.buffer);p.set(o,d);const f=c[a](h,r,n,d,o.length);if(0===f&&u[s]&&u[s](h,l,n),e.set(p.subarray(h,h+r*n)),t(h-t(0)),0!==f)throw new Error(`Malformed buffer data: ${f}`)}}})).then(e=>{Bg=e,kg=null})),kg}()),a)for(let p=0;p<a.length;p++)u.push(ry(a[p],n,p,i,r));if(u.length&&await Promise.all(u),r&&r.throwIfAborted(),h&&s)for(const{primitives:p}of s)for(const e of p)Yg(e,n);if(d&&s&&c)for(const p of c)Jg(p,n);return n}(i,0,e,t)}class oy{constructor(e,t,i,r){if(this.triangleCount=t.length/3,this.min=new ke(0,0),this.max=new ke(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],0===this.triangleCount||0===e.length)return;const[n,o]=[e[0].clone(),e[0].clone()];for(let u=1;u<e.length;++u){const t=e[u];n.x=Math.min(n.x,t.x),n.y=Math.min(n.y,t.y),o.x=Math.max(o.x,t.x),o.y=Math.max(o.y,t.y)}if(r){const e=Math.ceil(Math.max(o.x-n.x,o.y-n.y)/r);i=Math.max(i,e)}if(0===i)return;this.min=n,this.max=o;const a=this.max.sub(this.min);a.x=Math.max(a.x,1),a.y=Math.max(a.y,1);const s=Math.max(a.x,a.y)/i;this.cellsX=Math.max(1,Math.ceil(a.x/s)),this.cellsY=Math.max(1,Math.ceil(a.y/s)),this.xScale=1/s,this.yScale=1/s;const l=[];for(let u=0;u<this.triangleCount;u++){const i=e[t[3*u+0]].sub(this.min),r=e[t[3*u+1]].sub(this.min),n=e[t[3*u+2]].sub(this.min),o=ay(Math.floor(Math.min(i.x,r.x,n.x)),this.xScale,this.cellsX),a=ay(Math.floor(Math.max(i.x,r.x,n.x)),this.xScale,this.cellsX),c=ay(Math.floor(Math.min(i.y,r.y,n.y)),this.yScale,this.cellsY),h=ay(Math.floor(Math.max(i.y,r.y,n.y)),this.yScale,this.cellsY),d=new ke(0,0),p=new ke(0,0),f=new ke(0,0),m=new ke(0,0);for(let e=c;e<=h;++e){d.y=p.y=e*s,f.y=m.y=(e+1)*s;for(let t=o;t<=a;++t)d.x=f.x=t*s,p.x=m.x=(t+1)*s,(bd(i,r,n,d,p,m)||bd(i,r,n,d,m,f))&&l.push({cellIdx:e*this.cellsX+t,triIdx:u})}}if(0===l.length)return;l.sort((e,t)=>e.cellIdx-t.cellIdx||e.triIdx-t.triIdx);let c=0;for(;c<l.length;){const e=l[c].cellIdx,t={start:this.payload.length,len:0};for(;c<l.length&&l[c].cellIdx===e;)++t.len,this.payload.push(l[c++].triIdx);this.cells[e]=t}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(e,t){if(0===this.triangleCount||0===this.cells.length)return;if(e.x>this.max.x||this.min.x>e.x||e.y>this.max.y||this.min.y>e.y)return;const i=ay(e.x-this.min.x,this.xScale,this.cellsX),r=ay(e.y-this.min.y,this.yScale,this.cellsY),n=this.cells[r*this.cellsX+i];if(n){this._lazyInitLookup();for(let e=0;e<n.len;e++){const i=this.payload[n.start+e],r=Math.floor(i/8),o=1<<i%8;if(!(this.lookup[r]&o)&&(this.lookup[r]|=o,t.push(i),t.length===this.triangleCount))return}}}query(e,t,i){if(0===this.triangleCount||0===this.cells.length)return;if(e.x>this.max.x||this.min.x>t.x)return;if(e.y>this.max.y||this.min.y>t.y)return;this._lazyInitLookup();const r=ay(e.x-this.min.x,this.xScale,this.cellsX),n=ay(t.x-this.min.x,this.xScale,this.cellsX),o=ay(e.y-this.min.y,this.yScale,this.cellsY),a=ay(t.y-this.min.y,this.yScale,this.cellsY);for(let s=o;s<=a;s++)for(let e=r;e<=n;e++){const t=this.cells[s*this.cellsX+e];if(t)for(let e=0;e<t.len;e++){const r=this.payload[t.start+e],n=Math.floor(r/8),o=1<<r%8;if(!(this.lookup[n]&o)&&(this.lookup[n]|=o,i.push(r),i.length===this.triangleCount))return}}}}function ay(e,t,i){return Math.max(0,Math.min(i-1,Math.floor(e*t)))}Rs(oy,"TriangleGridIndex");const sy=lu([{name:"a_pos_3f",components:3,type:"Float32"}]),ly=lu([{name:"a_color_3f",components:3,type:"Float32"}]),cy=lu([{name:"a_color_4f",components:4,type:"Float32"}]),uy=lu([{name:"a_uv_2f",components:2,type:"Float32"}]),hy=lu([{name:"a_uv_2f",components:2,type:"Uint16",normalized:!0}]),dy=lu([{name:"a_normal_4n",components:4,type:"Int8",normalized:!0}]),py=lu([{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"}]),fy=lu([{name:"a_feature",components:2,type:"Uint16"}]);function my(e,t){const i=gy(e.projection,e.zoom,e.width,e.height),r=function(e,t,i,r,n){const o=new kc(i.lng-180*yy,i.lat),a=new kc(i.lng+180*yy,i.lat),s=e.project(o.lng,o.lat),l=e.project(a.lng,a.lat),c=-Math.atan2(l.y-s.y,l.x-s.x),u=Zc.fromLngLat(i);u.y=ht(u.y,-1+yy,1-yy);const h=u.toLngLat(),d=e.project(h.lng,h.lat),p=Zc.fromLngLat(h);p.x+=yy;const f=p.toLngLat(),m=e.project(f.lng,f.lat),g=vy(m.x-d.x,m.y-d.y,c),y=Zc.fromLngLat(h);y.y+=yy;const v=y.toLngLat(),w=e.project(v.lng,v.lat),E=vy(w.x-d.x,w.y-d.y,c),I=Math.abs(g.x)/Math.abs(E.y),S=_([]);A(S,S,-c*(1-(n?0:r)));const T=_([]);return b(T,T,[1,1-(1-I)*r,1]),T[4]=-E.x/E.y*r,A(T,T,c),x(T,S,T),T}(e.projection,0,e.center,i,t),n=_y(e);return b(r,r,[n,n,1]),r}function _y(e){const t=e.projection,i=gy(e.projection,e.zoom,e.width,e.height),r=xy(t,e.center),n=xy(t,kc.convert(t.center));return Math.pow(2,r*i+(1-i)*n)}function gy(e,t,i,r,n=1/0){const o=e.range;if(!o)return 0;const a=Math.min(n,Math.max(i,r)),s=Math.log2(a/1024);return dt(o[0]+s,o[1]+s,t)}const yy=1/4e4;function xy(e,t){const i=ht(t.lat,-85.051129,Gc),r=new kc(t.lng-180*yy,i),n=new kc(t.lng+180*yy,i),o=e.project(r.lng,i),a=e.project(n.lng,i),s=Zc.fromLngLat(r),l=Zc.fromLngLat(n),c=a.x-o.x,u=a.y-o.y,h=l.x-s.x,d=l.y-s.y,p=Math.sqrt((h*h+d*d)/(c*c+u*u));return Math.log2(p)}function vy(e,t,i){const r=Math.cos(i),n=Math.sin(i);return{x:e*r-t*n,y:e*n+t*r}}const by=new Float64Array([1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1]);function wy(e,t,i){_(e),A(e,e,nt(t[2])),w(e,e,nt(t[0])),E(e,e,nt(t[1])),b(e,e,i),x(e,e,by)}function Ey(e,t,i,r,n,o,a,s){const l=[i[0]-t[0],i[1]-t[1],0],c=[r[0]-t[0],r[1]-t[1],0];if(k(l)<1e-12||k(c)<1e-12)return ge(e);const u=ee([],l,c);J(u,u),j(c,r,t),l[2]=(o-n)*s,c[2]=(a-n)*s;const h=l;return ee(h,l,c),J(h,h),Se(e,u,h)}function Ay(e,t,i=!1){const r=mf(t.zoom),n=function(e,t,i){const r=t.worldSize,n=[e[12],e[13],e[14]],o=Xn(n[1]/r),a=Zn(n[0]/r),s=_([]),l=Uc(1,o)*r,c=Uc(1,0)*r*$c(o,t.zoom),u=1/hf(r);let h=c*u;if(i){const e=gy(t.projection,t.zoom,t.width,t.height,1024);h=u*t.projection.pixelSpaceConversion(t.center.lat,r,e)}const d=Fc(o,a);U(d,d,W([],J([],d),l*h*n[2]));const p=function(e){const t=[e[0],e[1],e[2]];let i=[0,1,0];const r=ee([],i,t);return ee(i,t,r),0===Y(i)&&(i=[0,1,0],ee(r,t,i)),J(r,r),J(i,i),J(t,t),[r[0],r[1],r[2],0,i[0],i[1],i[2],0,t[0],t[1],t[2],0,e[0],e[1],e[2],1]}(d);b(s,s,[h,h,h*l]),v(s,s,[-n[0],-n[1],-n[2]]);const f=x([],t.globeMatrix,p);return x(f,f,s),x(f,f,e),f}(e,t,i);if(r>0){const i=function(e,t){const i=t.worldSize,r=Uc(1,0)*i*$c(t.center.lat,t.zoom)/hf(i),n=Uc(1,t.center.lat)*i,o=_([]);E(o,o,nt(t.center.lng)),w(o,o,nt(t.center.lat)),v(o,o,[0,0,Mc]),b(o,o,[r,r,r*n]);const a=t.point;return v(o,o,[-a.x,-a.y,0]),x(o,o,e),x(o,t.globeMatrix,o)}(e,t);return function(e,t,i){const r=(e,t,i)=>{const r=k(e),n=k(t),o=Qp(e,t,i);return W(o,o,1/k(o)*Wr(r,n,i))},n=r([e[0],e[1],e[2]],[t[0],t[1],t[2]],i),o=r([e[4],e[5],e[6]],[t[4],t[5],t[6]],i),a=r([e[8],e[9],e[10]],[t[8],t[9],t[10]],i),s=Qp([e[12],e[13],e[14]],[t[12],t[13],t[14]],i);return[n[0],n[1],n[2],0,o[0],o[1],o[2],0,a[0],a[1],a[2],0,s[0],s[1],s[2],1]}(n,i,r)}return n}function Iy(e,t,i,r){const n=Wp.projectAabbCorners(r,i);let o=Number.MAX_VALUE;for(let s=0;s<n.length;++s){const e=n[s];e[0]=(.5*e[0]+.5)*t.width,e[1]=(.5-.5*e[1])*t.height,e[2]<o&&(o=e[2])}const a=function(e){const t=[];let i=0;for(let a=1;a<e.length;a++)(e[a][0]<e[i][0]||e[a][0]===e[i][0]&&e[a][1]<e[i][1])&&(i=a);let r,n=i;const o=new Uint8Array(e.length);do{if(o[n])break;t.push(new ke(e[n][0],e[n][1])),o[n]=1,r=(n+1)%e.length;for(let t=0;t<e.length;t++){if(e[t][0]===e[r][0]&&e[t][1]===e[r][1]||e[t][0]===e[n][0]&&e[t][1]===e[n][1])continue;const i=[e[t][0]-e[n][0],e[t][1]-e[n][1]],o=[e[r][0]-e[n][0],e[r][1]-e[n][1]],a=i[0]*o[1]-i[1]*o[0];(a>0||0===a&&i[0]*o[0]+i[1]*o[1]>=0&&i[0]*i[0]+i[1]*i[1]>o[0]*o[0]+o[1]*o[1])&&(r=t)}n=r}while(n!==i);return t.length>0&&t.push(t[0]),t}(n);if(ad(e,a))return o}const Sy=["","wall","door","roof","window","lamp","logo"],Ty=[1,1,1];function Dy(e,t,i,r,n,o,a,s,l,c=!1){const u=i.zoom,h=i.project(r),d=$c(r.lat,u),p=1/d;_(e),v(e,e,[h.x+a[0]*p,h.y+a[1]*p,a[2]]);let f=1,m=1;const g=i.worldSize;if(c){if("mercator"===i.projection.name){let e=0;i.elevation&&(e=i.elevation.getAtPointOrZero(new Zc(h.x/g,h.y/g),0));const t=me([],[h.x,h.y,e,1],i.projMatrix)[3]/i.cameraToCenterDistance;f=t,m=t*$c(i.center.lat,u)}else if("globe"===i.projection.name){const t=Ay(e,i),n=[0,0,0,1];me(n,n,x([],i.projMatrix,t));const o=n[3]/i.cameraToCenterDistance,a=mf(u),s=i.projection.pixelsPerMeter(r.lat,g)*$c(r.lat,u),l=i.projection.pixelsPerMeter(i.center.lat,g)*$c(i.center.lat,u);f=o/Wr(s,Hc(i.center.lat),a),m=o*d/s,f*=l,m*=l}}else f=p;b(e,e,[f,f,m]);const y=[...e],w=t.orientation,E=[];if(wy(E,[w[0]+(n?n[0]:0),w[1]+(n?n[1]:0),w[2]+(n?n[2]:0)],o),x(e,y,E),s&&i.elevation){let n=0;const o=[];if(l&&i.elevation){n=function(e,t,i,r,n){const o=t.elevation;if(!o)return 0;const a=Wp.projectAabbCorners(i,r),s=Uc(1,n.lat)*t.worldSize,l=function(e,t){const i=[0,0,1],r=[{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 n of r){const r=e[n.corners[0]],o=e[n.corners[1]],a=e[n.corners[2]],s=[o[0]-r[0],o[1]-r[1],t*(o[2]-r[2])],l=ee(s,s,[a[0]-r[0],a[1]-r[1],t*(a[2]-r[2])]);J(l,l),n.dotProductWithUp=Q(l,i)}return r.sort((e,t)=>e.dotProductWithUp-t.dotProductWithUp),r[0].corners}(a,s),c=a[l[0]],u=a[l[1]],h=a[l[2]],d=a[l[3]],p=o.getAtPointOrZero(new Zc(c[0]/t.worldSize,c[1]/t.worldSize),0),f=o.getAtPointOrZero(new Zc(u[0]/t.worldSize,u[1]/t.worldSize),0),m=o.getAtPointOrZero(new Zc(h[0]/t.worldSize,h[1]/t.worldSize),0),_=o.getAtPointOrZero(new Zc(d[0]/t.worldSize,d[1]/t.worldSize),0),g=(p+_)/2,y=(f+m)/2;return g>y?f<m?Ey(e,u,d,c,f,_,p,s):Ey(e,h,c,d,m,p,_,s):p<_?Ey(e,c,u,h,p,f,m,s):Ey(e,d,h,u,_,m,f,s),Math.max(g,y)}(o,i,t.aabb,e,r);const a=x([],R([],o),E);x(e,y,a)}else n=i.elevation.getAtPointOrZero(new Zc(h.x/g,h.y/g),0);0!==n&&(e[14]+=n)}}class My{constructor(e,t,i,r,n){this.materialOverrides=new Map,this.nodeOverrides=new Map,this.materialOverrideNames=[],this.nodeOverrideNames=[],this.featureProperties={},this.id=e,this.uri=t,this.position=null!=i?new kc(i[0],i[1]):new kc(0,0),this.orientation=r??[0,0,0],this.nodes=n,this.uploaded=!1,this.aabb=new Wp([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(e,t){x(e.globalMatrix,t,e.localMatrix);const i=this.nodeOverrides.get(e.name);if(void 0!==i){if(i.orientation){const t=[];n=i.orientation,_(r=t),E(r,r,nt(n[1])),A(r,r,nt(n[2])),w(r,r,nt(n[0])),x(e.globalMatrix,e.globalMatrix,t)}i.minZoom&&(e.minZoom=i.minZoom),i.maxZoom&&(e.maxZoom=i.maxZoom)}var r,n;if(e.meshes)for(const o of e.meshes){const t=Wp.applyTransformFast(o.aabb,e.globalMatrix);this.aabb.encapsulate(t)}if(e.children)for(const o of e.children)this._applyTransformations(o,e.globalMatrix)}computeBoundsAndApplyParent(){const e=_([]);this.aabb=new Wp([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const t of this.nodes)this._applyTransformations(t,e)}computeModelMatrix(e,t,i,r,n,o,a=!1){Dy(this.matrix,this,e.transform,this.position,t,i,r,n,o,a)}upload(e){if(!this.uploaded){for(const t of this.nodes)Ry(t,e);for(const e of this.nodes)Ly(e);this.uploaded=!0}}destroy(){for(const e of this.nodes)Oy(e)}}function Py(e,t,i=!1){e.uploaded||(e.gfxTexture=new $m(t,e.image,i?t.gl.R8:t.gl.RGBA8,{useMipmap:e.sampler.minFilter>=t.gl.NEAREST_MIPMAP_NEAREST}),e.uploaded=!0,e.image=null)}function Cy(e,t,i){e.indexBuffer=t.createIndexBuffer(e.indexArray,!1,!0),e.vertexBuffer=t.createVertexBuffer(e.vertexArray,sy.members,!1,!0),e.normalArray&&(e.normalBuffer=t.createVertexBuffer(e.normalArray,dy.members,!1,!0)),e.texcoordArray&&(e.texcoordBuffer=t.createVertexBuffer(e.texcoordArray,(8===e.texcoordArray.bytesPerElement?uy:hy).members,!1,!0)),e.colorArray&&(e.colorBuffer=t.createVertexBuffer(e.colorArray,(12===e.colorArray.bytesPerElement?ly:cy).members,!1,!0)),e.featureArray&&(e.featureBuffer=t.createVertexBuffer(e.featureArray,fy.members,!1,!0)),e.segments=uh.simpleSegment(0,0,e.vertexArray.length,e.indexArray.length);const r=e.material;r.pbrMetallicRoughness.baseColorTexture&&Py(r.pbrMetallicRoughness.baseColorTexture,t),r.pbrMetallicRoughness.metallicRoughnessTexture&&Py(r.pbrMetallicRoughness.metallicRoughnessTexture,t),r.normalTexture&&Py(r.normalTexture,t),r.occlusionTexture&&Py(r.occlusionTexture,t,i),r.emissionTexture&&Py(r.emissionTexture,t)}function Ry(e,t,i){if(e.meshes)for(const r of e.meshes)Cy(r,t,i);if(e.lodMeshes)for(const r of e.lodMeshes)Cy(r,t,i);if(e.children)for(const r of e.children)Ry(r,t,i)}function zy(e){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()}function Ly(e){if(e.meshes)for(const t of e.meshes)zy(t);if(e.lodMeshes)for(const t of e.lodMeshes)zy(t);if(e.children)for(const t of e.children)Ly(t)}function Fy(e){var t;e.vertexBuffer&&(e.vertexBuffer.destroy(),e.indexBuffer.destroy(),e.normalBuffer&&e.normalBuffer.destroy(),e.texcoordBuffer&&e.texcoordBuffer.destroy(),e.colorBuffer&&e.colorBuffer.destroy(),e.featureBuffer&&e.featureBuffer.destroy(),e.segments.destroy(),e.material&&((t=e.material).pbrMetallicRoughness.baseColorTexture&&t.pbrMetallicRoughness.baseColorTexture.gfxTexture&&t.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),t.pbrMetallicRoughness.metallicRoughnessTexture&&t.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&t.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),t.normalTexture&&t.normalTexture.gfxTexture&&t.normalTexture.gfxTexture.destroy(),t.emissionTexture&&t.emissionTexture.gfxTexture&&t.emissionTexture.gfxTexture.destroy(),t.occlusionTexture&&t.occlusionTexture.gfxTexture&&t.occlusionTexture.gfxTexture.destroy()))}function Oy(e){if(e.meshes)for(const t of e.meshes)Fy(t);if(e.lodMeshes)for(const t of e.lodMeshes)Fy(t);if(e.footprintDebugMesh&&(e.footprintDebugMesh.vertexBuffer.destroy(),e.footprintDebugMesh.indexBuffer.destroy(),e.footprintDebugMesh.segments.destroy()),e.children)for(const t of e.children)Oy(t)}function By(e,t,i,r){return e[0]<=r[0]&&t[0]>=i[0]&&e[1]<=r[1]&&t[1]>=i[1]&&e[2]<=r[2]&&t[2]>=i[2]}function ky(e,t,i,r,n,o,a,s,l,c,u){const h=.5*(c[0]+u[0]),d=.5*(c[1]+u[1]),p=.5*(c[2]+u[2]),f=.5*(u[0]-c[0]),m=.5*(u[1]-c[1]),_=.5*(u[2]-c[2]),g=e-h,y=t-d,x=i-p,v=r-h,b=n-d,w=o-p,E=a-h,A=s-d,I=l-p,S=v-g,T=b-y,D=w-x,M=E-v,P=A-b,C=I-w,R=g-E,z=y-A,L=x-I;let F,O,B,k,V,N;if(F=x*T-y*D,O=w*T-b*D,B=I*T-A*D,k=Math.min(F,O,B),V=Math.max(F,O,B),N=Math.abs(D)*m+Math.abs(T)*_,k>N||V<-N)return!1;if(F=x*P-y*C,O=w*P-b*C,B=I*P-A*C,k=Math.min(F,O,B),V=Math.max(F,O,B),N=Math.abs(C)*m+Math.abs(P)*_,k>N||V<-N)return!1;if(F=x*z-y*L,O=w*z-b*L,B=I*z-A*L,k=Math.min(F,O,B),V=Math.max(F,O,B),N=Math.abs(L)*m+Math.abs(z)*_,k>N||V<-N)return!1;if(F=g*D-x*S,O=v*D-w*S,B=E*D-I*S,k=Math.min(F,O,B),V=Math.max(F,O,B),N=Math.abs(D)*f+Math.abs(S)*_,k>N||V<-N)return!1;if(F=g*C-x*M,O=v*C-w*M,B=E*C-I*M,k=Math.min(F,O,B),V=Math.max(F,O,B),N=Math.abs(C)*f+Math.abs(M)*_,k>N||V<-N)return!1;if(F=g*L-x*R,O=v*L-w*R,B=E*L-I*R,k=Math.min(F,O,B),V=Math.max(F,O,B),N=Math.abs(L)*f+Math.abs(R)*_,k>N||V<-N)return!1;if(F=y*S-g*T,O=b*S-v*T,B=A*S-E*T,k=Math.min(F,O,B),V=Math.max(F,O,B),N=Math.abs(T)*f+Math.abs(S)*m,k>N||V<-N)return!1;if(F=y*M-g*P,O=b*M-v*P,B=A*M-E*P,k=Math.min(F,O,B),V=Math.max(F,O,B),N=Math.abs(P)*f+Math.abs(M)*m,k>N||V<-N)return!1;if(F=y*R-g*z,O=b*R-v*z,B=A*R-E*z,k=Math.min(F,O,B),V=Math.max(F,O,B),N=Math.abs(z)*f+Math.abs(R)*m,k>N||V<-N)return!1;if(k=Math.min(g,v,E),V=Math.max(g,v,E),k>f||V<-f)return!1;if(k=Math.min(y,b,A),V=Math.max(y,b,A),k>m||V<-m)return!1;if(k=Math.min(x,w,I),V=Math.max(x,w,I),k>_||V<-_)return!1;const U=T*C-D*P,j=D*M-S*C,G=S*P-T*M,H=-(U*g+j*y+G*x);return N=f*Math.abs(U)+m*Math.abs(j)+_*Math.abs(G),!(Math.abs(H)>N)}const Vy=[];class Ny{serializeFromGltf(e,t,i,r){if(e.length<7)return;let n=0;if(109!==e[n++]||98!==e[n++]||120!==e[n++]||98!==e[n++]||118!==e[n++]||104!==e[n++])return;if(43!==e[n++])return;const o=new DataView(e.buffer,e.byteOffset),a=o.getUint16(n,!0);if(n+=2,0===a)return;this._nodes=[];let s=0;for(let c=0;c<a;c++){const e=[t[3*s],t[3*s+1],t[3*s+2]],r=[i[3*s],i[3*s+1],i[3*s+2]];s++;const a=o.getUint16(n,!0);n+=2;let l=0,c=0;65535===a&&(l=o.getUint16(n,!0),n+=2,c=o.getUint32(n,!0),n+=4),this._nodes.push({aabbMin:e,aabbMax:r,backChild:a,indexCount:l,indexOffset:c})}const l=o.getUint32(n,!0);this._indices=r.slice(0,l)}setVertices(e){this._vertices=e}findHighestPoint(e,t){if(!this._nodes||0===this._nodes.length)return null;if(!By(this._nodes[0].aabbMin,this._nodes[0].aabbMax,e,t))return null;const i=Vy;i.length=0,i.push(0);let r=-1/0;for(;i.length>0;){const n=i.pop(),o=this._nodes[n];if(o.aabbMax[2]<=r)continue;if(65535===o.backChild){for(let i=0;i<o.indexCount;i+=3){const n=3*this._indices[o.indexOffset+i],a=3*this._indices[o.indexOffset+i+1],s=3*this._indices[o.indexOffset+i+2];ky(this._vertices[n],this._vertices[n+1],this._vertices[n+2],this._vertices[a],this._vertices[a+1],this._vertices[a+2],this._vertices[s],this._vertices[s+1],this._vertices[s+2],e,t)&&(r=Math.max(r,this._vertices[n+2],this._vertices[a+2],this._vertices[s+2]))}continue}const a=n+1,s=o.backChild,l=this._nodes[a],c=this._nodes[s],u=By(l.aabbMin,l.aabbMax,e,t),h=By(c.aabbMin,c.aabbMax,e,t);u&&h?l.aabbMax[2]<c.aabbMax[2]?(i.push(a),i.push(s)):(i.push(s),i.push(a)):u?i.push(a):h&&i.push(s)}return r>=0?r:null}}function Uy(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}function jy(e,t){const i=e.json.bufferViews[t.bufferView],r=$g[t.componentType];return new r(e.buffers[i.buffer],(t.byteOffset||0)+(i.byteOffset||0),t.count*(i.byteStride&&i.byteStride!==qg[t.type]*r.BYTES_PER_ELEMENT?i.byteStride/r.BYTES_PER_ELEMENT:qg[t.type]))}function Gy(e,t,i,r){const n=jy(e,t),o=n instanceof Float32Array?n:new Uint32Array(n.buffer,n.byteOffset,t.count),a=new Tu;a.reserveExact(t.count);let s=-1;for(let l=0;l<t.count;l++){const e=i?o[l]>>>16|o[l]<<16:o[l],t=65535&e,r=e>>>16;s=s<0&&2==(15&r)?t:s,a.emplaceBack(t,r)}r.featureArray=a,s>=0&&(r.doorVertexColor=s)}function Hy(e,t,i,r,n=!0){const o=$g[t.componentType],a=qg[t.type],s=n?Uy(o):1,l=e.json.bufferViews[t.bufferView],c=l.byteStride?l.byteStride/o.BYTES_PER_ELEMENT:a,u=t.count*c;for(let h=0,d=0;h<u;h+=c,d+=a)for(let e=0;e<a;e++)i[d+e]=r[h+e]*s}function $y(e,t,i){const r=e.indices,n=e.attributes,o={};o.indexArray=new Ru;const a=t.json.accessors[r],s=jy(t,a);o.indexArray.resizeExact(a.count/3),o.indexArray.uint16.set(s),o.vertexArray=new xu;const l=t.json.accessors[n.POSITION],c=jy(t,l);o.vertexArray.resizeExact(l.count),o.vertexArray.float32.set(c),o.aabb=new Wp(l.min,l.max);const[u,h,d]=l.min,[p,f,m]=l.max;if(o.centroid=[.5*(u+p),.5*(h+f),.5*(d+m)],void 0!==n.COLOR_0){const e=t.json.accessors[n.COLOR_0],i=qg[e.type],r=jy(t,e);o.colorArray=3===i?new xu:new Iu,o.colorArray.resizeExact(e.count),Hy(t,e,o.colorArray.float32,r)}if(void 0!==n.NORMAL){o.normalArray=new Gu;const e=t.json.accessors[n.NORMAL];o.normalArray.resizeExact(e.count);const i=jy(t,e);!function(e,t,i,r){const n=$g[t.componentType],o=Uy(n),a=e.json.bufferViews[t.bufferView],s=qg[t.type],l=i.length/t.count,c=a.byteStride?a.byteStride/n.BYTES_PER_ELEMENT:s,u=t.count*c;for(let h=0,d=0;h<u;h+=c,d+=l)for(let e=0;e<s;e++)i[d+e]=Math.round(127*Math.min(1,Math.max(-1,r[h+e]*o)))}(t,e,o.normalArray.int8,i)}if(void 0!==n.TEXCOORD_0&&i.length>0){const e=t.json.accessors[n.TEXCOORD_0],i=jy(t,e);e.normalized&&$g[e.componentType]===Uint16Array?(o.texcoordArray=new Tu,o.texcoordArray.resizeExact(e.count),Hy(t,e,o.texcoordArray.uint16,i,!1)):(o.texcoordArray=new Nu,o.texcoordArray.resizeExact(e.count),Hy(t,e,o.texcoordArray.float32,i))}const _=!(!t.json.extensionsUsed||!t.json.extensionsUsed.includes("EXT_meshopt_compression"));void 0!==n._FEATURE_ID_RGBA4444&&_&&Gy(t,t.json.accessors[n._FEATURE_ID_RGBA4444],!1,o),void 0!==n._FEATURE_RGBA4444&&Gy(t,t.json.accessors[n._FEATURE_RGBA4444],!_,o),o.hasFeatureData=!!o.featureArray;const g=e.material;return o.material=function(e,t){const{emissiveFactor:i=[0,0,0],alphaMode:r="OPAQUE",alphaCutoff:n=.5,normalTexture:o,occlusionTexture:a,emissiveTexture:s,doubleSided:l,name:c}=e,{baseColorFactor:u=[1,1,1,1],metallicFactor:h=1,roughnessFactor:d=1,baseColorTexture:p,metallicRoughnessTexture:f}=e.pbrMetallicRoughness||{},m=a?t[a.index]:void 0;if(a&&a.extensions&&a.extensions.KHR_texture_transform&&m){const e=a.extensions.KHR_texture_transform;m.offsetScale=[e.offset[0],e.offset[1],e.scale[0],e.scale[1]]}return{name:c,pbrMetallicRoughness:{baseColorFactor:new Zr(...u),metallicFactor:h,roughnessFactor:d,baseColorTexture:p?t[p.index]:void 0,metallicRoughnessTexture:f?t[f.index]:void 0},doubleSided:l,emissiveFactor:new Zr(...i),alphaMode:r,alphaCutoff:n,normalTexture:o?t[o.index]:void 0,occlusionTexture:m,emissionTexture:s?t[s.index]:void 0,defined:void 0===e.defined}}(void 0!==g?t.json.materials[g]:{defined:!1},i),o}function Wy(e,t,i){const{matrix:r,rotation:n,translation:o,scale:a,mesh:s,extras:l,children:c,name:u}=e,h={};if(h.name=u,h.localMatrix=r||function(e,t,i,r){var n=t[0],o=t[1],a=t[2],s=t[3],l=n+n,c=o+o,u=a+a,h=n*l,d=n*c,p=n*u,f=o*c,m=o*u,_=a*u,g=s*l,y=s*c,x=s*u,v=r[0],b=r[1],w=r[2];return e[0]=(1-(f+_))*v,e[1]=(d+x)*v,e[2]=(p-y)*v,e[3]=0,e[4]=(d-x)*b,e[5]=(1-(h+_))*b,e[6]=(m+g)*b,e[7]=0,e[8]=(p+y)*w,e[9]=(m-g)*w,e[10]=(1-(h+f))*w,e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1,e}([],n||[0,0,0,1],o||[0,0,0],a||[1,1,1]),h.globalMatrix=f(h.localMatrix),void 0!==s){h.meshes=i[s];const e=h.anchor=[0,0];for(const t of h.meshes){const{min:i,max:r}=t.aabb;e[0]+=i[0]+r[0],e[1]+=i[1]+r[1]}e[0]=Math.floor(e[0]/h.meshes.length/2),e[1]=Math.floor(e[1]/h.meshes.length/2)}if(l&&(l.id&&(h.id=l.id),l.lights&&(h.lights=function(e){if(!e.length)return[];const t=function(e){const t=atob(e),i=new Uint8Array(t.length);for(let r=0;r<t.length;r++)i[r]=t.codePointAt(r);return i}(e),i=[],r=t.length/24,n=new Uint16Array(t.buffer),o=new Float32Array(t.buffer);for(let a=0;a<r;a++){const e=n[2*a*6]/30,t=n[2*a*6+1]/30,r=n[2*a*6+10]/100,s=o[6*a+1],l=o[6*a+2],c=o[6*a+3],u=o[6*a+4],h=c-s,d=u-l,p=Math.hypot(h,d);i.push({pos:[s+.5*h,l+.5*d,t],normal:[d/p,-h/p,0],width:p,height:e,depth:r,points:[s,l,c,u]})}return i}(l.lights)),l.MAPBOX_geometry_bloom&&(h.isGeometryBloom=l.MAPBOX_geometry_bloom),l.MAPBOX_zoom_min&&(h.minZoom=l.MAPBOX_zoom_min),l.MAPBOX_zoom_max&&(h.maxZoom=l.MAPBOX_zoom_max)),c){const e=[];for(const r of c)e.push(Wy(t.json.nodes[r],t,i));h.children=e}if(e.extensions&&e.extensions.mbx_bvh&&(h.meshBVH=function(e,t,i){const r=t.binaryAccessor,n=t.positionMinAccessor,o=t.positionMaxAccessor,a=t.indexAccessor;if(!(Number.isInteger(r)&&Number.isInteger(n)&&Number.isInteger(o)&&Number.isInteger(a)))return null;const s=e.json.accessors;if(r>=s.length||n>=s.length||o>=s.length||a>=s.length)return null;const l=s[r],c=s[n],u=s[o],h=s[a];if(void 0===l.bufferView||void 0===c.bufferView||void 0===u.bufferView||void 0===h.bufferView)return null;const d=e.json.bufferViews;if(l.bufferView>=d.length||c.bufferView>=d.length||u.bufferView>=d.length||h.bufferView>=d.length)return null;const p=d[l.bufferView],f=d[c.bufferView],m=d[u.bufferView],_=d[h.bufferView];if(p.buffer>=e.buffers.length||f.buffer>=e.buffers.length||m.buffer>=e.buffers.length||_.buffer>=e.buffers.length)return null;const g=(e,t,i)=>e>=0&&e<=i&&t<=i-e,y=l.byteOffset||0,x=c.byteOffset||0,v=u.byteOffset||0,b=h.byteOffset||0;if(!(g(y,0,p.byteLength)&&g(x,3*c.count*4,f.byteLength)&&g(v,3*u.count*4,m.byteLength)&&g(b,4*h.count,_.byteLength)))return null;const w=new Uint8Array(e.buffers[p.buffer],(p.byteOffset||0)+y,p.byteLength-y),E=new Float32Array(e.buffers[f.buffer],(f.byteOffset||0)+x,3*c.count),A=new Float32Array(e.buffers[m.buffer],(m.byteOffset||0)+v,3*u.count),I=new Uint32Array(e.buffers[_.buffer],(_.byteOffset||0)+b,h.count),S=new Ny;if(S.serializeFromGltf(w,E,A,I),void 0!==i&&e.json.meshes&&e.json.meshes[i]){const t=e.json.meshes[i].primitives[0];if(t&&void 0!==t.attributes.POSITION&&t.attributes.POSITION<s.length){const i=s[t.attributes.POSITION];if(void 0!==i.bufferView&&i.bufferView<d.length){const t=d[i.bufferView];if(t.buffer<e.buffers.length){const r=i.byteOffset||0,n=t.byteStride?t.byteStride/4:3;if(g(r,i.count*n*4,t.byteLength)){const o=(t.byteOffset||0)+r;if(3===n)S.setVertices(new Float32Array(e.buffers[t.buffer],o,3*i.count));else{const r=new Float32Array(e.buffers[t.buffer],o,i.count*n),a=new Float32Array(3*i.count);for(let e=0;e<i.count;e++)a[3*e]=r[e*n],a[3*e+1]=r[e*n+1],a[3*e+2]=r[e*n+2];S.setVertices(a)}}}}}}return S}(t,e.extensions.mbx_bvh,s)),!h.meshBVH&&h.children)for(const d of h.children)if(d.meshBVH){h.meshBVH=d.meshBVH;break}return h}function qy(e){if(0===e.vertices.length||0===e.indices.length)return null;const t=new oy(e.vertices,e.indices,8,256),[i,r]=[t.min.clone(),t.max.clone()];return{vertices:e.vertices,indices:e.indices,grid:t,min:i,max:r}}function Zy(e){if(!e.extras||!e.extras.ground)return null;const t=e.extras.ground;if(!t||!Array.isArray(t)||0===t.length)return null;const i=t[0];if(!i||!Array.isArray(i)||0===i.length)return null;const r=[];for(const a of i){if(!Array.isArray(a)||2!==a.length)continue;const e=a[0],t=a[1];"number"==typeof e&&"number"==typeof t&&r.push(new ke(e,t))}if(r.length<3)return null;r.length>1&&r.at(-1).equals(r[0])&&r.pop();let n=0;for(let a=0;a<r.length;a++){const e=r[a],t=r[(a+1)%r.length],i=r[(a+2)%r.length];n+=(e.x-t.x)*(i.y-t.y)-(i.x-t.x)*(e.y-t.y)}n>0&&r.reverse();const o=ec(r.flatMap(e=>[e.x,e.y]),[]);return 0===o.length?null:{vertices:r,indices:o}}function Xy(e,t){const i=[],r=[];let n=0;const o=[];for(const a of e){n=i.length;const e=a.vertexArray.float32,s=a.indexArray.uint16;for(let r=0;r<a.vertexArray.length;r++)o[0]=e[3*r+0],o[1]=e[3*r+1],o[2]=e[3*r+2],ie(o,o,t),i.push(new ke(o[0],o[1]));for(let t=0;t<3*a.indexArray.length;t++)r.push(s[t]+n)}if(r.length%3!=0)return null;for(let a=0;a<r.length;a+=3){const e=i[r[a+0]],t=i[r[a+1]],n=i[r[a+2]];(e.x-t.x)*(n.y-t.y)-(n.x-t.x)*(e.y-t.y)>0&&([r[a+1],r[a+2]]=[r[a+2],r[a+1]])}return{vertices:i,indices:r}}function Yy(e,t){for(let i=0;i<e.length;i++)if(e[i].name===t)return i;return-1}function Ky(e){const t=function(e,t){const i=[],r=WebGL2RenderingContext;if(e.json.textures)for(const n of e.json.textures){const o={magFilter:r.LINEAR,minFilter:r.NEAREST,wrapS:r.REPEAT,wrapT:r.REPEAT};void 0!==n.sampler&&Object.assign(o,e.json.samplers[n.sampler]),i.push({image:t[n.source],sampler:o,uploaded:!1})}return i}(e,e.images),i=function(e,t){const i=[];if(!e.json.meshes)return i;for(const r of e.json.meshes){const n=[];for(const i of r.primitives)n.push($y(i,e,t));i.push(n)}return i}(e,t),{scenes:r,scene:n,nodes:o}=e.json;let a=r?Yy(r,"Default Scene"):-1;a<0&&(a=n||0);const s=r&&r[a]?r[a].nodes||[]:[...o.keys()],l=[];for(const u of s)l.push(Wy(o[u],e,i));!function(e,t,i){const r={},n=new Set;for(let o=0;o<e.length;o++){const e=i[t[o]];if(!e.extras)continue;const a=e.extras["mapbox:footprint:version"],s=e.extras["mapbox:footprint:id"];(a||s)&&n.add(o),"1.0.0"===a&&s&&(r[s]=o)}for(let o=0;o<e.length;o++){if(n.has(o))continue;const a=e[o],s=i[t[o]];if(!s.extras)continue;let l=null;a.id in r&&(l=Xy(e[r[a.id]].meshes,a.localMatrix)),l||(l=Zy(s)),l&&(a.footprint=qy(l))}if(n.size>0){const t=Array.from(n.values()).sort((e,t)=>e-t);for(let i=t.length-1;i>=0;i--)e.splice(t[i],1)}}(l,s,e.json.nodes);const c=r?Yy(r,"LOD"):-1;if(c>=0){const t=r[c].nodes,n=new Map;for(const r of t){const t=Wy(o[r],e,i);t.id&&n.set(t.id,t)}for(const e of l)if(e.id){const t=n.get(e.id);t&&t.meshes&&(e.lodMeshes=t.meshes,t.meshBVH&&(e.meshBVH=t.meshBVH))}}return l}function Jy(e,t,i,r,n){i.reserve(i.length+4*e.length),r.reserve(r.length+10*e.length),n.reserve(n.length+10*e.length);let o=r.length;for(const a of e){const e=Math.min(10,Math.max(4,1.3*a.height))*t,s=[-a.normal[1],a.normal[0],0],l=Math.min(.29,.1*a.width/a.depth),c=a.width-2*a.depth*t*(l+.01),u=q([],a.pos,s,c/2),h=q([],a.pos,s,-c/2),d=[u[0],u[1],u[2]+a.height],p=[h[0],h[1],h[2]+a.height],f=q([],a.normal,s,l);W(f,f,e);const m=q([],a.normal,s,-l);W(m,m,e),U(f,u,f),U(m,h,m),u[2]+=.1,h[2]+=.1,r.emplaceBack(f[0],f[1],f[2]),r.emplaceBack(m[0],m[1],m[2]),r.emplaceBack(u[0],u[1],u[2]),r.emplaceBack(h[0],h[1],h[2]),r.emplaceBack(d[0],d[1],d[2]),r.emplaceBack(p[0],p[1],p[2]),r.emplaceBack(u[0],u[1],u[2]),r.emplaceBack(h[0],h[1],h[2]),r.emplaceBack(f[0],f[1],f[2]),r.emplaceBack(m[0],m[1],m[2]);const _=c/e/2;n.emplaceBack(-_-l,-1,_,.8),n.emplaceBack(_+l,-1,_,.8),n.emplaceBack(-_,0,_,1.3),n.emplaceBack(_,0,_,1.3),n.emplaceBack(_+l,-.8,_,.7),n.emplaceBack(_+l,-.8,_,.7),n.emplaceBack(0,0,_,1.3),n.emplaceBack(0,0,_,1.3),n.emplaceBack(_+l,-1.2,_,.8),n.emplaceBack(_+l,-1.2,_,.8),i.emplaceBack(6+o,4+o,8+o),i.emplaceBack(7+o,9+o,5+o),i.emplaceBack(0+o,1+o,2+o),i.emplaceBack(1+o,3+o,2+o),o+=10}}Rs(Ny,"ModelBVH");const Qy=lu([{name:"a_pos_3f",components:3,type:"Float32"}]),ex=lu([{name:"a_normal_3",components:3,type:"Int16"}]),tx=lu([{name:"a_centroid_3",components:3,type:"Int16"}]),ix=lu([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),rx=lu([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),nx=lu([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),ox=lu([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),ax=lu([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),sx=lu([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Int16"}]),lx=lu([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),cx=lu([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),ux=lu([{name:"a_flood_light_ground_radius",components:1,type:"Float32"}]),hx=lu([{name:"a_centroid_pos",components:2,type:"Uint16"}]),dx=lu([{name:"a_join_normal_inside",components:3,type:"Int16"}]),px=lu([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),fx=lu([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:mx}=lx;function _x(e,t,i,r){const n=[],o=0===r?(e,t,i,r,n,o)=>{e.push(new ke(o,i+(o-t)/(r-t)*(n-i)))}:(e,t,i,r,n,o)=>{e.push(new ke(t+(o-i)/(n-i)*(r-t),o))};for(const a of e){const e=[];for(const n of a){if(n.length<=2)continue;const a=[];for(let e=0;e<n.length-1;e++){const s=n[e].x,l=n[e].y,c=n[e+1].x,u=n[e+1].y,h=0===r?s:l,d=0===r?c:u;h<t?d>t&&o(a,s,l,c,u,t):h>i?d<i&&o(a,s,l,c,u,i):a.push(n[e]),d<t&&h>=t&&o(a,s,l,c,u,t),d>i&&h<=i&&o(a,s,l,c,u,i)}let s=n.at(-1);const l=0===r?s.x:s.y;l>=t&&l<=i&&a.push(s),a.length&&(s=a.at(-1),a[0].x===s.x&&a[0].y===s.y||a.push(a[0]),e.push(a))}e.length&&n.push(e)}return n}const gx=[new ke(0,0),new ke(co,0),new ke(co,co),new ke(0,co)];function yx(e,t){const i=[];let r=[];if(!t||e.length<2)return[e];if(2===e.length)return xd(e[0],e[1],gx)?[e]:[];for(let n=0;n<e.length+2;n++){const t=0===n?e.at(-1):e[(n-1)%e.length],o=e[n%e.length],a=e[(n+1)%e.length],s=xd(t,o,gx),l=xd(o,a,gx),c=s||l;c&&r.push(o),c&&l||r.length>0&&(r.length>1&&i.push(r),r=[])}return r.length>1&&i.push(r),i}const xx=td.types,vx=["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"],bx=["f
2ill-extrusion-flood-light-ground-radius"],wx=Math.pow(2,13),Ex=Math.pow(2,15)-1,Ax=new ke(0,1),Ix=2147483648,Sx=1073741824;function Tx(e,t,i,r,n,o,a,s){e.emplaceBack((t<<1)+a,(i<<1)+o,(Math.floor(r*wx)<<1)+n,Math.round(s))}function Dx(e,t,i){e.emplaceBack(t.x*co,t.y*co,i?1:0)}function Mx(e,t,i,r,n,o){e.emplaceBack(t.x,t.y,(i.x<<1)+r,(i.y<<1)+n,o)}function Px(e,t,i){const r=16384;e.emplaceBack(t.x,t.y,t.z,i[0]*r,i[1]*r,i[2]*r)}class Cx{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class Rx{constructor(){this.data=[]}get length(){return this.data.length}push(e){this.data.push(e)}get(e){return this.data[e]}static serialize(e,t){const i=e.data.length,r=new Uint32Array(4*i),n=[];n.length=i;for(let o=0;o<i;o++){const t=e.data[o],i=4*o;r[i]=t.vertexOffset,r[i+1]=t.vertexCount,r[i+2]=t.indexOffset,r[i+3]=t.indexCount,n[o]=t.ringIndices}return t&&t.add(r.buffer),{scalars:r,rings:n}}static deserialize(e){const{scalars:t,rings:i}=e,r=t.length/4,n=new Rx,o=[];o.length=r,n.data=o;for(let a=0;a<r;a++){const e=4*a,r=new Cx;r.vertexOffset=t[e],r.vertexCount=t[e+1],r.indexOffset=t[e+2],r.indexCount=t[e+3],r.ringIndices=i[a],n.data[a]=r}return n}}class zx{constructor(){this.centroidXY=new ke(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 ke(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new ke(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0,this.groupCentroidPos=new ke(0,0)}span(){return new ke(this.max.x-this.min.x,this.max.y-this.min.y)}}class Lx{constructor(){this.data=[],this.buffer=null}get length(){return this.data.length}push(e){this.data.push(e)}get(e){return this.data[e]}find(e){return this.data.find(e)}[Symbol.iterator](){return this.data[Symbol.iterator]()}static serialize(e,t){const i=e.data.length,r=new Float64Array(15*i);for(let n=0;n<i;n++){const t=e.data[n],i=15*n;r[i]=t.centroidXY.x,r[i+1]=t.centroidXY.y,r[i+2]=t.min.x,r[i+3]=t.min.y,r[i+4]=t.max.x,r[i+5]=t.max.y,r[i+6]=t.groupCentroidPos.x,r[i+7]=t.groupCentroidPos.y,r[i+8]=t.vertexArrayOffset,r[i+9]=t.vertexCount,r[i+10]=t.groundVertexArrayOffset,r[i+11]=t.groundVertexCount,r[i+12]=t.footprintSegLen,r[i+13]=t.height,r[i+14]=t.buildingId}return t&&t.add(r.buffer),{buffer:r}}static deserialize(e){const t=e.buffer,i=t.length/15,r=new Lx;r.buffer=t;const n=[];n.length=i,r.data=n;let o=0;for(let a=0;a<i;a++){const e=15*a,i=new zx;i.centroidXY=new ke(t[e],t[e+1]),i.min=new ke(t[e+2],t[e+3]),i.max=new ke(t[e+4],t[e+5]),i.groupCentroidPos=new ke(t[e+6],t[e+7]),i.vertexArrayOffset=t[e+8],i.vertexCount=t[e+9],i.groundVertexArrayOffset=t[e+10],i.groundVertexCount=t[e+11],i.footprintSegLen=t[e+12],i.height=t[e+13],i.buildingId=t[e+14],i.footprintSegIdx=o,o+=i.footprintSegLen,r.data[a]=i}return r}}class Fx{constructor(){this.acc=new ke(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(e,t){e.min.x===Number.MAX_VALUE&&(e.min.x=e.max.x=t.x,e.min.y=e.max.y=t.y)}appendEdge(e,t,i){this.accCount++,this.acc._add(t);let r=!!this.borders;t.x<e.min.x?(e.min.x=t.x,r=!0):t.x>e.max.x&&(e.max.x=t.x,r=!0),t.y<e.min.y?(e.min.y=t.y,r=!0):t.y>e.max.y&&(e.max.y=t.y,r=!0),((0===t.x||t.x===co)&&t.x===i.x)!=((0===t.y||t.y===co)&&t.y===i.y)&&this.processBorderOverlap(t,i),r&&this.checkBorderIntersection(t,i)}checkBorderIntersection(e,t){t.x<0!=e.x<0&&this.addBorderIntersection(0,Wr(t.y,e.y,(0-t.x)/(e.x-t.x))),t.x>co!=e.x>co&&this.addBorderIntersection(1,Wr(t.y,e.y,(co-t.x)/(e.x-t.x))),t.y<0!=e.y<0&&this.addBorderIntersection(2,Wr(t.x,e.x,(0-t.y)/(e.y-t.y))),t.y>co!=e.y>co&&this.addBorderIntersection(3,Wr(t.x,e.x,(co-t.y)/(e.y-t.y)))}addBorderIntersection(e,t){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 i=this.borders[e];t<i[0]&&(i[0]=t),t>i[1]&&(i[1]=t)}processBorderOverlap(e,t){if(e.x===t.x){if(e.y===t.y)return;const i=0===e.x?0:1;this.addBorderIntersection(i,t.y),this.addBorderIntersection(i,e.y)}else{const i=0===e.y?2:3;this.addBorderIntersection(i,t.x),this.addBorderIntersection(i,e.x)}}centroid(){return 0===this.accCount?new ke(0,0):new ke(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((e,t)=>
vendor: 19,046 bytes, line 2
2e+ +(t[0]!==Number.MAX_VALUE),0):0}}function Ox(e,t){const i=e.add(t)._unit(),r=ht(e.x*i.x+e.y*i.y,-1,1);var n,o,a;return a=Math.acos(r),Math.min(4,Math.max(-4,Math.tan(a)))/4*Ex*((n=e).x*(o=t).y-n.y*o.x<0?-1:1)}const Bx=[e=>e.x<0,e=>e.x>co,e=>e.y<0,e=>e.y>co];function kx(e,t,i,r){const n=[4];if(0===r)return n;i._mult(r);const o=e.sub(i),a=t.sub(i),s=[e,t,o,a];for(let l=0;l<4;l++)for(const e of s)if(Bx[l](e)){n.push(l);break}return n}class Vx{constructor(e){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new gu,this.indexArray=new Ru,this.programConfigurations=new kh(e.layers,{zoom:e.zoom,lut:e.lut},e=>bx.includes(e)),this._segments=new uh,this.hiddenByLandmarkVertexArray=new Wu,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new uh}getDefaultSegment(){return this.regionSegments[4]}hasData(){return 0!==this.vertexArray.length}addData(e,t,i,r=!1){const n=e.length;if(n>2){let o=Math.max(0,this._segments.get().length-1);const a=this._segments._prepareSegment(4*n,this.vertexArray.length,2*this._segmentToGroundQuads[o].length);let s;o!==this._segments.get().length-1&&(o++,this._segmentToGroundQuads[o]=[],this._segmentToRegionTriCounts[o]=[0,0,0,0,0]);{const t=e[0],i=e[1];s=Ox(t.sub(e[n-1])._perp()._unit(),i.sub(t)._perp()._unit())}for(let l=0;l<n;l++){const c=l===n-1?0:l+1,u=e[l],h=e[c],d=e[c===n-1?0:c+1],p=h.sub(u)._perp()._unit(),f=Ox(p,d.sub(h)._perp()._unit()),m=s,_=f;if(qx(u,h,t)||r&&Zx(u,t)&&Zx(h,t)){s=f;continue}const g=a.vertexLength;Mx(this.vertexArray,u,h,1,1,m),Mx(this.vertexArray,u,h,1,0,m),Mx(this.vertexArray,u,h,0,1,_),Mx(this.vertexArray,u,h,0,0,_),a.vertexLength+=4;const y=kx(u,h,p,i);for(const e of y)this._segmentToGroundQuads[o].push({id:g,region:e}),this._segmentToRegionTriCounts[o][e]+=2,a.primitiveLength+=2;s=f}}}prepareBorderSegments(){if(!this.hasData())return;const e=this._segments.get(),t=e.length;for(let i=0;i<t;i++)this._segmentToGroundQuads[i].sort((e,t)=>e.region-t.region);for(let i=0;i<t;i++){const t=this._segmentToGroundQuads[i],r=e[i],n=this._segmentToRegionTriCounts[i];n.reduce((e,t)=>e+t,0);let o=0;for(let e=0;e<=4;e++){const t=n[e];if(0!==t){let i=this.regionSegments[e];i||(i=this.regionSegments[e]=new uh);const n={vertexOffset:r.vertexOffset,primitiveOffset:r.primitiveOffset+o,vertexLength:r.vertexLength,primitiveLength:t};i.get().push(n)}o+=t}for(let e=0;e<t.length;e++){const i=t[e].id;this.indexArray.emplaceBack(i,i+1,i+3),this.indexArray.emplaceBack(i,i+3,i+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(e,t,i,r,n,o,a){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,e,t,i,r,n,o,void 0,a)}upload(e){this.hasData()&&(this.vertexBuffer=e.createVertexBuffer(this.vertexArray,cx.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),null!=this.groundRadiusArray&&(this.groundRadiusBuffer=e.createVertexBuffer(this.groundRadiusArray,ux.members)))}uploadPaintProperties(e){this.hasData()&&this.programConfigurations.upload(e)}update(e,t,i,r,n,o,a,s){this.hasData()&&this.programConfigurations.updatePaintArrays(e,t,i,r,n,o,a,s)}updateHiddenByLandmark(e){this.updateHiddenByLandmarkRange(e.groundVertexArrayOffset,e.groundVertexCount,!!(e.flags&Ix||e.flags&Sx))}updateHiddenByLandmarkRange(e,t,i){if(!this.hasData())return;const r=t+e;if(0!==t){for(let t=e;t<r;++t)this.hiddenByLandmarkVertexArray.emplace(t,i?1:0);this._needsHiddenByLandmarkUpdate=!0}}uploadHiddenByLandmark(e){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,px.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 e=0;e<=4;e++){const t=this.regionSegments[e];t&&t.destroy()}}}}class Nx{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.pixelRatio=e.pixelRatio,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=new Lx,this.footprintIndices=new Ru,this.footprintVertices=new uu,this.footprintSegments=new Rx,this.layoutVertexArray=new _u,this.centroidVertexArray=new rh,this.wallVertexArray=new oh,this.indexArray=new Ru,this.programConfigurations=new kh(e.layers,{zoom:e.zoom,lut:e.lut},e=>vx.includes(e)),this.segments=new uh,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.groundEffect=new Vx(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.buildingGroups=new Map,this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,t){}updateAppearances(e,t,i,r){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,i,r){this.features=[],this.hasPattern=Tc("fill-extrusion",this.layers,this.pixelRatio,t),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=qc(i),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:n,id:o,index:a,sourceLayerIndex:s}of e){const e=this.layers[0]._featureFilter.needGeometry,l=ru(n,e);if(!this.layers[0]._featureFilter.filter(new ll(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),l,i))continue;const c={id:o,sourceLayerIndex:s,index:a,geometry:e?l.geometry:iu(n,i,r),properties:n.properties,type:n.type,patterns:{}},u=this.layoutVertexArray.length,h="Polygon"===xx[c.type];if(this.hasPattern)this.features.push({featureId:n.id,feature:Dc("fill-extrusion",this.layers,c,this.zoom,this.pixelRatio,t)});else if(this.wallMode)for(const o of c.geometry)for(const e of yx(o,h))this.addFeature(n.id,c,[e],a,i,{},t.availableImages,r,t.brightness);else this.addFeature(n.id,c,c.geometry,a,i,{},t.availableImages,r,t.brightness);t.featureIndex.insert(n,c.geometry,a,s,this.index,u)}this._finalizeBuildingGroups(),this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,t,i,r,n,o){for(const{featureId:a,feature:s}of this.features){const e="Polygon"===xx[s.type],{geometry:l}=s;if(this.wallMode)for(const c of l)for(const l of yx(c,e))this.addFeature(a,s,[l],s.index,t,i,r,n,o);else this.addFeature(a,s,l,s.index,t,i,r,n,o)}this._finalizeBuildingGroups(),this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles()}update(e,t,i,r,n,o,a){this.programConfigurations.updatePaintArrays(e,t,n,i,r,o,a,this.worldview),this.groundEffect.update(e,t,n,i,r,o,a,this.worldview)}updateExpressions(e){this.programConfigurations.updateExpressions(e),this.groundEffect.programConfigurations.updateExpressions(e)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,mx),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,dx.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,fx.members,!0)),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}uploadCentroid(e){this.groundEffect.uploadHiddenByLandmark(e),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,hx.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(e,t,i,r,n,o,a,s,l){const c=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(t,{})/this.tileToMeter,u=[new ke(0,0),new ke(co,co)],h=s.projection,d="globe"===h.name,p=this.wallMode||"Polygon"===xx[t.type],f=new Fx;f.centroidDataIndex=this.centroidData.length;const m=new zx;m.buildingId=e,t.properties&&Object.hasOwn(t.properties,"building_id")&&(m.buildingId=Number(t.properties.building_id)),f.buildingId=m.buildingId;const _=this.layers[0].paint.get("fill-extrusion-base").evaluate(t,{},n)<=0,g=this.layers[0].paint.get("fill-extrusion-height").evaluate(t,{},n);let y;if(m.height=g,m.vertexArrayOffset=this.layoutVertexArray.length,m.groundVertexArrayOffset=this.groundEffect.vertexArray.length,d&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new wu),this.wallMode){if(d)return void Tt("Non zero fill-extrusion-line-width is not yet supported on globe.");if(1!==i.length)return;y=function(e){const t=e[0].x===e.at(-1).x&&e[0].y===e.at(-1).y,i=function(e){let t=0;const i=e.length;for(let r=0;r<i;r++)t+=(e[(r+1)%i].x-e[r].x)*(e[(r+1)%i].y+e[r].y);return t>=0}(e);i||(e=e.reverse());const r={geometry:[],joinNormals:[],indices:[]},n=[],o=[],a=[];let s=e.length;for(;s>=2&&e[s-1].equals(e[s-2]);)s--;if(s<(t?3:2))return r;let l,c,u,h,d,p=0;for(;p<s-1&&e[p].equals(e[p+1]);)p++;t&&(l=e[s-2],d=e[p].sub(l)._unit()._perp());for(let m=p;m<s;m++){if(u=m===s-1?t?e[p+1]:void 0:e[m+1],u&&e[m].equals(u))continue;d&&(h=d),l&&(c=l),l=e[m],d=u?u.sub(l)._unit()._perp():h,h=h||d;let i=h.add(d);0===i.x&&0===i.y||i._unit();const r=i.x*d.x+i.y*d.y,f=0!==r?1/r:1/0,_=h.x*d.y-h.y*d.x>0;let g="miter";const y=2;"miter"===g&&f>y&&(g="bevel"),"bevel"===g&&(f>100&&(g="flipbevel"),f<y&&(g="miter"));const x=(e,t,i,r)=>{const s=new ke(e.x,e.y),l=new ke(e.x,e.y);s.x+=t.x*r,s.y+=t.y*r,l.x-=t.x*Math.max(i,1),l.y-=t.y*Math.max(i,1),a.push(t),n.push(s),o.push(l)};if("miter"===g)i._mult(f),x(l,i,0,0);else if("flipbevel"===g)i=d.mult(-1),x(l,i,0,0),x(l,i.mult(-1),0,0);else{const e=-Math.sqrt(f*f-1),t=_?e:0,i=_?0:e;c&&x(l,h,t,i),u&&x(l,d,t,i)}}r.geometry=[...n,...o.reverse(),n[0]],r.joinNormals=[...a,...a.reverse(),a.at(-1)];const f=r.geometry.length-1;for(let m=0;m<f/2;m++)if(m+1<f/2){let e=m,t=m+1,i=f-1-m,n=f-2-m;e=0===e?f-1:e-1,t=0===t?f-1:t-1,i=0===i?f-1:i-1,n=0===n?f-1:n-1,r.indices.push(i),r.indices.push(t),r.indices.push(e),r.indices.push(i),r.indices.push(n),r.indices.push(t)}return r}(i[0]),i=[y.geometry]}const x=(e,t)=>e<(t.length-1)/2||e===t.length-1,v=this.wallMode?[i]:We(i,500);for(let I=v.length-1;I>=0;I--){const e=v[I];(0===e.length||Xx(e[0]))&&v.splice(I,1)}let b;if(d)b=Qx(v,u,n);else{b=[];for(const e of v)b.push({polygon:e,bounds:u})}const w=p?this.edgeRadius:0,E=w>0&&this.zoom<17,A=(e,t)=>{if(0===e.length)return!1;const i=e.at(-1);return t.x===i.x&&t.y===i.y};for(const{polygon:I,bounds:S}of b){let e=0,t=0;for(const n of I)p&&!n[0].equals(n.at(-1))&&n.push(n[0]),t+=p?n.length-1:n.length;const i=this.segments.prepareSegment((p?5:4)*t,this.layoutVertexArray,this.indexArray);m.footprintSegIdx<0&&(m.footprintSegIdx=this.footprintSegments.length),m.polygonSegIdx<0&&(m.polygonSegIdx=this.polygonSegments.length);const r={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},o=new Cx;if(o.vertexOffset=this.footprintVertices.length,o.indexOffset=3*this.footprintIndices.length,o.ringIndices=[],p){const t=[],r=[];e=i.vertexLength;for(let e=0;e<I.length;e++){const a=I[e];a.length&&0!==e&&r.push(t.length/2);const s=[];let l,u;l=a[1].sub(a[0])._perp()._unit(),o.ringIndices.push(a.length-1);for(let e=1;e<a.length;e++){const r=a[e],o=a[e===a.length-1?1:e+1],c=r.clone();if(w){u=jx(r,o,l);const e=Gx(l,u),t=Hx(l,u),i=w*Math.min(4,1/t);c.x+=i*e.x,c.y+=i*e.y,c.x=Math.round(c.x),c.y=Math.round(c.y),l=u}if(!_||0!==w&&!E||A(s,c)||s.push(c),Tx(this.layoutVertexArray,c.x,c.y,0,0,1,1,0),this.wallMode){const t=x(e,a);Dx(this.wallVertexArray,y.joinNormals[e],!t)}i.vertexLength++,this.footprintVertices.emplaceBack(r.x,r.y),t.push(r.x,r.y),d&&Px(this.layoutVertexExtArray,h.projectTilePoint(c.x,c.y,n),h.upVector(n,c.x,c.y))}_&&(0===w||E)&&(0!==s.length&&A(s,s[0])&&s.pop(),this.groundEffect.addData(s,S,c))}const a=this.wallMode?y.indices:ec(t,r);for(let n=0;n<a.length;n+=3)this.footprintIndices.emplaceBack(o.vertexOffset+a[n+0],o.vertexOffset+a[n+1],o.vertexOffset+a[n+2]),this.indexArray.emplaceBack(e+a[n],e+a[n+2],e+a[n+1]),i.primitiveLength++;o.indexCount+=a.length,o.vertexCount+=this.footprintVertices.length-o.vertexOffset}for(let a=0;a<I.length;a++){const t=I[a];f.startRing(m,t[0]);let r=t.length>4&&Yx(t[t.length-2],t[0],t[1]),o=w?$x(t[t.length-2],t[0],t[1],w):0;const s=[];let l,u,g;u=t[1].sub(t[0])._perp()._unit();let v=!0;for(let a=1,c=0;a<t.length;a++){let p=t[a-1],b=t[a];const E=t[a===t.length-1?1:a+1];if(f.appendEdge(m,b,p),qx(b,p,S)){w&&(u=E.sub(b)._perp()._unit(),v=!v);continue}const I=b.sub(p)._perp(),T=I.x/(Math.abs(I.x)+Math.abs(I.y)),D=I.y>0?1:0,M=p.dist(b);if(c+M>32768&&(c=0),w){g=jx(b,E,u);let e=Wx(p,b,E,Hx(u,g),w);isNaN(e)&&(e=0);const t=Ux(p,b,new ke(0,0));p=p.add(t.mult(o))._round(),b=b.add(t.mult(-e))._round(),o=e,u=g,_&&this.zoom>=17&&(A(s,p)||s.push(p),A(s,b)||s.push(b))}const P=i.vertexLength,C=t.length>4&&Yx(p,b,E);let R=Kx(c,r,v);if(Tx(this.layoutVertexArray,p.x,p.y,T,D,0,0,R),Tx(this.layoutVertexArray,p.x,p.y,T,D,0,1,R),this.wallMode){const e=x(a-1,t),i=y.joinNormals[a-1];Dx(this.wallVertexArray,i,e),Dx(this.wallVertexArray,i,e)}if(c+=M,R=Kx(c,C,!v),r=C,Tx(this.layoutVertexArray,b.x,b.y,T,D,0,0,R),Tx(this.layoutVertexArray,b.x,b.y,T,D,0,1,R),this.wallMode){const e=x(a,t),i=y.joinNormals[a];Dx(this.wallVertexArray,i,e),Dx(this.wallVertexArray,i,e)}if(i.vertexLength+=4,this.indexArray.emplaceBack(P+0,P+1,P+2),this.indexArray.emplaceBack(P+1,P+3,P+2),i.primitiveLength+=2,w){const r=e+(1===a?t.length-2:a-2),n=1===a?e:r+1;if(this.indexArray.emplaceBack(P+1,r,P+3),this.indexArray.emplaceBack(r,n,P+3),i.primitiveLength+=2,void 0===l&&(l=P),!qx(E,t[a],S)){const e=a===t.length-1?l:i.vertexLength;this.indexArray.emplaceBack(P+2,P+3,e),this.indexArray.emplaceBack(P+3,e+1,e),this.indexArray.emplaceBack(P+3,n,e+1),i.primitiveLength+=3}v=!v}if(d){const e=this.layoutVertexExtArray,t=h.projectTilePoint(p.x,p.y,n),i=h.projectTilePoint(b.x,b.y,n),r=h.upVector(n,p.x,p.y),o=h.upVector(n,b.x,b.y);Px(e,t,r),Px(e,t,r),Px(e,i,o),Px(e,i,o)}}p&&(e+=t.length-1),_&&w&&this.zoom>=17&&(0!==s.length&&A(s,s[0])&&s.pop(),this.groundEffect.addData(s,S,c,w>0))}this.footprintSegments.push(o),r.triangleCount=this.indexArray.length-r.triangleArrayOffset,this.polygonSegments.push(r),++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?Ax:this.encodeCentroid(f,m),t.properties&&Object.hasOwn(t.properties,"building_id")){const e=m.buildingId;let t=this.buildingGroups.get(e);t||(t={accX:0,accY:0,accCount:0,mergedMin:new ke(Number.MAX_VALUE,Number.MAX_VALUE),mergedMax:new ke(-Number.MAX_VALUE,-Number.MAX_VALUE),partIndices:[]},this.buildingGroups.set(e,t)),t.accX+=f.acc.x,t.accY+=f.acc.y,t.accCount+=f.accCount,t.mergedMin.x=Math.min(t.mergedMin.x,m.min.x),t.mergedMin.y=Math.min(t.mergedMin.y,m.min.y),t.mergedMax.x=Math.max(t.mergedMax.x,m.max.x),t.mergedMax.y=Math.max(t.mergedMax.y,m.max.y),t.partIndices.push(this.centroidData.length)}if(this.centroidData.push(m),f.borders){this.featuresOnBorder.push(f);const e=this.featuresOnBorder.length-1;for(let t=0;t<f.borders.length;t++)f.borders[t][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[t].push(e)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,o,a,n,l,void 0,this.worldview),this.groundEffect.addPaintPropertiesData(t,r,o,a,n,l,this.worldview),this.maxHeight=Math.max(this.maxHeight,g)}}_finalizeBuildingGroups(){for(const[,e]of this.buildingGroups){if(0===e.partIndices.length)continue;const t=new Fx;t.acc=new ke(e.accX,e.accY),t.accCount=e.accCount;const i=new zx;i.min=e.mergedMin,i.max=e.mergedMax;const r=this.encodeCentroid(t,i),n=t.centroid();for(const o of e.partIndices){const t=this.centroidData.get(o);t.centroidXY.x===Ax.x&&t.centroidXY.y===Ax.y||(t.centroidXY=r),t.min=e.mergedMin,t.max=e.mergedMax,t.groupCentroidPos=n}}this.buildingGroups.clear()}sortBorders(){for(let e=0;e<this.borderFeatureIndices.length;e++)this.borderFeatureIndices[e].sort((t,i)=>this.featuresOnBorder[t].borders[e][0]-this.featuresOnBorder[i].borders[e][0])}splitToSubtiles(){const e=[];for(let a=0;a<this.centroidData.length;a++){const t=this.centroidData.get(a),i=+(t.min.y+t.max.y>co),r=2*i+(+(t.min.x+t.max.x>co)^i);for(let n=0;n<t.polygonSegLen;n++){const i=t.polygonSegIdx+n;e.push({centroidIdx:a,subtile:r,polygonSegmentIdx:i,triangleSegmentIdx:this.polygonSegments[i].triangleSegIdx})}}const t=new Ru;e.sort((e,t)=>e.triangleSegmentIdx===t.triangleSegmentIdx?e.subtile-t.subtile:e.triangleSegmentIdx-t.triangleSegmentIdx);let i=0,r=0,n=0;for(const a of e){if(a.triangleSegmentIdx!==i)break;n++}const o=e.length;for(;r!==e.length;){i=e[r].triangleSegmentIdx;let a=0,s=r,l=r;for(let t=s;t<n&&e[t].subtile===a;t++)l++;for(;s!==n;){const r=e[s];a=r.subtile;const o=this.centroidData.get(r.centroidIdx).min.clone(),c=this.centroidData.get(r.centroidIdx).max.clone(),u={vertexOffset:this.segments.segments[i].vertexOffset,primitiveOffset:t.length,vertexLength:this.segments.segments[i].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let i=s;i<l;i++){const r=e[i],n=this.polygonSegments[r.polygonSegmentIdx],a=this.centroidData.get(r.centroidIdx).min,s=this.centroidData.get(r.centroidIdx).max,l=this.indexArray.uint16;for(let e=n.triangleArrayOffset;e<n.triangleArrayOffset+n.triangleCount;e++)t.emplaceBack(l[3*e],l[3*e+1],l[3*e+2]);u.primitiveLength+=n.triangleCount,o.x=Math.min(o.x,a.x),o.y=Math.min(o.y,a.y),c.x=Math.max(c.x,s.x),c.y=Math.max(c.y,s.y)}u.primitiveLength>0&&this.triangleSubSegments.push({segment:u,min:o,max:c}
vendor: 5,188 bytes, line 2
2),s=l;for(let t=s;t<n&&e[t].subtile===e[s].subtile;t++)l++}r=n;for(let t=r;t<o&&e[t].triangleSegmentIdx===e[r].triangleSegmentIdx;t++)n++}t._trim(),this.indexArray=t}getVisibleSegments(e,t,i){const r=new uh;if(this.wallMode){for(const e of this.triangleSubSegments)r.segments.push(e.segment);return r}let n=0,o=0;const a=1<<e.canonical.z;if(t){const i=t.getMinMaxForTile(e);i&&(n=i.min,o=i.max)}o+=this.maxHeight;const s=e.toUnwrapped();let l;const c=[s.canonical.x/a+s.wrap,s.canonical.y/a],u=[(s.canonical.x+1)/a+s.wrap,(s.canonical.y+1)/a],h=(e,t,i)=>[Wr(e[0],t[0],i[0]),Wr(e[1],t[1],i[1])],d=[],p=[];for(const f of this.triangleSubSegments){d[0]=f.min.x/co,d[1]=f.min.y/co,p[0]=f.max.x/co,p[1]=f.max.y/co;const e=h(c,u,d),t=h(c,u,p);if(0===new Wp([e[0],e[1],n],[t[0],t[1],o]).intersectsPrecise(i)){l&&(r.segments.push(l),l=void 0);continue}const a=f.segment;l&&l.vertexOffset!==a.vertexOffset&&(r.segments.push(l),l=void 0),l?(l.vertexLength+=a.vertexLength,l.primitiveLength+=a.primitiveLength):l={vertexOffset:a.vertexOffset,primitiveLength:a.primitiveLength,vertexLength:a.vertexLength,primitiveOffset:a.primitiveOffset,sortKey:void 0,vaos:{}}}return l&&r.segments.push(l),r}encodeCentroid(e,t){const i=e.centroid(),r=t.span(),n=Math.min(7,Math.round(r.x*this.tileToMeter/10)),o=Math.min(6,Math.round(r.y*this.tileToMeter/10));return new ke(ht(i.x,1,8191)<<3|n,ht(i.y,1,8191)<<3|o)}encodeBorderCentroid(e){if(!e.borders)return new ke(0,0);const t=e.borders,i=Number.MAX_VALUE;if(t[0][0]!==i||t[1][0]!==i){const e=t[0][0]!==i?0:1;return new ke(6|(t[0][0]!==i?0:65528),(t[e][0]+t[e][1])/2<<3|6)}{const e=t[2][0]!==i?2:3;return new ke((t[e][0]+t[e][1])/2<<3|6,6|(t[2][0]!==i?0:65528))}}showCentroid(e,t){const i=this.centroidData.get(e.centroidDataIndex);if(i.flags&=Ix,"keep"!==t||7&~i.centroidXY.y){if(0!==i.groupCentroidPos.x||0!==i.groupCentroidPos.y){const e=i.span(),t=Math.min(7,Math.round(e.x*this.tileToMeter/10)),r=Math.min(6,Math.round(e.y*this.tileToMeter/10));i.centroidXY=new ke(ht(i.groupCentroidPos.x,1,8191)<<3|t,ht(i.groupCentroidPos.y,1,8191)<<3|r)}else i.centroidXY=new ke(0,0);this.writeCentroidToBuffer(i)}else this.writeCentroidToBuffer(i)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);const t=e.vertexArrayOffset,i=e.vertexCount+e.vertexArrayOffset,r=-1073741824&e.flags?Ax:e.centroidXY,n=this.centroidVertexArray.geta_centroid_pos0(t);if(this.centroidVertexArray.geta_centroid_pos1(t)!==r.y||n!==r.x){for(let e=t;e<i;++e)this.centroidVertexArray.emplace(e,r.x,r.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const e of this.centroidData)this.writeCentroidToBuffer(e)}updateReplacement(e,t,i){if(t.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=t.updateTime;const r=t.getReplacementRegionsForTile(e.toUnwrapped());if(hm(this.activeReplacements,r))return;if(this.activeReplacements=r,0===this.centroidVertexArray.length)this.createCentroidsBuffer();else for(const o of this.centroidData)o.flags&=1073741823;const n=[];for(const o of this.activeReplacements){if(o.order<i)continue;const t=Math.max(1,Math.pow(2,o.footprintTileId.canonical.z-e.canonical.z));if(o.footprint.buildingIds)for(const e of this.centroidData)e.flags&Ix||e.flags&Sx||o.min.x>e.max.x||e.min.x>o.max.x||o.min.y>e.max.y||e.min.y>o.max.y||o.footprint.buildingIds.has(e.buildingId)&&(e.flags|=0!==o.clipMask?-1073741824:Ix);else for(const i of this.centroidData)if(!(i.flags&Ix||i.flags&Sx||o.min.x>i.max.x||i.min.x>o.max.x||o.min.y>i.max.y||i.min.y>o.max.y))for(let r=0;r<i.footprintSegLen;r++){const a=this.footprintSegments.get(i.footprintSegIdx+r);if(n.length=0,ev(this.footprintVertices,a.vertexOffset,a.vertexCount,o.footprintTileId.canonical,e.canonical,n),fm(o.footprint,n,this.footprintIndices.uint16,a.indexOffset,a.indexCount,-a.vertexOffset,-t)){i.flags|=0!==o.clipMask?-1073741824:Ix;break}}}for(const o of this.centroidData)this.writeCentroidToBuffer(o);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(e,t,i){let r=!1;for(let n=0;n<i.footprintSegLen;n++){const o=this.footprintSegments.get(i.footprintSegIdx+n);let a=0;for(const i of o.ringIndices){for(let n=a,s=i+a-1;n<i+a;s=n++){const i=this.footprintVertices.int16[2*(n+o.vertexOffset)+0],a=this.footprintVertices.int16[2*(n+o.vertexOffset)+1],l=this.footprintVertices.int16[2*(s+o.vertexOffset)+1];a>t!=l>t&&e<(this.footprintVertices.int16[2*(s+o.vertexOffset)+0]-i)*(t-a)/(l-a)+i&&(r=!r)}a=i}}return r}getHeightAtTileCoord(e,t){let i=Number.NEGATIVE_INFINITY,r=!0;const n=4*(e+co)*co+(t+co);if(Object.hasOwn(this.partLookup,n)){const e=this.partLookup[n];return e?{height:e.height,hidden:!!(e.flags&Ix)}:void 0}const o=this.centroidData.buffer,a=this.centroidData.length;for(let s=0;s<a;s++){const a=15*s;if(e>o[a+4]||o[a+2]>e||t>o[a+5]||o[a+3]>t)continue;const l=o[a+13];if(l<=i)continue;const c=this.centroidData.get(s);this.footprintContainsPoint(e,t,c)&&(i=l,this.partLookup[n]=c,r=!!(c.flags&Ix))}if(i!==Number.NEGATIVE_INFINITY)return{height:i,hidden:r};this.partLookup[n]=void 0}}
vendor: 50,217 bytes, line 2
2function Ux(e,t,i){return e.equals(t)?i:t.sub(e)._unit()}function jx(e,t,i){return e.equals(t)?i:t.sub(e)._perp()._unit()}function Gx(e,t){const i=e.add(t),r=i.mag();return 0===r?e:i.div(r)}function Hx(e,t){const i=Gx(e,t);return e.x*i.x+e.y*i.y}function $x(e,t,i,r){let n,o;return e.equals(t)?(o=jx(t,i,new ke(0,0)),n=o):(n=t.sub(e)._perp()._unit(),o=jx(t,i,n)),Wx(e,t,i,Hx(n,o),r)}function Wx(e,t,i,r,n){const o=Math.sqrt(1-r*r);return Math.min(e.dist(t)/3,t.dist(i)/3,n*o/r)}function qx(e,t,i){return e.x<i[0].x&&t.x<i[0].x||e.x>i[1].x&&t.x>i[1].x||e.y<i[0].y&&t.y<i[0].y||e.y>i[1].y&&t.y>i[1].y}function Zx(e,t){return e.x<t[0].x||e.x>t[1].x||e.y<t[0].y||e.y>t[1].y}function Xx(e){return e.every(e=>e.x<=0)||e.every(e=>e.x>=co)||e.every(e=>e.y<=0)||e.every(e=>e.y>=co)}function Yx(e,t,i){if(e.x<0||e.x>=co||t.x<0||t.x>=co||i.x<0||i.x>=co)return!1;const r=i.sub(t),n=r.perp(),o=e.sub(t);return(r.x*o.x+r.y*o.y)/Math.sqrt((r.x*r.x+r.y*r.y)*(o.x*o.x+o.y*o.y))>-.866&&n.x*o.x+n.y*o.y<0}function Kx(e,t,i){const r=t?2|e:-3&e;return i?1|r:-2&r}function Jx(){const e=Math.PI/32,t=Math.tan(e),i=Oc;return i*Math.sqrt(1+2*t*t)-i}function Qx(e,t,i){const r=1<<i.z,n=Zn(i.x/r),o=Zn((i.x+1)/r),a=Xn(i.y/r),s=Xn((i.y+1)/r);return function(e,t,i,r,n=0,o){const a=[];if(!e.length||!i||!r)return a;const s=(e,t)=>{for(const i of e)a.push({polygon:i,bounds:t})},l=Math.ceil(Math.log2(i)),c=Math.ceil(Math.log2(r)),u=l-c,h=[];for(let f=0;f<Math.abs(u);f++)h.push(u>0?0:1);for(let f=0;f<Math.min(l,c);f++)h.push(0),h.push(1);let d=e;if(d=_x(d,t[0].y-n,t[1].y+n,1),d=_x(d,t[0].x-n,t[1].x+n,0),!d.length)return a;const p=[];for(h.length?p.push({polygons:d,bounds:t,depth:0}):s(d,t);p.length;){const e=p.pop(),t=e.depth,i=h[t],r=e.bounds[0],a=e.bounds[1],l=0===i?r.x:r.y,c=0===i?a.x:a.y,u=o?o(i,l,c):.5*(l+c),d=_x(e.polygons,l-n,u+n,i),f=_x(e.polygons,u-n,c+n,i);if(d.length){const e=[r,new ke(0===i?u:a.x,1===i?u:a.y)];h.length>t+1?p.push({polygons:d,bounds:e,depth:t+1}):s(d,e)}if(f.length){const e=[new ke(0===i?u:r.x,1===i?u:r.y),a];h.length>t+1?p.push({polygons:f,bounds:e,depth:t+1}):s(f,e)}}return a}(e,t,Math.ceil((o-n)/11.25),Math.ceil((a-s)/11.25),1,(e,t,n)=>{if(0===e)return.5*(t+n);{const e=Xn((i.y+t/co)/r);return(qn(.5*(Xn((i.y+n/co)/r)+e))*r-i.y)*co}})}function ev(e,t,i,r,n,o){const a=Math.pow(2,r.z-n.z);for(let s=0;s<i;s++){let i=e.int16[2*(s+t)+0],l=e.int16[2*(s+t)+1];i=(i+n.x*co)*a-r.x*co,l=(l+n.y*co)*a-r.y*co,o.push(new ke(i,l))}}Rs(Nx,"FillExtrusionBucket",{omit:["layers","features"]}),Rs(zx,"PartData"),Rs(Lx,"PartDataArray"),Rs(Rx,"FootprintSegmentArray"),Rs(Fx,"BorderCentroidData"),Rs(Vx,"GroundEffect");const tv=4096;class iv{constructor(e){this.module=e,this.memoryStack=this.module.malloc(tv),this.memoryStackNextFree=this.memoryStack}createIntArray(e){const t=this.memoryStackNextFree;return this.memoryStackNextFree+=e.length*Int32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>tv?-1:(new Int32Array(this.module.heap32.buffer,t,e.length).set(e),t)}createFloatArray(e){const t=this.memoryStackNextFree;return this.memoryStackNextFree+=e.length*Float32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>tv?-1:(new Float32Array(this.module.heapF32.buffer,t,e.length).set(e),t)}readStringBuffer(e){let t="";for(;0!==this.module.heapU8[e];)t+=String.fromCharCode(this.module.heapU8[e]),++e;return t}setStyle(e){const t=e.normalScale;this.module.setStyle(t[0],t[1],t[2],e.tileToMeters)}setAOOptions(e,t){this.module.setAOOptions(e?1:0,t)}setMetricOptions(e,t){this.module.setMetricOptions(e?1:0,t)}setStructuralOptions(e){this.module.setStructuralOptions(e?1:0)}setFacadeOptions(e,t){this.module.setFacadeOptions(e,t?1:0)}setFauxFacadeOptions(e,t,i){this.module.setFauxFacadeOptions(e?1:0,t?1:0,i)}setFacadeClassifierOptions(e){this.module.setFacadeClassifierOptions(e)}generateMesh(e,t){this.memoryStackNextFree=this.memoryStack;for(const a of e){const e=this.createIntArray(a.ringIndices),t=this.createFloatArray(a.coordinates);if(-1===e||-1===t)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFeature(a.id,a.sourceId,a.minHeight,a.height,a.roofType,t,e,a.ringIndices.length-1)}for(const a of t){let e;e=a.entrances?JSON.parse(a.entrances):[];const t=this.createFloatArray(e),i=this.createFloatArray(a.coordinates);if(-1===t||-1===i)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFacade(a.sourceId,a.crossPerc,a.distanceToRoad,t,e.length,i,a.coordinates.length)}if(!this.module.generateMesh()){const e=this.module.getLastError();return this.readStringBuffer(e)}const i=this.module.getMeshCount(),r=new Array(i);for(let a=0;a<i;a++){const e=this.module.getPositionsPtr(a),t=this.module.getPositionsLength(a),i=new Float32Array(this.module.heapF32.buffer,e,t),n=this.module.getNormalsPtr(a),o=this.module.getNormalsLength(a),s=new Float32Array(this.module.heapF32.buffer,n,o),l=this.module.getAOPtr(a),c=this.module.getAOLength(a),u=new Float32Array(this.module.heapF32.buffer,l,c),h=this.module.getUVPtr(a),d=this.module.getUVLength(a),p=new Float32Array(this.module.heapF32.buffer,h,d),f=this.module.getFauxFacadePtr(a),m=this.module.getFauxFacadeLength(a),_=new Uint8Array(this.module.heapU8.buffer,f,m),g=this.module.getIndicesPtr(a),y=this.module.getIndicesLength(a),x=new Int16Array(this.module.heap16.buffer,g,y),v=this.module.getBuildingPart(a);r[a]={positions:i,normals:s,ao:u,uv:p,isFauxFacade:_,indices:x,buildingPart:v}}const n=this.module.getRingCount(),o=[];for(let a=0;a<n;a++){const e=this.module.getRingPtr(a),t=this.module.getRingLength(a),i=new Float32Array(this.module.heapF32.buffer,e,t);o.push(i)}return{meshes:r,outerRingLength:this.module.getOuterRingLength(),modifiedPolygonRings:o}}}const rv=td.types,nv=32767;function ov(e,t){const i=co+t;for(const r of e)for(const e of r)if(e.x<-t||e.x>i||e.y<-t||e.y>i)return!1;return!0}function av(e){switch(e){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: ${e}`)}}let sv=null,lv=null,cv=null;class uv{constructor(){this.layoutVertexArray=new xu,this.layoutAttenuationArray=new Iu,this.layoutColorArray=new Tu,this.indexArray=new Ru,this.indexArrayForConflation=new Ru,this.segmentsBucket=new uh}}class hv{constructor(e){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new uh,this.entranceBloom=new uv;const t=66560;this.layoutVertexArray=new xu,this.layoutVertexArray.reserve(t),this.layoutNormalArray=new hu,this.layoutNormalArray.reserve(t),this.layoutCentroidArray=new hu,this.layoutCentroidArray.reserve(t),this.layoutColorArray=new Tu,this.layoutColorArray.reserve(t),this.layoutFloodLightDataArray=new $u,this.layoutFloodLightDataArray.reserve(t),this.layoutAOArray=new Wu,this.layoutAOArray.reserve(t),this.indexArray=new Ru,this.indexArray.reserve(66560),this.indexArrayForConflation=new Ru,this.segmentsBucket=new uh,this.entranceBloom=new uv,e&&(this.layoutFacadePaintArray=new Tu,this.layoutFacadeDataArray=new bu,this.layoutFacadeVerticalRangeArray=new Tu)}reserve(e,t,i){this.layoutVertexArray.reserveForAdditional(e),this.layoutCentroidArray.reserveForAdditional(e),this.layoutFloodLightDataArray.reserveForAdditional(e),this.layoutNormalArray.reserveForAdditional(e),this.layoutAOArray.reserveForAdditional(e),this.layoutColorArray.reserveForAdditional(e),this.indexArray.reserveForAdditional(t),i&&(this.layoutFacadePaintArray.reserveForAdditional(e),this.layoutFacadeDataArray.reserveForAdditional(e),this.layoutFacadeVerticalRangeArray.reserveForAdditional(e))}}class dv{constructor(e){this.requiresHDRuntime=!0,this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.footprintsVertices=new Nu,this.footprintsIndices=new ju,this.footprintsMin=new ke(1/0,1/0),this.footprintsMax=new ke(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new hv(!1),this.buildingWithFacade=new hv(!0),this.indexArrayForConflationUploaded=!1,this.featureFootprintLookup=new Map,this.buildingIds=new Set,this.footprintLookup={},this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.worldview=e.worldview,this.lut=e.lut,this.programConfigurations=new kh(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.projection=e.projection,this.groundEffect=new Vx(e),this.groundEffect.groundRadiusArray=new pu,this.hasAppearances=null}updateFootprints(e,t){const i=new oy([],[],1),r={vertices:[],indices:new Uint32Array(0),grid:i,min:this.footprintsMin,max:this.footprintsMax,buildingIds:this.buildingIds};t.push({footprint:r,id:e})}updateAppearances(e,t,i,r){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,i,r){if(!cv)return;const n=qc(i);this.tileToMeter=n,this.brightness=t.brightness,cv.setStyle({normalScale:[1,-1,n],tileToMeters:n}),cv.setAOOptions(!1,.3),cv.setMetricOptions(!1,16),cv.setStructuralOptions(!0),cv.setFacadeClassifierOptions(3);const o=new Map,a=new Map;let s=0;for(const{feature:m}of e){if("LineString"!==rv[m.type]){o.set(m.id,m.properties.source_id);continue}const e=this.layers[0]._featureFilter.needGeometry;if(e&&!this.layers[0]._featureFilter.filter(new ll(this.zoom),m,i))continue;const t=ru(m,e);if(!e&&!this.layers[0]._featureFilter.filter(new ll(this.zoom),t,i))continue;const n=e?t.geometry:iu(m,i,r),l=[];for(const i of n)for(const e of i)l.push(e.x),l.push(e.y);const c={coordinates:l,crossPerc:m.properties.cross_perc,distanceToRoad:m.properties.distance_to_road,entrances:m.properties.entrances,sourceId:0},u=m.properties.source_id;let h=a.get(u);h||(h=[],a.set(u,h)),h.push(c),++s}this.maxHeight=0;const l=new Array,c=new Set,u=e=>{null!=e&&c.add(e)},h=(e,t)=>{null!=e&&l.push({buildingId:e,footprintIndex:t})},d=64*(e.length-s),p=d/2;this.buildingWithFacade.reserve(d,p,!0),this.buildingWithoutFacade.reserve(2*d,2*p,!1),this.footprintsIndices.reserve(16*(e.length-s)),this.footprintsVertices.reserve(8*(e.length-s));for(const{feature:m,id:_,index:g,sourceLayerIndex:y}of e){if("LineString"===rv[m.type])continue;const e=this.layers[0]._featureFilter.needGeometry;if(e&&!this.layers[0]._featureFilter.filter(new ll(this.zoom),m,i))continue;let s=null;if(m.properties&&Object.hasOwn(m.properties,"building_id")&&(s=Number(m.properties.building_id),c.has(s)))continue;const l=ru(m,e);if(!e&&!this.layers[0]._featureFilter.filter(new ll(this.zoom),l,i))continue;const d=e?l.geometry:iu(m,i,r),p=We(d,500);let f=!1;for(const t of p)if(1!==t.length){f=!0;break}if(f){u(s);continue}if(!ov(d,163)){u(s);continue}const x=this.layers[0],v=av(x.layout.get("building-roof-shape").evaluate(m,{},i)),b=x.layout.get("building-base").evaluate(m,{},i),w=x.layout.get("building-height").evaluate(m,{},i),E=x.layout.get("building-flood-light-ground-radius").evaluate(m,{},i),A=x.paint.get("building-ambient-occlusion-intensity"),I=E/this.tileToMeter;m.properties["building-part"]="roof";const S=x.paint.get("building-color").evaluate(m,{},this.canonical).toPremultipliedRenderColor(this.lut),T=x.paint.get("building-emissive-strength").evaluate(m,{},this.canonical);m.properties["building-part"]="wall";const D=x.paint.get("building-color").evaluate(m,{},this.canonical).toPremultipliedRenderColor(this.lut),M=x.paint.get("building-emissive-strength").evaluate(m,{},this.canonical);m.properties["building-part"]="window";const P=x.paint.get("building-color").evaluate(m,{},this.canonical).toPremultipliedRenderColor(this.lut),C=x.paint.get("building-emissive-strength").evaluate(m,{},this.canonical);m.properties["building-part"]="door";const R=x.paint.get("building-color").evaluate(m,{},this.canonical).toPremultipliedRenderColor(this.lut),z=x.paint.get("building-emissive-strength").evaluate(m,{},this.canonical);let L=x.layout.get("building-flood-light-wall-radius").evaluate(m,{},i);L=ht(L,0,2048);const F=L/2048*nv,O=o.get(_),B=a.get(O)||[],k=0!==B.length&&x.layout.get("building-facade").evaluate(m,{},i);cv.setFacadeOptions(4,!0),cv.setFauxFacadeOptions(k,!1,1);let V=0,N=0,U=0,j=0,G=0,H=0,$=0,W=0,q=0,Z=0,X=0;if(k){let e=Math.round(x.layout.get("building-facade-floors").evaluate(m,{},i));if(0===b){e=Math.max(1,e-(B.length>0?1:0));let t=4;if(w>100){const e=[10,13,15];t=e[m.id?m.id%e.length:0]}else w<=10&&(t=3);cv.setFacadeOptions(t,!0),G=(w<15?1.3:1.61803)*t/n}else G=b/n;H=w/n,G=Math.min(G,H),U=x.layout.get("building-facade-unit-width").evaluate(m,{},i)/n,j=(H-G)/e,cv.setFauxFacadeOptions(!0,!0,U);const t=x.layout.get("building-facade-window").evaluate(m,{},i);V=t[0],N=t[1],$=Math.floor(65535*Math.min(1,G/co)),W=Math.floor(65535*Math.min(1,H/co)),q=Math.floor(255*V)<<8|Math.floor(255*N),Z=Math.floor(65535*Math.min(1,U/co)),X=Math.floor(65535*Math.min(1,j/co))}const Y=Array(p.length),K={x:1/0,y:1/0},J={x:-1/0,y:-1/0},Q={x:0,y:0};let ee=0;for(let t=0;t<p.length;t++){const e=p[t];if(e.length>0){const i=[],r=Array(e.length+1);r[0]=0;for(let t=0;t<e.length;t++){const n=e[t];for(let e=0;e<n.length;e++){const t=n[n.length-e-1];K.x=Math.min(K.x,t.x),K.y=Math.min(K.y,t.y),J.x=Math.max(J.x,t.x),J.y=Math.max(J.y,t.y),Q.x+=t.x,Q.y+=t.y,ee++,i.push(t.x),i.push(t.y)}r[t+1]=i.length}Y[t]={id:m.id?m.id:0,height:w,minHeight:b,sourceId:0,roofType:v,coordinates:i,ringIndices:r}}}Q.x/=ee||1,Q.y/=ee||1;const te=cv.generateMesh(Y,B);if("string"==typeof te){Tt(`Unable to generate building ${m.id}: ${te}`),u(s);continue}if(0===te.meshes.length||0===te.modifiedPolygonRings.length){u(s);continue}const ie=k?this.buildingWithFacade:this.buildingWithoutFacade;let re=0;for(const t of te.meshes)re+=t.positions.length/3;const ne=ie.segmentsBucket.prepareSegment(re,ie.layoutVertexArray,ie.indexArray),oe=[];let ae=null,se=0,le=-1;const ce=ie.layoutVertexArray.length,ue=ce+re;ie.layoutVertexArray.resize(ue),ie.layoutCentroidArray.resize(ue),ie.layoutNormalArray.resize(ue),ie.layoutAOArray.resize(ue),ie.layoutColorArray.resize(ue),ie.layoutFloodLightDataArray.resize(ue),k&&(ie.layoutFacadePaintArray.resize(ue),ie.layoutFacadeDataArray.resize(ue),ie.layoutFacadeVerticalRangeArray.resize(ue));const he=ie.indexArray.length;let de=0,pe=ce;for(const t of te.meshes){let e,i;if(1===t.buildingPart)e=S,i=T;else if(0===t.buildingPart)e=D,i=M;else if(2===t.buildingPart)e=P,i=C;else{if(3!==t.buildingPart)continue;e=R,i=z}if(i=ht(i,0,1),3===t.buildingPart){const e=new Array;for(let o=0;o<t.positions.length;o+=12){const i=t.positions[o+0],r=t.positions[o+1],n=t.positions[o+3],a=t.positions[o+4],s=t.positions[o+2],l=t.positions[o+8]-s,c=1,u=n-i,h=a-r,d=Math.hypot(u,h);e.push({pos:[i+.5*u,r+.5*h,s],normal:[h/d,-u/d,0],width:d,height:l,depth:c,points:[i,r,n,a]})}const i=ie.entranceBloom.segmentsBucket.prepareSegment(10*e.length,ie.entranceBloom.layoutVertexArray,ie.entranceBloom.indexArray),r=ie.entranceBloom.layoutVertexArray.length;se=ie.entranceBloom.indexArray.length,Jy(e,.5/this.tileToMeter,ie.entranceBloom.indexArray,ie.entranceBloom.layoutVertexArray,ie.entranceBloom.layoutAttenuationArray);const n=ie.entranceBloom.layoutVertexArray.length-r;le=ie.entranceBloom.indexArray.length-se;for(let t=0;t<n;t++)ie.entranceBloom.layoutColorArray.emplaceBack(255*R.r<<8|255*R.g,255*R.b<<8|51*z);i.vertexLength+=n,i.primitiveLength+=le,ae={part:t.buildingPart,vertexOffset:r,vertexLength:n}}ie.layoutVertexArray.float32.set(t.positions,3*pe);const r=t.positions.length/3;for(let p=0;p<r;++p){const r=3*p;de=Math.max(de,t.positions[r+2]);const n=t.normals[r+1]*nv,o=t.normals[r+2]*nv,a=3*(pe+p);ie.layoutNormalArray.int16[a]=t.normals[r]*nv,ie.layoutNormalArray.int16[a+1]=n,ie.layoutNormalArray.int16[a+2]=o;const s=t.ao[p];ie.layoutAOArray.uint8[pe+p]=255*s;const l=1+(s-1)*A,c=255*e.b*l<<8|255*i;ie.layoutColorArray.uint16[2*(pe+p)]=255*e.r*l<<8|255*e.g*l,ie.layoutColorArray.uint16[2*(pe+p)+1]=c}const n=Math.min(8191,Math.max(0,Math.floor(Q.x))),o=Math.min(8191,Math.max(0,Math.floor(Q.y))),a=Math.floor(w),s=20,l=4*n+Math.min(3,Math.round((J.x-K.x)*this.tileToMeter/s)),c=4*o+Math.min(3,Math.round((J.y-K.y)*this.tileToMeter/s));for(let t=0;t<r;++t){const e=3*(pe+t);ie.layoutCentroidArray.int16[e]=l,ie.layoutCentroidArray.int16[e+1]=c,ie.layoutCentroidArray.int16[e+2]=a}if(ie.layoutFloodLightDataArray.int16.fill(0===t.buildingPart?F:0,pe,pe+r),k){const e=255*P.r<<8|255*P.g,i=255*P.b<<8|255*C;for(let t=0;t<r;++t){const r=2*(pe+t);ie.layoutFacadePaintArray.uint16[r]=e,ie.layoutFacadePaintArray.uint16[r+1]=i}for(let n=0;n<r;++n)if(t.isFauxFacade[n]){const e=Math.min(65535,Math.floor(t.uv[2*n]*te.outerRingLength));ie.layoutFacadeDataArray.emplace(pe+n,1|e,q,Z,X),ie.layoutFacadeVerticalRangeArray.emplace(pe+n,$,W)}else ie.layoutFacadeDataArray.emplace(pe+n,0,0,0,0),ie.layoutFacadeVerticalRangeArray.emplace(pe+n,0,0)}const u=ne.vertexLength,h=t.indices.length/3,d=ie.indexArray.length;ie.indexArray.resize(d+h);for(let p=0;p<h;++p){const e=3*p,i=3*d+e;ie.indexArray.uint16[i]=u+t.indices[e],ie.indexArray.uint16[i+1]=u+t.indices[e+1],ie.indexArray.uint16[i+2]=u+t.indices[e+2]}1!==t.buildingPart&&0!==t.buildingPart&&2!==t.buildingPart&&3!==t.buildingPart||oe.push({part:t.buildingPart,vertexOffset:pe,vertexLength:t.positions.length/3}),pe+=r,ne.vertexLength+=r,ne.primitiveLength+=t.indices.length/3}this.maxHeight=Math.max(this.maxHeight,de);const fe=ie.indexArray.length-he,me=this.footprintsIndices.length,_e=this.footprintsVertices.length,ge=[],ye=new ke(1/0,1/0),xe=new ke(-1/0,-1/0),ve=b<=0,be=this.groundEffect.vertexArray.length;for(const t of te.modifiedPolygonRings){const e=[],i=new ke(1/0,1/0),r=new ke(-1/0,-1/0);for(let n=0;n<t.length;n+=2){const o=t.length-n-2;i.x=Math.min(i.x,t[o]),i.y=Math.min(i.y,t[o+1]),r.x=Math.max(r.x,t[o]),r.y=Math.max(r.y,t[o+1]);const a=new ke(t[o],t[o+1]);ve&&e.push(a),ge.push(a.x,a.y),this.footprintsVertices.emplaceBack(a.x,a.y)}ye.x=Math.min(ye.x,i.x),ye.y=Math.min(ye.y,i.y),xe.x=Math.max(xe.x,r.x),xe.y=Math.max(xe.y,r.y),ve&&this.groundEffect.addData(e,[i,r],I)}const we=this.groundEffect.vertexArray.length-be;this.groundEffect.groundRadiusArray.reserveForAdditional(we);for(let t=0;t<we;t++)this.groundEffect.groundRadiusArray.emplaceBack(E);(K.x<0||J.x>co||K.y<0||J.y>co)&&this.featuresOnBorder.push({featureId:m.id,footprintIndex:this.footprints.length});{const e=ec(ge,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+e.length),this.footprintsIndices.uint16.set(e,me),this.buildingIds.add(s??m.id),this.footprintsMin.x=Math.min(this.footprintsMin.x,ye.x),this.footprintsMin.y=Math.min(this.footprintsMin.y,ye.y),this.footprintsMax.x=Math.max(this.footprintsMax.x,xe.x),this.footprintsMax.y=Math.max(this.footprintsMax.y,xe.y);const t={footprintVertexOffset:_e,footprintVertexLength:this.footprintsVertices.length-_e,footprintIndexOffset:me,footprintIndexLength:this.footprintsIndices.length-me,min:ye,max:xe,hiddenFlags:0,indicesOffset:he,indicesLength:fe,bloomIndicesOffset:se,bloomIndicesLength:le,groundEffectVertexOffset:be,groundEffectVertexLength:we,hasFauxFacade:k,height:de,promoteId:_,feature:l,parts:oe,buildingBloom:ae},i=this.footprints.length;void 0!==m.id&&this.featureFootprintLookup.set(m.id,i),h(s,i),this.footprints.push(t)}this.programConfigurations.populatePaintArrays(ie.layoutVertexArray.length,m,g,{},t.availableImages,i,t.brightness),this.groundEffect.addPaintPropertiesData(m,g,{},t.availableImages,i,t.brightness),t.featureIndex.insert(m,d,g,y,this.index,ce)}l.forEach(({buildingId:e,footprintIndex:t})=>{c.has(e)&&(this.footprints[t].hiddenFlags|=4)});const f=new Set;this.buildingIds.forEach((e,t,i)=>{c.has(e)||f.add(e)}),this.buildingIds=f,this.groundEffect.prepareBorderSegments()}update(e,t,i,r,n,o,a){this.programConfigurations.updatePaintArrays(e,t,n,i,r,o,a),this.groundEffect.update(e,t,n,i,r,o,a),this.evaluate(this.layers[0],e),this.colorBufferUploaded=!1}updateExpressions(e){this.programConfigurations.updateExpressions(e),this.groundEffect.programConfigurations.updateExpressions(e)}isEmpty(){return 0===this.buildingWithoutFacade.layoutVertexArray.length&&0===this.buildingWithFacade.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){const t=t=>{t.layoutVertexBuffer=e.createVertexBuffer(t.layoutVertexArray,Qy.members),t.layoutNormalBuffer=e.createVertexBuffer(t.layoutNormalArray,ex.members),t.layoutCentroidBuffer=e.createVertexBuffer(t.layoutCentroidArray,tx.members),t.layoutFloodLightDataBuffer=e.createVertexBuffer(t.layoutFloodLightDataArray,sx.members),t.layoutFacadeDataArray&&t.layoutFacadeDataArray.length&&(t.layoutFacadeDataBuffer=e.createVertexBuffer(t.layoutFacadeDataArray,nx.members)),t.layoutFacadeVerticalRangeArray&&t.layoutFacadeVerticalRangeArray.length&&(t.layoutFacadeVerticalRangeBuffer=e.createVertexBuffer(t.layoutFacadeVerticalRangeArray,ox.members)),t.entranceBloom.layoutVertexArray.length&&(t.entranceBloom.layoutVertexBuffer=e.createVertexBuffer(t.entranceBloom.layoutVertexArray,Qy.members),t.entranceBloom.layoutAttenuationBuffer=e.createVertexBuffer(t.entranceBloom.layoutAttenuationArray,ax.members)),this.uploadUpdatedColorBuffer(e),this.uploadUpdatedIndexBuffer(e)};this.uploaded||(t(this.buildingWithoutFacade),t(this.buildingWithFacade),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){const e=e=>{e.layoutVertexBuffer&&(e.layoutVertexBuffer.destroy(),e.layoutNormalBuffer.destroy(),e.layoutColorBuffer.destroy(),e.segmentsBucket.destroy(),e.indexBuffer&&e.indexBuffer.destroy(),e.entranceBloom.layoutVertexBuffer&&(e.entranceBloom.layoutVertexBuffer.destroy(),e.entranceBloom.layoutColorBuffer.destroy(),e.entranceBloom.layoutAttenuationBuffer.destroy(),e.entranceBloom.indexBuffer.destroy(),e.entranceBloom.segmentsBucket.destroy()))};e(this.buildingWithoutFacade),e(this.buildingWithFacade),this.groundEffect.destroy(),this.programConfigurations.destroy()}updateFootprintHiddenFlags(e,t,i=!0){let r=!1;const n=i?t:0,o=0|(i?-1:~t);0===this.groundEffect.hiddenByLandmarkVertexArray.length&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const a of e){const e=this.footprints[a],t=e.hiddenFlags&o|n;e.hiddenFlags!==t&&(e.hiddenFlags=t,r=!0,this.groundEffect.updateHiddenByLandmarkRange(e.groundEffectVertexOffset,e.groundEffectVertexLength,0!==e.hiddenFlags))}return r&&(this.indexArrayForConflationUploaded=!1),r}uploadUpdatedIndexBuffer(e){if(this.groundEffect.uploadHiddenByLandmark(e),this.indexArrayForConflationUploaded)return;const t=e=>{0!==e.indexArray.length&&(e.indexArrayForConflation.resize(e.indexArray.length),e.indexArrayForConflation.uint16.set(e.indexArray.uint16),e.entranceBloom.indexArrayForConflation.resize(e.entranceBloom.indexArray.length),e.entranceBloom.indexArrayForConflation.uint16.set(e.entranceBloom.indexArray.uint16))};t(this.buildingWithoutFacade),t(this.buildingWithFacade);for(const r of this.footprints){const e=r.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,t=r.indicesOffset+r.indicesLength;if(0!==r.hiddenFlags){for(let n=r.indicesOffset;n<t;n++)e.indexArrayForConflation.uint16[3*n+0]=0,e.indexArrayForConflation.uint16[3*n+1]=0,e.indexArrayForConflation.uint16[3*n+2]=0;const i=r.bloomIndicesOffset+r.bloomIndicesLength;for(let t=r.bloomIndicesOffset;t<i;t++)e.entranceBloom.indexArrayForConflation.uint16[3*t+0]=0,e.entranceBloom.indexArrayForConflation.uint16[3*t+1]=0,e.entranceBloom.indexArrayForConflation.uint16[3*t+2]=0}}const i=t=>{0!==t.indexArray.length&&(t.indexBuffer?t.indexBuffer.updateData(t.indexArrayForConflation):t.indexBuffer=e.createIndexBuffer(t.indexArrayForConflation,!0),t.entranceBloom.indexBuffer?t.entranceBloom.indexBuffer.updateData(t.entranceBloom.indexArrayForConflation):t.entranceBloom.indexBuffer=e.createIndexBuffer(t.entranceBloom.indexArrayForConflation,!0))};i(this.buildingWithoutFacade),i(this.buildingWithFacade),this.indexArrayForConflationUploaded=!0}uploadUpdatedColorBuffer(e){const t=t=>{t.layoutColorBuffer?t.layoutColorBuffer.updateData(t.layoutColorArray):t.layoutColorBuffer=e.createVertexBuffer(t.layoutColorArray,ix.members,!0),t.layoutFacadePaintArray&&(t.layoutFacadePaintBuffer?t.layoutFacadePaintBuffer.updateData(t.layoutFacadePaintArray):t.layoutFacadePaintBuffer=e.createVertexBuffer(t.layoutFacadePaintArray,rx.members,!0)),t.entranceBloom.layoutColorBuffer?t.entranceBloom.layoutColorBuffer.updateData(t.entranceBloom.layoutColorArray):t.entranceBloom.layoutColorBuffer=e.createVertexBuffer(t.entranceBloom.layoutColorArray,ix.members,!0)};t(this.buildingWithoutFacade),t(this.buildingWithFacade),this.colorBufferUploaded=!0}evaluate(e,t){const i=e.paint.get("building-ambient-occlusion-intensity");for(const r of this.footprints){if(4&r.hiddenFlags)continue;const n=t[r.promoteId],o=r.feature;o.properties["building-part"]="roof";const a=e.paint.get("building-color").evaluate(o,n,this.canonical).toPremultipliedRenderColor(this.lut),s=e.paint.get("building-emissive-strength").evaluate(o,n,this.canonical);o.properties["building-part"]="wall";const l=e.paint.get("building-color").evaluate(o,n,this.canonical).toPremultipliedRenderColor(this.lut),c=e.paint.get("building-emissive-strength").evaluate(o,n,this.canonical);o.properties["building-part"]="window";const u=e.paint.get("building-color").evaluate(o,n,this.canonical).toPremultipliedRenderColor(this.lut),h=e.paint.get("building-emissive-strength").evaluate(o,n,this.canonical);o.properties["building-part"]="door";const d=e.paint.get("building-color").evaluate(o,n,this.canonical).toPremultipliedRenderColor(this.lut),p=e.paint.get("building-emissive-strength").evaluate(o,n,this.canonical),f=r.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(const e of r.parts){let t,n=a;1===e.part?(n=a,t=s):0===e.part?(n=l,t=c):2===e.part?(n=u,t=h):3===e.part&&(n=d,t=p),t=ht(t,0,1);for(let o=0;o<e.vertexLength;o++){const a=e.vertexOffset+o,s=1+(f.layoutAOArray.uint8[a]/255-1)*i;f.layoutColorArray.emplace(a,n.r*s*255<<8|n.g*s*255,n.b*s*255<<8|255*t),r.hasFauxFacade&&f.layoutFacadePaintArray.emplace(a,255*u.r<<8|255*u.g,255*u.b<<8|255*h)}}const m=r.buildingBloom;if(m)for(let e=0;e<m.vertexLength;e++)f.entranceBloom.layoutColorArray.emplace(m.vertexOffset+e,255*d.r<<8|255*d.g,255*d.b<<8|51*p)}}needsEvaluation(){return!this.colorBufferUploaded}updateReplacement(e,t,i){if(t.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=t.updateTime;const r=t.getReplacementRegionsForTile(e.toUnwrapped());if(hm(this.activeReplacements,r))return;this.activeReplacements=r;for(const o of this.footprints)o.hiddenFlags&=-2;const n=[];for(const o of this.activeReplacements){if(o.order<i)continue;const t=Math.max(1,Math.pow(2,o.footprintTileId.canonical.z-e.canonical.z));for(const i of this.footprints)i.min.x>o.max.x||i.max.x<o.min.x||i.min.y>o.max.y||i.max.y<o.min.y||(n.length=0,fv(this.footprintsVertices,i.footprintVertexOffset,i.footprintVertexLength,o.footprintTileId.canonical,e.canonical,n),fm(o.footprint,n,this.footprintsIndices.uint16,i.footprintIndexOffset,i.footprintIndexLength,0,-t)&&(i.hiddenFlags|=1))}0===this.groundEffect.hiddenByLandmarkVertexArray.length&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const o of this.footprints)this.groundEffect.updateHiddenByLandmarkRange(o.groundEffectVertexOffset,o.groundEffectVertexLength,0!==o.hiddenFlags);this.indexArrayForConflationUploaded=!1}getFootprint(e){if(void 0!==e.id){const t=this.featureFootprintLookup.get(e.id);return this.footprints[t]}return null}getHeightAtTileCoord(e,t){let i=Number.NEGATIVE_INFINITY,r=!0;const n=4*(e+co)*co+(t+co);if(Object.hasOwn(this.footprintLookup,n)){const e=this.footprintLookup[n];return e?{height:e.height,hidden:0!==e.hiddenFlags}:void 0}const o=new ke(e,t);for(const a of this.footprints)e>a.max.x||a.min.x>e||t>a.max.y||a.min.y>t||a.height<=i||pv(o,this.footprintsVertices.float32.subarray(2*a.footprintVertexOffset,2*(a.footprintVertexOffset+a.footprintVertexLength)),this.footprintsIndices.uint16.subarray(a.footprintIndexOffset,a.footprintIndexOffset+a.footprintIndexLength))&&(i=a.height,this.footprintLookup[n]=a,r=0!==a.hiddenFlags);if(i!==Number.NEGATIVE_INFINITY)return{height:i,hidden:r};this.footprintLookup[n]=void 0}}function pv(e,t,i){for(let r=0;r<i.length;r+=3){const n=i[r],o=i[r+1],a=i[r+2],s=t[2*n+0],l=t[2*n+1],c=t[2*o+0],u=t[2*o+1],h=t[2*a+0],d=t[2*a+1],p=(s-h)*(e.y-d)-(l-d)*(e.x-h),f=(c-s)*(e.y-l)-(u-l)*(e.x-s);if(p<0!=f<0&&0!==p&&0!==f)continue;const m=(h-c)*(e.y-u)-(d-u)*(e.x-c);if(0===m||m<0==p+f<=0)return!0}return!1}function fv(e,t,i,r,n,o){const a=Math.pow(2,r.z-n.z);for(let s=0;s<i;s++){let i=e.float32[2*(s+t)+0],l=e.float32[2*(s+t)+1];i=(i+n.x*co)*a-r.x*co,l=(l+n.y*co)*a-r.y*co,o.push(new ke(i,l))}}Rs(dv,"BuildingBucket",{omit:["layers"]}),Rs(hv,"BuildingGeometry"),Rs(uv,"BuildingBloomGeometry");const mv="hd_road_coverage";Rs(class{constructor(e=0,t=[]){this.frcMask=e,this.rings=t}hasGeometry(){return this.rings.length>0&&this.rings[0].length>0}},"FrcCoveragePolygon");class _v{static calculate(e,t,i){const r=new Set,n=new Map,o=new Set,a=new Set;for(const l of Object.values(e))for(const[e,i]of Object.entries(l.floors)){o.add(e),i.isDefault&&a.add(e),i.conflicts&&n.set(e,i.conflicts);const s=e===t,l=i.connections&&t&&i.connections.has(t);(s||l)&&r.add(e)}const s=e=>{const t=n.get(e)||new Set;for(const i of r)if((n.get(i)||new Set).has(e)||t.has(i))return!0;return!1};if(i)for(const l of i)o.has(l)&&(s(l)||r.add(l));for(const l of a)r.has(l)||s(l)||r.add(l);return r}}async function gv(){}function yv(e,t,i){const r=t.paint.get(e).value;return"constant"===r.kind?r.value:i.programConfigurations.get(t.id).getMaxValue(e)}function xv(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function vv(e,t,i,r,n){if(!t[0]&&!t[1])return e;const o=ke.convert(t)._mult(n);"viewport"===i&&o._rotate(-r);const a=[];for(let s=0;s<e.length;s++)a.push(e[s].sub(o));return a}function bv(e,t,i,r){const n=ke.convert(e)._mult(r);return"viewport"===t&&n._rotate(-i),n}let wv,Ev;const Av=p(),Iv=(e,t,i,r,n,o)=>{const a=e.transform,s="globe"===a.projection.name;let l;if("map"===o.paint.get("circle-pitch-alignment"))if(s){const e=df(a.zoom,t.canonical)*a._pixelsPerMercatorPixel;l=Float32Array.from([e,0,0,e])}else l=a.calculatePixelsToTileUnitsMatrix(i);else l=new Float32Array([a.pixelsToGLUnits[0],0,0,a.pixelsToGLUnits[1]]);const c={u_camera_to_center_distance:e.transform.getCameraToCenterDistance(a.projection),u_matrix:e.translatePosMatrix(t.projMatrix,i,o.paint.get("circle-translate"),o.paint.get("circle-translate-anchor")),u_device_pixel_ratio:ei.devicePixelRatio,u_extrude_scale:l,u_inv_rot_matrix:Av,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:o.paint.get("circle-emissive-strength")};if(s){c.u_inv_rot_matrix=r,c.u_merc_center=n,c.u_tile_id=[t.canonical.x,t.canonical.y,1<<t.canonical.z],c.u_zoom_transition=mf(a.zoom);const e=n[0]*co,i=n[1]*co;c.u_up_dir=a.projection.upVector(new Df(0,0,0),e,i)}return c},Sv=e=>{const t=[];return"map"===e.paint.get("circle-pitch-alignment")&&t.push("PITCH_WITH_MAP"),"map"===e.paint.get("circle-pitch-scale")&&t.push("SCALE_WITH_MAP"),t};function Tv(e,t,i,r,n,o,a,s,l){if(o&&e.queryGeometry.isAboveHorizon)return!1;o&&(l*=e.pixelToTileUnitsFactor);const c=e.tileID.canonical,u=i.projection.upVectorScale(c,i.center.lat,i.worldSize).metersToTile;for(const h of t)for(const t of h){const h=t.add(s),d=n&&i.elevation?i.elevation.exaggeration()*n.getElevationAt(h.x,h.y,!0):0,p=i.projection.projectTilePoint(h.x,h.y,c);if(d>0){const e=i.projection.upVector(c,h.x,h.y);p.x+=e[0]*u*d,p.y+=e[1]*u*d,p.z+=e[2]*u*d}const f=o?h:Dv(p.x,p.y,p.z,r),m=o?e.tilespaceRays.map(e=>Cv(e,d)):e.queryGeometry.screenGeometry,_=me([],[p.x,p.y,p.z,1],r);if(!a&&o?l*=_[3]/i.cameraToCenterDistance:a&&!o&&(l*=i.cameraToCenterDistance/_[3]),o){const e=Xn((t.y/co+c.y)/(1<<c.z));l/=i.projection.pixelsPerMeter(e,1)/Uc(1,e)}if(sd(m,f,l))return!0}return!1}function Dv(e,t,i,r){const n=me([],[e,t,i,1],r);return new ke(n[0]/n[3],n[1]/n[3])}const Mv=V(0,0,0),Pv=V(0,0,1);function Cv(e,t){const i=O();return Mv[2]=t,e.intersectsPlane(Mv,Pv,i),new ke(i[0],i[1])}class Rv extends $d{}let zv,Lv;Rs(Rv,"HeatmapBucket",{omit:["layers"]});const Fv=(e,t,i,r)=>Wr(t,i,"log"===r?(Math.pow(10,e)-1)/9:e);function Ov(e){const{expression:t,evaluationKey:i,resolution:r=256,clips:n,scale:o="linear",lut:a=null}=e,s=n?n.length:1,l=e.image||new zd({width:r,height:s}),c={},u=(e,r,n)=>{c[i]=n;const o=t.evaluate(c),s=o?.toNonPremultipliedRenderColor(a)??null;s&&(l.data[e+r+0]=Math.floor(255*s.r),l.data[e+r+1]=Math.floor(255*s.g),l.data[e+r+2]=Math.floor(255*s.b),l.data[e+r+3]=Math.floor(255*s.a))};for(let h=0,d=0;h<s;++h,d+=4*r){const e=n?.[h].start??0,t=n?.[h].end??1;for(let i=0,n=0;i<r;i++,n+=4)u(d,n,Fv(i/(r-1),e,t,o))}return l}let Bv,kv,Vv,Nv,Uv,jv,Gv,Hv,$v,Wv,qv,Zv;class Xv{constructor(e){this.zoom=e.zoom,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.footprints=[],this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,t){for(const i of this.footprints)t.push({footprint:i,id:e})}updateAppearances(e,t,i,r){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,i,r){const n=[];for(const{feature:o,id:a,index:s,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,c=ru(o,e);if(!this.layers[0]._featureFilter.filter(new ll(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),c,i))continue;const u={id:a,properties:o.properties,type:o.type,sourceLayerIndex:l,index:s,geometry:e?c.geometry:iu(o,i,r),patterns:{}};n.push(u)}for(const o of n){const{geometry:r,index:n,sourceLayerIndex:a}=o;this.addFeature(o,r,n,i,{},t.availableImages,t.brightness),t.featureIndex.insert(e[n].feature,r,n,a,this.index)}}isEmpty(){return 0===this.footprints.length}uploadPending(){return!1}upload(e){}update(e,t,i,r,n,o,a){}destroy(){}addFeature(e,t,i,r,n,o=[],a){for(const s of We(t,2)){const e=[],t=[],i=[],r=new ke(1/0,1/0),n=new ke(-1/0,-1/0);for(const l of s)if(0!==l.length){l!==s[0]&&i.push(t.length/2);for(let i=0;i<l.length;i++)t.push(l[i].x),t.push(l[i].y),e.push(l[i]),r.x=Math.min(r.x,l[i].x),r.y=Math.min(r.y,l[i].y),n.x=Math.max(n.x,l[i].x),n.y=Math.max(n.y,l[i].y)}const o=ec(t,i),a=new oy(e,o,8,256);this.footprints.push({vertices:e,indices:o,grid:a,min:r,max:n})}}}function Yv(e,t){return e.x*t.x+e.y*t.y}function Kv(e,t){if(1===e.length){let i=0;const r=t[i++];let n;for(;!n||r.equals(n);)if(n=t[i++],!n)return 1/0;for(;i<t.length;i++){const o=t[i],a=e[0],s=n.sub(r),l=o.sub(r),c=a.sub(r),u=Yv(s,s),h=Yv(s,l),d=Yv(l,l),p=Yv(c,s),f=Yv(c,l),m=u*d-h*h,_=(d*p-h*f)/m,g=(u*f-h*p)/m,y=r.z*(1-_-g)+n.z*_+o.z*g;if(isFinite(y))return y}return 1/0}{let e=1/0;for(const i of t)e=Math.min(e,i.z);return e}}function Jv(e,t,i){let r=1/0;ld(i,t)&&(r=Kv(i,t[0]));for(let n=0;n<t.length;n++){const o=t[n],a=e[n];for(let e=0;e<o.length-1;e++){const t=o[e],n=[t,o[e+1],a[e+1],a[e],t];ad(i,n)&&(r=Math.min(r,Kv(i,n)))}}return r!==1/0&&r}function Qv(e,t,i,r,n,o,a,s,l,c,u){return"globe"===e.projection.name?function(e,t,i,r,n,o,a,s,l,c,u){const h=[],d=[],p=e.projection.upVectorScale(u,e.center.lat,e.worldSize).metersToTile,f=[0,0,0,1],m=[0,0,0,1],_=(e,t,i,r)=>{e[0]=t,e[1]=i,e[2]=r,e[3]=1},g=Jx();i>0&&(i+=g),r+=g;for(const y of t){const t=[],g=[];for(const h of y){const d=h.x+n.x,y=h.y+n.y,x=e.projection.projectTilePoint(d,y,u),v=e.projection.upVector(u,h.x,h.y);let b=i,w=r;if(a){const e=eb(d,y,i,r,a,s,l,c);b+=e.base,w+=e.top}0!==i?_(f,x.x+v[0]*p*b,x.y+v[1]*p*b,x.z+v[2]*p*b):_(f,x.x,x.y,x.z),_(m,x.x+v[0]*p*w,x.y+v[1]*p*w,x.z+v[2]*p*w),ie(f,f,o),ie(m,m,o),t.push(new wd(f[0],f[1],f[2])),g.push(new wd(m[0],m[1],m[2]))}h.push(t),d.push(g)}return[h,d]}(e,t,i,r,n,o,a,s,l,c,u):a?function(e,t,i,r,n,o,a,s,l){const c=[],u=[],h=[0,0,0,1];for(const d of e){const e=[],p=[];for(const c of d){const u=c.x+r.x,d=c.y+r.y,f=eb(u,d,t,i,o,a,s,l);h[0]=u,h[1]=d,h[2]=f.base,h[3]=1,me(h,h,n),h[3]=Math.max(h[3],1e-5);const m=new wd(h[0]/h[3],h[1]/h[3],h[2]/h[3]);h[0]=u,h[1]=d,h[2]=f.top,h[3]=1,me(h,h,n),h[3]=Math.max(h[3],1e-5);const _=new wd(h[0]/h[3],h[1]/h[3],h[2]/h[3]);e.push(m),p.push(_)}c.push(e),u.push(p)}return[c,u]}(t,i,r,n,o,a,s,l,c):function(e,t,i,r,n){const o=[],a=[],s=n[8]*t,l=n[9]*t,c=n[10]*t,u=n[11]*t,h=n[8]*i,d=n[9]*i,p=n[10]*i,f=n[11]*i;for(const m of e){const e=[],t=[];for(const i of m){const o=i.x+r.x,a=i.y+r.y,m=n[0]*o+n[4]*a+n[12],_=n[1]*o+n[5]*a+n[13],g=n[2]*o+n[6]*a+n[14],y=n[3]*o+n[7]*a+n[15],x=m+s,v=_+l,b=g+c,w=Math.max(y+u,1e-5),E=m+h,A=_+d,I=g+p,S=Math.max(y+f,1e-5);e.push(new wd(x/w,v/w,b/w)),t.push(new wd(E/S,A/S,I/S))}o.push(e),a.push(t)}return[o,a]}(t,i,r,n,o)}function eb(e,t,i,r,n,o,a,s){const l=a*n.getElevationAt(e,t,!0,!0),c=0!==o[0],u=c?0===o[1]?a*(o[0]/7-450):a*function(e,t,i){const r=Math.floor(t[0]/8),n=Math.floor(t[1]/8),o=10*(t[0]-8*r),a=10*(t[1]-8*n),s=e.getElevationAt(r,n,!0,!0),l=e.getMeterToDEM(i),c=Math.floor(.5*(o*l-1)),u=Math.floor(.5*(a*l-1)),h=e.tileCoordToPixel(r,n),d=2*c+1,p=2*u+1,f=function(e,t,i,r,n){return[e.getElevationAtPixel(t,i,!0),e.getElevationAtPixel(t+n,i,!0),e.getElevationAtPixel(t,i+n,!0),e.getElevationAtPixel(t+r,i+n,!0)]}(e,h.x-c,h.y-u,d,p),m=Math.abs(f[0]-f[1]),_=Math.abs(f[2]-f[3]),g=Math.abs(f[0]-f[2])+Math.abs(f[1]-f[3]),y=Math.min(.25,.5*l*(m+_)/d),x=Math.min(.25,.5*l*g/p);return s+Math.max(y*o,x*a)}(n,o,s):l;return{base:l+(0===i?-1:i),top:c?Math.max(u+r,l+i+2):l+r}}function tb(e,t,i){return t*(co/(e.tileSize*Math.pow(2,i-e.tileID.overscaledZ)))}Rs(Xv,"ClipBucket",{omit:["layers"]});const ib=(e,t,i,r,n,o,a,s,l,c)=>{const u=e.transform,h=u.calculatePixelsToTileUnitsMatrix(t),d="none"===i.paint.get("line-trim-color-use-theme").constantOr("default"),p=u.pitch<15?Wr(.07,.7,ht((14-u.zoom)/5,0,1)):.07;return{u_matrix:ob(e,t,i,r),u_pixels_to_tile_units:h,u_device_pixel_ratio:o,u_width_scale:a,u_floor_width_scale:s,u_units_to_pixels:[1/u.pixelsToGLUnits[0],1/u.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_border_gradient_image:2,u_image_height:n,u_texsize:sb(i)&&t.lineAtlasTexture?t.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:nb(t,e.transform),u_alpha_discard_threshold:0,u_trim_offset:l,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_gradient_mix_range:[1,1],u_trim_color:i.paint.get("line-trim-color").toPremultipliedRenderColor(d?null:i.lut).toArray01(),u_zbias_factor:p,u_road_view_depth_bias:0,u_road_clip_to_view:[0,0,0,0],u_tile_to_meter:qc(t.tileID.canonical,0),u_ground_shadow_factor:c,u_opacity_multiplier:1}},rb=(e,t,i,r,n,o,a,s,l,c)=>{const u=e.transform,h=u.pitch<15?Wr(.07,.7,ht((14-u.zoom)/5,0,1)):.07,d="none"===i.paint.get("line-trim-color-use-theme").constantOr("default");return{u_matrix:ob(e,t,i,r),u_texsize:t.imageAtlasTexture?t.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:u.calculatePixelsToTileUnitsMatrix(t),u_device_pixel_ratio:n,u_width_scale:o,u_floor_width_scale:a,u_image:0,u_tile_units_to_pixels:nb(t,u),u_units_to_pixels:[1/u.pixelsToGLUnits[0],1/u.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:s,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_gradient_mix_range:[1,1],u_trim_color:i.paint.get("line-trim-color").toPremultipliedRenderColor(d?null:i.lut).toArray01(),u_zbias_factor:h,u_tile_to_meter:qc(t.tileID.canonical,0),u_ground_shadow_factor:l,u_pattern_transition:c,u_opacity_multiplier:1}};function nb(e,t){return 1/tb(e,1,t.tileZoom)}function ob(e,t,i,r){return e.translatePosMatrix(r||t.tileID.projMatrix,t,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const ab=e=>{const t=[];sb(e)&&t.push("RENDER_LINE_DASH"),e.paint.get("line-gradient")&&t.push("RENDER_LINE_GRADIENT"),"multiply"===e.paint.get("line-blend-mode")&&t.push("LINE_BLEND_MULTIPLY"),"additive"===e.paint.get("line-blend-mode")&&t.push("LINE_BLEND_ADDITIVE");const i=e.paint.get("line-trim-offset");0===i[0]&&0===i[1]||t.push("RENDER_LINE_TRIM_OFFSET");const r=0!==e.paint.get("line-border-width").constantOr(1);r&&t.push("RENDER_LINE_BORDER"),r&&e.paint.get("line-border-gradient")&&t.push("RENDER_LINE_BORDER_GRADIENT");const n="none"===e.layout.get("line-join").constantOr("miter"),o=!!e.paint.get("line-pattern").constantOr(1);return n&&o&&t.push("LINE_JOIN_NONE"),t};function sb(e){const t=e.paint.get("line-dasharray").value;return"constant"!==t.kind||t.value}let lb;const cb=()=>lb||(lb={layout:qv||(qv=new wl({"line-cap":new yl(El.layout_line["line-cap"]),"line-join":new yl(El.layout_line["line-join"]),"line-miter-limit":new gl(El.layout_line["line-miter-limit"]),"line-round-limit":new gl(El.layout_line["line-round-limit"]),"line-sort-key":new yl(El.layout_line["line-sort-key"]),"line-z-offset":new yl(El.layout_line["line-z-offset"]),"line-elevation-reference":new gl(El.layout_line["line-elevation-reference"]),"line-cross-slope":new gl(El.layout_line["line-cross-slope"]),visibility:new gl(El.layout_line.visibility),"line-width-unit":new gl(El.layout_line["line-width-unit"]),"line-elevation-ground-scale":new yl(El.layout_line["line-elevation-ground-scale"])})),paint:Zv||(Zv=new wl({"line-opacity":new yl(El.paint_line["line-opacity"]),"line-color":new yl(El.paint_line["line-color"]),"line-translate":new gl(El.paint_line["line-translate"]),"line-translate-anchor":new gl(El.paint_line["line-translate-anchor"]),"line-width":new yl(El.paint_line["line-width"]),"line-gap-width":new yl(El.paint_line["line-gap-width"]),"line-offset":new yl(El.paint_line["line-offset"]),"line-blur":new yl(El.paint_line["line-blur"]),"line-dasharray":new yl(El.paint_line["line-dasharray"]),"line-pattern":new yl(El.paint_line["line-pattern"]),"line-pattern-cross-fade":new gl(El.paint_line["line-pattern-cross-fade"]),"line-gradient":new xl(El.paint_line["line-gradient"]),"line-trim-offset":new gl(El.paint_line["line-trim-offset"]),"line-trim-fade-range":new gl(El.paint_line["line-trim-fade-range"]),"line-trim-color":new gl(El.paint_line["line-trim-color"]),"line-emissive-strength":new yl(El.paint_line["line-emissive-strength"]),"line-border-width":new yl(El.paint_line["line-border-width"]),"line-border-color":new yl(El.paint_line["line-border-color"]),"line-border-gradient":new xl(El.paint_line["line-border-gradient"]),"line-occlusion-opacity":new gl(El.paint_line["line-occlusion-opacity"]),"line-blend-mode":new gl(El.paint_line["line-blend-mode"]),"line-blend-additive-clamp":new gl(El.paint_line["line-blend-additive-clamp"]),"line-cutout-depth":new gl(El.paint_line["line-cutout-depth"]),"line-color-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"}),"line-border-gradient-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"})}))},lb);class ub extends yl{possiblyEvaluate(e,t){return t=new ll(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,transition:t.transition,worldview:t.worldview}),super.possiblyEvaluate(e,t)}evaluate(e,t,i,r){return t={...t,zoom:Math.floor(t.zoom)},super.evaluate(e,t,i,r)}}let hb,db,pb,fb;function mb(e,t){return t>0?t+2*e:e}function _b(e,t){return t.replace(/{([^{}]+)}/g,(t,i)=>i in e?String(e[i]):"")}class gb{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:rn,this.defaultValue=e}evaluate(e){if(e.formattedSection){const t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Rs(gb,"FormatSectionOverride",{omit:["defaultValue"]});const yb={};function xb(e){return"constant"!==e.value.kind&&e.value.isStateDependent}const vb=()=>fb||(fb={layout:db||(db=new wl({"symbol-placement":new gl(El.layout_symbol["symbol-placement"]),"symbol-spacing":new gl(El.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new gl(El.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new yl(El.layout_symbol["symbol-sort-key"]),"symbol-z-order":new gl(El.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new gl(El.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new gl(El.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new gl(El.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new gl(El.layout_symbol["icon-ignore-placement"]),"icon-optional":new gl(El.layout_symbol["icon-optional"]),"icon-rotation-alignment":new gl(El.layout_symbol["icon-rotation-alignment"]),"icon-size":new yl(El.layout_symbol["icon-size"]),"icon-size-scale-range":new gl(El.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new yl(El.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new yl(El.layout_symbol["icon-text-fit-padding"]),"icon-image":new yl(El.layout_symbol["icon-image"]),"icon-image-use-theme":new gl({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new yl(El.layout_symbol["icon-rotate"]),"icon-padding":new gl(El.layout_symbol["icon-padding"]),"icon-keep-upright":new gl(El.layout_symbol["icon-keep-upright"]),"icon-offset":new yl(El.layout_symbol["icon-offset"]),"icon-anchor":new yl(El.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new gl(El.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new gl(El.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new gl(El.layout_symbol["text-rotation-alignment"]),"text-field":new yl(El.layout_symbol["text-field"]),"text-font":new yl(El.layout_symbol["text-font"]),"text-size":new yl(El.layout_symbol["text-size"]),"text-size-scale-range":new gl(El.layout_symbol["text-size-scale-range"]),"text-max-width":new yl(El.layout_symbol["text-max-width"]),"text-line-height":new yl(El.layout_symbol["text-line-height"]),"text-letter-spacing":new yl(El.layout_symbol["text-letter-spacing"]),"text-justify":new yl(El.layout_symbol["text-justify"]),"text-radial-offset":new yl(El.layout_symbol["text-radial-offset"]),"text-variable-anchor":new gl(El.layout_symbol["text-variable-anchor"]),"text-anchor":new yl(El.layout_symbol["text-anchor"]),"text-max-angle":new gl(El.layout_symbol["text-max-angle"]),"text-writing-mode":new gl(El.layout_symbol["text-writing-mode"]),"text-rotate":new yl(El.layout_symbol["text-rotate"]),"text-padding":new gl(El.layout_symbol["text-padding"]),"text-keep-upright":new gl(El.layout_symbol["text-keep-upright"]),"text-transform":new yl(El.layout_symbol["text-transform"]),"text-offset":new yl(El.layout_symbol["text-offset"]),"text-allow-overlap":new gl(El.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new gl(El.layout_symbol["text-ignore-placement"]),"text-optional":new gl(El.layout_symbol["text-optional"]),visibility:new gl(El.layout_symbol.visibility)})),paint:pb||(pb=new wl({"icon-opacity":new yl(El.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new yl(El.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new yl(El.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new yl(El.paint_symbol["text-emissive-strength"]),"icon-color":new yl(El.paint_symbol["icon-color"]),"icon-halo-color":new yl(El.paint_symbol["icon-halo-color"]),"icon-halo-width":new yl(El.paint_symbol["icon-halo-width"]),"icon-halo-blur":new yl(El.paint_symbol["icon-halo-blur"]),"icon-translate":new gl(El.paint_symbol["icon-translate"]),"icon-translate-anchor":new gl(El.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new gl(El.paint_symbol["icon-image-cross-fade"]),"text-opacity":new yl(El.paint_symbol["text-opacity"]),"text-occlusion-opacity":new yl(El.paint_symbol["text-occlusion-opacity"]),"text-color":new yl(El.paint_symbol["text-color"],{runtimeType:sn,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new yl(El.paint_symbol["text-halo-color"]),"text-halo-width":new yl(El.paint_symbol["text-halo-width"]),"text-halo-blur":new yl(El.paint_symbol["text-halo-blur"]),"text-translate":new gl(El.paint_symbol["text-translate"]),"text-translate-anchor":new gl(El.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new gl(El.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new gl(El.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new gl(El.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new gl(El.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new yl(El.paint_symbol["symbol-z-offset"]),"placement-priority":new yl(El.paint_symbol["placement-priority"]),"placement-group":new yl(El.paint_symbol["placement-group"]),"icon-color-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"})}))},fb);class bb extends Jl{constructor(e,t,i,r){super(e,vb(),t,i,r,e.layout?e.layout["icon-image-use-theme"]:null),this._colorAdjustmentMatrix=_([]),this.hasOcclusionOpacityProperties=void 0!==e.paint&&("icon-occlusion-opacity"in e.paint||"text-occlusion-opacity"in e.paint)}_handleSpecialPaintPropertyUpdate(e){"icon-occlusion-opacity"!==e&&"text-occlusion-opacity"!==e||(this.hasOcclusionOpacityProperties=!0)}recalculate(e,t){super.recalculate(e,t),this.appearances&&this.appearances.forEac
vendor: 4,184 bytes, line 2
2h(i=>{i.recalculate(e,t,this.iconImageUseTheme)}),0!==this.appearances.length&&delete this.layout._values["text-variable-anchor"],"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 i=this.layout.get("text-writing-mode");if(i){const e=[];for(const t of i)e.includes(t)||e.push(t);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(e,t,i,r){return this._saturation===e&&this._contrast===t&&this._brightnessMin===i&&this._brightnessMax===r||(this._colorAdjustmentMatrix=function(e,t,i,r){e=Gt(e),t=jt(t);const n=p(),o=e/3,a=1-2*o,s=[a,o,o,0,o,a,o,0,o,o,a,0,0,0,0,1],l=.5-.5*t,c=r-i;return x(n,[c,0,0,0,0,c,0,0,0,0,c,0,i,i,i,1],[t,0,0,0,0,t,0,0,0,0,t,0,l,l,l,1]),x(n,n,s),n}(e,t,i,r),this._saturation=e,this._contrast=t,this._brightnessMin=i,this._brightnessMax=r),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,t,i,r){const n=this.layout.get(e).evaluate(t,{},i,r),o=this._unevaluatedLayout._values[e];return o.isDataDriven()||ws(o.value)||!n?n:_b(t.properties,n)}getAppearanceValueAndResolveTokens(e,t,i,r,n){const o=e.getLayoutProperty(t);if(!o)return;const a=o.evaluate(i,{},r,n),s=e.getUnevaluatedLayoutProperties()._values[t];return s.isDataDriven()||ws(s.value)||!a||"string"!=typeof a?a:_b(i.properties,a)}createBucket(e){return new S_(e)}placeSymbols(e,t,i,r,n){const{globalPlacement:o,idRangeAllocator:a,transform:s,buildingIndex:l,fogState:c,groupOrders:u,replacementSource:h}=e,d=this.runtimeLayerUID,p=xb(this.paint.get("placement-group"))||xb(this.paint.get("placement-priority"))?r._state.getState(this.sourceLayer||"_geojsonTileLayer"):yb;for(const f of t){const e=f.getBucket(this);if(!e||this.fqid!==e.layerIds[0])continue;"offset"===e.elevationType&&l?l.updateZOffset(e,f.tileID):"road"===e.elevationType&&e.hdExt&&e.hdExt.updateRoadElevation(e,f.tileID.canonical),e.updateZOffset(),o.startSymbolSourceProcessing(e);const t=Mm(f.tileID,e.getProjection(),s,s.projection.name);e.addToPlacement(o,a,d,t,s,f.tileSize/co,f,c,u,i,p,n?h:null),o.finishSourceProcessing()}}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of vb().paint.overridableProperties){if(!bb.hasPaintOverride(this.layout,e))continue;const t=this.paint.get(e),i=new gb(t),r=new bs(i,t.property.specification,this.scope,this.options,this.layout.get("icon-image-use-theme"));let n=null;n="constant"===t.value.kind||"source"===t.value.kind?new Is("source",r):new Ss("composite",r,t.value.zoomStops,t.value.interpolationType),this.paint._values[e]=new ml(t.property,n,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,i){return!(!this.layout||t.isDataDriven()||i.isDataDriven())&&bb.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){const i=e.get("text-field"),r=vb().paint.properties[t];let n=!1;const o=e=>{for(const t of e)if(r.overrides&&r.overrides.hasOverride(t))return void(n=!0)};if("constant"===i.value.kind&&i.value.value instanceof bn)o(i.value.value.sections);else if("source"===i.value.kind){const e=t=>{n||(t instanceof Dn&&Sn(t.value)===hn?o(t.value.sections):t instanceof Rn?o(t.sections):t.eachChild(e))},t=i.value;t._styleExpression&&e(t._styleExpression.expression)}return n}getProgramIds(){return["symbol"]}getDefaultProgramParams(e,t,i){return{config:new Bh(this,{zoom:t,lut:i}),overrideFog:!1}}hasElevation(){return this.layout&&"hd-road-markup"===this.layout.get("symbol-elevation-reference")}mayUse(e){return"HD"===e&&Ql(this,"symbol-elevation-reference",e=>"hd-road-markup"===e)}
vendor: 10,848 bytes, line 2
2prepare(){return this.mayUse("HD")?gv():Promise.resolve()}}let wb,Eb,Ab,Ib;const Sb=1024,Tb=(Math.pow(Sb,2)-1)/268170240;class Db extends Jl{constructor(e,t,i,r){super(e,{layout:Ab||(Ab=new wl({visibility:new gl(El.layout_raster.visibility)})),paint:Ib||(Ib=new wl({"raster-opacity":new gl(El.paint_raster["raster-opacity"]),"raster-color":new xl(El.paint_raster["raster-color"]),"raster-color-mix":new gl(El.paint_raster["raster-color-mix"]),"raster-color-range":new gl(El.paint_raster["raster-color-range"]),"raster-color-scale":new gl(El.paint_raster["raster-color-scale"]),"raster-hue-rotate":new gl(El.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new gl(El.paint_raster["raster-brightness-min"]),"raster-brightness-max":new gl(El.paint_raster["raster-brightness-max"]),"raster-saturation":new gl(El.paint_raster["raster-saturation"]),"raster-contrast":new gl(El.paint_raster["raster-contrast"]),"raster-resampling":new gl(El.paint_raster["raster-resampling"]),"raster-fade-duration":new gl(El.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new gl(El.paint_raster["raster-emissive-strength"]),"raster-array-band":new gl(El.paint_raster["raster-array-band"]),"raster-elevation":new gl(El.paint_raster["raster-elevation"]),"raster-elevation-reference":new gl(El.paint_raster["raster-elevation-reference"]),"raster-color-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r),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(e){const t=e?e._source:null;return(!t||"image"!==t.type&&"video"!==t.type&&"canvas"!==t.type||!t.onNorthPole&&!t.onSouthPole)&&0===this.paint.get("raster-elevation")}_handleSpecialPaintPropertyUpdate(e){"raster-color"!==e&&"raster-color-range"!==e&&"raster-color-scale"!==e||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}updateColorRamp(e){if(!this.hasColorMap())return;if(!this._curRampRange)return;const t=this._transitionablePaint._values["raster-color"].value.expression,[i,r]=e||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];if(isNaN(i)&&isNaN(r))return;if(i===this._curRampRange[0]&&r===this._curRampRange[1])return;const n=this._transitionablePaint._values["raster-color-scale"].value.expression.evaluate({zoom:0});this.colorRamp=Ov({expression:t,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:i,end:r}],resolution:Sb,scale:n}),this.colorRampTexture=null,this._curRampRange=[i,r]}is3D(e){return this.paint.get("raster-elevation")>0}}let Mb,Pb,Cb,Rb,zb,Lb,Fb,Ob;class Bb extends Jl{constructor(e,t,i,r){super(e,{layout:Mb||(Mb=new wl({visibility:new gl(El["layout_raster-particle"].visibility)})),paint:Pb||(Pb=new wl({"raster-particle-array-band":new gl(El["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new gl(El["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new xl(El["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new gl(El["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new gl(El["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new gl(El["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new gl(El["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new gl(El["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r),this._updateColorRamp(),this.lastInvalidatedAt=ei.now()}mayUse(e){return"HD"===e}_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(e){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(e){return!1}_handleSpecialPaintPropertyUpdate(e){"raster-particle-color"!==e&&"raster-particle-max-speed"!==e||(this._updateColorRamp(),this._invalidateAnimationState()),"raster-particle-count"===e&&this._invalidateAnimationState()}_updateColorRamp(){if(!this.hasColorMap())return;const e=this._transitionablePaint._values["raster-particle-color"].value.expression,t=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=Ov({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:t}],resolution:256}),this.colorRampTexture=null}_invalidateAnimationState(){this.lastInvalidatedAt=ei.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class kb extends Jl{constructor(e,t){super(e,{},t,null),this.implementation=e,e.slot&&(this.slot=e.slot)}is3D(e){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}isDraped(e){return void 0!==this.implementation.renderToTile}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(e){this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)}onRemove(e){this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)}}function Vb(e,t,i){const r=[0,0,1],n=ge([]);return ve(n,n,i?-nt(e)+Math.PI:nt(e)),xe(n,n,-nt(t)),ne(r,r,n),J(r,r)}class Nb{constructor(e,t){this.feature=e,this.instancedDataOffset=t,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class Ub{constructor(){this.maxScale=1,this.maxXYTranslationDistance=0,this.instancedDataArray=new Hu,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}colorForInstance(e){const t=16*e,i=this.instancedDataArray.float32;let r=Math.floor(i[t+2]);const n=1.05*(i[t+2]-r);return r/=100,[i[t]%1*1.05,i[t+1]%1*1.05,n,r]}tileCoordinatesForInstance(e){const t=16*e,i=this.instancedDataArray.float32;let r=i[t+0];return r=r>co?r-co:r,new ke(Math.trunc(r),Math.trunc(i[t+1]))}translationForInstance(e){const t=16*e,i=this.instancedDataArray.float32;return[i[t+4],i[t+5],i[t+6]]}rotationScaleForInstance(e){const t=16*e,i=this.instancedDataArray.float32;return[i[t+7],i[t+8],i[t+9],i[t+10],i[t+11],i[t+12],i[t+13],i[t+14],i[t+15]]}transformForInstance(e){const t=16*e,i=this.instancedDataArray.float32;return[i[t+7],i[t+8],i[t+9],i[t+4],i[t+10],i[t+11],i[t+12],i[t+5],i[t+13],i[t+14],i[t+15],i[t+6],0,0,0,1]}}class jb{constructor(e){this.requiresStandardRuntime=!0,this.zoom=e.zoom,this.canonical=e.canonical,this.overscaledZ=this.canonical.z+Math.log2(e.overscaling),this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.projection=e.projection,this.index=e.index,this.worldview=e.worldview,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.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=e.styleDefinedModelURLs,this.hasAppearances=null}updateFootprints(e,t){}updateAppearances(e,t,i,r){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,i,r){this.tileToMeter=qc(i);const n=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);const o="hd-road-markup"===this.layers[0].paint.get("model-elevation-reference")?t.elevationFeatures:void 0;for(const{feature:a,id:s,index:l,sourceLayerIndex:c}of e){const e=s??(a.properties&&Object.hasOwn(a.properties,"id")?a.properties.id:void 0),u=ru(a,n);if(!this.layers[0]._featureFilter.filter(new ll(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),u,i))continue;const h={id:e,sourceLayerIndex:c,index:l,geometry:n?u.geometry:iu(a,i,r),properties:a.properties,type:a.type,patterns:{}},d=this.addFeature(h,h.geometry,u,o,i);d&&t.featureIndex.insert(a,h.geometry,l,c,this.index,this.instancesPerModel[d].instancedDataArray.length,256)}this.lookup=null}evaluateQueryRenderedFeaturePadding(){const e=this.layers[0].modelManager,t=this.layers[0].scope;let i=0;for(const r of this.modelUris){const n=e.getModel(r,t);if(!n)continue;const o=this.instancesPerModel[r];if(o){const e=.5*Z(n.aabb.max,n.aabb.min)*o.maxScale+o.maxXYTranslationDistance,t=Math.min(co,Math.max(e/this.tileToMeter,256));i=Math.max(t,i)}}return i}update(e,t,i,r){for(const n in this.instancesPerModel){const t=this.instancesPerModel[n];for(const i in e)Object.hasOwn(t.idToFeaturesIndex,i)&&(this.evaluate(t.features[t.idToFeaturesIndex[i]],e[i],t,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(const t in this.instancesPerModel){const i=this.instancesPerModel[t];for(const t of i.features){const r=this.layers[0],n=t.feature,o=this.canonical,a=r.paint.get("model-rotation").evaluate(n,{},o),s=r.paint.get("model-scale").evaluate(n,{},o),l=r.paint.get("model-translation").evaluate(n,{},o);ae(t.rotation,a)&&ae(t.scale,s)&&ae(t.translation,l)||(this.evaluate(t,t.featureStates,i,!0),e=!0)}}return e}updateReplacement(e,t,i,r){if(t.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=t.updateTime;const n=t.getReplacementRegionsForTile(e.toUnwrapped(),!0);if(hm(this.activeReplacements,n))return!1;this.activeReplacements=n;let o=!1;for(const a in this.instancesPerModel){const t=this.instancesPerModel[a],n=t.instancedDataArray;for(const a of t.features){const t=a.instancedDataOffset,s=a.instancedDataCount;for(let a=0;a<s;a++){const s=16*(a+t);let l=n.float32[s+0];const c=l>co;l=c?l-co:l;const u=Math.floor(l),h=Math.floor(n.float32[s+1]);let d=!1;for(const t of this.activeReplacements)if(!am(t,i,1,r)&&!(t.min.x>u||u>t.max.x||t.min.y>h||h>
vendor: 5,272 bytes, line 2
2t.max.y)&&(d=gm(_m(u,h,e.canonical,t.footprintTileId.canonical),t.footprint),d))break;n.float32[s]=d?l+co:l,o=o||d!==c}}}return o}isEmpty(){for(const e in this.instancesPerModel)if(0!==this.instancesPerModel[e].instancedDataArray.length)return!1;return!0}uploadPending(){return!this.uploaded}upload(e){if(!this.uploaded)for(const t in this.instancesPerModel){const i=this.instancesPerModel[t];i.instancedDataArray.length<0||0===i.instancedDataArray.length||(i.instancedDataBuffer?i.instancedDataBuffer.updateData(i.instancedDataArray):i.instancedDataBuffer=e.createVertexBuffer(i.instancedDataArray,py.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(e){for(const i in this.instancesPerModel){const e=this.instancesPerModel[i];0!==e.instancedDataArray.length&&e.instancedDataBuffer&&e.instancedDataBuffer.destroy()}const t=this.layers[0].modelManager;if(e&&t&&this.modelUris&&this.modelsRequested)for(const i of this.modelUris)t.removeModel(i,"",!0)}addFeature(e,t,i,r,n){const o=this.layers[0],a=o.layout.get("model-id"),s=o.layout.get("model-allow-density-reduction"),l=a.evaluate(i,{},this.canonical);if(!l)return Tt(`modelId is not evaluated for layer ${o.id} and it is not going to get rendered.`),l;!l.includes("://")&&!this.styleDefinedModelURLs[l]||this.modelUris.includes(l)||this.modelUris.push(l),this.instancesPerModel[l]||(this.instancesPerModel[l]=new Ub);const c=this.instancesPerModel[l],u=c.instancedDataArray,h=new Nb(i,u.length);let d;if(r){const t=U_(e,r,void 0,n);d=t?t.feature:void 0}for(const p of t)for(const e of p){if(e.x<0||e.x>=co||e.y<0||e.y>=co)continue;if(0!==this.lookupDim&&s){const t=(this.lookupDim-1)/co,i=this.lookupDim*(e.y*t|0)+e.x*t|0;if(this.lookup){if(0!==this.lookup[i])continue;this.lookup[i]=1}}this.instanceCount++;const t=u.length;if(u.resize(t+1),r){c.instancesRoadElevation||(c.instancesRoadElevation=[]);const t=d?d.pointElevation(new ke(e.x,e.y)):0;c.instancesRoadElevation.push(t)}c.instancesEvaluatedElevation.push(0),u.float32[16*t]=e.x,u.float32[16*t+1]=e.y}return h.instancedDataCount=c.instancedDataArray.length-h.instancedDataOffset,h.instancedDataCount>0&&(e.id&&(c.idToFeaturesIndex[e.id]=c.features.length),c.features.push(h),this.evaluate(h,{},c,!1)),l}getModelUris(){return this.modelUris}evaluate(e,t,i,r){const n=this.layers[0],o=e.feature,a=this.canonical,s=e.rotation=n.paint.get("model-rotation").evaluate(o,t,a),l=e.scale=n.paint.get("model-scale").evaluate(o,t,a),c=e.translation=n.paint.get("model-translation").evaluate(o,t,a),{r:u,g:h,b:d}=n.paint.get("model-color").evaluate(o,t,a),p=n.paint.get("model-color-mix-intensity").evaluate(o,t,a),f=[];this.maxVerticalOffset<c[2]&&(this.maxVerticalOffset=c[2]);const m=c[0]*c[0]+c[1]*c[1],_=m>0?Math.sqrt(m):0;i.maxScale=Math.max(Math.max(i.maxScale,l[0]),Math.max(l[1],l[2])),i.maxXYTranslationDistance=Math.max(i.maxXYTranslationDistance,_),this.maxScale=Math.max(Math.max(this.maxScale,l[0]),Math.max(l[1],l[2])),wy(f,s,l);const g=Math.round(100*p)+d/1.05;for(let y=0;y<e.instancedDataCount;++y){const t=e.instancedDataOffset+y,n=16*t,o=i.instancedDataArray.float32;let s=0;r&&(s=o[n+6]-i.instancesEvaluatedElevation[t]);const l=0|o[n+1];o[n]=(0|o[n])+u/1.05,o[n+1]=l+h/1.05,o[n+2]=g,o[n+3]=1/(a.z>10?this.tileToMeter:qc(a,l)),o[n+4]=c[0],o[n+5]=c[1],o[n+6]=c[2]+(i.instancesRoadElevation?i.instancesRoadElevation[t]:0)+s,o[n+7]=f[0],o[n+8]=f[1],o[n+9]=f[2],o[n+10]=f[4],o[n+11]=f[5],o[n+12]=f[6],o[n+13]=f[8],o[n+14]=f[9],o[n+15]=f[10],i.instancesEvaluatedElevation[t]=c[2]}}}Rs(jb,"ModelBucket",{omit:["layers"]}),Rs(Ub,"PerModelAttributes"),Rs(Nb,"ModelFeature");const Gb=new WeakMap;class Hb{constructor(e,t){const i=e.gl;if(this.context=e,this.buffer=i.createBuffer(),!this.buffer)throw new Error("Failed to create model part style UBO buffer");i.bindBuffer(i.UNIFORM_BUFFER,this.buffer),i.bufferData(i.UNIFORM_BUFFER,t,i.DYNAMIC_DRAW),i.bindBuffer(i.UNIFORM_BUFFER,null)}update(e){const t=this.context.gl;t.bindBuffer(t.UNIFORM_BUFFER,this.buffer),t.bufferSubData(t.UNIFORM_BUFFER,0,e),t.bindBuffer(t.UNIFORM_BUFFER,null)}bind(e,t){let i=Gb.get(t);if(void 0===i){const r=e.gl,n=r.getUniformBlockIndex(t,"ModelPartStyleUniform");i=n!==r.INVALID_INDEX,i&&r.uniformBlockBinding(t,n,0),Gb.set(t,i)}if(!i)return;const r=e.gl;r.bindBufferBase(r.UNIFORM_BUFFER,0,this.buffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),this.buffer=null)}}const $b=new Float32Array(262144),Wb=new Uint8Array(262144),qb=[0,0,0],Zb=[0,0,0];function Xb(e){let t=0;if(e.meshes)for(const i of e.meshes)t=Math.max(t,i.aabb.max[2]);if(e.children)for(const i of e.children)t=Math.max(t,Xb(i));return t}function Yb(e,t,i){if(e.meshes)for(const r of e.meshes){if(r.aabb.min[0]===1/0)continue;const n=Wp.applyTransform(r.aabb,e.globalMatrix);i.insert(t,n.min[0],n.min[1],n.max[0],n.max[1])}if(e.children)for(const r of e.children)Yb(r,t,i)}class Kb{constructor(e){this.node=e,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.partStyle=new Float32Array(112),this.partStyleUBO=null,this.needsPartStyleUBO=!1,this.cameraCollisionOpacity=1,this.targetL
vendor: 25,789 bytes, line 2
2od=-1,this.feature={type:"Point",id:e.id,geometry:[],properties:{height:Xb(e)}},this.aabb=this._getLocalBounds(),this.state=null}_getLocalBounds(){if(!this.node.meshes)return new Wp([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0;const t=new Wp([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const i of this.node.meshes)this.node.lightMeshIndex!==e&&(i.transformedAabb=Wp.applyTransformFast(i.aabb,this.node.globalMatrix),t.encapsulate(i.transformedAabb)),e++;this.aabb=t}return this.aabb}}function Jb(e,t){return e instanceof Is&&!e.isLightConstant&&t}function Qb(e,t){e[t+4]=16*Math.floor(15*e[t+4])/255,e[t+5]=16*Math.floor(15*e[t+5])/255,e[t+6]=Math.min(Math.floor(127.5*e[t+6]+.5),255)/255*2,e[t+7]=Math.floor(255*e[t+7])/255;const i=Math.floor(255*e[t+10])/256,r=Math.floor(255*(e[t+10]+e[t+11]))/256;e[t+10]=i,e[t+11]=r-i}function ew(e){const t=e.partStyle;for(let i=0;i<Sy.length;i++){const r=e.evaluatedColor[i],n=e.evaluatedRMEA[i],o=e.emissionHeightBasedParams[i],a=ht(o[0],0,1),s=ht(o[1],0,1),l=16*i;t[l]=r[0],t[l+1]=r[1],t[l+2]=r[2],t[l+3]=ht(r[3],0,1),t[l+4]=n[0],t[l+5]=n[1],t[l+6]=ht(n[2],0,2),t[l+7]=n[3],a!==s?(t[l+8]=a,t[l+9]=s,t[l+10]=ht(o[2],0,1),t[l+11]=ht(o[3],0,1)-t[l+10],t[l+12]=Math.pow(10,ht(o[4],-1,1))):(t[l+8]=0,t[l+9]=1,t[l+10]=1,t[l+11]=0,t[l+12]=1),Qb(t,l)}}Rs(class{constructor(e,t,i,r,n,o,a,s){this.requiresStandardRuntime=!0,this.isTiled3dModelBucket=!0,this.id=i,this.layers=e,this.layerIds=this.layers.map(e=>e.fqid),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.modelTraits|=1,this.uploaded=!1,this.hasPattern=!1,r&&(this.modelTraits|=4),n&&(this.modelTraits|=8),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=o,this.worldview=s,this.dirty=!0,this.needsPartStyleUBOs=!1,this.filter=null,this.nodesInfo=[];for(const l of t)this.nodesInfo.push(new Kb(l)),Yb(l,a.featureIndexArray.length,a.grid),a.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,a.bucketLayerIDs.length-1,0);this.states={},this.hasAppearances=null}updateFootprints(e,t){for(const i of this.getNodesInfo()){const r=i.node;r.footprint&&t.push({footprint:r.footprint,id:e})}}updateAppearances(e,t,i,r){return{hasLayoutChanges:!1,hasUboChanges:!1}}update(e){const t=0!==Object.keys(e).length;if(t&&!this.stateDependentLayers.length)return;const i=t?this.stateDependentLayers:this.layers;if(!Ve(e,this.states))for(const r of i)this.evaluate(r,e);this.states=structuredClone(e)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsPartStyleUBOs}upload(e){if(this.needsPartStyleUBOs&&(this.createPartStyleUBOs(e),this.needsPartStyleUBOs=!1),!this.uploaded){const t=this.getNodesInfo();for(const i of t)Ry(i.node,e,!0);for(const e of t)Ly(e.node);this.uploaded=!0}}createPartStyleUBOs(e){for(const t of this.getNodesInfo())t.needsPartStyleUBO&&(t.partStyleUBO=new Hb(e,t.partStyle),t.needsPartStyleUBO=!1)}needsReEvaluation(e,t,i){const r=e.transform.projectionOptions,n=e.style.getBrightness(),o=this.brightness!==n;if(!this.uploaded||this.dirty||r.name!==this.projection.name||Jb(i.paint.get("model-color").value,o)||Jb(i.paint.get("model-color-mix-intensity").value,o)||Jb(i.paint.get("model-roughness").value,o)||Jb(i.paint.get("model-emissive-strength").value,o)||Jb(i.paint.get("model-height-based-emissive-strength-multiplier").value,o)){this.projection=r,this.brightness=n;const e=this.getNodesInfo();for(const t of e)t.state=null;return!0}return!1}evaluateTransform(e,t){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;const i=this.getNodesInfo(),r=this.id.canonical;for(const n of i){const e=n.feature;n.evaluatedTranslation=t.paint.get("model-translation").evaluate(e,{},r),n.evaluatedScale=t.paint.get("model-scale").evaluate(e,{},r)}}evaluate(e,t){const i=this.getNodesInfo();for(const r of i){if(!r.node.meshes)continue;const i=r.feature,n=t&&t[i.id];if(Ve(n,r.state))continue;r.state=structuredClone(n);const o=r.node.meshes&&r.node.meshes[0].hasFeatureData,a=this.id.canonical;if(r.hasTranslucentParts=!1,o){for(let t=0;t<Sy.length;t++){const o=Sy[t];o.length&&(i.properties.part=o);const s=e.paint.get("model-color").evaluate(i,n,a).toPremultipliedRenderColor(null),l=e.paint.get("model-color-mix-intensity").evaluate(i,n,a);r.evaluatedColor[t]=[s.r,s.g,s.b,l],r.evaluatedRMEA[t][0]=e.paint.get("model-roughness").evaluate(i,n,a),r.evaluatedRMEA[t][2]=e.paint.get("model-emissive-strength").evaluate(i,n,a),r.evaluatedRMEA[t][3]=s.a,r.emissionHeightBasedParams[t]=e.paint.get("model-height-based-emissive-strength-multiplier").evaluate(i,n,a),!r.hasTranslucentParts&&s.a<1&&(r.hasTranslucentParts=!0)}delete i.properties.part}else r.evaluatedRMEA[0][2]=e.paint.get("model-emissive-strength").evaluate(i,n,a);r.evaluatedTranslation=e.paint.get("model-translation").evaluate(i,n,a),r.evaluatedScale=e.paint.get("model-scale").evaluate(i,n,a),o&&(ew(r),r.partStyleUBO?r.partStyleUBO.update(r.partStyle):(r.needsPartStyleUBO=!0,this.needsPartStyleUBOs=!0))}this.dirty=!1}elevationUpdate(e,t,i,r){const n=e.findDEMTileFor(i);if(n&&(n.tileID.canonical!==this.terrainTile||t!==this.terrainExaggeration)){if(n.dem&&n.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=n.tileID.overscaledZ;const t=vm.create(e,i,n);if(!t)return;4&this.modelTraits&&this.updateDEM(e,t,i,r);for(const e of this.getNodesInfo()){const i=e.node;if(!i.footprint||!i.footprint.vertices||!i.footprint.vertices.length)continue;const r=i.footprint.vertices;let n=t.getElevationAt(r[0].x,r[0].y,!0,!0);for(let e=1;e<r.length;e++)n=Math.min(n,t.getElevationAt(r[e].x,r[e].y,!0,!0));i.elevation=n}}this.terrainTile=n.tileID.canonical,this.terrainExaggeration=t}}updateDEM(e,t,i,r){let n=t._dem._modifiedForSources[r];if(void 0===n&&(t._dem._modifiedForSources[r]=[],n=t._dem._modifiedForSources[r]),n.includes(i.canonical))return;const o=t._dem.dim;n.push(i.canonical);let a=!1;for(const s of this.getNodesInfo()){const e=s.node;if(!e.footprint||!e.footprint.grid)continue;const i=e.footprint.grid,r=t.tileCoordToPixel(i.min.x,i.min.y),n=t.tileCoordToPixel(i.max.x,i.max.y),l=Math.min(Math.min(o-n.y,r.x),Math.min(r.y,o-n.x));if(l<0)continue;const c=ht(l,2,5);let u=Math.max(0,r.x-c),h=Math.max(0,r.y-c),d=Math.min(n.x+c,o-1),p=Math.min(n.y+c,o-1);for(let t=h;t<=p;++t)for(let e=u;e<=d;++e)Wb[t*o+e]=255;let f=0,m=0;for(let a=0;a<i.cellsY;++a)for(let e=0;e<i.cellsX;++e){if(!i.cells[a*i.cellsX+e])continue;const r=t.tileCoordToPixel(i.min.x+e/i.xScale,i.min.y+a/i.yScale),n=t.tileCoordToPixel(i.min.x+(e+1)/i.xScale,i.min.y+(a+1)/i.yScale);for(let e=r.y;e<=Math.min(n.y+1,o-1);++e)for(let i=r.x;i<=Math.min(n.x+1,o-1);++i)255===Wb[e*o+i]&&(Wb[e*o+i]=0,f+=t.getElevationAtPixel(i,e),m++)}const _=f/m;u=Math.max(1,r.x-c),h=Math.max(1,r.y-c),d=Math.min(n.x+c,o-2),p=Math.min(n.y+c,o-2),a=!0;for(let a=h;a<=p;++a)for(let e=u;e<=d;++e)0===Wb[a*o+e]&&($b[a*o+e]=t._dem.set(e,a,_));for(let a=1;a<c;++a){u=Math.max(1,r.x-a),h=Math.max(1,r.y-a),d=Math.min(n.x+a,o-2),p=Math.min(n.y+a,o-2);for(let e=h;e<=p;++e)for(let i=u;i<=d;++i){const r=e*o+i;if(255===Wb[r]){let n=0,s=0,l=-1,u=-1;for(let t=-1;t<=1;++t)for(let r=-1;r<=1;++r){const c=(e+t)*o+i+r;if(Wb[c]>=a)continue;const h=$b[c],d=Math.abs(h);d>s&&(n=h,s=d,l=r,u=t)}if(s>.1){const o=1-(a+.5*Math.abs(l*u))/c;let s=t._dem.get(i,e)+n*o;const h=t._dem.get(i+l,e+u),d=t._dem.get(i-l,e-u,!0);(s-h)*(s-d)>0&&(s=(h+d)/2),$b[r]=t._dem.set(i,e,s),Wb[r]=a}}}}}a&&(t._demTile.needsDEMTextureUpload=!0,t._dem._timestamp=ei.now())}setFilter(e){this.filter=e?Tl(e):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(e=>this.filter.filter(new ll(this.id.overscaledZ,{worldview:this.worldview}),e.feature,this.id.canonical)):this.nodesInfo}destroy(){const e=this.getNodesInfo();for(const t of e)Ly(t.node),Oy(t.node),t.partStyleUBO&&(t.partStyleUBO.destroy(),t.partStyleUBO=null)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,t){if(t.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=t.updateTime;const i=t.getReplacementRegionsForTile(e.toUnwrapped());for(const r of this.getNodesInfo()){const e=r.node.footprint;r.hiddenByReplacement=!!e&&!i.some(t=>t.footprint===e)}}getHeightAtTileCoord(e,t){const i=[0,0,0],r=_([]);for(const n of this.getNodesInfo()){const o=n.node.meshes[0],a=o.transformedAabb;if(e<a.min[0]||t<a.min[1]||e>a.max[0]||t>a.max[1])continue;if(!0===n.node.hidden)return{height:1/0,maxHeight:n.feature.properties.height,hidden:!1,verticalScale:n.evaluatedScale[2]};if(y(r,n.node.globalMatrix),i[0]=e,i[1]=t,i[2]=0,ie(i,i,r),n.node.meshBVH){const e=i[0],t=i[1];qb[0]=e-1,qb[1]=t-1,qb[2]=-1e3,Zb[0]=e+1,Zb[1]=t+1,Zb[2]=1e3;const r=n.node.meshBVH.findHighestPoint(qb,Zb);if(null!==r)return{height:r,maxHeight:n.feature.properties.height,hidden:n.hiddenByReplacement,verticalScale:n.evaluatedScale[2]};continue}if(!o.heightmap)continue;const s=(i[0]-o.aabb.min[0])/(o.aabb.max[0]-o.aabb.min[0])*64|0,l=64*Math.min(63,(i[1]-o.aabb.min[1])/(o.aabb.max[1]-o.aabb.min[1])*64|0)+Math.min(63,s),c=o.heightmap[l];if(c<0&&n.node.footprint){const i=[];if(n.node.footprint.grid.query(new ke(e,t),new ke(e,t),i),i.length>0)return{height:void 0,maxHeight:n.feature.properties.height,hidden:n.hiddenByReplacement,verticalScale:n.evaluatedScale[2]};continue}if(n.hiddenByReplacement)return;return{height:c,maxHeight:n.feature.properties.height,hidden:!1,verticalScale:n.evaluatedScale[2]}}}},"Tiled3dModelBucket",{omit:["layers"]}),Rs(Kb,"Tiled3dModelFeature",{omit:["partStyleUBO"]});class tw{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){const i=e[t];this._stringToNumber[i]=t,this._numberToString[t]=i}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}const iw=["id","tile","layer","source","sourceLayer","state"];class rw{constructor(e,t,i,r,n){this.type="Feature",this._vectorTileFeature=e,this._z=t,this._x=i,this._y=r,this.properties=e?e.properties:{},this.id=n}clone(){const e=new rw(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(e.state={...this.state}),this.layer&&(e.layer={...this.layer}),this.source&&(e.source=this.source),this.sourceLayer&&(e.sourceLayer=this.sourceLayer),e}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(e){this._geometry=e}toJSON(){const e={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const t of iw)void 0!==this[t]&&(e[t]=this[t]);return e}}class nw extends rw{constructor(e,t){super(e._vectorTileFeature,e._z,e._x,e._y,e.id),e.state&&(this.state={...e.state}),this.target=t.target,this.namespace=t.namespace,t.properties&&(this.properties=t.properties),this.target&&("featuresetId"in this.target&&!this.target.importId||"layerId"in this.target)&&(this.source=e.source,this.sourceLayer=e.sourceLayer,this.layer=e.layer)}toJSON(){const e=super.toJSON();return e.target=this.target,e.namespace=this.namespace,e}}const ow=new Float32Array(_([])),aw=[0,0,0],sw=(e,t,i,r,n,o,a,s,c,u,h,p,f,m=[0,0,0],_,g,y,x=1,v=!1)=>{let b=aw,w=0,E=aw;if(!v){const e=n.style.light,t=e.properties.get("position");if(b=[-t.x,-t.y,t.z],"viewport"===e.properties.get("anchor")){const e=l();d(e,-n.transform.angle),re(b,b,e)}const i=e.properties.get("color").toNonPremultipliedRenderColor(null);w=e.properties.get("intensity"),E=[i.r,i.g,i.b]}const A="MASK"===h.alphaMode,I=f.paint.get("model-ambient-occlusion-intensity"),S=f.paint.get("model-color").constantOr(Zr.white).toNonPremultipliedRenderColor(null);return S.a=f.paint.get("model-color-mix-intensity").constantOr(0),y&&(S.r=y[0],S.g=y[1],S.b=y[2],S.a=y[3]),g&&(S.r=g.color.r,S.g=g.color.g,S.b=g.color.b,S.a=g.colorMix,p=g.emissionStrength,o*=g.opacity),{u_matrix:e,u_lighting_matrix:t,u_normal_matrix:i,u_node_matrix:r||ow,u_lightpos:b,u_lightintensity:w,u_lightcolor:E,u_camera_pos:m,u_opacity:o,u_baseTextureIsAlpha:0,u_alphaMask:+A,u_alphaCutoff:h.alphaCutoff,u_baseColorFactor:a.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:s.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:c,u_roughnessFactor:u,u_baseColorTexture:5,u_metallicRoughnessTexture:6,u_normalTexture:7,u_occlusionTexture:8,u_emissionTexture:9,u_lutTexture:10,u_color_mix:S.toArray01(),u_aoIntensity:I,u_emissive_strength:p,u_occlusionTextureTransform:_||[0,0,0,0],u_dithered_discard_threshold:x,u_model_mesh_params:[0,1,0,0]}},lw=(e,t=ow,i=ow)=>({u_matrix:e,u_instance:t,u_node_matrix:i}),cw=7680;class uw{constructor(e,t,i,r,n,o){this.test=e,this.ref=t,this.mask=i,this.fail=r,this.depthFail=n,this.pass=o}}uw.disabled=new uw({func:519,mask:0},0,0,cw,cw,cw);const hw=770,dw=771;class pw{constructor(e,t,i,r){this.blendFunction=e,this.blendColor=t.toNonPremultipliedRenderColor(null),this.mask=i,this.blendEquation=r}}pw.Replace=[1,0,1,0],pw.disabled=new pw(pw.Replace,Zr.transparent,[!1,!1,!1,!1]),pw.unblended=new pw(pw.Replace,Zr.transparent,[!0,!0,!0,!0]),pw.alphaBlended=new pw([1,dw,1,dw],Zr.transparent,[!0,!0,!0,!0]),pw.alphaBlendedNonPremultiplied=new pw([hw,dw,hw,dw],Zr.transparent,[!0,!0,!0,!0]),pw.multiply=new pw([774,0,774,0],Zr.transparent,[!0,!0,!0,!0]),pw.multiplyAccumulateAlpha=new pw([774,0,1,dw],Zr.transparent,[!0,!0,!0,!0]),pw.additive=new pw([1,1,1,1],Zr.transparent,[!0,!0,!0,!0]),pw.additiveAlphaWeighted=new pw([hw,1,773,1],Zr.transparent,[!0,!0,!0,!0]),pw.additiveAlphaWeightedUnboundedAlpha=new pw([hw,1,1,1],Zr.transparent,[!0,!0,!0,!0]);class fw{constructor(e,t,i){this.func=e,this.mask=t,this.range=i}}fw.ReadOnly=!1,fw.ReadWrite=!0,fw.disabled=new fw(519,fw.ReadOnly,[0,1]);const mw=1029,_w=2305;class gw{constructor(e,t,i){this.enable=e,this.mode=t,this.frontFace=i}}gw.disabled=new gw(!1,mw,_w),gw.backCCW=new gw(!0,mw,_w),gw.backCW=new gw(!0,mw,2304),gw.frontCW=new gw(!0,1028,2304),gw.frontCCW=new gw(!0,1028,_w);class yw{constructor(e=0,t=0,i=0,r=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(i)||i<0||isNaN(r)||r<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=t,this.left=i,this.right=r}interpolate(e,t,i){return null!=t.top&&null!=e.top&&(this.top=Wr(e.top,t.top,i)),null!=t.bottom&&null!=e.bottom&&(this.bottom=Wr(e.bottom,t.bottom,i)),null!=t.left&&null!=e.left&&(this.left=Wr(e.left,t.left,i)),null!=t.right&&null!=e.right&&(this.right=Wr(e.right,t.right,i)),this}getCenter(e,t){return new ke(ht((this.left+e-this.right)/2,0,e),ht((this.top+t-this.bottom)/2,0,t))}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new yw(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function xw(e,t){const i=Ot(e,3);R(e,t),Bt(e,3,i)}function vw(e,t){const i=ge([]);return be(i,i,-t),xe(i,i,-e),i}function bw(e,t){const i=[e[0],e[1],0],r=[t[0],t[1],0];if(k(i)>=1e-15){const e=J([],i);W(r,e,Q(r,e)),t[0]=r[0],t[1]=r[1]}const n=ee([],t,e);if(ue(n)<1e-15)return null;const o=Math.atan2(-n[1],n[0]);return vw(Math.atan2(Math.sqrt(e[0]*e[0]+e[1]*e[1]),-e[2]),o)}class ww{constructor(e,t){this.position=e,this.orientation=t}get position(){return this._position}set position(e){if(e){const t=e instanceof Zc?e:new Zc(e[0],e[1],e[2]);this._renderWorldCopies&&(t.x=pt(t.x,0,1)),this._position=t}else this._position=null}lookAtPoint(e,t,i){if(this.orientation=null,!this.position)return;const r=this.position,n=i||(this._elevation?this._elevation.getAtPointOrZero(Zc.fromLngLat(e)):0),o=Zc.fromLngLat(e,n),a=[o.x-r.x,o.y-r.y,o.z-r.z];t||(t=[0,0,1]),t[2]=Math.abs(t[2]),this.orientation=bw(a,t)}setPitchBearing(e,t){this.orientation=vw(nt(e),nt(-t))}}class Ew{constructor(e,t){this._transform=_([]),this.orientation=t,this.position=e}get mercatorPosition(){const e=this.position;return new Zc(e[0],e[1],e[2])}get position(){const e=Ot(this._transform,3);return[e[0],e[1],e[2]]}set position(e){var t;e&&Bt(this._transform,3,[(t=e)[0],t[1],t[2],1])}get orientation(){return this._orientation}set orientation(e){this._orientation=e||ge([]),e&&xw(this._transform,this._orientation)}getPitchBearing(){const e=this.forward(),t=this.right();return{bearing:Math.atan2(-t[1],t[0]),pitch:Math.atan2(Math.sqrt(e[0]*e[0]+e[1]*e[1]),-e[2])}}setPitchBearing(e,t){this._orientation=vw(e,t),xw(this._transform,this._orientation)}forward(){const e=Ot(this._transform,2);return[-e[0],-e[1],-e[2]]}up(){const e=Ot(this._transform,1);return[-e[0],-e[1],-e[2]]}right(){const e=Ot(this._transform,0);return[e[0],e[1],e[2]]}getCameraToWorld(e,t){const i=new Float64Array(16);return y(i,this.getWorldToCamera(e,t)),i}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(e,t,i){const r=this.position;W(r,r,-e);const n=new Float64Array(16);return S(n,[i,i,i]),v(n,n,r),n[10]*=t,n}getWorldToCamera(e,t){const i=new Float64Array(16),r=new Float64Array(4),n=this.position;var o,a;return(o=r)[0]=-(a=this._orientation)[0],o[1]=-a[1],o[2]=-a[2],o[3]=a[3],W(n,n,-e),R(i,r),v(i,i,n),i[1]*=-1,i[5]*=-1,i[9]*=-1,i[13]*=-1,i[8]*=t,i[9]*=t,i[10]*=t,i[11]*=t,i}getCameraToClipPerspective(e,t,i,r){const n=new Float64Array(16);return z(n,e,t,i,r),n}getCameraToClipOrthographic(e,t,i,r,n,o){const a=new Float64Array(16);return L(a,e,t,i,r,n,o),a}getDistanceToElevation(e,t=!1){const i=0===e?0:Uc(e,t?Xn(this.position[1]):this.position[1]),r=this.forward();return(i-this.position[2])/r[2]}clone(){return new Ew([...this.position],[...this.orientation])}}const Aw=Math.tan(85*Math.PI/180);function Iw(e,t,i,r,n,o,a){const l=p();if(i)if("globe"===o.name){const e=function(e,t){const{x:i,y:r}=e.point,n=pf(i,r,e.worldSize/e._pixelsPerMercatorPixel,0,0);return x(n,n,uf(Jp(t)))}(n,t);x(l,l,e)}else{const e=s([],a);l[0]=e[0],l[1]=e[1],l[4]=e[2],l[5]=e[3],r||A(l,l,n.angle)}else x(l,n.labelPlaneMatrix,e);return l}function Sw(e,t,i,r,n,o,a){const s=Iw(e,t,i,r,n,o,a);return"globe"===o.name&&i||(s[2]=s[6]=s[10]=s[14]=0),s}function Tw(e,t,i,r,n,o,a){if(i){if("globe"===o.name){const s=Iw(e,t,i,r,n,o,a);return y(s,s),x(s,e,s),s}{const t=f(e),[i,o,s,l]=a,[c,u,h,d,p,m,_,g]=t;return t[0]=i*c+o*p,t[1]=i*u+o*m,t[2]=i*h+o*_,t[3]=i*d+o*g,t[4]=s*c+l*p,t[5]=s*u+l*m,t[6]=s*h+l*_,t[7]=s*d+l*g,r||A(t,t,-n.angle),t}}return n.glCoordMatrix}function Dw(e,t,i,r){const n=[e,t,i,1];i?me(n,n,r):ym(n,n,r);const o=n[3];return n[0]/=o,n[1]/=o,n[2]/=o,n}function Mw(e,t){return Math.min(.5+e/t*.5,1.5)}function Pw(e,t){const i=e[0]/e[3],r=e[1]/e[3];return i>=-t[0]&&i<=t[0]&&r>=-t[1]&&r<=t[1]}function Cw(e,t,i,r,n,o,a,s,l,c,u=1){const h=i.transform,d=r?e.textSizeData:e.iconSizeData,p=Ip(d,i.transform.zoom,u),f="globe"===h.projection.name,m=(()=>{if(!f)return null;const e=mf(h.zoom);return 0===e?null:{t:e,invMatrix:h.projection.createInversionMatrix(h,c.canonical),mercCenter:[Wn(h.center.lng),qn(h.center.lat)]}})(),_=[256/i.width*2+1,256/i.height*2+1],g=r?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;g.clear();let y=null;f&&(y=r?e.text.globeExtVertexArray:e.icon.globeExtVertexArray);const x=e.lineVertexArray,v=r?e.text.placedSymbolArray:e.icon.placedSymbolArray,b=i.transform.width/i.transform.height;let w,E=!1;for(let A=0;A<v.length;A++){const u=v.get(A),{numGlyphs:f,writingMode:I}=u;if(I!==gp.vertical||E||w===gp.horizontal||(E=!0),w=I,(u.hidden||I===gp.vertical)&&!E){Vw(f,g);continue}E=!1;const S=new ke(u.tileAnchorX,u.tileAnchorY),T="road"===e.elevationType,D=!!h.elevation||T;let{x:M,y:P,z:C}=h.projection.projectTilePoint(S.x,S.y,c.canonical);if(m){const[e,t,i]=Fw(S,c.canonical,m);M+=(e-M)*m.t,P+=(t-P)*m.t,C+=(i-C)*m.t}let R=null;if(D){R=T&&e.hdExt?e.hdExt.makeRoadSymbolElevationParams(e,r?e.text:e.icon,A,c,l,h.elevation,h.projection,h.center.lat,h.worldSize):{getElevation:l,elevation:h.elevation,elevationFeature:null};const[t,i,n]=R.getElevation(S,h.elevation,R.elevationFeature);M+=t,P+=i,C+=n}const z=[M,P,C,1];if(me(z,z,t),!Pw(z,_)){Vw(f,g);continue}const L=z[3],F=Mw(i.transform.getCameraToCenterDistance(h.projection),L),O=Ap(d,p,u),B=a?O/F:O*F,k=Dw(M,P,C,n);if(k[3]<=0){Vw(f,g);continue}let V={};const N=nt(e.layers[0].layout.get("text-max-angle")),U=Math.cos(N),j=a?null:R,G=Lw(u,B,!1,s,t,n,o,e.glyphOffsetArray,x,g,y,k,S,V,b,j,h.projection,c,a,U,m);E=G.useVertical,j&&G.needsFlipping&&(V={}),(G.notEnoughRoom||E||G.needsFlipping&&Lw(u,B,!0,s,t,n,o,e.glyphOffsetArray,x,g,y,k,S,V,b,j,h.projection,c,a,U,m).notEnoughRoom)&&Vw(f,g)}r?(e.text.dynamicLayoutVertexBuffer.updateData(g),y&&e.text.globeExtVertexBuffer&&e.text.globeExtVertexBuffer.updateData(y)):(e.icon.dynamicLayoutVertexBuffer.updateData(g),y&&e.icon.globeExtVertexBuffer&&e.icon.globeExtVertexBuffer.updateData(y))}function Rw(e,t,i,r,n,o,a,s,l,c,u,h,d,p,f,m,_,g){const{lineStartIndex:y,glyphStartIndex:x,segment:v}=s,b=x+s.numGlyphs,w=y+s.lineLength,E=t.getoffsetX(x),A=t.getoffsetX(b-1),I=kw(e*E,i,r,n,o,a,v,y,w,l,c,u,h,d,!0,p,f,m,_,g);if(!I)return null;const S=kw(e*A,i,r,n,o,a,v,y,w,l,c,u,h,d,!0,p,f,m,_,g);return S?{first:I,last:S}:null}function zw(e,t,i,r){return e===gp.horizontal&&Math.abs(r)>Math.abs(i)?{useVertical:!0}:e===gp.vertical?r>0?{needsFlipping:!0}:null:0!==t&&function(e,t){return 0===e||Math.abs(t/e)>Aw}(i,r)?1===t?{needsFlipping:!0}:null:i<0?{needsFlipping:!0}:null}function Lw(e,t,i,r,n,o,a,s,l,c,u,h,d,p,f,m,_,g,y,x,v){const b=t/24,w=e.lineOffsetX*b,E=e.lineOffsetY*b,{lineStartIndex:A,glyphStartIndex:I,numGlyphs:S,segment:T,writingMode:D,flipState:M}=e,P=A+e.lineLength,C=e=>{if(u){const[t,i,r]=e.up,n=c.length;x_(u,n+0,t,i,r),x_(u,n+1,t,i,r),x_(u,n+2,t,i,r),x_(u,n+3,t,i,r)}const[t,i,r]=e.point;v_(c,t,i,r,e.angle)};if(S>1){const t=Rw(b,s,w,E,i,h,d,e,l,o,p,m,!1,_,g,y,x,v);if(!t)return{notEnoughRoom:!0};if(r&&!i){let[i,r,n]=t.first.point,[o,s,l]=t.last.point;[i,r]=Dw(i,r,n,a),[o,s]=Dw(o,s,l,a);const c=zw(D,M,(o-i)*f,s-r);if(e.flipState=c&&c.needsFlipping?1:2,c)return c}C(t.first);for(let e=I+1;e<I+S-1;e++){const t=kw(b*s.getoffsetX(e),w,E,i,h,d,T,A,P,l,o,p,m,!1,!1,_,g,y,x,v);if(!t)return c.length-=4*(e-I),{notEnoughRoom:!0};C(t)}C(t.last)}else{if(r&&!i){const t=Dw(d.x,d.y,0,n),i=A+T+1,r=new ke(l.getx(i),l.gety(i)),o=Dw(r.x,r.y,0,n),a=o[3]>0?o:Bw(d,r,t,1,n,void 0,_,g.canonical),s=zw(D,M,(a[0]-t[0])*f,a[1]-t[1]);if(e.flipState=s&&s.needsFlipping?1:2,s)return s}const t=kw(b*s.getoffsetX(I),w,E,i,h,d,T,A,P,l,o,p,m,!1,!1,_,g,y,x,v);if(!t)return{notEnoughRoom:!0};C(t)}return{}}function Fw(e,t,i){const r=1<<t.z;let n=(e.x/co+t.x)/r-i.mercCenter[0];const o=(e.y/co+t.y)/r-i.mercCenter[1];n-=Math.round(n);const a=[n*co,o*co,co/(2*Math.PI),1];return me(a,a,i.invMatrix),[a[0],a[1],a[2]]}function Ow(e,t,i,r,n,o){let{x:a,y:s,z:l}=r.projectTilePoint(e.x,e.y,t);if(o){const[i,r,n]=Fw(e,t,o);a+=(i-a)*o.t,s+=(r-s)*o.t,l+=(n-l)*o.t}if(!n)return Dw(a,s,l,i);const[c,u,h]=n.getElevation(e,n.elevation,n.elevationFeature);return Dw(a+c,s+u,l+h,i)}function Bw(e,t,i,r,n,o,a,s,l){const c=Ow(e.sub(t)._unit()._add(e),s,n,a,o,l);return se(c,i,c),J(c,c),q(c,i,c,r)}function kw(e,t,i,r,n,o,a,s,l,c,u,h,d,p,f,m,_,g,y,x){const v=r?e-t:e+t;let b=v>0?1:-1,w=0;r&&(b*=-1,w=Math.PI),b<0&&(w+=Math.PI);let E=s+a+(b>0?0:1)|0,A=n,I=n,S=0,T=0;const D=Math.abs(v),M=[],P=[];let C=o,R=C,z=oe([]);const L=()=>Bw(R,C,I,D-S+1,u,d,m,_.canonical,x);for(;S+T<=D;){if(E+=b,E<s||E>=l)return null;if(I=A,R=C,M.push(I),p&&P.push(R),C=new ke(c.getx(E),c.gety(E)),A=h[E],!A){const e=Ow(C,_.canonical,u,m,d,x);A=e[3]>0?h[E]=e:L()}S+=T;const e=se([],A,I),t=Z(I,A);if(i&&t>0&&T>0&&Q(z,e)/(T*t)<y)return null;T=t,z=e}f&&d&&(h[E]&&(A=L(),T=Z(I,A),z=se([],A,I)),h[E]=A);const F=(D-S)/T,O=C.sub(R)._mult(F)._add(R),B=q([],I,z,F);let k=[0,0,1],V=z[0],N=z[1];if(g&&(k=m.upVector(_.canonical,O.x,O.y),0!==k[0]||0!==k[1]||1!==k[2])){const e=[k[2],0,-k[0]],t=ee([],k,e);J(e,e),J(t,t),V=Q(z,e),N=Q(z,t)}if(i){const e=ee([],k,z);J(e,e),q(B,B,e,i*b)}const U=w+Math.atan2(N,V);return M.push(B),p&&P.push(O),{point:B,angle:U,path:M,tilePath:P,up:k}}function Vw(e,t){const i=t.length,r=i+4*e;t.resize(r),t.float32.fill(-1/0,4*i,4*r)}const Nw=15;class Uw{constructor(e,t,i,r,n,o,a){this.tileSize=512,this._renderWorldCopies=void 0===n||n,this._minZoom=e||0,this._maxZoom=t||22,this._minPitch=i??0,this._maxPitch=r??60,this.setProjection(o),this.setMaxBounds(a),this.width=0,this.height=0,this._center=new kc(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._nearClipOffset=0,this._unmodified=!0,this._edgeInsets=new yw,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new Ew,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1,this._allowWorldUnderZoom=!1,this.mercatorMatrix=new Float64Array(16),this.mercatorFogMatrix=new Float32Array(16),this.invProjMatrix=new Float64Array(16),this._expandedFarZProjMatrixBuf=new Float64Array(16),this.expandedFarZProjMatrix=this._expandedFarZProjMatrixBuf,this.starsProjMatrix=new Float32Array(16),this.skyboxMatrix=new Float32Array(16),this._mat4Scratch=new Float64Array(16),this.alignedProjMatrix=new Float64Array(16),this.labelPlaneMatrix=new Float32Array(16),this.glCoordMatrix=new Float32Array(16),this.pixelMatrix=new Float64Array(16),this.pixelMatrixInverse=new Float64Array(16)}clone(){const e=new Uw(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return e._elevation=this._elevation,e._centerAltitude=this._centerAltitude,e._centerAltitudeValidForE
vendor: 1,401 bytes, line 2
2xaggeration=this._centerAltitudeValidForExaggeration,e.tileSize=this.tileSize,e.mercatorFromTransition=this.mercatorFromTransition,e.width=this.width,e.height=this.height,e.cameraElevationReference=this.cameraElevationReference,e._center=this._center,e._setZoom(this.zoom),e._seaLevelZoom=this._seaLevelZoom,e.angle=this.angle,e._fov=this._fov,e._pitch=this._pitch,e._nearZ=this._nearZ,e._farZ=this._farZ,e._nearClipOffset=this._nearClipOffset,e._averageElevation=this._averageElevation,e._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,e._unmodified=this._unmodified,e._edgeInsets=this._edgeInsets.clone(),e._camera=this._camera.clone(),e._calcMatrices(),e.freezeTileCoverage=this.freezeTileCoverage,e.frustumCorners=this.frustumCorners,e._allowWorldUnderZoom=this._allowWorldUnderZoom,e}get isOrthographic(){return"globe"!==this.projection.name&&this._orthographicProjectionAtLowPitch&&this.pitch<Nw}get elevation(){return this._elevation}set elevation(e){this._elevation!==e&&(this._elevation=e,this._updateCameraOnTerrain(),this._calcMatrices())}get nearClipOffset(){return this._nearClipOffset}set nearClipOffset(e){this._nearClipOffset=e,this._calcMatrices()}get depthOcclusionForSymbolsAndCircles(){return"globe"!==this.projection.name&&!this.isOrthographic}updateElevation(e,t=!1){const i=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForE
vendor: 42,672 bytes, line 2
2xaggeration;(null==this._seaLevelZoom||i)&&this._updateCameraOnTerrain(),(e||i)&&this._constrainCamera(t),this._calcMatrices()}getProjection(){return mt(this.projection,["name","center","parallels"])}setProjection(e){this.projectionOptions=e||{name:"mercator"};const t=this.projection?this.getProjection():void 0;this.projection=rm(this.projectionOptions);const i=!Ve(t,this.getProjection());return i&&this._calcMatrices(),this.mercatorFromTransition=!1,i}setOrthographicProjectionAtLowPitch(e){return this._orthographicProjectionAtLowPitch!==e&&(this._orthographicProjectionAtLowPitch=e,this._calcMatrices(),!0)}setMercatorFromTransition(){const e=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=rm({name:"mercator"});const t=e!==this.projection.name;return t&&this._calcMatrices(),t}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies&&!0===this.projection.supportsWorldCopies}set renderWorldCopies(e){void 0===e?e=!0:null===e&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const e=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(e))}get cameraWorldSize(){const e=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(e))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return Uc(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new ke(this.width,this.height)}get bearing(){return pt(this.rotation,-180,180)}set bearing(e){this.rotation=e}get rotation(){return-this.angle/Math.PI*180}set rotation(e){const t=-e*Math.PI/180;if(this.angle===t)return;this._unmodified=!1,this.angle=t,this._calcMatrices();const i=Math.sin(this.angle),r=Math.cos(this.angle);this.rotationMatrix=[r,i,-i,r]}get pitch(){return this._pitch/Math.PI*180}set pitch(e){const t=ht(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==t&&(this._unmodified=!1,this._pitch=t,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}set fov(e){e=Math.max(.01,Math.min(60,e)),this._fov!==e&&(this._unmodified=!1,this._fov=nt(e),this._calcMatrices())}get fovX(){return this._fov}get fovY(){const e=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/e)}get horizontalFov(){return ot(2*Math.atan(Math.tan(.5*this._fov)*this.aspect))}get averageElevation(){return this._averageElevation}set averageElevation(e){this._averageElevation=e,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(e){const t=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==t&&(this._unmodified=!1,this._setZoom(t),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(e){this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(e){this._tileCoverLift!==e&&(this._tileCoverLift=e)}_updateCameraOnTerrain(){const e=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,t=this.elevation&&e===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>0&&this._centerAltitudeValidForExaggeration;if(!this._elevation||e===Number.NEGATIVE_INFINITY&&(!t||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const i=this._elevation;t||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&i.exaggeration()&&this._centerAltitudeValidForExaggeration!==i.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*i.exaggeration(),this._centerAltitudeValidForExaggeration=i.exaggeration()):(this._centerAltitude=e||0,this._centerAltitudeValidForExaggeration=i.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){if(void 0===this._centerAltitudeValidForExaggeration)return;const e=Math.max(0,(this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize);this._seaLevelZoom=this._zoomFromMercatorZ(e)}sampleAverageElevation(){if(!this._elevation)return 0;const e=this._elevation,t=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],i=this.horizonLineFromTop();let r=0,n=0;for(let o=0;o<t.length;o++){const a=new ke(t[o][0]*this.width,i+t[o][1]*(this.height-i)),s=e.pointCoordinate(a);if(!s)continue;const l=1/Math.hypot(s[0]-this._camera.position[0],s[1]-this._camera.position[1]);r+=s[3]*l,n+=l}return 0===n?NaN:r/n}get center(){return this._center}set center(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._terrainEnabled()&&("ground"===this.cameraElevationReference?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(null==this._seaLevelZoom||!this._elevation)return;const e=this._seaLevelZoom,t=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),i=this.pixelsPerMeter/this.worldSize*t,r=this._mercatorZfromZoom(e),n=this._mercatorZfromZoom(this._maxZoom),o=Math.max(r-i,n);this._setZoom(this._zoomFromMercatorZ(o))}get padding(){return this._edgeInsets.toJSON()}set padding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}equals(e){const t=this.elevation,i=e.elevation,r=null!=t!=(null!=i)||t&&i&&t.exaggeration()!==i.exaggeration();return this.width===e.width&&this.height===e.height&&this.center.lng===e.center.lng&&this.center.lat===e.center.lat&&this.zoom===e.zoom&&this.bearing===e.bearing&&this.pitch===e.pitch&&this.fov===e.fov&&this.projection.name===e.projection.name&&this._edgeInsets.equals(e.padding)&&!r}computeZoomRelativeTo(e){const t=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,e.toAltitude()));let i;i=e.z<this._camera.position[2]?[t.x,t.y,t.z]:[e.x,e.y,e.z];const r=k(se([],this._camera.position,i));return ht(this._zoomFromMercatorZ(r),this._minZoom,this._maxZoom)}setFreeCameraOptions(e){if(!this.height)return;if(!e.position&&!e.orientation)return;this._updateCameraState();let t=!1;if(e.orientation&&!((i=e.orientation)[0]===(r=this._camera.orientation)[0]&&i[1]===r[1]&&i[2]===r[2]&&i[3]===r[3])&&(t=this._setCameraOrientation(e.orientation)),e.position){const i=[e.position.x,e.position.y,e.position.z];ae(i,this._camera.position)||(this._setCameraPosition(i),t=!0)}var i,r;t&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const e=this._camera.position,t=new ww;return t.position=new Zc(e[0],e[1],e[2]),t.orientation=this._camera.orientation,t._elevation=this.elevation,t._renderWorldCopies=this.renderWorldCopies,t}_setCameraOrientation(e){if(!function(e){var t=e[0],i=e[1],r=e[2],n=e[3];return Math.sqrt(t*t+i*i+r*r+n*n)}(e))return!1;Ie(e,e);const t=ne([],[0,0,-1],e),i=ne([],[0,-1,0],e);if(i[2]<0)return!1;const r=bw(t,i);return!!r&&(this._camera.orientation=r,!0)}_setCameraPosition(e){const t=this.zoomScale(this.minZoom)*this.tileSize,i=this.zoomScale(this.maxZoom)*this.tileSize,r=this.cameraToCenterDistance;e[2]=ht(e[2],r/i,r/t),this._camera.position=e}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,i){this._unmodified=!1,this._edgeInsets.interpolate(e,t,i),this._constrain(),this._calcMatrices()}coveringZoomLevel(e){const t=(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize));return Math.max(0,t)}getVisibleUnwrappedCoordinates(e){const t=[new Mf(0,e)];if(this.renderWorldCopies){const i=this.pointCoordinate(new ke(0,0)),r=this.pointCoordinate(new ke(this.width,0)),n=this.pointCoordinate(new ke(this.width,this.height)),o=this.pointCoordinate(new ke(0,this.height)),a=Math.floor(Math.min(i.x,r.x,n.x,o.x)),s=Math.floor(Math.max(i.x,r.x,n.x,o.x)),l=1;for(let c=a-l;c<=s+l;c++)0!==c&&t.push(new Mf(c,e))}return t}isLODDisabled(e){return(!e||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCover(e,t,i,r){let n=[];const o=null!=i,a=!o;if(a&&this.zoom<t)return n;if(o&&0===i[0]&&0===i[1])return n;const s=new Set,l=(e,t,i,r,o)=>{const a=Cf(t,e,i,r,o);s.has(a)||(n.push(new Pf(e,t,i,r,o)),s.add(a))};for(let u=0;u<e.length;u++){const n=e[u];if(a&&n.canonical.z!==t)continue;if(o&&void 0!==r&&r>n.canonical.z)continue;const s=n.canonical,c=n.overscaledZ,h=n.wrap,d=1<<s.z,p=s.x+1<d,f=s.x>0,m=s.y+1<d,_=s.y>0,g=n.wrap-(f?0:1),y=n.wrap+(p?0:1),x=f?s.x-1:d-1,v=p?s.x+1:0;if(o)i[0]<0?(l(c,y,s.z,v,s.y),i[1]<0&&m&&(l(c,h,s.z,s.x,s.y+1),l(c,y,s.z,v,s.y+1)),i[1]>0&&_&&(l(c,h,s.z,s.x,s.y-1),l(c,y,s.z,v,s.y-1))):i[0]>0?(l(c,g,s.z,x,s.y),i[1]<0&&m&&(l(c,h,s.z,s.x,s.y+1),l(c,g,s.z,x,s.y+1)),i[1]>0&&_&&(l(c,h,s.z,s.x,s.y-1),l(c,g,s.z,x,s.y-1))):i[1]<0&&m?l(c,h,s.z,s.x,s.y+1):_&&l(c,h,s.z,s.x,s.y-1);else{const e=n.visibleQuadrants;1&e&&(l(c,g,s.z,x,s.y),_&&(l(c,h,s.z,s.x,s.y-1),l(c,g,s.z,x,s.y-1))),2&e&&(l(c,y,s.z,v,s.y),_&&(l(c,h,s.z,s.x,s.y-1),l(c,y,s.z,v,s.y-1))),4&e&&(l(c,g,s.z,x,s.y),m&&(l(c,h,s.z,s.x,s.y+1),l(c,g,s.z,x,s.y+1))),8&e&&(l(c,y,s.z,v,s.y),m&&(l(c,h,s.z,s.x,s.y+1),l(c,y,s.z,v,s.y+1)))}}const c=[];for(const u of n)n.some(e=>u.isChildOf(e))||c.push(u);if(n=c.filter(i=>!e.some(e=>!!(i.overscaledZ<t&&e.isChildOf(i))||i.equals(e)||i.isChildOf(e))),a){const e=1<<t,i="globe"===this.projection.name?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),r=[e*i.x,e*i.y],o=4,a=o*o;n=n.filter(e=>{const t=e.canonical.x+.5-r[0],i=e.canonical.y+.5-r[1];return t*t+i*i<a})}return n}extendTileCoverToNearPlane(e,t,i){const r=[],n=new Set;for(const g of e)n.add(g.key);const o=(e,t,i,o,a)=>{const s=Cf(t,e,i,o,a);n.has(s)||(r.push(new Pf(e,t,i,o,a)),n.add(s))},a=e.reduce((e,t)=>Math.max(e,t.overscaledZ),i),s=1<<i,l=[new ke(0,0),new ke(co,0),new ke(co,co),new ke(0,co)],c=new ke(0,0),u=new ke(0,0),h=(e,t)=>{const r=Math.floor(e[0]),n=Math.floor(e[1]),h=(e[0]-r)*co,d=(e[1]-n)*co,p=Math.floor(t[0]),f=Math.floor(t[1]),m=(t[0]-p)*co,_=(t[1]-f)*co;for(let g=-1;g<=1;g++){const e=r+g;if(!(e<0||e>=s)){c.x=h-g*co,u.x=m-(e-p)*co;for(let t=-1;t<=1;t++){const r=n+t;c.y=d-t*co,u.y=_-(r-f)*co,xd(c,u,l)&&o(a,0,i,e,r)}}}},d=t.points,p=d[3],f=d[2],m=this._projectToGround(p,d[7]),_=this._projectToGround(f,d[6]);return h(p,m),h(f,_),r}_projectToGround(e,t){return te(O(),e,t,e[2]/(e[2]-t[2]))}_projectToZ(e,t,i){const r=e[2]-t[2];return Math.abs(r)<1e-6?B(e):te(O(),e,t,(e[2]-i)/r)}extendTileCoverForTunnels(e,t,i,r){if(i<18)return[];const n=t.points,o=n[0],a=n[1],s=n[4],l=n[5];if(s[2]>=0&&l[2]>=0||o[2]<=0||a[2]<=0)return[];const c=s[2]<0?this._projectToZ(o,s,0):s,u=l[2]<0?this._projectToZ(a,l,0):l,h=-r,d=s[2]<h?this._projectToZ(o,s,h):s,p=l[2]<h?this._projectToZ(a,l,h):l,f=this._findExtensionTilesInQuad(e,i,[p,d,u,c],[.5*(c[0]+u[0]),.5*(c[1]+u[1])]);return f.length>3&&(f.length=3),f}_findExtensionTilesInQuad(e,t,i,r){const n=[],o=new Set;for(const E of e)o.add(E.key);const a=e.reduce((e,t)=>Math.max(e,t.overscaledZ),t),s=1<<t,l=[new ke(i[0][0],i[0][1]),new ke(i[1][0],i[1][1]),new ke(i[3][0],i[3][1]),new ke(i[2][0],i[2][1]),new ke(i[0][0],i[0][1])],c=i[0][0],u=i[1][0],h=i[2][0],d=i[3][0],p=i[0][1],f=i[1][1],m=i[2][1],_=i[3][1],g=Math.max(0,Math.floor(Math.min(c,u,h,d))),y=Math.min(s-1,Math.ceil(Math.max(c,u,h,d))-1),x=Math.max(0,Math.floor(Math.min(p,f,m,_))),v=Math.min(s-1,Math.ceil(Math.max(p,f,m,_))-1);for(let E=x;E<=v;E++)for(let e=g;e<=y;e++){if(!yd(l,e,E,e+1,E+1))continue;const i=Cf(0,a,t,e,E);o.has(i)||(n.push(new Pf(a,0,t,e,E)),o.add(i))}const b=r[0],w=r[1];return n.sort((e,t)=>{const i=e.canonical.x+.5-b,r=e.canonical.y+.5-w,n=t.canonical.x+.5-b,o=t.canonical.y+.5-w;return i*i+r*r-(n*n+o*o)||e.canonical.x-t.canonical.x||e.canonical.y-t.canonical.y}),n}coveringTiles(e){let t=this.coveringZoomLevel(e);const i=t,r=this.elevation&&this.elevation.exaggeration(),n=r&&!e.isTerrainDEM,o="mercator"===this.projection.name;if(void 0!==e.minzoom&&t<e.minzoom)return[];void 0!==e.maxzoom&&t>e.maxzoom&&(t=e.maxzoom);const a=this.locationCoordinate(this.center),s=this.center.lat,l=1<<t,c=[l*a.x,l*a.y,0],u="globe"===this.projection.name,h=!u,d=$p.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,t,h),p=u?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),f=l*Uc(1,this.center.lat),m=this._camera.position[2]/Uc(1,this.center.lat),_=[l*p.x,l*p.y,m*(h?1:f)],g=u||r,y=this.cameraToCenterDistance/e.tileSize*(e.roundZoom?1:.502),x=this.isLODDisabled(!0)?t:0;let v;if(this._elevation&&e.isTerrainDEM)v=1e4*this._elevation.exaggeration();else if(this._elevation){const e=this._elevation.getMinMaxForVisibleTiles();v=e?e.max:this._centerAltitude}else v=this._centerAltitude;const b=e.isTerrainDEM?-v:this._elevation?this._elevation.getMinElevationBelowMSL():0,w=this.projection.isReprojectedInTileSpace?_y(this):1,E=e=>{const t=1/4e4,i=new Zc(e.x+t,e.y,e.z),r=new Zc(e.x,e.y+t,e.z),n=e.toLngLat(),o=i.toLngLat(),a=r.toLngLat(),s=this.locationCoordinate(n),l=this.locationCoordinate(o),c=this.locationCoordinate(a),u=Math.hypot(l.x-s.x,l.y-s.y),h=Math.hypot(c.x-s.x,c.y-s.y);return Math.sqrt(u*h)*w/t},A=e=>{const t=v,i=b;return{aabb:Lf(this,l,0,0,0,e,i,t,this.projection),zoom:0,x:0,y:0,minZ:i,maxZ:t,wrap:e,fullyVisible:!1}},I=[];let S=[];const T=t,D=e.reparseOverscaled?i:t,M=(m-this._centerAltitude)*f,P=e=>{if(!this._elevation||!e.tileID||!o)return;const t=this._elevation.getMinMaxForTile(e.tileID),i=e.aabb;t?(i.min[2]=t.min,i.max[2]=t.max,i.center[2]=(i.min[2]+i.max[2])/2):(e.shouldSplit=R(e),e.shouldSplit||(i.min[2]=i.max[2]=i.center[2]=this._centerAltitude))},C=(e,t)=>{if(.707*t<e)return 1;const i=t/e;return i/(1.4144271570014144+(Math.pow(1.1,i-1.4144271570014144+1)-1)/(1.1-1)-1)},R=e=>{if(e.zoom<x)return!0;if(e.zoom===T)return!1;if(null!=e.shouldSplit)return e.shouldSplit;const t=e.aabb.distanceX(_),r=e.aabb.distanceY(_);let a=M,l=1;if(u){a=e.aabb.distanceZ(_);const t=Math.pow(2,e.zoom),i=Xn((e.y+1)/t),r=Xn(e.y/t),n=Math.min(Math.max(s,i),r),o=Nc(n)/Nc(s);if(l=n===s?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,o/this._mercatorScaleRatio),this.zoom<=5&&e.zoom===T-1&&o>=.9)return!0}else if(n&&(a=e.aabb.distanceZ(_)*f),this.projection.isReprojectedInTileSpace&&i<=5){const t=Math.pow(2,e.zoom),i=E(new Zc((e.x+.5)/t,(e.y+.5)/t));l=i>.85?1:i}if(!o&&!u){const i=Math.sqrt(t*t+r*r+a*a);let n=(1<<T-e.zoom)*y*l;return n*=C(Math.max(a,M),i),i<n}let h=Number.MAX_VALUE,d=0;const p=e.aabb.getCorners(),m=[0,0,0];for(const i of p){se(m,i,_),u||(n?m[2]*=f:m[2]=M);const e=Q(m,this._camera.forward());e<h&&(h=e,d=Math.abs(m[2]))}let g=(1<<T-e.zoom)*y*l;if(g*=C(Math.max(d,M),h),h<g)return!0;const v=e.aabb.closestPoint(c);return v[0]===c[0]&&v[1]===c[1]};if(this.renderWorldCopies)for(let z=1;z<=3;z++)I.push(A(-z)),I.push(A(z));for(I.push(A(0));I.length>0;){const i=I.pop(),r=i.x,a=i.y;let s=i.fullyVisible;const h=()=>"globe"===this.projection.name&&(0===i.y||i.y===(1<<i.zoom)-1);if(!s){let e=g?i.aabb.intersects(d):i.aabb.intersectsFlat(d);if(0===e&&h()){const t=new Df(i.zoom,r,a);e=rf(this,l,t,!0).intersects(d)}if(0===e)continue;s=2===e}if(i.zoom===T||!R(i)){const n=i.zoom===T?D:i.zoom;if(e.minzoom&&e.minzoom>n)continue;let o=0;if(!s){let t=g?i.aabb.intersectsPrecise(d):i.aabb.intersectsPreciseFlat(d);if(0===t&&h()){const e=new Df(i.zoom,r,a);t=rf(this,l,e,!0).intersectsPrecise(d)}if(0===t)continue;if(e.calculateQuadrantVisibility)if(d.containsPoint(i.aabb.center))o=15;else for(let e=0;e<4;e++)0!==i.aabb.quadrant(e).intersects(d)&&(o|=1<<e)}const u=c[0]-(.5+r+(i.wrap<<i.zoom))*(1<<t-i.zoom),p=c[1]-.5-a,f=i.tileID?i.tileID:new Pf(n,i.wrap,i.zoom,r,a);e.calculateQuadrantVisibility&&(f.visibleQuadrants=o),S.push({tileID:f,distanceSq:u*u+p*p});continue}for(let e=0;e<4;e++){const t=(r<<1)+e%2,c=(a<<1)+(e>>1),h={aabb:o?i.aabb.quadrant(e):Lf(this,l,i.zoom+1,t,c,i.wrap,i.minZ,i.maxZ,this.projection),zoom:i.zoom+1,x:t,y:c,wrap:i.wrap,fullyVisible:s,tileID:void 0,shouldSplit:void 0,minZ:i.minZ,maxZ:i.maxZ};n&&!u&&(h.tileID=new Pf(i.zoom+1===T?D:i.zoom+1,i.wrap,i.zoom+1,t,c),P(h)),I.push(h)}}if(this.fogCullDistSq){const t=this.fogCullDistSq,i=this.horizonLineFromTop();S=S.filter(r=>{const n=[0,0,0,1],o=[co,co,0,1],a=this.calculateFogTileMatrix(r.tileID.toUnwrapped());me(n,n,a),me(o,o,a);const s=(h=n,d=o,(u=[])[0]=Math.min(h[0],d[0]),u[1]=Math.min(h[1],d[1]),u[2]=Math.min(h[2],d[2]),u[3]=Math.min(h[3],d[3]),u),l=function(e,t,i){return e[0]=Math.max(t[0],i[0]),e[1]=Math.max(t[1],i[1]),e[2]=Math.max(t[2],i[2]),e[3]=Math.max(t[3],i[3]),e}([],n,o),c=function(e,t){let i=0;for(let r=0;r<2;++r){const n=0;e[r]>n&&(i+=(e[r]-n)*(e[r]-n)),t[r]<n&&(i+=(n-t[r])*(n-t[r]))}return i}(s,l);var u,h,d;if(0===c)return!0;let p=!1;const f=this._elevation;if(f&&c>t&&0!==i){const t=this.calculateProjMatrix(r.tileID.toUnwrapped());let n;e.isTerrainDEM||(n=f.getMinMaxForTile(r.tileID)),n||(n={min:b,max:v});const o=function(e){const t=Math.round((e+45+360)%360/90)%4;return at[t]}(this.rotation),a=[o[0]*co,o[1]*co,n.max];ie(a,a,t),p=(1-a[1])*this.height*.5<i}return c<t||p})}return S.sort((e,t)=>e.distanceSq-t.distanceSq).map(e=>e.tileID)}resize(e,t){this.width=e,this.height=t,this.pixelsToGLUnits=[2/e,-2/t],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log2(e)}project(e){const t=ht(e.lat,-85.051129,Gc),i=this.projection.project(e.lng,t);return new ke(i.x*this.worldSize,i.y*this.worldSize)}unproject(e){return this.projection.unproject(e.x/this.worldSize,e.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/Uc(1,this.center.lat)/this.worldSize}setLocationAtPoint(e,t){let i,r;const n=this.centerPoint;if("globe"===this.projection.name){const e=this.worldSize;i=(t.x-n.x)/e,r=(t.y-n.y)/e}else{const e=this.pointCoordinate(t),o=this.pointCoordinate(n);i=e.x-o.x,r=e.y-o.y}const o=this.locationCoordinate(e);this.setLocation(new Zc(o.x-i,o.y-r))}setLocation(e){this.center=this.coordinateLocation(e),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(e,t){return this.projection.locationPoint(this,e,t)}locationPoint3D(e,t){return this.projection.locationPoint(this,e,t,!0)}pointLocation(e){return this.coordinateLocation(this.pointCoordinate(e))}pointLocation3D(e,t){return this.coordinateLocation(this.pointCoordinate3D(e,t))}locationCoordinate(e,t){const i=t?Uc(t,e.lat):void 0,r=this.projection.project(e.lng,e.lat);return new Zc(r.x,r.y,i)}coordinateLocation(e){return this.projection.unproject(e.x,e.y)}pointRayIntersection(e,t){const i=t??this._centerAltitude,r=[e.x,e.y,0,1],n=[e.x,e.y,1,1];me(r,r,this.pixelMatrixInverse),me(n,n,this.pixelMatrixInverse);const o=n[3];pe(r,r,1/r[3]),pe(n,n,1/o);const a=r[2],s=n[2];return{p0:r,p1:n,t:a===s?0:(i-a)/(s-a)}}screenPointToMercatorRay(e){const t=[e.x,e.y,0,1],i=[e.x,e.y,1,1];return me(t,t,this.pixelMatrixInverse),me(i,i,this.pixelMatrixInverse),pe(t,t,1/t[3]),pe(i,i,1/i[3]),t[2]=Uc(t[2],this._center.lat)*this.worldSize,i[2]=Uc(i[2],this._center.lat)*this.worldSize,pe(t,t,1/this.worldSize),pe(i,i,1/this.worldSize),new kp([t[0],t[1],t[2]],J([],se([],i,t)))}rayIntersectionCoordinate(e){const{p0:t,p1:i,t:r}=e,n=Uc(t[2],this._center.lat),o=Uc(i[2],this._center.lat);return new Zc(Wr(t[0],i[0],r)/this.worldSize,Wr(t[1],i[1],r)/this.worldSize,Wr(n,o,r))}pointCoordinate(e,t=this._centerAltitude){return this.projection.pointCoordinate(this,e.x,e.y,t)}pointCoordinate3D(e,t){if(!this.elevation)return this.pointCoordinate(e,t);let i=this.projection.pointCoordinate3D(this,e.x,e.y);if(i)return new Zc(i[0],i[1],i[2]);let r=0,n=this.horizonLineFromTop();if(e.y>n)return this.pointCoordinate(e,t);const o=.02*n,a=e.clone();for(let s=0;s<10&&n-r>o;s++){a.y=Wr(r,n,.66);const e=this.projection.pointCoordinate3D(this,a.x,a.y);e?(n=a.y,i=e):r=a.y}return i?new Zc(i[0],i[1],i[2]):this.pointCoordinate(e)}isPointAboveHorizon(e){return this.projection.isPointAboveHorizon(this,e)}isPointOnSurface(e){if(e.y<0||e.y>this.height||e.x<0||e.x>this.width)return!1;if(this.elevation||this.zoom>=6)return!this.isPointAboveHorizon(e);const t=this.pointCoordinate(e);return t.y>=0&&t.y<=1}_coordinatePoint(e,t){const i=t&&this.elevation?this.elevation.getAtPointOrZero(e,this._centerAltitude):this._centerAltitude,r=[e.x*this.worldSize,e.y*this.worldSize,i+e.toAltitude(),1];return me(r,r,this.pixelMatrix),r[3]>0?new ke(r[0]/r[3],r[1]/r[3]):new ke(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:e,left:t}=this._edgeInsets,i=this.height-this._edgeInsets.bottom,r=this.width-this._edgeInsets.right,n=this.pointLocation3D(new ke(t,e)),o=this.pointLocation3D(new ke(r,e)),a=this.pointLocation3D(new ke(r,i)),s=this.pointLocation3D(new ke(t,i));let l=Math.min(n.lng,o.lng,a.lng,s.lng),c=Math.max(n.lng,o.lng,a.lng,s.lng),u=Math.min(n.lat,o.lat,a.lat,s.lat),h=Math.max(n.lat,o.lat,a.lat,s.lat);const d=Math.pow(2,-this.zoom)/16*270,p="globe"===this.projection.name?1:4,f=(e,t,i,r,n)=>{const o=(e+i)/2,a=(t+r)/2,s=new ke(o,a),{lng:m,lat:_}=this.pointLocation3D(s),g=Math.max(0,l-m,u-_,m-c,_-h);l=Math.min(l,m),c=Math.max(c,m),u=Math.min(u,_),h=Math.max(h,_),(n<p||g>d)&&(f(e,t,o,a,n+1),f(o,a,i,r,n+1))};if(f(t,e,r,e,1),f(r,e,r,i,1),f(r,i,t,i,1),f(t,i,t,e,1),"globe"===this.projection.name){const[e,t]=function(e){const t=_(new Float64Array(16));x(t,e.pixelMatrix,e.globeMatrix);const i=[0,Rc,0],r=[0,zc,0];return ie(i,i,t),ie(r,r,t),[i[0]>0&&i[0]<=e.width&&i[1]>0&&i[1]<=e.height&&!wf(e,new kc(e.center.lat,90)),r[0]>0&&r[0]<=e.width&&r[1]>0&&r[1]<=e.height&&!wf(e,new kc(e.center.lat,-90))]}(this);e?(h=90,c=180,l=-180):t&&(u=-90,c=180,l=-180)}return new Vc(new kc(l,u),new kc(c,h))}_getBoundsRectangular(e,t){const{top:i,left:r}=this._edgeInsets,n=this.height-this._edgeInsets.bottom,o=this.width-this._edgeInsets.right,a=new ke(r,i),s=new ke(o,i),l=new ke(o,n),c=new ke(r,n);let u=this.pointCoordinate(a,e),h=this.pointCoordinate(s,e);const d=this.pointCoordinate(l,t),p=this.pointCoordinate(c,t),f=(e,t)=>(t.y-e.y)/(t.x-e.x);return u.y>1&&h.y>=0?u=new Zc((1-p.y)/f(p,u)+p.x,1):u.y<0&&h.y<=1&&(u=new Zc(-p.y/f(p,u)+p.x,0)),h.y>1&&u.y>=0?h=new Zc((1-d.y)/f(d,h)+d.x,1):h.y<0&&u.y<=1&&(h=new Zc(-d.y/f(d,h)+d.x,0)),(new Vc).extend(this.coordinateLocation(u)).extend(this.coordinateLocation(h)).extend(this.coordinateLocation(p)).extend(this.coordinateLocation(d))}_getBoundsRectangularTerrain(){const e=this.elevation;if(!e.visibleDemTiles.length||e.isUsingMockSource())return this._getBoundsRectangular(0,0);const t=e.visibleDemTiles.reduce((e,t)=>{if(t.dem){const i=t.dem.tree;e.min=Math.min(e.min,i.minimums[0]),e.max=Math.max(e.max,i.maximums[0])}return e},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(t.min*e.exaggeration(),t.max*e.exaggeration())}getBounds(){return"mercator"===this.projection.name||"equirectangular"===this.projection.name?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(e=!0){const t=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,i=this.height/2-t*(1-this._horizonShift);return e?Math.max(0,i):i}getMaxBounds(){return this.maxBounds}setMaxBounds(e){this.maxBounds=e,this.minLat=-85.051129,this.maxLat=Gc,this.minLng=-180,this.maxLng=180,e&&(this.minLat=e.getSouth(),this.maxLat=e.getNorth(),this.minLng=e.getWest(),this.maxLng=e.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=Wn(this.minLng)*this.tileSize,this.worldMaxX=Wn(this.maxLng)*this.tileSize,this.worldMinY=qn(this.maxLat)*this.tileSize,this.worldMaxY=qn(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(e,t){return this.projection.createTileMatrix(this,t,e)}calculateDistanceTileData(e){const t=e.key,i=this._distanceTileDataCache;if(i[t])return i[t];const r=e.canonical,n=1/this.height,o=this.cameraWorldSize,a=o/this.zoomScale(r.z),s=(r.x+Math.pow(2,r.z)*e.wrap)*a,l=r.y*a,c=this.point;c.x*=o/this.worldSize,c.y*=o/this.worldSize;const u=this.angle,h=Math.sin(-u),d=-Math.cos(-u);return i[t]={bearing:[h,d],center:[(c.x-s)*n,(c.y-l)*n],scale:a/co*n},i[t]}calculateFogTileMatrix(e){const t=e.key,i=this._fogTileMatrixCache;if(i[t])return i[t];const r=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,e);return x(r,this.worldToFogMatrix,r),i[t]=new Float32Array(r),i[t]}calculateProjMatrix(e,t=!1,i=!1){const r=e.key;let n;if(n=i?this._expandedProjMatrixCache:t?this._alignedProjMatrixCache:this._projMatrixCache,n[r])return n[r];const o=this.calculatePosMatrix(e,this.worldSize);let a;return a=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:i?this.expandedFarZProjMatrix:t?this.alignedProjMatrix:this.projMatrix,x(o,a,o),n[r]=new Float32Array(o),n[r]}calculatePixelsToTileUnitsMatrix(e){const t=e.tileID.key,i=this._pixelsToTileUnitsCache;if(i[t])return i[t];const r=function(e,t){const{scale:i}=e.tileTransform,r=i*co/(e.tileSize*Math.pow(2,t.zoom-e.tileID.overscaledZ+e.tileID.canonical.z)),n=t.inverseAdjustmentMatrix;return new Float32Array([n[0]*r,n[1]*r,n[2]*r,n[3]*r])}(e,this);return i[t]=r,i[t]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if("globe"===this.projection.name){const e=1/this.worldSize,t=S([],[e,e,e]);return x(t,t,this.globeMatrix),t}}recenterOnTerrain(){if(!this._elevation||"globe"===this.projection.name)return;const e=this._elevation;this._updateCameraState();const t=Uc(1,this._center.lat)*this.worldSize,i=this._computeCameraPosition(t),r=this._camera.forward(),n=Uc(1,this._center.lat);i[2]/=n,r[2]/=n,J(r,r);const o=e.raycast(i,r,e.exaggeration());if(o){const e=q([],i,r,o),t=new Zc(e[0],e[1],Uc(e[2],Xn(e[1]))),a=(t.z+k([t.x-i[0],t.y-i[1],t.z-i[2]*n]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(a),this._centerAltitude=t.toAltitude(),this._center=this.coordinateLocation(t),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(e=!1){if(!this._elevation)return;const t=this._elevation,i=Uc(1,this._center.lat)*this.worldSize,r=this._computeCameraPosition(i),n=t.getAtPointOrZero(new Zc(...r)),o=this.pixelsPerMeter/this.worldSize*n,a=this._minimumHeightOverTerrain(),s=r[2]-o;if(s<=a)if(s<0||e){const e=this.locationCoordinate(this._center,this._centerAltitude),t=[r[0],r[1],e.z-r[2]],i=k(t);t[2]-=(a-s)/this._pixelsPerMercatorPixel;const n=k(t);if(0===n)return;W(t,t,i/n*this._pixelsPerMercatorPixel),this._camera.position=[r[0],r[1],e.z*this._pixelsPerMercatorPixel-t[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const e="globe"===this.projection.name||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||e){const t=this.center;return t.lat=ht(t.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!e)&&(t.lng=ht(t.lng,this.minLng,this.maxLng)),this.center=t,void(this._constraining=!1)}const t=this._unmodified,{x:i,y:r}=this.point;let n=0,o=i,a=r;const s=this.width/2,l=this.height/2,c=this.worldMinY*this.scale,u=this.worldMaxY*this.scale;if(r-l<c&&(a=c+l),r+l>u&&(a=u-l),u-c<this.height&&(n=Math.max(n,this.height/(u-c)),a=(u+c)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const e=this.worldMinX*this.scale,t=this.worldMaxX*this.scale,r=this.worldSize/2-(e+t)/2;o=(i+r+this.worldSize)%this.worldSize-r,o-s<e&&(o=e+s),o+s>t&&(o=t-s),t-e<this.width&&(n=Math.max(n,this.width/(t-e)),o=(t+e)/2)}o===i&&a===r||this._allowWorldUnderZoom||(this.center=this.unproject(new ke(o,a))),n&&!this._allowWorldUnderZoom&&(this.zoom+=this.scaleZoom(n)),this._constrainCamera(),this._unmodified=t,this._constraining=!1}_minZoomForBounds(){let e=Math.max(0,this.scaleZoom(Math.max(0,this.height)/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(e=Math.max(e,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),e}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}_calcMatrices(){if(!this.height)return;const e=this.centerOffset,t="globe"===this.projection.name,i=this.pixelsPerMeter;"globe"===this.projection.name&&(this._mercatorScaleRatio=Uc(1,this.center.lat)/Uc(1,45));const r=gy(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,r),this.cameraToCenterDistance=.5/Math.tan(.5*this._fov)*this.height*this._pixelsPerMercatorPixel,this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;const n="meters"===this.projection.zAxisUnit?i:1,o=this._camera.getWorldToCamera(this.worldSize,n);let a;const l=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(l[8]=2*-e.x/this.width,l[9]=2*e.y/this.height,this.isOrthographic){let t=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),i=t*this.aspect,r=-i,n=-t;i-=e.x,r-=e.x,t+=e.y,n+=e.y,a=this._camera.getCameraToClipOrthographic(r,i,n,t,this._nearZ+this._nearClipOffset,this._farZ),((e,t,i,r)=>{for(let n=0;n<16;n++)e[n]=Wr(t[n],i[n],r)})(a,a,l,$t(this.pitch>=Nw?1:this.pitch/Nw))}else a=l;const c=F([],l,o),u=F([],a,o);if(this.projection.isReprojectedInTileSpace){const e=this.locationCoordinate(this.center);_(this._mat4Scratch);const t=this._mat4Scratch;v(t,t,[e.x*this.worldSize,e.y*this.worldSize,0]),x(t,t,my(this)),v(t,t,[-e.x*this.worldSize,-e.y*this.worldSize,0]),x(u,u,t),x(c,c,t),this.inverseAdjustmentMatrix=function(e){const t=my(e,!0);return s([],[t[0],t[1],t[4],t[5]])}(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(b(this.mercatorMatrix,u,[this.worldSize,this.worldSize,this.worldSize/n,1]),this.projMatrix=u,y(this.invProjMatrix,this.projMatrix),t){const t=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);t[8]=2*-e.x/this.width,t[9]=2*e.y/this.height,F(this._expandedFarZProjMatrixBuf,t,o),this.expandedFarZProjMatrix=this._expandedFarZProjMatrixBuf}else this.expandedFarZProjMatrix=this.projMatrix;y(this._mat4Scratch,a),this.frustumCorners=Vp.fromInvProjectionMatrix(this._mat4Scratch,this.horizonLineFromTop(),this.height),this.cameraFrustum=$p.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!t),S(this.skyboxMatrix,[1,-1,1]),w(this.skyboxMatrix,this.skyboxMatrix,this._pitch),A(this.skyboxMatrix,this.skyboxMatrix,this.angle),z(this.starsProjMatrix,this._fov,this.width/this.height,this._nearZ,this._farZ);const h=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;m(this._mat4Scratch,this.starsProjMatrix),this._mat4Scratch[8]=2*-e.x/this.width,this._mat4Scratch[9]=2*(e.y+h)/this.height,x(this.skyboxMatrix,this._mat4Scratch,this.skyboxMatrix);const d=this.point,p=d.x,f=d.y,g=this.width%2/2,E=this.height%2/2,I=Math.cos(this.angle),T=Math.sin(this.angle),D=p-Math.round(p)+I*g+T*E,M=f-Math.round(f)+I*E+T*g;if(m(this.alignedProjMatrix,u),v(this.alignedProjMatrix,this.alignedProjMatrix,[D>.5?D-1:D,M>.5?M-1:M,0]),S(this.labelPlaneMatrix,[this.width/2,-this.height/2,1]),v(this.labelPlaneMatrix,this.labelPlaneMatrix,[1,-1,0]),S(this.glCoordMatrix,[1,-1,1]),v(this.glCoordMatrix,this.glCoordMatrix,[-1,-1,0]),b(this.glCoordMatrix,this.glCoordMatrix,[2/this.width,2/this.height,1]),x(this.pixelMatrix,this.labelPlaneMatrix,c),this._calcFogMatrices(),this._distanceTileDataCache={},!y(this.pixelMatrixInverse,this.pixelMatrix))throw new Error("failed to invert matrix");if("globe"===this.projection.name||this.mercatorFromTransition){this.globeMatrix=function(e){const{x:t,y:i}=e.point,{lng:r,lat:n}=e._center;return pf(t,i,e.worldSize,r,n)}(this);const e=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=ie(e,e,o),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=this.pixelMatrixInverse;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const e=this.cameraWorldSizeForFog,t=this.cameraPixelsPerMeter,i=this._camera.position,r=1/this.height/this._pixelsPerMercatorPixel,n=[e,e,t];W(n,n,r),W(i,i,-1),G(i,i,n),I(this.mercatorFogMatrix,i),b(this.mercatorFogMatrix,this.mercatorFogMatrix,n),this.worldToFogMatrix=this._camera.getWorldToCameraPosition(e,t,r)}_computeCameraPosition(e){const t=(e=e||this.pixelsPerMeter)/this.pixelsPerMeter,i=this._camera.forward(),r=this.point,n=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*t-e/this.worldSize*this._centerAltitude;return[r.x/this.worldSize-i[0]*n,r.y/this.worldSize-i[1]*n,e/this.worldSize*this._centerAltitude-i[2]*n]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(e){const t=this._maxCameraBoundsDistance()*Math.cos(this._pitch),i=this._camera.position[2],r=e[2];let n=1;this.projection.wrap&&(this.center=this.center.wrap()),r>0&&(n=Math.min((t-i)/r,1)),this._camera.position=q([],this._camera.position,e,n),this._updateStateFromCamera()}_updateStateFromCamera(){const e=this._camera.position,t=this._camera.forward(),{pitch:i,bearing:r}=this._camera.getPitchBearing(),n=Uc(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,o=this._mercatorZfromZoom(this._maxZoom)*Math.cos(nt(this._maxPitch)),a=Math.max((e[2]-n)/Math.cos(i),o),s=this._zoomFromMercatorZ(a);q(e,e,t,a),this._pitch=ht(i,nt(this.minPitch),nt(this.maxPitch)),this.angle=pt(r,-Math.PI,Math.PI),this._setZoom(ht(s,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new Zc(e[0],e[1],e[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(e){return Math.pow(2,e)*this.tileSize}_mercatorZfromZoom(e){return this.cameraToCenterDistance/this._worldSizeFromZoom(e)}_minimumHeightOverTerrain(){const e=Math.min(this._seaLevelZoom??this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(e)}_zoomFromMercatorZ(e){return this.scaleZoom(this.cameraToCenterDistance/(Math.max(0,e)*this.tileSize))}zoomFromMercatorZAdjusted(e){let t=0,i=6,r=0,n=1/0;for(;i-t>1e-6&&i>t;){const o=t+.5*(i-t),a=this.tileSize*Math.pow(2,o),s=this.getCameraToCenterDistance(this.projection,o,a),l=this.scaleZoom(s/(Math.max(0,e)*this.tileSize)),c=Math.abs(o-l);c<n&&(n=c,r=o),o<l?t=o:i=o}return r}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(Tt("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(e,t){const i=Math.min(e.x,t.x),r=Math.max(e.x,t.x),n=Math.min(e.y,t.y),o=Math.max(e.y,t.y);if(n<this.horizonLineFromTop(!1))return!0;if("mercator"!==this.projection.name)return!1;const a=[new ke(i,n),new ke(r,o),new ke(i,o),new ke(r,n)],s=this.renderWorldCopies?-3:0,l=this.renderWorldCopies?4:1;for(const c of a){const e=this.pointRayIntersection(c);if(e.t<0)return!0;const t=this.rayIntersectionCoordinate(e);if(t.x<s||t.y<0||t.x>l||t.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+ot(this.fovAboveCenter)>88||this.anyCornerOffEdge(new ke(0,0),new ke(this.width,this.height))}zoomDeltaToMovement(e,t){const i=k(se([],this._camera.position,e)),r=this._zoomFromMercatorZ(i)+t;return i-this._mercatorZfromZoom(r)}getCameraPoint(){if("globe"===this.projection.name){const e=function([e,t,i],r){const n=[e,t,i,1];me(n,n,r);const o=n[3]=Math.max(n[3],1e-6);return n[0]/=o,n[1]/=o,n[2]/=o,n}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new ke(e[0],e[1])}{const e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new ke(0,e))}}getCameraToCenterDistance(e,t=this.zoom,i=this.worldSize){const r=gy(e,t,this.width,this.height,1024),n=e.pixelSpaceConversion(this.center.lat,i,r);let o=.5/Math.tan(.5*this._fov)*this.height*n;return this.isOrthographic&&(o=Wr(1,o,$t(this.pitch>=Nw?1:this.pitch/Nw))),o}getWorldToCameraMatrix(){const e=this._camera.getWorldToCamera(this.worldSize,"meters"===this.projection.zAxisUnit?this.pixelsPerMeter:1);return"globe"===this.projection.name&&x(e,e,this.globeMatrix),e}getFrustum(e){return $p.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,e,"meters"===this.projection.zAxisUnit)}}const jw=(e,t)=>{if(t<=0||e.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const i=e.transform,r=i.pitch,n=i.isLODDisabled(!1)?60:30;if(r<n-15)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const o=i._farZ-i._nearZ,a=t*i.height*1.3,s=Math.pow(2,.85*Math.max(i._zoom-e.minCutoffZoom,0)),l=1.4*i.cameraToCenterDistance*s,c=dt(n-15,n,r),u=Wr(i._farZ+a,l,c),h=Math.min(a,u-i._nearZ);return{shouldRenderCutoff:c>0,uniformValues:{u_cutoff_params:[i._nearZ,i._farZ,(u-i._nearZ)/o,(u-h-i._nearZ)/o]}}};function Gw(e,t,i,r){const n=1<<e.z;t.lat=Xn((r/co+e.y)/n),t.lng=Zn((i/co+e.x)/n)}const Hw=(e,t,i=1)=>({u_matrix:e,u_color:t,u_overlay:0,u_overlay_scale:i}),$w=new Float64Array(16),Ww=new Float64Array(16),qw=new Float64Array(16),Zw=new Float64Array(16),Xw=new Float64Array(16),Yw=new Float64Array(16),Kw=new Float64Array(16),Jw=[0,0,0],Qw=new Float32Array(16),eE=[0,0,0],tE=[0,0,0],iE=[];function rE(e,t,i){const r=i.cameraWorldSizeForFog/i.worldSize;return b(e,i.worldToFogMatrix,[r,r,1]),x(e,e,t),e}function nE(e,t,i,r){return v(e,t,i),ae(r,Ty)||b(e,e,r),e}function oE(e,t,i,r){const n=i?t.lightsStyleAabb:e.aabb,o=n?n.min[2]:1/0,a=(n?n.max[2]:-1/0)-o;return[isFinite(o)?o:0,a>0&&isFinite(a)?a:1,r?1:0,0]}function aE(e,t){return t.featureBuffer?e.partStyleUBO:null}function sE(e,t,i,r,n,o=null){const a=i.material,s=r.context,{baseColorTexture:l,metallicRoughnessTexture:c}=a.pbrMetallicRoughness,{normalTexture:u,occlusionTexture:h,emissionTexture:d}=a;function p(t,i,r){if(t&&(e.push(i),s.activeTexture.set(s.gl.TEXTURE0+r),t.gfxTexture)){const{minFilter:e,magFilter:i,wrapS:r,wrapT:n}=t.sampler;t.gfxTexture.bindExtraParam(e,i,r,n)}}p(l,"HAS_TEXTURE_u_baseColorTexture",5),p(c,"HAS_TEXTURE_u_metallicRoughnessTexture",6),p(u,"HAS_TEXTURE_u_normalTexture",7),p(h,"HAS_TEXTURE_u_occlusionTexture",8),p(d,"HAS_TEXTURE_u_emissionTexture",9),n&&(n.texture||(n.texture=new Wm(r.context,n.image,[n.image.height,n.image.height,n.image.height],s.gl.RGBA8)),s.activeTexture.set(s.gl.TEXTURE0+10),n.texture&&n.texture.bind(s.gl.LINEAR,s.gl.CLAMP_TO_EDGE),e.push("APPLY_LUT_ON_GPU")),i.texcoordBuffer&&(e.push("HAS_ATTRIBUTE_a_uv_2f"),t.push(i.texcoordBuffer)),i.colorBuffer&&(e.push(12===i.colorBuffer.itemSize?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),t.push(i.colorBuffer)),i.normalBuffer&&(e.push("HAS_ATTRIBUTE_a_normal_4n"),t.push(i.normalBuffer)),o&&(e.push("HAS_ATTRIBUTE_a_feature"),t.push(i.featureBuffer)),"OPAQUE"!==a.alphaMode&&"MASK"!==a.alphaMode||e.push("UNPREMULT_TEXTURE_IN_SHADER"),a.defined||e.push("DIFFUSE_SHADED");const f=r.shadowRenderer;f&&(e.push("RENDER_SHADOWS"),f.useNormalOffset&&e.push("NORMAL_OFFSET"))}function lE(e,t,i,r,n,o){const a=e.modelOpacity,s=t.context,l=new fw(t.context.gl.LEQUAL,e.isLightMesh?fw.ReadOnly:fw.ReadWrite,t.depthRangeFor3D),c=t.transform,u=e.mesh,h=u.material,d=h.pbrMetallicRoughness,p=t.style.fog;"pixels"===t.transform.projection.zAxisUnit?$w.set(e.nodeModelMatrix):x($w,r.zScaleMatrix,e.nodeModelMatrix),x($w,r.negCameraPosMatrix,$w),y(Ww,$w),g(Ww,Ww);const f="none"===i.paint.get("model-color-use-theme").constantOr("default"),m=i.paint.get("model-emissive-strength").constantOr(0),_={defines:[]},v=[],b=t.shadowRenderer;b&&(b.useNormalOffset=!1),sE(_.defines,v,u,t,f?null:i.lut);let w=null;if(p&&(w=rE(qw,e.nodeModelMatrix,t.transform),"globe"!==c.projection.name)){const e=u.aabb.min,t=u.aabb.max,[i,r]=p.getOpacityForBounds(w,e[0],e[1],t[0],t[1]);_.overrideFog=i>=bm||r>=bm}const E=jw(t,i.paint.get("model-cutoff-fade-range"));E.shouldRenderCutoff&&_.defines.push("RENDER_CUTOFF");const A=t.getOrCreateProgram("model",_),I=sw(e.worldViewProjection,$w,Ww,null,t,a,d.baseColorFactor,h.emissiveFactor,d.metallicFactor,d.roughnessFactor,h,m,i,void 0,void 0,e.materialOverride,e.modelColor,1,A.fixedDefines.includes("LIGHTING_3D_MODE"));t.uploadCommonUniforms(s,A,null,w,E,e.lightOverrides),"shadow"!==t.renderPass&&b&&b.setupShadowsFromMatrix(e.nodeModelMatrix,A),A.draw(t,s.gl.TRIANGLES,l,n,o,u.material.doubleSided?gw.disabled:gw.backCCW,I,i.id,u.vertexBuffer,u.indexBuffer,u.segments,i.paint,t.transform.zoom,void 0,v)}function cE(e,t){return e.style._importedAsBasemap?"basemap":t.scope}function uE(e,t,i,r,n,o,a,s,l,c,u){const h=e.transform,d=!!t.isGeometryBloom&&t.isGeometryBloom;if(void 0!==t.minZoom&&e.transform.zoom<t.minZoom)return;if(void 0!==t.maxZoom&&e.transform.zoom>t.maxZoom)return;if(d&&"shadow"===e.renderPass)return;const p="globe"===h.projection.name?Ay(i,h):[...i];x(p,p,t.globalMatrix);const f=x([],r,p);if(t.meshes)for(const m of t.meshes){const e=s.get(m.material.name);if(e&&e.opacity<=0)continue;if("BLEND"!==m.material.alphaMode){a.push({mesh:m,depth:0,modelIndex:n,worldViewProjection:f,nodeModelMatrix:p,isLightMesh:d,materialOverride:e,modelOpacity:l,modelColor:c,lightOverrides:u,node:t,modelMatrix:i});continue}const r=ie([],m.centroid,f);!h.isOrthographic&&r[2]<=0||o.push({mesh:m,depth:r[2],modelIndex:n,worldViewProjection:f,nodeModelMatrix:p,isLightMesh:d,materialOverride:e,modelOpacity:l,modelColor:c,lightOverrides:u,node:t,modelMatrix:i})}if(t.children)for(const m of t.children)uE(e,m,i,r,n,o,a,s,l,c,u)}function hE(e,t,i,r,n){const o=i.shadowRenderer;if(!o)return;const a=o.getShadowPassDepthMode(),s=n||o.calculateShadowPassMatrixFromMatr
vendor: 4,481 bytes, line 2
2ix(t),l=lw(s);i.getOrCreateProgram("modelDepth").draw(i,i.context.gl.TRIANGLES,a,uw.disabled,pw.disabled,gw.disabled,l,r.id,e.vertexBuffer,e.indexBuffer,e.segments,r.paint,i.transform.zoom,void 0,void 0)}function dE(e,t,i,r){const n=function(e,t){if(t.footprintDebugMesh)return t.footprintDebugMesh;if(!t.footprint)return null;const i=e.context,r=t.footprint.vertices,n=t.footprint.indices,o=new uu;o.reserve(r.length);for(const _ of r)o.emplaceBack(_.x,_.y);const a=new Ru;a.reserve(n.length);for(let _=0;_<n.length;_+=3)a.emplaceBack(n[_],n[_+1],n[_+2]);const s=i.createVertexBuffer(o,Op.members),l=i.createIndexBuffer(a),c=uh.simpleSegment(0,0,r.length,n.length),u=t.id||t.name||"footprint";let h;const d=parseInt(u,10);h=isNaN(d)?function(e){let t=0;for(let i=0;i<e.length;i++)t=(t<<5)-t+e.charCodeAt(i)|0;return t}(u):d;const p=Wt(h),f=Wt(h+1),m=Wt(h+2);return t.footprintDebugMesh={vertexBuffer:s,indexBuffer:l,segments:c,color:new Zr(p,f,m,.5)},t.footprintDebugMesh}(e,i);if(!n)return;const o=e.context,a=o.gl,s=e.getOrCreateProgram("debug"),l=n.color,c=fw.disabled;o.activeTexture.set(a.TEXTURE0),e.emptyTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE),s.draw(e,a.TRIANGLES,c,uw.disabled,pw.alphaBlended,gw.disabled,Hw(r,l.toPremultipliedRenderColor(null)),"$debug",n.vertexBuffer,n.indexBuffer,n.segments)}function pE(e,t,i,r,n,o){for(const a of n){const n={...r};n.part=a;const s={type:"Unknown",id:t,properties:n},l={orientation:e.paint.get("model-rotation").evaluate(s,i)};o.set(a,l)}}function fE(e,t,i,r,n,o){for(const a of n){const n={...r};n.part=a;const s={type:"Unknown",id:t,properties:n},l={color:e.paint.get("model-color").evaluate(s,i),colorMix:e.paint.get("model-color-mix-intensity").evaluate(s,i),opacity:e.paint.get("model-opacity").evaluate(s,i),emissionStrength:e.paint.get("model-emissive-strength").evaluate(s,i)};o.set(a,l)}}function mE(e,t,i,r,n){let o=!1;for(const s of r)1!==s.modelOpacity&&(lE(s,e,t,n[s.modelIndex],uw.disabled,pw.disabled),o=!0);for(const s of r)lE(s,e,t,n[s.modelIndex],1!==s.modelOpacity?e.stencilModeFor3D():uw.disabled,e.colorModeForRenderPass());o&&e.resetStencilClippingMasks();const a=pw.additive;for(const s of i)lE(s,e,t,n[s.modelIndex],uw.disabled,s.isLightMesh?a:e.colorModeForRenderPass())}function _E(e,t,i){const r=t.updateZoomBasedPaintProperties(),n=function(e,t,i){let r,n,o,a=e.terrain?e.terrain.exaggeration():0;if(e.terrain&&a>0){const t=e.terrain,n=t.findDEMTileFor(i);n&&n.dem?r=vm.create(t,i,n):a=0}if(0===a&&(t.terrainElevationMin=0,t.terrainElevationMax=0),a===t.validForExaggeration&&(0===a||r&&r._demTile&&r._demTile.tileID===t.validForDEMTile.id&&r._dem._timestamp===t.validForDEMTile.timestamp))return!1;for(const s in t.instancesPerModel){const e=t.instancesPerModel[s];for(let i=0;i<e.instancedDataArray.length;++i){const s=(r?a*r.getElevationAt(0|e.instancedDataArray.float32[16*i],0|e.instancedDataArray.float32[16*i+1],!0,!0):0)+e.instancesEvaluatedElevation[i];e.instancedDataArray.float32[16*i+6]=s,n=n?Math.min(t.terrainElevationMin,s):s,o=o?Math.max(t.terrainElevationMax,s):s}}return t.terrainElevationMin=n||0,t.terrainElevationMax=o||0,t.validForExaggeration=a,t.validForDEMTile=r&&r._demTile?{id:r._demTile.tileID,timestamp:r._dem._timestamp}:{id:void 0,timestamp:0},!0}(e,t,i);(r||n)&&(t.uploaded=!1,t.upload(e.context))}const gE={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new Wp([0,0,0],[co,co,0])};function yE(e,t){const i=1<<e.canonical.z,r=t.getFreeCameraOptions().position,n=t.elevation,o=e.canonical.x/i,a=(e.canonical.x+1)/i,s=e.canonical.y/i,l=(e.canonical.y+1)/i;let c=t._centerAltitude;if(n){const t=n.getMinMaxForTile(e);t&&t.max>c&&(c=t.max)}const u=ht(r.x,o,a)-r.x,h=ht(r.y,s,l)-r.y,d=Uc(c,t.center.lat)-r.z;return t._zoomFromMercatorZ(Math.sqrt(u*u+h*h+d*d))}function xE(e,t,i,r,n,o,a){const s=e.context,l="shadow"===e.renderPass,c=e.shadowRenderer,u=l&&c?c.getShadowPassDepthMode():new fw(s.gl.LEQUAL,fw.ReadWrite,e.depthRangeFor3D),h=e.isTileAffectedByFog(o),d="globe"===e.transform.projection.name;if(i.meshes)for(const p of i.meshes){const f=d?[]:["MODEL_POSITION_ON_GPU"],m=[];let _,g,y;const x=!d&&r.instancedDataArray.length>20;x&&f.push("INSTANCED_ARRAYS");const v=jw(e,t.paint.get("model-cutoff-fade-range"));if(v.shouldRenderCutoff&&f.push("RENDER_CUTOFF"),l&&c)_=e.getOrCreateProgram("modelDepth",{defines:f}),g=lw(a.shadowTileMatrix,a.shadowTileMatrix,i.globalMatrix),y=pw.disabled;
vendor: 4,565 bytes, line 2
2else{sE(f,m,p,e,"none"===t.paint.get("model-color-use-theme").constantOr("default")?null:t.lut),_=e.getOrCreateProgram("model",{defines:f,overrideFog:h});const r=p.material,l=r.pbrMetallicRoughness,u=t.paint.get("model-opacity").constantOr(1),d=t.paint.get("model-emissive-strength").constantOr(0);g=sw(o.expandedProjMatrix,i.globalMatrix,Qw,null,e,u,l.baseColorFactor,r.emissiveFactor,l.metallicFactor,l.roughnessFactor,r,d,t,n,void 0,void 0,void 0,1,_.fixedDefines.includes("LIGHTING_3D_MODE")),c&&(a.shadowUniformsInitialized?_.setShadowUniformValues(s,c.getShadowUniformValues()):(c.setupShadows(o.toUnwrapped(),_,"model-tile"),a.shadowUniformsInitialized=!0)),y=v.shouldRenderCutoff||u<1||"OPAQUE"!==r.alphaMode?pw.alphaBlended:pw.unblended}e.uploadCommonUniforms(s,_,o.toUnwrapped(),null,v);const b=p.material.doubleSided?gw.disabled:gw.backCCW;if(x)m.push(r.instancedDataBuffer),_.draw(e,s.gl.TRIANGLES,u,uw.disabled,y,b,g,t.id,p.vertexBuffer,p.indexBuffer,p.segments,t.paint,e.transform.zoom,void 0,m,r.instancedDataArray.length);else{const i=l?"u_instance":"u_normal_matrix";for(let n=0;n<r.instancedDataArray.length;++n)g[i]=new Float32Array(r.instancedDataArray.arrayBuffer,64*n,16),_.draw(e,s.gl.TRIANGLES,u,uw.disabled,y,b,g,t.id,p.vertexBuffer,p.indexBuffer,p.segments,t.paint,e.transform.zoom,void 0,m)}}if(i.children)for(const p of i.children)xE(e,t,p,r,n,o,a)}function vE(e,t,i,r,n){const o=e.node;if(o.lodMeshes&&o.lodMeshes.length>0)if(e.targetLod<0)e.targetLod=t>r?1:0;else{const o=n>0?i/1e3/n:1;e.targetLod=ht(t>r?e.targetLod+o:e.targetLod-o,0,1)}else e.targetLod=0}function bE(e,t,i,r){if(!i.modelManager)return!0;const n=i.modelManager;if(!i.shadowRenderer)return!0;const o=i.shadowRenderer,a=t.aabb;let s=!0,l=e.maxHeight;if(0===l){let t=0;for(const i in e.instancesPerModel){const e=n.getModel(i,r);e?t=Math.max(t,Math.max(Math.max(e.aabb.max[0],e.aabb.max[1]),e.aabb.max[2])):s=!1}l=e.maxScale*t*1.41+e.maxVerticalOffset,s&&(e.maxHeight=l)}a.max[2]=l,a.min[2]+=e.terrainElevationMin,a.max[2]+=e.terrainElevationMax,ie(a.min,a.min,t.tileMatrix),ie(a.max,a.max,t.tileMatrix);const c=a.intersects(o.getCurrentCascadeFrustum());return 0===i.currentShadowCascade&&(e.isInsideFirstShadowMapFrustum=2===c),0===c}function wE(e,t){const i=e.uniformValues.u_cutoff_params[0],r=e.uniformValues.u_cutoff_params[1],n=e.uniformValues.u_cutoff_params[2],o=e.uniformValues.u_cutoff_params[3];return r===i||o===n?1:ht(((t-i)/(r-i)-n)/(o-n),0,1)}function EE(e,t,i,r){if(t.pitch<20)return 1;const n=t.getWorldToCameraMatrix();x(n,n,e);const o=de(i.min[0],i.min[1],i.min[2],1);let a=me(he(),o,n),s=a,l=a;o[1]=i.max[1],a=me(he(),o,n),s=a[1]<s[1]?a:s,l=a[1]>l[1]?a:l,o[0]=i.max[0],a=me(he(),o,n),s=a[1]<s[1]?a:s,l=a[1]>l[1]?a:l,o[1]=i.min[1],a=me(he(),o,n),s=a[1]<s[1]?a:s,l=a[1]>l[1]?a:l;const c=ht(r[0],0,1),u=100*t.pixelsPerMeter*ht(r[1],0,1),h=ht(r[2],0,1),d=(m=he(),b=(_=s)[1],w=_[2],E=_[3],m[0]=(v=_[0])+(y=c)*((g=l)[0]-v),m[1]=b+y*(g[1]-b),m[2]=w+y*(g[2]-w),m[3]=E+y*(g[3]-E),m),p=Math.tan(.5*t.fovX),f=-d[2]*p;var m,_,g,y,v,b,w,E;if(0===u)return d[1]<-Math.abs(f)?h:1;const A=ht(Wr(1,h,(-Math.abs(f)-d[1])/u),h,1);return Wr(1,A,ht((t.pitch-20)/20,0,1))}var AE="\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#ifdef RENDER_CUTOFF\nfloat cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);}\n#endif",IE="\n#define FLIP_VIEWPORT_UV_Y(uv)\n#ifdef DUAL_SOURCE_BLENDING\nlayout(location=0,index=0) out vec4 glFragColor;layout(location=0,index=1) out vec4 glFragColorSrc1;\n#elif defined(FLOAT_RENDER_TARGET)\nlayout(location=0) out highp vec4 glFragColor;\n#else\nlayout(location=0) out vec4 glFragColor;\n#endif\n#ifdef USE_MRT1\nlayout(location=1) out vec4 out_Target1;\n#endif\nhighp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}const float DITHER_THRESHOLDS[16]=float[16](\n1.0/17.0, 9.0/17.0, 3.0/17.0,11.0/17.0,13.0/17.0, 5.0/17.0,15.0/17.0, 7.0/17.0,4.0/17.0,12.0/17.0, 2.0/17.0,10.0/17.0,16.0
2/17.0, 8.0/17.0,14.0/17.0, 6.0/17.0\n);int viewport_dither_index(vec2 fragCoordXY) {return (int(fragCoordXY.x) % 4)*4+(int(fragCoordXY.y) % 4);}\n#ifdef DEBUG_WIREFRAME\n#define HANDLE_WIREFRAME_DEBUG \\\nglFragColor=vec4(0.7,0.0,0.0,0.7); \\\ngl_FragDepth=gl_FragCoord.z-0.0001;\n#else\n#define HANDLE_WIREFRAME_DEBUG\n#endif\n#ifdef RENDER_CUTOFF\nuniform highp vec4 u_cutoff_params;in float v_cutoff_opacity;\n#endif\nvec4 textureLodCustom(sampler2D image,highp vec2 pos,highp vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 premultiplyColor(vec3 nonPremultipliedColor,float a) {return vec4(nonPremultipliedColor*a,a);}vec3 unpremultiplyColor(vec4 premultipliedColor) {if (premultipliedColor.a > 0.0) {return premultipliedColor.rgb/premultipliedColor.a;}return premultipliedColor.rgb;}vec3 applyLUT(highp sampler3D lut,vec3 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return texture(lut,uvw).rgb;}vec4 applyLUT(highp sampler3D lut,vec4 premultipliedColor) {return premultiplyColor(applyLUT(lut,unpremultiplyColor(premultipliedColor)),premultipliedColor.a);}void storeEmissiveColor(vec4 color,float emissiveStrength) {\n#ifdef DUAL_SOURCE_BLENDING\nglFragColorSrc1=vec4(vec3(0.0),emissiveStrength);\n#else\n#ifdef USE_MRT1 \n#ifdef USE_MRT1_RGBA\nout_Target1=vec4(color.rgb*emissiveStrength,color.a);\n#else\nout_Target1=vec4(emissiveStrength*color.a,0.0,0.0,glFragColor.a);\n#endif\n#endif\n#endif\n}",SE="\n#define EXTENT 8192.0\n#define RAD_TO_DEG 180.0/PI\n#define DEG_TO_RAD PI/180.0\n#define GLOBE_RADIUS EXTENT/PI/2.0\nfloat wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#ifndef PROJECTED_POS_ON_VIEWPORT\nfloat tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;\n#else\nreturn vec3(0.0);\n#endif\n}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec4 decode_color(const vec2 encodedColor) {return vec4(\nunpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const vec2 units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (units_to_pixels*pos+offset)/pattern_size;}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {return get_pattern_pos(pixel_coord_upper,pixel_coord_lower,pattern_size,vec2(tile_units_to_pixels),pos);}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}\n#ifdef RENDER_CUTOFF\nuniform vec4 u_cutoff_params;out float v_cutoff_opacity;\n#endif\nconst vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(ivec2 posWithComposedSkirt)\n{float skirt=float(float(posWithComposedSkirt.x) >=skirtOffset);vec2 pos=vec2(posWithComposedSkirt)-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}\n#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_id) attrib\n#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_id) attrib\n#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_id) attrib\n#define DECLARE_MATERIAL_TABLE_INFO\n",TE="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;
2void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",DE="\n#define ELEVATION_SCALE 7.0\n#define ELEVATION_OFFSET 450.0\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;\n#endif\nvec3 elevationVector(vec2 pos) {\n#ifdef PROJECTION_GLOBE_VIEW\nvec2 uv=pos/EXTENT;vec3 up=normalize(mix(\nmix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;\n#else\nreturn vec3(0,0,1);\n#endif\n}\n#ifdef TERRAIN\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float currentElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}float prevElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}vec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}\n#endif\nfloat elevation(vec2 apos) {\n#ifdef TERRAIN\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);\n#else\nreturn currentElevation(apos);\n#endif\n#else\nreturn 0.0;\n#endif\n}\n#ifdef DEPTH_OCCLUSION\nuniform highp sampler2D u_depth;uniform highp vec2 u_depth_size_inv;uniform highp vec2 u_depth_range_unpack;uniform highp float u_occluder_half_size;uniform highp float u_occlusion_depth_offset;\n#ifdef DEPTH_D24\nfloat unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}vec4 unpack_depth4(vec4 depth) {return depth*u_depth_range_unpack.x+vec4(u_depth_range_unpack.y);}\n#else\nhighp float unpack_depth_rgba(vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}\n#endif\nbool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;\n#ifdef DEPTH_D24\nfloat depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r);\n#else\nfloat depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5));\n#endif\nreturn coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_
2size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5;\n#ifdef DEPTH_D24\nhighp vec4 depth=vec4(\ntexture(u_depth,uv-df.xz).r,texture(u_depth,uv+df.xz).r,texture(u_depth,uv-df.zy).r,texture(u_depth,uv+df.zy).r\n);depth=unpack_depth4(depth);\n#else\nhighp vec4 depth=vec4(\nunpack_depth_rgba(texture(u_depth,uv-df.xz)),unpack_depth_rgba(texture(u_depth,uv+df.xz)),unpack_depth_rgba(texture(u_depth,uv-df.zy)),unpack_depth_rgba(texture(u_depth,uv+df.zy))\n);\n#endif\nreturn depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5;int NX=3;int NY=4;highp vec2 df=u_occluder_half_size*u_depth_size_inv;highp vec2 oneStep=2.0*u_occluder_half_size*u_depth_size_inv/vec2(NX-1,NY-1);highp float res=0.0;for (int y=0; y < NY;++y) {for (int x=0; x < NX;++x) {\n#ifdef DEPTH_D24\nhighp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r);\n#else\nhighp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)));\n#endif\nres+=1.0-clamp(300.0*(coord.z+u_occlusion_depth_offset-depth),0.0,1.0);}}res=clamp(2.0*res/float(NX*NY)-0.5,0.0,1.0);return res;}highp float occlusionFade(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec4 depth=getCornerDepths(coord.xy);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z+u_occlusion_depth_offset)-depth),0.0,1.0));}\n#else\nbool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; }\n#endif",ME="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}\n#endif",PE="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;FLIP_VIEWPORT_UV_Y(uv);highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}
2vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {return color;}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\n#endif",CE="\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);}\n#endif",RE="#ifdef RASTER_ARRAY\nuniform highp sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}
2vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0)\n);}vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0)\n);}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}\n#endif",zE="#ifdef RENDER_SHADOWS\nuniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {vec3 transformed_normal=vec3(-normal.xy,normal.z);float NDotL=dot(normalize(transformed_normal),u_shadow_direction);float dotScale=min(1.0-NDotL,1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];}\n#endif",LE="#ifdef RENDER_SHADOWS\nprecision highp sampler2DShadow;uniform sampler2DShadow u_shadowmap_0;uniform sampler2DShadow u_shadowmap_1;uniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;highp vec2 shadow_map_ndc_to_uv(highp vec2 ndc_xy) {return ndc_xy*0.5+0.5;}highp vec3 shadow_map_ndc_to_sample_space(highp vec3 ndc) {return vec3(shadow_map_ndc_to_uv(ndc.xy),ndc.z*0.5+0.5);}float shadow_sample(sampler2DShadow shadowmap,highp vec3 pos,highp float bias) {highp vec3 coord=vec3(shadow_map_ndc_to_uv(pos.xy),pos.z*0.5+0.5-bias);return texture(shadowmap,coord);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {light_view_pos0.xyz/=light_view_pos0.w;\n#ifdef SHADOWS_SINGLE_CASCADE\nvec2 abs_bounds=abs(light_view_pos0.xy);if (abs_bounds.x >=1.0 || abs_bounds.y >=1.0) {return 0.0;}return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);\n#else\nlight_view_pos1.xyz/=light_view_pos1.w;vec4 abs_bounds=abs(vec4(light_view_pos0.xy,light_view_pos1.xy));if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}float occlusion1=shadow_sample(u_shadowmap_1,light_view_pos1.xyz,bias);return clamp(mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth)),0.0,1.0);\n#endif\n}highp float calculate_shadow_bias(float NDotL) {\n#ifdef NORMAL_OFFSET\nreturn 0.5*u_shadow_bias.x;\n#else\nreturn 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z));\n#endif\n}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_opacity(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,float shadow_opacity) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias)*shadow_opacity;return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}highp vec2 compute_receiver_plane_depth_bias(highp vec3 pos_dx,highp vec3 pos_dy)\n{highp vec2 biasUV=vec2(\npos_dy.y*pos_dx.z-pos_dx.y*pos_dy.z,pos_dx.x*pos_dy.z-pos_dy.x*pos_dx.z);biasUV*=1.0/((pos_dx.x*pos_dy.y)-(pos_dx.y*pos_dy.x));return biasUV;}float shadowed_light_factor_plane_bias(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {highp vec3 light_view_pos0_xyz=shadow_map_ndc_to_sample_space(light_view_pos0.xyz/light_view_pos0.w);highp vec3 light_view_pos0_ddx=dFdx(light_view_pos0_xyz);highp vec3 light_view_pos0_ddy=dFdy(light_view_pos0_xyz);highp vec2 plane_depth_bias=compute_receiver_plane_depth_bias(light_view_pos0_ddx,light_view_pos0_ddy);highp float bias=dot(vec2(u_shadow_texel_size,u_shadow_texel_size),plane_depth_bias)+0.0001;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);}\n#endif";const FE=/^#include\s+"([^"]+)"\s*\r?\n/gm,OE=/#pragma mapbox: ([\
2w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,BE=/\b[A-Za-z_][A-Za-z0-9_]*\b/g,kE=new Set(["ifdef","ifndef","elif","if","defined"]),VE=new Set;XE(AE,VE),XE(SE,VE),XE(IE,VE);const NE={"_prelude_fog.vertex.glsl":ME,"_prelude_terrain.vertex.glsl":DE,"_prelude_shadow.vertex.glsl":zE,"_prelude_material_table.vertex.glsl":"","_prelude_fog.fragment.glsl":PE,"_prelude_shadow.fragment.glsl":LE,"_prelude_lighting.glsl":CE,"_prelude_raster_array.glsl":RE,"_prelude_indicator_cutout.fragment.glsl":"\nvec4 applyCutout(vec4 color,float height) {return color;}","_prelude_feature_cutout.fragment.glsl":"// feature cutout (gl-native only)\n","_prelude_feature_cutout.vertex.glsl":"// feature cutout (gl-native only)\n"},UE={},jE="precision highp float;",GE="precision mediump float;",HE="\n#if defined(GL_EXT_blend_func_extended) && defined(DUAL_SOURCE_BLENDING)\n#extension GL_EXT_blend_func_extended : require\n#endif",$E={preludeTerrain:KE("",DE),preludeFog:KE(PE,ME),preludeShadow:KE(LE,zE),preludeRasterArray:KE(RE,""),preludeLighting:KE(CE,CE),preludePrecisionQualifiers:KE(GE,jE),prelude:KE(IE,SE),preludeExtensions:KE(HE,"")},WE=[HE,GE,AE,$E.prelude.fragmentSource].join("\n"),qE=[jE,AE,$E.prelude.vertexSource].join("\n");var ZE={background:KE('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_feature_cutout.fragment.glsl"\nuniform vec4 u_color;uniform float u_opacity;uniform mediump float u_emissive_strength;\n#ifdef LIGHTING_3D_MODE\nin vec4 v_color;\n#endif\nvoid main() {vec4 out_color;\n#ifdef LIGHTING_3D_MODE\nout_color=v_color;\n#else\nout_color=u_color;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*u_opacity;storeEmissiveColor(glFragColor,u_emissive_strength);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_lighting.glsl"\nin ivec2 a_pos;uniform mat4 u_matrix;uniform mediump float u_emissive_strength;\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec4 u_color;out vec4 v_color;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef LIGHTING_3D_MODE\nv_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));\n#endif\n}'),backgroundPattern:KE('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in highp vec2 v_pos;void main() {highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*u_opacity;storeEmissiveColor(glFragColor,u_emissive_strength);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec2 u_pattern_units_to_pixels;in ivec2 a_pos;out highp vec2 v_pos;void main() {vec2 pos=vec2(a_pos);gl_Position=u_matrix*vec4(pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_pattern_units_to_pixels,pos);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),circle:K
vendor: 7,339 bytes, line 2
2E('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec3 v_data;in float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nuniform float u_emissive_strength;void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);float antialiase_blur_opacity=smoothstep(0.0,antialiasblur,extrude_length-1.0);float opacity_t=blur_positive==1.0 ? \nsmoothstep(0.0,-antialiased_blur,1.0-extrude_length) : \nsmoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_opacity;float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(\nantialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\nglFragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define NUM_VISIBILITY_RINGS 2\n#define INV_SQRT2 0.70710678\n#define ELEVATION_BIAS 0.0001\n#define NUM_SAMPLES_PER_RING 16\nuniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in ivec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin ivec4 a_pos_3;in ivec4 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\n#ifdef ELEVATED_ROADS\nin float a_circle_z_offset;\n#endif\nout vec3 v_data;out float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1.0,-1.0),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1.0,-1.0),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1.0,1.0),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1.0,1.0),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {\n#if defined(TERRAIN)\nreturn elevation(pos)+ELEVATION_BIAS;\n#else\nreturn 0.0;\n#endif\n}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);\n#ifdef PITCH_WITH_MAP\n#ifdef PROJECTION_GLOBE_VIEW\nreturn u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );\n#else\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\n#endif\n#else\nreturn projected_center+vec4(sample_offset,0,0);\n#endif\n}float get_sample_step() {\n#ifdef PITCH_WITH_MAP\nreturn 2.0*PI/float(NUM_SAMPLES_PER_RING);\n#else\nreturn PI/float(NUM_SAMPLES_PER_RING);\n#endif\n}void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 pos2=vec2(a_pos);vec2 extrude=vec2(mod(pos2,2.0)*2.0-1.0);vec2 circle_center=floor(pos2*0.5);float height=circle_elevation(circle_center);vec4 world_center;mat3 surface_vectors;\n#ifdef PROJECTION_GLOBE_VIEW\nsurface_vectors=globe_mercator_surface_vectors(vec3(a_pos_normal_3)/16384.0,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*height;vec3 globe_pos=vec3(a_pos_3)+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*height;vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);\n#else \nsurface_vectors=mat3(1.0);world_center=vec4(circle_center,height,1);\n#endif\n#ifdef ELEVATED_ROADS\nworld_center.z+=a_circle_z_offset+ELEVATION_BIAS;\n#endif\nvec4 projected_center=u_matrix*world_center;float view_scale=0.0;\n#ifdef PITCH_WITH_MAP\n#ifdef SCALE_WITH_MAP\nview_scale=1.0;\n#else\nview_scale=projected_center.w/u_camera_to_center_distance;\n#endif\n#else\n#ifdef SCALE_WITH_MAP\nview_scale=u_camera_to_center_distance;\n#else\nview_scale=projected_center.w;\n#endif\n#endif\ngl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;\n#ifdef PITCH_WITH_MAP\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center;\n#else\nocclusion_world_center=world_center;occlusion_projected_center=projected_center;\n#endif\nfor(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);\n#else\nvisibility=1.0;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nvisibility=1.0;\n#endif\nv_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);\n#ifdef FOG\nv_fog_pos=fog_position(world_center.xyz);\n#endif\n}'),clippingMask:
2KE("void main() {glFragColor=vec4(1.0);}","in ivec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:KE('#include "_prelude_fog.fragment.glsl"\nuniform highp float u_intensity;in vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);glFragColor=vec4(val,1.0,1.0,1.0);\n#ifdef FOG\nif (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_intensity;in ivec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin ivec4 a_pos_3;in ivec4 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nout vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(vec2(a_pos),2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(vec2(a_pos)*0.5);vec3 pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=vec3(a_pos_normal_3)/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=vec3(a_pos_3)+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#else\npos=vec3(tilePos+extrude,elevation(tilePos));\n#endif\ngl_Position=u_matrix*vec4(pos,1);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),heatmapTexture:KE("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));glFragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(0.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}","in ivec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=vec2(a_pos)*0.5+0.5;}"),collisionBox:KE("in float v_placed;in float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",'#include "_prelude_terrain.vertex.glsl"\nin ivec4 a_pos;in ivec2 a_anchor_pos;in ivec2 a_extrude;in uvec2 a_placed;in vec2 a_shift;in vec2 a_elevation_from_sea;in float a_size_scale;in vec2 a_padding;in float a_auto_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform float u_zoom_transition;\n#endif\nout float v_placed;out float v_notUsed;void main() {vec2 anchor_pos=vec2(a_anchor_pos);float feature_elevation=a_elevation_from_sea.x+a_auto_z_offset;float terrain_elevation=(a_elevation_from_sea.y==1.0 ? 0.0 : elevation(anchor_pos));vec3 proj_pos=vec3(a_pos)+elevationVector(anchor_pos)*(feature_elevation+terrain_elevation);\n#ifdef PROJECTION_GLOBE_VIEW\n#ifndef PROJECTED_POS_ON_VIEWPORT\nvec3 globe_pos=proj_pos;vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,anchor_pos,u_tile_id,u_merc_center);proj_pos=mix_globe_mercator(globe_pos,mercator_pos,u_zoom_transition);\n#endif\n#endif\nvec4 projectedPoint=u_matrix*vec4(proj_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(vec2(a_extrude)*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=float(a_placed.x);v_notUsed=float(a_placed.y);}'),collisionCircle:KE("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);glFragColor=color*alpha*opacity_t;}","in vec2 a_pos_2f;in float a_radius;in ivec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd  =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz  /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;int vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(\nmix(-1.0,1.0,float(vertexIdx >=2)),mix(-1.0,1.0,float(vertexIdx >=1 && vertexIdx <=2)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=float(a_flags.x);gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:KE("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}",'#include "_prelude_terrain.vertex.glsl"\nin ivec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin ivec4 a_pos_3;\n#endif\nout vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {vec2 pos=vec2(a_pos);float h=elevation(pos);v_uv=pos/8192.0;
2\n#ifdef PROJECTION_GLOBE_VIEW\ngl_Position=u_matrix*vec4(vec3(a_pos_3)+elevationVector(pos)*h,1);\n#else\ngl_Position=u_matrix*vec4(pos*u_overlay_scale,h,1);\n#endif\n}'),fill:KE('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_indicator_cutout.fragment.glsl"\n#include "_prelude_feature_cutout.fragment.glsl"\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nuniform float u_emissive_strength;uniform lowp float u_opacity_multiplier;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nvec2 cutout_factors=vec2(0.0);vec4 out_color=color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nout_color*=(opacity*u_opacity_multiplier);glFragColor=out_color;storeEmissiveColor(glFragColor,u_emissive_strength);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin ivec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;out highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nuniform mat4 u_matrix;uniform lowp float u_opacity_multiplier;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp float z_offset\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;v_road_z_offset=z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));\n#endif\n}'),fillOutline:KE('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_feature_cutout.fragment.glsl"\nin highp vec2 v_pos;uniform float u_emissive_strength;uniform lowp float u_opacity_multiplier;\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;vec2 cutout_factors=vec2(0.0);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*(alpha*opacity*u_opacity_multiplier);storeEmissiveColor(glFragColor,u_emissive_strength);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
2\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin ivec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;out highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nuniform mat4 u_matrix;uniform vec2 u_world;uniform lowp float u_opacity_multiplier;out highp vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp float z_offset\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;v_road_z_offset=z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));\n#endif\n}'),fillOutlinePattern:KE('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_feature_cutout.fragment.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FILL_PATTERN_TRANSITION\nuniform float u_pattern_transition;\n#endif\nuniform float u_emissive_strength;uniform lowp float u_opacity_multiplier;\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\nin highp vec2 v_pos;in highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef APPLY_LUT_ON_GPU\nout_color=applyLUT(u_lutTexture,out_color);\n#endif\n#ifdef FILL_PATTERN_TRANSITION\nvec2 pattern_b_tl=vec2(pattern_b.xy);vec2 pattern_b_br=vec2(pattern_b.zw);highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;\n#endif\nvec2 cutout_factors=vec2(0.0);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*(alpha*opacity*u_opacity_multiplier);storeEmissiveColor(glFragColor,u_emissive_strength);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_world;uniform lowp float u_opacity_multiplier;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in ivec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;out highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nout highp vec2 v_pos;out highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize highp float z_offset\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;v_road_z_offset=z_offset;\n#endif\nfloat hidden=float(opacity==0.0);vec2 pos=vec2(a_pos);gl_Position=mix(u_matrix*vec4(pos,z_offset,1),AWAY,hidden);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(pos,z_offset);vec3 shd_pos1=vec3(pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),fillPattern:KE('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_feature_cutout.fragment.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FILL_PATTERN_TRANSITION\nuniform float u_pattern_transition;\n#endif\nin highp vec2 v_pos;uniform float u_emissive_strength;uniform lowp float u_opacity_multiplier;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef APPLY_LUT_ON_GPU\nout_color=applyLUT(u_lutTexture,out_color);\n#endif\n#ifdef FILL_PATTERN_TRANSITION\nvec2 pattern_b_tl=vec2(pattern_b.xy);vec2 pattern_b_br=vec2(pattern_b.zw);highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;\n#endif\nvec2 cutout_factors=vec2(0.0);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);\n#ifdef ELEVATED_ROADS\nout_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#else\nout_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*(opacity*u_opacity_multiplier);storeEmissiveColor(glFragColor,u_emissive_strength);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
2\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nuniform mat4 u_matrix;uniform lowp float u_opacity_multiplier;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in ivec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;out highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nout highp vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump uvec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize highp float z_offset\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;v_road_z_offset=z_offset;\n#endif\nfloat hidden=float(opacity==0.0);vec2 pos=vec2(a_pos);gl_Position=mix(u_matrix*vec4(pos,z_offset,1),AWAY,hidden);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(pos,z_offset);vec3 shd_pos1=vec3(pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),lineBlendComposite:KE("uniform highp sampler2D u_image;uniform float u_opacity;uniform int u_blend_mode;uniform highp float u_max_density;in vec2 v_pos;\n#define ADDITIVE 1\nvoid main() {vec4 color=texture(u_image,v_pos);if (u_blend_mode==ADDITIVE) {if (color.a <=0.0) {discard;}highp float density=color.a;vec3 avgColor=color.rgb/max(density,0.001);highp float n=density/max(u_max_density,0.001);highp float t=sqrt(n/(n+1.0));glFragColor=vec4(avgColor*t,t);} else {vec3 multiplyFactor=color.rgb*u_opacity+(1.0-u_opacity);glFragColor=vec4(multiplyFactor,1.0);}\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(0.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}","in ivec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=vec2(a_pos)*0.5+0.5;}"),lineBlendReduce:KE("uniform highp sampler2D u_image;uniform vec2 u_texel_size;uniform bool u_first_pass;in vec2 v_pos;void main() {vec2 o=u_texel_size*0.5;vec4 s0=texture(u_image,v_pos+vec2(-o.x,-o.y));vec4 s1=texture(u_image,v_pos+vec2( o.x,-o.y));vec4 s2=texture(u_image,v_pos+vec2(-o.x, o.y));vec4 s3=texture(u_image,v_pos+vec2( o.x, o.y));float r0; float g0;float r1; float g1;float r2; float g2;float r3; float g3;if (u_first_pass) {float a0=s0.a;float a1=s1.a;float a2=s2.a;float a3=s3.a;r0=a0; g0=a0 > 0.0 ? 1.0 : 0.0;r1=a1; g1=a1 > 0.0 ? 1.0 : 0.0;r2=a2; g2=a2 > 0.0 ? 1.0 : 0.0;r3=a3; g3=a3 > 0.0 ? 1.0 : 0.0;} else {r0=s0.r; g0=s0.g;r1=s1.r; g1=s1.g;r2=s2.r; g2=s2.g;r3=s3.r; g3=s3.g;}glFragColor=vec4((r0+r1+r2+r3)*0.25,(g0+g1+g2+g3)*0.25,0.0,0.0);}","in ivec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=vec2(a_pos)*0.5+0.5;}"),fillExtrusion:KE
vendor: 13,578 bytes, line 2
2('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_indicator_cutout.fragment.glsl"\n#include "_prelude_feature_cutout.fragment.glsl"\nin vec4 v_color;in vec4 v_flat;\n#if defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\nin float v_dither_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;\n#endif\nuniform lowp float u_opacity;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec2 v_ao;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nin vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nin highp vec3 v_normal;\n#endif\nuniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nin float v_flood_radius;in float v_has_floodlight;\n#endif\nin float v_height;\n#pragma mapbox: define highp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp float emissive_strength\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nvec3 normal=normalize(v_normal);\n#endif\nfloat z;vec4 color=v_color;\n#ifdef ZERO_ROOF_RADIUS\nz=float(normal.z > 0.00001);\n#ifdef LIGHTING_3D_MODE\nnormal=mix(normal,vec3(0.0,0.0,1.0),z);\n#else\ncolor=mix(v_color,v_roof_color,z);\n#endif\n#endif\nfloat h=max(0.0,v_height);float ao_shade=1.0;\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;\n#ifdef ZERO_ROOF_RADIUS\nconcave*=(1.0-z);\n#endif\nfloat x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave);\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\ncolor.rgb*=mix(ao_shade,1.0,v_has_floodlight);\n#else\ncolor.rgb*=ao_shade;\n#endif\n#else\ncolor.rgb*=ao_shade;\n#endif\n#endif\n#ifdef LIGHTING_3D_MODE\nfloat flood_radiance=0.0;\n#ifdef FLOOD_LIGHT\nflood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;\n#endif\n#ifdef RENDER_SHADOWS\n#ifdef FLOOD_LIGHT\nfloat ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance);\n#else\nfloat shadowed_lighting_factor;\n#ifdef RENDER_CUTOFF\nshadowed_lighting_factor=shadowed_light_factor_normal_opacity(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;}\n#else\nshadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);\n#endif\ncolor.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);\n#endif\n#else\ncolor.rgb=apply_lighting(color.rgb,normal);\n#ifdef FLOOD_LIGHT\ncolor.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);\n#endif\n#endif\ncolor.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity;\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));\n#endif\n#if defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\nif (v_dither_opacity < 1.0) {int index=viewport_dither_index(gl_FragCoord.xy);if (v_dither_opacity < DITHER_THRESHOLDS[index]) {discard;}}\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_material_table.vertex.glsl"\n#include "_prelude_feature_cutout.vertex.glsl"\nuniform mat4 u_matrix;\n#ifndef LIGHTING_3D_MODE\nuniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;\n#endif\nuniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;uniform float u_width_scale;in ivec4 a_pos_normal_ed;\n#if defined(HAS_CENTROID) || defined(TERRAIN)\nin uvec2 a_centroid_pos;\n#endif\n#ifdef RENDER_WALL_MODE\nin ivec4 a_join_normal_inside;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin ivec4 a_pos_3;in ivec4 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nuniform highp float u_vertical_scale;\n#if defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\n#ifdef RENDER_FRONT_CUTOFF\nuniform vec3 u_front_cutoff_params;\n#endif\nout float v_dither_opacity;\n#endif\nout vec4 v_color;out vec4 v_flat;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nout vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nout highp vec3 v_normal;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec2 v_ao;\n#endif\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nout float v_flood_radius;out float v_has_floodlight;\n#endif\nout float v_height;vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define highp float flood_light_wall_radius\n#pragma mapbox: define highp float line_width\n#pragma mapbox: define highp float emissive_strength\nvoid main() {DECLARE_MATERIAL_TABLE_INFO\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize highp float flood_light_wall_radius\n#pragma mapbox: initialize highp float line_width\n#pragma mapbox: initialize highp float emissive_strength\nbase*=u_vertical_scale;height*=u_vertical_scale;vec4 top_up_ny_start=vec4(a_pos_normal_ed & 1);vec4 pos_nx=vec4(a_pos_normal_ed >> 1);float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny_start.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny_start.z-1.0)*(1.0-abs(x_normal)),0.0));\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nv_normal=normal;\n#endif\nbase=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny_start.y==0.0 && top_up_ny_start.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny_start.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=vec2(a_centroid_pos);\n#endif\nfloat ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);bool is_elevation_encoded=centroid_pos.y==0.0 || (centroid_pos.y > 0.0 && (int(centroid_pos.y) & 7)==7);c_ele=is_flat_height || is_flat_base ? (is_elevation_encoded ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;\n#else\nh=t > 0.0 ? height : base;\n#endif\npos=vec3(pos_nx.xy,h);\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(vec3(a_pos_normal_3)/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=vec3(a_pos_3)+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat cutoff=1.0;vec3 scaled_pos=pos;\n#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\nvec2 centroid_decoded=pos.xy;bool isBorderCentroid=false;if (centroid_pos.x > 0.0 && centroid_pos.y > 0.0) {int iy=int(centroid_pos.y);int spanYbits=iy & 7;if (spanYbits==7) {isBorderCentroid=true;int borderID=(iy >> 3) & 3;float coordAlongBorder=float(iy >> 5)*4.0;if (borderID==0) centroid_decoded=vec2(0.0,coordAlongBorder);else if (borderID==1) centroid_decoded=vec2(EXTENT,coordAlongBorder);else if (borderID==2) centroid_decoded=vec2(coordAlongBorder,0.0);else centroid_decoded=vec2(coordAlongBorder,EXTENT);} else {centroid_decoded=floor(centroid_pos/8.0);}}\n#endif\n#if defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\nfloat frontCutoffOpacity=1.0;float routeFade=0.0;\n#endif\n#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)\nvec4 ground=u_matrix*vec4(centroid_decoded,ele,1.0);\n#endif\n#ifdef RENDER_CUTOFF\ncutoff=cutoff_opacity(u_cutoff_params,ground.z);if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_random/8.0;vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale);\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0));\n#ifdef RENDER_FRONT_CUTOFF\nif (centroid_pos.x > 0.0 && centroid_pos.y > 0.0) {hidden=max(hidden,float(ground.w <=0.0));float ndc_y=ground.y/max(ground.w,0.001);float threshold=u_front_cutoff_params.x*2.0-1.0;float range_ndc=u_front_cutoff_params.y*2.0;if (!isBorderCentroid) {hidden=max(hidden,float(ndc_y < threshold-range_ndc));}float t=clamp((ndc_y-(threshold-range_ndc))/max(range_ndc,0.001),0.0,1.0);frontCutoffOpacity=mix(u_front_cutoff_params.z,1.0,t);}\n#endif\n#if defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\nv_dither_opacity=1.0;\n#ifdef RENDER_FRONT_CUTOFF\nv_dither_opacity=min(v_dither_opacity,frontCutoffOpacity);\n#endif\n#endif\n#ifdef RENDER_WALL_MODE\nvec3 join_normal_inside=vec3(a_join_normal_inside);vec2 wall_offset=u_width_scale*line_width*(join_normal_inside.xy/EXTENT);scaled_pos.xy+=(1.0-join_normal_inside.z)*wall_offset*0.5;scaled_pos.xy-=join_normal_inside.z*wall_offset*0.5;\n#endif\ngl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h;\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=pos;vec3 shd_pos1=pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);\n#endif\nfloat NdotL=0.0;float colorvalue=0.0;\n#ifndef LIGHTING_3D_MODE\ncolorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#endif\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny_start.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\nfloat is_wall=1.0-float(t > 0.0 && top_up_ny_start.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale;\n#endif\nv_color=vec4(color.rgb,1.0);float ndotl=calculate_NdotL(normal);v_flat.rgb=sRGBToLinear(color.rgb);v_flat.rgb=v_flat.rgb*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);v_flat=vec4(linearTosRGB(v_flat.rgb),1.0);\n#else\nv_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nfloat roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),fillExtrusionPattern:
2KE
vendor: 8,299 bytes, line 2
2('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_indicator_cutout.fragment.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\nuniform float u_pattern_transition;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nin vec3 v_normal;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\nin highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define mediump uvec4 pattern\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\n#pragma mapbox: define highp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\n#pragma mapbox: initialize highp float pixel_ratio\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef APPLY_LUT_ON_GPU\nout_color=applyLUT(u_lutTexture,out_color);\n#endif\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\nvec2 pattern_b_tl=vec2(pattern_b.xy);vec2 pattern_b_br=vec2(pattern_b.zw);highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;\n#else\nout_color=out_color*v_lighting;\n#endif\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_material_table.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_width_scale;\n#ifndef LIGHTING_3D_MODE\nuniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;\n#endif\nin ivec4 a_pos_normal_ed;\n#if defined(HAS_CENTROID) || defined(TERRAIN)\nin uvec2 a_centroid_pos;\n#endif\n#ifdef RENDER_WALL_MODE\nin ivec4 a_join_normal_inside;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin ivec4 a_pos_3;in ivec4 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nout highp vec2 v_pos;out vec4 v_lighting;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nout vec3 v_normal;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump uvec4 pattern\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\n#pragma mapbox: define highp float pixel_ratio\n#pragma mapbox: define highp float line_width\nvoid main() {DECLARE_MATERIAL_TABLE_INFO\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\n#pragma mapbox: initialize highp float pixel_ratio\n#pragma mapbox: initialize highp float line_width\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);vec4 top_up_ny_start=vec4(a_pos_normal_ed & 1);vec4 pos_nx=vec4(a_pos_normal_ed >> 1);float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny_start.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny_start.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=float(a_pos_normal_ed.w);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny_start.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=vec2(a_centroid_pos);\n#endif\nfloat ele=0.0;float h=z;vec3 p;float c_ele;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);bool is_elevation_encoded=centroid_pos.y==0.0 || (centroid_pos.y > 0.0 && int(centroid_pos.y)-(int(centroid_pos.y)/8)*8==7);c_ele=is_flat_height || is_flat_base ? (is_elevation_encoded ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;p=vec3(pos_nx.xy,h);\n#else\np=vec3(pos_nx.xy,z);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(vec3(a_pos_normal_3)/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=vec3(a_pos_3)+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\n#ifdef RENDER_WALL_MODE\nvec3 join_normal_inside=vec3(a_join_normal_inside);vec2 wall_offset=u_width_scale*line_width*(join_normal_inside.xy/EXTENT);p.xy+=(1.0-join_normal_inside.z)*wall_offset*0.5;p.xy-=join_normal_inside.z*wall_offset*0.5;\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0\n? pos_nx.xy\n: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;\n#ifdef LIGHTING_3D_MODE\nNdotL=calculate_NdotL(normal);\n#else\nNdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);\n#endif\nif (normal.y !=0.0) {float r=0.84;\n#ifndef LIGHTING_3D_MODE\nr=mix(0.7,0.98,1.0-u_lightintensity);\n#endif\nNdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny_start.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_normal=normal;\n#else\nv_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}'),hillshadePrepare:
2KE("precision highp float;uniform highp sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2(\n(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4(\nderiv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}","uniform mat4 u_matrix;uniform vec2 u_dimension;in ivec2 a_pos;in uvec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(vec2(a_texture_pos)/8192.0)*scale+epsilon;}"),hillshade:KE('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);glFragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef LIGHTING_3D_MODE\nglFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);\n#endif\n#ifdef FOG\nglFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));\n#endif\nstoreEmissiveColor(glFragColor,u_emissive_strength);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;in ivec2 a_pos;in uvec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=vec2(a_texture_pos)/8192.0;\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));\n#endif\n}'),line:KE
vendor: 19,061 bytes, line 2
2('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_indicator_cutout.fragment.glsl"\n#include "_prelude_feature_cutout.fragment.glsl"\nuniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform float u_alpha_discard_threshold;uniform lowp float u_opacity_multiplier;uniform bool u_clip_to_tile_borders;in vec4 v_width2_dilute;in vec2 v_normal;in float v_gamma_scale;in vec2 v_tile_pos;\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef VARIABLE_LINE_WIDTH\nin float stub_side;\n#endif\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;uniform highp float u_floor_width_scale;in highp vec2 v_tex;\n#endif\n#ifdef DEBUG_ELEVATION_ID\nin vec3 v_elevation_id_col;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_BORDER_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nin highp vec3 v_uv;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;\n#endif\n#ifdef RENDER_LINE_BORDER_GRADIENT\nuniform sampler2D u_border_gradient_image;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nuniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform highp vec2 u_trim_gradient_mix_range;uniform lowp vec4 u_trim_color;\n#endif\n#ifdef RENDER_SHADOWS\nuniform bool u_emissive_in_shadows;uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nfloat luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump uvec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float side_z_offset\n#pragma mapbox: define lowp float border_width\n#pragma mapbox: define lowp vec4 border_color\n#pragma mapbox: define lowp float emissive_strength\nfloat linearstep(float edge0,float edge1,float x) {return  clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump uvec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float side_z_offset\n#pragma mapbox: initialize lowp float border_width\n#pragma mapbox: initialize lowp vec4 border_color\n#pragma mapbox: initialize lowp float emissive_strength\nfloat dist=length(v_normal)*v_width2_dilute.x;float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;\n#ifdef RENDER_LINE_BORDER\n#ifndef VARIABLE_LINE_WIDTH\nANTIALIASING*=8.0;\n#endif\n#endif\n#ifdef VARIABLE_LINE_WIDTH\nblur=mix(blur,0.0,stub_side);\n#endif\nfloat diluted_opacity=opacity*v_width2_dilute.z;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2_dilute.y-blur2),v_width2_dilute.x-dist)/blur2,0.0,1.0);float pxStep;float delta;\n#ifdef RENDER_LINE_BORDER\n#ifndef VARIABLE_LINE_WIDTH\npxStep=fwidth(dist);float out_edge=v_width2_dilute.x-dist;float in_edge=dist-(v_width2_dilute.y-2.0*ANTIALIASING);delta=v_width2_dilute.y > 0.0 ? min(in_edge,out_edge) : out_edge;float edge=ANTIALIASING;alpha=delta > 0.0 ? smoothstep(edge-pxStep,u_width_scale*blur+edge+pxStep,delta) : 0.0;\n#endif\n#endif\n#ifdef RENDER_LINE_DASH\nhighp float dash_w=float(dash.w);highp float dash_len=float(dash.z)+dash_w/65535.0;float sdfgamma=ANTIALIASING/float(dash_len);float scaled_floorwidth=(floorwidth*u_floor_width_scale);float periods_per_pixel=fwidth(v_tex.x);float dash_coverage=float(dash.y >> 4u)/4095.0;float fade=linearstep(0.25,0.5,periods_per_pixel);float gamma=max(sdfgamma/scaled_floorwidth,0.5*periods_per_pixel);if (fade >=1.0) {alpha*=dash_coverage;} else if (periods_per_pixel < 0.1) {float sdfdist=texture(u_dash_image,v_tex).r;alpha*=linearstep(0.5-gamma,0.5+gamma,sdfdist);} else {float span=min(periods_per_pixel,1.0);float tap_offset=span*0.25;float sdf0=texture(u_dash_image,vec2(v_tex.x-tap_offset,v_tex.y)).r;float sdf1=texture(u_dash_image,vec2(v_tex.x+tap_offset,v_tex.y)).r;alpha*=mix(0.5*(\nlinearstep(0.5-gamma,0.5+gamma,sdf0)+linearstep(0.5-gamma,0.5+gamma,sdf1)\n),dash_coverage,fade);}\n#endif\nhighp vec4 out_color;\n#ifdef RENDER_LINE_GRADIENT\nout_color=texture(u_gradient_image,v_uv.xy);\n#else\nout_color=color;\n#endif\nfloat trim_alpha=1.0;\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);highp float gradient_trim_color_mix_factor=0.0;\n#ifdef RENDER_LINE_GRADIENT\ngradient_trim_color_mix_factor=smoothstep(u_trim_gradient_mix_range.x,u_trim_gradient_mix_range.y,line_progress);\n#endif\nhighp vec4 trim_color=mix(u_trim_color,out_color,gradient_trim_color_mix_factor);out_color=mix(u_trim_gradient_mix_range.x < 1.0 ? color : out_color,trim_color,transition_factor);trim_alpha=1.0-transition_factor;}\n#endif\nif (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}}\n#ifdef RENDER_LINE_BORDER\n#ifndef VARIABLE_LINE_WIDTH\nfloat edge2=border_width*u_width_scale+ANTIALIASING;float alpha2=smoothstep(edge2-pxStep,edge2+pxStep,delta);if (alpha2 < 1.) {\n#ifdef RENDER_LINE_BORDER_GRADIENT\nvec4 border_gradient_color=texture(u_border_gradient_image,v_uv.xy);out_color=mix(border_gradient_color*trim_alpha,out_color,alpha2);\n#else\nif (border_color.a==0.0) {\n#ifndef RENDER_LINE_GRADIENT\nfloat Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-alpha2));} else {out_color.rgb*=(0.6+0.4*alpha2);}\n#else\nout_color.rgb*=(0.6+0.4*alpha2);\n#endif\n} else {out_color=mix(border_color*trim_alpha,out_color,alpha2);}\n#endif\nout_color*=v_width2_dilute.w;}\n#endif\n#endif\nvec2 cutout_factors=vec2(0.0);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);light=u_emissive_in_shadows ? mix(light,1.0,emissive_strength) : light;\n#ifdef ELEVATED_ROADS\nout_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#else\nout_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nout_color*=(alpha*diluted_opacity*u_opacity_multiplier);\n#ifdef LINE_BLEND_ADDITIVE\n{float cov=alpha*diluted_opacity;glFragColor=vec4(cov > 0.0 ? out_color.rgb/cov : vec3(0.0),cov);}\n#else\n#ifdef LINE_BLEND_MULTIPLY\nglFragColor=vec4(out_color.rgb+(1.0-out_color.a),1.0);\n#else\nglFragColor=out_color;\n#endif\n#endif\nstoreEmissiveColor(glFragColor,emissive_strength);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n#ifdef DEBUG_ELEVATION_ID\nglFragColor=vec4(v_elevation_id_col,1.0);\n#endif\nif (u_clip_to_tile_borders) {if (v_tile_pos.x > 1.0 || v_tile_pos.y > 1.0 || v_tile_pos.x < 0.0 || v_tile_pos.y < 0.0) {discard;}}HANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define EXTRUDE_SCALE 0.015873016\nin ivec2 a_pos_normal;in uvec4 a_data;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH) || defined(VARIABLE_LINE_EMISSIVE_STRENGTH)\nin vec4 a_z_offset_width;\n#endif\n#ifdef DEBUG_ELEVATION_ID\nin vec3 a_elevation_id_col;\n#endif\n#ifdef DEBUG_ELEVATION_ID\nout vec3 v_elevation_id_col;\n#endif\n#ifdef ELEVATION_GROUND_SCALE\nin float a_elevation_ground_scale;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_BORDER_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) || defined(RENDER_LINE_CURVE)\nin highp vec3 a_packed;\n#endif\n#ifdef RENDER_LINE_DASH\nin float a_linesofar;\n#endif\nuniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_z_offset;uniform highp float u_road_view_depth_bias;uniform highp vec4 u_road_clip_to_view;\n#ifdef ELEVATED\nuniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {\n#ifdef ELEVATION_REFERENCE_SEA\nreturn 0.0;\n#else\nreturn elevation(apos);\n#endif\n}\n#endif\nout vec2 v_normal;out vec4 v_width2_dilute;out float v_gamma_scale;out vec2 v_tile_pos;\n#ifdef ELEVATED_ROADS\nout highp float v_road_z_offset;\n#endif\n#ifdef VARIABLE_LINE_WIDTH\nout float stub_side;uniform float u_width_addition;\n#endif\n#ifdef RENDER_LINE_DASH\nuniform highp float u_floor_width_scale;uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out highp vec2 v_tex;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_BORDER_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nout highp vec3 v_uv;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_BORDER_GRADIENT)\nuniform float u_image_height;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump uvec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define mediump float side_z_offset\n#pragma mapbox: define lowp float border_width\n#pragma mapbox: define lowp vec4 border_color\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump uvec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize mediump float side_z_offset\n#pragma mapbox: initialize lowp float border_width\n#pragma mapbox: initialize lowp vec4 border_color\n#pragma mapbox: initialize lowp float emissive_strength\n#ifdef VARIABLE_LINE_EMISSIVE_STRENGTH\nemissive_strength=a_z_offset_width.w;\n#endif\nfloat a_z_offset=u_z_offset;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\na_z_offset+=a_z_offset_width.x;\n#endif\n#ifdef DEBUG_ELEVATION_ID\nv_elevation_id_col=a_elevation_id_col;\n#endif\nhighp float line_progress=0.0;\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_BORDER_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) || defined(RENDER_LINE_CURVE)\nline_progress=a_packed[2];\n#endif\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;\n#ifdef RENDER_LINE_BORDER\n#ifndef VARIABLE_LINE_WIDTH\nANTIALIASING*=8.0;\n#endif\n#endif\nvec2 a_extrude=vec2(a_data.xy)-128.0;float a_direction=float(a_data.z & 3u)-1.0;vec2 pos_normal=vec2(a_pos_normal);vec2 pos=floor(pos_normal*0.5);mediump vec2 normal=pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;offset=-1.0*offset*u_width_scale;bool left=normal.y==1.0;gapwidth=gapwidth/2.0;float halfwidth;float dilute_scale=1.0;float dilute_border_scale=1.0;float symmetric_outset=0.0;\n#ifdef VARIABLE_LINE_WIDTH\nfloat left_width=a_z_offset_width.y;float right_width=a_z_offset_width.z;bool zero_right_width=border_width==0.0 && right_width==0.0;halfwidth=left ? left_width : right_width;halfwidth+=u_width_addition*(zero_right_width ? (left ? 1.0 : 0.0) : 0.5); \nhalfwidth*=u_width_scale;if (side_z_offset !=0.0) {float left_f=step(1.0,normal.y);float is_negative=step(side_z_offset,0.0);float apply=mix(1.0-left_f,left_f,is_negative);a_extrude*=apply;a_z_offset+=abs(side_z_offset)*apply;v_normal*=apply;}offset=border_width > 0.0 ? (left_width+right_width+u_width_addition)*u_width_scale : offset;halfwidth=border_width > 0.0 ? border_width*u_width_scale*0.5 : halfwidth;symmetric_outset=zero_right_width ? u_width_scale*(left_width+u_width_addition) : halfwidth;stub_side=zero_right_width ?-normal.y : 0.0;v_normal=!left && zero_right_width ? vec2(0.0) : v_normal;ANTIALIASING=!left && zero_right_width ? 0.0 : ANTIALIASING;\n#else\nhalfwidth=(u_width_scale*width)/2.0;\n#endif\nfloat inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth > 0.0 ? ANTIALIASING : 0.0);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;\n#ifdef ELEVATED_ROADS\nv_road_z_offset=a_z_offset;v_tile_pos=pos+offset2*u_pixels_to_tile_units;gl_Position=u_matrix*vec4(v_tile_pos,a_z_offset,1.0);\n#else\n#ifdef ELEVATED\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;float scaled_z_offset=a_z_offset;\n#ifdef ELEVATION_GROUND_SCALE\nscaled_z_offset=a_z_offset*mix(1.0,u_exaggeration,a_elevation_ground_scale);\n#endif\n#ifdef CROSS_SLOPE_VERTICAL\nfloat top=pos_normal.y-2.0*floor(pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+scaled_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);\n#else\n#ifdef CROSS_SLOPE_HORIZONTAL\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+scaled_z_offset;\n#else\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+scaled_z_offset;\n#endif\n#endif\nv_tile_pos=offset_pos;gl_Position=u_matrix*vec4(v_tile_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);\n#else\nv_tile_pos=pos+offset2*u_pixels_to_tile_units;gl_Position=u_matrix*vec4(v_tile_pos,0.0,1.0);\n#endif\n#endif\n#ifndef ELEVATED\n#ifndef VARIABLE_LINE_WIDTH\n#ifndef RENDER_TO_TEXTURE\nfloat base_w=gl_Position.w;vec2 screen_width=abs(projected_extrude.xy/base_w*u_units_to_pixels);float max_extrude_component=max(screen_width.x,screen_width.y);if (width >=1.0 && base_w > 0.0 && max_extrude_component > 0.0001) {float min_pixel=1.05;if (max_extrude_component < min_pixel) {vec2 abs_pos=abs(gl_Position.xy);float is_out=max(abs_pos.x,abs_pos.y)/base_w;dilute_scale=mix(max_extrude_component/min_pixel,1.0,smoothstep(2.5,4.5,is_out));projected_extrude/=dilute_scale;}else if (gapwidth > 0.0) {float visible_ratio=(halfwidth+ANTIALIASING)/outset;vec2 visible_screen_width=screen_width*visible_ratio;float max_visible_component=max(visible_screen_width.x,visible_screen_width.y);dilute_scale=min(1.0,max_visible_component/min_pixel);}else\n{\n#ifdef RENDER_LINE_BORDER\nfloat border_ratio=(border_width*u_width_scale+ANTIALIASING)/outset;screen_width*=border_ratio;float max_border_component=max(screen_width.x,screen_width.y);dilute_border_scale=min(1.0,max_border_component/min_pixel);\n#endif\n}}\n#endif\n#endif\nv_tile_pos=(v_tile_pos+extrude)/EXTENT;\n#ifdef ELEVATED_ROADS\ngl_Position=gl_Position+projected_extrude;\n#ifdef VARIABLE_LINE_WIDTH\n#ifndef ELEVATED\nhighp float road_view_depth_bias=u_road_view_depth_bias*smoothstep(-0.5,0.0,a_z_offset);if (road_view_depth_bias > 0.0) {highp float z_in=gl_Position.z/gl_Position.w*0.5+0.5;highp float a=u_road_clip_to_view.x;highp float b=u_road_clip_to_view.y;highp float c=u_road_clip_to_view.z;highp float d=u_road_clip_to_view.w;highp float view=(a*z_in+b)/(c*z_in+d);highp float view_new=view+road_view_depth_bias;highp float z_new=(view_new*d-b)/(a-view_new*c);z_new=clamp(z_new,0.0,1.0);gl_Position.z=(z_new*2.0-1.0)*gl_Position.w;}\n#endif\n#endif\n#else\ngl_Position=mix(gl_Position+projected_extrude,AWAY,hidden);\n#endif\n#endif\n#ifdef ELEVATED_ROADS\n#ifdef RENDER_SHADOWS\nvec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;\n#ifdef NORMAL_OFFSET\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#endif\n#ifndef RENDER_TO_TEXTURE\nfloat epsilon=0.0001;float extrude_length_without_perspective=max(length(dist),epsilon);float extrude_length_with_perspective=max(length(projected_extrude_xy/gl_Position.w*u_units_to_pixels),epsilon);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));\n#else\nv_gamma_scale=1.0;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_BORDER_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nhighp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_BORDER_GRADIENT)\nhighp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec3(a_uv_x,a_split_index*texel_height-half_texel_height,line_progress);\n#else\nv_uv=vec3(a_uv_x,0.0,line_progress);\n#endif\n#endif\n#ifdef RENDER_LINE_DASH\nvec4 dashf=vec4(dash);highp float dash_w=float(dash.w);highp float totalLength=float(dash.z)+dash_w/65535.0;float scale=totalLength==0.0 ? 0.0 : u_tile_units_to_pixels/totalLength;float dash_half_height=float(dash.y & 15u);v_tex=vec2(a_linesofar*scale/(floorwidth*u_floor_width_scale),(-normal.y*dash_half_height+dashf.x+0.5)/u_texsize.y);\n#endif\nv_width2_dilute=vec4(outset,inset,dilute_scale,dilute_border_scale);\n#ifdef VARIABLE_LINE_WIDTH\nv_width2_dilute.x=symmetric_outset;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),linePattern:
2KE
vendor: 11,858 bytes, line 2
2('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_indicator_cutout.fragment.glsl"\nuniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_alpha_discard_threshold;uniform lowp float u_opacity_multiplier;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;uniform sampler2D u_image;\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#ifdef LINE_PATTERN_TRANSITION\nuniform float u_pattern_transition;\n#endif\nin vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec3 v_uv;\n#endif\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef LINE_JOIN_NONE\nin vec2 v_pattern_data;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#pragma mapbox: define mediump uvec4 pattern\n#ifdef LINE_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\n#pragma mapbox: define mediump float pixel_ratio\n#pragma mapbox: define mediump float blur\n#pragma mapbox: define mediump float opacity\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef LINE_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\n#pragma mapbox: initialize mediump float pixel_ratio\n#pragma mapbox: initialize mediump float blur\n#pragma mapbox: initialize mediump float opacity\n#pragma mapbox: initialize lowp float emissive_strength\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;highp float pattern_size=display_size.x/u_tile_units_to_pixels;float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);highp float pattern_x=v_linesofar/pattern_size*aspect;highp float x=mod(pattern_x,1.0);highp float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;highp vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));highp vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef APPLY_LUT_ON_GPU\ncolor=applyLUT(u_lutTexture,color);\n#endif\n#ifdef LINE_PATTERN_TRANSITION\nvec2 pattern_b_tl=vec2(pattern_b.xy);vec2 pattern_b_br=vec2(pattern_b.zw);highp vec2 pos_b=mix(pattern_b_tl*texel_size-texel_size,pattern_b_br*texel_size+texel_size,vec2(x,y));vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);color=color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);color=mix(color,color.a*u_trim_color,transition_factor);}\n#endif\n#ifdef LINE_JOIN_NONE\nhighp float pattern_len=pattern_size/aspect;highp float segment_phase=pattern_len-mod(v_linesofar-v_pattern_data.x+pattern_len,pattern_len);highp float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;highp float visible_end=floor((v_pattern_data.y-segment_phase)/pattern_len)*pattern_len+segment_phase;visible_end+=step(pattern_len*0.5,v_pattern_data.y-visible_end)*pattern_len;if (v_pattern_data.x < visible_start || v_pattern_data.x >=visible_end) {color=vec4(0.0);}\n#endif\n#ifdef LIGHTING_3D_MODE\ncolor=apply_lighting_with_emission_ground(color,emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#ifdef ELEVATED_ROADS\ncolor.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#else\ncolor.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=(alpha*opacity*u_opacity_multiplier);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}}glFragColor=color;storeEmissiveColor(glFragColor,emissive_strength);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define scale 0.015873016\nin ivec2 a_pos_normal;in uvec4 a_data;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\nin vec4 a_z_offset_width;\n#endif\n#ifdef ELEVATION_GROUND_SCALE\nin float a_elevation_ground_scale;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec3 a_packed;\n#endif\nin highp float a_linesofar;\n#ifdef LINE_JOIN_NONE\nin highp vec3 a_pattern_data;out vec2 v_pattern_data;\n#endif\nuniform mat4 u_matrix;uniform float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_floor_width_scale;\n#ifdef ELEVATED\nuniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {\n#ifdef ELEVATION_REFERENCE_SEA\nreturn 0.0;\n#else\nreturn elevation(apos);\n#endif\n}\n#endif\nout vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef RENDER_LINE_TRIM_OFFSET\nout highp vec3 v_uv;\n#endif\n#ifdef ELEVATED_ROADS\nout highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#pragma mapbox: define mediump float blur\n#pragma mapbox: define mediump float opacity\n#pragma mapbox: define mediump float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define mediump float floorwidth\n#pragma mapbox: define mediump uvec4 pattern\n#ifdef LINE_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\n#pragma mapbox: define mediump float pixel_ratio\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize mediump float blur\n#pragma mapbox: initialize mediump float opacity\n#pragma mapbox: initialize mediump float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize mediump float floorwidth\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef LINE_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\n#pragma mapbox: initialize mediump float pixel_ratio\n#pragma mapbox: initialize lowp float emissive_strength\nfloat a_z_offset;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\na_z_offset=a_z_offset_width.x;\n#endif\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(a_data.xy)-128.0;float a_direction=float(a_data.z & 3u)-1.0;vec2 pos_normal=vec2(a_pos_normal);vec2 pos=floor(pos_normal*0.5);vec2 normal=pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=(u_width_scale*width)/2.0;offset=-1.0*offset*u_width_scale;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);vec2 dist=outset*a_extrude*scale;float u=0.5*a_direction;float t=1.0-abs(u);vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;\n#ifdef ELEVATED_ROADS\nv_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude;\n#else\n#ifdef ELEVATED\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;float scaled_z_offset=a_z_offset;\n#ifdef ELEVATION_GROUND_SCALE\nscaled_z_offset=a_z_offset*mix(1.0,u_exaggeration,a_elevation_ground_scale);\n#endif\n#ifdef CROSS_SLOPE_VERTICAL\nfloat top=pos_normal.y-2.0*floor(pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+scaled_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);\n#else\n#ifdef CROSS_SLOPE_HORIZONTAL\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+scaled_z_offset;\n#else\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+scaled_z_offset;\n#endif\n#endif\ngl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);\n#else\ngl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);\n#endif\n#endif\n#ifdef ELEVATED_ROADS\n#ifdef RENDER_SHADOWS\nvec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;\n#ifdef NORMAL_OFFSET\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#endif\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude_xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));\n#else\nv_gamma_scale=1.0;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress);\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale);\n#ifdef LINE_JOIN_NONE\nv_width=(floorwidth*u_floor_width_scale)+ANTIALIASING;mediump float pixels_to_tile_units=1.0/u_tile_units_to_pixels;mediump float pixel_ratio_inverse=1.0/pixel_ratio;mediump float aspect=v_width/(float(pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=float(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),raster:
2KE('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_raster_array.glsl"\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth;\n#ifdef PROJECTION_GLOBE_VIEW\nin float v_split_fade;\n#endif\nuniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength;\n#ifndef RASTER_ARRAY\nuniform highp sampler2D u_image0;uniform sampler2D u_image1;\n#endif\n#ifdef RASTER_COLOR\nuniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;uniform highp float u_color_ramp_size;\n#endif\nvoid main() {vec4 color0,color1,color;vec2 value;\n#ifdef RASTER_COLOR\n#ifdef RASTER_ARRAY\n#ifdef RASTER_ARRAY_LINEAR\nvalue=mix(\nraTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\n);\n#else\nvalue=mix(\nraTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\n);\n#endif\nif (value.y > 0.0) value.x/=value.y;\n#ifdef RASTER_COLOR_SCALE_LOG\nfloat N=u_color_ramp_size;float vNorm=max((value.x-0.5/N)*N/(N-1.0),0.0);vNorm=log(vNorm*(10.0-1.0)+1.0)/log(10.0);value.x=0.5/N+vNorm*(N-1.0)/N;\n#endif\n#else\ncolor=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a);\n#endif\ncolor=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y;\n#else\ncolor0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);\n#endif\ncolor.a*=u_opacity;\n#ifdef GLOBE_POLES\ncolor.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition);\n#endif\nvec3 rgb=color.rgb;rgb=vec3(\ndot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb;\n#endif\n#ifdef FOG\nhighp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef PROJECTION_GLOBE_VIEW\nglFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade));\n#endif\n#ifdef RENDER_CUTOFF\nglFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nstoreEmissiveColor(glFragColor,u_emissive_strength);HANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\n#ifdef ELEVATED\nuniform lowp float u_zbias_factor;\n#endif\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin ivec2 a_pos;in uvec2 a_texture_pos;\n#endif\nout vec2 v_pos0;out vec2 v_pos1;out float v_depth;\n#ifdef PROJECTION_GLOBE_VIEW\nout float v_split_fade;\n#endif\nvoid main() {vec2 uv;\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;uv=a_uv;float ele=u_raster_elevation;\n#ifdef ELEVATION_REFERENCE_GROUND\nele+=elevation(uv*EXTENT);\n#endif\nglobe_pos+=normalize(globe_pos)*ele*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos,1.0);\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);\n#endif\n#else\nvec4 world_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec2 texture_pos=vec2(a_texture_pos);uv=texture_pos/8192.0;vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);  \nfloat tiles=u_grid_matrix[0][2];
2if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}float ele=u_raster_elevation;\n#ifdef ELEVATION_REFERENCE_GROUND\nele+=elevation(uv*EXTENT)-decomposed_pos_and_skirt.z;\n#endif\nvec4 merc_world_pos=vec4(0.0);   \nv_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,ele,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*ele*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);world_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\nfloat ele=0.0;vec2 decodedPos=vec2(a_pos);\n#ifdef ELEVATION_REFERENCE_GROUND\nvec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;decodedPos=decomposedPosAndSkirt.xy;uv=decodedPos/8192.0;ele=elevation(decodedPos)-skirt;\n#else\nuv=vec2(a_texture_pos)/8192.0;\n#endif\nworld_pos=vec4(decodedPos,(u_raster_elevation+ele),1.0);\n#ifdef FOG\nv_fog_pos=fog_position(decodedPos);\n#endif\n#endif\nfloat w=1.0+dot(uv*EXTENT,u_perspective_transform);gl_Position=u_matrix*world_pos*w;\n#endif\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1;\n#ifdef ELEVATED\nfloat z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor);gl_Position.z-=(gl_Position.w*zbias);\n#endif\n#ifdef RENDER_CUTOFF\nv_depth=gl_Position.z;\n#endif\n}'),symbol:KE
vendor: 7,646 bytes, line 2
2('#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_indicator_cutout.fragment.glsl"\n#include "_prelude_feature_cutout.fragment.glsl"\n#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform sampler2D u_texture;\n#ifdef RENDER_TEXT_AND_SYMBOL\nuniform sampler2D u_texture_icon;\n#endif\nuniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_sdf;uniform lowp float u_scale_factor;uniform lowp float u_opacity_multiplier;\n#ifdef ICON_TRANSITION\nuniform float u_icon_transition;\n#endif\n#ifdef COLOR_ADJUSTMENT\nuniform mat4 u_color_adj_mat;\n#endif\n#ifdef RENDER_SHADOWS\nin highp float v_z_offset;\n#endif\nin vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nin vec2 v_tex_b;\n#endif\nin float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity;\n#ifdef RENDER_TEXT_AND_SYMBOL\nin float is_sdf;in vec2 v_tex_a_icon;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\nin lowp float v_opacity;in lowp vec4 v_fill_np_color;in lowp vec4 v_halo_np_color;in lowp float v_halo_width;in lowp float v_halo_blur;\n#ifdef LIGHTING_3D_MODE\nin lowp float v_emissive_strength;\n#endif\nvoid main() {lowp float opacity=v_opacity;lowp vec4 fill_color=vec4(0.0);lowp vec4 halo_color=vec4(0.0);lowp float halo_width=0.0;lowp float halo_blur=0.0;if (u_is_sdf) {fill_color=vec4(v_fill_np_color.rgb*v_fill_np_color.a,v_fill_np_color.a);halo_color=vec4(v_halo_np_color.rgb*v_halo_np_color.a,v_halo_np_color.a);halo_width=v_halo_width;halo_blur=v_halo_blur;}lowp float emissive_strength=0.0;\n#ifdef LIGHTING_3D_MODE\nemissive_strength=v_emissive_strength;\n#endif\nvec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2];\n#ifdef RENDER_TEXT_AND_SYMBOL\nif (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity*u_opacity_multiplier;glFragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nreturn;}\n#endif\nvec2 cutout_factors=vec2(0.0);if (u_is_sdf) {float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_gamma_scale_size_fade_opacity.x;float size=v_gamma_scale_size_fade_opacity.y;float fontScale=u_is_text ? size/24.0 : size;out_color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {out_color=halo_color;gamma=(halo_blur*u_scale_factor*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width*u_scale_factor/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,v_tex_a).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);out_color*=alpha;} else {\n#ifdef ICON_TRANSITION\nvec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b);\n#else\nout_color=texture(u_texture,v_tex_a);\n#endif\n#ifdef APPLY_LUT_ON_GPU\nout_color=applyLUT(u_lutTexture,out_color);\n#endif\n#ifdef COLOR_ADJUSTMENT\nout_color=u_color_adj_mat*out_color;\n#endif\n}out_color*=opacity*fade_opacity*u_opacity_multiplier;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);\n#ifdef TERRAIN\nout_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#else\nout_color.rgb*=mix(v_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#endif\n#endif\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#define USING_APPEARANCE 1.0\nin ivec4 a_pos_offset;in uvec4 a_tex_size;in ivec4 a_pixeloffset;in vec4 a_projected_pos;in uint a_fade_opacity;\n#ifdef Z_OFFSET\nin float a_auto_z_offset;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin ivec4 a_globe_anchor;in vec3 a_globe_normal;\n#endif\n#ifdef ICON_TRANSITION\nin uvec2 a_texb;\n#endif\n#ifdef ELEVATED_ROADS\nin vec3 a_x_axis;in vec3 a_y_axis;uniform float u_normal_scale;\n#endif\n#ifdef RENDER_SHADOWS\nout highp float v_z_offset;\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_inv_matrix;\n#endif\nuniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_elevation_from_sea;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_up_vector;\n#endif\n#ifdef RENDER_TEXT_AND_SYMBOL\nuniform vec2 u_texsize_icon;\n#endif\nuniform bool u_is_halo;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nout vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nout vec2 v_tex_b;\n#endif\nout float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity;\n#ifdef RENDER_TEXT_AND_SYMBOL\nout float is_sdf;out vec2 v_tex_a_icon;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#ifndef MAX_UBO_SIZE_VEC4\n#define MAX_UBO_SIZE_VEC4 1024u\n#endif\n#define SPP_HEADER_SIZE_VEC4 4u\nstruct SymbolPaintProperties {vec4 fill_np_color;vec4 halo_np_color;float opacity;float halo_width;float halo_blur;float emissive_strength;float occlusion_opacity;float z_offset;vec2 translate;};uniform lowp vec4 u_spp_fill_np_color;uniform lowp vec4 u_spp_halo_np_color;uniform lowp float u_spp_opacity;uniform lowp float u_spp_halo_width;uniform lowp float u_spp_halo_blur;uniform lowp float u_spp_emissive_strength;uniform lowp float u_spp_occlusion_opacity;uniform highp float u_spp_z_offset;uniform lowp vec2 u_spp_translate_rotation;uniform highp float u_spp_zoom_fraction;in float a_feature_index;layout(std140) uniform SymbolPaintPropertiesHeaderUniform {uvec4 header[SPP_HEADER_SIZE_VEC4];} u_spp_header;layout(std140) uniform SymbolPaintPropertiesUniform {vec4 properties[MAX_UBO_SIZE_VEC4];} u_spp_properties;layout(std140) uniform SymbolPaintPropertiesIndexUniform {uvec4 block_indices[MAX_UBO_SIZE_VEC4];} u_spp_index;out lowp float v_opacity;out lowp vec4 v_fill_np_color;out lowp vec4 v_halo_np_color;out lowp float v_halo_width;out lowp float v_halo_blur;\n#ifdef LIGHTING_3D_MODE\nout lowp float v_emissive_strength;\n#endif\nfloat zoomFactor(float zm,float zM) {if (zm==zM) return u_spp_zoom_fraction-zm >=0.0 ? 1.0 : 0.0;return clamp((u_spp_zoom_fraction-zm)/(zM-zm),0.0,1.0);}vec4 readColor(uint base,bool isDataDriven,uint offsetVec4,uint dzr,vec2 headerZoom,vec4 fallbackValue) {if (!isDataDriven) return fallbackValue;vec4 value=u_spp_properties.properties[base+offsetVec4];vec2 blockZoom=u_spp_properties.properties[base+offsetVec4+dzr].xy;vec2 zr=mix(headerZoom,blockZoom,float(dzr));return unpack_mix_color(value,zoomFactor(zr.x,zr.y));}uint uvec4At(uvec4 v,uint index) {return (index==0u) ? v.x :\n(index==1u) ? v.y :\n(index==2u) ? v.z : v.w;}
vendor: 6,858 bytes, line 2
2float readScalar(uint base,bool isDataDriven,uint offsetVec4,float fallbackValue) {if (!isDataDriven) return fallbackValue;vec4 slot=u_spp_properties.properties[base+offsetVec4];return unpack_mix_vec2(slot.xy,zoomFactor(slot.z,slot.w));}vec2 readTranslate(uint base,bool isDataDriven,uint offsetVec4,uint dzr) {if (!isDataDriven) return vec2(0.0);vec4 value=u_spp_properties.properties[base+offsetVec4];vec2 blockZoom=u_spp_properties.properties[base+offsetVec4+dzr].xy;float t=zoomFactor(blockZoom.x,blockZoom.y)*float(dzr);return mix(value.xy,value.zw,t);}SymbolPaintProperties readSymbolPaintProperties() {uint dataDrivenMask=u_spp_header.header[0][0];uint dzrMask       =u_spp_header.header[0][1];uint blockSizeVec4 =u_spp_header.header[0][2];uint fillColorDzr=dzrMask & 1u;uint haloColorDzr=(dzrMask >> 1u) & 1u;vec2 fillColorHeaderZoom=uintBitsToFloat(u_spp_header.header[3].xy);vec2 haloColorHeaderZoom=uintBitsToFloat(u_spp_header.header[3].zw);uint featureIndex=uint(a_feature_index);uvec4 indexSlot=u_spp_index.block_indices[featureIndex/4u];uint base=uvec4At(indexSlot,featureIndex % 4u)*blockSizeVec4;SymbolPaintProperties props;props.fill_np_color    =readColor(base,(dataDrivenMask & (1u << 0u)) !=0u,u_spp_header.header[0][3],fillColorDzr,fillColorHeaderZoom,u_spp_fill_np_color);props.halo_np_color    =readColor(base,(dataDrivenMask & (1u << 1u)) !=0u,u_spp_header.header[1][0],haloColorDzr,haloColorHeaderZoom,u_spp_halo_np_color);props.opacity          =readScalar(base,(dataDrivenMask & (1u << 2u)) !=0u,u_spp_header.header[1][1],u_spp_opacity);props.halo_width       =readScalar(base,(dataDrivenMask & (1u << 3u)) !=0u,u_spp_header.header[1][2],u_spp_halo_width);props.halo_blur        =readScalar(base,(dataDrivenMask & (1u << 4u)) !=0u,u_spp_header.header[1][3],u_spp_halo_blur);props.emissive_strength=readScalar(base,(dataDrivenMask & (1u << 5u)) !=0u,u_spp_header.header[2][0],u_spp_emissive_strength);props.occlusion_opacity=readScalar(base,(dataDrivenMask & (1u << 6u)) !=0u,u_spp_header.header[2][1],u_spp_occlusion_opacity);props.z_offset         =readScalar(base,(dataDrivenMask & (1u << 7u)) !=0u,u_spp_header.header[2][2],u_spp_z_offset);uint translateDzr=(dzrMask >> 8u) & 1u;props.translate        =readTranslate(base,(dataDrivenMask & (1u << 8u)) !=0u,u_spp_header.header[2][3],translateDzr);return props;}vec2 unpack_opacity(uint packedOpacity) {return vec2(float(packedOpacity/2u)/127.0,float(packedOpacity & 1u));}void main() {SymbolPaintProperties paint_properties=readSymbolPaintProperties();lowp float opacity=paint_properties.opacity;v_opacity=opacity;v_fill_np_color=paint_properties.fill_np_color;v_halo_np_color=paint_properties.halo_np_color;v_halo_width=paint_properties.halo_width;v_halo_blur=paint_properties.halo_blur;\n#ifdef LIGHTING_3D_MODE\nv_emissive_strength=paint_properties.emissive_strength;\n#endif\nlowp float occlusion_opacity=paint_properties.occlusion_opacity;highp float z_offset=paint_properties.z_offset;vec2 a_pos=vec2(a_pos_offset.xy);vec2 a_offset=vec2(a_pos_offset.zw);vec2 a_tex=vec2(a_tex_size.xy);vec2 a_size=vec2(a_tex_size.zw);float a_size_min=floor(a_size[0]*0.5);float a_size_max= floor(a_size[1]*0.5);float a_apperance=a_size[1]-2.0*a_size_max;vec2 a_pxoffset=vec2(a_pixeloffset.xy);vec2 a_min_font_scale=vec2(a_pixeloffset.zw)/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (a_apperance==USING_APPEARANCE) {size=a_size_max/128.0;} else if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size_max,u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=u_elevation_from_sea ? z_offset : z_offset+elevation(tile_anchor);\n#ifdef Z_OFFSET\ne+=a_auto_z_offset;\n#endif\nvec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=vec3(a_globe_anchor)+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;vec2 a;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(vec3(a_globe_anchor)+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w;\n#else\noffsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w;\n#endif\nvec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\n#ifdef PROJECTED_POS_ON_VIEWPORT\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0);\n#else\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz,mercator_pos,u_zoom_transition)+h;projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#endif\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\n#ifdef Z_OFFSET\nz+=u_pitch_with_map ? a_auto_z_offset+z_offset : 0.0;\n#else\nz+=u_pitch_with_map ? z_offset : 0.0;\n#endif\nfloat occlusion_fade=globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float out_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));\n#ifdef DEPTH_OCCLUSION\nfloat depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier;\n#endif\n
2float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);vec3 pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y;\n#else\n#ifdef ELEVATED_ROADS\nvec3 xAxis=vec3(a_x_axis.xy,a_x_axis.z*u_normal_scale);vec3 yAxis=vec3(a_y_axis.xy,a_y_axis.z*u_normal_scale);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y;\n#else\npos=vec3(projected_pos.xy/projected_pos.w+offset,z);\n#endif\n#endif\ngl_Position=mix(u_coord_matrix*vec4(pos,1.0),AWAY,hidden);{vec2 tr=paint_properties.translate;vec2 rotated_tr=vec2(\nu_spp_translate_rotation.x*tr.x-u_spp_translate_rotation.y*tr.y,u_spp_translate_rotation.y*tr.x+u_spp_translate_rotation.x*tr.y\n);gl_Position.xy+=(u_coord_matrix*vec4(rotated_tr,0.0,0.0)).xy;}float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_gamma_scale_size_fade_opacity=vec3(gamma_scale,size,out_fade_opacity);v_tex_a=a_tex/u_texsize;\n#ifdef RENDER_TEXT_AND_SYMBOL\nis_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon;\n#endif\n#ifdef ICON_TRANSITION\nv_tex_b=vec2(a_texb)/u_texsize;\n#endif\n#ifdef RENDER_SHADOWS\nvec4 shd_pos=u_inv_matrix*vec4(pos,1.0);vec3 shd_pos0=shd_pos.xyz;vec3 shd_pos1=shd_pos.xyz;\n#ifdef NORMAL_OFFSET\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef RENDER_SHADOWS\nv_z_offset=e;\n#endif\n}'),skybox:KE('#include "_prelude_fog.fragment.glsl"\nin lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(\ncos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(e
2nd-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}',TE),skyboxGradient:KE('#include "_prelude_fog.fragment.glsl"\nin highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture(u_color_ramp,vec2(progress,0.5));\n#ifdef FOG\ncolor.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;\n#endif\ncolor*=u_opacity;glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}',TE),skyboxCapture:K
vendor: 3,690 bytes, line 2
2E("\nin highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float;\n#define BETA_R                  vec3(5.5e-6,13.0e-6,22.4e-6)\n#define BETA_M                  vec3(21e-6,21e-6,21e-6)\n#define MIE_G                   0.76\n#define DENSITY_HEIGHT_SCALE_R  8000.0\n#define DENSITY_HEIGHT_SCALE_M  1200.0\n#define PLANET_RADIUS           6360e3\n#define ATMOSPHERE_RADIUS       6420e3\n#define SAMPLE_STEPS            10\n#define DENSITY_STEPS           4\nfloat ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}","in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;
2v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeAtmosphere:KE('#include "_prelude_fog.fragment.glsl"\nuniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_atmosphere_fog_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;\n#ifdef PROJECTION_GLOBE_VIEW\nglobe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {\n#ifdef ALPHA_PASS\nglFragColor=vec4(0,0,0,0);return;\n#else\nglFragColor=vec4(0,0,0,1);return;\n#endif\n}\n#endif\nhighp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?\n0.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;\n#ifdef PROJECTION_GLOBE_VIEW\nhighp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?\nPI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);\n#else\nhorizon_angle=horizon_angle_mercator;\n#endif\nhorizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_atmosphere_fog_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_atmosphere_fog_color.rgb;vec3 color_stop_1=u_high_color.rgb;vec3 color_stop_2=u_space_color.rgb;\n#ifdef ALPHA_PASS\nfloat a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a);\n#else\nvec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;glFragColor=vec4(c*t,t);\n#endif\n}',"in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(\nmix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}"),stars:KE("in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv)\n{float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}","\nin vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}"),occlusion:KE("uniform vec4 u_color;void main() {glFragColor=u_color;}",'#include "_prelude_terrain.vertex.glsl"\nin highp vec2 a_offset_xy;uniform highp vec3 u_anchorPos;uniform mat4 u_matrix;uniform vec2 u_screenSizePx;uniform vec2 u_occluderSizePx;void main() {vec3 world_pos=u_anchorPos;\n#ifdef TERRAIN\nfloat e=elevation(world_pos.xy);world_pos.z+=e;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1.0);projected_point.xy+=projected_point.w*a_offset_xy*0.5*u_occluderSizePx/u_screenSizePx;gl_Position=projected_point;}')};function XE(e,t){const i=e.split("\n");for(let r of i){if(r=r.trimStart(),"#"!==r[0])continue;if(!r.includes("if"))continue;if(r.startsWith("#endif"))continue;const e=r.match(BE);if(e)for(const i of e)kE.has(i)||t.add(i)}}function YE(e){return new Set(["uint","int","uvec2","ivec2","uvec3","ivec3","uvec4","ivec4"]).has(e)}function KE(e,t){const i=new Set,r=[],n=[];e=e.replace(FE,(e,t)=>(n.push(t),"")),t=t.replace(FE,(e,t)=>(r.push(t),""));let o=new Set(VE);XE(e,o),XE(t,o);for(const a of[...r,...n])UE[a]||(UE[a]=new Set,XE(NE[a],UE[a])),o=new Set([...o,...UE[a]]);return{fragmentSource:e=e.replace(OE,(e,t,r,n,o)=>(i.add(o),"define"===t?`\n#ifndef HAS_UNIFORM_u_${o}\n${YE(n)?"flat ":""}in ${r} ${n} ${o};\n#else\nuniform ${r} ${n} u_${o};\n#endif\n`:"initialize"===t?`\n#ifdef HAS_UNIFORM_u_${o}\n    ${r} ${n} ${o} = u_${o};\n#endif\n`:"define-attribute"===t?`\n#ifdef HAS_ATTRIBUTE_a_${o}\n    in ${r} ${n} ${o};\n#endif\n`:"initialize-attribute"===t?"":void 0)),vertexSource:t=t.replace(OE,(e,t,r,n,o)=>{const a=`MATERIAL_ATTRIBUTE_OFFSET_${o}`,s="float"===n?"vec2":n,l=`GET_ATTRIBUTE_${s}(a_${o}, materialInfo, ${a})`,c=o.includes("color")?"color":s;return"define-attribute-vertex-shader-only"===t?`\n#ifdef HAS_ATTRIBUTE_a_${o}\nin ${r} ${n} a_${o};\n#endif\n`:i.has(o)?"define"===t?`\n#ifndef HAS_UNIFORM_u_${o}\nuniform lowp float u_${o}_t;\n    #if !defined(${a})\n        in ${r} ${s} a_${o};\n    #endif\n${YE(n)?"flat ":""}out ${r} ${n} ${o};\n#else\nuniform ${r} ${n} u_${o};\n#endif\n`:"initialize"===t?"vec4"===c||"uvec4"===c?`\n#ifndef HAS_UNIFORM_u_${o}\n    ${o} = a_${o};\n#else\n    ${r} ${n} ${o} = u_${o};\n#endif\n`:`\n#if !defined(HAS_UNIFORM_u_${o})\n    #ifdef ${a}\n        ${o} = unpack_mix_${c}(${l}, u_${o}_t);\n    #else\n        ${o} = unpack_mix_${c}(a_${o}, u_${o}_t);\n    #endif\n#else\n    ${r} ${n} ${o} = u_${o};\n#endif\n`:"define-attribute"===t?`\n#ifdef HAS_ATTRIBUTE_a_${o}\n    in ${r} ${n} a_${o};\n    out ${r} ${n} ${o};\n#endif\n`:"initialize-attribute"===t?`\n#ifdef HAS_ATTRIBUTE_a_${o}\n    ${o} = a_${o};\n#endif\n`:void 0:"define"===t?`\n#ifndef HAS_UNIFORM_u_${o}\nuniform lowp float u_${o}_t;\n    #if !defined(${a})\n        in ${r} ${s} a_${o};\n    #endif\n#else\nuniform ${r} ${n} u_${o};\n#endif\n`:"define-instanced"===t?"mat4"===c?`\n#ifdef INSTANCED_ARRAYS\nin vec4 a_${o}0;\nin vec4 a_${o}1;\nin vec4 a_${o}2;\nin vec4 a_${o}3;\n#else\nuniform ${r} ${n} u_${o};\n#endif\n`:`\n#ifdef INSTANCED_ARRAYS\nin ${r} ${s} a_${o};\n#else\nuniform ${r} ${n} u_${o};\n#endif\n`:"initialize-attribute-custom"===t?`\n#ifdef HAS_ATTRIBUTE_a_${o}\n    ${r} ${n} ${o} = a_${o};\n#endif\n`:"vec4"===c||"uvec4"===c?`\n#ifndef HAS_UNIFORM_u_${o}\n    #ifdef ${a}\n        ${r} ${n} ${o} = ${l};\n    #else\n        ${r} ${n} ${o} = a_${o};\n    #endif\n#else\n    ${r} ${n} ${o} = u_${o};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${o}\n    #ifdef ${a}\n        ${r} ${n} ${o} = unpack_mix_${c}(${l}, u_${o}_t);\n    #else\n        ${r} ${n} ${o} = unpack_mix_${c}(a_${o}, u_${o}_t);\n    #endif\n#else\n    ${r} ${n} ${o} = u_${o};\n#endif\n`}),usedDefines:o,vertexIncludes:r,fragmentIncludes:n}}var JE={model:KE
vendor: 6,840 bytes, line 2
2('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_indicator_cutout.fragment.glsl"\n#include "_prelude_feature_cutout.fragment.glsl"\nuniform float u_opacity;\n#ifdef DITHERED_DISCARD\nuniform float u_dithered_discard_threshold;\n#endif\n#ifndef LIGHTING_3D_MODE\nuniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;\n#endif\nuniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows;\n#endif\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nuniform vec4 u_occlusionTextureTransform;\n#endif\n#pragma mapbox: define-attribute highp vec4 normal_4n\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec4 normal_4n\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#ifdef HAS_ATTRIBUTE_a_feature\nin lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;\n#endif\n#ifdef HAS_TEXTURE_u_baseColorTexture\nuniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff;\n#endif\n#ifdef HAS_TEXTURE_u_metallicRoughnessTexture\nuniform sampler2D u_metallicRoughnessTexture;\n#endif\n#ifdef HAS_TEXTURE_u_occlusionTexture\nuniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;\n#endif\n#ifdef HAS_TEXTURE_u_normalTexture\nuniform sampler2D u_normalTexture;\n#endif\n#ifdef HAS_TEXTURE_u_emissionTexture\nuniform sampler2D u_emissionTexture;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#define saturate(_x) clamp(_x,0.,1.)\nvec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor)\n{\n#ifdef LIGHTING_3D_MODE\nvec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));\n#endif\nreturn apply_lighting(albedo,transformed_normal,lighting_factor);\n#else\nvec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-lightColor),vec3(1.0));return c3;\n#endif\n}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;\n#ifdef HAS_ATTRIBUTE_a_color_3f\nalbedo*=vec4(color_3f,1.0);\n#endif\n#ifdef HAS_ATTRIBUTE_a_feature\n#else\n#ifdef HAS_ATTRIBUTE_a_color_4f\nalbedo*=color_4f;\n#endif\n#endif\n#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f)\nvec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}}\n#ifdef UNPREMULT_TEXTURE_IN_SHADER\ntexColor=vec4(unpremultiplyColor(texColor),1.0);\n#endif\nif(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;}\n#endif\nvec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a);\n#ifdef APPLY_LUT_ON_GPU\ncolor=applyLUT(u_lutTexture,color);\n#endif\nreturn color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) {\n#ifdef HAS_TEXTURE_u_normalTexture\nhighp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y;highp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res;\n#else\nreturn mat3(1.0);\n#endif\n}highp vec3 getNormal(){highp vec3 n;\n#ifdef HAS_ATTRIBUTE_a_normal_4n\nn=normalize(normal_4n.xyz);\n#else\nhighp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z));n=normalize(cross(fdx,fdy))*-1.0;\n#endif\n#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nvec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap);\n#endif\nreturn n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor;\n#ifdef HAS_ATTRIBUTE_a_feature\nmat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;\n#endif\n#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nvec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;\n#endif\nconst float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness)\n{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);
vendor: 2,676 bytes, line 2
2float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH)\n{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)\n{float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness)\n{highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV)\n{float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat)\n{\n#ifdef LIGHTING_3D_MODE\nreturn mat.diffuseColor;\n#else\nreturn mat.diffuseColor/PI;\n#endif\n}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)\n{vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal)\n{vec3 env_light=vec3(0.65,0.65,0.65);\n#ifdef LIGHTING_3D_MODE\nfloat ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;\n#endif\nvec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor)\n{highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=NdotL;\n#endif\nvec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*light
vendor: 9,447 bytes, line 2
2Color;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;\n#if !defined(LIGHTING_3D_MODE)\nconst vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL);\n#endif\ncolor*=intensityFactor;return color;}void main() {vec3 lightDir;vec3 lightColor;\n#ifdef LIGHTING_3D_MODE\nlightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;\n#else\nlightDir=u_lightpos;lightColor=u_lightcolor;\n#endif\nvec4 finalColor;\n#ifdef DIFFUSE_SHADED\nvec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor);\n#ifdef HAS_TEXTURE_u_occlusionTexture\nfloat ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;\n#endif\nfinalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity;\n#else\nMaterial mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;\n#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nvec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy;\n#else\nvec2 uv=uv_2f;\n#endif\nao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao;\n#endif\nvec4 emissive=u_emissiveFactor;\n#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nemissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);\n#endif\n#ifdef APPLY_LUT_ON_GPU\nfloat emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength;\n#endif\ncolor+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;\n#ifdef HAS_ATTRIBUTE_a_feature\nfloat resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);vec3 color_mix=v_color_mix.rgb;\n#ifdef APPLY_LUT_ON_GPU\ncolor_mix=applyLUT(u_lutTexture,color_mix);\n#endif\ncolor=mix(color,color_mix,min(1.0,resEmission));\n#ifdef HAS_ATTRIBUTE_a_color_4f\nfloat distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance);\n#endif\n#endif\nvec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);\n#endif\n#ifdef DITHERED_DISCARD\nif (abs(u_dithered_discard_threshold) < 1.0) {float ditherValue=fract(52.9829189*fract(0.06711056*gl_FragCoord.x+0.00583715*gl_FragCoord.y));float compareValue=mix(1.0-ditherValue,ditherValue,step(0.0,u_dithered_discard_threshold));if (abs(u_dithered_discard_threshold) < compareValue) {discard;}}\n#endif\n#ifdef FOG\nfinalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));\n#endif\n#ifdef RENDER_CUTOFF\nfinalColor*=v_cutoff_opacity;\n#endif\nglFragColor=finalColor;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_feature_cutout.vertex.glsl"\nin vec3 a_pos_3f;\n#pragma mapbox: define-attribute highp vec4 normal_4n\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 feature\n#define MODEL_PART_COUNT 7u\n#define MODEL_PART_STYLE_SIZE_VEC4 28u\n#ifdef HAS_ATTRIBUTE_a_feature\nstruct ModelPartStyle {vec4 color_mix;vec4 rmea;vec4 gradient;float gradient_power;};layout(std140) uniform ModelPartStyleUniform {vec4 part_style[MODEL_PART_STYLE_SIZE_VEC4];} u_model_part_style;uniform vec4 u_model_mesh_params;\n#endif\nuniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_normal_matrix;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows;\n#endif\nout vec4 v_position_height;out lowp vec4 v_color_mix;\n#ifdef HAS_ATTRIBUTE_a_feature\nout lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;\n#endif\nvec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}\n#ifdef HAS_ATTRIBUTE_a_feature\nuint decodeModelPartId(uvec2 feature) {uint partId=feature.y & 0xFu;return partId < MODEL_PART_COUNT ? partId : 0u;}vec4 decodeModelVertexColor(uvec2 feature) {uvec4 nibbles=uvec4(feature.x >> 12u,feature.x >> 8u,feature.x >> 4u,feature.x) & 0xFu;return vec4(nibbles*17u)/255.0;}ModelPartStyle readModelPartStyle(uint partId) {uint base=partId*4u;ModelPartStyle style;style.color_mix=u_model_part_style.part_style[base];style.rmea=u_model_part_style.part_style[base+1u];style.gradient=u_model_part_style.part_style[base+2u];style.gradient_power=u_model_part_style.part_style[base+3u].x;return style;}vec3 modelAlbedo(ModelPartStyle style,vec4 vertexColor) {float ambientOcclusion=mix(1.0,vertexColor.a,u_model_mesh_params.z);return ambientOcclusion*mix(vertexColor.rgb,style.color_mix.rgb,style.color_mix.a);}vec4 resolveModelEmissiveGradient(ModelPartStyle style,float height) {float begin=u_model_mesh_params.x+u_model_mesh_params.y*style.gradient.x;float span=u_model_mesh_params.y*(style.gradient.y-style.gradient.x);return vec4((height-begin)/span,style.gradient_power,style.gradient.z,style.gradient.w);}\n#endif\nvoid main() {\n#pragma mapbox: initialize-attribute highp vec4 normal_4n\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute-custom highp uvec2 feature\nhighp mat4 normal_matrix;\n#ifdef INSTANCED_ARRAYS\nnormal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\nnormal_matrix=u_normal_matrix;\n#endif\nvec3 local_pos;mat3 rs;\n#ifdef MODEL_POSITION_ON_GPU\nvec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float hidden=float(pos_a.x > EXTENT);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=mix(u_matrix*pos,AWAY,hidden);pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos;\n#else\nlocal_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a);\n#endif\nv_position_height.w=a_pos_3f.z;\n#ifdef HAS_ATTRIBUTE_a_feature\nModelPartStyle part_style=readModelPartStyle(decodeModelPartId(feature));v_color_mix=vec4(modelAlbedo(part_style,decodeModelVertexColor(feature)),1.0);v_roughness_metallic_emissive_alpha=part_style.rmea;v_height_based_emission_params=resolveModelEmissiveGradient(part_style,a_pos_3f.z);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(local_pos);\n#endif\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n#ifdef HAS_ATTRIBUTE_a_normal_4n\n#ifdef MODEL_POSITION_ON_GPU\nfloat x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_4n=vec4(rs*((u_lighting_matrix*vec4(normal_4n.xyz,0.0)).xyz/squared_scale),0.0);normal_4n=normalize(normal_4n);\n#else\nnormal_4n=vec4((normal_matrix*vec4(normal_4n.xyz,0)).xyz,0.0);\n#endif\n#endif\n#ifdef HAS_ATTRIBUTE_a_feature\n#ifdef HAS_ATTRIBUTE_a_color_4f\nv_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0);\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0);\n#ifdef NORMAL_OFFSET\n#ifdef HAS_ATTRIBUTE_a_normal_4n\n#ifdef MODEL_POSITION_ON_GPU\nvec3 offset=shadow_normal_offset(vec3(-normal_4n.xy,normal_4n.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#else\nvec3 offset=shadow_normal_offset_model(normal_4n.xyz);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#endif\n#endif\n#endif\nv_pos_light_view_0=u_light_matrix_0*shadow_pos;v_pos_light_view_1=u_light_matrix_1*shadow_pos;v_depth_shadows=gl_Position.w;\n#endif\n}'),modelDepth:
2KE("void main() {}","in vec3 a_pos_3f;uniform mat4 u_matrix;\n#ifdef MODEL_POSITION_ON_GPU\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_instance;\n#endif\nuniform highp mat4 u_node_matrix;\n#endif\nvoid main() {\n#ifdef MODEL_POSITION_ON_GPU\nhighp mat4 instance;\n#ifdef INSTANCED_ARRAYS\ninstance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\ninstance=u_instance;\n#endif\nvec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float hidden=float(pos_a.x > EXTENT);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=mix(u_matrix*pos,AWAY,hidden);\n#else\ngl_Position=u_matrix*vec4(a_pos_3f,1);\n#endif\n}"),fillExtrusionDepth:KE("void main() {}",'#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_material_table.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale;\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nin ivec4 a_pos_normal_ed;\n#if defined(HAS_CENTROID) || defined(TERRAIN)\nin uvec2 a_centroid_pos;\n#endif\n#ifdef RENDER_WALL_MODE\nin ivec4 a_join_normal_inside;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp float line_width\n#pragma mapbox: define highp vec4 color\nvoid main() {DECLARE_MATERIAL_TABLE_INFO\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp float line_width\n#pragma mapbox: initialize highp vec4 color\nbase*=u_vertical_scale;height*=u_vertical_scale;vec3 top_up_ny=vec3(a_pos_normal_ed.xyz & 1);vec3 pos_nx=vec3(a_pos_normal_ed.xyz >> 1);base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=vec2(a_centroid_pos);\n#endif\nvec3 pos;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;float ele=elevation(pos_nx.xy);bool is_elevation_encoded=centroid_pos.y==0.0 || (centroid_pos.y > 0.0 && int(centroid_pos.y)-(int(centroid_pos.y)/8)*8==7);float c_ele=is_flat_height || is_flat_base ? (is_elevation_encoded ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);float h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);\n#else\npos=vec3(pos_nx.xy,t > 0.0 ? height : base);\n#endif\n#ifdef RENDER_WALL_MODE\nvec3 join_normal_inside=vec3(a_join_normal_inside);vec2 wall_offset=u_width_scale*line_width*(join_normal_inside.xy/EXTENT);pos.xy+=(1.0-join_normal_inside.z)*wall_offset*0.5;pos.xy-=join_normal_inside.z*wall_offset*0.5;\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);}'),fillExtrusionGroundEffect:K
vendor: 3,848 bytes, line 2
2E("uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size;\n#ifdef SDF_SUBPASS\nin highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);}\n#ifdef FOG\nin highp float v_fog;\n#endif\n#endif\nvoid main() {\n#ifdef CLEAR_SUBPASS\nvec4 color=vec4(1.0);\n#ifdef CLEAR_FROM_TEXTURE\ncolor=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size));\n#endif\nglFragColor=color;\n#else\n#ifdef SDF_SUBPASS\nhighp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0;\n#ifdef FOG\nfog=v_fog;\n#endif\n#ifdef RENDER_CUTOFF\nfog*=v_cutoff_opacity;\n#endif\nglFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog));\n#else\n#ifdef USE_MRT1\nout_Target1=vec4(1.0-texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)).a,0.0,0.0,0.0);\n#else\nvec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass);\n#ifdef OVERDRAW_INSPECTOR\ncolor=vec4(1.0);\n#endif\nglFragColor=color;\n#endif\n#endif\nHANDLE_WIREFRAME_DEBUG;\n#endif\n}",'#include "_prelude_fog.vertex.glsl"\nin highp ivec4 a_pos_end;in highp int a_angular_offset_factor;in highp uint a_hidden_by_landmark;\n#ifdef SDF_SUBPASS\nout highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;\n#ifdef FOG\nout highp float v_fog;\n#endif\n#endif\nuniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp float u_dynamic_offset;uniform highp vec2 u_ao;\n#pragma mapbox: define highp float flood_light_ground_radius\nconst float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {\n#pragma mapbox: initialize highp float flood_light_ground_radius\nvec4 pos_end=vec4(a_pos_end);vec2 p=pos_end.xy;vec2 q=floor(pos_end.zw*0.5);vec2 start_bottom=pos_end.zw-q*2.0;float fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=float(a_angular_offset_factor)/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(u_dynamic_offset,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp;\n#ifdef SDF_SUBPASS\nv_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius);\n#ifdef FOG\nv_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos);\n#endif\n#endif\nfloat hidden_by_landmark=0.0;\n#ifdef HAS_CENTROID\nhidden_by_landmark=float(a_hidden_by_landmark);\n#endif\nfloat isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0));\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n}'),groundShadow:
vendor: 39,393 bytes, line 2
2KE('#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_indicator_cutout.fragment.glsl"\n#include "_prelude_feature_cutout.fragment.glsl"\nprecision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\nvoid main() {float light=shadowed_light_factor_plane_bias(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light);\n#ifdef RENDER_CUTOFF\nshadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w));\n#endif\n#ifdef FOG\nshadow=mix(shadow,vec3(1.0),v_fog_opacity);\n#endif\nglFragColor=vec4(shadow,1.0);}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in ivec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0);\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));v_fog_opacity=fog(v_fog_pos);\n#endif\n}')};const QE=(e,t)=>({u_matrix:e,u_ground_shadow_factor:t});function eA(e,t,i=0){const r=Math.pow(2,t.tileID.overscaledZ),n=t.tileSize*Math.pow(2,e.transform.tileZoom)/r,o=n*(t.tileID.canonical.x+t.tileID.wrap*r),a=n*t.tileID.canonical.y;return{u_image:0,u_texsize:t.imageAtlasTexture?t.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/tb(t,1,e.transform.tileZoom),u_pixel_coord_upper:[o>>16,a>>16],u_pixel_coord_lower:[65535&o,65535&a],u_pattern_transition:i}}const tA={terrain:0,flat:1},iA=p(),rA=[0,0,0],nA=(e,t,i,r,n,o,a,s,c,u,h,p,f,m,_,g,y,x,v=[0,0,1],b=!1)=>{let w=rA,E=0,A=rA;if(!b){const e=t.style.light,i=e.properties.get("position");if(w=[i.x,i.y,i.z],"viewport"===e.properties.get("anchor")){const e=l();d(e,-t.transform.angle),re(w,w,e)}const r=e.properties.get("color").toPremultipliedRenderColor(null);E=e.properties.get("intensity"),A=[r.r,r.g,r.b]}const I=t.transform,S={u_matrix:e,u_lightpos:w,u_lightintensity:E,u_lightcolor:A,u_vertical_gradient:+i,u_opacity:r,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:iA,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:tA[u],u_base_type:tA[h],u_ao:n,u_edge_radius:o,u_width_scale:a,u_flood_light_color:_,u_vertical_scale:g,u_flood_light_intensity:y,u_ground_shadow_factor:x,u_front_cutoff_params:v};return"globe"===I.projection.name&&(S.u_tile_id=[s.canonical.x,s.canonical.y,1<<s.canonical.z],S.u_zoom_transition=p,S.u_inv_rot_matrix=m,S.u_merc_center=f,S.u_up_dir=I.projection.upVector(new Df(0,0,0),f[0]*co,f[1]*co),S.u_height_lift=c),S},oA=(e,t,i,r,n,o)=>({u_matrix:e,u_edge_radius:t,u_width_scale:i,u_vertical_scale:r,u_height_type:tA[n],u_base_type:tA[o]}),aA=(e,t,i,r,n,o,a,s,l,c,u,h,d,p,f,m,_,g,y=!1)=>{const x=nA(e,t,i,r,n,o,a,s,c,u,h,d,p,f,m,_,1,[0,0,0],[0,0,1],y),v={u_height_factor:-Math.pow(2,s.overscaledZ)/l.tileSize/8};return Object.assign(x,eA(t,l,g),v)},sA=new Float32Array(16);function lA(e,t,i,r,n,o,a,s,l,c,u,h,d,p,f,m,_,g,y,x,b){const w=t.context,E=w.gl,A=t.transform,I=t.transform.zoom,S=[],T=e.translate,D=e.translateAnchor,M=e.edgeRadius,P=jw(t,e.cutoffFadeRange);"clear"===u?(S.push("CLEAR_SUBPASS"),x&&(S.push("CLEAR_FROM_TEXTURE"),w.activeTexture.set(E.TEXTURE0),x.bind(E.LINEAR,E.CLAMP_TO_EDGE))):"sdf"===u?S.push("SDF_SUBPASS"):"emissive"===u&&(S.push("USE_MRT1"),w.activeTexture.set(E.TEXTURE0),x.bind(E.LINEAR,E.CLAMP_TO_EDGE)),g&&S.push("HAS_CENTROID"),P.shouldRenderCutoff&&S.push("RENDER_CUTOFF");const C=(e,i,n,u,y)=>{let v=S;null!=i.groundRadiusBuffer&&(v=S.concat("HAS_ATTRIBUTE_a_flood_light_ground_radius"));const b=i.programConfigurations.get(r.id),E=t.isTileAffectedByFog(e),A=t.getOrCreateProgram("fillExtrusionGroundEffect",{config:b,defines:v,overrideFog:E}),T=((e,t,i,r,n,o,a,s,l,c)=>({u_matrix:e,u_opacity:t,u_ao_pass:i?1:0,u_meter_to_tile:r,u_ao:n,u_flood_light_intensity:o,u_flood_light_color:a,u_attenuation:s,u_edge_radius:l,u_fb:0,u_fb_size:c,u_dynamic_offset:1}))(u,h,c,y,[d,p*y],f,m,_,I>=17?0:M*y,x?x.size[0]:0),D=[];g&&D.push(i.hiddenByLandmarkVertexBuffer),null!=i.groundRadiusBuffer&&D.push(i.groundRadiusBuffer),t.uploadCommonUniforms(w,A,e.toUnwrapped(),null,P),A.draw(t,w.gl.TRIANGLES,o,a,s,l,T,r.id,i.vertexBuffer,i.indexBuffer,n,r.paint,I,b,D)};for(const R of n){const e=i.getTile(R),n=e.getBucket(r);if(!n||n.projection.name!==A.projection.name||!n.groundEffect||n.groundEffect&&!n.groundEffect.hasData())continue;const o=n.groundEffect,a=1/n.tileToMeter;{const i=t.translatePosMatrix(R.projMatrix,e,T,D),r=o.getDefaultSegment();C(R,o,r,i,a)}if(y)for(let s=0;s<4;s++){const n=Rf[s](R),o=i.getTile(n);if(!o)continue;const l=o.getBucket(r);if(!l||l.projection.name!==A.projection.name||!l.groundEffect||l.groundEffect&&!l.groundEffect.hasData())continue;const c=l.groundEffect;let u,h;0===s?(u=[-8192,0,0],h=1):1===s?(u=[co,0,0],h=0):2===s?(u=[0,-8192,0],h=3):(u=[0,co,0],h=2);const d=c.regionSegments[h];d&&(v(sA,R.projMatrix,u),C(R,c,d,t.translatePosMatrix(sA,e,T,D),a))}}}const cA={model:e=>({u_matrix:new Th(e),u_lighting_matrix:new Th(e),u_normal_matrix:new Th(e),u_node_matrix:new Th(e),u_lightpos:new Eh(e),u_lightintensity:new bh(e),u_lightcolor:new Eh(e),u_camera_pos:new Eh(e),u_opacity:new bh(e),u_baseColorFactor:new Ih(e),u_emissiveFactor:new Ih(e),u_metallicFactor:new bh(e),u_roughnessFactor:new bh(e),u_baseTextureIsAlpha:new vh(e),u_alphaMask:new vh(e),u_alphaCutoff:new bh(e),u_baseColorTexture:new vh(e),u_metallicRoughnessTexture:new vh(e),u_normalTexture:new vh(e),u_occlusionTexture:new vh(e),u_emissionTexture:new vh(e),u_lutTexture:new vh(e),u_color_mix:new Ih(e),u_aoIntensity:new bh(e),u_emissive_strength:new bh(e),u_occlusionTextureTransform:new Ih(e),u_dithered_discard_threshold:new bh(e),u_model_mesh_params:new Ih(e)}),modelDepth:e=>({u_matrix:new Th(e),u_instance:new Th(e),u_node_matrix:new Th(e)}),groundShadow:e=>({u_matrix:new Th(e),u_ground_shadow_factor:new Eh(e)}),fillExtrusionDepth:e=>({u_matrix:new Th(e),u_edge_radius:new bh(e),u_width_scale:new bh(e),u_vertical_scale:new bh(e),u_height_type:new vh(e),u_base_type:new vh(e)}),fillExtrusionGroundEffect:e=>({u_matrix:new Th(e),u_opacity:new bh(e),u_ao_pass:new bh(e),u_meter_to_tile:new bh(e),u_ao:new wh(e),u_flood_light_intensity:new bh(e),u_flood_light_color:new Eh(e),u_attenuation:new bh(e),u_edge_radius:new bh(e),u_fb:new vh(e),u_fb_size:new bh(e),u_dynamic_offset:new bh(e)})};function uA(e){const t=e.properties.get("direction"),i=Pt(t.x,t.y,t.z);i[2]=ht(i[2],0,75);const r=Mt([i[0],i[1],i[2]]);return V(r.x,r.y,r.z)}function hA(e,t,i){const r="none"===t.properties.get("color-use-theme"),n=t.properties.get("color"),o=t.properties.get("intensity"),a=t.properties.get("direction"),s=[a.x,a.y,a.z],l="none"===i.properties.get("color-use-theme"),c=i.properties.get("color"),u=i.properties.get("intensity"),h=Math.max(Q([0,0,1],s),0),d=[0,0,0];W(d,c.toPremultipliedRenderColor(l?null:e.getLut(t.scope)).toArray01Linear().slice(0,3),u);const p=[0,0,0];return W(p,n.toPremultipliedRenderColor(r?null:e.getLut(i.scope)).toArray01Linear().slice(0,3),h*o),Vt([d[0]>0?d[0]/(d[0]+p[0]):0,d[1]>0?d[1]/(d[1]+p[1]):0,d[2]>0?d[2]/(d[2]+p[2]):0])}const dA=[];function pA(e){return dA[e]=dA[e]||new Float64Array(16)}const fA=[],mA=new Float32Array(16);class _A{constructor(e,t){this.aabb=e,this.lastCascade=t}}class gA{add(e,t){const i=this.receivers[e.key];void 0!==i?(i.aabb.min[0]=Math.min(i.aabb.min[0],t.min[0]),i.aabb.min[1]=Math.min(i.aabb.min[1],t.min[1]),i.aabb.min[2]=Math.min(i.aabb.min[2],t.min[2]),i.aabb.max[0]=Math.max(i.aabb.max[0],t.max[0]),i.aabb.max[1]=Math.max(i.aabb.max[1],t.max[1]),i.aabb.max[2]=Math.max(i.aabb.max[2],t.max[2])):this.receivers[e.key]=new _A(t,null)}clear(){this.receivers={}}get(e){return this.receivers[e.key]}computeRequiredCascades(e,t,i){const r=Wp.fromPoints(e.points);let n=0;for(const o in this.receivers){const e=this.receivers[o];if(!e)continue;if(!r.intersectsAabb(e.aabb))continue;e.aabb.min=r.closestPoint(e.aabb.min),e.aabb.max=r.closestPoint(e.aabb.max);const a=e.aabb.getCorners();for(let r=0;r<i.length;r++){let o=!0;for(const e of a){const n=[e[0]*t,e[1]*t,e[2]];if(ie(n,n,i[r].matrix),n[0]<-1||n[0]>1||n[1]<-1||n[1]>1){o=!1;break}}if(e.lastCascade=r,n=Math.max(n,r),o)break}}return n+1}}function yA(e,t,i){const r=ee([],se([],i,t),se([],e,t)),n=k(r);return 0===n?[0,0,1,0]:(W(r,r,1/n),[r[0],r[1],r[2],-Q(r,t)])}function xA(e,t,i,r,n,o){const a=e.zoom,s=e.scale,l=e.worldSize,c=1/l,u=e.aspect,h=Math.sqrt(1+u*u)*Math.tan(.5*e.fovX),d=h*h,p=r-i,f=r+i;let m,g;d>p/f?(m=r,g=r*h):(m=.5*f*(1+d),g=.5*Math.sqrt(p*p+2*(r*r+i*i)*d+f*f*d*d));const b=e.projection.pixelsPerMeter(e.center.lat,l),w=[0,0,-m*c];ie(w,w,e._camera.getCameraToWorldMercator());let E=g*c;const A=function(t){return t[0]/=s,t[1]/=s,t[2]=Uc(t[2],e._center.lat),t},I=e._edgeInsets;if(!(0===I.left&&0===I.top&&0===I.right&&0===I.bottom||I.left===I.right&&I.top===I.bottom)){const t=e._camera.getWorldToCamera(e.worldSize,"meters"===e.projection.zAxisUnit?b:1),n=e._camera.getCameraToClipPerspective(e._fov,e.width/e.height,i,r);n[8]=2*-e.centerOffset.x/e.width,n[9]=2*e.centerOffset.y/e.height;const o=new Float64Array(16);F(o,n,t);const s=new Float64Array(16);y(s,o);const c=$p.fromInvProjectionMatrix(s,l,a,!0);for(const e of c.points){const t=A(e);E=Math.max(E,ue(j([],w,t)))}}E*=n/(n-1);const S=Math.acos(t[2]),T=Math.atan2(-t[0],-t[1]),D=new Ew;D.position=w,D.setPitchBearing(S,T);const M=D.getWorldToCamera(l,b),P=E*l,C=Math.min(e._mercatorZfromZoom(17)*l*-2,-2*P),R=D.getCameraToClipOrthographic(-P,P,-P,P,C,(P+o*b)/t[2]),z=new Float64Array(16);x(z,R,M);const L=.5*n,O=[0,0,0];ie(O,V(Math.floor(1e6*w[0])/1e6*l,Math.floor(1e6*w[1])/1e6*l,0),z),W(O,O,L);const B=[Math.floor(O[0]),Math.floor(O[1]),Math.floor(O[2])],k=[0,0,0];se(k,O,B),W(k,k,-1/L);const N=new Float64Array(16);return _(N),v(N,N,k),x(z,N,z),[z,P]}class vA extends Nr{constructor(e,t,i,r){super(),this.id=e,this.type="model",this.models=[],this._options=t,this._modelsInfo=new Map,this._abortController=null}cancelModelRequests(){this._abortController&&(this._abortController.abort(),this._abortController=null)}async loadGLTFFromURI(e,t){return ny((await this.map._requestManager.transformRequest(e,Bi.Model,t)).url,t)}async loadModel(e,t,i){try{const r=await this.loadGLTFFromURI(t.uri,i);if(i.aborted)return;const n=this._modelsInfo.get(e);if(!n)return;const o=Ky(r),a=n.modelSpec,s=new My(e,a.uri,a.position,a.orientation,o);vA.applyModelSpecification(s,a),s.computeBoundsAndApplyParent(),this.models.push(s),n.model=s}catch(r){if(i.aborted)return;this.fire(new Br(new Error(`Could not load model ${e} from ${t.uri}`,{cause:r})))}}async load(){this._abortController||(this._abortController=new AbortController);const e=this._abortController.signal,t=[];for(const i in this._options.models){const r=this._options.models[i],n=this._modelsInfo.get(i);if(n&&n.model){n.modelSpec=r;const e=n.model;e.position=null!=r.position?new kc(r.position[0],r.position[1]):new kc(0,0),e.orientation=r.orientation??[0,0,0],vA.applyModelSpecification(e,r),e.computeBoundsAndApplyParent(),this.models.push(e)}else n?n.modelSpec=r:(this._modelsInfo.set(i,{modelSpec:r,model:null}),t.push(this.loadModel(i,r,e)))}0!==t.length?(await Promise.allSettled(t),e.aborted||this.fire(new Or("data",{dataType:"source",sourceDataType:"metadata"}))):this.loaded()&&this.fire(new Or("data",{dataType:"source",sourceDataType:"metadata"}))}static arrayFromColorSpecification(e){const t=e;if(void 0===t)return;if(Array.isArray(t))return[t[0],t[1],t[2]];const i=Zr.parse(t);return i?[i.r,i.g,i.b]:void 0}static applyModelSpecification(e,t){if(t.nodeOverrides&&vA.convertNodeOverrides(e,t.nodeOverrides),t.materialOverrides&&vA.convertMaterialOverrides(e,t.materialOverrides),t.nodeOverrideNames&&(e.nodeOverrideNames=[...t.nodeOverrideNames]),t.materialOverrideNames&&(e.materialOverrideNames=[...t.materialOverrideNames]),t.featureProperties&&(e.featureProperties=t.featureProperties),t.lightOverrides){const i=t.lightOverrides,r=vA.arrayFromColorSpecification(i["light-ambient-color"]),n=vA.arrayFromColorSpecification(i["light-directional-color"]);e.lightOverrides={ambientIntensity:i["light-ambient-intensity"],ambientColor:r,directionalIntensity:i["light-directional-intensity"],directionalColor:n}}else e.lightOverrides=void 0}static convertNodeOverrides(e,t){if(Array.isArray(t)&&t.every(e=>"string"==typeof e)){e.nodeOverrideNames=[];for(const i of t)e.nodeOverrideNames.push(i)}else Object.entries(t).forEach(([t,i])=>{const r={orientation:[0,0,0],minZoom:void 0,maxZoom:void 0};if(Object.hasOwn(i,"orientation")){const e=i.orientation;e&&(r.orientation=e)}Object.hasOwn(i,"minzoom")&&(r.minZoom=i.minzoom),Object.hasOwn(i,"maxzoom")&&(r.maxZoom=i.maxzoom),e.nodeOverrides.set(t,r)})}static convertMaterialOverrides(e,t){if(Array.isArray(t)&&t.every(e=>"string"==typeof e)){e.materialOverrideNames=[];for(const i of t)e.materialOverrideNames.push(i)}else Object.entries(t).forEach(([t,i])=>{const r=vA.arrayFromColorSpecification(i["model-color"]),n={color:void 0!==r?new Zr(r[0],r[1],r[2]):new Zr(1,1,1),colorMix:0,emissionStrength:0,opacity:1},o=i["model-color-mix-intensity"];void 0!==o&&(n.colorMix=o);const a=i["model-emissive-strength"];void 0!==a&&(n.emissionStrength=a);const s=i["model-opacity"];void 0!==s&&(n.opacity=s),e.materialOverrides.set(t,n)})}onAdd(e){this.map=e,this.load()}hasTransition(){return!1}loaded(){if(0===this._modelsInfo.size)return!0;for(const e of this._modelsInfo.values())if(null==e.model)return!1;return!0}getModels(){return this.models}loadTile(e,t){}serialize(){return this._options}setProperty(e,t){return!1}reload(){this.cancelModelRequests();const e=Ul(this.id,this.scope);this.map.style.clearSource(e),this.models=[],this._modelsInfo.clear(),this.load()}onRemove(e){this.cancelModelRequests()}setModels(e){this.models=[];const t=new Map;for(const i in e){const r=e[i],n=this._modelsInfo.get(i);n&&n.modelSpec.uri===r.uri&&t.set(i,n)}if(this._modelsInfo.size!==t.size){this.cancelModelRequests();for(const[e,i]of t)i.model||t.delete(e)}this._modelsInfo=t,this._options.models=e,this.load()}}async function bA(e,t,i){const r=e.url&&!e.tiles?await t.transformRequest(e.url,Bi.Source,i):void 0;return{request:r,options:r?{...e,url:r.url}:e}}function wA(e,t,i){try{t=function(e){if(!e.variants)return e;if(!Array.isArray(e.variants))throw new Error("variants must be an array");let t=null,i=null;for(const n of e.variants){if(null==n||"object"!=typeof n||n.constructor!==Object)throw new Error("variant must be an object");if(!Array.isArray(n.capabilities))throw new Error("capabilities must be an array");1===n.capabilities.length&&("meshopt-v2+lod"===n.capabilities[0]?i=n:"meshopt"===n.capabilities[0]&&(t=n))}const r=null!==i?i:t;return null!==r?Object.assign(e,r):e}(t)}catch(e){return new Error("Failed to process TileJSON variants",{cause:e})}const r=mt({...t,...e},["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","extra_bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);return e.url&&t.tiles&&e.tiles&&(r.tiles=t.tiles),r.tiles=i.canonicalizeTileset(r,e.url),r}function EA(e,t,i,r,n){const o=function(i,r){if(i)return n(i);if(r){e.url&&r.tiles&&e.tiles&&delete e.tiles;const i=wA(e,r,t);if(i instanceof Error)return n(i);n(null,i)}},a=function(e,t,i){if(!e)return null;if(!t&&!i)return e;i=i||e.worldview_default;const r=Object.values(e.language||{});if(0===r.length)return null;const n=Object.values(e.worldview||{});if(0===n.length)return null;const o=r.every(e=>e===t),a=n.every(e=>e===i);return o&&a?e:t in(e.language_options||{})||i in(e.worldview_options||{})?null:e.language_options&&e.worldview_options?e:null}(e.data,i,r);if(a)return ei.frame(()=>o(null,a));if(e.url){const n=new AbortController;return(async()=>{const a=await t.transformRequest(t.normalizeSourceURL(e.url,null,i,r),Bi.Source,n.signal),{data:s}=await $i(a,n.signal);o(null,s)})().catch(e=>{n.signal.aborted||o(e)}),{cancel:()=>n.abort()}}return ei.frame(()=>{const{data:t,...i}=e;o(null,i)})}function AA(e,t){const i=Math.pow(2,t.z),r=Math.floor(Wn(e.getWest())*i),n=Math.floor(qn(e.getNorth())*i),o=Math.ceil(Wn(e.getEast())*i),a=Math.ceil(qn(e.getSouth())*i);return t.x>=r&&t.x<o&&t.y>=n&&t.y<a}class IA{constructor(e,t,i){this.bounds=e?Vc.convert(this.validateBounds(e)):null,this.minzoom=t||0,this.maxzoom=i||24}validateBounds(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}addExtraBounds(e){if(e){this.extraBounds||(this.extraBounds=[]);for(const t of e)this.extraBounds.push(Vc.convert(this.validateBounds(t)))}}contains(e){if(e.z>this.maxzoom||e.z<this.minzoom)return!1;if(this.bounds&&!AA(this.bounds,e))return!1;if(!this.extraBounds)return!0;for(const t of this.extraBounds)if(AA(t,e))return!0;return!1}static fromTileJSON(e){if(!e.bounds&&!e.extra_bounds)return null;const t=new IA(e.bounds,e.minzoom,e.maxzoom);return t.addExtraBounds(e.extra_bounds),t}}const SA={loaded:!0,drawModels:function(e,t,i,r){if("opaque"===e.renderPass)return;const n=i.paint.get("model-opacity").constantOr(1),o=i.paint.get("model-elevation-reference"),a="ground"===o,s="ground"===o;if(0===n)return;const l=i.paint.get("model-cast-shadows");if("shadow"===e.renderPass){if(!l)return;if(e.terrain&&n<.65&&i._transitionablePaint._values["model-opacity"].value.expression instanceof Ss)return}const c=e.shadowRenderer,u=i.paint.get("model-receive-shadows");c&&(c.useNormalOffset=!0,u||(c.enabled=!1));const h=()=>{c&&(c.useNormalOffset=!0,u||(c.enabled=!0))},d=t.getSource();if("light-beam"===e.renderPass&&"batched-model"!==d.type)return;if("vector"===d.type||"geojson"===d.type)return function(e,t,i,r,n){const o=e.transform,a="globe"===o.projection.name,s=o.getFreeCameraOptions().position;if(!e.modelManager)return;const l=e.modelManager;i.modelManager=l;const c=e.shadowRenderer;if(!Object.hasOwn(i._unevaluatedLayout._values,"model-id"))return;const u=i._unevaluatedLayout._values["model-id"],h={...i.layout.get("model-id").parameters},d=e.style.order.indexOf(i.fqid),f=i.paint.get("model-opacity").constantOr(1);for(const m of r){const r=t.getTile(m).getBucket(i);if(!r||r.projection.name!==o.projection.name)continue;const _=r.getModelUris();if(_&&!r.modelsRequested&&(l.addModelsFromBucket(_,n),r.modelsRequested=!0),a)h.zoom=m.overscaledZ;else{const e=yE(m,o);h.zoom=e}const g=u.possiblyEvaluate(h);if(_E(e,r,m),gE.shadowUniformsInitialized=!1,gE.useSingleShadowCascade=!!c&&0===c.getMaxCascadeForTile(m.toUnwrapped()),"shadow"===e.renderPass&&c){if(1===e.currentShadowCascade&&r.isInsideFirstShadowMapFrustum)continue;const t=o.calculatePosMatrix(m.toUnwrapped(),o.worldSize);if(gE.tileMatrix.set(t),gE.shadowTileMatrix.set(c.calculateShadowPassMatrixFromMatrix(t)),gE.aabb.min=[0,0,0],gE.aabb.max[0]=gE.aabb.max[1]=co,gE.aabb.max[2]=0,bE(r,gE,e,i.scope))continue}const y=1<<m.canonical.z,x=[((s.x-m.wrap)*y-m.canonical.x)*co,(s.y*y-m.canonical.y)*co,s.z*y*co];e.conflationActive&&Object.keys(r.instancesPerModel).length>0&&e.style.isLayerClipped(i,t.getSource())&&r.updateReplacement(m,e.replacementSource,d,i.scope)&&(r.uploaded=!1,r.upload(e.context));let v=0;const b=new Array,w=new Array,E=new Array;for(let t in r.instancesPerModel){const o=r.instancesPerModel[t];o.features.length>0&&!a&&(t=g.evaluate(o.features[0].feature,{}));const c=l.getModel(t,n);if(c||l.hasURLBeenRequested(t)||r.modelUris.includes(t)||(r.modelUris.push(t),r.modelsRequested=!1),c&&c.uploaded)if(a){const t=W([],[s.x,s.y,s.z],e.transform.worldSize);K(t,t);for(let i=0;i<o.instancedDataArray.length;++i){const n=[0,0,0],a=[1,1,1],s=_e(),l=o.tileCoordinatesForInstance(i),u=o.transformForInstance(i);P(a,u),C(s,u),ye(n,s);const h=o.translationForInstance(i),d=new kc(0,0);Gw(r.canonical,d,l.x,l.y);const m=p();Dy(m,c,e.transform,d,n,a,h,!0,!1,!1);const _=o.colorForInstance(i),g=I([],t),y=S([],[1,1,1/$c(d.lat,e.transform.zoom)]);E.push({zScaleMatrix:y,negCameraPosMatrix:g});for(const t of c.nodes)uE(e,t,m,e.transform.expandedFarZProjMatrix,v,b,w,c.materialOverrides,f,_);++v}}else for(const t of c.nodes)xE(e,i,t,o,x,m,gE)}if(a)if("shadow"===e.renderPass){for(const t of w)hE(t.mesh,t.nodeModelMatrix,e,i);for(const t of b)hE(t.mesh,t.nodeModelMatrix,e,i)}else mE(e,i,b,w,E)}}(e,t,i,r,cE(e,i)),void h();if(!d.loaded())return;if("batched-model"===d.type)return function(e,t,i,r){i.resetLayerRenderingStats(e);const n=e.context,o=e.transform,a=e.style.fog,s=e.shadowRenderer;if("mercator"!==o.projection.name)return void Tt(`Drawing 3D landmark models for ${o.projection.name} projection is not yet implemented`);const l=e.transform.getFreeCameraOptions().position,c=W([],[l.x,l.y,l.z],e.transform.worldSize),u=I([],K([],c)),h=$c(o.center.lat,o.zoom),d=x([],u,S([],[1,1,1/h])),p=i.paint.get("model-opacity").constantOr(1),f=new fw(n.gl.LEQUAL,fw.ReadWrite,e.depthRangeFor3D),m=new fw(n.gl.LEQUAL,fw.ReadOnly,e.depthRangeFor3D),_=new Wp([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),v="shadow"===e.renderPass,w="light-beam"===e.renderPass,E="none"===i.paint.get("model-color-use-theme").constantOr("default"),A=v&&s?s.getCurrentCascadeFrustum():o.getFrustum(o.scaleZoom(o.worldSize)),T=i.paint.get("model-front-cutoff"),D=T[2]<1,M=jw(e,i.paint.get("model-cutoff-fade-range")),P=i.getLayerRenderingStats();(function(e,t,i,r){const n=e.terrain?e.terrain.exaggeration():0,o=e.transform.zoom;for(const a of r){const r=t.getTile(a).getBucket(i);r&&(r.setFilter(i.filter),e.conflationActive&&r.updateReplacement(a,e.replacementSource),r.evaluateTransform(e,i),e.terrain&&n>0&&r.elevationUpdate(e.terrain,n,a,i.source),r.needsReEvaluation(e,o,i)&&r.evaluate(i))}})(e,t,i,r),function(){const l=new Map;let u,I,S;D?(u=r.length-1,I=-1,S=-1):(u=0,I=r.length,S=1);const C=O(),R=new ke(0,0);for(let z=u;z!==I;z+=S){const u=r[z],I=t.getTile(u).getBucket(i);if(!I||!I.uploaded)continue;let S=!1;s&&(S=0===s.getMaxCascadeForTile(u.toUnwrapped()));const L=o.calculatePosMatrix(u.toUnwrapped(),o.worldSize),F=!!(4&I.modelTraits);x(Zw,d,L),x(Xw,o.expandedFarZProjMatrix,L),y(Yw,Zw),g(Yw,Yw);const O=!v&&s&&s.enabled?s.computeCascadeTileMatrices(L):null;!v&&D&&(y(Ww,L),ie(C,c,Ww),R.x=C[0],R.y=C[1]);const B=[];I.setFilter(i.filter);for(const t of I.getNodesInfo()){if(t.hiddenByReplacement)continue;if(!t.node.meshes)continue;const i=t.node;let r=0;e.terrain&&i.elevation&&(r=i.elevation*e.terrain.exaggeration());const n=()=>{const e=t.aabb,i=_.min,n=_.max;return i[0]=e.min[0],i[1]=e.min[1],i[2]=e.min[2]+r,n[0]=e.max[0],n[1]=e.max[1],n[2]=e.max[2]+r,ie(i,i,L),ie(n,n,L),_},a=n(),s=t.evaluatedScale;if(s[0]<=1&&s[1]<=1&&s[2]<=1&&0===a.intersects(A))continue;if(!v){const i=a.min,r=a.max;eE[0]=.5*(i[0]+r[0]),eE[1]=.5*(i[1]+r[1]),eE[2]=.5*(i[2]+r[2]);const n=Z(c,eE)*h,o=e._debugParams.lodSwitchDistance,l=o>=0;if(l&&o>=9999)t.targetLod=0;else{let a;if(l)a=o;else{const e=(r[2]-i[2])*h*s[2],t=Math.max(r[0]-i[0],r[1]-i[1])*h*Math.max(s[0],s[1]);let n;n=e>=30?1:t>=80?.5:Math.max(e,t)>=20?.25:0,a=2e3+3e3*n}vE(t,n,Math.min(e.frameTimeDelta,1e3/30),a,e._debugParams.lodSwitchFadeDuration)}}if(!v&&D){const e=1/6;t.cameraCollisionOpacity=c[0]>a.min[0]&&c[0]<a.max[0]&&c[1]>a.min[1]&&c[1]<a.max[1]&&c[2]*h<a.max[2]&&i.footprint&&gm(R,i.footprint)?Math.max(t.cameraCollisionOpacity-e,0):Math.min(1,t.cameraCollisionOpacity+e)}const l=1/qc(u.canonical),d=i.anchor?i.anchor[0]:0,f=i.anchor?i.anchor[1]:0,m=[d*(s[0]-1)+t.evaluatedTranslation[0]*l,f*(s[1]-1)+t.evaluatedTranslation[1]*l,r+t.evaluatedTranslation[2]],g=nE(new Float64Array(16),L,m,s),y=x([],g,i.globalMatrix),b=x([],o.expandedFarZProjMatrix,y),w=b[2]*d+b[6]*f+b[10]*r+b[14];i.hidden=!1;let E=p;v||(D&&(E*=t.cameraCollisionOpacity,E*=EE(g,o,t.aabb,T)),E*=wE(M,w)),0!==E?B.push({nodeInfo:t,depth:w,opacity:E,wvpForNode:b,nodeModelMatrix:y,tileModelMatrix:g,tileTranslation:m}):i.hidden=!0}v||B.sort((e,t)=>!D||1===e.opacity&&1===t.opacity?e.depth<t.depth?-1:1:1===e.opacity?-1:1===t.opacity?1:e.depth>t.depth?-1:1);for(const t of B){const r=t.nodeInfo,c=r.node;let u=null;if(e._debugParams.show3DModelFootprints&&c.footprint){const e=c.id||c.name||"footprint";if(!l.has(e)){const i=nE(new Float64Array(16),Xw,t.tileTranslation,t.nodeInfo.evaluatedScale);l.set(e,{node:c,mvp:i})}}const h=t.nodeInfo.evaluatedScale;nE($w,Zw,t.tileTranslation,h),Jw[0]=1/h[0],Jw[1]=-1/h[1],Jw[2]=1/h[2],b(Ww,Yw,Jw),x($w,$w,c.globalMatrix);const d=F?0:r.evaluatedRMEA[0][2],p=r.targetLod,_=c.lodMeshes&&c.lodMeshes.length>0,g=_&&p>0&&p<1;if(v&&_&&1===Math.round(p))continue;const y=!v&&a?rE(qw,t.nodeModelMatrix,e.transform):null,A=v&&s?s.calculateShadowPassMatrixFromMatrix(t.nodeModelMatrix):null,I=g?2:1,T=_&&1===Math.round(p);for(let l=0;l<I;++l){const h=g?1===l:T,_=h?c.lodMeshes:c.meshes,x=g?h?-p:1-p:1;for(let l=0;l<_.length;++l){const p=_[l],b=!h&&l===c.lightMeshIndex;let I=t.wvpForNode;if(b){if(!w&&!e.terrain&&e.shadowRenderer){e.currentLayer<e.firstLightBeamLayer&&(e.firstLightBeamLayer=e.currentLayer);continue}I=nE(Kw,Xw,t.tileTranslation,t.nodeInfo.evaluatedScale)}else if(w)continue;const T={defines:[]},D=[],M=!!p.normalBuffer;!v&&s&&(s.useNormalOffset=M);const C=aE(r,p);if(sE(T.defines,D,p,e,E?null:i.lut,C),F||T.defines.push("DIFFUSE_SHADED"),S&&T.defines.push("SHADOWS_SINGLE_CASCADE"),P&&(v?P.numRenderedVerticesInShadowPass+=p.vertexArray.length:P.numRenderedVerticesInTransparentPass+=p.vertexArray.length),v){hE(p,t.nodeModelMatrix,e,i,A);continue}if(a&&"globe"!==o.projection.name){const e=p.aabb.min,t=p.aabb.max,[i,r]=a.getOpacityForBounds(y,e[0],e[1],t[0],t[1]);T.overrideFog=i>=bm||r>=bm}const R=p.material;let z;R.occlusionTexture&&R.occlusionTexture.offsetScale&&(z=R.occlusionTexture.offsetScale,T.defines.push("OCCLUSION_TEXTURE_TRANSFORM")),g&&T.defines.push("DITHERED_DISCARD");const L=e.getOrCreateProgram("model",T);if(!v&&s&&s.enabled)if(u!==M){for(let e=0;e<O.length;e++)nE(iE[e]=iE[e]||new Float64Array(16),O[e],t.tileTranslation,t.nodeInfo.evaluatedScale);s.setupShadowsFromCascadeMatrices(iE,L,M),u=M}else L.setShadowUniformValues(n,s.getShadowUniformValues());e.uploadCommonUniforms(n,L,null,y);const B=R.pbrMetallicRoughness;B.metallicFactor=.9,B.roughnessFactor=.5;const k=sw(I,$w,Ww,c.globalMatrix,e,t.opacity,B.baseColorFactor,R.emissiveFactor,B.metallicFactor,B.roughnessFactor,R,d,i,tE,z,void 0,void 0,x,L.fixedDefines.includes("LIGHTING_3D_MODE"));k.u_model_mesh_params=oE(p,c,b,h),C&&C.bind(n,L.program),!b&&(r.hasTranslucentParts||t.opacity<1)&&L.draw(e,n.gl.TRIANGLES,f,uw.disabled,pw.disabled,gw.backCCW,k,i.id,p.vertexBuffer,p.indexBuffer,p.segments,i.paint,e.transform.zoom,void 0,D),L.draw(e,n.gl.TRIANGLES,b?m:f,uw.disabled,b||t.opacity<1||r.hasTranslucentParts?pw.alphaBlended:pw.unblended,gw.backCCW,k,i.id,p.vertexBuffer,p.indexBuffer,p.segments,i.paint,e.transform.zoom,void 0,D)}}}}if(e._debugParams.show3DModelFootprints&&l.size>0){const t=Array.from(l.keys()).sort();for(const i of t){const{node:t,mvp:r}=l.get(i);dE(e,0,t,r)}}}()}(e,t,i,r),void h();if("model"!==d.type)return;const f=d.getModels(),m=[],_=e.transform.getFreeCameraOptions().position,v=W([],[_.x,_.y,_.z],e.transform.worldSize);K(v,v);const w=[],E=[];let A=0;for(const p of f){const r=t.getFeatureState("",p.id),n={type:"Unknown",id:p.id,properties:p.featureProperties},o=i.paint.get("model-rotation").evaluate(n,r),l=i.paint.get("model-scale").evaluate(n,r),c=i.paint.get("model-translation").evaluate(n,r),u=i.paint.get("model-opacity").evaluate(n,r);pE(i,p.id,r,p.featureProperties,p.nodeOverrideNames,p.nodeOverrides),fE(i,p.id,r,p.featureProperties,p.materialOverrideNames,p.materialOverrides),p.nodeOverrides.size>0&&p.computeBoundsAndApplyParent(),p.computeModelMatrix(e,o,l,c,s,a,!1);const h=I([],v),d=S([],[1,1,1/$c(p.position.lat,e.transform.zoom)]);m.push({zScaleMatrix:d,negCameraPosMatrix:h});for(const t of p.nodes)uE(e,t,p.matrix,e.transform.expandedFarZProjMatrix,A,w,E,p.materialOverrides,u,void 0,p.lightOverrides);A++}if(w.sort((e,t)=>t.depth-e.depth),"shadow"!==e.renderPass){if(e._debugParams.show3DModelFootprints){const t=e.transform.projMatrix,i=new Map,r=(e,r)=>{if(e.footprint){const n=e.id||e.name||"footprint";if(!i.has(n)){const o=x([],t,r);i.set(n,{node:e,mvp:o})}}};for(const e of E)r(e.node,e.modelMatrix);for(const e of w)r(e.node,e.modelMatrix);const n=Array.from(i.keys()).sort();for(const o of n){const{node:t,mvp:r}=i.get(o);dE(e,0,t,r)}}mE(e,i,w,E,m),h()}else{for(const t of E)hE(t.mesh,t.nodeModelMatrix,e,i);for(const t of w)hE(t.mesh,t.nodeModelMatrix,e,i);h()}},prepare:function(e,t,i){const r=t.getSource();if(!r.loaded())return;if("vector"===r.type||"geojson"===r.type)return void(i.modelManager&&i.modelManager.upload(i,cE(i,e)));if("batched-model"===r.type)return;if("model"!==r.type)return;const n=r.getModels();for(const o of n)o.upload(i.context)},shaders:JE,programUniforms:cA,ShadowRenderer:class{constructor(e){this.painter=e,this._enabled=!1,this._drawShadowAfterLayer=-1,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new gA,this._depthMode=new fw(e.context.gl.LEQUAL,fw.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this._devtoolsFolder=null,this.useNormalOffset=!1,this._shadowParameters={cascadeCount:2,normalOffset:3,shadowMapResolution:2048}}destroy(){for(const e of this._cascades)e.texture.destroy(),e.framebuffer.destroy();this._cascades=[]}_hasCasterGeometry(e,t){const i=this.painter.style.getLayerSourceCache(e);if(!i)return!1;const r=i.getSource();if("model"===r.type)return r.getModels().length>0;const n=t[i.id];if(!n)return!1;for(const o of n){const t=i.getTile(o);if(t&&t.getBucket(e))return!0}return!1}updateShadowParameters(e,t,i){const r=this.painter;if(this._enabled=!1,this._drawShadowAfterLayer=-1,this._receivers.clear(),!t||!t.properties)return;const n=t.properties.get("shadow-intensity"),o=t.properties.get("shadow-draw-before-layer");if(!t.shadowsEnabled()||n<=0)return;let a=-1,s=0;for(const g of r.style.order){const t=r.style._mergedLayers[g];t.hasShadowPass()&&!t.isHidden(e.zoom)&&this._hasCasterGeometry(t,i)&&(a=s),!o||o!==g&&o!==t.slot||(this._drawShadowAfterLayer=s>0?s-1:0),s+=1}if(this._enabled=a>=0,!this.enabled)return;this._drawShadowAfterLayer<0&&(this._drawShadowAfterLayer=a);const l=r.context,c=this._shadowParameters.shadowMapResolution,u=this._shadowParameters.shadowMapResolution;if(0===this._cascades.length||this._shadowParameters.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let e=0;e<this._shadowParameters.cascadeCount;++e){const e=l.gl,t=l.createFramebuffer(c,u,0,"texture"),i=new $m(l,{width:c,height:u,data:null},e.DEPTH_COMPONENT16);t.depthAttachment.set(i.texture),this._cascades.push({framebuffer:t,texture:i,matrix:[],far:0,boundingSphereRadius:0,frustum:new $p,scale:0})}}this.shadowDirection=uA(t);let h=0;if(e.elevation){const t=e.elevation,i=[1e4,-1e4];t.visibleDemTiles.filter(e=>e.dem).forEach(e=>{const t=e.dem.tree;i[0]=Math.min(i[0],t.minimums[0]),i[1]=Math.max(i[1],t.maximums[0])}),1e4!==i[0]&&(h=(i[1]-i[0])*t.exaggeration())}const d=1.5*e.cameraToCenterDistance,p=3*d,f=new Float64Array(16);for(let g=0;g<this._cascades.length;++g){const t=this._cascades[g];let i=e.height/50,r=1;1===this._shadowParameters.cascadeCount?r=p:0===g?r=d:(i=d,r=p);const[n,o]=xA(e,this.shadowDirection,i,r,this._shadowParameters.shadowMapResolution,h);t.scale=e.scale,t.matrix=n,t.boundingSphereRadius=o,y(f,t.matrix),t.frustum=$p.fromInvProjectionMatrix(f,1,0,!0),t.far=r}const m=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[m].far,this._cascades[m].far],this._uniformValues.u_shadow_intensity=n,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=1/this._shadowParameters.shadowMapResolution,this._uniformValues.u_shadow_map_resolution=this._shadowParameters.shadowMapResolution,this._uniformValues.u_shadowmap_0=11,this._uniformValues.u_shadowmap_1=12,this._groundShadowTiles=r.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});const _=r.transform.elevation;for(const g of this._groundShadowTiles){let e={min:0,max:0};if(_){const t=_.getMinMaxForTile(g);t&&(e=t)}this.addShadowReceiver(g.toUnwrapped(),e.min,e.max)}}get enabled(){return this._enabled&&!this._forceDisable}set enabled(e){this._enabled=e}drawShadowPass(e,t){if(!this.enabled)return;const i=this.painter,r=i.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(i.transform.getFrustum(0),i.transform.worldSize,this._cascades),r.viewport.set([0,0,this._shadowParameters.shadowMapResolution,this._shadowParameters.shadowMapResolution]);for(let n=0;n<this._numCascadesToRender;++n){i.currentShadowCascade=n,r.bindFramebuffer.set(this._cascades[n].framebuffer.framebuffer),r.clear({color:Zr.white,depth:1});for(const r of e.order){const n=e._mergedLayers[r];if(!n.hasShadowPass()||n.isHidden(i.transform.zoom))continue;const o=e.getLayerSourceCache(n),a=o?t[o.id]:void 0;("model"===n.type||a&&a.length)&&i.renderLayer(i,o,n,a)}}i.currentShadowCascade=0}drawGroundShadows(){if(!this.enabled)return;const e=this.painter,t=e.style,i=e.context,r=i.gl,n=t.directionalLight,o=t.ambientLight;if(!n||!o)return;const a=[],s=jw(e,e.longestCutoffRange);s.shouldRenderCutoff&&a.push("RENDER_CUTOFF"),a.push("RENDER_SHADOWS"),this.useNormalOffset&&a.push("NORMAL_OFFSET");const l=hA(t,n,o),c=new fw(r.LEQUAL,fw.ReadOnly,e.depthRangeFor3D),u=new uw({func:r.EQUAL,mask:255},0,255,r.KEEP,r.KEEP,r.KEEP);for(const h of this._groundShadowTiles){const t=h.toUnwrapped(),n=e.isTileAffectedByFog(h),o=e.getOrCreateProgram("groundShadow",{defines:a,overrideFog:n});this.setupShadows(t,o),e.uploadCommonUniforms(i,o,t,null,s);const d=QE(e.transform.calculateProjMatrix(t),l);o.draw(e,r.TRIANGLES,c,u,pw.multiply,gw.disabled,d,"ground_shadow",e.tileExtentBuffer,e.quadTriangleIndexBuffer,e.tileExtentSegments,null,e.transform.zoom,null,null)}}getShadowPassDepthMode(){return this._depthMode}getGroundShadowLayerIndex(){return this._drawShadowAfterLayer}calculateShadowPassMatrixFromTile(e){const t=this.painter.transform,i=t.calculatePosMatrix(e,t.worldSize);return x(i,this._cascades[this.painter.currentShadowCascade].matrix,i),Float32Array.from(i)}calculateShadowPassMatrixFromMatrix(e){return x(mA,this._cascades[this.painter.currentShadowCascade].matrix,e)}setupShadows(e,t,i){if(!this.enabled)return;const r=this.painter.transform,n=this.painter.context,o=n.gl,a=this._uniformValues,s=r.calculatePosMatrix(e,r.worldSize);for(let l=0;l<this._cascades.length;l++){const e=pA(l);x(e,this._cascades[l].matrix,s),a[0===l?"u_light_matrix_0":"u_light_matrix_1"]=e,n.activeTexture.set(o.TEXTURE0+11+l),this._cascades[l].texture.bindExtraParam(o.LINEAR,o.LINEAR,o.CLAMP_TO_EDGE,o.CLAMP_TO_EDGE,o.GREATER)}if(this.useNormalOffset=!!i,this.useNormalOffset){const t=qc(e.canonical),n=2/r.tileSize*co/this._shadowParameters.shadowMapResolution,o=n*this._cascades[0].boundingSphereRadius,s=n*this._cascades.at(-1).boundingSphereRadius,l=("vector-tile"===i?1:3)*function(e){const t=ht((e-22)/-22,0,1);return.125*(1-t)+4*t}(r.zoom);a.u_shadow_normal_offset=[t,o*l,s*l],a.u_shadow_bias=[1e-4,.0012,.012]}else a.u_shadow_bias=[36e-5,.0012,.012];t.setShadowUniformValues(n,a)}computeCascadeTileMatrices(e){const t=this._shadowParameters.cascadeCount;for(let i=0;i<t;i++)x(fA[i]=fA[i]||new Float64Array(16),this._cascades[i].matrix,e);return fA.length=t,fA}setupShadowsFromMatrix(e,t,i=!1){if(!this.enabled)return;const r=this._shadowParameters.cascadeCount;for(let n=0;n<r;n++)x(pA(n),this._cascades[n].matrix,e);dA.length=r,this.setupShadowsFromCascadeMatrices(dA,t,i)}setupShadowsFromCascadeMatrices(e,t,i=!1){if(!this.enabled)return;const r=this.painter.context,n=r.gl,o=this._uniformValues;for(let a=0;a<this._shadowParameters.cascadeCount;a++)o[0===a?"u_light_matrix_0":"u_light_matrix_1"]=e[a],r.activeTexture.set(n.TEXTURE0+11+a),this._cascades[a].texture.bindExtraParam(n.LINEAR,n.LINEAR,n.CLAMP_TO_EDGE,n.CLAMP_TO_EDGE,n.GREATER);if(this.useNormalOffset=i,i){const e=this._shadowParameters.normalOffset;o.u_shadow_normal_offset=[1,e,e],o.u_shadow_bias=[6e-5,.0012,.012]}else o.u_shadow_bias=[36e-5,.0012,.012];t.setShadowUniformValues(r,o)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(e,t,i,r){if(r[2]>=0)return{};const n=function(e,t,i){const r=i/(1<<e.canonical.z);return new Wp([e.canonical.x*r+e.wrap*i,e.canonical.y*r+e.wrap*i,0],[(e.canonical.x+1)*r+e.wrap*i,(e.canonical.y+1)*r+e.wrap*i,t])}(e,t,i).getCorners(),o=t/-r[2];r[0]<0?(U(n[0],n[0],[r[0]*o,0,0]),U(n[3],n[3],[r[0]*o,0,0])):r[0]>0&&(U(n[1],n[1],[r[0]*o,0,0]),U(n[2],n[2],[r[0]*o,0,0])),r[1]<0?(U(n[0],n[0],[0,r[1]*o,0]),U(n[1],n[1],[0,r[1]*o,0])):r[1]>0&&(U(n[2],n[2],[0,r[1]*o,0]),U(n[3],n[3],[0,r[1]*o,0]));const a={};return a.vertices=n,a.planes=[yA(n[1],n[0],n[4]),yA(n[2],n[1],n[5]),yA(n[3],n[2],n[6]),yA(n[0],n[3],n[7])],a}addShadowReceiver(e,t,i){this._receivers.add(e,Wp.fromTileIdAndHeight(e,t,i))}getMaxCascadeForTile(e){const t=this._receivers.get(e);return t&&t.lastCascade?t.lastCascade:0}},drawGroundEffect:lA,queryModelLayerRendered:function(e,t,i,r){const n=i.getSource();if(!n||"model"!==n.type)return{};const o=n,a={};a[e.id]=[];const s=a[e.id];let l=0;for(const c of o.models){const n=i.getFeatureState(e.sourceLayer,c.id),o={type:"Unknown",id:c.id,properties:c.featureProperties},a=e.paint.get("model-rotation").evaluate(o,n),u=e.paint.get("model-scale").evaluate(o,n),h=e.paint.get("model-translation").evaluate(o,n),d=e.paint.get("model-elevation-reference");let p=[];Dy(p,c,r,c.position,a,u,h,"ground"===d,"ground"===d,!1),"globe"===r.projection.name&&(p=Ay(p,r));const f=x([],r.projMatrix,p),m=Iy(t.isPointQuery()?t.screenBounds:t.screenGeometry,r,f,c.aabb);if(null!=m){const t=new rw(void 0,0,0,0,c.id);t.layer=e.layer,t.properties=structuredClone(c.featureProperties),t.properties.layer=e.id,t.properties.uri=c.uri,t.properties.orientation=c.orientation,t.sourceLayer=e.sourceLayer,t.geometry={type:"Point",coordinates:[c.position.lng,c.position.lat]},t.state=n,t.source=e.source,s.push({featureIndex:l,feature:t,intersectionZ:m})}++l}return a},queryModelLayerIntersectsFeature:function(e,t,i,r,n,o){if(!e.modelManager)return!1;const a=e.modelManager,s=t.tile.getBucket(e);if(!(s&&s instanceof jb))return!1;for(const l in s.instancesPerModel){const r=s.instancesPerModel[l],c=void 0!==i.id?i.id:i.properties&&Object.hasOwn(i.properties,"id")?i.properties.id:void 0;if(Object.hasOwn(r.idToFeaturesIndex,c)){const i=r.features[r.idToFeaturesIndex[c]],u=a.getModel(l,o||e.scope);if(!u)return!1;let h=[];const d=new kc(0,0),p=s.canonical;let f=Number.MAX_VALUE;for(let e=0;e<i.instancedDataCount;++e){const o=16*(i.instancedDataOffset+e),a=r.instancedDataArray.float32,s=[a[o+4],a[o+5],a[o+6]];Gw(p,d,Math.floor(a[o]),Math.floor(a[o+1])),Dy(h,u,n,d,i.rotation,i.scale,s,!1,!1,
vendor: 3,751 bytes, line 2
2!1),"globe"===n.projection.name&&(h=Ay(h,n));const l=x([],n.projMatrix,h),c=t.queryGeometry,m=Iy(c.isPointQuery()?c.screenBounds:c.screenGeometry,n,l,u.aabb);null!=m&&(f=Math.min(m,f))}return f!==Number.MAX_VALUE&&f}}return!1},loadMatchingModelFeature:function(e,t,i,r){const n=e.getNodesInfo()[t];if(!n||n.hiddenByReplacement||!n.node.meshes)return;let o=Number.MAX_VALUE;const a=n.node,s=i.tile,l=r.calculatePosMatrix(s.tileID.toUnwrapped(),r.worldSize),c=n.evaluatedScale;let u=0;r.elevation&&a.elevation&&(u=a.elevation*r.elevation.exaggeration()),v(l,l,[(a.anchor?a.anchor[0]:0)*(c[0]-1),(a.anchor?a.anchor[1]:0)*(c[1]-1),u]),b(l,l,c);const h=i.queryGeometry,d=h.isPointQuery()?h.screenBounds:h.screenGeometry,p=function(e){const t=x([],l,e.globalMatrix);x(t,r.expandedFarZProjMatrix,t);for(let i=0;i<e.meshes.length;++i){const n=e.meshes[i];if(i===e.lightMeshIndex)continue;const a=Iy(d,r,t,n.aabb);null!=a&&(o=Math.min(a,o))}if(e.children)for(const i of e.children)p(i)};if(p(a),o===Number.MAX_VALUE)return;const f=new kc(0,0);return Gw(s.tileID.canonical,f,n.node.anchor[0],n.node.anchor[1]),{intersectionZ:o,position:f,feature:n.feature}},ModelSource:vA,Tiled3dModelSource:class extends Nr{constructor(e,t,i,r){super(),this.type="batched-model",this.id=e,this.tileSize=512,this._options=t,this.tiles=this._options.tiles,this.maxzoom=t.maxzoom||19,this.minzoom=t.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=i,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(r)}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest();const e=Ul(this.id,this.scope);this.load(()=>this.map.style.clearSource(e))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(e){this._loaded=!1,this.fire(new Or("dataloading",{dataType:"source"}));const t=Array.isArray(this.map._language)?this.map._language.join():this.map._language,i=this.map.getWorldview();this._tileJSONRequest=EA(this._options,this.map._requestManager,t,i,(r,n)=>{this._tileJSONRequest=null,this._loaded=!0,r?(t&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${t}`),i&&2!==i.length&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${i}`),this.fire(new Br(r))):n&&(Object.assign(this,n),n.bounds&&(this.tileBounds=new IA(n.bounds,this.minzoom,this.maxzoom)),vr(n.tiles,this.map._requestManager._customAccessToken),this.fire(new Or("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new Or("data",{dataType:"source",sourceDataType:"content"}))),e&&e(r)})}hasTransition(){return!1}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loaded(){return this._loaded}async loadTile(e,t){const i=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme)),r=!e.actor||"expired"===e.state;if(r)e.actor=this.dispatcher.getActor();else{if("loading"===e.state)return void(e.reloadCallback=t);if(e.buckets){const t=Object.values(e.buckets);for(const e of t)e.dirty=!0;return void(e.state="loaded")}}const n=r?"loadTile":"reloadTile",o=new AbortController;e.request=o;const a=(i,r)=>(delete e.request,e.aborted?t(null):i&&!Vi(i)?t(i):(this.map._refreshExpiredTiles&&r&&e.setExpiryData(zt(r.headers)),e.loadModelData(r,this.map.painter),e.state="loaded",t(null),void(e.reloadCallback&&(this.loadTile(e,e.reloadCallback),e.reloadCallback=null))));try{const r=await this.map._requestManager.transformRequest(i,Bi.Tile,o.signal);if(o.signal.aborted)return t(null);const s={request:r,data:void 0,uid:e.uid,tileID:e.tileID,tileZoom:e.tileZoom,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.t
vendor: 8,619 bytes, line 2
2ype,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,renderSourceType:e.renderSourceType,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:ei.devicePixelRatio,promoteId:this.promoteId};e.request=e.actor.sendCancelable(n,s,{},a)}catch(e){if(o.signal.aborted)return t(null);t(e)}}abortTile(e){e.request&&(e.request.abort(),delete e.request),e.actor&&e.actor.notify("abortTile",{uid:e.uid,type:this.type,source:this.id,scope:this.scope})}serialize(){return{...this._options}}},loadModel:async function(e,t,i){const r=await ny(e),n=new My(t,i,void 0,void 0,Ky(r));return n.computeBoundsAndApplyParent(),n}};function TA(e,t,i,r,n){return wt(e,(e,o)=>{const a=t instanceof _l?t.get(o):null;return a&&a.evaluate?a.evaluate(i,r,void 0,n):a})}function DA(e,t){return t-e}Rs(class{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Ps(co,co,512),this.featureIndexArray=new ih,this.promoteId=t,this.is3DTile=!1,this.serializedLayersCache=new Map}insert(e,t,i,r,n,o=0,a=0){const s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,r,n,o);const l=this.grid;for(let c=0;c<t.length;c++){const e=t[c],i=[1/0,1/0,-1/0,-1/0];for(let t=0;t<e.length;t++){const r=e[t];i[0]=Math.min(i[0],r.x),i[1]=Math.min(i[1],r.y),i[2]=Math.max(i[2],r.x),i[3]=Math.max(i[3],r.y)}0!==a&&(i[0]-=a,i[1]-=a,i[2]+=a,i[3]+=a),i[0]<co&&i[1]<co&&i[2]>=0&&i[3]>=0&&l.insert(s,i[0],i[1],i[2],i[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new od(new zm(this.rawTileData)).layers,this.sourceLayerCoder=new tw(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const e in this.vtLayers)this.vtFeatures[e]=[]}return this.vtLayers}query(e,t){const{tilespaceGeometry:i,transform:r,tileTransform:n,pixelPosMatrix:o,availableImages:a,worldview:s}=t;this.loadVTLayers(),this.serializedLayersCache.clear();const l=t.queryRadius?t.queryRadius:0,c=i.bufferedTilespaceBounds,u=this.grid.queryKeys(c.min.x,c.min.y,c.max.x,c.max.y,(e,t,r,n)=>yd(i.bufferedTilespaceGeometry,e-l,t-l,r+l,n+l));u.sort(DA);let h=null;r.elevation&&u.length>0&&(h=vm.create(r.elevation,this.tileID));const d={};let p;for(let f=0;f<u.length;f++){const l=u[f];if(l===p)continue;p=l;const c=this.featureIndexArray.get(l);let m=null;this.is3DTile?this.loadMatchingModelFeature(d,c,e,i,r,s):this.loadMatchingFeature(d,c,e,a,s,(e,a,s,l=0)=>(m||(m=iu(e,this.tileID.canonical,n)),a.queryIntersectsFeature(i,e,s,m,this.z,r,o,h,l,t.scope)))}return d}loadMatchingFeature(e,t,i,r,n,o){const{featureIndex:a,bucketIndex:s,sourceLayerIndex:l,layoutVertexArrayOffset:c}=t,u=this.bucketLayerIDs[s],h=i.layers,d=Object.keys(h);if(d.length&&!It(d,u))return;const p=i.sourceCache,f=this.sourceLayerCoder.decode(l),m=this.vtLayers[f].feature(a),_=this.getId(m,f);for(let g=0;g<u.length;g++){const t=u[g];if(!h[t])continue;const{styleLayer:i,targets:s}=h[t];let l={};void 0!==_&&(l=p.getFeatureState(i.sourceLayer,_));const d=!o||o(m,i,l,c);if(!d)continue;const f=new rw(m,this.z,this.x,this.y,_);f.tile=this.tileID.canonical,f.state=l;let y=this.serializedLayersCache.get(t);y||(y=i.serialize(),y.id=t,this.serializedLayersCache.set(t,y)),f.source=y.source,f.sourceLayer=y["source-layer"],f.layer={...y},f.layer.paint=TA(y.paint,i.paint,m,l,r),f.layer.layout=TA(y.layout,i.layout,m,l,r);const x=new ll(this.tileID.overscaledZ,{worldview:n});let v=!1;for(const e of s){this.updateFeatureProperties(f,e);const{filter:t}=e;if(t)if(m.properties=f.properties,t.needGeometry){const e=ru(m,!0);if(!t.filter(x,e,this.tileID.canonical))continue}else if(!t.filter(x,m))continue;v=!0,e.targetId&&this.addFeatureVariant(f,e)}v&&this.appendToResult(e,t,a,f,d)}}loadMatchingModelFeature(e,t,i,r,n,o){const{featureIndex:a,bucketIndex:s}=t,l=this.bucketLayerIDs[s],c=i.layers,u=Object.keys(c);if(!u.length||It(u,l))for(let h=0;h<l.length;h++){const t=l[h],{styleLayer:s,targets:u}=c[t];if("model"!==s.type)continue;const d=r.tile,p=d.getBucket(s);if(!p||!p.isTiled3dModelBucket)continue;if(!SA.loadMatchingModelFeature)continue;const f=SA.loadMatchingModelFeature(p,a,r,n);if(!f)continue;const{z:m,x:_,y:g}=d.tileID.canonical,{feature:y,intersectionZ:x,position:v}=f;let b={};void 0!==y.id&&(b=i.sourceCache.getFeatureState(s.sourceLayer,y.id));const w=new rw({},m,_,g,y.id);w.tile=this.tileID.canonical,w.state=b,w.properties=y.properties,w.geometry={type:"Point",coordinates:[v.lng,v.lat]};let E=this.serializedLayersCache.get(t);E||(E=s.serialize(),E.id=t,this.serializedLayersCache.set(t,E)),w.source=E.source,w.sourceLayer=E["source-layer"],w.layer={...E};const A=new ll(this.tileID.overscaledZ,{worldview:o});let I=!1;for(const e of u){this.updateFeatureProperties(w,e);const{filter:t}=e;if(t)if(y.properties=w.properties,t.needGeometry){if(!t.filter(A,y,this.tileID.canonical))continue}else if(!t.filter(A,y))continue;I=!0,e.targetId&&this.addFeatureVariant(w,e)}I&&this.appendToResult(e,t,a,w,x)}}updateFeatureProperties(e,t,i){if(t.properties){const r={};for(const n in t.properties){const o=t.properties[n].evaluate({zoom:this.z},e._vectorTileFeature,e.state,e.tile,i);null!=o&&(r[n]=o)}e.properties=r}}addFeatureVariant(e,t,i){const r={target:t.target,namespace:t.namespace,uniqueFeatureID:t.uniqueFeatureID};t.properties&&(r.properties=e.properties),e.variants=e.variants||{},e.variants[t.targetId]=e.variants[t.targetId]||[],e.variants[t.targetId].push(r)}appendToResult(e,t,i,r,n){let o=e[t];void 0===o&&(o=e[t]=[]),o.push({featureIndex:i,feature:r,intersectionZ:n})}lookupSymbolFeatures(e,t,i,r,n,o){const a={};this.loadVTLayers();for(const s of e)this.loadMatchingFeature(a,{bucketIndex:t,sourceLayerIndex:i,featureIndex:s,layoutVertexArrayOffset:0},r,n,o);return a}loadFeature(e){const{featureIndex:t,sourceLayerIndex:i}=e;this.loadVTLayers();const r=this.sourceLayerCoder.decode(i),n=this.vtFeatures[r];if(n[t])return n[t];const o=this.vtLayers[r].feature(t);return n[t]=o,o}hasLayer(e){for(const t of this.bucketLayerIDs)for(const i of t)if(e===i)return!0;return!1}getId(e,t){let i=e.id;if(this.promoteId){const r=Array.isArray(this.promoteId)||"object"!=typeof this.promoteId?this.promoteId:this.promoteId[t];if(null!=r)if(Array.isArray(r)){if(!this.promoteIdExpression){const e=Es(r);if("success"!==e.result){return void Tt(`Failed to create expression for promoteId: ${e.value.map(e=>`${e.key}: ${e.message}`).join(", ")}`)}this.promoteIdExpression=e.value}i=this.promoteIdExpression.evaluate({zoom:0},e)}else i=e.properties[r];"boolean"==typeof i&&(i=Number(i))}return i}},"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const MA={circle:class extends Jl{constructor(e,t,i,r){super(e,{layout:wv||(wv=new wl({"circle-sort-key":new yl(El.layout_circle["circle-sort-key"]),"circle-elevation-reference":new gl(El.layout_circle["circle-elevation-reference"]),visibility:new gl(El.layout_circle.visibility)})),paint:Ev||(Ev=new wl({"circle-radius":new yl(El.paint_circle["circle-radius"]),"circle-color":new yl(El.paint_circle["circle-color"]),"circle-blur":new yl(El.paint_circle["circle-blur"]),"circle-opacity":new yl(El.paint_circle["circle-opacity"]),"circle-translate":new gl(El.paint_circle["circle-translate"]),"circle-translate-anchor":new gl(El.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new gl(El.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new gl(El.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new yl(El.paint_circle["circle-stroke-width"]),"circle-stroke-color":new yl(El.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new yl(El.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new gl(El.paint_circle["circle-emissive-strength"]),"circle-color-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"}),"circle-stroke-color-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r)}createBucket(e){return new $d(e)}queryRadius(e){const t=e;return yv("circle-radius",this,t)+yv("circle-stroke-width",this,t)+xv(this.paint.get("circle-translate"))}queryIntersectsFeature(e,t,i,r,n,o,a,s){const l=bv(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),c=this.paint.get("circle-radius").evaluate(t,i)+this.paint.get("circle-stroke-width").evaluate(t,i);return Tv(e,r,o,a,s,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),l,c)}getProgramIds(){return["circle"]}getDefaultProgramParams(e,t,i){const r=Sv(this);return{config:new Bh(this,{zoom:t,lut:i}),defines:r,overrideFog:!1}}
vendor: 5,728 bytes, line 2
2is3D(e){return!e&&!!this.layout&&"none"!==this.layout.get("circle-elevation-reference")}hasElevation(){return this.layout&&"none"!==this.layout.get("circle-elevation-reference")}mayUse(e){return"HD"===e&&Ql(this,"circle-elevation-reference",e=>"hd-road-markup"===e)}prepare(){return this.mayUse("HD")?gv():Promise.resolve()}},heatmap:class extends Jl{createBucket(e){return new Rv(e)}constructor(e,t,i,r){super(e,{layout:zv||(zv=new wl({visibility:new gl(El.layout_heatmap.visibility)})),paint:Lv||(Lv=new wl({"heatmap-radius":new yl(El.paint_heatmap["heatmap-radius"]),"heatmap-weight":new yl(El.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new gl(El.paint_heatmap["heatmap-intensity"]),"heatmap-color":new xl(El.paint_heatmap["heatmap-color"]),"heatmap-opacity":new gl(El.paint_heatmap["heatmap-opacity"]),"heatmap-color-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"heatmap-color"===e&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Ov({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(e){return yv("heatmap-radius",this,e)}queryIntersectsFeature(e,t,i,r,n,o,a,s){const l=this.paint.get("heatmap-radius").evaluate(t,i);return Tv(e,r,o,a,s,!0,!0,new ke(0,0),l)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(e,t,i){return"heatmap"===e?{config:new Bh(this,{zoom:t,lut:i}),overrideFog:!1}:{}}},hillshade:class extends Jl{constructor(e,t,i,r){super(e,{layout:Bv||(Bv=new wl({visibility:new gl(El.layout_hillshade.visibility)})),paint:kv||(kv=new wl({"hillshade-illumination-direction":new gl(El.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new gl(El.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new gl(El.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new gl(El.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new gl(El.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new gl(El.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new gl(El.paint_hillshade["hillshade-emissive-strength"]),"hillshade-shadow-color-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"}),"hillshade-highlight-color-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"}),"hillshade-accent-color-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r)}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(e,t,i){return{overrideFog:!1}}},fill:class extends Jl{constructor(e,t,i,r){super(e,{layout:Vv||(Vv=new wl({"fill-sort-key":new yl(El.layout_fill["fill-sort-key"]),visibility:new gl(El.layout_fill.visibility),"fill-elevation-reference":new gl(El.layout_fill["fill-elevation-reference"]),"fill-construct-bridge-guard-rail":new yl(El.layout_fill["fill-construct-bridge-guard-rail"])})),paint:Nv||(Nv=new wl({"fill-antialias":new gl(El.paint_fill["fill-antialias"]),"fill-opacity":new yl(El.paint_fill["fill-opacity"]),"fill-color":new yl(El.paint_fill["fill-color"]),"fill-outline-color":new yl(El.paint_fill["fill-outline-color"]),"fill-translate":new gl(El.paint_fill["fill-translate"]),"fill-translate-anchor":new gl(El.paint_fill["fill-translate-anchor"]),"fill-pattern":new yl(El.paint_fill["fill-pattern"]),"fill-pattern-cross-fade":new gl(El.paint_fill["fill-pattern-cross-fade"]),"fill-emissive-strength":new gl(El.paint_fill["fill-emissive-strength"]),"fill-z-offset":new yl(El.paint_fill["fill-z-offset"]),"fill-bridge-guard-rail-color":new yl(El.paint_fill["fill-bridge-guard-rail-color"]),"fill-tunnel-structure-color":new yl(El.paint_fill["fill-tunnel-structure-color"]),"fill-color-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"}),"fill-outline-color-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"}),"fill-bridge-guard-rail-color-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"}),"fill-tunnel-structure-color-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r)}getProgramIds(){const e=this.paint.get("fill-pattern"),t=e&&e.constantOr(1),i=[t?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&i.push(t&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),i}getDefaultProgramParams(e,t,i){return{config:new Bh(this,{zoom:t,lut:i}),overrideFog:!1}}recalculate(e,t){super.recalculate(e,t);const i=this.paint._values["fill-outline-color"];"constant"===i.value.kind&&void 0===i.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new $h(e)}queryRadius(){return xv(this.paint.get("fill-translate"))}queryIntersectsFeature(e,t,i,r,n,o){return!e.queryGeometry.isAboveHorizon&&ld(vv(e.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),r)}
vendor: 10,894 bytes, line 2
2isTileClipped(){return 0===this.paint.get("fill-z-offset").constantOr(1)}is3D(e){if(0!==this.paint.get("fill-z-offset").constantOr(1))return!0;const t=this.layout&&"none"!==this.layout.get("fill-elevation-reference");return null!=e?t&&!e:t}hasElevation(){return this.layout&&"none"!==this.layout.get("fill-elevation-reference")}mayUse(e){return"HD"===e&&Ql(this,"fill-elevation-reference",e=>"none"!==e)}prepare(){return this.mayUse("HD")?gv():Promise.resolve()}hasShadowPass(){return this.layout&&"none"!==this.layout.get("fill-elevation-reference")}},"fill-extrusion":class extends Jl{constructor(e,t,i,r){super(e,{layout:Gv||(Gv=new wl({visibility:new gl(El["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new gl(El["layout_fill-extrusion"]["fill-extrusion-edge-radius"]),"source-max-zoom":new gl(El["layout_fill-extrusion"]["source-max-zoom"])})),paint:Hv||(Hv=new wl({"fill-extrusion-opacity":new gl(El["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new yl(El["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new gl(El["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new gl(El["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new yl(El["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-pattern-cross-fade":new gl(El["paint_fill-extrusion"]["fill-extrusion-pattern-cross-fade"]),"fill-extrusion-height":new yl(El["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new yl(El["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new gl(El["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new gl(El["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new gl(El["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new gl(El["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new gl(El["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new gl(El["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new gl(El["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new gl(El["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new gl(El["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new gl(El["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new yl(El["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new yl(El["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new gl(El["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new gl(El["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new gl(El["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new gl(El["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-front-cutoff":new gl(El["paint_fill-extrusion"]["fill-extrusion-front-cutoff"]),"fill-extrusion-emissive-strength":new yl(El["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new yl(El["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new gl(El["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]),"fill-extrusion-color-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"}),"fill-extrusion-flood-light-color-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(e){return new Nx(e)}queryRadius(){return xv(this.paint.get("fill-extrusion-translate"))}is3D(e){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(e,t,i,r,n,o,a,s,l){const c=bv(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),u=this.paint.get("fill-extrusion-height").evaluate(t,i),h=this.paint.get("fill-extrusion-base").evaluate(t,i),d=[0,0],p=s&&o.elevation,f=o.elevation?o.elevation.exaggeration():1,m=e.tile.getBucket(this);if(m instanceof Nx){const e=m.centroidData.find(e=>l>=e.vertexArrayOffset&&l<e.vertexArrayOffset+e.vertexCount);if(e&&e.flags&Sx)return!1;if(p){const e=m.centroidVertexArray,t=l+1;t<e.length&&(d[0]=e.geta_centroid_pos0(t),d[1]=e.geta_centroid_pos1(t))}}if(0===d[0]&&1===d[1])return!1;"globe"===o.projection.name&&(r=Qx([r],[new ke(0,0),new ke(co,co)],e.tileID.canonical).map(e=>e.polygon).flat());const _=p?s:null,[g,y]=Qv(o,r,h,u,c,a,_,d,f,o.center.lat,e.tileID.canonical),x=e.queryGeometry;return Jv(g,y,x.isPointQuery()?x.screenBounds:x.screenGeometry)}},building:class extends Jl{constructor(e,t,i,r){super(e,{layout:$v||($v=new wl({visibility:new gl(El.layout_building.visibility),"building-facade":new yl(El.layout_building["building-facade"]),"building-facade-floors":new yl(El.layout_building["building-facade-floors"]),"building-facade-unit-width":new yl(El.layout_building["building-facade-unit-width"]),"building-facade-window":new yl(El.layout_building["building-facade-window"]),"building-roof-shape":new yl(El.layout_building["building-roof-shape"]),"building-height":new yl(El.layout_building["building-height"]),"building-base":new yl(El.layout_building["building-base"]),"building-flood-light-wall-radius":new yl(El.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new yl(El.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new yl(El.layout_building["building-flip-roof-orientation"])})),paint:Wv||(Wv=new wl({"building-opacity":new gl(El.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new gl(El.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new gl(El.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new gl(El.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new gl(El.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new gl(El.paint_building["building-vertical-scale"]),"building-cast-shadows":new gl(El.paint_building["building-cast-shadows"]),"building-color":new yl(El.paint_building["building-color"]),"building-emissive-strength":new yl(El.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new gl(El.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new gl(El.paint_building["building-cutoff-fade-range"]),"building-front-cutoff":new gl(El.paint_building["building-front-cutoff"]),"building-flood-light-color":new gl(El.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new gl(El.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new gl(El.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}mayUse(e){return"HD"===e}prepare(){return async function(){return function(){if(!Ct(self))return null;if(null!=cv||null!=lv)return null;if(null!=sv)return sv;const e=fetch(vi());return sv=function(e){let t,i,r,n,o;function a(){t=new Uint8Array(o.buffer),i=new Int16Array(o.buffer),r=new Int32Array(o.buffer),n=new Float32Array(o.buffer)}function s(){throw new Error("Unexpected BuildingGen error.")}const l=()=>{},c={a:{a:s,f:function(e){const i=t.length,r=Math.max(e>>>0,Math.ceil(1.2*i)),n=Math.ceil((r-i)/65536);try{return o.grow(n),a(),!0}catch(e){return!1}},g:s,b:l,c:l,d:l,e:l}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(e,c):e.then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,c))).then(e=>{const s=e.instance.exports;return(0,s.g)(),o=s.f,a(),new iv({setStyle:s.h,setAOOptions:s.i,setMetricOptions:s.j,setStructuralOptions:s.k,setFacadeOptions:s.l,setFauxFacadeOptions:s.m,setFacadeClassifierOptions:s.n,addFeature:s.o,addFacade:s.p,generateMesh:s.q,getLastError:s.r,getOuterRingLength:s.s,getMeshCount:s.t,getPositionsPtr:s.u,getPositionsLength:s.v,getNormalsPtr:s.w,getNormalsLength:s.x,getAOPtr:s.y,getAOLength:s.z,getUVPtr:s.A,getUVLength:s.B,getFauxFacadePtr:s.C,getFauxFacadeLength:s.D,getIndicesPtr:s.E,getIndicesLength:s.F,getBuildingPart:s.G,getRingCount:s.H,getRingPtr:s.I,getRingLength:s.J,malloc:s.K,free:s.L,heapU8:t,heap16:i,heap32:r,heapF32:n})})}(e).then(e=>{sv=null,cv=e}).catch(e=>{Tt("Could not load building-gen"),sv=null,lv=e}),sv}()}()}createBucket(e){return new dv(e)}cutoffRange(){return this.paint.get("building-cutoff-fade-range")}hasShadowPass(){return this.paint.get("building-cast-shadows")}hasLightBeamPass(){return!0}canCastShadows(){return!0}is3D(e){return!0}queryRadius(e){return 0}queryIntersectsFeature(e,t,i,r,n,o,a,s,l,c){let u=this.layout.get("building-height").evaluate(t,i);const h=this.layout.get("building-base").evaluate(t,i),d=e.tile.getBucket(this).getFootprint(t);if(d){if(0!==d.hiddenFlags)return!1;u=d.height}const[p,f]=Qv(o,r,h,u,new ke(0,0),a,null,[0,0],1,o.center.lat,e.tileID.canonical),m=e.queryGeometry;return Jv(p,f,m.isPointQuery()?m.screenBounds:m.screenGeometry)}},line:class extends Jl{constructor(e,t,i,r){const n=cb();super(e,n,t,i,r),n.layout&&(this.layout=new _l(n.layout)),this.gradientVersion=0,this.borderGradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1,this.lineBlendFbos=null,this.lineBlendDensityReadback=null}_handleSpecialPaintPropertyUpdate(e){if("line-gradient"===e){const e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof la,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}
vendor: 5,571 bytes, line 2
2else if("line-gradient-use-theme"===e)this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER;else if("line-border-gradient"===e){const e=this._transitionablePaint._values["line-border-gradient"].value.expression;this.borderStepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof la,this.borderGradientVersion=(this.borderGradientVersion+1)%Number.MAX_SAFE_INTEGER}else"line-border-gradient-use-theme"===e&&(this.borderGradientVersion=(this.borderGradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}borderGradientExpression(){return this._transitionablePaint._values["line-border-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}emissiveStrengthExpression(){return this._transitionablePaint._values["line-emissive-strength"].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values["line-floorwidth"]=(()=>{if(hb)return hb;const e=cb();return hb=new ub(e.paint.properties["line-width"].specification),hb.useIntegerZoom=!0,hb})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new Nd(e)}getProgramIds(){const e=[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"];return"default"!==this.paint.get("line-blend-mode")&&e.push("lineBlendComposite"),e}getDefaultProgramParams(e,t,i){if("lineBlendComposite"===e)return{};const r=ab(this);return{config:new Bh(this,{zoom:t,lut:i}),defines:r,overrideFog:!1}}queryRadius(e){const t=e,i=mb(yv("line-width",this,t),yv("line-gap-width",this,t)),r=yv("line-offset",this,t);return i/2+Math.abs(r)+xv(this.paint.get("line-translate"))}queryIntersectsFeature(e,t,i,r,n,o){if(e.queryGeometry.isAboveHorizon)return!1;const a=vv(e.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),s=e.pixelToTileUnitsFactor/2*mb(this.paint.get("line-width").evaluate(t,i),this.paint.get("line-gap-width").evaluate(t,i)),l=this.paint.get("line-offset").evaluate(t,i);return l&&(r=function(e,t){const i=[],r=new ke(0,0);for(let n=0;n<e.length;n++){const o=e[n],a=[];for(let e=0;e<o.length;e++){const i=o[e],n=o[e+1],s=0===e?r:i.sub(o[e-1])._unit()._perp(),l=e===o.length-1?r:n.sub(i)._unit()._perp(),c=s._add(l)._unit();c._mult(1/(c.x*l.x+c.y*l.y)),a.push(c._mult(t)._add(i))}i.push(a)}return i}(r,l*e.pixelToTileUnitsFactor)),function(e,t,i){for(let r=0;r<t.length;r++){const n=t[r];if(e.length>=3)for(let t=0;t<n.length;t++)if(gd(e,n[t]))return!0;if(cd(e,n,i))return!0}return!1}(a,r,s)}isTileClipped(){return this.hasNonElevatedBuckets}isDraped(e){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")}mayUse(e){return"HD"===e?Ql(this,"line-elevation-reference",e=>"hd-road-markup"===e):"Lite"===e&&function(e){if(!e._unevaluatedLayout)return!1;const t=e._unevaluatedLayout.getValue("line-elevation-reference");if(void 0!==t&&("string"!=typeof t||"none"!==t))return!0;const i=e._unevaluatedLayout.getValue("line-z-offset");return void 0!==i&&("number"!=typeof i||0!==i)}(this)}prepare(){return this.mayUse("HD")?gv():Promise.resolve()}hasOffscreenPass(){return"default"!==this.paint.get("line-blend-mode")&&0!==this.paint.get("line-opacity").constantOr(1)&&0!==this.paint.get("line-width").constantOr(1)&&"none"!==this.visibility}resize(){this._destroyLineBlendFbo()}onRemove(e){this._destroyLineBlendFbo(e.painter&&e.painter.context&&e.painter.context.gl||void 0)}_clear(){this._destroyLineBlendFbo()}_destroyLineBlendFbo(e){this.lineBlendFbos&&(this.lineBlendFbos.destroy(),this.lineBlendFbos=null),e&&this.lineBlendDensityReadback&&this.lineBlendDensityReadback.destroy(e),this.lineBlendDensityReadback=null}},symbol:bb,background:class extends Jl{constructor(e,t,i,r){super(e,{layout:wb||(wb=new wl({visibility:new gl(El.layout_background.visibility)})),paint:Eb||(Eb=new wl({"background-pitch-alignment":new gl(El.paint_background["background-pitch-alignment"]),"background-color":new gl(El.paint_background["background-color"]),"background-pattern":new gl(El.paint_background["background-pattern"]),"background-opacity":new gl(El.paint_background["background-opacity"]),"background-emissive-strength":new gl(El.paint_background["background-emissive-strength"]),"background-color-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(e,t,i){return{overrideFog:!1}}is3D(e){return"viewport"===this.paint.get("background-pitch-alignment")}},raster:Db,"raster-particle":Bb,sky:class extends Jl{constructor(e,t,i,r){super(e,{layout:Cb||(Cb=new wl({visibility:new gl(El.layout_sky.visibility)})),paint:Rb||(Rb=new wl({"sky-type":new gl(El.paint_sky["sky-type"]),"sky-atmosphere-sun":new gl(El.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new gl(El.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new gl(El.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new gl(El.paint_sky["sky-gradient-radius"]),"sky-gradient":new xl(El.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new gl(El.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new gl(El.paint_sky["sky-atmosphere-color"]),"sky-opacity":new gl(El.paint_sky["sky-opacity"]),"sky-gradient-use
2-theme":new yl({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r),this._updateColorRamp()}_clear(){this.skyboxFbo&&(this.skyboxFbo.destroy(),this.skyboxFbo=null),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this._skyboxInvalidated=!0}_handleSpecialPaintPropertyUpdate(e){"sky-gradient"===e?this._updateColorRamp():"sky-atmosphere-sun"!==e&&"sky-atmosphere-halo-color"!==e&&"sky-atmosphere-color"!==e&&"sky-atmosphere-sun-intensity"!==e||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=Ov({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(e){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const t=e.style.light.properties.get("position");return this._lightPosition.azimuthal!==t.azimuthal||this._lightPosition.polar!==t.polar}return!1}getCenter(e,t){if("atmosphere"===this.paint.get("sky-type")){const i=this.paint.get("sky-atmosphere-sun"),r=!i,n=e.style.light,o=n.properties.get("position");return r&&"viewport"===n.properties.get("anchor")&&Tt("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),r?Vb(o.azimuthal,90-o.polar,t):Vb(i[0],90-i[1],t)}const i=this.paint.get("sky-gradient-center");return Vb(i[0],90-i[1],t)}isSky(){return!0}markSkyboxValid(e){this._skyboxInvalidated=!1,this._lightPosition=e.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const e=this.paint.get("sky-type");return"atmosphere"===e?["skyboxCapture","skybox"]:"gradient"===e?["skyboxGradient"]:null}},slot:class extends Jl{constructor(e,t,i,r){super(e,{paint:zb||(zb=new wl({}))},t,null)}},"placement-group":class extends Jl{constructor(e,t,i,r){super(e,{paint:Lb||(Lb=new wl({}))},t,i,r)}},model:class extends Jl{constructor(e,t,i,r){super(e,{layout:Fb||(Fb=new wl({visibility:new gl(El.layout_model.visibility),"model-id":new yl(El.layout_model["model-id"]),"model-allow-density-reduction":new gl(El.layout_model["model-allow-density-reduction"])})),paint:Ob||(Ob=new wl({"model-opacity":new yl(El.paint_model["model-opacity"]),"model-rotation":new yl(El.paint_model["model-rotation"]),"model-scale":new yl(El.paint_model["model-scale"]),"model-translation":new yl(El.paint_model["model-translation"]),"model-color":new yl(El.paint_model["model-color"]),"model-color-mix-intensity":new yl(El.paint_model["model-color-mix-intensity"]),"model-type":new gl(El.paint_model["model-type"]),"model-cast-shadows":new gl(El.paint_model["model-cast-shadows"]),"model-receive-shadows":new gl(El.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new gl(El.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new yl(El.paint_model["model-emissive-strength"]),"model-roughness":new yl(El.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new yl(El.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new gl(El.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new gl(El.paint_model["model-front-cutoff"]),"model-elevation-reference":new gl(El.paint_model["model-elevation-reference"]),"model-line-cutout-mode":new gl(El.paint_model["model-line-cutout-mode"]),"model-color-use-theme":new yl({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r),this.layer=e,this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}mayUse(e){return"Standard"===e}prepare(){return async function(){return Promise.resolve()}()}createBucket(e){return new jb(e)}getProgramIds(){return["model"]}is3D(e){return!0}hasShadowPass(){return this.paint.get("model-cast-shadows")}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(e){return e.isTiled3dModelBucket?8191:0}queryRenderedFeatures(e,t,i){return SA.queryModelLayerRendered?SA.queryModelLayerRendered(this,e,t,i):{}}queryIntersectsFeature(e,t,i,r,n,o,a,s,l,c){return!!SA.queryModelLayerIntersectsFeature&&SA.queryModelLayerIntersectsFeature(this,e,t,i,o,c)}_handleOverridablePaintPropertyUpdate(e,t,i){return!(!this.layout||t.isDataDriven()||i.isDataDriven()||"model-color"!==e&&"model-color-mix-intensity"!==e&&"model-rotation"!==e&&"model-scale"!==e&&"model-translation"!==e&&"model-emissive-strength"!==e)}_isPropertyZoomDependent(e){const t=this._transitionablePaint._values[e];return null!=t&&null!=t.value&&null!=t.value.expression&&t.value.expression instanceof Ss}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}},clip:class extends Jl{constructor(e,t,i,r){super(e,{layout:Uv||(Uv=new wl({"clip-layer-types":ne
vendor: 7,600 bytes, line 2
2w gl(El.layout_clip["clip-layer-types"]),"clip-layer-scope":new gl(El.layout_clip["clip-layer-scope"]),visibility:new gl(El.layout_clip.visibility)})),paint:jv||(jv=new wl({}))},t,i,r)}recalculate(e,t){super.recalculate(e,t)}createBucket(e){return new Xv(e)}is3D(e){return!0}}};function PA(e,t,i,r){return"custom"===e.type?new kb(e,t):new MA[e.type](e,t,i,r)}class CA{constructor(e){this._layer=e,this._filterDependencies=void 0}invalidateFilter(){this._filterDependencies=void 0}get _filterDeps(){return void 0===this._filterDependencies&&(this._filterDependencies=this._computeFilterDependencies()),this._filterDependencies}_computeFilterDependencies(){const e=this._layer;if(!e.type||"custom"===e.type||"background"===e.type||"sky"===e.type||"slot"===e.type||"placement-group"===e.type)return null;const t=Es(e.filter,El[`filter_${e.type}`]);return"error"===t.result?null:{configDependencies:t.value.configDependencies,isIndoorDependent:t.value.isIndoorDependent}}hasConfigDependency(e){const{_unevaluatedLayout:t,_transitionablePaint:i}=this._layer;if(t&&t.configDependencies.has(e))return!0;if(i&&i.configDependencies.has(e))return!0;const r=this._filterDeps;return!!r&&r.configDependencies.has(e)}get isConfigDependent(){const{_unevaluatedLayout:e,_transitionablePaint:t}=this._layer;if(e&&0!==e.configDependencies.size)return!0;if(t&&0!==t.configDependencies.size)return!0;const i=this._filterDeps;return!!i&&0!==i.configDependencies.size}get isIndoorDependent(){const{_unevaluatedLayout:e,_transitionablePaint:t}=this._layer;if(e&&e.isIndoorDependent())return!0;if(t&&t.isIndoorDependent())return!0;const i=this._filterDeps;return!!i&&i.isIndoorDependent}}function RA(e){const{userImage:t}=e;return!!(t&&t.render&&t.render())&&(e.data.replace(new Uint8Array(t.data.buffer)),!0)}const zA=new Zr(0,0,0);function LA(e,t){const i=[],r=e[`stretch_${t}`];let n=null;for(let o=0;o<r.length;o++)null===n?n=0===i.length?r[0]:i.at(-1)[1]+r[o]:(i.push([n,n+r[o]]),n=null);e[`stretch_${t}_areas`]=i}function FA(e,t){const i={name:void 0};let r;for(;r=e.nextField(t);)1===r?i.name=e.readString():2===r?i.metadata=OA(e,e.readVarint()+e.pos):3===r&&(i.usvg_tree=VA(e,e.readVarint()+e.pos),i.data="usvg_tree");return function(e){if(e.usvg_tree.height||(e.usvg_tree.height=e.usvg_tree.width),!e.metadata)return e;const{metadata:t}=e;if(t.content_area){const{content_area:i}=t;i.left??=0,i.top??=i.left,i.width??=e.usvg_tree.width,i.height??=i.width}if(t.text_placeholder){const{text_placeholder:e}=t;e.top??=e.left,e.height??=e.width}return t.stretch_x&&t.stretch_x.length&&LA(t,"x"),t.stretch_y&&t.stretch_y.length&&LA(t,"y"),e}(i)}function OA(e,t){const i={stretch_x:null,stretch_y:null,stretch_x_areas:null,stretch_y_areas:null,variables:[]};let r;for(;r=e.nextField(t);)1===r?i.stretch_x=e.readPackedVarint():2===r?i.stretch_y=e.readPackedVarint():3===r?i.content_area=BA(e,e.readVarint()+e.pos):4===r?i.variables.push(kA(e,e.readVarint()+e.pos)):5===r&&(i.text_placeholder=BA(e,e.readVarint()+e.pos));return i}function BA(e,t){const i={};let r;for(;r=e.nextField(t);)1===r?i.left=e.readVarint():2===r?i.width=e.readVarint():3===r?i.top=e.readVarint():4===r&&(i.height=e.readVarint());return i}function kA(e,t){const i={name:void 0};let r;for(;r=e.nextField(t);)1===r?i.name=e.readString():2===r&&(i.rgb_color=WA(e.readVarint()),i.value="rgb_color");return i}function VA(e,t){const i={width:20,children:[],linear_gradients:[],radial_gradients:[],clip_paths:[],masks:[],height:20};let r;for(;r=e.nextField(t);)1===r?i.width=i.height=e.readVarint():2===r?i.height=e.readVarint():3===r?i.children.push(NA(e,e.readVarint()+e.pos)):4===r?i.linear_gradients.push(qA(e,e.readVarint()+e.pos)):5===r?i.radial_gradients.push(XA(e,e.readVarint()+e.pos)):7===r?i.clip_paths.push(YA(e,e.readVarint()+e.pos)):8===r&&i.masks.push(KA(e,e.readVarint()+e.pos));return i}function NA(e,t){const i={};let r;for(;r=e.nextField(t);)1===r?(i.group=UA(e,e.readVarint()+e.pos),i.node="group"):2===r&&(i.path=GA(e,e.readVarint()+e.pos),i.node="path");return i}function UA(e,t){const i={opacity:255,children:[]};let r;for(;r=e.nextField(t);)1===r?i.transform=jA(e,e.readVarint()+e.pos):2===r?i.opacity=e.readVarint():5===r?i.clip_path_idx=e.readVarint():6===r?i.mask_idx=e.readVarint():7===r&&i.children.push(NA(e,e.readVarint()+e.pos));return i}function jA(e,t){const i={sx:1,ky:0,kx:0,sy:1,tx:0,ty:0};let r;for(;r=e.nextField(t);)1===r?i.sx=e.readFloat():2===r?i.ky=e.readFloat():3===r?i.kx=e.readFloat():4===r?i.sy=e.readFloat():5===r?i.tx=e.readFloat():6===r&&(i.ty=e.readFloat());return i}function GA(e,t){const i={paint_order:1,commands:[],step:1,diffs:[],rule:1};let r;for(;r=e.nextField(t);)1===r?i.fill=HA(e,e.readVarint()+e.pos):2===r?i.stroke=$A(e,e.readVarint()+e.pos):3===r?i.paint_order=e.readVarint():5===r?e.readPackedVarint(i.commands):6===r?i.step=e.readFloat():7===r?e.readPackedSVarint(i.diffs):8===r&&(i.rule=e.readVarint());return i}function HA(e,t){const i={rgb_color:zA,paint:"rgb_color",opacity:255};let r;for(;r=e.nextField(t);)1===r?(i.rgb_color=WA(e.readVarint()),i.paint="rgb_color"):2===r?(i.linear_gradient_idx=e.readVarint(),i.paint="linear_gradient_idx"):3===r?(i.radial_gradient_idx=e.readVarint(),i.paint="radial_gradient_idx"):5===r&&(i.opacity=e.readVarint());return i}function $A(e,t){const i={rgb_color:zA,paint:"rgb_color",dasharray:[],dashoffset:0,miterlimit:4,opacity:255,width:1,linecap:1,linejoin:1};let r;for(;r=e.nextField(t);)1===r?(i.rgb_color=WA(e.readVarint()),i.paint="rgb_color"):2===r?(i.linear_gradient_idx=e.readVarint(),i.paint="linear_gradient_idx"):3===r?(i.radial_gradient_idx=e.readVarint(),i.paint="radial_gradient_idx"):5===r?e.readPackedFloat(i.dasharray):6===r?i.dashoffset=e.readFloat():7===r?i.miterlimit=e.readFloat():8===r?i.opacity=e.readVarint():9===r?i.width=e.readFloat():10===r?i.linecap=e.readVarint():11===r&&(i.linejoin=e.readVarint());return i}function WA(e){return new Zr((e>>16&255)/255,(e>>8&255)/255,(255&e)/255,1)}function qA(e,t){const i={spread_method:1,stops:[],x1:0,y1:0,x2:1,y2:0};let r;for(;r=e.nextField(t);)1===r?i.transform=jA(e,e.readVarint()+e.pos):2===r?i.spread_method=e.readVarint():3===r?i.stops.push(ZA(e,e.readVarint()+e.pos)):4===r?i.x1=e.readFloat():5===r?i.y1=e.readFloat():6===r?i.x2=e.readFloat():7===r&&(i.y2=e.readFloat());return i}function ZA(e,t){const i={offset:0,opacity:255,rgb_color:zA};let r;for(;r=e.nextField(t);)1===r?i.offset=e.readFloat():2===r?i.opacity=e.readVarint():3===r&&(i.rgb_color=WA(e.readVarint()));return i}function XA(e,t){const i={spread_method:1,stops:[],cx:.5,cy:.5,r:.5,fx:.5,fy:.5,fr:0};let r;for(;r=e.nextField(t);)1===r?i.transform=jA(e,e.readVarint()+e.pos):2===r?i.spread_method=e.readVarint():3===r?i.stops.push(ZA(e,e.readVarint()+e.pos)):4===r?i.cx=e.readFloat():5===r?i.cy=e.readFloat():6===r?i.r=e.readFloat():7===r?i.fx=e.readFloat():8===r?i.fy=e.readFloat():9===r&&(i.fr=e.readFloat());return i}function YA(e,t){const i={children:[]};let r;for(;r=e.nextField(t);)1===r?i.transform=jA(e,e.readVarint()+e.pos):2===r?i.clip_path_idx=e.readVarint():3===r&&i.children.push(NA(e,e.readVarint()+e.pos));return i}function KA(e,t){const i={left:0,width:20,mask_type:1,children:[]};let r;for(;r=e.nextField(t);)1===r?i.left=i.top=e.readFloat():2===r?i.width=i.height=e.readFloat():3===r?i.top=e.readFloat():4===r?i.height=e.readFloat():5===r?i.mask_type=e.readVarint():6===r?i.mask_idx=e.readVarint():7===r&&i.children.push(NA(e,e.readVarint()+e.pos));return i.height??=i.width,i.top??=i.left,i}class JA{static calculate(e={},t=[]){const i=new Map,r=new Map;if(0===Object.keys(e).length)return i;
vendor: 4,453 bytes, line 2
2t.forEach(e=>{r.set(e.name,e.rgb_color||new Zr(0,0,0))});for(const[n,o]of Object.entries(e))r.has(n)?i.set(r.get(n).toString(),o):console.warn(`Ignoring unknown image variable "${n}"`);return i}}function QA(e,t=255,i){const r=i.get(e.toString())||e;return 255===t?r.toString():new Zr(r.r,r.g,r.b,r.a*t/255).toString()}const eI=[];let tI=0;function iI(e,t){if(tI>=eI.length){const i=Qt()?new OffscreenCanvas(e,t).getContext("2d",{willReadFrequently:!0}):document.createElement("canvas").getContext("2d",{willReadFrequently:!0});eI.push(i)}const i=eI[tI++];return i.canvas.width=e,i.canvas.height=t,i}function rI(){tI--}function nI(e,t,i,r,n){for(const o of r.children)oI(e,t,i,o,n)}function oI(e,t,i,r,n){r.group?(e.save(),function(e,t,i,r,n){const o=null!=r.mask_idx?i.masks[r.mask_idx]:null,a=null!=r.clip_path_idx?i.clip_paths[r.clip_path_idx]:null;if(r.transform&&(t=fI(r.transform).preMultiplySelf(t)),!function(e,t,i){return 255!==e.opacity||t||i}(r,null!=a,null!=o))return void nI(e,t,i,r,n);const s=iI(e.canvas.width,e.canvas.height);nI(s,t,i,r,n),a&&dI(s,t,i,a),o&&pI(s,t,i,o,n),e.globalAlpha=r.opacity/255,e.drawImage(s.canvas,0,0),rI()}(e,t,i,r.group,n),e.restore()):r.path&&(e.save(),function(e,t,i,r,n){e.setTransform(t),1===r.paint_order?(aI(e,i,r,n),lI(e,i,r,n)):(lI(e,i,r,n),aI(e,i,r,n))}(e,t,i,r.path,n),e.restore())}function aI(e,t,i,r){const n=i.fill;if(!n)return;const o=n.opacity/255;switch(e.save(),e.beginPath(),mI(i,e),n.paint){case"rgb_color":e.fillStyle=QA(n.rgb_color,n.opacity,r);break;case"linear_gradient_idx":{const i=t.linear_gradients[n.linear_gradient_idx];i.transform&&e.setTransform(fI(i.transform).preMultiplySelf(e.getTransform())),e.fillStyle=cI(e,i,o,r);break}case"radial_gradient_idx":{const i=t.radial_gradients[n.radial_gradient_idx];i.transform&&e.setTransform(fI(i.transform).preMultiplySelf(e.getTransform())),e.fillStyle=uI(e,i,o,r)}}e.fill(sI(i)),e.restore()}function sI(e){return 1===e.rule?"nonzero":2===e.rule?"evenodd":void 0}function lI(e,t,i,r){const n=i.stroke;if(!n)return;const o=_I(i);e.lineWidth=n.width,e.miterLimit=n.miterlimit,e.setLineDash(n.dasharray),e.lineDashOffset=n.dashoffset;const a=n.opacity/255;switch(n.paint){case"rgb_color":e.strokeStyle=QA(n.rgb_color,n.opacity,r);break;case"linear_gradient_idx":e.strokeStyle=cI(e,t.linear_gradients[n.linear_gradient_idx],a,r,!0);break;case"radial_gradient_idx":e.strokeStyle=uI(e,t.radial_gradients[n.radial_gradient_idx],a,r,!0)}switch(n.linejoin){case 2:case 1:e.lineJoin="miter";break;case 3:e.lineJoin="round";break;case 4:e.lineJoin="bevel"}switch(n.linecap){case 1:e.lineCap="butt";break;case 2:e.lineCap="round";break;case 3:e.lineCap="square"}e.stroke(o)}function cI(e,t,i,r,n=!1){if(1===t.stops.length){const e=t.stops[0];return QA(e.rgb_color,e.opacity*i,r)}const{x1:o,y1:a,x2:s,y2:l}=t;let c=new DOMPoint(o,a),u=new DOMPoint(s,l);if(n){const e=fI(t.transform);c=e.transformPoint(c),u=e.transformPoint(u)}const h=e.createLinearGradient(c.x,c.y,u.x,u.y);for(const d of t.stops)h.addColorStop(d.offset,QA(d.rgb_color,d.opacity*i,r));return h}function uI(e,t,i,r,n=!1){if(1===t.stops.length){const e=t.stops[0];return QA(e.rgb_color,e.opacity*i,r)}const o=fI(t.transform),{fx:a,fy:s,fr:l,cx:c,cy:u,r:h}=t;let d=new DOMPoint(a,s),p=new DOMPoint(c,u),f=l,m=h;if(n){d=o.transformPoint(d),p=o.transformPoint(p);const e=(o.a+o.d)/2;f=l*e,m=t.r*e}const _=e.createRadialGradient(d.x,d.y,f,p.x,p.y,m);for(const g of t.stops)_.addColorStop(g.offset,QA(g.rgb_color,g.opacity*i,r));return _}function hI(e,t,i,r){const n=r.transform?fI(r.transform).preMultiplySelf(t):t,o=iI(e.canvas.width,e.canvas.height);for(const s of r.children)if(s.group)hI(o,n,i,s.group);else if(s.path){const e=s.path,t=new Path2D;t.addPath(_I(e),n),o.fill(t,sI(e))}const a=null!=r.clip_path_idx?i.clip_paths[r.clip_path_idx]:null;a&&dI(o,n,i,a),e.globalCompositeOperation="source-over",e.drawImage(o.canvas,0,0),rI()}function dI(e,t,i,r){const n=iI(e.canvas.width,e.canvas.height);hI(n,t,i,r),e.globalCompositeOperation="destination-in",e.drawImage(n.canvas,0,0),rI()}function pI(e,t,i,r,n){if(0===r.children.length)return;const o=null!=r.mask_idx?i.masks[r.mask_idx]:null;o&&pI(e,t,i,o,n);const a=e.canvas.width,s=e.canvas.height,l=iI(a,s),c=r.width,u=r.height,h=r.left,d=r.top,p=new Path2D,f=new Path2D;f.rect(h,d,c,u),p.addPath(f,t),l.clip(p);for(const g of r.children)oI(l,t,i,g,n);const m=l.getImageData(0,0,a,s),_=m.data;if(1===r.mask_type)for(let g=0;g<_.length;
vendor: 17,175 bytes, line 2
2g+=4)_[g+3]=_[g+3]/255*(.2126*_[g]+.7152*_[g+1]+.0722*_[g+2]);l.putImageData(m,0,0),e.globalCompositeOperation="destination-in",e.drawImage(l.canvas,0,0),rI()}function fI(e){return e?new DOMMatrix([e.sx,e.ky,e.kx,e.sy,e.tx,e.ty]):new DOMMatrix}function mI(e,t){const i=e.step;let r=e.diffs[0]*i,n=e.diffs[1]*i;t.moveTo(r,n);for(let o=0,a=2;o<e.commands.length;o++)switch(e.commands[o]){case 1:r+=e.diffs[a++]*i,n+=e.diffs[a++]*i,t.moveTo(r,n);break;case 2:r+=e.diffs[a++]*i,n+=e.diffs[a++]*i,t.lineTo(r,n);break;case 3:{const o=r+e.diffs[a++]*i,s=n+e.diffs[a++]*i;r=o+e.diffs[a++]*i,n=s+e.diffs[a++]*i,t.quadraticCurveTo(o,s,r,n);break}case 4:{const o=r+e.diffs[a++]*i,s=n+e.diffs[a++]*i,l=o+e.diffs[a++]*i,c=s+e.diffs[a++]*i;r=l+e.diffs[a++]*i,n=c+e.diffs[a++]*i,t.bezierCurveTo(o,s,l,c,r,n);break}case 5:t.closePath()}return t}function _I(e){return mI(e,new Path2D)}class gI{constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;const t=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,t),t}put(e,t){this.cache.has(e)?this.cache.delete(e):this.cache.size===this.capacity&&this.cache.delete(this.cache.keys().next().value),this.cache.set(e,t)}delete(e){this.cache.delete(e)}}Rs(gI,"LRUCache");class yI{constructor(){this.cacheMap=new Map,this.cacheDependenciesMap=new Map}static _getImage(e){return new zd(e,e.data)}getFromCache(e,t,i){return this.cacheMap.has(i)||this.cacheMap.set(i,new gI(150)),this.cacheMap.get(i).get(Ul(e.toString(),t))}setInCache(e,t,i,r){this.cacheDependenciesMap.has(r)||this.cacheDependenciesMap.set(r,new Map),this.cacheMap.has(r)||this.cacheMap.set(r,new gI(150));const n=this.cacheDependenciesMap.get(r),o=Ul(e.id.toString(),i);n.get(o)||n.set(o,new Set);const a=this.cacheMap.get(r),s=e.toString();n.get(o).add(s),a.put(Ul(e.toString(),i),t)}removeImagesFromCacheByIds(e,t,i=0){if(!this.cacheMap.has(i)||!this.cacheDependenciesMap.has(i))return;const r=this.cacheMap.get(i),n=this.cacheDependenciesMap.get(i);for(const o of e){const e=Ul(o.toString(),t);if(n.has(e)){for(const t of n.get(e))r.delete(t);n.delete(e)}}}rasterize(e,t,i,r){const n=this.getFromCache(e,i,r);if(n)return n.clone();const o=function(e,t){const i=JA.calculate(t.params,e.metadata?e.metadata.variables:[]),r=e.usvg_tree,n=r.width,o=r.height,a=Math.max(1,Math.round(n*t.sx)),s=Math.max(1,Math.round(o*t.sy)),l=new DOMMatrix([a/n,0,0,s/o,0,0]),c=iI(a,s);nI(c,l,r,r,i);const u=c.getImageData(0,0,a,s);return rI(),u}(t.icon,e),a=yI._getImage(o);return this.setInCache(e,a,i,r),a.clone()}}class xI extends Nr{constructor(e){super(),this.imageProviders=new Map,this.images=new Map,this.updatedImages=new Map,this.callbackDispatchedThisFrame=new Map,this.imageVersions=new Map,this.loaded=new Map,this.requestors=[],this.patterns=new Map,this.patternsInFlight=new Set,this.atlasImage=new Map,this.atlasTexture=new Map,this.imageAtlasCache=new Km,this.dirty=!0,this.spriteFormat=e,this.imageRasterizer=new yI}addScope(e){this.loaded.set(e,!1),this.imageProviders.set(e,new Map),this.images.set(e,new Map),this.updatedImages.set(e,new Set),this.callbackDispatchedThisFrame.set(e,new Set),this.imageVersions.set(e,new Map),this.patterns.set(e,new Map),this.atlasImage.set(e,new zd({width:1,height:1}))}removeScope(e){this.loaded.delete(e),this.imageProviders.delete(e),this.images.delete(e),this.updatedImages.delete(e),this.callbackDispatchedThisFrame.delete(e),this.imageVersions.delete(e),this.patterns.delete(e),this.atlasImage.delete(e);const t=this.atlasTexture.get(e);t&&(t.destroy(),this.atlasTexture.delete(e))}addImageProvider(e,t){this.imageProviders.has(t)||this.imageProviders.set(t,new Map),this.imageProviders.get(t).set(e.id,e)}removeImageProvider(e,t){this.imageProviders.has(t)&&this.imageProviders.get(t).delete(e)}getPendingImageProviders(){const e=[];for(const t of this.imageProviders.values())for(const i of t.values())i.hasPendingRequests()&&e.push(i);return e}isLoaded(){for(const e of this.loaded.keys())if(!this.loaded.get(e))return!1;return!0}setLoaded(e,t){if(this.loaded.get(t)!==e&&(this.loaded.set(t,e),e)){for(const{ids:e,callback:i}of this.requestors)this._notify(e,t,i);this.requestors=[]}}hasImage(e,t){return!!this.getImage(e,t)}getImage(e,t){return this.images.get(t).get(e.toString())}addImage(e,t,i){if(this._validate(e,i)){this.images.get(t).set(e.toString(),i);const r=this.imageVersions.get(t),n=r.get(e.toString())||0;r.set(e.toString(),n+1)}}_validate(e,t){let i=!0;return this._validateStretch(t.stretchX,t.data&&t.data.width)||(this.fire(new Br(new Error(`Image "${e.name}" has invalid "stretchX" value`))),i=!1),this._validateStretch(t.stretchY,t.data&&t.data.height)||(this.fire(new Br(new Error(`Image "${e.name}" has invalid "stretchY" value`))),i=!1),this._validateContent(t.content,t)||(this.fire(new Br(new Error(`Image "${e.name}" has invalid "content" value`))),i=!1),i}_validateStretch(e,t){if(!e)return!0;let i=0;for(const r of e){if(r[0]<i||r[1]<r[0]||t<r[1])return!1;i=r[1]}return!0}_validateContent(e,t){if(!e)return!0;if(4!==e.length)return!1;if(!t.usvg){if(e[0]<0||t.data.width<e[0])return!1;if(e[1]<0||t.data.height<e[1])return!1;if(e[2]<0||t.data.width<e[2])return!1;if(e[3]<0||t.data.height<e[3])return!1}return!(e[2]<e[0]||e[3]<e[1])}updateImage(e,t,i){const r=this.images.get(t).get(e.toString());i.version=r.version+1,this.images.get(t).set(e.toString(),i),this.updatedImages.get(t).add(e);const n=this.imageVersions.get(t),o=n.get(e.toString())||0;n.set(e.toString(),o+1),this.removeFromImageRasterizerCache(e,t)}clearUpdatedImages(e){this.updatedImages.get(e).clear()}removeFromImageRasterizerCache(e,t){"raster"!==this.spriteFormat&&this.imageRasterizer.removeImagesFromCacheByIds([e],t)}removeImage(e,t){const i=this.images.get(t),r=i.get(e.toString());i.delete(e.toString());const n=this.imageVersions.get(t),o=n.get(e.toString())||0;n.set(e.toString(),o+1),this.patterns.get(t).delete(e.toString()),this.removeFromImageRasterizerCache(e,t),r.userImage&&r.userImage.onRemove&&r.userImage.onRemove()}listImages(e){return Array.from(this.images.get(e).keys()).map(e=>Ur.from(e))}getImageVersions(e){return this.imageVersions.get(e)||new Map}hasImageProviderForSource(e,t){const i=this.imageProviders.get(t);if(!i)return!1;for(const r of i.values())if(r.sourceCache.getSource().id===e)return!0;return!1}getImages(e,t,i){const r=[],n=[],o=this.imageProviders.get(t);for(const c of e){if(!c.iconsetId){r.push(c);continue}const e=o.get(c.iconsetId);e&&(this.getImage(c,t)?n.push(c):e.addPendingRequest(c))}if(0===r.length)return void this._notify(n,t,i);let a=!0;const s=!!this.loaded.get(t),l=this.images.get(t);if(!s)for(const c of r)l.has(c.toString())||(a=!1);s||a?this._notify(r,t,i):this.requestors.push({ids:r,scope:t,callback:i})}rasterizeImages(e,t){const i=new Map,{iconTasks:r,patternTasks:n,scope:o}=e;for(const a of[r,n])for(const[e,t]of a.entries()){const r=this.getImage(t.id,o);r&&i.set(e,{image:r,imageVariant:t})}t(null,this._rasterizeImages(o,i))}_rasterizeImages(e,t){const i=new Map;for(const[r,{image:n,imageVariant:o}]of t.entries())i.set(r,this.imageRasterizer.rasterize(o,n,e,0));return i}getUpdatedImages(e){return this.updatedImages.get(e)||new Set}_notify(e,t,i){const r=this.images.get(t),n=new Map;for(const o of e){if(!r.get(o.toString())){if(o.iconsetId)continue;this.fire(new Or("styleimagemissing",{id:o.name}))}const e=r.get(o.toString());if(!e){Tt(`Image "${o.name}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`);continue}const t={data:e.usvg?null:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,usvg:e.usvg,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,hasRenderCallback:Boolean(e.userImage&&e.userImage.render)};e.usvg&&Object.assign(t,{width:e.icon.usvg_tree.width,height:e.icon.usvg_tree.height}),n.set(Ur.toString(o),t)}i(null,{images:n,versions:this.getImageVersions(t)})}getPixelSize(e){const{width:t,height:i}=this.atlasImage.get(e);return{width:t,height:i}}getPattern(e,t,i){const r=e.toString(),n=this.patterns.get(t),o=n.get(r),a=this.getImage(e,t);if(!a)return null;if(o){if(o.position.version===a.version)return o.position;o.position.version=a.version}else{if(a.usvg&&!a.data){const n=this.getPatternInFlightId(r,t);if(this.patternsInFlight.has(n))return null;this.patternsInFlight.add(n);const o=new wn(e).scaleSelf(ei.devicePixelRatio),s=new Map([[o.toString(),{image:a,imageVariant:o}]]),l=this._rasterizeImages(t,s);return this.storePatternImage(o,t,a,i,l),null}this.storePattern(e,t,a)}return this._updatePatternAtlas(t,i),n.get(r).position}getPatternInFlightId(e,t){return Ul(e,t)}hasPatternsInFlight(){return 0!==this.patternsInFlight.size}storePatternImage(e,t,i,r,n){const o=e.toString(),a=n?n.get(o):void 0;a&&(i.data=a,this.storePattern(e.id,t,i),this._updatePatternAtlas(t,r),this.patternsInFlight.delete(this.getPatternInFlightId(e.id.toString(),t)))}storePattern(e,t,i){const r={w:i.data.width+4,h:i.data.height+4,x:0,y:0},n=new Zm(r,i,2);this.patterns.get(t).set(e.toString(),{bin:r,position:n})}destroyAtlasTextures(){for(const e of this.atlasTexture.values())e&&e.destroy();this.atlasTexture.clear()}bind(e,t){const i=e.gl;let r=this.atlasTexture.get(t);r?this.dirty&&(r.update(this.atlasImage.get(t)),this.dirty=!1):(r=new $m(e,this.atlasImage.get(t),i.RGBA8),this.atlasTexture.set(t,r)),r.bind(i.LINEAR,i.CLAMP_TO_EDGE)}_updatePatternAtlas(e,t){const i=this.patterns.get(e),r=Array.from(i.values()).map(({bin:e})=>e),{w:n,h:o}=Bm(r),a=this.atlasImage.get(e);a.resize({width:n||1,height:o||1});const s=this.images.get(e);for(const[l,{bin:c,position:u}]of i.entries()){let e=u.padding;const i=c.x+e,r=c.y+e,n=s.get(l).data,o=n.width,h=n.height;e=e>1?e-1:e,zd.copy(n,a,{x:0,y:0},{x:i,y:r},{width:o,height:h},t),zd.copy(n,a,{x:0,y:h-e},{x:i,y:r-e},{width:o,height:e},t),zd.copy(n,a,{x:0,y:0},{x:i,y:r+h},{width:o,height:e},t),zd.copy(n,a,{x:o-e,y:0},{x:i-e,y:r},{width:e,height:h},t),zd.copy(n,a,{x:0,y:0},{x:i+o,y:r},{width:e,height:h},t),zd.copy(n,a,{x:o-e,y:h-e},{x:i-e,y:r-e},{width:e,height:e},t),zd.copy(n,a,{x:0,y:h-e},{x:i+o,y:r-e},{width:e,height:e},t),zd.copy(n,a,{x:0,y:0},{x:i+o,y:r+h},{width:e,height:e},t),zd.copy(n,a,{x:o-e,y:0},{x:i-e,y:r+h},{width:e,height:e},t)}this.dirty=!0}beginFrame(){for(const e of this.images.keys())this.callbackDispatchedThisFrame.set(e,new Set);this.imageAtlasCache.beginFrame()}dispatchRenderCallbacks(e,t){const i=this.images.get(t);for(const r of e){if(this.callbackDispatchedThisFrame.get(t).has(r.toString()))continue;this.callbackDispatchedThisFrame.get(t).add(r.toString());const e=i.get(r.toString());RA(e)&&this.updateImage(r,t,e)}}}class vI{constructor(e,t,i,r){this.message=(e?`${e}: `:"")+i,r&&(this.identifier=r),null!=t&&t.__line__&&(this.line=t.__line__)}}class bI extends vI{}function wI(e){const t=e.value,i=e.valueSpec,r=e.style,n=e.styleSpec,o=e.key,a=e.arrayElementValidator||XI;if(!Array.isArray(t))return[new vI(o,t,`array expected, ${Ln(t)} found`)];if(i.length&&t.length!==i.length)return[new vI(o,t,`array length ${i.length} expected, length ${t.length} found`)];if(i["min-length"]&&t.length<i["min-length"])return[new vI(o,t,`array length at least ${i["min-length"]} expected, length ${t.length} found`)];let s={type:i.value,values:i.values,minimum:i.minimum,maximum:i.maximum,function:void 0};n.$version<7&&(s.function=i.function),Fn(i.value)&&(s=i.value);let l=[];for(let c=0;c<t.length;c++)l=l.concat(a({array:t,arrayIndex:c,value:t[c],valueSpec:s,style:r,styleSpec:n,key:`${o}[${c}]`},!0));return l}function EI(e){const t=e.key,i=e.value,r=e.valueSpec;if(!Bn(i))return[new vI(t,i,`number expected, ${Ln(i)} found`)];if(i!=i)return[new vI(t,i,"number expected, NaN found")];if("minimum"in r){let n=r.minimum;if(Array.isArray(r.minimum)&&(n=r.minimum[e.arrayIndex]),i<n)return[new vI(t,i,`${i} is less than the minimum value ${n}`)]}if("maximum"in r){let n=r.maximum;if(Array.isArray(r.maximum)&&(n=r.maximum[e.arrayIndex]),i>n)return[new vI(t,i,`${i} is greater than the maximum value ${n}`)]}return[]}function AI(e){const t=e.key,i=e.value;if(!Fn(i))return[new vI(t,i,`object expected, ${Ln(i)} found`)];const r=e.valueSpec,n=Al(i.type);let o,a,s,l={};const c="categorical"!==n&&void 0===i.property,u=!c,h=function(e){const t=e.stops;return Array.isArray(t)&&Array.isArray(t[0])&&Fn(t[0][0])}(i),d=YI({key:e.key,value:e.value,valueSpec:e.styleSpec.function,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if("identity"===n)return[new vI(e.key,e.value,'identity function may not have a "stops" property')];let t=[];const i=e.value;return t=t.concat(wI({key:e.key,value:i,valueSpec:e.valueSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:p})),Array.isArray(i)&&0===i.length&&t.push(new vI(e.key,i,"array must have at least one stop")),t},default:function(e){return XI({key:e.key,value:e.value,valueSpec:r,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===n&&c&&d.push(new vI(e.key,e.value,'missing required property "property"')),"identity"===n||i.stops||d.push(new vI(e.key,e.value,'missing required property "stops"')),"exponential"===n&&r.expression&&!ds(r)&&d.push(new vI(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(u&&!cs(r)?d.push(new vI(e.key,e.value,"property functions not supported")):c&&!hs(r)&&d.push(new vI(e.key,e.value,"zoom functions not supported"))),"categorical"!==n&&!h||void 0!==i.property||d.push(new vI(e.key,e.value,'"property" property is required')),d;function p(e){let t=[];const i=e.value,n=e.key;if(!Array.isArray(i))return[new vI(n,i,`array expected, ${Ln(i)} found`)];if(2!==i.length)return[new vI(n,i,`array length 2 expected, length ${i.length} found`)];if(h){if(!Fn(i[0]))return[new vI(n,i,`object expected, ${Ln(i[0])} found`)];const r=i[0];if(void 0===r.zoom)return[new vI(n,i,"object stop key must have zoom")];if(void 0===r.value)return[new vI(n,i,"object stop key must have value")];const o=Al(r.zoom);if("number"!=typeof o)return[new vI(n,r.zoom,"stop zoom values must be numbers")];if(s&&s>o)return[new vI(n,r.zoom,"stop zoom values must appear in ascending order")];o!==s&&(s=o,a=void 0,l={}),t=t.concat(YI({key:`${n}[0]`,value:i[0],valueSpec:{zoom:{}},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:EI,value:f}}))}else t=t.concat(f({key:`${n}[0]`,value:i[0],style:e.style,styleSpec:e.styleSpec},i));return ws(Il(i[1]))?t.concat([new vI(`${n}[1]`,i[1],"expressions are not allowed in function stops.")]):t.concat(XI({key:`${n}[1]`,value:i[1],valueSpec:r,style:e.style,styleSpec:e.styleSpec}))}function f(e,t){const i=Ln(e.value),s=Al(e.value),c=null!==e.value?e.value:t;if(o){if(i!==o)return[new vI(e.key,c,`${i} stop domain type must match previous stop domain type ${o}`)]}else o=i;if("number"!==i&&"string"!==i&&"boolean"!==i&&"number"!=typeof s&&"string"!=typeof s&&"boolean"!=typeof s)return[new vI(e.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==i&&"categorical"!==n){let t=`number expected, ${i} found`;return cs(r)&&void 0===n&&(t+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new vI(e.key,c,t)]}return"categorical"!==n||"number"!==i||"number"==typeof s&&isFinite(s)&&Math.floor(s)===s?"categorical"!==n&&"number"===i&&"number"==typeof s&&"number"==typeof a&&void 0!==a&&s<a?[new vI(e.key,c,"stop domain values must appear in ascending order")]:(a=s,"categorical"===n&&s in l?[new vI(e.key,c,"stop domain values must be unique")]:(l[s]=!0,[])):[new vI(e.key,c,`integer expected, found ${String(s)}`)]}}function II(e){const t=("property"===e.expressionContext?Ts:Es)(Il(e.value),e.valueSpec);if("error"===t.result)return t.value.map(t=>new vI(`${e.key}${t.key}`,e.value,t.message));const i=t.value.expression||t.value._styleExpression.expression;if("property"===e.expressionContext&&"text-font"===e.propertyKey&&!i.outputDefined())return[new vI(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===e.expressionContext&&"layout"===e.propertyType&&!_o(i))return[new vI(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext)return SI(i,e);if("appearance"===e.expressionContext)return MI(i,e);if(e.expressionContext&&0===e.expressionContext.indexOf("cluster")){if(!yo(i,["zoom","feature-state"]))return[new vI(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!mo(i))return[new vI(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function SI(e,t){const i=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(t.valueSpec&&t.valueSpec.expression)for(const n of t.valueSpec.expression.parameters)i.delete(n);if(0===i.size)return[];const r=[];return e instanceof Gn&&i.has(e.name)?[new vI(t.key,t.value,`["${e.name}"] expression is not supported in a filter for a ${t.object.type}
2 layer with id: ${t.object.id}`)]:(e.eachChild(e=>{r.push(...SI(e,t))}),r)}const TI=new Set(["get","has","properties","geometry-type","id"]),DI=new Set(["zoom","pitch","distance-from-center","feature","feature-state","measure-light","heatmap-density","line-progress","raster-value","raster-particle-speed","sky-radial-progress"]);function MI(e,t){if(t.valueSpec&&t.valueSpec.expression)for(const r of t.valueSpec.expression.parameters)DI.delete(r);if(0===DI.size)return[];const i=[];if(e instanceof Gn){const i=TI.has(e.name)?"feature":e.name;if(DI.has(i))return[new vI(t.key,t.value,`["${e.name}"] is not an allowed parameter`)]}return e.eachChild(e=>{i.push(...MI(e,t))}),i}function PI(e){const t=e.key,i=e.value,r=e.valueSpec,n=[];return Array.isArray(r.values)?r.values.includes(Al(i))||n.push(new vI(t,i,`expected one of [${r.values.join(", ")}], ${JSON.stringify(i)} found`)):Object.keys(r.values).includes(Al(i))||n.push(new vI(t,i,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(i)} found`)),n}function CI(e){if(Sl(Il(e.value))){const t=e.layerType||"fill";return II({...e,expressionContext:"filter",valueSpec:e.styleSpec[`filter_${t}`]})}return RI(e)}function RI(e){const t=e.value,i=e.key;if(!Array.isArray(t))return[new vI(i,t,`array expected, ${Ln(t)} found`)];if(t.length<1)return[new vI(i,t,"filter array must have at least 1 element")];const r=e.styleSpec;let n=PI({key:`${i}[0]`,value:t[0],valueSpec:r.filter_operator});const o=()=>{t.length>=2&&(On(t[1])||n.push(new vI(`${i}[1]`,t[1],`string expected, ${Ln(t[1])} found`)));for(let e=2;e<t.length;e++)"$type"===Al(t[1])?n=n.concat(PI({key:`${i}[${e}]`,value:t[e],valueSpec:r.geometry_type})):On(t[e])||Bn(t[e])||kn(t[e])||n.push(new vI(`${i}[${e}]`,t[e],`string, number, or boolean expected, ${Ln(t[e])} found.`))};switch(Al(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&"$type"===Al(t[1])&&n.push(new vI(i,t,`"$type" cannot be use with operator "${t[0]}"`)),3!==t.length&&n.push(new vI(i,t,`filter array for operator "${t[0]}" must have 3 elements`)),o();break;case"==":case"!=":3!==t.length&&n.push(new vI(i,t,`filter array for operator "${t[0]}" must have 3 elements`)),o();break;case"in":case"!in":o();break;case"any":case"all":case"none":for(let r=1;r<t.length;r++)n=n.concat(RI({key:`${i}[${r}]`,value:t[r],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":2!==t.length?n.push(new vI(i,t,`filter array for "${t[0]}" operator must have 2 elements`)):On(t[1])||n.push(new vI(`${i}[1]`,t[1],`string expected, ${Ln(t[1])} found`))}return n}const zI=/^{([^}]+)}$/;function LI(e,t){const i=e.key,r=e.style,n=e.layer,o=e.styleSpec,a=e.value,s=e.objectKey,l=o[`${t}_${e.layerType}`];if(!l)return[];const c=s.match(ss);if(c&&l[c[1]])return ws(Il(a))?[].concat(XI({key:i,value:a,valueSpec:{type:"string",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},style:r,styleSpec:o,expressionContext:"property",propertyType:t,propertyKey:s})):XI({key:i,value:a,valueSpec:{type:"string"},style:r,styleSpec:o});const u=s.match(as);if("paint"===t&&u&&l[u[1]]&&l[u[1]].transition)return XI({key:i,value:a,valueSpec:o.transition,style:r,styleSpec:o});const h=e.valueSpec||l[s];if(!h)return[new bI(i,a,`unknown property "${s}"`)];let d;if(On(a)&&cs(h)&&!h.tokens&&(d=zI.exec(a))){const e=`\`{ "type": "identity", "property": ${d?JSON.stringify(d[1]):'"_"'} }\``;return[new vI(i,a,`"${s}" does not support interpolation syntax\nUse an identity property function instead: ${e}.`)]}const p=[];if("symbol"===e.layerType)"text-field"!==s||!r||r.glyphs||r.imports||p.push(new vI(i,a,'use of "text-field" requires a style "glyphs" property')),"text-font"===s&&ps(Il(a))&&"identity"===Al(a.type)&&p.push(new vI(i,a,'"text-font" does not support identity functions'));else if("model"===e.layerType&&"paint"===t&&n&&n.layout&&Object.hasOwn(n.layout,"model-id")&&cs(h)&&(us(h)||hs(h))){const e=Ts(Il(a),h).value,t="expression"in e&&e.expression||"_styleExpression"in e&&e._styleExpression&&e._styleExpression.expression;t&&!yo(t,["measure-light"])&&("model-emissive-strength"===s&&mo(t)&&_o(t)||p.push(new vI(i,a,`${s} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return p.concat(XI({key:e.key,value:a,valueSpec:h,style:r,styleSpec:o,expressionContext:"property",propertyType:t,propertyKey:s}))}function FI(e){return LI(e,"paint")}function OI(e){return LI(e,"layout")}function BI(e){let t=[];const i=e.value,r=e.key,n=e.style,o=e.styleSpec;if(!Fn(i))return[new vI(r,i,"object expected")];i.type||i.ref||t.push(new vI(r,i,'either "type" or "ref" is required'));let a=Al(i.type);const s=Al(i.ref);
vendor: 7,041 bytes, line 2
2if(i.id){const o=Al(i.id);for(let a=0;a<e.arrayIndex;a++){const e=n.layers[a];Al(e.id)===o&&t.push(new vI(r,i.id,`duplicate layer id "${o}", previously used at line ${e.id.__line__}`))}}if("ref"in i){let e;["type","source","source-layer","filter","layout"].forEach(e=>{e in i&&t.push(new vI(r,i[e],`"${e}" is prohibited for ref layers`))}),n.layers.forEach(t=>{Al(t.id)===s&&(e=t)}),e?e.ref?t.push(new vI(r,i.ref,"ref cannot reference another ref layer")):a=Al(e.type):"string"==typeof s&&t.push(new vI(r,i.ref,`ref layer "${s}" not found`))}else if("background"!==a&&"sky"!==a&&"slot"!==a&&"placement-group"!==a)if(i.source)if(On(i.source)){const e=n.sources&&Object.hasOwn(n.sources,i.source)?n.sources[i.source]:void 0,o=e&&Al(e.type);e?"vector"===o&&"raster"===a?t.push(new vI(r,i.source,`layer "${i.id}" requires a raster source`)):"raster"===o&&"raster"!==a?t.push(new vI(r,i.source,`layer "${i.id}" requires a vector source`)):"vector"!==o||i["source-layer"]?"raster-dem"===o&&"hillshade"!==a?t.push(new vI(r,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):"raster-array"!==o||["raster","raster-particle"].includes(a)?"line"===a&&i.paint&&i.paint["line-gradient"]&&"geojson"===o&&!e.lineMetrics?t.push(new vI(r,i,`layer "${i.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):"line"===a&&i.paint&&i.paint["line-trim-offset"]&&"geojson"===o&&!e.lineMetrics?t.push(new vI(r,i,`layer "${i.id}" specifies a line-trim-offset, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):"raster-particle"===a&&"raster-array"!==o&&t.push(new vI(r,i.source,`layer "${i.id}" requires a 'raster-array' source.`)):t.push(new vI(r,i.source,"raster-array source can only be used with layer type 'raster'.")):t.push(new vI(r,i,`layer "${i.id}" must specify a "source-layer"`)):t.push(new vI(r,i.source,`source "${i.source}" not found`))}else t.push(new vI(`${r}.source`,i.source,'"source" must be a string'));else t.push(new vI(r,i,'missing required property "source"'));return t=t.concat(YI({key:r,value:i,valueSpec:o.layer,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":()=>[],type:()=>XI({key:`${r}.type`,value:i.type,valueSpec:o.layer.type,style:e.style,styleSpec:e.styleSpec,object:i,objectKey:"type"}),filter:e=>CI({layerType:a,...e}),layout:e=>YI({layer:i,key:e.key,value:e.value,valueSpec:{},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":e=>OI({layerType:a,...e})}}),paint:e=>YI({layer:i,key:e.key,value:e.value,valueSpec:{},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":e=>FI({layerType:a,layer:i,...e})}}),appearances(e){const t=wI({key:e.key,value:e.value,valueSpec:e.valueSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:e=>function(e){const{key:t,layer:i,layerType:r}=e,n=Al(e.value),o=Al(n.name),a=Al(n.condition),s=YI({key:t,value:n,valueSpec:e.styleSpec.appearance,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{condition:e=>function(e){const t=[];return t.push(...II({key:e.key,value:e.object.condition,valueSpec:El.appearance.condition,expressionContext:"appearance"})),t}({...e}),properties:e=>function(e){const t=[],{styleSpec:i,layer:r,layerType:n}=e,o=i[`paint_${n}`],a=i[`layout_${n}`],s=e.object[e.objectKey];for(const l in s){const i=l in o?"paint":l in a?"layout":void 0;if(!i){t.push(new vI(e.key,l,`unknown property "${l}" for layer type "${n}"`));continue}const c={...e,key:`${e.key}.${l}`,objectKey:l,layer:r,layerType:n,value:s[l],valueSpec:"paint"===i?o[l]:a[l]};t.push(...LI(c,i))}return t}({layer:i,layerType:r,...e})}});return"hidden"!==o&&void 0===a&&s.push(new vI(e.key,"name",'Appearance with name different than "hidden" must have a condition')),s}({layerType:a,layer:i,...e})}),r=Array.isArray(e.value)?e.value:[],n=new Set;return r.forEach((r,o)=>{const a=Al(r.name);if(a)if(n.has(a)){const r=Al(i.id);t.push(new vI(e.key,a,`Duplicated appearance name "${a}" for layer "${r}"`))}else n.add(a)}),t}}})),t}function kI({key:e,value:t}){return On(t)?[]:[new vI(e,t,`string expected, ${Ln(t)} found`)]}const VI={promoteId:function e({key:t,value:i}){if(On(i))return kI({key:t,value:i});if(Array.isArray(i)){const e=[],r=Es(Il(i));return"error"===r.result?(r.value.forEach(i=>{e.push(new vI(`${t}${i.key}`,null,`${i.message}`))}),e):(yo(r.value.expression,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])||e.push(new vI(`${t}`,null,"promoteId expression should be only feature dependent")),e)}if(!Fn(i))return[new vI(t,i,`string, expression or object expected, "${Ln(i)}" found`)];const r=[];for(const n in i)r.push(...e({key:`${t}.${n}`,value:i[n]}));return r}};function NI(e){const t=e.value,i=e.key,r=e.styleSpec,n=e.style;if(!Fn(t))return[new vI(i,t,`object expected, ${Ln(t)} found`)];if(!("type"in t))return[new vI(i,t,'"type" is required')];const o=Al(t.type);let a=[];switch(["vector","raster","raster-dem","raster-array"].includes(o)&&("url"in t||"tiles"in t||a.push(new bI(i,t,'Either "url" or "tiles" is required.'))),o){case"vector":case"raster":case"raster-dem":case"raster-array":return a=a.concat(YI({key:i,value:t,valueSpec:r[`source_${o.replace("-","_")}`],style:e.style,styleSpec:r,objectElementValidators:VI})),a;case"geojson":if(a=YI({key:i,value:t,valueSpec:r.source_geojson,style:n,styleSpec:r,objectElementValidators:VI}),"cluster"in t&&"clusterProperties"in t){if(!Fn(t.clusterProperties))return[new vI(`${i}.clusterProperties`,t,`object expected, ${Ln(t)} found`)];for(const e in t.clusterProperties){const r=t.clusterProperties[e];if(!Array.isArray(r))return[new vI(`${i}.clusterProperties.${e}`,r,"array expected")];const[n,o]=r,s="string"==typeof n?[n,["accumulated"],["get",e]]:n;a.push(...II({key:`${i}.${e}.map`,value:o,expressionContext:"cluster-map"})),a.push(...II({key:`${i}.${e}.reduce`,value:s,expressionContext:"cluster-reduce"}))}}return a;case"video":return YI({key:i,value:t,valueSpec:r.source_video,style:n,styleSpec:r});case"image":return YI({key:i,value:t,valueSpec:r.source_image,style:n,styleSpec:r});case"canvas":return[new vI(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return PI({key:`${i}.type`,value:t.type,valueSpec:{values:UI(r)}})}}function UI(e){return e.source.reduce((t,i)=>{const r=e[i];return"enum"===r.type.type&&(t=t.concat(Object.keys(r.type.values||{}))),t},[])}function jI(e,t){const i=!e.includes("://");try{return new URL(e,i&&t?"http://example.com":void 0),!0}catch(e){return!1}}function GI(e){const t=e.value;return t?On(t)?jI(t,!0)?[]:[new vI(e.key,t,`invalid url "${t}"`)]:[new vI(e.key,t,`string expected, "${Ln(t)}" found`)]:[]}function HI(e){const t=e.value,i=e.styleSpec,r=i.light,n=e.style;if(void 0===t)return[];if(!Fn(t))return[new vI("light",t,`object expected, ${Ln(t)} found`)];let o=[];for(const a in t){const e=a.match(as),s=a.match(ss);
vendor: 7,092 bytes, line 2
2o=o.concat(s&&r[s[1]]?XI({key:a,value:t[a],valueSpec:{type:"string"},style:n,styleSpec:i}):e&&r[e[1]]&&r[e[1]].transition?XI({key:a,value:t[a],valueSpec:i.transition,style:n,styleSpec:i}):r[a]?XI({key:a,value:t[a],valueSpec:r[a],style:n,styleSpec:i}):[new vI(a,t[a],`unknown property "${a}"`)])}return o}function $I(e){const t=e.value;if(!t)return[];const i=e.key;if(!Fn(t))return[new vI(i,t,`object expected, ${Ln(t)} found`)];let r=[];const n=e.styleSpec,o=n["light-3d"],a=e.style,s=e.style.lights;for(const u of["type","id"])if(!(u in t))return r=r.concat([new vI(i,t,`missing property "${u}"`)]),r;if(!On(t.type))return r=r.concat([new vI(`${i}.type`,t.type,"string expected")]),r;if(s)for(let u=0;u<e.arrayIndex;u++){const e=Al(t.type),n=s[u];Al(n.type)===e&&r.push(new vI(i,t.id,`duplicate light type "${t.type}", previously defined at line ${n.id.__line__}`))}const l=`properties_light_${t.type}`;if(!(l in n))return r=r.concat([new vI(`${i}.type`,t,`Invalid light type ${t.type}`)]),r;const c=n[l];for(const u in t)if("properties"===u){const i=t[u];if(!Fn(i))return r=r.concat([new vI("properties",i,`object expected, ${Ln(i)} found`)]),r;for(const t in i){const o=t.match(as),s=t.match(ss);r=r.concat(s&&c[s[1]]?XI({key:t,value:i[t],valueSpec:{type:"string"},style:a,styleSpec:n}):o&&c[o[1]]&&c[o[1]].transition?XI({key:t,value:i[t],valueSpec:n.transition,style:a,styleSpec:n}):c[t]?XI({key:t,value:i[t],valueSpec:c[t],style:a,styleSpec:n}):[new bI(e.key,i[t],`unknown property "${t}"`)])}}else r=r.concat(o[u]?XI({key:u,value:t[u],valueSpec:o[u],style:a,styleSpec:n}):[new bI(u,t[u],`unknown property "${u}"`)]);return r}function WI(e){const t=e.value,i=e.key,r=e.style,n=e.styleSpec,o=n.terrain;if(null==t)return[];if(!Fn(t))return[new vI("terrain",t,`object expected, ${Ln(t)} found`)];let a=[];for(const s in t){const e=s.match(as),i=s.match(ss);a=a.concat(i&&o[i[1]]?XI({key:s,value:t[s],valueSpec:{type:"string"},style:r,styleSpec:n}):e&&o[e[1]]&&o[e[1]].transition?XI({key:s,value:t[s],valueSpec:n.transition,style:r,styleSpec:n}):o[s]?XI({key:s,value:t[s],valueSpec:o[s],style:r,styleSpec:n}):[new bI(s,t[s],`unknown property "${s}"`)])}if(t.source)if(On(t.source)){const e=r.sources&&Object.hasOwn(r.sources,t.source)?r.sources[t.source]:void 0,n=e&&Al(e.type);e?"raster-dem"!==n&&a.push(new vI(`${i}.source`,t.source,`terrain cannot be used with a source of type ${n}, it only be used with a "raster-dem" source type`)):a.push(new vI(`${i}.source`,t.source,`source "${t.source}" not found`))}else a.push(new vI(`${i}.source`,t.source,"source must be a string"));else a.push(new vI(i,t,'terrain is missing required property "source"'));return a}function qI(e){const t=e.value,i=e.style,r=e.styleSpec,n=r.fog;if(void 0===t)return[];if(!Fn(t))return[new vI("fog",t,`object expected, ${Ln(t)} found`)];let o=[];for(const a in t){const e=a.match(as),s=a.match(ss);o=o.concat(s&&n[s[1]]?XI({key:a,value:t[a],valueSpec:{type:"string"},style:i,styleSpec:r}):e&&n[e[1]]&&n[e[1]].transition?XI({key:a,value:t[a],valueSpec:r.transition,style:i,styleSpec:r}):n[a]?XI({key:a,value:t[a],valueSpec:n[a],style:i,styleSpec:r}):[new bI(a,t[a],`unknown property "${a}"`)])}return o}const ZI={"*":()=>[],array:wI,boolean:function(e){const t=e.value,i=e.key;return kn(t)?[]:[new vI(i,t,`boolean expected, ${Ln(t)} found`)]},number:EI,color:function({key:e,value:t}){return On(t)?void 0===Zr.parse(Al(t))?[new vI(e,t,`color expected, "${t}" found`)]:[]:[new vI(e,t,`color expected, ${Ln(t)} found`)]},enum:PI,filter:CI,function:AI,layer:BI,object:YI,source:NI,model:GI,light:HI,"light-3d":$I,terrain:WI,fog:qI,string:kI,formatted:function(e){return 0===kI(e).length?[]:II(e)},resolvedImage:function(e){return 0===kI(e).length?[]:II(e)},projection:function(e){const t=e.value,i=e.styleSpec,r=i.projection,n=e.style;if(Fn(t)){let e=[];for(const o in t)e=e.concat(XI({key:o,value:t[o],valueSpec:r[o],style:n,styleSpec:i}));return e}return On(t)?[]:[new vI("projection",t,`object or string expected, ${Ln(t)} found`)]},import:function(e){const t=e.key,{value:i,styleSpec:r}=e;if(!Fn(i))return[new vI(t,i,"import must be an object")];const{data:n,...o}=i;Object.defineProperty(o,"__line__",{value:i.__line__,enumerable:!1});let a=YI({...e,value:o,valueSpec:r.import});""===Al(o.id)&&a.push(new vI(`${e.key}.id`,o,"import id can't be an empty string"));const s=Al(o.id);return"__proto__"!==s&&"constructor"!==s&&"prototype"!==s||a.push(new vI(`${e.key}.id`,o,`import id can't be "${String(s)}"`)),n&&(a=a.concat(JI(n,r,{key:`${e.key}.data`}))),a},iconset:function(e){const t=e.value,i=e.key,r=e.styleSpec,n=e.style;if(!Fn(t))return[new vI(i,t,"object expected")];if(!t.type)return[new vI(i,t,'"type" is required')];const o=Al(t.type);let a=[];if(a=a.concat(YI({key:i,value:t,valueSpec:r[`iconset_${o}`],style:n,styleSpec:r})),function(e,t){return!("source"!==e||!t.source)}(o,t)){const e=n.sources&&Object.hasOwn(n.sources,t.source)?n.sources[t.source]:void 0,r=e&&Al(e.type);e?"raster-array"!==r&&a.push(new vI(i,t.source,`iconset cannot be used with a source of type ${String(r)}, it only be used with a "raster-array" source type`)):a.push(new vI(i,t.source,`source "${t.source}" not found`))}return a},option:function(e){const t=e.styleSpec,i=e.value,r=Fn(i)&&!0===Al(i.array)||!Fn(i)?void 0:Al(i.type);return YI({...e,valueSpec:t.option,objectElementValidators:{default:e=>{const t=e.value;return Fn(t)?XI({...e,valueSpec:{...e.valueSpec,type:"*",expression:void 0}}):r&&Array.isArray(t)?XI({...e,valueSpec:{...e.valueSpec,type:r}}):XI(e)}}})}};function XI(e,t=!1){const i=e.value,r=e.valueSpec,n=e.styleSpec;if(r.expression){if(ps(Al(i)))return AI(e);if(ws(Il(i)))return II(e)}if(r.type&&ZI[r.type]){const i=ZI[r.type](e);return!0===t&&i.length>0&&Array.isArray(e.value)?II(e):i}return YI({...e,valueSpec:r.type?n[r.type]:r})}function YI(e){const t=e.key,i=e.value,r=e.valueSpec||{},n=e.objectElementValidators||{},o=e.style,a=e.styleSpec;if(!Fn(i))return[new vI(t,i,`object expected, ${Ln(i)} found`)];let s=[];for(const l in i){if(!Object.hasOwn(i,l))continue;const e=l.split(".")[0],c=Object.hasOwn(r,e),u=Object.hasOwn(r,"*"),h=c?r[e]:u?r["*"]:void 0;let d;Object.hasOwn(n,e)?d=n[e]:c?d=XI:Object.hasOwn(n,"*")?d=n["*"]:u&&(d=XI),d?s=s.concat(d({key:(t?`${t}.`:t)+l,value:i[l],valueSpec:h,style:o,styleSpec:a,object:i,objectKey:l},i)):s.push(new bI(t,i[l],`unknown property "${l}"`))}for(const l in r){if(!Object.hasOwn(r,l))continue;if(Object.hasOwn(n,l))continue;const e=r[l];!e.required||void 0!==e.default||Object.hasOwn(i,l)&&void 0!==i[l]||s.push(new vI(t,i,`missing required property "${l}"`))}return s}function KI({key:e,value:t}){const i=kI({key:e,value:t});if(i.length)return i;const r=t;return r.includes("{fontstack}")||i.push(new vI(e,t,'"glyphs" url must include a "{fontstack}" token')),r.includes("{range}")||i.push(new vI(e,t,'"glyphs" url must include a "{range}" token')),i}function JI(e,t=El,i={}){return YI({key:i.key||"",value:e,valueSpec:{...t.$root,"*":{type:"*"}},styleSpec:t,style:e,objectElementValidators:{glyphs:KI}})}function QI(e){return e.slice().sort((e,t)=>
vendor: 5,045 bytes, line 2
2e.line&&t.line?e.line-t.line:0)}const eS="setStyle",tS="addLayer",iS="removeLayer",rS="setPaintProperty",nS="setLayerProperty",oS="setTerrain",aS="removeImport",sS="addIconset",lS="removeIconset";function cS(e,t,i){i.push({command:"addSource",args:[e,t[e]]})}function uS(e,t,i){t.push({command:"removeSource",args:[e]}),i[e]=!0}function hS(e,t,i,r){uS(e,i,r),cS(e,t,i)}function dS(e,t,i){let r;for(r in e[i])if(Object.hasOwn(e[i],r)&&"data"!==r&&!Ve(e[i][r],t[i][r]))return!1;for(r in t[i])if(Object.hasOwn(t[i],r)&&"data"!==r&&!Ve(e[i][r],t[i][r]))return!1;return!0}function pS(e,t,i,r,n,o){let a;for(a in t=t||{},e=e||{})Object.hasOwn(e,a)&&(Ve(e[a],t[a])||i.push({command:o,args:[r,a,t[a],n]}));for(a in t)Object.hasOwn(t,a)&&!Object.hasOwn(e,a)&&(Ve(e[a],t[a])||i.push({command:o,args:[r,a,t[a],n]}))}function fS(e){return e.id}function mS(e,t){return e[t.id]=t,e}const _S=new Zr(1,0,0,1),gS=new Zr(0,1,0,1),yS=new Zr(0,0,1,1),xS=new Zr(1,0,1,1),vS=new Zr(0,1,1,1);function bS(e,t,i,r,n,o,a){const s=e.context,l=e.transform,c=s.gl,u="globe"===l.projection.name,h=u?["PROJECTION_GLOBE_VIEW"]:[];let d=f(i.projMatrix);if(u&&mf(l.zoom)>0){const e=uf(ef(i.canonical,l));d=x(new Float32Array(16),l.globeMatrix,e),x(d,l.projMatrix,d)}const m=p();m[12]+=2*n/(ei.devicePixelRatio*l.width),m[13]+=2*o/(ei.devicePixelRatio*l.height),x(d,m,d);const _=e.getOrCreateProgram("debug",{defines:h}),g=t.getTileByID(i.key);e.terrain&&e.terrain.setupElevationDraw(g,_);const y=fw.disabled,v=uw.disabled,b=e.colorModeForRenderPass(),w="$debug";s.activeTexture.set(c.TEXTURE0),e.emptyTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),u?g._makeGlobeTileDebugBuffers(e.context,l):g._makeDebugTileBoundsBuffers(e.context,l.projection);const E=g._tileDebugBuffer||e.debugBuffer,A=g._tileDebugIndexBuffer||e.debugIndexBuffer,I=g._tileDebugSegments||e.debugSegments;if(_.draw(e,c.LINE_STRIP,y,v,b,gw.disabled,Hw(d,r.toPremultipliedRenderColor(null)),w,E,A,I,null,null,null,[g._globeTileDebugBorderBuffer]),a){const t=g.latestRawTileData,r=Math.floor((t&&t.byteLength||0)/1024);let n=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(n+=` => ${i.overscaledZ}`),n+=` ${g.state}`,n+=` ${r}kb`,function(e,t){e.initDebugOverlayCanvas();const i=e.debugOverlayCanvas,r=e.context.gl,n=e.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,i.width,i.height),n.shadowColor="white",n.shadowBlur=2,n.lineWidth=1.5,n.strokeStyle="white",n.textBaseline="top",n.font="bold 36px Open Sans, sans-serif",n.fillText(t,5,5),n.strokeText(t,5,5),e.debugOverlayTexture.update(i),e.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}(e,n)}const S=t.getTile(i).tileSize,T=512/Math.min(S,512)*(i.overscaledZ/l.zoom)*.5,D=g._tileDebugTextBuffer||e.debugBuffer,M=g._tileDebugTextIndexBuffer||e.quadTriangleIndexBuffer,P=g._tileDebugTextSegments||e.debugSegments;_.draw(e,c.TRIANGLES,y,v,pw.alphaBlended,gw.disabled,Hw(d,Zr.transparent.toPremultipliedRenderColor(null),T),w,D,M,P,null,null,null,[g._globeTileDebugTextBuffer])}function wS(e,t,i,r){AS(e,0,t+i/2,e.transform.width,i,r)}function ES(e,t,i,r){AS(e,t-i/2,0,i,e.transform.height,r)}function AS(e,t,i,r,n,o){const a=e.context,s=a.gl;s.enable(s.SCISSOR_TEST),s.scissor(t*ei.devicePixelRatio,i*ei.devicePixelRatio,r*ei.devicePixelRatio,n*ei.devicePixelRatio),a.clear({color:o}),s.disable(s.SCISSOR_TEST)}function IS(e,t,i){const r=e.context,n=r.gl,o=i.projMatrix,a=e.getOrCreateProgram("debug"),s=t.getTileByID(i.key);e.terrain&&e.terrain.setupElevationDraw(s,a);const l=fw.disabled,c=uw.disabled,u=e.colorModeForRenderPass(),h="$debug";r.activeTexture.set(n.TEXTURE0),e.emptyTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE);const d=s.queryGeometryDebugViz,p=s.queryBoundsDebugViz;if(d&&d.vertices.length>0){d.lazyUpload(r);const t=d.vertexBuffer,i=d.indexBuffer,s=d.segments;null!=t&&null!=i&&null!=s&&a.draw(e,n.LINE_STRIP,l,c,u,gw.disabled,Hw(o,d.color.toPremultipliedRenderColor(null)),h,t,i,s)}if(p&&p.vertices.length>0){p.lazyUpload(r);const t=p.vertexBuffer,i=p.indexBuffer,s=p.segments;null!=t&&null!=i&&null!=s&&a.draw(e,n.LINE_STRIP,l,c,u,gw.disabled,Hw(o,p.color.toPremultipliedRenderColor(null)),h,t,i,s)}}const SS=(e,t,i,r,n,o,a,s)=>{const l=co/o.tileSize;return{u_matrix:e,u_inv_rot_matrix:t,u_camera_to_center_distance:i.getCameraToCenterDistance(s),u_extrude_scale:[i.pixelsToGLUnits[0]/l,i.pixelsToGLUnits[1]/l],u_zoom_transition:r,u_tile_id:a,u_merc_center:n}},TS=(e,t,i,r)=>({u_matrix:e,u_inv_matrix:t,u_camera_to_center_distance:i.getCameraToCenterDistance(r),u_viewport_size:[i.width,i.height]});let DS;const MS={loaded:!0,validateStyle:function(e,t=El){return QI(JI(e,t))},validateSource:e=>QI(NI(e)),validateLight:e=>QI(HI(e)),validateLights:e=>QI($I(e)),validateTerrain:e=>QI(WI(e)),validateFog:e=>QI(qI(e)),validateSnow:e=>QI(function(e){const t=e.value,i=e.style,r=e.styleSpec,n=r.snow;if(void 0===t)return[];if(!Fn(t))return[new vI("snow",t,`object expected, ${Ln(t)} found`)];let o=[];for(const a in t){const e=a.match(as);o=o.concat(e&&n[e[1]]&&n[e[1]].transition?XI({key:a,value:t[a],valueSpec:r.transition,style:i,styleSpec:r}
vendor: 4,750 bytes, line 2
2):n[a]?XI({key:a,value:t[a],valueSpec:n[a],style:i,styleSpec:r}):[new bI(a,t[a],`unknown property "${a}"`)])}return o}(e)),validateRain:e=>QI(function(e){const t=e.value,i=e.style,r=e.styleSpec,n=r.rain;if(void 0===t)return[];if(!Fn(t))return[new vI("rain",t,`object expected, ${Ln(t)} found`)];let o=[];for(const a in t){const e=a.match(as);o=o.concat(e&&n[e[1]]&&n[e[1]].transition?XI({key:a,value:t[a],valueSpec:r.transition,style:i,styleSpec:r}):n[a]?XI({key:a,value:t[a],valueSpec:n[a],style:i,styleSpec:r}):[new bI(a,t[a],`unknown property "${a}"`)])}return o}(e)),validateLayer:e=>QI(BI(e)),validateFilter:e=>QI(CI(e)),validatePaintProperty:e=>QI(FI(e)),validateLayoutProperty:e=>QI(OI(e)),validateModel:e=>QI(GI(e)),diffStyles:function(e,t){if(!e)return[{command:eS,args:[t]}];let i=[];try{if(!Ve(e.version,t.version))return[{command:eS,args:[t]}];if(Ve(e.center,t.center)||i.push({command:"setCenter",args:[t.center]}),Ve(e.zoom,t.zoom)||i.push({command:"setZoom",args:[t.zoom]}),Ve(e.bearing,t.bearing)||i.push({command:"setBearing",args:[t.bearing]}),Ve(e.pitch,t.pitch)||i.push({command:"setPitch",args:[t.pitch]}),Ve(e.sprite,t.sprite)||i.push({command:"setSprite",args:[t.sprite]}),Ve(e.glyphs,t.glyphs)||i.push({command:"setGlyphs",args:[t.glyphs]}),Ve(e.imports,t.imports)||function(e=[],t=[],i){t=t||[];const r=(e=e||[]).map(fS),n=t.map(fS),o=e.reduce(mS,{}),a=t.reduce(mS,{}),s=r.slice();let l,c,u,h;for(l=0,c=0;l<r.length;l++)u=r[l],Object.hasOwn(a,u)?c++:(i.push({command:aS,args:[u]}),s.splice(s.indexOf(u,c),1));for(l=0,c=0;l<n.length;l++)u=n[n.length-1-l],s[s.length-1-l]!==u&&(Object.hasOwn(o,u)?(i.push({command:aS,args:[u]}),s.splice(s.lastIndexOf(u,s.length-c),1)):c++,h=s[s.length-l],i.push({command:"addImport",args:[a[u],h]}),s.splice(s.length-l,0,u));for(const d of t){const e=o[d.id];e&&(delete e.data,Ve(e,d)||i.push({command:"updateImport",args:[d.id,d]}))}}(e.imports,t.imports,i),Ve(e.transition,t.transition)||i.push({command:"setTransition",args:[t.transition]}),Ve(e.light,t.light)||i.push({command:"setLight",args:[t.light]}),Ve(e.fog,t.fog)||i.push({command:"setFog",args:[t.fog]}),Ve(e.snow,t.snow)||i.push({command:"setSnow",args:[t.snow]}),Ve(e.rain,t.rain)||i.push({command:"setRain",args:[t.rain]}),Ve(e.projection,t.projection)||i.push({command:"setProjection",args:[t.projection]}),Ve(e.lights,t.lights)||i.push({command:"setLights",args:[t.lights]}),Ve(e.camera,t.camera)||i.push({command:"setCamera",args:[t.camera]}),Ve(e.iconsets,t.iconsets)||function(e,t,i){let r;for(r in t=t||{},e=e||{})Object.hasOwn(e,r)&&(Object.hasOwn(t,r)||i.push({command:lS,args:[r]}));for(r in t){if(!Object.hasOwn(t,r))continue;const n=t[r];Object.hasOwn(e,r)?Ve(e[r],n)||(i.push({command:lS,args:[r]}),i.push({command:sS,args:[r,n]})):i.push({command:sS,args:[r,n]})}}(e.iconsets,t.iconsets,i),!Ve(e["color-theme"],t["color-theme"]))return[{command:eS,args:[t]}];const r={},n=[];!function(e,t,i,r){let n;for(n in t=t||{},e=e||{})Object.hasOwn(e,n)&&(Object.hasOwn(t,n)||uS(n,i,r));for(n in t){if(!Object.hasOwn(t,n))continue;const o=t[n];Object.hasOwn(e,n)?Ve(e[n],o)||("geojson"===e[n].type&&"geojson"===o.type&&dS(e,t,n)?i.push({command:"setGeoJSONSourceData",args:[n,o.data]}):hS(n,t,i,r)):cS(n,t,i)}}(e.sources,t.sources,n,r);const o=[];e.layers&&e.layers.forEach(e=>{e.source&&r[e.source]?i.push({command:iS,args:[e.id]}):o.push(e)});let a=e.terrain;a&&r[a.source]&&(i.push({command:oS,args:[void 0]}),a=void 0),i=i.concat(n),Ve(a,t.terrain)||i.push({command:oS,args:[t.terrain]}),function(e,t,i){t=t||[];const r=(e=e||[]).map(fS),n=t.map(fS),o=e.reduce(mS,{}),a=t.reduce(mS,{}),s=r.slice(),l=Object.create(null);let c,u,h,d,p,f,m;for(c=0,u=0;c<r.length;c++)h=r[c],Object.hasOwn(a,h)?u++:(i.push({command:iS,args:[h]}),s.splice(s.indexOf(h,u),1));for(c=0,u=0;c<n.length;c++)h=n[n.length-1-c],s[s.length-1-c]!==h&&(Object.hasOwn(o,h)?(i.push({command:iS,args:[h]}),s.splice(s.lastIndexOf(h,s.length-u),1)):u++,f=s[s.length-c],i.push({command:tS,args:[a[h],f]}),s.splice(s.length-c,0,h),l[h]=!0);for(c=0;c<n.length;c++)if(h=n[c],d=o[h],p=a[h],!l[h]&&!Ve(d,p))if(Ve(d.source,p.source)&&Ve(d["source-layer"],p["source-layer"])&&Ve(d.type,p.type)){for(m in pS(d.layout,p.layout,i,h,null,"setLayoutProperty"),pS(d.paint,p.paint,i,h,null,rS),Ve(d.slot,p.slot)||i.push({command:"setSlot",args:[h,p.slot]}),Ve(d.filter,p.filter)||i.push({command:"setFilter",args:[h,p.filter]}),Ve(d.minzoom,p.minzoom)&&Ve(d.maxzoom,p.maxzoom)||i.push({command:"setLayerZoomRange",args:[h,p.minzoom,p.maxzoom]}),d)Object.hasOwn(d,m)&&"layout"!==m&&"paint"!==m&&"filter"!==m&&"metadata"!==m&&"minzoom"!==m&&"maxzoom"!==m&&"slot"!==m&&(0===m.indexOf("paint.")?pS(d[m],p[m],i,h,m.slice(6),rS):Ve(d[m],p[m])||i.push({command:nS,args:[h,m,p[m]]}
vendor: 20,989 bytes, line 2
2));for(m in p)Object.hasOwn(p,m)&&!Object.hasOwn(d,m)&&"layout"!==m&&"paint"!==m&&"filter"!==m&&"metadata"!==m&&"minzoom"!==m&&"maxzoom"!==m&&"slot"!==m&&(0===m.indexOf("paint.")?pS(d[m],p[m],i,h,m.slice(6),rS):Ve(d[m],p[m])||i.push({command:nS,args:[h,m,p[m]]}))}else i.push({command:iS,args:[h]}),f=s[s.lastIndexOf(h)+1],i.push({command:tS,args:[p,f]})}(o,t.layers,i)}catch(e){console.warn("Unable to compute style diff:",e),i=[{command:eS,args:[t]}]}return i},drawDebug:function(e,t,i,r,n,o){for(let a=0;a<i.length;a++)if(n){const n=1,s=.8,l=new Zr(r.r*s,r.g*s,r.b*s,1);bS(e,t,i[a],r,-n,-n,o),bS(e,t,i[a],r,-n,n,o),bS(e,t,i[a],r,n,n,o),bS(e,t,i[a],r,n,-n,o),bS(e,t,i[a],l,0,0,o)}else bS(e,t,i[a],r,0,0,o)},drawDebugPadding:function(e){const t=e.transform.padding;wS(e,e.transform.height-(t.top||0),3,_S),wS(e,t.bottom||0,3,gS),ES(e,t.left||0,3,yS),ES(e,e.transform.width-(t.right||0),3,xS);const i=e.transform.centerPoint;!function(e,t,i,r){AS(e,t-1,i-10,2,20,r),AS(e,t-10,i-1,20,2,r)}(e,i.x,e.transform.height-i.y,vS)},drawDebugQueryGeometry:function(e,t,i){for(let r=0;r<i.length;r++)IS(e,t,i[r])},drawCollisionDebug:function(e,t,i,r,n,o,a){const s=e.context,l=s.gl,c=e.transform,u=[Wn(c.center.lng),qn(c.center.lat)],h=i.layout.get("symbol-placement"),d=i.layout.get("text-variable-anchor"),f="map"===i.layout.get("icon-rotation-alignment"),m="map"===i.layout.get("text-rotation-alignment"),_="point"!==h,g=[];let y=0,x=0;for(let I=0;I<r.length;I++){const s=r[I],h=t.getTile(s),v=h.getBucket(i);if(!v)continue;const b=v.getProjection().createInversionMatrix(c,s.canonical),w=[],E=Tm(s,v,c),A=!a&&f&&_,S=a&&m&&_,T=d&&v.hasTextData(),D=v.hasIconTextFit()&&T&&v.hasIconData(),M=A||S||a&&T||D,P="globe"===v.projection.name,C=P?mf(c.zoom):0;P&&(w.push("PROJECTION_GLOBE_VIEW"),M&&w.push("PROJECTED_POS_ON_VIEWPORT"));const R=e.getOrCreateProgram("collisionBox",{defines:w});let z=E;0===n[0]&&0===n[1]||(z=e.translatePosMatrix(E,h,n,o));const L=a?v.textCollisionBox:v.iconCollisionBox,O=v.collisionCircleArray;if(O.length>0){const e=p(),t=z;F(e,v.placementInvProjMatrix,c.glCoordMatrix),F(e,e,v.placementViewportMatrix),g.push({circleArray:O,circleOffset:x,transform:t,invTransform:e,projection:v.getProjection()}),y+=O.length/4,x=y}if(!L)continue;e.terrain&&e.terrain.setupElevationDraw(h,R);const B=P?[s.canonical.x,s.canonical.y,1<<s.canonical.z]:[0,0,0];R.draw(e,l.LINES,fw.disabled,uw.disabled,e.colorModeForRenderPass(),gw.disabled,SS(z,b,c,C,u,h,B,v.getProjection()),i.id,L.layoutVertexBuffer,L.indexBuffer,L.segments,null,c.zoom,null,[L.collisionVertexBuffer,L.collisionVertexBufferExt])}if(!a||!g.length)return;const v=e.getOrCreateProgram("collisionCircle"),b=new Pu;b.resize(4*y),b._trim();let w=0;for(const p of g)for(let e=0;e<p.circleArray.length/4;e++){const t=4*e,i=p.circleArray[t+0],r=p.circleArray[t+1],n=p.circleArray[t+2],o=p.circleArray[t+3];b.emplace(w++,i,r,n,o,0),b.emplace(w++,i,r,n,o,1),b.emplace(w++,i,r,n,o,2),b.emplace(w++,i,r,n,o,3)}(!DS||DS.length<2*y)&&(DS=function(e){const t=2*e,i=new Ru;i.resize(t),i._trim();for(let r=0;r<t;r++){const e=6*r;i.uint16[e+0]=4*r+0,i.uint16[e+1]=4*r+1,i.uint16[e+2]=4*r+2,i.uint16[e+3]=4*r+2,i.uint16[e+4]=4*r+3,i.uint16[e+5]=4*r+0}return i}(y));const E=s.createIndexBuffer(DS,!0),A=s.createVertexBuffer(b,ip.members,!0);for(const p of g){const t=TS(p.transform,p.invTransform,c,p.projection);v.draw(e,l.TRIANGLES,fw.disabled,uw.disabled,e.colorModeForRenderPass(),gw.disabled,t,i.id,A,E,uh.simpleSegment(0,2*p.circleOffset,p.circleArray.length,p.circleArray.length/2),null,c.zoom)}A.destroy(),E.destroy()}};async function PS(){return Promise.resolve()}function CS(e,t){let i=!1;if(t&&t.length)for(const r of t)r instanceof bI?Tt(r.message):(e.fire(new Br(new Error(r.message))),i=!0);return i}function RS(e){return(...t)=>{const i=MS[e];return i?i(...t):[]}}const zS=RS("validateStyle"),LS=RS("validateSource"),FS=RS("validateLight"),OS=RS("validateLights"),BS=RS("validateTerrain"),kS=RS("validateFog"),VS=RS("validateSnow"),NS=RS("validateRain"),US=RS("validateLayer"),jS=RS("validateFilter"),GS=RS("validatePaintProperty"),HS=RS("validateLayoutProperty"),$S=RS("validateModel"),WS=El.light;let qS;class ZS extends Nr{constructor(e,t="flat"){super(),this._transitionable=new hl(qS||(qS=new wl({anchor:new gl(WS.anchor),position:new bl(WS.position),color:new gl(WS.color),intensity:new gl(WS.intensity)}))),this.setLight(e,t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,t,i={}){this._validate(FS,e,i)||(this._transitionable.setTransitionOrValue(e),this.id=t)}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t,i){return(!i||!1!==i.validate)&&CS(this,e.call(zS,{value:t,style:{glyphs:!0,sprite:!0},styleSpec:El}))}}const XS=El.terrain;let YS=class extends Nr{constructor(e,t,i,r,n){super(),this.scope=i,this._transitionable=new hl(new wl({source:new gl(XS.source),exaggeration:new gl(XS.exaggeration)}),i,r),this._transitionable.setTransitionOrValue(e,r),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=t,this.worldview=n}get(){return this._transitionable.serialize()}set(e,t){this._transitionable.setTransitionOrValue(e,t)}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}getExaggeration(e){return this._transitioning.possiblyEvaluate(new ll(e,{worldview:this.worldview})).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const e=this._transitionable._values.exaggeration;if(!e)return null;const t=e.value.expression;if(!t)return null;let i=-1,r=-1,n=1;for(const o of t.zoomStops)n=t.evaluate(new ll(o,{worldview:this.worldview})),n>.01?(i=o,r=-1):r=o;return n<.01&&i>0&&r>i?[i,r]:null}isZoomDependent(){const e=this._transitionable._values.exaggeration;return null!=e&&null!=e.value&&null!=e.value.expression&&e.value.expression instanceof Ss}};function KS(e,t){const i=e?e.terrain:null;return!!i&&(!t||!!t.projection.requiresDraping||!i.isZoomDependent()||i.getExaggeration(t.zoom)>0)}const JS=El.fog;class QS extends Nr{constructor(e,t,i,r){super();const n=new wl({range:new gl(JS.range),color:new gl(JS.color),"color-use-theme":new gl({type:"string","property-type":"data-constant",default:"default"}),"high-color":new gl(JS["high-color"]),"high-color-use-theme":new gl({type:"string","property-type":"data-constant",default:"default"}),"space-color":new gl(JS["space-color"]),"space-color-use-theme":new gl({type:"string","property-type":"data-constant",default:"default"}),"horizon-blend":new gl(JS["horizon-blend"]),"star-intensity":new gl(JS["star-intensity"]),"vertical-range":new gl(JS["vertical-range"])});this._transitionable=new hl(n,i,r),this.set(e,r),this._transitioning=this._transitionable.untransitioned(),this._transform=t,this.properties=new _l(n),this.scope=i}get state(){const e=this._transform,t="globe"===e.projection.name,i=mf(e.zoom),r=this.properties.get("range"),n=[2,4.5],o=.5/Math.tan(.5*e._fov),a=[r[0]+o,r[1]+o];return{range:t?[Wr(n[0],a[0],i),Wr(n[1],a[1],i)]:a,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(e,t,i={}){if(this._validate(kS,e,i))return;const r={...e};for(const n of Object.keys(JS))void 0===r[n]&&(r[n]=JS[n].default);this._options=r,this._transitionable.setTransitionOrValue(this._options,t)}getOpacity(e){if(!this._transform.projection.supportsFog)return 0;const t=this.properties&&this.properties.get("color")||1;return("globe"===this._transform.projection.name?1:dt(45,65,e))*t.a}getOpacityAtLatLng(e,t){return this._transform.projection.supportsFog?function(e,t,i){const r=Zc.fromLngLat(t),n=i.elevation?i.elevation.getAtPointOrZero(r):0;return Am(e,r.x,r.y,n,i)}(this.state,e,t):0}getOpacityForTile(e){if(!this._transform.projection.supportsFog)return[1,1];const t=this._transform.calculateFogTileMatrix(e.toUnwrapped());return Im(this.state,t,0,0,co,co,this._transform)}getOpacityForBounds(e,t,i,r,n){return this._transform.projection.supportsFog?Im(this.state,e,t,i,r,n,this._transform):[1,1]}getRangeForProjection(){return this._transform.projection.supportsFog?this.state.range:[0,1]}isVisibleOnFrustum(e){if(!this._transform.projection.supportsFog)return!1;const t=[4,5,6,7];for(const i of t){const t=e.points[i];let r;if(t[2]>=0)r=t;else{const n=e.points[i-4];r=Jr(n,t,n[2]/(n[2]-t[2]))}if(Am(this.state,r[0],r[1],0,this._transform)>=bm)return!0}return!1}updateConfig(e){this._transitionable.setTransitionOrValue(this._options,e)}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t,i){return(!i||!1!==i.validate)&&CS(this,e.call(zS,{value:t,style:{glyphs:!0,sprite:!0},styleSpec:El}))}}let eT,tT,iT=class extends Nr{constructor(e,t,i,r){super();const n=eT||(eT=new wl({density:new gl(El.snow.density),intensity:new gl(El.snow.intensity),color:new gl(El.snow.color),opacity:new gl(El.snow.opacity),vignette:new gl(El.snow.vignette),"vignette-color":new gl(El.snow["vignette-color"]),"center-thinning":new gl(El.snow["center-thinning"]),direction:new gl(El.snow.direction),"flake-size":new gl(El.snow["flake-size"])}));this._transitionable=new hl(n,i,r),this.set(e,r),this._transitioning=this._transitionable.untransitioned(),this.properties=new _l(n),this.scope=i}get state(){const e=this.properties.get("opacity"),t=this.properties.get("color"),i=this.properties.get("direction"),r=nt(i[0]),n=-Math.max(nt(i[1]),.01),o=[Math.cos(r)*Math.cos(n),Math.sin(r)*Math.cos(n),Math.sin(n)],a=this.properties.get("vignette"),s=this.properties.get("vignette-color"),l=new Zr(s.r,s.g,s.b,a);return{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new Zr(t.r,t.g,t.b,t.a*e),direction:o,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:l}}get(){return this._transitionable.serialize()}set(e,t,i={}){if(this._validate(VS,e,i))return;const r={...e},n=El.snow;for(const o of Object.keys(n))void 0===r[o]&&(r[o]=n[o].default);this._options=r,this._transitionable.setTransitionOrValue(this._options,t)}updateConfig(e){this._transitionable.setTransitionOrValue(this._options,e)}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t,i){return(!i||!1!==i.validate)&&CS(this,e.call(zS,{value:t,style:{glyphs:!0,sprite:!0},styleSpec:El}))}},rT=class extends Nr{constructor(e,t,i,r){super();const n=tT||(tT=new wl({density:new gl(El.rain.density),intensity:new gl(El.rain.intensity),color:new gl(El.rain.color),opacity:new gl(El.rain.opacity),vignette:new gl(El.rain.vignette),"vignette-color":new gl(El.rain["vignette-color"]),"center-thinning":new gl(El.rain["center-thinning"]),direction:new gl(El.rain.direction),"droplet-size":new gl(El.rain["droplet-size"]),"distortion-strength":new gl(El.rain["distortion-strength"])}));this._transitionable=new hl(n,i,r),this.set(e,r),this._transitioning=this._transitionable.untransitioned(),this.properties=new _l(n),this.scope=i}get state(){const e=this.properties.get("opacity"),t=this.properties.get("color"),i=this.properties.get("direction"),r=nt(i[0]),n=-Math.max(nt(i[1]),.01),o=[Math.cos(r)*Math.cos(n),Math.sin(r)*Math.cos(n),Math.sin(n)],a=this.properties.get("vignette-color"),s=new Zr(a.r,a.g,a.b,this.properties.get("vignette"));return{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new Zr(t.r,t.g,t.b,t.a*e),direction:o,centerThinning:this.properties.get("center-thinning"),dropletSize:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:s}}get(){return this._transitionable.serialize()}set(e,t,i={}){if(this._validate(NS,e,i))return;const r={...e},n=El.rain;for(const o of Object.keys(n))void 0===r[o]&&(r[o]=n[o].default);this._options=r,this._transitionable.setTransitionOrValue(this._options,t)}updateConfig(e){this._transitionable.setTransitionOrValue(this._options,e)}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t,i){return(!i||!1!==i.validate)&&CS(this,e.call(zS,{value:t,style:{glyphs:!0,sprite:!0},styleSpec:El}))}};class nT{constructor(e){this._callback=e,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&&(this._channel.port1.close(),this._channel.port2.close()),this._callback=()=>{}}}class oT{constructor(){this.tasks=new Map,bt(["process"],this),this.invoker=new nT(this.process),this.nextId=0}add(e,t){const i=this.nextId++,r=function({type:e,renderSourceType:t,zoom:i}){i=i||0;const r=1===t;return"message"===e?0:"maybePrepare"!==e||r?"parseTile"!==e||r?"parseTile"===e&&r?300-i:"maybePrepare"===e&&r?400-i:500:200-i:100-i}(t);if(0===r){try{e()}finally{}return null}return this.tasks.set(i,{fn:e,metadata:t,priority:r,id:i}),this.invoker.trigger(),{cancel:()=>{this.tasks.delete(i)}}}process(){try{const e=this.pick();if(!e)return;this.tasks.delete(e.id),this.tasks.size>0&&this.invoker.trigger(),e.fn()}finally{}}pick(){let e=null,t=1/0;for(const i of this.tasks.values())i.priority<t&&(t=i.priority,e=i);return e}remove(){this.tasks.clear(),this.invoker.remove()}}const aT={type:"message"},sT={workerUrl:"",workerClass:null,workerParams:void 0};function lT(e){return null!=sT.workerClass?new sT.workerClass:new self.Worker(sT.workerUrl,{name:e,type:"module",...sT.workerParams})}const cT="mapboxgl_preloaded_worker_pool";class uT{constructor(e){this.active={},this.workers=null,this.name=e}acquire(e,t=uT.workerCount){if(!this.workers)for(this.workers=[];this.workers.length<t;){const t=lT(`${this.name||""}WorkerPool: ${e}-${this.workers.length}`);this.workers.push(t)}return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.workers&&0===this.numActive()&&(this.workers.forEach(e=>{e.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[cT]}numActive(){return Object.keys(this.active).length}}uT.workerCount=2;class hT{constructor(e,t,i="Worker",r=uT.workerCount){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=gt();const n=this.workerPool.acquire(this.id,r);for(let o=0;o<n.length;o++){const e=new hT.Actor(n[o],t,this.id);e.name=`${i} ${o}`,this.actors.push(e)}this.ready=!1,this.send("checkIfReady",null).then(()=>{this.ready=!0}).catch(()=>{})}send(e,t,i){return Promise.all(this.actors.map(r=>r.send(e,t,i)))}broadcast(e,t){for(const i of this.actors)i.notify(e,t)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(e=>{e.remove()}),this.actors=[],this.workerPool.release(this.id)}}hT.Actor=class{constructor(e,t,i){this.target=e,this.parent=t,this.mapId=i,this.pendingResponses=new Map,bt(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler=new oT}send(e,t,i){const{signal:r,targetMapId:n,metadata:o}=i||{},a=Math.round(1e18*Math.random()).toString(36).substring(0,10),s=new Set;return r&&r.aborted?Promise.reject(r.reason):(this.target.postMessage({id:a,type:e,targetMapId:n,sourceMapId:this.mapId,data:Os(t,s)},[...s]),new Promise((e,t)=>{const i={resolve:e,reject:t,metadata:o||aT};if(r){const e=()=>{this.pendingResponses.delete(a),t(r.reason)};r.addEventListener("abort",e,{once:!0}),i.detach=()=>r.removeEventListener("abort",e)}this.pendingResponses.set(a,i)}))}notify(e,t,i){const{targetMapId:r}=i||{},n=new Set;this.target.postMessage({type:e,targetMapId:r,sourceMapId:this.mapId,data:Os(t,n)},[...n])}sendCancelable(e,t,i,r){const n=new AbortController;return this.send(e,t,{...i,signal:n.signal}).then(e=>r(null,e)).catch(e=>{"AbortError"!==e.name&&r(e)}),n}getWorkerSourceActor(e){return{scheduler:this.scheduler,send:(t,i,r)=>this.send(t,i,{...r,targetMapId:e}),notify:(t,i)=>{this.notify(t,i,{targetMapId:e})},sendCancelable:(t,i,r,n)=>this.sendCancelable(t,i,{...r,targetMapId:e},n)}}receive(e){const t=e.data;if(!t)return;const i=t.id;if(!t.targetMapId||this.mapId===t.targetMapId)if(Ct(self)){const e=this.pendingResponses.get(i);this.scheduler.add(()=>{this.processTask(i,t)},e&&e.metadata||aT)}else this.processTask(i,t)}async processTask(e,t){if("<response>"===t.type){const i=this.pendingResponses.get(e);if(this.pendingResponses.delete(e),i){i.detach&&i.detach();try{t.error?i.reject(Bs(t.error)):i.resolve(Bs(t.data))}catch(e){i.reject(e)}}return}const i=new Set,r=Bs(t.data);try{let n;if(this.parent[t.type])n=await this.parent[t.type](t.sourceMapId,r);else{if(!this.parent.getWorkerSource)throw new Error(`Could not find function ${t.type}`);{const e=t.type.split("."),{source:i,scope:o}=r,a=this.parent.getWorkerSource(t.sourceMapId,{type:e[0],source:i,scope:o});n=await a[e[1]](r)}}if(!e)return;this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:null,data:Os(n,i)},[...i])}catch(t){this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:Os(t),data:null},[])}}remove(){for(const e of this.pendingResponses.values())e.detach&&e.detach(),e.reject(new DOMException("Actor removed","AbortError"));this.pendingResponses.clear(),this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}};class dT extends Nr{constructor(e,t,i,r){super(),this.scope=i,this._options=e,this.properties=new _l(t),this._transitionable=new hl(t,i,r),this._transitionable.setTransitionOrValue(e.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(e){this._transitionable.setTransitionOrValue(this._options.properties,e)}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(e,t){this._options=e,this._transitionable.setTransitionOrValue(e.properties,t)}shadowsEnabled(){return!!this.properties&&!0===this.properties.get("cast-shadows")}}let pT;const fT=()=>pT||(pT=new wl({color:new gl(El.properties_light_ambient.color),"color-use-theme":new gl({type:"string",default:"default","property-type":"data-constant"}),intensity:new gl(El.properties_light_ambient.intensity)}));let mT;const _T=()=>mT||(mT=new wl({direction:new vl(El.properties_light_directional.direction),color:new gl(El.properties_light_directional.color),"color-use-theme":new gl({type:"string",default:"default","property-type":"data-constant"}),intensity:new gl(El.properties_light_directional.intensity),"cast-shadows":new gl(El.properties_light_directional["cast-shadows"]),"shadow-quality":new gl(El.properties_light_directional["shadow-quality"]),"shadow-intensity":new gl(El.properties_light_directional["shadow-intensity"]),"shadow-draw-before-layer":new gl(El.properties_light_directional["shadow-draw-before-layer"])})),gT=(e,t,i,r,n,o,a,s,l,c=[0,0,1])=>({u_matrix:e,u_normal_matrix:t,u_opacity:i,u_faux_facade_ao_intensity:r,u_camera_pos:n,u_tile_to_meter:o,u_facade_emissive_chance:a,u_flood_light_color:s,u_flood_light_intensity:l,u_front_cutoff_params:c}),yT=e=>({u_matrix:e}),xT=e=>({u_matrix:e}),vT=SA;async function bT(){return Promise.resolve()}function wT(e,t,i,r,n,o,a,s){i.resetLayerRenderingStats(e);const l=e.context,c=l.gl,u=e.transform,h=i.paint.get("fill-extrusion-pattern"),d=i.paint.get("fill-extrusion-pattern-cross-fade"),p=h.constantOr(null),f=h.constantOr(1),m=i.paint.get("fill-extrusion-opacity"),_=e.style.enable3dLights(),g=i.paint.get(_&&!f?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),y=[i.paint.get("fill-extrusion-ambient-occlusion-intensity"),g],x=i.layout.get("fill-extrusion-edge-radius"),v=x>0&&!i.paint.get("fill-extrusion-rounded-roof"),b=v?0:x,w="globe"===u.projection.name?Jx():0,E="globe"===u.projection.name,A=E?mf(u.zoom):0,I=[Wn(u.center.lng),qn(u.center.lat)],S="none"===i.paint.get("fill-extrusion-flood-light-color-use-theme").
vendor: 4,248 bytes, line 2
2constantOr("default"),T=i.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(S?null:i.lut).toArray01().slice(0,3),D=i.paint.get("fill-extrusion-flood-light-intensity"),M=i.paint.get("fill-extrusion-vertical-scale"),P=0!==i.paint.get("fill-extrusion-line-width").constantOr(1),C=i.paint.get("fill-extrusion-height-alignment"),R=i.paint.get("fill-extrusion-base-alignment"),z=jw(e,i.paint.get("fill-extrusion-cutoff-fade-range")),L=i.paint.get("fill-extrusion-front-cutoff"),F=AT(u.pitch,L,!!e.terrain),O=F[2]<1;O&&(e.maxFrontCutoffRawStart=Math.max(e.maxFrontCutoffRawStart,L[0]));const B=[];let k;E&&B.push("PROJECTION_GLOBE_VIEW"),y[0]>0&&B.push("FAUX_AO"),v&&B.push("ZERO_ROOF_RADIUS"),s&&B.push("HAS_CENTROID"),D>0&&B.push("FLOOD_LIGHT"),z.shouldRenderCutoff&&B.push("RENDER_CUTOFF"),O&&B.push("RENDER_FRONT_CUTOFF"),P&&B.push("RENDER_WALL_MODE");const V="shadow"===e.renderPass,N=e.shadowRenderer,U=V&&!!N,j=V?gw.disabled:gw.backCCW;e.shadowRenderer&&(e.shadowRenderer.useNormalOffset=!0);let G=[0,0,0];if(N){const t=e.style.directionalLight,i=e.style.ambientLight;t&&i&&(G=hA(e.style,t,i)),V||(B.push("RENDER_SHADOWS"),N.useNormalOffset&&B.push("NORMAL_OFFSET")),k=B.concat(["SHADOWS_SINGLE_CASCADE"])}const H=U?"fillExtrusionDepth":f?"fillExtrusionPattern":"fillExtrusion",$=i.getLayerRenderingStats();for(const W of r){const r=t.getTile(W),h=r.getBucket(i);if(!h||h.projection.name!==u.projection.name)continue;let _=!1;N&&(_=0===N.getMaxCascadeForTile(W.toUnwrapped()));const g=e.isTileAffectedByFog(W),x=h.programConfigurations.get(i.id);let v=!1;if(p&&r.imageAtlas){const e=r.imageAtlas,t=En.from(p),i=t.getPrimary().scaleSelf(ei.devicePixelRatio).toString(),n=t.getSecondary(),o=e.patternPositions.get(i),a=n?e.patternPositions.get(n.scaleSelf(ei.devicePixelRatio).toString()):null;v=!!o&&!!a,o&&x.setConstantPatternPositions(o,a)}d>0&&(v||x.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&B.push("FILL_EXTRUSION_PATTERN_TRANSITION");const S=e.getOrCreateProgram(H,{config:x,defines:_?k:B,overrideFog:g});if(e.terrain&&e.terrain.setupElevationDraw(r,S,{useMeterToDem:!0}),!h.centroidVertexBuffer){const e=S.getAttributeLocation(c,"a_centroid_pos");-1!==e&&c.vertexAttribI4ui(e,0,0,0,0)}!V&&N&&N.setupShadows(r.tileID.toUnwrapped(),S,"vector-tile"),f&&(e.context.activeTexture.set(c.TEXTURE0),r.imageAtlasTexture&&r.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),x.updatePaintBuffers());const L=i.paint.get("fill-extrusion-vertical-gradient"),O=1/h.tileToMeter;let U;if(V&&N){if(MT(r.tileID,h.maxHeight,e))continue;const t=N.calculateShadowPassMatrixFromTile(r.tileID.toUnwrapped());U=oA(t,b,O,M,C,R)}else{const t=e.translatePosMatrix(W.expandedProjMatrix,r,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),n=u.projection.createInversionMatrix(u,W.canonical),o=S.fixedDefines.includes("LIGHTING_3D_MODE");U=f?aA(t,e,L,m,y,b,O,W,r,w,C,R,A,I,n,T,M,d,o):nA(t,e,L,m,y,b,O,W,w,C,R,A,I,n,T,M,D,G,F,o)}e.uploadCommonUniforms(l,S,W.toUnwrapped(),null,z);let q=h.segments;if("mercator"===u.projection.name&&!V&&(q=h.getVisibleSegments(r.tileID,e.terrain,e.transform.getFrustum(0)),!q.get().length))continue;if($)if(V)for(const e of q.get())$.numRenderedVerticesInShadowPass+=e.primitiveLength;else for(const e of q.get())$.numRenderedVerticesInTransparentPass+=e.primitiveLength;const Z=[];(e.terrain||s)&&Z.push(h.centroidVertexBuffer),E&&Z.push(h.layoutVertexExtBuffer),P&&Z.push(h.wallVertexBuffer),S.draw(e,l.gl.TRIANGLES,n,o,a,j,U,i.id,h.layoutVertexBuffer,h.indexBuffer,q,i.paint,e.transform.zoom,x,Z)}e.shadowRenderer&&(e.shadowRenderer.useNormalOffset=!1)}class ET{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function AT(e,t,i){if(!(t[2]<1)||i)return[0,0,1];const r=180*e/Math.PI;if(r<15)return[-.5,t[1],t[2]];const n=Math.min(1,Math.max(0,(r-15)/5)),o=n*n*(3-2*n);return[-.5*(1-o)+t[0]*o,t[1],t[2]]}function IT(e,t,i,r,n,o,a){0===r.centroidVertexArray.length&&r.createCentroidsBuffer();const s=o?o.findDEMTileFor(i):null;if(!(s&&s.dem||a))return;o&&s&&s.dem&&r.selfDEMTileTimestamp!==s.dem._timestamp&&(r.borderDoneWithNeighborZ=[-1,-1,-1,-1],r.selfDEMTileTimestamp=s.dem._timestamp);const l=(e,t)=>
vendor: 14,527 bytes, line 2
2{(e.flags|t.flags)&Ix?(e.flags|=Ix,t.flags|=Ix):(e.flags&=2147483647,t.flags&=2147483647)},c=e=>new ke(Math.ceil(7*(e+450)),0),u=(e,t,i)=>new ke(Math.ceil(7*(e+450)),Math.floor(Math.max(0,Math.min(8191,i))/4)<<5|(3&t)<<3|7),h=(e,t)=>{const i=Number.MAX_VALUE,r=t[0][0]!==i,n=t[1][0]!==i,o=t[2][0]!==i,a=t[3][0]!==i;if(!((r?1:0)+(n?1:0)+(o?1:0)+(a?1:0)>2))return e<2?o===a?void 0:o?0:8191:r===n?void 0:r?0:8191},d=(e,t,i,r)=>(t?h(e,t):void 0)??(r?h(i,r):void 0),p=e=>{const i=t.getSource().minzoom,r=e=>{const i=t.getTileByID(e);if(i&&i.hasData())return i.getBucket(n)},o=[0,-1,1];for(const t of o){if(e.overscaledZ+t<i)continue;const n=r(e.calculateScaledKey(e.overscaledZ+t));if(n)return n}},f=[0,0,0],m=(e,t)=>(f[0]=Math.min(e.min.y,t.min.y),f[1]=Math.max(e.max.y,t.max.y),f[2]=co-t.min.x>e.max.x?t.min.x-co:e.max.x,f),_=(e,t)=>(f[0]=Math.min(e.min.x,t.min.x),f[1]=Math.max(e.max.x,t.max.x),f[2]=co-t.min.y>e.max.y?t.min.y-co:e.max.y,f),g=[(e,t)=>m(e,t),(e,t)=>m(t,e),(e,t)=>_(e,t),(e,t)=>_(t,e)],y=(e,t,r,n,a,l,c)=>{if(!o)return 0;const u=[[l?r:e,l?e:r,0],[l?r:t,l?t:r,0]],h=c<0?co+c:c,d=[l?h:(e+t)/2,l?(e+t)/2:h,0];return 0===r&&c<0||0!==r&&c>0?o.getForTilePoints(a,[d],!0,n):u.push(d),o.getForTilePoints(i,u,!0,s),Math.max(u[0][2],u[1][2],d[2])/o.exaggeration()};for(let x=0;x<4;x++){const e=r.borderFeatureIndices[x];if(0===e.length)continue;const t=Rf[x](i),n=p(t);if(!(n&&n instanceof Nx))continue;const s=o?o.findDEMTileFor(t):null;if(!(s&&s.dem||a))continue;if(o&&s&&s.dem&&r.borderDEMTileTimestamp[x]!==s.dem._timestamp&&(r.borderDoneWithNeighborZ[x]=-1,r.borderDEMTileTimestamp[x]=s.dem._timestamp),r.borderDoneWithNeighborZ[x]===n.canonical.z)continue;0===n.centroidVertexArray.length&&n.createCentroidsBuffer();const h=(x<2?1:5)-x,f=n.borderDoneWithNeighborZ[h]!==r.canonical.z,m=n.borderFeatureIndices[h];let _=0;if(r.canonical.z!==n.canonical.z){for(const t of e)r.showCentroid(r.featuresOnBorder[t],"discard");if(f)for(const e of m)n.showCentroid(n.featuresOnBorder[e],"discard");r.borderDoneWithNeighborZ[x]=n.canonical.z,n.borderDoneWithNeighborZ[h]=r.canonical.z;continue}const v=new Map,b=new Set,w=new Set;for(let i=0;i<m.length;i++){const e=n.featuresOnBorder[m[i]];void 0!==e.buildingId&&v.set(e.buildingId,i)}for(const i of e){const e=r.featuresOnBorder[i],c=r.centroidData.get(e.centroidDataIndex);if(void 0===e.buildingId)continue;const p=v.get(e.buildingId);if(void 0===p)continue;const f=n.featuresOnBorder[m[p]],_=n.centroidData.get(f.centroidDataIndex);b.add(i),w.add(p),a&&l(c,_);const E=0!==c.groupCentroidPos.x||0!==c.groupCentroidPos.y?c.groupCentroidPos:e.centroid(),A=0!==_.groupCentroidPos.x||0!==_.groupCentroidPos.y?_.groupCentroidPos:f.centroid(),I=o?void 0:d(x,e.borders,h,f.borders),S=void 0!==I?I:x<2?Math.round((E.y+A.y)/2):Math.round((E.x+A.x)/2),T=e.intersectsCount()>1||f.intersectsCount()>1;{let e=0;if(s&&s.dem&&!T){const i=g[x](c,_),r=x%2?8191:0;e=y(i[0],Math.min(8191,i[1]),r,s,t,x<2,i[2])}c.centroidXY=u(e,x,S),_.centroidXY=u(e,h,S)}if(r.writeCentroidToBuffer(c),n.writeCentroidToBuffer(_),void 0!==e.buildingId){for(const t of r.centroidData)t.buildingId===e.buildingId&&t!==c&&(t.centroidXY=c.centroidXY,r.writeCentroidToBuffer(t));for(const t of n.centroidData)t.buildingId===e.buildingId&&t!==_&&(t.centroidXY=_.centroidXY,n.writeCentroidToBuffer(t))}}for(const i of e){if(b.has(i))continue;const e=r.featuresOnBorder[i],p=r.centroidData.get(e.centroidDataIndex),f=e.borders[x];let v;for(;_<m.length;){if(w.has(_)){_++;continue}v=n.featuresOnBorder[m[_]];const e=v.borders[h];if(e[1]>f[0]+3||e[0]>f[0]-3)break;n.showCentroid(v,"keep"),_++}if(v&&_<m.length){let i=_,b=0;for(;;)if(w.has(_)){if(++_===m.length)break;v=n.featuresOnBorder[m[_]]}else{if(v.borders[h][0]>f[1]-3)break;if(b++,++_===m.length)break;v=n.featuresOnBorder[m[_]]}for(;i<m.length&&w.has(i);)i++;if(i>=m.length){r.showCentroid(e,"keep");continue}v=n.featuresOnBorder[m[i]];let E=!1;if(b>=1){const e=v.borders[h];Math.abs(f[0]-e[0])<3&&Math.abs(f[1]-e[1])<3&&(b=1,E=!0,_=i+1)}else if(0===b){r.showCentroid(e,"keep");continue}const A=n.centroidData.get(v.centroidDataIndex);a&&E&&l(p,A);const I=e.intersectsCount()>1||v.intersectsCount()>1;if(b>1)_=i,p.centroidXY=A.centroidXY=new ke(0,0);else if(s&&s.dem&&!I){const e=g[x](p,A),i=x%2?8191:0,r=y(e[0],Math.min(8191,e[1]),i,s,t,x<2,e[2]);p.centroidXY=A.centroidXY=c(r)}else if(I){const t=o?void 0:d(x,e.borders,h,v.borders);void 0!==t?(p.centroidXY=u(0,x,t),A.centroidXY=u(0,h,t)):p.centroidXY=A.centroidXY=new ke(0,0)}else p.centroidXY=r.encodeBorderCentroid(e),A.centroidXY=n.encodeBorderCentroid(v);r.writeCentroidToBuffer(p),n.writeCentroidToBuffer(A)}else r.showCentroid(e,"keep")}r.borderDoneWithNeighborZ[x]=n.canonical.z,n.borderDoneWithNeighborZ[h]=r.canonical.z}(r.needsCentroidUpdate||!r.centroidVertexBuffer&&0!==r.centroidVertexArray.length)&&r.uploadCentroid(e)}const ST=[1,0,0],TT=[0,1,0],DT=[0,0,1];function MT(e,t,i){const r=i.transform,n=i.shadowRenderer;if(!n)return!0;const o=i.frameCounter,a=i.currentShadowCascade;let s=i._shadowCullCache;if(!s||s.frame!==o||s.cascade!==a){const e=r.tileSize*n._cascades[a].scale,t=r.scaleZoom(e),l=n.shadowDirection,c=[l[0],l[1],-l[2]],u=[ST,TT,DT,c,[c[0],0,c[2]],[0,c[1],c[2]]];s={frame:o,cascade:a,cameraFrustum:$p.fromInvProjectionMatrix(r.invProjMatrix,r.worldSize,t,!("globe"===r.projection.name)),edges:u,shadowDir:c,ws:e,zoom:t},i._shadowCullCache=s}const{cameraFrustum:l,edges:c,shadowDir:u,ws:h,zoom:d}=s;let p=t;if(r.elevation){const t=r.elevation.getMinMaxForTile(e);t&&(p+=t.max)}p/=$c(r.center.lat,d);const f=n.computeSimplifiedTileShadowVolume(e.toUnwrapped(),p,h,u);if(!f)return!1;const{vertices:m,planes:_}=f;return 0===l.intersectsPrecise(m,_,c)||0===n.getCurrentCascadeFrustum().intersectsPrecise(m,_,c)}const PT=new Float32Array(16),CT=new Float32Array(16);function RT(e){const{painter:t,source:i,layer:r,coords:n}=e;let o=e.defines;const a=t.context,s="shadow"===t.renderPass,l="light-beam"===t.renderPass,c=t.shadowRenderer,u=$c(t.transform.center.lat,t.transform.zoom),h=jw(t,r.paint.get("building-cutoff-fade-range"));h.shouldRenderCutoff&&(o=o.concat("RENDER_CUTOFF"));const d=r.paint.get("building-front-cutoff"),p=d[2]<1&&!t.terrain,f=AT(t.transform.pitch,d,!!t.terrain);p&&(o=o.concat("RENDER_FRONT_CUTOFF"),t.maxFrontCutoffRawStart=Math.max(t.maxFrontCutoffRawStart,d[0])),e.floodLightIntensity>0&&(o=o.concat("FLOOD_LIGHT"));for(const m of n){const n=i.getTile(m),d=n.getBucket(r);if(!d)continue;c&&0===c.getMaxCascadeForTile(m.toUnwrapped())&&(o=o.concat("SHADOWS_SINGLE_CASCADE"));const p=d.programConfigurations.get(r.id);let _,x;const v=t.translatePosMatrix(m.expandedProjMatrix,n,[0,0],"map");b(PT,v,[1,1,e.verticalScale]);const w=PT;let E;if(s&&c){if(MT(n.tileID,d.maxHeight*u,t))continue;const i=c.calculateShadowPassMatrixFromTile(n.tileID.toUnwrapped());b(i,i,[1,1,e.verticalScale]),E=xT(i),_=x=t.getOrCreateProgram("buildingDepth",{config:p,defines:o,overrideFog:!1})}else if(l)_=x=t.getOrCreateProgram("buildingBloom",{config:p,defines:o,overrideFog:!1}),E=yT(w);else{const i=t.transform.calculatePosMatrix(m.toUnwrapped(),t.transform.worldSize);b(i,i,[1,1,e.verticalScale]),b(CT,i,[1,-1,1/u]),y(CT,CT),g(CT,CT);const r=CT,n=t.transform.getFreeCameraOptions().position,s=1<<m.canonical.z;if(E=gT(w,r,e.opacity,e.facadeAOIntensity,[((n.x-m.wrap)*s-m.canonical.x)*co,(n.y*s-m.canonical.y)*co,n.z*s*co],d.tileToMeter,e.facadeEmissiveChance,e.floodLightColor,e.floodLightIntensity,f),x=t.getOrCreateProgram("building",{config:p,defines:o,overrideFog:!1}),!0===e.depthOnly)_=x;else{const e=o.concat(["BUILDING_FAUX_FACADE","HAS_ATTRIBUTE_a_faux_facade_color_emissive"]);_=t.getOrCreateProgram("building",{config:p,defines:e,overrideFog:!1})}c&&(c.setupShadowsFromMatrix(i,x,!0),_!==x&&_.setShadowUniformValues(a,c.getShadowUniformValues()))}const A=(i,n)=>{if(l){const o=i.entranceBloom;n.draw(t,a.gl.TRIANGLES,e.depthMode,uw.disabled,e.blendMode,gw.disabled,E,r.id,o.layoutVertexBuffer,o.indexBuffer,o.segmentsBucket,r.paint,t.transform.zoom,p,[o.layoutAttenuationBuffer,o.layoutColorBuffer])}else{const o=i.segmentsBucket;let l=[i.layoutNormalBuffer,i.layoutCentroidBuffer,i.layoutColorBuffer,i.layoutFloodLightDataBuffer];i.layoutFacadePaintBuffer&&(l=l.concat([i.layoutFacadeDataBuffer,i.layoutFacadeVerticalRangeBuffer,i.layoutFacadePaintBuffer])),n.draw(t,a.gl.TRIANGLES,e.depthMode,uw.disabled,e.blendMode,s?gw.disabled:gw.backCW,E,r.id,i.layoutVertexBuffer,i.indexBuffer,o,r.paint,t.transform.zoom,p,l)}};t.uploadCommonUniforms(a,x,m.toUnwrapped(),null,h),d.buildingWithoutFacade&&A(d.buildingWithoutFacade,x),d.buildingWithFacade&&(_!==x&&t.uploadCommonUniforms(a,_,m.toUnwrapped(),null,h),A(d.buildingWithFacade,_))}}function zT(e,t,i,r,n,o,a,s,l,c,u,h,d,p){const f=e.context.gl,m=e.depthModeForSublayer(1,fw.ReadOnly,f.LEQUAL,!0),_=Wr(.1,3,u),g=e._showOverdrawInspector,y=h,x=new ET;g||lA(x,e,t,i,r,m,new uw({func:f.ALWAYS,mask:255},255,255,f.KEEP,f.KEEP,f.REPLACE),new pw([f.ONE,f.ONE,f.ONE,f.ONE],Zr.transparent,[!1,!1,!1,!0],f.MIN),gw.disabled,n,"sdf",o,a,s,l,c,_,y,!1,void 0);{const u=g?uw.disabled:new uw({func:f.EQUAL,mask:255},255,255,f.KEEP,f.DECR,f.DECR),h=g?e.colorModeForRenderPass():new pw([f.ONE_MINUS_DST_ALPHA,f.DST_ALPHA,f.ONE,f.ONE],Zr.transparent,[!0,!0,!0,!0]);lA(x,e,t,i,r,m,u,h,gw.disabled,n,"color",o,a,s,l,c,_,y,!1,void 0)}}class LT{constructor(){this._previousClosestBuildingId=null,this._hysteresisRatio=.8,this._indoorMinimumZoom=16}findClosestBuilding(e,t,i,r,n){if(i<this._indoorMinimumZoom)return this._previousClosestBuildingId=null,null;let o=null,a=Number.MAX_VALUE,s=Number.MAX_VALUE,l=!1;const c=this._previousClosestBuildingId?e[this._previousClosestBuildingId]:null;this._previousClosestBuildingId&&c&&this._isBuildingVisible(c,r,n)&&(l=!0,s=this._calculateDistance(t,c));for(const[u,h]of Object.entries(e)){if(!this._isBuildingVisible(h,r,n))continue;const e=this._calculateDistance(t,h);e<a&&(a=e,o=u)}return l&&o&&this._previousClosestBuildingId&&o!==this._previousClosestBuildingId?a>s*this._hysteresisRatio&&(o=this._previousClosestBuildingId):l&&!o&&(o=this._previousClosestBuildingId),this._previousClosestBuildingId=o,o}_calculateDistance(e,t){if(!t.center)return Number.MAX_VALUE;const i=e.lat-t.center[1],r=e.lng-t.center[0];return i*i+r*r}_isBuildingVisible(e,t,i){if(!i)return!1;for(const r of e.floorIds){const t=e.floors[r];if(!t.geometry)continue;const n=t.geometry;if("Polygon"===n.type){if(ad(this._convertRingToPoints(n.coordinates[0]),i))return!0}else if("MultiPolygon"===n.type&&ld(i,this._convertMultiPolygonToPoints(n.coordinates)))return!0}return!1}_convertRingToPoints(e){return e.map(e=>new ke(e[0],e[1]))}_convertMultiPolygonToPoints(e){return e.map(e=>0===e.length?[]:e[0].map(e=>new ke(e[0],e[1])))}}const FT=.05,OT=(e,t,i,r,n,o,a,s,l,c,u,h)=>({u_matrix:e,u_normalize_matrix:t,u_globe_matrix:i,u_merc_matrix:r,u_grid_matrix:n,u_tl_parent:o,u_scale_parent:c,u_fade_t:u.mix,u_opacity:u.opacity,u_image0:0,u_image1:1,u_raster_elevation:h,u_zoom_transition:a,u_merc_center:s,u_cutoff_params:l}),BT=(e,t,i,r,n,o,a,s,l,c)=>({u_particle_texture:e,u_particle_texture_side_len:t,u_tile_offset:i,u_velocity:r,u_color_ramp:o,u_velocity_res:n,u_max_speed:a,u_uv_offset:s,u_data_scale:[255*l[0],255*l[1]],u_data_offset:c,u_particle_pos_scale:1.1,u_particle_pos_offset:[FT,FT]}),kT=(e,t,i,r,n,o,a,s,l,c)=>({u_particle_texture:e,u_particle_texture_side_len:t,u_velocity:i,u_velocity_res:r,u_max_speed:n,u_speed_factor:o,u_reset_rate:a,u_rand_seed:Math.random(),u_uv_offset:s,u_data_scale:[255*l[0],255*l[1]],u_data_offset:c,u_particle_pos_scale:1.1,u_particle_pos_offset:[FT,FT]});function VT(e,[t,i,r,n],[o,a]){if(o===a)return[0,0,0,0];const s=255*(e-1)/(e*(a-o));return[t*s,i*s,r*s,n*s]}function NT(e,t,[i,r]){return i===r?0:.5/e+(t-i)*(e-1)/(e*(r-i))}var UT=lu([{name:"a_index",type:"Int16",components:1}]);class jT{constructor(e,t,i,r){const n={width:i[0],height:i[1],data:null},o=e.gl;this.targetColorTexture=new $m(e,n,o.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new $m(e,n,o.RGBA8,{useMipmap:!1}),this.context=e,this.updateParticleTexture(t,r),this.lastInvalidatedAt=0}updateParticleTexture(e,t){if(this.particleTextureDimension===t.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const i=this.context.gl,r=t.width*t.height;this.particleTexture0=new $m(this.context,t,i.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new $m(this.context,t,i.RGBA8,{premultiply:!1,useMipmap:!1});const n=new $u;n.reserve(r);for(let o=0;o<r;o++)n.emplaceBack(o);this.particleIndexBuffer=this.context.createVertexBuffer(n,UT.members,!0),this.particleSegment=uh.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=t.width}update(e){return!(this.lastInvalidatedAt<e&&(this.lastInvalidatedAt=ei.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}function GT(e,t,i,r,n){if(n>0){const o=ei.now(),a=(o-e.timeAdded)/n,s=t?(o-t.timeAdded)/n:-1,l=i.getSource(),c=r.coveringZoomLevel({tileSize:l.tileSize,roundZoom:l.roundZoom}),u=!t||Math.abs(t.tileID.overscaledZ-c)>Math.abs(e.tileID.overscaledZ-c),h=u&&e.refreshedUponExpiration?1:ht(u?a:1-s,0,1);return t?{opacity:1,mix:1-h,isFading:a<1}:{opacity:h,mix:0,isFading:a<1}}return{opacity:1,mix:0,isFading:!1}}function HT(e,t,i){if(!e)return null;const r=t.getTextureDescriptor(e,i,!0);if(!r)return null;let{texture:n,mix:o,offset:a,tileSize:s,buffer:l,format:c}=r;if(!n||!c)return null;let u=!1;return"uint32"===c&&(u=!0,o[3]=0,o=VT(256,o,[0,i.paint.get("raster-particle-max-speed")]),a=NT(256,a,[0,i.paint.get("raster-particle-max-speed")])),{texture:n,textureOffset:[l/(s+2*l),s/(s+2*l)],tileSize:s,scalarData:u,scale:o,offset:a,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[c]]}}function $T(e){const t=e._nearZ,i=e.projection.farthestPixelDistance(e),r=i-t,n=.2*e.height,o=t+n;return[t,i,(o-n-t)/r,(o-t)/r]}var WT="#ifdef RASTER_ARRAY\nuniform sampler2D u_velocity;uniform mediump vec2 u_velocity_res;uniform mediump float u_max_speed;const vec4 NO_DATA=vec4(1);const vec2 INVALID_VELOCITY=vec2(-1);uniform highp vec2 u_uv_offset;uniform highp float u_data_offset;uniform highp vec2 u_data_scale;
2ivec4 rasterArrayLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}highp vec2 lookup_velocity(highp vec2 uv) {uv=u_uv_offset.x+u_uv_offset.y*uv;highp vec2 fxy;ivec4 c=rasterArrayLinearCoord(uv,u_velocity_res,fxy);highp vec4 tl=texelFetch(u_velocity,c.yz,0);highp vec4 tr=texelFetch(u_velocity,c.xz,0);highp vec4 bl=texelFetch(u_velocity,c.yw,0);highp vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NO_DATA) {return INVALID_VELOCITY;}if (tr==NO_DATA) {return INVALID_VELOCITY;}if (bl==NO_DATA) {return INVALID_VELOCITY;}if (br==NO_DATA) {return INVALID_VELOCITY;}highp vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);highp vec2 velocity=u_data_offset+vec2(dot(t.rg,u_data_scale),dot(t.ba,u_data_scale));velocity.y=-velocity.y;velocity/=max(u_max_speed,length(velocity));return velocity;}\n#endif\nuniform highp float u_particle_pos_scale;uniform highp vec2 u_particle_pos_offset;highp vec4 pack_pos_to_rgba(highp vec2 p) {highp vec2 v=(p+u_particle_pos_offset)/u_particle_pos_scale;highp vec4 r=vec4(v.x,fract(v.x*255.0),v.y,fract(v.y*255.0));return vec4(r.x-r.y/255.0,r.y,r.z-r.w/255.0,r.w);}highp vec2 unpack_pos_from_rgba(highp vec4 v) {v=floor(v*255.0+0.5)/255.0;highp vec2 p=vec2(v.x+(v.y/255.0),v.z+(v.w/255.0));return u_particle_pos_scale*p-u_particle_pos_offset;}";NE["_prelude_raster_particle.glsl"]||(NE["_prelude_raster_particle.glsl"]=WT);var qT={building:KE
vendor: 11,697 bytes, line 2
2('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_indicator_cutout.fragment.glsl"\n#include "_prelude_feature_cutout.fragment.glsl"\nconst float window_depth=0.5;const float ao_radius=0.2;in vec4 v_color;in highp vec3 v_normal;in highp vec3 v_pos;\n#if defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\nin float v_dither_opacity;\n#endif\n#ifdef BUILDING_FAUX_FACADE\nin lowp float v_faux_facade;in highp float v_faux_facade_ed;in highp vec2 v_faux_facade_window;in highp vec2 v_faux_facade_floor;in highp vec2 v_faux_facade_range;in highp float v_aspect;in highp vec3 v_tbn_0;in highp vec3 v_tbn_1;in highp vec3 v_tbn_2;in highp vec4 v_faux_color_emissive;uniform float u_faux_facade_ao_intensity;\n#endif\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;\n#endif\n#ifdef FLOOD_LIGHT\nin highp float v_flood_radius;in float v_has_flood_light;\n#endif\nuniform lowp float u_opacity;uniform vec3 u_camera_pos;uniform highp float u_tile_to_meter;uniform float u_facade_emissive_chance;uniform vec3 u_flood_light_color;uniform float u_flood_light_intensity;vec3 linearTosRGB(in vec3 color) {return pow(color,vec3(1./2.2));}\n#ifdef BUILDING_FAUX_FACADE\nhighp float hash12(in highp vec2 p) {highp vec3 p3 =fract(vec3(p.xyx)*0.1031);p3+=dot(p3,p3.yzx+33.33);return fract((p3.x+p3.y)*p3.z);}float min3(in vec3 v) {return min(min(v.x,v.y),v.z);}highp vec2 get_uv_mask_id(in highp vec2 q,out highp float mask,out highp vec2 id) {highp vec2 p=q;mask=step(v_faux_facade_range.x,p.y)*step(p.y,v_faux_facade_range.y);p.y=p.y-v_faux_facade_range.x;highp vec2 uv=modf(p/v_faux_facade_floor,id);highp vec4 d=(v_faux_facade_floor.xyxy+vec4(-v_faux_facade_window,v_faux_facade_window))*0.5;highp vec4 edge=d/v_faux_facade_floor.xyxy;highp vec2 m=step(edge.xy,uv)*step(uv,edge.zw);mask*=m.x*m.y;uv-=vec2(0.5);uv*=vec2(0.5)/(vec2(0.5)-edge.xy);uv+=vec2(0.5);return uv;}highp float ray_unit_box(in highp vec3 ray_o,in highp vec3 ray_d,in highp vec3 bmin,in highp vec3 bmax) {highp vec3 planes=mix(bmin,bmax,step(0.0,ray_d));highp vec3 t=(planes-ray_o)/ray_d;return min3(t);}float get_emissive(in vec2 id) {if (u_facade_emissive_chance > 0.0) {return (step(hash12(id),u_facade_emissive_chance)+0.05)*v_faux_color_emissive.a;}return 0.0;}vec3 get_shade_info(in highp vec3 v,in highp vec3 v_normalized,in vec3 color,in vec2 id,in mat3 tbn,inout vec3 out_normal,inout float out_emissive) {vec3 out_color=color;highp vec3 abs_v=abs(v_normalized);bool x_major=abs_v.x >=abs_v.y && abs_v.x >=abs_v.z;bool y_major=abs_v.y >=abs_v.x && abs_v.y >=abs_v.z;bool z_major=abs_v.z >=abs_v.x && abs_v.z >=abs_v.y;if (x_major) {out_normal=-sign(v.x)*tbn[0];} else if (y_major) {out_normal=vec3(0.0,0.0,-sign(v.y));} else if (z_major) {out_color=v_faux_color_emissive.rgb;out_emissive=v.z <=0.0 ? get_emissive(id) : out_emissive;}float ao=1.0;if (u_faux_facade_ao_intensity > 0.0) {vec4 ao_range=v_faux_facade_window.xxyy*0.5-vec4(0,ao_radius,0,ao_radius);vec2 ao_range_z=vec2(window_depth*0.5)-vec2(0.0,ao_radius);if (x_major || y_major) {ao*=smoothstep(-ao_range_z.x,-ao_range_z.y,v.z);} else if (z_major) {ao*=smoothstep(-ao_range.x,-ao_range.y,v.x)*(1.0-smoothstep(ao_range.y,ao_range.x,v.x));ao*=smoothstep(-ao_range.z,-ao_range.w,v.y)*(1.0-smoothstep(ao_range.w,ao_range.z,v.y));}ao=mix(1.0,min(1.0,ao+0.25),u_faux_facade_ao_intensity);}out_color*=ao;return out_color;}\n#endif\nvec3 apply_lighting_linear(in vec3 color,in vec3 normal,in float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return color*(ambient_contrib+directional_contrib);}void main() {vec3 normal=normalize(v_normal);vec3 base_color=v_color.rgb;float emissive=v_color.a;\n#ifdef BUILDING_FAUX_FACADE\nif (v_faux_facade > 0.0) {highp mat3 tbn=mat3(v_tbn_0,v_tbn_1,v_tbn_2);highp vec3 v=vec3(v_pos.xy,v_pos.z/u_tile_to_meter)-u_camera_pos;highp vec3 view_tangent=transpose(tbn)*v;highp vec2 q=vec2(v_faux_facade_ed,v_pos.z);float mask=0.0;vec2 id=vec2(0.0);highp vec2 uv=get_uv_mask_id(q,mask,id);uv*=v_faux_facade_window;highp vec3 bmin=vec3(0.0,0.0,-window_depth);highp vec3 bmax=bmin+vec3(v_faux_facade_window,window_depth);highp vec3 ray_o=vec3(uv,0.0);highp vec3 ray_d=normalize(view_tangent);highp float t_min=ray_unit_box(ray_o,ray_d,bmin,bmax);highp vec3 hit=ray_o+t_min*ray_d;highp vec3 r=vec3(v_faux_facade_window,-window_depth);hit-=r*0.5;highp vec3 normalized=hit/r;vec3 out_normal=normal;float out_emissive=emissive;vec3 room_color=get_shade_info(hit,normalized,base_color,id,tbn,out_normal,out_emissive);base_color=mix(base_color,room_color,mask);normal=mix(normal,out_normal,mask);emissive=mix(emissive,out_emissive,mask);}\n#endif\nvec4 color=vec4(base_color,1.0);vec3 xy_flipped_normal=vec3(-normal.xy,normal.z);float shadowed_lighting_factor=0.0;\n#ifdef RENDER_SHADOWS\n#ifdef RENDER_CUTOFF\nshadowed_lighting_factor=shadowed_light_factor_normal_opacity(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;}\n#else\nshadowed_lighting_factor=shadowed_light_factor_normal(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);\n#endif\n#else\nshadowed_lighting_factor=max(0.0,dot(xy_flipped_normal,u_lighting_directional_dir));\n#endif\ncolor.rgb=apply_lighting_linear(color.rgb,xy_flipped_normal,shadowed_lighting_factor);color.rgb=linearTosRGB(color.rgb);\n#ifdef FLOOD_LIGHT\nfloat flood_radiance=(1.0-min(v_pos.z/v_flood_radius,1.0))*u_flood_light_intensity*v_has_flood_light;color.rgb=mix(color.rgb,u_flood_light_color,flood_radiance);\n#endif\ncolor.rgb=mix(color.rgb,linearTosRGB(base_color.rgb),emissive);\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos,v_pos.z));\n#endif\ncolor*=u_opacity;\n#if defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\nif (v_dither_opacity < 1.0) {int index=viewport_dither_index(gl_FragCoord.xy);if (v_dither_opacity < DITHER_THRESHOLDS[index]) {discard;}}\n#endif\nglFragColor=color;\n#ifdef DEBUG_SHOW_NORMALS\ncolor.rgb=xy_flipped_normal*0.5+vec3(0.5,0.5,0.5);color.a=1.0;glFragColor=color;\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_feature_cutout.vertex.glsl"\nin vec3 a_pos_3f;in ivec4 a_normal_3;in ivec4 a_centroid_3;\n#ifdef FLOOD_LIGHT\nin int a_flood_light_wall_radius_1i16;\n#endif\n#ifdef BUILDING_FAUX_FACADE\nin uvec4 a_faux_facade_data;in uvec2 a_faux_facade_vertical_range;\n#endif\nuniform mat4 u_matrix;uniform mat4 u_normal_matrix;uniform highp float u_tile_to_meter;\n#if defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\n#ifdef RENDER_FRONT_CUTOFF\nuniform vec3 u_front_cutoff_params;\n#endif\nout float v_dither_opacity;\n#endif\nout vec4 v_color;out vec3 v_normal;out highp vec3 v_pos;\n#ifdef BUILDING_FAUX_FACADE\nout lowp float v_faux_facade;out highp float v_faux_facade_ed;out highp vec2 v_faux_facade_window;out highp vec2 v_faux_facade_floor;out highp vec2 v_faux_facade_range;out highp float v_aspect;out highp vec3 v_tbn_0;out highp vec3 v_tbn_1;out highp vec3 v_tbn_2;out highp vec4 v_faux_color_emissive;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;\n#endif\n#ifdef FLOOD_LIGHT\nout highp float v_flood_radius;out float v_has_flood_light;\n#endif\nconst float MAX_UINT_16=65535.0;const float MAX_INT_16=32767.0;const float MAX_UINT_8=255.0;const float TWO_POW_8=256.0;const float FLOOD_LIGHT_MAX_RADIUS_METER=2048.0;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}\n#ifdef BUILDING_FAUX_FACADE\nmat3 get_tbn(in vec3 normal) {const vec3 bitangent=vec3(0.0,0.0,1.0);vec3 tangent=normalize(vec3(normal.y,-normal.x,0.0));return mat3(tangent,bitangent,normal);}\n#endif\n#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 part_color_emissive\n#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 faux_facade_color_emissive\nvoid main() {\n#pragma mapbox: initialize-attribute-custom highp uvec2 part_color_emissive\n#pragma mapbox: initialize-attribute-custom highp uvec2 faux_facade_color_emissive\n#ifdef FLOOD_LIGHT\nv_flood_radius=(float(a_flood_light_wall_radius_1i16)/MAX_INT_16*FLOOD_LIGHT_MAX_RADIUS_METER);v_has_flood_light=step(0.0,v_flood_radius);\n#endif\nvec4 color_emissive=decode_color(vec2(part_color_emissive));v_color=vec4(sRGBToLinear(color_emissive.rgb),color_emissive.a);vec3 a_normal_3f=vec3(a_normal_3)/MAX_INT_16;v_normal=vec3(u_normal_matrix*vec4(a_normal_3f,0.0));float hidden=0.0;float depth_offset=0.0;float frontCutoffOpacity=1.0;float routeFade=0.0;vec2 centroid_xy=vec2(a_centroid_3.xy >> 2);vec2 spanBits=vec2(a_centroid_3.xy & 3);\n#ifdef BUILDING_FAUX_FACADE\nvec4 faux_facade_data=vec4(a_faux_facade_data);v_faux_facade=faux_facade_data.x;if (v_faux_facade > 0.0) {v_faux_facade_ed=faux_facade_data.x *u_tile_to_meter;float window_x_perc=floor(faux_facade_data.y/TWO_POW_8);float window_y_perc=faux_facade_data.y-TWO_POW_8*window_x_perc;vec2 window_perc=vec2(window_x_perc,window_y_perc)/MAX_UINT_8;v_faux_facade_floor=(faux_facade_data.zw/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_faux_facade_window=window_perc*v_faux_facade_floor;v_faux_facade_range=(vec2(a_faux_facade_vertical_range)/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_aspect=v_faux_facade_window.x/v_faux_facade_window.y;mat3 tbn=get_tbn(normalize(v_normal));v_tbn_0=tbn[0];v_tbn_1=tbn[1];v_tbn_2=tbn[2];v_faux_color_emissive=decode_color(vec2(faux_facade_color_emissive));v_faux_color_emissive.rgb=sRGBToLinear(v_faux_color_emissive.rgb);depth_offset=min(1000.0,float(a_centroid_3.z))*0.0000002;}\n#endif\nv_pos=a_pos_3f;\n#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)\nfloat halfSpanX=spanBits.x*10.0/u_tile_to_meter;float halfSpanY=spanBits.y*10.0/u_tile_to_meter;vec2 screenUpInTile=vec2(u_matrix[0][1],u_matrix[1][1]);vec2 spanOffset=vec2(halfSpanX,halfSpanY)*sign(screenUpInTile);vec2 cutoff_highestCorner=centroid_xy+spanOffset;vec2 cutoff_lowestCorner=centroid_xy-spanOffset;\n#endif\n#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)\nvec4 ground=u_matrix*vec4(centroid_xy,0.0,1.0);\n#endif\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,ground.z);hidden=float(v_cutoff_opacity==0.0);v_pos.z*=v_cutoff_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nvec3 shadow_pos=v_pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset_model(v_normal);shadow_pos+=offset*shadow_normal_offset_multiplier0();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shadow_pos,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(shadow_pos,1.0);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(v_pos);\n#endif\n#ifdef RENDER_FRONT_CUTOFF\n{hidden=max(hidden,float(ground.w <=0.0));float ndc_y=ground.y/max(ground.w,0.001);float threshold=u_front_cutoff_params.x*2.0-1.0;float range_ndc=u_front_cutoff_params.y*2.0;hidden=max(hidden,float(ndc_y < threshold-range_ndc));float t=clamp((ndc_y-(threshold-range_ndc))/max(range_ndc,0.001),0.0,1.0);frontCutoffOpacity=mix(u_front_cutoff_params.z,1.0,t);}\n#endif\ngl_Position=mix(u_matrix*vec4(v_pos,1),AWAY,hidden);gl_Position.z-=depth_offset*gl_Position.w;\n#if defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\nv_dither_opacity=1.0;\n#ifdef RENDER_FRONT_CUTOFF\nv_dither_opacity=min(v_dither_opacity,frontCutoffOpacity);\n#endif\n#endif\n}'),buildingBloom:
2KE("in vec4 v_color_emissive;\n#pragma mapbox: define-attribute highp vec4 bloom_attenuation\nfloat saturate(float val) {return clamp(val,0.0,1.0);}void main() {\n#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation\nfloat emission=v_color_emissive.a;float opacity=1.0;\n#ifdef HAS_ATTRIBUTE_a_bloom_attenuation\nfloat distance=length(vec2(1.3*max(0.0,abs(bloom_attenuation.x)-bloom_attenuation.z),bloom_attenuation.y));distance+= mix(0.5,0.0,clamp(emission-1.0,0.0,1.0));opacity*=saturate(1.0-distance*distance);\n#endif\n#ifdef RENDER_CUTOFF\nopacity*=v_cutoff_opacity;\n#endif\nglFragColor=vec4(v_color_emissive.rgb,1.0)*opacity;}","in vec3 a_pos_3f;\n#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 part_color_emissive\n#pragma mapbox: define-attribute highp vec4 bloom_attenuation\nout vec4 v_color_emissive;uniform mat4 u_matrix;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {\n#pragma mapbox: initialize-attribute-custom highp uvec2 part_color_emissive\n#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation\n#ifdef HAS_ATTRIBUTE_a_part_color_emissive\nvec4 color_emissive=decode_color(vec2(part_color_emissive));float part_emissive=color_emissive.a*5.0;v_color_emissive=vec4(sRGBToLinear(color_emissive.rgb),part_emissive);\n#else\nv_color_emissive=vec4(1.0);\n#endif\ngl_Position=u_matrix*vec4(a_pos_3f,1.0);\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n}"),buildingDepth:KE("void main() {}","in vec3 a_pos_3f;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos_3f,1.0);}"),rasterParticle:KE('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;uniform sampler2D u_image0;uniform sampler2D u_image1;void main() {vec4 color0,color1,color;color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 out_color=color.rgb;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),1.0).rgb;\n#endif\n#ifdef FOG\nhighp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\nin ivec2 a_pos;in uvec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvX=mercatorX*tiles-idx;float uvY=mercatorY*tiles-idy;uv=vec2(uvX,uvY);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\nuv=vec2(a_texture_pos)/8192.0;
2gl_Position=u_matrix*vec4(vec2(a_pos)*w,u_raster_elevation*w,w);\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));\n#endif\n#endif\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}'),rasterParticleDraw:KE("uniform sampler2D u_color_ramp;in float v_particle_speed;void main() {glFragColor=texture(u_color_ramp,vec2(v_particle_speed,0.5));}",'#include "_prelude_raster_particle.glsl"\nin int a_index;uniform sampler2D u_particle_texture;uniform float u_particle_texture_side_len;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {ivec2 pixel_coord=ivec2(\nmod(float(a_index),u_particle_texture_side_len),float(a_index)/u_particle_texture_side_len);vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);vec2 pos=unpack_pos_from_rgba(pixel)+u_tile_offset;vec2 tex_coord=fract(pos);vec2 velocity=lookup_velocity(tex_coord);if (velocity==INVALID_VELOCITY) {gl_Position=AWAY;v_particle_speed=0.0;} else {gl_Position=vec4(2.0*pos-1.0,0,1);v_particle_speed=length(velocity);}gl_PointSize=1.0;}'),rasterParticleTexture:KE("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}","in ivec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*vec2(a_pos)+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}"),rasterParticleUpdate:KE('#include "_prelude_raster_particle.glsl"\nuniform sampler2D u_particle_texture;uniform mediump float u_particle_texture_side_len;uniform mediump float u_speed_factor;uniform highp float u_reset_rate;uniform highp float u_rand_seed;in highp vec2 v_tex_coord;vec2 linearstep(vec2 edge0,vec2 edge1,vec2 x) {return  clamp((x-edge0)/(edge1-edge0),vec2(0),vec2(1));}const highp vec3 rand_constants=vec3(12.9898,78.233,4375.85453);highp float rand(const highp vec2 co) {highp float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}void main() {ivec2 pixel_coord=ivec2(v_tex_coord*u_particle_texture_side_len);highp vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);highp vec2 pos=unpack_pos_from_rgba(pixel);highp vec2 velocity=lookup_velocity(clamp(pos,0.0,1.0));highp vec2 dp=velocity==INVALID_VELOCITY ? vec2(0) : velocity*u_speed_factor;pos=pos+dp;highp vec2 seed=(pos+v_tex_coord)*u_rand_seed;highp vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));highp vec2 persist_rate=pow(\nlinearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4)\n);highp vec2 per_frame_persist=pow(persist_rate,abs(dp)/u_particle_pos_offset);highp float drop_rate=1.0-per_frame_persist.x*per_frame_persist.y;drop_rate=any(greaterThanEqual(abs(pos-0.5),vec2(0.5+u_particle_pos_offset))) ? 1.0 : drop_rate;highp float drop=step(1.0-drop_rate-u_reset_rate,rand(seed));highp vec2 next_pos=mix(pos,random_pos,drop);glFragColor=pack_pos_to_rgba(next_pos);}',"in ivec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*vec2(a_pos+ivec2(1));gl_Position=vec4(a_pos,0.0,1.0);}"),snowParticle:KE("in highp vec2 uv;in highp float alphaMultiplier;uniform vec4 u_particleColor;uniform vec2 u_simpleShapeParameters;void main() {float t=clamp((length(uv)-u_simpleShapeParameters.x)/(1.0-u_simpleShapeParameters.x),0.0,1.0);float alpha=1.0-pow(t,pow(10.0,u_simpleShapeParameters.y));alpha*=alphaMultiplier;alpha*=u_particleColor.a;vec3 color=u_particleColor.rgb*alpha;glFragColor=vec4(color,alpha) ;HANDLE_WIREFRAME_DEBUG;}","\nin highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_snowParticleData;in highp vec4 a_snowParticleDataHorizontalOscillation;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform vec2 u_screenSize;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; \nuniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; \nuniform float u_horizontalOscillationRate; \nuniform float u_billboardSize;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;out highp vec2 uv;out highp float alphaMultiplier;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos.xyz*=halfBoxSize;pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_snowParticleData.z;float coneAngleHeadingRad=a_snowParticleData.w*radians(360.0);vec3 localZ=normalize(u_direction);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 direction;direction.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.z=cos(coneAnglePichRad);direction=normalize(direction);vec3 simPosLocal=vec3(0,0,0);float velocityScale=(1.0+3.0*a_snowParticleData.y)*u_velocity;simPosLocal+=direction*velocityScale*u_time;float horizontalOscillationRadius=u_horizontalOscillationRadius*a_snowParticleDataHorizontalOscillation.x;float horizontalOscillationAngle=u_horizontalOscillationRate*u_time*(-1.0+2.0*a_snowParticleDataHorizontalOscillation.y);
2simPosLocal.xy+=horizontalOscillationRadius*vec2(cos(horizontalOscillationAngle),sin(horizontalOscillationAngle));vec3 simPos=localX*simPosLocal.x+\nlocalY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);float clipZ=-u_cam_pos.z+pos.z;vec4 posView=u_modelview*vec4(pos,1.0);float size=u_billboardSize;alphaMultiplier=1.0;vec4 posScreen=u_projection*posView;posScreen/=posScreen.w;posScreen.xy=vec2(0.5)+posScreen.xy*0.5;posScreen.xy*=u_screenSize;vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=u_screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-posScreen.xy)/(0.5*u_screenSize));screenDist+=a_snowParticleData.x*u_thinningParticleOffset;float scaleFactorMode=0.0;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);if (a_snowParticleData.x < u_thinningAffectedRatio) {scaleFactorMode=1.0-thinningFadeRatio;alphaMultiplier=thinningFadeRatio;}}vec4 posScreen1=u_projection*vec4(posView.x-size,posView.yzw);posScreen1/=posScreen1.w;vec4 posScreen2=u_projection*vec4(posView.x+size,posView.yzw);posScreen2/=posScreen2.w;posScreen1.xy=vec2(0.5)+posScreen1.xy*0.5;posScreen1.xy*=u_screenSize;posScreen2.xy=vec2(0.5)+posScreen2.xy*0.5;posScreen2.xy*=u_screenSize;float screenLength=length(posScreen1.xy-posScreen2.xy);float screenEpsilon=3.0;float scaleFactor=1.0;if (screenLength < screenEpsilon) {scaleFactor=screenEpsilon/max(screenLength,0.01);scaleFactor=mix(scaleFactor,1.0,scaleFactorMode);}float screenEpsilon2=15.0;if (screenLength > screenEpsilon2) {scaleFactor=screenEpsilon2/max(screenLength,0.01);}size*=scaleFactor;vec2 right=size*vec2(1,0);vec2 up=size*vec2(0,1);posView.xy+=right*a_uv.x;posView.xy+=up*a_uv.y;uv=a_uv;gl_Position=u_projection*posView;}"),rainParticle:KE("in highp vec2 uv;in highp float particleRandomValue;uniform sampler2D u_texScreen;uniform float u_distortionStrength;uniform vec4 u_color;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;uniform float u_shapeDirectionalPower;uniform float u_mode;void main() {vec2 st=uv*0.5+vec2(0.5);vec2 uvm=uv;uvm.y=-1.0+2.0*pow(st.y,u_shapeDirectionalPower);float shape=clamp(1.0-length(uvm),0.0,1.0);float alpha=abs(shape)*u_color.a;vec2 screenSize=vec2(textureSize(u_texScreen,0));vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-gl_FragCoord.xy)/(0.5*screenSize));screenDist+=(0.5+0.5*particleRandomValue)*u_thinningParticleOffset;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;float thinningAlpha=1.0;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);thinningAlpha*=thinningFadeRatio;}vec2 offsetXY=normalize(uvm)*abs(shape);vec2 stScreen=(gl_FragCoord.xy+offsetXY*u_distortionStrength*thinningAlpha)/screenSize;vec3 colorScreen=texture(u_texScreen,stScreen).rgb;alpha*=thinningAlpha;glFragColor=mix(vec4(colorScreen,1.0),vec4(u_color.rgb*alpha,alpha),u_mode);HANDLE_WIREFRAME_DEBUG;}","\nin highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_rainParticleData;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; \nuniform float u_velocity; \nuniform vec2 u_rainDropletSize;uniform vec3 u_rainDirection;out highp vec2 uv;out highp float particleRandomValue;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos*=halfBoxSize; \npos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_rainParticleData.z;float coneAngleHeadingRad=a_rainParticleData.w*radians(360.0);vec3 localZ=normalize(u_rainDirection);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 directionLocal;directionLocal.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.z=cos(coneAnglePichRad);directionLocal=normalize(directionLocal);vec3 directionWorld=localX*directionLocal.x+localY*directionLocal.y+localZ*directionLocal.z;float velocityScale=(1.0+3.0*a_rainParticleData.y)*u_velocity;vec3 simPosLocal=vec3(0,0,0);simPosLocal+=directionLocal*velocityScale*u_time;vec3 simPos=localX*simPosLocal.x+\nlocalY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);vec4 posView=u_modelview*vec4(pos,1.0);vec3 directionView=normalize((u_modelview*vec4(directionWorld,0.0)).xyz);vec3 side=cross(directionView,normalize(posView.xyz));posView.xyz+=side*a_uv.x*u_rainDropletSize.x;posView.xyz+=directionView*a_uv.y*u_rainDropletSize.y;uv=a_uv;particleRandomValue=a_rainParticleData.x;gl_Position=u_projection*posView;}"),vignette:KE("uniform vec3 u_vignetteShape;uniform vec4 u_vignetteColor;in vec2 st;void main() {float screenDist=length(st);float alpha=clamp((screenDist-u_vignetteShape.x)/u_vignetteShape.y,0.0,1.0);alpha=pow(alpha,u_vignetteShape.z)*u_vignetteColor.a;vec3 color=u_vignetteColor.rgb;glFragColor=vec4(color*alpha,alpha) ;}","in vec2 a_pos_2f;out vec2 st;void main() {st=a_pos_2f;gl_Position=vec4(a_pos_2f,0,1);}"),elevatedStructuresDepth:KE("void main() {}","in ivec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform float u_depth_bias;void main() {gl_Position=u_matrix*vec4(a_pos,a_height,1);gl_Position.z=gl_Position.z+u_depth_bias;}"),elevatedStructures:KE('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_indicator_cutout.fragment.glsl"\n#include "_prelude_feature_cutout.fragment.glsl"\nin vec3 v_normal;in float v_height;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth;\n#endif\nvec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
2vec3 compute_view_dependent_emissive_color(float ndotl,float emissive_strength,vec3 color)\n{color=sRGBToLinear(color);color=color*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);color=linearTosRGB(color.rgb);return color;}uniform float u_emissive_strength;uniform float u_opacity_multiplier;\n#pragma mapbox: define highp vec4 structure_color\nvoid main() {\n#pragma mapbox: initialize highp vec4 structure_color\nvec3 color=structure_color.xyz;vec2 cutout_factors=vec2(0.0);\n#ifdef LIGHTING_3D_MODE\nvec3 normal=normalize(v_normal);vec3 transformed_normal=vec3(-normal.xy,normal.z);float ndotl=calculate_NdotL(transformed_normal);float emissive_strength=u_emissive_strength;emissive_strength=0.0;vec3 emissive_color=compute_view_dependent_emissive_color(ndotl,emissive_strength,color.xyz);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);color.rgb=apply_lighting(color.rgb,transformed_normal,light);\n#else\ncolor=apply_lighting(color,transformed_normal);\n#endif\ncolor=mix(color,emissive_color,emissive_strength);if (v_height < 0.0) {float penetration=max(v_height+7.5,0.0);float occlusion=1.0-1.0/PI*acos(1.0-penetration/4.0);color=color*(1.0-pow(occlusion,2.0)*0.3);}\n#endif\n#ifdef FOG\ncolor=fog_apply(color,v_fog_pos);\n#endif\nvec4 out_color=vec4(color,1.0);out_color*=u_opacity_multiplier;glFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin ivec2 a_pos;in float a_height;in ivec4 a_pos_normal_3;uniform mat4 u_matrix;out vec3 v_normal;out float v_height;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth;\n#endif\n#pragma mapbox: define highp vec4 structure_color\nvoid main() {\n#pragma mapbox: initialize highp vec4 structure_color\nv_normal=vec3(a_pos_normal_3)/16384.0;v_height=a_height;vec3 pos=vec3(vec2(a_pos),a_height);gl_Position=u_matrix*vec4(pos,1);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=pos;vec3 shd_pos1=pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(-v_normal.xy,v_normal.z));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));\n#endif\n}'),elevatedStructuresDepthReconstruct:KE('#include "_prelude_feature_cutout.fragment.glsl"\n#ifdef DEPTH_RECONSTRUCTION\nin float v_height;\n#endif\nvoid main() {\n#ifdef DEPTH_RECONSTRUCTION\nif (v_height >=0.0)\ndiscard;\n#else\n#endif\nglFragColor=vec4(1.0,0.0,0.0,1.0);}',"in ivec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform vec3 u_camera_pos;uniform highp float u_depth_bias;uniform lowp float u_height_scale;uniform lowp float u_reset_depth;\n#ifdef DEPTH_RECONSTRUCTION\nout float v_height;\n#endif\nvoid main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale);\n#ifdef DEPTH_RECONSTRUCTION\nif (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height;\n#endif\ngl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}")};KE(WT,"");const ZT=lu([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]),XT=lu([{type:"Float32",name:"a_pos_2f",components:2}]);class YT{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(e,t){const i=e.getOrCreateProgram("vignette");if(!this.vignetteVx||!this.vignetteIdx){const t=new Nu,i=new Ru;t.emplaceBack(-1,-1),t.emplaceBack(1,-1),t.emplaceBack(1,1),t.emplaceBack(-1,1),i.emplaceBack(0,1,2),i.emplaceBack(0,2,3),this.vignetteVx=e.context.createVertexBuffer(t,XT.members),this.vignetteIdx=e.context.createIndexBuffer(i)}const r=uh.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){e.uploadCommonUniforms(e.context,i);const o={u_vignetteShape:(n={vignetteShape:[t.start,t.range,Math.pow(10,t.fadePower)],vignetteColor:[t.color.r,t.color.g,t.color.b,t.color.a*t.strength]}).vignetteShape,u_vignetteColor:n.vignetteColor};i.draw(e,e.context.gl.TRIANGLES,fw.disabled,uw.disabled,pw.alphaBlended,gw.disabled,o,"vignette",this.vignetteVx,this.vignetteIdx,r)}var n}}class KT{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(e,t){const i=e.getFreeCameraOptions().position,r=i.toAltitude(),n=i.toLngLat(),o=nt(n.lng),a=nt(n.lat),s=e.pixelsPerMeter/t,l=o*Oc,c=Oc*Math.log(Math.tan(Math.PI/4+a/2));if(void 0===this._offsetXPrev)this._offsetXPrev=0,this._offsetYPrev=0,this._elevationPrev=0,this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0;else{const e=-this._offsetYPrev+c,t=-this._elevationPrev+r;this._accumulatedOffsetX+=(-this._offsetXPrev+l)*s,this._accumulatedOffsetY+=e*s,this._accumulatedElevation+=t*s,this._offsetXPrev=l,this._offsetYPrev=c,this._elevationPrev=r}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function JT(e,t){return[-(e[0]-Math.floor(e[0]/t)*t),-(e[1]-Math.floor(e[1]/t)*t),-(e[2]-Math.floor(e[2]/t)*t)]}function QT(e){const t=Za(1323123451230),i=[];for(let r=0;r<e;++r){const e=2*t()-1,r=2*t()-1,n=2*t()-1;i.push(V(e,r,n))}return i}function eD(e,t,i,r,n){return Wr(e,t,ht((n-i)/(r-i),0,1))}class tD{constructor(e){this._movement=new KT,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new YT,this._ppmScaleFactor=e}destroy(){this.particlesVx&&this.particlesVx.destroy(),this.particlesIdx&&this.particlesIdx.destroy(),this._vignette&&this._vignette.destroy()}updateOnRender(e,t){const i=e.transform;this._movement.update(i,this._ppmScaleFactor);const r=i.starsProjMatrix,n=ge([]);xe(n,n,nt(90)-i._pitch),be(n,n,-i.angle);const o=R(new Float32Array(16),n),a=x([],g([],new Float32Array([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1])),o),s=Date.now()/1e3;return this._accumulatedTimeFromStart+=(s-this._prevTime)*t,this._prevTime=s,{projectionMatrix:r,modelviewMatrix:a}}}const iD=lu([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_snowParticleData",components:4},{type:"Float32",name:"a_snowParticleDataHorizontalOscillation",components:2}]),rD=(e,t)=>({u_matrix:e,u_depth_bias:t}),nD=(e,t)=>({u_matrix:e,u_ground_shadow_factor:t,u_opacity_multiplier:1}),oD=(e,t,i,r,n)=>({u_matrix:e,u_camera_pos:[t[0],t[1],t[2]],u_depth_bias:i,u_height_scale:r,u_reset_depth:n}),aD={building:e=>({u_matrix:new Th(e),u_normal_matrix:new Th(e),u_opacity:new bh(e),u_faux_facade_ao_intensity:new bh(e),u_camera_pos:new Eh(e),u_tile_to_meter:new bh(e),u_facade_emissive_chance:new bh(e),u_flood_light_color:new Eh(e),u_flood_light_intensity:new bh(e),u_front_cutoff_params:new Eh(e)}),buildingBloom:e=>({u_matrix:new Th(e)}),buildingDepth:e=>({u_matrix:new Th(e)}
vendor: 10,107 bytes, line 2
2),elevatedStructuresDepth:e=>({u_matrix:new Th(e),u_depth_bias:new bh(e)}),elevatedStructures:e=>({u_matrix:new Th(e),u_ground_shadow_factor:new Eh(e),u_opacity_multiplier:new bh(e)}),elevatedStructuresDepthReconstruct:e=>({u_matrix:new Th(e),u_camera_pos:new Eh(e),u_depth_bias:new bh(e),u_height_scale:new bh(e),u_reset_depth:new bh(e)}),rasterParticle:e=>({u_matrix:new Th(e),u_normalize_matrix:new Th(e),u_globe_matrix:new Th(e),u_merc_matrix:new Th(e),u_grid_matrix:new Dh(e),u_tl_parent:new wh(e),u_scale_parent:new bh(e),u_fade_t:new bh(e),u_opacity:new bh(e),u_image0:new vh(e),u_image1:new vh(e),u_raster_elevation:new bh(e),u_zoom_transition:new bh(e),u_merc_center:new wh(e),u_cutoff_params:new Ih(e)}),rasterParticleTexture:e=>({u_texture:new vh(e),u_opacity:new bh(e)}),rasterParticleDraw:e=>({u_particle_texture:new vh(e),u_particle_texture_side_len:new bh(e),u_tile_offset:new wh(e),u_velocity:new vh(e),u_color_ramp:new vh(e),u_velocity_res:new wh(e),u_max_speed:new bh(e),u_uv_offset:new wh(e),u_data_scale:new wh(e),u_data_offset:new bh(e),u_particle_pos_scale:new bh(e),u_particle_pos_offset:new wh(e)}),rasterParticleUpdate:e=>({u_particle_texture:new vh(e),u_particle_texture_side_len:new bh(e),u_velocity:new vh(e),u_velocity_res:new wh(e),u_max_speed:new bh(e),u_speed_factor:new bh(e),u_reset_rate:new bh(e),u_rand_seed:new bh(e),u_uv_offset:new wh(e),u_data_scale:new wh(e),u_data_offset:new bh(e),u_particle_pos_scale:new bh(e),u_particle_pos_offset:new wh(e)}),snowParticle:e=>({u_modelview:new Th(e),u_projection:new Th(e),u_time:new bh(e),u_cam_pos:new Eh(e),u_velocityConeAperture:new bh(e),u_velocity:new bh(e),u_horizontalOscillationRadius:new bh(e),u_horizontalOscillationRate:new bh(e),u_boxSize:new bh(e),u_billboardSize:new bh(e),u_simpleShapeParameters:new wh(e),u_screenSize:new wh(e),u_thinningCenterPos:new wh(e),u_thinningShape:new Eh(e),u_thinningAffectedRatio:new bh(e),u_thinningParticleOffset:new bh(e),u_particleColor:new Ih(e),u_direction:new Eh(e)}),rainParticle:e=>({u_modelview:new Th(e),u_projection:new Th(e),u_time:new bh(e),u_cam_pos:new Eh(e),u_texScreen:new vh(e),u_velocityConeAperture:new bh(e),u_velocity:new bh(e),u_boxSize:new bh(e),u_rainDropletSize:new wh(e),u_distortionStrength:new bh(e),u_rainDirection:new Eh(e),u_color:new Ih(e),u_screenSize:new wh(e),u_thinningCenterPos:new wh(e),u_thinningShape:new Eh(e),u_thinningAffectedRatio:new bh(e),u_thinningParticleOffset:new bh(e),u_shapeDirectionalPower:new bh(e),u_shapeNormalPower:new bh(e),u_mode:new bh(e)}),vignette:e=>({u_vignetteShape:new Eh(e),u_vignetteColor:new Ih(e)})};function sD(e,t){const i=1<<e.canonical.z;return V((t.x*i-e.canonical.x-e.wrap*i)*co,(t.y*i-e.canonical.y)*co,jc(t.z,t.y))}function lD(e){let t=0;for(const i of e)t|=i.frcMask;return t}class cD{constructor(e=[]){this.tiles=e}getTile(e){for(const t of this.tiles)if(t.tileId.z===e.z&&t.tileId.x===e.x&&t.tileId.y===e.y)return t;return null}getTileOrParent(e){for(let t=e.z;t>0;--t){const i=Math.floor(e.x/(1<<e.z-t)),r=Math.floor(e.y/(1<<e.z-t));for(const e of this.tiles)if(e.tileId.z===t&&e.tileId.x===i&&e.tileId.y===r&&0!==e.frcMask)return e}return null}getFullCoverageMask(e){let t=null,i=0;for(let u=e.z;u>0;--u){const r=Math.floor(e.x/(1<<e.z-u)),n=Math.floor(e.y/(1<<e.z-u));for(const e of this.tiles)if(e.tileId.z===u&&e.tileId.x===r&&e.tileId.y===n){t=e,i=u;break}if(t)break}if(!t||0===t.frcMask)return null;const r=1<<e.z-i,n=co/r,o=e.x%r*n,a=e.y%r*n,s=o+n,l=a+n;let c=0;for(const u of t.polygons)0!==u.frcMask&&(u.hasGeometry()?0===u.rings.length||e.z<=i||uD(u.rings,o,a,s,l)&&(c|=u.frcMask):c|=u.frcMask);return 0!==c?c:null}equals(e){if(this.tiles.length!==e.length)return!1;for(let t=0;t<this.tiles.length;++t){const i=this.tiles[t],r=e[t];if(i.tileId.z!==r.tileId.z||i.tileId.x!==r.tileId.x||i.tileId.y!==r.tileId.y||i.frcMask!==r.frcMask||i.polygons.length!==r.polygons.length)return!1}return!0}empty(){return 0===this.tiles.length}}function uD(e,t,i,r,n){const o=[0,0,0,0],a=[t,r,r,t],s=[i,i,n,n];for(const l of e){const e=l.length;if(!(e<2))for(let c=0,u=e-1;c<e;u=c++){const e=l[u].x,h=l[u].y,d=l[c].x,p=l[c].y;for(let t=0;t<4;++t)h>s[t]!=p>s[t]&&a[t]<e+(d-e)*(s[t]-h)/(p-h)&&o[t]++;let f=0,m=0;if(e<t?f|=1:e>r&&(f|=2),h<i?f|=4:h>n&&(f|=8),d<t?m|=1:d>r&&(m|=2),p<i?m|=4:p>n&&(m|=8),!(f&m)){if(0===f||0===m)return!1;if(hD(e,h,d,p,t,i,r,n))return!1}}}for(let l=0;l<4;++l)if(!(1&o[l]))return!1;return!0}function hD(e,t,i,r,n,o,a,s){const l=(e,t,i,r,n,o,a,s)=>{const l=(i-e)*(o-t)-(r-t)*(n-e),c=(i-e)*(s-t)-(r-t)*(a-e);if(l>0&&c>0||l<0&&c<0)return!1;const u=(a-n)*(t-o)-(s-o)*(e-n),h=(a-n)*(r-o)-(s-o)*(i-n);return!(u>0&&h>0||u<0&&h<0)};return!!(l(e,t,i,r,n,o,a,o)||l(e,t,i,r,a,o,a,s)||l(e,t,i,r,n,s,a,s)||l(e,t,i,r,n,o,n,s))}class dD{constructor(){this._tileCoverages=[],this._snapshot=new cD}clear(){this._tileCoverages=[]}addTileCoverage(e,t){this._tileCoverages.push({tileId:e,polygons:t,frcMask:lD(t)})}empty(){return 0===this._tileCoverages.length}updateSnapshotIfNeeded(){if(this._snapshot.equals(this._tileCoverages))return this._snapshot;const e=this._tileCoverages.map(e=>({tileId:e.tileId,polygons:e.polygons,frcMask:e.frcMask}));return this._snapshot=new cD(e),this._snapshot}}function pD(e,t){const i={};if(!t)return i;for(const r of e){const e=r.layerIds.map(e=>t.getLayer(e)).filter(Boolean);if(0!==e.length){r.layers=e,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map(t=>e.filter(e=>e.id===t)[0])),r.updateExpressions&&r.updateExpressions(e);for(const t of e)i[t.fqid]=r}}return i}const fD=32,mD=33,_D=new Uint16Array(8184);for(let JF=0;JF<2046;JF++){let e=JF+2,t=0,i=0,r=0,n=0,o=0,a=0;for(1&e?r=n=o=fD:t=i=a=fD;(e>>=1)>1;){const s=t+r>>1,l=i+n>>1;1&e?(r=t,n=i,t=o,i=a):(t=r,i=n,r=o,n=a),o=s,a=l}const s=4*JF;_D[s+0]=t,_D[s+1]=i,_D[s+2]=r,_D[s+3]=n}const gD=new Uint16Array(2178),yD=new Uint8Array(1089),xD=new Uint16Array(1089);function vD(e){return 0===e?-.03125:32===e?.03125:0}var bD=lu([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Uint16",components:2}]);const wD={type:2,extent:co,loadGeometry:()=>[[new ke(0,0),new ke(8193,0),new ke(8193,8193),new ke(0,8193),new ke(0,0)]]};let ED,AD=0;class ID{constructor(e,t,i,r,n,o){this.tileID=e,this.uid=gt(),this.uses=0,this.tileSize=t,this.tileZoom=i,this.dashIdealZ=e.overscaledZ,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasTunnelGeometry=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=n,r&&r.style&&(this._lastUpdatedBrightness=r.style.getBrightness()),this._lastAvailableImagesCount=0,this._firstPrepareComplete=!1,this.expiredRequestCount=0,this.state="loading",r&&r.transform&&(this.projection=r.transform.projection),this.worldview=o,this._hasAppearances=null}registerFadeDuration(e){const t=e+this.timeAdded;t<ei.now()||void 0!==this.fadeEndTime&&t<this.fadeEndTime||(this.fadeEndTime=t)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}get tileTransform(){return this._tileTransform||(this._tileTransform=zf(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(e,t,i){if(this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=pD(e.buckets,t.style),e.frcCoveragePolygons&&e.frcCoveragePolygons.length>0&&(this.frcCoveragePolygons=e.frcCoveragePolygons),this.hasDeferredRoadStructure=!!e.hasDeferredRoadStructure,void 0!==e.parsedElevationFeatures&&(this.parsedElevationFeatures=e.parsedElevationFeatures,this.parsedElevationGeneration=++AD),this.hasDeferredElevationFeatures=!!e.hasDeferredElevationFeatures,this.hasSymbolBuckets=!1,this.hasTunnelGeometry=!!e.hasTunnelGeometry;for(const e in this.buckets){const t=this.buckets[e];if(t instanceof S_){if(this.hasSymbolBuckets=!0,!i)break;t.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const e in this.buckets){const t=this.buckets[e];if(t instanceof S_&&t.hasRTLText){this.hasRTLText=!0,sl();break}}this.queryPadding=0;for(const e in this.buckets){const i=this.buckets[e],r=t.style.getOwnLayer(e);if(!r)continue;const n=r.queryRadius(i)||0;this.queryPadding=Math.max(this.queryPadding,n)}e.imageAtlas&&(this.imageAtlas=t.style.imageManager.imageAtlasCache.getOrCache(e.imageAtlas)),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),e.lineAtlas&&(this.lineAtlas=e.lineAtlas),this._lastUpdatedBrightness=e.brightness}else this.collisionBoxArray=new Zu}resetPlacementVisibility(){for(const e in this.buckets)this.buckets[e].resetPlacementVisibility?.()}unloadVectorData(){if(this.hasData()){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&(this.imageAtlasTexture=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}loadModelData(e,t,i){e&&(e.resourceTiming&&(this.resourceTiming=e.resourceTiming),this.buckets={...this.buckets,...pD(e.buckets,t.style)}
vendor: 7,229 bytes, line 2
2,e.featureIndex&&(this.latestFeatureIndex=e.featureIndex))}getBucket(e){return this.buckets[e.fqid]}upload(e,t){for(const n in this.buckets){const i=this.buckets[n];if(i.uploadPending()){let r={},n=[],o={zoom:0,pitch:0,brightness:0,worldview:""};if(t){if(t.style){n=t.style.listImages();const e=i.layers[0],o=e.sourceLayer||"_geojsonTileLayer",a=t.style.getLayerSourceCache(e);a&&(r=a._state.getState(o,void 0))}o={zoom:t.transform.zoom||0,pitch:t.transform.pitch||0,brightness:t.style.getBrightness()||0,worldview:t.worldview||""}}i.upload(e,this.tileID.canonical,r,n,o)}}const i=e.gl,r=this.imageAtlas;r&&t&&(this.imageAtlasTexture=t.style.imageManager.imageAtlasCache.getTextureForAtlas(r,e,i.RGBA8),r.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new $m(e,this.glyphAtlasImage,i.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new $m(e,this.lineAtlas.image,i.R8),this.lineAtlas.uploaded=!0)}prepare(e,t,i){if(this.imageAtlas&&this.imageAtlasTexture&&t){const r=t.style.getLut(i);this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture,i,r)}if(!t||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;const r=t.style.getBrightness(),n=t.style.listImages(),o=n.length,a=t.style._changes.getUpdatedPaintProperties(),s=Object.keys(this.buckets).some(e=>this.buckets[e].layers.some(e=>a.has(e.fqid))),l=Object.keys(this.buckets).some(e=>this.buckets[e].layers.some(e=>e.hasTransition&&e.hasTransition())),c=this._firstPrepareComplete&&o!==this._lastAvailableImagesCount;null===this._hasAppearances&&(this._hasAppearances=this.hasAppearances(t));const u=this._lastUpdatedBrightness!==r;this._lastAvailableImagesCount=o,this._firstPrepareComplete=!0,(this._lastUpdatedBrightness||r||this._hasAppearances||s||l||c)&&(!(this._hasAppearances||s||l||c)&&this._lastUpdatedBrightness&&r&&Math.abs(this._lastUpdatedBrightness-r)<.001||(this.updateBuckets(t,u,void 0,c||s||l,a,n),this._lastUpdatedBrightness=r))}evaluateQueryRenderedFeaturePadding(){let e=0;for(const t in this.buckets){const i=this.buckets[t];i.evaluateQueryRenderedFeaturePadding&&(e=Math.max(e,i.evaluateQueryRenderedFeaturePadding()))}return e}queryRenderedFeatures(e,t,i,r,n,o,a){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile)return{};const s=this.evaluateQueryRenderedFeaturePadding(),l=function(e,t){const i=S([],[.5*e.width,.5*-e.height,1]);return v(i,i,[1,-1,0]),x(i,i,e.calculateProjMatrix(t.toUnwrapped())),Float32Array.from(i)}(n,this.tileID);return this.latestFeatureIndex.query(e,{tilespaceGeometry:t,pixelPosMatrix:l,transform:r,availableImages:i,tileTransform:this.tileTransform,worldview:this.worldview,queryRadius:s,scope:a})}querySourceFeatures(e,t){const i=this.latestFeatureIndex;if(!i||!i.rawTileData)return;const r=i.loadVTLayers(),n=t?t.sourceLayer:"",o=r._geojsonTileLayer||r[n];if(!o)return;const a=Tl(t&&t.filter),{z:s,x:l,y:c}=this.tileID.canonical,u={z:s,x:l,y:c};for(let h=0;h<o.length;h++){const t=o.feature(h);if(a.needGeometry){const e=ru(t,!0);if(!a.filter(new ll(this.tileID.overscaledZ,{worldview:this.worldview}),e,this.tileID.canonical))continue}else if(!a.filter(new ll(this.tileID.overscaledZ,{worldview:this.worldview}),t))continue;const r=i.getId(t,n),d=new rw(t,s,l,c,r);d.tile=u,e.push(d)}}loaded(){return"loaded"===this.state||"errored"===this.state}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return!!this.imageAtlas&&!!this.imageAtlas.patternPositions.size}setExpiryData(e){const t=this.expirationTime;if(e.cacheControl){const t=Rt(e.cacheControl);t["max-age"]&&(this.expirationTime=Date.now()+1e3*t["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const e=Date.now();let i=!1;if(this.expirationTime>e)i=!1;else if(t)if(this.expirationTime<t)i=!0;else{const r=this.expirationTime-t;r?this.expirationTime=e+Math.max(r,3e4):i=!0}else i=!0;i?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-Date.now(),Math.pow(2,31)-1)}refreshFeatureState(e,t){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile||!e)return;const i=e.style.listImages();this.updateBuckets(e,!1,t,void 0,void 0,i)}hasAppearances(e){for(const t in this.buckets)if(e.style.hasLayer(t)&&this.buckets[t].layers.some(e=>e.appearances&&e.appearances.length>0))return!0;return!1}updateBuckets(e,t,i,r,n,o){if(!this.latestFeatureIndex)return;if(!e.style)return;const a=o||e.style.listImages(),s=e.style.getBrightness(),l=n||new Set;for(const c in this.buckets){if(!e.style.hasLayer(c))continue;const n=this.buckets[c],o=n.layers[0],u=o.sourceLayer||"_geojsonTileLayer",h=e.style.getLayerSourceCache(o),d=n.layers.some(e=>l.has(e.fqid)),p=(r||d)&&n instanceof S_?e.style.getOwnLayer(c):void 0;let f=i&&i[u]||{};h&&!i&&(f=h._state.getState(u,void 0));const m=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},_=Object.keys(f).length>0&&!t;n.hasAppearances=n.layers.some(e=>e.appearances&&e.appearances.length>0);const g=_?n.stateDependentLayers:n.layers;if(_&&0!==n.stateDependentLayers.length||t||d||r){const i=this.latestFeatureIndex.loadVTLayers()[u];if(n.update(f,i,a,m,g,t,s,this.tileID.canonical),(r||d)&&(!t||t&&n instanceof S_&&(!n.text.uboBinder||n.text.uboBinder.isLightConstant||!n.icon.uboBinder||n.icon.uboBinder.isLightConstant))&&n instanceof S_&&p&&"symbol"===p.type){const e=n;e.text&&e.text.uboBinder&&e.text.uboBinder.updateDynamicExpressions(p,i,this.tileID.canonical,a,f,s),e.icon&&e.icon.uboBinder&&e.icon.uboBinder.updateDynamicExpressions(p,i,this.tileID.canonical,a,f,s)}if(n instanceof S_){const t=n,i=e.context;t.text&&t.text.uboBinder&&t.text.uboBinder.upload(i),t.icon&&t.icon.uboBinder&&t.icon.uboBinder.upload(i)}}if(_&&0!==n.stateDependentLayers.length||t||n.hasAppearances){const t={zoom:e.transform.zoom,pitch:e.transform.pitch,brightness:e.style.getBrightness()||0,worldview:e.worldview},i=n.updateAppearances(this.tileID.canonical,f,a,t,e.imageManager,_&&0!==n.stateDependentLayers.length);if(i&&i.hasUboChanges){const t=e.context;n instanceof S_&&n.text&&n.text.uboBinder&&n.text.uboBinder.upload(t),n instanceof S_&&n.icon&&n.icon.uboBinder&&n.icon.uboBinder.upload(t)}}(n instanceof Nd||n instanceof $h)&&e._terrain&&e._terrain.enabled&&h&&n.uploadPending()&&e._terrain._clearRenderCacheForTile(h.id,this.tileID);const y=e&&e.style&&e.style.getOwnLayer(c);y&&(this.queryPadding=Math.max(this.queryPadding,y.queryRadius(n)||0))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<ei.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=ei.now()+e}setTexture(e,t){const i=t.context,r=i.gl;this.texture=this.texture||t.getTileTexture(e.width),this.texture&&this.texture instanceof $m?this.texture.update(e):(this.texture=new $m(i,e,r.RGBA8,{useMipmap:!0}),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE))}
vendor: 6,824 bytes, line 2
2setDependencies(e,t){const i={};for(const r of t)i[r]=!0;this.dependencies[e]=i}hasDependency(e,t){for(const i of e){const e=this.dependencies[i];if(e)for(const i of t)if(e[i])return!0}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(e,t){if(!t||"mercator"===t.name||this._tileDebugBuffer)return;const i=iu(wD,this.tileID.canonical,this.tileTransform)[0],r=new uu,n=new ju;for(let o=0;o<i.length;o++){const{x:e,y:t}=i[o];r.emplaceBack(e,t),n.emplaceBack(o)}n.emplaceBack(0),this._tileDebugIndexBuffer=e.createIndexBuffer(n),this._tileDebugBuffer=e.createVertexBuffer(r,Op.members),this._tileDebugSegments=uh.simpleSegment(0,0,r.length,n.length)}_makeTileBoundsBuffers(e,t){if(this._tileBoundsBuffer||!t||"mercator"===t.name)return;const i=iu(wD,this.tileID.canonical,this.tileTransform)[0];let r,n;if(this.isRaster){const e=function(e,t){const i=zf(e,t),r=Math.pow(2,e.z);for(let c=0;c<mD;c++)for(let n=0;n<mD;n++){const o=Zn((e.x+(n+vD(n))/fD)/r),a=Xn((e.y+(c+vD(c))/fD)/r),s=t.project(o,a),l=c*mD+n;gD[2*l+0]=Math.round((s.x*i.scale-i.x)*co),gD[2*l+1]=Math.round((s.y*i.scale-i.y)*co)}yD.fill(0),xD.fill(0);for(let c=2045;c>=0;c--){const e=4*c,t=_D[e+0],i=_D[e+1],r=_D[e+2],n=_D[e+3],o=t+r>>1,a=i+n>>1,s=o+a-i,l=a+t-o,u=i*mD+t,h=n*mD+r,d=a*mD+o,p=Math.hypot((gD[2*u+0]+gD[2*h+0])/2-gD[2*d+0],(gD[2*u+1]+gD[2*h+1])/2-gD[2*d+1])>=16;yD[d]=yD[d]||(p?1:0),c<1022&&(yD[d]=yD[d]||yD[(i+l>>1)*mD+(t+s>>1)]||yD[(n+l>>1)*mD+(r+s>>1)])}const n=new du,o=new Ru;let a=0;function s(e,t){const i=t*mD+e;return 0===xD[i]&&(n.emplaceBack(gD[2*i+0],gD[2*i+1],e*co/fD,t*co/fD),xD[i]=++a),xD[i]-1}function l(e,t,i,r,n,a){const c=e+i>>1,u=t+r>>1;if(Math.abs(e-n)+Math.abs(t-a)>1&&yD[u*mD+c])l(n,a,e,t,c,u),l(i,r,n,a,c,u);else{const l=s(e,t),c=s(i,r),u=s(n,a);o.emplaceBack(l,c,u)}}return l(0,0,fD,fD,fD,0),l(fD,fD,0,0,0,fD),{vertices:n,indices:o}}(this.tileID.canonical,t);r=e.vertices,n=e.indices}else{r=new du,n=new Ru;for(const{x:t,y:n}of i)r.emplaceBack(t,n,0,0);const e=ec(r.int16.subarray(0,4*r.length),void 0,4);for(let t=0;t<e.length;t+=3)n.emplaceBack(e[t],e[t+1],e[t+2])}this._tileBoundsBuffer=e.createVertexBuffer(r,bD.members),this._tileBoundsIndexBuffer=e.createIndexBuffer(n),this._tileBoundsSegments=uh.simpleSegment(0,0,r.length,n.length)}_makeGlobeTileDebugBuffers(e,t){const i=t.projection;if(!i||"globe"!==i.name||t.freezeTileCoverage)return;const r=this.tileID.canonical,n=cf(ef(r,t)),o=mf(t.zoom);let a;o>0&&(a=y(new Float64Array(16),t.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(e,r,t,n,a,o),this._makeGlobeTileDebugTextBuffer(e,r,t,n,a,o)}_globePoint(e,t,i,r,n,o,a){let s=af(e,t,i);if(o){const n=1<<i.z,l=Wn(r.center.lng),c=qn(r.center.lat),u=(i.x+.5)/n-l;let h=0;u>.5?h=-1:u<-.5&&(h=1);let d=(e/co+i.x)/n+h,p=(t/co+i.y)/n;d=(d-l)*r._pixelsPerMercatorPixel+l,p=(p-c)*r._pixelsPerMercatorPixel+c;const f=[d*r.worldSize,p*r.worldSize,0];ie(f,f,o),s=Qp(s,f,a)}return ie(s,s,n)}_makeGlobeTileDebugBorderBuffer(e,t,i,r,n,o){const a=new uu,s=new ju,l=new hu,c=(e,c,u,h,d)=>{const p=(u-e)/(d-1),f=(h-c)/(d-1),m=a.length;for(let _=0;_<d;_++){const u=e+_*p,h=c+_*f;a.emplaceBack(u,h);const d=this._globePoint(u,h,t,i,r,n,o);l.emplaceBack(d[0],d[1],d[2]),s.emplaceBack(m+_)}},u=co;c(0,0,u,0,16),c(u,0,u,u,16),c(u,u,0,u,16),c(0,u,0,0,16),this._tileDebugIndexBuffer=e.createIndexBuffer(s),this._tileDebugBuffer=e.createVertexBuffer(a,Op.members),this._globeTileDebugBorderBuffer=e.createVertexBuffer(l,Fp.members),this._tileDebugSegments=uh.simpleSegment(0,0,a.length,s.length)}_makeGlobeTileDebugTextBuffer(e,t,i,r,n,o){const a=new uu,s=new Ru,l=new hu,c=25;s.reserve(32),a.reserve(c),l.reserve(c);const u=(e,t)=>c*e+t;for(let h=0;h<c;h++){const e=2048*h;for(let s=0;s<c;s++){const c=2048*s;a.emplaceBack(c,e);const u=this._globePoint(c,e,t,i,r,n,o);l.emplaceBack(u[0],u[1],u[2])}}for(let h=0;h<4;h++)for(let e=0;e<4;e++){const t=u(h,e),i=u(h,e+1),r=u(h+1,e),n=u(h+1,e+1);s.emplaceBack(t,i,r),s.emplaceBack(r,i,n)}this._tileDebugTextIndexBuffer=e.createIndexBuffer(s),this._tileDebugTextBuffer=e.createVertexBuffer(a,Op.members),this._globeTileDebugTextBuffer=e.createVertexBuffer(l,Fp.members),this._tileDebugTextSegments=uh.simpleSegment(0,0,c,32)}destroy(e=!0){for(const t in this.buckets)this.buckets[t].destroy(e);this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&delete this.imageAtlasTexture,this.glyphAtlasTexture&&(this.glyphAtlasTexture.destroy(),delete this.glyphAtlasTexture),this.lineAtlasTexture&&(this.lineAtlasTexture.destroy(),delete this.lineAtlasTexture),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),e&&this.texture&&this.texture instanceof $m&&(this.texture.destroy(),delete this.texture),this.emissiveTexture&&this.emissiveTexture instanceof $m&&(this.emissiveTexture.destroy(),delete this.emissiveTexture),this.hillshadeFBO&&(this.hillshadeFBO.destroy(),delete this.hillshadeFBO),this.dem&&delete this.dem,this.neighboringTiles&&delete this.neighboringTiles,this.demTexture&&(this.demTexture.destroy(),delete this.demTexture),this.rasterParticleState&&(this.rasterParticleState.destroy(),delete this.rasterParticleState),this.latestFeatureIndex=null,this.state="unloaded"}}class SD{constructor(e,t){this.max=e,this.onRemove=t,this.reset()}reset(){for(const e in this.data)for(const t of this.data[e])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(e,t,i){const r=e.wrapped().key;void 0===this.data[r]&&(this.data[r]=[]);const n={value:t,timeout:void 0};if(void 0!==i&&(n.timeout=setTimeout(()=>{this.remove(e,n)},i)),this.data[r].push(n),this.order.push(r),this.order.length>this.max){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){const t=this.data[e];return t?t[0].value:null}
vendor: 8,781 bytes, line 2
2get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;const i=e.wrapped().key,r=void 0===t?0:this.data[i].indexOf(t),n=this.data[i][r];return this.data[i].splice(r,1),n.timeout&&clearTimeout(n.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(n.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){const t=[];for(const i in this.data)for(const r of this.data[i])e(r.value)||t.push(r);for(const i of t)this.remove(i.value.tileID,i)}}class TD{constructor(){this.state=Object.create(null),this.stateChanges=Object.create(null),this.deletedStates=Object.create(null)}updateState(e,t,i){const r=String(t);if(this.stateChanges[e]=this.stateChanges[e]||Object.create(null),this.stateChanges[e][r]=this.stateChanges[e][r]||Object.create(null),Object.assign(this.stateChanges[e][r],i),null===this.deletedStates[e]){this.deletedStates[e]=Object.create(null);for(const t in this.state[e])t!==r&&(this.deletedStates[e][t]=null)}else if(this.deletedStates[e]&&null===this.deletedStates[e][r]){this.deletedStates[e][r]=Object.create(null);for(const t in this.state[e][r])i[t]||(this.deletedStates[e][r][t]=null)}else for(const n in i)this.deletedStates[e]&&this.deletedStates[e][r]&&null===this.deletedStates[e][r][n]&&delete this.deletedStates[e][r][n]}removeFeatureState(e,t,i){if(null===this.deletedStates[e])return;const r=String(t);if(this.deletedStates[e]=this.deletedStates[e]||Object.create(null),i&&void 0!==t)null!==this.deletedStates[e][r]&&(this.deletedStates[e][r]=this.deletedStates[e][r]||Object.create(null),this.deletedStates[e][r][i]=null);else if(void 0!==t)if(this.stateChanges[e]&&this.stateChanges[e][r])for(i in this.deletedStates[e][r]=Object.create(null),this.stateChanges[e][r])this.deletedStates[e][r][i]=null;else this.deletedStates[e][r]=null;else this.deletedStates[e]=null}getState(e,t){const i=this.state[e]||Object.create(null),r=this.stateChanges[e]||Object.create(null),n=this.deletedStates[e];if(null===n)return Object.create(null);if(void 0!==t){const e=String(t),o=Object.assign(Object.create(null),i[e],r[e]);if(n){const e=n[t];if(null===e)return Object.create(null);for(const t in e)delete o[t]}return o}const o=Object.assign(Object.create(null),i,r);if(n)for(const a in n)delete o[a];return o}initializeTileState(e,t){e.refreshFeatureState(t)}coalesceChanges(e,t){const i=Object.create(null);for(const r in this.stateChanges){this.state[r]=this.state[r]||Object.create(null);const e=Object.create(null);for(const t in this.stateChanges[r])this.state[r][t]||(this.state[r][t]=Object.create(null)),Object.assign(this.state[r][t],this.stateChanges[r][t]),e[t]=this.state[r][t];i[r]=e}for(const r in this.deletedStates){this.state[r]=this.state[r]||Object.create(null);const e=Object.create(null);if(null===this.deletedStates[r])for(const t in this.state[r])e[t]=Object.create(null),this.state[r][t]=Object.create(null);else for(const t in this.deletedStates[r]){if(null===this.deletedStates[r][t])this.state[r][t]=Object.create(null);else if(this.state[r][t])for(const e of Object.keys(this.deletedStates[r][t]))delete this.state[r][t][e];e[t]=this.state[r][t]}i[r]=i[r]||Object.create(null),Object.assign(i[r],e)}if(this.stateChanges=Object.create(null),this.deletedStates=Object.create(null),0!==Object.keys(i).length)for(const r in e)e[r].refreshFeatureState(t,i)}}class DD extends Nr{constructor(e,t,i){super(),this.id=e,this._renderSourceType=i,this._maxzoomOverride=null,this.setSource(t),this._tiles={},this._cache=new SD(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=t.minTileCacheSize,this._maxTileCacheSize=t.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new TD,this._isRaster="raster"===this._source.type||"raster-dem"===this._source.type||"raster-array"===this._source.type||"custom"===this._source.type&&"_dataType"in this._source&&"raster"===this._source._dataType,this._supportsFading="raster"===this._source.type||"raster-array"===this._source.type||"image"===this._source.type||"video"===this._source.type||"custom"===this._source.type,this._isRasterElevatedOverTerrain=!1}onAdd(e){this.map=e,this._minTileCacheSize=void 0===this._minTileCacheSize&&e?e._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=void 0===this._maxTileCacheSize&&e?e._maxTileCacheSize:this._maxTileCacheSize}setSource(e){e.on("data",e=>{"source"===e.dataType&&"metadata"===e.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===e.dataType&&"content"===e.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))}),e.on("error",()=>{this._sourceErrored=!0}),this._source=e}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;for(const e in this._tiles)if(!this._tiles[e].loaded())return!1;return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform)}setMaxzoomOverride(e){this._maxzoomOverride=e}_loadTile(e,t){return e.renderSourceType=this._renderSourceType,e.isExtraShadowCaster=this._shadowCasterTiles[e.tileID.key],this._source.loadTile(e,t)}_unloadTile(e){if(this._source.unloadTile)return this._source.unloadTile(e)}_abortTile(e){if(this._source.abortTile)return this._source.abortTile(e)}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const t in this._tiles){const i=this._tiles[t];i.upload(e,this.map?this.map.painter:void 0),i.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(MD).map(e=>e.key)}getRenderableIds(e,t){const i=[];for(const r in this._tiles)this._isIdRenderable(+r,e,t)&&i.push(this._tiles[r]);return e?i.sort((e,t)=>{const i=e.tileID,r=t.tileID,n=new ke(i.canonical.x,i.canonical.y)._rotate(this.transform.angle),o=new ke(r.canonical.x,r.canonical.y)._rotate(this.transform.angle);return i.overscaledZ-r.overscaledZ||o.y-n.y||o.x-n.x}).map(e=>e.tileID.key):i.map(e=>e.tileID).sort(MD).map(e=>e.key)}hasRenderableParent(e){const t=this.findLoadedParent(e,0);return!!t&&this._isIdRenderable(t.tileID.key)}_isIdRenderable(e,t,i){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(t||!this._tiles[e].holdingForFade())&&(i||!this._shadowCasterTiles[e])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const e in this._tiles)"errored"!==this._tiles[e].state&&this._reloadTile(+e,"reloading")}}_reloadTile(e,t){const i=this._tiles[e];i&&("loading"!==i.state&&(i.state=t),this._loadTile(i,this._tileLoaded.bind(this,i,e,t)))}_tileLoaded(e,t,i,r,n){if(r){if(e.state="errored",Vi(r)){if(this._source.fire(new Or("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:e})),!(e.tileID.key in this._loadedParentTiles))return;if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){const e=this.map.painter.terrain;this.update(this.transform,e.getScaledDemTileSize(),!0),e.resetTileLookupCache(this.id)}else this.update(this.transform)}else this._source.fire(new Br(r,{tile:e}));return}e.timeAdded=ei.now(),"expired"===i&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(t,e),"raster-dem"===this._source.type&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null);let o=new Headers;n&&n.headers&&(o=n.headers),this._source.fire(new Or("data",{dataType:"source",tile:e,coord:e.tileID,sourceCacheId:this.id,responseHeaders:o}))}_hasTunnelGeometry(){for(const e in this._tiles){const t=this._tiles[e];if(t&&t.hasTunnelGeometry)return!0}return!1}_backfillDEM(e){const t=this.getRenderableIds();for(let r=0;r<t.length;r++){const n=t[r];if(e.neighboringTiles&&e.neighboringTiles[n]){const t=this.getTileByID(n);i(e,t),i(t,e)}}function i(e,t){if(!e.dem||e.dem.borderReady)return;e.needsHillshadePrepare=!0,e.needsDEMTextureUpload=!0;let i=t.tileID.canonical.x-e.tileID.canonical.x;const r=t.tileID.canonical.y-e.tileID.canonical.y,n=Math.pow(2,e.tileID.canonical.z),o=t.tileID.key;0===i&&0===r||Math.abs(r)>1||(Math.abs(i)>1&&(1===Math.abs(i+n)?i+=n:1===Math.abs(i-n)&&(i-=n)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,i,r),e.neighboringTiles&&e.neighboringTiles[o]&&(e.neighboringTiles[o].backfilled=!0)))}}
vendor: 5,467 bytes, line 2
2getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,t,i,r){const n="raster-array"===this._source.type;for(const o in this._tiles){let a=this._tiles[o];if(r[o]||!a.hasData()||a.tileID.overscaledZ<=t||a.tileID.overscaledZ>i)continue;if(n&&a.parentTile)continue;let s=a.tileID;for(;a&&a.tileID.overscaledZ>t+1;){const e=a.tileID.scaledTo(a.tileID.overscaledZ-1);a=this._tiles[e.key],a&&a.hasData()&&(s=e)}let l=s;for(;l.overscaledZ>t;)if(l=l.scaledTo(l.overscaledZ-1),e[l.key]){r[s.key]=s;const e=this._tiles[s.key];e&&(e.dashIdealZ=l.overscaledZ);break}}}findLoadedParent(e,t){if(e.key in this._loadedParentTiles){const i=this._loadedParentTiles[e.key];return i&&i.tileID.overscaledZ>=t?i:null}for(let i=e.overscaledZ-1;i>=t;i--){const t=e.scaledTo(i),r=this._getLoadedTile(t);if(r)return r}}_getLoadedTile(e){const t=this._tiles[e.key];return t&&t.hasData()?t:this._cache.getByKey(this._source.reparseOverscaled?e.wrapped().key:e.canonical.key)}updateCacheSize(e,t){t=t||this._source.tileSize;const i=Math.ceil(e.width/t)+1,r=Math.ceil(e.height/t)+1,n=Math.floor(i*r*5),o="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,n):n,a="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,o):o;this._cache.setMaxSize(a)}handleWrapJump(e){const t=Math.round((e-(void 0===this._prevLng?e:this._prevLng))/360);if(this._prevLng=e,t){const e={};for(const i in this._tiles){const r=this._tiles[i];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+t),e[r.tileID.key]=r}this._tiles=e;for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t in this._tiles)this._setTileReloadTimer(+t,this._tiles[t])}}update(e,t,i,r,n){if(this.transform=e,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage)return;if(this.usedForTerrain&&!i)return;this.updateCacheSize(e,t),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const o="batched-model"===this._source.type;let a,s=this._source.maxzoom;null!==this._maxzoomOverride&&(s=Math.min(s,this._maxzoomOverride));const l=this.map&&this.map.painter?this.map.painter._terrain:null;if(l&&l.sourceCache===this&&l.attenuationRange()){const e=l.attenuationRange()[0],t=Math.floor(e)-Math.log2(l.getDemUpscale());s>t&&(s=t)}const c=null===this._maxzoomOverride&&this._source.reparseOverscaled;if(this.used||this.usedForTerrain){if(this._source.tileID)a=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(e=>new Pf(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y));else if(0!==this.tileCoverLift){const r=e.clone();r.tileCoverLift=this.tileCoverLift,a=r.coveringTiles({tileSize:t||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:s,roundZoom:this._source.roundZoom&&!i,reparseOverscaled:c,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:o}),this._source.minzoom<=1&&"globe"===e.projection.name&&(a.push(new Pf(1,0,1,0,0)),a.push(new Pf(1,0,1,1,0)),a.push(new Pf(1,0,1,0,1)),a.push(new Pf(1,0,1,1,1)))}else if(a=e.coveringTiles({tileSize:t||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:s,roundZoom:this._source.roundZoom&&!i,reparseOverscaled:c,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:o}),this._source.hasTile){const e=this._source.hasTile.bind(this._source);a=a.filter(t=>e(t))}}else a=[];if(a.length>0&&"globe"!==this.transform.projection.name&&!this.usedForTerrain&&!this._supportsFading){const l=e.coveringZoomLevel({tileSize:t||this._source.tileSize,roundZoom:this._source.roundZoom&&!i}),c=Math.min(l,s);if(o){const t=e.extendTileCover(a,c);for(const e of t)a.push(e)}else if(n){const t=this.transform.getFrustum(c),i=e.extendTileCoverToNearPlane(a,t,c);for(const e of i)a.push(e);if(c>=18&&this._hasTunnelGeometry()){const i=e.extendTileCoverForTunnels(a,t,c,20);for(const e of i)a.push(e)}}else if(this.castsShadows&&r){const t=e.extendTileCover(a,c,r,16);for(const e of t)this._shadowCasterTiles[e.key]=!0,a.push(e)}}for(const d in this._tiles){const e=this._tiles[d];e.dashIdealZ=e.tileID.overscaledZ}const u=this._updateRetainedTiles(a);if(this._supportsFading&&0!==a.length){const e={},t={},i=ei.now(),r=Object.keys(u);for(const o of r){const r=u[o],n=this._tiles[o];if(!n||void 0!==n.fadeEndTime&&n.fadeEndTime<=i)continue;const a=this.findLoadedParent(r,Math.max(r.overscaledZ-DD.maxOverzooming,this._source.minzoom));a&&(this._addTile(a.tileID),e[a.tileID.key]=a.tileID),t[o]=r}const n=a.at(-1).overscaledZ;for(const o in this._tiles){const e=this._tiles[o];if(u[o]||!e.hasData())continue;let i=e.tileID;for(;i.overscaledZ>n;){i=i.scaledTo(i.overscaledZ-1);const r=this._tiles[i.key];if(r&&r.hasData()&&t[i.key]){u[o]=e.tileID;break}}}for(const o in e)u[o]||(this._coveredTiles[o]=!0,u[o]=e[o])}for(const d in u)this._tiles[d].clearFadeHold();const h=function(e,t){const i=[];for(const r in e)r in t||i.push(r);return i}(this._tiles,u);for(const d of h){const e=this._tiles[d];e.hasSymbolBuckets&&!e.holdingForFade()?e.setHoldDuration(this.map._fadeDuration):e.hasSymbolBuckets&&!e.symbolFadeFinished()||this._removeTile(+d)}this._updateLoadedParentTileCache(),1===this._renderSourceType&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(+e)}_updateRetainedTiles(e){const t={};if(0===e.length)return t;const i={},r=e.reduce((e,t)=>
vendor: 4,688 bytes, line 2
2Math.min(e,t.overscaledZ),1/0),n=e[0].overscaledZ,o=Math.max(n-DD.maxOverzooming,this._source.minzoom),a=Math.max(n+DD.maxUnderzooming,this._source.minzoom),s={};for(const l of e){const e=this._addTile(l);t[l.key]=l,e.hasData()||r<this._source.maxzoom&&(s[l.key]=l)}if(this._retainLoadedChildren(s,r,a,t),"raster-array"===this._source.type){const i=this._source,r=this._tiles;for(const n of i.collectOverzoomParentTileIDs(r,e))t[n.key]=n}for(const l of e){let e=this._tiles[l.key];if(e.hasData())continue;if(l.canonical.z>=this._source.maxzoom){const e=l.children(this._source.maxzoom)[0],i=this.getTile(e);if(i&&i.hasData()){t[e.key]=e,i.dashIdealZ=l.overscaledZ;continue}}else{const e=l.children(this._source.maxzoom);if(t[e[0].key]&&t[e[1].key]&&t[e[2].key]&&t[e[3].key])continue}let r=e.wasRequested();for(let n=l.overscaledZ-1;n>=o;--n){const o=l.scaledTo(n);if(i[o.key])break;if(i[o.key]=!0,e=this.getTile(o),!e&&r&&(e=this._addTile(o)),e&&(t[o.key]=o,e.dashIdealZ=l.overscaledZ,r=e.wasRequested(),e.hasData()))break}}return t}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const t=[];let i,r=this._tiles[e].tileID;for(;r.overscaledZ>0;){if(r.key in this._loadedParentTiles){i=this._loadedParentTiles[r.key];break}t.push(r.key);const e=r.scaledTo(r.overscaledZ-1);if(i=this._getLoadedTile(e),i)break;r=e}for(const e of t)this._loadedParentTiles[e]=i}}_addTile(e){let t=this._tiles[e.key];if(t)return!0!==t.isExtraShadowCaster||!!this._shadowCasterTiles[e.key]||this._reloadTile(e.key,"reloading"),t;t=this._cache.getAndRemove(e),t&&(this._setTileReloadTimer(e.key,t),t.tileID=e,this._state.initializeTileState(t,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,t)),t.resetPlacementVisibility());const i=Boolean(t);if(!i){const i=this.map?this.map.painter:null,r=this._source.tileSize*e.overscaleFactor();t="raster-array"===this._source.type?function(e,t,i,r,n){if(!ED)throw new Error("Raster-array module is not loaded.");return ED(e,t,i,r,n)}(e,r,this.transform.tileZoom,i,this._isRaster):new ID(e,r,this.transform.tileZoom,i,this._isRaster,this._source.worldview),this._loadTile(t,this._tileLoaded.bind(this,t,e.key,t.state))}return t.uses++,this._tiles[e.key]=t,i||this._source.fire(new Or("dataloading",{tile:t,coord:t.tileID,dataType:"source"})),t}_setTileReloadTimer(e,t){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const i=t.getExpiryTimeout();i&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},i))}_removeTile(e){const t=this._tiles[e];t&&(t.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),t.uses>0||(t.hasData()&&"reloading"!==t.state||"empty"===t.state?this._cache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(+e);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(e,t,i){const r=[],n=this.transform;if(!n)return r;const o="globe"===n.projection.name,a=Wn(n.center.lng),s=n.getFreeCameraOptions().position||new Zc(0,0,0);for(const l in this._tiles){const c=this._tiles[l];if(i&&c.clearQueryDebugViz(),c.holdingForFade())continue;let u;if(o){const e=c.tileID.canonical;if(0===e.z){const t=[Math.abs(ht(a,...PD(e,-1))-a),Math.abs(ht(a,...PD(e,1))-a)];u=[0,2*t.indexOf(Math.min(...t))-1]}else{const t=[Math.abs(ht(a,...PD(e,-1))-a),Math.abs(ht(a,...PD(e,0))-a),Math.abs(ht(a,...PD(e,1))-a)];u=[t.indexOf(Math.min(...t))-1]}}else u=[0];for(const i of u){const o=e.containsTile(c,n,t,i,s);o&&r.push(o)}}return r}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(e){return this._getRenderableCoordinates(e)}_getRenderableCoordinates(e,t){if(!this.transform)return[];const i=this.getRenderableIds(e,t).map(e=>this._tiles[e].tileID),r="globe"===this.transform.projection.name;for(const n of i)n.projMatrix=this.transform.calculateProjMatrix(n.toUnwrapped()),n.expandedProjMatrix=r?this.transform.calculateProjMatrix(n.toUnwrapped(),!1,!0):n.projMatrix;return i}sortCoordinatesByDistance(e){if(!this.transform)return e.slice();const t=e.slice(),i=this.transform._camera.position,r=this.transform._camera.forward(),n={};for(const o of t){const e=1/(1<<o.canonical.z);n[o.key]=((o.canonical.x+.5)*e+o.wrap-i[0])*r[0]+((o.canonical.y+.5)*e-i[1])*r[1]-i[2]*r[2]}return t.sort((e,t)=>
vendor: 20,067 bytes, line 2
2n[e.key]-n[t.key]),t}hasTransition(){if(this._source.hasTransition())return!0;if(this._supportsFading){const e=ei.now();for(const t in this._tiles){const i=this._tiles[t];if(void 0!==i.fadeEndTime&&i.fadeEndTime>=e)return!0}}return!1}setFeatureState(e,t,i){this._state.updateState(e=e||"_geojsonTileLayer",t,i)}removeFeatureState(e,t,i){this._state.removeFeatureState(e=e||"_geojsonTileLayer",t,i)}getFeatureState(e,t){return this._state.getState(e=e||"_geojsonTileLayer",t)}setDependencies(e,t,i){const r=this._tiles[e];r&&r.setDependencies(t,i)}reloadTilesForDependencies(e,t){for(const i in this._tiles)this._tiles[i].hasDependency(e,t)&&this._reloadTile(+i,"reloading");this._cache.filter(i=>!i.hasDependency(e,t))}_preloadTiles(e,t){if(!this._sourceLoaded){const i=()=>{this._sourceLoaded&&(this._source.off("data",i),this._preloadTiles(e,t))};return void this._source.on("data",i)}const i=new Map,r=Array.isArray(e)?e:[e],n=this.map.painter.terrain,o=this.usedForTerrain&&n?n.getScaledDemTileSize():this._source.tileSize;for(const a of r){const e=a.coveringTiles({tileSize:o,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const t of e)i.set(t.key,t);this.usedForTerrain&&a.updateElevation(!1)}ft(Array.from(i.values()),(e,t)=>{const i=new ID(e,this._source.tileSize*e.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(i,e=>{"raster-dem"===this._source.type&&i.dem&&this._backfillDEM(i),t(e,i)})},t)}}function MD(e,t){const i=Math.abs(2*e.wrap)-+(e.wrap<0),r=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||r-i||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function PD(e,t){const i=1<<e.z;return[e.x/i+t,(e.x+1)/i+t]}function CD(e,t){if(e.z<=t.z){const i=t.z-e.z;return t.x>>i===e.x&&t.y>>i===e.y}const i=e.z-t.z;return e.x>>i===t.x&&e.y>>i===t.y}function RD(e,t){return e.sourceFQID!==t.sourceFQID?e.sourceFQID<t.sourceFQID?-1:1:e.tileId.z!==t.tileId.z?e.tileId.z-t.tileId.z:e.tileId.x!==t.tileId.x?e.tileId.x-t.tileId.x:e.tileId.y-t.tileId.y}DD.maxOverzooming=10,DD.maxUnderzooming=3;class zD{constructor(e=[]){this.tiles=e}getTilesIntersecting(e){const t=[];for(const i of this.tiles)CD(i.tileId,e)&&t.push(i);return t}equals(e){if(this.tiles.length!==e.length)return!1;for(let t=0;t<this.tiles.length;++t){const i=this.tiles[t],r=e[t];if(i.sourceFQID!==r.sourceFQID||i.tileId.z!==r.tileId.z||i.tileId.x!==r.tileId.x||i.tileId.y!==r.tileId.y||i.generation!==r.generation)return!1}return!0}empty(){return 0===this.tiles.length}}class LD{constructor(){this._tiles=[],this._snapshot=new zD,this._snapshotChanged=!1}clear(){this._tiles.length=0}consumeSnapshotChanged(){const e=this._snapshotChanged;return this._snapshotChanged=!1,e}addTileElevation(e,t,i,r){this._tiles.push({sourceFQID:e,tileId:t,features:i,generation:r})}updateSnapshotIfNeeded(){return this._tiles.sort(RD),this._snapshot.equals(this._tiles)||(this._snapshot=new zD(this._tiles.slice()),this._snapshotChanged=!0),this._snapshot}}function FD(e,t){const i=[];for(const r of e.getTilesIntersecting(t))i.push(`${r.tileId.z}/${r.tileId.x}/${r.tileId.y}:${r.generation}`);return i.sort(),i.join("|")}function OD(e,t){return e._mergedOtherSourceCaches[t]||e._mergedSymbolSourceCaches[t]}function BD(e){return!("none"===e.visibility||!e.sourceLayer||"fill"!==e.type||!e.layout||"hd-road-base"!==e.layout.get("fill-elevation-reference"))}function kD(e){return!!e.layout&&("line"===e.type&&"hd-road-markup"===e.layout.get("line-elevation-reference")||"circle"===e.type&&"hd-road-markup"===e.layout.get("circle-elevation-reference")||"symbol"===e.type&&"hd-road-markup"===e.layout.get("symbol-elevation-reference")||"fill"===e.type&&"hd-road-markup"===e.layout.get("fill-elevation-reference"))}function VD(e){const t=new Set;for(const i in e._mergedLayers){const r=e._mergedLayers[i];kD(r)&&t.add(Ul(r.source,r.scope))}return t}function ND(e){const t=VD(e);if(0===t.size)return!1;const i=UD(e);for(const r of t)for(const e of i)if(r!==e)return!0;return!1}function UD(e){const t=new Set;for(const i in e._mergedLayers){const r=e._mergedLayers[i];r.source&&BD(r)&&t.add(Ul(r.source,r.scope))}return t}function jD(e,t,i){const r=new Set;for(const o in e._mergedLayers){const t=e._mergedLayers[o];"none"!==t.visibility&&kD(t)&&r.add(Ul(t.source,t.scope))}if(0===r.size)return;if(!i){const t=UD(e);for(const e of t)r.delete(e)}if(0===r.size)return;const n=[e._mergedOtherSourceCaches,e._mergedSymbolSourceCaches];for(const o of n)for(const e in o){if(!r.has(e))continue;const i=o[e];for(const e in i._tiles){const r=i._tiles[e];r&&(t&&!t(r)||(r.hasDeferredElevationFeatures=!1,i._reloadTile(+e,"reloading")))}}}class GD{constructor(){this.manager=new LD,this._needsCrossSourceElevation=!1,this._ingestFQIDs=new Set,this._terrainActiveLast=void 0}}function HD(e){e.map&&e.map.painter&&(e.map.painter.elevationCoverageSnapshot=null,e.map.painter.elevationProvidersReady=void 0)}function $D(e){if(e._crossSourceElevationActive=!1,function(e){const t=e._hdElevation,i=!!(e.map&&e.map.painter&&e.map.painter.elevationCoverageSnapshot);return t?!t._needsCrossSourceElevation&&0===t._ingestFQIDs.size&&0===t.manager._tiles.length&&!i:!i}(e))return;const t=!!e._hdElevation&&e._hdElevation._needsCrossSourceElevation;HD(e),e._hdElevation&&(e._hdElevation._needsCrossSourceElevation=!1,e._hdElevation._ingestFQIDs.clear(),e._hdElevation.manager.clear(),e._hdElevation._terrainActiveLast=void 0,t&&jD(e,void 0,!0))}function WD(e,t){if(KS(e,e.map&&e.map.transform))return t.manager.clear(),void(e.map.painter&&(e.map.painter.elevationCoverageSnapshot=null));if(!t._needsCrossSourceElevation)return void HD(e);t.manager.clear();let i=!0;for(const s of t._ingestFQIDs){const r=OD(e,s);if(!r)continue;const n=r._tiles;for(const e in n){const r=n[e];if(!r||!r.loaded())continue;const o=r.parsedElevationFeatures;void 0!==o?t.manager.addTileElevation(s,r.tileID.canonical,o,r.parsedElevationGeneration):i=!1}}const r=t.manager._snapshot,n=t.manager.updateSnapshotIfNeeded();e.map.painter&&(e.map.painter.elevationCoverageSnapshot=n.empty()?null:n);const o=i&&function(e,t){for(const i of t){const t=OD(e,i);if(!t)return!1;if(!t._sourceLoaded)return!1;for(const e in t._tiles){const i=t._tiles[e];if(i&&("loading"===i.state||"reloading"===i.state))return!1}}return!0}(e,function(e){const t=VD(e),i=new Set;for(const r in e._mergedLayers){const n=e._mergedLayers[r];if(!n.source||!BD(n))continue;const o=Ul(n.source,n.scope);t.has(o)||i.add(o)}return i}(e));e.map.painter&&(e.map.painter.elevationProvidersReady=o);const a=t.manager.consumeSnapshotChanged();(a||o)&&jD(e,e=>{return!!e.hasDeferredElevationFeatures||a&&(t=n,FD(r,i=e.tileID.canonical)!==FD(t,i));var t,i})}const qD=e=>({u_matrix:e});function ZD(e,t){const i=e.context.gl;return new uw({func:i.EQUAL,mask:255},e._tileClippingMaskIDs[t.key]||0,0,i.KEEP,i.KEEP,i.KEEP)}function XD(e,t){const i=e.context.gl;return new uw({func:i.EQUAL,mask:255},255&~(e._tileClippingMaskIDs[t.key]||0),0,i.KEEP,i.KEEP,i.KEEP)}function YD(e,t){if(!e.frcCoverageSnapshot||!e.frcCoverageRenderer)return null;const i=e.frcCoverageSnapshot.getTileOrParent(t.canonical);if(!i||0===i.frcMask)return null;const r=e.frcCoverageRenderer.getBuffers(i.tileId);if(!r)return null;const n=new Df(i.tileId.z,i.tileId.x,i.tileId.y),o=new Mf(t.wrap,n);return{buffers:r,projMatrix:e.transform.calculateProjMatrix(o),coverageTile:i}}function KD(e,t,i){if(!e.frcCoverageSnapshot)return;const r=e.context,n=r.gl,o=e.getOrCreateProgram("clippingMask");r.setColorMode(pw.disabled),r.setDepthMode(fw.disabled);for(const a of t){const t=YD(e,a);if(!t)continue;const r=t.buffers.frcLevelSegments[i];r&&o.draw(e,n.TRIANGLES,fw.disabled,new uw({func:n.EQUAL,mask:255},e._tileClippingMaskIDs[a.key]||0,255,n.KEEP,n.KEEP,n.INVERT),pw.disabled,gw.disabled,qD(t.projMatrix),`$frc_coverage_${i}`,t.buffers.vertexBuffer,t.buffers.indexBuffer,r)}}function JD(e,t,i){if(!e.frcCoverageSnapshot)return;const r=e.context,n=r.gl,o=e.getOrCreateProgram("clippingMask");r.setColorMode(pw.disabled),r.setDepthMode(fw.disabled);for(const a of t){const t=YD(e,a);if(!t)continue;const r=t.buffers.frcLevelSegments[i];r&&o.draw(e,n.TRIANGLES,fw.disabled,new uw({func:n.EQUAL,mask:255},255&~(e._tileClippingMaskIDs[a.key]||0),255,n.KEEP,n.KEEP,n.INVERT),pw.disabled,gw.disabled,qD(t.projMatrix),`$frc_coverage_restore_${i}`,t.buffers.vertexBuffer,t.buffers.indexBuffer,r)}}function QD(e,t,i,r,n){if(0===t.length)return;let o=0;for(const s of t)o|=s.frcMask;const a=t.map(e=>e.coord);for(let s=0;s<9;++s)if(o&1<<s){if(KD(e,a,s),r)for(const i of t)i.frcMask&1<<s&&r(i,s,ZD(e,i.coord));if(i>0&&n)for(const i of t)i.frcMask&1<<s&&n(i,s,XD(e,i.coord));JD(e,a,s)}}function eM(e){for(const t of e)if(t.rings.length>0&&t.rings[0].length>0)return!0;return!1}function tM(e){const t=e.frcCoverageFadeRange;return!t||t[1]<=t[0]?0:1-Math.max(0,Math.min(1,(e.transform.zoom-t[0])/(t[1]-t[0])))}const iM={loaded:!0,drawBuilding:function(e,t,i,r){e.currentLayer<e.firstLightBeamLayer&&(e.firstLightBeamLayer=e.currentLayer);const n=i.paint.get("building-ambient-occlusion-ground-intensity"),o=i.paint.get("building-ambient-occlusion-ground-radius"),a=i.paint.get("building-ambient-occlusion-ground-attenuation"),s=i.paint.get("building-opacity");if(s<=0)return;let l=n>0&&o>0,c=!0;const u=i.paint.get("building-vertical-scale");if(u<=0)return;e.shadowRenderer||(c=!1);const h=e.conflationActive&&e.style.isLayerClipped(i,t.getSource()),d=e.style.order.indexOf(i.fqid);if(function(e,t,i,r,n,o){for(const a of o){const o=t.getTile(a).getBucket(i);o&&(n&&o.updateReplacement(a,e.replacementSource,r),o.uploadUpdatedIndexBuffer(e.context))}}(e,t,i,d,h,r),function(e,t,i,r){for(const n of r){const r=t.getTile(n).getBucket(i);r&&r.needsEvaluation()&&r.uploadUpdatedColorBuffer(e.context)}}(e,t,i,r),i.resetLayerRenderingStats(e),e.shadowRenderer&&(e.shadowRenderer.useNormalOffset=!0),"shadow"===e.renderPass&&e.shadowRenderer){const n=[],o=e.shadowRenderer.getShadowPassDepthMode();RT({painter:e,source:t,layer:i,coords:r,defines:n,blendMode:pw.disabled,depthMode:o,opacity:s,verticalScale:u,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}else if("translucent"===e.renderPass){let d=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];c&&(d=d.concat("RENDER_SHADOWS")),e.shadowRenderer&&e.shadowRenderer.useNormalOffset&&(d=d.concat("NORMAL_OFFSET"));const p=i.paint.get("building-facade-emissive-chance"),f=i.paint.get("building-ambient-occlusion-intensity"),m=i.paint.get("building-flood-light-intensity"),_="none"===i.paint.get("building-flood-light-color-use-theme").constantOr("default"),g=i.paint.get("building-flood-light-color").toNonPremultipliedRenderColor(_?null:i.lut).toArray01().slice(0,3),y=i.paint.get("building-flood-light-ground-attenuation"),x=m>0,v=new fw(e.context.gl.LEQUAL,fw.ReadWrite,e.depthRangeFor3D);s<1&&RT({painter:e,source:t,layer:i,coords:r,defines:d,blendMode:pw.disabled,depthMode:v,opacity:s,verticalScale:u,facadeEmissiveChance:p,facadeAOIntensity:f,floodLightIntensity:m,floodLightColor:g,depthOnly:!0});const b=e.colorModeForRenderPass();RT({painter:e,source:t,layer:i,coords:r,defines:d,blendMode:b,depthMode:v,opacity:s,verticalScale:u,facadeEmissiveChance:p,facadeAOIntensity:f,floodLightIntensity:m,floodLightColor:g});const w=i.paint.get("building-front-cutoff");AT(e.transform.pitch,w,!!e.terrain),l&&zT(e,t,i,r,!0,s,n,o,m,g,a,h),x&&zT(e,t,i,r,!1,s,n,o,m,g,y,h)}else if("light-beam"===e.renderPass){const n=["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],o=new fw(e.context.gl.LEQUAL,fw.ReadOnly,e.depthRangeFor3D);RT({painter:e,source:t,layer:i,coords:r,defines:n,blendMode:pw.alphaBlended,depthMode:o,opacity:s,verticalScale:u,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}e.shadowRenderer&&(e.shadowRenderer.useNormalOffset=!1),e.resetStencilClippingMasks()},BuildingTileBorderManager:class{constructor(){this.visibleTiles=[]}updateBorders(e,t){const i=[],r=[],n=e._getRenderableCoordinates(!1,!0);for(const s of n){const n=e.getTile(s);if(!n.hasData())continue;const o=n.getBucket(t);o&&(o.isEmpty()||(i.push(s.key),r.push({bucket:o,tileID:s.canonical})))}let o=i.length!==this.visibleTiles.length;if(!o){i.sort();for(let e=0;e<i.length;e++)if(i[e]!==this.visibleTiles[e]){o=!0;break}}if(!o)return;const a=new Set;this.visibleTiles=i,r.sort((e,t)=>e.tileID.z-t.tileID.z||e.tileID.x-t.tileID.x||e.tileID.y-t.tileID.y);for(const s of r){const e=new Array,t=new Array,i=s.bucket;for(const r of i.featuresOnBorder)4&i.footprints[r.footprintIndex].hiddenFlags||(a.has(r.featureId)?t.push(r.footprintIndex):(a.add(r.featureId),e.push(r.footprintIndex)));i.updateFootprintHiddenFlags(e,2,!1),i.updateFootprintHiddenFlags(t,2,!0)}}},drawRasterParticle:function(e,t,i,r,n,o){"offscreen"===e.renderPass&&function(e,t,i,r){if(!r.length)return;const n=e.context,o=n.gl,a=t.getSource();if("raster-array"!==a.type)return;const s=Math.ceil(Math.sqrt(i.paint.get("raster-particle-count")));let l=i.particlePositionRGBAImage;if(!l||l.width!==s){const e=function(e){const t=e*e,i=new Uint8Array(4*t),r=.9090909090909091;for(let n=0;n<t;n++){const e=r*(Wt(2*n+0)+FT),t=r*(Wt(2*n+1)+FT),o=255*e%1,a=255*t%1,s=o,l=t-a/255,c=a;i[4*n+0]=255*(e-o/255),i[4*n+1]=255*s,i[4*n+2]=255*l,i[4*n+3]=255*c}return i}(s);l=i.particlePositionRGBAImage=new zd({width:s,height:s},e)}let c=i.particleFramebuffer;c?c.width!==s&&(c.destroy(),c=i.particleFramebuffer=n.createFramebuffer(s,s,1,null)):c=i.particleFramebuffer=n.createFramebuffer(s,s,1,null);const u=[];for(const p of r){const e=t.getTile(p);if(!e)continue;const r=HT(e,a,i);if(!r)continue;const o=[e.tileSize,e.tileSize];let c=i.tileFramebuffer;c||(c=i.tileFramebuffer=n.createFramebuffer(o[0],o[1],1,null));let h=e.rasterParticleState;h||(h=e.rasterParticleState=new jT(n,p,o,l));const d=h.update(i.lastInvalidatedAt);h.particleTextureDimension!==s&&h.updateParticleTexture(p,l);const f=h.targetColorTexture;h.targetColorTexture=h.backgroundColorTexture,h.backgroundColorTexture=f;const m=h.particleTexture0;h.particleTexture0=h.particleTexture1,h.particleTexture1=m,u.push([p,r,h,d])}if(0===u.length)return;const h=ei.now(),d=i.previousDrawTimestamp?.001*(h-i.previousDrawTimestamp):.0167;if(i.previousDrawTimestamp=h,i.hasColorMap()){n.activeTexture.set(o.TEXTURE0+2);let e=i.colorRampTexture;e||(e=i.colorRampTexture=new $m(n,i.colorRamp,o.RGBA8)),e.bind(o.LINEAR,o.CLAMP_TO_EDGE)}n.bindFramebuffer.set(i.tileFramebuffer.framebuffer),function(e,t,i){const r=e.context,n=r.gl,o=t.tileFramebuffer;r.activeTexture.set(n.TEXTURE0);const a={u_texture:0,u_opacity:1.05*(l=t.paint.get("raster-particle-fade-opacity-factor"))/(l+.05)},s=e.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});var l;for(const c of i){const[,,i,l]=c;o.colorAttachment0.set(i.targetColorTexture.texture),r.viewport.set([0,0,o.width,o.height]),r.clear({color:Zr.transparent}),l&&(i.backgroundColorTexture.bind(n.NEAREST,n.CLAMP_TO_EDGE),s.draw(e,n.TRIANGLES,fw.disabled,uw.disabled,pw.alphaBlended,gw.disabled,a,t.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments))}}(e,i,u),function(e,t,i,r){const n=e.context,o=n.gl,a=i.tileFramebuffer,s="globe"===e.transform.projection.name,l=i.paint.get("raster-particle-max-speed");for(const c of r){const[r,u,h]=c;n.activeTexture.set(o.TEXTURE0+0),u.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE),a.colorAttachment0.set(h.targetColorTexture.texture);const d=e.getOrCreateProgram("rasterParticleDraw",{defines:u.defines,overrideFog:!1});n.activeTexture.set(o.TEXTURE0+1);const p=u.scalarData?[]:[0,1,2,3].map(e=>Rf[e](r));p.push(r);const f=r.canonical.x,m=r.canonical.y;for(const n of p){const a=t.getTile(s?n.wrapped():n);if(!a)continue;const c=a.rasterParticleState;if(!c)continue;const h=n.canonical.x+(1<<n.canonical.z)*(n.wrap-r.wrap),p=n.canonical.y;c.particleTexture0.bind(o.NEAREST,o.CLAMP_TO_EDGE);const _=BT(1,c.particleTexture0.size[0],[h-f,p-m],0,u.texture.size,2,l,u.textureOffset,u.scale,u.offset);d.draw(e,o.POINTS,fw.disabled,uw.disabled,pw.alphaBlended,gw.disabled,_,i.id,c.particleIndexBuffer,void 0,c.particleSegment)}}}(e,t,i,u),n.bindFramebuffer.set(i.particleFramebuffer.framebuffer),function(e,t,i,r){const n=e.context,o=n.gl,a=t.paint.get("raster-particle-max-speed"),s=r*t.paint.get("raster-particle-speed-factor")*.15,l=function(e){return Math.pow(e,6)}(.01+1*t.paint.get("raster-particle-reset-rate-factor")),c=t.particleFramebuffer;n.viewport.set([0,0,c.width,c.height]);for(const u of i){const[,i,r]=u;n.activeTexture.set(o.TEXTURE0+0),i.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE),n.activeTexture.set(o.TEXTURE0+1);const h=r.particleTexture0;h.bind(o.NEAREST,o.CLAMP_TO_EDGE);const d=kT(1,h.size[0],0,i.texture.size,a,s,l,i.textureOffset,i.scale,i.offset);c.colorAttachment0.set(r.particleTexture1.texture),n.clear({color:Zr.transparent}),e.getOrCreateProgram("rasterParticleUpdate",{defines:i.defines}).draw(e,o.TRIANGLES,fw.disabled,uw.disabled,pw.unblended,gw.disabled,d,t.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments)}}(e,i,u,d)}(e,t,i,r),"translucent"===e.renderPass&&(function(e,t,i,r){const n=e.context,o=n.gl,a=t.getSource().tileSize,s=5*(1-dt(6,7,e.transform.zoom))*a+i.paint.get("raster-particle-elevation"),l=!e.options.moving,c="globe"===e.transform.projection.name;if(!r.length)return;const[u,h]=e.stencilConfigForOverlap(r),d=[];c&&d.push("PROJECTION_GLOBE_VIEW");const p=e.stencilModeFor3D();for(const f of h){const r=f.toUnwrapped(),a=t.getTile(f);if(!a.rasterParticleState)continue;const h=a.rasterParticleState,m=100;a.registerFadeDuration(m);const _=t.findLoadedParent(f,0),g=GT(a,_,t,e.transform,m);let y,x;e.terrain&&e.terrain.prepareDrawTile(),n.activeTexture.set(o.TEXTURE0),h.targetColorTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE),n.activeTexture.set(o.TEXTURE1),_&&_.rasterParticleState?(_.rasterParticleState.targetColorTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE),y=Math.pow(2,_.tileID.overscaledZ-a.tileID.overscaledZ),x=[a.tileID.canonical.x*y%1,a.tileID.canonical.y*y%1]):h.targetColorTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE);const v=c?e.transform.expandedFarZProjMatrix:e.transform.calculateProjMatrix(r,l),b=e.transform,w=$T(b),E=nf(f.canonical),A=xf(E.getCenter().lat);let I,S,T,D,M;c?(I=Float32Array.from(cf(Jp(f.canonical))),S=Float32Array.from(b.globeMatrix),T=Float32Array.from(ff(b)),D=[Wn(b.center.lng),qn(b.center.lat)],M=Float32Array.from(yf(f.canonical,E,A,b.worldSize/b._pixelsPerMercatorPixel))):(I=new Float32Array(16),S=new Float32Array(9),T=new Float32Array(16),D=[0,0],M=new Float32Array(9));const P=OT(v,I,S,T,M,x||[0,0],mf(e.transform.zoom),D,w,y||1,g,s),C=e.isTileAffectedByFog(f),R=e.getOrCreateProgram("rasterParticle",{defines:d,overrideFog:C});if(e.uploadCommonUniforms(n,R,r),c){const t=new fw(o.LEQUAL,fw.ReadOnly,e.depthRangeFor3D),r=0,n=e.globeSharedBuffers;if(n){const[a,s,l]=n.getGridBuffers(A,0!==r);R.draw(e,o.TRIANGLES,t,p,pw.alphaBlended,e.renderElevatedRasterBackface?gw.frontCCW:gw.backCCW,P,i.id,a,s,l)}}else{const t=e.depthModeForSublayer(0,fw.ReadOnly),r=u[f.overscaledZ],{tileBoundsBuffer:n,tileBoundsIndexBuffer:s,tileBoundsSegments:l}=e.getTileBoundsBuffers(a);R.draw(e,o.TRIANGLES,t,r,pw.alphaBlended,gw.disabled,P,i.id,n,s,l)}}e.resetStencilClippingMasks()}(e,t,i,r),e.style.map.triggerRepaint())},prepareRasterParticle:function(e,t,i){const r=t.getSource();if("raster-array"!==r.type||!r.loaded())return;const n=e.sourceLayer||r.rasterLayerIds&&r.rasterLayerIds[0];if(!n)return;const o=e.paint.get("raster-particle-array-band")||r.getInitialBand(n);if(null==o)return;const a=t.getIds().map(e=>t.getTileByID(e));for(const s of a)s.updateNeeded(e.id,o)&&(s._isHeaderLoaded||s.parentTile)&&r.prepareTile(s,n,e.id,o)},Rain:class extends tD{constructor(){super(4.25),this._params={intensity:.5,timeFactor:1,velocityConeAperture:0,velocity:300,boxSize:2500,droplet
vendor: 13,178 bytes, line 2
2SizeX:1,dropletSizeYScale:10,distortionStrength:70,screenThinning:{intensity:.57,start:.46,range:1.17,fadePower:.17,affectedRatio:1,particleOffset:-.2},color:{r:.66,g:.68,b:.74,a:.7},direction:{x:-50,y:-35},shapeDirPower:2,shapeNormalPower:1},this._vignetteParams={strength:1,start:.7,range:1,fadePower:.4,color:{r:.27,g:.27,b:.27,a:1}},this.particlesCount=16e3,this._devtoolsFolder=null,this._painter=null}destroy(){super.destroy()}update(e){const t=e.context;if(!this.particlesVx){const e=QT(this.particlesCount),i=new Vu,r=new Ru;let n=0;const o=Za(1323123451230);for(let t=0;t<e.length;++t){const a=e[t],s=[2*o()-1,o(),o(),o()];i.emplaceBack(a[0],a[1],a[2],-1,-1,...s),i.emplaceBack(a[0],a[1],a[2],1,-1,...s),i.emplaceBack(a[0],a[1],a[2],1,1,...s),i.emplaceBack(a[0],a[1],a[2],-1,1,...s),r.emplaceBack(n+0,n+1,n+2),r.emplaceBack(n+0,n+2,n+3),n+=4}this.particlesVx=t.createVertexBuffer(i,ZT.members),this.particlesIdx=t.createIndexBuffer(r)}}getDrawParams(e){if(!e.style.rain)return null;const t=e.style.rain.state,i=structuredClone(this._params);i.intensity=t.density,i.timeFactor=t.intensity,i.color=structuredClone(t.color),i.screenThinning.intensity=t.centerThinning,i.dropletSizeX=t.dropletSize[0],i.dropletSizeYScale=t.dropletSize[1]/t.dropletSize[0],i.distortionStrength=100*t.distortionStrength;const r=structuredClone(this._vignetteParams);return r.strength=1,r.color=structuredClone(t.vignetteColor),{params:i,vignetteParams:r,revealParams:{revealStart:0,revealRange:.01},direction:structuredClone(t.direction)}}draw(e){const t=this.getDrawParams(e);if(!t)return;const{params:i,revealParams:r,direction:n,vignetteParams:o}=t,a=e.transform.zoom;if(r.revealStart>a)return;const s=eD(0,1,r.revealStart,r.revealStart+r.revealRange,a);if(!this.particlesVx||!this.particlesIdx)return;o.strength*=s;const l=this.updateOnRender(e,i.timeFactor),c=e.context,u=c.gl,h=e.transform;this.screenTexture&&this.screenTexture.size[0]===e.width&&this.screenTexture.size[1]===e.height||(this.screenTexture=new $m(c,{width:e.width,height:e.height,data:null},u.RGBA8)),i.distortionStrength>0&&(c.activeTexture.set(u.TEXTURE0),this.screenTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),u.copyTexSubImage2D(u.TEXTURE_2D,0,0,0,0,0,e.width,e.height));const d=e.getOrCreateProgram("rainParticle");e.uploadCommonUniforms(c,d),c.activeTexture.set(u.TEXTURE0),this.screenTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE);const p=[i.color.r,i.color.g,i.color.b,i.color.a],f=(t,r)=>{const o=JT(this._movement.getPosition(),t),a=i.dropletSizeX,s=i.dropletSizeX*i.dropletSizeYScale,c=e.width/2,f=e.height/2,m=eD(0,i.screenThinning.start,0,1,i.screenThinning.intensity),_=eD(.001,i.screenThinning.range,0,1,i.screenThinning.intensity),g=eD(0,i.screenThinning.particleOffset,0,1,i.screenThinning.intensity),y=(x={modelview:l.modelviewMatrix,projection:l.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:o,velocityConeAperture:i.velocityConeAperture,velocity:i.velocity,boxSize:t,rainDropletSize:[a,s],distortionStrength:i.distortionStrength,rainDirection:n,color:p,screenSize:[h.width,h.height],thinningCenterPos:[c,f],thinningShape:[m,_,Math.pow(10,i.screenThinning.fadePower)],thinningAffectedRatio:i.screenThinning.affectedRatio,thinningParticleOffset:g,shapeDirectionalPower:i.shapeDirPower,shapeNormalPower:i.shapeNormalPower,mode:r?0:1},{u_modelview:Float32Array.from(x.modelview),u_projection:Float32Array.from(x.projection),u_time:x.time,u_cam_pos:x.camPos,u_texScreen:0,u_velocityConeAperture:x.velocityConeAperture,u_velocity:x.velocity,u_boxSize:x.boxSize,u_rainDropletSize:x.rainDropletSize,u_distortionStrength:x.distortionStrength,u_rainDirection:x.rainDirection,u_color:x.color,u_screenSize:x.screenSize,u_thinningCenterPos:x.thinningCenterPos,u_thinningShape:x.thinningShape,u_thinningAffectedRatio:x.thinningAffectedRatio,u_thinningParticleOffset:x.thinningParticleOffset,u_shapeDirectionalPower:x.shapeDirectionalPower,u_shapeNormalPower:x.shapeNormalPower,u_mode:x.mode});var x;const v=Math.round(i.intensity*this.particlesCount),b=uh.simpleSegment(0,0,4*v,2*v);d.draw(e,u.TRIANGLES,fw.disabled,uw.disabled,pw.alphaBlended,gw.disabled,y,"rain_particles",this.particlesVx,this.particlesIdx,b)};i.distortionStrength>0&&f(i.boxSize,!0),f(i.boxSize,!1),this._vignette.draw(e,o)}},Snow:class extends tD{constructor(){super(2.25),this._params={intensity:.85,timeFactor:.75,velocityConeAperture:70,velocity:40,horizontalOscillationRadius:4,horizontalOscillationRate:1.5,boxSize:2e3,billboardSize:2,shapeFadeStart:.27,shapeFadePower:.21,screenThinning:{intensity:.4,start:.15,range:1.4,fadePower:.24,affectedRatio:1,particleOffset:-.2},color:{r:1,g:1,b:1,a:1},direction:{x:-50,y:-35}},this._vignetteParams={strength:.3,start:.78,range:.46,fadePower:.2,color:{r:1,g:1,b:1,a:1}},this.particlesCount=16e3,this._devtoolsFolder=null,this._painter=null}destroy(){super.destroy()}update(e){const t=e.context;if(!this.particlesVx){const e=QT(this.particlesCount),i=new ku,r=new Ru;let n=0;const o=Za(1323123451230);for(let t=0;t<e.length;++t){const a=e[t],s=o(),l=o(),c=o(),u=[t/e.length,s,l,c],h=[o(),o()];i.emplaceBack(a[0],a[1],a[2],-1,-1,...u,...h),i.emplaceBack(a[0],a[1],a[2],1,-1,...u,...h),i.emplaceBack(a[0],a[1],a[2],1,1,...u,...h),i.emplaceBack(a[0],a[1],a[2],-1,1,...u,...h),r.emplaceBack(n+0,n+1,n+2),r.emplaceBack(n+0,n+2,n+3),n+=4}this.particlesVx=t.createVertexBuffer(i,iD.members),this.particlesIdx=t.createIndexBuffer(r)}}getDrawParams(e){if(!e.style.snow)return null;const t=e.style.snow.state,i=structuredClone(this._params);i.intensity=t.density,i.timeFactor=t.intensity,i.color=structuredClone(t.color),i.screenThinning.intensity=t.centerThinning,i.billboardSize=2.79*t.flakeSize;const r=structuredClone(this._vignetteParams);return r.strength=1,r.color=structuredClone(t.vignetteColor),{params:i,vignetteParams:r,revealParams:{revealStart:0,revealRange:.01},direction:structuredClone(t.direction)}}draw(e){const t=this.getDrawParams(e);if(!t)return;const{params:i,revealParams:r,direction:n,vignetteParams:o}=t,a=e.transform.zoom;if(r.revealStart>a)return;const s=eD(0,1,r.revealStart,r.revealStart+r.revealRange,a);o.strength*=s;const l=this.updateOnRender(e,i.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const c=e.context,u=c.gl,h=e.transform,d=e.getOrCreateProgram("snowParticle");e.uploadCommonUniforms(c,d),((t,i,r)=>{const o=JT(this._movement.getPosition(),t),a=h.width/2,s=h.height/2,c=eD(0,r.screenThinning.start,0,1,r.screenThinning.intensity),p=eD(.001,r.screenThinning.range,0,1,r.screenThinning.intensity),f=eD(0,r.screenThinning.particleOffset,0,1,r.screenThinning.intensity),m=(_={modelview:l.modelviewMatrix,projection:l.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:o,velocityConeAperture:r.velocityConeAperture,velocity:r.velocity,horizontalOscillationRadius:r.horizontalOscillationRadius,horizontalOscillationRate:r.horizontalOscillationRate,boxSize:t,billboardSize:1*r.billboardSize,simpleShapeParameters:[r.shapeFadeStart,r.shapeFadePower],screenSize:[h.width,h.height],thinningCenterPos:[a,s],thinningShape:[c,p,Math.pow(10,r.screenThinning.fadePower)],thinningAffectedRatio:r.screenThinning.affectedRatio,thinningParticleOffset:f,color:[r.color.r,r.color.g,r.color.b,r.color.a],direction:n},{u_modelview:Float32Array.from(_.modelview),u_projection:Float32Array.from(_.projection),u_time:_.time,u_cam_pos:_.camPos,u_velocityConeAperture:_.velocityConeAperture,u_velocity:_.velocity,u_horizontalOscillationRadius:_.horizontalOscillationRadius,u_horizontalOscillationRate:_.horizontalOscillationRate,u_boxSize:_.boxSize,u_billboardSize:_.billboardSize,u_simpleShapeParameters:_.simpleShapeParameters,u_screenSize:_.screenSize,u_thinningCenterPos:_.thinningCenterPos,u_thinningShape:_.thinningShape,u_thinningAffectedRatio:_.thinningAffectedRatio,u_thinningParticleOffset:_.thinningParticleOffset,u_particleColor:_.color,u_direction:_.direction});var _;const g=Math.round(r.intensity*this.particlesCount),y=uh.simpleSegment(0,0,4*g,2*g);this.particlesVx&&this.particlesIdx&&d.draw(e,u.TRIANGLES,fw.disabled,uw.disabled,pw.alphaBlended,gw.disabled,m,"snow_particles",this.particlesVx,this.particlesIdx,y)})(i.boxSize,0,i),this._vignette.draw(e,o)}},shaders:qT,programUniforms:aD,drawElevatedStructures:function(e){const{painter:t,sourceCache:i,layer:r,coords:n,colorMode:o}=e,a=t.context.gl,s=e.painter.shadowRenderer,l=!!s&&s.enabled,c=new fw(t.context.gl.LEQUAL,fw.ReadOnly,t.depthRangeFor3D);let u=[0,0,0];if(l){const e=t.style.directionalLight,i=t.style.ambientLight;e&&i&&(u=hA(t.style,e,i))}const h=e=>{for(const h of n){const n=i.getTile(h),d=n.getBucket(r);if(!d)continue;const p=d.hdExt?d.hdExt.elevatedStructures:void 0;if(!p)continue;let f,m;if(e?(f=p.renderableBridgeSegments,m=p.bridgeProgramConfigurations.get(r.id)):(f=p.renderableTunnelSegments,m=p.tunnelProgramConfigurations.get(r.id)),!f||0===f.segments[0].primitiveLength)continue;m.updatePaintBuffers(),t.prepareDrawTile();const _=t.isTileAffectedByFog(h),g=[];l&&g.push("RENDER_SHADOWS","NORMAL_OFFSET");const y=t.getOrCreateProgram("elevatedStructures",{config:m,overrideFog:_,defines:g}),x=t.translatePosMatrix(h.projMatrix,n,r.paint.get("fill-translate"),r.paint.get("fill-translate-anchor"));l&&s.setupShadows(n.tileID.toUnwrapped(),y,"vector-tile");const v=nD(x,u);t.uploadCommonUniforms(t.context,y,h.toUnwrapped()),y.draw(t,a.TRIANGLES,c,uw.disabled,o,gw.backCCW,v,r.id,p.vertexBuffer,p.indexBuffer,f,r.paint,t.transform.zoom,m,[p.vertexBufferNormal])}};h(!0),h(!1)},drawElevatedFillShadows:function(e){const{painter:t,sourceCache:i,layer:r,coords:n}=e,o=t.context.gl,a=e.painter.shadowRenderer;for(const s of n){const e=i.getTile(s),n=e.getBucket(r);if(!n)continue;const l=n.hdExt?n.hdExt.elevatedStructures:void 0;if(!l)continue;if(!l.shadowCasterSegments||0===l.shadowCasterSegments.segments[0].primitiveLength)continue;t.prepareDrawTile();const c=n.bufferData.programConfigurations.get(r.id),u=t.isTileAffectedByFog(s),h=t.getOrCreateProgram("elevatedStructuresDepth",{config:c,overrideFog:u}),d=a.calculateShadowPassMatrixFromTile(e.tileID.toUnwrapped());t.uploadCommonUniforms(t.context,h,s.toUnwrapped());const p=rD(d,0);h.draw(t,o.TRIANGLES,a.getShadowPassDepthMode(),uw.disabled,pw.disabled,gw.disabled,p,r.id,l.vertexBuffer,l.indexBuffer,l.shadowCasterSegments,r.paint,t.transform.zoom,c)}},drawDepthPrepass:function(e,t,i,r,n){if(!t)return;if(!i.layout||"none"===i.layout.get("fill-elevation-reference")||0===i.paint.get("fill-opacity").constantOr(1))return;const o=e.context.gl,a=new fw(e.context.gl.LEQUAL,fw.ReadWrite,e.depthRangeFor3D),s=new fw(e.context.gl.GREATER,fw.ReadWrite,e.depthRangeFor3D),l=function(e){let t=.01;return e.isOrthographic&&(t=Wr(1e-4,t,$t(e.pitch>=Nw?1:e.pitch/Nw))),2*t}(e.transform),c=e.transform.getFreeCameraOptions().position,u="elevatedStructuresDepthReconstruct";let h;for(const d of r){const r=t.getTile(d),p=r.getBucket(i);if(!p)continue;if(!p.hdExt)continue;const f=p.hdExt.elevatedStructures,m=p.hdExt.elevationBufferData;if(!f||!f.depthSegments||!m)continue;const _=m.heightRange,g=sD(d.toUnwrapped(),c),y=e.translatePosMatrix(d.projMatrix,r,i.paint.get("fill-translate"),i.paint.get("fill-translate-anchor"));let x,v,b;if("initialize"===n){if(!_||_.min>=1||0===f.depthSegments.segments[0].primitiveLength)continue;x=oD(y,g,l,1,0),v=a,b=f.depthSegments,h=h||e.getOrCreateProgram(u,{defines:["DEPTH_RECONSTRUCTION"]})}else if("reset"===n){if(!_||_.min>=0||0===f.maskSegments.segments[0].primitiveLength)continue;x=oD(y,g,0,0,1),v=s,b=f.maskSegments,h=h||e.getOrCreateProgram(u,{defines:["DEPTH_RECONSTRUCTION"]})}else if("geometry"===n){if(0===f.depthSegments.segments[0].primitiveLength)continue;x=oD(y,g,l,1,0),v=a,b=f.depthSegments,h=h||e.getOrCreateProgram(u)}h.draw(e,o.TRIANGLES,v,uw.disabled,pw.disabled,gw.disabled,x,i.id,f.vertexBuffer,f.indexBuffer,b,i.paint,e.transform.zoom)}},drawGroundShadowMask:function(e,t,i,r){if(!t)return;if(!i.layout||"none"===i.layout.get("fill-elevation-reference")||0===i.paint.get("fill-opacity").constantOr(1))return;const n=e.context.gl,o=new fw(n.LEQUAL,fw.ReadOnly,e.depthRangeFor3D),a=new uw({func:n.ALWAYS,mask:255},255,255,n.KEEP,n.KEEP,n.REPLACE),s=e.transform.getFreeCameraOptions().position;let l;for(const c of r){const r=t.getTile(c),u=r.getBucket(i);if(!u)continue;const h=u.hdExt?u.hdExt.elevatedStructures:void 0;if(!h||!h.depthSegments||0===h.depthSegments.segments[0].primitiveLength)continue;const d=sD(c.toUnwrapped(),s),p=e.translatePosMatrix(c.projMatrix,r,i.paint.get("fill-translate"),i.paint.get("fill-translate-anchor"));l=l||e.getOrCreateProgram("elevatedStructuresDepthReconstruct");const f=oD(p,d,0,1,0);l.draw(e,n.TRIANGLES,o,a,pw.disabled,gw.disabled,f,i.id,h.vertexBuffer,h.indexBuffer,h.depthSegments,i.paint,e.transform.zoom)}},IndoorManager:class extends Nr{constructor(e,t=!1){super(),this._style=e,this._buildings={},this._activeFloors=new Set,this._closestBuildingId=null,this._indoorState={selectedFloorId:null,activeFloorsVisible:!0,activeFloors:this._activeFloors},this._buildingDetectionStrategy=new LT,this._initialLoadDone=!1,bt(["_updateUI"],this);const i=()=>{this._style.isIndoorEnabled()&&(this._style.map.on("load",()=>
vendor: 43,841 bytes, line 2
2{this._initialLoadDone=!0,this._indoorState&&this._indoorState.needsUpdate&&(this._indoorState.needsUpdate=!1,this._style.updateIndoorDependentLayers()),this._updateUI()}),this._style.map.on("move",this._updateUI),this._style.map.on("idle",this._updateUI))};t?(this._initialLoadDone=!0,i()):this._style.on("style.load",i)}destroy(){this._buildings={},this._activeFloors=new Set,this._indoorState=null}selectFloor(e){e===this._selectedFloorId&&this._indoorState&&this._indoorState.activeFloorsVisible||(this._selectedFloorId=e,this._recalculateActiveFloors())}setActiveFloorsVisibility(e){this._updateActiveFloors(e),this._updateIndoorSelector()}setIndoorData(e){let t=!1;for(const[i,r]of Object.entries(e.buildings))if(this._buildings[i])for(const e of r.floorIds)this._buildings[i].floorIds.add(e),this._buildings[i].floors[e]?this._mergeFloors(this._buildings[i].floors[e],r.floors[e]):(this._buildings[i].floors[e]=r.floors[e],t=!0);else this._buildings[i]=r,t=!0;t&&this._recalculateActiveFloors()}getIndoorTileOptions(e,t){return this._indoorState?{sourceLayers:this._style.getIndoorSourceLayers(e,t),indoorState:this._indoorState}:null}getControlState(){const e=this._buildings,t=this._closestBuildingId,i=t&&e?e[t]:void 0;if(!i)return{selectedFloorId:null,activeFloorsVisible:!!this._indoorState&&this._indoorState.activeFloorsVisible,floors:[]};let r=null;for(const o of i.floorIds)if(this._activeFloors&&this._activeFloors.has(o)){r=o;break}const n=Array.from(i.floorIds).map(e=>({id:e,name:i.floors[e].name,zIndex:i.floors[e].zIndex})).sort((e,t)=>t.zIndex-e.zIndex).filter((e,t,i)=>0===t||e.zIndex!==i[t-1].zIndex);return{selectedFloorId:r,activeFloorsVisible:!!this._indoorState&&this._indoorState.activeFloorsVisible,floors:n}}_updateUI(){this._initialLoadDone=!0;const e=this._style.map.transform,t=this._buildingDetectionStrategy.findClosestBuilding(this._buildings,e.center,e.zoom,e.getBounds(),this._makeViewportPolygon());if(t!==this._closestBuildingId){const e=this._closestBuildingId;this._closestBuildingId=t,this._onBuildingTransition(e,t),this._updateIndoorSelector()}}_onBuildingTransition(e,t){if(!this._indoorState)return;const i=!!t&&!e;!t&&e?(this._indoorState.activeFloors=new Set,this._indoorState.activeFloorsVisible=!1,this._style.updateIndoorDependentLayers()):i&&(this._recalculateActiveFloors(),this._updateActiveFloors(!0))}_updateIndoorSelector(){this.fire(new Or("selector-update",this.getControlState()))}_updateActiveFloors(e){this._indoorState={selectedFloorId:this._selectedFloorId,activeFloorsVisible:e,activeFloors:this._activeFloors},this._initialLoadDone?this._style.updateIndoorDependentLayers():this._indoorState.needsUpdate=!0}_recalculateActiveFloors(){if(!this._buildings)return;const e=_v.calculate(this._buildings,this._selectedFloorId,this._activeFloors);(function(e,t){if(e===t)return!0;if(!e||!t)return!1;if(e.size!==t.size)return!1;for(const i of e)if(!t.has(i))return!1;return!0})(e,this._activeFloors)||(this._activeFloors=e,this._updateActiveFloors(!!this._indoorState&&this._indoorState.activeFloorsVisible),this._updateIndoorSelector())}_mergeFloors(e,t){t.geometry&&(e.geometry?("Polygon"===e.geometry.type&&(e.geometry={type:"MultiPolygon",coordinates:[e.geometry.coordinates]}),"Polygon"===t.geometry.type?e.geometry.coordinates.push(t.geometry.coordinates):"MultiPolygon"===t.geometry.type&&e.geometry.coordinates.push(...t.geometry.coordinates)):e.geometry=t.geometry)}_makeViewportPolygon(){const e=this._style.map.transform,t=e.width,i=e.height;return[e.pointLocation(new ke(0,0)),e.pointLocation(new ke(t,0)),e.pointLocation(new ke(t,i)),e.pointLocation(new ke(0,i))].map(e=>new ke(e.lng,e.lat))}},HdCoverageState:class{constructor(){this.coverageSourceCaches={},this.manager=new dD}},updateFrcCoverage:function(e,t){t.manager.clear();for(const r in e._mergedHdRoadCoverageSourceCaches){const i=e._mergedHdRoadCoverageSourceCaches[r]._tiles;for(const e in i){const r=i[e];if(!r||!r.loaded())continue;const n=r.frcCoveragePolygons;t.manager.addTileCoverage(r.tileID.canonical,n&&n.length>0?n:[])}}const i=t.manager.updateSnapshotIfNeeded();if(e.map.painter&&(e.map.painter.frcCoverageSnapshot=i.empty()?null:i),!i.empty()){const t=[e._mergedOtherSourceCaches,e._mergedSymbolSourceCaches];for(const e of t)for(const t in e){const i=e[t];for(const e in i._tiles){const t=i._tiles[e];t&&t.hasDeferredRoadStructure&&(t.hasDeferredRoadStructure=!1,i._reloadTile(+e,"reloading"))}}}},updateHdCoverageSourceCache:function(e,t,i){if("fill"!==i.type||i.sourceLayer!==mv)return;if(t.coverageSourceCaches[i.source])return;const r=e.getOwnSource(i.source);if(!r||"vector"!==r.type)return;const n=`hd-road-coverage:${i.source}`,o=Ul(n,e.scope),a=e._sourceCaches[n]=new DD(o,r,3);t.coverageSourceCaches[i.source]=a,a.setMaxzoomOverride(14),a.onAdd(e.map);const s=e._otherSourceCaches[i.source];s&&s._sourceLoaded&&(a._sourceLoaded=!0)},updateFrcCoverageFadeRange:function(e,t){let i=null,r=null;const n={globals:{zoom:0}};e.forEachFragmentStyle(t=>{if(i)return;const o=t.stylesheet?t.stylesheet.schema:null;if(!o||!o.sdCoverageFadeRange)return;const a=Ul("sdCoverageFadeRange",t.scope),s=t.options?t.options.get(a):void 0,l=s?s.value||s.default:null;if(l){const e=l.evaluate(n);Array.isArray(e)&&2===e.length&&(e[0]>0||e[1]>0)&&(i=[e[0],e[1]])}const c=Ul("sdCoverageSourceLayers",t.scope),u=t.options?t.options.get(c):void 0,h=u?u.value||u.default:null;if(h){const e=h.evaluate(n);Array.isArray(e)&&e.length>0&&(r=e)}else{const i=e.stylesheet&&e.stylesheet.imports||[];for(const e of i)if(e.id===t.scope){const t=e.config?e.config.sdCoverageSourceLayers:void 0;Array.isArray(t)&&t.length>0&&(r=t);break}}}),t.frcCoverageFadeRange=i,t.frcCoverageSourceLayers=null!=i?r||["road","structure"]:[]},HdElevationState:GD,setupAndUpdateElevationCoverage:function(e){if(!function(e){for(const t in e._mergedLayers)if(kD(e._mergedLayers[t]))return!0;return!1}(e))return void $D(e);const t=KS(e,e.map&&e.map.transform);e._hdElevation||(e._hdElevation=new GD);const i=e._hdElevation._terrainActiveLast;if(e._hdElevation._terrainActiveLast=t,void 0!==i&&i!==t&&jD(e,void 0,!0),t)return void(e.map.painter&&(e.map.painter.elevationCoverageSnapshot=null));if(!ND(e))return void $D(e);void 0===i&&jD(e,void 0,!0);const r=e._hdElevation;r._needsCrossSourceElevation=!0,e._crossSourceElevationActive=!0,r._ingestFQIDs=UD(e),WD(e,r)},updateElevationCoverage:WD,updateCrossSourceElevationGate:function(e){e._crossSourceElevationActive=ND(e)},buildElevationRequestParams:function(e,t,i){if(KS(e.style,e.transform))return null;if(!i)return null;const r=e.painter?e.painter.elevationCoverageSnapshot:null,n=!(!e.painter||!e.painter.elevationProvidersReady);return r?function(e,t,i){const r=e.getTilesIntersecting(t);if(0===r.length)return{registry:[],hasCoveringTile:!1,allProvidersReady:i};const n=[];for(const o of r)for(const e of o.features)n.push({tileId:o.tileId,feature:e});return n.sort((e,t)=>e.feature.id-t.feature.id),{registry:n,hasCoveringTile:!0,allProvidersReady:i}}(r,t.tileID.canonical,n):{registry:[],hasCoveringTile:!1,allProvidersReady:n}},FrcCoverageRenderer:class{constructor(){this.tileBuffers=new Map,this._context=null}update(e,t){this._context=e;const i=new Set;for(const r of t){if(0===r.frcMask)continue;let t=!1;for(const e of r.polygons)if(e.hasGeometry()){t=!0;break}if(!t)continue;const n=`${r.tileId.z}/${r.tileId.x}/${r.tileId.y}`;if(i.add(n),!this.tileBuffers.has(n)){const t=this._createBuffers(e,r);t&&this.tileBuffers.set(n,t)}}for(const r of this.tileBuffers.keys())if(!i.has(r)){const e=this.tileBuffers.get(r);e.vertexBuffer.destroy(),e.indexBuffer.destroy();for(const t of e.frcLevelSegments)t&&t.destroy();this.tileBuffers.delete(r)}}getBuffers(e){return this.tileBuffers.get(`${e.z}/${e.x}/${e.y}`)||null}destroy(){for(const e of this.tileBuffers.values()){e.vertexBuffer.destroy(),e.indexBuffer.destroy();for(const t of e.frcLevelSegments)t&&t.destroy()}this.tileBuffers.clear()}_createBuffers(e,t){const i=new uu,r=new Ru,n=[];for(const a of t.polygons){if(!a.hasGeometry()||0===a.rings.length)continue;const e=i.length,t=r.length,o=i.length,s=[],l=[];let c=0;for(let r=0;r<a.rings.length;r++){const e=a.rings[r];if(!(e.length<3)){r>0&&l.push(c);for(const t of e)i.emplaceBack(t.x,t.y),s.push(t.x,t.y),c++}}const u=ec(s,l.length>0?l:void 0);for(let i=0;i<u.length;i+=3)r.emplaceBack(o+u[i],o+u[i+1],o+u[i+2]);n.push({vertexOffset:e,indexOffset:t,vertexCount:i.length-e,indexCount:r.length-t,frcMask:a.frcMask})}if(0===i.length)return null;const o=new Array(9).fill(null);for(let a=0;a<9;++a){const e=1<<a;if(0===(t.frcMask&e))continue;let i=1/0,r=0,s=0,l=!1;for(const t of n)0!==(t.frcMask&e)&&(i=Math.min(i,t.indexOffset),r=Math.max(r,t.indexOffset+t.indexCount),s=Math.max(s,t.vertexOffset+t.vertexCount),l=!0);l&&(o[a]=uh.simpleSegment(0,i,s,r-i))}return{vertexBuffer:e.createVertexBuffer(i,Op.members),indexBuffer:e.createIndexBuffer(r),frcLevelSegments:o}}},drawFillFrcCoverageFirstPass:function(e){const{painter:t,bucket:i,coord:r,elevatedGeometry:n}=e,o="road"===i.sourceLayerName,a="structure"===i.sourceLayerName;if(!o&&!a)return"fallthrough";if(!t.frcCoverageSnapshot||n)return"fallthrough";const s=t.frcCoverageSnapshot.getTileOrParent(r.canonical);if(!s||0===s.frcMask)return"fallthrough";const l=i.hdExt&&i.hdExt.frcData,c=!!l&&!l.empty(),u=eM(s.polygons);if(a&&!u)return"skip";if(a&&u)return e.polygonCoverageTiles.push({coord:e.coord,bufferData:e.bufferData,program:e.program,programConfiguration:e.programConfiguration,uniformValues:e.uniformValues,depthMode:e.depthMode,dynamicBuffers:e.dynamicBuffers,indexBuffer:e.indexBuffer,segments:e.segments,frcMask:s.frcMask}),"deferred";if(o&&c&&l){const i=s.frcMask,r=t.transform.zoom;for(const[n,o]of l.frcPerLevel)i&1<<n||0!==o.segments.length&&e.program.draw(t,e.drawMode,e.depthMode,e.stencilMode,e.colorMode,gw.disabled,e.uniformValues,e.layer.id,e.bufferData.layoutVertexBuffer,e.indexBuffer,o,e.layer.paint,r,e.programConfiguration,e.dynamicBuffers);return l.frcNonRoadSegments.segments.length>0&&e.program.draw(t,e.drawMode,e.depthMode,e.stencilMode,e.colorMode,gw.disabled,e.uniformValues,e.layer.id,e.bufferData.layoutVertexBuffer,e.indexBuffer,l.frcNonRoadSegments,e.layer.paint,r,e.programConfiguration,e.dynamicBuffers),"drawn"}return"fallthrough"},drawFillFrcCoverageSecondPass:function(e,t,i,r,n){if(0===i.length)return;const o=tM(e),a=e.transform.zoom,s=(i,o,s)=>{1!==s&&(i.uniformValues.u_opacity_multiplier=s),i.program.draw(e,r,i.depthMode,o,n,gw.disabled,i.uniformValues,t.id,i.bufferData.layoutVertexBuffer,i.indexBuffer,i.segments,t.paint,a,i.programConfiguration,i.dynamicBuffers),1!==s&&(i.uniformValues.u_opacity_multiplier=1)};QD(e,i,o,(e,t,i)=>s(e,i,1),(e,t,i)=>s(e,i,o))},drawLineFrcCoverageDetect:function(e,t,i,r,n,o,a,s,l,c){const u=t.hdExt&&t.hdExt.frcData;if(!u||0===u.frcPerLevel.size)return null;if(!e.frcCoverageSnapshot||r)return null;const h=e.frcCoverageSnapshot.getTileOrParent(i.canonical);if(!h||0===h.frcMask)return null;const d=eM(h.polygons),p=e.frcCoverageFadeRange,f=null!=p&&e.transform.zoom>=p[0];if(d&&f){let e=!1;for(const t of u.frcPerLevel.keys())if(h.frcMask&1<<t){e=!0;break}e&&c.push({coord:i,bucket:t,uniformValues:n,programConfiguration:o,program:a,depthMode:s,colorMode:l,frcMask:h.frcMask})}return{coverageTile:h,frcMask:h.frcMask,active:f,hasPolygonGeometry:d}},drawLineFrcRenderLine:function(e,t,i,r){const n=e.hdExt&&e.hdExt.frcData;if(!n)return;const o=t.frcMask;for(const[s,l]of n.frcPerLevel)o&1<<s||r(i,l);const a=n.frcNonRoadSegments;a.segments.length>0&&r(i,a)},drawLineFrcFadePass:function(e,t,i,r,n,o,a){if(r.hasPolygonGeometry)return;const s=t.hdExt&&t.hdExt.frcData;if(!s||!e.frcCoverageFadeRange)return;const[l,c]=e.frcCoverageFadeRange;if(l>=c)return;const u=1-Math.max(0,Math.min(1,(e.transform.zoom-l)/(c-l)));if(u<=0)return;const h=n?o:e.stencilModeForClipping(i),d=r.frcMask;for(const[p,f]of s.frcPerLevel)d&1<<p&&a(h,f,u)},drawLineFrcCoverageSecondPass:function(e,t,i){if(0===i.length)return;const r=e.context.gl,n=tM(e),o=e.transform.zoom,a=(i,n,a,s)=>{const l=i.bucket.hdExt&&i.bucket.hdExt.frcData,c=l&&l.frcPerLevel.get(n);c&&0!==c.segments.length&&(1!==s&&(i.uniformValues.u_opacity_multiplier=s),i.program.draw(e,r.TRIANGLES,i.depthMode,a,i.colorMode,gw.disabled,i.uniformValues,t.id,i.bucket.layoutVertexBuffer,i.bucket.indexBuffer,c,t.paint,o,i.programConfiguration,[i.bucket.layoutVertexBuffer2,i.bucket.patternVertexBuffer,i.bucket.zOffsetVertexBuffer,i.bucket.elevationIdColVertexBuffer,i.bucket.elevationGroundScaleVertexBuffer]),1!==s&&(i.uniformValues.u_opacity_multiplier=1))};QD(e,i,n,(e,t,i)=>a(e,t,i,1),(e,t,i)=>a(e,t,i,n))}},rM=iM;async function nM(){return Promise.resolve()}function oM(e,t){const i=Math.pow(2,t.canonical.z),r=t.canonical.y;return[new Zc(0,r/i).toLngLat().lat,new Zc(0,(r+1)/i).toLngLat().lat]}function aM(e,t,i,r,n,o,a){const s=e.context,l=s.gl,c=i.hillshadeFBO;if(!c)return;e.prepareDrawTile();const u=e.isTileAffectedByFog(t),h=[];e.terrain&&e.terrain.renderingToTexture&&e.isEmissiveMrtActive()&&(h.push("USE_MRT1"),"mrt-full-rgba"===e.emissiveMode&&h.push("USE_MRT1_RGBA"));const d=e.getOrCreateProgram("hillshade",{overrideFog:u,defines:h});s.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,c.colorAttachment0.get());const p=((e,t,i,r)=>{const n=i.paint.get("hillshade-shadow-color"),o="none"===i.paint.get("hillshade-shadow-color-use-theme").constantOr("default"),a=i.paint.get("hillshade-highlight-color"),s="none"===i.paint.get("hillshade-highlight-color-use-theme").constantOr("default"),l=i.paint.get("hillshade-accent-color"),c="none"===i.paint.get("hillshade-accent-color-use-theme").constantOr("default"),u=i.paint.get("hillshade-emissive-strength");let h=nt(i.paint.get("hillshade-illumination-direction"));if("viewport"===i.paint.get("hillshade-illumination-anchor"))h-=e.transform.angle;else if(e.style&&e.style.enable3dLights()&&e.style.directionalLight){const t=e.style.directionalLight.properties.get("direction");h=nt(Pt(t.x,t.y,t.z)[1])}const d=!e.options.moving;return{u_matrix:r||e.transform.calculateProjMatrix(t.tileID.toUnwrapped(),d),u_image:0,u_latrange:oM(0,t.tileID),u_light:[i.paint.get("hillshade-exaggeration"),h],u_shadow:n.toPremultipliedRenderColor(o?null:i.lut),u_highlight:a.toPremultipliedRenderColor(s?null:i.lut),u_emissive_strength:u,u_accent:l.toPremultipliedRenderColor(c?null:i.lut)}})(e,i,r,e.terrain?t.projMatrix:null);e.uploadCommonUniforms(s,d,t.toUnwrapped());const{tileBoundsBuffer:f,tileBoundsIndexBuffer:m,tileBoundsSegments:_}=e.getTileBoundsBuffers(i);d.draw(e,l.TRIANGLES,n,o,a,gw.disabled,p,r.id,f,m,_)}function sM(e,t,i){if(!t.needsDEMTextureUpload)return;const r=e.context,n=r.gl;r.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||e.getTileTexture(i.stride);const o=i.getPixels();t.demTexture?t.demTexture.update(o,{premultiply:!1}):t.demTexture=new $m(r,o,n.R32F,{premultiply:!1}),t.needsDEMTextureUpload=!1}function lM(e,t,i){const r=e.context,n=r.gl;if(!t.dem)return;const o=t.dem;if(r.activeTexture.set(n.TEXTURE1),sM(e,t,o),!t.demTexture)return;t.demTexture.bind(n.NEAREST,n.CLAMP_TO_EDGE);const a=o.dim;r.activeTexture.set(n.TEXTURE0);let s=t.hillshadeFBO;if(!s){const e=new $m(r,{width:a,height:a,data:null},n.RGBA8);e.bind(n.LINEAR,n.CLAMP_TO_EDGE),s=t.hillshadeFBO=r.createFramebuffer(a,a,1,"renderbuffer"),s.colorAttachment0.set(e.texture)}r.bindFramebuffer.set(s.framebuffer),r.viewport.set([0,0,a,a]);const{tileBoundsBuffer:l,tileBoundsIndexBuffer:c,tileBoundsSegments:u}=e.getMercatorTileBoundsBuffers(),h=[];e.linearFloatFilteringSupported()&&h.push("TERRAIN_DEM_FLOAT_FORMAT"),e.terrain&&e.terrain.renderingToTexture&&e.isEmissiveMrtActive()&&(h.push("USE_MRT1"),"mrt-full-rgba"===e.emissiveMode&&h.push("USE_MRT1_RGBA")),e.getOrCreateProgram("hillshadePrepare",{defines:h}).draw(e,n.TRIANGLES,fw.disabled,uw.disabled,pw.unblended,gw.disabled,((e,t)=>{const i=t.stride,r=p();return L(r,0,co,-8192,0,0,1),v(r,r,[0,-8192,0]),{u_matrix:r,u_image:1,u_dimension:[i,i],u_zoom:e.overscaledZ}})(t.tileID,o),i.id,l,c,u),t.needsHillshadePrepare=!1}class cM{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class uM extends cM{getDefault(){return Zr.transparent.toNonPremultipliedRenderColor(null)}set(e){const t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class hM extends cM{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class dM extends cM{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class pM extends cM{getDefault(){return[!0,!0,!0,!0]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class fM extends cM{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class mM extends cM{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class _M extends cM{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){const t=this.current;(e.func!==t.func||e.ref!==t.ref||e.mask!==t.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class gM extends cM{getDefault(){const e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class yM extends cM{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1}}class xM extends cM{getDefault(){return[0,1]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class vM extends cM{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1}}class bM extends cM{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class wM extends cM{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1}}class EM extends cM{getDefault(){const e=this.gl;return[e.ONE,e.ZERO,e.ONE,e.ZERO]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.blendFuncSeparate(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class AM extends cM{getDefault(){return Zr.transparent.toNonPremultipliedRenderColor(null)}set(e){const t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class IM extends cM{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(e,e),this.current=e,this.dirty=!1)}}class SM extends cM{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1}}class TM extends cM{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class DM extends cM{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}let MM=class extends cM{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}};class PM extends cM{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class CM extends cM{getDefault(){const e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class RM extends cM{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class zM extends cM{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class LM extends cM{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class FM extends cM{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class OM extends cM{getDefault(){return null}set(e){const t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class BM extends cM{getDefault(){return null}set(e){this.gl&&(e!==this.current||this.dirty)&&(this.gl.bindVertexArray(e),this.current=e,this.dirty=!1)}}class kM extends cM{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class VM extends cM{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class NM extends cM{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class UM extends cM{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}}class jM extends UM{constructor(e,t,i=0){super(e,t),this.attachmentPoint=e.gl.COLOR_ATTACHMENT0+i}setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,this.attachmentPoint,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class GM extends UM{attachment(){return this.gl.DEPTH_ATTACHMENT}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,this.attachment(),t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class HM extends UM{attachment(){return this.gl.DEPTH_ATTACHMENT}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,this.attachment(),t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class $M extends GM{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const WM=(e,t,i,r)=>({u_matrix:e,u_image0:0,u_image1:1,u_skirt_height:t,u_ground_shadow_factor:i,u_emissive_texture_available:r}),qM=(e,t,i,r,n,o,a,s,l,c,u,h,d,p,f,m,_)=>({u_proj_matrix:Float32Array.from(e),u_globe_matrix:t,u_normalize_matrix:Float32Array.from(r),u_merc_matrix:i,u_zoom_transition:n,u_merc_center:o,u_image0:0,u_image1:1,u_frustum_tl:a,u_frustum_tr:s,u_frustum_br:l,u_frustum_bl:c,u_globe_pos:u,u_globe_radius:h,u_viewport:d,u_grid_matrix:_?Float32Array.from(_):new Float32Array(9),u_skirt_height:p,u_far_z_cutoff:f,u_emissive_texture_available:m});function ZM(e,t){return null!=e&&null!=t&&!(!e.hasData()||!t.hasData())&&null!=e.demTexture&&null!=t.demTexture&&e.tileID.key!==t.tileID.key}const XM=new class{constructor(){this.operations={}}newMorphing(e,t,i,r,n){if(e in this.operations){const t=this.operations[e];t.to.tileID.key!==i.tileID.key&&(t.queued=i)}else this.operations[e]={startTime:r,phase:0,duration:n,from:t,to:i,queued:null}}getMorphValuesForProxy(e){if(!(e in this.operations))return null;const t=this.operations[e];return{from:t.from,to:t.to,phase:t.phase}}update(e){for(const t in this.operations){const i=this.operations[t];for(i.phase=(e-i.startTime)/i.duration;i.phase>=1||!this._validOp(i);)if(!this._nextOp(i,e)){delete this.operations[t];break}}}_nextOp(e,t){return!!e.queued&&(e.from=e.to,e.to=e.queued,e.queued=null,e.phase=0,e.startTime=t,!0)}_validOp(e){return e.from.hasData()&&e.to.hasData()}};function YM(e,t,i){if(0===t)return 0;const r=t<1&&514===i?.25/t:1;return 6*Math.pow(1.5,22-e)*Math.max(t,1)*r}function KM(e,t){const i=1<<e.z;return!t&&(0===e.x||e.x===i-1)||0===e.y||e.y===i-1}function JM(e,t){if(!e.style||!e.style.enable3dLights())return;const i=e.context,r=i.gl;i.activeTexture.set(r.TEXTURE1),t?t.bind(r.LINEAR,r.CLAMP_TO_EDGE):e.emptyTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}class QM extends Nr{constructor(e,t,i,r,n,o){super(),this.id=e,this.type=t,this.tileSize=i,this.minzoom=r,this.maxzoom=n,this.roundZoom=!1,this.reparseOverscaled=o}loaded(){return!0}loadTile(e,t){t(null)}serialize(){return{type:this.type}}}class eP extends DD{constructor(e){const t=new QM("mock-dem","raster-dem",512,0,Math.ceil(e.transform.maxZoom),!1);super("mock-dem",t,null),t.setEventedParent(this),this._sourceLoaded=!0}_loadTile(e,t){e.state="loaded",t(null)}}class tP extends DD{constructor(e){const t=new QM("proxy","geojson",512,0,Math.ceil(e.transform.maxZoom),!0);super("proxy",t,null),t.setEventedParent(this),this.map=this.getSource().map=e,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(e,t,i){if(e.freezeTileCoverage)return;this.transform=e;const r=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((t,i)=>{if(t[i.key]="",!this._tiles[i.key]){const t=new ID(i,this._source.tileSize*i.overscaleFactor(),e.tileZoom,void 0,void 0,this._source.worldview);t.state="loaded",this._tiles[i.key]=t}return t},{});for(const n in this._tiles)n in r||(this.freeFBO(n),this._tiles[n].unloadVectorData(),delete this._tiles[n])}freeFBO(e){const t=this.proxyCachedFBO[e];if(void 0!==t){const i=Object.values(t);this.renderCachePool.push(...i),delete this.proxyCachedFBO[e]}}deallocRenderCache(){this.renderCache.forEach(e=>e.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class iP extends Pf{constructor(e,t,i){super(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y),this.proxyTileKey=t,this.projMatrix=i}}function rP(e,t){return"rgba8"===t?e.RGBA8:e.R8}class nP extends xm{constructor(e,t){super(),this.painter=e,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[i,r,n]=function(){const e=new uu,t=new Ru,i=131;e.reserve(17161),t.reserve(33800);for(let n=-64;n<8288;n+=64)for(let t=-64;t<8288;t+=64){const i=t<0||t>8224||n<0||n>8224?24575:0,r=ht(Math.round(t),0,co),o=ht(Math.round(n),0,co);e.emplaceBack(r+i,o)}const r=(e,r)=>{const n=r*i+e;t.emplaceBack(n+1,n,n+i),t.emplaceBack(n+i,n+i+1,n+1)};for(let n=1;n<129;n++)for(let e=1;e<129;e++)r(e,n);return[0,129].forEach(e=>{for(let t=0;t<130;t++)r(t,e),r(e,t)}),[e,t,32768]}(),o=e.context;this.gridBuffer=o.createVertexBuffer(i,Op.members),this.gridIndexBuffer=o.createIndexBuffer(r),this.gridSegments=uh.simpleSegment(0,0,i.length,r.length),this.gridNoSkirtSegments=uh.simpleSegment(0,0,i.length,n),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new tP(t.map),this.orthoMatrix=p(),L(this.orthoMatrix,"globe"===this.painter.transform.projection.name?.015:0,co,0,co,0,1);const a=o.gl;this._overlapStencilMode=new uw({func:a.GEQUAL,mask:255},0,255,a.KEEP,a.KEEP,a.REPLACE),this._previousZoom=e.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=t,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new eP(t.map),this._pendingGroundEffectLayers=[],this._emissiveTexture="none",this._devtoolsFolder=null}set style(e){e.on("data",this._onStyleDataEvent.bind(this)),this._style=e,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(e,t,i){if(e&&e.terrain){this._style!==e&&(this.style=e,this._evaluationZoom=void 0);const r=e.terrain.properties,n=0===e.terrain.drapeRenderMode,o=e.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=ei.now();const a=e.terrain&&e.terrain.scope,s=r.get("source"),l=n?this._mockSourceCache:e.getSourceCache(s,a);if(!l)return void Tt(`Couldn't find terrain source "${s}".`);if(this.sourceCache=l,this._attenuationRange=e.terrain.getAttenuationRange(),this._exaggeration=o?this.calculateExaggeration(t):r.get("exaggeration"),!t.projection.requiresDraping&&o&&0===this._exaggeration)return void this._disable();this.enabled=!0;const c=()=>{this.sourceCache.used&&Tt(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source.\nThis leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const e=this.getScaledDemTileSize();this.sourceCache.update(t,e,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,c(),this._initializing=!0),c(),t.updateElevation(!0,i),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(t),this._emptyDEMTextureDirty=!0,this._previousZoom=t.zoom}else this._disable()}calculateExaggeration(e){if(this._attenuationRange&&e.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(e.zoom);const t=this._previousCameraAltitude,i=e.getFreeCameraOptions().position.z/e.pixelsPerMeter*e.worldSize;this._previousCameraAltitude=i;const r=null!=t?i-t:Number.MAX_VALUE;if(Math.abs(r)<2)return this._exaggeration;const n=e.zoom,o=this._style.terrain;if(!this._previousUpdateTimestamp)return o.getExaggeration(n);let a=n-this._previousZoom;const s=this._previousUpdateTimestamp;let l=n;null!=this._evaluationZoom&&(l=this._evaluationZoom,Math.abs(n-l)>.5&&(a=.5*(n-l+a)),a*r<0&&(l+=a)),this._evaluationZoom=l;const c=o.getExaggeration(l),u=c===o.getExaggeration(Math.max(0,l-.1));if(u&&Math.abs(c-this._exaggeration)<.01)return c;let h=Math.min(.1,.00375*(this._updateTimestamp-s));return(u||c<.1||Math.abs(a)<1e-4)&&(h=Math.min(.2,4*h)),Wr(this._exaggeration,c,h)}resetTileLookupCache(e){this._findCoveringTileCache[e]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(e){"source"===e.dataType&&e.coord?this._clearRenderCacheForTile(e.sourceCacheId,e.coord):"style"===e.dataType&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._emptyDEMTextureDirty=!0,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const e in this._style._mergedSourceCaches)this._style._mergedSourceCaches[e].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(e=>e.fb.destroy()),this.pool=[],this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this.enabled?this._exaggeration:0}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const e=2*this.proxySourceCache.getSource().tileSize;return[e,e]}set useVertexMorphing(e){this._useVertexMorphing=e}updateTileBinding(e){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const t=this.proxySourceCache,i=this.painter.transform;this._initializing&&(this._initializing=0===i._centerAltitude&&-1===this.getAtPointOrZero(Zc.fromLngLat(i.center),-1),this._emptyDEMTextureDirty=!this._initializing);const r=this.proxyCoords=t.getIds().map(e=>{const r=t.getTileByID(e).tileID;return r.projMatrix=i.calculateProjMatrix(r.toUnwrapped()),r});!function(e,t){const i=t.transform.pointCoordinate(t.transform.getCameraPoint()),r=new ke(i.x,i.y);e.sort((e,t)=>{if(t.overscaledZ-e.overscaledZ)return t.overscaledZ-e.overscaledZ;const i=new ke(e.canonical.x+(1<<e.canonical.z)*e.wrap,e.canonical.y),n=new ke(t.canonical.x+(1<<t.canonical.z)*t.wrap,t.canonical.y),o=r.mult(1<<e.canonical.z);return o.x-=.5,o.y-=.5,o.distSqr(i)-o.distSqr(n)})}(r,this.painter);const n=this.proxyToSource||{};this.proxyToSource={},r.forEach(e=>{this.proxyToSource[e.key]={}}),this.terrainTileForTile={};const o=this._style._mergedSourceCaches;for(const s in o){const t=o[s];if(!t.used)continue;if(!t.transform)continue;if(t!==this.sourceCache&&this.resetTileLookupCache(t.id),this._setupProxiedCoordsForOrtho(t,e[s],n),t.usedForTerrain)continue;const i=e[s];(t.getSource().reparseOverscaled||t._isRasterElevatedOverTerrain)&&this._assignTerrainTiles(i)}this.proxiedCoords[t.id]=r.map(e=>new iP(e,e.key,this.orthoMatrix)),this._assignTerrainTiles(r),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(n),this.renderingToTexture=!1;const a={};this._visibleDemTiles=[];for(const s of this.proxyCoords){const e=this.terrainTileForTile[s.key];if(!e)continue;const t=e.tileID.key;t in a||(this._visibleDemTiles.push(e),a[t]=t)}}_assignTerrainTiles(e){this._initializing||e.forEach(e=>{if(this.terrainTileForTile[e.key])return;const t=this._findTileCoveringTileID(e,this.sourceCache);t&&(this.terrainTileForTile[e.key]=t)})}_prepareDEMTextures(){const e=this.painter.context,t=e.gl;for(const i in this.terrainTileForTile){const r=this.terrainTileForTile[i],n=r.dem;!n||r.demTexture&&!r.needsDEMTextureUpload||(e.activeTexture.set(t.TEXTURE1),sM(this.painter,r,n))}}_prepareDemTileUniforms(e,t,i,r){if(!t||null==t.demTexture)return!1;const n=e.tileID.canonical,o=Math.pow(2,t.tileID.canonical.z-n.z),a=r||"";return i[`u_dem_tl${a}`]=[n.x*o%1,n.y*o%1],i[`u_dem_scale${a}`]=o,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let e=0;const t=this._visibleDemTiles.reduce((t,i)=>{if(!i.dem)return t;const r=i.dem.tree.minimums[0];return r>0&&e++,t+r},0);return e?t/e:0}_updateEmptyDEMTexture(){const e=this.painter.context,t=e.gl;e.activeTexture.set(t.TEXTURE2);const i=this._getLoadedAreaMinimum(),r=new Ld({width:1,height:1},new Float32Array([i]));this._emptyDEMTextureDirty=!1;let n=this._emptyDEMTexture;return n?n.update(r,{premultiply:!1}):n=this._emptyDEMTexture=new $m(e,r,t.R32F,{premultiply:!1}),n}setupElevationDraw(e,t,i){const r=this.painter.context,n=r.gl,o={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0};o.u_exaggeration=this.exaggeration();let a=null,s=null,l=1;if(i&&i.morphing&&this._useVertexMorphing){const t=i.morphing.srcDemTile,r=i.morphing.dstDemTile;l=i.morphing.phase,t&&r&&(this._prepareDemTileUniforms(e,t,o,"_prev")&&(s=t),this._prepareDemTileUniforms(e,r,o)&&(a=r))}const c=e=>e&&e.demTexture&&this.painter.linearFloatFilteringSupported()?n.LINEAR:n.NEAREST;let u=null;var h;if(this.enabled?s&&a?(u=a.demTexture,r.activeTexture.set(n.TEXTURE4),s.demTexture.bind(c(s),n.CLAMP_TO_EDGE),o.u_dem_lerp=l):(a=this.terrainTileForTile[e.tileID.key],u=this._prepareDemTileUniforms(e,a,o)?a.demTexture:this.emptyDEMTexture):u=this.emptyDEMTexture,r.activeTexture.set(n.TEXTURE2),u&&(o.u_dem_size=1===(h=u).size[0]?1:h.size[0]-2,u.bind(c(a),n.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(i&&i.useDepthForOcclusion,t,o),i&&i.useMeterToDem&&a){const e=(1<<a.tileID.canonical.z)*Uc(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;o.u_meter_to_dem=e}if(i&&i.labelPlaneMatrixInv&&(o.u_label_plane_matrix_inv=i.labelPlaneMatrixInv),t.setTerrainUniformValues(r,o),"globe"===this.painter.transform.projection.name){const n=this.globeUniformValues(this.painter.transform,e.tileID.canonical,i&&i.useDenormalizedUpVectorScale);t.setGlobeUniformValues(r,n)}}globeUniformValues(e,t,i){const r=e.projection;return{u_tile_tl_up:r.upVector(t,0,0),u_tile_tr_up:r.upVector(t,co,0),u_tile_br_up:r.upVector(t,co,co),u_tile_bl_up:r.upVector(t,0,co),u_tile_up_scale:i?qp(1):r.upVectorScale(t,e.center.lat,e.worldSize).metersToTile}}renderToBackBuffer(e){const t=this.painter,i=this.painter.context;0!==e.length&&(i.bindFramebuffer.set(null),i.viewport.set([0,0,t.width,t.height]),t.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(e,t,i,r,n){if("globe"===e.transform.projection.name)!function(e,t,i,r,n){const o=e.context,a=o.gl;let s,l;const c=e.transform,u=gf(e,0,c),h=(t,i)=>{if(l===i)return;const r=[];1===i&&r.push("TERRAIN_VERTEX_MORPHING"),r.push("PROJECTION_GLOBE_VIEW"),u&&r.push("CUSTOM_ANTIALIASING");const n=e.isTileAffectedByFog(t);s=e.getOrCreateProgram("globeRaster",{defines:r,overrideFog:n}),l=i},d=e.colorModeForRenderPass(),f=new fw(a.LEQUAL,fw.ReadWrite,e.depthRangeFor3D);XM.update(n);const m=ff(c),_=[Wn(c.center.lng),qn(c.center.lat)],g=e.globeSharedBuffers,y=[c.width*ei.devicePixelRatio,c.height*ei.devicePixelRatio],x=Float32Array.from(c.globeMatrix),v={useDenormalizedUpVectorScale:!0};{const c=e.transform,u=YM(c.zoom,t.exaggeration(),t.sourceCache._source.tileSize);l=-1;const p=a.TRIANGLES;for(const l of r){const r=i.getTile(l),b=uw.disabled,w=t.prevTerrainTileForTile[l.key],E=t.terrainTileForTile[l.key];ZM(w,E)&&XM.newMorphing(l.key,w,E,n,250),JM(e,r.emissiveTexture),o.activeTexture.set(a.TEXTURE0),r.texture&&r.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE);const A=XM.getMorphValuesForProxy(l.key),I=A?1:0;A&&Object.assign(v,{morphing:{srcDemTile:A.from,dstDemTile:A.to,phase:st(A.phase)}});const S=nf(l.canonical),T=xf(S.getCenter().lat),D=yf(l.canonical,S,T,c.worldSize/c._pixelsPerMercatorPixel),M=cf(Jp(l.canonical)),P=e.isEmissiveMrtActive()?1:0,C=qM(c.expandedFarZProjMatrix,x,m,M,mf(c.zoom),_,c.frustumCorners.TL,c.frustumCorners.TR,c.frustumCorners.BR,c.frustumCorners.BL,c.globeCenterInViewSpace,c.globeRadius,y,u,c._farZ,P,D);if(h(l,I),s&&(t.setupElevationDraw(r,s,v),e.uploadCommonUniforms(o,s,l.toUnwrapped()),g)){const[t,i,r]=g.getGridBuffers(T,0!==u);s.draw(e,p,f,b,d,gw.backCCW,C,"globe_raster",t,i,r)}}}if(g&&(e.renderDefaultNorthPole||e.renderDefaultSouthPole)){const n=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];u&&n.push("CUSTOM_ANTIALIASING"),s=e.getOrCreateProgram("globeRaster",{defines:n});for(const l of r){const{x:r,y:n,z:u}=l.canonical,h=0===n,m=n===(1<<u)-1,[x,w,E,A]=g.getPoleBuffers(u,!1);if(A&&(h||m)){const n=i.getTile(l);JM(e,n.emissiveTexture),o.activeTexture.set(a.TEXTURE0),n.texture&&n.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE);let g=_f(u,r,c);const I=cf(Jp(l.canonical)),S=e.isEmissiveMrtActive()?1:0,T=(t,i)=>t.draw(e,a.TRIANGLES,f,uw.disabled,d,gw.disabled,qM(c.expandedFarZProjMatrix,g,g,I,0,_,c.frustumCorners.TL,c.frustumCorners.TR,c.frustumCorners.BR,c.frustumCorners.BL,c.globeCenterInViewSpace,c.globeRadius,y,0,c._farZ,S),"globe_pole_raster",i,E,A);t.setupElevationDraw(n,s,v),e.uploadCommonUniforms(o,s,l.toUnwrapped()),h&&e.renderDefaultNorthPole&&T(s,x),m&&e.renderDefaultSouthPole&&(g=b(p(),g,[1,-1,1]),T(s,w))}}}}(e,t,i,r,n);else{const o=e.context,a=o.gl;let s,l;const c=e.shadowRenderer,u=jw(e,e.longestCutoffRange),h=t=>{if(l===t)return;const i=[];1===t&&i.push("TERRAIN_VERTEX_MORPHING"),u.shouldRenderCutoff&&i.push("RENDER_CUTOFF"),c&&(i.push("RENDER_SHADOWS"),c.useNormalOffset&&i.push("NORMAL_OFFSET")),s=e.getOrCreateProgram("terrainRaster",{defines:i}),l=t},d=e.colorModeForRenderPass(),p=new fw(a.LEQUAL,fw.ReadWrite,e.depthRangeFor3D);XM.update(n);const f=e.transform,m=YM(f.zoom,t.exaggeration(),t.sourceCache._source.tileSize);let _=[0,0,0];if(c){const t=e.style.directionalLight,i=e.style.ambientLight;t&&i&&(_=hA(e.style,t,i))}{l=-1;const g=a.TRIANGLES,[y,x]=[t.gridIndexBuffer,t.gridSegments];for(const l of r){const r=i.getTile(l),v=uw.disabled,b=t.prevTerrainTileForTile[l.key],w=t.terrainTileForTile[l.key];ZM(b,w)&&XM.newMorphing(l.key,b,w,n,250),JM(e,r.emissiveTexture),o.activeTexture.set(a.TEXTURE0),r.texture&&r.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE);const E=XM.getMorphValuesForProxy(l.key),A=E?1:0;let I;E&&(I={morphing:{srcDemTile:E.from,dstDemTile:E.to,phase:st(E.phase)}});const S=e.isEmissiveMrtActive()?1:0,T=WM(l.projMatrix,KM(l.canonical,f.renderWorldCopies)?m/10:m,_,S);if(h(A),!s)continue;t.setupElevationDraw(r,s,I);const D=l.toUnwrapped();c&&c.setupShadows(D,s),e.uploadCommonUniforms(o,s,D,null,u),s.draw(e,g,p,v,d,gw.backCCW,T,"terrain_raster",t.gridBuffer,y,x)}}}}(t,this,this.proxySourceCache,e,this._updateTimestamp),this.renderingToTexture=!0,t.gpuTimingDeferredRenderEnd(),e.splice(0,e.length))}renderBatch(e){if(0===this._drapedRenderBatches.length)return e+1;this.renderingToTexture=!0;const t=this.painter,i=this.painter.context,r=this.proxySourceCache,n=this.proxiedCoords[r.id],o=this._drapedRenderBatches.shift(),a=t.style.order,s=[];this._updateFBOs("mrt-full-rgba"===t.emissiveMode?"rgba8":"mrt-fallback"===t.emissiveMode?"r8":"none");let l=0;for(const c of n){const n=r.getTileByID(c.proxyTileKey),u=r.proxyCachedFBO[c.key]?r.proxyCachedFBO[c.key][e]:void 0,h=void 0!==u?r.renderCache[u]:this.pool[l++],d=void 0!==u;if(n.texture=h.tex,n.emissiveTexture=h.emissiveTex,d&&!h.dirty){s.push(n.tileID);continue}i.bindFramebuffer.set(h.fb.framebuffer);const p=i.gl;let f;t.isEmissiveMrtActive()?p.drawBuffers([p.COLOR_ATTACHMENT0,p.COLOR_ATTACHMENT1]):p.drawBuffers([p.COLOR_ATTACHMENT0]),this.renderedToTile=!1,h.dirty&&(i.clear({color:Zr.transparent,stencil:0}),h.dirty=!1);for(let e=o.start;e<=o.end;++e){const r=t.style._mergedLayers[a[e]];if(r.isHidden(t.transform.zoom))continue;const n=t.style.getLayerSourceCache(r),o=n?this.proxyToSource[c.key][n.id]:[c];if(!o)continue;const s=o;i.viewport.set([0,0,h.fb.width,h.fb.height]),f!==(n?n.id:null)&&(this._setupStencil(h,o,r,n),f=n?n.id:null),t.renderLayer(t,n,r,s)}if(p.drawBuffers([p.COLOR_ATTACHMENT0]),0===this._drapedRenderBatches.length)for(const e of this._pendingGroundEffectLayers){const r=t.style._mergedLayers[a[e]];if(r.isHidden(t.transform.zoom))continue;const n=t.style.getLayerSourceCache(r),o=n?this.proxyToSource[c.key][n.id]:[c];if(!o)continue;const s=o;i.viewport.set([0,0,h.fb.width,h.fb.height]),f!==(n?n.id:null)&&(this._setupStencil(h,o,r,n),f=n?n.id:null),t.renderLayer(t,n,r,s)}this.renderedToTile?(h.dirty=!0,s.push(n.tileID)):d||--l,5===l&&(l=0,this.renderToBackBuffer(s))}return this.renderToBackBuffer(s),this.renderingToTexture=!1,i.bindFramebuffer.set(null),i.viewport.set([0,0,t.width,t.height]),o.end+1}postRender(){}isLayerOrderingCorrect(e){const t=e.order.length;let i=-1,r=t;for(let n=0;n<t;++n)this._style.isLayerDraped(e._mergedLayers[e.order[n]])?i=Math.max(i,n):r=Math.min(r,n);return r>i}getMinElevationBelowMSL(){let e=0;return this._visibleDemTiles.filter(e=>e.dem).forEach(t=>{e=Math.min(e,t.dem.tree.minimums[0])}),0===e?e:(e-30)*this._exaggeration}raycast(e,t,i){if(!this._visibleDemTiles)return null;const r=this._visibleDemTiles.filter(e=>e.dem).map(r=>{const n=r.tileID,o=1<<n.overscaledZ,{x:a,y:s}=n.canonical,l=a/o,c=(a+1)/o,u=s/o,h=(s+1)/o;return{minx:l,miny:u,maxx:c,maxy:h,t:r.dem.tree.raycastRoot(l,u,c,h,e,t,i),tile:r}});r.sort((e,t)=>
vendor: 9,887 bytes, line 2
2(null!==e.t?e.t:Number.MAX_VALUE)-(null!==t.t?t.t:Number.MAX_VALUE));for(const n of r){if(null==n.t)return null;const r=n.tile.dem.tree.raycast(n.minx,n.miny,n.maxx,n.maxy,e,t,i);if(null!=r)return r}return null}_createFBO(){const e=this.painter.context,t=e.gl,i=this.drapeBufferSize;e.activeTexture.set(t.TEXTURE0);const r=new $m(e,{width:i[0],height:i[1],data:null},t.RGBA8);r.bind(t.LINEAR,t.CLAMP_TO_EDGE);const n=e.createFramebuffer(i[0],i[1],1,null);let o;return n.colorAttachment0.set(r.texture),"none"!==this._emissiveTexture&&(o=new $m(e,{width:i[0],height:i[1],data:null},rP(t,this._emissiveTexture)),o.bind(t.LINEAR,t.CLAMP_TO_EDGE),n.createColorAttachment(e,1),n.colorAttachment1.set(o.texture)),n.depthAttachment=new $M(e,n.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=e.createRenderbuffer(e.gl.DEPTH_STENCIL,i[0],i[1]),this._stencilRef=0,n.depthAttachment.set(this._sharedDepthStencil),e.clear({stencil:0})):n.depthAttachment.set(this._sharedDepthStencil),e.extTextureFilterAnisotropic&&t.texParameterf(t.TEXTURE_2D,e.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,e.extTextureFilterAnisotropicMax),{fb:n,tex:r,emissiveTex:o,dirty:!1}}_updateFBOs(e){if(this._emissiveTexture!==e){for(const t of this.pool)this._updateFBO(t,e);for(const t of this.proxySourceCache.renderCache)this._updateFBO(t,e);this._emissiveTexture=e}}_updateFBO(e,t){const i=e.fb,r=this.painter.context,n=r.gl,o=this.drapeBufferSize;if("none"!==t){const a=new $m(r,{width:o[0],height:o[1],data:null},rP(n,t));a.bind(n.LINEAR,n.CLAMP_TO_EDGE),e.emissiveTex=a,i.createColorAttachment(r,1),i.colorAttachment1.set(a.texture)}else e.emissiveTex=void 0,i.removeColorAttachment(r,1);e.dirty=!0}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._style.hasLightTransitions())return!0;for(const e in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[e].hasTransition())return!0;return this._style.order.some(e=>{const t=this._style._mergedLayers[e],i=t.isHidden(this.painter.transform.zoom);return"hillshade"===t.type||"custom"===t.type?!i&&t.shouldRedrape():!i&&t.hasTransition()})}_clearLineLayersFromRenderCache(){let e=!1;for(const i of this._style.getSources())if("vector"===i.type){e=!0;break}if(!e)return;const t={};for(let i=0;i<this._style.order.length;++i){const e=this._style._mergedLayers[this._style.order[i]],r=this._style.getLayerSourceCache(e);if(!r||t[r.id])continue;if(e.isHidden(this.painter.transform.zoom)||"line"!==e.type)continue;const n=e.widthExpression(),o=e.emissiveStrengthExpression();if(n instanceof Ss||o instanceof Ss){t[r.id]=!0;for(const e of this.proxyCoords){const t=this.proxyToSource[e.key][r.id];if(t)for(const e of t)this._clearRenderCacheForTile(r.id,e)}}}}_clearRasterLayersFromRenderCache(){let e=!1;for(const i in this._style._mergedSourceCaches){const t=this._style._mergedSourceCaches[i]._source.type;if("raster"===t||"raster-dem"===t||"raster-array"===t){e=!0;break}}if(!e)return;const t={};for(let i=0;i<this._style.order.length;++i){const e=this._style._mergedLayers[this._style.order[i]],r=this._style.getLayerSourceCache(e);if(!r||t[r.id])continue;if(e.isHidden(this.painter.transform.zoom)||"raster"!==e.type)continue;const n=e.paint.get("raster-fade-duration");for(const t of this.proxyCoords){const e=this.proxyToSource[t.key][r.id];if(e)for(const t of e){const e=GT(r.getTile(t),r.findLoadedParent(t,0),r,this.painter.transform,n);(1!==e.opacity||0!==e.mix)&&this._clearRenderCacheForTile(r.id,t)}}}}_setupDrapedRenderBatches(){this._style.updateDrapeFirstLayers();const e=this._style.order,t=e.length;if(0===t)return;const i=[];this._pendingGroundEffectLayers=[];let r,n=0,o=this._style._mergedLayers[e[n]];for(;!this._style.isLayerDraped(o)&&o.isHidden(this.painter.transform.zoom)&&++n<t;)o=this._style._mergedLayers[e[n]];for(;n<t;++n){const t=this._style._mergedLayers[e[n]];t.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(t)?void 0===r&&(r=n):("fill-extrusion"===t.type&&this._pendingGroundEffectLayers.push(n),void 0!==r&&(i.push({start:r,end:n-1}),r=void 0)))}if(void 0!==r&&i.push({start:r,end:n-1}),0!==i.length){const e=i.at(-1);this._pendingGroundEffectLayers.every(t=>t>e.end)||Tt("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=i}_setupRenderCache(e){const t=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,t.renderCache.length>t.renderCachePool.length){const e=Object.values(t.proxyCachedFBO);t.proxyCachedFBO={};for(let i=0;i<e.length;++i){const r=Object.values(e[i]);t.renderCachePool.push(...r)}}return}this._clearRasterLayersFromRenderCache();const i=this.proxyCoords,r=this._tilesDirty;for(let o=i.length-1;o>=0;o--){const n=i[o];if(t.getTileByID(n.key),void 0!==t.proxyCachedFBO[n.key]){const i=e[n.key],o=this.proxyToSource[n.key];let a=0;for(const e in o){const t=o[e],n=i[e];if(!n||n.length!==t.length||t.some((t,i)=>t!==n[i]||r[e]&&Object.hasOwn(r[e],t.key))){a=-1;break}++a}for(const e in t.proxyCachedFBO[n.key])t.renderCache[t.proxyCachedFBO[n.key][e]].dirty=a<0||a!==Object.values(i).length}}const n=[...this._drapedRenderBatches];n.sort((e,t)=>t.end-t.start-(e.end-e.start));for(const o of n)for(const e of i){if(t.proxyCachedFBO[e.key])continue;let i=t.renderCachePool.pop();void 0===i&&t.renderCache.length<50&&(i=t.renderCache.length,t.renderCache.push(this._createFBO())),void 0!==i&&(t.proxyCachedFBO[e.key]={},t.proxyCachedFBO[e.key][o.start]=i,t.renderCache[i].dirty=!0)}this._tilesDirty={}}_setupStencil(e,t,i,r){if(!r||!this._sourceTilesOverlap[r.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const n=this.painter.context,o=n.gl;if(t.length<=1)return void(this._overlapStencilType=!1);let a;if(i.isTileClipped())a=t.length,this._overlapStencilMode.test={func:o.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(t[0].overscaledZ>t.at(-1).overscaledZ))return void(this._overlapStencilType=!1);a=1,this._overlapStencilMode.test={func:o.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+a>255&&(n.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=a,this._overlapStencilMode.ref=this._stencilRef,i.isTileClipped()&&this._renderTileClippingMasks(t,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return"Clip"===this._overlapStencilType||"Mask"===this._overlapStencilType}stencilModeForRTTOverlap(e){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[e.key]),this._overlapStencilMode):uw.disabled}_renderTileClippingMasks(e,t){const i=this.painter,r=this.painter.context,n=r.gl;i._tileClippingMaskIDs={},r.setColorMode(pw.disabled),r.setDepthMode(fw.disabled);const o=i.getOrCreateProgram("clippingMask");for(const a of e){const e=i._tileClippingMaskIDs[a.key]=--t;o.draw(i,n.TRIANGLES,fw.disabled,new uw({func:n.ALWAYS,mask:0},e,255,n.KEEP,n.KEEP,n.REPLACE),pw.disabled,gw.disabled,qD(a.projMatrix),"$clipping",i.tileExtentBuffer,i.quadTriangleIndexBuffer,i.tileExtentSegments)}}pointCoordinate(e){const t=this.painter.transform;if(e.x<0||e.x>t.width||e.y<0||e.y>t.height)return null;const i=[e.x,e.y,1,1];me(i,i,t.pixelMatrixInverse),pe(i,i,1/i[3]),i[0]/=t.worldSize,i[1]/=t.worldSize;const r=t._camera.position,n=Uc(1,t.center.lat),o=[r[0],r[1],r[2]/n,0],a=j([],i.slice(0,3),o);J(a,a);const s=this.raycast(o,a,this._exaggeration);return null!==s&&s?(q(o,o,a,s),o[3]=o[2],o[2]*=n,o):null}_setupProxiedCoordsForOrtho(e,t,i){if(["image","video","canvas"].includes(e.getSource().type))return this._setupProxiedCoordsForImageSource(e,t,i);this._findCoveringTileCache[e.id]=this._findCoveringTileCache[e.id]||{};const r=this.proxiedCoords[e.id]=[],n=this.proxyCoords;for(let s=0;s<n.length;s++){const t=n[s],o=this._findTileCoveringTileID(t,e);if(o){const n=this._createProxiedId(t,o,i[t.key]&&i[t.key][e.id]);r.push(n),this.proxyToSource[t.key][e.id]=[n]}}let o=!1;const a=new Set;for(let s=0;s<t.length;s++){const n=e.getTile(t[s]);if(!n||!n.hasData())continue;const l=this._findTileCoveringTileID(n.tileID,this.proxySourceCache);if(l&&l.tileID.canonical.z!==n.tileID.canonical.z){const t=this.proxyToSource[l.tileID.key][e.id],s=this._createProxiedId(l.tileID,n,i[l.tileID.key]&&i[l.tileID.key][e.id]);t?t.splice(t.length-1,0,s):this.proxyToSource[l.tileID.key][e.id]=[s];const c=this.proxyToSource[l.tileID.key][e.id];a.has(c)||a.add(c),r.push(s),o=!0}}if(this._sourceTilesOverlap[e.id]=o,o)for(const s of a)s.sort((e,t)=>t.overscaledZ-e.overscaledZ)}_setupProxiedCoordsForImageSource(e,t,i){if(!e.getSource().loaded())return;const r=this.proxiedCoords[e.id]=[],n=this.proxyCoords,o=e.getSource(),a=o.tileID;if(!a)return;const s=new ke(a.x,a.y)._div(1<<a.z),l=o.coordinates.map(Zc.fromLngLat).reduce((e,t)=>(e.min.x=Math.min(e.min.x,t.x-s.x),e.min.y=Math.min(e.min.y,t.y-s.y),e.max.x=Math.max(e.max.x,t.x-s.x),e.max.y=Math.max(e.max.y,t.y-s.y),e),{min:new ke(Number.MAX_VALUE,Number.MAX_VALUE),max:new ke(-Number.MAX_VALUE,-Number.MAX_VALUE)}),c=(e,t)=>{const i=e.wrap+e.canonical.x/(1<<e.canonical.z),r=e.canonical.y/(1<<e.canonical.z),n=co/(1<<e.canonical.z),o=t.wrap+t.canonical.x/(1<<t.canonical.z),a=t.canonical.y/(1<<t.canonical.z);return i+n<o+l.min.x||i>o+l.max.x||r+n<a+l.min.y||r>a+l.max.y};for(let u=0;u<n.length;u++){const o=n[u];for(let n=0;n<t.length;n++){const a=e.getTile(t[n]);if(!a||!a.hasData())continue;if(c(o,a.tileID))continue;const s=this._createProxiedId(o,a,i[o.key]&&i[o.key][e.id]),l=this.proxyToSource[o.key][e.id];l?l.push(s):this.proxyToSource[o.key][e.id]=[s],r.push(s)}}}_createProxiedId(e,t,i){let r=this.orthoMatrix;if(i){const e=i.find(e=>e.key===t.tileID.key);if(e)return e}
vendor: 17,007 bytes, line 2
2if(t.tileID.key!==e.key){const i=e.canonical.z-t.tileID.canonical.z;let n,o,a;r=p();const s=t.tileID.wrap-e.wrap<<e.overscaledZ;i>0?(n=co>>i,o=n*((t.tileID.canonical.x<<i)-e.canonical.x+s),a=n*((t.tileID.canonical.y<<i)-e.canonical.y)):(n=co<<-i,o=co*(t.tileID.canonical.x-(e.canonical.x+s<<-i)),a=co*(t.tileID.canonical.y-(e.canonical.y<<-i))),L(r,0,n,0,n,0,1),v(r,r,[o,a,0])}return new iP(t.tileID,e.key,r)}_findTileCoveringTileID(e,t){let i=t.getTile(e);if(i&&i.hasData())return i;const r=this._findCoveringTileCache[t.id],n=r[e.key];if(i=n?t.getTileByID(n):null,i&&i.hasData()||null===n)return i;let o=i?i.tileID:e,a=o.overscaledZ;const s=t.getSource().minzoom,l=[];if(!n){const r=t.getSource().maxzoom;if(e.canonical.z>=r){const i=e.canonical.z-r;t.getSource().reparseOverscaled?(a=Math.max(e.canonical.z+2,t.transform.tileZoom),o=new Pf(a,e.wrap,r,e.canonical.x>>i,e.canonical.y>>i)):0!==i&&(a=r,o=new Pf(a,e.wrap,r,e.canonical.x>>i,e.canonical.y>>i))}o.key!==e.key&&(l.push(o.key),i=t.getTile(o))}const c=e=>{l.forEach(t=>{r[t]=e}),l.length=0};for(a-=1;a>=s&&(!i||!i.hasData());a--){i&&c(i.tileID.key);const e=o.calculateScaledKey(a);if(i=t.getTileByID(e),i&&i.hasData())break;const n=r[e];if(null===n)break;void 0===n?l.push(e):i=t.getTileByID(n)}return c(i?i.tileID.key:null),i&&i.hasData()?i:null}findDEMTileFor(e){return this.enabled?this._findTileCoveringTileID(e,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(e,t){let i=this._tilesDirty[e];i||(i=this._tilesDirty[e]={}),i[t.key]=!0}}let oP=null;const aP=[];function sP(e,t){return oP?oP.create(e,t):null}const lP=(e,t,i)=>({u_matrix:e,u_emissive_strength:t,u_ground_shadow_factor:i,u_opacity_multiplier:1}),cP=(e,t,i,r,n,o=0)=>Object.assign(lP(e,t,n),eA(i,r,o)),uP=(e,t,i,r)=>({u_matrix:e,u_world:i,u_emissive_strength:t,u_ground_shadow_factor:r,u_opacity_multiplier:1}),hP=(e,t,i,r,n,o,a=0)=>Object.assign(cP(e,t,i,r,o,a),{u_world:n}),dP=(e,t,i)=>({u_image:e,u_texel_size:t,u_first_pass:i?1:0}),pP=p(),fP=(e,t,i,r,n,o,a)=>{const s=e.transform,l="globe"===s.projection.name,c=l?df(s.zoom,t.canonical)*s._pixelsPerMercatorPixel:tb(i,1,o),u={u_matrix:t.projMatrix,u_extrude_scale:c,u_intensity:a,u_inv_rot_matrix:pP,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(l){u.u_inv_rot_matrix=r,u.u_merc_center=n,u.u_tile_id=[t.canonical.x,t.canonical.y,1<<t.canonical.z],u.u_zoom_transition=mf(s.zoom);const e=n[0]*co,i=n[1]*co;u.u_up_dir=s.projection.upVector(new Df(0,0,0),e,i)}return u};function mP(e){const t=e.terrain?e.terrain.exaggeration():1;return(e.transform.pitch<15?Wr(.07,.7,ht((14-e.transform.zoom)/5,0,1)):.07)*t}const _P=(e,t,i,r,n,o,a,s,l,c,u,h,d,p,f,m,_,g,y,x,v,b)=>({u_matrix:t,u_normalize_matrix:i,u_globe_matrix:r,u_merc_matrix:n,u_grid_matrix:o,u_tl_parent:a,u_scale_parent:u,u_fade_t:h.mix,u_opacity:h.opacity*d.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:d.paint.get("raster-brightness-min"),u_brightness_high:d.paint.get("raster-brightness-max"),u_saturation_factor:Gt(d.paint.get("raster-saturation")),u_contrast_factor:jt(d.paint.get("raster-contrast")),u_spin_weights:gP(d.paint.get("raster-hue-rotate")),u_perspective_transform:p,u_raster_elevation:f,u_zoom_transition:s,u_merc_center:l,u_cutoff_params:c,u_colorization_mix:VT(Sb,_,y),u_colorization_offset:NT(Sb,g,y),u_color_ramp:m,u_color_ramp_size:Sb,u_texture_offset:[v/(x+2*v),x/(x+2*v)],u_texture_res:[x+2*v,x+2*v],u_emissive_strength:b,u_zbias_factor:mP(e)});function gP(e){e*=Math.PI/180;const t=Math.sin(e),i=Math.cos(e);return[(2*i+1)/3,(-Math.sqrt(3)*t-i+1)/3,(Math.sqrt(3)*t-i+1)/3]}const yP=p(),xP=(e,t,i,r,n,o,a,s,l,c,u,h,d,f,m,_,g,x,v,b,w,E,A,I,S)=>{const T=n.transform,D={u_is_size_zoom_constant:+("constant"===e||"source"===e),u_is_size_feature_constant:+("constant"===e||"camera"===e),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:T.getCameraToCenterDistance(b),u_rotate_symbol:+i,u_aspect_ratio:T.width/T.height,u_fade_change:n.options.fadeDuration?n.symbolFadeChange:1,u_matrix:o,u_label_plane_matrix:a,u_coord_matrix:s,u_is_text:+c,u_is_sdf:+u,u_elevation_from_sea:l?1:0,u_pitch_with_map:+r,u_texsize:h,u_texsize_icon:d,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:yP,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:yP,u_up_vector:[0,-1,0],u_color_adj_mat:A,u_icon_transition:I||0,u_gamma_scale:u?r?n.transform.getCameraToCenterDistance(b)*Math.cos(n.terrain?0:n.transform._pitch):1:0,u_device_pixel_ratio:ei.devicePixelRatio,u_is_halo:1,u_scale_factor:S||1,u_ground_shadow_factor:w,u_inv_matrix:y(p(),a),u_normal_scale:E,u_lutTexture:10,u_spp_fill_np_color:[0,0,0,1],u_spp_halo_np_color:[0,0,0,0],u_spp_opacity:1,u_spp_halo_width:0,u_spp_halo_blur:0,u_spp_emissive_strength:0,u_spp_occlusion_opacity:1,u_spp_z_offset:0,u_spp_translate_rotation:[1,0],u_spp_zoom_fraction:0,u_opacity_multiplier:1};return"globe"===b.name&&(D.u_tile_id=[m.canonical.x,m.canonical.y,1<<m.canonical.z],D.u_zoom_transition=_,D.u_inv_rot_matrix=x,D.u_merc_center=g,D.u_camera_forward=T._camera.forward(),D.u_ecef_origin=function(e,t){const i=[0,0,0];return ie(i,i,cf(Jp(t.canonical))),ie(i,i,e),i}(T.globeMatrix,m.toUnwrapped()),D.u_tile_matrix=T.globeMatrix,D.u_up_vector=v),D},vP=(e,t,i,r)=>({u_matrix:e,u_emissive_strength:t,u_opacity:i,u_color:r}),bP=(e,t,i,r,n,o,a,s,l)=>Object.assign(function(e,t,i,r,n,o){const{width:a,height:s}=r.imageManager.getPixelSize(t),l=Math.pow(2,o.tileID.overscaledZ),c=o.tileSize*Math.pow(2,r.transform.tileZoom)/l,u=c*(o.tileID.canonical.x+o.tileID.wrap*l),h=c*o.tileID.canonical.y;return{u_image:0,u_pattern_tl:i.tl,u_pattern_br:i.br,u_texsize:[a,s],u_pattern_size:i.displaySize,u_pattern_units_to_pixels:n?[r.transform.width,-1*r.transform.height]:[1/tb(o,1,r.transform.tileZoom),1/tb(o,1,r.transform.tileZoom)],u_pixel_coord_upper:[u>>16,h>>16],u_pixel_coord_lower:[65535&u,65535&h]}}(0,o,a,r,s,l),{u_matrix:e,u_emissive_strength:t,u_opacity:i}),wP={fillExtrusion:e=>({u_matrix:new Th(e),u_lightpos:new Eh(e),u_lightintensity:new bh(e),u_lightcolor:new Eh(e),u_vertical_gradient:new bh(e),u_opacity:new bh(e),u_edge_radius:new bh(e),u_width_scale:new bh(e),u_ao:new wh(e),u_height_type:new vh(e),u_base_type:new vh(e),u_tile_id:new Eh(e),u_zoom_transition:new bh(e),u_inv_rot_matrix:new Th(e),u_merc_center:new wh(e),u_up_dir:new Eh(e),u_height_lift:new bh(e),u_flood_light_color:new Eh(e),u_vertical_scale:new bh(e),u_flood_light_intensity:new bh(e),u_ground_shadow_factor:new Eh(e),u_front_cutoff_params:new Eh(e)}),fillExtrusionPattern:e=>({u_matrix:new Th(e),u_lightpos:new Eh(e),u_lightintensity:new bh(e),u_lightcolor:new Eh(e),u_vertical_gradient:new bh(e),u_height_factor:new bh(e),u_edge_radius:new bh(e),u_width_scale:new bh(e),u_ao:new wh(e),u_height_type:new vh(e),u_base_type:new vh(e),u_tile_id:new Eh(e),u_zoom_transition:new bh(e),u_inv_rot_matrix:new Th(e),u_merc_center:new wh(e),u_up_dir:new Eh(e),u_height_lift:new bh(e),u_image:new vh(e),u_texsize:new wh(e),u_pixel_coord_upper:new wh(e),u_pixel_coord_lower:new wh(e),u_tile_units_to_pixels:new bh(e),u_opacity:new bh(e),u_pattern_transition:new bh(e)}),fill:e=>({u_matrix:new Th(e),u_emissive_strength:new bh(e),u_ground_shadow_factor:new Eh(e),u_opacity_multiplier:new bh(e)}),fillPattern:e=>({u_matrix:new Th(e),u_emissive_strength:new bh(e),u_image:new vh(e),u_texsize:new wh(e),u_pixel_coord_upper:new wh(e),u_pixel_coord_lower:new wh(e),u_tile_units_to_pixels:new bh(e),u_ground_shadow_factor:new Eh(e),u_pattern_transition:new bh(e),u_opacity_multiplier:new bh(e)}),fillOutline:e=>({u_matrix:new Th(e),u_emissive_strength:new bh(e),u_world:new wh(e),u_ground_shadow_factor:new Eh(e),u_opacity_multiplier:new bh(e)}),fillOutlinePattern:e=>({u_matrix:new Th(e),u_emissive_strength:new bh(e),u_world:new wh(e),u_image:new vh(e),u_texsize:new wh(e),u_pixel_coord_upper:new wh(e),u_pixel_coord_lower:new wh(e),u_tile_units_to_pixels:new bh(e),u_ground_shadow_factor:new Eh(e),u_pattern_transition:new bh(e),u_opacity_multiplier:new bh(e)}),lineBlendComposite:e=>({u_image:new vh(e),u_opacity:new bh(e),u_blend_mode:new vh(e),u_max_density:new bh(e)}),lineBlendReduce:e=>({u_image:new vh(e),u_texel_size:new wh(e),u_first_pass:new vh(e)}),circle:e=>({u_camera_to_center_distance:new bh(e),u_extrude_scale:new Mh(e),u_device_pixel_ratio:new bh(e),u_matrix:new Th(e),u_inv_rot_matrix:new Th(e),u_merc_center:new wh(e),u_tile_id:new Eh(e),u_zoom_transition:new bh(e),u_up_dir:new Eh(e),u_emissive_strength:new bh(e)}),collisionBox:e=>({u_matrix:new Th(e),u_inv_rot_matrix:new Th(e),u_camera_to_center_distance:new bh(e),u_extrude_scale:new wh(e),u_zoom_transition:new bh(e),u_merc_center:new wh(e),u_tile_id:new Eh(e)}),collisionCircle:e=>({u_matrix:new Th(e),u_inv_matrix:new Th(e),u_camera_to_center_distance:new bh(e),u_viewport_size:new wh(e)}),debug:e=>({u_color:new Sh(e),u_matrix:new Th(e),u_overlay:new vh(e),u_overlay_scale:new bh(e)}),clippingMask:e=>({u_matrix:new Th(e)}),heatmap:e=>({u_extrude_scale:new bh(e),u_intensity:new bh(e),u_matrix:new Th(e),u_inv_rot_matrix:new Th(e),u_merc_center:new wh(e),u_tile_id:new Eh(e),u_zoom_transition:new bh(e),u_up_dir:new Eh(e)}),heatmapTexture:e=>({u_image:new vh(e),u_color_ramp:new vh(e),u_opacity:new bh(e)}),hillshade:e=>({u_matrix:new Th(e),u_image:new vh(e),u_latrange:new wh(e),u_light:new wh(e),u_shadow:new Sh(e),u_highlight:new Sh(e),u_emissive_strength:new bh(e),u_accent:new Sh(e)}),hillshadePrepare:e=>({u_matrix:new Th(e),u_image:new vh(e),u_dimension:new wh(e),u_zoom:new bh(e)}),line:e=>({u_matrix:new Th(e),u_pixels_to_tile_units:new Mh(e),u_device_pixel_ratio:new bh(e),u_width_scale:new bh(e),u_floor_width_scale:new bh(e),u_units_to_pixels:new wh(e),u_dash_image:new vh(e),u_gradient_image:new vh(e),u_border_gradient_image:new vh(e),u_image_height:new bh(e),u_texsize:new wh(e),u_tile_units_to_pixels:new bh(e),u_alpha_discard_threshold:new bh(e),u_trim_offset:new wh(e),u_trim_fade_range:new wh(e),u_trim_gradient_mix_range:new wh(e),u_trim_color:new Ih(e),u_zbias_factor:new bh(e),u_road_view_depth_bias:new bh(e),u_road_clip_to_view:new Ih(e),u_tile_to_meter:new bh(e),u_ground_shadow_factor:new Eh(e),u_opacity_multiplier:new bh(e)}),linePattern:e=>({u_matrix:new Th(e),u_texsize:new wh(e),u_pixels_to_tile_units:new Mh(e),u_device_pixel_ratio:new bh(e),u_width_scale:new bh(e),u_floor_width_scale:new bh(e),u_image:new vh(e),u_units_to_pixels:new wh(e),u_tile_units_to_pixels:new bh(e),u_alpha_discard_threshold:new bh(e),u_trim_offset:new wh(e),u_trim_fade_range:new wh(e),u_trim_gradient_mix_range:new wh(e),u_trim_color:new Ih(e),u_zbias_factor:new bh(e),u_tile_to_meter:new bh(e),u_ground_shadow_factor:new Eh(e),u_pattern_transition:new bh(e),u_opacity_multiplier:new bh(e)}),raster:e=>({u_matrix:new Th(e),u_normalize_matrix:new Th(e),u_globe_matrix:new Th(e),u_merc_matrix:new Th(e),u_grid_matrix:new Dh(e),u_tl_parent:new wh(e),u_scale_parent:new bh(e),u_fade_t:new bh(e),u_opacity:new bh(e),u_image0:new vh(e),u_image1:new vh(e),u_brightness_low:new bh(e),u_brightness_high:new bh(e),u_saturation_factor:new bh(e),u_contrast_factor:new bh(e),u_spin_weights:new Eh(e),u_perspective_transform:new wh(e),u_raster_elevation:new bh(e),u_zoom_transition:new bh(e),u_merc_center:new wh(e),u_cutoff_params:new Ih(e),u_colorization_mix:new Ih(e),u_colorization_offset:new bh(e),u_color_ramp:new vh(e),u_color_ramp_size:new bh(e),u_texture_offset:new wh(e),u_texture_res:new wh(e),u_emissive_strength:new bh(e),u_zbias_factor:new bh(e)}),symbol:e=>({u_is_size_zoom_constant:new vh(e),u_is_size_feature_constant:new vh(e),u_size_t:new bh(e),u_size:new bh(e),u_camera_to_center_distance:new bh(e),u_rotate_symbol:new vh(e),u_aspect_ratio:new bh(e),u_fade_change:new bh(e),u_matrix:new Th(e),u_label_plane_matrix:new Th(e),u_coord_matrix:new Th(e),u_is_text:new vh(e),u_is_sdf:new vh(e),u_elevation_from_sea:new vh(e),u_pitch_with_map:new vh(e),u_texsize:new wh(e),u_texsize_icon:new wh(e),u_texture:new vh(e),u_texture_icon:new vh(e),u_gamma_scale:new bh(e),u_device_pixel_ratio:new bh(e),u_tile_id:new Eh(e),u_zoom_transition:new bh(e),u_inv_rot_matrix:new Th(e),u_merc_center:new wh(e),u_camera_forward:new Eh(e),u_tile_matrix:new Th(e),u_up_vector:new Eh(e),u_ecef_origin:new Eh(e),u_is_halo:new vh(e),u_icon_transition:new bh(e),u_color_adj_mat:new Th(e),u_scale_factor:new bh(e),u_ground_shadow_factor:new Eh(e),u_inv_matrix:new Th(e),u_normal_scale:new bh(e),u_lutTexture:new vh(e),u_spp_fill_np_color:new Ih(e),u_spp_halo_np_color:new Ih(e),u_spp_opacity:new bh(e),u_spp_halo_width:new bh(e),u_spp_halo_blur:new bh(e),u_spp_emissive_strength:new bh(e),u_spp_occlusion_opacity:new bh(e),u_spp_z_offset:new bh(e),u_spp_translate_rotation:new wh(e),u_spp_zoom_fraction:new bh(e),u_opacity_multiplier:new bh(e)}),background:e=>({u_matrix:new Th(e),u_emissive_strength:new bh(e),u_opacity:new bh(e),u_color:new Sh(e)}),backgroundPattern:e=>({u_matrix:new Th(e),u_emissive_strength:new bh(e),u_opacity:new bh(e),u_image:new vh(e),u_pattern_tl:new wh(e),u_pattern_br:new wh(e),u_texsize:new wh(e),u_pattern_size:new wh(e),u_pixel_coord_upper:new wh(e),u_pixel_coord_lower:new wh(e),u_pattern_units_to_pixels:new wh(e)}),skybox:e=>({u_matrix:new Th(e),u_sun_direction:new Eh(e),u_cubemap:new vh(e),u_opacity:new bh(e),u_temporal_offset:new bh(e)}),skyboxGradient:e=>({u_matrix:new Th(e),u_color_ramp:new vh(e),u_center_direction:new Eh(e),u_radius:new bh(e),u_opacity:new bh(e),u_temporal_offset:new bh(e)}),skyboxCapture:e=>({u_matrix_3f:new Dh(e),u_sun_direction:new Eh(e),u_sun_intensity:new bh(e),u_color_tint_r:new Ih(e),u_color_tint_m:new Ih(e),u_luminance:new bh(e)}),globeAtmosphere:e=>({u_frustum_tl:new Eh(e),u_frustum_tr:new Eh(e),u_frustum_br:new Eh(e),u_frustum_bl:new Eh(e),u_horizon:new bh(e),u_transition:new bh(e),u_fadeout_range:new bh(e),u_atmosphere_fog_color:new Ih(e),u_high_color:new Ih(e),u_space_color:new Ih(e),u_temporal_offset:new bh(e),u_horizon_angle:new bh(e)}),stars:e=>({u_matrix:new Th(e),u_up:new Eh(e),u_right:new Eh(e),u_intensity_multiplier:new bh(e)}),occlusion:e=>({u_matrix:new Th(e),u_anchorPos:new Eh(e),u_screenSizePx:new wh(e),u_occluderSizePx:new wh(e),u_color:new Ih(e)})};var EP={terrainRaster:KE('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nuniform sampler2D u_image1;uniform float u_emissive_texture_available;\n#endif\nin vec2 v_pos0;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nin vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#endif\nuniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color;\n#ifdef LIGHTING_3D_MODE\nconst vec3 normal=vec3(0.0,0.0,1.0);\n#ifdef RENDER_SHADOWS\nfloat cutoffOpacity=1.0;\n#ifdef RENDER_CUTOFF\ncutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w);\n#endif\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nvec3 unlit_base;vec3 emissive_base;\n#ifdef USE_MRT1_RGBA\nvec4 emissive_premult=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0) : vec4(0.0);unlit_base=image_color.rgb-emissive_premult.rgb;emissive_base=emissive_premult.rgb;\n#else\nfloat emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : image_color.a;unlit_base=image_color.rgb*(1.0-emissive_strength);emissive_base=image_color.rgb*emissive_strength;\n#endif\nfloat ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0;\n#else\nfloat lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity));\n#endif\n#else\nfloat lighting_factor=u_lighting_directional_dir.z;\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\n#ifdef USE_MRT1_RGBA\nvec4 emissive_premult=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0) : vec4(0.0);vec3 unlit_base=image_color.rgb-emissive_premult.rgb;color.rgb=apply_lighting(unlit_base,normal,lighting_factor)+emissive_premult.rgb;color.a=1.0;\n#else\ncolor=apply_lighting(image_color,normal,lighting_factor);float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : image_color.a;color.rgb=mix(color.rgb,image_color.rgb,emissive_strength);color.a=1.0;\n#endif\n#else\ncolor=apply_lighting(image_color,normal,lighting_factor);\n#endif\n#endif\n#else\ncolor=image_color;\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
2\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_skirt_height;in ivec2 a_pos;out vec2 v_pos0;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;\n#endif\nvoid main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\n#ifdef FOG\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\n#endif\n#ifdef RENDER_SHADOWS\nvec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);\n#endif\n}'),terrainDepth:KE("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",'#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;in ivec2 a_pos;out float v_depth;void main() {float elevation=elevation(vec2(a_pos));gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}'),globeRaster:KE('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nuniform sampler2D u_image1;uniform float u_emissive_texture_available;\n#endif\nuniform float u_far_z_cutoff;in vec2 v_pos0;\n#ifndef FOG\nuniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;\n#endif\nvoid main() {vec4 color;\n#ifdef CUSTOM_ANTIALIASING\nhighp vec2 uv=gl_FragCoord.xy/u_viewport;FLIP_VIEWPORT_UV_Y(uv);highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;highp float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);highp float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\n#ifdef USE_MRT1_RGBA\nvec4 emissive_premult=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0) : vec4(0.0);vec3 unlit_base=raster.rgb-emissive_premult.rgb;raster.rgb=apply_lighting_ground(vec4(unlit_base,1.0)).rgb+emissive_premult.rgb;color=vec4(clamp(raster.rgb,vec3(0),vec3(1))*antialias,antialias);\n#else\nfloat emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : raster.a;raster=apply_lighting_with_emission_ground(raster,emissive_strength);color=vec4(clamp(raster.rgb,vec3(0),vec3(1))*antialias,antialias);\n#endif\n#else\nraster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS \n#ifdef USE_MRT1_RGBA\nvec4 emissive_premult=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0) : vec4(0.0);vec3 unlit_base=color.rgb-emissive_premult.rgb;color.rgb=apply_lighting_ground(vec4(unlit_base,1.0)).rgb+emissive_premult.rgb;color.a=1.0;\n#else\nfloat emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : color.a;color=apply_lighting_with_emission_ground(color,emissive_strength);color.a=1.0;\n#endif\n#else\ncolor=apply_lighting_ground(color);\n#endif\n#endif\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;\n#ifndef GLOBE_POLES\nuniform mat4 u_merc_matrix;\n#endif\nuniform float u_zoom_transition;uniform vec2 u_merc_center;\n#ifndef GLOBE_POLES\nuniform mat3 u_grid_matrix;\n#endif\nuniform float u_skirt_height;\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin ivec2 a_pos;\n#endif\nout vec2 v_pos0;void main() {\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;vec2 uv=a_uv;\n#else\nfloat tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);\n#endif\nv_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;\n#ifdef GLOBE_POLES\nvec3 up_vector=globe_derived_up_vector;\n#else\nvec3 up_vector=elevationVector(tile_pos);\n#endif\nfloat height=elevation(tile_pos);globe_pos+=up_vector*height;\n#ifndef GLOBE_POLES\nglobe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;\n#endif\n#ifdef GLOBE_POLES\nvec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);\n#else\nvec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);\n#endif\ngl_Position=u_proj_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n}')};!function(e){oP=e;for(const t of aP.splice(0))t()}({create:(e,t)=>
vendor: 35,258 bytes, line 2
2new nP(e,t)}),Object.assign(wP,{terrainRaster:e=>({u_matrix:new Th(e),u_image0:new vh(e),u_image1:new vh(e),u_skirt_height:new bh(e),u_ground_shadow_factor:new Eh(e),u_emissive_texture_available:new bh(e)}),globeRaster:e=>({u_proj_matrix:new Th(e),u_globe_matrix:new Th(e),u_normalize_matrix:new Th(e),u_merc_matrix:new Th(e),u_zoom_transition:new bh(e),u_merc_center:new wh(e),u_image0:new vh(e),u_image1:new vh(e),u_grid_matrix:new Dh(e),u_skirt_height:new bh(e),u_far_z_cutoff:new bh(e),u_frustum_tl:new Eh(e),u_frustum_tr:new Eh(e),u_frustum_br:new Eh(e),u_frustum_bl:new Eh(e),u_globe_pos:new Eh(e),u_globe_radius:new bh(e),u_viewport:new wh(e),u_emissive_texture_available:new bh(e)})});const AP={shaders:EP};class IP{constructor(e,t,i){this.screenBounds=e,this.cameraPoint=i.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=t,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,i)}static createFromScreenPoints(e,t){let i,r;if(e instanceof ke||"number"==typeof e[0]){const n=ke.convert(e);i=[n],r=t.isPointAboveHorizon(n)}else{const n=ke.convert(e[0]),o=ke.convert(e[1]),a=n.add(o)._div(2);i=[n,o],r=ct(n,o).every(e=>t.isPointAboveHorizon(e))&&t.isPointAboveHorizon(a)}return new IP(i,r,t)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(e){return ct(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],e)}bufferedCameraGeometry(e){const t=this.screenBounds[0],i=1===this.screenBounds.length?this.screenBounds[0].add(new ke(1,1)):this.screenBounds[1],r=ct(t,i,0,!1);return this.cameraPoint.y>i.y&&(this.cameraPoint.x>t.x&&this.cameraPoint.x<i.x?r.splice(3,0,this.cameraPoint):this.cameraPoint.x>=i.x?r[2]=this.cameraPoint:this.cameraPoint.x<=t.x&&(r[3]=this.cameraPoint)),function(e,t){const i=[];for(let r=0;r<e.length;r++){const n=pt(r-1,-1,e.length-1),o=pt(r+1,-1,e.length-1),a=e[r],s=e[o],l=e[n].sub(a).unit(),c=s.sub(a).unit(),u=c.angleWithSep(l.x,l.y),h=l.add(c).unit().mult(-1*t/Math.sin(u/2));i.push(a.add(h))}return i}(r,e)}bufferedCameraGeometryGlobe(e){const t=this.screenBounds[0],i=1===this.screenBounds.length?this.screenBounds[0].add(new ke(1,1)):this.screenBounds[1],r=ct(t,i,e),n=this.cameraPoint.clone(),o=Number(n.x>t.x)+Number(n.x>i.x);switch(3*(Number(n.y>t.y)+Number(n.y>i.y))+o){case 0:r[0]=n,r[4]=n.clone();break;case 1:r.splice(1,0,n);break;case 2:r[1]=n;break;case 3:r.splice(4,0,n);break;case 5:r.splice(2,0,n);break;case 6:r[3]=n;break;case 7:r.splice(3,0,n);break;case 8:r[2]=n}return r}containsTile(e,t,i,r=0,n){const o=Math.max(e.queryPadding,e.evaluateQueryRenderedFeaturePadding())/t._pixelsPerMercatorPixel+1,a=i?this._bufferedCameraMercator(o,t):this._bufferedScreenMercator(o,t);let s=e.tileID.wrap+(a.unwrapped?r:0);const l=a.polygon.map(t=>Ff(e.tileTransform,t,s));if(!yd(l,0,0,co,co))return;s=e.tileID.wrap+(this.screenGeometryMercator.unwrapped?r:0);const c=this.screenGeometryMercator.polygon.map(t=>Of(e.tileTransform,t,s)),u=c.map(e=>new ke(e[0],e[1])),h=Of(e.tileTransform,n,s),d=c.map(e=>{const t=se(e,e,h);return J(t,t),new kp(h,t)}),p=tb(e,1,t.zoom)*t._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:u,tilespaceRays:d,bufferedTilespaceGeometry:l,bufferedTilespaceBounds:(f=lt(l),f.min.x=ht(f.min.x,0,co),f.min.y=ht(f.min.y,0,co),f.max.x=ht(f.max.x,0,co),f.max.y=ht(f.max.y,0,co),f),tile:e,tileID:e.tileID,pixelToTileUnitsFactor:p};var f}_bufferedScreenMercator(e,t){const i=DP(e);if(this._screenRaycastCache[i])return this._screenRaycastCache[i];{let r;return r="globe"===t.projection.name?this._projectAndResample(this.bufferedScreenGeometry(e),t):{polygon:this.bufferedScreenGeometry(e).map(e=>t.pointCoordinate3D(e)),unwrapped:!0},this._screenRaycastCache[i]=r,r}}_bufferedCameraMercator(e,t){const i=DP(e);if(this._cameraRaycastCache[i])return this._cameraRaycastCache[i];{let r;return r="globe"===t.projection.name?this._projectAndResample(this.bufferedCameraGeometryGlobe(e),t):{polygon:this.bufferedCameraGeometry(e).map(e=>t.pointCoordinate3D(e)),unwrapped:!0},this._cameraRaycastCache[i]=r,r}}_projectAndResample(e,t){const i=function(e,t){const i=x([],t.pixelMatrix,t.globeMatrix),r=[0,-Mc,0,1],n=[0,Mc,0,1],o=[0,0,0,1];me(r,r,i),me(n,n,i),me(o,o,i);const a=new ke(r[0]/r[3],r[1]/r[3]),s=new ke(n[0]/n[3],n[1]/n[3]),l=gd(e,a)&&r[3]<o[3],c=gd(e,s)&&n[3]<o[3];if(!l&&!c)return null;const u=function(e,t,i){for(let r=1;r<e.length;r++){const n=TP(t.pointCoordinate3D(e[r-1]).x),o=TP(t.pointCoordinate3D(e[r]).x);if(i<0){if(n<o)return{idx:r,t:-n/(o-1-n)}}else if(o<n)return{idx:r,t:(1-n)/(o+1-n)}}return null}(e,t,l?-1:1);if(!u)return null;const{idx:h,t:d}=u;let p=h>1?SP(e.slice(0,h),t):[],f=h<e.length?SP(e.slice(h),t):[];p=p.map(e=>new ke(TP(e.x),e.y)),f=f.map(e=>new ke(TP(e.x),e.y));const m=[...p];0===m.length&&m.push(f.at(-1));const _=Wr(m.at(-1).y,(0===f.length?p[0]:f[0]).y,d);let g;return g=l?[new ke(0,_),new ke(0,0),new ke(1,0),new ke(1,_)]:[new ke(1,_),new ke(1,1),new ke(0,1),new ke(0,_)],m.push(...g),0===f.length?m.push(p[0]):m.push(...f),{polygon:m.map(e=>new Zc(e.x,e.y)),unwrapped:!1}}(e,t);if(i)return i;const r=function(e,t){let i=!1,r=-1/0,n=0;for(let a=0;a<e.length-1;a++)e[a].x>r&&(r=e[a].x,n=a);for(let a=0;a<e.length-1;a++){const t=(n+a)%(e.length-1),r=e[t],o=e[t+1];Math.abs(r.x-o.x)>.5&&(r.x<o.x?(r.x+=1,0===t&&(e.at(-1).x+=1)):(o.x+=1,t+1===e.length-1&&(e[0].x+=1)),i=!0)}const o=Wn(t.center.lng);return i&&o<Math.abs(o-1)&&e.forEach(e=>{e.x-=1}),{polygon:e,unwrapped:i}}(SP(e,t).map(e=>new ke(TP(e.x),e.y)),t);return{polygon:r.polygon.map(e=>new Zc(e.x,e.y)),unwrapped:r.unwrapped}}}function SP(e,t){return Yc(e,e=>{const i=t.pointCoordinate3D(e);e.x=i.x,e.y=i.y},1/256)}function TP(e){return e<0?1+e%1:e%1}function DP(e){return 100*e|0}class MP{constructor(e){this.entries={},this.scheduler=e}request(e,t,i,r){const n=this.entries[e]=this.entries[e]||{callbacks:[]};if(n.result){const[e,i]=n.result;return this.scheduler?this.scheduler.add(()=>{r(e,i)},t):r(e,i),()=>{}}return n.callbacks.push(r),n.cancel||(n.cancel=i((i,r)=>{n.result=[i,r];for(const e of n.callbacks)this.scheduler?this.scheduler.add(()=>{e(i,r)},t):e(i,r);setTimeout(()=>delete this.entries[e],3e3)})),()=>{n.result||(n.callbacks=n.callbacks.filter(e=>e!==r),n.callbacks.length||(n.cancel(),delete this.entries[e]))}}}function PP(e,t,i){const r=JSON.stringify(e.request);return e.data&&(this.deduped.entries[r]={result:[null,e.data]}),this.deduped.request(r,{type:"parseTile",renderSourceType:e.renderSourceType,zoom:e.tileZoom},t=>{const r=new AbortController;return Wi(e.request,r.signal).then(({data:e,headers:r})=>{t(null,{rawData:e,vectorTile:i?void 0:new od(new zm(e)),headers:r})}).catch(e=>{r.signal.aborted||(Vi(e)?t(null,null):t(e))}),()=>{r.abort(),t(null,null)}},t)}const CP=new Map,RP=new Map;function zP(e){if("provider"in e&&!e.provider)return null;let t=e.provider;if(!t&&"url"in e&&e.url&&(t=function(e){try{const t=new URL(e).pathname.split("/").pop()||"",i=t.lastIndexOf(".");return i>=0?t.slice(i+1):""}catch{return""}}(e.url)),!t)return null;const i=gi.TILE_PROVIDER_URLS[t];if(!i)return null;let r;try{r=new URL(i,gi.API_URL).href}catch(e){return new Error(`TileProvider "${t}" has an invalid URL: "${i}"`)}return{name:t,url:r}}function LP(e,t,i){return t?wA(e,t,i):e.tiles&&e.tiles.length>0?{tiles:e.tiles}:new Error('TileJSON is missing required "tiles" property')}class FP extends Nr{constructor(e,t,i,r){super(),this.id=e,this.dispatcher=i,this.setEventedParent(r),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options={type:"raster",...t},Object.assign(this,mt(t,["url","scheme","tileSize"]))}load(e){this._loaded=!1,this.fire(new Or("dataloading",{dataType:"source"}));const t=this.map.getWorldview(),i=(t,i)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new Br(t)):i&&(Object.assign(this,i),i.raster_layers&&(this.rasterLayers=i.raster_layers,this.rasterLayerIds=this.rasterLayers.map(e=>e.id)),this.tileBounds=IA.fromTileJSON(i),vr(i.tiles),this.fire(new Or("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new Or("data",{dataType:"source",sourceDataType:"content"}))),e&&e(t)};this.provider="string"==typeof this._options.provider?this._options.provider:void 0,this._tileProvider=void 0;const r=zP(this._options);return r instanceof Error?(this._loaded=!0,this.fire(new Br(r)),void(e&&e())):this.provider&&!r?(this._loaded=!0,this.fire(new Br(new Error(`TileProvider "${this.provider}" is not registered`))),void(e&&e())):void(this._tileJSONRequest=r?this.loadTileJSONWithProvider(r,i):EA(this._options,this.map._requestManager,null,t,i))}loadTileJSONWithProvider(e,t){this.provider=e.name;const i=new AbortController;return(async()=>{const{request:r,options:n}=await bA(this._options,this.map._requestManager,i.signal);if(i.signal.aborted)return;const o=await async function(e,t){const i=RP.get(e);if(i)return i;const r=CP.get(e);if(void 0!==r)return r;const n=import(t).catch(t=>{throw new Error(`TileProvider "${e}" failed to load: ${t instanceof Error?t.message:String(t)}`)}).then(t=>{const i=t.default;if("function"!=typeof i)throw new Error(`TileProvider "${e}" module must default-export a class`);if("function"!=typeof i.prototype.loadTile)throw new Error(`TileProvider "${e}" class must have a loadTile method`);return RP.set(e,i),i}).finally(()=>{CP.delete(e)});return CP.set(e,n),n}(e.name,e.url);if(i.signal.aborted)return;const a=new o(n);let s=null;if(a.load&&r&&(s=await a.load({request:r}),i.signal.aborted))return;this._tileProvider=a;const l=LP(this._options,s,this.map._requestManager);l instanceof Error?t(l):t(null,l)})().catch(r=>{i.signal.aborted||t(new Error(`Could not load tile provider ${e.name}`,{cause:r}))}),{cancel:()=>i.abort()}}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest();const e=Ul(this.id,this.scope);this.load(()=>this.map.style.clearSource(e))}setTiles(e){return this._options.tiles=e,this.reload(),this}setUrl(e){return this.url=e,this._options.url=e,this.reload(),this}onRemove(e){this.cancelTileJSONRequest()}serialize(){return{...this._options}}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}async loadTile(e,t){const i=ei.devicePixelRatio>=2,r=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme),i,this.tileSize),n=new AbortController;if(e.request=n,this._tileProvider)this.loadTileWithProvider(e,this._tileProvider,r,n,t);else try{const i=await this.map._requestManager.transformRequest(r,Bi.Tile,n.signal);if(n.signal.aborted)return delete e.request,t(null);const{data:o,headers:a}=await Yi(i,n.signal);if(delete e.request,e.aborted)return t(null);const s=zt(a);this.map._refreshExpiredTiles&&e.setExpiryData(s),e.setTexture(o,this.map.painter),e.state="loaded",Ci(this.dispatcher),t(null)}catch(i){if(delete e.request,n.signal.aborted)return t(null);e.state="errored",t(i)}}async loadTileWithProvider(e,t,i,r,n){const{z:o,x:a,y:s}=e.tileID.canonical;try{const l=await this.map._requestManager.transformRequest(i,Bi.Tile,r.signal);if(r.signal.aborted)return n(null);const c=await t.loadTile({z:o,x:a,y:s},{request:l,signal:r.signal});if(r.signal.aborted)return n(null);if(null==c){const t=new Error("Tile not found");return t.status=404,e.state="errored",n(t)}if(null==c.data)return e.state="loaded",n(null);const u=c.data instanceof ImageBitmap?c.data:await createImageBitmap(new Blob([c.data]));if(r.signal.aborted)return n(null);e.setTexture(u,this.map.painter),e.state="loaded",this.map._refreshExpiredTiles&&e.setExpiryData({cacheControl:c.cacheControl,expires:c.expires}),n(null)}catch(t){if(r.signal.aborted)return n(null);e.state="errored",n(new Error(`Could not load tile from ${i}`,{cause:t}))}finally{delete e.request}}abortTile(e,t){e.request&&(e.request.abort(),delete e.request),t&&t()}unloadTile(e,t){e.texture&&e.texture instanceof $m?(e.destroy(!1),e.texture&&e.texture instanceof $m&&this.map.painter.saveTileTexture(e.texture)):e.destroy(),t&&t()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class OP{constructor(e){this.size=e,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(e,t){const i=this.toIdx(e,t);return{min:this.minimums[i],max:this.maximums[i]}}isLeaf(e,t){return this.leaves[this.toIdx(e,t)]}toIdx(e,t){return t*this.size+e}}function BP(e,t,i,r){let n=0,o=Number.MAX_VALUE;for(let a=0;a<3;a++)if(Math.abs(r[a])<1e-15){if(i[a]<e[a]||i[a]>t[a])return null}else{const s=1/r[a];let l=(e[a]-i[a])*s,c=(t[a]-i[a])*s;if(l>c){const e=l;l=c,c=e}if(l>n&&(n=l),c<o&&(o=c),n>o)return null}return n}function kP(e,t,i,r,n,o,a,s,l,c,u){const h=r-e,d=n-t,p=o-i,f=a-e,m=s-t,_=l-i,g=u[1]*_-u[2]*m,y=u[2]*f-u[0]*_,x=u[0]*m-u[1]*f,v=h*g+d*y+p*x;if(Math.abs(v)<1e-15)return null;const b=1/v,w=c[0]-e,E=c[1]-t,A=c[2]-i,I=(w*g+E*y+A*x)*b;if(I<0||I>1)return null;const S=E*p-A*d,T=A*h-w*p,D=w*d-E*h,M=(u[0]*S+u[1]*T+u[2]*D)*b;return M<0||I+M>1?null:(f*S+m*T+_*D)*b}function VP(e,t,i,r,n,o,a,s,l){const c=1<<i,u=o-r,h=a-n,d=(e+1)/c*u+r,p=(t+0)/c*h+n,f=(t+1)/c*h+n;s[0]=(e+0)/c*u+r,s[1]=p,l[0]=d,l[1]=f}class NP{constructor(e){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=e,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const t=function(e){const t=e.dim,i=Math.ceil(Math.log2(t/8)),r=[];let n=Math.ceil(Math.pow(2,i));const o=(e,t,i,r,n)=>{const o=r?1:0,a=(e+1)*i-o,s=t*i,l=(t+1)*i-o;n[0]=e*i,n[1]=s,n[2]=a,n[3]=l};let a=new OP(n);const s=1/n,{floatView:l,stride:c}=e,u=[];for(let h=0;h<n*n;h++){const i=Math.floor(h/n),r=h%n;o(r,i,s,!1,u);const d=jP(u[0],u[1],e),p=jP(u[2],u[1],e),f=jP(u[2],u[3],e),m=jP(u[0],u[3],e),_=Math.min(d,p,f,m),g=Math.max(0,8*r-1),y=Math.min(t-1,8*(r+1)),x=Math.max(0,8*i-1),v=Math.min(t-1,8*(i+1));let b=-1/0;for(let e=x;e<=v;e++){const t=(e+1)*c;for(let e=g;e<=y;e++){const i=l[t+e+1];i>b&&(b=i)}}a.minimums.push(_),a.maximums.push(b),a.leaves.push(1)}for(r.push(a),n/=2;n>=1;n/=2){const e=r.at(-1);a=new OP(n);for(let t=0;t<n*n;t++){o(t%n,Math.floor(t/n),2,!0,u);const i=e.getElevation(u[0],u[1]),r=e.getElevation(u[2],u[1]),s=e.getElevation(u[2],u[3]),l=e.getElevation(u[0],u[3]),c=e.isLeaf(u[0],u[1]),h=e.isLeaf(u[2],u[1]),d=e.isLeaf(u[2],u[3]),p=e.isLeaf(u[0],u[3]),f=Math.min(i.min,r.min,s.min,l.min),m=Math.max(i.max,r.max,s.max,l.max),_=c&&h&&d&&p;a.maximums.push(m),a.minimums.push(f),a.leaves.push(m-f<=5&&_?1:0)}r.push(a)}return r}(this.dem),i=t.length-1,r=t[i];this._addNode(r.minimums[0],r.maximums[0],r.leaves[0]),this._construct(t,0,0,i,0)}raycastRoot(e,t,i,r,n,o,a=1){return BP([e,t,-100],[i,r,this.maximums[0]*a],n,o)}raycast(e,t,i,r,n,o,a=1){if(!this.nodeCount)return null;const s=this.raycastRoot(e,t,i,r,n,o,a);if(null==s)return null;const l=[],c=[],u=[],h=[],d=[{idx:0,t:s,nodex:0,nodey:0,depth:0}];for(;d.length>0;){const{idx:s,t:p,nodex:f,nodey:m,depth:_}=d.pop();if(this.leaves[s]){VP(f,m,_,e,t,i,r,u,h);const s=1<<_,l=f/s,c=(f+1)/s,d=m/s,g=(m+1)/s,{dim:y,floatView:x,stride:v}=this.dem,b=Math.floor(l*y),w=Math.ceil(c*y),E=Math.floor(d*y),A=w-b,I=Math.ceil(g*y)-E;if(A<=0||I<=0)continue;const S=u[0],T=u[1],D=(h[0]-S)/A,M=(h[1]-T)/I,P=Math.max(0,p),C=n[0]+o[0]*P,R=n[1]+o[1]*P,z=Math.abs(o[0])>1e-10,L=Math.abs(o[1])>1e-10,F=o[0]>=0?1:-1,O=o[1]>=0?1:-1;let B=Math.max(0,Math.min(A-1,Math.floor((C-S)/D))),k=Math.max(0,Math.min(I-1,Math.floor((R-T)/M)));const V=z?Math.abs(D/o[0]):Number.MAX_VALUE,N=L?Math.abs(M/o[1]):Number.MAX_VALUE;let U=z?P+(S+(o[0]>=0?B+1:B)*D-C)/o[0]:Number.MAX_VALUE,j=L?P+(T+(o[1]>=0?k+1:k)*M-R)/o[1]:Number.MAX_VALUE;const G=(e,t)=>x[(t+1)*v+e+1]*a;let H=G(b+B,E+k),$=G(b+B+1,E+k),W=G(b+B,E+k+1),Z=G(b+B+1,E+k+1),X=null;for(let e=0;e<A+I;e++){const e=Math.min(U,j);if(o[2]>=0||n[2]+o[2]*e<=Math.max(H,$,W,Z)){const e=S+B*D,t=e+D,i=T+k*M,r=i+M,a=kP(t,i,$,e,i,H,e,r,W,n,o),s=kP(e,r,W,t,r,Z,t,i,$,n,o);null!=a&&a>=0&&(null===X||a<X)&&(X=a),null!=s&&s>=0&&(null===X||s<X)&&(X=s)}const t=U<j;if(t?(B+=F,U+=V):(k+=O,j+=N),B<0||B>=A||k<0||k>=I)break;if(null!==X&&e>X)break;t?F>0?(H=$,W=Z,$=G(b+B+1,E+k),Z=G(b+B+1,E+k+1)):($=H,Z=W,H=G(b+B,E+k),W=G(b+B,E+k+1)):O>0?(H=W,$=Z,W=G(b+B,E+k+1),Z=G(b+B+1,E+k+1)):(W=H,Z=$,H=G(b+B,E+k),$=G(b+B+1,E+k))}if(null!==X)return X||0;const Y=q([],n,o,p),K=(Y[0]-u[0])/(h[0]-u[0]),J=(Y[1]-u[1])/(h[1]-u[1]),Q=jP(l,d,this.dem)*a,ee=jP(c,d,this.dem)*a,te=jP(c,g,this.dem)*a;if(UP(Q,ee,jP(l,g,this.dem)*a,te,K,J)>=Y[2])return p;continue}let g=0;for(let d=0;d<this._siblingOffset.length;d++){VP((f<<1)+this._siblingOffset[d][0],(m<<1)+this._siblingOffset[d][1],_+1,e,t,i,r,u,h),u[2]=-100,h[2]=this.maximums[this.childOffsets[s]+d]*a;const p=BP(u,h,n,o);if(null!=p){const e=p;l[d]=e;let t=!1;for(let i=0;i<g&&!t;i++)e>=l[c[i]]&&(c.splice(i,0,d),t=!0);t||(c[g]=d),g++}}for(let e=0;e<g;e++){const t=c[e];d.push({idx:this.childOffsets[s]+t,t:l[t],nodex:(f<<1)+this._siblingOffset[t][0],nodey:(m<<1)+this._siblingOffset[t][1],depth:_+1})}}return null}_addNode(e,t,i){return this.minimums.push(e),this.maximums.push(t),this.leaves.push(i),this.childOffsets.push(0),this.nodeCount++}_construct(e,t,i,r,n){if(1===e[r].isLeaf(t,i))return;this.childOffsets[n]||(this.childOffsets[n]=this.nodeCount);const o=r-1,a=e[o];let s=0,l=0;for(let c=0;c<this._siblingOffset.length;c++){const e=2*t+this._siblingOffset[c][0],r=2*i+this._siblingOffset[c][1],n=a.getElevation(e,r),o=a.isLeaf(e,r),u=this._addNode(n.min,n.max,o);o&&(s|=1<<c),l||(l=u)}for(let c=0;c<this._siblingOffset.length;c++)s&1<<c||this._construct(e,2*t+this._siblingOffset[c][0],2*i+this._siblingOffset[c][1],o,l+c)}}function UP(e,t,i,r,n,o){return Wr(Wr(e,i,o),Wr(t,r,o),n)}function jP(e,t,i){const r=i.dim,n=ht(e*r-.5,0,r-1),o=ht(t*r-.5,0,r-1),a=Math.floor(n),s=Math.floor(o),l=Math.min(a+1,r-1),c=Math.min(s+1,r-1);return UP(i.get(a,s),i.get(l,s),i.get(a,c),i.get(l,c),n-a,o-s)}const GP={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function HP(e,t,i){return(256*e*256+256*t+i)/10-1e4}function $P(e,t,i){return 256*e+t+i/256-32768}class WP{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(e,t,i,r=!1){if(this.uid=e,t.height!==t.width)throw new RangeError("DEM tiles must be square");if(i&&"mapbox"!==i&&"terrarium"!==i)return void Tt(`"${i}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=t.height;const n=this.dim=t.height-2,o=new Uint32Array(t.data.buffer);if(this.pixels=new Uint8Array(t.data.buffer),this.floatView=new Float32Array(t.data.buffer),this.borderReady=r,this._modifiedForSources={},!r){for(let e=0;e<n;e++)o[this._idx(-1,e)]=o[this._idx(0,e)],o[this._idx(n,e)]=o[this._idx(n-1,e)],o[this._idx(e,-1)]=o[this._idx(e,0)],o[this._idx(e,n)]=o[this._idx(e,n-1)];o[this._idx(-1,-1)]=o[this._idx(0,0)],o[this._idx(n,-1)]=o[this._idx(n-1,0)],o[this._idx(-1,n)]=o[this._idx(0,n-1)],o[this._idx(n,n)]=o[this._idx(n-1,n-1)]}const a="terrarium"===i?$P:HP;for(let s=0;s<o.length;++s){const e=4*s;this.floatView[s]=a(this.pixels[e],this.pixels[e+1],this.pixels[e+2])}this._timestamp=ei.now()}_buildQuadTree(){this._tree=new NP(this)}get(e,t,i=!1){i&&(e=ht(e,-1,this.dim),t=ht(t,-1,this.dim));const r=this._idx(e,t);return this.floatView[r]}set(e,t,i){const r=this._idx(e,t),n=this.floatView[r];return this.floatView[r]=i,i-n}static getUnpackVector(e){return GP[e]}_idx(e,t){if(e<-1||e>=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(t+1)*this.stride+(e+1)}static pack(e,t){const i=[0,0,0,0],r=WP.getUnpackVector(t);let n=Math.floor((e+r[3])/r[2]);return i[2]=n%256,n=Math.floor(n/256),i[1]=n%256,n=Math.floor(n/256),i[0]=n,i}getPixels(){return new Ld({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,t,i){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let r=t*this.dim,n=t*this.dim+this.dim,o=i*this.dim,a=i*this.dim+this.dim;switch(t){case-1:r=n-1;break;case 1:n=r+1}switch(i){case-1:o=a-1;break;case 1:a=o+1}const s=-t*this.dim,l=-i*this.dim;for(let c=o;c<a;c++)for(let t=r;t<n;t++){const i=4*this._idx(t,c),r=4*this._idx(t+s,c+l);this.pixels[i+0]=e.pixels[r+0],this.pixels[i+1]=e.pixels[r+1],this.pixels[i+2]=e.pixels[r+2],this.pixels[i+3]=e.pixels[r+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}function qP(e,t,i,r,n,o,a,s){const l=[e,t,1,i,r,1,n,o,1],c=[a,s,1],d=u([],l),[p,f,m]=re(c,c,d);return h(l,l,[p,0,0,0,f,0,0,0,m])}function ZP(e,t,i,r,n,o,a,s){const l=function(e,t,i,r,n,o,a,s){const l=qP(0,0,1,0,1,1,0,1),c=qP(e,t,i,r,n,o,a,s);return h(c,c,u([],l))}(e,t,i,r,n,o,a,s);return[l[2]/l[8]/co,l[5]/l[8]/co]}function XP(e){return[e[0],Math.min(Math.max(e[1],-85.051129),Gc)]}Rs(WP,"DEMData"),Rs(NP,"DemMinMaxQuadTree",{omit:["dem"]});class YP extends Nr{constructor(e,t,i,r){super(),this.id=e,this.dispatcher=i,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(r),this.options=t,this._dirty=!1}async load(e,t){if(this._loaded=t||!1,this.fire(new Or("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();const i=new AbortController;this._imageRequest=i;try{const t=await this.map._requestManager.transformRequest(this.url,Bi.Image,i.signal),{data:r}=await Yi(t,i.signal);this._imageRequest=null,this._loaded=!0,this.image=r,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,e&&(this.coordinates=e),this._finishLoading()}catch(e){if(i.signal.aborted)return;this._imageRequest=null,this._loaded=!0,this.fire(new Br(e))}}loaded(){return this._loaded}updateImage(e){return e.url?(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.abort(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded),this):this}setTexture(e){if(!(e.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new qm(this.map.painter.context,e.handle),this.width=e.dimensions[0],this.height=e.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new Or("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(e){this._imageRequest&&(this._imageRequest.abort(),this._imageRequest=null),!this.texture||this.texture instanceof qm||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(e){if(this.coordinates=e,this._boundsArray=void 0,this._unsupportedCoords=!1,!e.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let t=e[0][1],i=e[0][1];for(const n of e)n[1]>i&&(i=n[1]),n[1]<t&&(t=n[1]);const r=(i+t)/2;if(r>Gc?this.onNorthPole=!0:r<-85.051129&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const t=e.map(Zc.fromLngLat);this.tileID=function(e){let t=1/0,i=1/0,r=-1/0,n=-1/0;for(const c of e)t=Math.min(t,c.x),i=Math.min(i,c.y),r=Math.max(r,c.x),n=Math.max(n,c.y);const o=Math.max(r-t,n-i),a=Math.max(0,Math.floor(-Math.log2(o))),s=Math.pow(2,a);let l=Math.floor((t+r)/2*s);return l>1&&(l-=1),new Df(a,l,Math.floor((i+n)/2*s))}(t),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new Or("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof qm||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(e){for(const u in this.tiles){const e=this.tiles[u];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const t=zf(new Df(0,0,0),this.map.transform.projection),i=[t.projection.project(this.coordinates[0][0],this.coordinates[0][1]),t.projection.project(this.coordinates[1][0],this.coordinates[1][1]),t.projection.project(this.coordinates[2][0],this.coordinates[2][1]),t.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(e){const t=e[1].x-e[0].x,i=e[1].y-e[0].y,r=e[2].x-e[1].x,n=e[2].y-e[1].y,o=e[3].x-e[2].x,a=e[3].y-e[2].y,s=e[0].x-e[3].x,l=e[0].y-e[3].y,c=t*n-r*i,u=r*a-o*n,h=o*l-s*a,d=s*i-t*l;return c>0&&u>0&&h>0&&d>0||c<0&&u<0&&h<0&&d<0}(i))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const r=zf(this.tileID,this.map.transform.projection),[n,o,a,s]=this.coordinates.map(e=>{const t=r.projection.project(e[0],e[1]);return Ff(r,t)._round()});this.perspectiveTransform=ZP(n.x,n.y,o.x,o.y,a.x,a.y,s.x,s.y);const l=this._boundsArray=new du;l.emplaceBack(n.x,n.y,0,0),l.emplaceBack(o.x,o.y,co,0),l.emplaceBack(s.x,s.y,0,co),l.emplaceBack(a.x,a.y,co,co),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(l,bD.members),this.boundsSegments=uh.simpleSegment(0,0,4,2);const c=[],d=function(e){return[XP(e[0]),XP(e[1]),XP(e[2]),XP(e[3])]}(this.coordinates),[p,f,m,_]=function(e){let t=e[0][0],i=t,r=e[0][1],n=r;for(let o=1;o<e.length;o++)e[o][0]<t?t=e[o][0]:e[o][0]>i&&(i=e[o][0]),e[o][1]<r?r=e[o][1]:e[o][1]>n&&(n=e[o][1]);return[t,r,i-t,n-r]}(d);{const r=new du,[n,o,a,s]=function(e){let t=e[0].x,i=t,r=e[0].y,n=r;for(let o=1;o<e.length;o++)e[o].x<t?t=e[o].x:e[o].x>i&&(i=e[o].x),e[o].y<r?r=e[o].y:e[o].y>n&&(n=e[o].y);return[t,r,i-t,n-r]}(i),l=e=>[(e.x-n)/a,(e.y-o)/s],[d,g,y,x]=i.map(l),v=function(e,t,i,r,n,o,a,s){const l=qP(0,0,1,0,1,1,0,1);return h(l,l,u([],qP(e,t,i,r,n,o,a,s)))}(d[0],d[1],g[0],g[1],y[0],y[1],x[0],x[1]);this.elevatedGlobePerspectiveTransform=ZP(d[0],d[1],g[0],g[1],y[0],y[1],x[0],x[1]);const b=(e,t)=>{c.push(e.lng);const i=Math.round((e.lng-p)/m*co),n=Math.round((e.lat-f)/_*co),o=l(t),a=re([],[o[0],o[1],1],v),s=Math.round(a[0]/a[2]*co),u=Math.round(a[1]/a[2]*co);r.emplaceBack(i,n,s,u)},w=i[3].x-i[0].x,E=i[3].y-i[0].y,A=i[2].x-i[1].x,I=i[2].y-i[1].y;for(let e=0;e<65;e++){const r=e/64,n=[i[0].x+r*w,i[0].y+r*E],o=[i[1].x+r*A,i[1].y+r*I],a=o[0]-n[0],s=o[1]-n[1];for(let e=0;e<65;e++){const i=e/64,r={x:n[0]+a*i,y:n[1]+s*i};b(t.projection.unproject(r.x,r.y),r)}}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(r,bD.members)}{this.maxLongitudeTriangleSize=0;let t=[],i=new Ru;const r=(e,r,n)=>{i.emplaceBack(e,r,n);const o=c[e],a=c[r],s=c[n],l=Math.min(Math.min(o,a),s),u=Math.max(Math.max(o,a),s)-l;u>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=u),t.push(l+u/2)};for(let e=0;e<64;e++)for(let t=0;t<64;t++){const i=65*e+t,n=i+1,o=i+65,a=o+1;r(i,o,n),r(n,o,a)}[t,i]=function(e,t){const i=Array.from({length:e.length},(e,t)=>t);i.sort((t,i)=>e[t]-e[i]);const r=[],n=new Ru;for(let o=0;o<i.length;o++){const a=i[o];r.push(e[a]);const s=3*a,l=s+1;n.emplaceBack(t.uint16[s],t.uint16[l],t.uint16[l+1])}return[r,n]}(t,i),this.elevatedGlobeTrianglesCenterLongitudes=t,this.elevatedGlobeIndexBuffer=e.createIndexBuffer(i)}this.elevatedGlobeSegments=uh.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,m/co,0,_/co,0,0,f,p,0])}prepare(){const e=0!==Object.keys(this.tiles).length;if(this.tileID&&!e)return;const t=this.map.painter.context,i=t.gl;!this._dirty||this.texture instanceof qm||(this.texture?this.texture.update(this.image):(this.texture=new $m(t,this.image,i.RGBA8),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE)),this._dirty=!1),e&&this._prepareData(t)}loadTile(e,t){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},t(null)):(e.state="errored",t(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(e){const t=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!t)return null;const i=this.elevatedGlobeTrianglesCenterLongitudes;let r=(n=e+180)+360*Math.round((i[0]-n)/360);var n;const o=new uh,a=(e,i)=>{o.segments.push({vertexOffset:0,primitiveOffset:e,vertexLength:t.segments[0].vertexLength,primitiveLength:i,sortKey:void 0,vaos:{}})},s=.51*this.maxLongitudeTriangleSize;if(Math.abs(i[0]-r)<=s){const e=Ut(i,0,i.length,r+s);return e===i.length||a(e,Nt(i,e+1,i.length,r+360-s)-e),o}r<i[0]&&(r+=360);const l=Nt(i,0,i.length,r-s);if(l===i.length)return a(0,i.length),o;a(0,l-0);const c=Ut(i,l+1,i.length,r+s);return c!==i.length&&a(c,i.length-c),o}}const KP={vector:class extends Nr{constructor(e,t,i,r){if(super(),this.id=e,this.dispatcher=i,this.type="vector",this.provider=t.provider,this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,Object.assign(this,mt(t,["url","scheme","tileSize","promoteId"])),this._options={type:"vector",...t},this._collectResourceTiming=!!t.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(r),this._tileWorkers={},this._deduped=new MP}load(e){this._loaded=!1,this.fire(new Or("dataloading",{dataType:"source"}));const t=Array.isArray(this.map._language)?this.map._language.join():this.map._language,i=this.map.getWorldview(),r=(r,n)=>{this._tileJSONRequest=null,this._loaded=!0,r?(t&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${t}`),i&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${i}`),this.fire(new Br(r))):n&&(this._setTileJSON(n),rM.updateCrossSourceElevationGate&&this.map.style&&rM.updateCrossSourceElevationGate(this.map.style),vr(n.tiles,this.map._requestManager._customAccessToken),this.fire(new Or("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new Or("data",{dataType:"source",sourceDataType:"content"}))),e&&e(r)};this.provider=this._options.provider;const n=zP(this._options);return n instanceof Error?(this._loaded=!0,this.fire(new Br(n)),void(e&&e())):this.provider&&!n?(this._loaded=!0,this.fire(new Br(new Error(`TileProvider "${this.provider}" is not registered`))),void(e&&e())):void(this._tileJSONRequest=n?this.loadTileJSONWithProvider(n,r):EA(this._options,this.map._requestManager,t,i,r))}loadTileJSONWithProvider(e,t){this.provider=e.name;const i=new AbortController;return(async()=>{const{request:r,options:n}=await bA(this._options,this.map._requestManager,i.signal);if(i.signal.aborted)return;const o=await this.dispatcher.send("loadTileProvider",{name:e.name,url:e.url,source:this.id,scope:this.scope,type:this.type,options:n,request:r},{signal:i.signal});if(i.signal.aborted)return;const a=o?o.find(e=>null!=e):null,s=LP(this._options,a,this.map._requestManager);s instanceof Error?t(s):t(null,s)})().catch(e=>{i.signal.aborted||t(e)}),{cancel:()=>i.abort()}}_setTileJSON(e){if(Object.assign(this,e),this.hasWorldviews=!!e.worldview_options,e.worldview_default&&(this.worldviewDefault=e.worldview_default),e.vector_layers){this.vectorLayers=e.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set;for(const t of e.vector_layers)this.vectorLayerIds.push(t.id),e.worldview&&e.worldview[t.source]&&this.localizableLayerIds.add(t.id)}this.tileBounds=IA.fromTileJSON(e)}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest();const e=Ul(this.id,this.scope);this.load(()=>this.map.style.clearSource(e))}setTiles(e){return this._options.tiles=e,this.reload(),this}setUrl(e){return this.url=e,this._options.url=e,this.reload(),this}onRemove(e){this.cancelTileJSONRequest()}serialize(){return{...this._options}}async loadTile(e,t){const i=e.tileID.canonical.url(this.tiles,this.scheme),r=this.map._requestManager.normalizeTileURL(i),n=!e.actor||"expired"===e.state;if(!n&&"loading"===e.state)return void(e.reloadCallback=t);n&&(e.actor=this._tileWorkers[r]=this._tileWorkers[r]||this.dispatcher.getActor());const o=new AbortController;e.request=o;try{const a=await this.map._requestManager.transformRequest(r,Bi.Tile,o.signal);if(o.signal.aborted)return t(null);this.dispatchTile(e,r,i,a,o,n,t)}catch(e){if(o.signal.aborted)return t(null);t(e)}}dispatchTile(e,t,i,r,n,o,a){const s=this.map.style?this.map.style.getLut(this.scope):null,l=s?{image:s.image.clone()}:null,c=!(!this.map.style||!this.map.style._crossSourceElevationActive),u=!(!this.map.style||!c),h={request:r,data:void 0,uid:e.uid,tileID:e.tileID,tileZoom:e.tileZoom,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,lut:l,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,pixelRatio:ei.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,showElevationIdDebug:!!this.map.painter&&this.map.painter._debugParams.showElevationIdDebug,promoteId:this.promoteId,renderSourceType:e.renderSourceType,frcCoverage:(()=>{const t=this.map.painter,i=t?t.frcCoverageFadeRange:null;if(null==i)return null;const r=t?t.frcCoverageSnapshot:null,n=this.map.transform.zoom<i[0],o=r?r.getTileOrParent(e.tileID.canonical):null,a=e.tileID.overscaledZ>=Math.ceil(i[1]),s=r&&a?r.getFullCoverageMask(e.tileID.canonical):null;return{frcMask:a?s??null:null,resolved:n||null!=r,polygons:o&&0!==o.frcMask?o.polygons:null,tileZoom:o&&0!==o.frcMask?o.tileId.z:null,sourceLayers:t?t.frcCoverageSourceLayers:["road","structure"]}})(),terrainEnabled:KS(this.map.style,this.map.transform),crossSourceElevationEnabled:u,elevation:rM.buildElevationRequestParams?rM.buildElevationRequestParams(this.map,e,c):null,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:e.isExtraShadowCaster,tessellationStep:this.map._tessellationStep,scaleFactor:this.map.getScaleFactor(),worldview:this.map.getWorldview()||this.worldviewDefault,indoor:this.map.getIndoorTileOptions(this.id,this.scope)};if(this.hasWorldviews&&zi(i)&&(h.localizableLayerIds=this.localizableLayerIds),h.request.collectResourceTiming=this._collectResourceTiming,o)if(this.dispatcher.ready||this.provider)e.request=e.actor.sendCancelable("loadTile",h,{},d.bind(this));else{const t=PP.call({deduped:this._deduped},h,(t,i)=>{e.aborted||(t||!i?d.call(this,t):(h.data={rawData:i.rawData.slice(0),headers:i.headers},e.actor&&(e.request=e.actor.sendCancelable("loadTile",h,{},d.bind(this)))))},!0);n.signal.addEventListener("abort",t,{once:!0})}else e.request=e.actor.sendCancelable("reloadTile",h,{},d.bind(this));function d(t,i){return delete e.request,e.aborted?a(null):t?a(t):(i&&i.resourceTiming&&(e.resourceTiming=i.resourceTiming),this.map._refreshExpiredTiles&&i&&e.setExpiryData(zt(i.headers)),void function(){if(e.aborted)return a(null);e.loadVectorData(i,this.map.painter),Ci(this.dispatcher),a(null,i),e.reloadCallback&&(this.loadTile(e,e.reloadCallback),e.reloadCallback=null)}.call(this))}}abortTile(e){e.request&&(e.request.abort(),delete e.request),e.actor&&e.actor.notify("abortTile",{uid:e.uid,type:this.t
vendor: 3,783 bytes, line 2
2ype,source:this.id,scope:this.scope})}unloadTile(e,t){e.actor&&e.actor.notify("removeTile",{uid:e.uid,type:this.type,source:this.id,scope:this.scope}),e.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}},raster:FP,"raster-dem":class extends FP{constructor(e,t,i,r){super(e,t,i,r),this.type="raster-dem",this.maxzoom=22,this._options={type:"raster-dem",...t},this.encoding=t.encoding||"mapbox"}loadTileJSONWithProvider(e,t){this.provider=e.name;const i=new AbortController;return(async()=>{const{request:r,options:n}=await bA(this._options,this.map._requestManager,i.signal);if(i.signal.aborted)return;const o=await this.dispatcher.send("loadTileProvider",{name:e.name,url:e.url,source:this.id,scope:this.scope,type:this.type,options:n,request:r},{signal:i.signal});if(i.signal.aborted)return;const a=o?o.find(e=>null!=e):null,s=LP(this._options,a,this.map._requestManager);s instanceof Error?t(s):t(null,s)})().catch(e=>{i.signal.aborted||t(e)}),{cancel:()=>i.abort()}}async loadTile(e,t){if(e.actor&&"expired"!==e.state)return;const i=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);e.actor=this.dispatcher.getActor();const r=new AbortController;e.request=r;try{const n=await this.map._requestManager.transformRequest(i,Bi.Tile,r.signal);if(r.signal.aborted)return t(null);e.request=e.actor.sendCancelable("loadTile",{uid:e.uid,tileID:e.tileID,source:this.id,type:this.type,scope:this.scope,request:n,encoding:this.encoding},{},function(i,r){return delete e.request,e.aborted?t(null):i?(e.state="errored",t(i)):(r&&(this.map._refreshExpiredTiles&&e.setExpiryData(zt(r.headers)),r.borderReady||e.neighboringTiles||(e.neighboringTiles=this._getNeighboringTiles(e.tileID)),e.dem=r.dem,e.dem.onDeserialize(),e.needsHillshadePrepare=!0,e.needsDEMTextureUpload=!0),e.state="loaded",void t(null))}.bind(this))}catch(i){if(r.signal.aborted)return t(null);e.state="errored",t(i)}}abortTile(e,t){e.request&&(e.request.abort(),delete e.request),e.actor&&e.actor.notify("abortTile",{uid:e.uid,type:this.type,source:this.id,scope:this.scope}),t&&t()}_getNeighboringTiles(e){const t=e.canonical,i=Math.pow(2,t.z),r=(t.x-1+i)%i,n=0===t.x?e.wrap-1:e.wrap,o=(t.x+1+i)%i,a=t.x+1===i?e.wrap+1:e.wrap,s={};return s[new Pf(e.overscaledZ,n,t.z,r,t.y).key]={backfilled:!1},s[new Pf(e.overscaledZ,a,t.z,o,t.y).key]={backfilled:!1},t.y>0&&(s[new Pf(e.overscaledZ,n,t.z,r,t.y-1).key]={backfilled:!1},s[new Pf(e.overscaledZ,e.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},s[new Pf(e.overscaledZ,a,t.z,o,t.y-1).key]={backfilled:!1}),t.y+1<i&&(s[new Pf(e.overscaledZ,n,t.z,r,t.y+1).key]={backfilled:!1},s[new Pf(e.overscaledZ,e.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},s[new Pf(e.overscaledZ,a,t.z,o,t.y+1).key]={backfilled:!1}),s}},geojson:class extends Nr{constructor(e,t,i,r){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=i.getActor(),this.setEventedParent(r),this._data=t.data,this._options={...t},this._collectResourceTiming=t.collectResourceTiming,void 0!==t.maxzoom&&(this.maxzoom=t.maxzoom),void 0!==t.minzoom&&(this.minzoom=t.minzoom),t.type&&(this.type=t.type),t.attribution&&(this.attribution=t.attribution),this.promoteId=t.promoteId;const n=co/this.tileSize;this.workerOptions={source:this.id,scope:this.scope,cluster:t.cluster||!1,geojsonVtOptions:{buffer:(void 0!==t.buffer?t.buffer:128)*n,tolerance:(void 0!==t.tolerance?t.tolerance:.375)*n,extent:co,maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1},superclusterOptions:{maxZoom:void 0!==t.clusterMaxZoom?t.clusterMa
vendor: 15,629 bytes, line 2
2xZoom:this.maxzoom-1,minPoints:Math.max(2,t.clusterMinPoints||2),extent:co,radius:(void 0!==t.clusterRadius?t.clusterRadius:50)*n,log:!1,generateId:t.generateId||!1},clusterProperties:t.clusterProperties,filter:t.filter,dynamic:t.dynamic,...t.workerOptions}}onAdd(e){this.map=e,this.setData(this._data)}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(e){if(!this._options.dynamic)return this.fire(new Br(new Error("Can't call updateData on a GeoJSON source with dynamic set to false.")));if("string"!=typeof e&&("Feature"===e.type&&(e={type:"FeatureCollection",features:[e]}),"FeatureCollection"!==e.type))return this.fire(new Br(new Error("Data to update should be a feature or a feature collection.")));if(this._coalesce&&"string"!=typeof e&&"string"!=typeof this._data&&"FeatureCollection"===this._data.type){const t=new Map;for(const e of this._data.features)t.set(e.id,e);for(const i of e.features)t.set(i.id,i);this._data.features=[...t.values()]}else this._data=e;return this._updateWorkerData(!0),this}getClusterExpansionZoom(e,t){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:e,source:this.id,scope:this.scope}).then(e=>t(null,e)).catch(e=>t(e)),this}getClusterChildren(e,t){return this.actor.send("geojson.getClusterChildren",{clusterId:e,source:this.id,scope:this.scope}).then(e=>t(null,e)).catch(e=>t(e)),this}getClusterLeaves(e,t,i,r){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:e,limit:t,offset:i}).then(e=>r(null,e)).catch(e=>r(e)),this}async _updateWorkerData(e=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new Or("dataloading",{dataType:"source"})),this._loaded=!1;const t={append:e,...this.workerOptions};t.scope=this.scope;const i=this._data,r=new AbortController;this._pendingLoad=r;try{if("string"==typeof i){if(t.request=await this.map._requestManager.transformRequest(ei.resolveURL(i),Bi.Source,r.signal),r.signal.aborted)return this._pendingLoad=null,void(this._coalesce=!1);t.request.collectResourceTiming=this._collectResourceTiming}else t.data=JSON.stringify(i);const n=await this.actor.send(`${this.type}.loadData`,t,{signal:r.signal});this._loaded=!0,this._pendingLoad=null;const o={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&n&&n.resourceTiming&&n.resourceTiming[this.id]&&(o.resourceTiming=n.resourceTiming[this.id]),e&&(this._partialReload=!0),this.fire(new Or("data",o)),this._partialReload=!1,this._metadataFired=!0}catch(e){if(r.signal.aborted)return this._pendingLoad=null,void(this._coalesce=!1);this._loaded=!0,this._pendingLoad=null,this.fire(new Br(e))}this._coalesce&&(this._updateWorkerData(e),this._coalesce=!1)}loaded(){return this._loaded}reload(){const e=Ul(this.id,this.scope);this.map.style.clearSource(e),this._updateWorkerData()}loadTile(e,t){const i=e.actor?"reloadTile":"loadTile";e.actor=this.actor;const r=this.map.style?this.map.style.getLut(this.scope):null,n=r?{image:r.image.clone()}:null,o=this._partialReload,a={type:this.type,uid:e.uid,tileID:e.tileID,tileZoom:e.tileZoom,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:n,scope:this.scope,pixelRatio:ei.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,showElevationIdDebug:!!this.map.painter&&this.map.painter._debugParams.showElevationIdDebug,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:e.isExtraShadowCaster,scaleFactor:this.map.getScaleFactor(),partial:o,worldview:this.map.getWorldview(),indoor:this.map.getIndoorTileOptions(this.id,this.scope)};e.request=this.actor.sendCancelable(i,a,{},(r,n)=>o&&!n?(e.state="loaded",t(null)):(delete e.request,e.destroy(!1),e.aborted?t(null):r?t(r):(e.loadVectorData(n,this.map.painter,"reloadTile"===i),void t(null))))}abortTile(e){e.request&&(e.request.abort(),delete e.request),e.aborted=!0}unloadTile(e,t){this.actor.notify("removeTile",{uid:e.uid,type:this.type,source:this.id,scope:this.scope}),e.destroy()}onRemove(e){this._pendingLoad&&this._pendingLoad.abort()}serialize(){return{...this._options,type:this.type,data:this._data}}hasTransition(){return!1}},video:class extends YP{constructor(e,t,i,r){super(e,t,i,r),this.roundZoom=!0,this.type="video",this.options=t}async load(){this._loaded=!1;const e=this.options,t=new AbortController;this._imageRequest=t;try{const i=await Promise.all(e.urls.map(async e=>(await this.map._requestManager.transformRequest(e,Bi.Source,t.signal)).url));if(t.signal.aborted)return;this.urls=i;const r=await async function(e){const t=document.createElement("video");t.muted=!0;for(const i of e){const e=document.createElement("source");qi(i)||(t.crossOrigin="Anonymous"),e.src=i,t.appendChild(e)}return await new Promise((i,r)=>{t.onloadstart=()=>i(),t.onerror=()=>r(new Error(`Could not load video: ${e.join(", ")}`))}),t}(i);if(t.signal.aborted)return;this._imageRequest=null,this.video=r,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(e){if(t.signal.aborted)return;this.fire(new Br(e))}finally{this._loaded=!0}}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){const t=this.video.seekable;e<t.start(0)||e>t.end(0)?this.fire(new Br(new vI(`sources.${this.id}`,null,`Playback for this video can be set only between the ${t.start(0)} and ${t.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const e=this.map.painter.context,t=e.gl;this.texture?this.video.paused||(this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.texture=new $m(e,this.video,t.RGBA8),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(e)}serialize(){return{type:"video",urls:this.options.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:YP,canvas:class extends YP{constructor(e,t,i,r){super(e,t,i,r),t.coordinates?Array.isArray(t.coordinates)&&4===t.coordinates.length&&!t.coordinates.some(e=>!Array.isArray(e)||2!==e.length||e.some(e=>"number"!=typeof e))||this.fire(new Br(new vI(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new Br(new vI(`sources.${e}`,null,'missing required property "coordinates"'))),t.animate&&"boolean"!=typeof t.animate&&this.fire(new Br(new vI(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),t.canvas?"string"==typeof t.canvas||t.canvas instanceof HTMLCanvasElement||this.fire(new Br(new vI(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new Br(new vI(`sources.${e}`,null,'missing required property "canvas"'))),this.options=t,this.animate=void 0===t.animate||t.animate}async load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new Br(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(e){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const t=this.map.painter.context;this.texture?!e&&!this._playing||this.texture instanceof qm||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new $m(t,this.canvas,t.gl.RGBA8,{premultiply:!0}),this._prepareData(t)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}},custom:class extends Nr{constructor(e,t,i,r){super(),this.id=e,this.type="custom",this._dataType="raster",this._dispatcher=i,this._implementation=t,this.setEventedParent(r),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new Br(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new Br(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new IA(this._implementation.bounds,this.minzoom,this.maxzoom));const n=t;n.update=this._update.bind(this),n.clearTiles=this._clearTiles.bind(this),n.coveringTiles=this._coveringTiles.bind(this),Object.assign(this,mt(t,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return mt(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new Or("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new Or("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(e){this.map=e,this._loaded=!1,this.fire(new Or("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(e),this.load()}onRemove(e){this._implementation.onRemove&&this._implementation.onRemove(e)}hasTile(e){if(this._implementation.hasTile){const{x:t,y:i,z:r}=e.canonical;return this._implementation.hasTile({x:t,y:i,z:r})}return!this.tileBounds||this.tileBounds.contains(e.canonical)}async loadTile(e,t){const{x:i,y:r,z:n}=e.tileID.canonical,o=new AbortController;e.request=o;try{const a=await this._implementation.loadTile({x:i,y:r,z:n},{signal:o.signal});if(delete e.request,e.aborted)return e.state="unloaded",t(null);if(void 0===a)return e.state="errored",t(null);if(null===a)return this.loadTileData(e,{width:this.tileSize,height:this.tileSize,data:null}),e.state="loaded",t(null);if(!function(e){return e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof ImageBitmap||e instanceof HTMLImageElement}(a))return e.state="errored",t(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`));this.loadTileData(e,a),e.state="loaded",t(null)}catch(i){if(o.signal.aborted)return;e.state="errored",t(i)}}loadTileData(e,t){e.setTexture(t,this.map.painter)}unloadTile(e,t){if(e.texture&&e.texture instanceof $m?(e.destroy(!1),e.texture&&e.texture instanceof $m&&this.map.painter.saveTileTexture(e.texture)):e.destroy(),this._implementation.unloadTile){const{x:t,y:i,z:r}=e.tileID.canonical;this._implementation.unloadTile({x:t,y:i,z:r})}t&&t()}abortTile(e,t){e.request&&(e.request.abort(),delete e.request),t&&t()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(e=>({x:e.canonical.x,y:e.canonical.y,z:e.canonical.z}))}_clearTiles(){const e=Ul(this.id,this.scope);this.map.style.clearSource(e)}_update(){this.fire(new Or("data",{dataType:"source",sourceDataType:"content"}))}}},JP=function(e,t,i,r){const n=QP(t.type);if(!n)throw new Error(`Unknown source type "${t.type}"`);const o=new n(e,t,i,r);if(o.id!==e)throw new Error(`Expected Source id to be ${e} instead of ${o.id}`);return bt(["load","abort","unload","serialize","prepare"],o),o},QP=function(e){return Object.hasOwn(KP,e)?KP[e]:void 0};function eC(e,t){const i={};let r;for(;r=e.nextField(t);)1===r?(i.delta_filter=tC(e,e.readVarint()+e.pos),i.filter="delta_filter"):2===r?(e.readVarint(),i.filter="zigzag_filter"):3===r?(e.readVarint(),i.filter="bitshuffle_filter"):4===r&&(e.readVarint(),i.filter="byteshuffle_filter");return i}function tC(e,t){const i={blockSize:0};let r;for(;r=e.nextField(t);)1===r&&(i.blockSize=e.readVarint());return i}function iC(e,t){const i={};let r;for(;r=e.nextField(t);)1===r?(e.readVarint(),i.codec="gzip_data"):2===r?(e.readVarint(),i.codec="jpeg_image"):3===r?(e.readVarint(),i.codec="webp_image"):4===r&&(e.readVarint(),i.codec="png_image");return i}function rC(e,t){const i={firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]};let r,n=0,o=0;for(;r=e.nextField(t);)1===r?i.firstByte=e.readFixed64():2===r?i.lastByte=e.readFixed64():3===r?i.filters.push(eC(e,e.readVarint()+e.pos)):4===r?i.codec=iC(e,e.readVarint()+e.pos):5===r?o=e.readFloat():6===r?n=e.readFloat():7===r?i.bands.push(e.readString()):8===r?i.offset=e.readDouble():9===r&&(i.scale=e.readDouble());return 0===i.offset&&(i.offset=o),0===i.scale&&(i.scale=n),i}function nC(e,t){const i={version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]};let r;for(;r=e.nextField(t);)1===r?i.version=e.readVarint():2===r?i.name=e.readString():3===r?i.units=e.readString():4===r?i.tileSize=e.readVarint():5===r?i.buffer=e.readVarint():6===r?i.pixelFormat=e.readVarint():7===r&&i.dataIndex.push(rC(e,e.readVarint()+e.pos));return i}function oC(e,t,i){let r;for(;r=e.nextField(t);)if(1===r){let t=0;const r=e.readVarint()+e.pos;for(;e.pos<r;)i[t++]=e.readVarint()}return i}function aC(e,t){if(4!==t.length)throw new Error(`Expected data of dimension 4 but got ${t.length}.`);let i=t[3];for(let r=2;r>=1;r--){const n=1===r?1:0,o=2===r?1:0;for(let r=0;r<t[0];r++){const a=t[1]*r;for(let r=n;r<t[1];r++){const n=t[2]*(r+a);for(let r=o;r<t[2];r++){const o=t[3]*(r+n);for(let r=0;r<t[3];r++){const t=o+r;e[t]+=e[t-i]}}}}i*=t[r]}return e}function sC(e){for(let t=0,i=e.length;t<i;t++)e[t]=e[t]>>>1^-(1&e[t]);return e}function lC(e,t){switch(t){case"uint32":return e;case"uint16":for(let t=0;t<e.length;t+=2){const i=e[t],r=e[t+1];e[t]=(240&i)>>4|(61440&i)>>8|(240&r)<<4|61440&r,e[t+1]=15&i|(3840&i)>>4|(15&r)<<8|(3840&r)<<4}return e;case"uint8":for(let t=0;t<e.length;t+=4){const i=e[t],r=e[t+1],n=e[t+2],o=e[t+3];e[t+0]=(192&i)>>6|(192&r)>>4|(192&n)>>2|192&o,e[t+1]=(48&i)>>4|(48&r)>>2|48&n|(48&o)<<2,e[t+2]=(12&i)>>2|12&r|(12&n)<<2|(12&o)<<4,e[t+3]=3&i|(3&r)<<2|(3&n)<<4|(3&o)<<6}return e;default:throw new Error(`Invalid pixel format, "${t}"`)}}var cC=Uint8Array,uC=Uint16Array,hC=Int32Array,dC=new cC([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]),pC=new cC([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]),fC=new cC([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),mC=function(e,t){for(var i=new uC(31),r=0;r<31;++r)i[r]=t+=1<<e[r-1];var n=new hC(i[30]);for(r=1;r<30;++r)for(var o=i[r];o<i[r+1];++o)n[o]=o-i[r]<<5|r;return{b:i,r:n}},_C=mC(dC,2),gC=_C.b,yC=_C.r;gC[28]=258,yC[258]=28;for(var xC=mC(pC,0).b,vC=new uC(32768),bC=0;bC<32768;++bC){var wC=(43690&bC)>>1|(21845&bC)<<1;vC[bC]=((65280&(wC=(61680&(wC=(52428&wC)>>2|(13107&wC)<<2))>>4|(3855&wC)<<4))>>8|(255&wC)<<8)>>1}var EC=function(e,t,i){for(var r=e.length,n=0,o=new uC(t);n<r;++n)e[n]&&++o[e[n]-1];var a,s=new uC(t);for(n=1;n<t;++n)s[n]=s[n-1]+o[n-1]<<1;a=new uC(1<<t);var l=15-t;for(n=0;n<r;++n)if(e[n])for(var c=n<<4|e[n],u=t-e[n],h=s[e[n]-1]++<<u,d=h|(1<<u)-1;h<=d;
vendor: 5,199 bytes, line 2
2++h)a[vC[h]>>l]=c;return a},AC=new cC(288);for(bC=0;bC<144;++bC)AC[bC]=8;for(bC=144;bC<256;++bC)AC[bC]=9;for(bC=256;bC<280;++bC)AC[bC]=7;for(bC=280;bC<288;++bC)AC[bC]=8;var IC=new cC(32);for(bC=0;bC<32;++bC)IC[bC]=5;var SC=EC(AC,9),TC=EC(IC,5),DC=function(e){for(var t=e[0],i=1;i<e.length;++i)e[i]>t&&(t=e[i]);return t},MC=function(e,t,i){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&i},PC=function(e,t){var i=t/8|0;return(e[i]|e[i+1]<<8|e[i+2]<<16)>>(7&t)},CC=function(e){return(e+7)/8|0},RC=["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"],zC=function(e,t,i){var r=new Error(t||RC[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,zC),!i)throw r;return r},LC=new cC(0),FC="undefined"!=typeof TextDecoder&&new TextDecoder;try{FC.decode(LC,{stream:!0})}catch(e){}const OC={gzip_data:"gzip"};class BC extends Error{constructor(e){super(e),this.name="MRTError"}}const kC={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},VC={uint32:1,uint16:2,uint8:4},NC={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let UC;class jC{constructor(e=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=e}getLayer(e){const t=this.layers[e];if(!t)throw new BC(`Layer '${e}' not found`);return t}getHeaderLength(e){const t=new Uint8Array(e),i=new DataView(e);if(13!==t[0])throw new BC("File is not a valid MRT.");return i.getUint32(1,!0)}parseHeader(e){const t=new Uint8Array(e),i=this.getHeaderLength(e);if(t.length<i)throw new BC(`Expected header with length >= ${i} but got buffer of length ${t.length}`);const r=function(e){const t={headerLength:0,x:0,y:0,z:0,layers:[]};let i;for(;i=e.nextField(void 0);)1===i?t.headerLength=e.readFixed32():2===i?t.x=e.readVarint():3===i?t.y=e.readVarint():4===i?t.z=e.readVarint():5===i&&t.layers.push(nC(e,e.readVarint()+e.pos));return t}(new UC(t.subarray(0,i)));if(!isNaN(this.x)&&(this.x!==r.x||this.y!==r.y||this.z!==r.z))throw new BC(`Invalid attempt to parse header ${r.z}/${r.x}/${r.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=r.x,this.y=r.y,this.z=r.z;for(const n of r.layers)this.layers[n.name]=new GC(n,{cacheSize:this._cacheSize});return this}createDecodingTask(e){const t=[],i=this.getLayer(e.layerName);for(let r of e.blockIndices){const n=i.dataIndex[r],o=n.firstByte-e.firstByte,a=n.lastByte-e.firstByte;if(i._blocksInProgress.has(r))continue;const s={layerName:i.name,firstByte:o,lastByte:a,pixelFormat:i.pixelFormat,blockIndex:r,blockShape:[n.bands.length].concat(i.bandShape),buffer:i.buffer,codec:n.codec.codec,filters:n.filters.map(e=>e.filter)};i._blocksInProgress.add(r),t.push(s)}return new HC(t,()=>{t.forEach(e=>i._blocksInProgress.delete(e.blockIndex))},(e,r)=>{if(t.forEach(e=>i._blocksInProgress.delete(e.blockIndex)),e)throw e;r.forEach(e=>{this.getLayer(e.layerName).processDecodedData(e)})})}}class GC{constructor({version:e,name:t,units:i,tileSize:r,pixelFormat:n,buffer:o,dataIndex:a},s){if(this.version=e,1!==this.version)throw new BC(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=t,this.units=i,this.tileSize=r,this.buffer=o,this.pixelFormat=kC[n],this.dataIndex=a,this.bandShape=[r+2*o,r+2*o,VC[this.pixelFormat]],this._decodedBlocks=new gI(s?s.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return VC[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:e})=>e).flat()}processDecodedData(e){const t=e.blockIndex.toString();this._decodedBlocks.get(t)||this._decodedBlocks.put(t,e.data)}getBlockForBand(e){let t=0;switch(typeof e){case"string":for(const[i,r]of this.dataIndex.entries()){for(const[n,o]of r.bands.entries())if(o===e)return{bandIndex:t+n,blockIndex:i,blockBandIndex:n};t+=r.bands.length}break;case"number":for(const[i,r]of this.dataIndex.entries()){if(e>=t&&e<t+r.bands.length)return{bandIndex:e,blockIndex:i,blockBandIndex:e-t};t+=r.bands.length}break;default:throw new BC(`Invalid band \`${JSON.stringify(e)}\`. Expected string or integer.`)}return{blockIndex:-1,blockBandIndex:-1}}getDataRange(e){let t=1/0,i=-1/0;const r=[],n=new Set;for(const o of e){const{blockIndex:e}=this.getBlockForBand(o);if(e<0)throw new BC(`Invalid band: ${JSON.stringify(o)}`);const a=this.dataIndex[e];r.includes(e)||r.push(e),n.add(e),t=Math.min(t,a.firstByte),i=Math.max(i,a.lastByte)}if(n.size>this.cacheSize)throw new BC(`Number of blocks to decode (${n.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:t,lastByte:i,blockIndices:r}}hasBand(e){const{blockIndex:t}=this.getBlockForBand(e);return t>=0}hasDataForBand(e){const{blockIndex:t}=this.getBlockForBand(e);return t>=0&&!!this._decodedBlocks.get(t.toString())}getBandView(e){const{blockIndex:t,blockBandIndex:i}=this.getBlockForBand(e);if(t<0)throw new BC(`Band not found: ${JSON.stringify(e)}`);const r=this._decodedBlocks.get(t.toString());if(!r)throw new BC(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);const n=this.dataIndex[t],o=this.bandShape.reduce((e,t)=>
vendor: 12,518 bytes, line 2
2e*t,1),a=i*o,s=r.subarray(a,a+o);return{data:s,bytes:new Uint8Array(s.buffer).subarray(s.byteOffset,s.byteOffset+s.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:n.offset,scale:n.scale}}}jC.setPbf=function(e){UC=e};class HC{constructor(e,t,i){this.tasks=e,this._onCancel=t,this._onComplete=i,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,t){this._finalized||(this._onComplete(e,t),this._finalized=!0)}}function $C([e,t],i,r,{scaled:n=!0}={}){const{tileSize:o,buffer:a}=r,{x:s,y:l,z:c}=i;if(!isFinite(s)||!isFinite(l)||!isFinite(c))throw new Error("Invalid MRT header");const u=2**c,h=u*Wn(e),d=u*qn(t);return function([e,t],i,{scaled:r=!0}={}){if(!i)throw new Error("bandView is undefined");const{data:n,tileSize:o,buffer:a,offset:s,scale:l,dimension:c}=i;if(e<-a||e>o+a||t<-a||t>o+a)throw new Error(`Point (${e}, ${t}) out of bounds for tileSize=${o}, buffer=${a}`);const u=(t+a)*(o+2*a)+(e+a);if(4294967295===new Uint32Array(n.buffer)[u])return null;let h=[];h=r?[]:new(0,i.data.constructor)(c);for(let d=0;d<c;d++)h[d]=Math.round(1e12*(n[c*u+d]*l+s))/1e12;return h}([Math.min(Math.max(-a,Math.floor((h-s)*o)),o-1+a),Math.min(Math.max(-a,Math.floor((d-l)*o)),o-1+a)],r,{scaled:n})}jC.performDecoding=function(e,t){const i=new Uint8Array(e);return Promise.all(t.tasks.map(e=>{const{layerName:t,firstByte:r,lastByte:n,pixelFormat:o,blockShape:a,blockIndex:s,filters:l,codec:c}=e,u=i.subarray(r,n+1),h=new Uint32Array(a[0]*a[1]*a[2]);let d;if("gzip_data"!==c)throw new BC(`Unhandled codec: ${c}`);return d=function(e,t){if(!globalThis.DecompressionStream&&"gzip_data"===t)return Promise.resolve((o=function(e){31==e[0]&&139==e[1]&&8==e[2]||zC(6,"invalid gzip data");var t=e[3],i=10;4&t&&(i+=2+(e[10]|e[11]<<8));for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[i++]);return i+(2&t)}(i=e),o+8>i.length&&zC(6,"invalid gzip data"),function(e,t,i,r){var n=e.length;if(!n||t.f&&!t.l)return i||new cC(0);var o=!i,a=o||2!=t.i,s=t.i;o&&(i=new cC(3*n));var l=function(e){var t=i.length;if(e>t){var r=new cC(Math.max(2*t,e));r.set(i),i=r}},c=t.f||0,u=t.p||0,h=t.b||0,d=t.l,p=t.d,f=t.m,m=t.n,_=8*n;do{if(!d){c=MC(e,u,1);var g=MC(e,u+1,3);if(u+=3,!g){var y=e[(M=CC(u)+4)-4]|e[M-3]<<8,x=M+y;if(x>n){s&&zC(0);break}a&&l(h+y),i.set(e.subarray(M,x),h),t.b=h+=y,t.p=u=8*x,t.f=c;continue}if(1==g)d=SC,p=TC,f=9,m=5;else if(2==g){var v=MC(e,u,31)+257,b=MC(e,u+10,15)+4,w=v+MC(e,u+5,31)+1;u+=14;for(var E=new cC(w),A=new cC(19),I=0;I<b;++I)A[fC[I]]=MC(e,u+3*I,7);u+=3*b;var S=DC(A),T=(1<<S)-1,D=EC(A,S);for(I=0;I<w;){var M,P=D[MC(e,u,T)];if(u+=15&P,(M=P>>4)<16)E[I++]=M;else{var C=0,R=0;for(16==M?(R=3+MC(e,u,3),u+=2,C=E[I-1]):17==M?(R=3+MC(e,u,7),u+=3):18==M&&(R=11+MC(e,u,127),u+=7);R--;)E[I++]=C}}var z=E.subarray(0,v),L=E.subarray(v);f=DC(z),m=DC(L),d=EC(z,f),p=EC(L,m)}else zC(1);if(u>_){s&&zC(0);break}}a&&l(h+131072);for(var F=(1<<f)-1,O=(1<<m)-1,B=u;;B=u){var k=(C=d[PC(e,u)&F])>>4;if((u+=15&C)>_){s&&zC(0);break}if(C||zC(2),k<256)i[h++]=k;else{if(256==k){B=u,d=null;break}var V=k-254;k>264&&(V=MC(e,u,(1<<(j=dC[I=k-257]))-1)+gC[I],u+=j);var N=p[PC(e,u)&O],U=N>>4;if(N||zC(3),u+=15&N,L=xC[U],U>3){var j=pC[U];L+=PC(e,u)&(1<<j)-1,u+=j}if(u>_){s&&zC(0);break}a&&l(h+131072);var G=h+V;if(h<L){var H=0-L,$=Math.min(L,G);for(H+h<0&&zC(3);h<$;++h)i[h]=r[H+h]}for(;h<G;++h)i[h]=i[h-L]}}t.l=d,t.p=B,t.b=h,t.f=c,d&&(c=1,t.m=f,t.d=p,t.n=m)}while(!c);return h!=i.length&&o?function(e,t,i){return(null==i||i>e.length)&&(i=e.length),new cC(e.subarray(0,i))}(i,0,h):i.subarray(0,h)}(i.subarray(o,-8),{i:2},new cC(((r=i)[(n=r.length)-4]|r[n-3]<<8|r[n-2]<<16|r[n-1]<<24)>>>0),void 0)));var i,r,n,o;const a=OC[t];if(!a)throw new Error(`Unhandled codec: ${t}`);const s=new globalThis.DecompressionStream(a);return new Response(new Blob([e]).stream().pipeThrough(s)).arrayBuffer().then(e=>new Uint8Array(e))}(u,c).then(e=>(function(e,t){let i;for(;i=e.nextField();)if(2===i)oC(e,e.readVarint()+e.pos,t);else if(3===i)throw new Error("Not implemented")}(new UC(e),h),new(0,NC[o])(h.buffer))),d.then(e=>{for(let t=l.length-1;t>=0;t--)switch(l[t]){case"delta_filter":aC(e,a);break;case"zigzag_filter":sC(e);break;case"bitshuffle_filter":lC(e,o);break;default:throw new BC(`Unhandled filter "${l[t]}"`)}return{layerName:t,blockIndex:s,data:e}}).catch(e=>{throw e})}))},Rs(HC,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),Rs(jC,"MapboxRasterTile"),Rs(GC,"MapboxRasterLayer",{omit:["_blocksInProgress"]});class WC extends Error{constructor(e){super(e),this.name="MRTOverzoomError"}}const qC={uint8:Uint8Array,uint16:Uint16Array,uint32:Uint32Array};function ZC(e,t,i){const{x:r,y:n,z:o}=t,{x:a,y:s,z:l}=i,c=l-o;if(c<0)throw new WC(`Invalid overzoom, source (z=${o}) is higher zoom than destination (z=${l}).`);const u=a-(r<<c),h=s-(n<<c),d=1<<c;if(u<0||u>=d||h<0||h>=d)throw new WC(`Invalid overzoom, ${l}/${a}/${s} is not a child of ${o}/${r}/${n}.`);const p=0|Math.log2(e),f=Math.min(c,p),m=c-f,_=e>>f;return{offset:[(u>>m)*_,(h>>m)*_],tileSize:_,deltaZ:c}}jC.setPbf(zm);class XC extends ID{constructor(e,t,i,r,n){super(e,t,i,r,n),this._workQueuePerLayer=new Map,this._fetchQueuePerLayer=new Map,this._taskQueue=new Map,this._isHeaderLoaded=!1,this._isLoadInProgress=!1,this.textureDescriptorPerLayer=new Map,this.texturePerLayer=new Map,this.parentTile=null,this.overzoomCoordsPerLayer=null}getLayers(){return this._mrt?Object.values(this._mrt.layers):[]}getLayer(e){return this._mrt&&this._mrt.getLayer(e)}setTexturePerLayer(e,t,i){const r=i.context,n=r.gl;let o=this.texturePerLayer.get(e)||i.getTileTexture(t.width);o&&o instanceof $m?o.update(t,{premultiply:!1}):(o=new $m(r,t,n.RGBA8,{premultiply:!1}),o.bind(n.LINEAR,n.CLAMP_TO_EDGE)),this.texturePerLayer.has(e)||this.texturePerLayer.set(e,o)}flushQueues(e){const t=this._workQueuePerLayer.get(e)||[],i=this._fetchQueuePerLayer.get(e)||[];for(;t.length;)t.pop()();for(;i.length;)i.pop()()}flushAllQueues(){for(const e of this._workQueuePerLayer.keys()){const t=this._workQueuePerLayer.get(e)||[];for(;t.length;)t.pop()()}for(const e of this._fetchQueuePerLayer.keys()){const t=this._fetchQueuePerLayer.get(e)||[];for(;t.length;)t.pop()()}}fetchHeader(e=16384,t){const i=this._mrt=new jC(30),r={...this.requestParams,headers:{Range:"bytes=0-"+(e-1)}};this.entireBuffer=null;const n=new AbortController;return this.request=n,Wi(r,n.signal).then(({data:r,headers:n})=>{try{const o=i.getHeaderLength(r);if(o>e)return void(this.request=this.fetchHeader(o,t));i.parseHeader(r),this._isHeaderLoaded=!0;let a=0;for(const e of Object.values(i.layers))a=Math.max(a,e.dataIndex.at(-1).lastByte);r.byteLength>=a&&(this.entireBuffer=r),t(null,this.entireBuffer||r,n)}catch(e){t(e)}}).catch(e=>{n.signal.aborted||t(e)}),this.request}fetchBandForRender(e,t,i,r){this.fetchBand(e,t,i,n=>{if(n)return void r(n);this.updateTextureDescriptor(e,t,i);const o=this.textureDescriptorPerLayer.get(t);r(null,o?o.img:null)})}fetchBand(e,t,i,r){const n=this._mrt;if(!this._isHeaderLoaded||!n)return void r(new Error("Tile header is not ready"));if(this.parentTile&&this.overzoomCoordsPerLayer)return void r(null,null);const o=this.actor;if(!o)return void r(new Error("Can't fetch tile band without an actor"));let a;const s=Ul(String(i),Ul(this.tileID.key,e));let l=this._taskQueue.get(s);l?l.add(r):(l=new Set,l.add(r),this._taskQueue.set(s,l));const c=(e,t)=>{a.complete(e,t),e?r(e):(l.forEach(e=>e(null,t)),this._taskQueue.delete(s))},u=(e,i)=>{if(e)return r(e);let n,s=!1;if(null!==t){const e=this._workQueuePerLayer.get(t)||[];e.push(()=>{s=!0,n&&n.abort(),a.cancel()}),this._workQueuePerLayer.has(t)||this._workQueuePerLayer.set(t,e)}const l=()=>{s||(n=o.sendCancelable("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:i,task:a},{},c))};void 0!==this.workerReady?this.workerReady.then(l).catch(e=>r(e)):l()};let h;try{h=n.getLayer(e)}catch(t){if(this.parentTile&&this.overzoomCoordsPerLayer)return void r(new Error(`Layer '${e}' not found in parent tile MRT`));if("reloading"===this.state)return;throw t}if(!h)return void r(new Error(`Unknown sourceLayer "${e}"`));if(h.hasDataForBand(i))return l.forEach(e=>e(null,null)),void this._taskQueue.delete(s);const d=h.getDataRange([i]);if(a=n.createDecodingTask(d),!a||a.tasks.length)if(null!==t&&this.flushQueues(t),this.entireBuffer)u(null,this.entireBuffer.slice(d.firstByte,d.lastByte+1));else{const e={...this.requestParams,headers:{Range:`bytes=${d.firstByte}-${d.lastByte}`}},i=new AbortController;if(Wi(e,i.signal).then(({data:e})=>u(null,e)).catch(e=>{i.signal.aborted||u(e)}),null!==t){const e=this._fetchQueuePerLayer.get(t)||[];e.push(()=>{i.abort(),a.cancel()}),this._fetchQueuePerLayer.has(t)||this._fetchQueuePerLayer.set(t,e)}}}updateNeeded(e,t){return(!this.textureDescriptorPerLayer.get(e)||this.textureDescriptorPerLayer.get(e).band!==t||this.refreshedUponExpiration)&&"errored"!==this.state}updateTextureDescriptor(e,t,i){if(!this._mrt)return;let r;try{r=this._mrt.getLayer(e)}catch(e){return}if(!r||!r.hasBand(i)||!r.hasDataForBand(i))return;let{bytes:n,tileSize:o,buffer:a,offset:s,scale:l}=r.getBandView(i);if(this.parentTile&&this.overzoomCoordsPerLayer){const t=this.overzoomCoordsPerLayer.get(e);t&&(n=this.cropBandData(n,o,a,t),o=t.tileSize)}const c=o+2*a,u=new zd({width:c,height:c},n),h=this.texturePerLayer.get(t);h&&h instanceof $m&&h.update(u,{premultiply:!1}),this.textureDescriptorPerLayer.set(t,{layer:e,band:i,img:u,buffer:a,offset:s,tileSize:o,format:r.pixelFormat,mix:[l,256*l,65536*l,16777216*l]})}cropBandData(e,t,i,r){const{offset:n,tileSize:o}=r,a=t+2*i,s=o+2*i;return function(e,t,i,r){const n=function(e){if(e instanceof Uint8Array)return"uint8";if(e instanceof Uint16Array)return"uint16";if(e instanceof Uint32Array)return"uint32";throw new Error("Invalid array type")}(e),o=qC[n];if(!o)throw new Error(`Invalid data type "${n}"`);const a=t[2]*t[3],s=t[1]*a,l=i[2]*i[3],c=i[1]*l,u=new o(c*i[0]);for(let h=0;h<i[0];h++){let n=h*s;n+=i[3]*(r[1]*t[2]+r[0]);let o=h*c;for(let t=0;t<i[1];t++)u.subarray(o,o+l).set(e.subarray(n,n+l)),n+=a,o+=l}return u}(e,[1,a,a,4],[1,s,s,4],n)}setupOverzoom(e){let t=e;for(;t.parentTile;)t=t.parentTile;const i=t._mrt;if(!i||!i.layers)return!1;const r=Object.values(i.layers);if(0===r.length)return!1;const n={x:t.tileID.canonical.x,y:t.tileID.canonical.y,z:t.tileID.canonical.z},o={x:this.tileID.canonical.x,y:this.tileID.canonical.y,z:this.tileID.canonical.z},a=new Map;for(const s of r)try{a.set(s.name,ZC(s.tileSize,n,o))}catch(e){return!1}return this.parentTile=t,this._mrt=i,this._isHeaderLoaded=!0,this.overzoomCoordsPerLayer=a,!0}destroy(e=!1){if(super.destroy(e),delete this._mrt,!e)for(const t of this.texturePerLayer.values())t&&t instanceof $m&&t.destroy();this.texturePerLayer.clear(),this.textureDescriptorPerLayer.clear(),this.fbo&&(this.fbo.destroy(),delete this.fbo),delete this.request,delete this.requestParams,this._isHeaderLoaded=!1}}ED=(e,t,i,r,n)=>new XC(e,t,i,r,n);const YC={RasterArrayTileSource:class extends FP{get partial(){return!this.map.style.imageManager.hasImageProviderForSource(this.id,this.scope)}constructor(e,t,i,r){super(e,t,i,r),this.type="raster-array",this.maxzoom=void 0!==t.maxzoom?t.maxzoom:22,this._loadTilePending={},this._loadTileLoaded={},this._pendingParentWaiters=new Map,this._options={type:"raster-array",...t}}onAdd(e){super.onAdd(e);const t=e=>{"source"===e.dataType&&"metadata"===e.sourceDataType&&(this.off("data",t),void 0===this._dataMaxzoom&&(this._dataMaxzoom=this.maxzoom))};this.on("data",t)}getDataMaxzoom(){return this._dataMaxzoom}collectOverzoomParentTileIDs(e,t){const i=[];for(const n in e){const t=e[n];if(!t)continue;const r=t.parentTile;r&&e[r.tileID.key]&&i.push(r.tileID)}const r=this._dataMaxzoom;if(void 0!==r)for(const n of t){if(n.canonical.z<=r)continue;const t=n.scaledTo(r);e[t.key]&&i.push(t)}return i}_narrowDataMaxzoom(e){const t=Math.max(this.minzoom,e-1);(void 0===this._dataMaxzoom||t<this._dataMaxzoom)&&(this._dataMaxzoom=t)}_isParentReady(e){const t=e._mrt;return e._isHeaderLoaded&&!!t&&!!t.layers&&Object.keys(t.layers).length>0}_waitForParent(e,t){if(this._isParentReady(e))return void t(null);if("errored"===e.state)return void t(new Error("Parent tile failed to load"));const i=this._pendingParentWaiters.get(e.uid);if(i)return void i.push(t);this._pendingParentWaiters.set(e.uid,[t]);const r=t=>{if("source"!==t.dataType||t.tile!==e)return;const i=this._isParentReady(e);if(!i&&"errored"!==e.state)return;this.off("data",r);
vendor: 5,121 bytes, line 2
2const n=this._pendingParentWaiters.get(e.uid)||[];this._pendingParentWaiters.delete(e.uid);const o=i?null:new Error("Parent tile failed to load");for(const e of n)e(o)};this.on("data",r)}triggerRepaint(e){const t=this.map.painter._terrain,i=this.map.style.getSourceCache(this.id);t&&t.enabled&&i&&t._clearRenderCacheForTile(i.id,e.tileID),this.map.triggerRepaint()}_setupOverzoomTile(e,t){const i=void 0!==this._dataMaxzoom?this._dataMaxzoom:this.maxzoom,r=this.map.style.getSourceCache(this.id);if(!r)return void t(new Error("Source cache not found"));e._isLoadInProgress=!0;const n=e.tileID.scaledTo(i);let o=r.getTile(n);for(;o&&o.parentTile;)o=o.parentTile;o||(o=r._addTile(n));const a=i=>{e._isLoadInProgress=!1,t(i)};this._waitForParent(o,t=>{if(t||!e.setupOverzoom(o))return e.state="errored",void a(t||new Error("Parent tile setup failed"));e.state="loaded",a(null)})}async loadTile(e,t){const i=e.tileID.canonical.z>(void 0!==this._dataMaxzoom?this._dataMaxzoom:this.maxzoom);if("loaded"===e.state)return void t(null);if(e._isLoadInProgress)return void t(null);if(i)return void this._setupOverzoomTile(e,t);const r=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);e.source=this.id,e.scope=this.scope,void 0===this._workerReady&&(this._workerReady=this.dispatcher.send("ensureRasterArraySource",void 0).then(()=>{}),this._workerReady.catch(()=>{})),e.workerReady=this._workerReady,e.actor||(e.actor=this.dispatcher.getActor());const n=new AbortController;e.request=n;const o=(i,r,n)=>{if(delete e.request,e.aborted)return t(null);if(i)return(404===i.status||"string"==typeof i.message&&i.message.includes("Not Found"))&&(this._narrowDataMaxzoom(e.tileID.canonical.z),void 0!==this._dataMaxzoom&&e.tileID.canonical.z>this._dataMaxzoom)?void this._setupOverzoomTile(e,t):(e.state="errored",t(i));if(this.map._refreshExpiredTiles&&r&&e.setExpiryData(zt(n)),this.partial&&"expired"!==e.state)e.state="empty";else if(!this.partial){if(!r)return t(null);e.state="loaded",e._isHeaderLoaded=!0,e._mrt=r}t(null)};try{const i=await this.map._requestManager.transformRequest(r,Bi.Tile,n.signal);if(n.signal.aborted)return t(null);e.requestParams=i;const a={request:i,uid:e.uid,tileID:e.tileID,type:this.type,source:this.id,scope:this.scope,partial:this.partial};e.request=this.partial?e.fetchHeader(void 0,(e,t,i)=>{o(e,t,i)}):e.actor.sendCancelable("loadTile",a,{},(e,t)=>e?o(e):t?void o(null,t.mrt,t.headers):o(null,null))}catch(i){if(n.signal.aborted)return t(null);e.state="errored",t(i)}}abortTile(e){e.request&&(e.request.abort(),delete e.request),e.actor&&e.actor.notify("abortTile",{uid:e.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(e,t){const i=e.texturePerLayer;if(e.flushAllQueues(),i.size){e.destroy(!1);for(const e of i.values())this.map.painter.saveTileTexture(e)}else e.destroy()}prepareTile(e,t,i,r){e.tileID.canonical.z>(void 0!==this._dataMaxzoom?this._dataMaxzoom:this.maxzoom)&&(!e.parentTile||!e.overzoomCoordsPerLayer)||e._isHeaderLoaded&&("empty"!==e.state&&(e.state="reloading"),e.fetchBandForRender(t,i,r,(t,r)=>{t?(e.state="errored",this.fire(new Br(t))):r&&(e._isHeaderLoaded=!0,e.setTexturePerLayer(i,r,this.map.painter),e.state="loaded"),this.triggerRepaint(e)}))}getInitialBand(e){if(!this.rasterLayers)return 0;const t=this.rasterLayers.find(({id:t})=>t===e),i=t&&t.fields,r=i&&i.bands&&i.bands;return r?r[0]:0}getTextureDescriptor(e,t,i){if(!e)return;const r=t.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!r)return;let n=null;t instanceof Db?n=t.paint.get("raster-array-band"):t instanceof Bb&&(n=t.paint.get("raster-particle-array-band"));const o=n||this.getInitialBand(r);return null==o||!e.textureDescriptorPerLayer.get(t.id)||e.updateNeeded(t.id,o)&&!i?void 0:{...e.textureDescriptorPerLayer.get(t.id),texture:e.texturePerLayer.get(t.id)}}getImages(e,t){const i=new Map;for(const r of e)for(const e of t){const[t,n]=e.split("/"),o=r.getLayer(t);if(!o)continue;if(!o.hasBand(n)||!o.hasDataForBand(n))continue;const{bytes:a,tileSize:s,buffer:l}=o.getBandView(n),c=s+2*l,u={data:new zd({width:c,height:c},a),pixelRatio:2,sdf:!1,usvg:!1,version:0};i.set(e,u)}return i}queryRasterArrayValueByBandId(e,t,i){const r=t._mrt;return new Promise(n=>{const o={},a=new Set;for(const[s,l]of Object.entries(r.layers)){if(i.layerName&&s!==i.layerName)continue;const c={};o[s]=c;for(const{bands:u}of l.dataIndex)for(const h of u)i.bands&&!i.bands.includes(h)||(a.add(Ul(s,h)),t.fetchBand(s,null,h,t=>{ei.frame(()=>{c[h]=t?null:$C([e.lng,e.lat],r,l.getBandView(h)),a.delete(Ul(s,h)),0===a.size&&n(o)})}))}0===a.size&&n(o)})}_loadTileForQuery(e){if(this._loadTileLoaded[e.uid])return Promise.resolve(e._mrt);if(e.uid in this._loadTilePending)return this._loadTilePending[e.uid];const t=this._fetchTileForQuery(e);return this._loadTilePending[e.uid]=t,t}async _fetchTileForQuery(e){const t=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);try{const i={request:await this.map._requestManager.transformRequest(t,Bi.Tile),uid:e.uid,tileID:e.tileID,type:this.t
vendor: 16,055 bytes, line 2
2ype,source:this.id,scope:this.scope,partial:!1},r=await e.actor.send("loadTile",i);if(!r)return null;const n=r.mrt;return this.map._refreshExpiredTiles&&e.setExpiryData(zt(r.headers)),e._mrt=n,e._isHeaderLoaded=!0,e.state="loaded",this._loadTileLoaded[e.uid]=!0,n}finally{delete this._loadTilePending[e.uid]}}async queryRasterArrayValueByAllBands(e,t,i){return await this._loadTileForQuery(t)?this.queryRasterArrayValueByBandId(e,t,i):null}queryRasterArrayValue(e,t){const i=kc.convert(e),r=this.findLoadedParent(i);return r&&r._mrt?t.bands||!this.partial?this.queryRasterArrayValueByBandId(i,r,t):this.queryRasterArrayValueByAllBands(i,r,t):Promise.resolve(null)}findLoadedParent(e){const t=Zc.fromLngLat(e,this.map.transform.tileSize),i=this.maxzoom+1,r=1<<i,n=Math.floor(t.x),o=Math.floor((t.x-n)*r),a=Math.floor(t.y*r);if(o<0||o>=r||a<0||a>=r)return null;const s=this.map.style.getSourceCache(this.id),l=new Pf(i,n,i,o,a);return s.findLoadedParent(l,this.minzoom)}}},KC=YC,JC={model:()=>bT().then(()=>vT.ModelSource),"batched-model":()=>bT().then(()=>vT.Tiled3dModelSource),"raster-array":()=>async function(){return Promise.resolve()}().then(()=>KC.RasterArrayTileSource)};class QC extends Nr{constructor(e,t,i,r){super(),this.id=e,this.type=t.type,this._options=t,this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.setEventedParent(r)}hasTransition(){return!1}loaded(){return!1}onAdd(e){}onRemove(e){}loadTile(e,t){}serialize(){return this._options}}function eR(e,t,i=""){return`${i}:${t.id||""}:${t.layer.id}:${function(e){if("layerId"in e)return`layer:${e.layerId}`;{const{featuresetId:t,importId:i}=e;return`featureset:${t}${i?`:import:${i}`:""}`}}(e.target)}`}function tR(e,t,i,r=""){if(e.uniqueFeatureID){const n=eR(e,t,r);if(i.has(n))return!0;i.add(n)}return!1}function iR(e,t,i,r,n=!1,o=void 0){const a=t.sourceCache.transform,s=t.sourceCache.tilesIn(e,t.has3DLayers,n);s.sort(oR);const l=[];for(const c of s){const e=c.tile.queryRenderedFeatures(t,c,i,r,a,n,o);Object.keys(e).length&&l.push({wrappedTileID:c.tile.tileID.wrapped().key,queryResults:e})}for(const c in t.layers){const i=t.layers[c];if(i.styleLayer){const n=i.styleLayer.queryRenderedFeatures(e,t.sourceCache,r);Object.keys(n).length&&l.push({wrappedTileID:0,queryResults:n})}}return 0===l.length?{}:function(e){const t={},i={};for(const r of e){const e=r.queryResults,n=r.wrappedTileID,o=i[n]=i[n]||{};for(const i in e){const r=e[i],n=o[i]=o[i]||{},a=t[i]=t[i]||[];for(const e of r)n[e.featureIndex]||(n[e.featureIndex]=!0,a.push(e))}}return t}(l)}function rR(e,t,i,r,n,o){const a={},s=r.queryRenderedSymbols(e),l=[];for(const c of Object.keys(s).map(Number))l.push(n[c]);l.sort(oR);for(const c of l){const e=c.featureIndex.lookupSymbolFeatures(s[c.bucketInstanceId],c.bucketIndex,c.sourceLayerIndex,t,i,o);for(const t in e){const i=a[t]=a[t]||[],r=e[t];r.sort((e,t)=>{const i=c.featureSortOrder;if(i){const r=i.indexOf(e.featureIndex);return i.indexOf(t.featureIndex)-r}return t.featureIndex-e.featureIndex});for(const e of r)i.push(e)}}return a}function nR(e,t){const i=e.getRenderableIds().map(t=>e.getTileByID(t)),r=[],n={};for(let o=0;o<i.length;o++){const e=i[o],a=e.tileID.canonical.key;n[a]||(n[a]=!0,e.querySourceFeatures(r,t))}return r}function oR(e,t){const i=e.tileID,r=t.tileID;return i.overscaledZ-r.overscaledZ||i.canonical.y-r.canonical.y||i.wrap-r.wrap||i.canonical.x-r.canonical.x}class aR{constructor(e){this.style=e,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){this.layers=[];const e=!1,t=!1;for(const i in this.style._mergedLayers){const r=this.style._mergedLayers[i];if("fill-extrusion"===r.type||"building"===r.type)this.layers.push({layer:r,visible:e,visibilityChanged:t});else if("model"===r.type){const i=this.style.getLayerSource(r);i&&"batched-model"===i.type&&this.layers.push({layer:r,visible:e,visibilityChanged:t})}}}onNewFrame(e){this.layersGotHidden=!1;for(const t of this.layers){const i=t.layer;let r=!1;"fill-extrusion"===i.type?r=!i.isHidden(e)&&i.paint.get("fill-extrusion-opacity")>0:"building"===i.type?r=!i.isHidden(e)&&i.paint.get("building-opacity")>0:"model"===i.type&&(r=!i.isHidden(e)&&i.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!r&&t.visible,t.visible=r}}updateZOffset(e,t){this.currentBuildingBuckets=[];for(const r of this.layers){const e=r.layer,i=this.style.getLayerSourceCache(e);let n=1;"fill-extrusion"===e.type?n=r.visible?e.paint.get("fill-extrusion-vertical-scale"):0:"building"===e.type&&(n=r.visible?e.paint.get("building-vertical-scale"):0);let o=i?i.getTile(t):null;if(!o&&i)for(const r in i._tiles){const e=i._tiles[r];if(t.canonical.isChildOf(e.tileID.canonical)){o=e;break}}this.currentBuildingBuckets.push({bucket:o?o.getBucket(e):null,tileID:o?o.tileID:t,verticalScale:n})}e.hasAnyZOffset=!1;let i=!1;for(let r=0;r<e.symbolInstances.length;r++){const n=e.symbolInstances.get(r),o=n.zOffset,a=this._getHeightAtTileOffset(t,n.tileAnchorX,n.tileAnchorY);n.zOffset=a!==Number.NEGATIVE_INFINITY?a:o,i||o===n.zOffset||(i=!0),e.hasAnyZOffset||0===n.zOffset||(e.hasAnyZOffset=!0)}i&&(e.zOffsetBuffersNeedUpload=!0,e.zOffsetSortDirty=!0)}hasLayerForSourceCache(e){for(const{layer:t}of this.layers){const i=this.style.getLayerSourceCache(t);if(i&&i.id===e)return!0}return!1}_mapCoordToOverlappingTile(e,t,i,r){let n=t,o=i;if(e.canonical.z!==r.canonical.z){const a=r.canonical,s=1/(1<<e.canonical.z-a.z);n=(t+e.canonical.x*co)*s-a.x*co|0,o=(i+e.canonical.y*co)*s-a.y*co|0}return{tileX:n,tileY:o}}_getHeightAtTileOffset(e,t,i){let r,n;for(let o=0;o<this.layers.length;++o){const a=this.layers[o].layer;if("fill-extrusion"!==a.type&&"building"!==a.type)continue;const{bucket:s,tileID:l,verticalScale:c}=this.currentBuildingBuckets[o];if(!s)continue;const{tileX:u,tileY:h}=this._mapCoordToOverlappingTile(e,t,i,l),d=s.getHeightAtTileCoord(u,h);d&&void 0!==d.height&&(d.hidden?r=d.height:n=Math.max(d.height*c,n||0))}if(void 0!==n)return n;for(let o=0;o<this.layers.length;++o){const n=this.layers[o];if("model"!==n.layer.type||!n.visible)continue;const{bucket:a,tileID:s}=this.currentBuildingBuckets[o];if(!a)continue;const{tileX:l,tileY:c}=this._mapCoordToOverlappingTile(e,t,i,s),u=a.getHeightAtTileCoord(l,c);if(u&&!u.hidden)return void 0===u.height&&void 0!==r?Math.min(u.maxHeight,r)*u.verticalScale:u.height?u.height*u.verticalScale:Number.NEGATIVE_INFINITY}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}let sR;function lR(){return sR||(sR=new uT),sR}var cR=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function uR(e,t){const i={},r=e,n=t,o=i;for(const a in r)"ref"!==a&&(o[a]=r[a]);return cR.forEach(e=>{e in n&&(o[e]=n[e])}),i}function hR(e){e=e.slice();const t=Object.create(null);for(const i of e)t[i.id]=i;for(let i=0;i<e.length;i++){const r=e[i];if(r&&"ref"in r){const n=t[r.ref];n&&(e[i]=uR(r,n))}}return e}class dR{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let i=1;i<this.points.length;i++)this._distances[i]=this._distances[i-1]+this.points[i].dist(this.points[i-1]);this.length=this._distances.at(-1),this.padding=Math.min(t||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(1===this.points.length)return this.points[0];e=ht(e,0,1);let t=1,i=this._distances[t];const r=e*this.paddedLength+this.padding;for(;i<r&&t<this._distances.length;)i=this._distances[++t];const n=t-1,o=this._distances[n],a=i-o,s=a>0?(r-o)/a:0;return this.points[n].mult(1-s).add(this.points[t].mult(s))}}const pR=100;class fR{constructor(e,t){this.gridRightBoundary=0,this.gridBottomBoundary=0,this.clippedSymbols=new Map,this.reset(e,t)}reset(e,t){const i=e.width+200,r=e.height+200;i!==this.gridRightBoundary||r!==this.gridBottomBoundary?(this.grid=new Ps(i,r,25),this.ignoredGrid=new Ps(i,r,25)):(this.grid.clear(),this.ignoredGrid.clear()),this.transform=e,this.fogState=t,this.pitchfactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+pR,this.screenBottomBoundary=e.height+pR,this.gridRightBoundary=i,this.gridBottomBoundary=r,this.clippedSymbols.clear()}clearClippedSymbolsForBucket(e){this.clippedSymbols.delete(e)}markSymbolAsClipped(e,t){let i=this.clippedSymbols.get(e);i||(i=new Set,this.clippedSymbols.set(e,i)),i.add(t)}placeCollisionBox(e,t,i,r,n,o,a,s,l,c,u){let h=i.projectedAnchorX,d=i.projectedAnchorY,p=i.projectedAnchorZ;const f=i.tileAnchorX,m=i.tileAnchorY,_=i.elevation,g=i.tileID,y=e.getProjection();if(_&&g){const[e,t,r]=y.upVector(g.canonical,i.tileAnchorX,i.tileAnchorY),n=y.upVectorScale(g.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;h+=e*_*n,d+=t*_*n,p+=r*_*n}const x="globe"===e.projection.name,v="globe"===e.projection.name?mf(this.transform.zoom):0;if(g&&x&&v<1&&!o){const e=1<<g.canonical.z,t=De(f,m);Re(t,t,1/co),Pe(t,t,De(g.canonical.x,g.canonical.y)),Re(t,t,1/e),Oe(t,t,De(r[0],r[1])),t[0]=pt(t[0],-.5,.5),Re(t,t,co);const i=de(t[0],t[1],co/(2*Math.PI),1);me(i,i,n),h=Wr(h,i[0],v),d=Wr(d,i[1],v),p=Wr(p,i[2],v)}const b=this.projectAndGetPerspectiveRatio(c,h,d,p,i.tileID,"globe"===y.name||!!_||this.transform.pitch>0,y),w=l*b.perspectiveRatio,E=(i.x1*t+a.x-i.padding)*w+b.point.x,A=(i.y1*t+a.y-i.padding)*w+b.point.y,I=(i.x2*t+a.x+i.padding)*w+b.point.x,S=(i.y2*t+a.y+i.padding)*w+b.point.y,T=b.perspectiveRatio<=.55||b.occluded;return!this.isInsideGrid(E,A,I,S)||!s&&this.grid.hitTest(E,A,I,S,u)||T?{box:[],offscreen:!1,occluded:b.occluded}:{box:[E,A,I,S],offscreen:this.isOffscreen(E,A,I,S),occluded:!1}}placeCollisionCircles(e,t,i,r,n,o,a,s,l,c,u,h,d,p,f,m){const _=[],g=this.transform.elevation,y=e.getProjection(),x="road"===e.elevationType,v=!!g||x,b=xm.getAtTileOffsetFunc(m,this.transform.center.lat,this.transform.worldSize,y),w=new ke(i.tileAnchorX,i.tileAnchorY),E=new ke(i.tileAnchorX,i.tileAnchorY);let{x:A,y:I,z:S}=y.projectTilePoint(E.x,E.y,m.canonical),T=null;if(v){T=x&&e.hdExt?e.hdExt.makeRoadSymbolElevationParams(e,e.text,r,m,b,g,y,this.transform.center.lat,this.transform.worldSize):{getElevation:b,elevation:g,elevationFeature:null};const[t,i,n]=T.getElevation(w,g,T.elevationFeature);A+=t,I+=i,S+=n}const D="globe"===y.name,M=this.projectAndGetPerspectiveRatio(s,A,I,S,m,D||!!g||this.transform.pitch>0,y),{perspectiveRatio:P}=M,C=(h?a/P:a*P)/mp,R=Dw(A,I,S,l),z=i.lineOffsetX*C,L=i.lineOffsetY*C,F=nt(e.layers[0].layout.get("text-max-angle")),O=Math.cos(F),B=M.signedDistanceFromCamera>0?Rw(C,o,z,L,x&&1===i.flipState,R,E,i,n,l,{},v&&!h?T:null,h&&v,y,m,h,O):null;let k=!1,V=!1,N=!0;if(B&&!M.occluded){const e=.5*p*P+f,i=new ke(-100,-100),r=new ke(this.screenRightBoundary,this.screenBottomBoundary),n=new dR,{first:o,last:a}=B,s=o.path.length;let l=[];for(let t=s-1;t>=1;t--)l.push(o.path[t]);for(let t=1;t<a.path.length;t++)l.push(a.path[t]);const h=2.5*e;c&&(l=l.map(([e,t,i],r)=>(v&&!D&&(i=T.getElevation(r<s-1?o.tilePath[s-1-r]:a.tilePath[r-s+2],g,T.elevationFeature)[2]),Dw(e,t,i,c))),l.some(e=>e[3]<=0)&&(l=[]));let m=[];if(l.length>0){let e=1/0,t=-1/0,n=1/0,o=-1/0;for(const i of l)e=Math.min(e,i[0]),n=Math.min(n,i[1]),t=Math.max(t,i[0]),o=Math.max(o,i[1]);t>=i.x&&e<=r.x&&o>=i.y&&n<=r.y&&(m=[l.map(e=>new ke(e[0],e[1]))],(e<i.x||t>r.x||n<i.y||o>r.y)&&(m=Sd(m,i.x,i.y,r.x,r.y)))}for(const c of m){n.reset(c,.25*e);let i=0;i=n.length<=.5*e?1:Math.ceil(n.paddedLength/h)+1;for(let r=0;r<i;r++){const o=r/Math.max(i-1,1),a=n.lerp(o),s=a.x+pR,l=a.y+pR;_.push(s,l,e,0);const c=s-e,h=l-e,p=s+e,f=l+e;if(N=N&&this.isOffscreen(c,h,p,f),V=V||this.isInsideGrid(c,h,p,f),!t&&this.grid.hitTestCircle(s,l,e,d)&&(k=!0,!u))return{circles:[],offscreen:!1,collisionDetected:k,occluded:!1}}}}return{circles:!u&&k||!V?[]:_,offscreen:N,collisionDetected:k,occluded:M.occluded}}queryRenderedSymbols(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};const t=[];let i=1/0,r=1/0,n=-1/0,o=-1/0;for(const c of e){const e=new ke(c.x+pR,c.y+pR);i=Math.min(i,e.x),r=Math.min(r,e.y),n=Math.max(n,e.x),o=Math.max(o,e.y),t.push(e)}const a=this.grid.query(i,r,n,o).concat(this.ignoredGrid.query(i,r,n,o)),s={},l={};for(const c of a){const e=c.key;if(void 0===s[e.bucketInstanceId]&&(s[e.bucketInstanceId]={}),s[e.bucketInstanceId][e.featureIndex])continue;const i=this.clippedSymbols.get(e.bucketInstanceId);i&&i.has(e.featureIndex)||ad(t,[new ke(c.x1,c.y1),new ke(c.x2,c.y1),new ke(c.x2,c.y2),new ke(c.x1,c.y2)])&&(s[e.bucketInstanceId][e.featureIndex]=!0,void 0===l[e.bucketInstanceId]&&(l[e.bucketInstanceId]=[]),l[e.bucketInstanceId].push(e.featureIndex))}return l}insertCollisionBox(e,t,i,r,n){(t?this.ignoredGrid:this.grid).insert({bucketInstanceId:i,featureIndex:r,collisionGroupID:n},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,i,r,n){const o=t?this.ignoredGrid:this.grid,a={bucketInstanceId:i,featureIndex:r,collisionGroupID:n};for(let s=0;s<e.length;s+=4)o.insertCircle(a,e[s],e[s+1],e[s+2])}projectAndGetPerspectiveRatio(e,t,i,r,n,o,a){const s=[t,i,r,1];let l=!1;r||this.transform.pitch>0?(me(s,s,e),this.fogState&&n&&"globe"!==a.name&&(l=Em(this.fogState,t,i,r,n.toUnwrapped(),this.transform)>.9)):ym(s,s,e);const c=s[3];return{point:new ke((s[0]/c+1)/2*this.transform.width+pR,(-s[1]/c+1)/2*this.transform.height+pR),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(a)/c*.5,1.5),signedDistanceFromCamera:c,occluded:o&&s[2]>c||l}}isOffscreen(e,t,i,r){return i<pR||e>=this.screenRightBoundary||r<pR||t>this.screenBottomBoundary}isInsideGrid(e,t,i,r){return i>=0&&e<this.gridRightBoundary&&r>=0&&t<this.gridBottomBoundary}getViewportMatrix(){const e=_([]);return v(e,e,[-100,-100,0]),e}}class mR{constructor(e,t,i,r){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):r&&i?1:0,this.placed=i}isHidden(){return 0===this.opacity&&!this.placed}}class _R{constructor(e,t,i,r,n,o=!1){this.text=new mR(e?e.text:null,t,i,n),this.icon=new mR(e?e.icon:null,t,r,n),this.clipped=o}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class gR{constructor(e,t,i,r=!1){this.text=e,this.icon=t,this.skipFade=i,this.clipped=r}}class yR{constructor(){this.invProjMatrix=p(),this.viewportMatrix=p(),this.circles=[]}}class xR{constructor(e,t,i,r,n){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=i,this.bucketIndex=r,this.tileID=n}}class vR{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){const t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:e=>e.collisionGroupID===t}}return this.collisionGroups[e]}}function bR(e,t,i,r,n){const{horizontalAlign:o,verticalAlign:a}=yp(e),s=-(o-.5)*t,l=-(a-.5)*i,c=Mp(e,r);return new ke(s+c[0]*n,l+c[1]*n)}function wR(e,t,i,r,n){const o=new ke(e,t);return i&&o._rotate(r?n:-n),o}function ER(e,t,i,r){const{leftJustifiedTextSymbolIndex:n,centerJustifiedTextSymbolIndex:o,rightJustifiedTextSymbolIndex:a,verticalPlacedTextSymbolIndex:s,crossTileID:l}=i,c=function(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}(t),u=r===gp.vertical?s:"left"===c?n:"center"===c?o:"right"===c?a:-1;n>=0&&(e.text.placedSymbolArray.get(n).crossTileID=u>=0&&n!==u?0:l),o>=0&&(e.text.placedSymbolArray.get(o).crossTileID=u>=0&&o!==u?0:l),a>=0&&(e.text.placedSymbolArray.get(a).crossTileID=u>=0&&a!==u?0:l),s>=0&&(e.text.placedSymbolArray.get(s).crossTileID=u>=0&&s!==u?0:l)}function AR(e,t,i){const r=t===gp.horizontal||t===gp.horizontalOnly?t:0,n=t===gp.vertical?t:0,{leftJustifiedTextSymbolIndex:o,centerJustifiedTextSymbolIndex:a,rightJustifiedTextSymbolIndex:s,verticalPlacedTextSymbolIndex:l}=i,c=e.text.placedSymbolArray;o>=0&&(c.get(o).placedOrientation=r),a>=0&&(c.get(a).placedOrientation=r),s>=0&&(c.get(s).placedOrientation=r),l>=0&&(c.get(l).placedOrientation=n)}class IR{constructor(e,t,i,r,n,o,a){this.transform=e.clone(),this.projection=e.projection.name,a instanceof fR?(a.reset(this.transform,n),this.collisionIndex=a):this.collisionIndex=new fR(this.transform,n),this.buildingIndex=o,this.frontCutoff
vendor: 13,150 bytes, line 2
2Start=0,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=t,this.retainedQueryData={},this.collisionGroups=new vR(i),this.collisionCircleArrays={},this.prevPlacement=r,r&&(r.prevPlacement=void 0),this.placedOrientations={},this.lastReplacementSourceUpdateTime=0}getBucketParts(e,t,i,r,n=1){const o=i.getBucket(t),a=i.latestFeatureIndex;if(!o||!a||t.fqid!==o.layerIds[0])return;const s=o.layers[0].layout,l=o.layers[0].paint,c=i.collisionBoxArray,u=Math.pow(2,this.transform.zoom-i.tileID.overscaledZ),h=i.tileSize/co,d=i.tileID.toUnwrapped();this.transform.setProjection(o.projection);const p=Mm(i.tileID,o.getProjection(),this.transform,this.projection),f="map"===s.get("text-pitch-alignment"),m="map"===s.get("text-rotation-alignment");t.compileFilter(t.options);const _=t.dynamicFilter(),g=t.dynamicFilterNeedsFeature(),y=t.dynamicFilterNeedsGeometry(),v=this.transform.calculatePixelsToTileUnitsMatrix(i),b=Sw(p,i.tileID.canonical,f,m,this.transform,o.getProjection(),v);let w=null;const E=o.getProjection().createInversionMatrix(this.transform,i.tileID.canonical);if(f){const e=Tw(p,i.tileID.canonical,f,m,this.transform,o.getProjection(),v);w=x([],this.transform.labelPlaneMatrix,e)}let A=null;_&&i.latestFeatureIndex&&(A={unwrappedTileID:d,dynamicFilter:_,dynamicFilterNeedsFeature:g,needGeometry:y}),this.retainedQueryData[o.bucketInstanceId]=new xR(o.bucketInstanceId,a,o.sourceLayerIndex,o.index,i.tileID);const[I,S]=o.layers[0].layout.get("text-size-scale-range"),T=ht(n,I,S),[D,M]=s.get("icon-size-scale-range"),P=ht(n,D,M),C={bucket:o,layout:s,paint:l,posMatrix:p,invMatrix:E,mercatorCenter:[Wn(this.transform.center.lng),qn(this.transform.center.lat)],textLabelPlaneMatrix:b,labelToScreenMatrix:w,clippingData:A,scale:u,textPixelRatio:h,holdingForFade:i.holdingForFade(),collisionBoxArray:c,partiallyEvaluatedTextSize:Ip(o.textSizeData,this.transform.zoom,T),partiallyEvaluatedIconSize:Ip(o.iconSizeData,this.transform.zoom,P),collisionGroup:this.collisionGroups.get(o.sourceID),latestFeatureIndex:i.latestFeatureIndex};if(r)for(const x of o.sortKeyRanges){const{sortKey:t,symbolInstanceStart:i,symbolInstanceEnd:r}=x;e.push({sortKey:t,symbolInstanceStart:i,symbolInstanceEnd:r,parameters:C})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:C})}placeLayerBucketPart(e,t,i,r=1){const{bucket:n,layout:o,paint:a,posMatrix:s,textLabelPlaneMatrix:l,labelToScreenMatrix:c,clippingData:u,textPixelRatio:h,mercatorCenter:d,invMatrix:p,holdingForFade:f,collisionBoxArray:m,partiallyEvaluatedTextSize:_,partiallyEvaluatedIconSize:g,collisionGroup:x,latestFeatureIndex:v}=e.parameters,b=o.get("text-optional"),w=o.get("icon-optional"),E=o.get("text-allow-overlap"),A=o.get("icon-allow-overlap"),I="map"===o.get("text-rotation-alignment"),S="map"===o.get("icon-rotation-alignment"),T="map"===o.get("text-pitch-alignment"),D=a.get("symbol-z-offset"),M="sea"===o.get("symbol-elevation-reference"),P=o.get("symbol-placement"),C=o.get("text-variable-anchor"),R=I&&"point"!==P,z=S&&"point"!==P,L=C&&n.hasTextData(),F=n.hasIconTextFit()&&L&&n.hasIconData();this.transform.setProjection(n.projection);const O=L||R,B=z||F;let k=E&&(A||!n.hasIconData()||w),V=A&&(E||!n.hasTextData()||b);const N=!D.isConstant();!n.collisionArrays&&m&&n.deserializeCollisionBoxes(m);const U=(e,r,a)=>{const{crossTileID:m,numVerticalGlyphVertices:y}=e;let S=null;if(u&&u.dynamicFilterNeedsFeature||N){const t=this.retainedQueryData[n.bucketInstanceId],i=v.loadFeature({featureIndex:e.featureIndex,bucketIndex:t.bucketIndex,sourceLayerIndex:t.sourceLayerIndex,layoutVertexArrayOffset:0}),r=i.properties?i.properties.worldview:null;if(n.localizable&&n.worldview&&"string"==typeof r)if("all"===r)i.properties.$localized=!0;else{if(!r.split(",").includes(n.worldview))return;i.properties.$localized=!0,i.properties.worldview=n.worldview}S=u&&u.needGeometry?ru(i,!0):i}if(u&&!(0,u.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch,worldview:n.worldview},S,this.retainedQueryData[n.bucketInstanceId].tileID.canonical,new ke(e.tileAnchorX,e.tileAnchorY),this.transform.calculateDistanceTileData(u.unwrappedTileID)))return this.placements[m]=new gR(!1,!1,!1,!0),void t.add(m);const P=D.evaluate(S,{});if((e.zOffset||0)+(P||0)>0&&this.frontCutoffStart>0){const i=2*this.frontCutoffStart-1,r=[e.tileAnchorX,e.tileAnchorY,0,1],n=me(he(),r,s);if(n[1]/n[3]<i)return this.placements[m]=new gR(!1,!1,!1,!0),void t.add(m)}if(t.has(m))return;if(f)return void(this.placements[m]=new gR(!1,!1,!1));let R=!1,z=!1,L=!0,F=!1,U=!1,j=null,G={box:null,offscreen:null,occluded:null},H={box:null},$=null,W=null,q=null,Z=0,X=0,Y=0;a.textFeatureIndex?Z=a.textFeatureIndex:e.useRuntimeCollisionCircles&&(Z=e.featureIndex),a.verticalTextFeatureIndex&&(X=a.verticalTextFeatureIndex);const K=t=>{t.tileID=this.retainedQueryData[n.bucketInstanceId].tileID;const i=this.transform.elevation;if("road"===n.elevationType)t.elevation=M?P:P+xm.getAtTileOffset(t.tileID,new ke(t.tileAnchorX,t.tileAnchorY),i,null);else{const r=n.hdExt?n.hdExt.elevationFeatures[e.elevationFeatureIndex]:void 0;t.elevation=M?P:P+xm.getAtTileOffset(t.tileID,new ke(t.tileAnchorX,t.tileAnchorY),i,r)}t.elevation+=e.zOffset},J=a.textBox;if(J){K(J);const t=t=>{let i=gp.horizontal;if(n.allowVerticalPlacement&&!t&&this.prevPlacement){const t=this.prevPlacement.placedOrientations[m];t&&(this.placedOrientations[m]=t,i=t,AR(n,i,e))}return i},i=(e,t)=>{if(n.allowVerticalPlacement&&y>0&&a.verticalTextBox){for(const i of n.writingModes)if(i===gp.vertical?(G=t(),H=G):G=e(),G&&G.box&&G.box.length)break}else G=e()};if(C){let o=C;if(this.prevPlacement&&this.prevPlacement.variableOffsets[m]){const e=this.prevPlacement.variableOffsets[m];o.indexOf(e.anchor)>0&&(o=o.filter(t=>t!==e.anchor),o.unshift(e.anchor))}const l=(t,i,a)=>{const l=n.getSymbolInstanceTextSize(_,e,this.transform.zoom,r),c=(t.x2-t.x1)*l+2*t.padding,u=(t.y2-t.y1)*l+2*t.padding,f=e.hasIconTextFit&&!A?i:null;f&&K(f);let m={box:[],offscreen:!1,occluded:!1};const y=E?2*o.length:o.length;for(let v=0;v<y;++v){const i=this.attemptAnchorPlacement(o[v%o.length],t,d,p,O,c,u,l,I,T,h,s,x,v>=o.length,e,r,n,a,f,_,g);if(i&&(m=i.placedGlyphBoxes,m&&m.box&&m.box.length)){R=!0,j=i.shift;break}}return m};i(()=>l(J,a.iconBox,gp.horizontal),()=>{const e=a.verticalTextBox;return e&&K(e),n.allowVerticalPlacement&&!(G&&G.box&&G.box.length)&&y>0&&e?l(e,a.verticalIconBox,gp.vertical):{box:null,offscreen:null,occluded:null}}),G&&(R=G.box,L=G.offscreen,F=G.occluded);const c=t(!(!G||!G.box));if(!R&&this.prevPlacement){const t=this.prevPlacement.variableOffsets[m];t&&(this.variableOffsets[m]=t,ER(n,t.anchor,e,c))}}else{const o=(t,i)=>{const o=n.getSymbolInstanceTextSize(_,e,this.transform.zoom,r),a=this.collisionIndex.placeCollisionBox(n,o,t,d,p,O,new ke(0,0),E,h,s,x.predicate);return a&&a.box&&a.box.length&&(AR(n,i,e),this.placedOrientations[m]=i),a};i(()=>o(J,gp.horizontal),()=>{const e=a.verticalTextBox;return n.allowVerticalPlacement&&y>0&&e?(K(e),o(e,gp.vertical)):{box:null,offscreen:null,occluded:null}}),t(!!(G&&G.box&&G.box.length))}}if($=G,R=$&&$.box&&$.box.length>0,L=$&&$.offscreen,F=$&&$.occluded,e.useRuntimeCollisionCircles){const t=e.centerJustifiedTextSymbolIndex>=0?e.centerJustifiedTextSymbolIndex:e.verticalPlacedTextSymbolIndex,r=n.text.placedSymbolArray.get(t),a=Ap(n.textSizeData,_,r),u=o.get("text-padding");W=this.collisionIndex.placeCollisionCircles(n,E,r,t,n.lineVertexArray,n.glyphOffsetArray,a,s,l,c,i,T,x.predicate,e.collisionCircleDiameter*a/mp,u,this.retainedQueryData[n.bucketInstanceId].tileID),R=E||W.circles.length>0&&!W.collisionDetected,L=L&&W.offscreen,F=W.occluded}if(a.iconFeatureIndex&&(Y=a.iconFeatureIndex),a.iconBox){const t=t=>{K(t);const i=e.hasIconTextFit&&j?wR(j.x,j.y,I,T,this.transform.angle):new ke(0,0),r=n.getSymbolInstanceIconSize(g,this.transform.zoom,e.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(n,r,t,d,p,B,i,A,h,s,x.predicate)};H&&H.box&&H.box.length&&a.verticalIconBox?(q=t(a.verticalIconBox),z=q.box.length>0):(q=t(a.iconBox),z=q.box.length>0),L=L&&q.offscreen,U=q.occluded}const Q=b||0===e.numHorizontalGlyphVertices&&0===y,ee=w||0===e.numIconVertices;if(Q||ee?ee?Q||(z=z&&R):R=z&&R:z=R=z&&R,R&&$&&$.box&&this.collisionIndex.insertCollisionBox($.box,o.get("text-ignore-placement"),n.bucketInstanceId,H&&H.box&&X?X:Z,x.ID),z&&q&&this.collisionIndex.insertCollisionBox(q.box,o.get("icon-ignore-placement"),n.bucketInstanceId,Y,x.ID),W&&(R&&this.collisionIndex.insertCollisionCircles(W.circles,o.get("text-ignore-placement"),n.bucketInstanceId,Z,x.ID),i)){const e=n.bucketInstanceId;let t=this.collisionCircleArrays[e];void 0===t&&(t=this.collisionCircleArrays[e]=new yR);for(let i=0;i<W.circles.length;i+=4)t.circles.push(W.circles[i+0]),t.circles.push(W.circles[i+1]),t.circles.push(W.circles[i+2]),t.circles.push(W.collisionDetected?1:0)}const te="globe"!==n.projection.name;k=k&&(te||!F),V=V&&(te||!U),this.placements[m]=new gR(R||k,z||V,L||n.justReloaded),t.add(m)},j=this.retainedQueryData[n.bucketInstanceId].tileID;if("offset"===n.elevationType&&this.buildingIndex&&this.buildingIndex.updateZOffset(n,j),"road"===n.elevationType&&n.hdExt&&n.hdExt.updateRoadElevation(n,j.canonical),n.updateZOffset(),n.sortFeaturesByY){const e=n.getSortedSymbolIndexes(this.transform.angle);for(let t=e.length-1;t>=0;--t){const i=e[t];U(n.symbolInstances.get(i),i,n.collisionArrays[i])}n.hasAnyZOffset&&Tt(`${n.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(n.hasAnyZOffset){const e=n.getSortedIndexesByZOffset();for(let t=0;t<e.length;++t){const i=e[t];U(n.symbolInstances.get(i),i,n.collisionArrays[i])}}else for(let y=e.symbolInstanceStart;y<e.symbolInstanceEnd;y++)U(n.symbolInstances.get(y),y,n.collisionArrays[y]);if(i&&n.bucketInstanceId in this.collisionCircleArrays){const e=this.collisionCircleArrays[n.bucketInstanceId];y(e.invProjMatrix,s),e.viewportMatrix=this.collisionIndex.getViewportMatrix()}n.justReloaded=!1}attemptAnchorPlacement(e,t,i,r,n,o,a,s,l,c,u,h,d,p,f,m,_,g,y,x,v){const{textOffset0:b,textOffset1:w,crossTileID:E}=f,A=[b,w],I=bR(e,o,a,A,s),S=this.collisionIndex.placeCollisionBox(_,s,t,i,r,n,wR(I.x,I.y,l,c,this.transform.angle),p,u,h,d.predicate);if(y){const e=_.getSymbolInstanceIconSize(v,this.transform.zoom,f.placedIconSymbolIndex);if(0===this.collisionIndex.placeCollisionBox(_,e,y,i,r,n,wR(I.x,I.y,l,c,this.transform.angle),p,u,h,d.predicate).box.length)return}if(S.box.length>0){let t;return this.prevPlacement&&this.prevPlacement.variableOffsets[E]&&this.prevPlacement.placements[E]&&this.prevPlacement.placements[E].text&&(t=this.prevPlacement.variableOffsets[E].anchor),this.variableOffsets[E]={textOffset:A,width:o,height:a,anchor:e,textScale:s,prevAnchor:t},ER(_,e,f,g),_.allowVerticalPlacement&&(AR(_,g,f),this.placedOrientations[E]=g),{shift:I,placedGlyphBoxes:S}}}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const t=this.prevPlacement;let i=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;const r=t?t.symbolFadeChange(e):1,n=t?t.opacities:{},o=t?t.variableOffsets:{},a=t?t.placedOrientations:{};for(const s in this.placements){const e=this.placements[s],t=n[s];t?(this.opacities[s]=new _R(t,r,e.text,e.icon,null,e.clipped),i=i||e.text!==t.text.placed||e.icon!==t.icon.placed):(this.opacities[s]=new _R(null,r,e.text,e.icon,e.skipFade,e.clipped),i=i||e.text||e.icon)}for(const s in n){const e=n[s];if(!this.opacities[s]){const t=new _R(e,r,!1,!1);t.isHidden()||(this.opacities[s]=t,i=i||e.text.placed||e.icon.placed)}}for(const s in o)this.variableOffsets[s]||!this.opacities[s]||this.opacities[s].isHidden()||(this.variableOffsets[s]=o[s]);for(const s in a)this.placedOrientations[s]||!this.opacities[s]||this.opacities[s].isHidden()||(this.placedOrientations[s]=a[s]);i?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t,i,r,n=!1,o=1){r&&(this.lastReplacementSourceUpdateTime=r.updateTime);const a=new Set;for(const s of t){const t=s.getBucket(e);if(t&&s.latestFeatureIndex&&e.fqid===t.layerIds[0]&&(this.updateBucketOpacities(t,a,s,s.collisionBoxArray,i,r,s.tileID,e.scope),"offset"===t.elevationType&&this.buildingIndex&&this.buildingIndex.updateZOffset(t,s.tileID),"road"===t.elevationType&&t.hdExt&&t.hdExt.updateRoadElevation(t,s.tileID.canonical),t.updateZOffset(),n&&s.collisionBoxArray)){const e=t.layers[0].layout,[i,r]=e.get("text-size-scale-range"),[n,a]=e.get("icon-size-scale-range"),l=ht(o,i,r),c=ht(o,n,a);t.updateCollisionDebugBuffers(this.transform.zoom,s.collisionBoxArray,l,c)}}}updateBucketOpacities(e,t,i,r,n,o,a,s){e.hasTextData()&&e.text.opacityVertexArray.clear(),e.hasIconData()&&e.icon.opacityVertexArray.clear(),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const l=e.layers[0].layout,c=e.layers[0].paint,u=!!e.layers[0].dynamicFilter(),h=new _R(null,0,!1,!1,
vendor: 33,839 bytes, line 2
2!0),d=l.get("text-allow-overlap"),p=l.get("icon-allow-overlap"),f=l.get("text-variable-anchor"),m="map"===l.get("text-rotation-alignment"),_="map"===l.get("text-pitch-alignment"),g=c.get("symbol-z-offset"),y="sea"===l.get("symbol-elevation-reference"),x=!g.isConstant(),v=new _R(null,0,d&&(p||!e.hasIconData()||l.get("icon-optional")),p&&(d||!e.hasTextData()||l.get("text-optional")),!0);!e.collisionArrays&&r&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(r);const b=(e,t,i)=>{for(let r=0;r<t/4;r++)e.opacityVertexArray.emplaceBack(i)};let w=0;o&&e.updateReplacement(a,o),this.collisionIndex.clearClippedSymbolsForBucket(e.bucketInstanceId);for(let E=0;E<e.symbolInstances.length;E++){const r=e.symbolInstances.get(E),{numHorizontalGlyphVertices:l,numVerticalGlyphVertices:c,crossTileID:d,numIconVertices:p,tileAnchorX:A,tileAnchorY:I}=r;let S=null;const T=this.retainedQueryData[e.bucketInstanceId];x&&r&&T&&(S=i.latestFeatureIndex.loadFeature({featureIndex:r.featureIndex,bucketIndex:T.bucketIndex,sourceLayerIndex:T.sourceLayerIndex,layoutVertexArrayOffset:0}));const D=g.evaluate(S,{}),M=t.has(d);let P=this.opacities[d];M?P=h:P||(P=v,this.opacities[d]=P),t.add(d);const C=l>0||c>0,R=p>0,z=this.placedOrientations[d],L=z===gp.vertical,F=z===gp.horizontal||z===gp.horizontalOnly;!C&&!R||P.isHidden()||w++;let O=!1;if((C||R)&&o)for(const t of e.activeReplacements)if(!am(t,n,2,s)&&!(t.min.x>A||A>t.max.x||t.min.y>I||I>t.max.y)&&(O=gm(_m(A,I,a.canonical,t.footprintTileId.canonical),t.footprint),O))break;if(O&&this.collisionIndex.markSymbolAsClipped(e.bucketInstanceId,r.featureIndex),C){const t=O?FR:LR(P.text);b(e.text,l,L?FR:t),b(e.text,c,F?FR:t);const i=P.text.isHidden(),{leftJustifiedTextSymbolIndex:n,centerJustifiedTextSymbolIndex:o,rightJustifiedTextSymbolIndex:a,verticalPlacedTextSymbolIndex:s}=r,u=e.text.placedSymbolArray,h=i||L?1:0;n>=0&&(u.get(n).hidden=h),o>=0&&(u.get(o).hidden=h),a>=0&&(u.get(a).hidden=h),s>=0&&(u.get(s).hidden=i||F?1:0);const p=this.variableOffsets[d];p&&ER(e,p.anchor,r,z);const f=this.placedOrientations[d];f&&(ER(e,"left",r,f),AR(e,f,r))}if(R){const t=O?FR:LR(P.icon),{placedIconSymbolIndex:i,verticalPlacedIconSymbolIndex:n}=r,o=e.icon.placedSymbolArray,a=P.icon.isHidden()?1:0;i>=0&&(b(e.icon,p,L?FR:t),o.get(i).hidden=a),n>=0&&(b(e.icon,r.numVerticalIconVertices,F?FR:t),o.get(n).hidden=a)}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const t=e.collisionArrays[E];if(t){let i=new ke(0,0),n=!0;if(t.textBox||t.verticalTextBox){if(f){const e=this.variableOffsets[d];e?(i=bR(e.anchor,e.width,e.height,e.textOffset,e.textScale),m&&i._rotate(_?this.transform.angle:-this.transform.angle)):n=!1}u&&(n=!P.clipped),t.textBox&&SR(e.textCollisionBox.collisionVertexArray,P.text.placed,!n||L,D,y,i.x,i.y),t.verticalTextBox&&SR(e.textCollisionBox.collisionVertexArray,P.text.placed,!n||F,D,y,i.x,i.y)}const o=n&&Boolean(!F&&t.verticalIconBox);t.iconBox&&SR(e.iconCollisionBox.collisionVertexArray,P.icon.placed,o,D,y,r.hasIconTextFit?i.x:0,r.hasIconTextFit?i.y:0),t.verticalIconBox&&SR(e.iconCollisionBox.collisionVertexArray,P.icon.placed,!o,D,y,r.hasIconTextFit?i.x:0,r.hasIconTextFit?i.y:0)}}}if(e.fullyClipped=0===w,e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.bucketInstanceId in this.collisionCircleArrays){const t=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=t.invProjMatrix,e.placementViewportMatrix=t.viewportMatrix,e.collisionCircleArray=t.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}}symbolFadeChange(e){return 0===this.fadeDuration?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t){const i=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*i>e}isStale(){return this.stale}setStale(){this.stale=!0}}function SR(e,t,i,r,n,o,a){e.emplaceBack(t?1:0,i?1:0,o||0,a||0,r,n?1:0),e.emplaceBack(t?1:0,i?1:0,o||0,a||0,r,n?1:0),e.emplaceBack(t?1:0,i?1:0,o||0,a||0,r,n?1:0),e.emplaceBack(t?1:0,i?1:0,o||0,a||0,r,n?1:0)}const TR=Math.pow(2,25),DR=Math.pow(2,24),MR=Math.pow(2,17),PR=Math.pow(2,16),CR=Math.pow(2,9),RR=Math.pow(2,8),zR=Math.pow(2,1);function LR(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 4294967295;const t=e.placed?1:0,i=Math.floor(127*e.opacity);return i*TR+t*DR+i*MR+t*PR+i*CR+t*RR+i*zR+t}const FR=0;class OR{constructor(e){this._sortAcrossTiles="viewport-y"!==e.layout.get("symbol-z-order")&&void 0!==e.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(e,t,i,r,n,o){const a=this._bucketParts;for(;this._currentTileIndex<e.length;)if(t.getBucketParts(a,r,e[this._currentTileIndex],this._sortAcrossTiles,o),this._currentTileIndex++,n())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,a.sort((e,t)=>e.sortKey-t.sortKey));this._currentPartIndex<a.length;)if(t.placeLayerBucketPart(a[this._currentPartIndex],this._seenCrossTileIDs,i,o),this._currentPartIndex++,n())return!0;return!1}}class BR{constructor(){this._retiredCI=null}startNewPlacement(e,t,i,r,n,o,a,s){return this.placement=new IR(e,r,n,o,a,s,this._retiredCI),this._retiredCI=null,this._currentPlacementIndex=t.length-1,this._forceFullPlacement=!1,this._showCollisionBoxes=i,this._fadeDuration=r,this._done=!1,this._inProgressLayer=null,this}requestFullPlacement(){this._forceFullPlacement=!0}isFullPlacementRequested(){return this._forceFullPlacement}setStale(){this.placement&&(this.placement.stale=!0)}isStale(){return!!this.placement&&this.placement.stale}isDone(){return this._done}continuePlacement(e,t,i,r,n){const o=ei.now(),a=()=>!this.isFullPlacementRequested()&&0!==this._fadeDuration&&ei.now()-o>2;for(;this._currentPlacementIndex>=0;){const o=t[e[this._currentPlacementIndex]],s=this.placement.collisionIndex.transform.zoom;if("symbol"===o.type&&"none"!==o.visibility&&(!o.minzoom||o.minzoom<=s)&&(!o.maxzoom||o.maxzoom>s)){const e=o,t=e.layout.get("symbol-z-elevate"),s=void 0!==e.layout.get("symbol-sort-key").constantOr(1),l=e.layout.get("symbol-z-order"),c="viewport-y"===l||"auto"===l&&!("viewport-y"!==l&&s),u=e.layout.get("text-allow-overlap")||e.layout.get("icon-allow-overlap")||e.layout.get("text-ignore-placement")||e.layout.get("icon-ignore-placement"),h=c&&u,d=this._inProgressLayer=this._inProgressLayer||new OR(e),p=Ul(o.source,o.scope);if(d.continuePlacement(t||h?r[p]:i[p],this.placement,this._showCollisionBoxes,o,a,n))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._forceFullPlacement=!1,this._done=!0}commit(e){return this._retiredCI=this.placement.prevPlacement?this.placement.prevPlacement.collisionIndex:null,this.placement.commit(e),this.placement}}const kR=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],VR=new Uint32Array(96);class NR{static from(e){if(!e||void 0===e.byteLength||e.buffer)throw new Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");const[t,i]=new Uint8Array(e,0,2);if(219!==t)throw new Error("Data does not appear to be in a KDBush format.");const r=i>>4;if(1!==r)throw new Error(`Got v${r} data when expected v1.`);const n=kR[15&i];if(!n)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(e,2,1),[a]=new Uint32Array(e,4,1);return new NR(a,o,n,void 0,e)}constructor(e,t=64,i=Float64Array,r=ArrayBuffer,n){if(isNaN(e)||e<0)throw new Error(`Unexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const o=kR.indexOf(this.ArrayType),a=2*e*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-s%8)%8;if(o<0)throw new Error(`Unexpected typed array class: ${i}.`);if(n)this.data=n,this.ids=new this.IndexArrayType(n,8,e),this.coords=new i(n,8+s+l,2*e),this._pos=2*e,this._finished=!0;else{const n=this.data=new r(8+a+s+l);this.ids=new this.IndexArrayType(n,8,e),this.coords=new i(n,8+s+l,2*e),this._pos=0,this._finished=!1,new Uint8Array(n,0,2).set([219,16+o]),new Uint16Array(n,2,1)[0]=t,new Uint32Array(n,4,1)[0]=e}}add(e,t){const i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=t,i}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return UR(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,i,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:o,nodeSize:a}=this;VR[0]=0,VR[1]=n.length-1,VR[2]=0;let s=3;const l=[];for(;s>0;){const c=VR[--s],u=VR[--s],h=VR[--s];if(u-h<=a){for(let a=h;a<=u;a++){const s=o[2*a],c=o[2*a+1];s>=e&&s<=i&&c>=t&&c<=r&&l.push(n[a])}continue}const d=h+u>>1,p=o[2*d],f=o[2*d+1];p>=e&&p<=i&&f>=t&&f<=r&&l.push(n[d]),(0===c?e<=p:t<=f)&&(VR[s++]=h,VR[s++]=d-1,VR[s++]=1-c),(0===c?i>=p:r>=f)&&(VR[s++]=d+1,VR[s++]=u,VR[s++]=1-c)}return l}within(e,t,i){const r=[];return this.withinInto(e,t,i,r),r}withinInto(e,t,i,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:o,nodeSize:a}=this;VR[0]=0,VR[1]=n.length-1,VR[2]=0;let s=3,l=0;const c=i*i;for(;s>0;){const u=VR[--s],h=VR[--s],d=VR[--s];if(h-d<=a){for(let i=d;i<=h;i++)$R(o[2*i],o[2*i+1],e,t)<=c&&(r[l++]=n[i]);continue}const p=d+h>>1,f=o[2*p],m=o[2*p+1];$R(f,m,e,t)<=c&&(r[l++]=n[p]),(0===u?e-i<=f:t-i<=m)&&(VR[s++]=d,VR[s++]=p-1,VR[s++]=1-u),(0===u?e+i>=f:t+i>=m)&&(VR[s++]=p+1,VR[s++]=h,VR[s++]=1-u)}return l}}function UR(e,t,i,r,n,o){if(n-r<=i)return;const a=r+n>>1;jR(e,t,a,r,n,o),UR(e,t,i,r,a-1,1-o),UR(e,t,i,a+1,n,1-o)}function jR(e,t,i,r,n,o){for(;n>r;){if(n-r>600){const a=n-r+1,s=i-r+1,l=Math.log(a),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(a-c)/a)*(s-a/2<0?-1:1);jR(e,t,i,Math.max(r,Math.floor(i-s*c/a+u)),Math.min(n,Math.floor(i+(a-s)*c/a+u)),o)}const a=t[2*i+o];let s=r,l=n;for(GR(e,t,r,i),t[2*n+o]>a&&GR(e,t,r,n);s<l;){for(GR(e,t,s,l),s++,l--;t[2*s+o]<a;)s++;for(;t[2*l+o]>a;)l--}t[2*r+o]===a?GR(e,t,r,l):(l++,GR(e,t,l,n)),l<=i&&(r=l+1),i<=l&&(n=l-1)}}function GR(e,t,i,r){HR(e,i,r),HR(t,2*i,2*r),HR(t,2*i+1,2*r+1)}function HR(e,t,i){const r=e[t];e[t]=e[i],e[i]=r}function $R(e,t,i,r){const n=e-i,o=t-r;return n*n+o*o}const WR=.03125;class qR{constructor(e,t,i){this.tileID=e,this.bucketInstanceId=i,this.index=new NR(t.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const r=e.canonical.x*co,n=e.canonical.y*co;for(let o=0;o<t.length;o++){const{key:e,crossTileID:i,tileAnchorX:a,tileAnchorY:s}=t.get(o),l=Math.floor((r+a)*WR),c=Math.floor((n+s)*WR);this.index.add(l,c),this.keys.push(e),this.crossTileIDs.push(i)}this.index.finish()}findMatches(e,t,i){const r=this.tileID.canonical.z<t.canonical.z?1:Math.pow(2,this.tileID.canonical.z-t.canonical.z),n=WR/Math.pow(2,t.canonical.z-this.tileID.canonical.z),o=t.canonical.x*co,a=t.canonical.y*co;for(let s=0;s<e.length;s++){const t=e.get(s);if(t.crossTileID)continue;const{key:l,tileAnchorX:c,tileAnchorY:u}=t,h=Math.floor((o+c)*n),d=Math.floor((a+u)*n),p=this.index.range(h-r,d-r,h+r,d+r).sort((e,t)=>e-t);for(const e of p){const r=this.crossTileIDs[e];if(this.keys[e]===l&&!i.has(r)){i.add(r),t.crossTileID=r;break}}}}}class ZR{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class XR{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const t=Math.round((e-this.lng)/360);if(0!==t)for(const i in this.indexes){const e=this.indexes[i],r={};for(const i in e){const n=e[i];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+t),r[n.tileID.key]=n}this.indexes[i]=r}this.lng=e}addBucket(e,t,i){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let n=0;n<t.symbolInstances.length;n++)t.symbolInstances.get(n).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]=new Set);const r=this.usedCrossTileIDs[e.overscaledZ];for(const n in this.indexes){const i=this.indexes[n];if(Number(n)>e.overscaledZ)for(const n in i){const o=i[n];o.tileID.isChildOf(e)&&o.findMatches(t.symbolInstances,e,r)}else{const o=i[e.scaledTo(Number(n)).key];o&&o.findMatches(t.symbolInstances,e,r)}}for(let n=0;n<t.symbolInstances.length;n++){const e=t.symbolInstances.get(n);e.crossTileID||(e.crossTileID=i.generate(),r.add(e.crossTileID))}return void 0===this.indexes[e.overscaledZ]&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new qR(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(const i of t.crossTileIDs)this.usedCrossTileIDs[e].delete(i)}removeStaleBuckets(e){let t=!1;for(const i in this.indexes){const r=this.indexes[i];for(const n in r)e[r[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,r[n]),delete r[n],t=!0)}return t}}class YR{constructor(){this.layerIndexes={},this.crossTileIDs=new ZR,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,i,r){let n=this.layerIndexes[e.fqid];void 0===n&&(n=this.layerIndexes[e.fqid]=new XR);let o=!1;const a={};"globe"!==r.name&&n.handleWrapJump(i);for(const s of t){const t=s.getBucket(e);t&&e.fqid===t.layerIds[0]&&(t.bucketInstanceId||(t.bucketInstanceId=++this.maxBucketInstanceId),n.addBucket(s.tileID,t,this.crossTileIDs)&&(o=!0),a[t.bucketInstanceId]=!0)}return n.removeStaleBuckets(a)&&(o=!0),o}pruneUnusedLayers(e){const t={};e.forEach(e=>{t[e]=!0});for(const i in this.layerIndexes)t[i]||delete this.layerIndexes[i]}}function KR(e,t){const i=(t.right-t.left)/2,r=Math.abs(e.x-(t.left+i));if(r>=e.radius+i)return!1;const n=(t.bottom-t.top)/2,o=Math.abs(e.y-(t.top+n));if(o>=e.radius+n)return!1;if(r<i||o<n)return!0;const a=r-i,s=o-n;return a*a+s*s<e.radius*e.radius}function JR(e,t){return"box"===e.kind&&"box"===t.kind?function(e,t){return e.left<t.right&&t.left<e.right&&e.top<t.bottom&&t.top<e.bottom}(e,t):"circle"===e.kind&&"circle"===t.kind?function(e,t){const i=e.x-t.x,r=e.y-t.y,n=e.radius+t.radius;return i*i+r*r<n*n}(e,t):"circle"===e.kind?KR(e,t):KR(t,e)}class QR{constructor(e,t,i,r){this._cellSize=r,this._padding=i,this._screenWidth=e,this._screenHeight=t,this._grid=new Ps(e+2*i,t+2*i,r),this._workingArea=this._computeWorkingArea(),this._geometries=[],this._geometryData=[]}clearAndResize(e,t){e===this._screenWidth&&t===this._screenHeight?this._grid.clear():(this._screenWidth=e,this._screenHeight=t,this._grid=new Ps(e+2*this._padding,t+2*this._padding,this._cellSize),this._workingArea=this._computeWorkingArea()),this._geometries.length=0,this._geometryData.length=0}_computeWorkingArea(){return{kind:"box",left:-this._padding,top:-this._padding,right:this._grid.xCellCount*this._cellSize-this._padding,bottom:this._grid.yCellCount*this._cellSize-this._padding}}intersects(e,t,i){let r="outside-of-grid";for(const n of e){const e=this._elementIntersects(n,t,i);if("intersects"===e)return"intersects";"does-not-intersect"===e&&(r="does-not-intersect")}return r}_elementIntersects(e,t,i){if(!JR(e,this._workingArea))return"outside-of-grid";const r=this._padding,n=function(e,t){return 0===t?e:"box"===e.kind?{kind:"box",left:e.left-t,top:e.top-t,right:e.right+t,bottom:e.bottom+t}:{kind:"circle",x:e.x,y:e.y,radius:e.radius+t}}(e,t),o=e=>{if(!JR(this._geometries[e],n))return!1;const t=this._geometryData[e];return void 0===t||!i(t)};return("box"===n.kind?this._grid.hitTest(n.left+r,n.top+r,n.right+r,n.bottom+r,o):this._grid.hitTestCircle(n.x+r,n.y+r,n.radius,o))?"intersects":"does-not-intersect"}insert(e,t){const i=this._padding;let r=!1;for(const n of e){if(!JR(n,this._workingArea))continue;const e=this._geometries.length;this._geometries.push(n),this._geometryData.push(t),"box"===n.kind?this._grid.insert(e,n.left+i,n.top+i,n.right+i,n.bottom+i):this._grid.insertCircle(e,n.x+i,n.y+i,n.radius),r=!0}return r}}function ez(e){return 2*e.styleLayerId+e.symbolIdOrigin}function tz(e,t){const i=e.get(ez(t.symbolId));if(!i)return!1;const r=i.get(t.symbolId.symbolId);return void 0!==r&&r.has(t.variantIdx)}function iz(e,t){const i=ez(t.symbolId);let r=e.get(i);r||(r=new Map,e.set(i,r));let n=r.get(t.symbolId.symbolId);n||(n=new Set,r.set(t.symbolId.symbolId,n)),n.add(t.variantIdx)}class rz{constructor(){this._runStarted=!1,this._grid=null,this._timestamp=0,this._symbols=[],this._ignoredSymbolVariantIds=new Map,this._onlyIfPlacedReferencedIds=new Map,this._placedVariantIds=new Map,this._placedSymbolIds=new Map,this._processingSource=null,this._variantProcessingStarted=!1}startPlacement(e,t,i){if(this._runStarted)throw new Error("Attempt to start a placement run before finishing the previous one");this._runStarted=!0,this._grid?this._grid.clearAndResize(t,i):this._grid=new QR(t,i,100,32),this._timestamp=e,this._symbols=[],this._ignoredSymbolVariantIds.clear(),this._onlyIfPlacedReferencedIds.clear(),this._placedVariantIds.clear(),this._placedSymbolIds.clear()}_hasPlacedSymbol(e){const t=this._placedSymbolIds.get(ez(e));return void 0!==t&&t.has(e.symbolId)}_addPlacedSymbol(e){const t=ez(e);let i=this._placedSymbolIds.get(t);i||(i=new Set,this._placedSymbolIds.set(t,i)),i.add(e.symbolId)}startSymbolSourceProcessing(e){if(!this._runStarted)throw new Error("Attempt to start symbol source processing outside of a placement run");if(this._processingSource)throw new Error("Attempt to start a placement symbol source processing before finishing the previous one");this._processingSource=e}startSymbolVariantProcessing(e,t,i){const r=this._processingSource;if(!r)throw new Error("Attempt to start a symbol variant processing outside of symbol source processing");if(this._variantProcessingStarted)throw new Error("Attempt to begin a symbol variant processing before finishing the previous one");this._symbols.push({priority:t,source:r,variantId:e,geometry:[],placementRules:i});const n=i.collisionRules;n&&(n.symbolVariantToIgnoreCollisionWith&&iz(this._ignoredSymbolVariantIds,n.symbolVariantToIgnoreCollisionWith),n.onlyIfPlaced&&iz(this._onlyIfPlacedReferencedIds,n.onlyIfPlaced)),this._variantProcessingStarted=!0}addGeometry(e){if(!this._variantProcessingStarted)throw new Error("Attempt to add geometry outside of symbol variant processing");this._symbols.at(-1).geometry.push(e)}finishVariantProcessing(){if(!this._variantProcessingStarted)throw new Error("Attempt to finish a symbol variant processing that was not started");this._variantProcessingStarted=!1;const e=this._symbols.at(-1);0===e.geometry.length&&(2===e.priority.symbolVariantVisibility&&e.source.hideSymbolVariant(e.variantId,this._timestamp),this._symbols.pop())}finishSourceProcessing(){this._processingSource=null}finishPlacementRun(){if(!this._runStarted)throw new Error("Attempt to finish a placement run that was not started");this._runStarted=!1;const e=this._grid,t=this._timestamp;this._symbols.sort((e,t)=>function(e,t){return e.placementSubgroupOrder-t.placementSubgroupOrder||e.symbolPlacementPriority-t.symbolPlacementPriority||e.symbolVariantVisibility-t.symbolVariantVisibility||e.symbolPlacementType-t.symbolPlacementType||e.styleLayerOrder-t.styleLayerOrder||e.symbolDisplayOrder-t.symbolDisplayOrder}(t.priority,e.priority));for(const i of this._symbols){const r=2===i.priority.symbolVariantVisibility;let n=!0;if(this._hasPlacedSymbol(i.variantId.symbolId))n=!1;else if(i.placementRules.collisionRules){const t=i.placementRules.collisionRules.onlyIfPlaced;if(t&&!tz(this._placedVariantIds,t))n=!1;else{const t=i.placementRules.collisionRules.symbolVariantToIgnoreCollisionWith;"does-not-intersect"!==e.intersects(i.geometry,r?0:1,e=>{return void 0!==t&&(i=e).variantIdx===(r=t).variantIdx&&i.symbolId.styleLayerId===r.symbolId.styleLayerId&&i.symbolId.symbolIdOrigin===r.symbolId.symbolIdOrigin&&i.symbolId.symbolId===r.symbolId.symbolId;var i,r})&&(n=!1)}}if(n&&i.placementRules.insertIntoCollisionGrid){const t=tz(this._ignoredSymbolVariantIds,i.variantId)?i.variantId:void 0;e.insert(i.geometry,t)||(n=!1)}n&&(this._addPlacedSymbol(i.variantId.symbolId),tz(this._onlyIfPlacedReferencedIds,i.variantId)&&iz(this._placedVariantIds,i.variantId)),r!==n&&(n?i.source.showSymbolVariant(i.variantId,t):i.source.hideSymbolVariant(i.variantId,t))}}}class nz{constructor(){this._nextIdByLayer=new Map}allocateRange(e,t){const i=this._nextIdByLayer.get(e)||0;return this._nextIdByLayer.set(e,i+t),i}releaseLayer(e){this._nextIdByLayer.delete(e)}}class oz extends Nr{constructor(e){super(),this.requestManager=e,this.models=Object.create(null),this.models[""]=Object.create(null),this.modelUris=Object.create(null),this.modelUris[""]=Object.create(null),this.modelByURL=Object.create(null),this.numModelsLoading=Object.create(null)}async loadModel(e,t){try{const i=await this.requestManager.transformRequest(t,Bi.Model);return this.modelByURL[t]?(await bT(),vT.loadModel?await vT.loadModel(i.url,e,t):null):null}catch(i){if(404===i.status)return null;this.fire(new Br(new Error(`Could not load model ${e} from ${t}`,{cause:i})))}}load(e,t,i={forceReload:!1}){this.models[t]||(this.models[t]=Object.create(null));const r=Object.keys(e),n=[],o=[];for(const a of r){const r=e[a];this.hasURLBeenRequested(r)&&!i.forceReload||(this.modelByURL[r]={modelId:a,scope:t},n.push(this.loadModel(a,r)),o.push(a)),this.models[t][a]||(this.models[t][a]={model:null,numReferences:1})}this.numModelsLoading[t]=(this.numModelsLoading[t]||0)+o.length,Promise.allSettled(n).then(e=>{for(let i=0;i<e.length;i++){const{status:r}=e[i];if("rejected"===r)continue;const{value:n}=e[i];this.models[t][o[i]]||(this.models[t][o[i]]={model:null,numReferences:1}),this.models[t][o[i]].model=n}this.numModelsLoading[t]-=o.length,this.fire(new Or("data",{dataType:"style"}))}).catch(e=>{this.fire(new Br(new Error(`Could not load models: ${e.message}`)))})}isLoaded(){for(const e in this.numModelsLoading)if(this.numModelsLoading[e]>0)return!1;return!0}hasModel(e,t,i={exactIdMatch:!1}){return!!(i.exactIdMatch?this.getModel(e,t):this.getModelByURL(this.modelUris[t][e]))}getModel(e,t){return this.models[t]||(this.models[t]=Object.create(null)),this.models[t][e]?this.models[t][e].model:void 0}getModelByURL(e){if(!e)return null;const t=this.modelByURL[e];return t?this.models[t.scope][t.modelId].model:null}hasModelBeenAdded(e,t){return this.models[t]&&void 0!==this.models[t][e]}getModelURIs(e){return this.modelUris[e]||Object.create(null)}addModel(e,t,i){this.models[i]||(this.models[i]=Object.create(null)),this.modelUris[i]||(this.modelUris[i]=Object.create(null));const r=this.requestManager.normalizeModelURL(t);if((this.hasModel(e,i,{exactIdMatch:!0})||this.hasModelBeenAdded(e,i))&&this.modelUris[i][e]===r)this.models[i][e].numReferences++;else if(this.hasURLBeenRequested(r)){const{scope:e,modelId:t}=this.modelByURL[r];this.models[e][t].numReferences++}else this.modelUris[i][e]=r,this.load({[e]:this.modelUris[i][e]},i)}addModelURLs(e,t){this.models[t]||(this.models[t]=Object.create(null)),this.modelUris[t]||(this.modelUris[t]=Object.create(null));const i=this.modelUris[t];for(const r of Object.keys(e))i[r]=this.requestManager.normalizeModelURL(e[r])}reloadModels(e){this.load(this.modelUris[e],e,{forceReload:!0})}addModelsFromBucket(e,t){this.models[t]||(this.models[t]=Object.create(null)),this.modelUris[t]||(this.modelUris[t]=Object.create(null));const i=Object.create(null);for(const r of e)this.hasModel(r,t,{exactIdMatch:!0})||this.hasURLBeenRequested(r)?this.models[t][r].numReferences++:this.modelUris[t][r]&&!this.hasURLBeenRequested(r)?i[r]=this.modelUris[t][r]:!this.hasURLBeenRequested(r)&&jI(r,!1)&&(this.modelUris[t][r]=this.requestManager.normalizeModelURL(r),i[r]=this.modelUris[t][r]);this.load(i,t)}hasURLBeenRequested(e){return void 0!==this.modelByURL[e]}removeModel(e,t,i=!1,r=!1){if(this.models[t]&&this.models[t][e]&&(this.models[t][e].numReferences--,0===this.models[t][e].numReferences||r)){const r=this.modelUris[t][e];i||delete this.modelUris[t][e],delete this.modelByURL[r];const n=this.models[t][e].model;if(!n)return;delete this.models[t][e],n.destroy()}}destroy(){for(const e of Object.keys(this.models))for(const t of Object.keys(this.models[e])){const i=this.models[e][t].model;delete this.models[e][t],i&&i.destroy()}this.models=Object.create(null),this.models[""]=Object.create(null),this.modelUris=Object.create(null),this.modelUris[""]=Object.create(null),this.modelByURL=Object.create(null),this.numModelsLoading=Object.create(null)}listModels(e){return this.models[e]||(this.models[e]=Object.create(null)),Object.keys(this.models[e])}upload(e,t){this.models[t]||(this.models[t]=Object.create(null));for(const i in this.models[t])this.models[t][i].model&&this.models[t][i].model.upload(e.context)}}const az=["RENDER_SHADOWS","NORMAL_OFFSET"],sz=new Set(["symbol","circle"]),lz=class e{constructor(){this._queue=[],this._needsBuild=!0,this._idleHandle=null}needsBuild(){return this._needsBuild}buildQueue(e,t,i){null!=this._idleHandle&&"undefined"!=typeof cancelIdleCallback&&cancelIdleCallback(this._idleHandle),this._idleHandle=null,this._queue=[],this._needsBuild=!1;const r=!!i.fog,n=i.hasTerrain(),o=!(!i.projection||"globe"!==i.projection.name),a=n||o,s=!(!i.directionalLight||!i.directionalLight.shadowsEnabled()),l=i.map&&i.map.painter,c=!l||!l.context.extParallelShaderCompile,u=!!l&&("mrt-fallback"===l.emissiveMode||"mrt-full-rgba"===l.emissiveMode),h=(e,t=[],i={})=>{this._queue.push({programId:e,params:{...i.params,defines:t,overrideFog:!!i.fog,overrideTerrain:!!i.terrain,overrideGlobe:!!i.globe,overrideRtt:!!i.rtt,precompiled:!0}})};for(const d of e){if("none"===d.visibility)continue;const e=d.getProgramIds();if(e)for(const p of e){if(sz.has(p))continue;const e=d.getDefaultProgramParams(p,t.zoom,i._styleColorTheme.lut);if(!e)continue;const f=l?l.getShaderSource(p):null,m=a&&(!f||f.usedDefines.has("RENDER_TO_TEXTURE"));let _=e.defines;if(u&&m&&(_=(_||[]).concat("USE_MRT1"),"mrt-full-rgba"===l.emissiveMode&&(_=(_||[]).concat("USE_MRT1_RGBA"))),c){h(p,e.defines,{params:e}),m&&h(p,_,{params:e,rtt:!0});continue}const g=r&&(!f||f.usedDefines.has("FOG")),y=n&&!d.isDraped()&&(!f||f.usedDefines.has("TERRAIN")),x=o&&(!f||f.usedDefines.has("GLOBE")),v=s&&d.hasElevation()&&(!f||f.usedDefines.has("RENDER_SHADOWS"));for(const t of v?[!1,!0]:[!1]){const i=t?(e.defines||[]).concat(az):e.defines||[];for(const t of y?[!1,!0]:[!1])for(const r of x?[!1,!0]:[!1])for(const n of g?[!1,!0]:[!1])h(p,i,{params:e,fog:n,terrain:t,globe:r})}m&&h(p,_,{params:e,rtt:!0})}}if(h("clippingMask"),n)for(const d of[!1,!0])h("terrainRaster",d?["TERRAIN_VERTEX_MORPHING"]:[],{terrain:!0,fog:r});if(!c){if(e.some(e=>"hillshade"===e.type)&&h("hillshadePrepare"),s)for(const e of[!1,!0])for(const t of[!1,!0]){const i=[];e&&i.push("RENDER_CUTOFF"),i.push("RENDER_SHADOWS"),t&&i.push("NORMAL_OFFSET"),h("groundShadow",i),r&&h("groundShadow",i,{fog:!0})}if(o){for(const e of[[],["TERRAIN_VERTEX_MORPHING"],["GLOBE_POLES"]])for(const t of[!1,!0]){const i=[...e,"PROJECTION_GLOBE_VIEW"];t&&i.push("CUSTOM_ANTIALIASING"),h("globeRaster",i,{terrain:n,globe:!0,fog:r})}for(const e of[!1,!0]){const t=e?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];h("globeAtmosphere",t,{fog:!0,terrain:n,globe:e}),h("globeAtmosphere",[...t,"ALPHA_PASS"],{fog:!0,terrain:n,globe:e})}h("stars",[],{fog:r,terrain:n,globe:!0})}}}_executeBatch(t,i,r){if(r.map&&r.map.isMoving())return void(this._idleHandle=ei.requestIdleCallback(e=>this._executeBatch(e,i,r)));i.context.sweepPendingPrograms();const n=i.context.extParallelShaderCompile?e.DEADLINE_MARGIN_KHR_MS:e.DEADLINE_MARGIN_SYNC_MS;let o=0;for(;this._queue.length>0;){const e=this._queue.shift();if(!e)break;if(e.programId in wP&&(i.style=r,i._fogVisible=!!e.params.overrideFog,i.getOrCreateProgram(e.programId,e.params),o++,t.timeRemaining()<=n))break}const a=0===this._queue.length||t.timeRemaining()>n;o>0&&a&&i.context.gl.flush(),this._idleHandle=this._queue.length>0||i.context._pendingPrograms.size>0?ei.requestIdleCallback(e=>this._executeBatch(e,i,r)):null}processQueue(e,t){0!==this._queue.length&&(null!=this._idleHandle&&"undefined"!=typeof cancelIdleCallback&&cancelIdleCallback(this._idleHandle),this._idleHandle=ei.requestIdleCallback(i=>this._executeBatch(i,e,t)))}reset(){null!=this._idleHandle&&"undefined"!=typeof cancelIdleCallback&&cancelIdleCallback(this._idleHandle),this._queue=[],this._idleHandle=null,this._needsBuild=!0}};lz.DEADLINE_MARGIN_KHR_MS=5,lz.DEADLINE_MARGIN_SYNC_MS=25;let cz=lz;const uz=El.colorTheme,hz=new wl({data:new gl(uz.data)});function dz(e){if(!e.metadata||!e.metadata.content_area)return;const t=ei.devicePixelRatio,{left:i,top:r,width:n,height:o}=e.metadata.content_area,a=i*t,s=r*t;return[a,s,a+n*t,s+o*t]}function pz(e){if(e)return e.map(([e,t])=>[e*ei.devicePixelRatio,t*ei.devicePixelRatio])}class fz{constructor(e,t,i){this.id=e,this.scope=t,this.sourceCache=i,this.pendingRequests=new Set,this.missingRequests=new Set}addPendingRequest(e){this.missingRequests.has(e.name)||this.pendingRequests.has(e.name)||this.pendingRequests.add(e.name)}hasPendingRequests(){return this.pendingRequests.size>0}resolvePendingRequests(){const e=new Map;if(!this.sourceCache.loaded())return e;const t=this.sourceCache.getVisibleCoordinates();if(0===t.length)return e;const i=this.sourceCache.getSource();if("raster-array"!==i.type)return e;const r=t.map(e=>this.sourceCache.getTile(e)),n=i.getImages(r,Array.from(this.pendingRequests));for(const[o,a]of n)e.set(Ur.from({name:o,iconsetId:this.id}),a),this.pendingRequests.delete(o);for(const o of this.pendingRequests)this.missingRequests.add(o);return this.pendingRequests.clear(),e}}const mz=(e,t)=>CS(e,t&&t.filter(e=>"source.canvas"!==e.identifier)),_z=new Set(["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setLayerProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setSnow","setRain","setProjection","setCamera","addImport","removeImport","updateImport","addIconset","removeIconset"]),gz=new Set(["setCenter","setZoom","setBearing","setPitch"]),yz=new Set(["background","sky","slot","custom","placement-group"]),xz={version:8,layers:[],sources:{}},vz={duration:300,delay:0};class bz extends Nr{constructor(e,t={}){super(),this.map=e,this.scope=t.scope||"",this.globalId=null,this.fragments=[],this.importDepth=t.importDepth||0,this.importsCache=t.importsCache||new Map,this.resolvedImports=t.resolvedImports||new Set,this.transition={...vz},this._buildingIndex=new aR(this),this.crossTileSymbolIndex=new YR,this.globalPlacement=null,this.symbolIdRangeAllocator=new nz,this._groupOrders=null,this._groupOrdersVersion=-1,this._mergedOrder=[],this._mergedOrderVersion=0,this._drapedFirstOrder=[],this._mergedLayers=Object.create(null),this._mergedIndoor={},this._indoorEnabled=!1,this._mergedSourceCaches={},this._mergedOtherSourceCaches=Object.create(null),this._mergedSymbolSourceCaches=Object.create(null),this._mergedFillExtrusionSourceCaches=Object.create(null),this._mergedHdRoadCoverageSourceCaches=Object.create(null),this._hdCoverage=null,this._hdElevation=null,this._crossSourceElevationActive=!1,this._clipLayerPresent=!1,this._hasAppearances=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._importedAsBasemap=!1,this._changes=t.styleChanges||new jr,this._hasDataDrivenEmissive=!1,this.indoorManager=null,this.dispatcher=t.dispatcher?t.dispatcher:new hT(lR(),this);const i={referrer:Ni(),config:{API_URL:gi.API_URL,DRACO_URL:gi.DRACO_URL,MESHOPT_URL:gi.MESHOPT_URL,MESHOPT_SIMD_URL:gi.MESHOPT_SIMD_URL,BUILDING_GEN_URL:gi.BUILDING_GEN_URL}};if(this.map.painter&&this.map.painter.context){const e=this.map.painter.context.maxUniformBufferBindings,t=Math.floor(this.map.painter.context.maxUniformBlockSize/4);i.contextOptions={maxBindingPoints:e,maxUniformBlockSizeDwords:t}}this.isRootStyle()&&this.dispatcher.broadcast("setGlobalParams",i),t.imageManager?this.imageManager=t.imageManager:(this.imageManager=new xI(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=t.glyphManager?t.glyphManager:new a_(e._requestManager,t.localFontFamily?2:t.localIdeographFontFamily?1:0,t.localFontFamily||t.localIdeographFontFamily,t.fontstackCompositing),t.modelManager?this.modelManager=t.modelManager:(this.modelManager=new oz(e._requestManager),this.modelManager.setEventedParent(this)),this._layers=Object.create(null),this._sourceCaches={},this._otherSourceCaches=Object.create(null),this._symbolSourceCaches=Object.create(null),this._fillExtrusionSourceCaches=Object.create(null),this._hdCoverage=null,this._hdElevation=null,this._crossSourceElevationActive=!1,this._loaded=!1,this._drapingLoaded=void 0,this._initialBroadcastDone=!1,this._programPrecompiler=this.map._precompilePrograms&&this.isRootStyle()?new cz:null,this._availableImages=[],this._availableModels={}
vendor: 5,736 bytes, line 2
2,this._order=[],this._markersNeedUpdate=!1,this.options=t.configOptions?t.configOptions:new Map,this._layerExpressionDependencies=t.layerExpressionDependencies?t.layerExpressionDependencies:new Map,this._config=t.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:t.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=t.initialConfig;const r=this;this._rtlTextPluginCallback=bz.registerForPluginStateChange(e=>{r.dispatcher.send("syncRTLPluginState",{pluginStatus:e.pluginStatus,pluginURL:e.pluginURL}).then(e=>{if(tl(null),e.every(e=>e))for(const t in r._sourceCaches){const e=r._sourceCaches[t],i=e.getSource().type;"vector"!==i&&"geojson"!==i||e.reload()}}).catch(e=>{tl(e)})}),this.on("data",e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;const t=this.getOwnSource(e.sourceId);if(t&&t.vectorLayerIds)for(const i in this._layers){const e=this._layers[i];e.source===t.id&&this._validateLayer(e)}})}load(e){return e?("string"==typeof e?this.loadURL(e):this.loadJSON(e),this):this}_getGlobalId(e){if(!e)return null;if("string"==typeof e){if(zi(e))return e;const t=wi(e);if(!t.startsWith("http"))try{return new URL(t,location.href).toString()}catch(e){return t}return t}return`json://${Fr(JSON.stringify(e))}`}_diffStyle(e,t,i){this.globalId=this._getGlobalId(e),PS();const r=(e,t)=>{try{t(null,this.setState(e,i))}catch(e){t(e,!1)}};if("string"==typeof e){const i=this.map._requestManager.normalizeStyleURL(e),n=new AbortController;this._request={cancel:()=>n.abort()},(async()=>{const e=await this.map._requestManager.transformRequest(i,Bi.Style,n.signal),{data:o}=await $i(e,n.signal);this._request=null,r(o,t)})().catch(e=>{this._request=null,n.signal.aborted||this.fire(new Br(e))})}else"object"==typeof e&&r(e,t)}loadURL(e,t={}){this.fire(new Or("dataloading",{dataType:"style"}));const i="boolean"==typeof t.validate?t.validate:!zi(e);i&&PS(),this.globalId=this._getGlobalId(e),e=this.map._requestManager.normalizeStyleURL(e,t.accessToken),this.resolvedImports.add(e);const r=this.importsCache.get(e);if(r)return void this._load(r,i);const n=new AbortController;this._request={cancel:()=>n.abort()},(async()=>{const t=await this.map._requestManager.transformRequest(e,Bi.Style,n.signal),{data:r}=await $i(t,n.signal);this._request=null,this.importsCache.set(e,r),this._load(r,i)})().catch(e=>{this._request=null,n.signal.aborted||this.fire(new Br(e))})}loadJSON(e,t={}){this.fire(new Or("dataloading",{dataType:"style"}));const i=!1!==t.validate;i&&PS(),this.globalId=this._getGlobalId(e),this._request=ei.frame(()=>{this._request=null,this._load(e,i)})}loadEmpty(){this.fire(new Or("dataloading",{dataType:"style"})),this._load(xz,!1)}_loadImports(e,t,i){if(this.importDepth>=4)return Tt("Style doesn't support nesting deeper than 5"),Promise.resolve();const r=[];for(const n of e){const e=this._createFragmentStyle(n),o=new Promise(t=>{e.once("style.import.load",t),e.once("error",t)}).then(()=>{this.mergeAll(),this.fire(new Or("data",{dataType:"style"}))});if(r.push(o),this.resolvedImports.has(n.url)){e.loadEmpty();continue}const a=n.data||this.importsCache.get(n.url);a?(n.data?(e.fire(new Or("dataloading",{dataType:"style"})),e.globalId=e._getGlobalId(a),t&&PS(),queueMicrotask(()=>{e._load(a,t)})):e.loadJSON(a,{validate:t}),this._isInternalStyle(a)&&(e.globalId=null)):n.url?e.loadURL(n.url,{validate:t}):e.loadEmpty();const s={style:e,id:n.id,config:n.config};if(i){const e=this.fragments.findIndex(({id:e})=>e===i);this.fragments=this.fragments.slice(0,e).concat(s).concat(this.fragments.slice(e))}else this.fragments.push(s)}return Promise.allSettled(r)}getImportGlobalIds(e=this,t=new Set){for(const i of e.fragments)i.style.globalId&&t.add(i.style.globalId),this.getImportGlobalIds(i.style,t);return[...t.values()]}_createFragmentStyle(e){const t=this.scope?Ul(e.id,this.scope):e.id;let i;const r=this._initialConfig&&this._initialConfig[t];(e.config||r)&&(i={...e.config,...r});const n=new bz(this.map,{scope:t,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:i,configOptions:this.options,colorThemeOverride:e["color-theme"],layerExpressionDependencies:this._layerExpressionDependencies});return n.setEventedParent(this.map,{style:n}),n}_reloadImports(e=!1){this.mergeAll(),this._updateMapProjection(),e||this.updateConfigDependencies(),this._updateLayers(this._dependentLayerIds(e=>e.isIndoorDependent)),this.map._triggerCameraUpdate(this.camera),(!e||this.isRootStyle()||this.map.style._initialBroadcastDone)&&(e&&this.isRootStyle()?(this.forEachFragmentStyle(e=>{this.dispatcher.broadcast("setLayers",{layers:e._serializeLayers(e._order),scope:e.scope,options:e.options})}),this._initialBroadcastDone=!0):this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}))}_isInternalStyle(e){return this.isRootStyle()&&(e.fragment||!!e.schema&&!1!==e.fragment)}async _load(e,t){if(this._isInternalStyle(e)){const i={id:"basemap",data:e,url:""},r={...xz,imports:[i],...e.center?{center:e.center}:{},...e.bearing?{bearing:e.bearing}:{},...e.pitch?{pitch:e.pitch}:{},...e.zoom?{zoom:e.zoom}:{},...e.light?{light:e.light}:{}};return this._importedAsBasemap=!0,void this._load(r,t)}if(this.updateConfig(this._config,e.schema),t){if(await PS(),!this.dispatcher.actors.length)return;if(mz(this,zS(e)))return}this._loaded=!0;for(const n in e.sources)this.addSource(n,e.sources[n],{validate:!1,isInitialLoad:!0});this.stylesheet=At(e);const i=()=>
vendor: 14,185 bytes, line 2
2{if(e.iconsets)for(const t in e.iconsets)this.addIconset(t,e.iconsets[t]);e.sprite?this._loadIconset(e.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope})),!this.glyphManager.url&&e.glyphs&&this.glyphManager.setURL(e.glyphs);const i=hR(this.stylesheet.layers);if(this._order=i.map(e=>e.id),this.stylesheet.light&&Tt("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(1===this.stylesheet.lights.length&&"flat"===this.stylesheet.lights[0].type){const e=this.stylesheet.lights[0];this.light=new ZS(e.properties,e.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new ZS(this.stylesheet.light)),this._layers=Object.create(null);let r=!1;for(const e of i){const t=PA(e,this.scope,this._styleColorTheme.lut,this.options);this._layerExpressionDependencies.set(t.fqid,new CA(t)),this._hasAppearances=this._hasAppearances||0!==t.getAppearances().length,t.setEventedParent(this,{layer:{id:t.id}}),this._layers[t.id]=t,this._updateHdCoverageSourceCache(t)&&(r=!0);const i=this.getOwnLayerSourceCache(t),n=!!this.directionalLight&&this.directionalLight.shadowsEnabled();i&&t.canCastShadows()&&n&&(i.castsShadows=!0)}if(r&&nM().then(()=>{if(!this.map)return;for(const t in this._layers)this._updateHdCoverageSourceCache(this._layers[t]);this.map.style.mergeAll();const e=this.map.transform;for(const t in this.map.style._mergedHdRoadCoverageSourceCaches){const i=this.map.style._mergedHdRoadCoverageSourceCaches[t];i.used=!0,e&&i.update(e)}this.map._update()}),this.glyphManager.url){const e=new Set;for(const t in this._layers){const i=this._layers[t];if("symbol"===i.type&&i.layout){const t=i.layout.get("text-font");t&&t.value&&"constant"===t.value.kind&&e.add(t.value.value.join(","))}}for(const t of e)this.glyphManager.prefetchRange(t,0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);const n=this.stylesheet.terrain;n&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||(this._startLiteLoad(),this._createTerrain(n,1))),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.snow&&this._createSnow(this.stylesheet.snow),this.stylesheet.rain&&this._createRain(this.stylesheet.rain),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new Or("data",{dataType:"style"}));const o=this.isRootStyle();e.imports?this._loadImports(e.imports,t).then(()=>{this._reloadImports(!0),this.fire(new Or(o?"style.load":"style.import.load"))}).catch(e=>{this.fire(new Br(new Error("Failed to load imports",e))),this.fire(new Or(o?"style.load":"style.import.load"))}):(this._reloadImports(!0),this.fire(new Or(o?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];const r=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(r){const e=this._evaluateColorThemeData(r);this._loadColorTheme(e).then(()=>{i()}).catch(e=>{Tt(`Couldn't load color theme from the stylesheet: ${e}`),i()})}else this._styleColorTheme.lut=null,i()}isRootStyle(){return 0===this.importDepth}hasAppearances(){return this._hasAppearances||this.fragments.some(e=>e.style.hasAppearances())}mergeAll(){let e,t,i,r,n,o,a,s,l,c;const u={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(h=>{if(h.stylesheet){if(h.disableElevatedTerrain&&(this.disableElevatedTerrain=!0),null!=h.light&&(e=h.light),h.stylesheet.lights)for(const e of h.stylesheet.lights)"ambient"===e.type&&null!=h.ambientLight&&(t=h.ambientLight),"directional"===e.type&&null!=h.directionalLight&&(i=h.directionalLight);r=this._prioritizeTerrain(r,h.terrain,h.stylesheet.terrain),h.stylesheet.fog&&null!=h.fog&&(n=h.fog),h.stylesheet.snow&&null!=h.snow&&(o=h.snow),h.stylesheet.rain&&null!=h.rain&&(a=h.rain),null!=h.stylesheet.camera&&(c=h.stylesheet.camera),null!=h.stylesheet.projection&&(s=h.stylesheet.projection),null!=h.stylesheet.transition&&(l=h.stylesheet.transition),u[h.scope]=h._styleColorTheme}}),this.light=e,this.ambientLight=t,this.directionalLight=i,this.fog=n,this.snow=o,this.rain=a,this._styleColorThemeForScope=u,null===r?delete this.terrain:this.terrain=r,this.camera=c||{"camera-projection":"perspective"},this.projection=s||{name:"mercator"},this.transition={...vz,...l},this.mergeSources(),this.mergeLayers(),this.mergeIndoor(),this._programPrecompiler&&this._programPrecompiler.reset()}forEachFragmentStyle(e){const t=i=>{for(const e of i.fragments)t(e.style);e(i)};t(this)}_prioritizeTerrain(e,t,i){const r=e&&0===e.drapeRenderMode;return null===i?t&&0===t.drapeRenderMode?t:r?e:null:null!=t&&(!e||r||t&&1===t.drapeRenderMode)?t:e}mergeTerrain(){let e;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(t=>{e=this._prioritizeTerrain(e,t.terrain,t.stylesheet.terrain)}),null===e?delete this.terrain:this.terrain=e,this._programPrecompiler&&this._programPrecompiler.reset()}mergeProjection(){let e;this.forEachFragmentStyle(t=>{null!=t.stylesheet.projection&&(e=t.stylesheet.projection)}),this.projection=e||{name:"mercator"},this._programPrecompiler&&this._programPrecompiler.reset()}mergeSources(){const e={},t=Object.create(null),i=Object.create(null),r=Object.create(null),n=Object.create(null);this.forEachFragmentStyle(o=>{for(const t in o._sourceCaches){const i=Ul(t,o.scope);e[i]=o._sourceCaches[t]}for(const e in o._otherSourceCaches){const i=Ul(e,o.scope);t[i]=o._otherSourceCaches[e]}for(const e in o._symbolSourceCaches){const t=Ul(e,o.scope);i[t]=o._symbolSourceCaches[e]}for(const e in o._fillExtrusionSourceCaches){const t=Ul(e,o.scope);r[t]=o._fillExtrusionSourceCaches[e]}if(o._hdCoverage){const e=o._hdCoverage.coverageSourceCaches;for(const t in e)n[Ul(t,o.scope)]=e[t]}}),this._mergedSourceCaches=e,this._mergedOtherSourceCaches=t,this._mergedSymbolSourceCaches=i,this._mergedFillExtrusionSourceCaches=r,this._mergedHdRoadCoverageSourceCaches=n,Object.keys(n).length>0&&!this._hdCoverage&&rM.HdCoverageState&&(this._hdCoverage=new rM.HdCoverageState),rM.updateCrossSourceElevationGate&&rM.updateCrossSourceElevationGate(this)}mergeIndoor(){this._mergedIndoor={},this.forEachFragmentStyle(e=>{if(e.stylesheet&&e.stylesheet.indoor)for(const t of Object.values(e.stylesheet.indoor)){const i=t,r=Ul(i.sourceId,e.scope);this._mergedIndoor[r]=new Set(i.sourceLayers||[])}}),this._updateIndoorEnabled()}_updateIndoorEnabled(){const e=this._indoorEnabled;if(this._indoorEnabled=!1,Object.keys(this._mergedIndoor).length>0)for(const t of this._mergedOrder){const e=this._mergedLayers[t];if("none"!==e.visibility&&this._mergedIndoor[Ul(e.source,e.scope)]){this._indoorEnabled=!0;break}}!this._indoorEnabled||e||this.indoorManager||nM().then(()=>{this._initIndoorManager()})}_initIndoorManager(){if(!this.indoorManager&&rM.IndoorManager&&this.isRootStyle()&&0!==Object.keys(this._mergedIndoor).length&&(this.indoorManager=new rM.IndoorManager(this,this._loaded),this._loaded))for(const e of Object.keys(this._mergedIndoor)){const t=this._mergedSourceCaches[e]||this._mergedOtherSourceCaches[e];t&&t.reload()}}mergeLayers(){const e={},t=[],i=Object.create(null);this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(i=>{for(const r of i._order){const n=i._layers[r];if("slot"===n.type){const t=jl(r);if(e[t])continue;e[t]=[]}n.slot&&e[n.slot]?e[n.slot].push(n):t.push(n)}}),this._mergedOrder=[];let r=-1;const n=(t=[])=>{for(const o of t)if("slot"===o.type){const t=jl(o.id);e[t]&&n(e[t]),this._mergedSlots.push(t)}else{const e=Ul(o.id,o.scope);this._mergedOrder.push(e),i[e]=o,o.is3D(!!this.terrain)&&(this._has3DLayers=!0,r=this._mergedOrder.length-1),"circle"===o.type&&(this._hasCircleLayers=!0),"symbol"===o.type&&(this._hasSymbolLayers=!0),"clip"===o.type&&(this._clipLayerPresent=!0)}};if(n(t),this._has3DLayers){const e={};for(let t=0;t<this._mergedOrder.length;++t){const n=this._mergedOrder[t];e[n]=t===r?1:t<r?i[n].hasOcclusionOpacityProperties?2:0:4}this._mergedOrder.sort((t,i)=>e[t]-e[i])}this._mergedLayers=i,this._mergedOrderVersion++,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged(),this._updateDataDrivenEmissiveStrength()}terrainSetForDrapingOnly(){return!!this.terrain&&0===this.terrain.drapeRenderMode}getCamera(){return this.stylesheet.camera}setCamera(e){return this.stylesheet.camera={...this.stylesheet.camera,...e},this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(e){return e.data?function(e,t,i){const r={...t};for(const o of Object.keys(uz))void 0===r[o]&&(r[o]=uz[o].default);const n=new hl(hz,e,new Map(i));return n.setTransitionOrValue(r,i),n.untransitioned().possiblyEvaluate(new ll(0,{worldview:void 0}))}(this.scope,e,this.options).get("data"):null}_loadColorTheme(e){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const t=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((i,r)=>{const n="data:image/png;base64,";if(!e||0===e.length)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void i();let o=e;o.startsWith(n)||(o=n+o);const a=Ur.from("mapbox-reserved-lut"),s=new Image;s.src=o,s.onerror=()=>{this._styleColorTheme.lutLoading=!1,r(new Error("Failed to load image data"))},s.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==t)return void i();this._styleColorTheme.lutLoading=!1;const{width:n,height:o,data:l}=ei.getImageData(s);if(o>32)return void r(new Error("The height of the image must be less than or equal to 32 pixels."));if(n!==o*o)return void r(new Error("The width of the image must be equal to the height squared."));this.getImage(a)&&this.removeImage(a),this.addImage(a,{data:new zd({width:n,height:o},l),pixelRatio:1,sdf:!1,usvg:!1,version:0});const c=this.imageManager.getImage(a,this.scope);c?(this._styleColorTheme.lut={image:c.data,data:e},i()):r(new Error("Missing LUT image."))}})}getLut(e){const t=this._styleColorThemeForScope[e];return t?t.lut:null}setProjection(e){e?this.stylesheet.projection=e:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this.map.transform.projection.requiresDraping&&this._startLiteLoad(),this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(e){const t=new AbortController;this._spriteRequest=t,function(e,t,i,r){let n,o,a;const s=ei.devicePixelRatio>1?"@2x":"";function l(e){a||e&&i.aborted||(e&&(a=e),function(){if(a)r(a);else if(n&&o){const e=ei.getImageData(o),t={};for(const i in n){const{width:r,height:o,x:a,y:s,sdf:l,pixelRatio:c,stretchX:u,stretchY:h,content:d}=n[i],p=new zd({width:r,height:o});zd.copy(e,p,{x:a,y:s},{x:0,y:0},{width:r,height:o},null),t[i]={data:p,pixelRatio:void 0!==c?c:1,sdf:void 0!==l&&l,stretchX:u,stretchY:h,content:d,usvg:!1,version:0}}r(null,t)}}())}(async function(){const r=await t.transformRequest(t.normalizeSpriteURL(e,s,".json"),Bi.SpriteJSON,i),{data:o}=await $i(r,i);a||(n=o)})().then(()=>l(void 0),e=>l(e)),async function(){const r=await t.transformRequest(t.normalizeSpriteURL(e,s,".png"),Bi.SpriteImage,i),{data:n}=await Yi(r,i);a||(o=n)}().then(()=>l(void 0),e=>l(e))}(e,this.map._requestManager,t.signal,(e,t)=>{if(this._spriteRequest=null,e)this.dispatcher.broadcast("spriteLoaded",{scope:this.scope}),this.fire(new Br(e));else if(t){const e=new Map;for(const i in t)e.set(Ur.from(i),t[i]);this.addImages(e,!0)}this.imageManager.setLoaded(!0,this.scope),this.fire(new Or("data",{dataType:"style"}))})}addIconset(e,t){if("sprite"===t.type)return void this._loadSprite(t.url);const i=this.getOwnSourceCache(t.source);if(!i)return void this.fire(new Br(new Error(`Source "${t.source}" as specified by iconset "${e}" does not exist and cannot be used as an iconset source`)));if("raster-array"!==i.getSource().type)return void this.fire(new Br(new Error(`Source "${t.source}" as specified by iconset "${e}" is not a "raster-array" source and cannot be used as an iconset source`)));const r=new fz(e,this.scope,i);this.imageManager.addImageProvider(r,this.scope)}removeIconset(e){this.imageManager.removeImageProvider(e,this.scope)}_loadIconset(e){if(!zi(e)&&"icon_set"!==this.map._spriteFormat||"raster"===this.map._spriteFormat)return void this._loadSprite(e);const t="auto"===this.map._spriteFormat,i=new AbortController;this._spriteRequest=i,async function(e,t,i,r){try{const n=await t.transformRequest(t.normalizeIconsetURL(e),Bi.Iconset,i),{data:o}=await Wi(n,i),a={},s=function(e){const t={icons:[]};let i;for(;i=e.nextField(void 0);)1===i&&t.icons.push(FA(e,e.readVarint()+e.pos));return t}(new zm(o));for(const e of s.icons){const t={version:1,pixelRatio:ei.devicePixelRatio,content:dz(e),stretchX:e.metadata?pz(e.metadata.stretch_x_areas):void 0,stretchY:e.metadata?pz(e.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:e};a[e.name]=t}r(null,a)}catch(e){i.aborted||r(e)}}(e,this.map._requestManager,i.signal,(i,r)=>{if(this._spriteRequest=null,i)t?this._loadSprite(e):(this.dispatcher.broadcast("spriteLoaded",{scope:this.scope}),this.fire(new Br(i)));else if(r){const e=new Map;for(const t in r)e.set(Ur.from(t),r[t]);this.addImages(e,!0)}this.imageManager.setLoaded(!0,this.scope),this.fire(new Or("data",{dataType:"style"}))})}_validateLayer(e){const t=this.getOwnSource(e.source);if(!t)return;const i=e.sourceLayer;i&&("geojson"===t.type||t.vectorLayerIds&&!t.vectorLayerIds.includes(i))&&this.fire(new Br(new Error(`Source layer "${i}" does not exist on source "${t.id}" as specified by style layer "${e.id}"`)))}loaded(){if(!this._loaded)return!1;
vendor: 9,242 bytes, line 2
2if(Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const e in this._sourceCaches)if(!this._sourceCaches[e].loaded())return!1;if(!this.imageManager.isLoaded())return!1;if(this.imageManager.hasPatternsInFlight())return!1;if(!this.modelManager.isLoaded())return!1;if(this._styleColorTheme.lutLoading)return!1;if(!1===this._drapingLoaded)return!1;for(const{style:e}of this.fragments)if(!e.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((e,t)=>{const i=this.fragments[t];return i&&i.style&&(e.data=i.style.serialize()),e})}_serializeSources(){const e={};for(const t in this._sourceCaches){const i=this._sourceCaches[t].getSource();e[i.id]||(e[i.id]=i.serialize())}return e}_serializeLayers(e){const t=[];for(const i of e){const e=this._layers[i];e&&"custom"!==e.type&&t.push(e.serialize())}return t}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasSnowTransition(){return!!this.snow&&this.snow.hasTransition()}hasRainTransition(){return!!this.rain&&this.rain.hasTransition()}hasTransitions(){if(this.hasLightTransitions())return!0;if(this.hasFogTransition())return!0;if(this.hasSnowTransition())return!0;if(this.hasRainTransition())return!0;for(const e in this._sourceCaches)if(this._sourceCaches[e].hasTransition())return!0;for(const e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_updateDataDrivenEmissiveStrength(){for(const e in this._mergedLayers){const t=this._mergedLayers[e];if(t._transitionablePaint&&t._transitionablePaint._values){const e=t._transitionablePaint._values["line-emissive-strength"];if(e&&e.value&&e.value.isDataDriven())return void(this._hasDataDrivenEmissive=!0)}}this._hasDataDrivenEmissive=!1}hasDataDrivenEmissiveStrength(){return this._hasDataDrivenEmissive}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(e){return e?this.order:this._mergedOrder}isLayerDraped(e){return!!this.terrain&&e.isDraped(this.getLayerSourceCache(e))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(e){const t=this.getOwnLayer(e);if(t)return t;this.fire(new Br(new Error(`The layer '${e}' does not exist in the map's style.`)))}_checkSource(e){const t=this.getOwnSource(e);if(t)return t;this.fire(new Br(new Error(`The source '${e}' does not exist in the map's style.`)))}_resolveLayerFragment(e){const t=this.getLayer(e);if(!t)return void this.fire(new Br(new Error(`The layer '${e}' does not exist in the map's style.`)));const i=this.getFragmentStyle(t.scope);return i?{layer:t,fragment:i}:void 0}handleIdle(){const e=this.map.painter;e&&(e.context.sweepPendingPrograms(),this._programPrecompiler&&this._programPrecompiler.processQueue(e,this))}handleContextLost(){this._programPrecompiler&&this._programPrecompiler.reset()}update(e){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(e),this.directionalLight&&this.directionalLight.recalculate(e);const t=this.calculateLightsBrightness();e.brightness=t||0;let i=!1;t!==this._brightness&&(this._brightness=t,i=!0),e.worldview!==this._worldview&&(this._worldview=e.worldview,i=!0),i&&this.dispatcher.broadcast("upsertRenderParams",{brightness:this._brightness,worldview:this._worldview});const r=this._changes.isDirty();let n=!1;if(this._changes.isDirty()){const t=this._changes.getLayerUpdatesByScope();for(const e in t){const{updatedIds:i,removedIds:r}=t[e];(i||r)&&(this._updateWorkerLayers(e,i,r),n=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(e),this.light&&this.light.updateTransitions(e),this.ambientLight&&this.ambientLight.updateTransitions(e),this.directionalLight&&this.directionalLight.updateTransitions(e),this.fog&&this.fog.updateTransitions(e),this.snow&&this.snow.updateTransitions(e),this.rain&&this.rain.updateTransitions(e),this._changes.reset()}const o={};for(const l in this._mergedSourceCaches){const e=this._mergedSourceCaches[l];o[l]=e.used,e.used=!1,e.tileCoverLift=0}const a={};for(const l of this._mergedOrder){const t=this._mergedLayers[l];if(("none"!==t.visibility||t.hasTransition())&&t.recalculate(e,this._availableImages),!t.isHidden(e.zoom)){t.mayUse("HD")&&(t.prepare(),nM()),t.mayUse("Standard")&&(t.prepare(),bT()),t.mayUse("Lite")&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this._startLiteLoad());const e=this.getLayerSourceCache(t);e&&(e.used=!0,e.tileCoverLift=Math.max(e.tileCoverLift,t.tileCoverLift()))}if(t.source){const e=Ul(t.source,t.scope),i=this._mergedHdRoadCoverageSourceCaches[e];i&&!i.used&&(i.used=!0)}if("fill-extrusion"===t.type){const e=Ul(t.source,t.scope);if(e in this._mergedFillExtrusionSourceCaches){const i=t.layout&&t.layout.get("source-max-zoom");if(null!=i){const t=a[e];a[e]=null==t?i:Math.min(t,i)}}}}if(this._programPrecompiler&&this._programPrecompiler.needsBuild()){const t=this._mergedOrder.map(e=>this._mergedLayers[e]);this._programPrecompiler.buildQueue(t,e,this)}for(const l in this._mergedFillExtrusionSourceCaches)this._mergedFillExtrusionSourceCaches[l].setMaxzoomOverride(a[l]??null);this.terrain&&n&&this.mergeLayers();const s=this.imageManager.getPendingImageProviders();for(const l of s)l.sourceCache.used=!0;for(const l in o){const e=this._mergedSourceCaches[l];o[l]!==e.used&&e.getSource().fire(new Or("data",{sourceDataType:"visibility",dataType:"source",sourceId:e.getSource().id}))}this.light&&this.light.recalculate(e),this.terrain&&this.terrain.recalculate(e),this.fog&&this.fog.recalculate(e),this.snow&&this.snow.recalculate(e),this.rain&&this.rain.recalculate(e),this.z=e.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),r&&this.fire(new Or("data",{dataType:"style"}))}updateImageProviders(){const e=this.imageManager.getPendingImageProviders();for(const t of e){const e=t.resolvePendingRequests(),i=this.getFragmentStyle(t.scope);i&&i.addImages(e)}}_updateTilesForChangedImages(){const e={};for(const t in this._mergedSourceCaches){const i=this._mergedSourceCaches[t].getSource().scope;e[i]=e[i]||this._changes.getUpdatedImages(i),0!==e[i].length&&this._mergedSourceCaches[t].reloadTilesForDependencies(["icons","patterns"],e[i])}for(const t in e)this._changes.resetUpdatedImages(t)}_updateWorkerLayers(e,t,i){const r=this.getFragmentStyle(e);r&&this.dispatcher.broadcast("updateLayers",{layers:t?r._serializeLayers(t):[],scope:e,removedIds:i||[],options:r.options})}setState(e,t){if(this._checkLoaded(),mz(this,zS(e)))return!1;if((e=At(e)).layers=hR(e.layers),!MS.diffStyles)throw new Error("Debug module not loaded; cannot diff style.");const i=MS.diffStyles(this.serialize(),e).filter(e=>!gz.has(e.command));if(0===i.length)return!1;const r=i.filter(e=>!_z.has(e.command));if(r.length>0)throw new Error(`Unimplemented: ${r.map(e=>e.command).join(", ")}.`);const n=[];return i.forEach(e=>{n.push(this[e.command](...e.args))}),t&&Promise.all(n).then(t).catch(t),this.stylesheet=e,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}_updateWorkerImages(e=!1){this._availableImages=this.imageManager.listImages(this.scope);const t={scope:this.scope,images:this._availableImages};e&&(t.isSpriteLoaded=!0),this.dispatcher.broadcast("setImages",t)}_updateWorkerModels(){this._availableModels=this.modelManager.getModelURIs(this.scope),this.dispatcher.broadcast("setModels",{scope:this.scope,models:this._availableModels})}addImages(e,t){if(0===e.size)return t&&this.dispatcher.broadcast("spriteLoaded",{scope:this.scope}),this;for(const[i,r]of e.entries()){if(this.getImage(i))return this.fire(new Br(new Error(`An image with the name "${i.name}" already exists.`)));this.imageManager.addImage(i,this.scope,r),this._changes.updateImage(i,this.scope)}return this._updateWorkerImages(t),this.fire(new Or("data",{dataType:"style"})),this}addImage(e,t){return this.getImage(e)?this.fire(new Br(new Error(`An image with the name "${e.name}" already exists.`))):(this.imageManager.addImage(e,this.scope,t),this._changes.updateImage(e,this.scope),this._updateWorkerImages(),this.fire(new Or("data",{dataType:"style"})),this)}updateImage(e,t,i=!1){this.imageManager.updateImage(e,this.scope,t),i&&(this._changes.updateImage(e,this.scope),this._updateWorkerImages(),this.fire(new Or("data",{dataType:"style"})))}getImage(e){return this.imageManager.getImage(e,this.scope)}removeImage(e){return this.getImage(e)?(this.imageManager.removeImage(e,this.scope),this._changes.updateImage(e,this.scope),this._updateWorkerImages(),this.fire(new Or("data",{dataType:"style"})),this):this.fire(new Br(new Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}getActualScope(){return this._importedAsBasemap?"basemap":this.scope}addModelURLs(e){return this.modelManager.addModelURLs(e,this.getActualScope()),this._updateWorkerModels(),this.fire(new Or("data",{dataType:"style"})),this}addModel(e,t,i={}
vendor: 8,744 bytes, line 2
2){return this._checkLoaded(),this._validate($S,`models.${e}`,t,null,i)||(this.modelManager.addModel(e,t,this.getActualScope()),this.fire(new Or("data",{dataType:"style"}))),this}hasModel(e){return this.modelManager.hasModel(e,this.getActualScope())}removeModel(e){return this.hasModel(e)?(this.modelManager.removeModel(e,this.getActualScope(),!1,!0),this.fire(new Or("data",{dataType:"style"})),this):this.fire(new Br(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.getActualScope())}addSource(e,t,i={}){if(this._checkLoaded(),void 0!==this.getOwnSource(e))throw new Error(`There is already a source with ID "${e}".`);if(!t.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(t).join(", ")}.`);if(["vector","raster","geojson","video","image"].includes(t.type)&&this._validate(LS,`sources.${e}`,t,null,i))return;this.map&&this.map._collectResourceTiming&&(t.collectResourceTiming=!0);const r=Object.hasOwn(JC,t.type)&&!QP(t.type),n=r?new QC(e,t,this.dispatcher,this):JP(e,t,this.dispatcher,this);n.scope=this.scope;const o=e=>{e.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(e.id),source:e.serialize(),sourceId:e.id}))};o(n);const a=e=>{const t=(1===e?"symbol:":2===e?"fill-extrusion:":"other:")+n.id,i=Ul(t,this.scope),r=this._sourceCaches[t]=new DD(i,n,e);1===e?this._symbolSourceCaches[n.id]=r:2===e?this._fillExtrusionSourceCaches[n.id]=r:this._otherSourceCaches[n.id]=r,r.onAdd(this.map)};a(0),"vector"!==t.type&&"geojson"!==t.type||(a(1),"vector"===t.type&&a(2)),n.onAdd&&n.onAdd(this.map),r&&async function(e){if(QP(e))return;const t=JC[e];if(!t)throw new Error(`Unknown source type "${e}"`);const i=await t();i&&!QP(e)&&function(e,t){KP[e]=t}(e,i)}(t.type).then(()=>{const i=QP(t.type),r=this._otherSourceCaches[e];if(!r||r.getSource()!==n)return;if(!i)return void this.fire(new Br(new Error(`Could not load module for source type "${t.type}".`)));const a=JP(e,t,this.dispatcher,this);a.scope=this.scope,o(a),r.setSource(a),a.onAdd&&a.onAdd(this.map),this._changes.setDirty()}),i.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(e){this._checkLoaded();const t=this.getOwnSource(e);if(!t)throw new Error("There is no source with this ID");for(const r in this._layers)if(this._layers[r].source===e)return this.fire(new Br(new Error(`Source "${e}" cannot be removed while layer "${r}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===e)return this.fire(new Br(new Error(`Source "${e}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){const t=Object.entries(this.stylesheet.iconsets).find(([t,i])=>"source"===i.type&&i.source===e);if(t)return this.fire(new Br(new Error(`Source "${e}" cannot be removed while iconset "${t[0]}" is using it.`)))}const i=this.getOwnSourceCaches(e);for(const r of i){const e=jl(r.id);delete this._sourceCaches[e],this._changes.discardSourceCacheUpdate(r.id),r.fire(new Or("data",{sourceDataType:"metadata",dataType:"source",sourceId:r.getSource().id})),r.setEventedParent(null),r.clearTiles()}return delete this._otherSourceCaches[e],delete this._symbolSourceCaches[e],delete this._fillExtrusionSourceCaches[e],this._hdCoverage&&delete this._hdCoverage.coverageSourceCaches[e],this.mergeSources(),t.setEventedParent(null),t.onRemove&&t.onRemove(this.map),this.dispatcher.broadcast("removeSource",{type:t.type,source:e,scope:t.scope}),this._changes.setDirty(),this}setGeoJSONSourceData(e,t){this._checkLoaded(),this.getOwnSource(e).setData(t),this._changes.setDirty()}getOwnSource(e){const t=this.getOwnSourceCache(e);return t&&t.getSource()}getOwnSources(){const e=[];for(const t in this._otherSourceCaches){const i=this.getOwnSourceCache(t);i&&e.push(i.getSource())}return e}areTilesLoaded(){const e=this._mergedSourceCaches;for(const t in e){const i=e[t]._tiles;for(const e in i){const t=i[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}}return!0}setLights(e){if(this._checkLoaded(),this._programPrecompiler&&this._programPrecompiler.reset(),!e)return delete this.ambientLight,void delete this.directionalLight;const t=this._getTransitionParameters();for(const n of e){if(this._validate(OS,"lights",n))return;switch(n.type){case"ambient":if(this.ambientLight){const e=this.ambientLight;e.set(n),e.updateTransitions(t)}else this.ambientLight=new dT(n,fT(),this.scope,this.options);break;case"directional":if(this.directionalLight){const e=this.directionalLight;e.set(n),e.updateTransitions(t)}else this.directionalLight=new dT(n,_T(),this.scope,this.options)}}const i=Object.assign(t,{worldview:this.map.getWorldview()}),r=new ll(this.z||0,i);this.ambientLight&&this.ambientLight.recalculate(r),this.directionalLight&&this.directionalLight.recalculate(r),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("upsertRenderParams",{brightness:this._brightness})}calculateLightsBrightness(){const e=this.directionalLight,t=this.ambientLight;if(!e||!t)return;const i=e=>.2126*(e[0]<=.03928?e[0]/12.92:Math.pow((e[0]+.055)/1.055,2.4))+.7152*(e[1]<=.03928?e[1]/12.92:Math.pow((e[1]+.055)/1.055,2.4))+.0722*(e[2]<=.03928?e[2]/12.92:Math.pow((e[2]+.055)/1.055,2.4)),r=e.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),n=e.properties.get("intensity"),o=e.properties.get("direction"),a=1-Pt(o.x,o.y,o.z)[2]/90,s=i(r)*n*a,l=t.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),c=t.properties.get("intensity"),u=i(l)*c;return Number(((s+u)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const e=[];return this.directionalLight&&e.push(this.directionalLight.get()),this.ambientLight&&e.push(this.ambientLight.get()),e}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(e){if(null==e||""===e&&this.isRootStyle())return this;if(Nl(e)){const t=function(e){const t=e.lastIndexOf(Vl);return t>=0?e.slice(t+1):""}(e),i=this.fragments.find(({id:e})=>e===t);if(!i)return;const r=jl(e);return i.style.getFragmentStyle(r)}{const t=this.fragments.find(({id:t})=>t===e);return t?t.style:void 0}}setFeaturesetSelectors(e){if(!e)return;const t=(e,t="")=>`${e}::${t}`;this._featuresetSelectors={};for(const i in e){const r={},n=this._featuresetSelectors[i]=[];for(const o of e[i].selectors){if(o.featureNamespace){const e=this.getOwnLayer(o.layer);if(!e){Tt(`Layer is undefined for selector: ${o.layer}`);continue}const n=t(e.source,e.sourceLayer);if(n in r&&r[n]!==o.featureNamespace){Tt(`"featureNamespace ${o.featureNamespace} of featureset ${i}'s selector is not associated to the same source, skip this selector`);continue}r[n]=o.featureNamespace}let e;if(o.properties)for(const t in o.properties){const i=Es(o.properties[t]);"success"===i.result&&(e=e||{},e[t]=i.value)}n.push({layerId:o.layer,namespace:o.featureNamespace,properties:e,uniqueFeatureID:o._uniqueFeatureID})}}}getFeaturesetDescriptors(e){const t=this.getFragmentStyle(e);if(!t||!t.stylesheet.featuresets)return[];const i=[];for(const r in t.stylesheet.featuresets)i.push({featuresetId:r,importId:t.scope?t.scope:void 0});return i}getFeaturesetLayers(e,t){const i=this.getFragmentStyle(t),r=i.stylesheet.featuresets;if(!r||!r[e])return this.fire(new Br(new Error(`The featureset '${e}' does not exist in the map's style and cannot be queried.`))),[];const n=[];for(const o of r[e].selectors){const e=i.getOwnLayer(o.layer);e&&n.push(e)}return n}getConfigProperty(e,t){const i=this.getFragmentStyle(e);if(!i)return null;const r=Ul(t,i.scope),n=i.options.get(r),o=n?n.value||n.default:null;return o?o.serialize():null}isIndoorEnabled(){return this._indoorEnabled}getIndoorSourceLayers(e,t){const i=Ul(e,t);return this._mergedIndoor[i]}setIndoorData(e,t){this.indoorManager&&this.indoorManager.setIndoorData(t)}updateIndoorDependentLayers(){this._updateLayers(this._dependentLayerIds(e=>e.isIndoorDependent)),this.map._styleDirty=!0,this.map.triggerRepaint()}setConfigProperty(e,t,i){const r=this.getFragmentStyle(e);if(!r)return;const n=r.stylesheet.schema;if(!n||!n[t])return;const o=As(i,n[t]);if("success"!==o.result)return void mz(this,o.value);const a=o.value.expression,s=Ul(t,r.scope),l=r.options.get(s);if(!l)return;let c;const{minValue:u,maxValue:h,stepValue:d,type:p,values:f}=n[t],m=As(n[t].default,n[t]);"success"===m.result&&(c=m.value.expression),c?(this.options.set(s,{...l,value:a,default:c,minValue:u,maxValue:h,stepValue:d,type:p,values:f}),this.updateConfigDependencies(t)):this.fire(new Br(new Error(`No schema defined for the config option "${t}" in the "${e}" fragment.`)))}getConfig(e){const t=this.getFragmentStyle(e);
vendor: 2,254 bytes, line 2
2if(!t)return null;const i=t.stylesheet.schema;if(!i)return null;const r={};for(const n in i){const e=Ul(n,t.scope),i=t.options.get(e),o=i?i.value||i.default:null;r[n]=o?o.serialize():null}return r}setConfig(e,t){const i=this.getFragmentStyle(e);i&&(i.updateConfig(t,i.stylesheet.schema),this.updateConfigDependencies())}getSchema(e){const t=this.getFragmentStyle(e);return t?t.stylesheet.schema:null}setSchema(e,t){const i=this.getFragmentStyle(e);i&&(i.stylesheet.schema=t,i.updateConfig(i._config,t),this.updateConfigDependencies())}updateConfig(e,t){if(this._config=e,e||t)if(t)for(const i in t){let r,n;const o=As(t[i].default,t[i]);if("success"===o.result&&(r=o.value.expression),e&&void 0!==e[i]){const r=As(e[i],t[i]);"success"===r.result&&(n=r.value.expression)}const{minValue:a,maxValue:s,stepValue:l,type:c,values:u}=t[i];if(r){const e=Ul(i,this.scope);this.options.set(e,{default:r,value:n,minValue:a,maxValue:s,stepValue:l,type:c,values:u})}else this.fire(new Br(new Error(`No schema defined for config option "${i}".`)))}else this.fire(new Br(new Error("Attempting to set config for a style without schema.")))}_updateLayers(e){for(const t of e){const e=this.getLayer(t);e&&(e.possiblyEvaluateVisibility(),this._updateLayer(e),this._changes.setDirty())}}_dependentLayerIds(e){const t=[];for(const[i,r]of this._layerExpressionDependencies)e(r)&&t.push(i);return t}updateConfigDependencies(e){this._updateLayers(this._dependentLayerIds(t=>e?t.hasConfigDependency(e):t.isConfigDependent)),this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.snow&&this.snow.updateConfig(this.options),this.rain&&this.rain.updateConfig(this.options),this.forEachFragmentStyle(e=>{const t=e._styleColorTheme.colorThemeOverride?e._styleColorTheme.colorThemeOverride:e._styleColorTheme.colorTheme;if(t){const i=e._evaluateColorThemeData(t);(!e._styleColorTheme.lut&&""!==i||e._styleColorTheme.lut&&i!==e._styleColorTheme.lut.data)&&e.setColorTheme(t)}}),this._updateIndoorEnabled(),this._changes.setDirty()}addLayer(e,t,i={}){this._checkLoaded();const r=e.id;if(this._layers[r])return void this.fire(new Br(new Error(`Layer with i
2d "${r}" already exists on this map`)));let n;if("custom"===e.type){if(mz(this,function(e){const t=[],i=e.id;return void 0===i&&t.push({message:`layers.${i}: missing required property "id"`}),void 0===e.render&&t.push({message:`layers.${i}: missing required method "render"`}),e.renderingMode&&"2d"!==e.renderingMode&&"3d"!==e.renderingMode&&t.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),t}(e)))return;n=PA(e,this.scope,this._styleColorTheme.lut,this.options)}else{if("object"==typeof e.source&&(this.addSource(r,e.source),e=At(e),e=Object.assign(e,{source:r})),this._validate(US,`layers.${r}`,e,{arrayIndex:-1},i))return;n=PA(e,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(n),n.setEventedParent(this,{layer:{id:r}})}this._layerExpressionDependencies.set(n.fqid,new CA(n));let o=this._order.length;if(t){const e=this._order.indexOf(t);if(-1===e)return void this.fire(new Br(new Error(`Layer with id "${t}" does not exist on this map.`)));n.slot&&n.slot!==this._layers[t].slot?Tt(`Layer with i
2d "${t}" has a different slot. Layers can only be rearranged within the same slot.`):o=e}this._order.splice(o,0,r),this._handleLayerOrderChange(),this._layers[r]=n;const a=this.getOwnLayerSourceCache(n),s=!!this.directionalLight&&this.directionalLight.shadowsEnabled();a&&n.canCastShadows()&&s&&(a.castsShadows=!0);const l=this._changes.getRemovedLayer(n);if(l&&n.source&&a&&"custom"!==n.type){this._changes.discardLayerRemoval(n);const e=Ul(n.source,n.scope);l.type!==n.type?this._changes.updateSourceCache(e,"clear"):(this._changes.updateSourceCache(e,"reload"),a.pause())}this._updateLayer(n),n.onAdd&&n.onAdd(this.map),n.scope=this.scope,this.mergeLayers()}moveLayer(e,t){this._checkLoaded();const i=this._checkLayer(e);if(!i)return;if(e===t)return;const r=this._order.indexOf(e);this._order.splice(r,1);let n=this._order.length;if(t){const e=this._order.indexOf(t);if(-1===e)return void this.fire(new Br(new Error(`Layer with id "${t}" does not exist on this map.`)));i.slot&&i.slot!==this._layers[t].slot?Tt(`Layer with id "${t}" has a different slot. Layers can only be rearranged within the same slot.`):n=e}this._order.splice(n,0,e),this._changes.setDirty(),this._handleLayerOrderChange(),this.mergeLayers()}removeLayer(e){this._checkLoaded();const t=this._checkLayer(e);if(!t)return;t.setEventedParent(null);const i=this._order.indexOf(e);this._order.splice(i,1),delete this._layers[e],this._changes.setDirty(),this._handleLayerOrderChange(),this._layerExpressionDependencies.delete(t.fqid),this._changes.removeLayer(t),this.symbolIdRangeAllocator.releaseLayer(t.runtimeLayerUID);const r=this.getOwnLayerSourceCache(t);if(r&&r.castsShadows){let e=!1;for(const i in this._layers)if(this._layers[i].source===t.source&&this._layers[i].canCastShadows()){e=!0;break}r.castsShadows=e}t.onRemove&&t.onRemove(this.map),this.mergeLayers()}getOwnLayer(e){return this._layers[e]}hasLayer(e){return e in this._mergedLayers}hasLayerType(e){for(const t in this._layers)if(this._layers[t].type===e)return!0;return!1}setLayerZoomRange(e,t,i){this._checkLoaded();const r=this._checkLayer(e);r&&(r.minzoom===t&&r.maxzoom===i||(null!=t&&(r.minzoom=t),null!=i&&(r.maxzoom=i),this._updateLayer(r)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(e,t){this._checkLoaded();const i=this._checkLayer(e);i&&i.slot!==t&&(i.slot=t,this._updateLayer(i))}setFilter(e,t,i={}){this._checkLoaded();const r=this._checkLayer(e);if(!r)return;if(Ve(r.filter,t))return;const n=this._layerExpressionDependencies.get(r.fqid);if(null==t)return r.filter=void 0,n&&n.invalidateFilter(),void this._updateLayer(r);this._validate(jS,`layers.${r.id}.filter`,t,{layerType:r.type},i)||(r.filter=At(t),n&&n.invalidateFilter(),this._updateLayer(r))}getFilter(e){const t=this._checkLayer(e);if(t)return At(t.filter)}setLayoutProperty(e,t,i,r={}){this._checkLoaded();const n=this._checkLayer(e);if(n&&!Ve(n.getLayoutProperty(t),i)){if(null!=i&&(!r||!1!==r.validate)&&mz(n,HS.call(zS,{key:`layers.${e}.layout.${t}`,layerType:n.type,objectKey:t,value:i,styleSpec:El,style:{glyphs:!0,sprite:!0}})))return;n.setLayoutProperty(t,i),this._updateLayer(n)}}getLayerProperty(e,t){const i=this._checkLayer(e);if(i){switch(t){case"minzoom":return i.minzoom;case"maxzoom":return i.maxzoom;case"filter":return this.getFilter(e);case"slot":return i.slot;case"appearances":return i.getAppearances().map(e=>e.serialize())}return i.isPaintProperty(t)?this.getPaintProperty(e,t):this.getLayoutProperty(e,t)}}setLayerProperty(e,t,i,r={}){this._checkLoaded();const n=this._checkLayer(e);if(n){switch(t){case"appearances":return n.setAppearances(i),void this._updateLayer(n);case"minzoom":return this.setLayerZoomRange(e,i);case"maxzoom":return this.setLayerZoomRange(e,null,i);case"filter":return this.setFilter(e,i,r);case"slot":return this.setSlot(e,i)}n.isPaintProperty(t)?this.setPaintProperty(e,t,i,r):this.setLayoutProperty(e,t,i,r)}}getLayoutProperty(e,t){const i=this._checkLayer(e);if(i)return i.getLayoutProperty(t)}setPaintProperty(e,t,i,r={}){this._checkLoaded();const n=this._checkLayer(e);n&&(Ve(n.getPaintProperty(t),i)||(null==i||r&&!1===r.validate||!mz(n,GS.call(zS,{key:`layers.${e}.paint.${t}`,layerType:n.type,objectKey:t,value:i,styleSpec:El})))&&(n.setPaintProperty(t,i)&&this._updateLayer(n),this._changes.updatePaintProperties(n)))}getPaintProperty(e,t){const i=this._checkLayer(e);if(i)return i.getPaintProperty(t)}setFeatureState(e,t){if(this._checkLoaded(),"target"in e){if("featuresetId"in e.target){const{featuresetId:i,importId:r}=e.target,n=this.getFragmentStyle(r),o=n.getFeaturesetLayers(i);for(const{source:a,sourceLayer:s}of o)n.setFeatureState({id:e.id,source:a,sourceLayer:s},t)}else if("layerId"in e.target){const i=this._resolveLayerFragment(e.target.layerId);i?.fragment.setFeatureState({id:e.id,source:i.layer.source,sourceLayer:i.layer.sourceLayer},t)}return}const i=e.source,r=e.sourceLayer,n=this._checkSource(i);if(!n)return;const o=n.type;if("geojson"===o&&r)return void this.fire(new Br(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===o&&!r)return void this.fire(new Br(new Error("The sourceLayer parameter must be provided for vector source types.")));void 0===e.id&&this.fire(new Br(new Error("The feature id parameter must be provided.")));const a=this.getOwnSourceCaches(i);for(const s of a)s.setFeatureState(r,e.id,t)}removeFeatureState(e,t){if(this._checkLoaded(),"target"in e){if("featuresetId"in e.target){const{featuresetId:i,importId:r}=e.target,n=this.getFragmentStyle(r),o=n.getFeaturesetLayers(i);for(const{source:a,sourceLayer:s}of o)n.removeFeatureState({id:e.id,source:a,sourceLayer:s},t)}else if("layerId"in e.target){const i=this._resolveLayerFragment(e.target.layerId);i?.fragment.removeFeatureState({id:e.id,source:i.layer.source,sourceLayer:i.layer.sourceLayer},t)}return}const i=e.source,r=this._checkSource(i);if(!r)return;const n=r.type,o="vector"===n?e.sourceLayer:void 0;if("vector"===n&&!o)return void this.fire(new Br(new Error("The sourceLayer parameter must be provided for vector source types.")));if(t&&"string"!=typeof e.id&&"number"!=typeof e.id)return void this.fire(new Br(new Error("A feature id is required to remove its specific state property.")));const a=this.getOwnSourceCaches(i);
vendor: 4,095 bytes, line 2
2for(const s of a)s.removeFeatureState(o,e.id,t)}getFeatureState(e){if(this._checkLoaded(),"target"in e){let t;if("featuresetId"in e.target){const{featuresetId:i,importId:r}=e.target,n=this.getFragmentStyle(r),o=n.getFeaturesetLayers(i);for(const{source:a,sourceLayer:s}of o){const i=n.getFeatureState({id:e.id,source:a,sourceLayer:s});if(i&&!t)t=i;else if(!Ve(t,i))return void this.fire(new Br(new Error("The same feature id exists in multiple sources in the featureset, but their feature states are not consistent through the sources.")))}}else if("layerId"in e.target){const i=this._resolveLayerFragment(e.target.layerId);t=i?.fragment.getFeatureState({id:e.id,source:i.layer.source,sourceLayer:i.layer.sourceLayer})}return t}const t=e.source,i=e.sourceLayer,r=this._checkSource(t);if(r){if("vector"!==r.type||i)return void 0===e.id&&this.fire(new Br(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(t)[0].getFeatureState(i,e.id);this.fire(new Br(new Error("The sourceLayer parameter must be provided for vector source types.")))}}resetFeatureStates(e){if(this._checkLoaded(),"featuresetId"in e){const{featuresetId:t,importId:i}=e,r=this.getFragmentStyle(i);if(!r)return;const n=r.getFeaturesetLayers(t);for(const{source:e,sourceLayer:o}of n)r.removeFeatureState({source:e,sourceLayer:o})}else{const t=this._resolveLayerFragment(e.layerId);t?.fragment.removeFeatureState({source:t.layer.source,sourceLayer:t.layer.sourceLayer})}}setTransition(e){return this.stylesheet.transition={...this.stylesheet.transition,...e},this.transition=this.stylesheet.transition,this}getTransition(){return{...this.stylesheet.transition}}setWorldview(e){e!==this._worldview&&(this._worldview=e,this.dispatcher.broadcast("upsertRenderParams",{worldview:this._worldview}),this.reloadSources())}serialize(){this._checkLoaded();const e=this.getTerrain(),t=e&&this.terrain&&this.terrain.scope===this.scope?e:this.stylesheet.terrain;return Et({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,iconsets:this.stylesheet.iconsets,featuresets:this.stylesheet.featuresets,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:t,fog:this.stylesheet.fog,snow:this.stylesheet.snow,rain:this.stylesheet.rain,indoor:this.stylesheet.indoor,center:this.stylesheet.center,"color-theme":this.stylesheet["color-theme"],zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},e=>void 0!==e)}_updateFilteredLayers(e){for(const t of Object.values(this._mergedLayers))e(t)&&this._updateLayer(t)}_updateLayer(e){this._changes.updateLayer(e);const t=this.getLayerSourceCache(e),i=Ul(e.source,e.scope),r=this._changes.getUpdatedSourceCaches();e.source&&!r[i]&&t&&"raster"!==t.getSource().type&&(this._changes.updateSourceCache(i,"reload"),t.pause()),e.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(e){const t=e=>this._mergedLayers[e].is3D(!!this.terrain),i=this.order,r={},n=[];for(let a=i.length-1;a>=0;a--){const o=i[a];if(t(o)){r[o]=a;for(const t of e){const e=t[o];if(e)for(const t of e)n.push(t)}}}n.sort((e,t)=>t.intersectionZ-e.intersectionZ);const o=[];for(let a=i.length-1;a>=0;a--){const s=i[a];if(t(s))for(let e=n.length-1;e>=0;e--){const t=n[e].feature;if(t.layer&&r[t.layer.id]<a)break;o.push(t),n.pop()}else for(const t of e){const e=t[s];if(e)for(const t of e)o.push(t.feature)}}return o}queryRasterValue(e,t,i){const r=this.getOwnSource(e);return r?"raster-array"!==r.type?(this.fire(new Br(new Error('queryRasterValue support only "raster-array" sources.'))),Promise.resolve(null)):r.queryRasterArrayValue(t,i):(this.fire(new Br(new Error(`Source with id "${e}" does not exist in the style.`))),Promise.resolve(null))}queryRenderedFeatures(e,t,i){let r;
vendor: 9,396 bytes, line 2
2t&&!Array.isArray(t)&&t.filter&&(this._validate(jS,"queryRenderedFeatures.filter",t.filter,null,t),r=Tl(t.filter));const n={},o=e=>{if(yz.has(e.type))return;const t=this.getOwnLayerSourceCache(e),i=n[t.id]=n[t.id]||{sourceCache:t,layers:{},has3DLayers:!1};e.is3D(!!this.terrain)&&(i.has3DLayers=!0),i.layers[e.fqid]=i.layers[e.fqid]||{styleLayer:e,targets:[]},i.layers[e.fqid].targets.push({filter:r})};if(t&&t.layers){if(!Array.isArray(t.layers))return this.fire(new Br(new Error("parameters.layers must be an Array."))),[];for(const e of t.layers){const t=this._layers[e];if(!t)return this.fire(new Br(new Error(`The layer '${e}' does not exist in the map's style and cannot be queried for features.`))),[];o(t)}}else for(const c in this._layers)o(this._layers[c]);const a=this._queryRenderedFeatures(e,n,i),s=this._flattenAndSortRenderedFeatures(a),l=[];for(const c of s)Gl(c.layer.id)===this.scope&&l.push(c);return l}queryRenderedFeatureset(e,t,i){let r;t&&!Array.isArray(t)&&t.filter&&(this._validate(jS,"queryRenderedFeatures.filter",t.filter,null,t),r=Tl(t.filter));const n="mock",o=[];if(t&&t.target)o.push({...t,targetId:n,filter:r});else{const e=this.getFeaturesetDescriptors();for(const t of e)o.push({targetId:n,filter:r,target:t});for(const{style:t}of this.fragments){const e=t.getFeaturesetDescriptors();for(const t of e)o.push({targetId:n,filter:r,target:t})}}const a=this.queryRenderedTargets(e,o,i),s=[],l=new Set;for(const c of a)for(const e of c.variants[n])tR(e,c,l)||s.push(new nw(c,e));return s}queryRenderedTargets(e,t,i){const r={},n=(e,t,i,n)=>{const o=r[t.id]=r[t.id]||{sourceCache:t,layers:{},has3DLayers:!1};if(o.layers[e.fqid]=o.layers[e.fqid]||{styleLayer:e,targets:[]},e.is3D(!!this.terrain)&&(o.has3DLayers=!0),!n)return i.uniqueFeatureID=!1,void o.layers[e.fqid].targets.push(i);o.layers[e.fqid].targets.push({...i,namespace:n.namespace,properties:n.properties,uniqueFeatureID:n.uniqueFeatureID})};for(const a of t)if("featuresetId"in a.target){const{featuresetId:e,importId:t}=a.target,i=this.getFragmentStyle(t);if(!i||!i._featuresetSelectors)continue;const r=i._featuresetSelectors[e];if(!r){this.fire(new Br(new Error(`The featureset '${e}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const o of r){const e=i.getOwnLayer(o.layerId);e&&!yz.has(e.type)&&n(e,i.getOwnLayerSourceCache(e),a,o)}}else if("layerId"in a.target){const{layerId:e}=a.target,t=this.getLayer(e);if(!t||yz.has(t.type))continue;n(t,this.getLayerSourceCache(t),a)}const o=this._queryRenderedFeatures(e,r,i);return this._flattenAndSortRenderedFeatures(o)}_queryRenderedFeatures(e,t,i){const r=[],n=!!this.map._showQueryGeometry,o=IP.createFromScreenPoints(e,i);for(const a in t){const e=iR(o,t[a],this._availableImages,i,n,this.getActualScope());Object.keys(e).length&&r.push(e)}if(this.placement)for(const a in t){if(1!==t[a].sourceCache._renderSourceType)continue;const e=rR(o.screenGeometry,t[a],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(e).length&&r.push(e)}return r}querySourceFeatures(e,t){const i=t&&t.filter;i&&this._validate(jS,"querySourceFeatures.filter",i,null,t);let r=[];const n=this.getOwnSourceCaches(e);for(const o of n)r=r.concat(nR(o,t));return r}getFlatLight(){return this.light.getLight()}setFlatLight(e,t,i={}){this._checkLoaded();const r=this.light.getLight();let n=!1;for(const a in e)if(!Ve(e[a],r[a])){n=!0;break}if(!n)return;const o=this._getTransitionParameters();this.light.setLight(e,t,i),this.light.updateTransitions(o)}hasTerrain(){return!!this.terrain&&1===this.terrain.drapeRenderMode}getTerrain(){return this.hasTerrain()?this.terrain.get():null}_startLiteLoad(){void 0===this._drapingLoaded&&(this._drapingLoaded=!1,async function(){return Promise.resolve()}().then(()=>{this._drapingLoaded=!0,this.map._removed||0===this.dispatcher.actors.length||this.map.triggerRepaint()}))}setTerrainForDraping(){this._startLiteLoad(),this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){void 0===this.disableElevatedTerrain&&(this.disableElevatedTerrain=ei.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&Tt("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(e,t=1){if(this._checkLoaded(),!e)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),0===t&&delete this.terrain,null===e?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let i=e;const r=!("source"in e)||null==e.source;if(1===t){if(this._startLiteLoad(),this.disableElevatedTerrain)return;if("source"in i&&"object"==typeof i.source){const e="terrain-dem-src";this.addSource(e,i.source),i=At(i),i=Object.assign(i,{source:e})}const e={...i},t={};if(this.terrain&&r){e.source=this.terrain.get().source;const i=this.terrain?this.getFragmentStyle(this.terrain.scope):null;i&&(t.style=i.serialize())}if(this._validate(BS,"terrain",e,t))return}if(!this.terrain||this.terrain.scope!==this.scope&&!r||this.terrain&&t!==this.terrain.drapeRenderMode){if(!i)return;this._createTerrain(i,t),this.fire(new Or("data",{dataType:"style"}))}else{const t=this.terrain,r=t.get();for(const e of Object.keys(El.terrain))!Object.hasOwn(i,e)&&El.terrain[e].default&&(i[e]=El.terrain[e].default);for(const i in e)if(!Ve(e[i],r[i])){t.set(e,this.options),this.stylesheet.terrain=e;const i=this._getTransitionParameters({duration:0});t.updateTransitions(i),this.fire(new Or("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(e){const t=this.fog=new QS(e,this.map.transform,this.scope,this.options);this.stylesheet.fog=t.get();const i=this._getTransitionParameters({duration:0});t.updateTransitions(i)}_createSnow(e){const t=this.snow=new iT(e,this.map.transform,this.scope,this.options);this.stylesheet.snow=t.get();const i=this._getTransitionParameters({duration:0});t.updateTransitions(i)}_createRain(e){const t=this.rain=new rT(e,this.map.transform,this.scope,this.options);this.stylesheet.rain=t.get();const i=this._getTransitionParameters({duration:0});t.updateTransitions(i)}_updateMarkersOpacity(){0!==this.map._markers.length&&this.map._requestDomTask(()=>{for(const e of this.map._markers)e._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(e){if(this._checkLoaded(),e)if(this.fog){const t=this.fog;if(!Ve(t.get(),e)){t.set(e,this.options),this.stylesheet.fog=t.get();const i=this._getTransitionParameters({duration:0});t.updateTransitions(i)}}else this._createFog(e);else delete this.fog,delete this.stylesheet.fog;this._markersNeedUpdate=!0,this._programPrecompiler&&this._programPrecompiler.reset()}getSnow(){return this.snow?this.snow.get():null}setSnow(e){if(this._checkLoaded(),!e)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){const t=this.snow;if(!Ve(t.get(),e)){t.set(e,this.options),this.stylesheet.snow=t.get();const i=this._getTransitionParameters({duration:0});t.updateTransitions(i)}}else this._createSnow(e);this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(e){if(this._checkLoaded(),!e)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){const t=this.rain;if(!Ve(t.get(),e)){t.set(e,this.options),this.stylesheet.rain=t.get();const i=this._getTransitionParameters({duration:0});t.updateTransitions(i)}}else this._createRain(e);this._markersNeedUpdate=!0}_reloadColorTheme(){const e=()=>{for(const e in this._layers)this._layers[e].lut=this._styleColorTheme.lut;for(const e in this._sourceCaches)this._sourceCaches[e].clearTiles()},t=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!t)return this._styleColorTheme.lut=null,void e();const i=this._evaluateColorThemeData(t);this._loadColorTheme(i).then(()=>{this.fire(new Or("colorthemeset")),e()}).catch(e=>{Tt(`Couldn't set color theme: ${e}`)})}setColorTheme(e){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&Tt("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=e,this._reloadColorTheme()}setImportColorTheme(e,t){const i=this.getFragmentStyle(e);i&&(i._styleColorTheme.colorThemeOverride=t,i._reloadColorTheme())}_getTransitionParameters(e){return{now:ei.now(),transition:Object.assign(this.transition,e)}}updateDrapeFirstLayers(){if(!this.terrain)return;const e=[],t=[];for(const i of this._mergedOrder)this.isLayerDraped(this._mergedLayers[i])?e.push(i):t.push(i);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...e),this._drapedFirstOrder.push(...t)}_createTerrain(e,t){const i=this.terrain=new YS(e,t,this.scope,this.options,this.map.getWorldview());1===t&&(this.stylesheet.terrain=e),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const r=this._getTransitionParameters({duration:0});i.updateTransitions(r);const n=new ll(this.z||0,{...r,worldview:this.map.getWorldview()});i.recalculate(n)}_force3DLayerUpdate(){for(const e in this._layers){const t=this._layers[e];"fill-extrusion"===t.type&&this._updateLayer(t)}}
vendor: 4,282 bytes, line 2
2_forceSymbolLayerUpdate(){for(const e in this._layers){const t=this._layers[e];"symbol"===t.type&&this._updateLayer(t)}}_validate(e,t,i,r,n={}){if(n&&!1===n.validate)return!1;const o={...this.serialize()};return mz(this,e.call(zS,{key:t,style:o,value:i,styleSpec:El,...r}))}_remove(){this._programPrecompiler&&(this._programPrecompiler.reset(),this._programPrecompiler=null),this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),rl.off("pluginStateChange",this._rtlTextPluginCallback);for(const e in this._mergedLayers)this._mergedLayers[e].setEventedParent(null);for(const e in this._mergedSourceCaches){const t=this._mergedSourceCaches[e];t.clearTiles(),t.setEventedParent(null);const i=t.getSource();i&&i.onRemove&&i.onRemove(this.map)}this.imageManager.removeScope(this.scope),this.imageManager.imageAtlasCache.clear(),this.setEventedParent(null),delete this.fog,delete this.snow,delete this.rain,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.indoorManager&&this.indoorManager.destroy(),this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.modelManager.setEventedParent(null),this.modelManager.destroy(),this.dispatcher.remove())}clearSource(e){const t=this.getSourceCaches(e);for(const i of t)i.clearTiles()}clearSources(){for(const e in this._mergedSourceCaches)this._mergedSourceCaches[e].clearTiles()}clearLayers(){for(const e in this._mergedLayers){const t=this._mergedLayers[e];t._clear&&t._clear()}}reloadSource(e){const t=this.getSourceCaches(e);for(const i of t)i.resume(),i.reload()}reloadSources(){for(const e of this.getSources())e.reload&&e.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle(e=>{e.modelManager.reloadModels(e.scope)})}updateSources(e){let t;this.directionalLight&&(t=uA(this.directionalLight));const i=new Set,r=new Set,n=new Set;for(const o in this._mergedLayers){const e=this._mergedLayers[o];"building"===e.type?i.add(e.source):"raster"===e.type&&e.paint&&"ground"===e.paint.get("raster-elevation-reference")&&n.add(e.source),e.hasElevation()&&!r.has(e.source)&&r.add(e.source)}this.updateFrcCoverageFadeRange();for(const o in this._mergedSourceCaches){const a=this._mergedSourceCaches[o],s=r.has(a._source.id);a._isRasterElevatedOverTerrain=n.has(a._source.id),i.has(a._source.id)&&(a._source.reparseOverscaled=!1),a.update(e,void 0,void 0,t,s)}this.updateFrcCoverage(),this.updateElevationCoverage()}_reloadSources(){for(const e in this._sourceCaches){const t=this._sourceCaches[e];t.resume(),t.reload()}}updateFrcCoverageFadeRange(){this.map.painter&&rM.updateFrcCoverageFadeRange&&rM.updateFrcCoverageFadeRange(this,this.map.painter)}updateFrcCoverage(){this._hdCoverage&&rM.updateFrcCoverage&&rM.updateFrcCoverage(this,this._hdCoverage)}updateElevationCoverage(){this.isRootStyle()&&rM.setupAndUpdateElevationCoverage&&rM.setupAndUpdateElevationCoverage(this)}_handleLayerOrderChange(){this._requestFullLabelPlacement(),this.fire(new Or("neworder"))}_requestFullLabelPlacement(){this.pauseablePlacement||(this.pauseablePlacement=new BR),this.pauseablePlacement.requestFullPlacement()}_setLabelPlacementStale(){this.placement&&this.placement.setStale()}_updatePlacement(e,t,i,r,n,o){this.pauseablePlacement||(this.pauseablePlacement=new BR);let a=!1,s=!1;const l={},c={},u="global"===o,h=u?[]:this._mergedOrder;u&&this._driveGlobalPlacement(e,n);for(const g of h){const t=this._mergedLayers[g];if("symbol"!==t.type)continue;const i=Ul(t.source,t.scope);let r=l[i];if(!r){const e=this.getLayerSourceCache(t);if(!e)continue;const n=e.getRenderableIds(!0).map(t=>e.getTileByID(t));c[i]=n.slice(),r=l[i]=n.sort((e,t)=>t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1))}const n=this.crossTileSymbolIndex.addLayer(t,r,e.center.lng,e.projection);a=a||n}this.crossTileSymbolIndex.pruneUnusedLayers(h);const d=Boolean(this.placement&&!e.equals(this.placement.transform)),p=Boolean(this.placement&&(0!==this.placement.lastReplacementSourceUpdateTime&&!n||this.placement.lastReplacementSourceUpdateTime!==n.updateTime)),f=d||p||a,m=(f||this.pauseablePlacement.isStale())&&0===i,_=this.pauseablePlacement.isDone()&&!this.placement.stillRecent(ei.now(),e.zoom)&&
vendor: 11,592 bytes, line 2
20!==i;if((this.pauseablePlacement.isFullPlacementRequested()||!this.pauseablePlacement.placement||m||_)&&(this.pauseablePlacement=this.pauseablePlacement.startNewPlacement(e,h,t,i,r,this.placement,this.fog&&e.projection.supportsFog?this.fog.state:null,this._buildingIndex),this.map.painter)){const t=this.map.painter.maxFrontCutoffRawStart;if(t>0){const i=180*e.pitch/Math.PI;if(i>=15){const e=Math.min(1,Math.max(0,(i-15)/5)),r=e*e*(3-2*e);this.pauseablePlacement.placement.frontCutoffStart=-.5*(1-r)+t*r}}}if(this.pauseablePlacement.isDone()?f&&0!==i&&this.pauseablePlacement.setStale():(this.pauseablePlacement.continuePlacement(h,this._mergedLayers,l,c,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(ei.now()),s=!0),a&&this.pauseablePlacement.setStale()),s||a){this._buildingIndex.onNewFrame(e.zoom);for(let e=0;e<h.length;e++){const i=this._mergedLayers[h[e]];if("symbol"!==i.type)continue;if("none"===i.visibility)continue;const r=this.isLayerClipped(i);this.placement.updateLayerOpacities(i,l[Ul(i.source,i.scope)],e,r?n:null,t,this.map.painter.scaleFactor)}}return!this.pauseablePlacement.isDone()||this.placement.isStale()||this.placement.hasTransitions(ei.now())}_driveGlobalPlacement(e,t){if(0===e.width||0===e.height)return;this.globalPlacement||(this.globalPlacement=new rz);const i=this.globalPlacement;i.startPlacement(ei.now(),e.width,e.height),this._buildingIndex.onNewFrame(e.zoom);const r=this.fog&&e.projection.supportsFog?this.fog.state:null;if(this._groupOrdersVersion!==this._mergedOrderVersion||!this._groupOrders){const e=new Map;for(let t=0;t<this._mergedOrder.length;t++){const i=this._mergedLayers[this._mergedOrder[t]];"placement-group"===i.type&&e.set(i.fqid,Pm(t))}this._groupOrders=e,this._groupOrdersVersion=this._mergedOrderVersion}const n={globalPlacement:i,idRangeAllocator:this.symbolIdRangeAllocator,transform:e,buildingIndex:this._buildingIndex,fogState:r,groupOrders:this._groupOrders,replacementSource:t};for(let o=0;o<this._mergedOrder.length;o++){const e=this._mergedLayers[this._mergedOrder[o]];if("symbol"!==e.type)continue;const t=this.getLayerSourceCache(e);if(!t)continue;const i=t.getRenderableIds(!0).map(e=>t.getTileByID(e)),r=this.isLayerClipped(e);e.placeSymbols(n,i,o,t,r)}i.finishPlacementRun()}_releaseSymbolFadeTiles(){for(const e in this._sourceCaches)this._sourceCaches[e].releaseSymbolFadeTiles()}addImport(e,t){if(this._checkLoaded(),new Set(["__proto__","constructor","prototype"]).has(e.id))return void this.fire(new Br(new Error(`Import id can't be "${e.id}".`)));const i=this.stylesheet.imports=this.stylesheet.imports||[],r=i.findIndex(({id:t})=>t===e.id);if(-1!==r)return void this.fire(new Br(new Error(`Import with id '${e.id}' already exists in the map's style.`)));if(!t)return i.push(e),this._loadImports([e],!0);const n=i.findIndex(({id:e})=>e===t);return-1===n&&this.fire(new Br(new Error(`Import with id "${t}" does not exist on this map.`))),this.stylesheet.imports=i.slice(0,n).concat(e).concat(i.slice(n)),this._loadImports([e],!0,t)}updateImport(e,t){this._checkLoaded();const i=this.stylesheet.imports||[],r=this.getImportIndex(e);return-1===r?this:"string"==typeof t?(this.setImportUrl(e,t),this):(t.url&&t.url!==i[r].url&&this.setImportUrl(e,t.url),Ve(t.config,i[r].config)||this.setImportConfig(e,t.config,t.data.schema),Ve(t.data,i[r].data)||this.setImportData(e,t.data),this)}moveImport(e,t){this._checkLoaded();let i=this.stylesheet.imports||[];const r=this.getImportIndex(e);if(-1===r)return this;const n=this.getImportIndex(t);if(-1===n)return this;const o=i[r],a=this.fragments[r];return i=i.filter(({id:t})=>t!==e),this.fragments=this.fragments.filter(({id:t})=>t!==e),this.stylesheet.imports=i.slice(0,n).concat(o).concat(i.slice(n)),this.fragments=this.fragments.slice(0,n).concat(a).concat(this.fragments.slice(n)),this.mergeLayers(),this}setImportUrl(e,t){this._checkLoaded();const i=this.stylesheet.imports||[],r=this.getImportIndex(e);if(-1===r)return this;i[r].url=t;const n=this.fragments[r];return n.style=this._createFragmentStyle(i[r]),n.style.on("style.import.load",()=>this.mergeAll()),n.style.loadURL(t),this}setImportData(e,t){this._checkLoaded();const i=this.getImportIndex(e),r=this.stylesheet.imports||[];return-1===i?this:t?(this.fragments[i].style.setState(t),this._reloadImports(),this):(delete r[i].data,this.setImportUrl(e,r[i].url))}setImportConfig(e,t,i){this._checkLoaded();const r=this.getImportIndex(e),n=this.stylesheet.imports||[];if(-1===r)return this;t?n[r].config=t:delete n[r].config;const o=this.fragments[r];i&&o.style.stylesheet&&(o.style.stylesheet.schema=i);const a=o.style.stylesheet&&o.style.stylesheet.schema;return o.config=t,o.style.updateConfig(t,a),this.updateConfigDependencies(),this}removeImport(e){this._checkLoaded();const t=this.stylesheet.imports||[],i=this.getImportIndex(e);-1!==i&&(t.splice(i,1),this.fragments[i].style._remove(),this.fragments.splice(i,1),this._reloadImports())}getImportIndex(e){const t=(this.stylesheet.imports||[]).findIndex(t=>t.id===e);return-1===t&&this.fire(new Br(new Error(`Import '${e}' does not exist in the map's style and cannot be updated.`))),t}getLayer(e){return this._mergedLayers[e]}getSources(){const e=[];for(const t in this._mergedOtherSourceCaches){const i=this._mergedOtherSourceCaches[t];i&&e.push(i.getSource())}return e}getSource(e,t){const i=this.getSourceCache(e,t);return i&&i.getSource()}getLayerSource(e){const t=this.getLayerSourceCache(e);return t&&t.getSource()}getSourceCache(e,t){const i=Ul(e,t);return this._mergedOtherSourceCaches[i]}getLayerSourceCache(e){const t=Ul(e.source,e.scope);return"symbol"===e.type?this._mergedSymbolSourceCaches[t]:"fill-extrusion"===e.type?this._mergedFillExtrusionSourceCaches[t]||this._mergedOtherSourceCaches[t]:"fill"===e.type&&e.sourceLayer===mv&&this._mergedHdRoadCoverageSourceCaches[t]?this._mergedHdRoadCoverageSourceCaches[t]:this._mergedOtherSourceCaches[t]}getSourceCaches(e){return null==e?Object.values(this._mergedSourceCaches):[this._mergedOtherSourceCaches[e],this._mergedSymbolSourceCaches[e],this._mergedFillExtrusionSourceCaches[e],this._mergedHdRoadCoverageSourceCaches[e]].filter(Boolean)}updateSourceCaches(){const e=this._changes.getUpdatedSourceCaches();for(const t in e){const i=e[t];"reload"===i?this.reloadSource(t):"clear"===i&&this.clearSource(t)}}updateLayers(e){const t=this._changes.getUpdatedPaintProperties();for(const i of t){const t=this.getLayer(i);t&&t.updateTransitions(e)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(e){this.stylesheet.glyphs=e,this.glyphManager.setURL(e)}getOwnSourceCache(e){return this._otherSourceCaches[e]}getOwnLayerSourceCache(e){return"symbol"===e.type?this._symbolSourceCaches[e.source]:"fill-extrusion"===e.type&&this._fillExtrusionSourceCaches[e.source]||this._otherSourceCaches[e.source]}getOwnSourceCaches(e){return[this._otherSourceCaches[e],this._symbolSourceCaches[e],this._fillExtrusionSourceCaches[e],this._hdCoverage&&this._hdCoverage.coverageSourceCaches[e]].filter(Boolean)}_updateHdCoverageSourceCache(e){return rM.HdCoverageState&&rM.updateHdCoverageSourceCache?(this._hdCoverage||(this._hdCoverage=new rM.HdCoverageState),rM.updateHdCoverageSourceCache(this,this._hdCoverage,e),!1):"fill"===e.type&&e.sourceLayer===mv}_isSourceCacheLoaded(e){const t=this.getOwnSourceCaches(e);return 0===t.length?(this.fire(new Br(new Error(`There is no source with ID '${e}'`))),!1):t.every(e=>e.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(e,t){if(!this._clipLayerPresent&&"fill-extrusion"!==e.type&&"building"!==e.type)return!1;const i="fill-extrusion"===e.type&&("building"===e.sourceLayer||"procedural_buildings"===e.sourceLayer),r="building"===e.type;if(e.is3D(!!this.terrain)){if(i||r||t&&"batched-model"===t.type)return!0;if("model"===e.type)return!0}else if("symbol"===e.type)return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}getBOMObject(){}destroy(){this._clearWorkerCaches(),this.imageManager.imageAtlasCache.clear(),this.fragments.forEach(e=>{e.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}async getImages(e,t){const i=new Promise((e,i)=>{this.imageManager.getImages(t.icons.concat(t.patterns),t.scope,(t,r)=>{t?i(t):e(r)})});this._updateTilesForChangedImages();const r=t.icons.map(e=>Ur.toString(e)),n=t.patterns.map(e=>Ur.toString(e)),o=e=>{e&&(e.setDependencies(t.tileID.key,"icons",r),e.setDependencies(t.tileID.key,"patterns",n))},a=Ul(t.source,t.scope);return o(this._mergedOtherSourceCaches[a]),o(this._mergedSymbolSourceCaches[a]),(t.icons.some(e=>e.iconsetId)||t.patterns.some(e=>e.iconsetId))&&this.fire(new Or("data",{dataType:"style"})),i}async rasterizeImages(e,t){return new Promise((e,i)=>{this.imageManager.rasterizeImages(t,(t,r)=>{t?i(t):e(r)})})}async checkAtlasCache(e,t){const i=this.imageManager.imageAtlasCache.findCachedAtlas(t.descriptor);return i&&i.contentDescriptor?{iconPositions:i.iconPositions,patternPositions:i.patternPositions,sourceHash:i.contentDescriptor.hash}:null}async getGlyphs(e,t){return new Promise((e,i)=>{this.glyphManager.getGlyphs(t.stacks,(t,r)=>{t?i(t):e(r)})})}}bz.registerForPluginStateChange=function(e){return e({pluginStatus:Qs,pluginURL:el}),rl.on("pluginStateChange",e),e};class wz{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(e,t,i,r,n,o,a,s){this.context=e;let l=this.boundPaintVertexBuffers.length!==r.length;for(let u=0;!l&&u<r.length;u++)this.boundPaintVertexBuffers[u]!==r[u]&&(l=!0);let c=this.boundDynamicVertexBuffers.length!==a.length;for(let u=0;!c&&u<a.length;u++)this.boundDynamicVertexBuffers[u]!==a[u]&&(c=!0);if(!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==i||l||c||this.boundIndexBuffer!==n||this.boundVertexOffset!==o)this.freshBind(t,i,r,n,o,a,s);else{e.bindVertexArrayOES.set(this.vao);for(const i of a)i&&(i.bind(),s&&i.instanceCount&&i.setVertexAttribDivisor(e.gl,t,s));n&&n.dynamicDraw&&n.bind()}}freshBind(e,t,i,r,n,o,a){const s=this.context,l=s.gl;this.vao&&this.destroy(),this.vao=s.gl.createVertexArray(),s.bindVertexArrayOES.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=r,this.boundVertexOffset=n,this.boundDynamicVertexBuffers=o,t.enableAttributes(l,e),t.bind(),t.setVertexAttribPointers(l,e,n);for(const c of i)c.enableAttributes(l,e),c.bind(),c.setVertexAttribPointers(l,e,n);for(const c of o)c&&(c.enableAttributes(l,e),c.bind(),c.setVertexAttribPointers(l,e,n),a&&c.instanceCount&&c.setVertexAttribDivisor(l,e,a));r&&r.bind()}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function Ez(e,t,i){const r=function(e,t,i){const r=Q(t,e),n=Q(i,[.2126,.7152,.0722]),o=Wr(1-.3*Math.min(n,1),1,Math.min(r+1,1));return Wr(.92,1,Math.asin(ht(t[2],-1,1))/Math.PI+.5)*o}(e,[0,0,1],t),n=[0,0,0];W(n,i.slice(0,3),r);const o=[0,0,0];W(o,t.slice(0,3),e[2]);const a=[0,0,0];return U(a,n,o),Vt(a)}const Az=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],Iz=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","building","buildingBloom","elevatedStructures","model","symbol"];class Sz{static cacheKey(e,t,i,r){const n=[t];r&&n.push(r.cacheKey);
vendor: 4,493 bytes, line 2
2for(const o of i)("string"==typeof o&&o.includes(" ")||e.usedDefines.has(o))&&n.push(o);return n.join("/")}constructor(e,t,i,r,n,o,a=!1){const s=e.gl;this.program=s.createProgram(),this._context=e,this._fixedUniformsFn=n,this._pending=!0,this._precompiled=a,this.attributes={},this.configuration=r,this.name=t,this.fixedDefines=[...o],a?e._compileStats.precompiled++:e._compileStats.onDemand++;const l=`#version 300 es\n${(r?r.defines():[]).concat(o.map(e=>`#define ${e}`)).join("\n")}`,c=[l,WE];for(const m of i.fragmentIncludes)c.push(NE[m]);c.push(i.fragmentSource);const u=c.join("\n"),h=[l,qE];for(const m of i.vertexIncludes)h.push(NE[m]);this.forceManualRenderingForInstanceIDShaders=e.forceManualRenderingForInstanceIDShaders&&i.vertexSource.includes("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&h.push("uniform int u_instanceID;"),h.push(i.vertexSource);let d=h.join("\n");this.forceManualRenderingForInstanceIDShaders&&(d=d.replaceAll("gl_InstanceID","u_instanceID"));const p=s.createShader(s.FRAGMENT_SHADER);if(s.isContextLost())return this.failedToCreate=!0,void(this._pending=!1);s.shaderSource(p,u),s.compileShader(p),s.attachShader(this.program,p);const f=s.createShader(s.VERTEX_SHADER);if(s.isContextLost())return this.failedToCreate=!0,void(this._pending=!1);s.shaderSource(f,d),s.compileShader(f),s.attachShader(this.program,f),s.linkProgram(this.program),this._fragmentShader=p,this._vertexShader=f,e.extParallelShaderCompile?e._pendingPrograms.add(this):this._finalize()}_finalize(){if(!this._pending)return;this._pending=!1;const e=this._context,t=e.gl;e._pendingPrograms.delete(this);const i=ei.now(),r=t.getProgramParameter(this.program,t.LINK_STATUS),n=ei.now()-i,o=e._compileStats;if(o.totalStallMs+=n,n>o.maxStallMs&&(o.maxStallMs=n),n>1){o.framesMissed+=Math.floor(60*n/1e3);const e=this.fixedDefines.join(",");o.stalls.push({name:`${this.name}${e?"/":""}${e}`,ms:n,timestamp:i})}if(this._fragmentShader&&(r||Tt(`Fragment shader '${this.name}': ${t.getShaderInfoLog(this._fragmentShader)}`),t.deleteShader(this._fragmentShader),this._fragmentShader=null),this._vertexShader&&(r||Tt(`Vertex shader '${this.name}': ${t.getShaderInfoLog(this._vertexShader)}`),t.deleteShader(this._vertexShader),this._vertexShader=null),!r)return Tt(`Failed to link program '${this.name}': ${t.getProgramInfoLog(this.program)}`),void(this.failedToCreate=!0);this.fixedUniforms=this._fixedUniformsFn(e),this.fixedUniformsEntries=Object.entries(this.fixedUniforms),this.binderUniforms=this.configuration?this.configuration.getUniforms(e):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(e=>({u_instanceID:new vh(e)}))(e));const a=this.fixedDefines,s=this.name;(a.includes("TERRAIN")||a.includes("ELEVATED")||s.includes("symbol")||s.includes("circle"))&&(this.terrainUniforms=(e=>({u_dem:new vh(e),u_dem_prev:new vh(e),u_dem_tl:new wh(e),u_dem_scale:new bh(e),u_dem_tl_prev:new wh(e),u_dem_scale_prev:new bh(e),u_dem_size:new bh(e),u_dem_lerp:new bh(e),u_exaggeration:new bh(e),u_depth:new vh(e),u_depth_size_inv:new wh(e),u_depth_range_unpack:new wh(e),u_occluder_half_size:new bh(e),u_occlusion_depth_offset:new bh(e),u_meter_to_dem:new bh(e),u_label_plane_matrix_inv:new Th(e)}))(e)),a.includes("GLOBE")&&(this.globeUniforms=(e=>({u_tile_tl_up:new Eh(e),u_tile_tr_up:new Eh(e),u_tile_br_up:new Eh(e),u_tile_bl_up:new Eh(e),u_tile_up_scale:new bh(e)}))(e)),a.includes("FOG")&&(this.fogUniforms=(e=>({u_fog_matrix:new Th(e),u_fog_range:new wh(e),u_fog_color:new Ih(e),u_fog_horizon_blend:new bh(e),u_fog_vertical_limit:new wh(e),u_fog_temporal_offset:new bh(e),u_frustum_tl:new Eh(e),u_frustum_tr:new Eh(e),u_frustum_br:new Eh(e),u_frustum_bl:new Eh(e),u_globe_pos:new Eh(e),u_globe_radius:new bh(e),u_globe_transition:new bh(e),u_is_globe:new vh(e),u_viewport:new wh(e)}))(e)),a.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(e=>({u_cutoff_params:new Ih(e)}))(e)),a.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(e=>({u_lighting_ambient_color:new Eh(e),u_lighting_directional_dir:new Eh(e),u_lighting_directional_color:new Eh(e),u_ground_radiance:new Eh(e)}))(e)),a.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(e=>({u_light_matrix_0:new Th(e),u_light_matrix_1:new Th(e),u_fade_range:new wh(e),u_shadow_normal_offset:new Eh(e),u_shadow_intensity:new bh(e),u_shadow_texel_size:new bh(e),u_shadow_map_resolution:new bh(e),u_shadow_direction:new Eh(e),u_shadow_bias:new Eh(e),u_shadowmap_0:new vh(e),u_shadowmap_1:new vh(e)}))(e))}
vendor: 5,438 bytes, line 2
2maybeFinalize(){if(!this._pending)return;const e=this._context.extParallelShaderCompile;e&&!this._context.gl.getProgramParameter(this.program,e.COMPLETION_STATUS_KHR)||this._finalize()}_ensureReady(){this._pending&&(this._finalize(),this._context.sweepPendingPrograms())}getAttributeLocation(e,t){this._ensureReady();let i=this.attributes[t];return void 0===i&&(i=this.attributes[t]=e.getAttribLocation(this.program,t)),i}_setUniformGroup(e,t,i){this._ensureReady();const r=this[t];if(!this.failedToCreate&&r){e.program.set(this.program);for(const e in i){const t=r[e];t&&t.set(this.program,e,i[e])}}}setTerrainUniformValues(e,t){this._setUniformGroup(e,"terrainUniforms",t)}setGlobeUniformValues(e,t){this._setUniformGroup(e,"globeUniforms",t)}setFogUniformValues(e,t){this._setUniformGroup(e,"fogUniforms",t)}setCutoffUniformValues(e,t){this._setUniformGroup(e,"cutoffUniforms",t)}setLightsUniformValues(e,t){this._setUniformGroup(e,"lightsUniforms",t)}setShadowUniformValues(e,t){this._setUniformGroup(e,"shadowUniforms",t)}_drawDebugWireframe(e,t,i,r,n,o,a,s,l,c){const u=e.options.wireframe;if(!1===u.terrain&&!1===u.layers2D&&!1===u.layers3D)return;const h=e.context;if(!(()=>!(!u.terrain||"terrainRaster"!==this.name&&"globeRaster"!==this.name)||!(!u.layers2D||e._terrain&&e._terrain.renderingToTexture||!Az.includes(this.name))||!(!u.layers3D||!Iz.includes(this.name)))())return;const d=h.gl,p=e.wireframeDebugCache.getLinesFromTrianglesBuffer(e.frameCounter,n,h);if(!p)return;const f=[...this.fixedDefines,"DEBUG_WIREFRAME"],m=e.getOrCreateProgram(this.name,{config:this.configuration,defines:f});m._ensureReady(),h.program.set(m.program);const _=(e,t,i)=>{if(t[e]&&i[e])for(const r in t[e])i[e][r]&&i[e][r].set(i.program,r,t[e][r].current)};l&&l.setUniforms(m.program,h,m.binderUniforms,a,{zoom:s}),_("fixedUniforms",this,m),_("terrainUniforms",this,m),_("globeUniforms",this,m),_("fogUniforms",this,m),_("lightsUniforms",this,m),_("shadowUniforms",this,m),p.bind(),h.setColorMode(new pw([d.ONE,d.ONE_MINUS_SRC_ALPHA,d.ZERO,d.ONE],Zr.transparent,[!0,!0,!0,!1])),h.setDepthMode(new fw(t.func===d.LESS?d.LEQUAL:t.func,fw.ReadOnly,t.range)),h.setStencilMode(uw.disabled);const g=3*o.primitiveLength*2,y=3*o.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const e=c||1;for(let t=0;t<e;++t)m.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",t),d.drawElements(d.LINES,g,d.UNSIGNED_SHORT,y)}else c&&c>1?d.drawElementsInstanced(d.LINES,g,d.UNSIGNED_SHORT,y,c):d.drawElements(d.LINES,g,d.UNSIGNED_SHORT,y);n.bind(),h.program.set(this.program),h.setDepthMode(t),h.setStencilMode(i),h.setColorMode(r)}checkUniforms(e,t,i){if(this.fixedDefines.includes(t))for(const r of Object.keys(i))if(!i[r].initialized)throw new Error(`Program '${this.name}', from draw '${e}': uniform ${r} not set but required by ${t} being defined`)}draw(e,t,i,r,n,o,a,s,l,c,u,h,d,p,f,m){const _=e.context,g=_.gl;if(this._ensureReady(),this.failedToCreate)return;_.program.set(this.program),_.setDepthMode(i),_.setStencilMode(r),_.setColorMode(n),_.setCullFace(o);for(const[E,A]of this.fixedUniformsEntries)A.set(this.program,E,a[E]);p&&p.setUniforms(this.program,_,this.binderUniforms,h,{zoom:d});const y={[g.POINTS]:1,[g.LINES]:2,[g.TRIANGLES]:3,[g.LINE_STRIP]:1}[t];this.checkUniforms(s,"RENDER_SHADOWS",this.shadowUniforms);const x=f||[],v=p?p.getPaintVertexBuffers():[],b=t===g.TRIANGLES&&c,w=m&&m>0?1:void 0;for(const E of u.get()){const o=E.vaos||(E.vaos={});if((o[s]||(o[s]=new wz)).bind(_,this,l,v,c,E.vertexOffset,x,w),this.forceManualRenderingForInstanceIDShaders){const e=m||1;for(let i=0;i<e;++i)this.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",i),c?g.drawElements(t,E.primitiveLength*y,g.UNSIGNED_SHORT,E.primitiveOffset*y*2):g.drawArrays(t,E.vertexOffset,E.vertexLength)}else m&&m>1?g.drawElementsInstanced(t,E.primitiveLength*y,g.UNSIGNED_SHORT,E.primitiveOffset*y*2,m):c?g.drawElements(t,E.primitiveLength*y,g.UNSIGNED_SHORT,E.primitiveOffset*y*2):g.drawArrays(t,E.vertexOffset,E.vertexLength);b&&this._drawDebugWireframe(e,i,r,n,c,E,h,d,p,m)}}}class Tz{constructor(e,t,i,r){this.id=Tz.uniqueIdxCounter,Tz.uniqueIdxCounter++,this.context=e;const n=e.gl;this.buffer=n.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||r||t.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){this.id=Tz.uniqueIdxCounter,Tz.uniqueIdxCounter++;const t=this.context.gl;this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}Tz.uniqueIdxCounter=0;const Dz={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Mz{constructor(e,t,i,r,n,o){this.length=t.length,this.attributes=i,this.itemSize=t.bytesPerElement,this.dynamicDraw=r,this.instanceCount=o,this.context=e;const a=e.gl;this.buffer=a.createBuffer(),e.bindVertexBuffer.set(this.buffer),a.bufferData(a.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||n||t.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){const t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}
vendor: 5,319 bytes, line 2
2enableAttributes(e,t){for(const i of this.attributes){const r=t.getAttributeLocation(e,i.name);-1!==r&&e.enableVertexAttribArray(r)}}setVertexAttribPointers(e,t,i){for(const r of this.attributes){const n=t.getAttributeLocation(e,r.name);if(-1!==n){const t=r.offset+this.itemSize*(i||0);"Float32"===r.type||r.normalized?e.vertexAttribPointer(n,r.components,e[Dz[r.type]],!!r.normalized,this.itemSize,t):e.vertexAttribIPointer(n,r.components,e[Dz[r.type]],this.itemSize,t)}}}setVertexAttribDivisor(e,t,i){for(let r=0;r<this.attributes.length;r++){const n=t.getAttributeLocation(e,this.attributes[r].name);-1!==n&&this.instanceCount&&this.instanceCount>0&&e.vertexAttribDivisor(n,i)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Pz{constructor(e,t,i,r,n){this.context=e,this.width=t,this.height=i;const o=this.framebuffer=e.gl.createFramebuffer();r>0&&(this.colorAttachment0=new jM(e,o,0)),r>1&&(this.colorAttachment1=new jM(e,o,1)),n&&(this.depthAttachmentType=n,this.depthAttachment="renderbuffer"===n?new GM(e,o):new HM(e,o))}static createWithTexture(e,t,i,r,n){const o=e.gl;if(e.activeTexture.set(o.TEXTURE1),e.viewport.set([0,0,i,r]),t&&t.width===i&&t.height===r)return o.bindTexture(o.TEXTURE_2D,t.colorAttachment0.get()),e.bindFramebuffer.set(t.framebuffer),t;t&&t.destroy();const a=e.extRenderToTextureHalfFloat||e.extColorBufferFloat?e.gl.RGBA16F:e.gl.RGBA8,s=new $m(e,{width:i,height:r,data:null},a);s.bind(o.LINEAR,o.CLAMP_TO_EDGE);const l=e.createFramebuffer(i,r,1,null);if(l.format=a,l.colorAttachment0.set(s.texture),n){const t=e.createRenderbuffer(o.DEPTH24_STENCIL8,i,r);e.bindFramebuffer.set(l.framebuffer),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,t),l._stencilRbo=t}return l}createColorAttachment(e,t){0===t?this.colorAttachment0=new jM(e,this.framebuffer,0):1===t&&(this.colorAttachment1=new jM(e,this.framebuffer,1))}removeColorAttachment(e,t){const i=this.context.gl;let r;0===t?(r=this.colorAttachment0.get(),this.colorAttachment0=void 0):1===t&&(r=this.colorAttachment1.get(),this.colorAttachment1=void 0),r&&i.deleteTexture(r)}destroy(){const e=this.context.gl;if(this.colorAttachment0){const t=this.colorAttachment0.get();t&&e.deleteTexture(t)}if(this.colorAttachment1){const t=this.colorAttachment1.get();t&&e.deleteTexture(t)}if(this.depthAttachment&&this.depthAttachmentType)if("renderbuffer"===this.depthAttachmentType){const t=this.depthAttachment.get();t&&e.deleteRenderbuffer(t)}else{const t=this.depthAttachment.get();t&&e.deleteTexture(t)}this._stencilRbo&&(e.deleteRenderbuffer(this._stencilRbo),this._stencilRbo=null),e.deleteFramebuffer(this.framebuffer)}}class Cz{constructor(e,t){this.gl=e,this._pendingPrograms=new Set,this._compileStats={precompiled:0,onDemand:0,totalStallMs:0,maxStallMs:0,framesMissed:0,stalls:[]},this.clearColor=new uM(this),this.clearDepth=new hM(this),this.clearStencil=new dM(this),this.colorMask=new pM(this),this.depthMask=new fM(this),this.stencilMask=new mM(this),this.stencilFunc=new _M(this),this.stencilOp=new gM(this),this.stencilTest=new yM(this),this.depthRange=new xM(this),this.depthTest=new vM(this),this.depthFunc=new bM(this),this.blend=new wM(this),this.blendFunc=new EM(this),this.blendColor=new AM(this),this.blendEquation=new IM(this),this.cullFace=new SM(this),this.cullFaceSide=new TM(this),this.frontFace=new DM(this),this.program=new MM(this),this.activeTexture=new PM(this),this.viewport=new CM(this),this.bindFramebuffer=new RM(this),this.bindRenderbuffer=new zM(this),this.bindTexture=new LM(this),this.bindVertexBuffer=new FM(this),this.bindElementBuffer=new OM(this),this.bindVertexArrayOES=new BM(this),this.pixelStoreUnpack=new kM(this),this.pixelStoreUnpackPremultiplyAlpha=new VM(this),this.pixelStoreUnpackFlipY=new NM(this),this.options=t?{...t}:{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=e.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=e.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=e.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.forceManualRenderingForInstanceIDShaders=t&&!!t.forceManualRenderingForInstanceIDShaders||this.renderer&&this.renderer.includes("PowerVR"),this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=e.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=e.getExtension("EXT_color_buffer_half_float"),this.extColorBufferFloat=e.getExtension("EXT_color_buffer_float"),this.extTimerQuery=e.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),this.maxUniformBlockSize=Math.min(e.getParameter(e.MAX_UNIFORM_BLOCK_SIZE),32768),this.maxUniformBufferBindings=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS),this.extBlendFuncExtended=e.getExtension("WEBGL_blend_func_extended"),this.extParallelShaderCompile=e.getExtension("KHR_parallel_shader_compile")}
vendor: 9,753 bytes, line 2
2sweepPendingPrograms(){if(0!==this._pendingPrograms.size)for(const e of this._pendingPrograms)e.maybeFinalize()}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,t,i){return new Tz(this,e,t,i)}createVertexBuffer(e,t,i,r,n){return new Mz(this,e,t,i,r,n)}createRenderbuffer(e,t,i){const r=this.gl,n=r.createRenderbuffer();return this.bindRenderbuffer.set(n),r.renderbufferStorage(r.RENDERBUFFER,e,t,i),this.bindRenderbuffer.set(null),n}createFramebuffer(e,t,i,r){return new Pz(this,e,t,i,r)}clear({color:e,depth:t,stencil:i,colorMask:r}){const n=this.gl;let o=0;e&&(o|=n.COLOR_BUFFER_BIT,this.clearColor.set(e.toNonPremultipliedRenderColor(null)),this.colorMask.set(r||[!0,!0,!0,!0])),void 0!==t&&(o|=n.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),void 0!==i&&(o|=n.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),n.clear(o)}setCullFace(e){!1===e.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){Ve(e.blendFunction,pw.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor),e.blendEquation?this.blendEquation.set(e.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(e.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}const Rz=p();function zz(e){const t=x([],e._camera.getWorldToCamera(e.worldSize,1),e.globeMatrix);y(t,t);const i=[0,0,0],r=[0,1,0,0];return me(r,r,t),i[0]=r[0],i[1]=r[1],i[2]=r[2],J(i,i),i}function Lz({width:e,height:t,anchor:i,textOffset:r,textScale:n},o){const{horizontalAlign:a,verticalAlign:s}=yp(i),l=-(a-.5)*e,c=-(s-.5)*t,u=Mp(i,r);return new ke((l/n+u[0])*o,(c/n+u[1])*o)}function Fz(e,t,i,r,n,o,a,s,l,c){const u=e.text.placedSymbolArray,h=e.text.dynamicLayoutVertexArray,d=e.icon.dynamicLayoutVertexArray,p={},f=e.getProjection(),m=Dm(a,f,n),_=n.elevation,g=f.upVectorScale(a.canonical,n.center.lat,n.worldSize).metersToTile;h.clear();for(let y=0;y<u.length;y++){const d=u.get(y),{tileAnchorX:x,tileAnchorY:v,numGlyphs:b}=d,w=d.hidden||!d.crossTileID||e.allowVerticalPlacement&&!d.placedOrientation?null:r[d.crossTileID];if(w){let r=0,u=0,E=0;const A="road"===e.elevationType;if(_||A){const t=new ke(x,v);let i=0;if(A&&e.hdExt){const r=e.symbolInstances.get(e.text.symbolInstanceIndices[y]);if(e.hdExt.isCrossTileRoadElevation(r.elevationFeatureIndex,a.canonical)){const r=e.hdExt.getRoadFeatureHeightForPlacedSymbol(e,e.text,y,t,a.canonical);i=null!==r?r:0}else{const r=e.hdExt.getElevationFeatureForPlacedSymbol(e,e.text,y);i=xm.getAtTileOffset(a,t,_,void 0!==r?r:null)}}else i=xm.getAtTileOffset(a,t,_,null);const[n,o,s]=f.upVector(a.canonical,x,v);r=i*n*g,u=i*o*g,E=i*s*g}let[I,S,T,D]=Dw(d.projectedAnchorX+r,d.projectedAnchorY+u,d.projectedAnchorZ+E,i?m:o);const M=Mw(n.getCameraToCenterDistance(f),D);let P=Ap(e.textSizeData,l,d)*M/mp;i&&(P*=e.tilePixelRatio/s);const C=Lz(w,P);i?(({x:I,y:S,z:T}=f.projectTilePoint(x+C.x,v+C.y,a.canonical)),[I,S,T]=Dw(I+r,S+u,T+E,o)):(t&&C._rotate(-n.angle),I+=C.x,S+=C.y,T=0);const R=e.allowVerticalPlacement&&d.placedOrientation===gp.vertical?Math.PI/2:0;for(let e=0;e<b;e++)v_(h,I,S,T,R);c&&d.associatedIconIndex>=0&&(p[d.associatedIconIndex]={x:I,y:S,z:T,angle:R})}else Vw(b,h)}if(c){d.clear();const t=e.icon.placedSymbolArray;for(let e=0;e<t.length;e++){const i=t.get(e),{numGlyphs:r}=i,n=p[e];if(i.hidden||!n)Vw(r,d);else{const{x:e,y:t,z:i,angle:o}=n;for(let n=0;n<r;n++)v_(d,e,t,i,o)}}e.icon.dynamicLayoutVertexBuffer.updateData(d)}e.text.dynamicLayoutVertexBuffer.updateData(h)}function Oz(e,t,i,r,n,o,a={}){const s=i.paint.get("icon-translate"),l=i.paint.get("text-translate"),c=i.paint.get("icon-translate-anchor"),u=i.paint.get("text-translate-anchor"),h=i.layout.get("icon-rotation-alignment"),d=i.layout.get("text-rotation-alignment"),f=i.layout.get("icon-pitch-alignment"),m=i.layout.get("text-pitch-alignment"),_=i.layout.get("icon-keep-upright"),g=i.layout.get("text-keep-upright"),x=i.paint.get("icon-color-saturation"),v=i.paint.get("icon-color-contrast"),b=i.paint.get("icon-color-brightness-min"),w=i.paint.get("icon-color-brightness-max"),E="sea"===i.layout.get("symbol-elevation-reference"),A="none"===i.layout.get("icon-image-use-theme"),I=e.context,S=I.gl,T=e.transform,D="map"===h,M="map"===d,P="map"===f,C="map"===m,R=void 0!==i.layout.get("symbol-sort-key").constantOr(1);let z=!1;const L=e.depthModeForSublayer(0,fw.ReadOnly),F=new fw(e.context.gl.LEQUAL,fw.ReadOnly,e.depthRangeFor3D),O=[Wn(T.center.lng),qn(T.center.lat)],B=i.layout.get("text-variable-anchor"),k="globe"===T.projection.name,V=[],N=[0,-1,0];for(const U of r){const r=t.getTile(U),n=r.getBucket(i);if(!n)continue;if("mercator"===n.projection.name&&k)continue;if(n.fullyClipped)continue;const o="globe"===n.projection.name,h=o?mf(T.zoom):0,d=Dm(U,n.getProjection(),T),f=T.calculatePixelsToTileUnitsMatrix(r),m=B&&n.hasTextData(),j=n.hasIconTextFit()&&m&&n.hasIconData(),G=n.getProjection().createInversionMatrix(T,U.canonical),H=(1<<r.tileID.canonical.z)*co/e.transform.worldSize,$=t=>{let i=[0,0,0];if(t){const t=e.style.directionalLight,r=e.style.ambientLight;t&&r&&(i=hA(e.style,t,r))}return i},W=t=>{const i=Math.floor(e.context.maxUniformBlockSize/4),r=Math.floor(i/4);t.push(`MAX_UBO_SIZE_VEC4 ${r}u`)},q=t=>{T.depthOcclusionForSymbolsAndCircles&&(i.hasOcclusionOpacityProperties||e.terrain)&&(t.push("DEPTH_D24"),t.push("DEPTH_OCCLUSION"))},Z=t=>{i.lut&&!A&&(i.lut.texture||(i.lut.texture=new Wm(e.context,i.lut.image,[i.lut.image.height,i.lut.image.height,i.lut.image.height],I.gl.RGBA8)),I.activeTexture.set(I.gl.TEXTURE0+10),i.lut.texture&&i.lut.texture.bind(I.gl.LINEAR,I.gl.CLAMP_TO_EDGE),t.push("APPLY_LUT_ON_GPU"))},X=()=>{const t=D&&"point"!==i.layout.get("symbol-placement"),a=[];q(a),Z(a);const l=t||j,u="road"===n.elevationType,m=e.shadowRenderer,g=u&&P&&!!m&&m.enabled,A=$(g),I=u&&P&&!e.terrain?F:L,M=i.paint.get("icon-image-cross-fade");e.terrainRenderModeElevated()&&P&&a.push("PITCH_WITH_MAP_TERRAIN"),o&&(a.push("PROJECTION_GLOBE_VIEW"),l&&a.push("PROJECTED_POS_ON_VIEWPORT")),M>0&&n.hasAnySecondaryIcon&&a.push("ICON_TRANSITION"),!n.icon.zOffsetVertexBuffer||u&&e.terrain||a.push("Z_OFFSET"),0===x&&0===v&&0===b&&1===w||a.push("COLOR_ADJUSTMENT"),g&&a.push("RENDER_SHADOWS","NORMAL_OFFSET"),u&&P&&!e.terrain&&n.icon.orientationVertexBuffer&&a.push("ELEVATED_ROADS"),W(a);const C=e.getOrCreateProgram("symbol",{defines:a}),R=r.imageAtlasTexture?r.imageAtlasTexture.size:[0,0],z=n.iconSizeData,B=Ip(z,T.zoom),V=P||!T.isOrthographic,X=Iw(d,r.tileID.canonical,P,D,T,n.getProjection(),f),Y=Tw(d,r.tileID.canonical,P,D,T,n.getProjection(),f),K=n.icon.uboBinder&&n.icon.uboBinder.hasPerFeatureTranslate()?[0,0]:s,J=e.translatePosMatrix(Y,r,K,c,!0),Q=e.translatePosMatrix(d,r,K,c),ee=l?Rz:X,te=D&&!P&&!t;let ie=N;!k&&!T.mercatorFromTransition||D||(ie=zz(T));const re=o?ie:N,ne=i.getColorAdjustmentMatrix(x,v,b,w),oe=xP(z.kind,B,te,P,e,Q,ee,J,E,!1,n.sdfIcons,R,[0,0],0,U,h,O,G,re,n.getProjection(),A,H,ne,M,null),ae=r.imageAtlasTexture?r.imageAtlasTexture:null,se=1!==i.layout.get("icon-size").constantOr(0)||n.iconsNeedLinear,le=n.sdfIcons||e.options.rotating||e.options.zooming||se||V?S.LINEAR:S.NEAREST,ce=n.sdfIcons&&0!==i.paint.get("icon-halo-width").constantOr(1),ue=e.terrain&&P&&t?y(p(),X):Rz;if(t&&n.icon){const t=xm.getAtTileOffsetFunc(U,T.center.lat,T.worldSize,n.getProjection()),o=Sw(d,r.tileID.canonical,P,D,T,n.getProjection(),f),a=i.layout.get("icon-size-scale-range"),s=ht(e.scaleFactor,a[0],a[1]);Cw(n,d,e,!1,o,Y,P,_,t,U,s)}return{program:C,buffers:n.icon,uniformValues:oe,atlasTexture:ae,atlasTextureIcon:null,atlasInterpolation:le,atlasInterpolationIcon:null,isSDF:n.sdfIcons,hasH
vendor: 17,577 bytes, line 2
2alo:ce,depthMode:I,tile:r,renderWithShadows:g,labelPlaneMatrixInv:ue}},Y=()=>{const t=M&&"point"!==i.layout.get("symbol-placement"),a=[],s=t||B||j,c="road"===n.elevationType,m=e.shadowRenderer,_=c&&C&&!!m&&m.enabled,x=$(_),v=c&&C&&!e.terrain?F:L;e.terrainRenderModeElevated()&&C&&a.push("PITCH_WITH_MAP_TERRAIN"),o&&(a.push("PROJECTION_GLOBE_VIEW"),s&&a.push("PROJECTED_POS_ON_VIEWPORT")),!n.text.zOffsetVertexBuffer||c&&e.terrain||a.push("Z_OFFSET"),n.iconsInText&&a.push("RENDER_TEXT_AND_SYMBOL"),_&&a.push("RENDER_SHADOWS","NORMAL_OFFSET"),c&&C&&!e.terrain&&n.text.orientationVertexBuffer&&a.push("ELEVATED_ROADS"),q(a),W(a);const b=e.getOrCreateProgram("symbol",{defines:a});let w,A=[0,0],I=null;const D=n.textSizeData;n.iconsInText&&(A=r.imageAtlasTexture?r.imageAtlasTexture.size:[0,0],I=r.imageAtlasTexture?r.imageAtlasTexture:null,w=C||!T.isOrthographic||e.options.rotating||e.options.zooming||"composite"===D.kind||"camera"===D.kind?S.LINEAR:S.NEAREST);const P=r.glyphAtlasTexture?r.glyphAtlasTexture.size:[0,0],R=i.layout.get("text-size-scale-range"),z=ht(e.scaleFactor,R[0],R[1]),V=Ip(D,T.zoom,z),Z=Iw(d,r.tileID.canonical,C,M,T,n.getProjection(),f),X=Tw(d,r.tileID.canonical,C,M,T,n.getProjection(),f),Y=n.text.uboBinder&&n.text.uboBinder.hasPerFeatureTranslate()?[0,0]:l,K=e.translatePosMatrix(X,r,Y,u,!0),J=e.translatePosMatrix(d,r,Y,u),Q=s?Rz:Z,ee=M&&!C&&!t;let te=N;!k&&!T.mercatorFromTransition||M||(te=zz(T));const ie=xP(D.kind,V,ee,C,e,J,Q,K,E,!0,!0,P,A,0,U,h,O,G,o?te:N,n.getProjection(),x,H,null,null,z),re=r.glyphAtlasTexture?r.glyphAtlasTexture:null,ne=S.LINEAR,oe=0!==i.paint.get("text-halo-width").constantOr(1),ae=e.terrain&&C&&t?y(p(),Z):Rz;if(t&&n.text){const t=xm.getAtTileOffsetFunc(U,T.center.lat,T.worldSize,n.getProjection()),i=Sw(d,r.tileID.canonical,C,M,T,n.getProjection(),f);Cw(n,d,e,!0,i,X,C,g,t,U,z)}return{program:b,buffers:n.text,uniformValues:ie,atlasTexture:re,atlasTextureIcon:I,atlasInterpolation:ne,atlasInterpolationIcon:w,isSDF:!0,hasHalo:oe,depthMode:v,tile:r,renderWithShadows:_,labelPlaneMatrixInv:ae}},K=n.icon.segments.get().length,J=n.text.segments.get().length,Q=K&&!a.onlyText?X():null,ee=J&&!a.onlyIcons?Y():null,te=i.paint.get("icon-opacity").constantOr(1),ie=i.paint.get("text-opacity").constantOr(1);if(R&&n.canOverlap){z=!0;const e=te&&!a.onlyText?n.icon.segments.get():[],t=ie&&!a.onlyIcons?n.text.segments.get():[];for(const i of e)V.push({segments:new uh([i]),sortKey:i.sortKey,state:Q});for(const i of t)V.push({segments:new uh([i]),sortKey:i.sortKey,state:ee})}else a.onlyText||V.push({segments:te?n.icon.segments:new uh([]),sortKey:0,state:Q}),a.onlyIcons||V.push({segments:ie?n.text.segments:new uh([]),sortKey:0,state:ee})}z&&V.sort((e,t)=>e.sortKey-t.sortKey);for(const p of V){const t=p.state;if(t)if(e.terrain?e.terrain.setupElevationDraw(t.tile,t.program,{useDepthForOcclusion:T.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:t.labelPlaneMatrixInv}):e.setupDepthForOcclusion(T.depthOcclusionForSymbolsAndCircles,t.program),I.activeTexture.set(S.TEXTURE0),t.atlasTexture&&t.atlasTexture.bind(t.atlasInterpolation,S.CLAMP_TO_EDGE,!0),t.atlasTextureIcon&&(I.activeTexture.set(S.TEXTURE1),t.atlasTextureIcon&&t.atlasTextureIcon.bind(t.atlasInterpolationIcon,S.CLAMP_TO_EDGE,!0)),t.renderWithShadows&&e.shadowRenderer.setupShadows(t.tile.tileID.toUnwrapped(),t.program,"vector-tile"),e.uploadCommonLightUniforms(e.context,t.program),t.hasHalo){const r=t.uniformValues;r.u_is_halo=1,Bz(t.buffers,p.segments,i,e,t.program,t.depthMode,n,o,r,2),r.u_is_halo=0}else{if(t.isSDF){const r=t.uniformValues;t.hasHalo&&(r.u_is_halo=1,Bz(t.buffers,p.segments,i,e,t.program,t.depthMode,n,o,r,1)),r.u_is_halo=0}Bz(t.buffers,p.segments,i,e,t.program,t.depthMode,n,o,t.uniformValues,1)}}}function Bz(e,t,i,r,n,o,a,s,l,c){const u=r.context,h=u.gl,d=[e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer,e.iconTransitioningVertexBuffer,e.globeExtVertexBuffer,e.zOffsetVertexBuffer,e.orientationVertexBuffer];e.featureIdBuffer&&d.push(e.featureIdBuffer);const p=e.uboBinder?null:e.programConfigurations.get(i.id);if(e.uboBinder){e.uboBinder.layer=i;const t=r.transform.zoom,n=r.style.getBrightness?r.style.getBrightness():null,o=e.uboBinder.getConstantUniformValues(t,n);l.u_spp_fill_np_color=o.fill_np_color,l.u_spp_halo_np_color=o.halo_np_color,l.u_spp_opacity=o.opacity,l.u_spp_halo_width=o.halo_width,l.u_spp_halo_blur=o.halo_blur,l.u_spp_emissive_strength=o.emissive_strength,l.u_spp_occlusion_opacity=o.occlusion_opacity,l.u_spp_z_offset=o.z_offset,l.u_spp_zoom_fraction=t-e.uboBinder._floorZoom;const a=i.paint.get(e.uboBinder.isText?"text-translate-anchor":"icon-translate-anchor"),s=e.uboBinder.hasPerFeatureTranslate()&&"map"===a?r.transform.angle:0;l.u_spp_translate_rotation=[Math.cos(s),Math.sin(s)]}const{batchIndices:f,batchSegments:m}=e.getBatchGrouping(t);for(const _ of f){const t=m.get(_);e.uboBinder&&e.uboBinder.bind(u,n.program,_),n.draw(r,h.TRIANGLES,o,a,s,gw.disabled,l,i.id,e.layoutVertexBuffer,e.indexBuffer,t,i.paint,r.transform.zoom,p,d,c)}}function kz(e,t,i,r,n,o){const a=i.paint.get("line-width"),s=i.paint.get("line-emissive-strength").isConstant(),l=i.paint.get("line-emissive-strength").constantOr(0),c=i.paint.get("line-occlusion-opacity"),u=i.layout.get("line-elevation-reference"),h="meters"===i.layout.get("line-width-unit"),d="sea"===u,p=!(!e.terrain||!e.terrain.enabled),f=e.context,m=f.gl;if(i.hasElevatedBuckets&&"globe"===e.transform.projection.name)return;const _=i.layout.get("line-cross-slope"),g=void 0!==_,y=_<1,x=n||e.colorModeForDrapableLayerRenderPass(s?l:null),v=e.terrain&&e.terrain.renderingToTexture||o,b=v?1:ei.devicePixelRatio,w=i.paint.get("line-dasharray"),E=w.constantOr(1),A=i.layout.get("line-cap"),I=w.constantOr(null),S=A.constantOr(null),T=i.paint.get("line-pattern"),D=T.constantOr(1),M=i.paint.get("line-pattern-cross-fade"),P=T.constantOr(null),C=i.paint.get("line-opacity").constantOr(1);let R=!D&&1!==C||e.depthOcclusion&&c>0&&c<1;const z=i.paint.get("line-gradient"),L=0!==i.paint.get("line-border-width").constantOr(1)?i.paint.get("line-border-gradient"):null,F=D?"linePattern":"line",O=ab(i);let B;if(v&&e.terrain&&e.terrain.clipOrMaskOverlapStencilType()&&(R=!1),0!==c&&e.depthOcclusion){const e=i.paint._values["line-opacity"];e&&e.value&&"constant"===e.value.kind?B=e.value:Tt(`Occlusion opacity for layer ${i.id} is supported only when line-opacity isn't data-driven.`)}"constant"!==a.value.kind&&!1===a.value.isLineProgressConstant&&O.push("VARIABLE_LINE_WIDTH");const k=i.paint.get("line-emissive-strength");D||"constant"===k.value.kind||!1!==k.value.isLineProgressConstant||O.push("VARIABLE_LINE_EMISSIVE_STRENGTH"),e._debugParams.showElevationIdDebug&&O.push("DEBUG_ELEVATION_ID"),v&&("dual-source-blending"!==e.emissiveMode||s?e.isEmissiveMrtActive()&&(O.push("USE_MRT1"),"mrt-full-rgba"===e.emissiveMode&&O.push("USE_MRT1_RGBA")):O.push("DUAL_SOURCE_BLENDING"));const V={},N=[],U=(r,n,o,a,s,l)=>{for(const u of r){const r=t.getTile(u);if(D&&!r.patternsLoaded())continue;const d=r.getBucket(i);if(!d)continue;if("none"!==d.elevationType&&!s||"none"===d.elevationType&&s)continue;e.prepareDrawTile();const p=[...n],_="road"===d.elevationType,g=e.shadowRenderer,y=_&&!!g&&g.enabled;let w=[0,0,0];if(y){const t=e.style.directionalLight,i=e.style.ambientLight;t&&i&&(w=hA(e.style,t,i)),p.push("RENDER_SHADOWS","NORMAL_OFFSET")}const A=d.programConfigurations.get(i.id);let T=!1;if(P&&r.imageAtlas){const e=En.from(P),t=e.getPrimary().scaleSelf(b).toString(),i=r.imageAtlas.patternPositions.get(t),n=e.getSecondary(),o=n?r.imageAtlas.patternPositions.get(n.scaleSelf(b).toString()):null;T=!!i&&!!o,i&&A.setConstantPatternPositions(i,o)}M>0&&(T||A.getPatternTransitionVertexBuffer("line-pattern"))&&p.push("LINE_PATTERN_TRANSITION"),d.elevationGroundScaleVertexBuffer&&p.push("ELEVATION_GROUND_SCALE");const O=e.isTileAffectedByFog(u),k=e.getOrCreateProgram(F,{config:A,defines:p,overrideFog:O});if(!D&&I&&S&&r.lineAtlas){const e=r.lineAtlas.getDash(I,S);e&&A.setConstantPatternPositions(e)}y&&g.setupShadows(r.tileID.toUnwrapped(),k,"vector-tile");let[U,j]=i.paint.get("line-trim-offset");if("round"===S||"square"===S){const e=1;U!==j&&(0===U&&(U-=e),1===j&&(j+=e))}const G=v?u.projMatrix:null,H=h?1/d.tileToMeter/tb(r,1,e.transform.zoom):1,$=h?1/d.tileToMeter/tb(r,1,Math.floor(e.transform.zoom)):1,W=E?i.paint._values["line-floorwidth"]:null;let q;const Z=r.dashIdealZ;if(W&&"constant"===W.value.kind&&Z!==r.tileID.overscaledZ){const e=d.zoom;e in V||(V[e]=Math.max(.01,i.widthExpression().evaluate({zoom:e}))),q=W.value.value,W.value.value=V[e]*Math.pow(2,Z-e)}const X=D?rb(e,r,i,G,b,H,$,[U,j],w,M):ib(e,r,i,G,d.lineClipsArray.length,b,H,$,[U,j],w),Y=(r,n,o,a,s,l)=>{let c=r.texture;if(n!==r.version){let l=256;if(o){const i=t.getSource().maxzoom,r=u.canonical.z===i?Math.ceil(1<<e.transform.maxZoom-u.canonical.z):1;l=ht(xt(d.maxLineLength/co*1024*r),256,f.maxTextureSize)}r.gradient=Ov({expression:a,evaluationKey:"lineProgress",resolution:l,image:r.gradient||void 0,clips:d.lineClipsArray,lut:s?null:i.lut}),r.texture?r.texture.update(r.gradient):r.texture=new $m(f,r.gradient,m.RGBA8),r.version=n,c=r.texture}f.activeTexture.set(l),c.bind(o?m.NEAREST:m.LINEAR,m.CLAMP_TO_EDGE)};z&&Y(d.gradients[i.id],i.gradientVersion,i.stepInterpolant,i.gradientExpression(),"none"===i.paint.get("line-gradient-use-theme").constantOr("default"),m.TEXTURE1),L&&Y(d.borderGradients[i.id],i.borderGradientVersion,i.borderStepInterpolant,i.borderGradientExpression(),"none"===i.paint.get("line-border-gradient-use-theme").constantOr("default"),m.TEXTURE2),E&&(f.activeTexture.set(m.TEXTURE0),r.lineAtlasTexture&&r.lineAtlasTexture.bind(m.LINEAR,m.REPEAT),A.updatePaintBuffers()),D&&(f.activeTexture.set(m.TEXTURE0),r.imageAtlasTexture&&r.imageAtlasTexture.bind(m.LINEAR,m.CLAMP_TO_EDGE),A.updatePaintBuffers()),s&&!_&&e.terrain.setupElevationDraw(r,k),e.uploadCommonUniforms(f,k,u.toUnwrapped());const K=rM.drawLineFrcCoverageDetect?rM.drawLineFrcCoverageDetect(e,d,u,s,X,A,k,o,x,N):null,J=(t,r,n)=>{r&&0!==r.get().length&&(null!=B&&(B.value=C*c),void 0!==n&&(X.u_opacity_multiplier=n),k.draw(e,m.TRIANGLES,o,t,x,gw.disabled,X,i.id,d.layoutVertexBuffer,d.indexBuffer,r,i.paint,e.transform.zoom,A,[d.layoutVertexBuffer2,d.patternVertexBuffer,d.zOffsetVertexBuffer,d.elevationIdColVertexBuffer,d.elevationGroundScaleVertexBuffer]),void 0!==n&&(X.u_opacity_multiplier=1),null!=B&&(B.value=C))},Q=e=>{K&&K.active&&rM.drawLineFrcRenderLine?rM.drawLineFrcRenderLine(d,K,e,J):J(e,d.segments)};if(R&&!s){const t=e.stencilModeForClipping(u).ref;0===t&&v&&f.clear({stencil:0});const i={func:m.EQUAL,mask:255};X.u_alpha_discard_threshold=.8,Q(new uw(i,t,255,m.KEEP,m.KEEP,m.INVERT)),X.u_alpha_discard_threshold=0,Q(new uw(i,t,255,m.KEEP,m.KEEP,m.KEEP))}else X.u_alpha_discard_threshold=R&&s&&l?.8:0,Q(s?a:e.stencilModeForClipping(u));K&&rM.drawLineFrcFadePass&&rM.drawLineFrcFadePass(e,d,u,K,s,a,J),void 0!==q&&(W.value.value=q)}};let j=e.depthModeForSublayer(0,fw.ReadOnly);const G=new fw(e.depthOcclusion?m.GREATER:m.LEQUAL,fw.ReadOnly,e.depthRangeFor3D);if(i.hasNonElevatedBuckets){const t=!v&&e.terrain;0!==c&&t?Tt(`Occlusion opacity for layer ${i.id} is supported on terrain only if the layer has line-z-offset enabled.`):t?Tt(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${i.id}.`):U(r,O,j,uw.disabled,!1,!0)}if(i.hasElevatedBuckets){"hd-road-markup"===u?p||(j=G,O.push("ELEVATED_ROADS")):(O.push("ELEVATED"),j=G,g&&O.push(y?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),d&&O.push("ELEVATION_REFERENCE_SEA"));const t=R?e.stencilModeFor3D():uw.disabled;"hd-road-markup"!==u&&(e.forceTerrainMode=!0),U(r,O,j,t,!0,!0),R&&U(r,O,j,t,!0,!1),"hd-road-markup"!==u&&(e.forceTerrainMode=!1)}rM.drawLineFrcCoverageSecondPass&&rM.drawLineFrcCoverageSecondPass(e,i,N),R&&(e.resetStencilClippingMasks(),v&&f.clear({stencil:0})),0===c||e.depthOcclusion||v||e.layersWithOcclusionOpacity.push(e.currentLayer)}class Vz{destroy(){this.fbo&&(this.fbo.destroy(),this.fbo=null),this.drapeFbo&&(this.drapeFbo.destroy(),this.drapeFbo=null)}}class Nz{constructor(e){this.pbo=e.createBuffer(),this.sync=null,this.fboA=null,this.fboB=null,this.maxDensity=0}destroy(e){this.sync&&(e.deleteSync(this.sync),this.sync=null),e.deleteBuffer(this.pbo),this.fboA&&(this.fboA.destroy(),this.fboA=null),this.fboB&&(this.fboB.destroy(),this.fboB=null)}}const Uz={additive:{clearColor:new Zr(0,0,0,0),colorMode:pw.additiveAlphaWeighted,compositeUniformValue:1},multiply:{clearColor:new Zr(1,1,1,1),colorMode:pw.multiply,compositeUniformValue:0}};function jz(e){return!(!e.extRenderToTextureHalfFloat&&!e.extColorBufferFloat)}function Gz(e,t){return"additive"===e&&jz(t)?pw.additiveAlphaWeightedUnboundedAlpha:Uz[e].colorMode}function Hz(e,t,i){const r=e.context,n=r.gl;let o=i.width,a=i.height,s=i.colorAttachment0.get();t.lineBlendDensityReadback||(t.lineBlendDensityReadback=new Nz(n));const l=t.lineBlendDensityReadback;let c=0,u=!0;for(;o>1||a>1;){const i=Math.max(1,Math.floor(o/2)),h=Math.max(1,Math.floor(a/2)),d=0===c?"fboA":"fboB";l[d]=Pz.createWithTexture(r,l[d],i,h,!1);const p=l[d];r.bindFramebuffer.set(p.framebuffer),r.viewport.set([0,0,i,h]),r.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,s),e.getOrCreateProgram("lineBlendReduce").draw(e,n.TRIANGLES,fw.disabled,uw.disabled,pw.unblended,gw.disabled,dP(0,[1/o,1/a],u),t.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,t.paint,e.transform.zoom),o=i,a=h,s=p.colorAttachment0.get(),c=1-c,u=!1}const h=jz(r),d=h?16:4;l.sync&&(n.deleteSync(l.sync),l.sync=null),n.bindBuffer(n.PIXEL_PACK_BUFFER,l.pbo),n.bufferData(n.PIXEL_PACK_BUFFER,d,n.STREAM_READ),n.readPixels(0,0,1,1,n.RGBA,h?n.FLOAT:n.UNSIGNED_BYTE,0),n.bindBuffer(n.PIXEL_PACK_BUFFER,null),l.sync=n.fenceSync(n.SYNC_GPU_COMMANDS_COMPLETE,0),r.viewport.set([0,0,e.width,e.height])}function $z(e,t,i){if(!jz(e.context))return;const r=t.lineBlendDensityReadback;r&&r.sync?(function(e,t,i){if(e.sync&&t.getSyncParameter(e.sync,t.SYNC_STATUS)===t.SIGNALED){if(t.deleteSync(e.sync),e.sync=null,t.bindBuffer(t.PIXEL_PACK_BUFFER,e.pbo),jz(i)){const i=new Float32Array(4);t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,i);const r=i[1];e.maxDensity=Math.max(2*(r>0?i[0]/r:0),1)}else e.maxDensity=1;t.bindBuffer(t.PIXEL_PACK_BUFFER,null)}}(r,e.context.gl,e.context),r.sync||(Hz(e,t,i),e.style.map.triggerRepaint())):(Hz(e,t,i),e.style.map.triggerRepaint())}function Wz(e,t,i,r,n,o){const a=e.context,s=a.gl,l="additive"===i?1:t.paint.get("line-opacity").constantOr(1),c="additive"===i?function(e,t){const i=t.paint.get("line-blend-additive-clamp");if(i>0)return i;const r=t.lineBlendDensityReadback;return r&&0!==r.maxDensity?r.maxDensity:null}(0,t):1;if(null===c)return;a.bindFramebuffer.set(n),o&&a.viewport.set([0,0,o[0],o[1]]),a.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,r.colorAttachment0.get());const u=Gz(i,e.context);e.getOrCreateProgram("lineBlendComposite").draw(e,s.TRIANGLES,fw.disabled,uw.disabled,u,gw.disabled,((e,t,i,r)=>({u_image:0,u_opacity:t,u_blend_mode:i,u_max_density:r}))(0,l,Uz[i].compositeUniformValue,c),t.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,t.paint,e.transform.zoom)}function qz(e,t,i,r){const{painter:n,sourceCache:o,layer:a,coords:s,colorMode:l,elevationType:c,terrainEnabled:u,pass:h}=e,d=n.context.gl,p=a.paint.get("fill-pattern"),f=a.paint.get("fill-pattern-cross-fade"),m=p.constantOr(null);let _=c;"road"!==c||t&&!u||(_="none");const g="road"===_,y=e.painter.shadowRenderer,x=g&&!!y&&y.enabled,v=new fw(n.context.gl.LEQUAL,fw.ReadOnly,n.depthRangeFor3D);let b=[0,0,0];if(x){const e=n.style.directionalLight,t=n.style.ambientLight;e&&t&&(b=hA(n.style,e,t))}const w=p&&p.constantOr(1),E=n.terrain&&n.terrain.renderingToTexture,A=(e,h)=>{let p,_,A,I,S;h?(p=w&&!a.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",A=d.LINES):(p=w?"fillPattern":"fill",A=d.TRIANGLES);const T=[];for(const D of s){const s=o.getTile(D);if(w&&!s.patternsLoaded())continue;const M=s.getBucket(a);if(!M)continue;const P=t?M.hdExt&&M.hdExt.elevationBufferData:M.bufferData;if(!P||P.isEmpty())continue;n.prepareDrawTile();const C=P.programConfigurations.get(a.id),R=n.isTileAffectedByFog(D),z=[],L=[];g&&(z.push("ELEVATED_ROADS"),L.push(P.elevatedLayoutVertexBuffer)),x&&z.push("RENDER_SHADOWS","NORMAL_OFFSET"),E&&i&&(z.push("USE_MRT1"),"mrt-full-rgba"===n.emissiveMode&&z.push("USE_MRT1_RGBA")),w&&(n.context.activeTexture.set(d.TEXTURE0),s.imageAtlasTexture&&s.imageAtlasTexture.bind(d.LINEAR,d.CLAMP_TO_EDGE),C.updatePaintBuffers());let F=!1;if(m&&s.imageAtlas){const e=s.imageAtlas,t=En.from(m),i=t.getPrimary().scaleSelf(ei.devicePixelRatio).toString(),r=t.getSecondary(),n=e.patternPositions.get(i),o=r?e.patternPositions.get(r.scaleSelf(ei.devicePixelRatio).toString()):null;F=!!n&&!!o,n&&C.setConstantPatternPositions(n,o)}f>0&&(F||C.getPatternTransitionVertexBuffer("fill-pattern"))&&z.push("FILL_PATTERN_TRANSITION");const O=n.getOrCreateProgram(p,{config:C,overrideFog:R,defines:z}),B=n.translatePosMatrix(D.projMatrix,s,a.paint.get("fill-translate"),a.paint.get("fill-translate-anchor"));x&&y.setupShadows(s.tileID.toUnwrapped(),O,"vector-tile");const k=a.paint.get("fill-emissive-strength");if(h){I=P.lineIndexBuffer,S=P.lineSegments;const e=n.terrain&&n.terrain.renderingToTexture?n.terrain.drapeBufferSize:[d.drawingBufferWidth,d.drawingBufferHeight];_="fillOutlinePattern"===p&&w?hP(B,k,n,s,e,b,f):uP(B,k,e,b)}else I=P.indexBuffer,S=P.triangleSegments,_=w?cP(B,k,n,s,b,f):lP(B,k,b);n.uploadCommonUniforms(n.context,O,D.toUnwrapped());let V=e;
vendor: 9,600 bytes, line 2
2if(("road"===c&&!u||"offset"===c)&&(V=v),!S||S.get&&0===S.get().length)continue;const N=r||n.stencilModeForClipping(D);let U="fallthrough";!h&&rM.drawFillFrcCoverageFirstPass&&(U=rM.drawFillFrcCoverageFirstPass({painter:n,layer:a,bucket:M,coord:D,elevatedGeometry:t,program:O,programConfiguration:C,uniformValues:_,drawMode:A,depthMode:V,stencilMode:N,colorMode:l,bufferData:P,indexBuffer:I,segments:S,dynamicBuffers:L,polygonCoverageTiles:T})),"fallthrough"===U&&O.draw(n,A,V,N,l,gw.disabled,_,a.id,P.layoutVertexBuffer,I,S,a.paint,n.transform.zoom,C,L)}!h&&rM.drawFillFrcCoverageSecondPass&&rM.drawFillFrcCoverageSecondPass(n,a,T,A,l)};n.renderPass===h&&A(n.depthModeForSublayer(1,"opaque"===n.renderPass?fw.ReadWrite:fw.ReadOnly),!1),"none"===_&&"translucent"===n.renderPass&&a.paint.get("fill-antialias")&&A(n.depthModeForSublayer(a.getPaintProperty("fill-outline-color")?2:0,fw.ReadOnly),!0)}function Zz(e){return[e[0]*Tb,e[1]*Tb,e[2]*Tb,0]}function Xz(e,t,i,r,n,o,a,s,l,c){const u=n.getSource(),h=r.globeSharedBuffers;if(!h)return;let d,f,m;if(i&&(d=n.getTile(i)),u instanceof YP?(f=u.texture,m=_f(0,0,r.transform)):d&&i&&(f=d.texture,m=_f(i.canonical.z,i.canonical.x,r.transform)),!f||!m)return;t||(m=b(p(),m,[1,-1,1]));const _=r.context,g=_.gl,y="nearest"===o.paint.get("raster-resampling")?g.NEAREST:g.LINEAR,x=r.colorModeForDrapableLayerRenderPass(a),v=s.defines;v.push("GLOBE_POLES");const w=new fw(g.LEQUAL,fw.ReadWrite,r.depthRangeFor3D),E=r.transform.expandedFarZProjMatrix,A=Float32Array.from(cf(Jp(new Df(0,0,0))));r.terrain&&r.terrain.prepareDrawTile(),_.activeTexture.set(g.TEXTURE0),f.bind(y,g.CLAMP_TO_EDGE),_.activeTexture.set(g.TEXTURE1),f.bind(y,g.CLAMP_TO_EDGE),"useMipmap"in f&&_.extTextureFilterAnisotropic&&r.transform.pitch>20&&g.texParameterf(g.TEXTURE_2D,_.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,_.extTextureFilterAnisotropicMax);const[I,S,T,D]=i?h.getPoleBuffers(i.canonical.z,!1):h.getPoleBuffers(0,!0),M=e;let P;t?(P=I,r.renderDefaultNorthPole=0!==M):(P=S,r.renderDefaultSouthPole=0!==M);const C=Zz(s.mix),R=((e,t,i,r,n,o,a,s,l,c,u,h,d,p)=>_P(e,t,i,r,new Float32Array(16),new Float32Array(9),[0,0],n,[0,0],[0,0,0,0],1,{opacity:1,mix:0},a,[0,0]||0,l,2,u,h,d,1,0,p))(r,E,A,m,mf(r.transform.zoom),0,o,0,M,0,C,s.offset,s.range,a),z=r.getOrCreateProgram("raster",{defines:v});r.uploadCommonUniforms(_,z,null),z.draw(r,g.TRIANGLES,w,c,x,l,R,o.id,P,T,D)}function Yz(e){if(e.isOrthographic)return[0,0,0,0];const t=e._nearZ,i=e.projection.farthestPixelDistance(e),r=i-t,n=.2*e.height,o=t+n;return[t,i,(o-n-t)/r,(o-t)/r]}function Kz(e,t,i,r){if(e)return"raster-array"===t.type?t.getTextureDescriptor(e,i,!0):{texture:e.texture,mix:Zz(r.mix),offset:r.offset,buffer:0,tileSize:1}}const Jz=_(new Float32Array(16)),Qz={"dual-source-blending":"dual-source-blending","mrt-fallback":"mrt","mrt-full-rgba":"mrt-rgba"},eL=lu([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:tL}=eL;function iL(e,t,i,r){e.emplaceBack(t,i,r)}class rL{constructor(e){this.vertexArray=new xu,this.indices=new Ru,iL(this.vertexArray,-1,-1,1),iL(this.vertexArray,1,-1,1),iL(this.vertexArray,-1,1,1),iL(this.vertexArray,1,1,1),iL(this.vertexArray,-1,-1,-1),iL(this.vertexArray,1,-1,-1),iL(this.vertexArray,-1,1,-1),iL(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=e.createVertexBuffer(this.vertexArray,tL),this.indexBuffer=e.createIndexBuffer(this.indices),this.segment=uh.simpleSegment(0,0,36,12)}}function nL(e,t,i,r,n,o){const a=e.context.gl,s=t.paint.get("sky-atmosphere-color"),u=t.paint.get("sky-atmosphere-halo-color"),h=t.paint.get("sky-atmosphere-sun-intensity"),d=((e,t,i,r,n)=>({u_matrix_3f:e,u_sun_direction:t,u_sun_intensity:i,u_color_tint_r:[r.r,r.g,r.b,r.a],u_color_tint_m:[n.r,n.g,n.b,n.a],u_luminance:5e-5}))(c(l(),r),n,h,s.toPremultipliedRenderColor(null),u.toPremultipliedRenderColor(null));a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+o,t.skyboxTexture,0),i.draw(e,a.TRIANGLES,fw.disabled,uw.disabled,pw.unblended,gw.frontCW,d,"skyboxCapture",t.skyboxGeometry.vertexBuffer,t.skyboxGeometry.indexBuffer,t.skyboxGeometry.segment)}const oL=lu([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class aL{constructor(e){const t=new Ou;t.emplaceBack(-1,1,1,0,0),t.emplaceBack(1,1,1,1,0),t.emplaceBack(1,-1,1,1,1),t.emplaceBack(-1,-1,1,0,1);const i=new Ru;i.emplaceBack(0,1,2),i.emplaceBack(2,3,0),this.vertexBuffer=e.createVertexBuffer(t,oL.members),this.indexBuffer=e.createIndexBuffer(i),this.segments=uh.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const sL=lu([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_size_scale",components:1},{type:"Float32",name:"a_opacity",components:1}]);class lL{constructor(){this.colorModeAlphaBlendedWriteRGB=new pw([1,dw,1,dw],Zr.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new pw([1,0,1,0],Zr.transparent,[!1,!1,!1,!0]),this.params={starsCount:16e3,sizeMultiplier:.15,sizeRange:100,intensityRange:200},this.updateNeeded=!0,this._painter=null,this._devtoolsFolder=null}update(e){this._painter=e;const t=e.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new aL(t);let e=this.params;const i=e.sizeRange,r=e.intensityRange,n=function(e){const t=Za(30),i=[];for(let r=0;r<e;++r){const e=2*Math.PI*t(),r=Math.acos(1-2*t())-.5*Math.PI;i.push(V(Math.cos(r)*Math.cos(e),Math.cos(r)*Math.sin(e),Math.sin(r)))}return i}(e.starsCount),o=Za(300),a=new Bu,s=new Ru;let l=0;for(let t=0;t<n.length;++t){const e=W([],n[t],200),c=Math.max(0,1+.01*i*(1*o()-.5)),u=Math.max(0,1+.01*r*(1*o()-.5));a.emplaceBack(e[0],e[1],e[2],-1,-1,c,u),a.emplaceBack(e[0],e[1],e[2],1,-1,c,u),a.emplaceBack(e[0],e[1],e[2],1,1,c,u),a.emplaceBack(e[0],e[1],e[2],-1,1,c,u),s.emplaceBack(l+0,l+1,l+2),s.emplaceBack(l+0,l+2,l+3),l+=4}this.starsVx=t.createVertexBuffer(a,sL.members),this.starsIdx=t.createIndexBuffer(s),this.starsSegments=uh.simpleSegment(0,0,a.length,s.length)}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy(),this._painter=null}drawAtmosphereGlow(e,t){const i=e.context,r=i.gl,n=e.transform,o=new fw(r.LEQUAL,fw.ReadOnly,[0,1]),a=mf(n.zoom),s=e.style.getLut(t.scope),l="none"===t.properties.get("color-use-theme"),c=t.properties.get("color").toNonPremultipliedRenderColor(l?null:s),u="none"===t.properties.get("high-color-use-theme"),h=t.properties.get("high-color").toNonPremultipliedRenderColor(u?null:s),d="none"===t.properties.get("space-color-use-theme"),p=t.properties.get("space-color").toNonPremultipliedRenderColor(d?null:s),f=5e-4,m=ht((t.properties.get("horizon-blend")-0)/1*.2495+(w=f),w,.25),_=gf(e,0,n)&&m===f?n.worldSize/(2*Math.PI*1.025)-1:n.globeRadius,g=e.frameCounter/1e3%1,y=k(n.globeCenterInViewSpace),x=Math.sqrt(Math.pow(y,2)-Math.pow(_,2)),v=Math.acos(x/y),b=t=>{const s="globe"===n.projection.name?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];t&&s.push("ALPHA_PASS");const l=e.getOrCreateProgram("globeAtmosphere",{defines:s}),u=((e,t,i,r,n,o,a,s,l,c,u,h)=>({u_frustum_tl:e,u_frustum_tr:t,u_frustum_br:i,u_frustum_bl:r,u_horizon:n,u_transition:o,u_fadeout_range:a,u_atmosphere_fog_color:s.toArray01(),u_high_color:l.toArray01(),u_space_color:c.toArray01(),u_temporal_offset:u,u_horizon_angle:h}))(n.frustumCorners.TL,n.frustumCorners.TR,n.frustumCorners.BR,n.frustumCorners.BL,n.frustumCorners.horizon,a,m,c,h,p,g,v);e.uploadCommonUniforms(i,l);const d=this.atmosphereBuffer;d&&l.draw(e,r.TRIANGLES,o,uw.disabled,t?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,gw.backCW,u,t?"atmosphere_glow_alpha":"atmosphere_glow",d.vertexBuffer,d.indexBuffer,d.segments)};var w;b(!1),b(!0)}drawStars(e,t){const i=ht(t.properties.get("star-intensity"),0,1);if(0===i)return;const r=e.context,n=r.gl,o=e.transform,a=e.getOrCreateProgram("stars"),s=ge([]);xe(s,s,-o._pitch),be(s,s,-o.angle),xe(s,s,nt(o._center.lat)),ve(s,s,-nt(o._center.lng));const l=R(new Float32Array(16),s),u=x([],o.starsProjMatrix,l),h=(d=[],(T=(f=(p=c([],l))[0])*(A=(E=p[8])*(y=p[4])-(v=p[5])*(w=p[7]))+(m=p[1])*(I=-E*(g=p[3])+v*(b=p[6]))+(_=p[2])*(S=w*g-y*b))?(d[0]=A*(T=1/T),d[1]=(-E*m+_*w)*T,d[2]=(v*m-_*y)*T,d[3]=I*T,d[4]=(E*f-_*b)*T,d[5]=(-v*f+_*g)*T,d[6]=S*T,d[7]=(-w*f+m*b)*T,d[8]=(y*f-m*g)*T,d):null);var d,p,f,m,_,g,y,v,b,w,E,A,I,S,T;let D=this.params.sizeMultiplier;const M=[0,1,0];re(M,M,h),W(M,M,D);const P=[1,0,0];re(P,P,h),W(P,P,D);const C=((e,t,i,r)=>({u_matrix:Float32Array.from(e),u_up:t,u_right:i,u_intensity_multiplier:r}))(u,M,P,i);e.uploadCommonUniforms(r,a),this.starsVx&&this.starsIdx&&a.draw(e,n.TRIANGLES,fw.disabled,uw.disabled,this.colorModeAlphaBlendedWriteRGB,gw.disabled,C,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class cL{}class uL{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(e,t,i){{const i=this._storage.get(t.id);if(i)return i.lastUsedFrameIdx=e,i.buf}const r=i.gl,n=r.getBufferParameter(r.ELEMENT_ARRAY_BUFFER,r.BUFFER_SIZE),o=new ArrayBuffer(n),a=new Int16Array(o);r.getBufferSubData(r.ELEMENT_ARRAY_BUFFER,0,new Int16Array(o));const s=new Tu;
vendor: 10,614 bytes, line 2
2for(let u=0;u<n/2;u+=3){const e=a[u],t=a[u+1],i=a[u+2];s.emplaceBack(e,t),s.emplaceBack(t,i),s.emplaceBack(i,e)}const l=i.bindVertexArrayOES.current,c=new cL;return c.buf=new Tz(i,s),c.lastUsedFrameIdx=e,this._storage.set(t.id,c),i.bindVertexArrayOES.set(l),c.buf}update(e){for(const[t,i]of this._storage)e-i.lastUsedFrameIdx>30&&(i.buf.destroy(),this._storage.delete(t))}destroy(){for(const[e,t]of this._storage)t.buf.destroy(),this._storage.delete(e)}}class hL{constructor(){this.occluderSize=30,this.depthOffset=-1e-4}}const dL={symbol:function(e,t,i,r,n){if("translucent"!==e.renderPass)return;const o=uw.disabled,a=e.colorModeForRenderPass(),s=i.layout.get("text-variable-anchor"),l=i.layout.get("text-size-scale-range"),c=ht(e.scaleFactor,l[0],l[1]);s&&function(e,t,i,r,n,o,a,s){const l=t.transform,c="map"===n,u="map"===o;for(const h of e){const e=r.getTile(h),t=e.getBucket(i);if(!t||!t.text||!t.text.segments.get().length)continue;const n=Ip(t.textSizeData,l.zoom,s),o=Dm(h,t.getProjection(),l),d=l.calculatePixelsToTileUnitsMatrix(e),p=Iw(o,e.tileID.canonical,u,c,l,t.getProjection(),d),f=t.hasIconTextFit()&&t.hasIconData();n&&Fz(t,c,u,a,l,p,h,Math.pow(2,l.zoom-e.tileID.overscaledZ),n,f)}}(r,e,i,t,i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),n,c);const u=0!==i.paint.get("icon-opacity").constantOr(1),h=0!==i.paint.get("text-opacity").constantOr(1);void 0!==i.layout.get("symbol-sort-key").constantOr(1)&&(u||h)?Oz(e,t,i,r,o,a):(u&&Oz(e,t,i,r,o,a,{onlyIcons:!0}),h&&Oz(e,t,i,r,o,a,{onlyText:!0})),t.map.showCollisionBoxes&&MS.drawCollisionDebug&&(MS.drawCollisionDebug(e,t,i,r,i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),!0),MS.drawCollisionDebug(e,t,i,r,i.paint.get("icon-translate"),i.paint.get("icon-translate-anchor"),!1))},circle:function(e,t,i,r){if("translucent"!==e.renderPass)return;const n=i.paint.get("circle-opacity"),o=i.paint.get("circle-stroke-width"),a=i.paint.get("circle-stroke-opacity"),s=void 0!==i.layout.get("circle-sort-key").constantOr(1),l=i.paint.get("circle-emissive-strength");if(0===n.constantOr(1)&&(0===o.constantOr(1)||0===a.constantOr(1)))return;const c=e.context,u=c.gl,h=e.transform,d=!(!e.terrain||!e.terrain.enabled),p=i.layout.get("circle-elevation-reference"),f=e.depthModeForSublayer(0,fw.ReadOnly),m=new fw(e.context.gl.LEQUAL,fw.ReadOnly,e.depthRangeFor3D),_="none"===p||d?f:m,g=uw.disabled,y=e.colorModeForDrapableLayerRenderPass(l),x="globe"===h.projection.name,v=[Wn(h.center.lng),qn(h.center.lat)],b=[];for(let E=0;E<r.length;E++){const n=r[E],o=t.getTile(n),a=o.getBucket(i);if(!a||a.projection.name!==h.projection.name)continue;const l=a.programConfigurations.get(i.id),c=a.layoutVertexBuffer,u=a.globeExtVertexBuffer,d=a.indexBuffer,p=Sv(i),f=[u],m=e.isTileAffectedByFog(n);x&&p.push("PROJECTION_GLOBE_VIEW"),p.push("DEPTH_D24"),e.terrain&&h.depthOcclusionForSymbolsAndCircles&&p.push("DEPTH_OCCLUSION"),a.hdExt&&a.hdExt.hasElevation&&!e.terrain&&(p.push("ELEVATED_ROADS"),f.push(a.hdExt.elevatedLayoutVertexBuffer));const _=e.getOrCreateProgram("circle",{config:l,defines:p,overrideFog:m}),g=h.projection.createInversionMatrix(h,n.canonical),y={programConfiguration:l,program:_,layoutVertexBuffer:c,dynamicBuffers:f,indexBuffer:d,uniformValues:Iv(e,n,o,g,v,i),tile:o};if(s){const e=a.segments.get();for(const t of e)b.push({segments:new uh([t]),sortKey:t.sortKey,state:y})}else b.push({segments:a.segments,sortKey:0,state:y})}s&&b.sort((e,t)=>e.sortKey-t.sortKey);const w={useDepthForOcclusion:h.depthOcclusionForSymbolsAndCircles};for(const E of b){const{programConfiguration:t,program:r,layoutVertexBuffer:n,dynamicBuffers:o,indexBuffer:a,uniformValues:s,tile:l}=E.state,d=E.segments;e.terrain&&e.terrain.setupElevationDraw(l,r,w),e.uploadCommonUniforms(c,r,l.tileID.toUnwrapped()),r.draw(e,u.TRIANGLES,_,g,y,gw.disabled,s,i.id,n,a,d,i.paint,h.zoom,t,o)}},heatmap:function(e,t,i,r){if(0!==i.paint.get("heatmap-opacity"))if("offscreen"===e.renderPass){const n=e.context,o=n.gl,a=uw.disabled,s=new pw([o.ONE,o.ONE,o.ONE,o.ONE],Zr.transparent,[!0,!0,!0,!0]),l="globe"===e.transform.projection.name?.5:.25;i.heatmapFbo=Pz.createWithTexture(n,i.heatmapFbo,e.width*l,e.height*l),n.clear({color:Zr.transparent});const c=e.transform,u="globe"===c.projection.name,h=u?["PROJECTION_GLOBE_VIEW"]:[],d=u?gw.frontCCW:gw.disabled,p=[Wn(c.center.lng),qn(c.center.lat)];for(let f=0;f<r.length;f++){const l=r[f];if(t.hasRenderableParent(l))continue;const m=t.getTile(l),_=m.getBucket(i);if(!_||_.projection.name!==c.projection.name)continue;const g=e.isTileAffectedByFog(l),y=_.programConfigurations.get(i.id),x=e.getOrCreateProgram("heatmap",{config:y,defines:h,overrideFog:g}),{zoom:v}=e.transform;e.terrain&&e.terrain.setupElevationDraw(m,x),e.uploadCommonUniforms(n,x,l.toUnwrapped());const b=c.projection.createInversionMatrix(c,l.canonical);x.draw(e,o.TRIANGLES,fw.disabled,a,s,d,fP(e,l,m,b,p,v,i.paint.get("heatmap-intensity")),i.id,_.layoutVertexBuffer,_.indexBuffer,_.segments,i.paint,e.transform.zoom,y,u?[_.globeExtVertexBuffer]:null)}n.viewport.set([0,0,e.width,e.height])}else"translucent"===e.renderPass&&(e.context.setColorMode(e.colorModeForRenderPass()),function(e,t){const i=e.context,r=i.gl,n=t.heatmapFbo;if(!n)return;i.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,n.colorAttachment0.get()),i.activeTexture.set(r.TEXTURE1);let o=t.colorRampTexture;o||(o=t.colorRampTexture=new $m(i,t.colorRamp,r.RGBA8)),o.bind(r.LINEAR,r.CLAMP_TO_EDGE),e.getOrCreateProgram("heatmapTexture").draw(e,r.TRIANGLES,fw.disabled,uw.disabled,e.colorModeForRenderPass(),gw.disabled,((e,t)=>({u_image:0,u_color_ramp:1,u_opacity:t.paint.get("heatmap-opacity")}))(0,t),t.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,t.paint,e.transform.zoom)}(e,i))},line:function(e,t,i,r){const n=i.paint.get("line-opacity"),o=i.paint.get("line-width");if(0===n.constantOr(1)||0===o.constantOr(1))return;const a=i.paint.get("line-blend-mode"),s=e.terrain&&e.terrain.renderingToTexture;if("default"===a||"globe"===e.transform.projection.name)"translucent"===e.renderPass&&kz(e,t,i,r);else{if(s)return void function(e,t,i,r,n){if("translucent"!==e.renderPass)return;const o=e.context,a=o.gl,s=e.terrain;if(!s)return;const l=o.bindFramebuffer.current,c=e.isEmissiveMrtActive(),u=s.drapeBufferSize[0],h=s.drapeBufferSize[1];i.lineBlendFbos||(i.lineBlendFbos=new Vz),i.lineBlendFbos.drapeFbo=Pz.createWithTexture(o,i.lineBlendFbos.drapeFbo,u,h,!0),c&&a.drawBuffers([a.COLOR_ATTACHMENT0]),o.clear({color:Uz[n].clearColor,depth:1,stencil:0});const d=e.currentStencilSource,p=e._tileClippingMaskIDs,f=e.nextStencilID;e.currentStencilSource=void 0,e._tileClippingMaskIDs={},e.nextStencilID=1;const m=e._terrain;e._terrain=null,e._renderTileClippingMasks(i,t,r),kz(e,t,i,r,Gz(n,e.context),!0),e._terrain=m,e.currentStencilSource=d,e._tileClippingMaskIDs=p,e.nextStencilID=f,c&&a.drawBuffers([a.COLOR_ATTACHMENT0,a.COLOR_ATTACHMENT1]);const _=s.drapeBufferSize,g=i.lineBlendFbos&&i.lineBlendFbos.drapeFbo;g&&("additive"===n&&$z(e,i,g),Wz(e,i,n,g,l,_))}(e,t,i,r,a);if("offscreen"===e.renderPass)return void function(e,t,i,r,n){const o=e.context,a=Math.ceil(e.width),s=Math.ceil(e.height);i.lineBlendFbos||(i.lineBlendFbos=new Vz),i.lineBlendFbos.fbo=Pz.createWithTexture(o,i.lineBlendFbos.fbo,a,s,!0),o.clear({color:Uz[n].clearColor,depth:1,stencil:0});const l=e.currentStencilSource,c=e._tileClippingMaskIDs,u=e.nextStencilID;e.currentStencilSource=void 0,e._tileClippingMaskIDs={},e.nextStencilID=1,e._renderTileClippingMasks(i,t,r);const h=e.renderPass;e.renderPass="translucent",kz(e,t,i,r,Gz(n,e.context)),e.renderPass=h,e.currentStencilSource=l,e._tileClippingMaskIDs=c,e.nextStencilID=u,o.viewport.set([0,0,e.width,e.height]),"additive"===n&&$z(e,i,i.lineBlendFbos.fbo)}(e,t,i,r,a);if("translucent"===e.renderPass){const t=i.lineBlendFbos&&i.lineBlendFbos.fbo;return void(t&&Wz(e,i,a,t,null))}}},fill:function(e,t,i,r){const n=i.paint.get("fill-color"),o=i.paint.get("fill-opacity");if(0===o.constantOr(1))return;const a=i.paint.get("fill-emissive-strength"),s=e.colorModeForDrapableLayerRenderPass(a),l=i.paint.get("fill-pattern"),c=e.opaquePassEnabledForLayer()&&!l.constantOr(1)&&1===n.constantOr(Zr.transparent).a&&1===o.constantOr(0)?"opaque":"translucent";let u="none";"none"!==i.layout.get("fill-elevation-reference")?u="road":0!==i.paint.get("fill-z-offset").constantOr(1)&&(u="offset");const h=!(!e.terrain||!e.terrain.enabled),d={painter:e,sourceCache:t,layer:i,coords:r,colorMode:s,elevationType:u,terrainEnabled:h,pass:c};if("shadow"===e.renderPass)return void(e.shadowRenderer&&"road"===u&&!h&&rM.drawElevatedFillShadows&&rM.drawElevatedFillShadows(d));const p=e.isEmissiveMrtActive();if("offset"!==u){if(qz(d,!1,p),"road"===u){const n=!h&&"translucent"===e.renderPass;n&&rM.drawDepthPrepass&&rM.drawDepthPrepass(e,t,i,r,"geometry"),qz(d,!0,p,uw.disabled),n&&rM.drawElevatedStructures&&rM.drawElevatedStructures(d)}}else qz(d,!1,p,e.stencilModeFor3D())},"fill-extrusion":function(e,t,i,r){const n=i.paint.get("fill-extrusion-opacity"),o=e.context,a=o.gl,s=e.terrain,l=s&&s.renderingToTexture;if(0===n)return;const c=e.isEmissiveMrtActive(),u=e.conflationActive&&e.style.isLayerClipped(i,t.getSource()),h=e.style.order.indexOf(i.fqid);if(u&&function(e,t,i,r,n){for(const o of r){const r=t.getTile(o).getBucket(i);r&&(r.updateReplacement(o,e.replacementSource,n),r.uploadCentroid(e.context))}}(e,t,i,r,h),s||u)for(const d of r){const r=t.getTile(d).getBucket(i);r&&IT(e.context,t,d,r,i,s,u)}if("shadow"===e.renderPass&&e.shadowRenderer){if(s&&n<.65&&i._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof Ss)return;const o=e.shadowRenderer.getShadowPassDepthMode();wT(e,t,i,r,o,uw.disabled,pw.disabled,u)}else if("translucent"===e.renderPass){const h=!i.paint.get("fill-extrusion-pattern").constantOr(1),d=i.paint.get("fill-extrusion-color").constantOr(Zr.white);if(!l&&0!==d.a){const o=new fw(e.context.gl.LEQUAL,fw.ReadWrite,e.depthRangeFor3D);1===n&&h?wT(e,t,i,r,o,uw.disabled,pw.unblended,u):(wT(e,t,i,r,o,uw.disabled,pw.disabled,u),wT(e,t,i,r,o,e.stencilModeFor3D(),e.colorModeForRenderPass(),u),e.resetStencilClippingMasks())}const p=e.style.enable3dLights()&&h&&(!s&&"globe"!==e.transform.projection.name||l);if(p&&!vT.drawGroundEffect&&bT(),p&&vT.drawGroundEffect){const n=i.paint.get("fill-extrusion-opacity"),h=i.paint.get("fill-extrusion-ambient-occlusion-intensity"),d=i.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),p=i.paint.get("fill-extrusion-flood-light-intensity"),f="none"===i.paint.get("fill-extrusion-flood-light-color-use-theme").
vendor: 2,026 bytes, line 2
2constantOr("default"),m=i.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(f?null:i.lut).toArray01().slice(0,3),_=h>0&&d>0,g=p>0,y=new ET;y.translate=i.paint.get("fill-extrusion-translate"),y.translateAnchor=i.paint.get("fill-extrusion-translate-anchor"),y.edgeRadius=i.layout.get("fill-extrusion-edge-radius"),y.cutoffFadeRange=i.paint.get("fill-extrusion-cutoff-fade-range");const x=o=>{const s=e.depthModeForSublayer(1,fw.ReadOnly,a.LEQUAL,!0),l=Wr(.1,3,i.paint.get(o?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation")),c=e._showOverdrawInspector;if(!c){const c=new uw({func:a.ALWAYS,mask:255},255,255,a.KEEP,a.KEEP,a.REPLACE),f=new pw([a.ONE,a.ONE,a.ONE,a.ONE],Zr.transparent,[!1,!1,!1,!0],a.MIN);vT.drawGroundEffect(y,e,t,i,r,s,c,f,gw.disabled,o,"sdf",n,h,d,p,m,l,u,!1)}{const f=c?uw.disabled:new uw({func:a.EQUAL,mask:255},255,255,a.KEEP,a.DECR,a.DECR),_=c?e.colorModeForRenderPass():new pw([a.ONE_MINUS_DST_ALPHA,a.DST_ALPHA,a.ONE,a.ONE],Zr.transparent,[!0,!0,!0,!0]);vT.drawGroundEffect(y,e,t,i,r,s,f,_,gw.disabled,o,"color",n,h,d,p,m,l,u,!1)}};if(l){const l=()=>{const e=s.drapeBufferSize[0],t=s.drapeBufferSize[1];let i=s.framebufferCopyTexture;return i&&(!i||i.size[0]===e&&i.size[1]===t)||(i&&i.destroy(),i=s.framebufferCopyTexture=new $m(o,new zd({width:e,height:t}),a.RGBA8)),i.bind(a.LINEAR,a.CLAMP_TO_EDGE),a.copyTexSubImage2D(a.TEXTURE_2D,0,0,0,0,0,e,t),i},f=(o,s,f)=>{const _=e.depthModeForSublayer(1,fw.ReadOnly,a.LEQUAL,!1),g=Wr(.1,3,i.paint.get(o?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"));{const l=new pw([a.ONE,a.ONE,a.ONE,a.ONE],Zr.transparent,[!1,!1,!1,!0]);vT.drawGroundEffect(y,e,t,i,r,_,uw.disabled,l,gw.disabled,o,"clear",n,h,d,p,m,g,u,s)}{const l=new uw({func:a.ALWAYS,mask:255},255,255,a.KEEP,a.KEEP,a.REPLACE),c=new pw([a.ONE,a.ONE,a.ONE,a.ONE],Zr.transparent,[!1,!1,!1,!0],a.MIN);vT.drawGroundEffect(y,e,t,i,r,_,l,c,gw.disabled,o,"sdf",n,h,d,p,m,g,u,s)}
vendor: 4,760 bytes, line 2
2c&&!o&&(f=l());{const l=o?a.ZERO:a.ONE_MINUS_DST_ALPHA,c=new uw({func:a.EQUAL,mask:255},255,255,a.KEEP,a.DECR,a.DECR),f=new pw([l,a.DST_ALPHA,a.ONE_MINUS_DST_ALPHA,a.ZERO],Zr.transparent,[!0,!0,!0,!0]);vT.drawGroundEffect(y,e,t,i,r,_,c,f,gw.disabled,o,"color",n,h,d,p,m,g,u,s)}if(!c||o){const l=new pw([a.ONE,a.ONE,a.ONE,o?a.ZERO:a.ONE],Zr.transparent,[!1,!1,!1,!0],o?a.FUNC_ADD:a.MAX);vT.drawGroundEffect(y,e,t,i,r,_,uw.disabled,l,gw.disabled,o,"clear",n,h,d,p,m,g,u,s,f)}else{a.drawBuffers([a.NONE,a.COLOR_ATTACHMENT1]);const l=new uw({func:a.EQUAL,mask:255},254,255,a.KEEP,a.DECR,a.DECR),c=new pw([a.ONE,a.ONE,a.ONE,a.ONE],Zr.transparent,[!0,!1,!1,!1],a.MAX);vT.drawGroundEffect(y,e,t,i,r,_,l,c,gw.disabled,o,"emissive",n,h,d,p,m,g,u,s,f),a.drawBuffers([a.COLOR_ATTACHMENT0])}};if(_||g){let t;e.prepareDrawTile(),c&&!_||(t=l()),_&&f(!0,!1,t),g&&f(!1,!0,t)}}else _&&x(!0),g&&x(!1),(_||g)&&e.resetStencilClippingMasks()}}},hillshade:function(e,t,i,r){if("offscreen"!==e.renderPass&&"translucent"!==e.renderPass)return;if(e.style.disableElevatedTerrain)return;const n=e.context,o=e.terrain&&e.terrain.renderingToTexture,[a,s]="translucent"!==e.renderPass||o?[{},r]:e.stencilConfigForOverlap(r);for(const l of s){const r=t.getTile(l);if(r.needsHillshadePrepare&&"offscreen"===e.renderPass)lM(e,r,i);else if("translucent"===e.renderPass){const t=e.depthModeForSublayer(0,fw.ReadOnly),n=i.paint.get("hillshade-emissive-strength"),s=e.colorModeForDrapableLayerRenderPass(n),c=o&&e.terrain?e.terrain.stencilModeForRTTOverlap(l):a[l.overscaledZ];aM(e,l,r,i,t,c,s)}}n.viewport.set([0,0,e.width,e.height]),e.resetStencilClippingMasks()},raster:function(e,t,i,r,n,o){if("translucent"!==e.renderPass)return;const a=i.paint.get("raster-opacity");if(0===a)return;const s="globe"===e.transform.projection.name,l=i.paint.get("raster-elevation"),c="ground"===i.paint.get("raster-elevation-reference"),u=l>0,h=e.terrain&&e.terrain.exaggeration()>0&&u&&c,d=u&&s,p=!s&&h;if(e.renderElevatedRasterBackface&&!d)return;const f=e.context,m=f.gl,_=t.getSource(),g=function(e,t,i,r,n){const o=i.paint.get("raster-color"),a="raster-array"===t.type,s=[],l=i.paint.get("raster-resampling"),c=i.paint.get("raster-color-mix");let u=i.paint.get("raster-color-range");const h=[c[0],c[1],c[2],0],d=c[3];let p="nearest"===l?n.NEAREST:n.LINEAR;if(a&&(s.push("RASTER_ARRAY"),o||s.push("RASTER_COLOR"),"linear"===l&&s.push("RASTER_ARRAY_LINEAR"),p=n.NEAREST,o&&"log"===i.paint.get("raster-color-scale")&&s.push("RASTER_COLOR_SCALE_LOG"),!u&&t.rasterLayers)){const e=t.rasterLayers.find(({id:e})=>e===i.sourceLayer);e&&e.fields&&e.fields.range&&(u=e.fields.range)}if(u=u||[0,1],o){s.push("RASTER_COLOR"),r.activeTexture.set(n.TEXTURE2),i.updateColorRamp(u);let e=i.colorRampTexture;e||(e=i.colorRampTexture=new $m(r,i.colorRamp,n.RGBA8)),e.bind(p,n.CLAMP_TO_EDGE)}return e.terrain&&e.terrain.renderingToTexture&&e.isEmissiveMrtActive()&&(s.push("USE_MRT1"),"mrt-full-rgba"===e.emissiveMode&&s.push("USE_MRT1_RGBA")),{mix:h,range:u,offset:d,defines:s,resampling:p}}(e,_,i,f,m);if(_ instanceof YP&&!r.length&&!s)return;const y=i.paint.get("raster-emissive-strength"),x=e.colorModeForDrapableLayerRenderPass(y),v=e.terrain&&e.terrain.renderingToTexture,b=!e.options.moving,w="nearest"===i.paint.get("raster-resampling")?m.NEAREST:m.LINEAR;if(_ instanceof YP&&!r.length&&(_.onNorthPole||_.onSouthPole)){const r=u?e.stencilModeFor3D():uw.disabled;return void Xz(l,!!_.onNorthPole,null,e,t,i,y,g,gw.disabled,r)}if(!r.length)return;const[E,A]=_ instanceof YP||v?[{},r]:e.stencilConfigForOverlap(r),I=A.at(-1).overscaledZ;d&&g.defines.push("PROJECTION_GLOBE_VIEW"),u&&g.defines.push("RENDER_CUTOFF","ELEVATED"),h&&g.defines.push("ELEVATION_REFERENCE_GROUND");const S=(r,n,c)=>{for(const A of r){const r=A.toUnwrapped(),S=t.getTile(A);if(v&&(!S||!S.hasData()))continue;f.activeTexture.set(m.TEXTURE0);const T=Kz(S,_,i,g);if(!T||!T.texture)continue;const{texture:D,mix:M,offset:P,tileSize:C,buffer:R}=T;let z,L;v?(z=fw.disabled,L=A.projMatrix):u?(z=new fw(m.LEQUAL,fw.ReadWrite,e.depthRangeFor3D),L=s?e.transform.expandedFarZProjMatrix:e.transform.calculateProjMatrix(r,b)):(z=e.depthModeForSublayer(A.overscaledZ-I,1===a?fw.ReadWrite:fw.ReadOnly,m.LESS),L=e.transform.calculateProjMatrix(r,b));const F=e.terrain&&v?e.terrain.stencilModeForRTTOverlap(A):E[A.overscaledZ],O=o?0:i.paint.get("raster-fade-duration");S.registerFadeDuration(O);const B=t.findLoadedParent(A,0),k=GT(S,B,t,e.transform,O);let V,N;!k.isFading&&S.refreshedUponExpiration&&(S.refreshedUponExpiration=!1),e.terrain&&e.terrain.prepareDrawTile(),f.activeTexture.set(m.TEXTURE0),D.bind(w,m.CLAMP_TO_EDGE),f.activeTexture.set(m.TEXTURE1),B?(B.texture&&B.texture.bind(w,m.CLAMP_TO_EDGE),V=Math.pow(2,B.tileID.overscaledZ-S.tileID.overscaledZ
vendor: 8,612 bytes, line 2
2),N=[S.tileID.canonical.x*V%1,S.tileID.canonical.y*V%1]):D.bind(w,m.CLAMP_TO_EDGE),"useMipmap"in D&&f.extTextureFilterAnisotropic&&e.transform.pitch>20&&m.texParameterf(m.TEXTURE_2D,f.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,f.extTextureFilterAnisotropicMax);const U=e.transform;let j;const G=u?Yz(U):[0,0,0,0];let H,$,W,q,Z,X=0;if(d&&_ instanceof YP&&_.coordinates.length>3)H=Float32Array.from(cf(Jp(new Df(0,0,0)))),$=Float32Array.from(U.globeMatrix),W=Float32Array.from(ff(U)),q=[Wn(U.center.lng),qn(U.center.lat)],j=_.elevatedGlobePerspectiveTransform,Z=_.elevatedGlobeGridMatrix||new Float32Array(9);else if(d){const e=nf(A.canonical);X=xf(e.getCenter().lat),H=Float32Array.from(cf(Jp(A.canonical))),$=Float32Array.from(U.globeMatrix),W=Float32Array.from(ff(U)),q=[Wn(U.center.lng),qn(U.center.lat)],j=[0,0],Z=Float32Array.from(yf(A.canonical,e,X,U.worldSize/U._pixelsPerMercatorPixel))}else j=_ instanceof YP?_.perspectiveTransform:[0,0],H=new Float32Array(16),$=new Float32Array(9),W=new Float32Array(16),q=[0,0],Z=new Float32Array(9);const Y=_P(e,L,H,$,W,Z,N||[0,0],mf(e.transform.zoom),q,G,V||1,k,i,j,l,2,M,P,g.range,C,R,y),K=e.isTileAffectedByFog(A),J=e.getOrCreateProgram("raster",{defines:g.defines,overrideFog:K});if(e.uploadCommonUniforms(f,J,r),_ instanceof YP){const t=_.elevatedGlobeVertexBuffer,r=_.elevatedGlobeIndexBuffer;if(v||!s)_.boundsBuffer&&_.boundsSegments&&J.draw(e,m.TRIANGLES,z,uw.disabled,x,gw.disabled,Y,i.id,_.boundsBuffer,e.quadTriangleIndexBuffer,_.boundsSegments);else if(t&&r){const o=U.zoom<=5?_.elevatedGlobeSegments:_.getSegmentsForLongitude(U.center.lng);o&&J.draw(e,m.TRIANGLES,z,uw.disabled,x,n,Y,i.id,t,r,o)}}else if(d){z=new fw(m.LEQUAL,fw.ReadOnly,e.depthRangeFor3D);const t=e.globeSharedBuffers;if(t){h&&(e.terrain.setupElevationDraw(S,J),e.uploadCommonUniforms(f,J,S.tileID.toUnwrapped()));const[r,o,a]=t.getGridBuffers(X,!1),s=J.getAttributeLocation(m,"a_texture_pos");-1!==s&&m.vertexAttribI4ui(s,0,0,0,0),J.draw(e,m.TRIANGLES,z,c||F,e.colorModeForRenderPass(),n,Y,i.id,r,o,a)}}else if(p)z=new fw(m.LEQUAL,fw.ReadOnly,e.depthRangeFor3D),e.terrain.setupElevationDraw(S,J),e.uploadCommonUniforms(f,J,S.tileID.toUnwrapped()),U.pitch>20&&J.draw(e,m.TRIANGLES,z,uw.disabled,pw.disabled,gw.frontCCW,Y,i.id,e.terrain.gridBuffer,e.terrain.gridIndexBuffer,e.terrain.gridSegments),J.draw(e,m.TRIANGLES,z,F,x,gw.backCCW,Y,i.id,e.terrain.gridBuffer,e.terrain.gridIndexBuffer,e.terrain.gridSegments);else{const{tileBoundsBuffer:t,tileBoundsIndexBuffer:r,tileBoundsSegments:n}=e.getTileBoundsBuffers(S);J.draw(e,m.TRIANGLES,z,F,x,gw.disabled,Y,i.id,t,r,n)}}if(!(_ instanceof YP)&&d)for(const o of r){const r=o.canonical.y===(1<<o.canonical.z)-1;0===o.canonical.y&&Xz(l,!0,o,e,t,i,y,g,n,c||uw.disabled),r&&Xz(l,!1,o,e,t,i,y,g,n===gw.frontCW?gw.backCW:gw.frontCW,c||uw.disabled)}};d?S(A,e.renderElevatedRasterBackface?gw.backCW:gw.frontCW,e.stencilModeFor3D()):S(A,gw.disabled,void 0),e.resetStencilClippingMasks()},background:function(e,t,i,r){const n=i.paint.get("background-color"),o="none"===i.paint.get("background-color-use-theme").constantOr("default"),a=i.paint.get("background-opacity"),s=i.paint.get("background-emissive-strength"),l="viewport"===i.paint.get("background-pitch-alignment");if(0===a)return;const c=e.context,u=c.gl,h=e.transform,d=h.tileSize,p=i.paint.get("background-pattern");let f;if(void 0!==p){if(null===p)return;if(f=e.imageManager.getPattern(Ur.from(p.toString()),i.scope,e.style.getLut(i.scope)),!f)return}const m=!p&&1===n.a&&1===a&&e.opaquePassEnabledForLayer()?"opaque":"translucent";if(e.renderPass!==m)return;const _=uw.disabled,g=e.depthModeForSublayer(0,"opaque"===m?fw.ReadWrite:fw.ReadOnly),y=e.colorModeForDrapableLayerRenderPass(s),x=p?"backgroundPattern":"background";let v,b=r;b||(v=e.getBackgroundTiles(),b=Object.values(v).map(e=>e.tileID)),p&&(c.activeTexture.set(u.TEXTURE0),e.imageManager.bind(e.context,i.scope));const w=[];if(e.terrain&&e.terrain.renderingToTexture&&e.isEmissiveMrtActive()&&(w.push("USE_MRT1"),"mrt-full-rgba"===e.emissiveMode&&w.push("USE_MRT1_RGBA")),l){const t=e.getOrCreateProgram(x,{overrideFog:!1,overrideRtt:!0,defines:w}),r=Jz,c=new Pf(0,0,0,0,0),h=p?bP(r,s,a,e,0,i.scope,f,l,{tileID:c,tileSize:d}):vP(r,s,a,n.toPremultipliedRenderColor(o?null:i.lut));return void t.draw(e,u.TRIANGLES,g,_,y,gw.disabled,h,i.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments)}for(const E of b){const m=e.isTileAffectedByFog(E),b=e.getOrCreateProgram(x,{overrideFog:m,defines:w}),A=E.toUnwrapped(),I=r?E.projMatrix:e.transform.calculateProjMatrix(A);e.prepareDrawTile();const S=t?t.getTile(E):v?v[E.key]:new ID(E,d,h.zoom,e),T=p?bP(I,s,a,e,0,i.scope,f,l,{tileID:E,tileSize:d}):vP(I,s,a,n.toPremultipliedRenderColor(o?null:i.lut));e.uploadCommonUniforms(c,b,A);const{tileBoundsBuffer:D,tileBoundsIndexBuffer:M,tileBoundsSegments:P}=e.getTileBoundsBuffers(S);b.draw(e,u.TRIANGLES,g,_,y,gw.disabled,T,i.id,D,M,P)}},sky:function(e,t,i){const r=e._atmosphere?mf(e.transform.zoom):1,n=i.paint.get("sky-opacity")*r;if(0===n)return;const o=e.context,a=i.paint.get("sky-type"),s=new fw(o.gl.LEQUAL,fw.ReadOnly,[0,1]),l=e.frameCounter/1e3%1;"atmosphere"===a?"offscreen"===e.renderPass?i.needsSkyboxCapture(e)&&(function(e,t){const i=e.context,r=i.gl;let n=t.skyboxFbo;if(!n){n=t.skyboxFbo=i.createFramebuffer(32,32,1,null),t.skyboxGeometry=new rL(i),t.skyboxTexture=i.gl.createTexture(),r.bindTexture(r.TEXTURE_CUBE_MAP,t.skyboxTexture),r.texParameteri(r.TEXTURE_CUBE_MAP,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_CUBE_MAP,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_CUBE_MAP,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_CUBE_MAP,r.TEXTURE_MAG_FILTER,r.LINEAR);for(let e=0;e<6;++e)r.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,r.RGBA,32,32,0,r.RGBA,r.UNSIGNED_BYTE,null)}i.bindFramebuffer.set(n.framebuffer),i.viewport.set([0,0,32,32]);const o=t.getCenter(e,!0),a=e.getOrCreateProgram("skyboxCapture"),s=new Float64Array(16);M(s,.5*-Math.PI),nL(e,t,a,s,o,0),M(s,.5*Math.PI),nL(e,t,a,s,o,1),D(s,.5*-Math.PI),nL(e,t,a,s,o,2),D(s,.5*Math.PI),nL(e,t,a,s,o,3),_(s),nL(e,t,a,s,o,4),M(s,Math.PI),nL(e,t,a,s,o,5),i.viewport.set([0,0,e.width,e.height])}(e,i),i.markSkyboxValid(e)):"sky"===e.renderPass&&function(e,t,i,r,n){const o=e.context,a=o.gl,s=e.transform,l=e.getOrCreateProgram("skybox");o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_CUBE_MAP,t.skyboxTexture);const c=((e,t,i,r,n)=>({u_matrix:e,u_sun_direction:t,u_cubemap:0,u_opacity:r,u_temporal_offset:n}))(s.skyboxMatrix,t.getCenter(e,!1),0,r,n);e.uploadCommonUniforms(o,l),l.draw(e,a.TRIANGLES,i,uw.disabled,e.colorModeForRenderPass(),gw.backCW,c,"skybox",t.skyboxGeometry.vertexBuffer,t.skyboxGeometry.indexBuffer,t.skyboxGeometry.segment)}(e,i,s,n,l):"gradient"===a&&"sky"===e.renderPass&&function(e,t,i,r,n){const o=e.context,a=o.gl,s=e.transform,l=e.getOrCreateProgram("skyboxGradient");t.skyboxGeometry||(t.skyboxGeometry=new rL(o)),o.activeTexture.set(a.TEXTURE0);let c=t.colorRampTexture;c||(c=t.colorRampTexture=new $m(o,t.colorRamp,a.RGBA8)),c.bind(a.LINEAR,a.CLAMP_TO_EDGE);const u=((e,t,i,r,n)=>({u_matrix:e,u_color_ramp:0,u_center_direction:t,u_radius:nt(i),u_opacity:r,u_temporal_offset:n}))(s.skyboxMatrix,t.getCenter(e,!1),t.paint.get("sky-gradient-radius"),r,n);e.uploadCommonUniforms(o,l),l.draw(e,a.TRIANGLES,i,uw.disabled,e.colorModeForRenderPass(),gw.backCW,u,"skyboxGradient",t.skyboxGeometry.vertexBuffer,t.skyboxGeometry.indexBuffer,t.skyboxGeometry.segment)}(e,i,s,n,l)},custom:function(e,t,i,r){const n=e.context,o=i.implementation;if(!e.transform.projection.unsupportedLayers||!e.transform.projection.unsupportedLayers.includes("custom")||e.terrain&&(e.terrain.renderingToTexture||"offscreen"===e.renderPass)&&i.isDraped(t)){if("offscreen"===e.renderPass){const t=o.prerender;if(t){if(e.setCustomLayerDefaults(),n.setColorMode(e.colorModeForRenderPass()),"globe"===e.transform.projection.name){const i=e.transform.pointMerc;t.call(o,n.gl,e.transform.customLayerMatrix(),e.transform.getProjection(),e.transform.globeToMercatorMatrix(),mf(e.transform.zoom),[i.x,i.y],e.transform.pixelsPerMeterRatio)}else t.call(o,n.gl,e.transform.customLayerMatrix());n.setDirty(),e.setBaseState()}}else if("translucent"===e.renderPass){if(e.terrain&&e.terrain.renderingToTexture){const t=o.renderToTile;if(t){const i=r[0].canonical,a={x:i.x+r[0].wrap*(o.wrapTileId?0:1<<i.z),y:i.y,z:i.z};n.setDepthMode(fw.disabled),n.setStencilMode(uw.disabled),n.setColorMode(e.colorModeForRenderPass()),e.setCustomLayerDefaults();const s=Qz[e.emissiveMode],l=n.gl,c=o.supportsEmissiveMode,u=s&&
vendor: 5,445 bytes, line 2
2c&&c.call(o,s);e.isEmissiveMrtActive()&&!u&&l.drawBuffers([l.COLOR_ATTACHMENT0]),t.call(o,n.gl,a,s),e.isEmissiveMrtActive()&&!u&&l.drawBuffers([l.COLOR_ATTACHMENT0,l.COLOR_ATTACHMENT1]),n.setDirty(),e.setBaseState()}return}e.setCustomLayerDefaults(),n.setColorMode(e.colorModeForRenderPass()),n.setStencilMode(uw.disabled);const t="3d"===o.renderingMode?new fw(e.context.gl.LEQUAL,fw.ReadWrite,e.depthRangeFor3D):e.depthModeForSublayer(0,fw.ReadOnly);if(n.setDepthMode(t),"globe"===e.transform.projection.name){const t=e.transform.pointMerc;o.render(n.gl,e.transform.customLayerMatrix(),e.transform.getProjection(),e.transform.globeToMercatorMatrix(),mf(e.transform.zoom),[t.x,t.y],e.transform.pixelsPerMeterRatio)}else o.render(n.gl,e.transform.customLayerMatrix());n.setDirty(),e.setBaseState(),n.bindFramebuffer.set(null)}}else Tt("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")}},pL={line:function(e,t,i){if(e.hasElevatedBuckets=!1,e.hasNonElevatedBuckets=!1,void 0!==e._unevaluatedLayout.getValue("line-elevation-reference")||void 0!==e._unevaluatedLayout.getValue("line-z-offset")){if(t){const i=t.getVisibleCoordinates();for(const r of i){const i=t.getTile(r).getBucket(e);if(i&&("none"!==i.elevationType?e.hasElevatedBuckets=!0:e.hasNonElevatedBuckets=!0,e.hasElevatedBuckets&&e.hasNonElevatedBuckets))break}}}else e.hasNonElevatedBuckets=!0},raster:function(e,t,i){const r=t.getSource();if("raster-array"!==r.type||!r.loaded())return;const n=e.sourceLayer||r.rasterLayerIds&&r.rasterLayerIds[0];if(!n)return;const o=e.paint.get("raster-array-band")||r.getInitialBand(n);if(null==o)return;const a=t.getIds().map(e=>t.getTileByID(e));for(const s of a)s.updateNeeded(e.id,o)&&r.prepareTile(s,n,e.id,o)}};async function fL(e){if(await bT(),Object.assign(dL,{model:vT.drawModels}),Object.assign(pL,{model:vT.prepare}),e&&!e._destroyed&&!e._shadowRenderer){const t=vT.ShadowRenderer;t&&(e._shadowRenderer=new t(e))}}class mL{constructor(e,t,i,r,n,o){this._forceFullRgbaEmissive=!1,this.context=new Cz(e,t),this._forceFullRgbaEmissive="exact"===o,this.transform=i,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.frcCoverageSnapshot=null,this.elevationCoverageSnapshot=null,this.elevationProvidersReady=void 0,this.frcCoverageFadeRange=null,this.frcCoverageSourceLayers=[],this.frcCoverageRenderer=rM.FrcCoverageRenderer?new rM.FrcCoverageRenderer:null,this._debugParams={averageFPS:0,fpsHistory:[],fpsWindow:30,continousRedraw:!1,enabledLayers:{},buildingsShowNormals:!1,buildingsDrawGroundAO:!0,buildingsDrawShadowPass:!0,buildingsDrawTranslucentPass:!0,showTerrainProxyTiles:!1,terrainSortTilesHiZFirst:!0,terrainDisableRenderCache:!1,forceEnablePrecipitation:!1,overrideSnowParams:!1,snowParamsOverride:null,snowRevealParamsOverride:null,snowVignetteParamsOverride:null,overrideRainParams:!1,rainParamsOverride:null,rainRevealParamsOverride:null,rainVignetteParamsOverride:null,overrideStarsParams:!1,starsParamsOverride:null,show3DModelFootprints:!1,showElevationIdDebug:!1,lodSwitchDistance:-1,lodSwitchFadeDuration:.5},this.occlusionParams=new hL,this.setup(),this.numSublayers=DD.maxUnderzooming+DD.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this.frameTimeDelta=0,this.lastPaintStartTimeStamp=0,this._shadowCullCache=null,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new sm,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._wireframeDebugCache=new uL,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const a=new zd({width:1,height:1},Uint8Array.of(0,0,0,0));this.emptyDepthTexture=new $m(this.context,a,e.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=r,this.maxFrontCutoffRawStart=0,this.worldview=n,this._forceEmissiveMode=!1,this.emissiveMode="constant"}updateTerrain(e,t){const i=!!e&&!!e.terrain&&this.transform.projection.supportsTerrain;var r;(i||this._terrain&&this._terrain.enabled)&&(this._terrain||(this._terrain=sP(this,e),this._terrain)?(this.transform.elevation=i?this._terrain:null,this._terrain.update(e,this.transform,t),this.transform.elevation&&!this._terrain.enabled&&(this.transform.elevation=null)):this._terrainRendererRetryPending||(this._terrainRendererRetryPending=!0,r=()=>{this._terrainRendererRetryPending=!1,this.style&&this.style.map&&this.style.map._update(!1)},oP?r():aP.push(r)))}_updateFog(e){const t=e.fog;if(!t||"globe"===this.transform.projection.name||t.getOpacity(this.transform.pitch)<1||t.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[i,r]=t.getRangeForProjection();if(i>r)return void(this.transform.fogCullDistSq=null);const n=i+.78*(r-i);this.transform.fogCullDistSq=n*n}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(e){e&&!this._terrain&&(this._terrain=sP(this,this.style),this._terrain||console.warn("forceTerrainMode: Lite module not loaded yet, terrain renderer unavailable")),this._forceTerrainMode=e}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}
vendor: 13,184 bytes, line 2
2resize(e,t){if(this.width=e*ei.devicePixelRatio,this.height=t*ei.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const i of this.style.order)this.style._mergedLayers[i].resize()}setup(){const e=this.context,t=new uu;t.emplaceBack(0,0),t.emplaceBack(co,0),t.emplaceBack(0,co),t.emplaceBack(co,co),this.tileExtentBuffer=e.createVertexBuffer(t,Op.members),this.tileExtentSegments=uh.simpleSegment(0,0,4,2);const i=new uu;i.emplaceBack(0,0),i.emplaceBack(co,0),i.emplaceBack(0,co),i.emplaceBack(co,co),this.debugBuffer=e.createVertexBuffer(i,Op.members),this.debugSegments=uh.simpleSegment(0,0,4,5);const r=new uu;r.emplaceBack(-1,-1),r.emplaceBack(1,-1),r.emplaceBack(-1,1),r.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(r,Op.members),this.viewportSegments=uh.simpleSegment(0,0,4,2);const n=new du;n.emplaceBack(0,0,0,0),n.emplaceBack(co,0,co,0),n.emplaceBack(0,co,0,co),n.emplaceBack(co,co,co,co),this.mercatorBoundsBuffer=e.createVertexBuffer(n,bD.members),this.mercatorBoundsSegments=uh.simpleSegment(0,0,4,2);const o=new Ru;o.emplaceBack(0,1,2),o.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(o);const a=new ju;for(const l of[0,1,3,2,0])a.emplaceBack(l);this.debugIndexBuffer=e.createIndexBuffer(a),this.emptyTexture=new $m(e,new zd({width:1,height:1},Uint8Array.of(0,0,0,0)),e.gl.RGBA8),this.identityMat=p();const s=this.context.gl;this.stencilClearMode=new uw({func:s.ALWAYS,mask:0},0,255,s.ZERO,s.ZERO,s.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(e){return e._makeTileBoundsBuffers(this.context,this.transform.projection),e._tileBoundsBuffer?{tileBoundsBuffer:e._tileBoundsBuffer,tileBoundsIndexBuffer:e._tileBoundsIndexBuffer,tileBoundsSegments:e._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const e=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,e.TRIANGLES,fw.disabled,this.stencilClearMode,pw.disabled,gw.disabled,qD(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(e,t,i){if(!t||this.currentStencilSource===t.id||!e.isTileClipped()||!i||0===i.length)return;if(this._tileClippingMaskIDs&&!this.terrain){let e=!1;for(const t of i)if(void 0===this._tileClippingMaskIDs[t.key]){e=!0;break}if(!e)return}this.currentStencilSource=t.id;const r=this.context,n=r.gl;this.nextStencilID+i.length>256&&this.clearStencil(),r.setColorMode(pw.disabled),r.setDepthMode(fw.disabled);const o=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const a of i){const e=t.getTile(a),i=this._tileClippingMaskIDs[a.key]=this.nextStencilID++,{tileBoundsBuffer:r,tileBoundsIndexBuffer:s,tileBoundsSegments:l}=this.getTileBoundsBuffers(e);o.draw(this,n.TRIANGLES,fw.disabled,new uw({func:n.ALWAYS,mask:0},i,255,n.KEEP,n.KEEP,n.REPLACE),pw.disabled,gw.disabled,qD(a.projMatrix),"$clipping",r,s,l)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,t=this.context.gl;return new uw({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(e);const t=this.context.gl;return new uw({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}stencilConfigForOverlap(e){const t=this.context.gl,i=e.sort((e,t)=>t.overscaledZ-e.overscaledZ),r=i.at(-1).overscaledZ,n=i[0].overscaledZ-r+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();const e={};for(let i=0;i<n;i++)e[i+r]=new uw({func:t.GEQUAL,mask:255},i+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=n,[e,i]}return[{[r]:uw.disabled},i]}colorModeForRenderPass(){const e=this.context.gl;if(this._showOverdrawInspector){const t=1/8;return new pw([e.CONSTANT_COLOR,e.ONE,e.CONSTANT_COLOR,e.ONE],new Zr(t,t,t,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?pw.unblended:pw.alphaBlended}isEmissiveMrtActive(){return"mrt-fallback"===this.emissiveMode||"mrt-full-rgba"===this.emissiveMode}colorModeForDrapableLayerRenderPass(e){const t=this.context.gl;return(()=>this.style&&this.style.enable3dLights()&&!!this._terrain&&this._terrain.renderingToTexture)()&&"translucent"===this.renderPass?null!=e&&!this.isEmissiveMrtActive()||"constant"===this.emissiveMode?new pw([t.ONE,t.ONE_MINUS_SRC_ALPHA,t.CONSTANT_ALPHA,t.ONE_MINUS_SRC_ALPHA],new Zr(0,0,0,e??0),[!0,!0,!0,!0]):"dual-source-blending"===this.emissiveMode?new pw([t.ONE,t.ONE_MINUS_SRC_ALPHA,this.context.extBlendFuncExtended.SRC1_ALPHA_WEBGL,t.ONE_MINUS_SRC_ALPHA],Zr.transparent,[!0,!0,!0,!0]):this.colorModeForRenderPass():this.colorModeForRenderPass()}depthModeForSublayer(e,t,i,r=!1){if(this.depthOcclusion)return new fw(this.context.gl.GREATER,fw.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!r)return fw.disabled;const n=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new fw(i||this.context.gl.LEQUAL,t,[n,n])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}blitDepth(){const e=this.context.gl,t=Math.ceil(this.width),i=Math.ceil(this.height),r=this.context.bindFramebuffer.get(),n=e.getParameter(e.TEXTURE_BINDING_2D);this.depthFBO&&this.depthFBO.width===t&&this.depthFBO.height===i||(this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),0!==t&&0!==i&&(this.depthFBO=new Pz(this.context,t,i,0,"texture"),this.depthTexture=new $m(this.context,{width:t,height:i,data:null},e.DEPTH24_STENCIL8),this.depthFBO.depthAttachment.set(this.depthTexture.texture))),this.context.bindFramebuffer.set(r),e.bindTexture(e.TEXTURE_2D,n),this.depthFBO&&(e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,this.depthFBO.framebuffer),e.blitFramebuffer(0,0,t,i,0,0,t,i,e.DEPTH_BUFFER_BIT,e.NEAREST),e.bindFramebuffer(e.FRAMEBUFFER,this.context.bindFramebuffer.current))}render(e,t){this.context.sweepPendingPrograms(),this.frameTimeDelta=0===this.lastPaintStartTimeStamp?0:t.paintStartTimeStamp-this.lastPaintStartTimeStamp,this.lastPaintStartTimeStamp=t.paintStartTimeStamp,this._wireframeDebugCache.update(this.frameCounter),this.style=e,this.options=t,this.frcCoverageSnapshot&&!this.frcCoverageSnapshot.empty()&&(!this.frcCoverageRenderer&&rM.FrcCoverageRenderer&&(this.frcCoverageRenderer=new rM.FrcCoverageRenderer),this.frcCoverageRenderer&&this.frcCoverageRenderer.update(this.context,this.frcCoverageSnapshot.tiles));const i=this.style._mergedLayers,r=!(!this.terrain||!this.terrain.enabled),n=()=>this.style._getOrder(r);let o=n(),a=!1,s=!1,l=null,c=0,u=!1;for(const C of o){const e=i[C];"none"!==e.visibility&&("circle"===e.type?a=!0:"building"===e.type?(l=e,++c):"symbol"===e.type&&(e.hasOcclusionOpacityProperties?s=!0:a=!0))}this.updateEmissiveMode();let h=o.map(e=>i[e]);const d=this.style._mergedSourceCaches;this.imageManager=e.imageManager,this.modelManager=e.modelManager,this.symbolFadeChange=e.placement.symbolFadeChange(ei.now()),this.imageManager.beginFrame();for(const C in d){const e=d[C];e.used&&(e.prepare(this.context),e.getSource().usedInConflation&&++c)}let p=!1;for(const C of h)C.isHidden(this.transform.zoom)||("clip"===C.type&&(p=!0),this.prepareLayer(C));const f={},m={},_={},g={},y={};for(const C in d){const e=d[C];f[C]=e.getVisibleCoordinates(),m[C]=f[C].slice().reverse(),_[C]=e.getVisibleCoordinates(!0).reverse(),g[C]=e.getShadowCasterCoordinates(),y[C]=e.sortCoordinatesByDistance(f[C])}const x=e=>{const t=this.style.getLayerSourceCache(e);return t&&t.used?t.getSource():null};if(c||p||this._clippingActiveLastFrame){const e=[],t=[];let i=0;for(const r of h)this.isSourceForClippingOrConflation(r,x(r))&&(e.push(r),t.push(i)),i++;if(e&&(p||e.length>1)||this._clippingActiveLastFrame){p=!1;const i=[];for(let r=0;r<e.length;r++){const n=e[r],o=t[r],a=this.style.getLayerSourceCache(n);if(!a||!a.used||!a.getSource().usedInConflation&&"clip"!==n.type&&"building"!==n.type)continue;let s=nm,l=0;const c=[];let u=!0;if("building"===n.type)s=om;else if("clip"===n.type)if(s=o,n.isHidden(this.transform.zoom))u=!1;else{if(!n.layout){u=!1;continue}for(const e of n.layout.get("clip-layer-types"))l|="model"===e?1:"symbol"===e?2:4;for(const e of n.layout.get("clip-layer-scope"))c.push(Ul(e,n.scope));p=!0}u&&i.push({layer:n.fqid,cache:a,order:s,clipMask:l,clipScope:c})}this.replacementSource.setSources(i),u=!0}}this._clippingActiveLastFrame=p,u||this.replacementSource.clear(),this.conflationActive=u,this.minCutoffZoom=0,this.longestCutoffRange=0,this.maxFrontCutoffRawStart=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let C=0;C<h.length;C++){const e=h[C];if("none"===e.visibility)continue;const t=e.cutoffRange();if(this.longestCutoffRange=Math.max(t,this.longestCutoffRange),t>0){const t=x(e);t&&(this.minCutoffZoom=Math.max(t.minzoom,this.minCutoffZoom)),e.minzoom&&(this.minCutoffZoom=Math.max(e.minzoom,this.minCutoffZoom))}e.is3D(r)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=C),this._lastOcclusionLayer=C)}const v=this.style&&this.style.fog;v?(this._fogVisible=0!==v.getOpacity(this.transform.pitch),this._fogVisible&&"globe"!==this.transform.projection.name&&(this._fogVisible=v.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(_),this.opaquePassCutoff=0,o=n(),h=o.map(e=>i[e])),this.style.enable3dLights()&&!this._shadowRenderer&&fL(this);const b=this._shadowRenderer;if(b){b.updateShadowParameters(this.transform,this.style.directionalLight,g);for(const e in d)for(const t of f[e]){let e={min:0,max:0};this.terrain&&(e=this.terrain.getMinMaxForTile(t)||e),b.addShadowReceiver(t.toUnwrapped(),e.min,e.max)}}"globe"!==this.transform.projection.name||this.globeSharedBuffers||(this.globeSharedBuffers=new Sf(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new lL),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);let w=!(!this.style||!this.style.snow),E=!(!this.style||!this.style.rain);if(w&&!this._snow&&rM.Snow&&(this._snow=new rM.Snow),!w&&this._snow&&(this._snow.destroy(),delete this._snow),E&&!this._rain&&rM.Rain&&(this._rain=new rM.Rain),!E&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),l&&(!this.buildingTileBorderManager&&rM.BuildingTileBorderManager&&(this.buildingTileBorderManager=new rM.BuildingTileBorderManager),this.buildingTileBorderManager)){const e=this.style.getLayerSourceCache(l);this.buildingTileBorderManager.updateBorders(e,l)}if(!zr.has(this.context.gl))return;this.renderPass="offscreen";for(const C of h){const t=e.getLayerSourceCache(C);if(!C.hasOffscreenPass()||C.isHidden(this.transform.zoom))continue;const i=t?m[t.id]:void 0;("custom"===C.type||"raster"===C.type||"raster-particle"===C.type||C.isSky()||i&&i.length)&&this.renderLayer(this,t,C,i)}this.depthRangeFor3D=[0,1-(h.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,g)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const A="globe"===this.transform.projection.name||this.transform.isHorizonVisible(),I=(()=>{if(t.showOverdrawInspector)return Zr.black;const e=this.style.fog;if(e&&this.transform.projection.supportsFog){const t=this.style.getLut(e.scope);if(!A){const i="none"===e.properties.get("color-use-theme"),r=e.properties.get("color").toNonPremultipliedRenderColor(i?null:t).toArray01();return new Zr(...r)}if(A){const i="none"===e.properties.get("space-color-use-theme"),r=e.properties.get("space-color").toNonPremultipliedRenderColor(i?null:t).toArray01();return new Zr(...r)}}return Zr.transparent})();if(this.context.clear({color:I,depth:1}),this.clearStencil(),this._showOverdrawInspector=t.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&A&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=o.length-1;this.currentLayer>=0;this.currentLayer--){const t=h[this.currentLayer],i=e.getLayerSourceCache(t);if(t.isSky())continue;const n=i?(t.is3D(r)?y:m)[i.id]:void 0;this._renderTileClippingMasks(t,i,n),this.renderLayer(this,i,t,n)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&A&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||mf(this.transform.zoom)>0)&&("globe"===this.transform.projection.name||this.transform.isH
vendor: 36,192 bytes, line 2
2orizonVisible()))for(this.currentLayer=0;this.currentLayer<o.length;this.currentLayer++){const t=h[this.currentLayer],i=e.getLayerSourceCache(t);t.isSky()&&this.renderLayer(this,i,t,i?m[i.id]:void 0)}function S(e,t){let i;return t&&(i=("symbol"===e.type?_:e.is3D(r)?y:m)[t.id]),i}if(this.renderPass="translucent","globe"===this.transform.projection.name){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<o.length;){const t=h[this.currentLayer];if("raster"===t.type||"raster-particle"===t.type){const i=e.getLayerSourceCache(t);this.renderLayer(this,i,t,S(t,i))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;const T=b?b.getGroundShadowLayerIndex():-1;let D=!1,M=-1;for(let C=0;C<o.length;++C){const e=h[C];e.isHidden(this.transform.zoom)||e.is3D(r)&&(M=C)}s&&-1===M&&(a=!0);let P=!1;for(;this.currentLayer<o.length;){const t=h[this.currentLayer],i=e.getLayerSourceCache(t);if(t.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(t)){if(t.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer),this._lastOcclusionLayer=Math.max(this.currentLayer,this._lastOcclusionLayer)}else{if(!P&&t.is3D(r)&&!r){const e=this.currentLayer,t=e=>{for(this.currentLayer=0;this.currentLayer<h.length;this.currentLayer++){const t=h[this.currentLayer];if("fill"===t.type&&rM.drawDepthPrepass){const i=this.style.getLayerSourceCache(t);rM.drawDepthPrepass(this,i,t,S(t,i),e)}}};t("initialize"),t("reset"),this.currentLayer=e,P=!0}if(a&&!D&&this.terrain&&!this.transform.isOrthographic&&(D=!0,this.blitDepth()),s&&-1!==M&&this.currentLayer===M+1&&!this.transform.isOrthographic&&this.blitDepth(),this.terrain||this._renderTileClippingMasks(t,i,i?f[i.id]:void 0),this.renderLayer(this,i,t,S(t,i)),!this.terrain&&b&&this.currentLayer===T){{this.clearStencil(),this.resetStencilClippingMasks();const e=this.currentLayer;for(this.currentLayer=0;this.currentLayer<h.length;this.currentLayer++){const e=h[this.currentLayer];if("fill"===e.type&&rM.drawGroundShadowMask){const t=this.style.getLayerSourceCache(e);rM.drawGroundShadowMask(this,t,e,S(e,t))}}this.currentLayer=e}if(b.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer){const t=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=t;this.currentLayer++){const t=h[this.currentLayer];if(!t.hasLightBeamPass())continue;const i=e.getLayerSourceCache(t);this.renderLayer(this,i,t,i?m[i.id]:void 0)}this.currentLayer=t,this.renderPass="translucent"}}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const t=this.currentLayer;this.depthOcclusion=!0;for(const i of this.layersWithOcclusionOpacity){this.currentLayer=i;const t=h[this.currentLayer],r=e.getLayerSourceCache(t),n=r?m[r.id]:void 0;this.terrain||this._renderTileClippingMasks(t,r,r?f[r.id]:void 0),this.renderLayer(this,r,t,n)}this.depthOcclusion=!1,this.currentLayer=t,this.renderPass="translucent",this.layersWithOcclusionOpacity=[]}++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this._snow&&this._snow.draw(this),this._rain&&this._rain.draw(this),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let t=null;h.forEach(i=>{const r=e.getLayerSourceCache(i);r&&!i.isHidden(this.transform.zoom)&&r.getVisibleCoordinates().length&&(!t||t.getSource().maxzoom<r.getSource().maxzoom)&&(t=r)}),t&&this.options.showTileBoundaries&&MS.drawDebug&&MS.drawDebug(this,t,t.getVisibleCoordinates(),Zr.red,!1,this.options.showParseStatus)}this.options.showPadding&&MS.drawDebugPadding&&MS.drawDebugPadding(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveCanvasCopy()),u||(this.conflationActive=!1)}prepareLayer(e){this.gpuTimingStart(e);const{unsupportedLayers:t}=this.transform.projection,i=!t||!t.includes(e.type);if(pL[e.type]&&(i||this.terrain&&"custom"===e.type)){const t=this.style.getLayerSourceCache(e);pL[e.type](e,t,this)}this.gpuTimingEnd()}renderLayer(e,t,i,r){i.isHidden(this.transform.zoom)||("background"===i.type||"sky"===i.type||"custom"===i.type||"model"===i.type||"raster"===i.type||"raster-particle"===i.type||r&&r.length)&&(this.id=i.id,this.gpuTimingStart(i),(!e.transform.projection.unsupportedLayers||!e.transform.projection.unsupportedLayers.includes(i.type)||e.terrain&&"custom"===i.type)&&"clip"!==i.type&&"slot"!==i.type&&"placement-group"!==i.type&&dL[i.type]&&dL[i.type](e,t,i,r,this.style.placement.variableOffsets,this.options.isInitialLoad),dL[i.type]||(i.mayUse("HD")&&async function(){await nM(),Object.assign(dL,{building:rM.drawBuilding,"raster-particle":rM.drawRasterParticle}),Object.assign(pL,{"raster-particle":rM.prepareRasterParticle})}(),i.mayUse("Standard")&&fL(e)),this.gpuTimingEnd())}gpuTimingStart(e){if(!this.options.gpuTiming)return;const t=this.context.extTimerQuery,i=this.context.gl;let r=this.gpuTimers[e.id];r||(r=this.gpuTimers[e.id]={calls:0,cpuTime:0,query:i.createQuery()}),r.calls++,i.beginQuery(t.TIME_ELAPSED_EXT,r.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const e=this.context.extTimerQuery,t=this.context.gl,i=t.createQuery();this.deferredRenderGpuTimeQueries.push(i),t.beginQuery(e.TIME_ELAPSED_EXT,i)}}gpuTimingDeferredRenderEnd(){this.options.gpuTimingDeferredRender&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}gpuTimingEnd(){this.options.gpuTiming&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}collectGpuTimers(){const e=this.gpuTimers;return this.gpuTimers={},e}collectDeferredRenderGpuQueries(){const e=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],e}queryGpuTimers(e){const t={};for(const i in e){const r=e[i],n=this.context.extTimerQuery,o=n.getQueryParameter(r.query,this.context.gl.QUERY_RESULT)/1e6;n.deleteQueryEXT(r.query),t[i]=o}return t}queryGpuTimeDeferredRender(e){if(!this.options.gpuTimingDeferredRender)return 0;const t=this.context.gl;let i=0;for(const r of e)i+=t.getQueryParameter(r,t.QUERY_RESULT)/1e6,t.deleteQuery(r);return i}translatePosMatrix(e,t,i,r,n){if(!i[0]&&!i[1])return e;const o=n?"map"===r?this.transform.angle:0:"viewport"===r?-this.transform.angle:0;if(o){const e=Math.sin(o),t=Math.cos(o);i=[i[0]*t-i[1]*e,i[0]*e+i[1]*t]}const a=[n?i[0]:tb(t,i[0],this.transform.zoom),n?i[1]:tb(t,i[1],this.transform.zoom),0],s=new Float32Array(16);return v(s,e,a),s}saveTileTexture(e){if(e.context!==this.context)return;const t=e.size[0],i=this._tileTextures[t];i?i.push(e):this._tileTextures[t]=[e]}getTileTexture(e){const t=this._tileTextures[e];return t&&t.length>0?t.pop():null}terrainRenderModeElevated(){return this.style&&this.style.hasTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return null!=this.context.extTextureFloatLinear}currentGlobalDefines(e,t,i,r,n){const o=void 0===i?!!this._terrain&&this._terrain.renderingToTexture:i,a=void 0===r?this.terrainRenderModeElevated():r,s=void 0===n?"globe"===this.transform.projection.name:n,l=[];return this.style&&this.style.enable3dLights()&&("globeRaster"===e||"terrainRaster"===e?(l.push("LIGHTING_3D_MODE"),l.push("LIGHTING_3D_ALPHA_EMISSIVENESS"),"mrt-full-rgba"===this.emissiveMode&&l.push("USE_MRT1_RGBA")):o||l.push("LIGHTING_3D_MODE")),a&&(l.push("TERRAIN"),this.linearFloatFilteringSupported()&&l.push("TERRAIN_DEM_FLOAT_FORMAT")),s&&l.push("GLOBE"),!this._fogVisible||o||void 0!==t&&!t||l.push("FOG"),o&&l.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&l.push("OVERDRAW_INSPECTOR"),l}getOrCreateProgram(e,t){this.cache=this.cache||{};const{defines:i,config:r,overrideFog:n,overrideRtt:o,overrideTerrain:a,overrideGlobe:s,precompiled:l}=t||{},c=this.currentGlobalDefines(e,n,o,a,s).concat(i||[]),u=this.getShaderSource(e),h=rM.programUniforms,d=vT.programUniforms,p=wP[e]||h&&h[e]||d&&d[e],f=Sz.cacheKey(u,e,c,r);return this.cache[f]||(this.cache[f]=new Sz(this.context,e,u,r,p,c,l)),this.cache[f]}getShaderSource(e){const t=rM.shaders,i=vT.shaders,r=AP.shaders;return ZE[e]||t&&t[e]||i&&i[e]||r&&r[e]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new $m(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy(),this._destroyed=!0}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(e,t,i){if(this.style.enable3dLights()){const r=this.style.directionalLight,n=this.style.ambientLight;if(r&&n){const o=((e,t,i,r)=>{const n=e.properties.get("direction"),o="none"===e.properties.get("color-use-theme"),a=e.properties.get("color").toNonPremultipliedRenderColor(o?null:i.getLut(e.scope)).toArray01();let s=e.properties.get("intensity");const l="none"===t.properties.get("color-use-theme"),c=t.properties.get("color").toNonPremultipliedRenderColor(l?null:i.getLut(t.scope)).toArray01();let u=t.properties.get("intensity");const h=[n.x,n.y,n.z];r&&(void 0!==r.ambientIntensity&&(u=r.ambientIntensity),void 0!==r.directionalIntensity&&(s=r.directionalIntensity),void 0!==r.ambientColor&&(c[0]=r.ambientColor[0],c[1]=r.ambientColor[1],c[2]=r.ambientColor[2]),void 0!==r.directionalColor&&(a[0]=r.directionalColor[0],a[1]=r.directionalColor[1],a[2]=r.directionalColor[2]));const d=kt(c,u),p=kt(a,s);return{u_lighting_ambient_color:d,u_lighting_directional_dir:h,u_lighting_directional_color:p,u_ground_radiance:Ez(h,p,d)}})(r,n,this.style,i);t.setLightsUniformValues(e,o)}}}uploadCommonUniforms(e,t,i,r,n,o){if(this.uploadCommonLightUniforms(e,t,o),this.terrain&&this.terrain.renderingToTexture)return;const a=this.style.fog;if(a){const n=a.getOpacity(this.transform.pitch),o=((e,t,i,r,n,o,a,s,l,c,u,h)=>{const d=e.transform,p="none"===t.properties.get("color-use-theme"),f=t.properties.get("color").toNonPremultipliedRenderColor(p?null:e.style.getLut(t.scope)).toArray01();f[3]=r;const m=e.frameCounter/1e3%1,[_,g]=t.properties.get("vertical-range");return{u_fog_matrix:i?d.calculateFogTileMatrix(i):h||e.identityMat,u_fog_range:t.getRangeForProjection(),u_fog_color:f,u_fog_horizon_blend:t.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(_,g),g],u_fog_temporal_offset:m,u_frustum_tl:n,u_frustum_tr:o,u_frustum_br:a,u_frustum_bl:s,u_globe_pos:l,u_globe_radius:c,u_viewport:u,u_globe_transition:mf(d.zoom),u_is_globe:+("globe"===d.projection.name)}})(this,a,i,n,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*ei.devicePixelRatio,this.transform.height*ei.devicePixelRatio],r);t.setFogUniformValues(e,o)}n&&t.setCutoffUniformValues(e,n.uniformValues)}setTileLoadedFlag(e){this.tileLoaded=e}saveCanvasCopy(){const e=this.canvasCopy();e&&(this.frameCopies.push(e),this.tileLoaded=!1)}canvasCopy(){const e=this.context.gl,t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA,0,0,e.drawingBufferWidth,e.drawingBufferHeight,0),t}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const e=this.style&&this.style.fog;return!!e&&0!==e.getOpacity(this.transform.pitch)}getBackgroundTiles(){const e=this._backgroundTiles,t=this._backgroundTiles={},i=this.transform.coveringTiles({tileSize:512});for(const r of i)t[r.key]=e[r.key]||new ID(r,512,this.transform.tileZoom,this,void 0,this.worldview);return t}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(e,t){return!(!e.is3D(!(!this.terrain||!this.terrain.enabled))||"clip"!==e.type&&"building"!==e.type&&(e.minzoom&&e.minzoom>this.transform.zoom||(this.style._clipLayerPresent||"building"!==e.sourceLayer&&"procedural_buildings"!==e.sourceLayer)&&(!t||"batched-model"!==t.type)))}isTileAffectedByFog(e){if(!this.style||!this.style.fog)return!1;if("globe"===this.transform.projection.name)return!0;let t=this._cachedTileFogOpacities[e.key];return t||(this._cachedTileFogOpacities[e.key]=t=this.style.fog.getOpacityForTile(e)),t[0]>=bm||t[1]>=bm}setupDepthForOcclusion(e,t,i){const r=this.context,n=r.gl,o=!!i;var a;i||(i={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),r.activeTexture.set(n.TEXTURE3),e&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(n.NEAREST,n.CLAMP_TO_EDGE),i.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],i.u_depth_range_unpack=[2/((a=this.depthRangeFor3D)[1]-a[0]),-1-2*a[0]/(a[1]-a[0])],i.u_occluder_half_size=.5*this.occlusionParams.occluderSize,i.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(n.NEAREST,n.CLAMP_TO_EDGE),r.activeTexture.set(n.TEXTURE0),o||t.setTerrainUniformValues(r,i)}updateEmissiveMode(){if(this._forceEmissiveMode)return;const e=this.style.hasDataDrivenEmissiveStrength();this.emissiveMode=this._forceFullRgbaEmissive?"mrt-full-rgba":e?this.context.extBlendFuncExtended?"dual-source-blending":"mrt-fallback":"constant"}}function _L(e,t){let i=!1,r=null;const n=()=>{r=null,i&&(e(),r=setTimeout(n,t),i=!1)};return()=>(i=!0,r||n(),r)}const gL=/(#.+)?$/;class yL{constructor(e){this._hashName=e&&encodeURIComponent(e),bt(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=_L(this._updateHashUnthrottled.bind(this),300)}addTo(e){return this._map=e,window.addEventListener("hashchange",this._onHashChange,!1),e.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const e=this._map;if(!e)return"";const t=xL(e);if(this._hashName){const e=this._hashName;let i=!1;const r=location.hash.slice(1).split("&").map(r=>{const n=r.split("=")[0];return n===e?(i=!0,`${n}=${t}`):r}).filter(e=>e);return i||r.push(`${e}=${t}`),`#${r.join("&")}`}return`#${t}`}_getCurrentHash(){const e=location.hash.replace("#","");if(this._hashName){let t;return e.split("&").map(e=>e.split("=")).forEach(e=>{e[0]===this._hashName&&(t=e)}),(t&&t[1]||"").split("/")}return e.split("/")}_onHashChange(){const e=this._map;if(!e)return!1;const t=this._getCurrentHash();if(t.length>=3&&!t.some(e=>isNaN(Number(e)))){const i=e.dragRotate.isEnabled()&&e.touchZoomRotate.isEnabled()?+(t[3]||0):e.getBearing();return e.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:i,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(gL,this.getHashString()))}}function xL(e,t){const i=e.getCenter(),r=Math.round(100*e.getZoom())/100,n=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),o=Math.pow(10,n),a=Math.round(i.lng*o)/o,s=Math.round(i.lat*o)/o,l=e.getBearing(),c=e.getPitch();let u=t?`/${a}/${s}/${r}`:`${r}/${s}/${a}`;return(l||c)&&(u+="/"+Math.round(10*l)/10),c&&(u+=`/${Math.round(c)}`),u}const vL={linearity:.3,easing:Be(0,0,.3,1)},bL={deceleration:2500,maxSpeed:1400,...vL},wL={deceleration:20,maxSpeed:1400,...vL},EL={deceleration:1e3,maxSpeed:360,...vL},AL={deceleration:1e3,maxSpeed:90,...vL};class IL{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:ei.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,t=ei.now();for(;e.length>0&&t-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._map._prefersReducedMotion())return;if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const t={zoom:0,bearing:0,pitch:0,pan:new ke(0,0),pinchAround:void 0,around:void 0};for(const{settings:n}of this._inertiaBuffer)t.zoom+=n.zoomDelta||0,t.bearing+=n.bearingDelta||0,t.pitch+=n.pitchDelta||0,n.panDelta&&t.pan._add(n.panDelta),n.around&&(t.around=n.around),n.pinchAround&&(t.pinchAround=n.pinchAround);const i=this._inertiaBuffer.at(-1).time-this._inertiaBuffer[0].time,r={};if(t.pan.mag()){const n=TL(t.pan.mag(),i,{...bL,...e||{}});r.offset=t.pan.mult(n.amount/t.pan.mag()),r.center=this._map.transform.center,SL(r,n)}if(t.zoom){const e=TL(t.zoom,i,wL);r.zoom=this._map.transform.zoom+e.amount,SL(r,e)}if(t.bearing){const e=TL(t.bearing,i,EL);r.bearing=this._map.transform.bearing+ht(e.amount,-179,179),SL(r,e)}if(t.pitch){const e=TL(t.pitch,i,AL);r.pitch=this._map.transform.pitch+e.amount,SL(r,e)}if(r.zoom||r.bearing){const e=void 0===t.pinchAround?t.around:t.pinchAround;r.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),r.noMoveStart=!0,r}}function SL(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function TL(e,t,i){const{maxSpeed:r,linearity:n,deceleration:o}=i,a=ht(e*n/(t/1e3),-r,r),s=Math.abs(a)/(o*n);return{easing:i.easing,duration:1e3*s,amount:a*(s/2)}}class DL extends Or{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i,r={}){const n=pi(t.getCanvasContainer(),i);super(e,{point:n,lngLat:t.unproject(n),originalEvent:i,...r}),this._defaultPrevented=!1,this.target=t}}class ML extends Or{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i){const r="touchend"===e?i.changedTouches:i.touches,n=fi(t.getCanvasContainer(),r),o=n.map(e=>t.unproject(e)),a=n.reduce((e,t,i,r)=>e.add(t.div(r.length)),new ke(0,0));super(e,{points:n,point:a,lngLats:o,lngLat:t.unproject(a),originalEvent:i}),this._defaultPrevented=!1}}class PL extends Or{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t){super("wheel",{originalEvent:t}),this._defaultPrevented=!1}}class CL{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){this._mousedownPos=void 0}wheel(e){return this._firePreventable(new PL(this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new DL(e.type,this._map,e))}mouseup(e){this._map.fire(new DL(e.type,this._map,e))}preclick(e){const t=new MouseEvent("preclick",e);this._map.fire(new DL(t.type,this._map,t))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||(this.preclick(e),this._map.fire(new DL(e.type,this._map,e)))}dblclick(e){return this._firePreventable(new DL(e.type,this._map,e))}mouseover(e){this._map.fire(new DL(e.type,this._map,e))}mouseout(e){this._map.fire(new DL(e.type,this._map,e))}touchstart(e){return this._firePreventable(new ML(e.type,this._map,e))}touchmove(e){this._map.fire(new ML(e.type,this._map,e))}touchend(e){this._map.fire(new ML(e.type,this._map,e))}touchcancel(e){this._map.fire(new ML(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class RL{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(e){this._map.fire(new DL(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new DL("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._map.fire(new DL(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class zL{constructor(e,t){this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&0===e.button&&(ci(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;const i=t,r=this._startPos,n=this._lastPos;if(!r||!n||n.equals(i)||!this._box&&i.dist(r)<this._clickTolerance)return;this._lastPos=i,this._box||(this._box=ri("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",e));const o=Math.min(r.x,i.x),a=Math.max(r.x,i.x),s=Math.min(r.y,i.y),l=Math.max(r.y,i.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${o}px,${s}px)`,this._box.style.width=a-o+"px",this._box.style.height=l-s+"px")})}mouseupWindow(e,t){if(!this._active)return;const i=this._startPos,r=t;if(i&&0===e.button){if(this.reset(),di(),i.x!==r.x||i.y!==r.y)return this._map.fire(new Or("boxzoomend",{originalEvent:e})),{cameraAnimation:e=>e.fitScreenCoordinates(i,r,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",e)}}keydown(e){this._active&&27===e.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",e))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),ui(),delete this._startPos,delete this._lastPos}_fireEvent(e,t){return this._map.fire(new Or(e,{originalEvent:t}))}}function LL(e,t){const i={};for(let r=0;r<e.length;r++)i[e[r].identifier]=t[r];return i}class FL{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(e,t,i){(this.centroid||i.length>this.numTouches)&&(this.aborted=!0),this.aborted||(0===this.startTime&&(this.startTime=e.timeStamp),i.length===this.numTouches&&(this.centroid=function(e){const t=new ke(0,0);for(const i of e)t._add(i);return t.div(e.length)}(t),this.touches=LL(i,t)))}touchmove(e,t,i){if(this.aborted||!this.centroid)return;const r=LL(i,t);for(const n in this.touches){const e=r[n];(!e||e.dist(this.touches[n])>30)&&(this.aborted=!0)}}touchend(e,t,i){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){const e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}}class OL{constructor(e){this.singleTap=new FL(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(e,t,i){this.singleTap.touchstart(e,t,i)}touchmove(e,t,i){this.singleTap.touchmove(e,t,i)}touchend(e,t,i){const r=this.singleTap.touchend(e,t,i);if(r){const t=e.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(r)<30;if(t&&i||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}}class BL{constructor(){this._zoomIn=new OL({numTouches:1,numTaps:2}),this._zoomOut=new OL({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,i){this._zoomIn.touchstart(e,t,i),this._zoomOut.touchstart(e,t,i)}touchmove(e,t,i){this._zoomIn.touchmove(e,t,i),this._zoomOut.touchmove(e,t,i)}touchend(e,t,i){const r=this._zoomIn.touchend(e,t,i),n=this._zoomOut.touchend(e,t,i);return r?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:t.getZoom()+1,around:t.unproject(r)},{originalEvent:e})}):n?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:t.getZoom()-1,around:t.unproject(n)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const kL=0,VL=2,NL={[kL]:1,[VL]:2},UL={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class jL{constructor(e){this.reset(),this._clickTolerance=e.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(e,t){return!1}_move(e,t){return{}}mousedown(e,t){if(this._lastPoint)return;const i=mi(e);this._correctButton(e,i)&&(this._lastPoint=t,this._eventButton=i)}mousemoveWindow(e,t){const i=this._lastPoint;if(i)if(e.preventDefault(),null!=this._eventButton&&function(e,t){const i=NL[t];return void 0===e.buttons||(e.buttons&i)!==i}(e,this._eventButton))this.reset();else if(this._moved||!(t.dist(i)<this._clickTolerance))return this._moved=!0,this._lastPoint=t,this._move(i,t)}mouseupWindow(e){this._lastPoint&&mi(e)===this._eventButton&&(this._moved&&di(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class GL extends jL{mousedown(e,t){super.mousedown(e,t),this._lastPoint&&(this._active=!0)}_correctButton(e,t){return 0===t&&!e.ctrlKey}_move(e,t){return{around:t,panDelta:t.sub(e)}}}class HL extends jL{constructor(e){super(e),this._pitchRotateKey=e.pitchRotateKey?UL[e.pitchRotateKey]:void 0}_correctButton(e,t){return this._pitchRotateKey?0===t&&e[this._pitchRotateKey]:0===t&&e.ctrlKey||2===t}_move(e,t){const i=.8*(t.x-e.x);if(i)return this._active=!0,{bearingDelta:i}}contextmenu(e){this._pitchRotateKey||e.preventDefault()}}class $L extends jL{constructor(e){super(e),this._pitchRotateKey=e.pitchRotateKey?UL[e.pitchRotateKey]:void 0}_correctButton(e,t){return this._pitchRotateKey?0===t&&e[this._pitchRotateKey]:0===t&&e.ctrlKey||2===t}_move(e,t){const i=-.5*(t.y-e.y);if(i)return this._active=!0,{pitchDelta:i}}contextmenu(e){this._pitchRotateKey||e.preventDefault()}}class WL{constructor(e,t){this._map=e,this._el=e.getCanvasContainer(),this._minTouches=1,this._clickTolerance=t.clickTolerance||1,this.reset(),bt(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new ke(0,0)}touchstart(e,t,i){return this._calculateTransform(e,t,i)}touchmove(e,t,i){if(this._active&&!(i.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(1===i.length&&!Lt())return void this._showTouchPanBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return e.cancelable&&e.preventDefault(),this._calculateTransform(e,t,i)}}touchend(e,t,i){this._calculateTransform(e,t,i),this._active&&i.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,t,i){i.length>0&&(this._active=!0);const r=LL(i,t),n=new ke(0,0),o=new ke(0,0);let a=0;for(const l in r){const e=r[l],t=this._touches[l];t&&(n._add(e),o._add(e.sub(t)),a++,r[l]=e)}if(this._touches=r,a<this._minTouches||!o.mag())return;const s=o.div(a);return this._sum._add(s),this._sum.mag()<this._clickTolerance?void 0:{around:n.div(a),panDelta:s}}enable(){this._enabled=!0,this._map._cooperativeGestures&&(this._addTouchPanBlocker(),this._el.classList.add("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page"))}disable(){this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove(),this._el.classList.remove("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page")),this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}_addTouchPanBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=ri("div","mapboxgl-touch-pan-blocker",this._map._container),this._alertContainer.textContent=this._map._getUIString("TouchPanBlocker.Message"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showTouchPanBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")},500)}}class qL{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(e){}_move(e,t,i){return{}}touchstart(e,t,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,i){const r=this._firstTwoTouches;if(!r)return;e.preventDefault();const[n,o]=r,a=ZL(i,t,n),s=ZL(i,t,o);if(!a||!s)return;const l=this._aroundCenter?null:a.add(s).div(2);return this._move([a,s],l,e)}touchend(e,t,i){if(!this._firstTwoTouches)return;const[r,n]=this._firstTwoTouches,o=ZL(i,t,r),a=ZL(i,t,n);o&&a||(this._active&&di(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function ZL(e,t,i){for(let r=0;r<e.length;r++)if(e[r].identifier===i)return t[r]}function XL(e,t){return Math.log2(e/t)}class YL extends qL{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,t){const i=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(XL(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:XL(this._distance,i),pinchAround:t}}}function KL(e,t){return 180*e.angleWith(t)/Math.PI}class JL extends qL{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,t){const i=this._vector;if(this._vector=e[0].sub(e[1]),i&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:KL(this._vector,i),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const t=25/(Math.PI*this._minDiameter)*360,i=this._startVector;if(!i)return!1;const r=KL(e,i);return Math.abs(r)<t}}function QL(e){return Math.abs(e.y)>Math.abs(e.x)}class eF extends qL{constructor(e){super(),this._map=e}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(e){this._lastPoints=e,QL(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,t,i){const r=this._lastPoints;if(!r)return;const n=e[0].sub(r[0]),o=e[1].sub(r[1]);return this._map._cooperativeGestures&&!Lt()&&i.touches.length<3||(this._valid=this.gestureBeginsVertically(n,o,i.timeStamp),!this._valid)?void 0:(this._lastPoints=e,this._active=!0,{pitchDelta:(n.y+o.y)/2*-.5})}gestureBeginsVertically(e,t,i){if(void 0!==this._valid)return this._valid;const r=e.mag()>=2,n=t.mag()>=2;if(!r&&!n)return;if(!r||!n)return this._firstMove??=i,i-this._firstMove<100&&void 0;const o=e.y>0==t.y>0;return QL(e)&&QL(t)&&o}}const tF={panStep:100,bearingStep:15,pitchStep:10};class iF{constructor(){const e=tF;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._bearingDisabled=!1,this._pitchDisabled=!1,this._panDisabled=!1,this._zoomDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;if(!this.isEnabled())return;let t=0,i=0,r=0,n=0,o=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?i=-1:(e.preventDefault(),n=-1);break;case 39:e.shiftKey?i=1:(e.preventDefault(),n=1);break;case 38:e.shiftKey?r=1:(e.preventDefault(),o=-1);break;case 40:e.shiftKey?r=-1:(e.preventDefault(),o=1);break;default:return}return this._bearingDisabled&&(i=0),this._pitchDisabled&&(r=0),this._panDisabled&&(n=0,o=0),this._zoomDisabled&&(t=0),{cameraAnimation:a=>{const s=a.getZoom();a.easeTo({duration:300,easeId:"keyboardHandler",easing:rF,zoom:t?Math.round(s)+t*(e.shiftKey?2:1):s,bearing:a.getBearing()+i*this._bearingStep,pitch:a.getPitch()+r*this._pitchStep,offset:[-n*this._panStep,-o*this._panStep],center:a.getCenter()},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled&&!(this._bearingDisabled&&this._pitchDisabled&&this._panDisabled&&this._zoomDisabled)}isActive(){return this._active}disableRotation(){this._pitchDisabled=!0,this._bearingDisabled=!0}enableRotation(){this._pitchDisabled=!1,this._bearingDisabled=!1}isRotationEnabled(){return!this._pitchDisabled&&!this._bearingDisabled}disablePan(){this._panDisabled=!0}enablePan(){this._panDisabled=!1}isPanEnabled(){return!this._panDisabled}disableZoom(){this._zoomDisabled=!0}enableZoom(){this._zoomDisabled=!1}isZoomEnabled(){return!this._zoomDisabled}disablePitch(){this._pitchDisabled=!0}enablePitch(){this._pitchDisabled=!1}isPitchEnabled(){return!this._pitchDisabled}disableBearing(){this._bearingDisabled=!0}enableBearing(){this._bearingDisabled=!1}isBearingEnabled(){return!this._bearingDisabled}}function rF(e){return e*(2-e)}const nF=4.000244140625,oF=1/450,aF=/(Mac|iPad)/i;class sF{constructor(e,t){this._map=e,this._el=e.getCanvasContainer(),this._handler=t,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=oF,bt(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around,this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(e){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(e.ctrlKey||e.metaKey||this.isZooming()||Lt()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let t=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const i=ei.now(),r=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,0!==t&&t%nF===0?this._type="wheel":0!==t&&Math.abs(t)<4?this._type="trackpad":r>400?(this._type=null,this._lastValue=t,this._timeout=window.setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(r*t)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,t+=this._lastValue)),e.shiftKey&&t&&(t/=4),this._type&&(this._lastWheelEvent=e,this._delta-=t,this._active||this._start(e)),e.preventDefault()}_onTimeout(e){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const t=pi(this._el,e);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:t,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRe
vendor: 11,779 bytes, line 2
2nderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const e=this._map.transform;"wheel"===this._type&&e.projection.wrap&&(e._center.lng>=180||e._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const t=()=>e._terrainEnabled()&&this._aroundCoord?e.computeZoomRelativeTo(this._aroundCoord):e.zoom;if(0!==this._delta){const i="wheel"===this._type&&Math.abs(this._delta)>nF?this._wheelZoomRate:this._defaultZoomRate;let r=2/(1+Math.exp(-Math.abs(this._delta*i)));this._delta<0&&0!==r&&(r=1/r);const n=t(),o=Math.pow(2,n),a="number"==typeof this._targetZoom?e.zoomScale(this._targetZoom):o;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(a*r))),"wheel"===this._type&&(this._startZoom=n,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const i="number"==typeof this._targetZoom?this._targetZoom:t(),r=this._startZoom,n=this._easing;let o,a=!1;if("wheel"===this._type&&r&&n){const e=Math.min((ei.now()-this._lastWheelEventTime)/200,1);o=Wr(r,i,n(e)),e<1?this._frameId||(this._frameId=!0):a=!0}else o=i,a=!0;this._active=!0,a&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let s=o-t();return s*this._lastDelta<0&&(s=0),{noInertia:!0,needsRenderFrame:!a,zoomDelta:s,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let t=ut;if(this._prevEase){const e=this._prevEase,i=(ei.now()-e.start)/e.duration,r=e.easing(i+.01)-e.easing(i),n=.27/Math.sqrt(r*r+1e-4)*.01;t=Be(n,Math.sqrt(.0729-n*n),.25,1)}return this._prevEase={start:ei.now(),duration:e,easing:t},t}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=ri("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=aF.test(navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.removeAttribute("role")},200)}}class lF{constructor(e,t){this._clickZoom=e,this._tapZoom=t}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class cF{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(e,t){return e.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:i.getZoom()+(e.shiftKey?-1:1),around:i.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class uF{constructor(){this._tap=new OL({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(e,t,i){this._swipePoint||(this._tapTime&&e.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?i.length>0&&(this._swipePoint=t[0],this._swipeTouch=i[0].identifier):this._tap.touchstart(e,t,i))}touchmove(e,t,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const r=t[0],n=r.y-this._swipePoint.y;return this._swipePoint=r,e.preventDefault(),this._active=!0,{zoomDelta:n/128}}}else this._tap.touchmove(e,t,i)}touchend(e,t,i){this._tapTime?this._swipePoint&&0===i.length&&this.reset():this._tap.touchend(e,t,i)&&(this._tapTime=e.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class hF{constructor(e,t,i){this._el=e,this._mousePan=t,this._touchPan=i}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class dF{constructor(e,t,i){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=t,this._mousePitch=i,this._pitchDisabled=!1,this._rotationDisabled=!1}enable(){this._rotationDisabled||this._mouseRotate.enable(),this._pitchWithRotate&&!this._pitchDisabled&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._pitchWithRotate?!this._rotationDisabled&&this._mouseRotate.isEnabled()||!this._pitchDisabled&&this._mousePitch.isEnabled():!this._rotationDisabled&&this._mouseRotate.isEnabled()}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}disablePitch(){this._pitchDisabled=!0,this._mousePitch.disable()}enablePitch(){this._pitchDisabled=!1,this._pitchWithRotate&&this._mousePitch.enable()}isPitchEnabled(){return!this._pitchDisabled&&this._mousePitch.isEnabled()}disableRotation(){this._rotationDisabled=!0,this._mouseRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._mouseRotate.enable()}isRotationEnabled(){return!this._rotationDisabled&&this._mouseRotate.isEnabled()}}class pF{constructor(e,t,i,r){this._el=e,this._touchZoom=t,this._touchRotate=i,this._tapDragZoom=r,this._rotationDisabled=!1,this._tapDragZoomDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoomDisabled||this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()||!this._rotationDisabled&&this._touchRotate.isEnabled()||!this._tapDragZoomDisabled&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}isRotationEnabled(){return!this._rotationDisabled}disableTapDragZoom(){this._tapDragZoomDisabled=!0,this._tapDragZoom.disable()}enableTapDragZoom(){this._tapDragZoomDisabled=!1,this._touchZoom.isEnabled()&&this._tapDragZoom.enable()}isTapDragZoomEnabled(){return!this._tapDragZoomDisabled}}const fF=e=>e.zoom||e.drag||e.pitch||e.rotate;class mF extends Or{}class _F{constructor(){this.constants=[1,1,.01],this.radius=0}setup(e,t){const i=se([],t,e);this.radius=k(i[2]<0?ce([],i,this.constants):[i[0],i[1],0])}projectRay(e){ce(e,e,this.constants),J(e,e),le(e,e,this.constants);const t=W([],e,this.radius);if(t[2]>0){const e=W([],[0,0,1],Q(t,[0,0,1])),i=W([],J([],[t[0],t[1],0]),this.radius),r=U([],t,W([],se([],U([],i,e),t),2));t[0]=r[0],t[1]=r[1]}return t}}function gF(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta}class yF{constructor(e,t){this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new IL(e),this._bearingSnap=t.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new _F,this._dragOrigin=null,this._mouseBeingPressed=!1,this._activeTouchCount=0,this._eventsInProgress={},this._addDefaultHandlers(t),bt(["handleEvent","handleWindowEvent"],this);const i=this._el;this._listeners=[[i,"touchstart",{passive:!0}],[i,"touchmove",{passive:!1}],[i,"touchend",void 0],[i,"touchcancel",void 0],[i,"mousedown",void 0],[i,"mousemove",void 0],[i,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[i,"mouseover",void 0],[i,"mouseout",void 0],[i,"dblclick",void 0],[i,"click",void 0],[i,"keydown",{capture:!1}],[i,"keyup",void 0],[i,"wheel",{passive:!1}],[i,"contextmenu",void 0],[window,"blur",void 0]];for(const[r,n,o]of this._listeners){const e=r===document?this.handleWindowEvent:this.handleEvent;r.addEventListener(n,e,o)}}destroy(){for(const[e,t,i]of this._listeners){const r=e===document?this.handleWindowEvent:this.handleEvent;e.removeEventListener(t,r,i)}}_addDefaultHandlers(e){const t=this._map,i=t.getCanvasContainer();this._add("mapEvent",new CL(t,e));const r=t.boxZoom=new zL(t,e);this._add("boxZoom",r);const n=new BL,o=new cF;t.doubleClickZoom=new lF(o,n),this._add("tapZoom",n),this._add("clickZoom",o);const a=new uF;this._add("tapDragZoom",a);const s=t.touchPitch=new eF(t);this._add("touchPitch",s);const l=new HL(e),c=new $L(e);t.dragRotate=new dF(e,l,c),this._add("mouseRotate",l,["mousePitch"]),this._add("mousePitch",c,["mouseRotate"]);const u=new GL(e),h=new WL(t,e);t.dragPan=new hF(i,u,h),this._add("mousePan",u),this._add("touchPan",h,["touchZoom","touchRotate"]);const d=new JL,p=new YL;t.touchZoomRotate=new pF(i,p,d,a),this._add("touchRotate",d,["touchPan","touchZoom"]),this._add("touchZoom",p,["touchPan","touchRotate"]),this._add("blockableMapEvent",new RL(t));const f=t.scrollZoom=new sF(t,this);this._add("scrollZoom",f,["mousePan"]);const m=t.keyboard=new iF;this._add("keyboard",m);for(const _ of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])e.interactive&&e[_]&&t[_].enable(e[_])}_add(e,t,i){this._handlers.push({handlerName:e,handler:t,allowed:i}),this._handlersById[e]=t}stop(e="never"){if(!this._updatingCamera&&!("always"===e||"ifPointerDown"===e&&this._isPointerDown())){for(const{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},!1),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!fF(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(e,t,i){for(const r in e)if(!(r===i||t&&t.includes(r)))return!0;return!1}handleWindowEvent(e){this.handleEvent(e,`${e.type}Window`)}_getMapTouches(e){const t=[];for(const i of e)this._el.contains(i.target)&&t.push(i);return t}_updatePointerLiveness(e){switch(e.type){case"mousedown":this._mouseBeingPressed=!0;break;case"mousemove":0===e.buttons&&(this._mouseBeingPressed=!1);break;case"mouseup":this._mouseBeingPressed=!1;break;case"touchstart":case"touchmove":case"touchend":case"touchcancel":this._activeTouchCount=e.touches?e.touches.length:0;break;case"blur":this._mouseBeingPressed=!1,this._activeTouchCount=0}}_isPointerDown(){return this._mouseBeingPressed||this._activeTouchCount>0}handleEvent(e,t){this._updatePointerLiveness(e),this._updatingCamera=!0;const i="renderFrame"===e.type,r=i?void 0:e,n={needsRenderFrame:!1},o={},a={},s=e.touches?this._getMapTouches(e.touches):void 0,l=s?fi(this._el,s):i?void 0:pi(this._el,e);for(const{handlerName:h,handler:d,allowed:p}of this._handlers){if(!d.isEnabled())continue;let i;this._blockedByActive(a,p,h)?d.reset():d[t||e.type]&&(i=d[t||e.type](e,l,s),this.mergeHandlerResult(n,o,i,h,r),i&&i.needsRenderFrame&&this._triggerRe
vendor: 4,158 bytes, line 2
2nderFrame()),(i||d.isActive())&&(a[h]=d)}const c={};for(const h in this._previousActiveHandlers)a[h]||(c[h]=r);this._previousActiveHandlers=a,(Object.keys(c).length||gF(n))&&(this._changes.push([n,o,c]),this._triggerRenderFrame()),(Object.keys(a).length||gF(n))&&this._map._stop({keepGesture:"always"}),this._updatingCamera=!1;const{cameraAnimation:u}=n;u&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],u(this._map))}mergeHandlerResult(e,t,i,r,n){if(!i)return;Object.assign(e,i);const o={handlerName:r,originalEvent:i.originalEvent||n};void 0!==i.zoomDelta&&(t.zoom=o),void 0!==i.panDelta&&(t.drag=o),void 0!==i.pitchDelta&&(t.pitch=o),void 0!==i.bearingDelta&&(t.rotate=o)}_applyChanges(){const e={},t={},i={};for(const[r,n,o]of this._changes)r.panDelta&&(e.panDelta=(e.panDelta||new ke(0,0))._add(r.panDelta)),r.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+r.zoomDelta),r.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+r.bearingDelta),r.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+r.pitchDelta),void 0!==r.around&&(e.around=r.around),void 0!==r.aroundCoord&&(e.aroundCoord=r.aroundCoord),void 0!==r.pinchAround&&(e.pinchAround=r.pinchAround),r.noInertia&&(e.noInertia=r.noInertia),Object.assign(t,n),Object.assign(i,o);this._updateMapTransform(e,t,i),this._changes=[]}_updateMapTransform(e,t,i){const r=this._map,n=r.transform,o=e=>[e.x,e.y,e.z];if((()=>{const e=this._eventsInProgress.drag;return e&&!this._handlersById[e.handlerName].isActive()})()&&!gF(e)){const e=n.zoom;n.cameraElevationReference="sea",null!=this._originalZoom&&n._orthographicProjectionAtLowPitch&&"globe"!==n.projection.name&&0===n.pitch?(n.cameraElevationReference="ground",n.zoom=this._originalZoom):(n.recenterOnTerrain(),n.cameraElevationReference="ground"),e!==n.zoom&&this._map._update(!0)}if(n._isCameraConstrained&&r._stop({keepGesture:"always"}),!gF(e))return void this._fireEvents(t,i,!0);let{panDelta:a,zoomDelta:s,bearingDelta:l,pitchDelta:c,around:u,aroundCoord:h,pinchAround:d}=e;n._isCameraConstrained&&(s>0&&(s=0),n._isCameraConstrained=!1),void 0!==d&&(u=d),(s||(e=>t[e]&&!this._eventsInProgress[e])("drag"))&&u&&(this._dragOrigin=o(n.pointCoordinate3D(u)),this._originalZoom=n.zoom,this._trackingEllipsoid.setup(n._camera.position,this._dragOrigin)),n.cameraElevationReference="sea",r._stop({keepGesture:"always"}),u=u||r.transform.centerPoint,l&&(n.bearing+=l),c&&(n.pitch+=c),n._updateCameraState();const p=[0,0,0];if(a)if("mercator"===n.projection.name){const e=this._trackingEllipsoid.projectRay(n.screenPointToMercatorRay(u).dir),t=this._trackingEllipsoid.projectRay(n.screenPointToMercatorRay(u.sub(a)).dir);p[0]=t[0]-e[0],p[1]=t[1]-e[1]}else{const e=n.pointCoordinate(u);if("globe"===n.projection.name){a=a.rotate(-n.angle);const t=n._pixelsPerMercatorPixel/n.worldSize;p[0]=-a.x*Wc(Xn(e.y))*t,p[1]=-a.y*Wc(n.center.lat)*t}else{const t=n.pointCoordinate(u.sub(a));e&&t&&(p[0]=t.x-e.x,p[1]=t.y-e.y)}}const f=n.zoom,m=[0,0,0];if(s){const e=o(h||n.pointCoordinate3D(u)),t={dir:J([],se([],e,n._camera.position))};if(t.dir[2]<0){const i=n.zoomDeltaToMovement(e,s);W(m,t.dir,i)}}const _=U(p,p,m);n._translateCameraConstrained(_),s&&Math.abs(n.zoom-f)>1e-4&&n.recenterOnTerrain(),n.cameraElevationReference="ground",this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,i,!0)}_fireEvents(e,t,i){const r=fF(this._eventsInProgress),n=fF(e),o={};for(const c in e){const{originalEvent:t}=e[c];this._eventsInProgress[c]||(o[`${c}start`]=t),this._eventsInProgress[c]=e[c]}!r&&n&&this._fireEvent("movestart",n.originalEvent);for(const c in o)this._fireEvent(c,o[c]);n&&this._fireEvent("move",n.originalEvent);for(const c in e){const{originalEvent:t}=e[c];this._fireEvent(c,t)}const a={};let s;for(const c in this._eventsInProgress){const{handlerName:e,originalEvent:i}=this._eventsInProgress[c];this._handlersById[e].isActive()||(delete this._eventsInProgress[c],s=t[e]||i,a[`${c}end`]=s)}for(const c in a)this._fireEvent(c,a[c]);const l=fF(this._eventsInProgress);if(i&&(r||n)&&!l){this._updatingCamera=!0;const e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),t=e=>0!==e&&-this._bearingSnap<e&&e<this._bearingSnap;
vendor: 12,703 bytes, line 2
2e?(t(e.bearing||this._map.getBearing())&&(e.bearing=0),this._map.easeTo(e,{originalEvent:s})):(this._map.fire(new Or("moveend",{originalEvent:s})),t(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(e,t){this._map.fire(new Or(e,t?{originalEvent:t}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{this._frameId=void 0,this.handleEvent(new mF("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}const xF="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class vF extends Nr{constructor(e,t){super(),this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=t.bearingSnap,this._respectPrefersReducedMotion=!1!==t.respectPrefersReducedMotion,bt(["_renderFrameCallback"],this)}getCenter(){return new kc(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}panBy(e,t,i){return e=ke.convert(e).mult(-1),this.panTo(this.transform.center,{offset:e,...t},i)}panTo(e,t,i){return this.easeTo({center:e,...t},i)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(e,t,i){return this.easeTo({zoom:e,...t},i)}zoomIn(e,t){return this.zoomTo(this.getZoom()+1,e,t),this}zoomOut(e,t){return this.zoomTo(this.getZoom()-1,e,t),this}getBearing(){return this.transform.bearing}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(e,t,i){return this.easeTo({bearing:e,...t},i)}resetNorth(e,t){return this.rotateTo(0,{duration:1e3,...e},t),this}resetNorthPitch(e,t){return this.easeTo({bearing:0,pitch:0,duration:1e3,...e},t),this}snapToNorth(e,t){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,t):this}getPitch(){return this.transform.pitch}setPitch(e,t){return this.jumpTo({pitch:e},t),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,t){return this.jumpTo({fov:e},t)}getHorizontalFieldOfView(){return this.transform.horizontalFov}cameraForBounds(e,t){e=Vc.convert(e);const i=t&&t.bearing||0,r=t&&t.pitch||0,n=e.getNorthWest(),o=e.getSouthEast();return this._cameraForBounds(this.transform,n,o,i,r,t)}_extendPadding(e){const t={top:0,right:0,bottom:0,left:0};return null==e?{...t,...this.transform.padding}:"number"==typeof e?{top:e,bottom:e,right:e,left:e}:{...t,...e}}_extendCameraOptions(e){return(e={offset:[0,0],maxZoom:this.transform.maxZoom,...e}).padding=this._extendPadding(e.padding),e}_minimumAABBFrustumDistance(e,t){const i=t.max[0]-t.min[0],r=t.max[1]-t.min[1];return i/r>e.aspect?i/(2*Math.tan(.5*e.fovX)*e.aspect):r/(2*Math.tan(.5*e.fovY)*e.aspect)}_cameraForBoundsOnGlobe(e,t,i,r,n,o){const a=e.clone(),s=this._extendCameraOptions(o);a.bearing=r,a.pitch=n;const l=kc.convert(t),c=kc.convert(i),u=.5*(l.lat+c.lat),h=.5*(l.lng+c.lng),d=Fc(u,h),p=J([],d),f=J([],ee([],p,[0,1,0])),m=ee([],f,p),_=[f[0],f[1],f[2],0,m[0],m[1],m[2],0,p[0],p[1],p[2],0,0,0,0,1],g=[d,Fc(l.lat,l.lng),Fc(c.lat,l.lng),Fc(c.lat,c.lng),Fc(l.lat,c.lng),Fc(u,l.lng),Fc(u,c.lng),Fc(l.lat,h),Fc(c.lat,h)];let v=Wp.fromPoints(g.map(e=>[Q(f,e),Q(m,e),Q(p,e)]));const b=ie([],v.center,_);0===Y(b)&&N(b,0,0,1),J(b,b),W(b,b,Mc),a.center=function([e,t,i]){const r=Math.hypot(e,t,i),n=Math.atan2(e,i),o=.5*Math.PI-Math.acos(-t/r);return new kc(ot(n),ot(o))}(b);const w=a.getWorldToCameraMatrix(),E=y(new Float64Array(16),w);v=Wp.applyTransform(v,x([],w,_));const A=this._extendAABB(v,a,s,r);if(!A)return void Tt("Map cannot fit within canvas with the given bounds, padding, and/or offset.");v=A,ie(b,b,w);const I=.5*(v.max[2]-v.min[2]),S=this._minimumAABBFrustumDistance(a,v),T=W([],[0,0,1],I),D=U(T,b,T),M=S+(0===a.pitch?0:Z(b,D)),P=a.globeCenterInViewSpace,C=se([],b,[P[0],P[1],P[2]]);J(C,C),W(C,C,M);const R=U([],b,C);ie(R,R,E);const z=Oc/Mc,L=k(R),F=Uc(Math.max(L*z-Oc,Number.EPSILON),0),O=Math.min(a.zoomFromMercatorZAdjusted(F),s.maxZoom);return O>5.5?(a.setProjection({name:"mercator"}),a.zoom=O,this._cameraForBounds(a,t,i,r,n,o)):{center:a.center,zoom:O,bearing:r,pitch:n}}_extendAABB(e,t,i,r){const n=.5*((i.padding.left||0)+(i.padding.right||0)),o=.5*((i.padding.top||0)+(i.padding.bottom||0)),a=o,s=n,l=n,c=o,u=t.width-(s+l),h=t.height-(a+c),d=se([],e.max,e.min),p=Math.min(u/d[0],h/d[1]),f=Math.min(t.scaleZoom(t.scale*p),i.maxZoom);if(isNaN(f))return null;const m=t.scale/t.zoomScale(f),_=new Wp([e.min[0]-s*m,e.min[1]-c*m,e.min[2]],[e.max[0]+l*m,e.max[1]+a*m,e.max[2]]),g=("number"==typeof i.offset.x&&"number"==typeof i.offset.y?new ke(i.offset.x,i.offset.y):ke.convert(i.offset)).rotate(-nt(r));return _.center[0]-=g.x*m,_.center[1]+=g.y*m,_}queryTerrainElevation(e,t){const i=this.transform.elevation;return i?(t={exaggerated:!0,...t},i.getAtPoint(Zc.fromLngLat(e),null,t.exaggerated)):null}_cameraForBounds(e,t,i,r,n,o){if("globe"===e.projection.name)return this._cameraForBoundsOnGlobe(e,t,i,r,n,o);const a=e.clone(),s=this._extendCameraOptions(o);a.bearing=r,a.pitch=n;const l=kc.convert(t),c=kc.convert(i),u=new kc(l.lng,c.lat),h=new kc(c.lng,l.lat),d=a.project(l),p=a.project(c),f=this.queryTerrainElevation(l),m=this.queryTerrainElevation(c),_=this.queryTerrainElevation(u),g=this.queryTerrainElevation(h),x=[[d.x,d.y,Math.min(f||0,m||0,_||0,g||0)],[p.x,p.y,Math.max(f||0,m||0,_||0,g||0)]];let v=Wp.fromPoints(x);const b=a.getWorldToCameraMatrix(),w=y(new Float64Array(16),b);v=Wp.applyTransform(v,b);const E=this._extendAABB(v,a,s,r);if(!E)return void Tt("Map cannot fit within canvas with the given bounds, padding, and/or offset.");v=E;const A=.5*se([],v.max,v.min)[2],I=this._minimumAABBFrustumDistance(a,v),S=[0,0,1,0];me(S,S,b),fe(S,S);const T=W([],S,I+A),D=U([],v.center,T);ie(v.center,v.center,w),ie(D,D,w);const M=a.unproject(new ke(v.center[0],v.center[1])),P=xy(a.projection,M),C=Math.pow(2,P),R=Math.min(a._zoomFromMercatorZ(D[2]*a.pixelsPerMeter*C/a.worldSize),s.maxZoom);return a.mercatorFromTransition&&R<5.5?(a.setProjection({name:"globe"}),a.zoom=R,this._cameraForBounds(a,t,i,r,n,o)):{center:M,zoom:R,bearing:r,pitch:n}}fitBounds(e,t,i){const r=this.cameraForBounds(e,t);return this._fitInternal(r,t,i)}fitScreenCoordinates(e,t,i,r,n){const o=ke.convert(e),a=ke.convert(t),s=new ke(Math.min(o.x,a.x),Math.min(o.y,a.y)),l=new ke(Math.max(o.x,a.x),Math.max(o.y,a.y));if("mercator"===this.transform.projection.name&&this.transform.anyCornerOffEdge(o,a))return this;const c=this.transform.pointLocation3D(s),u=this.transform.pointLocation3D(l),h=this.transform.pointLocation3D(new ke(s.x,l.y)),d=this.transform.pointLocation3D(new ke(l.x,s.y)),p=[Math.min(c.lng,u.lng,h.lng,d.lng),Math.min(c.lat,u.lat,h.lat,d.lat)],f=[Math.max(c.lng,u.lng,h.lng,d.lng),Math.max(c.lat,u.lat,h.lat,d.lat)],m=r&&r.pitch?r.pitch:this.getPitch(),_=this._cameraForBounds(this.transform,p,f,i,m,r);return this._fitInternal(_,r,n)}_fitInternal(e,t,i){return e?(t=Object.assign(e,t)).linear?this.easeTo(t,i):this.flyTo(t,i):this}jumpTo(e,t){this._stop({keepGesture:"ifPointerDown"});const i=e.preloadOnly?this.transform.clone():this.transform;let r=!1,n=!1,o=!1;"zoom"in e&&i.zoom!==+e.zoom&&(r=!0,i.zoom=+e.zoom),void 0!==e.center&&(i.center=kc.convert(e.center)),"bearing"in e&&i.bearing!==+e.bearing&&(n=!0,i.bearing=+e.bearing),"pitch"in e&&i.pitch!==+e.pitch&&(o=!0,i.pitch=+e.pitch),"fov"in e&&(i.fov=+e.fov);const a="number"==typeof e.padding?this._extendPadding(e.padding):e.padding;if(null!=e.padding&&!i.isPaddingEqual(a))if(!1===e.retainPadding){const e=i.clone();e.padding=a,i.setLocationAtPoint(i.center,e.centerPoint)}else i.padding=a;return e.preloadOnly?(this._preloadTiles(i),this):(this.fire(new Or("movestart",t)).fire(new Or("move",t)),r&&this.fire(new Or("zoomstart",t)).fire(new Or("zoom",t)).fire(new Or("zoomend",t)),n&&this.fire(new Or("rotatestart",t)).fire(new Or("rotate",t)).fire(new Or("rotateend",t)),o&&this.fire(new Or("pitchstart",t)).fire(new Or("pitch",t)).fire(new Or("pitchend",t)),this.fire(new Or("moveend",t)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||Tt(xF),this.transform.getFreeCameraOptions()}setFreeCameraOptions(e,t){const i=this.transform;if(!i.projection.supportsFreeCamera)return Tt(xF),this;this.stop();const r=i.zoom,n=i.pitch,o=i.bearing;i.setFreeCameraOptions(e);const a=r!==i.zoom,s=n!==i.pitch,l=o!==i.bearing;return this.fire(new Or("movestart",t)).fire(new Or("move",t)),a&&this.fire(new Or("zoomstart",t)).fire(new Or("zoom",t)).fire(new Or("zoomend",t)),l&&this.fire(new Or("rotatestart",t)).fire(new Or("rotate",t)).fire(new Or("rotateend",t)),s&&this.fire(new Or("pitchstart",t)).fire(new Or("pitch",t)).fire(new Or("pitchend",t)),this.fire(new Or("moveend",t)),this}easeTo(e,t){this._stop({easeId:e.easeId}),(!1===(e={offset:[0,0],duration:500,easing:ut,...e}).animate||this._prefersReducedMotion(e))&&(e.duration=0);const i=this.transform,r=this.getZoom(),n=this.getBearing(),o=this.getPitch(),a=this.getPadding(),s=this.getVerticalFieldOfView(),l="zoom"in e?+e.zoom:r,c="bearing"in e?this._normalizeBearing(e.bearing,n):n,u="pitch"in e?+e.pitch:o,h="fov"in e?+e.fov:s,d=this._extendPadding(e.padding),p=ke.convert(e.offset);let f,m,_;if("globe"===i.projection.name){const t=Zc.fromLngLat(i.center),r=p.rotate(-i.angle);t.x+=r.x/i.worldSize,t.y+=r.y/i.worldSize;const n=t.toLngLat(),o=kc.convert(e.center||n);this._normalizeCenter(o),f=i.centerPoint.add(r),m=new ke(t.x,t.y).mult(i.worldSize),_=new ke(Wn(o.lng),qn(o.lat)).mult(i.worldSize).sub(m)}else{f=i.centerPoint.add(p);const t=i.pointLocation(f),r=kc.convert(e.center||t);this._normalizeCenter(r),m=i.project(t),_=i.project(r).sub(m)}const g=i.zoomScale(l-r);let y,x;e.around&&(y=kc.convert(e.around),x=i.locationPoint(y));const v=this._zooming||l!==r,b=this._rotating||n!==c,w=this._pitching||u!==o,E=h!==s,A=!i.isPaddingEqual(d),I=!1===e.retainPadding?i.clone():i,S=i=>S=>{if(v&&(i.zoom=Wr(r,l,S)),b&&(i.bearing=Wr(n,c,S)),w&&(i.pitch=Wr(o,u,S)),E&&(i.fov=Wr(s,h,S)),A&&(I.interpolatePadding(a,d,S),f=I.centerPoint.add(p)),y)i.setLocationAtPoint(y,x);else{const e=i.zoomScale(i.zoom-r),t=l>r?Math.min(2,g):Math.max(.5,g),n=Math.pow(t,1-S),o=i.unproject(m.add(_.mult(S*n)).mult(e));i.setLocationAtPoint(i.renderWorldCopies?o.wrap():o,f)}return e.preloadOnly||this._fireMoveEvents(t),i};if(e.preloadOnly){const t=this._emulate(S,e.duration,i);return this._preloadTiles(t),this}const T={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=v,this._rotating=b,this._pitching=w,this._padding=A,this._easeId=e.easeId,this._prepareEase(t,e.noMoveStart,T),this._ease(S(i),e=>{"sea"===i.cameraElevationReference&&i.recenterOnTerrain(),this._afterEase(t,e)},e),this}_prepareEase(e,t,i={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&0===this.transform.pitch&&"globe"!==this.transform.projection.name&&(this.transform.cameraElevationReference="ground"),t||i.moving||this.fire(new Or("movestart",e)),this._zooming&&!i.zooming&&this.fire(new Or("zoomstart",e)),this._rotating&&!i.rotating&&this.fire(new Or("rotatestart",e)),this._pitching&&!i.pitching&&this.fire(new Or("pitchstart",e))}_fireMoveEvents(e){this.fire(new Or("move",e)),this._zooming&&this.fire(new Or("zoom",e)),this._rotating&&this.fire(new Or("rotate",e)),this._pitching&&this.fire(new Or("pitch",e))}_afterEase(e,t){if(this._easeId&&t&&this._easeId===t)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const i=this._zooming,r=this._rotating,n=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,i&&this.fire(new Or("zoomend",e)),r&&this.fire(new Or("rotateend",e)),n&&this.fire(new Or("pitchend",e)),this.fire(new Or("moveend",e))}flyTo(e,t){if(this._prefersReducedMotion(e)){const i=mt(e,["center","zoom","bearing","pitch","fov","around","padding","retainPadding"]);return this.jumpTo(i,t)}this.stop(),e={offset:[0,0],speed:1.2,curve:1.42,easing:ut,...e};const i=this.transform,r=this.getZoom(),n=this.getBearing(),o=this.getPitch(),a=this.getPadding(),s=this.getVerticalFieldOfView(),l="zoom"in e?ht(+e.zoom,i.minZoom,i.maxZoom):r,c="bearing"in e?this._normalizeBearing(e.bearing,n):n,u="pitch"in e?+e.pitch:o,h="fov"in e?+e.fov:s,d=h!==s,p=this._extendPadding(e.padding),f=i.zoomScale(l-r),m=ke.convert(e.offset);let _=i.centerPoint.add(m);const g=i.pointLocation(_),y=kc.convert(e.center||g);this._normalizeCenter(y);const x=i.project(g),v=i.project(y).sub(x);let b=e.curve;const w=Math.max(i.width,i.height),E=w/f,A=v.mag();
vendor: 4,486 bytes, line 2
2if("minZoom"in e){const t=ht(Math.min(e.minZoom,r,l),i.minZoom,i.maxZoom),n=w/i.zoomScale(t-r);b=Math.sqrt(n/A*2)}const I=b*b;function S(e){const t=(E*E-w*w+(e?-1:1)*I*I*A*A)/(2*(e?E:w)*I*A);return Math.log(Math.sqrt(t*t+1)-t)}function T(e){return(Math.exp(e)-Math.exp(-e))/2}function D(e){return(Math.exp(e)+Math.exp(-e))/2}const M=S(0);let P=function(e){return D(M)/D(M+b*e)},C=function(e){return w*((D(M)*(T(t=M+b*e)/D(t))-T(M))/I)/A;var t},R=(S(1)-M)/b;if(Math.abs(A)<1e-6||!isFinite(R)){if(Math.abs(w-E)<1e-6)return this.easeTo(e,t);const i=E<w?-1:1;R=Math.abs(Math.log(E/w))/b,C=function(){return 0},P=function(e){return Math.exp(i*b*e)}}e.duration="duration"in e?+e.duration:1e3*R/("screenSpeed"in e?+e.screenSpeed/b:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0);const z=n!==c,L=u!==o,F=!i.isPaddingEqual(p),O=!1===e.retainPadding?i.clone():i,B=i=>f=>{const g=f*R,b=1/P(g);i.zoom=1===f?l:r+i.scaleZoom(b),z&&(i.bearing=Wr(n,c,f)),L&&(i.pitch=Wr(o,u,f)),d&&(i.fov=Wr(s,h,f)),F&&(O.interpolatePadding(a,p,f),_=O.centerPoint.add(m));const w=1===f?y:i.unproject(x.add(v.mult(C(g))).mult(b));return i.setLocationAtPoint(i.renderWorldCopies?w.wrap():w,_),i._updateCameraOnTerrain(),e.preloadOnly||this._fireMoveEvents(t),i};if(e.preloadOnly){const t=this._emulate(B,e.duration,i);return this._preloadTiles(t),this}return this._zooming=!0,this._rotating=z,this._pitching=L,this._padding=F,this._prepareEase(t,!1),this._ease(B(i),()=>this._afterEase(t),e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(e){}_cancelRenderFrame(e){}_stop({easeId:e,keepGesture:t}={}){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const t=this._onEaseEnd;this._onEaseEnd=void 0,t.call(this,e)}const i=this.handlers;return i&&i.stop(t),this}_ease(e,t,i){!1===i.animate||0===i.duration?(e(1),t()):(this._easeStart=ei.now(),this._easeOptions=i,this._onEaseFrame=e,this._onEaseEnd=t,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const e=Math.min((ei.now()-this._easeStart)/this._easeOptions.duration,1),t=this._onEaseFrame;t&&t(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(e,t){e=pt(e,-180,180);const i=Math.abs(e-t);return Math.abs(e-360-t)<i&&(e-=360),Math.abs(e+360-t)<i&&(e+=360),e}_normalizeCenter(e){const t=this.transform;if(t.maxBounds)return;if("globe"!==t.projection.name&&!t.renderWorldCopies)return;const i=e.lng-t.center.lng;e.lng+=i>180?-360:i<-180?360:0}_prefersReducedMotion(e){return this._respectPrefersReducedMotion&&ei.prefersReducedMotion&&!(e&&e.essential)}_emulate(e,t,i){const r=Math.ceil(15*t/1e3),n=[],o=e(i.clone());for(let a=0;a<=r;a++){const e=o(a/r);n.push(e.clone())}return n}_preloadTiles(e,t){}}const bF=/^(https?:|mailto:)/i;class wF{constructor(e={}){this.options=e,bt(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(e){const t=this.options&&this.options.compact,i=e._getUIString("AttributionControl.ToggleAttribution");this._map=e,this._container=ri("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=ri("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",i);const r=ri("span","mapboxgl-ctrl-icon",this._compactButton);return r.setAttribute("aria-hidden","true"),r.setAttribute("title",i),this._innerContainer=ri("div","mapboxgl-ctrl-attrib-inner",this._container),t&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===t&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","fal
2se")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let e=this._editLink;e||(e=this._editLink=this._container.querySelector(".mapbox-improve-map"));const t=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||gi.ACCESS_TOKEN}];if(e){const i=t.reduce((e,i,r)=>(i.value&&(e+=`${i.key}=${i.value}${r<t.length-1?"&":""}`),e),"?");e.href=`${gi.FEEDBACK_URL}/${i}#${xL(this._map,!0)}`,e.rel="noopener nofollow"}}_updateData(e){!e||("source"!==e.dataType||"metadata"!==e.sourceDataType&&"visibility"!==e.sourceDataType)&&"style"!==e.dataType||(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let e=[];if(this._map.style.stylesheet){const e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}const t=this._map.style._mergedSourceCaches;for(const r in t){const i=t[r];if(i.used){const t=i.getSource();t.attribution&&!e.includes(t.attribution)&&e.push(t.attribution)}}e.sort((e,t)=>e.length-t.length),e=e.filter((t,i)=>{for(let r=i+1;r<e.length;r++)if(e[r].includes(t))return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=[...this.options.customAttribution,...e]:e.unshift(this.options.customAttribution));const i=e.map(e=>function(e){const t=(new DOMParser).parseFromString(e,"text/html");return Array.from(t.body.querySelectorAll("*")).reverse().forEach(e=>{const i=e.textContent||"";if("A"!==e.tagName)return void e.replaceWith(...e.childNodes);const r=e.getAttribute("href");if(!r||!bF.test(r))return void e.replaceWith(t.createTextNode(i));const n=t.createElement("a");n.href=r,n.textContent=i,n.rel="noopener nofollow";const o=e.getAttribute("class");o&&(n.className=o),e.replaceWith(n)}),t.body.innerHTML}(e)).join(" | ");i!==this._attribHTML&&(this._attribHTML=i,e.length?(this._innerContainer.innerHTML=i,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class EF{constructor(){bt(["_updateLogo","_updateCompact"],this)}onAdd(e){this._map=e,this._container=ri("div","mapboxgl-ctrl");const t=ri("a","mapboxgl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://www.mapbox.com/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(e){e&&"metadata"!==e.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const e=this._map.style._sourceCaches;if(0===Object.entries(e).length)return!0;for(const t in e){const i=e[t].getSource();if(Object.hasOwn(i,"mapbox_logo")&&!i.mapbox_logo)return!1}return!0}_updateCompact(){const e=this._container.children;if(e.length){const t=e[0];this._map.getCanvasContainer().offsetWidth<250?t.classList.add("mapboxgl-compact"):t.classList.remove("mapboxgl-compact")}}}class AF{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){const t=this._currentlyRunning,i=t?this._queue.concat(t):this._queue;for(const r of i)if(r.id===e)return void(r.cancelled=!0)}run(e=0){const t=this._currentlyRunning=this._queue;this._queue=[];for(const i of t)if(!i.cancelled&&(i.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}class IF{constructor(e){this.jumpTo(e)}getValue(e){if(e<=this._startTime)return this._start;if(e>=this._endTime)return this._end;const t=st((e-this._startTime)/(this._endTime-this._startTime));return this._start*(1-t)+this._end*t}isEasing(e){return e>=this._startTime&&e<=this._endTime}jumpTo(e){this._startTime=-1/0,this._endTime=-1/0,this._start=e,this._end=e}easeTo(e,t,i){this._start=this.getValue(t),this._end=e,this._startTime=t,this._endTime=t+i}}const SF={"AttributionControl.ToggleAttribution":"Toggle attribution","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox homepage","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use \u2318 + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"};class TF extends Or{constructor(e,t,i,r){const{point:n,lngLat:o,originalEvent:a,target:s}=e;super(e.type,{point:n,lngLat:o,originalEvent:a,target:s}),this.preventDefault=()=>{e.preventDefault()},this.id=t,this.interaction=i,this.feature=r}}class DF{constructor(e){this.map=e,this.interactionsByType=new Map,this.delegatedInteractions=new Map,this.typeById=new Map,this.filters=new Map,this.handleType=this.handleType.bind(this),this.handleMove=this.handleMove.bind(this),this.handleOut=this.handleOut.bind(this),this.hoveredFeatures=new Map,this.prevHoveredFeatures=new Map}
vendor: 6,686 bytes, line 2
2add(e,t){if(this.typeById.has(e))throw new Error(`Interaction id "${e}" already exists.`);const i=t.filter;let r=t.type;i&&this.filters.set(e,Tl(i)),"mouseover"===r&&(r="mouseenter"),"mouseout"===r&&(r="mouseleave");const n=this.interactionsByType.get(r)||new Map;"mouseenter"===r||"mouseleave"===r?(0===this.delegatedInteractions.size&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(e,t)):0===n.size&&this.map.on(r,this.handleType),0===n.size&&this.interactionsByType.set(r,n),n.set(e,t),this.typeById.set(e,r)}get(e){const t=this.typeById.get(e);if(!t)return;const i=this.interactionsByType.get(t);return i?i.get(e):void 0}remove(e){const t=this.typeById.get(e);if(!t)return;this.typeById.delete(e),this.filters.delete(e);const i=this.interactionsByType.get(t);i&&(i.delete(e),"mouseenter"===t||"mouseleave"===t?(this.delegatedInteractions.delete(e),0===this.delegatedInteractions.size&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):0===i.size&&this.map.off(t,this.handleType))}queryTargets(e,t){const i=[];for(const[r,n]of t)n.target&&i.push({targetId:r,target:n.target,filter:this.filters.get(r)});return this.map.style.queryRenderedTargets(e,i,this.map.transform)}handleMove(e){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;const t=this.queryTargets(e.point,Array.from(this.delegatedInteractions).reverse());t.length&&(e.type="mouseenter",this.handleType(e,t));const i=new Map;for(const[r,{feature:n}]of this.prevHoveredFeatures)this.hoveredFeatures.has(r)||i.set(n.id,n);i.size&&(e.type="mouseleave",this.handleType(e,Array.from(i.values())))}handleOut(e){const t=Array.from(this.hoveredFeatures.values()).map(({feature:e})=>e);t.length&&(e.type="mouseleave",this.handleType(e,t)),this.hoveredFeatures.clear()}handleType(e,t){const i="mouseenter"===e.type;if(i&&!this.interactionsByType.has(e.type))return void Tt("mouseenter interaction required for mouseleave to work.");const r=Array.from(this.interactionsByType.get(e.type)).reverse(),n=!!t;t=t||this.queryTargets(e.point,r);let o=!1;const a=new Set;for(const s of t){for(const[t,l]of r){if(!l.target)continue;const r=s.variants?s.variants[t]:null;if(r){for(const c of r){if(tR(c,s,a,t))continue;const r=new nw(s,c),u=eR(c,s,t);n&&void 0!==r.id&&(r.state=this.map.getFeatureState(r));const h=i?this.prevHoveredFeatures.get(u):null,d=new TF(e,t,l,r),p=h?h.stop:l.handler(d);if(i&&this.hoveredFeatures.set(u,{feature:s,stop:p}),!1!==p){o=!0;break}}if(o)break}}if(o)break}if(!o)for(const[s,l]of r){const{handler:t,target:i}=l;if(!i&&!1!==t(new TF(e,s,l,null)))break}}}function MF(e,t){if(Array.isArray(e)&&Array.isArray(t)){const i=new Set(e),r=new Set(t);return i.size===r.size&&e.every(e=>r.has(e))}return Ve(e,t)}const PF=/matrix.*\((.+)\)/,CF={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,fontstackCompositing:"client",transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0,scaleFactor:1,emissiveColorPrecision:"approximate"},RF={showCompass:!0,showZoom:!0,visualizePitch:!1};class zF{constructor(e,t,i=!1){this._clickTolerance=10,this.element=t,this.mouseRotate=new HL({clickTolerance:e.dragRotate._mouseRotate._clickTolerance}),this.map=e,i&&(this.mousePitch=new $L({clickTolerance:e.dragRotate._mousePitch._clickTolerance})),bt(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),t.addEventListener("mousedown",this.mousedown),t.addEventListener("touchstart",this.touchstart,{passive:!1}),t.addEventListener("touchmove",this.touchmove),t.addEventListener("touchend",this.touchend),t.addEventListener("touchcancel",this.reset)}down(e,t){this.mouseRotate.mousedown(e,t),this.mousePitch&&this.mousePitch.mousedown(e,t),ci()}move(e,t){const i=this.map,r=this.mouseRotate.mousemoveWindow(e,t),n=r&&r.bearingDelta;if(n&&i.setBearing(i.getBearing()+n),this.mousePitch){const r=this.mousePitch.mousemoveWindow(e,t),n=r&&r.pitchDelta;n&&i.setPitch(i.getPitch()+n)}}off(){const e=this.element;e.removeEventListener("mousedown",this.mousedown),e.removeEventListener("touchstart",this.touchstart),e.removeEventListener("touchmove",this.touchmove),e.removeEventListener("touchend",this.touchend),e.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){ui(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(e){this.down({...e,button:e.button,type:e.type,ctrlKey:!0,preventDefault:()=>e.preventDefault()},pi(this.element,e)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(e){this.move(e,pi(this.element,e))}mouseup(e){this.mouseRotate.mouseupWindow(e),this.mousePitch&&this.mousePitch.mouseupWindow(e),this.offTemp()}touchstart(e){1!==e.targetTouches.length?this.reset():(this._startPos=this._lastPos=fi(this.element,e.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>e.preventDefault()},this._startPos))}touchmove(e){1!==e.targetTouches.length?this.reset():(this._lastPos=fi(this.element,e.targetTouches)[0],this.move({buttons:1,preventDefault:()=>e.preventDefault()},this._lastPos))}touchend(e){0===e.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function LF(e,t,i){if(e=new kc(e.lng,e.lat),t){const r=new kc(e.lng-360,e.lat),n=new kc(e.lng+360,e.lat),o=360*Math.ceil(Math.abs(e.lng-i.center.lng)/360),a=i.locationPoint3D(e).distSqr(t),s=t.x<0||t.y<0||t.x>i.width||t.y>i.height;i.locationPoint3D(r).distSqr(t)<a&&(s||Math.abs(r.lng-i.center.lng)<o)?e=r:i.locationPoint3D(n).distSqr(t)<a&&(s||Math.abs(n.lng-i.center.lng)<o)&&(e=n)}for(;Math.abs(e.lng-i.center.lng)>180;){const t=i.locationPoint3D(e);if(t.x>=0&&t.y>=0&&t.x<=i.width&&t.y<=i.height)break;e.lng>i.center.lng?e.lng-=360:e.lng+=360}return e}
vendor: 8,164 bytes, line 2
2const FF={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"},OF=/\s+/,BF={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class kF extends Nr{constructor(e,t){super(),(e instanceof HTMLElement||t)&&(e={element:e,...t}),bt(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:i="center",color:r="#3FB1CE",scale:n=1,draggable:o=!1,clickTolerance:a=0,rotation:s=BF.rotation,rotationAlignment:l=BF.rotationAlignment,pitchAlignment:c=BF.pitchAlignment,occludedOpacity:u=BF.occludedOpacity,altitude:h=BF.altitude}=e||{};this._anchor=i,this._color=r,this._scale=n,this._draggable=o,this._clickTolerance=a,this._rotation=s,this._rotationAlignment=l,this._pitchAlignment=c,this._occludedOpacity=u,this._altitude=h,this._state="inactive",this._isDragging=!1,this._pointerEvents=null,this._updateMoving=()=>this._update(!0),e&&e.element?(this._element=e.element,this._offset=ke.convert(e&&e.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=ke.convert(e&&e.offset||[0,-14])),this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",e=>{e.preventDefault()}),this._element.addEventListener("mousedown",e=>{e.preventDefault()});const d=this._element.classList;for(const p in FF)d.remove(`mapboxgl-marker-anchor-${p}`);d.add(`mapboxgl-marker-anchor-${this._anchor}`),e&&e.className&&d.add(...e.className.trim().split(OF)),this._popup=null}_createDefaultMarker(){const e=ri("div"),t=ni("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},e);this._svgElement=t;const i=ni("radialGradient",{id:"shadowGradient"},ni("defs",{},t));ni("stop",{offset:"10%","stop-opacity":.4},i),ni("stop",{offset:"100%","stop-opacity":.05},i);const r=ni("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"});return this._shadowElement=r,0===this._altitude&&t.insertBefore(r,t.firstChild),ni("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},t),ni("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},t),ni("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},t),e}addTo(e){return e===this._map||(this.remove(),this._map=e,e.getCanvasContainer().appendChild(this._element),e.on("move",this._updateMoving),e.on("moveend",this._update),e.on("remove",this._clearFadeTimer),e._addMarker(this),this.setDraggable(this._draggable),this._update(),e.on("click",this._onMapClick)),this}remove(){const e=this._map;return e&&(e.off("click",this._onMapClick),e.off("move",this._updateMoving),e.off("moveend",this._update),e.off("mousedown",this._addDragHandler),e.off("touchstart",this._addDragHandler),e.off("mouseup",this._onUp),e.off("touchend",this._onUp),e.off("mousemove",this._onMove),e.off("touchmove",this._onMove),e.off("remove",this._clearFadeTimer),e._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=kc.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(e){if(e===this._altitude)return this;const t=this._altitude;return this._altitude=e||BF.altitude,this._defaultMarker&&0===t!=(0===this._altitude)&&(0===this._altitude?this._svgElement.insertBefore(this._shadowElement,this._svgElement.firstChild):this._shadowElement.remove()),this._update(),this}getAltitude(){return this._altitude}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const t=38.1,i=13.5,r=Math.sqrt(Math.pow(i,2)/2);e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-t],"bottom-left":[r,-1*(t-i+r)],"bottom-right":[-r,-1*(t-i+r)],left:[i,-1*(t-i)],right:[-i,-1*(t-i)]}:this._offset}this._popup=e,e._marker=this,e._altitude=this._altitude,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(e){const t=e.code,i=e.charCode||e.keyCode;"Space"!==t&&"Enter"!==t&&32!==i&&13!==i||this.togglePopup()}_onMapClick(e){const t=e.originalEvent.target,i=this._element;this._popup&&(t===i||i.contains(t))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const e=this._popup;return e?(e.isOpen()?(e.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(e.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const e=this._map,t=this._pos;if(!e||!t)return!1;const i=e.unproject(t,this._altitude),r=e.getFreeCameraOptions();if(!r.position)return!1;const n=r.position.toLngLat();return n.distanceTo(i)<.9*n.distanceTo(this._lngLat)}_evaluateOpacity(){const e=this._map;if(!e)return;const t=this._pos;if(!t||t.x<0||t.x>e.transform.width||t.y<0||t.y>e.transform.height)return void this._clearFadeTimer();const i=e.unproject(t,this._altitude);let r;e._showingGlobe()&&wf(e.transform,this._lngLat)?r=0:(r=1-e._queryFogOpacity(i),e.transform._terrainEnabled()&&e.style&&e.style.hasTerrain()&&this._behindTerrain()&&(r*=this._occludedOpacity)),this._element.style.opacity=`${r}`;const n=this._element.style.pointerEvents;(null===this._pointerEvents?""===n:n===this._pointerEvents)&&(this._pointerEvents=r>0?"auto":"none",this._element.style.pointerEvents=this._pointerEvents),this._popup&&this._popup._setOpacity(r),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const e=this._pos;if(!e||!this._map)return;const t=this._offset.mult(this._scale);this._element.style.transform=`\n            translate(${e.x}px,${e.y}px)\n            ${FF[this._anchor]}\n            ${this._calculateXYTransform()} ${this._calculateZTransform()}\n            translate(${t.x}px,${t.y}px)\n        `}_calculateXYTransform(){const e=this._pos,t=this._map,i=this.getPitchAlignment();if(!t||!e||"map"!==i)return"";if(!t._showingGlobe()){const e=t.getPitch();return e?`rotateX(${e}deg)`:""}const r=ot(bf(t.transform,this._lngLat)),n=e.sub(vf(t.transform)),o=Math.abs(n.x)+Math.abs(n.y);if(0===o)return"";const a=r/o;return`rotateX(${-n.y*a}deg) rotateY(${n.x*a}deg)`}_calculateZTransform(){const e=this._pos,t=this._map;if(!t||!e)return"";let i=0;const r=this.getRotationAlignment();if("map"===r)if(t._showingGlobe()){const e=t.project(new kc(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),r=t.project(new kc(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(e);i=ot(Math.atan2(r.y,r.x))-90}else i=-t.getBearing();else if("horizon"===r){const r=dt(4,6,t.getZoom()),n=vf(t.transform);n.y+=r*t.transform.height;const o=e.sub(n),a=ot(Math.atan2(o.y,o.x));i=(a>90?a-270:a+90)*(1-r)}return i+=this._rotation,i?`rotateZ(${i}deg)`:""}_update(e){cancelAnimationFrame(this._updateFrameId);const t=this._map;
vendor: 6,306 bytes, line 2
2t&&(t.transform.renderWorldCopies&&(this._lngLat=LF(this._lngLat,this._pos,t.transform)),this._pos=t.project(this._lngLat,this._altitude),!0===e?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),t._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(t._showingGlobe()||t.style&&t.style.hasTerrain()||t.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(e){return this._offset=ke.convert(e),this._update(),this}addClassName(e){return this._element.classList.add(e),this}removeClassName(e){return this._element.classList.remove(e),this}toggleClassName(e){return this._element.classList.toggle(e)}_onMove(e){const t=this._map;if(!t)return;const i=this._pointerdownPos,r=this._positionDelta;if(i&&r){if(!this._isDragging){const r=this._clickTolerance||t._clickTolerance;if(e.point.dist(i)<r)return;this._isDragging=!0}this._pos=e.point.sub(r),this._lngLat=t.unproject(this._pos,this._altitude),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new Or("dragstart"))),this.fire(new Or("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;const e=this._map;e&&(e.off("mousemove",this._onMove),e.off("touchmove",this._onMove)),"active"===this._state&&this.fire(new Or("dragend")),this._state="inactive"}_addDragHandler(e){const t=this._map,i=this._pos;t&&i&&this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(i),this._pointerdownPos=e.point,this._state="pending",t.on("mousemove",this._onMove),t.on("touchmove",this._onMove),t.once("mouseup",this._onUp),t.once("touchend",this._onUp))}setDraggable(e){this._draggable=!!e;const t=this._map;return t&&(e?(t.on("mousedown",this._addDragHandler),t.on("touchstart",this._addDragHandler)):(t.off("mousedown",this._addDragHandler),t.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||BF.rotation,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||BF.rotationAlignment,this._update(),this}getRotationAlignment(){return"auto"===this._rotationAlignment||"horizon"===this._rotationAlignment&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e||BF.pitchAlignment,this._update(),this}getPitchAlignment(){return"auto"===this._pitchAlignment?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(e){return this._occludedOpacity=e||BF.occludedOpacity,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}const VF={OFF:[],WAITING_ACTIVE:["waiting","active"],ACTIVE_LOCK:["active"],ACTIVE_ERROR:["waiting","active-error"],BACKGROUND:["background"],BACKGROUND_ERROR:["waiting","background-error"]},NF=e=>`mapboxgl-ctrl-geolocate-${e}`,UF=["waiting","active","active-error","background","background-error"].map(NF),jF={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1,showButton:!0,followUserLocation:!0},GF={maxWidth:100,unit:"metric"},HF={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},$F=/\s+/,WF={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",altitude:0},qF=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function ZF(e=new ke(0,0),t="bottom"){if("number"==typeof e){const i=Math.round(Math.sqrt(.5*Math.pow(e,2)));switch(t){case"top":return new ke(0,e);case"top-left":return new ke(i,i);case"top-right":return new ke(-i,i);case"bottom":return new ke(0,-e);case"bottom-left":return new ke(i,-i);case"bottom-right":return new ke(-i,-i);case"left":return new ke(e,0);case"right":return new ke(-e,0)}return new ke(0,0)}return e instanceof ke||Array.isArray(e)?ke.convert(e):ke.convert(e[t]||[0,0])}const XF="undefined"!=typeof document?document.currentScript:null;var YF;YF=XF&&XF.src&&Li(XF.src)?"cdn":"other",_r=YF;const KF={version:n,supported:function(e){return!function(e){return"undefined"!=typeof window&&"undefined"!=typeof document?Object.hasOwn?"undefined"==typeof Worker?"Web Workers not supported":function(){const e=document.createElement("canvas");e.width=e.height=1;const t=e.getContext("2d");return!!t&&t.getImageData(0,0,1,1).width===e.width}()?function(e){return e?(void 0===i&&(i=r(!0)),i):(void 0===t&&(t=r(!1)),t)}(e)?"":"insufficient WebGL2 support":"insufficient Canvas/getImageData support":"Object.hasOwn not supported":"not a browser"}(e)},setRTLTextPlugin:function(e,t,i=!1){if(Qs===Xs||Qs===Ys||Qs===Ks)throw new Error("setRTLTextPlugin cannot be called multiple times.");el=ei.resolveURL(e),Qs=Xs,Js=t,il(),i||ol()},getRTLTextPluginStatus:nl,setSdkInfo:function(e){"string"!=typeof e||e.length>64||!mr.test(e)?Tt(`Invalid SDK info "${e}"; expected a "Name/version" string. Ignoring.`):fr=e},addTileProvider:function(e,t){if(!e||!t)throw new Error("TileProvider name and URL are required");gi.TILE_PROVIDER_URLS[e]=ei.resolveURL(t)},Map:class extends vF{constructor(e){Qi.mark(Ji.create);const t=e;if(null!=(e={...CF,...e}).minZoom&&null!=e.maxZoom&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=e.minPitch&&null!=e.maxPitch&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=e.minPitch&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=e.maxPitch&&e.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");super(new Uw(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies,null,null),e),this._animationFrameProvider=e.animationFrameProvider,this._repaint=!!e.repaint,this._interactive=e.interactive,this._minTileCacheSize=e.minTileCacheSize,this._maxTileC
vendor: 4,784 bytes, line 2
2acheSize=e.maxTileCacheSize,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._antialias=e.antialias,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._placementAlgorithm=e.placementAlgorithm||"default",this._isInitialLoad=!0,this._crossSourceCollisions=e.crossSourceCollisions,this._collectResourceTiming=e.collectResourceTiming,this._language=this._parseLanguage(e.language),this._worldview=e.worldview,this._renderTaskQueue=new AF,this._domRenderTaskQueue=new AF,this._controls=[],this._markers=[],this._popups=[],this._mapId=gt(),this._locale={...SF,...e.locale},this._clickTolerance=e.clickTolerance,this._cooperativeGestures=e.cooperativeGestures,this._performanceMetricsCollection=e.performanceMetricsCollection,this._tessellationStep=e.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=e.precompilePrograms,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new IF(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._emissiveColorPrecision=e.emissiveColorPrecision,this._scaleFactor=e.scaleFactor,this._requestManager=new sr(e.transformRequest,e.accessToken,e.testMode);const i=dr(e.accessToken||gi.ACCESS_TOKEN);if(i&&"atlas"in i&&"number"==typeof i.atlas&&(this._tokenExpiration=i.atlas),this._silenceAuthErrors=!!e.testMode,this._contextCreateOptions=e.contextCreateOptions?{...e.contextCreateOptions}:{},"string"==typeof e.container){const t=document.getElementById(e.container);if(!t)throw new Error(`Container '${e.container.toString()}' not found.`);this._container=t}else{if(!(e.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(this._container.childNodes.length>0&&Tt("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),e.maxBounds&&this.setMaxBounds(e.maxBounds),this._spriteFormat="auto",bt(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");if(this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new yF(this,e),this._localFontFamily=e.localFontFamily,this._localIdeographFontFamily=e.localIdeographFontFamily,this._fontstackCompositing=e.fontstackCompositing,(e.style||!e.testMode)&&this.setStyle(e.style||gi.DEFAULT_STYLE,{config:e.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily,fontstackCompositing:this._fontstackCompositing}),e.projection&&this.setProjection(e.projection),e.hash&&(this._hash=new yL("string"==typeof e.hash&&e.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){null==t.center&&null==t.zoom||(this.transform._unmodified=!1),this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch});const i=e.bounds;i&&(this.resize(),this.fitBounds(i,{...e.fitBoundsOptions,duration:0}))}this.resize(),e.attributionControl&&this.addControl(new wF({customAttribution:e.customAttribution})),this._logoControl=new EF,this.addControl(this._logoControl,e.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent(),this._postStyleWithAppearanceEvent()}),this.on("data",e=>{this._update("style"===e.dataType),this.fire(new Or(`${e.dataType}data`,e))}),this.on("dataloading",e=>{this.fire(new Or(`${e.dataType}dataloading`,e))}),this._interactions=new DF(this)}_getMapId(){return this._mapId}addControl(e,t){if(void 0===t&&(t=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e||!e.onAdd)return this.fire(new Br(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const i=e.onAdd(this);this._controls.push(e);const r=this._controlPositions[t];
vendor: 8,551 bytes, line 2
2return t.includes("bottom")?r.insertBefore(i,r.firstChild):r.appendChild(i),this}removeControl(e){if(!e||!e.onRemove)return this.fire(new Br(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(e);return t>-1&&this._controls.splice(t,1),e.onRemove(this),this}hasControl(e){return this._controls.includes(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(e){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const t=!this._moving;return t&&this.fire(new Or("movestart",e)).fire(new Or("move",e)),this.fire(new Or("resize",e)),t&&this.fire(new Or("moveend",e)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(e){return this.transform.setMaxBounds(Vc.convert(e)),this._update()}setMinZoom(e){if((e=e??-2)>=-2&&e<=this.transform.maxZoom)return this.transform.minZoom=e,this._update(),this.getZoom()<e?this.setZoom(e):this.fire(new Or("zoomstart")).fire(new Or("zoom")).fire(new Or("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(e){if((e=e??22)>=this.transform.minZoom)return this.transform.maxZoom=e,this._update(),this.getZoom()>e?this.setZoom(e):this.fire(new Or("zoomstart")).fire(new Or("zoom")).fire(new Or("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(e){if((e=e??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(e>=0&&e<=this.transform.maxPitch)return this.transform.minPitch=e,this._update(),this.getPitch()<e?this.setPitch(e):this.fire(new Or("pitchstart")).fire(new Or("pitch")).fire(new Or("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(e){if((e=e??85)>85)throw new Error("maxPitch must be less than or equal to 85");if(e>=this.transform.minPitch)return this.transform.maxPitch=e,this._update(),this.getPitch()>e?this.setPitch(e):this.fire(new Or("pitchstart")).fire(new Or("pitch")).fire(new Or("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(e){return this._scaleFactor=e,this.painter.scaleFactor=e,this.style&&this.style._setLabelPlacementStale(),this.style._updateFilteredLayers(e=>"symbol"===e.type),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.renderWorldCopies=e,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(e){return"auto"===e?navigator.language:Array.isArray(e)?0===e.length?void 0:e.map(e=>"auto"===e?navigator.language:e):e}setLanguage(e){const t=this._parseLanguage(e);if(!this.style||t===this._language)return this;this._language=t,this.style.reloadSources();for(const i of this._controls)i._setLanguage&&i._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(e){return this.style&&e!==this._worldview?(this._worldview=e,this._styleDirty=!0,this.style.setWorldview(e),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return"globe"===this.transform.projection.name}setProjection(e){return this._lazyInitEmptyStyle(),e?"string"==typeof e&&(e={name:e}):e=null,this._useExplicitProjection=!!e,this._prioritizeAndUpdateProjection(e,this.style.projection)}_updateProjectionTransition(){if("globe"!==this.getProjection().name)return;const e=this.transform,t=e.projection.name;let i;"globe"===t&&e.zoom>=6?(e.setMercatorFromTransition(),i=!0):"mercator"===t&&e.zoom<6&&(e.setProjection({name:"globe"}),i=!0),i&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayerUpdate(),this._update(!0))}_prioritizeAndUpdateProjection(e,t){return this._updateProjection(e||t||{name:"mercator"})}_updateProjection(e){let t;const i=this.transform.mercatorFromTransition;t="globe"===e.name&&this.transform.zoom>=6?this.transform.setMercatorFromTransition():this.transform.setProjection(e),this.style.applyProjectionUpdate();const r="mercator"===this.transform.getProjection().name&&i!==this.transform.mercatorFromTransition;return(t||r)&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(e,t){return this.transform.locationPoint3D(kc.convert(e),t)}unproject(e,t){return this.transform.pointLocation3D(ke.convert(e),t)}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(e,t,i){const r=e=>{let i=[];if(Array.isArray(t)){const r=t.filter(e=>this.getLayer(e));i=r.length?this.queryRenderedFeatures(e,{layers:r}):[]}else i=this.queryRenderedFeatures(e,{target:t});return i};if("mouseenter"===e||"mouseover"===e){let n=!1;const o=t=>{const o=r(t.point);o.length?n||(n=!0,i.call(this,new DL(e,this,t.originalEvent,{features:o}))):n=!1};return{listener:i,targets:t,delegates:{mousemove:o,mouseout:()=>{n=!1}}}}if("mouseleave"===e||"mouseout"===e){let n=!1;const o=t=>{r(t.point).length?n=!0:n&&(n=!1,i.call(this,new DL(e,this,t.originalEvent)))},a=t=>{n&&(n=!1,i.call(this,new DL(e,this,t.originalEvent)))};return{listener:i,targets:t,delegates:{mousemove:o,mouseout:a}}}{const n=e=>{const t=r(e.point);t.length&&(e.features=t,i.call(this,e),delete e.features)};return{listener:i,targets:t,delegates:{[e]:n}}}}on(e,t,i){if("function"==typeof t||void 0===i)return super.on(e,t);if("string"==typeof t&&(t=[t]),!this._areTargetsValid(t))return this;const r=this._createDelegatedListener(e,t,i);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(r);for(const n in r.delegates)this.on(n,r.delegates[n]);return this}once(e,t,i){if("function"==typeof t||void 0===i)return super.once(e,t);if("string"==typeof t&&(t=[t]),!this._areTargetsValid(t))return this;const r=this._createDelegatedListener(e,t,i);for(const n in r.delegates)this.once(n,r.delegates[n]);return this}off(e,t,i){if("function"==typeof t||void 0===i)return super.off(e,t);if("string"==typeof t&&(t=[t]),!this._areTargetsValid(t))return this;const r=this._delegatedListeners?this._delegatedListeners[e]:void 0;return r&&(e=>{for(let r=0;r<e.length;r++){const n=e[r];if(n.listener===i&&MF(n.targets,t)){for(const e in n.delegates)this.off(e,n.delegates[e]);return e.splice(r,1),this}}})(r),this}queryRenderedFeatures(e,t){if(!this.style)return[];if(void 0===e||e instanceof ke||Array.isArray(e)||void 0!==t||(t=e,e=void 0),e=e||[[0,0],[this.transform.width,this.transform.height]],!t){const t=this.style.queryRenderedFeatures(e,void 0,this.transform),i=this.style.queryRenderedFeatureset(e,void 0,this.transform);return t.concat(i)}let i=!0;if(t.target&&(i=this._isTargetValid(t.target),i&&!t.layers))return this.style.queryRenderedFeatureset(e,t,this.transform);let r=!0;if(t.layers&&Array.isArray(t.layers)){for(const e of t.layers)if(!this._isValidId(e)){r=!1;break}if(r&&!t.target)return this.style.queryRenderedFeatures(e,t,this.transform)}let n=[];return r&&(n=n.concat(this.style.queryRenderedFeatures(e,t,this.transform))),i&&(n=n.concat(this.style.queryRenderedFeatureset(e,t,this.transform))),n}querySourceFeatures(e,t){return!e||"string"==typeof e&&!this._isValidId(e)?[]:this.style.querySourceFeatures(e,t)}queryRasterValue(e,t,i){return this._isValidId(e)?this.style.queryRasterValue(e,t,i):Promise.resolve(null)}isPointOnSurface(e){const{name:t}=this.transform.projection;return"globe"!==t&&"mercator"!==t&&Tt(`${t} projection does not support isPointOnSurface, this API may behave unex
2pectedly.`),this.transform.isPointOnSurface(ke.convert(e))}addInteraction(e,t){return this._interactions.add(e,t),this}removeInteraction(e){return this._interactions.remove(e),this}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(e){return this._cooperativeGestures=e,this}setStyle(e,t){return t={localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily,fontstackCompositing:this._fontstackCompositing,...t},this.style&&e&&!1!==t.diff&&t.localFontFamily===this._localFontFamily&&t.localIdeographFontFamily===this._localIdeographFontFamily&&t.fontstackCompositing===this._fontstackCompositing&&!t.config?(this.style._diffStyle(e,(i,r)=>{i?(Tt(`Unable to perform style diff: ${"string"==typeof i?i:i instanceof Error?i.message:i.error}. Rebuilding the style from scratch.`),this._updateStyle(e,t)):r&&this._update(!0)},()=>this._postStyleLoadEvent()),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._localFontFamily=t.localFontFamily,this._fontstackCompositing=t.fontstackCompositing,this._updateStyle(e,t))}_getUIString(e){const t=this._locale[e];if(null==t)throw new Error(`Missing UI string '${e}'`);return t}_updateStyle(e,t){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),e){const i={...t};t&&t.config&&(i.initialConfig=t.config,delete i.config),this.style=new bz(this,i).load(e),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new bz(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(Tt("There is no style added to the map."),!1)}_isValidId(e){return null==e?(this.fire(new Br(new Error("IDs can't be empty."))),!1):Nl(e)?(this.fire(new Br(new Error(`IDs can't contain special symbols: "${e}".`))),!1):"__proto__"!==e&&"constructor"!==e&&"prototype"!==e||(this.fire(new Br(new Error(`IDs can't be "${e}".`))),!1)}_isTargetValid(e){return"featuresetId"in e?this._isValidId("importId"in e?e.importId:e.featuresetId):"layerId"in e&&this._isValidId(e.layerId)}_areTargetsValid(e){if(Array.isArray(e)){for(const t of e)if(!this._isValidId(t))return!1;return!0}return this._isTargetValid(e)}addSource(e,t){return this._isValidId(e)?(this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)):this}isSourceLoaded(e){return!!this._isValidId(e)&&!!this.style&&this.style._isSourceCacheLoaded(e)}areTilesLoaded(){return this.style.areTilesLoaded()}removeSource(e){return this._isValidId(e)?(this.style.removeSource(e),this._updateTerrain(),this._update(!0)):this}getSource(e){return this._isValidId(e)?this.style.getOwnSource(e):null}addImage(e,t,{pixelRatio:i=1,sdf:r=!1,stretchX:n,stretchY:o,content:a}={}){this._lazyInitEmptyStyle();const s=Ur.from(e);if(t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap){const{width:e,height:l,data:c}=ei.getImageData(t);this.style.addImage(s,{data:new zd({width:e,height:l},c),pixelRatio:i,stretchX:n,stretchY:o,content:a,sdf:r,version:0,usvg:!1})}else if(void 0===t.width||void 0===t.height)this.fire(new Br(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:l,height:c}=t,u=t;this.style.addImage(s,{data:new zd({width:l,height:c},new Uint8Array(u.data)),pixelRatio:i,stretchX:n,stretchY:o,content:a,sdf:r,usvg:!1,version:0,userImage:u}),u.onAdd&&u.onAdd(this,e)}}updateImage(e,t){this._lazyInitEmptyStyle();const i=Ur.from(e),r=this.style.getImage(i);if(!r)return void this.fire(new Br(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const n=t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap?ei.getImageData(t):t,{width:o,height:a,data:s}=n;if(void 0===o||void 0===a)return void this.fire(new Br(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(o!==(r.usvg?r.icon.usvg_tree.width:r.data.width)||a!==(r.usvg?r.icon.usvg_tree.height:r.data.height))return void this.fire(new Br(new Error(`The width and height of the updated image (${o}, ${a})\n                must be that same as the previous version of the image\n                (${r.data.width}, ${r.data.height})`)));const l=!(t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap);let c=!1;r.usvg?(r.data=new zd({width:o,height:a},new Uint8Array(s)),r.usvg=!1,r.icon=void 0,c=!0):r.data.replace(s,l),this.style.updateImage(i,r,c)}hasImage(e){return e?!!this.style&&!!this.style.getImage(Ur.from(e)):(this.fire(new Br(new Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(Ur.from(e))}loadImage(e,t){(async()=>{const t=await this._requestManager.transformRequest(e,Bi.Image),{data:i}=await Yi(t);return i})().then(e=>t(null,e)).catch(t)}listImages(){return this.style.listImages().map(e=>e.name)}
vendor: 10,535 bytes, line 2
2addModel(e,t){this._lazyInitEmptyStyle(),this.style.addModel(e,t)}hasModel(e){return e?this.style.hasModel(e):(this.fire(new Br(new Error("Missing required model id"))),!1)}removeModel(e){this.style.removeModel(e)}listModels(){return this.style.listModels()}addLayer(e,t){return this._isValidId(e.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)):this}getSlot(e){const t=this.getLayer(e);return t&&t.slot||null}setSlot(e,t){return this.style.setSlot(e,t),this.style.mergeLayers(),this._update(!0)}addImport(e,t){return this._isValidId(e.id)?(this.style.addImport(e,t).catch(e=>this.fire(new Br(new Error("Failed to add import",e)))),this):this}updateImport(e,t){return"string"!=typeof t&&t.id!==e?(this.removeImport(e),this.addImport(t)):(this.style.updateImport(e,t),this._update(!0))}removeImport(e){return this.style.removeImport(e),this}moveImport(e,t){return this.style.moveImport(e,t),this._update(!0)}moveLayer(e,t){return this._isValidId(e)?(this.style.moveLayer(e,t),this._update(!0)):this}removeLayer(e){return this._isValidId(e)?(this.style.removeLayer(e),this._update(!0)):this}getLayer(e){if(!this._isValidId(e))return null;const t=this.style.getOwnLayer(e);return t?"custom"===t.type?t.implementation:t.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(e,t,i){return this._isValidId(e)?(this.style.setLayerZoomRange(e,t,i),this._update(!0)):this}setFilter(e,t,i={}){return this._isValidId(e)?(this.style.setFilter(e,t,i),this._update(!0)):this}getFilter(e){return this._isValidId(e)?this.style.getFilter(e):null}setPaintProperty(e,t,i,r={}){return this._isValidId(e)?(this.style.setPaintProperty(e,t,i,r),this._update(!0)):this}getPaintProperty(e,t){return this._isValidId(e)?this.style.getPaintProperty(e,t):null}setLayoutProperty(e,t,i,r={}){return this._isValidId(e)?(this.style.setLayoutProperty(e,t,i,r),this._update(!0)):this}getLayoutProperty(e,t){return this._isValidId(e)?this.style.getLayoutProperty(e,t):null}getLayerProperty(e,t){return this._isValidId(e)?this.style.getLayerProperty(e,t):null}setLayerProperty(e,t,i,r={}){return this._isValidId(e)?("appearances"===t&&this._postAddingAppearancesToStyleEvent(),this.style.setLayerProperty(e,t,i,r),this._update(!0)):this}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(e){return this.style.setGlyphsUrl(e),this._update(!0)}getSchema(e){return this.style.getSchema(e)}setSchema(e,t){return this.style.setSchema(e,t),this._update(!0)}getConfig(e){return this.style.getConfig(e)}setConfig(e,t){return this.style.setConfig(e,t),this._update(!0)}getConfigProperty(e,t){return this.style.getConfigProperty(e,t)}setConfigProperty(e,t,i){return this.style.setConfigProperty(e,t,i),this._update(!0)}getFeaturesetDescriptors(e){return this.style.getFeaturesetDescriptors(e)}setLights(e){if(this._lazyInitEmptyStyle(),e&&1===e.length&&"flat"===e[0].type){const t=e[0];t.properties?this.style.setFlatLight(t.properties,t.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(e),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const e=this.style.getLights()||[];return 0===e.length&&e.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),e}setLight(e,t={}){return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."),this.setLights([{id:"flat",type:"flat",properties:e}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(e){return this._lazyInitEmptyStyle(),!e&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(e),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(e){return this._lazyInitEmptyStyle(),this.style.setFog(e),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(e){return this._lazyInitEmptyStyle(),this.style.setSnow(e),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(e){return this._lazyInitEmptyStyle(),this.style.setRain(e),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(e){return this._lazyInitEmptyStyle(),this.style.setColorTheme(e),this._update(!0)}setImportColorTheme(e,t){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(e,t),this._update(!0)}setCamera(e){return this.style.setCamera(e),this._triggerCameraUpdate(e)}getNearClipOffset(){return this.transform.nearClipOffset}setNearClipOffset(e){const t=this.transform.nearClipOffset!==e;return this.transform.nearClipOffset=e,this._update(t)}_triggerCameraUpdate(e){return this._update(this.transform.setOrthographicProjectionAtLowPitch("orthographic"===e["camera-projection"]))}getCamera(){return this.style.camera}_queryFogOpacity(e){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(kc.convert(e),this.transform):0}setFeatureState(e,t){return e.source&&!this._isValidId(e.source)?this:(this.style.setFeatureState(e,t),this._update())}removeFeatureState(e,t){return e.source&&!this._isValidId(e.source)?this:(this.style.removeFeatureState(e,t),this._update())}getFeatureState(e){return e.source&&!this._isValidId(e.source)?null:this.style.getFeatureState(e)}resetFeatureStates(e){return this.style.resetFeatureStates(e),this._update()}_selectIndoorFloor(e){this.style.indoorManager&&this.style.indoorManager.selectFloor(e)}_setIndoorActiveFloorsVisibility(e){this.style.indoorManager&&this.style.indoorManager.setActiveFloorsVisibility(e)}getIndoorTileOptions(e,t){return this.style&&this.style.isIndoorEnabled()&&this.style.indoorManager?this.style.indoorManager.getIndoorTileOptions(e,t):null}_updateContainerDimensions(){if(!this._container)return;const e=this._container.getBoundingClientRect().width||400,t=this._container.getBoundingClientRect().height||300;let i,r,n,o=this._container;for(;o&&(!r||!n);){const e=window.getComputedStyle(o).transform;e&&"none"!==e&&(i=e.match(PF)[1].split(", "),i[0]&&"0"!==i[0]&&"1"!==i[0]&&(r=i[0]),i[3]&&"0"!==i[3]&&"1"!==i[3]&&(n=i[3])),o=o.parentElement}this._containerWidth=r?Math.abs(e/r):e,this._containerHeight=n?Math.abs(t/n):t}_detectMissingCSS(){"rgb(250, 128, 114)"!==window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&Tt("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const e=this._container;e.classList.add("mapboxgl-map"),(this._missingCSSCanary=ri("div","mapboxgl-canary",e)).style.visibility="hidden",this._detectMissingCSS();const t=this._canvasContainer=ri("div","mapboxgl-canvas-container",e);this._canvas=ri("canvas","mapboxgl-canvas",t),this._interactive&&(t.classList.add("mapboxgl-interactive"),this._canvas.setAttribute("tabindex","0")),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const i=this._controlContainer=ri("div","mapboxgl-control-container",e),r=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(e=>{r[e]=ri("div",`mapboxgl-ctrl-${e}`,i)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(e,t){const i=ei.devicePixelRatio||1;this._canvas.width=i*Math.ceil(e),this._canvas.height=i*Math.ceil(t),this._canvas.style.width=`${e}px`,this._canvas.style.height=`${t}px`}_addMarker(e){this._markers.push(e)}_removeMarker(e){const t=this._markers.indexOf(e);-1!==t&&this._markers.splice(t,1)}_addPopup(e){this._popups.push(e)}_removePopup(e){const t=this._popups.indexOf(e);-1!==t&&this._popups.splice(t,1)}_setupPainter(){const t={...e,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1},i=this._canvas.getContext("webgl2",t);i?(Lr(i,!0),this.painter=new mL(i,this._contextCreateOptions,this.transform,this._scaleFactor,this._worldview,this._emissiveColorPrecision),this.on("data",e=>{if("source"===e.dataType){const t=this.transform.elevation?this.transform.elevation._source():null;t&&e.sourceCacheId===t.id&&this.style&&this.style._setLabelPlacementStale(),this.style&&e.sourceCacheId&&this.style._buildingIndex.hasLayerForSourceCache(e.sourceCacheId)&&this.style._requestFullLabelPlacement(),this.painter.setTileLoadedFlag(!0)}})):this.fire(new Br(new Error("Failed to initialize WebGL")))}_contextLost(e){e.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.style&&this.style.handleContextLost(),this.fire(new Or("webglcontextlost",{originalEvent:e}))}_contextRestored(e){this._setupPainter(),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight)),this._updateTerrain(),this.style&&(this.style.clearLayers(),this.style.imageManager.destroyAtlasTextures(),this.style.imageManager.imageAtlasCache.destroyTextures(),this.style.reloadModels(),this.style.clearSources()),this._update(),this.fire(new Or("webglcontextrestored",{originalEvent:e}))}_onMapScroll(e){if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}idle(){return!this.isMoving()&&this.loaded()}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}frameReady(){return this.loaded()&&!this._placementDirty}_update(e){return this.style?(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_requestDomTask(e){!this.loaded()||this.loaded()&&!this.isMoving()?e():this._domRenderTaskQueue.add(e)}_render(e){let t;this.fire(new Or("renderstart")),++this._frameId;const i=this.painter.context.extTimerQuery,r=ei.now(),n=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(t=n.createQuery(),n.beginQuery(i.TIME_ELAPSED_EXT,t)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&
vendor: 16,963 bytes, line 2
2(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(e),this._domRenderTaskQueue.run(e),this._removed)return;this._updateProjectionTransition();const o=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const e=this.transform.zoom,t=this.transform.pitch,i=ei.now(),r=new ll(e,{now:i,fadeDuration:o,pitch:t,transition:this._loaded?this.style.transition:{duration:0,delay:0},worldview:this._worldview});this.style.update(r)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let a=!1;if(this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),a=this._updateAverageElevation(r),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):a=this._updateAverageElevation(r),this.style&&(this._placementDirty=this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,o,this._crossSourceCollisions,this.painter.replacementSource,this._placementAlgorithm)),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:o,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming,paintStartTimeStamp:e}),this.fire(new Or("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,Qi.mark(Ji.load),this.fire(new Or("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&(this.style.snow||this.style.rain)&&(this._styleDirty=!0),this.style&&this.style.imageManager.hasPatternsInFlight()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),t){const e=ei.now()-r;n.endQuery(i.TIME_ELAPSED_EXT),setTimeout(()=>{const i=n.getQueryParameter(t,n.QUERY_RESULT)/1e6;n.deleteQuery(t),this.fire(new Or("gpu-timing-frame",{cpuTime:e,gpuTime:i}))},50)}if(this.listens("gpu-timing-layer")){const e=this.painter.collectGpuTimers();setTimeout(()=>{const t=this.painter.queryGpuTimers(e);this.fire(new Or("gpu-timing-layer",{layerTimes:t}))},50)}if(this.listens("gpu-timing-deferred-render")){const e=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const t=this.painter.queryGpuTimeDeferredRender(e);this.fire(new Or("gpu-timing-deferred-render",{gpuTime:t}))},50)}const s=this._sourcesDirty||this._styleDirty||this._placementDirty||a;if(s||this._repaint)this.triggerRepaint();else{const e=this.idle();if(e&&(a=this._updateAverageElevation(r,!0)),a)this.triggerRepaint();else{if(this._triggerFrame(!1),e&&(this.fire(new Or("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const e=this._calculateSpeedIndex();this.fire(new Or("speedindexcompleted",{speedIndex:e})),this.speedIndexTiming=!1}e&&this.style&&this.style.handleIdle()}}!this._loaded||this._fullyLoaded||s||(this._fullyLoaded=!0,Qi.mark(Ji.fullLoad),this._performanceMetricsCollection&&Pr(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:this.painter.style.hasTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(e){for(const t of this._markers)e&&!this.getRenderWorldCopies()&&(t._lngLat=t._lngLat.wrap()),t._update();for(const t of this._popups)!e||this.getRenderWorldCopies()||t._trackPointer||(t._lngLat=t._lngLat.wrap()),t._update()}_updateAverageElevation(e,t=!1){const i=e=>(this.transform.averageElevation=e,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&i(0);const r=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(r||(t||e-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(e)){const t=this.transform.averageElevation;let n=this.transform.sampleAverageElevation();null!=this.transform.elevation&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(n)?n=0:this._averageElevationLastSampledAt=e;const o=Math.abs(t-n);if(o>1){if(this._isInitialLoad||r)return this._averageElevation.jumpTo(n),i(n);this._averageElevation.easeTo(n,e,300)}else if(o>1e-4)return this._averageElevation.jumpTo(n),i(n)}return!!this._averageElevation.isEasing(e)&&i(this._averageElevation.getValue(e))}_isTokenExpired(){return null!=this._tokenExpiration&&Date.now()>this._tokenExpiration}_revokeAuth(){const e=this.painter.context.gl;Lr(e,!1),this._logoControl instanceof EF&&this._logoControl._updateLogo(),e&&e.clear(e.DEPTH_BUFFER_BIT|e.COLOR_BUFFER_BIT|e.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new Br(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}_authenticate(){Rr(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,e=>{e&&(e.message!==ar&&401!==e.status||this._revokeAuth())}),this._isTokenExpired()&&this._revokeAuth(),wr(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&Ar(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_postStyleWithAppearanceEvent(){this.style.globalId&&this.style.hasAppearances()&&Sr(this._requestManager._customAccessToken)}_postAddingAppearancesToStyleEvent(){Dr(this._requestManager._customAccessToken)}_updateTerrain(){const e=this._isDragging();this.painter.updateTerrain(this.style,e)}_calculateSpeedIndex(){const e=this.painter.canvasCopy(),t=this.painter.getCanvasCopiesAndTimestamps();t.timeStamps.push(performance.now());const i=this.painter.context.gl,r=i.createFramebuffer();function n(e){i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e,0);const t=new Uint8Array(i.drawingBufferWidth*i.drawingBufferHeight*4);return i.readPixels(0,0,i.drawingBufferWidth,i.drawingBufferHeight,i.RGBA,i.UNSIGNED_BYTE,t),t}return i.bindFramebuffer(i.FRAMEBUFFER,r),this._canvasPixelComparison(n(e),t.canvasCopies.map(n),t.timeStamps)}_canvasPixelComparison(e,t,i){let r=i[1]-i[0];const n=e.length/4;for(let o=0;o<t.length;o++){const a=t[o];let s=0;for(let t=0;t<a.length;t+=4)a[t]===e[t]&&a[t+1]===e[t+1]&&a[t+2]===e[t+2]&&a[t+3]===e[t+3]&&(s+=1);r+=(i[o+2]-i[o+1])*(1-s/n)}return r}remove(){if(this._removed)return;this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.style&&this.style.destroy(),this.painter.destroy(),this.handlers&&this.handlers.destroy(),this.handlers=void 0,this.setStyle(null),window.removeEventListener("resize",this._onWindowResize,!1),window.removeEventListener("orientationchange",this._onWindowResize,!1),window.removeEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.removeEventListener("online",this._onWindowOnline,!1),window.removeEventListener("visibilitychange",this._onVisibilityChange,!1);const e=this.painter.context.gl.getExtension("WEBGL_lose_context");e&&e.loseContext(),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._missingCSSCanary.remove(),this._canvas=void 0,this._canvasContainer=void 0,this._controlContainer=void 0,this._missingCSSCanary=void 0,this._container.classList.remove("mapboxgl-map"),this._container.removeEventListener("scroll",this._onMapScroll,!1),zr.delete(this.painter.context.gl),Cr.remove(),br.remove(),this._removed=!0,this.fire(new Or("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(e){if(this._renderNextFrame=this._renderNextFrame||e,!this.style||this._frame)return;const t=this._animationFrameProvider;if(!t)return void(this._frame=ei.frame(e=>{const t=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,t&&this._render(e)}));const i=e=>{const t=!!this._renderNextFrame;this._renderNextFrame=null;try{t&&this._render(e)}finally{this._frame=null}t&&!this._removed&&Promise.resolve().then(()=>this._triggerFrame(!1))};let r=null;this._frame={cancel:()=>{null!==r&&t.cancelAnimationFrame(r)}};try{r=t.requestAnimationFrame(i)}catch(e){throw this._frame=null,e}}_preloadTiles(e){return ft(this.style?this.style.getSourceCaches():[],(t,i)=>t._preloadTiles(e,i),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(e){this._trackResize&&this.resize({originalEvent:e})._update()}_onVisibilityChange(){"hidden"===document.visibilityState&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,e&&PS(),this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(e){this._showParseStatus!==e&&(this._showParseStatus=e,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(e){this._showTerrainWireframe!==e&&(this._showTerrainWireframe=e,this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(e){this._showLayers2DWireframe!==e&&(this._showLayers2DWireframe=e,this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(e){this._showLayers3DWireframe!==e&&(this._showLayers3DWireframe=e,this._update())}get showElevationIdDebug(){return!!this.painter&&this.painter._debugParams.showElevationIdDebug}set showElevationIdDebug(e){this.painter&&this.painter._debugParams.showElevationIdDebug!==e&&(this.painter._debugParams.showElevationIdDebug=e,this.style&&e?this.style._reloadSources():this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(e){this._speedIndexTiming!==e&&(this._speedIndexTiming=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,e&&PS(),this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e&&PS(),this.style&&e?this.style._reloadSources():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(e){this._showTileAABBs!==e&&(this._showTileAABBs=e,e&&this._update())}_setCacheLimits(e,t){!function(e,t){Ai=e,Ii=t}(e,t)}get version(){return n}},NavigationControl:class{constructor(e={}){this.options={...RF,...e},this._container=ri("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(bt(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",e=>{this._map&&this._map.zoomIn({},{originalEvent:e})}),ri("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",e=>{this._map&&this._map.zoomOut({},{originalEvent:e})}),ri("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(bt(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",e=>{const t=this._map;t&&(this.options.visualizePitch?t.resetNorthPitch({},{originalEvent:e}):t.resetNorth({},{originalEvent:e}))}),this._compassIcon=ri("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const e=this._map;if(!e)return;const t=e.getZoom(),i=t===e.getMaxZoom(),r=t===e.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=r,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",r.toString())}_rotateCompassArrow(){const e=this._map;if(!e)return;const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(e.transform.pitch*(Math.PI/180)),.5)}) rotateX(${e.transform.pitch}deg) rotateZ(${e.transform.angle*(180/Math.PI)}deg)`:`rotate(${e.transform.angle*(180/Math.PI)}deg)`;e._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=t)})}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),e.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&e.on("pitch",this._rotateCompassArrow),e.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new zF(e,this._compass,this.options.visualizePitch)),this._container}onRemove(){const e=this._map;e&&(this._container.remove(),this.options.showZoom&&e.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&e.off("pitch",this._rotateCompassArrow),e.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(e,t){const i=ri("button",e,this._container);return i.type="button",i.addEventListener("click",t),i}_setButtonTitle(e,t){if(!this._map)return;const i=this._map._getUIString(`NavigationControl.${t}`);e.setAttribute("aria-label",i),e.firstElementChild&&e.firstElementChild.setAttribute("title",i)}},GeolocateControl:class extends Nr{constructor(e={}){super();const t=navigator.geolocation;this.options={geolocation:t,...jF,...e},bt(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=_L(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(e){return this._map=e,this._container=ri("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){this._clearRequestTimeout(),void 0!==this._geolocationWatchID&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(e){const t=(t=!!this.options.geolocation)=>{this._supportsGeolocation=t,e(t)};void 0!==this._supportsGeolocation?e(this._supportsGeolocation):void 0!==navigator.permissions?navigator.permissions.query({name:"geolocation"}).then(e=>t("denied"!==e.state)).catch(()=>t()):t()}_isOutOfMapMaxBounds(e){const t=this._map.getMaxBounds(),i=e.coords;return!!t&&(i.longitude<t.getWest()||i.longitude>t.getEast()||i.latitude<t.getSouth()||i.latitude>t.getNorth())}_setWatchState(e){this._watchState=e;const t=this._geolocateButton.classList;t.remove(...UF);for(const i of VF[e])t.add(NF(i))}_setButtonTitle(e){const t=this._map._getUIString(e);this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":this._setWatchState("ACTIVE_ERROR");break;case"BACKGROUND":this._setWatchState("BACKGROUND_ERROR")}}_onSuccess(e){if(this._map){if(this._clearRequestTimeout(),this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new Or("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this._lastKnownPosition=e,this.options.trackUserLocation)switch(this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_E
2RROR":this._setWatchState(this.options.followUserLocation?"ACTIVE_LOCK":"BACKGROUND");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._setWatchState("BACKGROUND")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),this.options.followUserLocation&&(!this.options.trackUserLocation||"ACTIVE_LOCK"===this._watchState)&&this._updateCamera(e),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new Or("geolocate",{coords:e.coords,timestamp:e.timestamp,...e.toJSON?{toJSON:e.toJSON.bind(e)}:{}})),this._finish()}}_updateCamera(e){const t=new kc(e.coords.longitude,e.coords.latitude),i=e.coords.accuracy,r={bearing:this._map.getBearing(),...this.options.fitBoundsOptions};this._map.fitBounds(t.toBounds(i),r,{geolocateSource:!0})}_updateMarker(e){if(e){const t=new kc(e.coords.longitude,e.coords.latitude);this.options.showAccuracyCircle?this._accuracyCircleMarker.setLngLat(t).addTo(this._map):this._accuracyCircleMarker.remove(),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const e=this._map.transform,t=Uc(1,e._center.lat)*e.worldSize,i=Math.ceil(2*this._accuracy*t);this._circleElement.style.width=`${i}px`,this._circleElement.style.height=`${i}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&"number"==typeof this._heading?(this._userLocationDotMarker.setRotation(this._heading),this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")):(this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(e){if(this._map){if(this._clearRequestTimeout(),this.options.trackUserLocation)if(1===e.code)this._setWatchState("OFF"),this._geolocateButton.disabled=!0,this._setButtonTitle("GeolocateControl.LocationNotAvailable"),void 0!==this._geolocationWatchID&&this._clearWatch();else{if(3===e.code&&this._noTimeout)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new Or("error",{code:e.code,message:e.message,PERMISSION_DENIED:e.PERMISSION_DENIED,POSITION_UNAVAILABLE:e.POSITION_UNAVAILABLE,TIMEOUT:e.TIMEOUT})),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_startRequestTimeout(){this._clearRequestTimeout();const e=this.options.positionOptions.timeout;e&&(this._requestTimeoutId=window.setTimeout(()=>{this._onError({code:3,message:"Geolocation request timed out"})},e))}_clearRequestTimeout(){void 0!==this._requestTimeoutId&&(clearTimeout(this._requestTimeoutId),this._requestTimeoutId=void 0)}_setupUI(e){void 0!==this._map&&(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=ri("button","mapboxgl-ctrl-geolocate",this._container),ri("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===e?(Tt("Geolocation support is not available so the GeolocateControl will be disabled."),this._geolocateButton.disabled=!0,this._setButtonTitle("GeolocateControl.LocationNotAvailable")):this._setButtonTitle("GeolocateControl.FindMyLocation"),this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._createUserLocationMarkers(),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.showButton||(this._container.style.display="none"),this.options.trackUserLocation&&this._map.on("movestart",e=>{e.geolocateSource||"ACTIVE_LOCK"!==this._watchState||e.originalEvent&&"resize"===e.originalEvent.type||(this._setWatchState("BACKGROUND"),this.fire(new Or("trackuserlocationend")))}),this.fire(new Or("ready")))}_onDeviceOrientation(e){this._userLocationDotMarker&&(e.webkitCompassHeading?this._heading=e.webkitCompassHeading:!0===e.absolute&&(this._heading=-1*e.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return Tt("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._setWatchState("WAITING_ACTIVE"),this.fire(new Or("trackuserlocationstart"));break;
vendor: 4,639 bytes, line 2
2case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._setWatchState("OFF"),this.fire(new Or("trackuserlocationend"));break;case"BACKGROUND":this._setWatchState("ACTIVE_LOCK"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new Or("trackuserlocationstart"))}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let e;this._geolocateButton.classList.add(NF("waiting")),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(e={maximumAge:6e5,timeout:0},this._noTimeout=!0):(e=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,e),this._startRequestTimeout(),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._startRequestTimeout(),this._timeoutId=window.setTimeout(this._finish,1e4);return!0}setFollowUserLocation(e){return this.options.followUserLocation=e??jF.followUserLocation,this.options.trackUserLocation&&"OFF"!==this._watchState&&(this.options.followUserLocation?"BACKGROUND"!==this._watchState&&"BACKGROUND_ERROR"!==this._watchState||(this._setWatchState("ACTIVE_LOCK"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new Or("trackuserlocationstart"))):"ACTIVE_LOCK"!==this._watchState&&"ACTIVE_ERROR"!==this._watchState||(this._setWatchState("BACKGROUND"),this.fire(new Or("trackuserlocationend")))),this}setShowAccuracyCircle(e){if(this.options.showAccuracyCircle=e??jF.showAccuracyCircle,!this._accuracyCircleMarker)return this;if(this.options.showAccuracyCircle){if(this.options.showUserLocation&&this._lastKnownPosition){const{longitude:e,latitude:t,accuracy:i}=this._lastKnownPosition.coords;this._accuracy=i,this._accuracyCircleMarker.setLngLat(new kc(e,t)).addTo(this._map),this._updateCircleRadius()}}else this._accuracyCircleMarker.remove();return this}setShowUserHeading(e){return this.options.showUserHeading=e??jF.showUserHeading,this._setup?(this.options.showUserHeading?void 0!==this._geolocationWatchID&&this._addDeviceOrientationListener():(this._removeDeviceOrientationListener(),this._heading=void 0,this._userLocationDotMarker&&this._updateMarkerRotation()),this):this}setFitBoundsOptions(e){return this.options.fitBoundsOptions=e??jF.fitBoundsOptions,this}setShowUserLocation(e){return this.options.showUserLocation=e??jF.showUserLocation,this._setup?(this.options.showUserLocation?(this._userLocationDotMarker||(this._createUserLocationMarkers(),this._map.on("zoom",this._onZoom)),!this._lastKnownPosition||void 0!==this._watchState&&"OFF"===this._watchState||this._updateMarker(this._lastKnownPosition)):(this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this._accuracyCircleMarker&&this._accuracyCircleMarker.remove()),this):this}_addDeviceOrientationListener(){const e=()=>{const e="ondeviceorientationabsolute"in window?"deviceorientationabsolute":"deviceorientation";window.addEventListener(e,this._onDeviceOrientation)},t=DeviceOrientationEvent;"function"==typeof t?.requestPermission?t.requestPermission().then(t=>{"granted"===t?e():Tt("GeolocateControl: permission to use device orientation was denied, so the user heading arrow will not be shown.")}).catch(()=>{Tt("GeolocateControl: could not request device orientation permission. Enable the user heading from a user gesture (click/tap) so the browser can prompt for access.")}):e()}_removeDeviceOrientationListener(){window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation)}_createUserLocationMarkers(){this._dotElement=ri("div","mapboxgl-user-location"),this._dotElement.appendChild(ri("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(ri("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new kF({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=ri("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new kF({element:this._circleElement,pitchAlignment:"map"})}_clearWatch(){this._clearRequestTimeout(),this.options.geolocation.clearWatch(this._geolocationWatchID),this._removeDeviceOrientationListener(),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove(NF("waiting")),this._geolocateButton.setAttribute("aria-pressed","fal
2se"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:wF,ScaleControl:class{constructor(e={}){this.options={...GF,...e},bt(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const e=this.options.maxWidth||100,t=this._map,i=t._containerHeight/2,r=t._containerWidth/2-e/2,n=t.unproject([r,i]),o=t.unproject([r+e,i]),a=n.distanceTo(o);if("imperial"===this.options.unit){const t=3.2808*a;t>5280?this._setScale(e,t/5280,"mile"):this._setScale(e,t,"foot")}else"nautical"===this.options.unit?this._setScale(e,a/1852,"nautical-mile"):a>=1e3?this._setScale(e,a/1e3,"kilometer"):this._setScale(e,a,"meter")}_setScale(e,t,i){this._map._requestDomTask(()=>{const r=function(e){const t=Math.pow(10,`${Math.floor(e)}`.length-1);let i=e/t;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(e){const t=Math.pow(10,Math.ceil(-Math.log(e)/Math.LN10));return Math.round(e*t)/t}(i),t*i}(t),n=r/t;this._container.innerHTML="nautical-mile"!==i?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:i}).format(r):`${r}&nbsp;${HF[i]}`,this._container.style.width=e*n+"px"})}onAdd(e){return this._map=e,this._language=e.getLanguage(),this._container=ri("div","mapboxgl-ctrl mapboxgl-ctrl-scale",e.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(e){this._language=e,this._update()}setUnit(e){this.options.unit=e,this._update()}},FullscreenControl:class{constructor(e={}){this._fullscreen=!1,e&&e.container&&(e.container instanceof HTMLElement?this._container=e.container:Tt("Full screen control 'container' must be a DOM element.")),bt(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=ri("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",Tt("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){const e=this._fullscreenButton=ri("button","mapboxgl-ctrl-fullscreen",this._controlContainer);ri("span","mapboxgl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",e)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},IndoorControl:class{constructor(){bt(["_onIndoorUpdate","_onStyleData","_scrollUp","_scrollDown","_toggleIndoor"],this),this._visibleFloorStart=0,this._lastSelectedFloorId=null}onAdd(e){return this._map=e,this._container=ri("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.style.display="none",this._map.on("styledata",this._onStyleData),this._map.on("idle",this._onStyleData),this._updateConnection(),this._container}_onStyleData(){this._updateConnection()}_updateConnection(){if(this._map&&this._map.style&&this._map.style.indoorManager){const e=this._map.style.indoorManager;e.off("selector-update",this._onIndoorUpdate),e.on("selector-update",this._onIndoorUpdate),this._onIndoorUpdate(e.getControlState()),this._map.off("idle",this._onStyleData)}}_createButton(e,t){const i=ri("button",e,this._container);return i.type="button",i.addEventListener("click",t),i}_setButtonTitle(e,t){e.setAttribute("aria-label",t),e.textContent=t}onRemove(){this._container&&this._container.remove(),this._map&&(this._map.off("styledata",this._onStyleData),this._map.off("idle",this._onStyleData),this._map.style&&this._map.style.indoorManager&&this._map.style.indoorManager.off("selector-update",this._onIndoorUpdate),this._map=null)}getDefaultPosition(){return"top-right"}_onIndoorUpdate(e){if(!e||!e.floors||0===e.floors.length)return this._model=e,void(this._container.style.display="none");const t=this._model;this._model=e,this._container.style.display="inline-block";const i=!t||t.floors.length!==e.floors.length||t.floors.some((t,i)=>t.id!==e.floors[i].id);if(i&&(this._visibleFloorStart=0,this._lastSelectedFloorId=null),e.selectedFloorId){if(e.selectedFloorId!==this._lastSelectedFloorId||i){const t=e.floors.findIndex(t=>t.id===e.selectedFloorId);if(-1!==t){const i=e.floors.length;let r,n;i<=5?(r=0,n=i-1):0===this._visibleFloorStart?(r=0,n=3):this._visibleFloorStart>=i-3?(r=i-3-1,n=i-1):(r=this._visibleFloorStart,n=this._visibleFloorStart+3-1),t<r?this._visibleFloorStart=t:t>n&&(this._visibleFloorStart=t-2)}}this._lastSelectedFloorId=e.selectedFloorId}this._render()}
vendor: 8,317 bytes, line 2
2_render(){if(!this._container||!this._model||!this._model.floors)return;this._container.innerHTML="";const e=this._createButton("mapboxgl-ctrl-indoor-toggle",this._toggleIndoor);ri("span","mapboxgl-ctrl-icon",e).setAttribute("aria-hidden","true"),this._model.activeFloorsVisible||e.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.appendChild(e);const t=this._model.floors,i=t.length;if(i<=5)return void t.forEach(e=>this._createFloorButton(e));const r=0===this._visibleFloorStart,n=this._visibleFloorStart>=i-3;if(r)this._createFloorButton(t[0]);else{const e=this._createButton("mapboxgl-ctrl-arrow-up",this._scrollUp);ri("span","mapboxgl-ctrl-icon",e).setAttribute("aria-hidden","true"),this._container.appendChild(e)}let o=[];if(o=r?t.slice(1,4):n?t.slice(this._visibleFloorStart-1,this._visibleFloorStart+3-1):t.slice(this._visibleFloorStart,this._visibleFloorStart+3),o.forEach(e=>this._createFloorButton(e)),n)this._createFloorButton(t[i-1]);else{const e=this._createButton("mapboxgl-ctrl-arrow-down",this._scrollDown);ri("span","mapboxgl-ctrl-icon",e).setAttribute("aria-hidden","true"),this._container.appendChild(e)}}_createFloorButton(e){const t=this._createButton("mapboxgl-ctrl-level-button",()=>{const t=e.id;this._model&&this._model.selectedFloorId===t&&this._model.activeFloorsVisible||this._map&&(this._model&&!this._model.activeFloorsVisible&&this._map.style&&this._map.style.indoorManager&&this._map.style.indoorManager.setActiveFloorsVisibility(!0),this._map._selectIndoorFloor(t))}),i=(e.name||"").trim(),r=e.zIndex.toString(),n=i?Array.from(i).slice(0,3).join(""):r;this._setButtonTitle(t,n),this._model&&this._model.activeFloorsVisible&&e.id===this._model.selectedFloorId&&t.classList.add("mapboxgl-ctrl-level-button-selected"),this._container&&this._container.appendChild(t)}_toggleIndoor(){this._map&&this._map.style&&this._map.style.indoorManager&&this._model&&this._model.activeFloorsVisible&&this._map.style.indoorManager.setActiveFloorsVisibility(!1)}_scrollUp(){if(this._visibleFloorStart>0){this._visibleFloorStart--,1===this._visibleFloorStart&&(this._visibleFloorStart=0);const e=this._model&&this._model.floors||[];if(e.length>3){const t=e.length-3;this._visibleFloorStart===t-1&&(this._visibleFloorStart=t-2)}this._render()}}_scrollDown(){if(this._model&&this._model.floors){const e=this._model.floors.length-3;this._visibleFloorStart<e&&(this._visibleFloorStart++,1===this._visibleFloorStart&&(this._visibleFloorStart=2),this._visibleFloorStart===e-1&&(this._visibleFloorStart=e),this._visibleFloorStart>e&&(this._visibleFloorStart=e),this._render())}}},Popup:class extends Nr{constructor(e){super(),this.options=Object.assign(Object.create(WF),e),this._altitude=this.options.altitude,bt(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(e&&e.className?e.className.trim().split($F):[])}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&e.on("preclick",this._onClose),this.options.closeOnMove&&e.on("move",this._onClose),e.on("remove",this.remove),this._update(),e._addPopup(this),this._focusFirstElement(),this._trackPointer?(e.on("mousemove",this._onMouseEvent),e.on("mouseup",this._onMouseEvent),e._canvasContainer.classList.add("mapboxgl-track-pointer")):e.on("move",this._update),this.fire(new Or("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const e=this._map;return e&&(e.off("move",this._update),e.off("move",this._onClose),e.off("preclick",this._onClose),e.off("click",this._onClose),e.off("remove",this.remove),e.off("mousemove",this._onMouseEvent),e.off("mouseup",this._onMouseEvent),e.off("drag",this._onMouseEvent),e._canvasContainer&&e._canvasContainer.classList.remove("mapboxgl-track-pointer"),e._removePopup(this),this._map=void 0),this.fire(new Or("close")),this}getLngLat(){return this._lngLat}setLngLat(e){this._lngLat=kc.convert(e),this._pos=null,this._trackPointer=!1,this._update();const t=this._map;return t&&(t.on("move",this._update),t.off("mousemove",this._onMouseEvent),t._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}getAltitude(){return this._altitude}setAltitude(e){return this._altitude=e,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const e=this._map;return e&&(e.off("move",this._update),e.on("mousemove",this._onMouseEvent),e.on("drag",this._onMouseEvent),e._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){const t=document.createDocumentFragment(),i=document.createElement("body");let r;for(i.innerHTML=e;r=i.firstChild,r;)t.appendChild(r);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){let t=this._content;if(t)for(;t.hasChildNodes();)t.firstChild&&t.removeChild(t.firstChild);else t=this._content=ri("div","mapboxgl-popup-content",this._container||void 0);if(t.appendChild(e),this.options.closeButton){const e=this._closeButton=ri("button","mapboxgl-popup-close-button",t);e.type="button",e.setAttribute("aria-label","Close popup"),e.innerHTML='<span aria-hidden="true">&#215;</span>',e.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(e){return this._classList.add(e),this._updateClassList(),this}removeClassName(e){return this._classList.delete(e),this._updateClassList(),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){let t;return this._classList.delete(e)?t=!1:(this._classList.add(e),t=!0),this._updateClassList(),t}_onMouseEvent(e){this._update(e.point)}_getAnchor(e){if(this.options.anchor)return this.options.anchor;const t=this._map,i=this._container,r=this._pos;if(!t||!i||!r)return"bottom";const n=i.offsetWidth,o=i.offsetHeight,a=r.x<n/2,s=r.x>t.transform.width-n/2;if(r.y+e<o)return a?"top-left":s?"top-right":"top";if(r.y>t.transform.height-o){if(a)return"bottom-left";if(s)return"bottom-right"}return a?"left":s?"right":"bottom"}_updateClassList(){const e=this._container;if(!e)return;const t=[...this._classList];t.push("mapboxgl-popup"),this._anchor&&t.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&t.push("mapboxgl-popup-track-pointer"),e.className=t.join(" ")}_update(e){const t=this._map,i=this._content;if(!t||!this._lngLat&&!this._trackPointer||!i)return;let r=this._container;if(r||(r=this._container=ri("div","mapboxgl-popup",t.getContainer()),this._tip=ri("div","mapboxgl-popup-tip",r),r.appendChild(i)),this.options.maxWidth&&r.style.maxWidth!==this.options.maxWidth&&(r.style.maxWidth=this.options.maxWidth),t.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=LF(this._lngLat,this._pos,t.transform)),!this._trackPointer||e){const i=this._pos=this._trackPointer&&e instanceof ke?e:t.project(this._lngLat,this._altitude),r=ZF(this.options.offset),n=this._anchor=this._getAnchor(r.y),o=ZF(this.options.offset,n),a=i.add(o).round();t._requestDomTask(()=>{this._container&&n&&(this._container.style.transform=`${FF[n]} translate(${a.x}px,${a.y}px)`)})}if(!this._marker&&t._showingGlobe()){const e=wf(t.transform,this._lngLat)?0:1;this._setOpacity(e)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const e=this._container.querySelector(qF);e&&e.focus()}_onClose(){this.remove()}_setOpacity(e){this._container&&(this._container.style.opacity=`${e}`),this._content&&(this._content.style.pointerEvents=e?"auto":"none")}},Marker:kF,Style:bz,LngLat:kc,LngLatBounds:Vc,Point:ke,MercatorCoordinate:Zc,FreeCameraOptions:ww,Evented:Nr,config:gi,prewarm:function(){lR().acquire(cT)},clearPrewarmedResources:function(){const e=sR;e&&(e.isPreloaded()&&1===e.numActive()?(e.release(cT),sR=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()"))},get accessToken(){return gi.ACCESS_TOKEN},set accessToken(e){!function(e){gi.ACCESS_TOKEN=e}(e)},get baseApiUrl(){return gi.API_URL}
2,set baseApiUrl(e){!function(e){gi.API_URL=e}(e)},get workerCount(){return uT.workerCount},set workerCount(e){!function(e){uT.workerCount=e}(e)},get maxParallelImageRequests(){return gi.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(e){!function(e){gi.MAX_PARALLEL_IMAGE_REQUESTS=e}(e)},clearStorage(e){!function(e){const t=Di();if(!t)return;const i=t.delete(Ei);e&&i.then(()=>e()).catch(e)}(e)},get workerUrl(){return sT.workerUrl},set workerUrl(e){sT.workerUrl=e},get workerClass(){return sT.workerClass},set workerClass(e){sT.workerClass=e},get dracoUrl(){return yi()},set dracoUrl(e){!function(e){gi.DRACO_URL=ei.resolveURL(e)}(e)},get meshoptUrl(){return xi()},set meshoptUrl(e){!function(e){const t=ei.resolveURL(e);gi.MESHOPT_URL=t,gi.MESHOPT_SIMD_URL=t}(e)},get buildingGenUrl(){return vi()},set buildingGenUrl(e){!function(e){gi.BUILDING_GEN_URL=ei.resolveURL(e)}(e)},setNow:ei.setNow,restoreNow:ei.restoreNow};return KF},e.exports=t()}}]);
3//# sourceMappingURL=4032-296f4d16baab6ce7248a.chunk.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.