(globalThis.TURBOPACK_remote_chunk_loading_global_prj_Ea8QNpCs22Ye85AIRZ6hT1aa8n7z||(globalThis.TURBOPACK_remote_chunk_loading_global_prj_Ea8QNpCs22Ye85AIRZ6hT1aa8n7z=[])).push(["object"==typeof document?document.currentScript:void 0,71725,(e,i,r)=>{e.e,i.exports=function(){"use strict";var e,i,r;function a(a,n){if(e)if(i){var o="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+e+")(sharedChunk); ("+i+")(sharedChunk); self.onerror = null;",s={};e(s),r=n(s),"u">typeof window&&window&&window.URL&&window.URL.createObjectURL&&(r.workerUrl=window.URL.createObjectURL(new Blob([o],{type:"text/javascript"})))}else i=n;else e=n}return a(["exports"],function(e){let i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,E,I,A,M,C,P,R,z,D,L,F,O,k,B,V,N,U,j,G,q,H,$;var Z="u">typeof Float32Array?Float32Array:Array;function W(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=r*o-n*a;return s?(e[0]=o*(s=1/s),e[1]=-a*s,e[2]=-n*s,e[3]=r*s,e):null}function X(){var e=new Z(9);return Z!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function Y(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=i[4],l=i[5],h=i[6],u=i[7],c=i[8];return e[0]=s*c-l*u,e[1]=n*u-a*c,e[2]=a*l-n*s,e[3]=l*h-o*c,e[4]=r*c-n*h,e[5]=n*o-r*l,e[6]=o*u-s*h,e[7]=a*h-r*u,e[8]=r*s-a*o,e}function K(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=i[4],h=i[5],u=i[6],c=i[7],d=i[8],p=r[0],f=r[1],m=r[2],_=r[3],g=r[4],y=r[5],x=r[6],v=r[7],b=r[8];return e[0]=p*a+f*s+m*u,e[1]=p*n+f*l+m*c,e[2]=p*o+f*h+m*d,e[3]=_*a+g*s+y*u,e[4]=_*n+g*l+y*c,e[5]=_*o+g*h+y*d,e[6]=x*a+v*s+b*u,e[7]=x*n+v*l+b*c,e[8]=x*o+v*h+b*d,e}function J(){var e=new Z(16);return Z!=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 Q(e){var i=new Z(16);return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i}function ee(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 et(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=i[4],l=i[5],h=i[6],u=i[7],c=i[8],d=i[9],p=i[10],f=i[11],m=i[12],_=i[13],g=i[14],y=i[15],x=r*l-a*s,v=r*h-n*s,b=r*u-o*s,w=a*h-n*l,T=a*u-o*l,S=n*u-o*h,E=c*_-d*m,I=c*g-p*m,A=c*y-f*m,M=d*g-p*_,C=d*y-f*_,P=p*y-f*g,R=x*P-v*C+b*M+w*A-T*I+S*E;return R?(e[0]=(l*P-h*C+u*M)*(R=1/R),e[1]=(n*C-a*P-o*M)*R,e[2]=(_*S-g*T+y*w)*R,e[3]=(p*T-d*S-f*w)*R,e[4]=(h*A-s*P-u*I)*R,e[5]=(r*P-n*A+o*I)*R,e[6]=(g*b-m*S-y*v)*R,e[7]=(c*S-p*b+f*v)*R,e[8]=(s*C-l*A+u*E)*R,e[9]=(a*A-r*C-o*E)*R,e[10]=(m*T-_*b+y*x)*R,e[11]=(d*b-c*T-f*x)*R,e[12]=(l*I-s*M-h*E)*R,e[13]=(r*M-a*I+n*E)*R,e[14]=(_*v-m*w-g*x)*R,e[15]=(c*w-d*v+p*x)*R,e):null}function ei(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=i[4],h=i[5],u=i[6],c=i[7],d=i[8],p=i[9],f=i[10],m=i[11],_=i[12],g=i[13],y=i[14],x=i[15],v=r[0],b=r[1],w=r[2],T=r[3];return e[0]=v*a+b*l+w*d+T*_,e[1]=v*n+b*h+w*p+T*g,e[2]=v*o+b*u+w*f+T*y,e[3]=v*s+b*c+w*m+T*x,e[4]=(v=r[4])*a+(b=r[5])*l+(w=r[6])*d+(T=r[7])*_,e[5]=v*n+b*h+w*p+T*g,e[6]=v*o+b*u+w*f+T*y,e[7]=v*s+b*c+w*m+T*x,e[8]=(v=r[8])*a+(b=r[9])*l+(w=r[10])*d+(T=r[11])*_,e[9]=v*n+b*h+w*p+T*g,e[10]=v*o+b*u+w*f+T*y,e[11]=v*s+b*c+w*m+T*x,e[12]=(v=r[12])*a+(b=r[13])*l+(w=r[14])*d+(T=r[15])*_,e[13]=v*n+b*h+w*p+T*g,e[14]=v*o+b*u+w*f+T*y,e[15]=v*s+b*c+w*m+T*x,e}function er(e,i,r){var a,n,o,s,l,h,u,c,d,p,f,m,_=r[0],g=r[1],y=r[2];return i===e?(e[12]=i[0]*_+i[4]*g+i[8]*y+i[12],e[13]=i[1]*_+i[5]*g+i[9]*y+i[13],e[14]=i[2]*_+i[6]*g+i[10]*y+i[14],e[15]=i[3]*_+i[7]*g+i[11]*y+i[15]):(n=i[1],o=i[2],s=i[3],l=i[4],h=i[5],u=i[6],c=i[7],d=i[8],p=i[9],f=i[10],m=i[11],e[0]=a=i[0],e[1]=n,e[2]=o,e[3]=s,e[4]=l,e[5]=h,e[6]=u,e[7]=c,e[8]=d,e[9]=p,e[10]=f,e[11]=m,e[12]=a*_+l*g+d*y+i[12],e[13]=n*_+h*g+p*y+i[13],e[14]=o*_+u*g+f*y+i[14],e[15]=s*_+c*g+m*y+i[15]),e}function ea(e,i,r){var a=r[0],n=r[1],o=r[2];return e[0]=i[0]*a,e[1]=i[1]*a,e[2]=i[2]*a,e[3]=i[3]*a,e[4]=i[4]*n,e[5]=i[5]*n,e[6]=i[6]*n,e[7]=i[7]*n,e[8]=i[8]*o,e[9]=i[9]*o,e[10]=i[10]*o,e[11]=i[11]*o,e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e}function en(e,i,r){var a=Math.sin(r),n=Math.cos(r),o=i[4],s=i[5],l=i[6],h=i[7],u=i[8],c=i[9],d=i[10],p=i[11];return i!==e&&(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15]),e[4]=o*n+u*a,e[5]=s*n+c*a,e[6]=l*n+d*a,e[7]=h*n+p*a,e[8]=u*n-o*a,e[9]=c*n-s*a,e[10]=d*n-l*a,e[11]=p*n-h*a,e}function eo(e,i,r){var a=Math.sin(r),n=Math.cos(r),o=i[0],s=i[1],l=i[2],h=i[3],u=i[8],c=i[9],d=i[10],p=i[11];return i!==e&&(e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15]),e[0]=o*n-u*a,e[1]=s*n-c*a,e[2]=l*n-d*a,e[3]=h*n-p*a,e[8]=o*a+u*n,e[9]=s*a+c*n,e[10]=l*a+d*n,e[11]=h*a+p*n,e}function es(e,i,r){var a=Math.sin(r),n=Math.cos(r),o=i[0],s=i[1],l=i[2],h=i[3],u=i[4],c=i[5],d=i[6],p=i[7];return i!==e&&(e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15]),e[0]=o*n+u*a,e[1]=s*n+c*a,e[2]=l*n+d*a,e[3]=h*n+p*a,e[4]=u*n-o*a,e[5]=c*n-s*a,e[6]=d*n-l*a,e[7]=p*n-h*a,e}function el(e,i){return e[0]=i[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=i[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function eh(e,i,r){var a,n,o,s=r[0],l=r[1],h=r[2],u=Math.sqrt(s*s+l*l+h*h);return u0&&(o=1/Math.sqrt(o)),e[0]=i[0]*o,e[1]=i[1]*o,e[2]=i[2]*o,e}function eC(e,i){return e[0]*i[0]+e[1]*i[1]+e[2]*i[2]}function eP(e,i,r){var a=i[0],n=i[1],o=i[2],s=r[0],l=r[1],h=r[2];return e[0]=n*h-o*l,e[1]=o*s-a*h,e[2]=a*l-n*s,e}function eR(e,i,r,a){var n=i[0],o=i[1],s=i[2];return e[0]=n+a*(r[0]-n),e[1]=o+a*(r[1]-o),e[2]=s+a*(r[2]-s),e}function ez(e,i,r){var a=i[0],n=i[1],o=i[2],s=r[3]*a+r[7]*n+r[11]*o+r[15];return e[0]=(r[0]*a+r[4]*n+r[8]*o+r[12])/(s=s||1),e[1]=(r[1]*a+r[5]*n+r[9]*o+r[13])/s,e[2]=(r[2]*a+r[6]*n+r[10]*o+r[14])/s,e}function eD(e,i,r){var a=i[0],n=i[1],o=i[2];return e[0]=a*r[0]+n*r[3]+o*r[6],e[1]=a*r[1]+n*r[4]+o*r[7],e[2]=a*r[2]+n*r[5]+o*r[8],e}function eL(e,i,r){var a=r[0],n=r[1],o=r[2],s=r[3],l=i[0],h=i[1],u=i[2],c=n*u-o*h,d=o*l-a*u,p=a*h-n*l;return e[0]=l+s*(c+=c)+n*(p+=p)-o*(d+=d),e[1]=h+s*d+o*c-a*p,e[2]=u+s*p+a*d-n*c,e}function eF(e){return e[0]=0,e[1]=0,e[2]=0,e}function eO(e,i){return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]}function ek(){var e=new Z(4);return Z!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function eB(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e[3]=i[3]*r,e}function eV(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=r*r+a*a+n*n+o*o;return s>0&&(s=1/Math.sqrt(s)),e[0]=r*s,e[1]=a*s,e[2]=n*s,e[3]=o*s,e}function eN(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3];return e[0]=r[0]*a+r[4]*n+r[8]*o+r[12]*s,e[1]=r[1]*a+r[5]*n+r[9]*o+r[13]*s,e[2]=r[2]*a+r[6]*n+r[10]*o+r[14]*s,e[3]=r[3]*a+r[7]*n+r[11]*o+r[15]*s,e}function eU(){var e=new Z(4);return Z!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function ej(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function eG(e,i,r){r*=.5;var a=i[0],n=i[1],o=i[2],s=i[3],l=Math.sin(r),h=Math.cos(r);return e[0]=a*h+s*l,e[1]=n*h+o*l,e[2]=o*h-n*l,e[3]=s*h-a*l,e}function eq(e,i,r){r*=.5;var a=i[0],n=i[1],o=i[2],s=i[3],l=Math.sin(r),h=Math.cos(r);return e[0]=a*h-o*l,e[1]=n*h+s*l,e[2]=o*h+a*l,e[3]=s*h-n*l,e}ed(),ek();var eH,e$,eZ,eW=(eH=ed(),e$=em(1,0,0),eZ=em(0,1,0),function(e,i,r){var a,n,o=eC(i,r);return oef(eH)&&eP(eH,eZ,i),eM(eH,eH),n=Math.sin(a=.5*Math.PI),e[0]=n*eH[0],e[1]=n*eH[1],e[2]=n*eH[2],e[3]=Math.cos(a),e):o>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(eP(eH,i,r),e[0]=eH[0],e[1]=eH[1],e[2]=eH[2],e[3]=1+o,eV(e,e))});function eX(){var e=new Z(2);return Z!=Float32Array&&(e[0]=0,e[1]=0),e}function eY(e,i){var r=new Z(2);return r[0]=e,r[1]=i,r}function eK(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e}function eJ(e,i,r){return e[0]=i[0]-r[0],e[1]=i[1]-r[1],e}function eQ(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e}function e0(e){var i=e[0],r=e[1];return Math.sqrt(i*i+r*r)}function e1(e,i){var r=i[0],a=i[1],n=r*r+a*a;return n>0&&(n=1/Math.sqrt(n)),e[0]=i[0]*n,e[1]=i[1]*n,e}function e2(e,i){return e[0]*i[0]+e[1]*i[1]}function e3(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}eU(),eU(),X(),eX();var e5=e3(function(){if(t2)return t1;function e(e,i,r,a){this.cx=3*e,this.bx=3*(r-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(a-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=r,this.p2y=a}return t2=1,t1=e,e.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,i){if(void 0===i&&(i=1e-6),e1)return 1;for(var r=e,a=0;aMath.abs(o))break;r-=n/o}var s=0,l=1;for(r=e,a=0;an?s=r:l=r,r=.5*(l-s)+s;return r},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},t1}());function e4(e,i){this.x=e,this.y=i}function e6(e,i){if(Array.isArray(e)){if(!Array.isArray(i)||e.length!==i.length)return!1;for(let r=0;r=1)return 1;let i=e*e,r=i*e;return 4*(e<.5 tt n="new" e5 function n.solve ti="tt(.25,.1,.25,1);function" tr math.min ta tn a="r-i,n=((e-i)%a+a)%a+i;return" to r>{i(e,(e,i)=>{e&&(o=e),n[s]=i,0==--a&&r(o,n)})})}let ts=1;function tl(){return ts++}function th(e){return e{i[e]&&(i[e]=i[e].bind(i))})}function tc(e,i,r){let a={};for(let r in e)a[r]=i.call(this,e[r],r,e);return a}function td(e,i,r){let a={};for(let r in e)i.call(this,e[r],r,e)&&(a[r]=e[r]);return a}function tp(e){return Array.isArray(e)?e.map(tp):"object"==typeof e&&e?tc(e,tp):e}function tf(e,i){for(let r=0;r=0)return!0;return!1}let tm={};function t_(e){tm[e]||("u">typeof console&&console.warn(e),tm[e]=!0)}function tg(e,i,r){return(r.y-e.y)*(i.x-e.x)>(i.y-e.y)*(r.x-e.x)}function ty([e,i,r]){let a=(i+90)*e8,n=r*e8;return{x:e*Math.cos(a)*Math.sin(n),y:e*Math.sin(a)*Math.sin(n),z:e*Math.cos(n),azimuthal:i,polar:r}}function tx(e){return("u">typeof self||void 0!==e)&&"u">typeof WorkerGlobalScope&&(void 0!==e?e:self)instanceof WorkerGlobalScope}function tv(e){let i={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(e,r,a,n)=>{let o=a||n;return i[r]=!o||o.toLowerCase(),""}),i["max-age"]){let e=parseInt(i["max-age"],10);isNaN(e)?delete i["max-age"]:i["max-age"]=e}return i}let tb=null;function tw(e,i){return[e[4*i],e[4*i+1],e[4*i+2],e[4*i+3]]}function tT(e,i,r,a){for(;i>1;e[n]>1;e[n]0?1/(1.001-e):1+e}function tI(e){return e>0?1-1/(1.001-e):-e}function tA(e,i,r){return(e-i.min)*(r.max-r.min)/(i.max-i.min)+r.min}let tM={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!tM.API_URL)return null;try{let e=new URL(tM.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:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MESHOPT_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",BUILDING_GEN_URL:"https://api.mapbox.com/mapbox-gl-js/building-gen/building_gen_v1.2.4.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function tC(e){return tM.API_URL_REGEX.test(e)}function tP(e){return tM.API_SPRITE_REGEX.test(e)}function tR(){return null==i&&(i=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof self.createImageBitmap),i}let tz={now:()=>void 0!==n?n:performance.now(),setNow(e){n=e},restoreNow(){n=void 0},frame(e){let i=requestAnimationFrame(e);return{cancel:()=>cancelAnimationFrame(i)}},getImageData(e,i=0){let{width:r,height:a}=e;o||(o=document.createElement("canvas"));let n=o.getContext("2d",{willReadFrequently:!0});if(!n)throw Error("failed to create canvas 2d context");return(r>o.width||a>o.height)&&(o.width=r,o.height=a),n.clearRect(-i,-i,r+2*i,a+2*i),n.drawImage(e,0,0,r,a),n.getImageData(-i,-i,r+2*i,a+2*i)},resolveURL:e=>(r||(r=document.createElement("a")),r.href=e,r.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(null==a&&(a=window.matchMedia("(prefers-reduced-motion: reduce)")),a.matches)},hasCanvasFingerprintNoise(){if(void 0!==s)return s;if(!tR())return s=!1,!1;let e=new OffscreenCanvas(85,1),i=e.getContext("2d",{willReadFrequently:!0}),r=0;for(let a=0;a0?`?${o}`:""}`}let tF="mapbox-tiles",tO=500,tk=50,tB=["language","worldview","jobid"];function tV(){try{return caches}catch(e){}}function tN(){let e=tV();e&&null==l&&(l=e.open(tF))}let tU=1/0,tj={supported:!1,testSupport:function(e){!tH&&tq&&(t$?tW(e):tG=e)}},tG,tq,tH=!1,t$=!1,tZ="u">typeof self?self:{};function tW(e){let i=e.createTexture();e.bindTexture(e.TEXTURE_2D,i);try{if(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,tq),e.isContextLost())return;tj.supported=!0}catch(e){}e.deleteTexture(i),tH=!0}tZ.document&&((tq=tZ.document.createElement("img")).onload=function(){tG&&tW(tG),tG=null,t$=!0},tq.onerror=function(){tH=!0,tG=null},tq.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");let tX={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"};Object.freeze(tX);class tY extends Error{constructor(e,i,r){401===i&&tC(r)&&(e+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(e),this.status=i,this.url=r}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}let tK=tx()?()=>self.worker.referrer:()=>("blob:"===location.protocol?parent:self).location.href,tJ=function(e,i){var r,a;let n,o,s,h,u,c,d;return/^file:/.test(r=e.url)||/^file:/.test(tK())&&!/^\w+:/.test(r)?function(e,i){let r=new XMLHttpRequest;for(let i in r.open(e.method||"GET",e.url,!0),"arrayBuffer"===e.type&&(r.responseType="arraybuffer"),e.headers)r.setRequestHeader(i,e.headers[i]);return"json"===e.type&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===e.credentials,r.onerror=()=>{i(Error(r.statusText))},r.onload=()=>{if((r.status>=200&&r.status{let i=e.split(": "),r=i.shift(),a=i.join(": ");n.append(r,a)}),i(null,a,n)}else i(new tY(r.statusText,r.status,e.url))},r.send(e.body),{cancel:()=>r.abort()}}(e,i):(n=new AbortController,o=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,referrer:tK(),referrerPolicy:e.referrerPolicy,signal:n.signal}),s=!1,h=!1,u=(a=o.url).indexOf("sku=")>0&&tC(a),"json"===e.type&&o.headers.set("Accept","application/json"),c=(r,a,n)=>{if(h)return;if(r&&"SecurityError"!==r.message&&t_(r.toString()),a&&n)return d(a);let s=Date.now();fetch(o).then(r=>{if(r.ok){let e=u?r.clone():null;return d(r,e,s)}return i(new tY(r.statusText,r.status,e.url))}).catch(r=>{"AbortError"!==r.name&&i(Error(`${r.message} ${e.url}`))})},d=(r,a,n)=>{("arrayBuffer"===e.type?r.arrayBuffer():"json"===e.type?r.json():r.text()).then(e=>{h||(a&&n&&function(e,i,r){var a;if(tN(),null==l)return;let n=tv(i.headers.get("cache-control")||"");if(n["no-store"])return;let o={status:i.status,statusText:i.statusText,headers:new Headers};i.headers.forEach((e,i)=>o.headers.set(i,e)),n["max-age"]&&o.headers.set("Expires",new Date(r+1e3*n["max-age"]).toUTCString());let s=o.headers.get("expires");if(!s||new Date(s).getTime()-re.put(h,u)).catch(e=>t_(e.message))}(o,a,n),s=!0,i(null,e,r.headers))}).catch(e=>{h||i(Error(e.message))})},u?function(e,i){if(tN(),null==l)return i(null);l.then(r=>{let a=tL(e.url,{persistentParams:tB}),n=e.headers.get("Range");n&&(a=tD(a,{range:n})),r.match(a).then(e=>{let n=function(e){if(!e)return!1;let i=new Date(e.headers.get("expires")||0),r=tv(e.headers.get("cache-control")||"");return Number(i)>Date.now()&&!r["no-cache"]}(e);r.delete(a).catch(i),n&&r.put(a,e.clone()).catch(i),i(null,e,n)}).catch(i)}).catch(i)}(o,c):c(null,null),{cancel:()=>{h=!0,s||n.abort()}})},tQ=function(e,i){return tJ(Object.assign(e,{type:"arrayBuffer"}),i)};h=[],u=0;let t0=function(e,i){if(tj.supported&&(e.headers||(e.headers={}),e.headers.accept="image/webp,*/*"),u>=tM.MAX_PARALLEL_IMAGE_REQUESTS){let r={requestParameters:e,callback:i,cancelled:!1,cancel(){this.cancelled=!0}};return h.push(r),r}u++;let r=!1,a=()=>{if(!r)for(r=!0,u--;h.length&&u{a(),e?i(e):r&&createImageBitmap(new Blob([new Uint8Array(r)],{type:"image/png"})).then(e=>{((e,r)=>i(e,r,n))(null,e)}).catch(e=>{((e,r)=>i(e,r,n))(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.`))})});return{cancel:()=>{n.cancel(),a()}}};var t1,t2,t3,t5,t4,t6={exports:{}},t8={exports:{}},t9={exports:{}},t7=e3(function(){if(t4)return t6.exports;t4=1;var e=(t3||(t3=1,t8.exports=function(e,i){var r,a,n,o,s,l;for(a=e.length-(r=3&e.length),n=i,l=0;l>>16)*0xcc9e2d51&65535)>>17))*0x1b873593+(((s>>>16)*0x1b873593&65535)>>19))+((5*(n>>>16)&65535)>>16)+58964&65535)>>16)*0xcc9e2d51&65535)>>17))*0x1b873593+(((s>>>16)*0x1b873593&65535)>>16))+((0x85ebca6b*(n>>>16)&65535)>>13))+((0xc2b2ae35*(n>>>16)&65535)>>16)>>>0}),t8.exports),i=(t5||(t5=1,t9.exports=function(e,i){for(var r,a=e.length,n=i^a,o=0;a>=4;)r=0x5bd1e995*(65535&(r=255&e.charCodeAt(o)|(255&e.charCodeAt(++o))>>16)&65535)>>16)&65535)>>24))+((0x5bd1e995*(r>>>16)&65535)>>16)&65535)>>13))+((0x5bd1e995*(n>>>16)&65535)>>15)>>>0}),t9.exports);return t6.exports=e,t6.exports.murmur3=e,t6.exports.murmur2=i,t6.exports}());class ie{constructor(e,...i){Object.assign(this,i[0]||{}),this.type=e}}class it extends ie{constructor(e,i={}){super("error",Object.assign({error:e},i))}}function ii(e,i,r){r[e]&&-1!==r[e].indexOf(i)||(r[e]=r[e]||[],r[e].push(i))}function ir(e,i,r){if(r&&r[e]){let a=r[e].indexOf(i);-1!==a&&r[e].splice(a,1)}}class ia{on(e,i){return this._listeners=this._listeners||{},ii(e,i,this._listeners),this}off(e,i){return ir(e,i,this._listeners),ir(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},ii(e,i,this._oneTimeListeners),this):new Promise(i=>{this.once(e,i)})}fire(e,i){let r="string"==typeof e?new ie(e,i):e,a=r.type;if(this.listens(a)){for(let e of(r.target=this,this._listeners&&this._listeners[a]?this._listeners[a].slice():[]))e.call(this,r);for(let e of this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[])ir(a,e,this._oneTimeListeners),e.call(this,r);let e=this._eventedParent;e&&(Object.assign(r,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),e.fire(r))}else r instanceof it&&console.error(r.error);return this}listens(e){return!!(this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}setEventedParent(e,i){return this._eventedParent=e,this._eventedParentData=i,this}}class io{constructor(e){"string"==typeof e?this.name=e:(this.name=e.name,this.iconsetId=e.iconsetId)}static from(e){return new io(e)}static toString(e){return e.iconsetId?`${e.name}${e.iconsetId}`:e.name}static parse(e){let[i,r]=e.split("\x1f");return new io({name:i,iconsetId:r})}static isEqual(e,i){return e.name===i.name&&e.iconsetId===i.iconsetId}toString(){return io.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var is,il={},ih=function(){if(is)return il;is=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 i(e){return(e=Math.round(e))255?255:e}function r(e){return i("%"===e[e.length-1]?parseFloat(e)/100*255:parseInt(e))}function a(e){var i;return(i="%"===e[e.length-1]?parseFloat(e)/100:parseFloat(e))1?1:i}function n(e,i,r){return r1&&(r-=1),6*r=0&&s>4|(3840&s)>>8,240&s|(240&s)>>4,15&s|(15&s)=0&&s>16,(65280&s)>>8,255&s,1]:null;var h=l.indexOf("("),u=l.indexOf(")");if(-1!==h&&u+1===l.length){var c=l.substr(0,h),d=l.substr(h+1,u-(h+1)).split(","),p=1;switch(c){case"rgba":if(4!==d.length)break;p=a(d.pop());case"rgb":return 3!==d.length?null:[r(d[0]),r(d[1]),r(d[2]),p];case"hsla":if(4!==d.length)break;p=a(d.pop());case"hsl":if(3!==d.length)break;var f=(parseFloat(d[0])%360+360)%360/360,m=a(d[1]),_=a(d[2]),g=_.5?c/(2-u-h):c/(u+h)),100*d,n]}toArray01(){let{r:e,g:i,b:r,a:a}=this;return[e,i,r,a]}toArray01Scaled(e){let{r:i,g:r,b:a}=this;return[i*e,r*e,a*e]}toArray01Linear(){let{r:e,g:i,b:r,a:a}=this;return[Math.pow(e,2.2),Math.pow(i,2.2),Math.pow(r,2.2),a]}}class id extends ic{constructor(e,i,r,a,n){super(e,i,r,a,n,!1)}}class ip extends ic{constructor(e,i,r,a,n){super(e,i,r,a,n,!0)}}function im(e,i,r){return e*(1-r)+i*r}function i_(e,i,r){return e.map((e,a)=>im(e,i[a],r))}iu.black=new iu(0,0,0,1),iu.white=new iu(1,1,1,1),iu.transparent=new iu(0,0,0,0),iu.red=new iu(1,0,0,1),iu.blue=new iu(0,0,1,1);var ig=Object.freeze({__proto__:null,array:i_,color:function(e,i,r){return new iu(im(e.r,i.r,r),im(e.g,i.g,r),im(e.b,i.b,r),im(e.a,i.a,r))},number:im});class iy extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class ix{constructor(e,i=[]){for(const[r,a]of(this.parent=e,this.bindings={},i))this.bindings[r]=a}concat(e){return new ix(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}let iv={kind:"null"},ib={kind:"number"},iw={kind:"string"},iT={kind:"boolean"},iS={kind:"color"},iE={kind:"object"},iI={kind:"value"},iA={kind:"collator"},iM={kind:"formatted"},iC={kind:"resolvedImage"};function iP(e,i){return{kind:"array",itemType:e,N:i}}function iR(e){if("array"===e.kind){let i=iR(e.itemType);return"number"==typeof e.N?`array`:"value"===e.itemType.kind?"array":`array`}return e.kind}let iz=[iv,ib,iw,iT,iS,iM,iE,iP(iI),iC];function iD(e,i){if("error"===i.kind)return null;if("array"===e.kind){if("array"===i.kind&&(0===i.N&&"value"===i.itemType.kind||!iD(e.itemType,i.itemType))&&("number"!=typeof e.N||e.N===i.N))return null}else{if(e.kind===i.kind)return null;if("value"===e.kind){for(let e of iz)if(!iD(e,i))return null}}return`Expected ${iR(e)} but found ${iR(i)} instead.`}function iL(e,i){return i.some(i=>i.kind===e.kind)}function iF(e,i){return i.some(i=>"null"===i?null===e:"array"===i?Array.isArray(e):"object"===i?e&&!Array.isArray(e)&&"object"==typeof e:i===typeof e)}function iO(e,i){return"array"===e.kind&&"array"===i.kind?e.N===i.N&&iO(e.itemType,i.itemType):e.kind===i.kind}class ik{constructor(e,i,r){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,i){return this.collator.compare(e,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class iB{constructor(e,i,r,a,n){this.text=e.normalize?e.normalize():e,this.image=i,this.scale=r,this.fontStack=a,this.textColor=n}}class iV{constructor(e){this.sections=e}static fromString(e){return new iV([new iB(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 iV?e:iV.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map(e=>e.text).join("")}serialize(){let e=["format"];for(let i of this.sections){if(i.image){let r=i.image.getPrimary().id.toString();e.push(["image",r]);continue}e.push(i.text);let r={};i.fontStack&&(r["text-font"]=["literal",i.fontStack.split(",")]),i.scale&&(r["font-scale"]=i.scale),i.textColor&&(r["text-color"]=["rgba"].concat(i.textColor.toNonPremultipliedRenderColor(null).toArray())),e.push(r)}return e}}class iN{constructor(e,i={}){this.id=io.from(e),this.params=i.params,this.sx=i.sx||1,this.sy=i.sy||1}toString(){return JSON.stringify(this)}static parse(e){let i,r,a,n;try{({id:i,params:r,sx:a,sy:n}=JSON.parse(e)||{})}catch(e){return null}return i?new iN(i,{params:r,sx:a,sy:n}):null}scaleSelf(e,i=e){return this.sx*=e,this.sy*=i,this}}class iU{constructor(e,i,r,a,n=!1){this.primaryId=io.from(e),this.primaryOptions=i,r&&(this.secondaryId=io.from(r)),this.secondaryOptions=a,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 iN(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new iN(this.secondaryId,this.secondaryOptions):null}static from(e){return"string"==typeof e?iU.build({name:e}):e}static build(e,i,r,a){return e&&("object"!=typeof e||"name"in e)?new iU(e,r,i,a):null}}function ij(e,i,r,a){return"number"==typeof e&&e>=0&&e=0&&i=0&&r=0&&a2){let r=e[1];if("string"!=typeof r||!(r in iW)||"object"===r)return i.error('The item type argument of "array" must be one of string, number, boolean',1);n=iW[r],a++}else n=iI;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]e.outputDefined())}serialize(){let e=this.type,i=[e.kind];if("array"===e.kind){let r=e.itemType;if("string"===r.kind||"number"===r.kind||"boolean"===r.kind){i.push(r.kind);let a=e.N;("number"==typeof a||this.args.length>1)&&i.push(a)}}return i.concat(this.args.map(e=>e.serialize()))}}class iY{constructor(e){this.type=iM,this.sections=e}static parse(e,i){if(e.length{let r=i.content.evaluate(e);return iO(iq(r),iC)?new iB("",r,null,null,null):new iB(iH(r),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null)}))}eachChild(e){for(let i of this.sections)e(i.content),i.scale&&e(i.scale),i.font&&e(i.font),i.textColor&&e(i.textColor)}outputDefined(){return!1}serialize(){let e=["format"];for(let i of this.sections){e.push(i.content.serialize());let r={};i.scale&&(r["font-scale"]=i.scale.serialize()),i.font&&(r["text-font"]=i.font.serialize()),i.textColor&&(r["text-color"]=i.textColor.serialize()),e.push(r)}return e}}class iK{constructor(e,i,r,a){this._imageWarnHistory={},this.type=iC,this.namePrimary=e,this.nameSecondary=i,r&&(this.paramsPrimary=r.params,this.iconsetIdPrimary=r.iconset?r.iconset.id:void 0),a&&(this.paramsSecondary=a.params,this.iconsetIdSecondary=a.iconset?a.iconset.id:void 0)}static parse(e,i){if(e.lengthio.isEqual(e,i)),a.available){let i=a.getSecondary()?a.getSecondary().id:null;i&&(a.available=e.availableImages.some(e=>io.isEqual(e,i)))}}return a}eachChild(e){if(e(this.namePrimary),this.paramsPrimary)for(let i in this.paramsPrimary)this.paramsPrimary[i]&&e(this.paramsPrimary[i]);if(this.nameSecondary&&(e(this.nameSecondary),this.paramsSecondary))for(let i in this.paramsSecondary)this.paramsSecondary[i]&&e(this.paramsSecondary[i])}outputDefined(){return!1}serializeOptions(e,i){let r={};if(i&&(r.iconset={id:i}),e)for(let i in r.params={},e)e[i]&&(r.params[i]=e[i].serialize());return Object.keys(r).length>0?r:void 0}serialize(){let e=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){let i=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);i&&e.push(i)}if(this.nameSecondary&&(e.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){let i=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);i&&e.push(i)}return e}}function iJ(e){return i0(e)?"string":i1(e)?"number":i2(e)?"boolean":Array.isArray(e)?"array":null===e?"null":iQ(e)?"object":typeof e}function iQ(e){return null!=e&&!Array.isArray(e)&&"function"!=typeof e&&!(e instanceof String||e instanceof Number||e instanceof Boolean)&&"object"==typeof e}function i0(e){return"string"==typeof e||e instanceof String}function i1(e){return"number"==typeof e||e instanceof Number}function i2(e){return"boolean"==typeof e||e instanceof Boolean}let i3={"to-boolean":iT,"to-color":iS,"to-number":ib,"to-string":iw};class i5{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length0&&iG(e[1][0])))return null;n=iP(iq(e[1][0]),r)}for(let o=0;o4?`Invalid rbga value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:ij(i[0],i[1],i[2],i[3])))return new iu(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new iZ(r||`Could not parse color from value '${"string"==typeof i?i:String(JSON.stringify(i))}'`)}if("number"===this.type.kind){let i=null;for(let r of this.args){if(null===(i=r.evaluate(e)))return 0;let a=Number(i);if(!isNaN(a))return a}throw new iZ(`Could not convert ${JSON.stringify(i)} to number.`)}return"formatted"===this.type.kind?iV.fromString(iH(this.args[0].evaluate(e))):"resolvedImage"===this.type.kind?iU.build(iH(this.args[0].evaluate(e))):"array"===this.type.kind?this.args.map(i=>i.evaluate(e)):iH(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 iY([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new iK(this.args[0]).serialize();let e="array"===this.type.kind?[]:[`to-${this.type.kind}`];return this.eachChild(i=>{e.push(i.serialize())}),e}}let i4=["Unknown","Point","LineString","Polygon"];class i6{constructor(e,i,r){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=e,this.options=i,this.iconImageUseTheme=r}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?i4[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){let e=this.featureDistanceData.center,i=this.featureDistanceData.scale,{x:r,y:a}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(r*i-e[0])+this.featureDistanceData.bearing[1]*(a*i-e[1])}return 0}parseColor(e){let i=this._parseColorCache[e];return i||(i=this._parseColorCache[e]=iu.parse(e)),i}getConfig(e){return this.options?this.options.get(e):null}}class i8{constructor(e,i,r,a,n){this.name=e,this.type=i,this._evaluate=r,this.args=a,this._overloadIndex=n}evaluate(e){if(!this._evaluate){let e=i8.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,i){let r=e[0],a=i8.definitions[r];if(!a)return i.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);let n=Array.isArray(a)?a[0]:a.type,o=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,s=[],l=null,h=-1;for(let[a,u]of o){if(Array.isArray(a)&&a.length!==e.length-1)continue;s.push(a),h++,l=new rX(i.registry,i.path,null,i.scope,void 0,i._scope,i.options,i.iconImageUseTheme);let o=[],c=!1;for(let i=1;ie)).map(i9).join(" | "),a=[];for(let r=1;r=i[2]||e[1]=i[3])}function rr(e,i,r=!1){let a=!1;for(let n=0,o=i.length;ne[1]!=l[1]>e[1]&&e[0]0&&l0}function rn(e,i,r,a){var n,o;return 0!=(n=[a[0]-r[0],a[1]-r[1]])[0]*(o=[i[0]-e[0],i[1]-e[1]])[1]-n[1]*o[0]&&!(!ra(e,i,r,a)||!ra(r,a,e,i))}function ro(e){let i=new e4(1/0,1/0),r=new e4(-1/0,-1/0);for(let a of e[0])i.x>a.x&&(i.x=a.x),i.y>a.y&&(i.y=a.y),r.xr[2]){let i=.5*a,n=e[0]-r[0]>i?-a:r[0]-e[0]>i?a:0;0===n&&(n=e[0]-r[2]>i?-a:r[2]-e[0]>i?a:0),e[0]+=n}rt(i,e)}function rc(e,i,r,a){let n=8192*Math.pow(2,a.z),o=[8192*a.x,8192*a.y],s=[];if(!e)return s;for(let a of e)for(let e of a){let a=[e.x+o[0],e.y+o[1]];ru(a,i,r,n),s.push(a)}return s}function rd(e,i,r,a){let n=8192*Math.pow(2,a.z),o=[8192*a.x,8192*a.y],s=[];if(!e)return s;for(let r of e){let e=[];for(let a of r){let r=[a.x+o[0],a.y+o[1]];rt(i,r),e.push(r)}s.push(e)}if(i[2]-i[0]i)return rx(n,o,(i-(r-s))/s)}return e[e.length-1]}pointToSegmentDistance(e,i,r){let[a,n]=i,o=rv(r[0]-a)*this.kx,s=(r[1]-n)*this.ky;if(0!==o||0!==s){let i=(rv(e[0]-a)*this.kx*o+(e[1]-n)*this.ky*s)/(o*o+s*s);i>1?(a=r[0],n=r[1]):i>0&&(a+=o/this.kx*i,n+=s/this.ky*i)}return Math.sqrt((o=rv(e[0]-a)*this.kx)*o+(s=(e[1]-n)*this.ky)*s)}pointOnLine(e,i){let r=1/0,a=e[0][0],n=e[0][1],o=0,s=0;for(let l=0;l1?(h=e[l+1][0],u=e[l+1][1]):p>0&&(h+=c/this.kx*p,u+=d/this.ky*p));let f=(c=rv(i[0]-h)*this.kx)*c+(d=(i[1]-u)*this.ky)*d;fn.index||a.index===n.index&&a.t>n.t){let e=a;a=n,n=e}let o=[a.point],s=a.index+1,l=n.index;!ry(r[s],o[0])&&se&&0===n.length&&n.push(rx(s,l,(e-(a-h))/h)),a>=i)return n.push(rx(s,l,(i-(a-h))/h)),n;a>e&&n.push(l)}return n}bufferPoint(e,i){let r=i/this.ky,a=i/this.kx;return[e[0]-a,e[1]-r,e[0]+a,e[1]+r]}bufferBBox(e,i){let r=i/this.ky,a=i/this.kx;return[e[0]-a,e[1]-r,e[2]+a,e[3]+r]}insideBBox(e,i){return rv(e[0]-i[0])>=0&&0>=rv(e[0]-i[2])&&e[1]>=i[1]&&e[1]180;)e-=360;return e}class rb{constructor(e=[],i=(e,i)=>ei)){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;let e=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:i,compare:r}=this,a=i[e];for(;e>0;){let n=e-1>>1,o=i[n];if(r(a,o)>=0)break;i[e]=o,e=n}i[e]=a}_down(e){let{data:i,compare:r}=this,a=this.length>>1,n=i[e];for(;er(i[o],i[a])&&(a=o),r(i[a],n)>=0)break;i[e]=i[a],e=a}i[e]=n}}function rw(e,i){return i.dist-e.dist}function rT(e){let i=[1/0,1/0,-1/0,-1/0];if(i.length!==e.length)return!1;for(let r=0;r=e[0]&&e[1]e[1])return[null,null];let r=rS(e);if(i){if(2===r)return[e,null];let i=Math.floor(r/2);return[[e[0],e[0]+i],[e[0]+i,e[1]]]}{if(1===r)return[e,null];let i=Math.floor(r/2)-1;return[[e[0],e[0]+i],[e[0]+i+1,e[1]]]}}function rA(e,i){let r=[1/0,1/0,-1/0,-1/0];if(!rE(i,e.length))return r;for(let a=i[0];ai[2]&&(a=e[0]-i[2]),e[1]>i[3]&&(n=e[1]-i[3]),e[3]=s)continue;let c=o.range1,d=o.range2;if(rS(c)=o)&&0===(o=Math.min(o,rO(e,i,n,!0,a,o))))break;return o}function rB(e,i,r,a,n=1/0){let o=n,s=rA(e,[0,e.length-1]);for(let n of r){if(o!==1/0&&rC(s,rM(n),a)>=o)continue;let r=function(e,i,r,a,n=1/0){let o=Math.min(a.distance(e[0],r[0][0]),n);if(0===o)return o;let s=new rb([{dist:0,range1:[0,e.length-1],range2:[0,0]}],rw),l=i?50:100,h=rM(r);for(;s.length;){let n=s.pop();if(n.dist>=o)continue;let u=n.range1;if(rS(u)=a)return a;if(ri(n,o)){if(rL(e,i))return 0}else if(rL(i,e))return 0;let s=a;for(let a of e)for(let e=0,n=a.length,o=n-1;e{i&&!rU(e)&&(i=!1)}),i}function rj(e){if(e instanceof i8&&"feature-state"===e.name)return!1;let i=!0;return e.eachChild(e=>{i&&!rj(e)&&(i=!1)}),i}function rG(e,i){if(e instanceof i8&&i.indexOf(e.name)>=0)return!1;let r=!0;return e.eachChild(e=>{r&&!rG(e,i)&&(r=!1)}),r}function rq(e,i,r){return[e,i,r].filter(Boolean).join("\x1f")}function rH(e,i){switch(e){case"string":return iH(i);case"number":return+i;case"boolean":return!!i;case"color":return iu.parse(i);case"formatted":return iV.fromString(iH(i));case"resolvedImage":return iU.build(iH(i))}return i}function r$(e,i,r,a){return void 0!==a&&(e=a*Math.round(e/a)),void 0!==i&&er&&(e=r),e}class rZ{constructor(e,i,r,a=!1){this.type=e,this.key=i,this.scope=r,this.featureConstant=a}static parse(e,i){let r=i.expectedType;if(null==r&&(r=iI),e.length3)return i.error("Invalid number of arguments for 'config' expression.");let a=i.parse(e[1],1);if(!(a instanceof i$))return i.error("Key name of 'config' expression must be a string literal.");let n,o=!0,s=iH(a.value);if(e.length>=3){let r=i.parse(e[2],2);if(!(r instanceof i$))return i.error("Scope of 'config' expression must be a string literal.");n=iH(r.value)}if(i.options){let e=rq(s,n,i._scope),r=i.options.get(e);r&&(o=rU(r.value||r.default))}return new rZ(r,s,n,o)}evaluate(e){let i=rq(this.key,this.scope,e.scope),r=e.getConfig(i);if(!r)return null;let{type:a,value:n,values:o,minValue:s,maxValue:l,stepValue:h}=r,u=r.default.evaluate(e),c=u;if(n){let i=e.scope;e.scope=(i||"").split("\x1f").slice(1).join("\x1f"),c=n.evaluate(e),e.scope=i}return a&&(c=rH(a,c)),void 0===c||void 0===s&&void 0===l&&void 0===h||("number"==typeof c?c=r$(c,s,l,h):Array.isArray(c)&&(c=c.map(e=>"number"==typeof e?r$(e,s,l,h):e))),void 0!==n&&void 0!==c&&o&&!o.includes(c)&&(c=u,a&&(c=rH(a,c))),(a&&a!==this.type||void 0!==c&&!iO(iq(c),this.type))&&(c=rH(this.type.kind,c)),c}eachChild(){}outputDefined(){return!1}serialize(){let e=["config",this.key];return this.scope&&e.concat(this.scope),e}}class rW{constructor(e,i){this.type=i.type,this.name=e,this.boundExpression=i}static parse(e,i){if(2!==e.length||"string"!=typeof e[1])return i.error("'var' expression requires exactly one string literal argument.");let r=e[1];return i.scope.has(r)?new rW(r,i.scope.get(r)):i.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class rX{constructor(e,i=[],r,a=new ix,n=[],o,s,l){this.registry=e,this.path=i,this.key=i.map(e=>"string"==typeof e?`['${e}']`:`[${e}]`).join(""),this.scope=a,this.errors=n,this.expectedType=r,this._scope=o,this.options=s,this.iconImageUseTheme=l}parse(e,i,r,a,n={}){return i||r?this.concat(i,null,r,a)._parse(e,n):this._parse(e,n)}parseObjectValue(e,i,r,a,n,o={}){return this.concat(i,r,a,n)._parse(e,o)}_parse(e,i){function r(e,i,r){return"assert"===r?new iX(i,[e]):"coerce"===r?new i5(i,[e]):e}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", []].');let a="string"==typeof e[0]?this.registry[e[0]]:void 0;if(a){let n=a.parse(e,this);if(!n)return null;if(this.expectedType){let e=this.expectedType,a=n.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==a.kind)if("color"!==e.kind&&"formatted"!==e.kind&&"resolvedImage"!==e.kind||"value"!==a.kind&&"string"!==a.kind){if(this.checkSubtype(e,a))return null}else n=r(n,e,i.typeAnnotation||"coerce");else n=r(n,e,i.typeAnnotation||"assert")}if(!(n instanceof i$)&&"resolvedImage"!==n.type.kind&&function e(i){if(i instanceof rW)return e(i.boundExpression);if(i instanceof i8&&"error"===i.name||i instanceof i7||i instanceof rp||i instanceof rN||i instanceof rZ)return!1;let r=i instanceof i5||i instanceof iX,a=!0;return i.eachChild(i=>{a=r?a&&e(i):a&&i instanceof i$}),!!a&&rU(i)&&rG(i,["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"])}(n)){let e=new i6(this._scope,this.options,this.iconImageUseTheme);try{n=new i$(n.type,n.evaluate(e))}catch(e){return this.error(e.message),null}}return n}return i5.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,i,r,a){let n="number"==typeof e?this.path.concat(e):this.path;n="string"==typeof i?n.concat(i):n;let o=a?this.scope.concat(a):this.scope;return new rX(this.registry,n,r||null,o,this.errors,this._scope,this.options,this.iconImageUseTheme)}error(e,...i){let r=`${this.key}${i.map(e=>`[${e}]`).join("")}`;this.errors.push(new iy(r,e))}checkSubtype(e,i){let r=iD(e,i);return r&&this.error(r),r}}function rY(e,i){let r=e.length-1,a,n,o=0,s=r,l=0;for(;oi))throw new iZ("Input is not a number.");s=l-1}return 0}class rK{constructor(e,i,r){for(const[a,n]of(this.type=e,this.input=i,this.labels=[],this.outputs=[],r))this.labels.push(a),this.outputs.push(n)}static parse(e,i){if(e.length-1=o)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',l);let u=i.parse(s,h,n);if(!u)return null;n=n||u.type,a.push([o,u])}return new rK(n,r,a)}evaluate(e){let i=this.labels,r=this.outputs;if(1===i.length)return r[0].evaluate(e);let a=this.input.evaluate(e);if(a=i[n-1]?r[n-1].evaluate(e):r[rY(i,a)].evaluate(e)}eachChild(e){for(let i of(e(this.input),this.outputs))e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e=["step",this.input.serialize()];for(let i=0;i0&&e.push(this.labels[i]),e.push(this.outputs[i].serialize());return e}}let rJ=4/29,rQ=6/29,r0=6/29*3*(6/29),r1=6/29*(6/29)*(6/29),r2=Math.PI/180,r3=180/Math.PI;function r5(e){return e>r1?Math.pow(e,1/3):e/r0+rJ}function r4(e){return e>rQ?e*e*e:r0*(e-rJ)}function r6(e){return 255*(e180||o"number"!=typeof e||e1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);a={name:"cubic-bezier",controlPoints:e}}}if(e.length-13&&(e.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(!(n=i.parse(n,2,ib)))return null;let s=[],l=null;"interpolate-hcl"===r||"interpolate-lab"===r?l=iS:i.expectedType&&"value"!==i.expectedType.kind&&(l=i.expectedType);for(let e=0;e=r)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',n);let u=i.parse(a,h,l);if(!u)return null;l=l||u.type,s.push([r,u])}return"number"===l.kind||"color"===l.kind||"array"===l.kind&&"number"===l.itemType.kind&&"number"==typeof l.N?new ar(l,r,a,n,s):i.error(`Type ${iR(l)} is not interpolatable.`)}evaluate(e){let i=this.labels,r=this.outputs;if(1===i.length)return r[0].evaluate(e);let a=this.input.evaluate(e);if(a=i[n-1])return r[n-1].evaluate(e);let o=rY(i,a),s=ar.interpolationFactor(this.interpolation,a,i[o],i[o+1]),l=r[o].evaluate(e),h=r[o+1].evaluate(e);return"interpolate"===this.operator?ig[this.type.kind.toLowerCase()](l,h,s):"interpolate-hcl"===this.operator?at.reverse(at.interpolate(at.forward(l),at.forward(h),s)):ae.reverse(ae.interpolate(ae.forward(l),ae.forward(h),s))}eachChild(e){for(let i of(e(this.input),this.outputs))e(i)}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];let i=[this.operator,e,this.input.serialize()];for(let e=0;eiD(a,e.type))?iI:r,n)}evaluate(e){let i,r=null,a=0;for(let n of this.args){if(a++,(r=n.evaluate(e))&&r instanceof iU&&!r.available&&(i||(i=r),r=null,a===this.args.length))return i;if(null!==r)break}return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){let e=["coalesce"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class ao{constructor(e,i){this.type=i.type,this.bindings=[].concat(e),this.result=i}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let i of this.bindings)e(i[1]);e(this.result)}static parse(e,i){if(e.length{i.push(e.serialize())}),i}}}let au=ah("==",function(e,i,r){return i===r},al),ac=ah("!=",function(e,i,r){return i!==r},function(e,i,r,a){return!al(0,i,r,a)}),ad=ah("a.compare(i,r)}),ap=ah(">",function(e,i,r){return i>r},function(e,i,r,a){return a.compare(i,r)>0}),af=ah("=a.compare(i,r)});function am(e){return function(){let i=Math.imul((e=0x6d2b79f5+(e|=0)|0)^e>>>15,1|e);return(((i=i+Math.imul(i^i>>>7,61|i)^i)^i>>>14)>>>0)/0x100000000}}let a_={"==":au,"!=":ac,">":ap,"=":ah(">=",function(e,i,r){return i>=r},function(e,i,r,a){return a.compare(i,r)>=0}),"=r.length)throw new iZ("Array index out of bounds: index exceeds array size");if(i!==Math.floor(i))throw new iZ("Array index must be an integer. Use at-interpolated for fractional indices");return r[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}},"at-interpolated":class e{constructor(e,i,r){this.type=e,this.index=i,this.input=r}static parse(i,r){if(3!==i.length)return r.error(`Expected 2 arguments, but found ${i.length-1} instead.`);let a=r.parse(i[1],1,ib),n=r.parse(i[2],2,iP(r.expectedType||iI));return a&&n?new e(n.type.itemType,a,n):null}evaluate(e){let i=this.index.evaluate(e),r=this.input.evaluate(e);if(ir.length-1)throw new iZ(`Array index out of bounds: ${i} > ${r.length-1}.`);if(i===Math.floor(i))return r[i];let a=Math.floor(i),n=Math.ceil(i),o=r[a],s=r[n];if("number"!=typeof o||"number"!=typeof s)throw new iZ(`Cannot interpolate between non-number values at index ${i}.`);let l=i-a;return o*(1-l)+s*l}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}},boolean:iX,case:class e{constructor(e,i,r){this.type=e,this.branches=i,this.otherwise=r}static parse(i,r){let a;if(i.lengthi.outputDefined())&&this.otherwise.outputDefined()}serialize(){let e=["case"];return this.eachChild(i=>{e.push(i.serialize())}),e}},coalesce:an,collator:i7,format:iY,image:iK,in:class e{constructor(e,i){this.type=iT,this.needle=e,this.haystack=i}static parse(i,r){if(3!==i.length)return r.error(`Expected 2 arguments, but found ${i.length-1} instead.`);let a=r.parse(i[1],1,iI),n=r.parse(i[2],2,iI);return a&&n?iL(a.type,[iT,iw,ib,iv,iI])?new e(a,n):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${iR(a.type)} instead`):null}evaluate(e){let i=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(null==r)return!1;if(!iF(i,["boolean","string","number","null"]))throw new iZ(`Expected first argument to be of type boolean, string, number or null, but found ${iR(iq(i))} instead.`);if(!iF(r,["string","array"]))throw new iZ(`Expected second argument to be of type array or string, but found ${iR(iq(r))} instead.`);return r.indexOf(i)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}},"index-of":class e{constructor(e,i,r){this.type=ib,this.needle=e,this.haystack=i,this.fromIndex=r}static parse(i,r){if(i.length=5)return r.error(`Expected 3 or 4 arguments, but found ${i.length-1} instead.`);let a=r.parse(i[1],1,iI),n=r.parse(i[2],2,iI);if(!a||!n)return null;if(!iL(a.type,[iT,iw,ib,iv,iI]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${iR(a.type)} instead`);if(4===i.length){let o=r.parse(i[3],3,ib);return o?new e(a,n,o):null}return new e(a,n)}evaluate(e){let i=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!iF(i,["boolean","string","number","null"]))throw new iZ(`Expected first argument to be of type boolean, string, number or null, but found ${iR(iq(i))} instead.`);if(!iF(r,["string","array"]))throw new iZ(`Expected second argument to be of type array or string, but found ${iR(iq(r))} instead.`);if(this.fromIndex){let a=this.fromIndex.evaluate(e);return r.indexOf(i,a)}return r.indexOf(i)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){let e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}},interpolate:ar,"interpolate-hcl":ar,"interpolate-lab":ar,length:class e{constructor(e){this.type=ib,this.input=e}static parse(i,r){if(2!==i.length)return r.error(`Expected 1 argument, but found ${i.length-1} instead.`);let a=r.parse(i[1],1);return a?"array"!==a.type.kind&&"string"!==a.type.kind&&"value"!==a.type.kind?r.error(`Expected argument of type string or array, but found ${iR(a.type)} instead.`):new e(a):null}evaluate(e){let i=this.input.evaluate(e);if("string"==typeof i||Array.isArray(i))return i.length;throw new iZ(`Expected value to be of type string or array, but found ${iR(iq(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){let e=["length"];return this.eachChild(i=>{e.push(i.serialize())}),e}},let:ao,literal:i$,match:class e{constructor(e,i,r,a,n,o){this.inputType=e,this.type=i,this.input=r,this.cases=a,this.outputs=n,this.otherwise=o}static parse(i,r){let a,n;if(i.lengthNumber.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof e&&Math.floor(e)!==e)return u.error("Numeric branch labels must be integer values.");if(a){if(u.checkSubtype(a,iq(e)))return null}else a=iq(e);if(void 0!==o[String(e)])return u.error("Branch labels must be unique.");o[String(e)]=s.length}let c=r.parse(h,e,n);if(!c)return null;n=n||c.type,s.push(c)}let l=r.parse(i[1],1,iI);if(!l)return null;let h=r.parse(i[i.length-1],i.length-1,n);return h?"value"!==l.type.kind&&r.concat(1).checkSubtype(a,l.type)?null:new e(a,n,l,o,s,h):null}evaluate(e){let i=this.input.evaluate(e);return(iO(iq(i),this.inputType)&&this.outputs[this.cases[i]]||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(){let e=["match",this.input.serialize()],i=Object.keys(this.cases).sort(),r=[],a={};for(let e of i){let i=a[this.cases[e]];void 0===i?(a[this.cases[e]]=r.length,r.push([this.cases[e],[e]])):r[i][1].push(e)}let n=e=>"number"===this.inputType.kind?Number(e):e;for(let[i,a]of r)e.push(1===a.length?n(a[0]):a.map(n)),e.push(this.outputs[i].serialize());return e.push(this.otherwise.serialize()),e}},number:iX,"number-format":class e{constructor(e,i,r,a,n,o){this.type=iw,this.number=e,this.locale=i,this.currency=r,this.unit=a,this.minFractionDigits=n,this.maxFractionDigits=o}static parse(i,r){if(3!==i.length)return r.error("Expected two arguments.");let a=r.parse(i[1],1,ib);if(!a)return null;let n=i[2];if("object"!=typeof n||Array.isArray(n))return r.error("NumberFormat options argument must be an object.");let o=null;if(n.locale&&!(o=r.parseObjectValue(n.locale,2,"locale",iw)))return null;let s=null;if(n.currency&&!(s=r.parseObjectValue(n.currency,2,"currency",iw)))return null;let l=null;if(n.unit&&!(l=r.parseObjectValue(n.unit,2,"unit",iw)))return null;let h=null;if(n["min-fraction-digits"]&&!(h=r.parseObjectValue(n["min-fraction-digits"],2,"min-fraction-digits",ib)))return null;let u=null;return!n["max-fraction-digits"]||(u=r.parseObjectValue(n["max-fraction-digits"],2,"max-fraction-digits",ib))?new e(a,o,s,l,h,u):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(){let 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]}},object:iX,slice:class e{constructor(e,i,r,a){this.type=e,this.input=i,this.beginIndex=r,this.endIndex=a}static parse(i,r){if(i.length=5)return r.error(`Expected 3 or 4 arguments, but found ${i.length-1} instead.`);let a=r.parse(i[1],1,iI),n=r.parse(i[2],2,ib);if(!a||!n)return null;if(!iL(a.type,[iP(iI),iw,iI]))return r.error(`Expected first argument to be of type array or string, but found ${iR(a.type)} instead`);if(4===i.length){let o=r.parse(i[3],3,ib);return o?new e(a.type,a,n,o):null}return new e(a.type,a,n)}evaluate(e){let i=this.input.evaluate(e),r=this.beginIndex.evaluate(e);if(!iF(i,["string","array"]))throw new iZ(`Expected first argument to be of type array or string, but found ${iR(iq(i))} instead.`);if(this.endIndex){let a=this.endIndex.evaluate(e);return i.slice(r,a)}return i.slice(r)}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){let e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}},step:rK,string:iX,"to-boolean":i5,"to-color":i5,"to-number":i5,"to-string":i5,var:rW,within:rp,distance:rN,config:rZ,split:class e{constructor(e,i){this.type=iP(iw),this.str=e,this.delimiter=i}static parse(i,r){if(3!==i.length)return r.error(`Expected 2 arguments, but found ${i.length-1} instead.`);let a=r.parse(i[1],1,iw),n=r.parse(i[2],2,iw);return a&&n?new e(a,n):void 0}evaluate(e){let i=this.str.evaluate(e),r=this.delimiter.evaluate(e);return i.split(r)}eachChild(e){e(this.str),e(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}};function ag(e,[i,r,a,n]){i=i.evaluate(e),r=r.evaluate(e),a=a.evaluate(e);let o=n?n.evaluate(e):1,s=ij(i,r,a,o);if(s)throw new iZ(s);return new iu(i/255,r/255,a/255,o)}function ay(e,[i,r,a,n]){var o,s,l;i=i.evaluate(e),r=r.evaluate(e),a=a.evaluate(e);let h=n?n.evaluate(e):1,u=(o=i,s=r,l=a,"number"==typeof o&&o>=0&&o=0&&s=0&&l=0&&h{i=new Set([...i,...ab(e)])}),i}function aw(e){if(e instanceof i8&&"is-active-floor"===e.name)return!0;let i=!1;return e.eachChild(e=>{!i&&aw(e)&&(i=!0)}),i}function aT(e){return{result:"success",value:e}}function aS(e){return{result:"error",value:e}}function aE(e,i){return!!e&&!!e.parameters&&e.parameters.indexOf(i)>-1}function aI(e){return"data-driven"===e["property-type"]}function aA(e){return aE(e.expression,"measure-light")}function aM(e){return aE(e.expression,"zoom")}function aC(e){return!!e.expression&&e.expression.interpolated}function aP(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function aR(e){return e}function az(e,i,r){return void 0!==e?e:void 0!==i?i:void 0!==r?r:void 0}function aD(e,i,r,a,n){return az(typeof r===n?a[r]:void 0,e.default,i.default)}function aL(e,i,r){if(!i1(r))return az(e.default,i.default);let a=e.stops.length;if(1===a||r=e.stops[a-1][0])return e.stops[a-1][1];let n=rY(e.stops.map(e=>e[0]),r);return e.stops[n][1]}function aF(e,i,r){var a;let n,o,s=void 0!==e.base?e.base:1;if(!i1(r))return az(e.default,i.default);let l=e.stops.length;if(1===l||r=e.stops[l-1][0])return e.stops[l-1][1];let h=rY(e.stops.map(e=>e[0]),r),u=(a=e.stops[h][0],n=e.stops[h+1][0]-a,o=r-a,0===n?0:1===s?o/n:(Math.pow(s,o)-1)/(Math.pow(s,n)-1)),c=e.stops[h][1],d=e.stops[h+1][1],p=ig[i.type]||aR;if(e.colorSpace&&"rgb"!==e.colorSpace){let i=ai[e.colorSpace];p=(e,r)=>i.reverse(i.interpolate(i.forward(e),i.forward(r),u))}return"function"==typeof c.evaluate?{evaluate(...e){let i=c.evaluate.apply(void 0,e),r=d.evaluate.apply(void 0,e);if(void 0!==i&&void 0!==r)return p(i,r,u)}}:p(c,d,u)}function aO(e,i,r){return"color"===i.type?r=iu.parse(r):"formatted"===i.type?r=iV.fromString(r.toString()):"resolvedImage"===i.type?r=iU.build(r.toString()):iJ(r)===i.type||"enum"===i.type&&i.values[r]||(r=void 0),az(r,e.default,i.default)}i8.register(a_,{error:[{kind:"error"},[iw],(e,[i])=>{throw new iZ(i.evaluate(e))}],typeof:[iw,[iI],(e,[i])=>iR(iq(i.evaluate(e)))],"to-rgba":[iP(ib,4),[iS],(e,[i])=>i.evaluate(e).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[iP(ib,4),[iS],(e,[i])=>i.evaluate(e).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[iS,[ib,ib,ib],ag],rgba:[iS,[ib,ib,ib,ib],ag],hsl:[iS,[ib,ib,ib],ay],hsla:[iS,[ib,ib,ib,ib],ay],has:{type:iT,overloads:[[[iw],(e,[i])=>i.evaluate(e)in e.properties()],[[iw,iE],(e,[i,r])=>i.evaluate(e)in r.evaluate(e)]]},get:{type:iI,overloads:[[[iw],(e,[i])=>ax(i.evaluate(e),e.properties())],[[iw,iE],(e,[i,r])=>ax(i.evaluate(e),r.evaluate(e))]]},"feature-state":[iI,[iw],(e,[i])=>ax(i.evaluate(e),e.featureState||{})],properties:[iE,[],e=>e.properties()],"geometry-type":[iw,[],e=>e.geometryType()],worldview:[iw,[],e=>e.globals.worldview||""],"is-active-floor":[iT,av(iw),(e,i)=>{if(!(e.globals&&e.globals.activeFloors&&e.globals.activeFloors.size>0))return!1;if(0===i.length)return!0;let r=e.globals.activeFloors;return i.some(i=>{let a=i.evaluate(e);return r.has(a)})}],id:[iI,[],e=>e.id()],zoom:[ib,[],e=>e.globals.zoom],pitch:[ib,[],e=>e.globals.pitch||0],"distance-from-center":[ib,[],e=>e.distanceFromCenter()],"measure-light":[ib,[iw],(e,[i])=>e.measureLight(i.evaluate(e))],"heatmap-density":[ib,[],e=>e.globals.heatmapDensity||0],"line-progress":[ib,[],e=>e.globals.lineProgress||0],"raster-value":[ib,[],e=>e.globals.rasterValue||0],"raster-particle-speed":[ib,[],e=>e.globals.rasterParticleSpeed||0],"sky-radial-progress":[ib,[],e=>e.globals.skyRadialProgress||0],accumulated:[iI,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[ib,av(ib),(e,i)=>{let r=0;for(let a of i)r+=a.evaluate(e);return r}],"*":[ib,av(ib),(e,i)=>{let r=1;for(let a of i)r*=a.evaluate(e);return r}],"-":{type:ib,overloads:[[[ib,ib],(e,[i,r])=>i.evaluate(e)-r.evaluate(e)],[[ib],(e,[i])=>-i.evaluate(e)]]},"/":[ib,[ib,ib],(e,[i,r])=>i.evaluate(e)/r.evaluate(e)],"%":[ib,[ib,ib],(e,[i,r])=>i.evaluate(e)%r.evaluate(e)],ln2:[ib,[],()=>Math.LN2],pi:[ib,[],()=>Math.PI],e:[ib,[],()=>Math.E],"^":[ib,[ib,ib],(e,[i,r])=>Math.pow(i.evaluate(e),r.evaluate(e))],sqrt:[ib,[ib],(e,[i])=>Math.sqrt(i.evaluate(e))],log10:[ib,[ib],(e,[i])=>Math.log(i.evaluate(e))/Math.LN10],ln:[ib,[ib],(e,[i])=>Math.log(i.evaluate(e))],log2:[ib,[ib],(e,[i])=>Math.log2(i.evaluate(e))],sin:[ib,[ib],(e,[i])=>Math.sin(i.evaluate(e))],cos:[ib,[ib],(e,[i])=>Math.cos(i.evaluate(e))],tan:[ib,[ib],(e,[i])=>Math.tan(i.evaluate(e))],asin:[ib,[ib],(e,[i])=>Math.asin(i.evaluate(e))],acos:[ib,[ib],(e,[i])=>Math.acos(i.evaluate(e))],atan:[ib,[ib],(e,[i])=>Math.atan(i.evaluate(e))],min:[ib,av(ib),(e,i)=>Math.min(...i.map(i=>i.evaluate(e)))],max:[ib,av(ib),(e,i)=>Math.max(...i.map(i=>i.evaluate(e)))],abs:[ib,[ib],(e,[i])=>Math.abs(i.evaluate(e))],round:[ib,[ib],(e,[i])=>{let r=i.evaluate(e);return rMath.floor(i.evaluate(e))],ceil:[ib,[ib],(e,[i])=>Math.ceil(i.evaluate(e))],"filter-==":[iT,[iw,iI],(e,[i,r])=>e.properties()[i.value]===r.value],"filter-id-==":[iT,[iI],(e,[i])=>e.id()===i.value],"filter-type-==":[iT,[iw],(e,[i])=>e.geometryType()===i.value],"filter-{let a=e.properties()[i.value],n=r.value;return typeof a==typeof n&&a{let r=e.id(),a=i.value;return typeof r==typeof a&&r":[iT,[iw,iI],(e,[i,r])=>{let a=e.properties()[i.value],n=r.value;return typeof a==typeof n&&a>n}],"filter-id->":[iT,[iI],(e,[i])=>{let r=e.id(),a=i.value;return typeof r==typeof a&&r>a}],"filter-{let a=e.properties()[i.value],n=r.value;return typeof a==typeof n&&a{let r=e.id(),a=i.value;return typeof r==typeof a&&r=":[iT,[iw,iI],(e,[i,r])=>{let a=e.properties()[i.value],n=r.value;return typeof a==typeof n&&a>=n}],"filter-id->=":[iT,[iI],(e,[i])=>{let r=e.id(),a=i.value;return typeof r==typeof a&&r>=a}],"filter-has":[iT,[iI],(e,[i])=>i.value in e.properties()],"filter-has-id":[iT,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[iT,[iP(iw)],(e,[i])=>i.value.indexOf(e.geometryType())>=0],"filter-id-in":[iT,[iP(iI)],(e,[i])=>i.value.indexOf(e.id())>=0],"filter-in-small":[iT,[iw,iP(iI)],(e,[i,r])=>r.value.indexOf(e.properties()[i.value])>=0],"filter-in-large":[iT,[iw,iP(iI)],(e,[i,r])=>(function(e,i,r,a){for(;r>1;if(i[n]===e)return!0;i[n]>e?a=n-1:r=n+1}return!1})(e.properties()[i.value],r.value,0,r.value.length-1)],all:{type:iT,overloads:[[[iT,iT],(e,[i,r])=>i.evaluate(e)&&r.evaluate(e)],[av(iT),(e,i)=>{for(let r of i)if(!r.evaluate(e))return!1;return!0}]]},any:{type:iT,overloads:[[[iT,iT],(e,[i,r])=>i.evaluate(e)||r.evaluate(e)],[av(iT),(e,i)=>{for(let r of i)if(r.evaluate(e))return!0;return!1}]]},"!":[iT,[iT],(e,[i])=>!i.evaluate(e)],"is-supported-script":[iT,[iw],(e,[i])=>{let r=e.globals&&e.globals.isSupportedScript;return!r||r(i.evaluate(e))}],upcase:[iw,[iw],(e,[i])=>i.evaluate(e).toUpperCase()],downcase:[iw,[iw],(e,[i])=>i.evaluate(e).toLowerCase()],concat:[iw,av(iI),(e,i)=>i.map(i=>iH(i.evaluate(e))).join("")],"resolved-locale":[iw,[iA],(e,[i])=>i.evaluate(e).resolvedLocale()],random:[ib,[ib,ib,iI],(e,i)=>{let r,[a,n,o]=i.map(i=>i.evaluate(e));if(a>n||a===n)return a;if("string"==typeof o)r=function(e){let i=0;if(0===e.length)return i;for(let r=0;rJSON.stringify(e)).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,"u">typeof console&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${e.message}`)),this._defaultValue}}}function aB(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in a_}function aV(e,i,r,a,n){let o,s=new rX(a_,[],i?(o={color:iS,string:iw,number:ib,enum:iw,boolean:iT,formatted:iM,resolvedImage:iC},"array"===i.type?iP(o[i.value]||iI,i.length):o[i.type]):void 0,void 0,void 0,r,a,n),l=s.parse(e,void 0,void 0,void 0,i&&"string"===i.type?{typeAnnotation:"coerce"}:void 0);return l?aT(new ak(l,i,r,a,n)):aS(s.errors)}class aN{constructor(e,i,r,a){this.kind=e,this._styleExpression=i,this.isLightConstant=r,this.isLineProgressConstant=a,this.isStateDependent="constant"!==e&&!rj(i.expression),this.configDependencies=ab(i.expression),this.isIndoorDependent=aw(i.expression)}evaluateWithoutErrorHandling(e,i,r,a,n,o){return this._styleExpression.evaluateWithoutErrorHandling(e,i,r,a,n,o)}evaluate(e,i,r,a,n,o,s){return this._styleExpression.evaluate(e,i,r,a,n,o,void 0,void 0,s)}}class aU{constructor(e,i,r,a,n,o){this.kind=e,this.zoomStops=r,this._styleExpression=i,this.isStateDependent="camera"!==e&&!rj(i.expression),this.isIndoorDependent=aw(i.expression),this.isLightConstant=n,this.isLineProgressConstant=o,this.configDependencies=ab(i.expression),this.interpolationType=a}evaluateWithoutErrorHandling(e,i,r,a,n,o){return this._styleExpression.evaluateWithoutErrorHandling(e,i,r,a,n,o)}evaluate(e,i,r,a,n,o){return this._styleExpression.evaluate(e,i,r,a,n,o)}interpolationFactor(e,i,r){return this.interpolationType?ar.interpolationFactor(this.interpolationType,e,i,r):0}}function aj(e,i,r,a,n){if("error"===(e=aV(e,i,r,a,n)).result)return e;let o=e.value.expression,s=rU(o);if(!s&&!aI(i))return aS([new iy("","data expressions not supported")]);let l=rG(o,["zoom","pitch","distance-from-center"]);if(!l&&!aM(i))return aS([new iy("","zoom expressions not supported")]);let h=rG(o,["measure-light"]);if(!h&&!aA(i))return aS([new iy("","measure-light expression not supported")]);let u=rG(o,["line-progress"]);if(!u&&!aE(i.expression,"line-progress"))return aS([new iy("","line-progress expression not supported")]);let c=i.expression&&i.expression.relaxZoomRestriction,d=function e(i){let r=null;if(i instanceof ao)r=e(i.result);else if(i instanceof an){for(let a of i.args)if(r=e(a))break}else(i instanceof rK||i instanceof ar)&&i.input instanceof i8&&"zoom"===i.input.name&&(r=i);return r instanceof iy||i.eachChild(i=>{let a=e(i);a instanceof iy?r=a:r&&a&&r!==a&&(r=new iy("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),r}(o);return d||l||c?d instanceof iy?aS([d]):d instanceof ar&&!aC(i)?aS([new iy("",'"interpolate" expressions cannot be used with this property')]):aT(d?new aU(s&&u?"camera":"composite",e.value,d.labels,d instanceof ar?d.interpolation:void 0,h,u):new aN(s&&u?"constant":"source",e.value,h,u)):aS([new iy("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class aG{constructor(e,i){this._parameters=e,this._specification=i,Object.assign(this,function e(i,r){let a,n,o,s="color"===r.type,l=i.stops&&"object"==typeof i.stops[0][0],h=l||!(l||void 0!==i.property),u=i.type||(aC(r)?"exponential":"interval");if(s&&((i=Object.assign({},i)).stops&&(i.stops=i.stops.map(e=>[e[0],iu.parse(e[1])])),i.default=iu.parse(i.default?i.default:r.default)),i.colorSpace&&"rgb"!==i.colorSpace&&!ai[i.colorSpace])throw Error(`Unknown color space: ${i.colorSpace}`);if("exponential"===u)a=aF;else if("interval"===u)a=aL;else if("categorical"===u){for(let e of(a=aD,n=Object.create(null),i.stops))n[e[0]]=e[1];o=typeof i.stops[0][0]}else{if("identity"!==u)throw Error(`Unknown function type "${u}"`);a=aO}if(l){let a={},n=[];for(let e=0;ee[0]),evaluate:({zoom:e},a)=>aF({stops:o,base:i.base},r,e).evaluate(e,a)}}if(h){let e="exponential"===u?{name:"exponential",base:void 0!==i.base?i.base:1}:null;return{kind:"camera",interpolationType:e,interpolationFactor:ar.interpolationFactor.bind(void 0,e),zoomStops:i.stops.map(e=>e[0]),evaluate:({zoom:e})=>a(i,r,e,n,o)}}return{kind:"source",evaluate(e,s){let l=s&&s.properties?s.properties[i.property]:void 0;return void 0===l?az(i.default,r.default):a(i,r,l,n,o)}}}(this._parameters,this._specification))}static deserialize(e){return new aG(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}var aq,aH,a$=e3(function(){if(aH)return aq;function e(e,i,r){var a=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;var n=new Int32Array(this.arrayBuffer);e=n[0],this.d=(i=n[1])+2*(r=n[2]);for(var o=0;o=c[f+0]&&a>=c[f+1])?(s[p]=!0,o.push(u[p])):s[p]=!1}}},e.prototype._forEachCell=function(e,i,r,a,n,o,s,l){for(var h=this._convertToCellCoord(e),u=this._convertToCellCoord(i),c=this._convertToCellCoord(r),d=this._convertToCellCoord(a),p=h;p=0||(n[r]=aY(e[r],i)));e instanceof Error&&(n.message=e.message)}if(n.$name)throw Error("$name property is reserved for worker serialization logic.");return"Object"!==a&&(n.$name=a),n}throw Error("can't serialize object of type "+typeof e)}function aK(e){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||aX(e)||e instanceof ImageBitmap||ArrayBuffer.isView(e)||e instanceof ImageData)return e;if(Array.isArray(e))return e.map(aK);if("object"==typeof e){let i=e.$name||"Object";if("Map"===i){let i=e.entries||[],r=new Map;for(let e=0;ee>=1536&&ee>=1872&&ee>=2208&&ee>=11904&&ee>=12032&&ee>=12272&&ee>=12288&&ee>=12352&&ee>=12448&&ee>=12544&&ee>=12704&&ee>=12736&&ee>=12784&&ee>=12800&&ee>=13056&&ee>=13312&&ee>=19968&&ee>=40960&&ee>=42128&&ee>=44032&&ee>=63744&&ee>=64336&&ee>=65040&&ee>=65072&&ee>=65104&&ee>=65136&&ee>=65280&&e=65097&&e=12296&&e=12308&&e=12592&&e=43360&&e=55216&&e=4352&&e=12688&&e=65306&&e=65371&&e=65512&&e=65112&&e=65123&&e=5120&&e=6320&&e=19904&&e=128&&e=8192&&e=8448&&e=8528&&e=8960&&e=8960&&e=8972&&e=8996&&e=9085&&e=9150&&e=9169&&e=9186&&e=9216&&e=9280&&e=9312&&e=9632&&e=9728&&e=9754&&e=11008&&e=11026&&e=11088&&e=11192&&e=57344&&e=9984&&e=10102&&e=1424&&e-1&&(nb=nx.error),nv&&nv(e)};function nS(){nE.fire(new ie("pluginStateChange",{pluginStatus:nb,pluginURL:nw}))}let nE=new ia,nI=function(){return nb},nA=function(){if(nb!==nx.deferred||!nw)throw Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");nb=nx.loading,nS(),nw&&tQ({url:nw},e=>{e?nT(e):(nb=nx.loaded,nS())})},nM={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>nb===nx.loaded||null!=nM.applyArabicShaping,isLoading:()=>nb===nx.loading,setState(e){nb=e.pluginStatus,nw=e.pluginURL},isParsing:()=>nb===nx.parsing,isParsed:()=>nb===nx.parsed,getPluginURL:()=>nw};class nC{constructor(e,i){this.zoom=e,i?(this.now=i.now,this.fadeDuration=i.fadeDuration,this.transition=i.transition,this.pitch=i.pitch,this.brightness=i.brightness,this.worldview=i.worldview,this.activeFloors=i.activeFloors):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(e){var i=nM.isLoaded();for(let r of e)if(!function(e,i){return!(!i&&ny(e)||e>=2304&&e=3840&&e=6016&&e0){let o=aj(e,i,r,a,n);if("error"===o.result)throw Error(o.value.map(e=>`${e.key}: ${e.message}`).join(", "));return o.value}{let r=e;return"string"==typeof e&&"color"===i.type&&(r=iu.parse(e)),{kind:"constant",configDependencies:new Set,isIndoorDependent:!1,evaluate:()=>r}}}(void 0===i?e.specification.default:i,e.specification,r,a,n)}isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(e,i,r,a){return this.property.possiblyEvaluate(this,e,i,r,a)}}class nR{constructor(e,i,r,a){this.property=e,this.value=new nP(e,void 0,i,r,a)}transitioned(e,i){return new nD(this.property,this.value,i,Object.assign({},e.transition,this.transition),e.now)}untransitioned(){return new nD(this.property,this.value,null,{},0)}}class nz{constructor(e,i,r,a){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=i,this._options=r,this._iconImageUseTheme=a,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(e){return tp(this._values[e].value.value)}setValue(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new nR(this._values[e].property,this._scope,this._options,this._iconImageUseTheme)),this._values[e].value=new nP(this._values[e].property,null===i?void 0:tp(i),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,i){i&&(this._options=i);let r=this._properties.properties;if(e)for(let i in e){let a=e[i];if(i.endsWith("-transition")){let e=i.slice(0,-11);r[e]&&this.setTransition(e,a)}else r.hasOwnProperty(i)&&this.setValue(i,a)}}getTransition(e){return tp(this._values[e].transition)}setTransition(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new nR(this._values[e].property)),this._values[e].transition=tp(i)||void 0}serialize(){let e={};for(let i of Object.keys(this._values)){let r=this.getValue(i);void 0!==r&&(e[i]=r);let a=this.getTransition(i);void 0!==a&&(e[`${i}-transition`]=a)}return e}transitioned(e,i){let r=new nL(this._properties);for(let a of Object.keys(this._values))r._values[a]=this._values[a].transitioned(e,i._values[a]);return r}untransitioned(){let e=new nL(this._properties);for(let i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}isIndoorDependent(){return this._isIndoorDependent}}class nD{constructor(e,i,r,a,n){const o=a.delay||0,s=a.duration||0;n=n||0,this.property=e,this.value=i,this.begin=n+o,this.end=this.begin+s,e.specification.transition&&(a.delay||a.duration)&&(this.prior=r)}possiblyEvaluate(e,i,r){let a=e.now||0,n=this.value.possiblyEvaluate(e,i,r),o=this.prior;if(o){if(a>this.end||this.value.isDataDriven())return this.prior=null,n;if(a":1,">=":1,"=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"!0,needGeometry:!1,needFeature:!1};nH(e)||(e=function e(i){if(!i)return!0;let r=i[0];return i.length"===r||"="===r?nY(i[1],i[2],r):"any"===r?["any"].concat(i.slice(1).map(e)):"all"===r?["all"].concat(i.slice(1).map(e)):"none"===r?["all"].concat(i.slice(1).map(e).map(nQ)):"in"===r?nK(i[1],i.slice(2)):"!in"===r?nQ(nK(i[1],i.slice(2))):"has"===r?nJ(i[1]):"!has"!==r||nQ(nJ(i[1]))}(e));let n=e,o=!0;try{o=function(e){if(!nZ(e))return e;let i=nq(e);return function e(i){let r=!1,a=[];if("case"===i[0]){for(let e=1;ee(i))}(i)}(n)}catch(e){console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate. This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md and paste the contents of this message in the report. Thank you! Filter Expression: ${JSON.stringify(n,null,2)} `)}let s=null,l=null;if("background"!==a&&"sky"!==a&&"slot"!==a){let e=aV(o,l=nj[`filter_${a}`],i,r);if("error"===e.result)throw Error(e.value.map(e=>`${e.key}: ${e.message}`).join(", "));s=(i,r,a)=>e.value.evaluate(i,r,{},a)}let h=null,u=null;if(o!==n){let e=aV(n,l,i,r);if("error"===e.result)throw Error(e.value.map(e=>`${e.key}: ${e.message}`).join(", "));h=(i,r,a,n,o)=>e.value.evaluate(i,r,{},a,void 0,void 0,n,o),u=!rU(e.value.expression)}return{filter:s,dynamicFilter:h||void 0,needGeometry:function e(i){if(!Array.isArray(i))return!1;if("within"===i[0]||"distance"===i[0])return!0;for(let r=1;r",">=","i)}function nY(e,i,r){switch(e){case"$type":return[`filter-type-${r}`,i];case"$id":return[`filter-id-${r}`,i];default:return[`filter-${r}`,e,i]}}function nK(e,i){if(0===i.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",i]];case"$id":return["filter-id-in",["literal",i]];default:return i.length>200&&!i.some(e=>typeof e!=typeof i[0])?["filter-in-large",e,["literal",i.sort(nX)]]:["filter-in-small",e,["literal",i]]}}function nJ(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function nQ(e){return["!",e]}function n0(e,i){return i?`${e}${i}`:e}let n1=()=>c||(c=new nU({"icon-size":new nV(nj.layout_symbol["icon-size"]),"icon-image":new nV(nj.layout_symbol["icon-image"]),"icon-rotate":new nV(nj.layout_symbol["icon-rotate"]),"icon-offset":new nV(nj.layout_symbol["icon-offset"]),"text-size":new nV(nj.layout_symbol["text-size"]),"text-rotate":new nV(nj.layout_symbol["text-rotate"]),"text-offset":new nV(nj.layout_symbol["text-offset"])}));class n2{constructor(e,i,r,a,n,o){const s=aV(e,nj.appearance.condition);if("success"===s.result&&(this.condition=s.value),this.name=i,r)for(const e in this.properties=new nk(n1()),this.unevaluatedLayout=new nF(n1(),a,n,o),r)this.unevaluatedLayout.setValue(e,r[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}getProperty(e){return this.properties.get(e)}getUnevaluatedProperties(){return this.unevaluatedLayout}getUnevaluatedProperty(e){return this.unevaluatedLayout._values[e]}recalculate(e,i,r){this.unevaluatedLayout&&(this.properties=this.unevaluatedLayout.possiblyEvaluate(e,void 0,i,r))}serialize(){let e={};return e.condition=this.condition.expression.serialize(),this.name&&(e.name=this.name),this.unevaluatedLayout&&(e.properties=this.unevaluatedLayout.serialize()),e}hasIconProperties(){let e=this.hasProperty("icon-image"),i=this.hasProperty("icon-size"),r=this.hasProperty("icon-offset"),a=this.hasProperty("icon-rotate");return e||i||r||a}hasTextProperties(){let e=this.hasProperty("text-size"),i=this.hasProperty("text-offset"),r=this.hasProperty("text-rotate");return e||i||r}hasProperty(e){return void 0!==this.getUnevaluatedProperty(e).value}}let n3="-transition",n5=new Set(["fill","line","background","hillshade","raster"]);class n4 extends ia{constructor(e,i,r,a,n,o){if(super(),this.id=e.id,this.fqid=n0(this.id,r),this.type=e.type,this.scope=r,this.lut=a,this.options=n,this.iconImageUseTheme=o,this.appearances=[],this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.expressionDependencies={isIndoorDependent:!1,configDependencies:new Set},"custom"!==e.type){if(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type&&"background"!==e.type&&"sky"!==e.type&&"slot"!==e.type){this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter;const i=aV(this.filter,nj[`filter_${e.type}`]);"error"!==i.result&&(this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...i.value.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||i.value.isIndoorDependent)}if(e.slot&&(this.slot=e.slot),e.appearances&&this.setAppearances(e.appearances),i.layout&&(this._unevaluatedLayout=new nF(i.layout,this.scope,n,this.iconImageUseTheme),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._unevaluatedLayout.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._unevaluatedLayout.isIndoorDependent()),i.paint){for(const r in this._transitionablePaint=new nz(i.paint,this.scope,n),e.paint)this.setPaintProperty(r,e.paint[r]);for(const i in e.layout)this.setLayoutProperty(i,e.layout[i]);this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._transitionablePaint.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._transitionablePaint.isIndoorDependent(),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new nk(i.paint)}}}onAdd(e){}onRemove(e){}isDraped(e){return!this.is3D(!0)&&n5.has(this.type)}getLayoutProperty(e){return"visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,i){if("custom"===this.type&&"visibility"===e)return void(this.visibility=i);let r=this._unevaluatedLayout;r._properties.properties[e]&&(r.setValue(e,i),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...r.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||r.isIndoorDependent(),"visibility"===e&&this.possiblyEvaluateVisibility())}setAppearances(e){this.appearances=[],e.forEach(e=>{this.appearances.push(new n2(e.condition,e.name,e.properties,this.scope,this.options,this.iconImageUseTheme))})}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(e){return e.endsWith(n3)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}isPaintProperty(e){return!!this._transitionablePaint._properties.properties[e]}setPaintProperty(e,i){let r=this._transitionablePaint,a=r._properties.properties;if(e.endsWith(n3)){let n=e.slice(0,-11);return a[n]&&r.setTransition(n,i||void 0),!1}if(!a[e])return!1;let n=r._values[e],o=n.value.isDataDriven(),s=n.value;r.setValue(e,i),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...r.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||r.isIndoorDependent(),this._handleSpecialPaintPropertyUpdate(e);let l=r._values[e].value,h=l.isDataDriven(),u=e.endsWith("pattern")||"line-dasharray"===e;return h||o||u||this._handleOverridablePaintPropertyUpdate(e,s,l)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,i,r){return null}_handleOverridablePaintPropertyUpdate(e,i,r){return!1}isHidden(e){return!!(this.minzoom&&e=this.maxzoom)||"none"===this.visibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,i){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,i,this.iconImageUseTheme)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,i)}serialize(){let 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())),td(e,(e,i)=>!(void 0===e||"layout"===i&&!Object.keys(e).length||"paint"===i&&!Object.keys(e).length))}is3D(e){return!1}hasElevation(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}_clear(){}isStateDependent(){for(let e in this.paint._values){let i=this.paint.get(e);if(i instanceof nO&&aI(i.property.specification)&&("source"===i.value.kind||"composite"===i.value.kind)&&i.value.isStateDependent)return!0}for(let e of this.appearances)if(!rj(e.condition.expression))return!0;return!1}compileFilter(e){this._filterCompiled||(this._featureFilter=n$(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,i,r){return{}}queryRadius(e){}queryIntersectsFeature(e,i,r,a,n,o,s,l,h,u){}}let n6={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class n8{constructor(e,i){this._structArray=e,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}let n9=new ArrayBuffer(0);class n7{constructor(){this._reallocCount=0,this.capacity=0,this.length=0}static serialize(e,i){return e._trim(),i&&e.arrayBuffer&&i.add(e.arrayBuffer),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){let i=Object.create(this.prototype);return i.arrayBuffer=e.arrayBuffer,i.length=e.length,e.arrayBuffer?i.capacity=e.arrayBuffer.byteLength/i.bytesPerElement:(i.capacity=0,i.arrayBuffer=n9),i._refreshViews(),i}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this._reallocCount++,this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}reserveForAdditional(e){this.reserve(this.length+e)}_refreshViews(){throw Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(){throw Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(){throw 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 oe(e,i=1){let r=0,a=0;return{members:e.map(e=>{let n=n6[e.type].BYTES_PER_ELEMENT,o=r=ot(r,Math.max(i,n)),s=e.components||1;return a=Math.max(a,n),r+=n*s,{name:e.name,type:e.type,components:s,offset:o}}),size:ot(r,Math.max(a,i)),alignment:i}}function ot(e,i){return Math.ceil(e/i)*i}class oi extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,i)}emplace(e,i,r){let a=2*e;return this.int16[a+0]=i,this.int16[a+1]=r,e}}oi.prototype.bytesPerElement=4,aW(oi,"StructArrayLayout2i4");class or extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,e,i,r)}emplace(e,i,r,a){let n=3*e;return this.int16[n+0]=i,this.int16[n+1]=r,this.int16[n+2]=a,e}}or.prototype.bytesPerElement=6,aW(or,"StructArrayLayout3i6");class oa extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,e,i,r,a)}emplace(e,i,r,a,n){let o=4*e;return this.int16[o+0]=i,this.int16[o+1]=r,this.int16[o+2]=a,this.int16[o+3]=n,e}}oa.prototype.bytesPerElement=8,aW(oa,"StructArrayLayout4i8");class on extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.float32[+e+0]=i,e}}on.prototype.bytesPerElement=4,aW(on,"StructArrayLayout1f4");class oo extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,e,i,r)}emplace(e,i,r,a){let n=4*e;return this.int16[n+0]=i,this.int16[n+1]=r,this.float32[2*e+1]=a,e}}oo.prototype.bytesPerElement=8,aW(oo,"StructArrayLayout2i1f8");class os extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,e,i,r)}emplace(e,i,r,a){let n=4*e;return this.int16[n+0]=i,this.int16[n+1]=r,this.int16[n+2]=a,e}}os.prototype.bytesPerElement=8,aW(os,"StructArrayLayout3i8");class ol extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n){let o=this.length;return this.resize(o+1),this.emplace(o,e,i,r,a,n)}emplace(e,i,r,a,n,o){let s=5*e;return this.int16[s+0]=i,this.int16[s+1]=r,this.int16[s+2]=a,this.int16[s+3]=n,this.int16[s+4]=o,e}}ol.prototype.bytesPerElement=10,aW(ol,"StructArrayLayout5i10");class oh extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,e,i,r,a,n,o,s)}emplace(e,i,r,a,n,o,s,l){let h=6*e,u=12*e;return this.int16[h+0]=i,this.int16[h+1]=r,this.uint8[u+4]=a,this.uint8[u+5]=n,this.uint8[u+6]=o,this.uint8[u+7]=s,this.float32[3*e+2]=l,e}}oh.prototype.bytesPerElement=12,aW(oh,"StructArrayLayout2i4ub1f12");class ou extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,e,i,r)}emplace(e,i,r,a){let n=3*e;return this.float32[n+0]=i,this.float32[n+1]=r,this.float32[n+2]=a,e}}ou.prototype.bytesPerElement=12,aW(ou,"StructArrayLayout3f12");class oc extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n){let o=this.length;return this.resize(o+1),this.emplace(o,e,i,r,a,n)}emplace(e,i,r,a,n,o){let s=6*e;return this.uint16[s+0]=i,this.uint16[s+1]=r,this.uint16[s+2]=a,this.uint16[s+3]=n,this.float32[3*e+2]=o,e}}oc.prototype.bytesPerElement=12,aW(oc,"StructArrayLayout4ui1f12");class od extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,e,i,r,a)}emplace(e,i,r,a,n){let o=4*e;return this.uint16[o+0]=i,this.uint16[o+1]=r,this.uint16[o+2]=a,this.uint16[o+3]=n,e}}od.prototype.bytesPerElement=8,aW(od,"StructArrayLayout4ui8");class op extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o){let s=this.length;return this.resize(s+1),this.emplace(s,e,i,r,a,n,o)}emplace(e,i,r,a,n,o,s){let l=6*e;return this.int16[l+0]=i,this.int16[l+1]=r,this.int16[l+2]=a,this.int16[l+3]=n,this.int16[l+4]=o,this.int16[l+5]=s,e}}op.prototype.bytesPerElement=12,aW(op,"StructArrayLayout6i12");class of extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s,l,h,u,c,d){let p=this.length;return this.resize(p+1),this.emplace(p,e,i,r,a,n,o,s,l,h,u,c,d)}emplace(e,i,r,a,n,o,s,l,h,u,c,d,p){let f=12*e;return this.int16[f+0]=i,this.int16[f+1]=r,this.int16[f+2]=a,this.int16[f+3]=n,this.uint16[f+4]=o,this.uint16[f+5]=s,this.uint16[f+6]=l,this.uint16[f+7]=h,this.int16[f+8]=u,this.int16[f+9]=c,this.int16[f+10]=d,this.int16[f+11]=p,e}}of.prototype.bytesPerElement=24,aW(of,"StructArrayLayout4i4ui4i24");class om extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o){let s=this.length;return this.resize(s+1),this.emplace(s,e,i,r,a,n,o)}emplace(e,i,r,a,n,o,s){let l=10*e,h=5*e;return this.int16[l+0]=i,this.int16[l+1]=r,this.int16[l+2]=a,this.float32[h+2]=n,this.float32[h+3]=o,this.float32[h+4]=s,e}}om.prototype.bytesPerElement=20,aW(om,"StructArrayLayout3i3f20");class o_ extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,e,i,r,a)}emplace(e,i,r,a,n){let o=4*e;return this.float32[o+0]=i,this.float32[o+1]=r,this.float32[o+2]=a,this.float32[o+3]=n,e}}o_.prototype.bytesPerElement=16,aW(o_,"StructArrayLayout4f16");class og extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint32[+e+0]=i,e}}og.prototype.bytesPerElement=4,aW(og,"StructArrayLayout1ul4");class oy extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,i)}emplace(e,i,r){let a=2*e;return this.uint16[a+0]=i,this.uint16[a+1]=r,e}}oy.prototype.bytesPerElement=4,aW(oy,"StructArrayLayout2ui4");class ox extends n7{_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,i,r,a,n,o,s,l,h,u,c,d,p){let f=this.length;return this.resize(f+1),this.emplace(f,e,i,r,a,n,o,s,l,h,u,c,d,p)}emplace(e,i,r,a,n,o,s,l,h,u,c,d,p,f){let m=20*e,_=10*e;return this.int16[m+0]=i,this.int16[m+1]=r,this.int16[m+2]=a,this.int16[m+3]=n,this.int16[m+4]=o,this.float32[_+3]=s,this.float32[_+4]=l,this.float32[_+5]=h,this.float32[_+6]=u,this.int16[m+14]=c,this.uint32[_+8]=d,this.uint16[m+18]=p,this.uint16[m+19]=f,e}}ox.prototype.bytesPerElement=40,aW(ox,"StructArrayLayout5i4f1i1ul2ui40");class ov extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,e,i,r,a,n,o,s)}emplace(e,i,r,a,n,o,s,l){let h=8*e;return this.int16[h+0]=i,this.int16[h+1]=r,this.int16[h+2]=a,this.int16[h+4]=n,this.int16[h+5]=o,this.int16[h+6]=s,this.int16[h+7]=l,e}}ov.prototype.bytesPerElement=16,aW(ov,"StructArrayLayout3i2i2i16");class ob extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n){let o=this.length;return this.resize(o+1),this.emplace(o,e,i,r,a,n)}emplace(e,i,r,a,n,o){let s=4*e,l=8*e;return this.float32[s+0]=i,this.float32[s+1]=r,this.float32[s+2]=a,this.int16[l+6]=n,this.int16[l+7]=o,e}}ob.prototype.bytesPerElement=16,aW(ob,"StructArrayLayout2f1f2i16");class ow extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o){let s=this.length;return this.resize(s+1),this.emplace(s,e,i,r,a,n,o)}emplace(e,i,r,a,n,o,s){let l=20*e,h=5*e;return this.uint8[l+0]=i,this.uint8[l+1]=r,this.float32[h+1]=a,this.float32[h+2]=n,this.float32[h+3]=o,this.float32[h+4]=s,e}}ow.prototype.bytesPerElement=20,aW(ow,"StructArrayLayout2ub4f20");class oT extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,e,i,r)}emplace(e,i,r,a){let n=3*e;return this.uint16[n+0]=i,this.uint16[n+1]=r,this.uint16[n+2]=a,e}}oT.prototype.bytesPerElement=6,aW(oT,"StructArrayLayout3ui6");class oS extends n7{_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,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b){let w=this.length;return this.resize(w+1),this.emplace(w,e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b)}emplace(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w){let T=30*e,S=15*e,E=60*e;return this.int16[T+0]=i,this.int16[T+1]=r,this.int16[T+2]=a,this.float32[S+2]=n,this.float32[S+3]=o,this.uint16[T+8]=s,this.uint16[T+9]=l,this.uint32[S+5]=h,this.uint32[S+6]=u,this.uint32[S+7]=c,this.uint16[T+16]=d,this.uint16[T+17]=p,this.uint16[T+18]=f,this.float32[S+10]=m,this.float32[S+11]=_,this.uint8[E+48]=g,this.uint8[E+49]=y,this.uint8[E+50]=x,this.uint32[S+13]=v,this.int16[T+28]=b,this.uint8[E+58]=w,e}}oS.prototype.bytesPerElement=60,aW(oS,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class oE extends n7{_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,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,E,I,A,M,C,P,R,z,D){let L=this.length;return this.resize(L+1),this.emplace(L,e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,E,I,A,M,C,P,R,z,D)}emplace(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,E,I,A,M,C,P,R,z,D,L){let F=20*e,O=40*e;return this.float32[F+0]=i,this.float32[F+1]=r,this.int16[O+4]=a,this.int16[O+5]=n,this.int16[O+6]=o,this.int16[O+7]=s,this.int16[O+8]=l,this.int16[O+9]=h,this.int16[O+10]=u,this.int16[O+11]=c,this.int16[O+12]=d,this.uint16[O+13]=p,this.uint16[O+14]=f,this.uint16[O+15]=m,this.uint16[O+16]=_,this.uint16[O+17]=g,this.uint16[O+18]=y,this.uint16[O+19]=x,this.uint16[O+20]=v,this.uint16[O+21]=b,this.uint16[O+22]=w,this.uint16[O+23]=T,this.uint16[O+24]=S,this.uint16[O+25]=E,this.uint16[O+26]=I,this.uint16[O+27]=A,this.uint32[F+14]=M,this.float32[F+15]=C,this.float32[F+16]=P,this.float32[F+17]=R,this.float32[F+18]=z,this.uint8[80*e+76]=D,this.uint16[O+39]=L,e}}oE.prototype.bytesPerElement=80,aW(oE,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class oI extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o){let s=this.length;return this.resize(s+1),this.emplace(s,e,i,r,a,n,o)}emplace(e,i,r,a,n,o,s){let l=6*e;return this.float32[l+0]=i,this.float32[l+1]=r,this.float32[l+2]=a,this.float32[l+3]=n,this.float32[l+4]=o,this.float32[l+5]=s,e}}oI.prototype.bytesPerElement=24,aW(oI,"StructArrayLayout6f24");class oA extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n){let o=this.length;return this.resize(o+1),this.emplace(o,e,i,r,a,n)}emplace(e,i,r,a,n,o){let s=5*e;return this.float32[s+0]=i,this.float32[s+1]=r,this.float32[s+2]=a,this.float32[s+3]=n,this.float32[s+4]=o,e}}oA.prototype.bytesPerElement=20,aW(oA,"StructArrayLayout5f20");class oM extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,e,i,r,a,n,o,s)}emplace(e,i,r,a,n,o,s,l){let h=7*e;return this.float32[h+0]=i,this.float32[h+1]=r,this.float32[h+2]=a,this.float32[h+3]=n,this.float32[h+4]=o,this.float32[h+5]=s,this.float32[h+6]=l,e}}oM.prototype.bytesPerElement=28,aW(oM,"StructArrayLayout7f28");class oC extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s,l,h,u,c){let d=this.length;return this.resize(d+1),this.emplace(d,e,i,r,a,n,o,s,l,h,u,c)}emplace(e,i,r,a,n,o,s,l,h,u,c,d){let p=11*e;return this.float32[p+0]=i,this.float32[p+1]=r,this.float32[p+2]=a,this.float32[p+3]=n,this.float32[p+4]=o,this.float32[p+5]=s,this.float32[p+6]=l,this.float32[p+7]=h,this.float32[p+8]=u,this.float32[p+9]=c,this.float32[p+10]=d,e}}oC.prototype.bytesPerElement=44,aW(oC,"StructArrayLayout11f44");class oP extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s,l,h){let u=this.length;return this.resize(u+1),this.emplace(u,e,i,r,a,n,o,s,l,h)}emplace(e,i,r,a,n,o,s,l,h,u){let c=9*e;return this.float32[c+0]=i,this.float32[c+1]=r,this.float32[c+2]=a,this.float32[c+3]=n,this.float32[c+4]=o,this.float32[c+5]=s,this.float32[c+6]=l,this.float32[c+7]=h,this.float32[c+8]=u,e}}oP.prototype.bytesPerElement=36,aW(oP,"StructArrayLayout9f36");class oR extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,i)}emplace(e,i,r){let a=2*e;return this.float32[a+0]=i,this.float32[a+1]=r,e}}oR.prototype.bytesPerElement=8,aW(oR,"StructArrayLayout2f8");class oz extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,e,i,r,a)}emplace(e,i,r,a,n){let o=6*e;return this.uint32[3*e+0]=i,this.uint16[o+2]=r,this.uint16[o+3]=a,this.uint16[o+4]=n,e}}oz.prototype.bytesPerElement=12,aW(oz,"StructArrayLayout1ul3ui12");class oD extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint16[+e+0]=i,e}}oD.prototype.bytesPerElement=2,aW(oD,"StructArrayLayout1ui2");class oL extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_){let g=this.length;return this.resize(g+1),this.emplace(g,e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_)}emplace(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g){let y=16*e;return this.float32[y+0]=i,this.float32[y+1]=r,this.float32[y+2]=a,this.float32[y+3]=n,this.float32[y+4]=o,this.float32[y+5]=s,this.float32[y+6]=l,this.float32[y+7]=h,this.float32[y+8]=u,this.float32[y+9]=c,this.float32[y+10]=d,this.float32[y+11]=p,this.float32[y+12]=f,this.float32[y+13]=m,this.float32[y+14]=_,this.float32[y+15]=g,e}}oL.prototype.bytesPerElement=64,aW(oL,"StructArrayLayout16f64");class oF extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,e,i,r,a,n,o,s)}emplace(e,i,r,a,n,o,s,l){let h=10*e,u=5*e;return this.uint16[h+0]=i,this.uint16[h+1]=r,this.uint16[h+2]=a,this.uint16[h+3]=n,this.float32[u+2]=o,this.float32[u+3]=s,this.float32[u+4]=l,e}}oF.prototype.bytesPerElement=20,aW(oF,"StructArrayLayout4ui3f20");class oO extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e){let i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.int16[+e+0]=i,e}}oO.prototype.bytesPerElement=2,aW(oO,"StructArrayLayout1i2");class ok extends n7{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(e){let i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint8[+e+0]=i,e}}ok.prototype.bytesPerElement=1,aW(ok,"StructArrayLayout1ub1");class oB extends n8{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]}}oB.prototype.size=40;class oV extends ox{get(e){return new oB(this,e)}}aW(oV,"CollisionBoxArray");class oN extends n8{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}}oN.prototype.size=60;class oU extends oS{get(e){return new oN(this,e)}}aW(oU,"PlacedSymbolArray");class oj extends n8{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]}}oj.prototype.size=80;class oG extends oE{get(e){return new oj(this,e)}}aW(oG,"SymbolInstanceArray");class oq extends on{getoffsetX(e){return this.float32[+e+0]}}aW(oq,"GlyphOffsetArray");class oH extends oi{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}aW(oH,"SymbolLineVertexArray");class o$ extends n8{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]}}o$.prototype.size=12;class oZ extends oz{get(e){return new o$(this,e)}}aW(oZ,"FeatureIndexArray");class oW extends oy{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}aW(oW,"FillExtrusionCentroidArray");class oX extends n8{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]}}oX.prototype.size=6;class oY extends or{get(e){return new oX(this,e)}}aW(oY,"FillExtrusionWallArray");let oK=oe([{name:"a_pos",components:2,type:"Int16"}],4),oJ=oe([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),oQ=oe([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class o0{constructor(e=[]){this.segments=e}_prepareSegment(e,i,r,a){let n=this.segments[this.segments.length-1];return e>o0.MAX_VERTEX_ARRAY_LENGTH&&t_(`Max vertices per segment is ${o0.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!n||n.vertexLength+e>o0.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==a)&&(n={vertexOffset:i,primitiveOffset:r,vertexLength:0,primitiveLength:0},void 0!==a&&(n.sortKey=a),this.segments.push(n)),n}prepareSegment(e,i,r,a){return this._prepareSegment(e,i.length,r.length,a)}get(){return this.segments}destroy(){for(let e of this.segments)for(let i in e.vaos)e.vaos[i].destroy()}static simpleSegment(e,i,r,a){return new o0([{vertexOffset:e,primitiveOffset:i,vertexLength:r,primitiveLength:a,vaos:{},sortKey:0}])}}function o1(e,i){return 256*(e=tr(Math.floor(e),0,255))+tr(Math.floor(i),0,255)}o0.MAX_VERTEX_ARRAY_LENGTH=65535,aW(o0,"SegmentVector");let o2=oe([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),o3=oe([{name:"a_pattern_b",components:4,type:"Uint16"}]),o5=oe([{name:"a_dash",components:4,type:"Uint16"}]);class o4{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(e,i,r,a){this.ids.push(o6(e)),this.positions.push(i,r,a)}eachPosition(e,i){let r=o6(e),a=0,n=this.ids.length-1;for(;a>1;this.ids[e]>=r?n=e:a=e+1}for(;this.ids[a]===r;)i(this.positions[3*a],this.positions[3*a+1],this.positions[3*a+2]),a++}static serialize(e,i){let r=new Float64Array(e.ids),a=new Uint32Array(e.positions);return function e(i,r,a,n){for(;a>1],s=a-1,l=n+1;for(;;){do s++;while(i[s]o)if(s>=l)break;o8(i,s,l),o8(r,3*s,3*l),o8(r,3*s+1,3*l+1),o8(r,3*s+2,3*l+2)}l-a`u_${e}`),this.type=r,this.context=a}setUniform(e,i,r,a,n){let o=a.constantOr(this.value);i.set(e,n,o instanceof iu?o.toPremultipliedRenderColor(this.lutExpression&&"constant"===this.lutExpression.kind&&"none"===this.lutExpression.value?null:this.context.lut):o)}getBinding(e,i){return"color"===this.type?new sa(e):new se(e)}}class sp{constructor(e,i){this.uniformNames=i.map(e=>`u_${e}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(e,i){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br),this.patternTransition=i?i.tl.concat(i.br):this.pattern}setUniform(e,i,r,a,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&&i.set(e,n,o)}getBinding(e,i){return"u_pattern"===i||"u_pattern_b"===i||"u_dash"===i?new sr(e):new se(e)}}class sf{constructor(e,i,r,a){this.expression=e,this.type=r,this.maxValue=0,this.paintVertexAttributes=i.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===r?2:1,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,i,r,a,n,o,s,l){let h=this.paintVertexArray.length,u="composite"===this.expression.kind||"source"===this.expression.kind?this.expression.evaluate(new nC(0,{brightness:o,worldview:l}),i,{},n,a,s):"constant"===this.expression.kind&&this.expression.value,c=sc(this.lutExpression,i,{},a,n,o,s,l);this.paintVertexArray.resize(e),this._setPaintValue(h,e,u,c?null:this.context.lut)}updatePaintArray(e,i,r,a,n,o,s,l){let h="composite"===this.expression.kind||"source"===this.expression.kind?this.expression.evaluate({zoom:0,brightness:s,worldview:l},r,a,void 0,n):"constant"===this.expression.kind&&this.expression.value,u=sc(this.lutExpression,r,a,n,void 0,s,void 0,l);this._setPaintValue(e,i,h,u?null:this.context.lut)}_setPaintValue(e,i,r,a){if("color"===this.type){let n=su(r.toPremultipliedRenderColor(a));for(let r=e;r`u_${e}_t`),this.type=r,this.useIntegerZoom=a,this.context=n,this.maxValue=0,this.paintVertexAttributes=i.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===r?4:2,offset:0})),this.paintVertexArray=new o}populatePaintArray(e,i,r,a,n,o,s,l){let h=this.expression.evaluate(new nC(this.context.zoom,{brightness:o,worldview:l}),i,{},n,a,s),u=this.expression.evaluate(new nC(this.context.zoom+1,{brightness:o,worldview:l}),i,{},n,a,s),c=sc(this.lutExpression,i,{},a,n,o,s,l),d=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(d,e,h,u,c?null:this.context.lut)}updatePaintArray(e,i,r,a,n,o,s,l){let h=this.expression.evaluate({zoom:this.context.zoom,brightness:s,worldview:l},r,a,void 0,n),u=this.expression.evaluate({zoom:this.context.zoom+1,brightness:s,worldview:l},r,a,void 0,n),c=sc(this.lutExpression,r,a,n,void 0,s,void 0,l);this._setPaintValue(e,i,h,u,c?null:this.context.lut)}_setPaintValue(e,i,r,a,n){if("color"===this.type){let o=su(r.toPremultipliedRenderColor(n)),s=su(a.toPremultipliedRenderColor(n));for(let r=e;r!0){this.binders={},this._buffers=[],this.context=i;const a=[];for(const n in e.paint._values){const o=e.paint.get(n);if(n.endsWith("-use-theme")||!r(n)||!(o instanceof nO&&aI(o.property.specification)))continue;const s=function(e,i){return sx[e]||[e.replace(`${i}-`,"").replace(/-/g,"_")]}(n,e.type),l=o.value,h=o.property.specification.type,u=!!o.property.useIntegerZoom,c="line-dasharray"===n||n.endsWith("pattern"),d=e.paint.get(`${n}-use-theme`),p="line-dasharray"===n&&"constant"!==e.layout.get("line-cap").value.kind||d&&"constant"!==d.value.kind;if("constant"!==l.kind||p)if("source"===l.kind||p||c){const i=sw(n,h,"source");this.binders[n]=c?new s_(l,s,h,i,e.id):new sf(l,s,h,i),a.push(`/a_${n}`)}else{const e=sw(n,h,"composite");this.binders[n]=new sm(l,s,h,u,i,e),a.push(`/z_${n}`)}else this.binders[n]=c?new sp(l.value,s):new sd(l.value,s,h,i),a.push(`/u_${n}`);d&&(this.binders[n].lutExpression=d.value)}this.cacheKey=a.sort().join("")}getMaxValue(e){let i=this.binders[e];return i instanceof sf||i instanceof sm?i.maxValue:0}populatePaintArrays(e,i,r,a,n,o,s,l){for(let h in this.binders){let u=this.binders[h];u.context=this.context,(u instanceof sf||u instanceof sm||u instanceof s_)&&u.populatePaintArray(e,i,r,a,n,o,s,l)}}setConstantPatternPositions(e,i){for(let r in this.binders){let a=this.binders[r];a instanceof sp&&a.setConstantPatternPositions(e,i)}}getPatternTransitionVertexBuffer(e){let i=this.binders[e];return i instanceof s_?i.paintTransitionVertexBuffer:null}updatePaintArrays(e,i,r,a,n,o,s,l,h,u){let c=!1,d=Object.keys(e),p=0!==d.length&&!l,f=p?d:i.uniqueIds;for(let l in this.context.lut=n.lut,this.binders){let d=this.binders[l];if(d.context=this.context,(d instanceof sf||d instanceof sm||d instanceof s_)&&d.expression&&d.expression.kind&&"constant"!==d.expression.kind&&(!0===d.expression.isStateDependent||!1===d.expression.isLightConstant)){for(let r of(d.expression=n.paint.get(l).value,f)){let n=e[r.toString()];i.eachPosition(r,(e,i,r)=>{let l=a.feature(e);d.updatePaintArray(i,r,l,n,o,s,h,u)})}if(!p)for(let i of r.uniqueIds){let n=e[i.toString()];r.eachPosition(i,(e,i,r)=>{let l=a.feature(e);d.updatePaintArray(i,r,l,n,o,s,h,u)})}c=!0}}return c}defines(){let e=[];for(let i in this.binders){let r=this.binders[i];(r instanceof sd||r instanceof sp)&&e.push(...r.uniformNames.map(e=>`#define HAS_UNIFORM_${e}`))}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){let i=[];for(let r in this.binders){let a=this.binders[r];if(a instanceof sd||a instanceof sp||a instanceof sm)for(let n of a.uniformNames)i.push({name:n,property:r,binding:a.getBinding(e,n)})}return i}setUniforms(e,i,r,a,n){for(let{name:i,property:o,binding:s}of r)this.binders[o].setUniform(e,s,n,a.get(o),i)}updatePaintBuffers(){for(let e in this._buffers=[],this.binders){let i=this.binders[e];(i instanceof sf||i instanceof sm||i instanceof s_)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer),i instanceof s_&&i.paintTransitionVertexBuffer&&this._buffers.push(i.paintTransitionVertexBuffer)}}upload(e){for(let i in this.binders){let r=this.binders[i];(r instanceof sf||r instanceof sm||r instanceof s_)&&r.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let i=this.binders[e];(i instanceof sf||i instanceof sm||i instanceof s_)&&i.destroy()}}}class sy{constructor(e,i,r=()=>!0){for(const a of(this.programConfigurations={},e))this.programConfigurations[a.id]=new sg(a,i,r);this.needsUpload=!1,this._featureMap=new o4,this._featureMapWithoutIds=new o4,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,i,r,a,n,o,s,l,h){for(let r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(e,i,a,n,o,s,l,h);void 0!==i.id?this._featureMap.add(i.id,r,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,r,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,r,a,n,o,s,l){for(let h of r)this.needsUpload=this.programConfigurations[h.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,i,h,a,n,o,s||0,l)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(let i in this.programConfigurations)this.programConfigurations[i].upload(e);this.needsUpload=!1}}destroy(){for(let e in this.programConfigurations)this.programConfigurations[e].destroy()}}let sx={"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"]},sv={"line-pattern":{source:oc,composite:oc},"fill-pattern":{source:oc,composite:oc},"fill-extrusion-pattern":{source:oc,composite:oc},"line-dasharray":{source:od,composite:od}},sb={color:{source:oR,composite:o_},number:{source:on,composite:oR}};function sw(e,i,r){let a=sv[e];return a&&a[r]||sb[i][r]}aW(sd,"ConstantBinder"),aW(sp,"PatternConstantBinder"),aW(sf,"SourceExpressionBinder"),aW(s_,"PatternCompositeBinder"),aW(sm,"CompositeExpressionBinder"),aW(sg,"ProgramConfiguration",{omit:["_buffers"]}),aW(sy,"ProgramConfigurationSet");let sT=8192/Math.PI/2,sS=[64,32,16],sE=-sT;function sI(e,i,r,a=sT){return[e*Math.sin(r*=e8)*a,-i*a,e*Math.cos(r)*a]}function sA(e,i,r){return sI(Math.cos(e*e8),Math.sin(e*e8),i,r)}let sM=2*Math.PI*6371008.8;class sC{constructor(e,i){if(isNaN(e)||isNaN(i))throw Error(`Invalid LngLat object: (${e}, ${i})`);if(this.lng=+e,this.lat=+i,this.lat>90||this.lat, lat: }, an object {lon: , lat: }, or an array of [, ]")}}class sP{constructor(e,i){e&&(i?this.setSouthWest(e).setNorthEast(i):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 sC?new sC(e.lng,e.lat):sC.convert(e),this}setSouthWest(e){return this._sw=e instanceof sC?new sC(e.lng,e.lat):sC.convert(e),this}extend(e){let i,r,a=this._sw,n=this._ne;if(e instanceof sC)i=e,r=e;else{if(!(e instanceof sP))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(sP.convert(e)):this.extend(sC.convert(e)):"object"==typeof e&&null!==e&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(sC.convert(e)):this;if(i=e._sw,r=e._ne,!i||!r)return this}return a||n?(a.lng=Math.min(i.lng,a.lng),a.lat=Math.min(i.lat,a.lat),n.lng=Math.max(r.lng,n.lng),n.lat=Math.max(r.lat,n.lat)):(this._sw=new sC(i.lng,i.lat),this._ne=new sC(r.lng,r.lat)),this}getCenter(){return new sC((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 sC(this.getWest(),this.getNorth())}getSouthEast(){return new sC(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){let{lng:i,lat:r}=sC.convert(e),a=this._sw.lngthis._ne.lng&&(a=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat=u)?(e(i,r,a,x,v,s,b,h,u),e(i,x,v,n,o,b,l,h,u)):i.push(l)}(s,n,o,u,c,a,h,i,r),n=u,o=c,a=h}return s}let sG=-16383-1;function sq(e,i,r){let a=e.loadGeometry(),n=e.extent,o=8192/n;if(i&&r&&r.projection.isReprojectedInTileSpace){let o=1{let r=sL((i.x+e.x/n)/o),a=sF((i.y+e.y/n)/o),c=u.project(r,a);e.x=(c.x*s-l)*n,e.y=(c.y*s-h)*n};for(let i=0;i=n||r.y=n||(c(r),e.push(r));a[i]=e}}for(let e of a)for(let i of e)!function(e,i){let r=Math.round(e.x*i),a=Math.round(e.y*i);e.x=tr(r,sG,16383),e.y=tr(a,sG,16383),(re.x+1||ae.y+1)&&t_("Geometry exceeds allowed extent, reduce your vector tile buffer size")}(i,o);return a}function sH(e,i){return{type:e.type,id:e.id,properties:e.properties,geometry:i?sq(e):[]}}class s${constructor(e,i,r,a,n){this.properties={},this.extent=r,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=a,this._values=n,e.readFields(sZ,this,i)}loadGeometry(){let e=this._pbf;e.pos=this._geometry;let i=e.readVarint()+e.pos,r=[],a,n=1,o=0,s=0,l=0;for(;e.pos>3}if(o--,1===n||2===n)s+=e.readSVarint(),l+=e.readSVarint(),1===n&&(a&&r.push(a),a=[]),a&&a.push(new e4(s,l));else{if(7!==n)throw Error(`unknown command ${n}`);a&&a.push(a[0].clone())}}return a&&r.push(a),r}bbox(){let e=this._pbf;e.pos=this._geometry;let i=e.readVarint()+e.pos,r=1,a=0,n=0,o=0,s=1/0,l=-1/0,h=1/0,u=-1/0;for(;e.pos>3}if(a--,1===r||2===r)n+=e.readSVarint(),o+=e.readSVarint(),nl&&(l=n),ou&&(u=o);else if(7!==r)throw Error(`unknown command ${r}`)}return[s,h,l,u]}toGeoJSON(e,i,r){let a,n=this.extent*Math.pow(2,r),o=this.extent*e,s=this.extent*i,l=this.loadGeometry();function h(e){return[360*(e.x+o)/n-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+s)/n)*Math.PI))-90]}function u(e){return e.map(h)}if(1===this.type){let e=[];for(let i of l)e.push(i[0]);let i=u(e);a=1===e.length?{type:"Point",coordinates:i[0]}:{type:"MultiPoint",coordinates:i}}else if(2===this.type){let e=l.map(u);a=1===e.length?{type:"LineString",coordinates:e[0]}:{type:"MultiLineString",coordinates:e}}else{if(3!==this.type)throw Error("unknown feature type");{let e=function(e){let i,r,a=e.length;if(a=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[e];let i=this._pbf.readVarint()+this._pbf.pos;return new s$(this._pbf,i,this.extent,this._keys,this._values)}}function sX(e,i,r){15===e?i.version=r.readVarint():1===e?i.name=r.readString():5===e?i.extent=r.readVarint():2===e?i._features.push(r.pos):3===e?i._keys.push(r.readString()):4===e&&i._values.push(function(e){let i=null,r=e.readVarint()+e.pos;for(;e.pos>3;i=1===r?e.readString():2===r?e.readFloat():3===r?e.readDouble():4===r?e.readVarint64():5===r?e.readVarint():6===r?e.readSVarint():7===r?e.readBoolean():null}if(null==i)throw Error("unknown feature value");return i}(r))}class sY{constructor(e,i){this.layers=e.readFields(sK,{},i)}}function sK(e,i,r){if(3===e){let e=new sW(r,r.readVarint()+r.pos);e.length&&(i[e.name]=e)}}let sJ="3d_elevation_id",sQ="level";class s0{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,i){return this._valid&&e(i(this._geometry)),this}require(e,i,r){return this.get(e,!0,i,r)}optional(e,i,r){return this.get(e,!1,i,r)}success(){return this._valid}get(e,i,r,a){let n=this.feature.properties.hasOwnProperty(e)?+this.feature.properties[e]:void 0;return this._valid&&void 0!==n&&!Number.isNaN(n)?r(a?a(n):n):i&&(this._valid=!1),this}}class s1{constructor(e,i){this.featureFunc=e,this.vertexFunc=i}parseFeature(e,i,r){return this.featureFunc(e,i,r)}parseVertex(e,i,r){return this.vertexFunc(e,i,r)}}let s2=new s1((e,i,r)=>e.reset(i).require(sJ,e=>{r.id=e}).optional("fixed_height_relative",e=>{r.constantHeight=e},s5.decodeRelativeHeight).geometry(e=>{r.bounds=e},ro).success(),(e,i,r)=>e.reset(i).require(sJ,e=>{r.id=e}).require("elevation_idx",e=>{r.idx=e}).require("extent",e=>{r.extent=e}).require("height_relative",e=>{r.height=e},s5.decodeRelativeHeight).geometry(e=>{r.position=e},s5.getPoint).success()),s3=new s1((e,i,r)=>e.reset(i).require(sJ,e=>{r.id=e}).optional("fixed_height",e=>{r.constantHeight=e},s5.decodeMetricHeight).geometry(e=>{r.bounds=e},ro).success(),(e,i,r)=>e.reset(i).require(sJ,e=>{r.id=e}).require("elevation_idx",e=>{r.idx=e}).require("extent",e=>{r.extent=e}).require("height",e=>{r.height=e},s5.decodeMetricHeight).geometry(e=>{r.position=e},s5.getPoint).success());class s5{static getPoint(e){return eY(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?s3:void 0:s2}static parse(e){let i=[],r=[],a=e.length,n=new s0;for(let o=0;oMath.abs(a))return!1;let n=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1])/a;return r[0]=this.pos[0]+this.dir[0]*n,r[1]=this.pos[1]+this.dir[1]*n,!0}}class s6{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,r){let a=eC(i,this.dir);if(1e-6>Math.abs(a))return!1;let n=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1]+(e[2]-this.pos[2])*i[2])/a;return r[0]=this.pos[0]+this.dir[0]*n,r[1]=this.pos[1]+this.dir[1]*n,r[2]=this.pos[2]+this.dir[2]*n,!0}closestPointOnSphere(e,i,r){var a,n,o,s,l,h,u;if(a=this.pos,n=a[0],o=a[1],s=a[2],l=e[0],h=e[1],u=e[2],Math.abs(n-l)=0);if(0===o)return 0;o!==i.length&&(r=!1)}return r?2:1}function s7(e,i){for(let r of e.projections){let a=s8(i,e.points[0],r.axis);if(r.projection[1]a[1])return 0}return 1}function le(e,i){let r=0,a=[0,0,0,0];for(let n=0;n=0&&r++;return r}class lt{static fromPoints(e){let i=[1/0,1/0,1/0],r=[-1/0,-1/0,-1/0];for(let a of e)ev(i,i,a),eb(r,r,a);return new lt(i,r)}static fromTileIdAndHeight(e,i,r){let a=1e.max[i]||e.min[i]>this.max[i])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 i=0;i{var i,r;return e.a0?ew(l,l,1/h):e_(l,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max0?e2(d,c)/b:0,T=tr(w,0,1),S=Math.abs((w-T)*this.edgeProps[e].len);eJ(p,m,g),a=r[1],n=-r[0],f[0]=a,f[1]=n;let E=S+Math.abs(e2(p,f));E=0;--o){let s=this.edges[o].a,l=this.edges[o].b,{position:h,height:u,extent:c}=this.vertices[s],{position:d,height:p,extent:f}=this.vertices[l],m=this.vertexProps[s].dir,_=this.vertexProps[l].dir;if(e_(i,h[0]/e,h[1]/e,u),e_(r,d[0]/e,d[1]/e,p),e_(a,m[1],-m[0],0),ew(a,a,c),e_(n,_[1],-_[0],0),ew(n,n,f),.0025000000000000005>=this.distSqLines(em(i[0]+.5*a[0],i[1]+.5*a[1],i[2]+.5*a[2]),em(r[0]-.5*n[0],r[1]-.5*n[1],r[2]-.5*n[2]),em(i[0]-.5*a[0],i[1]-.5*a[1],i[2]-.5*a[2]),em(r[0]+.5*n[0],r[1]+.5*n[1],r[2]+.5*n[2])))continue;let g=this.vertices.length,y=eK(eX(),h,d);this.vertices.push({position:eQ(y,y,.5),height:.5*(u+p),extent:.5*(c+f)});let x=eK(eX(),m,_);this.vertexProps.push({dir:e1(x,x)}),this.edges.splice(o,1),this.edgeProps.splice(o,1),this.edges.push({a:s,b:g}),this.edges.push({a:g,b:l});let v=eJ(eX(),this.vertices[g].position,h),b=e0(v),w={vec:v,dir:eQ(eX(),v,1/b),len:b};this.edgeProps.push(w),this.edgeProps.push(w)}}distSqLines(e,i,r,a){let n=ey(ed(),i,e),o=ey(ed(),a,r),s=ey(ed(),e,r),l=eC(n,n),h=eC(n,o),u=eC(n,s),c=eC(o,o),d=eC(o,s),p=l*c-h*h;return 0===p?eE(eR(n,r,a,eC(s,o)/eC(o,o)),e):eE(eR(n,e,i,(h*d-u*c)/p),eR(o,r,a,(l*d-h*u)/p))}}class la{static parseFrom(e,i){let r=s5.parse(e);if(!r)return[];let{vertices:a,features:n}=r,o=1/sN(i);n.sort((e,i)=>e.id-i.id),a.sort((e,i)=>e.id-i.id||e.idx-i.idx);let s=[],l=0,h=(a=a.filter((e,i,r)=>i===r.findIndex(i=>i.id===e.id&&i.idx===e.idx))).length;for(let e of n){if(e.constantHeight){s.push(new lr(e.id,e.bounds,e.constantHeight));continue}for(;l!==h&&a[l].ide.id===r)}}class ln{constructor(e,i){this.zScale=1,this.xOffset=0,this.yOffset=0,e.equals(i)||(this.zScale=Math.pow(2,i.z-e.z),this.xOffset=(e.x*this.zScale-i.x)*8192,this.yOffset=(e.y*this.zScale-i.y)*8192)}constantElevation(e,i){if(null!=e.constantHeight)return this.computeBiasedHeight(e.constantHeight,i)}pointElevation(e,i,r){let a=this.constantElevation(i,r);return null!=a?a:(e.x=e.x*this.zScale+this.xOffset,e.y=e.y*this.zScale+this.yOffset,this.computeBiasedHeight(i.pointElevation(e),r))}computeBiasedHeight(e,i){return i=0?e:Math.abs(.5*e))}}aW(lr,"ElevationFeature");class lo{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 oi,this.indexArray=new oT,this.segments=new o0,this.programConfigurations=new sy(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,"none"!==this.elevationMode&&(this.elevatedLayoutVertexArray=new on),this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,r,a){}populate(e,i,r,a){let n=this.layers[0],o=[],s=null;for(let{feature:l,id:h,index:u,sourceLayerIndex:c}of("circle"===n.type&&(s=n.layout.get("circle-sort-key")),e)){let e=this.layers[0]._featureFilter.needGeometry,n=sH(l,e);if(!this.layers[0]._featureFilter.filter(new nC(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),n,r))continue;let d=s?s.evaluate(n,{},r):void 0,p={id:h,properties:l.properties,type:l.type,sourceLayerIndex:c,index:u,geometry:e?n.geometry:sq(l,r,a),patterns:{},sortKey:d};o.push(p)}s&&o.sort((e,i)=>e.sortKey-i.sortKey);let l=null;for(let n of("globe"===a.projection.name&&(this.globeExtVertexArray=new op,l=a.projection),o)){let{geometry:a,index:o,sourceLayerIndex:s}=n,h=e[o].feature;this.addFeature(n,a,o,i.availableImages,r,l,i.brightness,i.elevationFeatures),i.featureIndex.insert(h,a,o,s,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(e,i,r,a,n,o,s){this.programConfigurations.updatePaintArrays(e,i,n,r,a,o,s,this.worldview)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,oK.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,oQ.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,oJ.members))),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.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy())}addFeature(e,i,r,a,n,o,s,l){let h;for(let r of("none"!==this.elevationMode&&(h=la.getElevationFeature(e,l)),i))for(let i of r){let r=i.x,a=i.y;if(r=8192||a=8192)continue;if(o){let e=o.projectTilePoint(r,a,n),i=o.upVector(n,r,a);this.addGlobeExtVertex(e,i),this.addGlobeExtVertex(e,i),this.addGlobeExtVertex(e,i),this.addGlobeExtVertex(e,i)}let s=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),l=s.vertexLength;if(this.addCircleVertex(r,a,-1,-1),this.addCircleVertex(r,a,1,-1),this.addCircleVertex(r,a,1,1),this.addCircleVertex(r,a,-1,1),"none"!==this.elevationMode){let e=h?h.pointElevation(new e4(r,a)):0;this.hasElevation=this.hasElevation||0!==e;for(let i=0;i1?r:r.sub(i)._mult(n)._add(i))}function lp(e,i){let r,a,n,o=!1;for(let s=0;si.y!=n.y>i.y&&i.xi.y!=s.y>i.y&&i.x=o.x&&n>=o.y)return!0;let o=[new e4(i,r),new e4(i,n),new e4(a,n),new e4(a,r)];if(e.length>2){for(let i of o)if(lf(e,i))return!0}for(let i=0;in.x&&i.x>n.x||e.yn.y&&i.y>n.y)return!1;let o=tg(e,i,r[0]);return o!==tg(e,i,r[1])||o!==tg(e,i,r[2])||o!==tg(e,i,r[3])}function lg(e,i,r,a,n,o){let s=i.y-e.y,l=e.x-i.x;if(o=o||0){let e=s*s+l*l;if(0===e)return!0;let i=Math.sqrt(e);s/=i,l/=i}return!((r.x-e.x)*s+(r.y-e.y)*l-o>i&&e.y===this.y>>i}url(e,i){var r,a,n;let o,s,l,h,u=(r=this.x,a=this.y,n=this.z,o=2**n,l=(s=2*Math.PI*6378137)*(r/o-.5),h=s*(.5-(a+1)/o),`${l},${h},${l+s/o},${h+s/o}`),c=function(e,i,r){let a,n="";for(let o=e;o>0;o--)n+=(i&(a=1this.canonical.z?new lE(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new lE(e,this.wrap,e,this.canonical.x>>i,this.canonical.y>>i)}calculateScaledKey(e,i=!0){if(this.overscaledZ===e&&i)return this.key;if(e>this.canonical.z)return lI(this.wrap*i,e,this.canonical.z,this.canonical.x,this.canonical.y);{let r=this.canonical.z-e;return lI(this.wrap*i,e,e,this.canonical.x>>r,this.canonical.y>>r)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;let i=this.canonical.z-e.canonical.z;return 0===e.overscaledZ||e.overscaledZ>i&&e.canonical.y===this.canonical.y>>i}children(e){if(this.overscaledZ>=e)return[new lE(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let i=this.canonical.z+1,r=2*this.canonical.x,a=2*this.canonical.y;return[new lE(i,this.wrap,i,r,a),new lE(i,this.wrap,i,r+1,a),new lE(i,this.wrap,i,r,a+1),new lE(i,this.wrap,i,r+1,a+1)]}isLessThan(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.y{let i=e.canonical.x-1,r=e.wrap;return i{let i=e.canonical.x+1,r=e.wrap;return i===1new lE(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,(0===e.canonical.y?1new lE(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y===(11?null:(r=e.a[i],a=e.b[i],n=e.angle,o=tr(s,0,1),l=Math.sin(n),Math.sin((1-o)*n)/l*r+Math.sin(o*n)/l*a+e.center[i])}function lO(e){if(e.z0){for(let e of l)ev(c,c,e),eb(u,u,e);return new lt(c,u)}let d=[o[12]*n,o[13]*n,o[14]*n],p=s.getCenter(),f=tr(e.center.lat,-85.051129,85.051129),m=tr(p.lat,-85.051129,85.051129),_=sz(e.center.lng),g=sD(f),y=_-sz(p.lng),x=g-sD(m);y>.5?y-=1:yMath.abs(x)?v=y>=0?1:3:(v=x>=0?0:2,eT(d,d,[o[4]*n,o[5]*n,o[6]*n],-Math.sin((x>=0?s.getSouth():s.getNorth())*e8)*sT));let b=l[v],w=l[(v+1)%4],T=new lL(b,w,d),S=[lF(T,0)||b[0],lF(T,1)||b[1],lF(T,2)||b[2]],E=lY(e.zoom);if(E>0){let a=function({x:e,y:i,z:r},a,n,o,s){let l=1/(1.5?p=-1:fMath.PI/2*1.01}let lQ=85*e8,l0=Math.cos(lQ),l1=Math.sin(lQ),l2=J(),l3=e=>{let i=[];return"map"===e.paint.get("circle-pitch-alignment")&&i.push("PITCH_WITH_MAP"),"map"===e.paint.get("circle-pitch-scale")&&i.push("SCALE_WITH_MAP"),i};function l5(e,i,r,a,n,o,s,l,h){if(o&&e.queryGeometry.isAboveHorizon)return!1;o&&(h*=e.pixelToTileUnitsFactor);let u=e.tileID.canonical,c=r.projection.upVectorScale(u,r.center.lat,r.worldSize).metersToTile;for(let p of i)for(let i of p){var d;let p=i.add(l),f=n&&r.elevation?r.elevation.exaggeration()*n.getElevationAt(p.x,p.y,!0):0,m=r.projection.projectTilePoint(p.x,p.y,u);if(f>0){let e=r.projection.upVector(u,p.x,p.y);m.x+=e[0]*c*f,m.y+=e[1]*c*f,m.z+=e[2]*c*f}let _=o?p:function(e,i,r,a){let n=eN([],[e,i,r,1],a);return new e4(n[0]/n[3],n[1]/n[3])}(m.x,m.y,m.z,a),g=o?e.tilespaceRays.map(e=>(function(e,i){let r=ed();return l4[2]=i,e.intersectsPlane(l4,l6,r),new e4(r[0],r[1])})(e,f)):e.queryGeometry.screenGeometry,y=eN([],[m.x,m.y,m.z,1],a);if(!s&&o?h*=y[3]/r.cameraToCenterDistance:s&&!o&&(h*=r.cameraToCenterDistance/y[3]),o){let e=sF((i.y/8192+u.y)/(1e.width||n.height>e.height||r.x>e.width-n.width||r.y>e.height-n.height)throw RangeError("out of range source coordinates for image copy");if(n.width>i.width||n.height>i.height||a.x>i.width-n.width||a.y>i.height-n.height)throw RangeError("out of range destination coordinates for image copy");let h=e.data,u=i.data,c=4===o&&l;for(let l=0;l{i[e.evaluationKey]=o;let s=e.expression.evaluate(i),l=s?s.toNonPremultipliedRenderColor(null):null;l&&(n.data[r+a+0]=Math.floor(255*l.r),n.data[r+a+1]=Math.floor(255*l.g),n.data[r+a+2]=Math.floor(255*l.b),n.data[r+a+3]=Math.floor(255*l.a))};if(e.clips)for(let i=0,n=0;i=r.next.y&&r.next.y!==r.y){let e=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(es&&(s=e,o=r.x=r.x&&r.x>=h&&a!==r.x&&hf(no.x||r.x===o.x&&(d=o,p=r,0>h_(d.prev,d,p.prev)&&0>h_(p.next,d,d.next))))&&(o=r,c=i)}r=r.next}while(r!==l)return o}(e,i);if(!r)return i;let a=hw(r,e);return hc(a,a.next),hc(r,r.next)}(n[e],r);return r}(e,i,h,r)),e.length>80*r){a=e[0],n=e[1];let i=a,s=n;for(let o=r;oi&&(i=r),l>s&&(s=l)}o=0!==(o=Math.max(i-a,s-n))?32767/o:0}return function e(i,r,a,n,o,s,l){if(!i)return;!l&&s&&function(e,i,r,a){let n=e;do 0===n.z&&(n.z=hp(n.x,n.y,i,r,a)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==e)n.prevZ.nextZ=null,n.prevZ=null,function(e){let i,r=1;do{let a,n=e;e=null;let o=null;for(i=0;n;){i++;let s=n,l=0;for(let e=0;e0||h>0&&s;)0!==l&&(0===h||!s||n.z1)}(n)}(i,n,o,s);let h=i;for(;i.prev!==i.next;){let u=i.prev,c=i.next;if(s?function(e,i,r,a){let n=e.prev,o=e.next;if(h_(n,e,o)>=0)return!1;let s=n.x,l=e.x,h=o.x,u=n.y,c=e.y,d=o.y,p=Math.min(s,l,h),f=Math.min(u,c,d),m=Math.max(s,l,h),_=Math.max(u,c,d),g=hp(p,f,i,r,a),y=hp(m,_,i,r,a),x=e.prevZ,v=e.nextZ;for(;x&&x.z>=g&&v&&v.z=p&&x.x=f&&x.y=0||(x=x.prevZ,v.x>=p&&v.x=f&&v.y=0))return!1;v=v.nextZ}for(;x&&x.z>=g;){if(x.x>=p&&x.x=f&&x.y=0)return!1;x=x.prevZ}for(;v&&v.z=p&&v.x=f&&v.y=0)return!1;v=v.nextZ}return!0}(i,n,o,s):function(e){let i=e.prev,r=e.next;if(h_(i,e,r)>=0)return!1;let a=i.x,n=e.x,o=r.x,s=i.y,l=e.y,h=r.y,u=Math.min(a,n,o),c=Math.min(s,l,h),d=Math.max(a,n,o),p=Math.max(s,l,h),f=r.next;for(;f!==i;){if(f.x>=u&&f.x=c&&f.y=0)return!1;f=f.next}return!0}(i))r.push(u.i,i.i,c.i),hS(i),i=c.next,h=c.next;else if((i=c)===h){l?1===l?e(i=function(e,i){let r=e;do{let a=r.prev,n=r.next.next;!hg(a,n)&&hy(a,r,r.next,n)&&hb(a,n)&&hb(n,a)&&(i.push(a.i,r.i,n.i),hS(r),hS(r.next),r=e=n),r=r.next}while(r!==e)return hc(r)}(hc(i),r),r,a,n,o,s,2):2===l&&function(i,r,a,n,o,s){let l=i;do{let i=l.next.next;for(;i!==l.prev;){var h,u;if(l.i!==i.i&&(h=l,u=i,h.next.i!==u.i&&h.prev.i!==u.i&&!function(e,i){let r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==i.i&&r.next.i!==i.i&&hy(r,r.next,e,i))return!0;r=r.next}while(r!==e)return!1}(h,u)&&(hb(h,u)&&hb(u,h)&&function(e,i){let r=e,a=!1,n=(e.x+i.x)/2,o=(e.y+i.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&n0&&h_(u.prev,u,u.next)>0))){let h=hw(l,i);return l=hc(l,l.next),h=hc(h,h.next),e(l,r,a,n,o,s,0),void e(h,r,a,n,o,s,0)}i=i.next}l=l.next}while(l!==i)}(i,r,a,n,o,s):e(hc(i),r,a,n,o,s,1);break}}}(h,u,r,a,n,o,0),u}function hu(e,i,r,a,n){let o;if(n===function(e,i,r,a){let n=0;for(let o=i,s=r-a;o0)for(let n=i;n=i;n-=a)o=hT(n/a|0,e[n],e[n+1],o);return o&&hg(o,o.next)&&(hS(o),o=o.next),o}function hc(e,i){if(!e)return e;i||(i=e);let r,a=e;do if(r=!1,a.steiner||!hg(a,a.next)&&0!==h_(a.prev,a,a.next))a=a.next;else{if(hS(a),(a=i=a.prev)===a.next)break;r=!0}while(r||a!==i)return i}function hd(e,i){let r=e.x-i.x;return 0===r&&0==(r=e.y-i.y)&&(r=(e.next.y-e.y)/(e.next.x-e.x)-(i.next.y-i.y)/(i.next.x-i.x)),r}function hp(e,i,r,a,n){return(e=0x55555555&((e=0x33333333&((e=0xf0f0f0f&((e=0xff00ff&((e=(e-r)*n|0)|e=(e-s)*(o-l)&&(e-s)*(a-l)>=(r-s)*(i-l)&&(r-s)*(o-l)>=(n-s)*(a-l)}function hm(e,i,r,a,n,o,s,l){return(e!==s||i!==l)&&hf(e,i,r,a,n,o,s,l)}function h_(e,i,r){return(i.y-e.y)*(r.x-i.x)-(i.x-e.x)*(r.y-i.y)}function hg(e,i){return e.x===i.x&&e.y===i.y}function hy(e,i,r,a){let n=hv(h_(e,i,r)),o=hv(h_(e,i,a)),s=hv(h_(r,a,e)),l=hv(h_(r,a,i));return n!==o&&s!==l||!(0!==n||!hx(e,r,i))||!(0!==o||!hx(e,a,i))||!(0!==s||!hx(r,e,a))||!(0!==l||!hx(r,i,a))}function hx(e,i,r){return i.x=Math.min(e.x,r.x)&&i.y=Math.min(e.y,r.y)}function hv(e){return e>0?1:eh_(e.prev,e,e.next)?h_(e,i,e.next)>=0&&h_(e,e.prev,i)>=0:0>h_(e,i,e.prev)||0>h_(e,e.next,i)}function hw(e,i){let r=hE(e.i,e.x,e.y),a=hE(i.i,i.x,i.y),n=e.next,o=i.prev;return e.next=i,i.prev=e,r.next=n,n.prev=r,a.next=r,r.prev=a,o.next=a,a.prev=o,a}function hT(e,i,r,a){let n=hE(e,i,r);return a?(n.next=a.next,n.prev=a,a.next.prev=n,a.next=n):(n.prev=n,n.next=n),n}function hS(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 hE(e,i,r){return{i:e,x:i,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function hI(e,i){let r,a,n=e.length;if(n1)for(let e=0;ei)}){for(;n>a;){if(n-a>600){let s=n-a+1,l=r-a+1,h=Math.log(s),u=.5*Math.exp(2*h/3),c=.5*Math.sqrt(h*u*(s-u)/s)*(l-s/20&&re(i,a,n);lo(i[l],s);)l++;for(;o(i[h],s)>0;)h--}0===o(i[a],s)?re(i,a,h):re(i,++h,n),h=8192&&i>=8192}static evaluate(e){if(0===e.length)return new hR;let i=[];for(let r of e)i.push(...r.portals);if(0===i.length)return new hR;for(let e of i){let i=e.va,r=e.vb;(hR.isOnBorder(i.x,r.x)||hR.isOnBorder(i.y,r.y))&&(e.type="border")}let r=i.filter(e=>"unevaluated"!==e.type),a=i.filter(e=>"unevaluated"===e.type);if(0===a.length)return new hR;a.sort((e,i)=>e.hash===i.hash?e.isTunnel===i.isTunnel?0:e.isTunnel?-1:1:e.hashe.hash"fill-tunnel-structure-color"!==e),this.tunnelProgramConfigurations=new sy(i,{zoom:r,lut:a},e=>"fill-bridge-guard-rail-color"!==e)}addVertices(e,i){let r=this.unevalVertices.length;for(let r=0;r=n.min.x&&u.x=n.min.y&&u.y=n.min.x&&c.x=n.min.y&&c.yMath.abs(d)&&.01>Math.abs(p)?c="entrance":(this.isOnBorder(s.x,l.x)||this.isOnBorder(s.y,l.y))&&(c="border");let f=hD.computeEdgeHash(s,l);this.unevaluatedPortals.portals.push({connection:{a:e,b:void 0},va:s,vb:l,vab:h,length:u,hash:f,isTunnel:r,type:c});let m=hD.computePosHash(s);this.vertexHashLookup.set(m,{prev:o,next:f}),o=f}}}construct(e){if(0===this.unevalVertices.length)return;let i=()=>({vertexOffset:0,primitiveOffset:this.indexArray.length}),r=e=>{e.primitiveLength=this.indexArray.length-e.primitiveOffset},a=new hz(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(e.portals,this.unevalEdges);let n=i(),o=i(),s=i(),l=(e,i)=>{e.sort((e,r)=>e.type===i&&r.type!==i?-1:+(e.type!==i&&r.type===i));let r=e.findIndex(e=>e.type!==i);return r>=0?r:e.length},h=0;this.unevalEdges.length>0&&(h=l(this.unevalEdges,"none"),this.constructBridgeStructures(a,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:h},this.tileToMeters)),r(s);let u=i(),c=i();if(this.unevalEdges.length>0){let e=this.unevalEdges.splice(h),i=l(e,"tunnel")+h;this.unevalEdges.push(...e),this.constructTunnelStructures(a,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:h},{min:h,max:i})}r(u),a.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),r(c),a.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),r(o),a.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),r(n),this.maskSegments=o0.simpleSegment(0,c.primitiveOffset,0,c.primitiveLength),this.depthSegments=o0.simpleSegment(0,o.primitiveOffset,0,o.primitiveLength),this.renderableBridgeSegments=o0.simpleSegment(0,s.primitiveOffset,0,s.primitiveLength),this.renderableTunnelSegments=o0.simpleSegment(0,u.primitiveOffset,0,u.primitiveLength),this.shadowCasterSegments=o0.simpleSegment(0,n.primitiveOffset,0,n.primitiveLength)}update(e,i,r,a,n,o,s,l){this.bridgeProgramConfigurations.updatePaintArrays(e,i,n,r,a,o,s,l),this.tunnelProgramConfigurations.updatePaintArrays(e,i,n,r,a,o,s,l)}upload(e){this.vertexBuffer||0===this.vertexPositions.length||0===this.vertexNormals.length||0===this.indexArray.length||(this.vertexBuffer=e.createVertexBuffer(this.vertexPositions,hs.members),this.vertexBufferNormal=e.createVertexBuffer(this.vertexNormals,hl.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,i,r,a,n){let o=(o,s)=>{for(let l=0;le_(e,i[a].x,i[a].y,r[a]*l),c=ed(),d=ed(),p=ed(),f=ed(),m=ed(),_=(e,r)=>{let a=s.get(hD.computePosHash(i[r])),n=a.from,o=a.to;if(!n||!o)return;u(c,n),u(d,r),u(p,o),eF(f),eO(c,d)||(ey(m,d,c),eM(f,m)),eO(p,d)||(ey(m,p,d),eg(f,f,eM(m,m)));let l=ef(f);return l>0?ew(e,f,1/l):void 0},g=1/0;this.sortSubarray(a,n.min,n.max,(e,i)=>e.featureInfo.featureIndex-i.featureInfo.featureIndex);let y=ed(),x=ed(),v=ed(),b=ed(),w=ed(),T=ed(),S=ed(),E=ed(),I=ed(),A=[ed(),ed(),ed(),ed()],M=[ed(),ed(),ed(),ed()],C=[{coord:new e4(0,0),height:0},{coord:new e4(0,0),height:0}],P=(e,i)=>e>i;for(let u=n.min;ue.featureInfo.featureIndex-i.featureInfo.featureIndex;this.sortSubarray(a,n.min,n.max,l),this.sortSubarray(a,o.min,o.max,l);let h=e=>eM(e,e),u=[{coord:new e4(0,0),height:0},{coord:new e4(0,0),height:0}],c=(e,i)=>ee.hash===i.hash?i.polygonIdx-e.polygonIdx:i.hash>e.hash?1:-1);let r=0,a=0,n=0,o=i[0].polygonIdx;do(++a===i.length||i[r].hash!==i[a].hash)&&((1==a-r||i[a-1].polygonIdx!==o)&&(ne.portalHasho.hash?r++:o.hash>n.portalHash?a++:(n.type=o.type,r++)}}}isOnBorder(e,i){return e=8192&&i>=8192}addFeatureSection(e,i,r,a){return e!==i&&(i=e,r.push({featureIndex:e,vertexStart:a.getVertexCount()}),a.clearVertexLookup()),i}sortSubarray(e,i,r,a){let n=e.slice(i,r);n.sort(a),e.splice(i,n.length,...n)}static computeEdgeHash(e,i){return(e.y===i.y&&e.x>i.x||e.y>i.y)&&([e,i]=[i,e]),BigInt(hD.computePosHash(e))>>0}}function hL(e,i){return e>i?1:en(r.key,e)?r.right:r.left}else for(;r;)a=r,r=0>n(r.key,e)?r.right:r.left;return r={key:e,data:i,left:null,right:null,parent:a},a?0>n(a.key,r.key)?a.right=r:a.left=r:this._root=r,this.splay(r),this._size++,r}find(e){for(var i=this._root,r=this._compare;i;){var a=r(i.key,e);if(a0))return i;i=i.left}}return null}contains(e){for(var i=this._root,r=this._compare;i;){var a=r(e,i.key);if(0===a)return!0;i=a0?(e(i=r.pop(),n++),i=i.right):a=!0;return this}range(e,i,r,a){let n=[],o=this._compare,s=this._root;for(;0!==n.length||s;)if(s)n.push(s),s=s.left;else{if(o((s=n.pop()).key,i)>0)break;if(o(s.key,e)>=0&&r.call(a,s))return this;s=s.right}return this}keys(){for(var e=this._root,i=[],r=[],a=!1;!a;)e?(i.push(e),e=e.left):i.length>0?(r.push((e=i.pop()).key),e=e.right):a=!0;return r}values(){for(var e=this._root,i=[],r=[],a=!1;!a;)e?(i.push(e),e=e.left):i.length>0?(r.push((e=i.pop()).data),e=e.right):a=!0;return r}at(e){for(var i=this._root,r=[],a=!1,n=0;!a;)if(i)r.push(i),i=i.left;else if(r.length>0){if(i=r.pop(),n===e)return i;n++,i=i.right}else a=!0;return null}load(e=[],i=[],r=!1){if(0!==this._size)throw Error("bulk-load: tree is not empty");let a=e.length;return r&&function e(i,r,a,n,o){if(a>=n)return;let s=i[a+n>>1],l=a-1,h=n+1;for(;;){do l++;while(0>o(i[l],s))do h--;while(o(i[h],s)>0)if(l>=h)break;let e=i[l];i[l]=i[h],i[h]=e,e=r[l],r[l]=r[h],r[h]=e}e(i,r,a,h,o),e(i,r,h+1,n,o)}(e,i,0,a-1,this._compare),this._root=function e(i,r,a,n,o){let s=o-n;if(s>0){let l=n+Math.floor(s/2),h={key:r[l],data:a[l],parent:i};return h.left=e(h,r,a,n,l),h.right=e(h,r,a,l+1,o),h}return null}(null,e,i,0,a),this._size=a,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,i,r,a,n){return new hF(r,n).load(e,i,a)}}let hO=(3+8881784197001252e-31)*11102230246251565e-32;function hk(e,i,r,a,n){let o,s,l,h,u=i[0],c=a[0],d=0,p=0;c>u==c>-u?(o=u,u=i[++d]):(o=c,c=a[++p]);let f=0;if(du==c>-u?(s=u+o,l=o-(s-u),u=i[++d]):(s=c+o,l=o-(s-c),c=a[++p]),o=s,0!==l&&(n[f++]=l);du==c>-u?(h=(s=o+u)-o,l=o-(s-h)+(u-h),u=i[++d]):(h=(s=o+c)-o,l=o-(s-h)+(c-h),c=a[++p]),o=s,0!==l&&(n[f++]=l);for(;d0:(r[0]-e[0])*(i[1]-e[1])-(i[0]-e[0])*(r[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(){let e=new h$(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 hZ(e,i){return e[0]===i[0]&&e[1]===i[1]}function hW(e,i,r){let a=function(e,i,r,a,n,o){let s=(i-o)*(r-n),l=(e-n)*(a-o),h=s-l;if(0===s||0===l||s>0!=l>0)return h;let u=Math.abs(s+l);return Math.abs(h)>=33306690738754716e-32*u?h:-function(e,i,r,a,n,o,s){let l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,E,I=e-n,A=r-n,M=i-o,C=a-o;b=I*C,f=(p=0x8000001*I)-(p-I),m=I-f,_=(p=0x8000001*C)-(p-C),w=m*(g=C-_)-(b-f*_-m*_-f*g),T=M*A,f=(p=0x8000001*M)-(p-M),m=M-f,_=(p=0x8000001*A)-(p-A),y=w-(S=m*(g=A-_)-(T-f*_-m*_-f*g)),d=w-y,hV[0]=w-(y+d)+(d-S),d=(x=b+y)-b,y=(v=b-(x-d)+(y-d))-T,d=v-y,hV[1]=v-(y+d)+(d-T),d=(E=x+y)-x,hV[2]=x-(E-d)+(y-d),hV[3]=E;let P=function(e){let i=e[0];for(let r=1;r=R||-P>=R||(d=e-I,l=e-(I+d)+(d-n),d=r-A,u=r-(A+d)+(d-n),d=i-M,h=i-(M+d)+(d-o),d=a-C,c=a-(C+d)+(d-o),0===l&&0===h&&0===u&&0===c)||(R=11093356479670487e-47*s+hO*Math.abs(P),(P+=I*c+C*l-(M*u+A*h))>=R||-P>=R))return P;b=l*C,f=(p=0x8000001*l)-(p-l),m=l-f,_=(p=0x8000001*C)-(p-C),w=m*(g=C-_)-(b-f*_-m*_-f*g),T=h*A,f=(p=0x8000001*h)-(p-h),m=h-f,_=(p=0x8000001*A)-(p-A),y=w-(S=m*(g=A-_)-(T-f*_-m*_-f*g)),d=w-y,hG[0]=w-(y+d)+(d-S),d=(x=b+y)-b,y=(v=b-(x-d)+(y-d))-T,d=v-y,hG[1]=v-(y+d)+(d-T),d=(E=x+y)-x,hG[2]=x-(E-d)+(y-d),hG[3]=E;let z=hk(4,hV,4,hG,hN);b=I*c,f=(p=0x8000001*I)-(p-I),m=I-f,_=(p=0x8000001*c)-(p-c),w=m*(g=c-_)-(b-f*_-m*_-f*g),T=M*u,f=(p=0x8000001*M)-(p-M),m=M-f,_=(p=0x8000001*u)-(p-u),y=w-(S=m*(g=u-_)-(T-f*_-m*_-f*g)),d=w-y,hG[0]=w-(y+d)+(d-S),d=(x=b+y)-b,y=(v=b-(x-d)+(y-d))-T,d=v-y,hG[1]=v-(y+d)+(d-T),d=(E=x+y)-x,hG[2]=x-(E-d)+(y-d),hG[3]=E;let D=hk(z,hN,4,hG,hU);b=l*c,f=(p=0x8000001*l)-(p-l),m=l-f,_=(p=0x8000001*c)-(p-c),w=m*(g=c-_)-(b-f*_-m*_-f*g),T=h*u,f=(p=0x8000001*h)-(p-h),m=h-f,_=(p=0x8000001*u)-(p-u),y=w-(S=m*(g=u-_)-(T-f*_-m*_-f*g)),d=w-y,hG[0]=w-(y+d)+(d-S),d=(x=b+y)-b,y=(v=b-(x-d)+(y-d))-T,d=v-y,hG[1]=v-(y+d)+(d-T),d=(E=x+y)-x,hG[2]=x-(E-d)+(y-d),hG[3]=E;let L=hk(D,hU,4,hG,hj);return hj[L-1]}(e,i,r,a,n,o,u)}(e[0],e[1],i[0],i[1],r[0],r[1]);return a>0?-1:+(aa[0]?1:r[0]a[1]?1:-1:e.left!==i.left?e.left?1:-1:0!==hW(r,e.otherEvent.point,i.otherEvent.point)?e.isBelow(i.otherEvent.point)?-1:1:!e.isSubject&&i.isSubject?1:-1}function hY(e,i,r){let a=new h$(i,!1,e,e.isSubject),n=new h$(i,!0,e.otherEvent,e.isSubject);return hZ(e.point,e.otherEvent.point)&&console.warn("what is that, a collapsed segment?",e),a.contourId=n.contourId=e.contourId,hX(n,e.otherEvent)>0&&(e.otherEvent.left=!0,n.left=!1),e.otherEvent.otherEvent=n,e.otherEvent=a,r.push(n),r.push(a),r}function hK(e,i){return e[0]*i[1]-e[1]*i[0]}function hJ(e,i){return e[0]*i[0]+e[1]*i[1]}function hQ(e,i,r){let a=function(e,i,r,a){let n=[i[0]-e[0],i[1]-e[1]],o=[a[0]-r[0],a[1]-r[1]];function s(e,i,r){return[e[0]+i*r[0],e[1]+i*r[1]]}let l=[r[0]-e[0],r[1]-e[1]],h=hK(n,o),u=h*h,c=hJ(n,n);if(u>0){let i=hK(l,o)/h;if(i1)return null;let a=hK(l,n)/h;return a1?null:0===i||1===i?[s(e,i,n)]:0===a||1===a?[s(r,a,o)]:[s(e,i,n)]}if((u=(h=hK(l,n))*h)>0)return null;let d=hJ(n,l)/c,p=d+hJ(n,o)/c,f=Math.min(d,p),m=Math.max(d,p);return f=0?1===f?[s(e,f>0?f:0,n)]:0===m?[s(e,m0?f:0,n),s(e,m(i.contourId??0)?1:-1}return 1===hX(e,i)?1:-1}class h1{constructor(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null}isExterior(){return null==this.holeOf}}let h2=Math.max,h3=Math.min,h5=0;function h4(e,i,r,a,n,o){let s,l,h,u,c,d;for(s=0,l=e.length-1;s0?d.left=!0:c.left=!0;let l=h[0],p=h[1];n[0]=h3(n[0],l),n[1]=h3(n[1],p),n[2]=h2(n[2],l),n[3]=h2(n[3],p),a.push(c),a.push(d)}}let h6=[];function h8(e,i,r){var a,n,o,s;let l,h,u=e,c=i;"number"==typeof e[0][0][0]&&(u=[e]),"number"==typeof i[0][0][0]&&(c=[i]);let d=(a=u,n=c,l=null,a.length*n.length==0&&(0===r?l=h6:2===r?l=a:(1===r||3===r)&&(l=0===a.length?n:a)),l);if(d)return d===h6?null:d;let p=[1/0,1/0,-1/0,-1/0],f=[1/0,1/0,-1/0,-1/0],m=function(e,i,r,a,n){let o,s,l,h,u,c,d=new rb(void 0,hX);for(l=0,h=e.length;lf[2]||f[0]>p[2]||p[1]>f[3]||f[1]>p[3])&&(0===r?h=h6:2===r?h=o:(1===r||3===r)&&(h=o.concat(s))),d=h)return d===h6?null:d;let _=function(e){let i,r,a=function(e){let i,r,a,n,o,s=[];for(r=0,a=e.length;r0){let e=i[o];if(null!=e.holeOf){let n=e.holeOf;i[n].holeIds.push(r),a.holeOf=n,a.depth=i[o].depth}else i[o].holeIds.push(r),a.holeOf=o,a.depth=i[o].depth+1}else a.holeOf=null,a.depth=i[o].depth}else a.holeOf=null,a.depth=0;return a}(a[i],o,e),s=i=>{n[i]=!0,ia;)o--;return o}(l,a,n,h))==h||l>=a.length)&&a[l];);o.push(r)}return o}(function(e,i,r,a){let n,o,s,l=new hF(h0),h=[],u=Math.min(i[2],r[2]);for(;0!==e.length;){let r=e.pop();if(h.push(r),0===a&&r.point[0]>u||2===a&&r.point[0]>i[2])break;if(r.left){o=n=l.insert(r),n=n!==(s=l.minNode())?l.prev(n):null,o=l.next(o);let i=n?n.key:null;if(hq(r,i,a),o&&2===hQ(r,o.key,e)&&(hq(r,i,a),hq(o.key,r,a)),n&&2===hQ(n.key,r,e)){let e=n;hq(i,(e=e!==s?l.prev(e):null)?e.key:null,a),hq(r,i,a)}}else r=r.otherEvent,o=n=l.find(r),n&&o&&(n=n!==s?l.prev(n):null,o=l.next(o),l.remove(r),o&&n&&hQ(n.key,o.key,e))}return h}(m,p,f,r)),g=[];for(let e=0;e<_.length i="_[e];if(i.isExterior()){let" e="[i.points];for(let" r="0;r<i.holeIds.length;r++)e.push(_[i.holeIds[r]].points);g.push(e)}}return" g h9 n="[],o=0===a?(e,i,r,a,n,o)=">{e.push(new e4(o,r+(o-i)/(a-i)*(n-r)))}:(e,i,r,a,n,o)=>{e.push(new e4(i+(o-r)/(n-r)*(a-i),o))};for(let s of e){let e=[];for(let n of s){if(n.lengthi&&o(s,l,h,u,c,i):d>r?p=i&&o(s,l,h,u,c,i),p>r&&d=i&&he.map(e=>[e.x*i,e.y*i]))]}function ue(e,i=1,r){return e.map(e=>e.map((e,a)=>{let n=e.map(e=>{let a=e[0],n=e[1];return r&&(a=Math.round(a/r)*r,n=Math.round(n/r)*r),new e4(a*i,n*i)._round()});return a>0&&n.reverse(),n}))}class ut{constructor(e,i){this.layoutVertexArray=new oi,this.indexArray=new oT,this.lineIndexArray=new oy,this.triangleSegments=new o0,this.lineSegments=new o0,this.programConfigurations=new sy(e.layers,{zoom:e.zoom,lut:e.lut}),this.uploaded=!1,i&&(this.elevatedLayoutVertexArray=new on)}update(e,i,r,a,n,o,s,l){this.programConfigurations.updatePaintArrays(e,i,n,r,a,o,s,l)}isEmpty(){return 0===this.layoutVertexArray.length}needsUpload(){return this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,hn.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.lineIndexBuffer=e.createIndexBuffer(this.lineIndexArray),this.elevatedLayoutVertexArray&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,ho.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy())}populatePaintArrays(e,i,r,a,n,o,s){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,r,a,n,o,void 0,s)}}class ui{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 ut(e,!1),this.elevationBufferData=new ut(e,!0),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.projection=e.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference"),this.sourceLayerIndex=e.sourceLayerIndex,this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,r,a){}populate(e,i,r,a){this.hasPattern=hC("fill",this.layers,this.pixelRatio,i);let n=this.layers[0].layout.get("fill-sort-key"),o=[];for(let{feature:s,id:l,index:h,sourceLayerIndex:u}of e){let e=this.layers[0]._featureFilter.needGeometry,c=sH(s,e);if(!this.layers[0]._featureFilter.filter(new nC(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),c,r))continue;let d=n?n.evaluate(c,{},r,i.availableImages):void 0,p={id:l,properties:s.properties,type:s.type,sourceLayerIndex:u,index:h,geometry:e?c.geometry:sq(s,r,a),patterns:{},sortKey:d};o.push(p)}for(let a of(n&&o.sort((e,i)=>e.sortKey-i.sortKey),o)){let{geometry:n,index:o,sourceLayerIndex:s}=a;if(this.hasPattern){let e=hP("fill",this.layers,a,this.zoom,this.pixelRatio,i);this.patternFeatures.push(e)}else this.addFeature(a,n,o,r,{},i.availableImages,i.brightness,i.elevationFeatures);i.featureIndex.insert(e[o].feature,n,o,s,this.index)}}update(e,i,r,a,n,o,s){this.bufferData.update(e,i,r,a,n,o,s,this.worldview),this.elevationBufferData.update(e,i,r,a,n,o,s,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(e,i,r,a,n,o,s,this.worldview)}addFeatures(e,i,r,a,n,o){for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,i,r,a,o,e.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(e){this.bufferData.upload(e),this.elevationBufferData.upload(e),this.elevatedStructures&&this.elevatedStructures.upload(e)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}addFeature(e,i,r,a,n,o=[],s,l){let h=hI(i,500);"none"!==this.elevationMode?this.addElevatedRoadFeature(e,h,a,r,l):this.addGeometry(h,this.bufferData),this.bufferData.populatePaintArrays(e,r,n,o,a,s,this.worldview),this.elevationBufferData.populatePaintArrays(e,r,n,o,a,s,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}setEvaluatedPortalGraph(e,i,r,a,n){this.elevatedStructures&&(this.elevatedStructures.construct(e),this.elevatedStructures.populatePaintArrays(i,r,a,n,this.worldview))}addElevatedRoadFeature(e,i,r,a,n){let o=[],s=la.getElevationFeature(e,n);if(!s)return void this.addGeometry(i,this.bufferData);{let e=this.clipPolygonsToTile(i,1);e.length>0&&o.push({polygons:e,elevationFeature:s,elevationTileID:r})}let l={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(e,{},r),featureIndex:a};for(let i of o)if(i.elevationFeature){if("hd-road-base"===this.elevationMode){this.elevatedStructures||(this.elevatedStructures=new hD(i.elevationTileID,this.layers,this.zoom,this.lut));let r=i.elevationFeature.isTunnel(),a=0;e.properties.hasOwnProperty(sQ)&&(a=+e.properties[sQ]),this.elevatedStructures.addPortalCandidates(i.elevationFeature.id,i.polygons,r,i.elevationFeature,a)}null==i.elevationFeature.constantHeight&&(i.polygons=this.prepareElevatedPolygons(i.polygons,i.elevationFeature,i.elevationTileID));let n=new ln(r,i.elevationTileID);this.addElevatedGeometry(i.polygons,n,i.elevationFeature,.05*("hd-road-base"!==this.elevationMode),a,l)}}addElevatedGeometry(e,i,r,a,n,o){let[s,l]=this.addGeometry(e,this.elevationBufferData,{elevation:r,elevationSampler:i,bias:a,index:n,featureInfo:o});null==this.elevationBufferData.heightRange?this.elevationBufferData.heightRange={min:s,max:l}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,s),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,l))}addGeometry(e,i,r){let a=1/0,n=-1/0,o=null;r&&null!=(o=r.elevationSampler.constantElevation(r.elevation,r.bias))&&(a=o,n=o);let s=(e,s,l)=>{if(null!=r)if(s.push(e),null!=o)i.elevatedLayoutVertexArray.emplaceBack(o),l.push(o);else{let o=r.elevationSampler.pointElevation(e,r.elevation,r.bias);i.elevatedLayoutVertexArray.emplaceBack(o),l.push(o),a=Math.min(a,o),n=Math.max(n,o)}};for(let a of e){let e=0;for(let i of a)e+=i.length;let n=i.triangleSegments.prepareSegment(e,i.layoutVertexArray,i.indexArray),o=n.vertexLength,l=[],h=[],u=[],c=[],d=[],p=i.layoutVertexArray.length;for(let e of a){if(0===e.length)continue;e!==a[0]&&h.push(l.length/2);let n=i.lineSegments.prepareSegment(e.length,i.layoutVertexArray,i.lineIndexArray),o=n.vertexLength;r&&d.push(i.layoutVertexArray.length-p),s(e[0],u,c),i.layoutVertexArray.emplaceBack(e[0].x,e[0].y),i.lineIndexArray.emplaceBack(o+e.length-1,o),l.push(e[0].x),l.push(e[0].y);for(let r=1;r0&&r&&"hd-road-base"===this.elevationMode){let e=r.elevation.isTunnel(),i=r.elevation.safeArea,a=this.elevatedStructures.addVertices(u,c);this.elevatedStructures.addTriangles(f,a,e);let n=d.length;if(n>0){for(let o=0;o0&&(r=h8(r,a,2)),ue(r,152587890625e-16,128)}(r,new li(i,a));n.push(...e)}return n}clipPolygonsToTile(e,i){let r=-i,a=-i,n=8192+i,o=8192+i,s=0,l=[],h=[];for(;s=r&&u.max.x=a&&u.max.ye.cellIdx-i.cellIdx||e.triIdx-i.triIdx);let u=0;for(;uthis.max.x||this.min.x>e.x||e.y>this.max.y||this.min.y>e.y)return;let r=ua(e.x-this.min.x,this.xScale,this.cellsX),a=ua(e.y-this.min.y,this.yScale,this.cellsY),n=this.cells[a*this.cellsX+r];if(n){this._lazyInitLookup();for(let e=0;ethis.max.x||this.min.x>i.x||e.y>this.max.y||this.min.y>i.y)return;this._lazyInitLookup();let a=ua(e.x-this.min.x,this.xScale,this.cellsX),n=ua(i.x-this.min.x,this.xScale,this.cellsX),o=ua(e.y-this.min.y,this.yScale,this.cellsY),s=ua(i.y-this.min.y,this.yScale,this.cellsY);for(let e=o;ee.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,i){for(let r of this.footprints)i.push({footprint:r,id:e})}updateAppearances(e,i,r,a){}populate(e,i,r,a){let n=[];for(let{feature:o,id:s,index:l,sourceLayerIndex:h}of e){let e=this.layers[0]._featureFilter.needGeometry,u=sH(o,e);if(!this.layers[0]._featureFilter.filter(new nC(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),u,r))continue;let c={id:s,properties:o.properties,type:o.type,sourceLayerIndex:h,index:l,geometry:e?u.geometry:sq(o,r,a),patterns:{}};n.push(c)}for(let a of n){let{geometry:n,index:o,sourceLayerIndex:s}=a;this.addFeature(a,n,o,r,{},i.availableImages,i.brightness),i.featureIndex.insert(e[o].feature,n,o,s,this.index)}}isEmpty(){return 0===this.footprints.length}uploadPending(){return!1}upload(e){}update(e,i,r,a,n,o,s){}destroy(){}addFeature(e,i,r,a,n,o=[],s){for(let e of hI(i,2)){let i=[],r=[],a=[],n=new e4(1/0,1/0),o=new e4(-1/0,-1/0);for(let s of e)if(0!==s.length){s!==e[0]&&a.push(r.length/2);for(let e=0;ee===a)}function ug(e,i){return e.x-i.x||e.y-i.y}function uy(e,i){return 0===ug(e.min,i.min)&&0===ug(e.max,i.max)}function ux(e,i){return!(e.min.x>i.max.x||e.max.xi.max.y||e.max.y0&&(a.length>1&&r.push(a),a=[])}return a.length>1&&r.push(a),r}let uA=s$.types,uM=["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"],uC=["fill-extrusion-flood-light-ground-radius"],uP=new e4(0,1);function uR(e,i,r,a,n,o,s,l){e.emplaceBack((ie.max.x&&(e.max.x=i.x,a=!0),i.ye.max.y&&(e.max.y=i.y,a=!0),((0===i.x||8192===i.x)&&i.x===r.x)!=((0===i.y||8192===i.y)&&i.y===r.y)&&this.processBorderOverlap(i,r),a&&this.checkBorderIntersection(i,r)}checkBorderIntersection(e,i){i.x8192!=e.x>8192&&this.addBorderIntersection(1,im(i.y,e.y,(8192-i.x)/(e.x-i.x))),i.y8192!=e.y>8192&&this.addBorderIntersection(3,im(i.x,e.x,(8192-i.y)/(e.y-i.y)))}addBorderIntersection(e,i){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]]);let r=this.borders[e];ir[1]&&(r[1]=i)}processBorderOverlap(e,i){if(e.x===i.x){if(e.y===i.y)return;let r=+(0!==e.x);this.addBorderIntersection(r,i.y),this.addBorderIntersection(r,e.y)}else{let r=0===e.y?2:3;this.addBorderIntersection(r,i.x),this.addBorderIntersection(r,e.x)}}centroid(){return 0===this.accCount?new e4(0,0):new e4(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,i)=>e+ +(i[0]!==Number.MAX_VALUE),0):0}}function uB(e,i){let r=e.add(i)._unit();return Math.min(4,Math.max(-4,Math.tan(Math.acos(tr(e.x*r.x+e.y*r.y,-1,1)))))/4*32767*(e.x*i.y-e.y*i.xe.xe.x>8192,e=>e.ye.y>8192];class uN{constructor(e){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new ol,this.indexArray=new oT,this.programConfigurations=new sy(e.layers,{zoom:e.zoom,lut:e.lut},e=>uC.includes(e)),this._segments=new o0,this.hiddenByLandmarkVertexArray=new ok,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new o0}getDefaultSegment(){return this.regionSegments[4]}hasData(){return 0!==this.vertexArray.length}addData(e,i,r,a=!1){let n=e.length;if(n>2){let o,s=Math.max(0,this._segments.get().length-1),l=this._segments._prepareSegment(4*n,this.vertexArray.length,2*this._segmentToGroundQuads[s].length);s!==this._segments.get().length-1&&(s++,this._segmentToGroundQuads[s]=[],this._segmentToRegionTriCounts[s]=[0,0,0,0,0]);{let i=e[0],r=e[1];o=uB(i.sub(e[n-1])._perp()._unit(),r.sub(i)._perp()._unit())}for(let h=0;he.region-i.region);for(let r=0;re+i,0);let o=0;for(let e=0;e0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,uc.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;ee.fqid),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new oT,this.footprintVertices=new oi,this.footprintSegments=[],this.layoutVertexArray=new oa,this.centroidVertexArray=new oW,this.wallVertexArray=new oY,this.indexArray=new oT,this.programConfigurations=new sy(e.layers,{zoom:e.zoom,lut:e.lut},e=>uM.includes(e)),this.segments=new o0,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.groundEffect=new uN(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,r,a){}populate(e,i,r,a){for(let{feature:n,id:o,index:s,sourceLayerIndex:l}of(this.features=[],this.hasPattern=hC("fill-extrusion",this.layers,this.pixelRatio,i),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=sN(r),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=0!==this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1),e)){let e=this.layers[0]._featureFilter.needGeometry,h=sH(n,e);if(!this.layers[0]._featureFilter.filter(new nC(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),h,r))continue;let u={id:o,sourceLayerIndex:l,index:s,geometry:e?h.geometry:sq(n,r,a),properties:n.properties,type:n.type,patterns:{}},c=this.layoutVertexArray.length,d="Polygon"===uA[u.type];if(this.hasPattern)this.features.push({featureId:n.id,feature:hP("fill-extrusion",this.layers,u,this.zoom,this.pixelRatio,i)});else if(this.wallMode)for(let e of u.geometry)for(let o of uI(e,d))this.addFeature(n.id,u,[o],s,r,{},i.availableImages,a,i.brightness);else this.addFeature(n.id,u,u.geometry,s,r,{},i.availableImages,a,i.brightness);i.featureIndex.insert(n,u.geometry,s,l,this.index,c)}this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,i,r,a,n,o){for(let{featureId:e,feature:s}of this.features){let l="Polygon"===uA[s.type],{geometry:h}=s;if(this.wallMode)for(let u of h)for(let h of uI(u,l))this.addFeature(e,s,[h],s.index,i,r,a,n,o);else this.addFeature(e,s,h,s.index,i,r,a,n,o)}this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles()}update(e,i,r,a,n,o,s){this.programConfigurations.updatePaintArrays(e,i,n,r,a,o,s,this.worldview),this.groundEffect.update(e,i,n,r,a,o,s,this.worldview)}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,up),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,uu.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,ud.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,uh.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,i,r,a,n,o,s,l,h){let u,c,d=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(i,{})/this.tileToMeter,p=[new e4(0,0),new e4(8192,8192)],f=l.projection,m="globe"===f.name,_=this.wallMode||"Polygon"===uA[i.type],g=new uk;g.centroidDataIndex=this.centroidData.length;let y=new uO;y.buildingId=e,i.properties&&i.properties.hasOwnProperty("building_id")&&(y.buildingId=Number(i.properties.building_id));let x=0>=this.layers[0].paint.get("fill-extrusion-base").evaluate(i,{},n),v=this.layers[0].paint.get("fill-extrusion-height").evaluate(i,{},n);if(y.height=v,y.vertexArrayOffset=this.layoutVertexArray.length,y.groundVertexArrayOffset=this.groundEffect.vertexArray.length,m&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new op),this.wallMode){if(m)return void t_("Non zero fill-extrusion-line-width is not yet supported on globe.");if(1!==r.length)return;r=[(u=function(e){let i=e[0].x===e[e.length-1].x&&e[0].y===e[e.length-1].y;(function(e){let i=0,r=e.length;for(let a=0;a=0})(e)||(e=e.reverse());let r={geometry:[],joinNormals:[],indices:[]},a=[],n=[],o=[],s=e.length;for(;s>=2&&e[s-1].equals(e[s-2]);)s--;if(s0,y="miter";"miter"===y&&_>2&&(y="bevel"),"bevel"===y&&(_>100&&(y="flipbevel"),_{let l=new e4(e.x,e.y),h=new e4(e.x,e.y);l.x+=i.x*s,l.y+=i.y*s,h.x-=i.x*Math.max(r,1),h.y-=i.y*Math.max(r,1),o.push(i),a.push(l),n.push(h)};if("miter"===y)f._mult(_),x(l,f,0,0);else if("flipbevel"===y)x(l,f=d.mult(-1),0,0),x(l,f.mult(-1),0,0);else{let e=-Math.sqrt(_*_-1),i=g?e:0,r=g?0:e;h&&x(l,c,i,r),u&&x(l,d,i,r)}}r.geometry=[...a,...n.reverse(),a[0]],r.joinNormals=[...o,...o.reverse(),o[o.length-1]];let f=r.geometry.length-1;for(let e=0;ee=0;e--){var T;let i=w[e];(0===i.length||(T=i[0]).every(e=>e.xe.x>=8192)||T.every(e=>e.ye.y>=8192))&&w.splice(e,1)}if(m)c=uX(w,p,n);else for(let e of(c=[],w))c.push({polygon:e,bounds:p});let S=_?this.edgeRadius:0,E=S>0&&this.zoom{if(0===e.length)return!1;let r=e[e.length-1];return i.x===r.x&&i.y===r.y};for(let{polygon:e,bounds:i}of c){let r=0,a=0;for(let i of e)_&&!i[0].equals(i[i.length-1])&&i.push(i[0]),a+=_?i.length-1:i.length;let o=this.segments.prepareSegment((_?5:4)*a,this.layoutVertexArray,this.indexArray);y.footprintSegIdx4&&u$(c[c.length-2],c[0],c[1]),v=S?function(e,i,r,a){let n=i.sub(e)._perp()._unit(),o=r.sub(i)._perp()._unit();return uG(e,i,r,uj(n,o),a)}(c[c.length-2],c[0],c[1],S):0,w=[];l=c[1].sub(c[0])._perp()._unit();let T=!0;for(let e=1,a=0;e0),P=d.dist(_);if(a+P>32768&&(a=0),S){h=E.sub(_)._perp()._unit();let e=uG(d,_,E,uj(l,h),S);isNaN(e)&&(e=0);let i=_.sub(d)._unit();d=d.add(i.mult(v))._round(),_=_.add(i.mult(-e))._round(),v=e,l=h,x&&this.zoom>=17&&(I(w,d)||w.push(d),I(w,_)||w.push(_))}let R=o.vertexLength,z=c.length>4&&u$(d,_,E),D=uZ(a,p,T);if(uR(this.layoutVertexArray,d.x,d.y,M,C,0,0,D),uR(this.layoutVertexArray,d.x,d.y,M,C,0,1,D),this.wallMode){let i=b(e-1,c),r=u.joinNormals[e-1];uz(this.wallVertexArray,r,i),uz(this.wallVertexArray,r,i)}if(a+=P,D=uZ(a,z,!T),p=z,uR(this.layoutVertexArray,_.x,_.y,M,C,0,0,D),uR(this.layoutVertexArray,_.x,_.y,M,C,0,1,D),this.wallMode){let i=b(e,c),r=u.joinNormals[e];uz(this.wallVertexArray,r,i),uz(this.wallVertexArray,r,i)}if(o.vertexLength+=4,this.indexArray.emplaceBack(R+0,R+1,R+2),this.indexArray.emplaceBack(R+1,R+3,R+2),o.primitiveLength+=2,S){let a=r+(1===e?c.length-2:e-2),n=1===e?r:a+1;if(this.indexArray.emplaceBack(R+1,a,R+3),this.indexArray.emplaceBack(a,n,R+3),o.primitiveLength+=2,void 0===s&&(s=R),!uq(E,c[e],i)){let i=e===c.length-1?s:o.vertexLength;this.indexArray.emplaceBack(R+2,R+3,i),this.indexArray.emplaceBack(R+3,i+1,i),this.indexArray.emplaceBack(R+3,n,i+1),o.primitiveLength+=3}T=!T}if(m){let e=this.layoutVertexExtArray,i=f.projectTilePoint(d.x,d.y,n),r=f.projectTilePoint(_.x,_.y,n),a=f.upVector(n,d.x,d.y),o=f.upVector(n,_.x,_.y);uL(e,i,a),uL(e,i,a),uL(e,r,o),uL(e,r,o)}}_&&(r+=c.length-1),x&&S&&this.zoom>=17&&(0!==w.length&&I(w,w[0])&&w.pop(),this.groundEffect.addData(w,i,d,S>0))}this.footprintSegments.push(l),s.triangleCount=this.indexArray.length-s.triangleArrayOffset,this.polygonSegments.push(s),++y.footprintSegLen,++y.polygonSegLen}if(y.vertexCount=this.layoutVertexArray.length-y.vertexArrayOffset,y.groundVertexCount=this.groundEffect.vertexArray.length-y.groundVertexArrayOffset,0!==y.vertexCount){if(y.centroidXY=g.borders?uP:this.encodeCentroid(g,y),this.centroidData.push(y),g.borders){this.featuresOnBorder.push(g);let e=this.featuresOnBorder.length-1;for(let i=0;ithis.featuresOnBorder[i].borders[e][0]-this.featuresOnBorder[r].borders[e][0])}splitToSubtiles(){let e=[];for(let i=0;i8192),n=2*a+(r.min.x+r.max.x>8192^a);for(let a=0;ae.triangleSegmentIdx===i.triangleSegmentIdx?e.subtile-i.subtile:e.triangleSegmentIdx-i.triangleSegmentIdx);let r=0,a=0,n=0;for(let i of e){if(i.triangleSegmentIdx!==r)break;n++}let o=e.length;for(;a!==e.length;){r=e[a].triangleSegmentIdx;let s=0,l=a,h=a;for(let i=l;i0&&this.triangleSubSegments.push({segment:c,min:o,max:u}),l=h;for(let i=l;i[e[0]*(1-r[0])+i[0]*r[0],e[1]*(1-r[1])+i[1]*r[1]],p=[],f=[];for(let e of this.triangleSubSegments){p[0]=e.min.x/8192,p[1]=e.min.y/8192,f[0]=e.max.x/8192,f[1]=e.max.y/8192;let i=d(u,c,p),l=d(u,c,f);if(0===new lt([i[0],i[1],o],[l[0],l[1],s]).intersectsPrecise(r)){a&&(n.segments.push(a),a=void 0);continue}let h=e.segment;a&&a.vertexOffset!==h.vertexOffset&&(n.segments.push(a),a=void 0),a?(a.vertexLength+=h.vertexLength,a.primitiveLength+=h.primitiveLength):a={vertexOffset:h.vertexOffset,primitiveLength:h.primitiveLength,vertexLength:h.vertexLength,primitiveOffset:h.primitiveOffset,sortKey:void 0,vaos:{}}}return a&&n.segments.push(a),n}encodeCentroid(e,i){let r=e.centroid(),a=i.span(),n=Math.min(7,Math.round(a.x*this.tileToMeter/10)),o=Math.min(7,Math.round(a.y*this.tileToMeter/10));return new e4(tr(r.x,1,8191)e.max.x||e.min.x>i.max.x||i.min.y>e.max.y||e.min.y>i.max.y||i.footprint.buildingIds.has(e.buildingId)&&(e.flags|=0x80000000);else for(let r of this.centroidData)if(!(0x80000000&r.flags||i.min.x>r.max.x||r.min.x>i.max.x||i.min.y>r.max.y||r.min.y>i.max.y))for(let o=0;oi!=h>i&&eo.max.x||o.min.x>e||i>o.max.y||o.min.y>i||o.heightr[1].x&&i.x>r[1].x||e.yr[1].y&&i.y>r[1].y}function uH(e,i){return e.xi[1].x||e.yi[1].y}function u$(e,i,r){if(e.x=8192||i.x=8192||r.x=8192)return!1;let a=r.sub(i),n=a.perp(),o=e.sub(i);return(a.x*o.x+a.y*o.y)/Math.sqrt((a.x*a.x+a.y*a.y)*(o.x*o.x+o.y*o.y))>-.866&&n.x*o.x+n.y*o.y{for(let r of e)s.push({polygon:r,bounds:i})},h=Math.ceil(Math.log2(r)),u=Math.ceil(Math.log2(a)),c=h-u,d=[];for(let e=0;e0?0:1);for(let e=0;ei+1?f.push({polygons:p,bounds:e,depth:i+1}):l(p,e)}if(m.length){let e=[new e4(0===r?c:a.x,1===r?c:a.y),s];d.length>i+1?f.push({polygons:m,bounds:e,depth:i+1}):l(m,e)}}return s}(e,i,Math.ceil((sL((r.x+1)/a)-n)/11.25),Math.ceil((sF(r.y/a)-sF((r.y+1)/a))/11.25),1,(e,i,n)=>{if(0===e)return .5*(i+n);{let e=sF((r.y+i/8192)/a);return(sD(.5*(sF((r.y+n/8192)/a)+e))*a-r.y)*8192}})}aW(uU,"FillExtrusionBucket",{omit:["layers","features"]}),aW(uO,"PartData"),aW(uF,"FootprintSegment"),aW(uk,"BorderCentroidData"),aW(uN,"GroundEffect");class uY extends e4{constructor(e,i,r){super(e,i),this.z=r}}class uK extends uY{constructor(e,i,r,a){super(e,i,r),this.w=a}}function uJ(e,i,r,a){let n="x"===r?"y":"x",o=(a-e[r])/(i[r]-e[r]);e[n]=Math.round(e[n]+(i[n]-e[n])*o),e[r]=a,e.hasOwnProperty("z")&&(e.z=im(e.z,i.z,o)),e.hasOwnProperty("w")&&(e.w=im(e.w,i.w,o))}function uQ(e,i,r,a){for(let n of["x","y"]){let o=e,s=i;o[n]>=s[n]&&(o=i,s=e),o[n]r&&uJ(o,s,n,r),o[n]a&&uJ(s,o,n,a)}}function u0(e,i,r,a,n,o){let s=[];for(let l=0;l=a&&m.x>=a||(f.x>=a?f=new e4(a,f.y+(a-f.x)/(m.x-f.x)*(m.y-f.y))._round():m.x>=a&&(m=new e4(a,f.y+(a-f.x)/(m.x-f.x)*(m.y-f.y))._round()),f.y>=n&&m.y>=n||(f.y>=n?f=new e4(f.x+(n-f.y)/(m.y-f.y)*(m.x-f.x),n)._round():m.y>=n&&(m=new e4(f.x+(n-f.y)/(m.y-f.y)*(m.x-f.x),n)._round()),h&&f.equals(h[h.length-1])||(h=[f],s.push(h),o&&o.push({progress:{min:g+u1(c,p,f)*_,max:1},parentIndex:l,prevPoint:c,nextPoint:p})),h.push(m),o&&(o[o.length-1].progress.max=g+u1(c,p,m)*_,o[o.length-1].nextPoint=p)))))}if(o&&d>0)for(let e=c;e{e[0]=i,e[1]=r,e[2]=a,e[3]=1},y=uW();for(let x of(r>0&&(r+=y),a+=y,i)){let i=[],y=[];for(let d of x){let p=d.x+n.x,x=d.y+n.y,v=e.projection.projectTilePoint(p,x,c),b=e.projection.upVector(c,d.x,d.y),w=r,T=a;if(s){let e=u6(p,x,r,a,s,l,h,u);w+=e.base,T+=e.top}0!==r?g(m,v.x+b[0]*f*w,v.y+b[1]*f*w,v.z+b[2]*f*w):g(m,v.x,v.y,v.z),g(_,v.x+b[0]*f*T,v.y+b[1]*f*T,v.z+b[2]*f*T),ez(m,m,o),ez(_,_,o),i.push(new uY(m[0],m[1],m[2])),y.push(new uY(_[0],_[1],_[2]))}d.push(i),p.push(y)}return[d,p]}(e,i,r,a,n,o,s,l,h,u,c):s?function(e,i,r,a,n,o,s,l,h){let u=[],c=[],d=[0,0,0,1];for(let p of e){let e=[],f=[];for(let u of p){let c=u.x+a.x,p=u.y+a.y,m=u6(c,p,i,r,o,s,l,h);d[0]=c,d[1]=p,d[2]=m.base,d[3]=1,eN(d,d,n),d[3]=Math.max(d[3],1e-5);let _=new uY(d[0]/d[3],d[1]/d[3],d[2]/d[3]);d[0]=c,d[1]=p,d[2]=m.top,d[3]=1,eN(d,d,n),d[3]=Math.max(d[3],1e-5);let g=new uY(d[0]/d[3],d[1]/d[3],d[2]/d[3]);e.push(_),f.push(g)}u.push(e),c.push(f)}return[u,c]}(i,r,a,n,o,s,l,h,u):function(e,i,r,a,n){let o=[],s=[],l=n[8]*i,h=n[9]*i,u=n[10]*i,c=n[11]*i,d=n[8]*r,p=n[9]*r,f=n[10]*r,m=n[11]*r;for(let i of e){let e=[],r=[];for(let o of i){let i=o.x+a.x,s=o.y+a.y,_=n[0]*i+n[4]*s+n[12],g=n[1]*i+n[5]*s+n[13],y=n[2]*i+n[6]*s+n[14],x=n[3]*i+n[7]*s+n[15],v=_+l,b=g+h,w=y+u,T=Math.max(x+c,1e-5),S=_+d,E=g+p,I=y+f,A=Math.max(x+m,1e-5);e.push(new uY(v/T,b/T,w/T)),r.push(new uY(S/A,E/A,I/A))}o.push(e),s.push(r)}return[o,s]}(i,r,a,n,o)}function u6(e,i,r,a,n,o,s,l){var h,u;let c,d,p,f,m,_,g,y,x,v,b,w,T,S,E=s*n.getElevationAt(e,i,!0,!0),I=0!==o[0],A=I?0===o[1]?s*(o[0]/7-450):s*(c=Math.floor(o[0]/8),d=Math.floor(o[1]/8),p=10*(o[0]-8*c),f=10*(o[1]-8*d),m=n.getElevationAt(c,d,!0,!0),g=Math.floor(.5*(p*(_=n.getMeterToDEM(l))-1)),y=Math.floor(.5*(f*_-1)),x=n.tileCoordToPixel(c,d),v=2*g+1,b=2*y+1,h=x.x-g,u=x.y-y,T=Math.abs((w=[n.getElevationAtPixel(h,u,!0),n.getElevationAtPixel(h+b,u,!0),n.getElevationAtPixel(h,u+b,!0),n.getElevationAtPixel(h+v,u+b,!0)])[0]-w[1]),S=Math.abs(w[2]-w[3]),m+Math.max(Math.min(.25,.5*_*(T+S)/v)*p,Math.min(.25,.5*_*(Math.abs(w[0]-w[2])+Math.abs(w[1]-w[3]))/b)*f)):E;return{base:E+(0===r?-1:r),top:I?Math.max(A+a,E+r+2):E+a}}class u8{constructor(e){this._callback=e,this._triggered=!1,"u">typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){this._channel=void 0,this._callback=()=>{}}}class u9{constructor(){this.tasks={},this.taskQueue=[],tu(["process"],this),this.invoker=new u8(this.process),this.nextId=0}add(e,i){let r=this.nextId++,a=function({type:e,isSymbolTile:i,zoom:r}){return r=r||0,"message"===e?0:"maybePrepare"!==e||i?"parseTile"!==e||i?"parseTile"===e&&i?300-r:"maybePrepare"===e&&i?400-r:500:200-r:100-r}(i);return 0===a?(e(),null):(this.tasks[r]={fn:e,metadata:i,priority:a,id:r},this.taskQueue.push(r),this.invoker.trigger(),{cancel:()=>{delete this.tasks[r]}})}process(){{if(this.taskQueue=this.taskQueue.filter(e=>!!this.tasks[e]),!this.taskQueue.length)return;let e=this.pick();if(null===e)return;let i=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!i)return;i.fn()}}pick(){let e=null,i=1/0;for(let r=0;r{r&&delete this.callbacks[s],this.target.postMessage({id:s,type:"",targetMapId:a,sourceMapId:this.mapId})}}}receive(e){let i=e.data;if(!i)return;let r=i.id;if(r&&(!i.targetMapId||this.mapId===i.targetMapId))if(""===i.type){let e=this.cancelCallbacks[r];delete this.cancelCallbacks[r],e&&e.cancel()}else if(i.mustQueue||tx(self)){let e=this.callbacks[r],a=this.scheduler.add(()=>this.processTask(r,i),e&&e.metadata||{type:"message"});a&&(this.cancelCallbacks[r]=a)}else this.processTask(r,i)}processTask(e,i){if(delete this.cancelCallbacks[e],""===i.type){let r=this.callbacks[e];delete this.callbacks[e],r&&(i.error?r(aK(i.error)):r(null,aK(i.data)))}else{let r=new Set,a=i.hasCallback?(i,a)=>{this.target.postMessage({id:e,type:"",sourceMapId:this.mapId,error:i?aY(i):null,data:aY(a,r)},r)}:()=>{},n=aK(i.data);if(this.parent[i.type])this.parent[i.type](i.sourceMapId,n,a);else if(this.parent.getWorkerSource){let e=i.type.split("."),{source:r,scope:o}=n;this.parent.getWorkerSource(i.sourceMapId,e[0],r,o)[e[1]](n,a)}else a(Error(`Could not find function ${i.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var ce={workerUrl:"",workerClass:null,workerParams:void 0};let ct="mapboxgl_preloaded_worker_pool";class ci{constructor(e){this.active={},this.name=e}acquire(e,i=ci.workerCount){if(!this.workers)for(this.workers=[];this.workers.length{e.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[ct]}numActive(){return Object.keys(this.active).length}}ci.workerCount=2;class cr{constructor(e,i,r="Worker",a=ci.workerCount){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=tl();const n=this.workerPool.acquire(this.id,a);for(let e=0;e{this.ready=!0})}broadcast(e,i,r){to(this.actors,(r,a)=>{r.send(e,i,a)},r=r||function(){})}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)}}function ca(){return S||(S=new ci),S}cr.Actor=u7;class cn{constructor(e){this.module=e,this.memoryStack=this.module.malloc(4096),this.memoryStackNextFree=this.memoryStack}createIntArray(e){let i=this.memoryStackNextFree;return this.memoryStackNextFree+=e.length*Int32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>4096?-1:(new Int32Array(this.module.heap32.buffer,i,e.length).set(e),i)}createFloatArray(e){let i=this.memoryStackNextFree;return this.memoryStackNextFree+=e.length*Float32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>4096?-1:(new Float32Array(this.module.heapF32.buffer,i,e.length).set(e),i)}readStringBuffer(e){let i="";for(;0!==this.module.heapU8[e];)i+=String.fromCharCode(this.module.heapU8[e]),++e;return i}setStyle(e){let i=e.normalScale;this.module.setStyle(i[0],i[1],i[2],e.tileToMeters)}setAOOptions(e,i){this.module.setAOOptions(+!!e,i)}setMetricOptions(e,i){this.module.setMetricOptions(+!!e,i)}setStructuralOptions(e){this.module.setStructuralOptions(+!!e)}setFacadeOptions(e,i){this.module.setFacadeOptions(e,+!!i)}setFauxFacadeOptions(e,i,r){this.module.setFauxFacadeOptions(+!!e,+!!i,r)}setFacadeClassifierOptions(e){this.module.setFacadeClassifierOptions(e)}generateMesh(e,i){for(let i of(this.memoryStackNextFree=this.memoryStack,e)){let e=this.createIntArray(i.ringIndices),r=this.createFloatArray(i.coordinates);if(-1===e||-1===r)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFeature(i.id,i.sourceId,i.minHeight,i.height,i.roofType,r,e,i.ringIndices.length-1)}for(let e of i){let i;i=e.entrances?JSON.parse(e.entrances):[];let r=this.createFloatArray(i),a=this.createFloatArray(e.coordinates);if(-1===r||-1===a)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFacade(e.sourceId,e.crossPerc,e.distanceToRoad,r,i.length,a,e.coordinates.length)}if(!this.module.generateMesh()){let e=this.module.getLastError();return this.readStringBuffer(e)}let r=this.module.getMeshCount(),a=Array(r);for(let e=0;e>2)-3,s=r[a++]>>2;if(a++,n.json=JSON.parse(cT.decode(r.subarray(a,a+s))),(a+=s)>>0,Math.ceil(1.2*n))-n)/65536);try{return r.grow(o),a(),!0}catch(e){return!1}},b:n}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(e,o):e.then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,o))).then(e=>{let n,o,s,l,{Rb:h,Qb:u,P:c,T:d,X:p,Ja:f,La:m,Qa:_,Va:g,Wa:y,eb:x,jb:v,f:b,e:w,yb:T,zb:S,Ab:E,Bb:I,Db:A,Gb:M}=e.instance.exports;r=w;let C=(n=0,o=0,s=0,l=0,e=>{s&&(h(l),h(n),o+=s,s=n=0),n||(o+=128,n=u(o));let r=e.length+7&-8,a=n;r>=o&&(s=r,a=l=u(r));for(let r=0;r{cl=e,co=void 0})}()),p&&c.push(function(){var e;let i,r,a,n;if(cu)return;let o=(e=fetch(c_()),r=WebAssembly.instantiateStreaming(e,{}).then(e=>{(i=e.instance).exports.__wasm_call_ctors()}),a={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},n={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},{ready:r,supported:!0,decodeGltfBuffer(e,r,o,s,l,h){!function(e,i,r,a,n,o,s){let l=e.exports.sbrk,h=a+3&-4,u=l(h*n),c=l(o.length),d=new Uint8Array(e.exports.memory.buffer);d.set(o,c);let p=i(u,a,n,c,o.length);if(0===p&&s&&s(u,h,n),r.set(d.subarray(u,u+a*n)),l(u-l(0)),0!==p)throw Error(`Malformed buffer data: ${p}`)}(i,i.exports[n[l]],e,r,o,s,i.exports[a[h]])}});return o.ready.then(()=>{cu=o})}()),s)for(let e=0;e{let n=tJ(e,(e,i)=>{e?a(e):r(i)});i&&i.addEventListener("abort",()=>{n.cancel(),a(new DOMException("Aborted","AbortError"))},{once:!0})})}({url:e,type:"arrayBuffer"},i),0,e,i)}function cP(e){switch(e){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.RGBA;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.DEPTH_COMPONENT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.DEPTH_STENCIL;case WebGL2RenderingContext.R8:case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.RED}}function cR(e){switch(e){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.UNSIGNED_SHORT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.UNSIGNED_INT_24_8;case WebGL2RenderingContext.R8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.FLOAT}}class cz{constructor(e,i,r,a){this.context=e,this.format=r,this.useMipmap=a&&a.useMipmap,this.texture=e.gl.createTexture(),this.update(i,{premultiply:a&&a.premultiply})}update(e,i){let r=e&&e instanceof HTMLVideoElement&&0===e.width?e.videoWidth:e.width,a=e&&e instanceof HTMLVideoElement&&0===e.height?e.videoHeight:e.height,{context:n}=this,{gl:o}=n,{x:s,y:l}=i&&i.position?i.position:{x:0,y:0},h=s+r,u=l+a;this.size&&(this.size[0]!==h||this.size[1]!==u)&&(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&&(!i||!1!==i.premultiply));let c=e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap;if(!this.size&&h>0&&u>0){let e=this.useMipmap?Math.floor(Math.log2(Math.max(h,u)))+1:1;o.texStorage2D(o.TEXTURE_2D,e,this.format,h,u),this.size=[h,u]}this.size&&(c?o.texSubImage2D(o.TEXTURE_2D,0,s,l,cP(this.format),cR(this.format),e):"data"in e&&e.data&&o.texSubImage2D(o.TEXTURE_2D,0,s,l,r,a,cP(this.format),cR(this.format),e.data)),this.useMipmap&&o.generateMipmap(o.TEXTURE_2D)}bind(e,i,r=!1){let{context:a}=this,{gl:n}=a;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&&!r?e===n.NEAREST?n.NEAREST_MIPMAP_NEAREST:n.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),i!==this.wrapS&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,i),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,i),this.wrapS=i)}bindExtraParam(e,i,r,a,n){let{context:o}=this,{gl:s}=o;s.bindTexture(s.TEXTURE_2D,this.texture),i!==this.magFilter&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,i),this.magFilter=i),e!==this.minFilter&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,this.useMipmap?e===s.NEAREST?s.NEAREST_MIPMAP_NEAREST:s.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),r!==this.wrapS&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,r),this.wrapS=r),a!==this.wrapT&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,a),this.wrapT=a),n!==this.compareMode&&(n?(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_COMPARE_MODE,s.COMPARE_REF_TO_TEXTURE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_COMPARE_FUNC,n)):s.texParameteri(s.TEXTURE_2D,s.TEXTURE_COMPARE_MODE,s.NONE),this.compareMode=n)}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class cD{constructor(e,i){this.context=e,this.texture=i}bind(e,i){let{context:r}=this,{gl:a}=r;a.bindTexture(a.TEXTURE_2D,this.texture),e!==this.minFilter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,e),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,e),this.minFilter=e),i!==this.wrapS&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,i),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,i),this.wrapS=i)}}let cL=oe([{name:"a_pos_3f",components:3,type:"Float32"}]),cF=oe([{name:"a_color_3f",components:3,type:"Float32"}]),cO=oe([{name:"a_color_4f",components:4,type:"Float32"}]),ck=oe([{name:"a_uv_2f",components:2,type:"Float32"}]),cB=oe([{name:"a_normal_3f",components:3,type:"Float32"}]),cV=oe([{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"}]),cN=oe([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function cU(e,i){var r,a;let n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S=cG(e.projection,e.zoom,e.width,e.height),E=(r=e.projection,a=e.center,n=new sC(a.lng-180*cq,a.lat),o=new sC(a.lng+180*cq,a.lat),s=r.project(n.lng,n.lat),h=-Math.atan2((l=r.project(o.lng,o.lat)).y-s.y,l.x-s.x),(u=sU.fromLngLat(a)).y=tr(u.y,-1+cq,1-cq),c=u.toLngLat(),d=r.project(c.lng,c.lat),p=sU.fromLngLat(c),p.x+=cq,f=p.toLngLat(),_=c$((m=r.project(f.lng,f.lat)).x-d.x,m.y-d.y,h),g=sU.fromLngLat(c),g.y+=cq,y=g.toLngLat(),v=c$((x=r.project(y.lng,y.lat)).x-d.x,x.y-d.y,h),b=Math.abs(_.x)/Math.abs(v.y),es(w=ee([]),w,-h*(1-(i?0:S))),ea(T=ee([]),T,[1,1-(1-b)*S,1]),T[4]=-v.x/v.y*S,es(T,T,h),ei(T,w,T),T),I=cj(e);return ea(E,E,[I,I,1]),E}function cj(e){let i=e.projection,r=cG(e.projection,e.zoom,e.width,e.height);return Math.pow(2,cH(i,e.center)*r+(1-r)*cH(i,sC.convert(i.center)))}function cG(e,i,r,a,n=1/0){let o=e.range;if(!o)return 0;let s=Math.log2(Math.min(n,Math.max(r,a))/1024);return ta(o[0]+s,o[1]+s,i)}let cq=1/4e4;function cH(e,i){let r=tr(i.lat,-85.051129,85.051129),a=new sC(i.lng-180*cq,r),n=new sC(i.lng+180*cq,r),o=e.project(a.lng,r),s=e.project(n.lng,r),l=sU.fromLngLat(a),h=sU.fromLngLat(n),u=s.x-o.x,c=s.y-o.y,d=h.x-l.x,p=h.y-l.y;return Math.log2(Math.sqrt((d*d+p*p)/(u*u+c*c)))}function c$(e,i,r){let a=Math.cos(r),n=Math.sin(r);return{x:e*a-i*n,y:e*n+i*a}}function cZ(e,i,r){ee(e),es(e,e,i[2]*e8),en(e,e,i[0]*e8),eo(e,e,i[1]*e8),ea(e,e,r),ei(e,e,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function cW(e,i,r,a,n,o,s,l){let h=[r[0]-i[0],r[1]-i[1],0],u=[a[0]-i[0],a[1]-i[1],0];if(1e-12>ef(h)||1e-12>ef(u))return ej(e);let c=eP([],h,u);return eM(c,c),ey(u,a,i),h[2]=(o-n)*l,u[2]=(s-n)*l,eP(h,h,u),eM(h,h),eW(e,c,h)}function cX(e,i,r=!1){let a=lY(i.zoom),n=function(e,i,r){let a,n,o,s=i.worldSize,l=[e[12],e[13],e[14]],h=sF(l[1]/s),u=sL(l[0]/s),c=ee([]),d=1/sR(h)*s,p=1/sR(0)*s*sB(h,i.zoom),f=1/lZ(s),m=p*f;if(r){let e=cG(i.projection,i.zoom,i.width,i.height,1024);m=f*i.projection.pixelSpaceConversion(i.center.lat,s,e)}let _=sA(h,u);eg(_,_,ew([],eM([],_),d*m*l[2]));let g=(o=eP([],n=[0,1,0],a=[_[0],_[1],_[2]]),eP(n,a,o),0===eI(n)&&eP(o,a,n=[0,1,0]),eM(o,o),eM(n,n),eM(a,a),[o[0],o[1],o[2],0,n[0],n[1],n[2],0,a[0],a[1],a[2],0,_[0],_[1],_[2],1]);ea(c,c,[m,m,m*d]),er(c,c,[-l[0],-l[1],-l[2]]);let y=ei([],i.globeMatrix,g);return ei(y,y,c),ei(y,y,e),y}(e,i,r);if(a>0){let r,o,s,l,h,u,c,d,p,f,m=(r=i.worldSize,o=1/sR(0)*r*sB(i.center.lat,i.zoom)/lZ(r),s=1/sR(i.center.lat)*r,eo(l=ee([]),l,i.center.lng*e8),en(l,l,i.center.lat*e8),er(l,l,[0,0,sT]),ea(l,l,[o,o,o*s]),er(l,l,[-(h=i.point).x,-h.y,0]),ei(l,l,e),ei(l,i.globeMatrix,l));return c=(u=(e,i,r)=>{let a=ef(e),n=ef(i),o=lk(e,i,r);return ew(o,o,1/ef(o)*im(a,n,r))})([n[0],n[1],n[2]],[m[0],m[1],m[2]],a),d=u([n[4],n[5],n[6]],[m[4],m[5],m[6]],a),p=u([n[8],n[9],n[10]],[m[8],m[9],m[10]],a),f=lk([n[12],n[13],n[14]],[m[12],m[13],m[14]],a),[c[0],c[1],c[2],0,d[0],d[1],d[2],0,p[0],p[1],p[2],0,f[0],f[1],f[2],1]}return n}function cY(e,i,r,a){let n=lt.projectAabbCorners(a,r),o=Number.MAX_VALUE;for(let e=0;e0||0===s&&r[0]*o[0]+r[1]*o[1]>=0&&r[0]*r[0]+r[1]*r[1]>o[0]*o[0]+o[1]*o[1])&&(a=i)}n=a}while(n!==r)return i.length>0&&i.push(i[0]),i}(n)))return o}let cK={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function cJ(e,i,r,a,n,o,s,l,h,u=!1){let c=r.zoom,d=r.project(a),p=sB(a.lat,c),f=1/p;ee(e),er(e,e,[d.x+s[0]*f,d.y+s[1]*f,s[2]]);let m=1,_=1,g=r.worldSize;if(u){if("mercator"===r.projection.name){let e=0;r.elevation&&(e=r.elevation.getAtPointOrZero(new sU(d.x/g,d.y/g),0));let i=eN([],[d.x,d.y,e,1],r.projMatrix)[3]/r.cameraToCenterDistance;m=i,_=i*sB(r.center.lat,c)}else if("globe"===r.projection.name){let i=cX(e,r),n=[0,0,0,1];eN(n,n,ei([],r.projMatrix,i));let o=n[3]/r.cameraToCenterDistance,s=lY(c),l=r.projection.pixelsPerMeter(a.lat,g)*sB(a.lat,c),h=r.projection.pixelsPerMeter(r.center.lat,g)*sB(r.center.lat,c);m=o/im(l,sk(r.center.lat),s),_=o*p/l,m*=h,_*=h}}else m=f;ea(e,e,[m,m,_]);let y=[...e],x=i.orientation,v=[];if(cZ(v,[x[0]+(n?n[0]:0),x[1]+(n?n[1]:0),x[2]+(n?n[2]:0)],o),ei(e,y,v),l&&r.elevation){let n=0,o=[];if(h&&r.elevation){n=function(e,i,r,a,n){let o=i.elevation;if(!o)return 0;let s=lt.projectAabbCorners(r,a),l=1/sR(n.lat)*i.worldSize,h=function(e,i){let r=[0,0,1],a=[{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(let n of a){let a=e[n.corners[0]],o=e[n.corners[1]],s=e[n.corners[2]],l=[o[0]-a[0],o[1]-a[1],i*(o[2]-a[2])],h=eP(l,l,[s[0]-a[0],s[1]-a[1],i*(s[2]-a[2])]);eM(h,h),n.dotProductWithUp=eC(h,r)}return a.sort((e,i)=>e.dotProductWithUp-i.dotProductWithUp),a[0].corners}(s,l),u=s[h[0]],c=s[h[1]],d=s[h[2]],p=s[h[3]],f=o.getAtPointOrZero(new sU(u[0]/i.worldSize,u[1]/i.worldSize),0),m=o.getAtPointOrZero(new sU(c[0]/i.worldSize,c[1]/i.worldSize),0),_=o.getAtPointOrZero(new sU(d[0]/i.worldSize,d[1]/i.worldSize),0),g=o.getAtPointOrZero(new sU(p[0]/i.worldSize,p[1]/i.worldSize),0),y=(f+g)/2,x=(m+_)/2;return y>x?m<_ s="ei([],ec([],o),v);ei(e,y,s)}else" n="r.elevation.getAtPointOrZero(new" su cq map sc lt r a="this.nodeOverrides.get(e.name);if(void" i="[];r=a.orientation,ee(i),eo(i,i,r[1]*e8),es(i,i,r[2]*e8),en(i,i,r[0]*e8),ei(e.globalMatrix,e.globalMatrix,i)}if(e.meshes)for(let" of e.meshes e.children e="ee([]);for(let" this.nodes c0 cz>=i.gl.NEAREST_MIPMAP_NEAREST}),e.uploaded=!0,e.image=null)}function c1(e,i,r){if(e.meshes)for(let a of e.meshes)!function(e,i,r){e.indexBuffer=i.createIndexBuffer(e.indexArray,!1,!0),e.vertexBuffer=i.createVertexBuffer(e.vertexArray,cL.members,!1,!0),e.normalArray&&(e.normalBuffer=i.createVertexBuffer(e.normalArray,cB.members,!1,!0)),e.texcoordArray&&(e.texcoordBuffer=i.createVertexBuffer(e.texcoordArray,ck.members,!1,!0)),e.colorArray&&(e.colorBuffer=i.createVertexBuffer(e.colorArray,(12===e.colorArray.bytesPerElement?cF:cO).members,!1,!0)),e.featureArray&&(e.pbrBuffer=i.createVertexBuffer(e.featureArray,cN.members,!0)),e.segments=o0.simpleSegment(0,0,e.vertexArray.length,e.indexArray.length);let a=e.material;a.pbrMetallicRoughness.baseColorTexture&&c0(a.pbrMetallicRoughness.baseColorTexture,i),a.pbrMetallicRoughness.metallicRoughnessTexture&&c0(a.pbrMetallicRoughness.metallicRoughnessTexture,i),a.normalTexture&&c0(a.normalTexture,i),a.occlusionTexture&&c0(a.occlusionTexture,i,r),a.emissionTexture&&c0(a.emissionTexture,i)}(a,i,r);if(e.children)for(let a of e.children)c1(a,i,r)}function c2(e){if(e.meshes)for(let i of e.meshes)i.indexArray.destroy(),i.vertexArray.destroy(),i.colorArray&&i.colorArray.destroy(),i.normalArray&&i.normalArray.destroy(),i.texcoordArray&&i.texcoordArray.destroy(),i.featureArray&&i.featureArray.destroy();if(e.children)for(let i of e.children)c2(i)}function c3(e){if(e.meshes)for(let r of e.meshes){var i;r.vertexBuffer&&(r.vertexBuffer.destroy(),r.indexBuffer.destroy(),r.normalBuffer&&r.normalBuffer.destroy(),r.texcoordBuffer&&r.texcoordBuffer.destroy(),r.colorBuffer&&r.colorBuffer.destroy(),r.pbrBuffer&&r.pbrBuffer.destroy(),r.segments.destroy(),r.material&&((i=r.material).pbrMetallicRoughness.baseColorTexture&&i.pbrMetallicRoughness.baseColorTexture.gfxTexture&&i.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),i.pbrMetallicRoughness.metallicRoughnessTexture&&i.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&i.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),i.normalTexture&&i.normalTexture.gfxTexture&&i.normalTexture.gfxTexture.destroy(),i.emissionTexture&&i.emissionTexture.gfxTexture&&i.emissionTexture.gfxTexture.destroy(),i.occlusionTexture&&i.occlusionTexture.gfxTexture&&i.occlusionTexture.gfxTexture.destroy()))}if(e.footprintDebugMesh&&(e.footprintDebugMesh.vertexBuffer.destroy(),e.footprintDebugMesh.indexBuffer.destroy(),e.footprintDebugMesh.segments.destroy()),e.children)for(let i of e.children)c3(i)}function c5(e,i){let r=e.json.bufferViews[i.bufferView],a=cg[i.componentType];return new a(e.buffers[r.buffer],(i.byteOffset||0)+(r.byteOffset||0),i.count*(r.byteStride&&r.byteStride!==cx[i.type]*a.BYTES_PER_ELEMENT?r.byteStride/a.BYTES_PER_ELEMENT:cx[i.type]))}function c4(e,i,r,a){let n=cg[i.componentType],o=function(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}}(n),s=e.json.bufferViews[i.bufferView],l=s.byteStride?s.byteStride/n.BYTES_PER_ELEMENT:cx[i.type],h=r.float32,u=h.length/r.capacity;for(let e=0,r=0;e0){for(let n=0;n0){o.texcoordArray=new oR;let e=i.json.accessors[n.TEXCOORD_0];o.texcoordArray.resize(e.count);let r=c5(i,e);c4(i,e,o.texcoordArray,r)}if(void 0!==n._FEATURE_ID_RGBA4444){let e=i.json.accessors[n._FEATURE_ID_RGBA4444];i.json.extensionsUsed&&i.json.extensionsUsed.includes("EXT_meshopt_compression")&&(o.featureData=c5(i,e))}void 0!==n._FEATURE_RGBA4444&&(o.featureData=new Uint32Array(c5(i,i.json.accessors[n._FEATURE_RGBA4444]).buffer));let d=e.material;return o.material=function(e,i){let{emissiveFactor:r=[0,0,0],alphaMode:a="OPAQUE",alphaCutoff:n=.5,normalTexture:o,occlusionTexture:s,emissiveTexture:l,doubleSided:h,name:u}=e,{baseColorFactor:c=[1,1,1,1],metallicFactor:d=1,roughnessFactor:p=1,baseColorTexture:f,metallicRoughnessTexture:m}=e.pbrMetallicRoughness||{},_=s?i[s.index]:void 0;if(s&&s.extensions&&s.extensions.KHR_texture_transform&&_){let e=s.extensions.KHR_texture_transform;_.offsetScale=[e.offset[0],e.offset[1],e.scale[0],e.scale[1]]}return{name:u,pbrMetallicRoughness:{baseColorFactor:new iu(...c),metallicFactor:d,roughnessFactor:p,baseColorTexture:f?i[f.index]:void 0,metallicRoughnessTexture:m?i[m.index]:void 0},doubleSided:h,emissiveFactor:new iu(...r),alphaMode:a,alphaCutoff:n,normalTexture:o?i[o.index]:void 0,occlusionTexture:_,emissionTexture:l?i[l.index]:void 0,defined:void 0===e.defined}}(void 0!==d?i.json.materials[d]:{defined:!1},r),o}(r,e,i));r.push(n)}return r}(e,i),{scenes:a,scene:n,nodes:o}=e.json,s=a?a[n||0].nodes:[...o.keys()],l=[];for(let i of s)l.push(function e(i,r,a){var n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,E,I,A;let{matrix:M,rotation:C,translation:P,scale:R,mesh:z,extras:D,children:L,name:F}=i,O={};if(O.name=F,O.localMatrix=M||(n=[],o=C||[0,0,0,1],s=P||[0,0,0],l=R||[1,1,1],h=o[0],u=o[1],c=o[2],d=o[3],p=h+h,f=u+u,m=c+c,_=h*p,g=h*f,y=h*m,x=u*f,v=u*m,b=c*m,w=d*p,T=d*f,S=d*m,E=l[0],I=l[1],A=l[2],n[0]=(1-(x+b))*E,n[1]=(g+S)*E,n[2]=(y-T)*E,n[3]=0,n[4]=(g-S)*I,n[5]=(1-(_+b))*I,n[6]=(v+w)*I,n[7]=0,n[8]=(y+T)*A,n[9]=(v-w)*A,n[10]=(1-(_+x))*A,n[11]=0,n[12]=s[0],n[13]=s[1],n[14]=s[2],n[15]=1,n),O.globalMatrix=Q(O.localMatrix),void 0!==z){O.meshes=a[z];let e=O.anchor=[0,0];for(let i of O.meshes){let{min:r,max:a}=i.aabb;e[0]+=r[0]+a[0],e[1]+=r[1]+a[1]}e[0]=Math.floor(e[0]/O.meshes.length/2),e[1]=Math.floor(e[1]/O.meshes.length/2)}if(D&&(D.id&&(O.id=D.id),D.lights&&(O.lights=function(e){if(!e.length)return[];let i=function(e){let i=atob(e),r=new Uint8Array(i.length);for(let e=0;e0&&([a[e+1],a[e+2]]=[a[e+2],a[e+1]])}return{vertices:r,indices:a}}(e[a[s.id]].meshes,s.localMatrix)),h||(h=function(e){if(!e.extras||!e.extras.ground)return null;let i=e.extras.ground;if(!i||!Array.isArray(i)||0===i.length)return null;let r=i[0];if(!r||!Array.isArray(r)||0===r.length)return null;let a=[];for(let e of r){if(!Array.isArray(e)||2!==e.length)continue;let i=e[0],r=e[1];"number"==typeof i&&"number"==typeof r&&a.push(new e4(i,r))}if(a.length1&&a[a.length-1].equals(a[0])&&a.pop();let n=0;for(let e=0;e0&&a.reverse();let o=hh(a.flatMap(e=>[e.x,e.y]),[]);return 0===o.length?null:{vertices:a,indices:o}}(l)),h&&(s.footprint=function(e){if(0===e.vertices.length||0===e.indices.length)return null;let i=new ur(e.vertices,e.indices,8,256),[r,a]=[i.min.clone(),i.max.clone()];return{vertices:e.vertices,indices:e.indices,grid:i,min:r,max:a}}(h))}if(n.size>0){let i=Array.from(n.values()).sort((e,i)=>e-i);for(let r=i.length-1;r>=0;r--)e.splice(i[r],1)}}(l,s,e.json.nodes),l}function c8(e,i,r,a,n){r.reserve(r.length+4*e.length),a.reserve(a.length+10*e.length),n.reserve(n.length+10*e.length);let o=a.length;for(let s of e){let e=Math.min(10,Math.max(4,1.3*s.height))*i,l=[-s.normal[1],s.normal[0],0],h=Math.min(.29,.1*s.width/s.depth),u=s.width-2*s.depth*i*(h+.01),c=eT([],s.pos,l,u/2),d=eT([],s.pos,l,-u/2),p=[c[0],c[1],c[2]+s.height],f=[d[0],d[1],d[2]+s.height],m=eT([],s.normal,l,h);ew(m,m,e);let _=eT([],s.normal,l,-h);ew(_,_,e),eg(m,c,m),eg(_,d,_),c[2]+=.1,d[2]+=.1,a.emplaceBack(m[0],m[1],m[2]),a.emplaceBack(_[0],_[1],_[2]),a.emplaceBack(c[0],c[1],c[2]),a.emplaceBack(d[0],d[1],d[2]),a.emplaceBack(p[0],p[1],p[2]),a.emplaceBack(f[0],f[1],f[2]),a.emplaceBack(c[0],c[1],c[2]),a.emplaceBack(d[0],d[1],d[2]),a.emplaceBack(m[0],m[1],m[2]),a.emplaceBack(_[0],_[1],_[2]);let g=u/e/2;n.emplaceBack(-g-h,-1,g,.8),n.emplaceBack(g+h,-1,g,.8),n.emplaceBack(-g,0,g,1.3),n.emplaceBack(g,0,g,1.3),n.emplaceBack(g+h,-.8,g,.7),n.emplaceBack(g+h,-.8,g,.7),n.emplaceBack(0,0,g,1.3),n.emplaceBack(0,0,g,1.3),n.emplaceBack(g+h,-1.2,g,.8),n.emplaceBack(g+h,-1.2,g,.8),r.emplaceBack(6+o,4+o,8+o),r.emplaceBack(7+o,9+o,5+o),r.emplaceBack(0+o,1+o,2+o),r.emplaceBack(1+o,3+o,2+o),o+=10}}let c9=oe([{name:"a_pos_3f",components:3,type:"Float32"}]),c7=oe([{name:"a_normal_3",components:3,type:"Int16"}]),de=oe([{name:"a_centroid_3",components:3,type:"Int16"}]),dt=oe([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),di=oe([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),dr=oe([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),da=oe([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),dn=oe([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),ds=oe([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Uint16"}]),dl=s$.types;class dh{constructor(){this.layoutVertexArray=new ou,this.layoutAttenuationArray=new o_,this.layoutColorArray=new oy,this.indexArray=new oT,this.indexArrayForConflation=new oT,this.segmentsBucket=new o0}}class du{constructor(e){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new o0,this.entranceBloom=new dh,this.layoutVertexArray=new ou,this.layoutVertexArray.reserve(66560),this.layoutNormalArray=new or,this.layoutNormalArray.reserve(66560),this.layoutCentroidArray=new or,this.layoutCentroidArray.reserve(66560),this.layoutColorArray=new oy,this.layoutColorArray.reserve(66560),this.layoutFloodLightDataArray=new oD,this.layoutFloodLightDataArray.reserve(66560),this.layoutAOArray=new ok,this.layoutAOArray.reserve(66560),this.indexArray=new oT,this.indexArray.reserve(66560),this.indexArrayForConflation=new oT,this.segmentsBucket=new o0,this.entranceBloom=new dh,e&&(this.layoutFacadePaintArray=new oy,this.layoutFacadeDataArray=new od,this.layoutFacadeVerticalRangeArray=new oy)}reserve(e,i,r){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(i),r&&(this.layoutFacadePaintArray.reserveForAdditional(e),this.layoutFacadeDataArray.reserveForAdditional(e),this.layoutFacadeVerticalRangeArray.reserveForAdditional(e))}}class dc{constructor(e){this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.footprintsVertices=new oR,this.footprintsIndices=new oD,this.footprintsMin=new e4(1/0,1/0),this.footprintsMax=new e4(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new du(!1),this.buildingWithFacade=new du(!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 sy(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 uN(e),this.groundEffect.groundRadiusArray=new on,this.hasAppearances=null}updateFootprints(e,i){let r=new ur([],[],1),a={vertices:[],indices:new Uint32Array(0),grid:r,min:this.footprintsMin,max:this.footprintsMax,buildingIds:this.buildingIds};i.push({footprint:a,id:e})}updateAppearances(e,i,r,a){}prepare(){return null!=cf||null!=cp?null:null!=cd?cd:cd=(function(e){let i,r,a,n,o;function s(){i=new Uint8Array(o.buffer),r=new Int16Array(o.buffer),a=new Int32Array(o.buffer),n=new Float32Array(o.buffer)}function l(){throw Error("Unexpected BuildingGen error.")}let h=()=>{},u={a:{a:l,f:function(e){let r=i.length,a=Math.ceil((Math.max(e>>>0,Math.ceil(1.2*r))-r)/65536);try{return o.grow(a),s(),!0}catch(e){return!1}},g:l,b:h,c:h,d:h,e:h}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(e,u):e.then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,u))).then(e=>{let l=e.instance.exports;return(0,l.g)(),o=l.f,s(),new cn({setStyle:l.h,setAOOptions:l.i,setMetricOptions:l.j,setStructuralOptions:l.k,setFacadeOptions:l.l,setFauxFacadeOptions:l.m,setFacadeClassifierOptions:l.n,addFeature:l.o,addFacade:l.p,generateMesh:l.q,getLastError:l.r,getOuterRingLength:l.s,getMeshCount:l.t,getPositionsPtr:l.u,getPositionsLength:l.v,getNormalsPtr:l.w,getNormalsLength:l.x,getAOPtr:l.y,getAOLength:l.z,getUVPtr:l.A,getUVLength:l.B,getFauxFacadePtr:l.C,getFauxFacadeLength:l.D,getIndicesPtr:l.E,getIndicesLength:l.F,getBuildingPart:l.G,getRingCount:l.H,getRingPtr:l.I,getRingLength:l.J,malloc:l.K,free:l.L,heapU8:i,heap16:r,heap32:a,heapF32:n})})})(fetch(tM.BUILDING_GEN_URL)).then(e=>(cd=null,cf=e)).catch(e=>{t_("Could not load building-gen"),cd=null,cp=e})}populate(e,i,r,a){let n=cf;if(!n)return;let o=sN(r);this.tileToMeter=o,this.brightness=i.brightness,n.setStyle({normalScale:[1,-1,o],tileToMeters:o}),n.setAOOptions(!1,.3),n.setMetricOptions(!1,16),n.setStructuralOptions(!0),n.setFacadeClassifierOptions(3);let s=new Map,l=new Map,h=0;for(let{feature:i}of e){if("LineString"!==dl[i.type]){s.set(i.id,i.properties.source_id);continue}let e=this.layers[0]._featureFilter.needGeometry;if(e&&!this.layers[0]._featureFilter.filter(new nC(this.zoom),i,r))continue;let n=sH(i,e);if(!e&&!this.layers[0]._featureFilter.filter(new nC(this.zoom),n,r))continue;let o=e?n.geometry:sq(i,r,a),u=[];for(let e of o)for(let i of e)u.push(i.x),u.push(i.y);let c={coordinates:u,crossPerc:i.properties.cross_perc,distanceToRoad:i.properties.distance_to_road,entrances:i.properties.entrances,sourceId:0},d=i.properties.source_id,p=l.get(d);p||(p=[],l.set(d,p)),p.push(c),++h}this.maxHeight=0;let u=[],c=new Set,d=e=>{null!=e&&c.add(e)},p=(e,i)=>{null!=e&&u.push({buildingId:e,footprintIndex:i})},f=64*(e.length-h),m=f/2;for(let{feature:u,id:_,index:g,sourceLayerIndex:y}of(this.buildingWithFacade.reserve(f,m,!0),this.buildingWithoutFacade.reserve(2*f,2*m,!1),this.footprintsIndices.reserve(16*(e.length-h)),this.footprintsVertices.reserve(8*(e.length-h)),e)){if("LineString"===dl[u.type])continue;let e=this.layers[0]._featureFilter.needGeometry;if(e&&!this.layers[0]._featureFilter.filter(new nC(this.zoom),u,r))continue;let h=null;if(u.properties&&u.properties.hasOwnProperty("building_id")&&(h=Number(u.properties.building_id),c.has(h)))continue;let f=sH(u,e);if(!e&&!this.layers[0]._featureFilter.filter(new nC(this.zoom),f,r))continue;let m=e?f.geometry:sq(u,r,a),x=hI(m,500),v=!1;for(let e of x)if(1!==e.length){v=!0;break}if(v||!function(e){for(let i of e)for(let e of i)if(e.x8355||e.y8355)return!1;return!0}(m)){d(h);continue}let b=this.layers[0],w=function(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 Error(`Unknown roof shape: ${e}`)}}(b.layout.get("building-roof-shape").evaluate(u,{},r)),T=b.layout.get("building-base").evaluate(u,{},r),S=b.layout.get("building-height").evaluate(u,{},r),E=b.layout.get("building-flood-light-ground-radius").evaluate(u,{},r),I=b.paint.get("building-ambient-occlusion-intensity"),A=E/this.tileToMeter;u.properties["building-part"]="roof";let M=b.paint.get("building-color").evaluate(u,{},this.canonical).toPremultipliedRenderColor(this.lut),C=b.paint.get("building-emissive-strength").evaluate(u,{},this.canonical);u.properties["building-part"]="wall";let P=b.paint.get("building-color").evaluate(u,{},this.canonical).toPremultipliedRenderColor(this.lut),R=b.paint.get("building-emissive-strength").evaluate(u,{},this.canonical);u.properties["building-part"]="window";let z=b.paint.get("building-color").evaluate(u,{},this.canonical).toPremultipliedRenderColor(this.lut),D=b.paint.get("building-emissive-strength").evaluate(u,{},this.canonical);u.properties["building-part"]="door";let L=b.paint.get("building-color").evaluate(u,{},this.canonical).toPremultipliedRenderColor(this.lut),F=b.paint.get("building-emissive-strength").evaluate(u,{},this.canonical),O=b.layout.get("building-flood-light-wall-radius").evaluate(u,{},r),k=(O=tr(O,0,2048))/2048*32767,B=s.get(_),V=l.get(B)||[],N=0!==V.length&&b.layout.get("building-facade").evaluate(u,{},r);n.setFacadeOptions(4,!0),n.setFauxFacadeOptions(N,!1,1);let U=0,j=0,G=0,q=0,H=0,$=0,Z=0,W=0,X=0,Y=0,K=0;if(N){let e=Math.round(b.layout.get("building-facade-floors").evaluate(u,{},r));if(0===T){e=Math.max(1,e-(V.length>0));let i=4;if(S>100){let e=[10,13,15];i=e[u.id?u.id%e.length:0]}else S0){let r=[],a=Array(i.length+1);a[0]=0;for(let e=0;e8192||Q.y8192)&&this.featuresOnBorder.push({featureId:u.id,footprintIndex:this.footprints.length});{let e=hh(ex,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+e.length),this.footprintsIndices.uint16.set(e,eg),this.buildingIds.add(null!=h?h:u.id),this.footprintsMin.x=Math.min(this.footprintsMin.x,ev.x),this.footprintsMin.y=Math.min(this.footprintsMin.y,ev.y),this.footprintsMax.x=Math.max(this.footprintsMax.x,eb.x),this.footprintsMax.y=Math.max(this.footprintsMax.y,eb.y);let i={footprintVertexOffset:ey,footprintVertexLength:this.footprintsVertices.length-ey,footprintIndexOffset:eg,footprintIndexLength:this.footprintsIndices.length-eg,min:ev,max:eb,hiddenFlags:0,indicesOffset:ep,indicesLength:e_,bloomIndicesOffset:eh,bloomIndicesLength:eu,groundEffectVertexOffset:ew,groundEffectVertexLength:eT,hasFauxFacade:N,height:ef,promoteId:_,feature:f,parts:es,buildingBloom:el},r=this.footprints.length;void 0!==u.id&&this.featureFootprintLookup.set(u.id,r),p(h,r),this.footprints.push(i)}this.programConfigurations.populatePaintArrays(ea.layoutVertexArray.length,u,g,{},i.availableImages,r,i.brightness),this.groundEffect.addPaintPropertiesData(u,g,{},i.availableImages,r,i.brightness),i.featureIndex.insert(u,m,g,y,this.index,ec)}u.forEach(({buildingId:e,footprintIndex:i})=>{c.has(e)&&(this.footprints[i].hiddenFlags|=4)});let _=new Set;this.buildingIds.forEach((e,i,r)=>{c.has(e)||_.add(e)}),this.buildingIds=_,this.groundEffect.prepareBorderSegments()}update(e,i,r,a,n,o,s){this.programConfigurations.updatePaintArrays(e,i,n,r,a,o,s),this.groundEffect.update(e,i,n,r,a,o,s),this.evaluate(this.layers[0],e),this.colorBufferUploaded=!1}isEmpty(){return 0===this.buildingWithoutFacade.layoutVertexArray.length&&0===this.buildingWithFacade.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){let i=i=>{i.layoutVertexBuffer=e.createVertexBuffer(i.layoutVertexArray,c9.members),i.layoutNormalBuffer=e.createVertexBuffer(i.layoutNormalArray,c7.members),i.layoutCentroidBuffer=e.createVertexBuffer(i.layoutCentroidArray,de.members),i.layoutFloodLightDataBuffer=e.createVertexBuffer(i.layoutFloodLightDataArray,ds.members),i.layoutFacadeDataArray&&i.layoutFacadeDataArray.length&&(i.layoutFacadeDataBuffer=e.createVertexBuffer(i.layoutFacadeDataArray,dr.members)),i.layoutFacadeVerticalRangeArray&&i.layoutFacadeVerticalRangeArray.length&&(i.layoutFacadeVerticalRangeBuffer=e.createVertexBuffer(i.layoutFacadeVerticalRangeArray,da.members)),i.entranceBloom.layoutVertexArray.length&&(i.entranceBloom.layoutVertexBuffer=e.createVertexBuffer(i.entranceBloom.layoutVertexArray,c9.members),i.entranceBloom.layoutAttenuationBuffer=e.createVertexBuffer(i.entranceBloom.layoutAttenuationArray,dn.members)),this.uploadUpdatedColorBuffer(e),this.uploadUpdatedIndexBuffer(e)};this.uploaded||(i(this.buildingWithoutFacade),i(this.buildingWithFacade),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){let 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,i,r=!0){let a=!1,n=r?i:0,o=0|(r?-1:~i);for(let i of(0===this.groundEffect.hiddenByLandmarkVertexArray.length&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length),e)){let e=this.footprints[i],r=e.hiddenFlags&o|n;e.hiddenFlags!==r&&(e.hiddenFlags=r,a=!0,this.groundEffect.updateHiddenByLandmarkRange(e.groundEffectVertexOffset,e.groundEffectVertexLength,0!==e.hiddenFlags))}return a&&(this.indexArrayForConflationUploaded=!1),a}uploadUpdatedIndexBuffer(e){if(this.groundEffect.uploadHiddenByLandmark(e),this.indexArrayForConflationUploaded)return;let i=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))};for(let e of(i(this.buildingWithoutFacade),i(this.buildingWithFacade),this.footprints)){let i=e.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,r=e.indicesOffset+e.indicesLength;if(0!==e.hiddenFlags){for(let a=e.indicesOffset;a{0!==i.indexArray.length&&(i.indexBuffer?i.indexBuffer.updateData(i.indexArrayForConflation):i.indexBuffer=e.createIndexBuffer(i.indexArrayForConflation,!0),i.entranceBloom.indexBuffer?i.entranceBloom.indexBuffer.updateData(i.entranceBloom.indexArrayForConflation):i.entranceBloom.indexBuffer=e.createIndexBuffer(i.entranceBloom.indexArrayForConflation,!0))};r(this.buildingWithoutFacade),r(this.buildingWithFacade),this.indexArrayForConflationUploaded=!0}uploadUpdatedColorBuffer(e){let i=i=>{i.layoutColorBuffer?i.layoutColorBuffer.updateData(i.layoutColorArray):i.layoutColorBuffer=e.createVertexBuffer(i.layoutColorArray,dt.members,!0),i.layoutFacadePaintArray&&(i.layoutFacadePaintBuffer?i.layoutFacadePaintBuffer.updateData(i.layoutFacadePaintArray):i.layoutFacadePaintBuffer=e.createVertexBuffer(i.layoutFacadePaintArray,di.members,!0)),i.entranceBloom.layoutColorBuffer?i.entranceBloom.layoutColorBuffer.updateData(i.entranceBloom.layoutColorArray):i.entranceBloom.layoutColorBuffer=e.createVertexBuffer(i.entranceBloom.layoutColorArray,dt.members,!0)};i(this.buildingWithoutFacade),i(this.buildingWithFacade),this.colorBufferUploaded=!0}evaluate(e,i){let r=e.paint.get("building-ambient-occlusion-intensity");for(let a of this.footprints){if(4&a.hiddenFlags)continue;let n=i[a.promoteId],o=a.feature;o.properties["building-part"]="roof";let s=e.paint.get("building-color").evaluate(o,n,this.canonical).toPremultipliedRenderColor(this.lut),l=e.paint.get("building-emissive-strength").evaluate(o,n,this.canonical);o.properties["building-part"]="wall";let h=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";let c=e.paint.get("building-color").evaluate(o,n,this.canonical).toPremultipliedRenderColor(this.lut),d=e.paint.get("building-emissive-strength").evaluate(o,n,this.canonical);o.properties["building-part"]="door";let p=e.paint.get("building-color").evaluate(o,n,this.canonical).toPremultipliedRenderColor(this.lut),f=e.paint.get("building-emissive-strength").evaluate(o,n,this.canonical),m=a.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(let e of a.parts){let i,n=s;1===e.part?(n=s,i=l):0===e.part?(n=h,i=u):2===e.part?(n=c,i=d):3===e.part&&(n=p,i=f),i=tr(i,0,1);for(let o=0;oi.max.x||r.max.xi.max.y||r.max.ys.max.x||s.min.x>e||i>s.max.y||s.min.y>i||s.height1&&(s=e[++o]);let u=Math.min(Math.abs(l-s.left),Math.abs(l-s.right)),c=i/r*(a+1);if(s.isDash){let e=a-Math.abs(c);h=Math.sqrt(u*u+e*e)}else h=a-Math.sqrt(u*u+c*c);this.image.data[n+l]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(e,i){for(let i=e.length-1;i>=0;--i){let r=e[i],a=e[i+1];r.zeroLength?e.splice(i,1):a&&a.isDash===r.isDash&&(a.left=r.left,e.splice(i,1))}let r=e[0],a=e[e.length-1];r.isDash===a.isDash&&(r.left=a.left-this.width,a.right=r.right+this.width);let n=this.width*this.nextRow,o=0,s=e[0];for(let r=0;r1&&(s=e[++o]);let a=Math.min(Math.abs(r-s.left),Math.abs(r-s.right));this.image.data[n+r]=Math.max(0,Math.min(255,(s.isDash?a:-a)+i+128))}}addDash(e,i){let r=this.getKey(e,i);if(this.positions[r])return this.positions[r];let a="round"===i,n=7*!!a,o=2*n+1;if(this.nextRow+o>this.height)return t_("LineAtlas out of space"),null;0===e.length&&e.push(1);let s=0;for(let i=0;ie.fqid),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(e=>{this.gradients[e.id]={}}),this.layoutVertexArray=new oh,this.layoutVertexArray2=new ou,this.patternVertexArray=new ou,this.indexArray=new oT,this.programConfigurations=new sy(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new o0,this.maxLineLength=0,this.zOffsetVertexArray=new ou,this.elevationGroundScaleVertexArray=new on,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,i){}updateAppearances(e,i,r,a){}populate(e,i,r,a){this.hasPattern=hC("line",this.layers,this.pixelRatio,i);let n=this.layers[0].layout.get("line-sort-key");this.tileToMeter=sN(r);let o=this.layers[0].layout.get("line-elevation-reference");if("hd-road-markup"===o)this.elevationType="road";else{let e=this.layers[0].layout.get("line-z-offset"),i=e.isConstant()&&!e.constantOr(0);this.elevationType="sea"!==o&&"ground"!==o&&i?"none":"offset","offset"===this.elevationType&&"none"===o&&t_(`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}let s=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope="offset"===this.elevationType&&void 0!==s;let l=[];for(let{feature:o,id:s,index:h,sourceLayerIndex:u}of e){let e=this.layers[0]._featureFilter.needGeometry,c=sH(o,e);if(!this.layers[0]._featureFilter.filter(new nC(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),c,r))continue;let d=n?n.evaluate(c,{},r):void 0,p={id:s,properties:o.properties,type:o.type,sourceLayerIndex:u,index:h,geometry:e?c.geometry:sq(o,r,a),patterns:{},sortKey:d};l.push(p)}n&&l.sort((e,i)=>e.sortKey-i.sortKey);let{lineAtlas:h,featureIndex:u}=i,c=this.addConstantDashes(h);for(let a of l){let{geometry:n,index:o,sourceLayerIndex:s}=a;if(c&&this.addFeatureDashes(a,h),this.hasPattern){let e=hP("line",this.layers,a,this.zoom,this.pixelRatio,i);this.patternFeatures.push(e)}else this.addFeature(a,n,o,r,h.positions,i.availableImages,i.brightness,i.elevationFeatures);u.insert(e[o].feature,n,o,s,this.index)}}addConstantDashes(e){let i=!1;for(let r of this.layers){let a=r.paint.get("line-dasharray").value,n=r.layout.get("line-cap").value;if("constant"!==a.kind||"constant"!==n.kind)i=!0;else{let i=n.value,r=a.value;if(!r)continue;e.addDash(r,i)}}return i}addFeatureDashes(e,i){let r=this.zoom;for(let a of this.layers){let n,o,s=a.paint.get("line-dasharray").value,l=a.layout.get("line-cap").value;if("constant"!==s.kind||"constant"!==l.kind){if("constant"===s.kind){if(!(n=s.value))continue}else n=s.evaluate({zoom:r},e);o="constant"===l.kind?l.value:l.evaluate({zoom:r},e),i.addDash(n,o),e.patterns[a.id]=[i.getKey(n,o)]}}}update(e,i,r,a,n,o,s,l){this.programConfigurations.updatePaintArrays(e,i,n,r,a,o,s,l)}addFeatures(e,i,r,a,n,o){for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,i,r,a,o,e.elevationFeatures)}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,d_)),0!==this.patternVertexArray.length&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,dg)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,dp.members,!0)),!this.elevationGroundScaleVertexBuffer&&this.elevationGroundScaleVertexArray.length>0&&(this.elevationGroundScaleVertexBuffer=e.createVertexBuffer(this.elevationGroundScaleVertexArray,df.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,dm),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.elevationGroundScaleVertexBuffer&&this.elevationGroundScaleVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e,i){let r,a;if(i&&i>0?(r=`mapbox_clip_start_${i}`,a=`mapbox_clip_end_${i}`):(r="mapbox_clip_start",a="mapbox_clip_end"),e.properties&&e.properties.hasOwnProperty(r)&&e.properties.hasOwnProperty(a))return{start:+e.properties[r],end:+e.properties[a]}}addFeature(e,i,r,a,n,o,s,l){let h=this.layers[0].layout,u=h.get("line-join").evaluate(e,{}),c=h.get("line-cap").evaluate(e,{}),d=h.get("line-miter-limit"),p=h.get("line-round-limit");this.lineClips=this.lineFeatureClips(e),this.lineFeature=e;let f=!(!e.properties||!e.properties.hasOwnProperty("mapbox_line_metrics"))&&e.properties.mapbox_line_metrics;this.zOffsetValue=h.get("line-z-offset").value;let m=this.layers[0].paint.get("line-width").value;if("constant"!==m.kind&&!1===m.isLineProgressConstant&&(this.variableWidthValue=m),this.isSeaLevelReference){let e=h.get("line-elevation-ground-scale").value;"constant"===e.kind&&0===e.value||(this.elevationGroundScaleValue=e)}if("road"===this.elevationType){let r=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(e,i,a,l,u,c,d,p)){let[n,o]=this.clipRuntimeLinesToTile(i,1);for(let i=0;i0?s.parentIndex:null)}this.fillNonElevatedRoadSegment(r)}}else for(let r=0;r0?r:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,n,o,a,s,void 0,this.worldview)}computeSegNextDir(e,i){return e.nextPoint.sub(i.at(-2)).unit()}computeSegPrevDir(e,i){return i[1].sub(e.prevPoint).unit()}clipLinesToTile(e,i){return u0(e,-i,-i,8192+i,8192+i)}clipRuntimeLinesToTile(e,i){let r=[];return[u0(e,-i,-i,8192+i,8192+i,r),r]}addElevatedRoadFeature(e,i,r,a,n,o,s,l){let h=[],u=la.getElevationFeature(e,a);if(u){let e=this.clipLinesToTile(i,1);for(let i of this.prepareElevatedLines(e,u,r))h.push({geometry:i,elevation:u,elevationTileID:r,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if(0===h.length)return!1;for(let i of h){let a=this.layoutVertexArray.length;this.addLine(i.geometry,e,r,n,o,s,l);let h=new ln(r,i.elevationTileID);if(i.elevation)for(let e=a;e>1,this.layoutVertexArray.int16[6*e+1]>>1),a=h.pointElevation(r,i.elevation,.05);this.updateHeightRange(a),this.zOffsetVertexArray.emplaceBack(a,0,0)}else this.fillNonElevatedRoadSegment(a)}return!0}prepareElevatedLines(e,i,r){if(null!=i.constantHeight)return e;let a=[],n=1/sN(r);for(let r of e)!function(e,i,r){if(e.lengthe.t-i.t);let n=0,o=0,s=[];for(r.push(s);n!==e.length;){if(o===a.length){for(;n!==e.length;)0!==s.length&&s[s.length-1].equals(e[n])||s.push(e[n]),n++;break}a[o].t0,v=l&&l.progress.max0&&(a=(r.max-r.min)/e)}let n=+i.properties.mapbox_clip_feature_len,o=+i.properties.mapbox_clip_seg_len;if(Number.isNaN(n)||Number.isNaN(o)){for(let i=0;i=2&&e[E-1].equals(e[E-2]);)E--;let I=0;for(;I0,R=this.overscalingo&&(l="bevel"),"bevel"===l&&(T>2&&(l="flipbevel"),T2*R){let i=u.sub(u.sub(c)._mult(R/e)._round());this.updateDistance(c,i),this.addCurrentVertex(i,p,0,0,A,g),c=i}this.updateDistance(c,u),b._mult(T),this.addCurrentVertex(u,b,0,0,A,g);let i=u.dist(d);if(i>2*R){let e=u.add(d.sub(u)._mult(R/i)._round());this.updateDistance(u,e),this.addCurrentVertex(e,f,0,0,A,g),u=e}}else b._mult(T),this.addCurrentVertex(u,b,0,0,A,g);else if("flipbevel"===l){if(T>100)b=f.mult(-1);else{let e=T*p.add(f).mag()/p.sub(f).mag();b._perp()._mult(e*(P?-1:1))}this.addCurrentVertex(u,b,0,0,A,g),this.addCurrentVertex(u,b.mult(-1),0,0,A,g)}else if("bevel"===l||"fakeround"===l){let e=u.dist(c),i=1;if("offset"===this.elevationType&&"bevel"===l&&"round"!==this.currentLineJoinType&&!this.patternJoinNone&&null!=g&&c&&d){let r=4*R;e1){this.lineSoFar=e.w;let r=(i.x-e.x)/c,a=(i.y-e.y)/c,n=(i.z-e.z)/c,o=(i.w-e.w)/c,s=i.x-e.x,l=i.y-e.y,p=Math.sqrt(s*s+l*l);if(0===p)return;let f=-l/p,m=s/p,_=-f,g=-m;for(let i=1;i=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),l.primitiveLength++),o?this.e2=u:this.e1=u,null!=h&&this.zOffsetVertexArray.emplaceBack(h.zOffset,h.variableWidth,h.variableWidth),this.elevationGroundScaleValue){let e=h?h.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,i){this.prevDistance=this.distance,this.distance+=e.dist(i),this.updateScaledDistance()}}function dT(e,i,r){return e.xr||e.yr}function dS(e,i,r){return i*(8192/(e.tileSize*Math.pow(2,r-e.tileID.overscaledZ)))}aW(dw,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});let dE=(e,i,r)=>(1-r)*e+r*i;function dI(e,i){return 1/dS(e,1,i.tileZoom)}function dA(e,i,r,a){return e.translatePosMatrix(a||i.tileID.projMatrix,i,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}let dM=e=>{let i=[];dC(e)&&i.push("RENDER_LINE_DASH"),e.paint.get("line-gradient")&&i.push("RENDER_LINE_GRADIENT");let r=e.paint.get("line-trim-offset");0===r[0]&&0===r[1]||i.push("RENDER_LINE_TRIM_OFFSET"),0!==e.paint.get("line-border-width").constantOr(1)&&i.push("RENDER_LINE_BORDER");let a="none"===e.layout.get("line-join").constantOr("miter"),n=!!e.paint.get("line-pattern").constantOr(1);return a&&n&&i.push("LINE_JOIN_NONE"),i};function dC(e){let i=e.paint.get("line-dasharray").value;return"constant"!==i.kind||i.value}let dP=()=>P||(P={layout:M||(M=new nU({"line-cap":new nV(nj.layout_line["line-cap"]),"line-join":new nV(nj.layout_line["line-join"]),"line-miter-limit":new nB(nj.layout_line["line-miter-limit"]),"line-round-limit":new nB(nj.layout_line["line-round-limit"]),"line-sort-key":new nV(nj.layout_line["line-sort-key"]),"line-z-offset":new nV(nj.layout_line["line-z-offset"]),"line-elevation-reference":new nB(nj.layout_line["line-elevation-reference"]),"line-cross-slope":new nB(nj.layout_line["line-cross-slope"]),visibility:new nB(nj.layout_line.visibility),"line-width-unit":new nB(nj.layout_line["line-width-unit"]),"line-elevation-ground-scale":new nV(nj.layout_line["line-elevation-ground-scale"])})),paint:C||(C=new nU({"line-opacity":new nV(nj.paint_line["line-opacity"]),"line-color":new nV(nj.paint_line["line-color"]),"line-translate":new nB(nj.paint_line["line-translate"]),"line-translate-anchor":new nB(nj.paint_line["line-translate-anchor"]),"line-width":new nV(nj.paint_line["line-width"]),"line-gap-width":new nV(nj.paint_line["line-gap-width"]),"line-offset":new nV(nj.paint_line["line-offset"]),"line-blur":new nV(nj.paint_line["line-blur"]),"line-dasharray":new nV(nj.paint_line["line-dasharray"]),"line-pattern":new nV(nj.paint_line["line-pattern"]),"line-pattern-cross-fade":new nB(nj.paint_line["line-pattern-cross-fade"]),"line-gradient":new nN(nj.paint_line["line-gradient"]),"line-trim-offset":new nB(nj.paint_line["line-trim-offset"]),"line-trim-fade-range":new nB(nj.paint_line["line-trim-fade-range"]),"line-trim-color":new nB(nj.paint_line["line-trim-color"]),"line-emissive-strength":new nV(nj.paint_line["line-emissive-strength"]),"line-border-width":new nV(nj.paint_line["line-border-width"]),"line-border-color":new nV(nj.paint_line["line-border-color"]),"line-occlusion-opacity":new nB(nj.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new nV({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new nV({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new nV({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new nV({type:"string",default:"default","property-type":"data-driven"})}))});class dR extends nV{possiblyEvaluate(e,i){return i=new nC(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,transition:i.transition,worldview:i.worldview}),super.possiblyEvaluate(e,i)}evaluate(e,i,r,a){return i=Object.assign({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(e,i,r,a)}}let dz=oe([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),dD=oe([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),dL=oe([{name:"a_projected_pos",components:4,type:"Float32"}],4);oe([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let dF=oe([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),dO=oe([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),dk=oe([{name:"a_texb",components:2,type:"Uint16"}]),dB=oe([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),dV=oe([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);oe([{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"}]);let dN=oe([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),dU=oe([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);oe([{name:"triangle",components:3,type:"Uint16"}]),oe([{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"}]),oe([{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"}]),oe([{type:"Float32",name:"offsetX"}]),oe([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);let dj={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"},dG="u">3,n=this.pos;this.type=7&r,e(a,i,this),this.pos===n&&this.skip(r)}return i}readMessage(e,i){return this.readFields(e,i,this.readVarint()+this.pos)}readFixed32(){let e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){let e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){let e=this.dataView.getUint32(this.pos,!0)+0x100000000*this.dataView.getUint32(this.pos+4,!0);return this.pos+=8,e}readSFixed64(){let e=this.dataView.getUint32(this.pos,!0)+0x100000000*this.dataView.getInt32(this.pos+4,!0);return this.pos+=8,e}readFloat(){let e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){let e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){let i,r,a=this.buf;return i=127&(r=a[this.pos++]),r>4,n>>0):0x100000000*(i>>>0)+(e>>>0)}(e,a,i);throw Error("Expected varint not more than 10 bytes")}(i|=(15&(r=a[this.pos]))=12&&dG?dG.decode(this.buf.subarray(i,e)):function(e,i,r){let a="",n=i;for(;n239?4:i>223?3:i>191?2:1;if(n+u>r)break;1===u?i=55296&&h=1114112)&&(h=null)),null===h?(h=65533,u=1):h>65535&&(h-=65536,a+=String.fromCharCode(h>>>10&1023|55296),h=56320|1023&h),a+=String.fromCharCode(h),n+=u}return a}(this.buf,i,e)}readBytes(){let e=this.readVarint()+this.pos,i=this.buf.subarray(this.pos,e);return this.pos=e,i}readPackedVarint(e=[],i){let r=this.readPackedEnd();for(;this.pos127;);else if(2===i)this.pos=this.readVarint()+this.pos;else if(5===i)this.pos+=4;else{if(1!==i)throw Error(`Unimplemented type: ${i}`);this.pos+=8}}writeTag(e,i){this.writeVarint(e0xfffffff||e=0?(n=e%0x100000000|0,o=e/0x100000000|0):(n=~(-e%0x100000000),o=~(-e/0x100000000),0xffffffff^n?n=n+1|0:(n=0,o=o+1|0)),e>=0xffffffffffffffff||e>>=7,i.buf[i.pos++]=127&r|128,r>>>=7,i.buf[i.pos++]=127&r|128,r>>>=7,i.buf[i.pos++]=127&r|128,i.buf[i.pos]=127&(r>>>=7),s=(7&(a=o))>>=3),a&&(i.buf[i.pos++]=127&a|128*!!(a>>>=7),a&&(i.buf[i.pos++]=127&a|128*!!(a>>>=7),a&&(i.buf[i.pos++]=127&a|128*!!(a>>>=7),a&&(i.buf[i.pos++]=127&a|128*!!(a>>>=7),a&&(i.buf[i.pos++]=127&a)))))}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|128*(e>127),e>>=7)|128*(e>127),e>>=7)|128*(e>127),e>>7&127))))}writeSVarint(e){this.writeVarint(e55295&&a56319||o+1===i.length?(e[r++]=239,e[r++]=191,e[r++]=189):n=a;continue}if(a>6|192:(a>12|224:(e[r++]=a>>18|240,e[r++]=a>>12&63|128),e[r++]=a>>6&63|128),e[r++]=63&a|128)}return r}(this.buf,e,this.pos);let r=this.pos-i;r>=128&&dH(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){let i=e.length;this.writeVarint(i),this.realloc(i);for(let r=0;r=128&&dH(r,a,this),this.pos=r-1,this.writeVarint(a),this.pos+=a}writeMessage(e,i,r){this.writeTag(e,2),this.writeRawMessage(i,r)}writePackedVarint(e,i){i.length&&this.writeMessage(e,d$,i)}writePackedSVarint(e,i){i.length&&this.writeMessage(e,dZ,i)}writePackedBoolean(e,i){i.length&&this.writeMessage(e,dY,i)}writePackedFloat(e,i){i.length&&this.writeMessage(e,dW,i)}writePackedDouble(e,i){i.length&&this.writeMessage(e,dX,i)}writePackedFixed32(e,i){i.length&&this.writeMessage(e,dK,i)}writePackedSFixed32(e,i){i.length&&this.writeMessage(e,dJ,i)}writePackedFixed64(e,i){i.length&&this.writeMessage(e,dQ,i)}writePackedSFixed64(e,i){i.length&&this.writeMessage(e,d0,i)}writeBytesField(e,i){this.writeTag(e,2),this.writeBytes(i)}writeFixed32Field(e,i){this.writeTag(e,5),this.writeFixed32(i)}writeSFixed32Field(e,i){this.writeTag(e,5),this.writeSFixed32(i)}writeFixed64Field(e,i){this.writeTag(e,1),this.writeFixed64(i)}writeSFixed64Field(e,i){this.writeTag(e,1),this.writeSFixed64(i)}writeVarintField(e,i){this.writeTag(e,0),this.writeVarint(i)}writeSVarintField(e,i){this.writeTag(e,0),this.writeSVarint(i)}writeStringField(e,i){this.writeTag(e,2),this.writeString(i)}writeFloatField(e,i){this.writeTag(e,5),this.writeFloat(i)}writeDoubleField(e,i){this.writeTag(e,1),this.writeDouble(i)}writeBooleanField(e,i){this.writeVarintField(e,+i)}};function dH(e,i,r){let a=i=e;i--)r.buf[i+a]=r.buf[i]}function d$(e,i){for(let r=0;r=0&&r>=e&&d9[this.text.charCodeAt(r)];r--)i--;this.text=this.text.substring(e,i),this.sectionIndex=this.sectionIndex.slice(e,i)}substring(e,i){let r=new d6;return r.text=this.text.substring(e,i),r.sectionIndex=this.sectionIndex.slice(e,i),r.sections=this.sections,r}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,i)=>Math.max(e,this.sections[i].scale),0)}addTextSection(e,i){this.text+=e.text,this.sections.push(d4.forText(e.scale,e.fontStack||i));let r=this.sections.length-1;for(let i=0;i=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function d8(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_=1,g=1){let y=d6.fromFeature(e,n,_,g);d===d5.vertical&&y.verticalizePunctuation(p);let x=[],v=function(e,i,r,a,n,o,s=1){if(!e)return[];let l=[],h=function(e,i,r,a,n,o,s=1){let l=0;for(let r=0;r=0,c=0;for(let r=0;r0&&h>T&&(T=h)}else{let e=r[l.fontStack];if(!e)continue;e[g]&&(I=e[g]);let a=i[l.fontStack];if(!a)continue;let o=a.glyphs[g];if(!o)continue;if(b=o.metrics,M=24*(8203!==g),y){let e=void 0!==a.ascender?Math.abs(a.ascender):0,i=void 0!==a.descender?Math.abs(a.descender):0,r=(e+i)*x;S-r/2;){if(--sa;)u-=h.shift().angleDelta;if(u>n)return!1;s++,l+=i.dist(r)}return!0}function p_(e){let i=0;for(let r=0;ri.h-e.h);let a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(i/.95)),r),h:1/0}],n=0,o=0;for(let i of e)for(let e=a.length-1;e>=0;e--){let r=a[e];if(!(i.w>r.w||i.h>r.h)){if(i.x=r.x,i.y=r.y,o=Math.max(o,i.y+i.h),n=Math.max(n,i.x+i.w),i.w===r.w&&i.h===r.h){let i=a.pop();i&&e1?s-1:s,hi.copy(a.data,h,{x:0,y:0},{x:l,y:u},a.data,r),hi.copy(a.data,h,{x:0,y:d-s},{x:l,y:u-s},{width:c,height:s},r),hi.copy(a.data,h,{x:0,y:0},{x:l,y:u+d},{width:c,height:s},r),hi.copy(a.data,h,{x:c-s,y:0},{x:l-s,y:u},{width:s,height:d},r),hi.copy(a.data,h,{x:0,y:0},{x:l+c,y:u},{width:s,height:d},r),hi.copy(a.data,h,{x:c-s,y:d-s},{x:l-s,y:u-s},{width:s,height:s},r),hi.copy(a.data,h,{x:0,y:d-s},{x:l+c,y:u-s},{width:s,height:s},r),hi.copy(a.data,h,{x:0,y:0},{x:l+c,y:u+d},{width:s,height:s},r),hi.copy(a.data,h,{x:c-s,y:0},{x:l-s,y:u+d},{width:s,height:s},r)}this.lut=r,this.image=h,this.iconPositions=a,this.patternPositions=n}addImages(e,i,r,a){for(let[n,o]of e.entries()){let{bin:e,imagePosition:s,imageVariant:l}=pv(n,o,r);i.set(n,s),a.push(e),o.hasRenderCallback&&this.haveRenderCallbacks.push(l.id)}}patchUpdatedImages(e,i,r,a){for(let n of(this.haveRenderCallbacks=this.haveRenderCallbacks.filter(i=>e.hasImage(i,r)),e.dispatchRenderCallbacks(this.haveRenderCallbacks,r),e.getUpdatedImages(r))){for(let a of this.iconPositions.keys()){let o=iN.parse(a);if(io.isEqual(o.id,n)){let o=e.getImage(n,r);this.patchUpdatedImage(this.iconPositions.get(a),o,i,null)}}for(let o of this.patternPositions.keys()){let s=iN.parse(o);if(io.isEqual(s.id,n)){let s=e.getImage(n,r);this.patchUpdatedImage(this.patternPositions.get(o),s,i,a||this.lut)}}}}patchUpdatedImage(e,i,r,a=null){if(!e||!i||e.version===i.version)return;e.version=i.version;let[n,o]=e.tl,s=e.sdf;if(this.lut||s){let e={width:i.data.width,height:i.data.height},l=new hi(e);hi.copy(i.data,l,{x:0,y:0},{x:0,y:0},e,a,s),r.update(l,{position:{x:n,y:o}})}else r.update(i.data,{position:{x:n,y:o}})}}function pw(e,i,r,a,n,o,s,l,h){for(let u=i;u-1)o[++h]=l,s[h]=u,s[h+1]=1e20}for(let l=0,h=0;l{let n=this.entries[e];n||(n=this.entries[e]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let o=n.glyphs[i];if(void 0!==o)return void r(null,{stack:e,id:i,glyph:o});if(o=this._tinySDF(n,e,i))return n.glyphs[i]=o,void r(null,{stack:e,id:i,glyph:o});let s=Math.floor(i/256);if(256*s>65535)return t_("glyphs > 65535 not supported"),void r(null,{stack:e,id:i,glyph:o});if(n.ranges[s])return void r(null,{stack:e,id:i,glyph:o});let l=n.requests[s];l||(l=n.requests[s]=[],pE.loadGlyphRange(e,s,a,this.requestManager,(e,i)=>{if(i){for(let e in n.ascender=i.ascender,n.descender=i.descender,i.glyphs)this._doesCharSupportLocalGlyph(+e)||(n.glyphs[+e]=i.glyphs[+e]);n.ranges[s]=!0}for(let r of l)r(e,i);delete n.requests[s]})),l.push((a,n)=>{a?r(a):n&&r(null,{stack:e,id:i,glyph:n.glyphs[i]||null})})},(e,r)=>{if(e)i(e);else if(r){let e={};for(let{stack:i,id:a,glyph:n}of r)void 0===e[i]&&(e[i]={}),void 0===e[i].glyphs&&(e[i].glyphs={}),e[i].glyphs[a]=n&&{id:n.id,bitmap:n.bitmap.clone(),metrics:n.metrics},e[i].ascender=this.entries[i].ascender,e[i].descender=this.entries[i].descender;i(null,e)}})}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==pS.none&&(this.localGlyphMode===pS.all?!!this.localFontFamily:!!this.localFontFamily&&(na(e)||ns(e)||a4(e)||a6(e)||a5(e)||nr(e)||e>=131072&&e=66736&&e{var p,f,g,y,A,M,C,P,R,z,D,L,F,O,k,B;let V=(p=a.stretch-x,p/v*c+e.left*n),N=(f=a.fixed-T,g=S,y=a.stretch,f-g*y/m),U=(A=o.stretch-b,A/w*d+e.top*n),j=(M=o.fixed-E,C=I,P=o.stretch,M-C*P/_),G=(R=h.stretch-x,R/v*c+e.left*n),q=(z=h.fixed-T,D=S,L=h.stretch,z-D*L/m),H=(F=u.stretch-b,F/w*d+e.top*n),$=(O=u.fixed-E,k=I,B=u.stretch,O-k*B/_),Z=new e4(V,U),W=new e4(G,U),X=new e4(G,H),Y=new e4(V,H),K=new e4(N/l,j/l),J=new e4(q/l,$/l),Q=i*Math.PI/180;if(Q){let e=Math.sin(Q),i=Math.cos(Q),r=[i,-e,e,i];Z._matMult(r),W._matMult(r),Y._matMult(r),X._matMult(r)}let ee=a.stretch+a.fixed,et=h.stretch+h.fixed,ei=o.stretch+o.fixed,er=u.stretch+u.fixed,ea=e.imageSecondary;return{tl:Z,tr:W,bl:Y,br:X,texPrimary:{x:s.paddedRect.x+1+ee,y:s.paddedRect.y+1+ei,w:et-ee,h:er-ei},texSecondary:ea?{x:ea.paddedRect.x+1+ee,y:ea.paddedRect.y+1+ei,w:et-ee,h:er-ei}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:K,pixelOffsetBR:J,minFontScaleX:S/l/c,minFontScaleY:I/l/d,isSDF:r}};if(s.stretchX||s.stretchY){let e=pC(p,g,m),i=pC(f,y,_);for(let r=0;r0?[c,-d]:p{if(e)n(e);else if(i){let e={},r=new dq(i).readFields(d1,{});for(let i of r.glyphs)e[i.id]=i;n(null,{glyphs:e,ascender:r.ascender,descender:r.descender})}})},pE.TinySDF=class{constructor({fontSize:e=24,buffer:i=3,radius:r=8,cutoff:a=.25,fontFamily:n="sans-serif",fontWeight:o="normal",fontStyle:s="normal",lang:l=null}={}){this.buffer=i,this.cutoff=a,this.radius=r,this.lang=l;const h=this.size=e+4*i,u=this._createCanvas(h),c=this.ctx=u.getContext("2d",{willReadFrequently:!0});c.font=`${s} ${o} ${e}px ${n}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(h*h),this.gridInner=new Float64Array(h*h),this.f=new Float64Array(h),this.z=new Float64Array(h+1),this.v=new Uint16Array(h)}_createCanvas(e){let i=document.createElement("canvas");return i.width=i.height=e,i}draw(e){let{width:i,actualBoundingBoxAscent:r,actualBoundingBoxDescent:a,actualBoundingBoxLeft:n,actualBoundingBoxRight:o}=this.ctx.measureText(e),s=Math.ceil(r),l=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-n))),h=Math.min(this.size-this.buffer,s+Math.ceil(a)),u=l+2*this.buffer,c=h+2*this.buffer,d=Math.max(u*c,0),p=new Uint8ClampedArray(d),f={data:p,width:u,height:c,glyphWidth:l,glyphHeight:h,glyphTop:s,glyphLeft:0,glyphAdvance:i};if(0===l||0===h)return f;let{ctx:m,buffer:_,gridInner:g,gridOuter:y}=this;this.lang&&(m.lang=this.lang),m.clearRect(_,_,l,h),m.fillText(e,_,_+s);let x=m.getImageData(_,_,l,h);y.fill(1e20,0,d),g.fill(0,0,d);for(let e=0;e0?e*e:0,g[a]=ee.y!=l.y>e.y&&e.x32640&&t_(`${e}: Value for "text-size" is >= 255. Reduce your "text-size".`):"composite"===i.kind&&((s=[128*n*a,128*o*a])[0]>32640||s[1]>32640)&&t_(`${e}: Value for "text-size" is >= 255. Reduce your "text-size".`),s}function pX(e){for(let i in e)return e[i];return null}function pY(e,i,r,a,n,o,s,l,h,u,c){let d,p,f,m;if(d=c?c.top:s.top,p=c?c.bottom:s.bottom,f=c?c.left:s.left,m=c?c.right:s.right,pn(s)&&s.collisionPadding){let e=s.collisionPadding;f-=e[0],d-=e[1],m+=e[2],p+=e[3]}if(h){let e=new e4(f,d),i=new e4(m,d),r=new e4(f,p),a=new e4(m,p),n=h*e8,o=new e4(0,0);u&&(o=new e4(u[0],u[1])),e._rotateAround(n,o),i._rotateAround(n,o),r._rotateAround(n,o),a._rotateAround(n,o),f=Math.min(e.x,i.x,r.x,a.x),m=Math.max(e.x,i.x,r.x,a.x),d=Math.min(e.y,i.y,r.y,a.y),p=Math.max(e.y,i.y,r.y,a.y)}return e.emplaceBack(i.x,i.y,i.z,r.x,r.y,f,d,m,p,l,a,n,o),e.length-1}function pK(e){pn(e)&&e.collisionPadding&&(e.top-=e.collisionPadding[1],e.bottom+=e.collisionPadding[3]);let i=e.bottom-e.top;return i>0?Math.max(10,i):null}function pJ(e,i){let r=e.fovAboveCenter,a=e.elevation?e.elevation.getMinElevationBelowMSL()*i:0,n=(e._camera.position[2]*e.worldSize-a)/Math.cos(e._pitch),o=Math.sin(r)*n/Math.sin(Math.max(Math.PI/2-e._pitch-r,.01)),s=Math.sin(e._pitch)*o+n,l=n*(1/e._horizonShift);if(!e.elevation||0===e.elevation.exaggeration()){let i=Math.max(e.zoom-17,0);e.isOrthographic&&(i/=10),s*=1+i}return Math.min(1.01*s,l)}function pQ(e,i){if(!i.isReprojectedInTileSpace)return{scale:1v&&(b(e,u,a,n,l,h),b(u,r,l,h,o,s))}b(d,p,a,o,n,o),b(p,f,n,o,n,s),b(f,m,n,s,a,s),b(m,d,a,s,a,o),_-=v,g-=v,y+=v,x+=v;let w=1/Math.max(y-_,x-g);return{scale:w,x:_*w,y:g*w,x2:y*w,y2:x*w,projection:i}}function p0(e,{x:i,y:r},a=0){return new e4(((i-a)*e.scale-e.x)*8192,(r*e.scale-e.y)*8192)}let p1=ee(new Float32Array(16));class p2{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,i){return{x:0,y:0,z:0}}unproject(e,i){return new sC(0,0)}projectTilePoint(e,i,r){return{x:e,y:i,z:0}}locationPoint(e,i,r,a=!0){return e._coordinatePoint(e.locationCoordinate(i,r),a)}pixelsPerMeter(e,i){return 1/sR(e)*i}pixelSpaceConversion(e,i,r){return 1}farthestPixelDistance(e){return pJ(e,e.pixelsPerMeter)}pointCoordinate(e,i,r,a){let n=new e4(i,Math.max(e.horizonLineFromTop(!1),r));return e.rayIntersectionCoordinate(e.pointRayIntersection(n,a))}pointCoordinate3D(e,i,r){let a=new e4(i,r);if(e.elevation)return e.elevation.pointCoordinate(a);{let i=this.pointCoordinate(e,a.x,a.y,0);return[i.x,i.y,i.z]}}isPointAboveHorizon(e,i){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,i.x,i.y);let r=e.horizonLineFromTop();return i.yMath.abs(e)));++s);let o=p5*e*(1.340264+-.24331799999999998*a+n*(.0062510000000000005+.034164*a))/Math.cos(r),s=Math.asin(Math.sin(r)/p5);return new sC(tr(180*o/Math.PI,-180,180),tr(180*s/Math.PI,-85.051129,85.051129))}}class p6 extends p2{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){return{x:.5+e/360,y:.5-i/360,z:0}}unproject(e,i){return new sC(360*(e-.5),tr(360*(.5-i),-85.051129,85.051129))}}let p8=Math.PI/2;function p9(e){return Math.tan((p8+e)/2)}class p7 extends p2{constructor(e){super(e),this.center=e.center||[0,30];const[i,r]=this.parallels=e.parallels||[30,30];let a=i*e8,n=r*e8;this.southernCenter=a+n0?ip8-1e-6&&(i=p8-1e-6);let n=a/Math.pow(p9(i),r),o=n*Math.sin(r*e),s=a-n*Math.cos(r*e);return o=.5*(o/Math.PI+.5),s=.5*(s/Math.PI+.5),{x:o,y:this.southernCenter?s:1-s,z:0}}unproject(e,i){e=(2*e-.5)*Math.PI,this.southernCenter&&(i=1-i);let{n:r,f:a}=this,n=a-(i=(2*(1-i)-.5)*Math.PI),o=Math.sign(n),s=Math.sign(r)*Math.sqrt(e*e+n*n),l=Math.atan2(e,Math.abs(n))*o;n*r1e-6&&--a>0)return new sC(tr(e/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979))*e9,-180,180),r*e9)}}let fr=85.051129*e8;class fa extends p2{project(e,i){i*=e8,e*=e8;let r=Math.cos(i),a=Math.acos(r*Math.cos(e/2)),n=Math.sin(a)/a;return{x:.5*((.5*(2/Math.PI*e+2*r*Math.sin(e/2)/n)||0)/Math.PI+.5),y:1-.5*((.5*(i+Math.sin(i)/n)||0)/Math.PI+1),z:0}}unproject(e,i){let r=e=(2*e-.5)*Math.PI,a=i=(2*(1-i)-1)*Math.PI,n=25,o=0,s=0;do{let n=Math.cos(a),l=Math.sin(a),h=2*l*n,u=l*l,c=n*n,d=Math.cos(r/2),p=Math.sin(r/2),f=2*d*p,m=p*p,_=1-c*d*d,g=_?1/_:0,y=_?Math.acos(n*d)*Math.sqrt(1/_):0,x=.5*(2*y*n*p+2*r/Math.PI)-e,v=.5*(y*l+a)-i,b=.5*g*(c*m+y*n*d*u)+1/Math.PI,w=g*(f*h/4-y*l*p),T=.125*g*(h*p-y*l*c*f),S=.5*g*(u*d+y*m*n)+.5,E=w*T-S*b;o=(v*w-x*S)/E,s=(x*T-v*b)/E,r=tr(r-o,-Math.PI,Math.PI),a=tr(a-s,-fr,fr)}while((Math.abs(o)>1e-6||Math.abs(s)>1e-6)&&--n>0)return new sC(r*e9,a*e9)}}class fn extends p2{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(this.parallels[0]*e8)),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){let{scale:r,cosPhi:a}=this;return{x:e*e8*a*r+.5,y:-Math.sin(i*e8)/a*r+.5,z:0}}unproject(e,i){let{scale:r,cosPhi:a}=this,n=tr((e-.5)/r*e9/a,-180,180),o=Math.asin(tr(-(i-.5)/r*a,-1,1));return new sC(n,tr(o*e9,-85.051129,85.051129))}}class fo extends fe{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,i,r){let a=lj(e,i,r);return ez(a,a,lH(lO(r))),{x:a[0],y:a[1],z:a[2]}}locationPoint(e,i,r){let a=sA(i.lat,i.lng),n=eM([],a),o=r?e._centerAltitude+r:e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(i),e._centerAltitude):e._centerAltitude;eT(a,a,n,1/sR(0)*8192*o);let s=ee(new Float64Array(16));return ei(s,e.pixelMatrix,e.globeMatrix),ez(a,a,s),new e4(a[0],a[1])}pixelsPerMeter(e,i){return 1/sR(0)*i}pixelSpaceConversion(e,i,r){let a=1/sR(e)*i,n=im(1/sR(45)*i,a,r);return this.pixelsPerMeter(e,i)/n}createTileMatrix(e,i,r){let a=l$(lO(r.canonical));return ei(new Float64Array(16),e.globeMatrix,a)}createInversionMatrix(e,i){let{center:r}=e,a=lH(lO(i));return eo(a,a,r.lng*e8),en(a,a,r.lat*e8),ea(a,a,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(a)}pointCoordinate(e,i,r,a){return lD(e,i,r,!0)||new sU(0,0)}pointCoordinate3D(e,i,r){let a=this.pointCoordinate(e,i,r,0);return[a.x,a.y,a.z]}isPointAboveHorizon(e,i){return!lD(e,i.x,i.y,!1)}farthestPixelDistance(e){let i=function(e,i){let r,a=e.cameraToCenterDistance,n=e._centerAltitude*i,o=e._camera,s=e._camera.forward(),l=eg([],ew([],s,-a),[0,0,n]),h=e.worldSize/(2*Math.PI),u=[0,0,-h],c=e.width/e.height,d=Math.tan(e.fovAboveCenter),p=ew([],o.up(),d),f=ew([],o.right(),d*c),m=eM([],eg([],eg([],s,p),f)),_=[];if(new s6(l,m).closestPointOnSphere(u,h,_)){let i=ey([],eg([],_,u),l);r=Math.cos(e.fovAboveCenter)*ef(i)}else{let e=ey([],l,u),i=ey([],u,l);eM(i,i);let a=ef(e)-h,n=Math.acos((r=Math.sqrt(a*(a+2*h)))/(h+a))-Math.acos(eC(s,i));r*=Math.cos(n)}return 1.01*r}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),r=lY(e.zoom);return r>0?im(i,pJ(e,1/sR(e.center.lat)*e.worldSize)+e.worldSize/(2*Math.PI)*(1-Math.cos(Math.max(e.width,e.height)/e.worldSize*Math.PI)),Math.pow(r,10)):i}upVector(e,i,r){return lj(i,r,e,1)}upVectorScale(e){return{metersToTile:lR(lG(lO(e)))}}}function fs(e){let i=e.parallels,r=!!i&&.01>Math.abs(i[0]+i[1]);switch(e.name){case"mercator":return new fe(e);case"equirectangular":return new p6(e);case"naturalEarth":return new fi(e);case"equalEarth":return new p4(e);case"winkelTripel":return new fa(e);case"albers":return r?new fn(e):new p3(e);case"lambertConformalConic":return r?new fn(e):new p7(e);case"globe":return new fo(e)}throw Error(`Invalid projection name: ${e.name}`)}let fl=s$.types,fh=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function fu(e,i,r,a,n,o,s,l,h,u,c,d,p){let f=l?Math.min(32640,Math.round(l[0])):0,m=l?Math.min(32640,Math.round(l[1])):0;e.emplaceBack(i,r,Math.round(32*a),Math.round(32*n),o,s,(f{for(let n=0;n0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,dk.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,dD.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||n)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,dF.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=e.createVertexBuffer(this.orientationVertexArray,dO.members,!0)),this.opacityVertexBuffer.itemSize=1),(r||a)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.orientationVertexBuffer&&this.orientationVertexBuffer.destroy())}}aW(fm,"SymbolBuffers");class f_{constructor(e,i,r){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new r,this.segments=new o0,this.collisionVertexArray=new ow,this.collisionVertexArrayExt=new o_}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,dB.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,dV.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}aW(f_,"CollisionBuffers");class fg{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.collisionCircleArray=[],this.placementInvProjMatrix=ee([]),this.placementViewportMatrix=ee([]);const i=this.layers[0]._unevaluatedLayout._values;this.worldview=e.worldview,this.localizable=e.localizable,this.textSizeData=pc(this.zoom,i["text-size"],this.worldview,e.availableImages),this.iconSizeData=pc(this.zoom,i["icon-size"],this.worldview,e.availableImages);const r=this.layers[0].layout,a=r.get("symbol-sort-key"),n=r.get("symbol-z-order");this.lut=e.lut,this.canOverlap=r.get("text-allow-overlap")||r.get("icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==n&&void 0!==a.constantOr(1),this.sortFeaturesByY=("viewport-y"===n||"auto"===n&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=r.get("text-writing-mode").map(e=>d5[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.elevationStateComplete=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.hasAnySecondaryIcon=!1,this.hasAppearances=null,this.lastActiveApperance=null,this.featureToAppearanceIndex={}}hasAnyAppearanceProperty(e){let i=this.layers[0].getAppearances();if(!i||0===i.length)return!1;let r=Array.isArray(e)?e:[e];return i.some(e=>r.some(i=>null!=e.getProperty(i)))}createArrays(){this.text=new fm(new sy(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("text")||e.startsWith("symbol"))),this.icon=new fm(new sy(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("icon")||e.startsWith("symbol"))),this.glyphOffsetArray=new oq,this.lineVertexArray=new oH,this.symbolInstances=new oG}calculateGlyphDependencies(e,i,r,a,n){for(let r of e){let e=r.codePointAt(0);if(void 0===e)break;if(i[e]=!0,a&&n&&e0)&&("constant"!==l.value.kind||l.value.value.length>0),y="constant"!==u.value.kind||!!u.value.value||Object.keys(u.parameters).length>0,x=this.hasAnyAppearanceProperty("icon-image"),v=o.get("symbol-sort-key");if(this.features=[],this.appearanceFeatureData=[],!g&&!y&&!x)return;let b=i.iconDependencies,w=i.glyphDependencies,T=i.availableImages,S=new nC(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),E=e=>{let i=e.id.toString();b.has(i)?b.get(i).push(e):b.set(i,[e])};for(let i of e){let e,h,{feature:u,id:c,index:d,sourceLayerIndex:f}=i,m=n._featureFilter.needGeometry,I=sH(u,m);if(!n._featureFilter.filter(S,I,r))continue;if(m||(I.geometry=sq(u,r,a)),s&&1!==u.type&&r.z.98078528056>eC(lj(e.x,e.y,r,1),lj(i.x,i.y,r,1));for(let r=0;r{var a;let n;a=e.text,"uppercase"===(n=i.layout.get("text-transform").evaluate(r,{}))?a=a.toLocaleUpperCase():"lowercase"===n&&(a=a.toLocaleLowerCase()),nM.applyArabicShaping&&(a=nM.applyArabicShaping(a)),e.text=a}),e}(a,n,I))}if(y){let e=n.getValueAndResolveTokens("icon-image",I,r,T);h=this.getResolvedImageFromTokens(e)}let A=this.layers[0],M=!1;if(!h&&x){for(let e of A.getAppearances())if(e.getProperty("icon-image")){let i=A.getAppearanceValueAndResolveTokens(e,"icon-image",I,r,T);if(i){h=this.getResolvedImageFromTokens(i),M=!0;break}}}if(!e&&!h)continue;let C=this.sortFeaturesByKey?v.evaluate(I,{},r):void 0,P={id:c,text:e,icon:h,index:d,sourceLayerIndex:f,geometry:I.geometry,properties:u.properties,type:fl[u.type],sortKey:C};if(this.features.push(P),this.featureToAppearanceIndex[d]=this.appearanceFeatureData.length,this.appearanceFeatureData.push({id:c,properties:u.properties,usesAppearanceIconAsPlaceholder:M,isUsingAppearanceIconVertexData:!1,isUsingAppearanceTextVertexData:!1,layoutBasedIconVertexData:[],layoutBasedTextVertexData:[],activeAppearance:null}),h){let e=A._unevaluatedLayout._values,{iconPrimary:i,iconSecondary:a}=pG(h,this.iconSizeData,e["icon-size"],r,this.zoom,P,this.pixelRatio,p,this.worldview,T);E(i),a&&(this.hasAnySecondaryIcon=!0,E(a))}let R=A.getAppearances();if(0!==R.length&&R.forEach(e=>{if(!e.getProperty("icon-image"))return;let i=this.getCombinedIconPrimary(e,A,I,r,T,P,p);i&&E(i)}),e){let i=l.evaluate(I,{},r).join(","),a="map"===o.get("text-rotation-alignment")&&"point"!==o.get("symbol-placement");for(let r of(this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(d5.vertical)>=0,e.sections))if(r.image){let e=r.image.getPrimary().scaleSelf(this.pixelRatio*_),i=e.id.toString(),a=b.get(i)||[];a.push(e),b.set(i,a)}else{let n=nm(e.toString()),o=r.fontStack||i,s=w[o]=w[o]||{};this.calculateGlyphDependencies(r.text,s,a,this.allowVerticalPlacement,n)}}}if("line"===o.get("symbol-placement")&&(this.features=function(e){let i={},r={},a=[],n=0;function o(i){a.push(e[i]),n++}function s(e,i,n){let o=r[e];return delete r[e],r[i]=o,a[o].geometry[0].pop(),a[o].geometry[0]=a[o].geometry[0].concat(n[0]),o}function l(e,r,n){let o=i[r];return delete i[r],i[e]=o,a[o].geometry[0].shift(),a[o].geometry[0]=n[0].concat(a[o].geometry[0]),o}function h(e,i,r){let a=r?i[0][i[0].length-1]:i[0][0];return`${e}:${a.x}:${a.y}`}for(let u=0;ue.geometry)}(this.features)),"hd-road-markup"===o.get("symbol-elevation-reference")){if(this.elevationType="road",i.elevationFeatures)for(let e of(!this.elevationFeatures&&i.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map),i.elevationFeatures))this.elevationFeatureIdToIndex.set(e.id,this.elevationFeatures.length),this.elevationFeatures.push(e)}else o.get("symbol-z-elevate")&&(this.elevationType="offset");"none"!==this.elevationType&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((e,i)=>e.sortKey-i.sortKey)}getCombinedIconPrimary(e,i,r,a,n,o,s){let l,h,u=e.getUnevaluatedProperties();if(void 0!==u._values["icon-image"].value){let o=i.getAppearanceValueAndResolveTokens(e,"icon-image",r,a,n);l=this.getResolvedImageFromTokens(o)}else{let e=i.getValueAndResolveTokens("icon-image",r,a,n);l=this.getResolvedImageFromTokens(e)}if(l){let r=e.hasProperty("icon-size")?u._values["icon-size"]:i._unevaluatedLayout._values["icon-size"];h=pG(l,pc(this.zoom,r,this.worldview,n),r,a,this.zoom,o,this.pixelRatio,s,this.worldview,n).iconPrimary}return h}updateSymbolInstanceIconVertices(e,i,r,a,n,o,s,l,h,u,c,d,p,f){if(e.placedIconSymbolIndex0)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}}else if(i.isUsingAppearanceIconVertexData){let e=i.layoutBasedIconVertexData.length/12;for(let r=0;r0||e.numVerticalGlyphVertices>0;if(!x)return{vertexOffsetDelta:x?e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices:0,hasChanges:!1};if(i.activeAppearance===r)return{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!1};if(r&&i.textShaping){let{appearanceTextOffset:x,appearanceTextRotate:v,appearanceTextSize:b}=pN(r,s,a,o,c,p,d);i.fontScale=b*i.textScaleFactor/24;let w=r.getUnevaluatedProperty("text-size"),T=this.textSizeData,S=_,E=g;r.hasProperty("text-size")&&(T=pc(this.zoom,w,this.worldview,y),S="composite"===this.textSizeData.kind?this.textSizeData.minZoom:0,E="composite"===this.textSizeData.kind?this.textSizeData.maxZoom:0);let I=i.textShaping.bottom-c[1],A=i.textShaping.left-c[0],M=i.textShaping.right-c[0];i.textShaping.top=x[1]+(i.textShaping.top-c[1]),i.textShaping.bottom=x[1]+I,i.textShaping.left=x[0]+A,i.textShaping.right=x[0]+M;let C=pR(0,i.textShaping,x,s,!1,a,h,this.allowVerticalPlacement,v),P=b&&"composite"===T.kind?w.possiblyEvaluate(new nC(S,{}),o).evaluate(a,u,o):f,R=b&&"composite"===T.kind?w.possiblyEvaluate(new nC(E,{}),o).evaluate(a,u,o):m,z=pW(r.name,T,b,l,P,R),D=1+(Math.min(32640,Math.round((Array.isArray(z)?z[1]:b)*128))0||c>0,m=d>0,_=this.elevationFeatures[s.elevationFeatureIndex];if(_){let e=new e4(s.tileAnchorX,s.tileAnchorY),u=.075+_.pointElevation(e);s.zOffset!==u&&(i=!0,s.zOffset=u),0!==u&&(this.hasAnyZOffset=!0);let c=_.computeSlopeNormal(e,a),d=eW(eU(),em(0,0,1),c);eL(l,l,d),eL(h,h,d),l[2]*=r,h[2]*=r,1===l[0]&&0===l[1]&&0===l[2]&&0===h[0]&&1===h[1]&&0===h[2]||(n=n||f,o=o||m)}if(f&&(fp(this.text.orientationVertexArray,u,l,h),fp(this.text.orientationVertexArray,c,l,h)),m){let{placedIconSymbolIndex:e,verticalPlacedIconSymbolIndex:i}=s;e>=0&&fp(this.icon.orientationVertexArray,d,l,h),i>=0&&fp(this.icon.orientationVertexArray,p,l,h)}}n||(this.text.orientationVertexArray=void 0),o||(this.icon.orientationVertexArray=void 0),i&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){let e=(e,i,a)=>{(r+=i)>e.length&&e.resize(r);for(let n=-i;n{(a+=i)>e.length&&e.resize(a);for(let n=-i;n0;if((n>0||o>0)&&(e(this.text.zOffsetVertexArray,n,l),e(this.text.zOffsetVertexArray,o,l)),h){let{placedIconSymbolIndex:e,verticalPlacedIconSymbolIndex:r}=a;e>=0&&i(this.icon.zOffsetVertexArray,s,l),r>=0&&i(this.icon.zOffsetVertexArray,a.numVerticalIconVertices,l)}}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,i,r,a,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,i,r,a,n){if(!(e&&i&&r&&this.appearanceFeatureData))return!1;let o=this.icon.layoutVertexArray&&this.icon.layoutVertexArray.length>0&&this.icon.layoutVertexArray.arrayBuffer,s=this.text.layoutVertexArray&&this.text.layoutVertexArray.length>0&&this.text.layoutVertexArray.arrayBuffer;if(!o&&!s)return!1;let l=this.layers[0],h=l.layout,u=1,c=0,d=!1;if(o){let[e,i]=h.get("icon-size-scale-range");u=tr(1,e,i)}let p=1,f=0,m=!1;if(s){let[e,i]=h.get("text-size-scale-range");p=tr(1,e,i)}let _=new Map;if(n&&r)for(let e of r){let i=n.getImage(e,l.scope);if(i){let r=new iN(e.toString());_.set(r.toString(),i)}}for(let n=0;ni.isActive({globals:a,feature:w,canonical:e,featureState:b}));if(s){let i=h.get("text-size"),a=h.get("text-offset").evaluate(w,b,e),n=i.evaluate(w,b,e),o=h.get("text-rotate").evaluate(w,b,e),s="composite"===this.textSizeData.kind?this.textSizeData.minZoom:0,u="composite"===this.textSizeData.kind?this.textSizeData.maxZoom:0,c=i.evaluate(w,{zoom:s},e),d=i.evaluate(w,{zoom:u},e),y=this.updateSymbolInstanceTextVertices(g,x,T,w,f,e,l,p,_,b,a,n,o,c,d,s,u,r);f+=y.vertexOffsetDelta,m=m||y.hasChanges}if(o){let i=h.get("icon-offset").evaluate(w,b,e),n=h.get("icon-size").evaluate(w,b,e,r),o=h.get("icon-rotate").evaluate(w,b,e),s=this.updateSymbolInstanceIconVertices(g,x,T,w,c,e,r,a,l,u,b,i,n,o);c+=s.vertexOffsetDelta,d=d||s.hasChanges}x.activeAppearance=T}return d&&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.text.layoutVertexBuffer&&null!==this.text.layoutVertexArray.arrayBuffer&&this.text.layoutVertexArray.length===this.text.layoutVertexBuffer.length&&this.text.layoutVertexBuffer.updateData(this.text.layoutVertexArray),d||m}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=fs(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,i){let r=this.lineVertexArray.length;if(void 0!==e.segment)for(let{x:e,y:r}of i)this.lineVertexArray.emplaceBack(e,r);return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y){let x=e.indexArray,v=e.layoutVertexArray,b=e.globeExtVertexArray,w=e.segments.prepareSegment(4*y,v,x,this.canOverlap?o.sortKey:void 0),T=this.glyphOffsetArray.length,S=w.vertexLength,E=this.allowVerticalPlacement&&s===d5.vertical?Math.PI/2:0,I=o.text&&o.text.sections;for(let a=0;a=0?i.rightJustifiedTextSymbolIndex:i.centerJustifiedTextSymbolIndex>=0?i.centerJustifiedTextSymbolIndex:i.leftJustifiedTextSymbolIndex>=0?i.leftJustifiedTextSymbolIndex:i.verticalPlacedTextSymbolIndex>=0?i.verticalPlacedTextSymbolIndex:a),o=pd(this.textSizeData,e,n)/24;return this.tilePixelRatio*o}getSymbolInstanceIconSize(e,i,r){let a=this.icon.placedSymbolArray.get(r),n=pd(this.iconSizeData,e,a);return this.tilePixelRatio*n}_commitDebugCollisionVertexUpdate(e,i,r,a){e.emplaceBack(i,-r,-r,a),e.emplaceBack(i,r,-r,a),e.emplaceBack(i,r,r,a),e.emplaceBack(i,-r,r,a)}_updateTextDebugCollisionBoxes(e,i,r,a,n,o,s){for(let s=a;s0}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,i){let r=e.placedSymbolArray.get(i),a=r.vertexStartIndex+4*r.numGlyphs;for(let i=r.vertexStartIndex;ia[e]-a[i]||n[i]-n[e]),o}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let e=0;ethis.symbolInstances.get(i).zOffset-this.symbolInstances.get(e).zOffset)}addToSortKeyRanges(e,i){let r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===i?r.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:i,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{for(let i of(this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[],this.symbolInstanceIndexes)){let e=this.symbolInstances.get(i);this.featureSortOrder.push(e.featureIndex);let{rightJustifiedTextSymbolIndex:r,centerJustifiedTextSymbolIndex:a,leftJustifiedTextSymbolIndex:n,verticalPlacedTextSymbolIndex:o,placedIconSymbolIndex:s,verticalPlacedIconSymbolIndex:l}=e;r>=0&&this.addIndicesForPlacedSymbol(this.text,r),a>=0&&a!==r&&this.addIndicesForPlacedSymbol(this.text,a),n>=0&&n!==a&&n!==r&&this.addIndicesForPlacedSymbol(this.text,n),o>=0&&this.addIndicesForPlacedSymbol(this.text,o),s>=0&&this.addIndicesForPlacedSymbol(this.icon,s),l>=0&&this.addIndicesForPlacedSymbol(this.icon,l)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}getElevationFeatureForText(e){let i,r=this.symbolInstances.get(this.text.symbolInstanceIndices[e]).elevationFeatureIndex;return this.elevationFeatures&&rr in e?String(e[r]):"")}aW(fg,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),fg.addDynamicAttributes=ff;class fx{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:iv,this.defaultValue=e}evaluate(e){if(e.formattedSection){let i=this.defaultValue.property.overrides;if(i&&i.hasOverride(e.formattedSection))return i.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}}aW(fx,"FormatSectionOverride",{omit:["defaultValue"]});let fv=()=>L||(L={layout:z||(z=new nU({"symbol-placement":new nB(nj.layout_symbol["symbol-placement"]),"symbol-spacing":new nB(nj.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new nB(nj.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new nV(nj.layout_symbol["symbol-sort-key"]),"symbol-z-order":new nB(nj.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new nB(nj.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new nB(nj.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new nB(nj.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new nB(nj.layout_symbol["icon-ignore-placement"]),"icon-optional":new nB(nj.layout_symbol["icon-optional"]),"icon-rotation-alignment":new nB(nj.layout_symbol["icon-rotation-alignment"]),"icon-size":new nV(nj.layout_symbol["icon-size"]),"icon-size-scale-range":new nB(nj.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new nV(nj.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new nV(nj.layout_symbol["icon-text-fit-padding"]),"icon-image":new nV(nj.layout_symbol["icon-image"]),"icon-image-use-theme":new nB({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new nV(nj.layout_symbol["icon-rotate"]),"icon-padding":new nB(nj.layout_symbol["icon-padding"]),"icon-keep-upright":new nB(nj.layout_symbol["icon-keep-upright"]),"icon-offset":new nV(nj.layout_symbol["icon-offset"]),"icon-anchor":new nV(nj.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new nB(nj.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new nB(nj.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new nB(nj.layout_symbol["text-rotation-alignment"]),"text-field":new nV(nj.layout_symbol["text-field"]),"text-font":new nV(nj.layout_symbol["text-font"]),"text-size":new nV(nj.layout_symbol["text-size"]),"text-size-scale-range":new nB(nj.layout_symbol["text-size-scale-range"]),"text-max-width":new nV(nj.layout_symbol["text-max-width"]),"text-line-height":new nV(nj.layout_symbol["text-line-height"]),"text-letter-spacing":new nV(nj.layout_symbol["text-letter-spacing"]),"text-justify":new nV(nj.layout_symbol["text-justify"]),"text-radial-offset":new nV(nj.layout_symbol["text-radial-offset"]),"text-variable-anchor":new nB(nj.layout_symbol["text-variable-anchor"]),"text-anchor":new nV(nj.layout_symbol["text-anchor"]),"text-max-angle":new nB(nj.layout_symbol["text-max-angle"]),"text-writing-mode":new nB(nj.layout_symbol["text-writing-mode"]),"text-rotate":new nV(nj.layout_symbol["text-rotate"]),"text-padding":new nB(nj.layout_symbol["text-padding"]),"text-keep-upright":new nB(nj.layout_symbol["text-keep-upright"]),"text-transform":new nV(nj.layout_symbol["text-transform"]),"text-offset":new nV(nj.layout_symbol["text-offset"]),"text-allow-overlap":new nB(nj.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new nB(nj.layout_symbol["text-ignore-placement"]),"text-optional":new nB(nj.layout_symbol["text-optional"]),visibility:new nB(nj.layout_symbol.visibility)})),paint:D||(D=new nU({"icon-opacity":new nV(nj.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new nV(nj.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new nV(nj.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new nV(nj.paint_symbol["text-emissive-strength"]),"icon-color":new nV(nj.paint_symbol["icon-color"]),"icon-halo-color":new nV(nj.paint_symbol["icon-halo-color"]),"icon-halo-width":new nV(nj.paint_symbol["icon-halo-width"]),"icon-halo-blur":new nV(nj.paint_symbol["icon-halo-blur"]),"icon-translate":new nB(nj.paint_symbol["icon-translate"]),"icon-translate-anchor":new nB(nj.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new nB(nj.paint_symbol["icon-image-cross-fade"]),"text-opacity":new nV(nj.paint_symbol["text-opacity"]),"text-occlusion-opacity":new nV(nj.paint_symbol["text-occlusion-opacity"]),"text-color":new nV(nj.paint_symbol["text-color"],{runtimeType:iS,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new nV(nj.paint_symbol["text-halo-color"]),"text-halo-width":new nV(nj.paint_symbol["text-halo-width"]),"text-halo-blur":new nV(nj.paint_symbol["text-halo-blur"]),"text-translate":new nB(nj.paint_symbol["text-translate"]),"text-translate-anchor":new nB(nj.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new nB(nj.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new nB(nj.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new nB(nj.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new nB(nj.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new nV(nj.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new nV({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new nV({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new nV({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new nV({type:"string",default:"default","property-type":"data-driven"})}))});var fb=oe([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function fw(e,i,r,a,n,o,s,l){let h=[e,i,1,r,a,1,n,o,1],u=[s,l,1],[c,d,p]=eD(u,u,Y([],h));return K(h,h,[c,0,0,0,d,0,0,0,p])}function fT(e,i,r,a,n,o,s,l){let h,u,c=(h=fw(0,0,1,0,1,1,0,1),K(u=fw(e,i,r,a,n,o,s,l),u,Y([],h)));return[c[2]/c[8]/8192,c[5]/c[8]/8192]}function fS(e){return[e[0],Math.min(Math.max(e[1],-85.051129),85.051129)]}class fE extends ia{constructor(e,i,r,a){super(),this.id=e,this.dispatcher=r,this.coordinates=i.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(a),this.options=i,this._dirty=!1}load(e,i){(this._loaded=i||!1,this.fire(new ie("dataloading",{dataType:"source"})),this.url=this.options.url,this.url)?this._imageRequest=t0(this.map._requestManager.transformRequest(this.url,tX.Image),(i,r)=>{this._imageRequest=null,this._loaded=!0,i?this.fire(new it(i)):r&&(this.image=r,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,e&&(this.coordinates=e),this._finishLoading())}):(e&&(this.coordinates=e),this._loaded=!0,this._finishLoading())}loaded(){return this._loaded}updateImage(e){return e.url&&(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded)),this}setTexture(e){if(!(e.handle instanceof WebGLTexture))throw Error("The provided handle is not a WebGLTexture instance");return this.texture=new cD(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 ie("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(e){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof cD||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 i=e[0][1],r=e[0][1];for(let a of e)a[1]>r&&(r=a[1]),a[1]85.051129?this.onNorthPole=!0:a1&&(l-=1),new lT(o,l,Math.floor((r+n)/2*s))}(i),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new ie("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof cD||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(e){var i,r,a,n,o,s,l,h,u;let c,d,p,f,m,_,g,y,x,v,b,w;for(let e in this.tiles){let i=this.tiles[e];"loaded"!==i.state&&(i.state="loaded",i.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;let T=pQ(new lT(0,0,0),this.map.transform.projection),S=[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(c=S[1].x-S[0].x,d=S[1].y-S[0].y,p=S[2].x-S[1].x,f=S[2].y-S[1].y,m=S[3].x-S[2].x,_=S[3].y-S[2].y,g=S[0].x-S[3].x,y=S[0].y-S[3].y,x=c*f-p*d,v=p*_-m*f,b=m*y-g*_,w=g*d-c*y,(!(x>0)||!(v>0)||!(b>0)||!(w>0))&&(!(x{let i=E.projection.project(e[0],e[1]);return p0(E,i)._round()});this.perspectiveTransform=fT(I.x,I.y,A.x,A.y,M.x,M.y,C.x,C.y);let P=this._boundsArray=new oa;P.emplaceBack(I.x,I.y,0,0),P.emplaceBack(A.x,A.y,8192,0),P.emplaceBack(C.x,C.y,0,8192),P.emplaceBack(M.x,M.y,8192,8192),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(P,fb.members),this.boundsSegments=o0.simpleSegment(0,0,4,2);let R=[],[z,D,L,F]=function(e){let i=e[0][0],r=i,a=e[0][1],n=a;for(let o=1;or&&(r=e[o][0]),e[o][1]n&&(n=e[o][1]);return[i,a,r-i,n-a]}([fS((i=this.coordinates)[0]),fS(i[1]),fS(i[2]),fS(i[3])]);{let i,c=new oa,[d,p,f,m]=function(e){let i=e[0].x,r=i,a=e[0].y,n=a;for(let o=1;or&&(r=e[o].x),e[o].yn&&(n=e[o].y);return[i,a,r-i,n-a]}(S),_=e=>[(e.x-d)/f,(e.y-p)/m],[g,y,x,v]=S.map(_),b=(r=g[0],a=g[1],n=y[0],o=y[1],s=x[0],l=x[1],h=v[0],u=v[1],K(i=fw(0,0,1,0,1,1,0,1),i,Y([],fw(r,a,n,o,s,l,h,u))));this.elevatedGlobePerspectiveTransform=fT(g[0],g[1],y[0],y[1],x[0],x[1],v[0],v[1]);let w=(e,i)=>{R.push(e.lng);let r=Math.round((e.lng-z)/L*8192),a=Math.round((e.lat-D)/F*8192),n=_(i),o=eD([],[n[0],n[1],1],b),s=Math.round(o[0]/o[2]*8192),l=Math.round(o[1]/o[2]*8192);c.emplaceBack(r,a,s,l)},E=S[3].x-S[0].x,I=S[3].y-S[0].y,A=S[2].x-S[1].x,M=S[2].y-S[1].y;for(let e=0;e{r.emplaceBack(e,a,n);let o=R[e],s=R[a],l=R[n],h=Math.min(Math.min(o,s),l),u=Math.max(Math.max(o,s),l)-h;u>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=u),i.push(h+u/2)};for(let e=0;ei);r.sort((i,r)=>e[i]-e[r]);let a=[],n=new oT;for(let o=0;o{o.segments.push({vertexOffset:0,primitiveOffset:e,vertexLength:r.segments[0].vertexLength,primitiveLength:i,sortKey:void 0,vaos:{}})},l=.51*this.maxLongitudeTriangleSize;if(Math.abs(a[0]-n)0}}class fA extends n4{constructor(e,i,r,a){super(e,{layout:V||(V=new nU({visibility:new nB(nj["layout_raster-particle"].visibility)})),paint:N||(N=new nU({"raster-particle-array-band":new nB(nj["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new nB(nj["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new nN(nj["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new nB(nj["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new nB(nj["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new nB(nj["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new nB(nj["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new nB(nj["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new nV({type:"string",default:"default","property-type":"data-driven"})}))},i,r,a),this._updateColorRamp(),this.lastInvalidatedAt=tz.now()}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this.tileFramebuffer&&(this.tileFramebuffer.destroy(),this.tileFramebuffer=null),this.particleFramebuffer&&(this.particleFramebuffer.destroy(),this.particleFramebuffer=null)}onRemove(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;let e=this._transitionablePaint._values["raster-particle-color"].value.expression,i=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=ha({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:i}],resolution:256}),this.colorRampTexture=null}_invalidateAnimationState(){this.lastInvalidatedAt=tz.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class fM extends n4{constructor(e,i){super(e,{},i,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 fC(e,i,r){let a=[0,0,1],n=ej([]);return eq(n,n,r?-(e*e8)+Math.PI:e*e8),eG(n,n,-(i*e8)),eL(a,a,n),eM(a,a)}let fP={None:0,Model:1,Symbol:2,FillExtrusion:4};class fR{constructor(e,i,r,a){this.message=(e?`${e}: `:"")+r,a&&(this.identifier=a),null!=i&&i.__line__&&(this.line=i.__line__)}}function fz(e,i){let r=-1===e.indexOf("://");try{return new URL(e,r&&i?"http://example.com":void 0),!0}catch(e){return!1}}class fD{constructor(e,i){this.feature=e,this.instancedDataOffset=i,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class fL{constructor(){this.maxScale=1,this.maxXYTranslationDistance=0,this.instancedDataArray=new oL,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}colorForInstance(e){let i=16*e,r=this.instancedDataArray.float32,a=Math.floor(r[i+2]),n=1.05*(r[i+2]-a);return a/=100,[r[i]%1*1.05,r[i+1]%1*1.05,n,a]}tileCoordinatesForInstance(e){let i=16*e,r=this.instancedDataArray.float32,a=r[i+0];return new e4(Math.trunc(a=a>8192?a-8192:a),Math.trunc(r[i+1]))}translationForInstance(e){let i=16*e,r=this.instancedDataArray.float32;return[r[i+4],r[i+5],r[i+6]]}rotationScaleForInstance(e){let i=16*e,r=this.instancedDataArray.float32;return[r[i+7],r[i+8],r[i+9],r[i+10],r[i+11],r[i+12],r[i+13],r[i+14],r[i+15]]}transformForInstance(e){let i=16*e,r=this.instancedDataArray.float32;return[r[i+7],r[i+8],r[i+9],r[i+4],r[i+10],r[i+11],r[i+12],r[i+5],r[i+13],r[i+14],r[i+15],r[i+6],0,0,0,1]}}class fF{constructor(e){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,i){}updateAppearances(e,i,r,a){}populate(e,i,r,a){this.tileToMeter=sN(r);let n=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);let o="hd-road-markup"===this.layers[0].paint.get("model-elevation-reference")?i.elevationFeatures:void 0;for(let{feature:s,id:l,index:h,sourceLayerIndex:u}of e){let e=null!=l?l:s.properties&&s.properties.hasOwnProperty("id")?s.properties.id:void 0,c=sH(s,n);if(!this.layers[0]._featureFilter.filter(new nC(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),c,r))continue;let d={id:e,sourceLayerIndex:u,index:h,geometry:n?c.geometry:sq(s,r,a),properties:s.properties,type:s.type,patterns:{}},p=this.addFeature(d,d.geometry,c,o,r);p&&i.featureIndex.insert(s,d.geometry,h,u,this.index,this.instancesPerModel[p].instancedDataArray.length,256)}this.lookup=null}evaluateQueryRenderedFeaturePadding(){let e=this.layers[0].modelManager,i=this.layers[0].scope,r=0;for(let a of this.modelUris){let n=e.getModel(a,i);if(!n)continue;let o=this.instancesPerModel[a];o&&(r=Math.max(Math.min(8192,Math.max((.5*eS(n.aabb.max,n.aabb.min)*o.maxScale+o.maxXYTranslationDistance)/this.tileToMeter,256)),r))}return r}update(e,i,r,a){for(let i in this.instancesPerModel){let r=this.instancesPerModel[i];for(let i in e)r.idToFeaturesIndex.hasOwnProperty(i)&&(this.evaluate(r.features[r.idToFeaturesIndex[i]],e[i],r,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(let i in this.instancesPerModel){let r=this.instancesPerModel[i];for(let i of r.features){let a=this.layers[0],n=i.feature,o=this.canonical,s=a.paint.get("model-rotation").evaluate(n,{},o),l=a.paint.get("model-scale").evaluate(n,{},o),h=a.paint.get("model-translation").evaluate(n,{},o);eO(i.rotation,s)&&eO(i.scale,l)&&eO(i.translation,h)||(this.evaluate(i,i.featureStates,r,!0),e=!0)}}return e}updateReplacement(e,i,r,a){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;let n=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);if(uv(this.activeReplacements,n))return!1;this.activeReplacements=n;let o=!1;for(let i in this.instancesPerModel){let n=this.instancesPerModel[i],s=n.instancedDataArray;for(let i of n.features){let n=i.instancedDataOffset,l=i.instancedDataCount;for(let i=0;i8192,c=Math.floor(h=u?h-8192:h),d=Math.floor(s.float32[l+1]),p=!1;for(let i of this.activeReplacements)if(!u_(i,r,fP.Model,a)&&!(i.min.x>c||c>i.max.x||i.min.y>d||d>i.max.y)&&(p=uS(uT(c,d,e.canonical,i.footprintTileId.canonical),i.footprint)))break;s.float32[l]=p?h+8192:h,o=o||p!==u}}}return o}isEmpty(){for(let 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(let i in this.instancesPerModel){let r=this.instancesPerModel[i];r.instancedDataArray.length=8192||e.y=8192)continue;if(0!==this.lookupDim&&h){let i=(this.lookupDim-1)/8192,r=this.lookupDim*(e.y*i|0)+e.x*i|0;if(this.lookup){if(0!==this.lookup[r])continue;this.lookup[r]=1}}this.instanceCount++;let i=d.length;if(d.resize(i+1),a){c.instancesRoadElevation||(c.instancesRoadElevation=[]);let i=o?o.pointElevation(new e4(e.x,e.y)):0;c.instancesRoadElevation.push(i)}c.instancesEvaluatedElevation.push(0),d.float32[16*i]=e.x,d.float32[16*i+1]=e.y}return p.instancedDataCount=c.instancedDataArray.length-p.instancedDataOffset,p.instancedDataCount>0&&(e.id&&(c.idToFeaturesIndex[e.id]=c.features.length),c.features.push(p),this.evaluate(p,{},c,!1)),u}getModelUris(){return this.modelUris}evaluate(e,i,r,a){let n=this.layers[0],o=e.feature,s=this.canonical,l=e.rotation=n.paint.get("model-rotation").evaluate(o,i,s),h=e.scale=n.paint.get("model-scale").evaluate(o,i,s),u=e.translation=n.paint.get("model-translation").evaluate(o,i,s),c=Object.assign({},n.paint.get("model-color").evaluate(o,i,s));c.a=n.paint.get("model-color-mix-intensity").evaluate(o,i,s);let d=[];this.maxVerticalOffset0?Math.sqrt(p):0;r.maxScale=Math.max(Math.max(r.maxScale,h[0]),Math.max(h[1],h[2])),r.maxXYTranslationDistance=Math.max(r.maxXYTranslationDistance,f),this.maxScale=Math.max(Math.max(this.maxScale,h[0]),Math.max(h[1],h[2])),cZ(d,l,h);let m=Math.round(100*c.a)+c.b/1.05;for(let i=0;i10?this.tileToMeter:sN(s,p)),l[o+4]=u[0],l[o+5]=u[1],l[o+6]=u[2]+(r.instancesRoadElevation?r.instancesRoadElevation[n]:0)+h,l[o+7]=d[0],l[o+8]=d[1],l[o+9]=d[2],l[o+10]=d[4],l[o+11]=d[5],l[o+12]=d[6],l[o+13]=d[8],l[o+14]=d[9],l[o+15]=d[10],r.instancesEvaluatedElevation[n]=u[2]}}}aW(fF,"ModelBucket",{omit:["layers"]}),aW(fL,"PerModelAttributes"),aW(fD,"ModelFeature");class fO{constructor(e,i,r){this._demTile=e,this._dem=this._demTile.dem,this._scale=i,this._offset=r}static create(e,i,r){let a=r||e.findDEMTileFor(i);if(!a||!a.dem)return;let n=a.dem,o=a.tileID,s=1e.fqid),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.modelTraits|=cK.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,a&&(this.modelTraits|=cK.HasMapboxMeshFeatures),n&&(this.modelTraits|=cK.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=o,this.worldview=l,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[],i))this.nodesInfo.push(new fN(h)),function e(i,r,a){if(i.meshes)for(let e of i.meshes){if(e.aabb.min[0]===1/0)continue;let n=lt.applyTransform(e.aabb,i.globalMatrix);a.insert(r,n.min[0],n.min[1],n.max[0],n.max[1])}if(i.children)for(let n of i.children)e(n,r,a)}(h,s.featureIndexArray.length,s.grid),s.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,s.bucketLayerIDs.length-1,0);this.states={},this.hasAppearances=null}updateFootprints(e,i){for(let r of this.getNodesInfo()){let a=r.node;a.footprint&&i.push({footprint:a.footprint,id:e})}}updateAppearances(e,i,r,a){}update(e){let i=0!==Object.keys(e).length;if(i&&!this.stateDependentLayers.length)return;let r=i?this.stateDependentLayers:this.layers;if(!e6(e,this.states))for(let i of r)this.evaluate(i,e);this.states=structuredClone(e)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(e){if(!this.needsUpload)return;let i=this.getNodesInfo();for(let r of i){let i=r.node;this.uploaded?this.updatePbrBuffer(i):c1(i,e,!0)}for(let e of i)c2(e.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let i=!1;if(!e.meshes)return i;for(let r of e.meshes)r.pbrBuffer&&(r.pbrBuffer.updateData(r.featureArray),i=!0);return i}needsReEvaluation(e,i,r){let a=e.transform.projectionOptions,n=e.style.getBrightness(),o=this.brightness!==n;if(!this.uploaded||this.dirty||a.name!==this.projection.name||fj(r.paint.get("model-color").value,o)||fj(r.paint.get("model-color-mix-intensity").value,o)||fj(r.paint.get("model-roughness").value,o)||fj(r.paint.get("model-emissive-strength").value,o)||fj(r.paint.get("model-height-based-emissive-strength-multiplier").value,o)){for(let e of(this.projection=a,this.brightness=n,this.getNodesInfo()))e.state=null;return!0}return!1}evaluateTransform(e,i){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;let r=this.getNodesInfo(),a=this.id.canonical;for(let e of r){let r=e.feature;e.evaluatedTranslation=i.paint.get("model-translation").evaluate(r,{},a),e.evaluatedScale=i.paint.get("model-scale").evaluate(r,{},a)}}evaluate(e,i){for(let r of this.getNodesInfo()){if(!r.node.meshes)continue;let a=r.feature,n=i&&i[a.id];if(e6(n,r.state))continue;r.state=structuredClone(n);let o=r.node.meshes&&r.node.meshes[0].featureData,s=r.evaluatedColor[2],l=r.evaluatedRMEA[2],h=this.id.canonical;if(r.hasTranslucentParts=!1,o){for(let i=0;i>16&65535,h=o?i>>16&65535:65535&i,u=(15&h)>4)>>8,f=(3840&i|(3840&i)>>4)>>4,m=240&i|(240&i)>>4;r[3]>0&&(p=im(p,255*r[0],r[3]),f=im(f,255*r[1],r[3]),m=im(m,255*r[2],r[3]));let _=p=e)continue;let d=fk[u],p=Math.abs(d);p>l&&(s=d,l=p,h=n,c=i)}if(l>.1){let o=1-(e+.5*Math.abs(h*c))/u,l=i._dem.get(a,r)+s*o,d=i._dem.get(a+h,r+c),p=i._dem.get(a-h,r-c,!0);(l-d)*(l-p)>0&&(l=(d+p)/2),fk[n]=i._dem.set(a,r,l),fB[n]=e}}}}}s&&(i._demTile.needsDEMTextureUpload=!0,i._dem._timestamp=tz.now())}setFilter(e){this.filter=e?n$(e):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(e=>this.filter.filter(new nC(this.id.overscaledZ,{worldview:this.worldview}),e.feature,this.id.canonical)):this.nodesInfo}destroy(){for(let e of this.getNodesInfo())c2(e.node),c3(e.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;let r=i.getReplacementRegionsForTile(e.toUnwrapped());for(let e of this.getNodesInfo()){let i=e.node.footprint;e.hiddenByReplacement=!!i&&!r.find(e=>e.footprint===i)}}getHeightAtTileCoord(e,i){let r=[],a=[0,0,0],n=ee([]);for(let o of this.getNodesInfo()){let s=o.node.meshes[0],l=s.transformedAabb;if(el.max[0]||i>l.max[1])continue;if(!0===o.node.hidden)return{height:1/0,maxHeight:o.feature.properties.height,hidden:!1,verticalScale:o.evaluatedScale[2]};et(n,o.node.globalMatrix),a[0]=e,a[1]=i,ez(a,a,n);let h=(a[0]-s.aabb.min[0])/(s.aabb.max[0]-s.aabb.min[0])*64|0,u=64*Math.min(63,(a[1]-s.aabb.min[1])/(s.aabb.max[1]-s.aabb.min[1])*64|0)+Math.min(63,h),c=s.heightmap[u];if(!(c0)return{height:void 0,maxHeight:o.feature.properties.height,hidden:o.hiddenByReplacement,verticalScale:o.evaluatedScale[2]}}}}function fj(e,i){return e instanceof aN&&!e.isLightConstant&&i}aW(fU,"Tiled3dModelBucket",{omit:["layers"]}),aW(fN,"Tiled3dModelFeature");let fG=["id","tile","layer","source","sourceLayer","state"];class fq{constructor(e,i,r,a,n){this.type="Feature",this._vectorTileFeature=e,this._z=i,this._x=r,this._y=a,this.properties=e?e.properties:{},this.id=n}clone(){let e=new fq(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(e.state=Object.assign({},this.state)),this.layer&&(e.layer=Object.assign({},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(){let e={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(let i of fG)void 0!==this[i]&&(e[i]=this[i]);return e}}class fH extends ia{constructor(e,i,r,a){super(),this.id=e,this.type="model",this.models=[],this._options=i,this._modelsInfo=new Map,this._abortController=null}cancelModelRequests(){this._abortController&&(this._abortController.abort(),this._abortController=null)}loadGLTFFromURI(e,i){return cC(this.map._requestManager.transformRequest(e,tX.Model).url,i)}async loadModel(e,i,r){try{let a=await this.loadGLTFFromURI(i.uri,r);if(r.aborted)return;let n=this._modelsInfo.get(e);if(!n)return;let o=c6(a),s=n.modelSpec,l=new cQ(e,s.uri,s.position,s.orientation,o);fH.applyModelSpecification(l,s),l.computeBoundsAndApplyParent(),this.models.push(l),n.model=l}catch(a){if(a instanceof Error&&"AbortError"===a.name)return;let r=a instanceof Error?a.message:"Unknown error";this.fire(new it(Error(`Could not load model ${e} from ${i.uri}: ${r}`)))}}async load(){this._abortController||(this._abortController=new AbortController);let e=this._abortController.signal,i=[];for(let r in this._options.models){let a=this._options.models[r],n=this._modelsInfo.get(r);if(n&&n.model){n.modelSpec=a;let e=n.model;e.position=null!=a.position?new sC(a.position[0],a.position[1]):new sC(0,0),e.orientation=null!=a.orientation?a.orientation:[0,0,0],fH.applyModelSpecification(e,a),e.computeBoundsAndApplyParent(),this.models.push(e)}else n?n.modelSpec=a:(this._modelsInfo.set(r,{modelSpec:a,model:null}),i.push(this.loadModel(r,a,e)))}0!==i.length?(await Promise.allSettled(i),e.aborted||this.fire(new ie("data",{dataType:"source",sourceDataType:"metadata"}))):this.loaded()&&this.fire(new ie("data",{dataType:"source",sourceDataType:"metadata"}))}static applyModelSpecification(e,i){i.nodeOverrides&&fH.convertNodeOverrides(e,i.nodeOverrides),i.materialOverrides&&fH.convertMaterialOverrides(e,i.materialOverrides),i.nodeOverrideNames&&(e.nodeOverrideNames=[...i.nodeOverrideNames]),i.materialOverrideNames&&(e.materialOverrideNames=[...i.materialOverrideNames]),i.featureProperties&&(e.featureProperties=i.featureProperties)}static convertNodeOverrides(e,i){if(Array.isArray(i)&&i.every(e=>"string"==typeof e))for(let r of(e.nodeOverrideNames=[],i))e.nodeOverrideNames.push(r);else Object.entries(i).forEach(([i,r])=>{let a={orientation:[0,0,0]};if(r.hasOwnProperty("orientation")){let e=r.orientation;e&&(a.orientation=e)}e.nodeOverrides.set(i,a)})}static convertMaterialOverrides(e,i){if(Array.isArray(i)&&i.every(e=>"string"==typeof e))for(let r of(e.materialOverrideNames=[],i))e.materialOverrideNames.push(r);else Object.entries(i).forEach(([i,r])=>{let a={color:new iu(1,1,1),colorMix:0,emissionStrength:0,opacity:1},n=r["model-color"];void 0!==n&&(a.color.r=n[0],a.color.g=n[1],a.color.b=n[2]);let o=r["model-color-mix-intensity"];void 0!==o&&(a.colorMix=o);let s=r["model-emissive-strength"];void 0!==s&&(a.emissionStrength=s);let l=r["model-opacity"];void 0!==l&&(a.opacity=l),e.materialOverrides.set(i,a)})}onAdd(e){this.map=e,this.load()}hasTransition(){return!1}loaded(){if(0===this._modelsInfo.size)return!0;for(let e of this._modelsInfo.values())if(null==e.model)return!1;return!0}getModels(){return this.models}loadTile(e,i){}serialize(){return this._options}setProperty(e,i){return!1}reload(){this.cancelModelRequests();let e=n0(this.id,this.scope);this.map.style.clearSource(e),this.models=[],this._modelsInfo.clear(),this.load()}onRemove(e){this.cancelModelRequests()}setModels(e){this.models=[];let i=new Map;for(let r in e){let a=e[r],n=this._modelsInfo.get(r);n&&n.modelSpec.uri===a.uri&&i.set(r,n)}if(this._modelsInfo.size!==i.size)for(let[e,r]of(this.cancelModelRequests(),i))r.model||i.delete(e);this._modelsInfo=i,this._options.models=e,this.load()}}function f$(e,i,r,a){let n=1e.polygon).flat());let[g,y]=u4(o,a,d,c,u,s,f?l:null,p,m,o.center.lat,e.tileID.canonical),x=e.queryGeometry;return u5(g,y,x.isPointQuery()?x.screenBounds:x.screenGeometry)}},building:class extends n4{constructor(e,i,r,a){super(e,{layout:I||(I=new nU({visibility:new nB(nj.layout_building.visibility),"building-facade":new nV(nj.layout_building["building-facade"]),"building-facade-floors":new nV(nj.layout_building["building-facade-floors"]),"building-facade-unit-width":new nV(nj.layout_building["building-facade-unit-width"]),"building-facade-window":new nV(nj.layout_building["building-facade-window"]),"building-roof-shape":new nV(nj.layout_building["building-roof-shape"]),"building-height":new nV(nj.layout_building["building-height"]),"building-base":new nV(nj.layout_building["building-base"]),"building-flood-light-wall-radius":new nV(nj.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new nV(nj.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new nV(nj.layout_building["building-flip-roof-orientation"])})),paint:A||(A=new nU({"building-opacity":new nB(nj.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new nB(nj.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new nB(nj.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new nB(nj.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new nB(nj.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new nB(nj.paint_building["building-vertical-scale"]),"building-cast-shadows":new nB(nj.paint_building["building-cast-shadows"]),"building-color":new nV(nj.paint_building["building-color"]),"building-emissive-strength":new nV(nj.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new nB(nj.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new nB(nj.paint_building["building-cutoff-fade-range"]),"building-flood-light-color":new nB(nj.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new nB(nj.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new nB(nj.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new nV({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new nV({type:"string",default:"default","property-type":"data-driven"})}))},i,r,a),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(e){return new dc(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,i,r,a,n,o,s,l,h,u){let c=this.layout.get("building-height").evaluate(i,r),d=this.layout.get("building-base").evaluate(i,r),p=e.tile.getBucket(this).getFootprint(i);if(p){if(0!==p.hiddenFlags)return!1;c=p.height}let[f,m]=u4(o,a,d,c,new e4(0,0),s,null,[0,0],1,o.center.lat,e.tileID.canonical),_=e.queryGeometry;return u5(f,m,_.isPointQuery()?_.screenBounds:_.screenGeometry)}},line:class extends n4{constructor(e,i,r,a){const n=dP();super(e,n,i,r,a),n.layout&&(this.layout=new nk(n.layout)),this.gradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1}_handleSpecialPaintPropertyUpdate(e){if("line-gradient"===e){let e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof rK,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}emissiveStrengthExpression(){return this._transitionablePaint._values["line-emissive-strength"].value.expression}recalculate(e,i){super.recalculate(e,i),this.paint._values["line-floorwidth"]=(R||((R=new dR(dP().paint.properties["line-width"].specification)).useIntegerZoom=!0),R).possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new dw(e)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(e,i,r){let a=dM(this);return{config:new sg(this,{zoom:i,lut:r}),defines:a,overrideFog:!1}}queryRadius(e){var i,r;return i=lx("line-width",this,e),((r=lx("line-gap-width",this,e))>0?r+2*i:i)/2+Math.abs(lx("line-offset",this,e))+lv(this.paint.get("line-translate"))}queryIntersectsFeature(e,i,r,a,n,o){var s,l;if(e.queryGeometry.isAboveHorizon)return!1;let h=lb(e.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),u=e.pixelToTileUnitsFactor/2*(s=this.paint.get("line-width").evaluate(i,r),(l=this.paint.get("line-gap-width").evaluate(i,r))>0?l+2*s:s),c=this.paint.get("line-offset").evaluate(i,r);return c&&(a=function(e,i){let r=[],a=new e4(0,0);for(let n=0;n=3){for(let i=0;i1){if(lh(e,i))return!0;for(let a=0;a{r.recalculate(e,i,this.iconImageUseTheme)}),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));let r=this.layout.get("text-writing-mode");if(r){let e=[];for(let i of r)0>e.indexOf(i)&&e.push(i);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,i,r,a){var n,o;let s,l,h,u,c;return this._saturation===e&&this._contrast===i&&this._brightnessMin===r&&this._brightnessMax===a||(this._colorAdjustmentMatrix=(n=e,o=i,n=tI(n),o=tE(o),s=J(),h=1-2*(l=n/3),u=.5-.5*o,ei(s,[c=a-r,0,0,0,0,c,0,0,0,0,c,0,r,r,r,1],[o,0,0,0,0,o,0,0,0,0,o,0,u,u,u,1]),ei(s,s,[h,l,l,0,l,h,l,0,l,l,h,0,0,0,0,1]),s),this._saturation=e,this._contrast=i,this._brightnessMin=r,this._brightnessMax=a),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,i,r,a){let n=this.layout.get(e).evaluate(i,{},r,a),o=this._unevaluatedLayout._values[e];return o.isDataDriven()||aB(o.value)||!n?n:fy(i.properties,n)}getAppearanceValueAndResolveTokens(e,i,r,a,n){let o=e.getProperty(i);if(!o)return;let s=o.evaluate(r,{},a,n),l=e.getUnevaluatedProperties()._values[i];return l.isDataDriven()||aB(l.value)||!s||"string"!=typeof s?s:fy(r.properties,s)}createBucket(e){return new fg(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(let i of fv().paint.overridableProperties){if(!e.hasPaintOverride(this.layout,i))continue;let r=this.paint.get(i),a=new ak(new fx(r),r.property.specification,this.scope,this.options,this.layout.get("icon-image-use-theme")),n=null;n="constant"===r.value.kind||"source"===r.value.kind?new aN("source",a):new aU("composite",a,r.value.zoomStops,r.value.interpolationType),this.paint._values[i]=new nO(r.property,n,r.parameters)}}_handleOverridablePaintPropertyUpdate(i,r,a){return!(!this.layout||r.isDataDriven()||a.isDataDriven())&&e.hasPaintOverride(this.layout,i)}static hasPaintOverride(e,i){let r=e.get("text-field"),a=fv().paint.properties[i],n=!1,o=e=>{for(let i of e)if(a.overrides&&a.overrides.hasOverride(i))return void(n=!0)};if("constant"===r.value.kind&&r.value.value instanceof iV)o(r.value.value.sections);else if("source"===r.value.kind){let e=i=>{n||(i instanceof i$&&iq(i.value)===iM?o(i.value.sections):i instanceof iY?o(i.sections):i.eachChild(e))},i=r.value;i._styleExpression&&e(i._styleExpression.expression)}return n}getProgramIds(){return["symbol"]}getDefaultProgramParams(e,i,r){return{config:new sg(this,{zoom:i,lut:r}),overrideFog:!1}}hasElevation(){return this.layout&&"hd-road-markup"===this.layout.get("symbol-elevation-reference")}},background:class extends n4{constructor(e,i,r,a){super(e,{layout:F||(F=new nU({visibility:new nB(nj.layout_background.visibility)})),paint:O||(O=new nU({"background-pitch-alignment":new nB(nj.paint_background["background-pitch-alignment"]),"background-color":new nB(nj.paint_background["background-color"]),"background-pattern":new nB(nj.paint_background["background-pattern"]),"background-opacity":new nB(nj.paint_background["background-opacity"]),"background-emissive-strength":new nB(nj.paint_background["background-emissive-strength"]),"background-color-use-theme":new nV({type:"string",default:"default","property-type":"data-driven"})}))},i,r,a)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(e,i,r){return{overrideFog:!1}}is3D(e){return"viewport"===this.paint.get("background-pitch-alignment")}},raster:fI,"raster-particle":fA,sky:class extends n4{constructor(e,i,r,a){super(e,{layout:U||(U=new nU({visibility:new nB(nj.layout_sky.visibility)})),paint:j||(j=new nU({"sky-type":new nB(nj.paint_sky["sky-type"]),"sky-atmosphere-sun":new nB(nj.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new nB(nj.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new nB(nj.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new nB(nj.paint_sky["sky-gradient-radius"]),"sky-gradient":new nN(nj.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new nB(nj.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new nB(nj.paint_sky["sky-atmosphere-color"]),"sky-opacity":new nB(nj.paint_sky["sky-opacity"]),"sky-gradient-use-theme":new nV({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new nV({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new nV({type:"string",default:"default","property-type":"data-driven"})}))},i,r,a),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=ha({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")){let i=e.style.light.properties.get("position");return this._lightPosition.azimuthal!==i.azimuthal||this._lightPosition.polar!==i.polar}return!1}getCenter(e,i){if("atmosphere"===this.paint.get("sky-type")){let r=this.paint.get("sky-atmosphere-sun"),a=!r,n=e.style.light,o=n.properties.get("position");return a&&"viewport"===n.properties.get("anchor")&&t_("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),a?fC(o.azimuthal,90-o.polar,i):fC(r[0],90-r[1],i)}let r=this.paint.get("sky-gradient-center");return fC(r[0],90-r[1],i)}isSky(){return!0}markSkyboxValid(e){this._skyboxInvalidated=!1,this._lightPosition=e.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){let e=this.paint.get("sky-type");return"atmosphere"===e?["skyboxCapture","skybox"]:"gradient"===e?["skyboxGradient"]:null}},slot:class extends n4{constructor(e,i,r,a){super(e,{paint:G||(G=new nU({}))},i,null)}},model:class extends n4{constructor(e,i,r,a){super(e,{layout:q||(q=new nU({visibility:new nB(nj.layout_model.visibility),"model-id":new nV(nj.layout_model["model-id"]),"model-allow-density-reduction":new nB(nj.layout_model["model-allow-density-reduction"])})),paint:H||(H=new nU({"model-opacity":new nV(nj.paint_model["model-opacity"]),"model-rotation":new nV(nj.paint_model["model-rotation"]),"model-scale":new nV(nj.paint_model["model-scale"]),"model-translation":new nV(nj.paint_model["model-translation"]),"model-color":new nV(nj.paint_model["model-color"]),"model-color-mix-intensity":new nV(nj.paint_model["model-color-mix-intensity"]),"model-type":new nB(nj.paint_model["model-type"]),"model-cast-shadows":new nB(nj.paint_model["model-cast-shadows"]),"model-receive-shadows":new nB(nj.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new nB(nj.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new nV(nj.paint_model["model-emissive-strength"]),"model-roughness":new nV(nj.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new nV(nj.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new nB(nj.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new nB(nj.paint_model["model-front-cutoff"]),"model-elevation-reference":new nB(nj.paint_model["model-elevation-reference"]),"model-color-use-theme":new nV({type:"string",default:"default","property-type":"data-driven"})}))},i,r,a),this.layer=e,this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(e){return new fF(e)}getProgramIds(){return["model"]}is3D(e){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(e){return 8191*(e instanceof fU)}queryRenderedFeatures(e,i,r){let a=i.getSource();if(!(a&&a instanceof fH))return{};let n={};n[this.id]=[];let o=n[this.id],s=0;for(let n of a.models){let a=i.getFeatureState(this.sourceLayer,n.id),l={type:"Unknown",id:n.id,properties:n.featureProperties},h=this.paint.get("model-rotation").evaluate(l,a),u=this.paint.get("model-scale").evaluate(l,a),c=this.paint.get("model-translation").evaluate(l,a),d=this.paint.get("model-elevation-reference"),p=[];cJ(p,n,r,n.position,h,u,c,"ground"===d,"ground"===d,!1),"globe"===r.projection.name&&(p=cX(p,r));let f=ei([],r.projMatrix,p),m=cY(e.isPointQuery()?e.screenBounds:e.screenGeometry,r,f,n.aabb);if(null!=m){let e=new fq(void 0,0,0,0,n.id);e.layer=this.layer,e.properties=structuredClone(n.featureProperties),e.properties.layer=this.id,e.properties.uri=n.uri,e.properties.orientation=n.orientation,e.sourceLayer=this.sourceLayer,e.geometry={type:"Point",coordinates:[n.position.lng,n.position.lat]},e.state=a,e.source=this.source,o.push({featureIndex:s,feature:e,intersectionZ:m})}++s}return n}queryIntersectsFeature(e,i,r,a,n,o,s,l,h,u){if(!this.modelManager)return!1;let c=this.modelManager,d=e.tile.getBucket(this);if(!(d&&d instanceof fF))return!1;for(let r in d.instancesPerModel){let a=d.instancesPerModel[r],n=void 0!==i.id?i.id:i.properties&&i.properties.hasOwnProperty("id")?i.properties.id:void 0;if(a.idToFeaturesIndex.hasOwnProperty(n)){let i=a.features[a.idToFeaturesIndex[n]],s=c.getModel(r,u||this.scope);if(!s)return!1;let l=[],h=new sC(0,0),p=d.canonical,f=Number.MAX_VALUE;for(let r=0;r>16&255)/255,(e>>8&255)/255,(255&e)/255,1)}function mt(e,i,r){1===e?(i.rgb_color=me(r.readVarint()),i.paint="rgb_color"):2===e?(i.linear_gradient_idx=r.readVarint(),i.paint="linear_gradient_idx"):3===e?(i.radial_gradient_idx=r.readVarint(),i.paint="radial_gradient_idx"):5===e?r.readPackedFloat(i.dasharray):6===e?i.dashoffset=r.readFloat():7===e?i.miterlimit=r.readFloat():8===e?i.opacity=r.readVarint():9===e?i.width=r.readFloat():10===e?i.linecap=r.readVarint():11===e&&(i.linejoin=r.readVarint())}function mi(e,i,r){1===e?i.transform=f6(r,r.readVarint()+r.pos):2===e?i.spread_method=r.readVarint():3===e?i.stops.push(mr(r,r.readVarint()+r.pos)):4===e?i.x1=r.readFloat():5===e?i.y1=r.readFloat():6===e?i.x2=r.readFloat():7===e&&(i.y2=r.readFloat())}function mr(e,i){return e.readFields(ma,{offset:0,opacity:255,rgb_color:fW},i)}function ma(e,i,r){1===e?i.offset=r.readFloat():2===e?i.opacity=r.readVarint():3===e&&(i.rgb_color=me(r.readVarint()))}function mn(e,i,r){1===e?i.transform=f6(r,r.readVarint()+r.pos):2===e?i.spread_method=r.readVarint():3===e?i.stops.push(mr(r,r.readVarint()+r.pos)):4===e?i.cx=r.readFloat():5===e?i.cy=r.readFloat():6===e?i.r=r.readFloat():7===e?i.fx=r.readFloat():8===e?i.fy=r.readFloat():9===e&&(i.fr=r.readFloat())}function mo(e,i,r){1===e?i.transform=f6(r,r.readVarint()+r.pos):2===e?i.clip_path_idx=r.readVarint():3===e&&i.children.push(f3(r,r.readVarint()+r.pos))}function ms(e,i,r){1===e?i.left=i.top=r.readFloat():2===e?i.width=i.height=r.readFloat():3===e?i.top=r.readFloat():4===e?i.height=r.readFloat():5===e?i.mask_type=r.readVarint():6===e?i.mask_idx=r.readVarint():7===e&&i.children.push(f3(r,r.readVarint()+r.pos))}class ml{static calculate(e={},i=[]){let r=new Map,a=new Map;if(0===Object.keys(e).length)return r;for(let[n,o]of(i.forEach(e=>{a.set(e.name,e.rgb_color||new iu(0,0,0))}),Object.entries(e)))a.has(n)?r.set(a.get(n).toString(),o):console.warn(`Ignoring unknown image variable "${n}"`);return r}}function mh(e,i=255,r){let a=e.toString(),n=r.has(a)?r.get(a).clone():e.clone();return n.a*=i/255,n.toString()}function mu(e,i){if(!tR()){let r=document.createElement("canvas");return r.width=e,r.height=i,r}return new OffscreenCanvas(e,i)}let mc,md=null;function mp(e,i,r,a,n){for(let o of a.children)(function e(i,r,a,n,o){var s;n.group?(i.save(),function(i,r,a,n,o){var s,l;let h=null!=n.mask_idx?a.masks[n.mask_idx]:null,u=null!=n.clip_path_idx?a.clip_paths[n.clip_path_idx]:null;if(n.transform&&(r=mx(n.transform).preMultiplySelf(r)),s=null!=u,l=null!=h,255===n.opacity&&!s&&!l)return mp(i,r,a,n,o);let c=mu(i.canvas.width,i.canvas.height),d=c.getContext("2d");mp(d,r,a,n,o),u&&function e(i,r,a,n){let o=mu(i.canvas.width,i.canvas.height);(function i(r,a,n,o){let s=o.transform?mx(o.transform).preMultiplySelf(a):a,l=mu(r.canvas.width,r.canvas.height),h=l.getContext("2d");for(let e of o.children)if(e.group)i(h,s,n,e.group);else if(e.path){let i=e.path,r=new Path2D;r.addPath(mb(i),s),h.fill(r,mm(i))}let u=null!=o.clip_path_idx?n.clip_paths[o.clip_path_idx]:null;u&&e(h,s,n,u),r.globalCompositeOperation="source-over",r.drawImage(l,0,0)})(o.getContext("2d"),r,a,n),i.globalCompositeOperation="destination-in",i.drawImage(o,0,0)}(d,r,a,u),h&&function i(r,a,n,o,s){if(0===o.children.length)return;let l=null!=o.mask_idx?n.masks[o.mask_idx]:null;l&&i(r,a,n,l,s);let h=r.canvas.width,u=r.canvas.height,c=mu(h,u),d=c.getContext("2d"),p=o.width,f=o.height,m=o.left,_=o.top,g=new Path2D,y=new Path2D;for(let i of(y.rect(m,_,p,f),g.addPath(y,a),d.clip(g),o.children))e(d,a,n,i,s);let x=d.getImageData(0,0,h,u),v=x.data;if(1===o.mask_type)for(let e=0;eMath.abs(a[s])){if(r[s]i[s])return null}else{let l=1/a[s],h=(e[s]-r[s])*l,u=(i[s]-r[s])*l;if(h>u){let e=h;h=u,u=e}if(h>n&&(n=h),uo)return null}return n}function mI(e,i,r,a,n,o,s,l,h,u,c){let d=a-e,p=n-i,f=o-r,m=s-e,_=l-i,g=h-r,y=c[1]*g-c[2]*_,x=c[2]*m-c[0]*g,v=c[0]*_-c[1]*m,b=d*y+p*x+f*v;if(1e-15>Math.abs(b))return null;let w=1/b,T=u[0]-e,S=u[1]-i,E=u[2]-r,I=(T*y+S*x+E*v)*w;if(I1)return null;let A=S*f-E*p,M=E*d-T*f,C=T*p-S*d,P=(c[0]*A+c[1]*M+c[2]*C)*w;return P1?null:(m*A+_*M+g*C)*w}function mA(e,i,r,a,n,o,s,l,h){let u=1{let o=+!!a;n[0]=e*r,n[1]=i*r,n[2]=(e+1)*r-o,n[3]=(i+1)*r-o},s=new mS(a),l=[];for(let i=0;i=1;a/=2){let e=r[r.length-1];s=new mS(a);for(let i=0;i0;){let{idx:l,t:y,nodex:x,nodey:v,depth:b}=p.pop();if(this.leaves[l]){mA(x,v,b,e,i,r,a,c,d);let l=1=e[2])return y}continue}let w=0;for(let p=0;p=h[u[i]]&&(u.splice(i,0,p),e=!0);e||(u[w]=p),w++}}for(let e=0;e=this.dim+1||i=this.dim+1)throw RangeError("out of range source coordinates for DEM data");return(i+1)*this.stride+(e+1)}static pack(e,i){let r=[0,0,0,0],a=mL.getUnpackVector(i),n=Math.floor((e+a[3])/a[2]);return r[2]=n%256,n=Math.floor(n/256),r[1]=n%256,n=Math.floor(n/256),r[0]=n,r}getPixels(){return new hr({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,i,r){if(this.dim!==e.dim)throw Error("dem dimension mismatch");let a=i*this.dim,n=i*this.dim+this.dim,o=r*this.dim,s=r*this.dim+this.dim;switch(i){case -1:a=n-1;break;case 1:n=a+1}switch(r){case -1:o=s-1;break;case 1:s=o+1}let l=-i*this.dim,h=-r*this.dim;for(let i=o;i>1|(21845&m1)>2|(13107&m2)>4|(3855&m2)>8|(255&m2)>1}var m3=function(e,i,r){for(var a=e.length,n=0,o=new mq(i);n>h]=u;return s},m5=new mG(288);for(m1=0;m1i&&(i=e[r]);return i},m7=function(e,i,r){var a=i/8|0;return(e[a]|e[a+1]>(7&i)&r},_e=function(e,i){var r=i/8|0;return(e[r]|e[r+1]>(7&i)},_t=["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"],_i=function(e,i,r){var a=Error(i||_t[e]);if(a.code=e,Error.captureStackTrace&&Error.captureStackTrace(a,_i),!r)throw a;return a},_r=new mG(0),_a="u">typeof TextDecoder&&new TextDecoder;try{_a.decode(_r,{stream:!0})}catch(e){}let _n={gzip_data:"gzip"};class _o extends Error{constructor(e){super(e),this.name="MRTError"}}let _s={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},_l={uint32:1,uint16:2,uint8:4},_h={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};class _u{constructor(e=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=e}getLayer(e){let i=this.layers[e];if(!i)throw new _o(`Layer '${e}' not found`);return i}getHeaderLength(e){let i=new Uint8Array(e),r=new DataView(e);if(13!==i[0])throw new _o("File is not a valid MRT.");return r.getUint32(1,!0)}parseHeader(e){let i=new Uint8Array(e),r=this.getHeaderLength(e);if(i.length= ${r} but got buffer of length ${i.length}`);let a=new $(i.subarray(0,r)).readFields(mF,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0);if(!isNaN(this.x)&&(this.x!==a.x||this.y!==a.y||this.z!==a.z))throw new _o(`Invalid attempt to parse header ${a.z}/${a.x}/${a.y} for tile ${this.z}/${this.x}/${this.y}`);for(let e of(this.x=a.x,this.y=a.y,this.z=a.z,a.layers))this.layers[e.name]=new _c(e,{cacheSize:this._cacheSize});return this}createDecodingTask(e){let i=[],r=this.getLayer(e.layerName);for(let a of e.blockIndices){let n=r.dataIndex[a],o=n.firstByte-e.firstByte,s=n.lastByte-e.firstByte;if(r._blocksInProgress.has(a))continue;let l={layerName:r.name,firstByte:o,lastByte:s,pixelFormat:r.pixelFormat,blockIndex:a,blockShape:[n.bands.length].concat(r.bandShape),buffer:r.buffer,codec:n.codec.codec,filters:n.filters.map(e=>e.filter)};r._blocksInProgress.add(a),i.push(l)}return new _d(i,()=>{i.forEach(e=>r._blocksInProgress.delete(e.blockIndex))},(e,a)=>{if(i.forEach(e=>r._blocksInProgress.delete(e.blockIndex)),e)throw e;a.forEach(e=>{this.getLayer(e.layerName).processDecodedData(e)})})}}class _c{constructor({version:e,name:i,units:r,tileSize:a,pixelFormat:n,buffer:o,dataIndex:s},l){if(this.version=e,1!==this.version)throw new _o(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=i,this.units=r,this.tileSize=a,this.buffer=o,this.pixelFormat=_s[n],this.dataIndex=s,this.bandShape=[a+2*o,a+2*o,_l[this.pixelFormat]],this._decodedBlocks=new mw(l?l.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return _l[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:e})=>e).flat()}processDecodedData(e){let i=e.blockIndex.toString();this._decodedBlocks.get(i)||this._decodedBlocks.put(i,e.data)}getBlockForBand(e){let i=0;switch(typeof e){case"string":for(let[r,a]of this.dataIndex.entries()){for(let[n,o]of a.bands.entries())if(o===e)return{bandIndex:i+n,blockIndex:r,blockBandIndex:n};i+=a.bands.length}break;case"number":for(let[r,a]of this.dataIndex.entries()){if(e>=i&&ethis.cacheSize)throw new _o(`Number of blocks to decode (${n.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:i,lastByte:r,blockIndices:a}}hasBand(e){let{blockIndex:i}=this.getBlockForBand(e);return i>=0}hasDataForBand(e){let{blockIndex:i}=this.getBlockForBand(e);return i>=0&&!!this._decodedBlocks.get(i.toString())}getBandView(e){let{blockIndex:i,blockBandIndex:r}=this.getBlockForBand(e);if(ie*i,1),s=r*o,l=a.subarray(s,s+o);return{data:l,bytes:new Uint8Array(l.buffer).subarray(l.byteOffset,l.byteOffset+l.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:n.offset,scale:n.scale}}}_u.setPbf=function(e){$=e};class _d{constructor(e,i,r){this.tasks=e,this._onCancel=i,this._onComplete=r,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,i){this._finalized||(this._onComplete(e,i),this._finalized=!0)}}_u.performDecoding=function(e,i){let r=new Uint8Array(e);return Promise.all(i.tasks.map(e=>{let{layerName:i,firstByte:a,lastByte:n,pixelFormat:o,blockShape:s,blockIndex:l,filters:h,codec:u}=e,c=r.subarray(a,n+1),d=new Uint32Array(s[0]*s[1]*s[2]);if("gzip_data"!==u)throw new _o(`Unhandled codec: ${u}`);return(function(e,i){var r,a,n;if(!globalThis.DecompressionStream&&"gzip_data"===i)return Promise.resolve(((n=function(e){31==e[0]&&139==e[1]&&8==e[2]||_i(6,"invalid gzip data");var i=e[3],r=10;4&i&&(r+=2+(e[10]|e[11]>3&1)+(i>>4&1);a>0;a-=!e[r++]);return r+(2&i)}(e))+8>e.length&&_i(6,"invalid gzip data"),function(e,i,r,a){var n,o,s=e.length;if(!s||i.f&&!i.l)return r||new mG(0);var l=!r,h=l||2!=i.i,u=i.i;l&&(r=new mG(3*s));var c=function(e){var i=r.length;if(e>i){var a=new mG(Math.max(2*i,e));a.set(r),r=a}},d=i.f||0,p=i.p||0,f=i.b||0,m=i.l,_=i.d,g=i.m,y=i.n,x=8*s;do{if(!m){d=m7(e,p,1);var v=m7(e,p+1,3);if(p+=3,!v){var b=e[(z=((p+7)/8|0)+4)-4]|e[z-3]s){u&&_i(0);break}h&&c(f+b),r.set(e.subarray(z,w),f),i.b=f+=b,i.p=p=8*w,i.f=d;continue}if(1==v)m=m6,_=m8,g=9,y=5;else if(2==v){var T=m7(e,p,31)+257,S=m7(e,p+10,15)+4,E=T+m7(e,p+5,31)+1;p+=14;for(var I=new mG(E),A=new mG(19),M=0;M>4)x){u&&_i(0);break}}h&&c(f+131072);for(var B=(1>4;if((p+=15&L)>x){u&&_i(0);break}if(L||_i(2),U264&&(j=m7(e,p,(1>4;if(G||_i(3),p+=15&G,k=mQ[q],q>3){var H=mZ[q];k+=_e(e,p)&(1x){u&&_i(0);break}h&&c(f+131072);var $=f+j;if(fn.length)&&(o=n.length),new mG(n.subarray(0,o))):r.subarray(0,f)}(e.subarray(n,-8),{i:2},new mG((e[(a=e.length)-4]|e[a-3]>>0),r)));let o=_n[i];if(!o)throw Error(`Unhandled codec: ${i}`);let s=new globalThis.DecompressionStream(o);return new Response(new Blob([e]).stream().pipeThrough(s)).arrayBuffer().then(e=>new Uint8Array(e))})(c,u).then(e=>{var i;return i=new $(e),i.readFields(mU,d),new(0,_h[o])(d.buffer)}).then(e=>{for(let i=h.length-1;i>=0;i--)switch(h[i]){case"delta_filter":!function(e,i){if(4!==i.length)throw Error(`Expected data of dimension 4 but got ${i.length}.`);let r=i[3];for(let a=2;a>=1;a--){let n=+(1===a),o=+(2===a);for(let a=0;a>>1^-(1&r[e]);break;case"bitshuffle_filter":!function(e,i){switch(i){case"uint32":return;case"uint16":for(let i=0;i>4|(61440&r)>>8|(240&a)>4|(15&a)>6|(192&a)>>4|(192&n)>>2|192&o,e[i+1]=(48&r)>>4|(48&a)>>2|48&n|(48&o)>2|12&a|(12&n){throw e})}))},aW(_d,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),aW(_u,"MapboxRasterTile"),aW(_c,"MapboxRasterLayer",{omit:["_blocksInProgress"]});class _p{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i=0&&a[3]>=0&&h.insert(l,a[0],a[1],a[2],a[3])}}loadVTLayers(){if(!this.vtLayers)for(let e in this.vtLayers=new sY(new dq(this.rawTileData)).layers,this.sourceLayerCoder=new _p(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={},this.vtLayers)this.vtFeatures[e]=[];return this.vtLayers}query(e,i){let r,{tilespaceGeometry:a,transform:n,tileTransform:o,pixelPosMatrix:s,availableImages:l,worldview:h}=i;this.loadVTLayers(),this.serializedLayersCache.clear();let u=i.queryRadius?i.queryRadius:0,c=a.bufferedTilespaceBounds,d=this.grid.query(c.min.x,c.min.y,c.max.x,c.max.y,(e,i,r,n)=>lm(a.bufferedTilespaceGeometry,e-u,i-u,r+u,n+u));d.sort(__);let p=null;n.elevation&&d.length>0&&(p=fO.create(n.elevation,this.tileID));let f={};for(let u=0;u(_||(_=sq(e,this.tileID.canonical,o)),r.queryIntersectsFeature(a,e,l,_,this.z,n,s,p,h,i.scope)))}return f}loadMatchingFeature(e,i,r,a,n,o){let{featureIndex:s,bucketIndex:l,sourceLayerIndex:h,layoutVertexArrayOffset:u}=i,c=this.bucketLayerIDs[l],d=r.layers,p=Object.keys(d);if(p.length&&!tf(p,c))return;let f=r.sourceCache,m=this.sourceLayerCoder.decode(h),_=this.vtLayers[m].feature(s),g=this.getId(_,m);for(let i=0;i`${e.key}: ${e.message}`).join(", ");return void t_(`Failed to create expression for promoteId: ${i}`)}this.promoteIdExpression=e.value}r=this.promoteIdExpression.evaluate({zoom:0},e)}else r=e.properties[a];"boolean"==typeof r&&(r=Number(r))}return r}}function _m(e,i,r,a,n){return tc(e,(e,o)=>{let s=i instanceof nk?i.get(o):null;return s&&s.evaluate?s.evaluate(r,a,void 0,n):s})}function __(e,i){return i-e}aW(_f,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});let _g=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];function _y(e,i,r,a){_x(e,r,a),_x(i,2*r,2*a),_x(i,2*r+1,2*a+1)}function _x(e,i,r){let a=e[i];e[i]=e[r],e[r]=a}function _v(e,i,r,a){let n=e-r,o=i-a;return n*n+o*o}e.$=i2,e.A=iN,e.B=n0,e.C=2,e.D=cr,e.E=ia,e.F=px,e.G=py,e.H=iQ,e.I=io,e.J=nG,e.K=iJ,e.L=i1,e.M=aC,e.N=aI,e.O=aM,e.P=e4,e.Q=aB,e.R=tX,e.S=nq,e.T=cz,e.U=aV,e.V=fR,e.W=aj,e.X=rG,e.Y=rU,e.Z=rj,e._=i8,e.a=function(e){return tM.API_CDN_URL_REGEX.test(e)},e.a$=sF,e.a0=i0,e.a1=ih,e.a2=nH,e.a3=class extends fR{},e.a4=aP,e.a5=aA,e.a6=nj,e.a7=function(e){let i=e.value;return i?i0(i)?fz(i,!0)?[]:[new fR(e.key,i,`invalid url "${i}"`)]:[new fR(e.key,i,`string expected, "${iJ(i)}" found`)]:[]},e.a8=nz,e.a9=nU,e.aA=tr,e.aB=ei,e.aC=eN,e.aD=sT,e.aE=lf,e.aF=sz,e.aG=sj,e.aH=function(e,i){let r={};for(let a=0;a{a(e,r)},i):a(e,r),()=>{}}return n.callbacks.push(a),n.cancel||(n.cancel=r((r,a)=>{for(let e of(n.result=[r,a],n.callbacks))this.scheduler?this.scheduler.add(()=>{e(r,a)},i):e(r,a);setTimeout(()=>delete this.entries[e],3e3)})),()=>{n.result||(n.callbacks=n.callbacks.filter(e=>e!==a),n.callbacks.length||(n.cancel(),delete this.entries[e]))}}},e.aL=function(e,i,r){let a=JSON.stringify(e.request);return e.data&&(this.deduped.entries[a]={result:[null,e.data]}),this.deduped.request(a,{type:"parseTile",isSymbolTile:e.isSymbolTile,zoom:e.tileZoom},i=>{let a=tQ(e.request,(e,a,n)=>{e?i(e):a&&i(null,{rawData:a,vectorTile:r?void 0:new sY(new dq(a)),responseHeaders:new Map(n.entries())})});return()=>{a.cancel(),i()}},i)},e.aM=function(e){return e?{cacheControl:e.get("cache-control"),expires:e.get("expires")}:{cacheControl:void 0,expires:void 0}},e.aN=tY,e.aO=function(e){++tU>tk&&(e.getActor().send("enforceCacheSizeLimit",tO),tU=0)},e.aP=function(e){return e{}}},e.aW=cD,e.aX=fH,e.aY=tu,e.aZ=pQ,e.a_=sL,e.aa=nB,e.ab=class{constructor(e){this.specification=e}possiblyEvaluate(e,i){return ty(e.expression.evaluate(i))}interpolate(e,i,r){return{x:im(e.x,i.x,r),y:im(e.y,i.y,r),z:im(e.z,i.z,r),azimuthal:im(e.azimuthal,i.azimuthal,r),polar:im(e.polar,i.polar,r)}}},e.ac=nC,e.ad=aU,e.ae=sU,e.af=ez,e.ag=ef,e.ah=ta,e.ai=nk,e.aj=lY,e.ak=im,e.al=8192,e.am=i_,e.an=function(e){return e*e8},e.ao=iu,e.ap=class{constructor(e){this.specification=e}possiblyEvaluate(e,i){return function([e,i]){let r=ty([1,e,i]);return{x:r.x,y:r.y,z:r.z}}(e.expression.evaluate(i))}interpolate(e,i,r){return{x:im(e.x,i.x,r),y:im(e.y,i.y,r),z:im(e.z,i.z,r)}}},e.aq=function(e,i,r=0,a=!0){let n=new e4(r,r),o=e.sub(n),s=i.add(n),l=[o,new e4(s.x,o.y),s,new e4(o.x,s.y)];return a&&l.push(o.clone()),l},e.ar=function(e,i){let r=[];for(let a=0;a1)return!1;let r=i.getSource().maxzoom,a=11)return i;let n=a.getSource().maxzoom,o=1{let l=this.getAtTileOffset(e,n,o,s),h=a.upVector(e.canonical,n.x,n.y);return ew(h,h,l*a.upVectorScale(e.canonical,i,r).metersToTile),h}}getForTilePoints(e,i,r,a){if(this.isUsingMockSource())return!1;let n=fO.create(this,e,a);return!!n&&(i.forEach(e=>{e[2]=this.exaggeration()*n.getElevationAt(e[0],e[1],r)}),!0)}getMinMaxForTile(e){if(this.isUsingMockSource())return null;let i=this.findDEMTileFor(e);if(!i||!i.dem)return null;let r=i.dem.tree,a=i.tileID,n=10&&(a+=(e[r]-0)*(e[r]-0)),i[r]>4;if(1!==n)throw Error(`Got v${n} data when expected v1.`);let o=_g[15&a];if(!o)throw Error("Unrecognized array type.");let[s]=new Uint16Array(i,2,1),[l]=new Uint32Array(i,4,1);return new e(l,s,o,i)}constructor(e,i=64,r=Float64Array,a){if(isNaN(e)||e>1;return this.ids[r]=r,this.coords[this._pos++]=e,this.coords[this._pos++]=i,r}finish(){let e=this._pos>>1;if(e!==this.numItems)throw Error(`Added ${e} items when expected ${this.numItems}.`);return function e(i,r,a,n,o,s){if(o-n>1;(function e(i,r,a,n,o,s){for(;o>n;){if(o-n>600){let l=o-n+1,h=a-n+1,u=Math.log(l),c=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*c*(l-c)/l)*(h-l/2l&&_y(i,r,n,o);hl;)u--}r[2*n+s]===l?_y(i,r,n,u):_y(i,r,++u,o),u=e&&l=i&&u>1,f=o[2*p],m=o[2*p+1];f>=e&&f=i&&m=f:a>=m)&&(l.push(p+1),l.push(c),l.push(1-u))}return h}within(e,i,r){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:a,coords:n,nodeSize:o}=this,s=[0,a.length-1,0],l=[],h=r*r;for(;s.length;){let u=s.pop()||0,c=s.pop()||0,d=s.pop()||0;if(c-d>1,f=n[2*p],m=n[2*p+1];_v(f,m,e,i)=f:i+r>=m)&&(s.push(p+1),s.push(c),s.push(1-u))}return l}},e.c5=ew,e.c6=ef,e.c7=ej,e.c8=function(e,i,r){r*=.5;var a=i[0],n=i[1],o=i[2],s=i[3],l=Math.sin(r),h=Math.cos(r);return e[0]=a*h+n*l,e[1]=n*h-a*l,e[2]=o*h+s*l,e[3]=s*h-o*l,e},e.c9=eG,e.cA=ed,e.cB=class e{constructor(e,i){for(const r of(this.points=e||Array(8).fill([0,0,0]),this.planes=i||Array(6).fill([0,0,0,0]),this.bounds=lt.fromPoints(this.points),this.projections=[],this.frustumEdges=[ey([],this.points[2],this.points[3]),ey([],this.points[0],this.points[3]),ey([],this.points[4],this.points[0]),ey([],this.points[5],this.points[1]),ey([],this.points[6],this.points[2]),ey([],this.points[7],this.points[3])],this.frustumEdges)){const e=[0,-r[2],r[1]],i=[r[2],0,-r[0]];this.projections.push({axis:e,projection:s8(this.points,this.points[0],e)}),this.projections.push({axis:i,projection:s8(this.points,this.points[0],i)})}}static fromInvProjectionMatrix(i,r,a,n){let o=Math.pow(2,a),s=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(e=>{var a;let s=eN([],e,i),l=1/s[3]/r*o;return s[0]=s[0]*(a=[l,l,n?1/s[3]:l,l])[0],s[1]=s[1]*a[1],s[2]=s[2]*a[2],s[3]=s[3]*a[3],s}),l=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(e=>{let i=eM([],eP([],ey([],s[e[0]],s[e[1]]),ey([],s[e[2]],s[e[1]]))),r=-eC(i,s[e[1]]);return i.concat(r)}),h=[];for(let e=0;es[1]||s[0]>o[1])return 0}return 1}containsPoint(e){for(let i of this.planes){let r=i[3];if(eC([i[0],i[1],i[2]],e)+r0&&r[0]0&&r[1]0&&a[0]0&&a[1]0?Math.acos(r/a)*e9:0,o=0!==e||0!==i?Math.atan2(-i,-e)*e9+90:0;return o0;return 0===a&&!n&&!o},e.dG=function(e){let i=e.pixelsPerMeter,r=i/(1/sR(e.center.lat)),a=ee(new Float64Array(16));return er(a,a,[e.point.x,e.point.y,0]),ea(a,a,[r,r,i]),Float32Array.from(a)},e.dH=lN,e.dI=function(e){return Math.round(Math.pow(Math.abs(Math.sin((e=tr(e,-80.051129,80.051129)/80.051129*90)*e8)),3)*(sS.length-1))},e.dJ=function(e,i,r,a){let n=i.getNorth(),o=i.getSouth(),s=i.getWest(),l=i.getEast(),h=10){let e=180/a;K(f,f,[e/u+1,0,0,0,e/c+1,0,-.5*e/d,.5*e/p,1])}return f[2]=h,f[5]=e.x,f[8]=e.y,f},e.dK=lO,e.dL=function(e,i,r){let a=ee(new Float64Array(16)),n=(i/(1({u_matrix:new so(e),u_texsize:new st(e),u_pixels_to_tile_units:new sh(e),u_device_pixel_ratio:new se(e),u_width_scale:new se(e),u_floor_width_scale:new se(e),u_image:new o7(e),u_units_to_pixels:new st(e),u_tile_units_to_pixels:new se(e),u_alpha_discard_threshold:new se(e),u_trim_offset:new st(e),u_trim_fade_range:new st(e),u_trim_gradient_mix_range:new st(e),u_trim_color:new sr(e),u_zbias_factor:new se(e),u_tile_to_meter:new se(e),u_ground_shadow_factor:new si(e),u_pattern_transition:new se(e)}),e.dY=e=>({u_matrix:new so(e),u_pixels_to_tile_units:new sh(e),u_device_pixel_ratio:new se(e),u_width_scale:new se(e),u_floor_width_scale:new se(e),u_units_to_pixels:new st(e),u_dash_image:new o7(e),u_gradient_image:new o7(e),u_image_height:new se(e),u_texsize:new st(e),u_tile_units_to_pixels:new se(e),u_alpha_discard_threshold:new se(e),u_trim_offset:new st(e),u_trim_fade_range:new st(e),u_trim_gradient_mix_range:new st(e),u_trim_color:new sr(e),u_zbias_factor:new se(e),u_tile_to_meter:new se(e),u_ground_shadow_factor:new si(e)}),e.dZ=e=>({u_camera_to_center_distance:new se(e),u_extrude_scale:new sh(e),u_device_pixel_ratio:new se(e),u_matrix:new so(e),u_inv_rot_matrix:new so(e),u_merc_center:new st(e),u_tile_id:new si(e),u_zoom_transition:new se(e),u_up_dir:new si(e),u_emissive_strength:new se(e)}),e.d_=ob,e.da=ey,e.db=function(e){return[Math.pow(e[0],1/2.2),Math.pow(e[1],1/2.2),Math.pow(e[2],1/2.2)]},e.dc=cC,e.dd=c6,e.de=cQ,e.df=fz,e.dg=function(e,i){return e.readFields(fX,{icons:[]},i)},e.dh=ll,e.di=class{static calculate(e,i,r){let a=new Set,n=new Map,o=new Set,s=new Set;for(let r of Object.values(e))for(let[e,l]of Object.entries(r.floors)){o.add(e),l.isDefault&&s.add(e),l.conflicts&&n.set(e,l.conflicts);let r=e===i,h=l.connections&&i&&l.connections.has(i);(r||h)&&a.add(e)}let l=e=>{let i=n.get(e)||new Set;for(let r of a)if((n.get(r)||new Set).has(e)||i.has(r))return!0;return!1};if(r)for(let e of r)o.has(e)&&(l(e)||a.add(e));for(let e of s)a.has(e)||l(e)||a.add(e);return a}},e.dj=ca,e.dk=pE,e.dl=pS,e.dm=tK,e.dn=nT,e.dp=tL,e.dq=t7,e.dr=tp,e.ds=function(e){let i=e.indexOf("\x1f");return i>=0?e.slice(0,i):e},e.dt=function(e){return e.indexOf("\x1f")>=0},e.du=function(e){let i=e.lastIndexOf("\x1f");return i>=0?e.slice(i+1):""},e.dv=function(e){let i=[],r=e.id;return void 0===r&&i.push({message:`layers.${r}: missing required property "id"`}),void 0===e.render&&i.push({message:`layers.${r}: missing required method "render"`}),e.renderingMode&&"2d"!==e.renderingMode&&"3d"!==e.renderingMode&&i.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),i},e.dw=function(e,i,r,a){return"custom"===e.type?new fM(e,i):new fZ[e.type](e,i,r,a)},e.dx=td,e.dy=function(e){let i=e.indexOf("\x1f");return i>=0?e.slice(i+1):""},e.dz=class extends fq{constructor(e,i){super(e._vectorTileFeature,e._z,e._x,e._y,e.id),e.state&&(this.state=Object.assign({},e.state)),this.target=i.target,this.namespace=i.namespace,i.properties&&(this.properties=i.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(){let e=super.toJSON();return e.target=this.target,e.namespace=this.namespace,e}},e.e=tM,e.e$=sA,e.e0=class{constructor(e,i,r,a){this.context=e,this.format=a,this.size=r,this.texture=e.gl.createTexture();const[n,o,s]=this.size,{gl:l}=e;l.bindTexture(l.TEXTURE_3D,this.texture),e.pixelStoreUnpackFlipY.set(!1),e.pixelStoreUnpack.set(1),e.pixelStoreUnpackPremultiplyAlpha.set(!1),"data"in i&&i.data&&l.texImage3D(l.TEXTURE_3D,0,this.format,n,o,s,0,cP(this.format),cR(this.format),i.data)}bind(e,i){let{context:r}=this,{gl:a}=r;a.bindTexture(a.TEXTURE_3D,this.texture),e!==this.minFilter&&(a.texParameteri(a.TEXTURE_3D,a.TEXTURE_MAG_FILTER,e),a.texParameteri(a.TEXTURE_3D,a.TEXTURE_MIN_FILTER,e),this.minFilter=e),i!==this.wrapS&&(a.texParameteri(a.TEXTURE_3D,a.TEXTURE_WRAP_S,i),a.texParameteri(a.TEXTURE_3D,a.TEXTURE_WRAP_T,i),this.wrapS=i)}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}},e.e1=l3,e.e2=(e,i,r,a,n,o)=>{let s,l=e.transform,h="globe"===l.projection.name;if("map"===o.paint.get("circle-pitch-alignment"))if(h){let e=lW(l.zoom,i.canonical)*l._pixelsPerMercatorPixel;s=Float32Array.from([e,0,0,e])}else s=l.calculatePixelsToTileUnitsMatrix(r);else s=new Float32Array([l.pixelsToGLUnits[0],0,0,l.pixelsToGLUnits[1]]);let u={u_camera_to_center_distance:e.transform.getCameraToCenterDistance(l.projection),u_matrix:e.translatePosMatrix(i.projMatrix,r,o.paint.get("circle-translate"),o.paint.get("circle-translate-anchor")),u_device_pixel_ratio:tz.devicePixelRatio,u_extrude_scale:s,u_inv_rot_matrix:l2,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(h){u.u_inv_rot_matrix=a,u.u_merc_center=n,u.u_tile_id=[i.canonical.x,i.canonical.y,1{let c=e.transform,d=c.pitch{let c=e.transform,d=c.calculatePixelsToTileUnitsMatrix(i),p="none"===r.paint.get("line-trim-color-use-theme").constantOr("default"),f=c.pitch0?(g=2*Math.sqrt(_+1),e[3]=.25*g,e[0]=(d-f)/g,e[1]=(p-h)/g,e[2]=(l-u)/g):s>c&&s>m?(g=2*Math.sqrt(1+s-c-m),e[3]=(d-f)/g,e[0]=.25*g,e[1]=(l+u)/g,e[2]=(p+h)/g):c>m?(g=2*Math.sqrt(1+c-s-m),e[3]=(p-h)/g,e[0]=(l+u)/g,e[1]=.25*g,e[2]=(d+f)/g):(g=2*Math.sqrt(1+m-s-c),e[3]=(l-u)/g,e[0]=(p+h)/g,e[1]=(d+f)/g,e[2]=.25*g),e},e.eC=function(e,i){var r=2*Math.acos(i[3]),a=Math.sin(r/2);return a>1e-6?(e[0]=i[0]/a,e[1]=i[1]/a,e[2]=i[2]/a):(e[0]=1,e[1]=0,e[2]=0),r},e.eD=f$,e.eE=cJ,e.eF=cX,e.eG=[1,1,1],e.eH=fO,e.eI=ek,e.eJ=function(e,i,r,a){var n=i[0],o=i[1],s=i[2],l=i[3];return e[0]=n+a*(r[0]-n),e[1]=o+a*(r[1]-o),e[2]=s+a*(r[2]-s),e[3]=l+a*(r[3]-l),e},e.eK=cK,e.eL=oy,e.eM=oR,e.eN=function(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_){var g=new Z(16);return g[0]=e,g[1]=i,g[2]=r,g[3]=a,g[4]=n,g[5]=o,g[6]=s,g[7]=l,g[8]=h,g[9]=u,g[10]=c,g[11]=d,g[12]=p,g[13]=f,g[14]=m,g[15]=_,g},e.eO=6371008.8,e.eP=oP,e.eQ=oC,e.eR=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new e4(1/0,1/0),max:new e4(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(e,i=!1){let r=ub(new e4(0,0),new e4(8192,8192),e),a=[];if(i&&!ux(r,this._globalClipBounds))return a;for(let i of this._activeRegions){if(i.hiddenByOverlap||!ux(r,i))continue;let n=function(e,i,r){let a=1({getSourceId:()=>e.cache.id,getFootprints:()=>{let i=[];for(let r of e.cache.getVisibleCoordinates()){let a=e.cache.getTile(r).buckets[e.layer];a&&a.updateFootprints(r.toUnwrapped(),i)}return i},getOrder:()=>e.order,getClipMask:()=>e.clipMask,getClipScope:()=>e.clipScope})))}_addSource(e){let i=e.getFootprints();if(0===i.length)return;let r=e.getOrder(),a=e.getClipMask(),n=e.getClipScope();for(let e of i){if(!e.footprint)continue;let i=ub(e.footprint.min,e.footprint.max,e.id);this._activeRegions.push({min:i.min,max:i.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:e.id,footprint:e.footprint,order:r,clipMask:a,clipScope:n})}this._sourceIds.push(e.getSourceId())}_computeReplacement(){this._activeRegions.sort((e,i)=>{var r,a;let n;return e.priority-i.priority||ug(e.min,i.min)||ug(e.max,i.max)||e.order-i.order||e.clipMask-i.clipMask||(r=e.clipScope,a=i.clipScope,n=(e,i)=>e+i,r.length-a.length||r.reduce(n,"").localeCompare(a.reduce(n,"")))});let e=this._activeRegions.length!==this._prevRegions.length;if(!e){let i=0;for(;!e&&i!==this._activeRegions.length;){let r=this._activeRegions[i],a=this._prevRegions[i];e=r.priority!==a.priority||!uy(r,a)||r.order!==a.order||r.clipMask!==a.clipMask||!e6(r.clipScope,a.clipScope),this._activeRegions[i].hiddenByOverlap=a.hiddenByOverlap,++i}}if(e){for(let e of(++this._updateTime,this._activeRegions))e.order!==uf&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,e.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,e.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,e.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,e.max.y));let e=e=>{let i=this._activeRegions;if(e>=i.length)return e;let r=i[e].priority;for(;e1){let i=0,r=e(0);for(;i!==r;){let a=i,n=i;for(;a!==r;){let e=this._activeRegions[a];e.hiddenByOverlap=!1;for(let i=0;inew e4((e.x+8192*s.x)*h-8192*l.x,(e.y+8192*s.y)*h-8192*l.y))}return uw(a,o,i.indices,0,i.indices.length,0,0)}(e.footprint,e.tileId,r.footprint,r.tileId),e.hiddenByOverlap))break}++a}r=e(i=r)}}}}_setSources(e){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let i=e.length-1;i>=0;i--)this._addSource(e[i]);this._computeReplacement()}},e.eS=uf,e.eT=class{constructor(e){this._createGrid(e),this._createPoles(e)}destroy(){for(let e of(this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy(),this._poleSegments))e.destroy();for(let e of this._gridSegments)e.withSkirts.destroy(),e.withoutSkirts.destroy()}_fillGridMeshWithLods(e,i){let r=new oi,a=new oT,n=[],o=e+1+2,s=i[0]+1,l=i[0]+1+(1+i.length),h=(e,i,r)=>{let a=e===o-1?e-2:0===e?e:e-1;return[a+=24575*!!r,i]};for(let e=0;e>>=0,(e=Math.imul((e=Math.imul((e=Math.imul(0xa3c59ac3^e,0x9e3779b9)>>>0)^e>>>16,0x9e3779b9)>>>0)^e>>>16,0x9e3779b9)>>>0)/0x100000000},e.en=l$,e.eo=ou,e.ep=eo,e.eq=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[4],e[4]=i[5],e[5]=i[6],e[6]=i[8],e[7]=i[9],e[8]=i[10],e},e.er=oA,e.es=oM,e.et=function(e,i,r,a,n){return tr((e-i)/(r-i)*(n-a)+a,a,n)},e.eu=eq,e.ev=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=i[4],l=i[5],h=i[6],u=i[7],c=i[8],d=c*s-l*u,p=-c*o+l*h,f=u*o-s*h,m=r*d+a*p+n*f;return m?(e[0]=d*(m=1/m),e[1]=(-c*a+n*u)*m,e[2]=(l*a-n*s)*m,e[3]=p*m,e[4]=(c*r-n*h)*m,e[5]=(-l*r+n*o)*m,e[6]=f*m,e[7]=(-u*r+a*h)*m,e[8]=(s*r-a*o)*m,e):null},e.ew=am,e.ex=2,e.ey=eA,e.ez=eU,e.f=function(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,i)=>String.fromCharCode(Number("0x"+i))))},e.f0=eI,e.f1=e_,e.f2=function([e,i,r]){let a=Math.hypot(e,i,r);return new sC(Math.atan2(e,r)*e9,(.5*Math.PI-Math.acos(-i/a))*e9)},e.f3=eV,e.f4=cH,e.f5=function(e){let i=e.navigator?e.navigator.userAgent:null;return!!function(e){if(null==tb){let i=e.navigator?e.navigator.userAgent:null;tb=!!e.safari||!(!i||!(/\b(iPad|iPhone|iPod)\b/.test(i)||i.match("Safari")&&!i.match("Chrome")))}return tb}(e)&&!(!i||!(i.match("Version/15.4")||i.match("Version/15.5")||i.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/)))},e.f6=function(e,i){tO=e,tk=i},e.f7=lJ,e.f8=lK,e.f9=function(e){let i=[0,0,0],r=ee(new Float64Array(16));return ei(r,e.pixelMatrix,e.globeMatrix),ez(i,i,r),new e4(i[0],i[1])},e.fA=pb,e.fB=function(e,i,r,a,n,o,s,l,h,u){e.iconAtlasPositions=u.iconPositions;let{featureData:c,hasAnySecondaryIcon:d,sizes:p,textAlongLine:f,symbolPlacement:m}=i;for(let i of c){let{shapedIcon:r,verticallyShapedIcon:o,feature:c,shapedTextOrientations:_,shapedText:g,layoutTextSize:y,textOffset:x,isSDFIcon:v,iconPrimary:b,iconSecondary:w,iconTextFit:T,iconOffset:S,iconCollisionBounds:E,iconVerticalCollisionBounds:I,textCollisionBounds:A}=i;pq(r,u.iconPositions,b,w),pq(o,u.iconPositions,b,w),function(e,i){for(let r in e.horizontal)pH(e.horizontal[r],i);pH(e.vertical,i)}(_,u.iconPositions),function(e,i,r){if(!i)return;let a=r.get(e.toString()),n=r.get(i.toString());a&&n&&(a.paddedRect.w===n.paddedRect.w&&a.paddedRect.h===n.paddedRect.h||t_(`Mismatch in icon variant sizes: ${e.toString()} and ${i.toString()}`),a.usvg!==n.usvg&&t_(`Mismatch in icon variant image types: ${e.id} and ${i.id}`))}(b,w,u.iconPositions),(g||r)&&function(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w){var T;let S=s.textMaxSize.evaluate(i,{},d);void 0===S?S=l*s.textScaleFactor:S*=s.textScaleFactor;let E=e.layers[0].layout,I=l*s.textScaleFactor/24,A=pX(r.horizontal)||r.vertical,M=e.hasAnyAppearanceProperty(["text-size","text-offset","text-rotate"]);if(("none"!==_||M)&&e.appearanceFeatureData&&e.featureToAppearanceIndex[i.index]18&&T>2&&(T>>=1),Math.max(8192/(512*T),1)*E.get("symbol-spacing")),z=E.get("text-padding")*e.tilePixelRatio,D=E.get("icon-padding")*e.tilePixelRatio,L=E.get("text-max-angle")*e8,F="map"===E.get("icon-rotation-alignment")&&"point"!==x,O=R/2;!1===e.hasAnyIconTextFit&&"none"!==_&&(e.hasAnyIconTextFit=!0);let k=i.properties?+i.properties[sJ]:null,B=k&&e.elevationFeatureIdToIndex?e.elevationFeatureIdToIndex.get(k):65535,V=(l,x,T)=>{if(x.x=8192||x.y=8192)return;let S=null;if(C){let{x:e,y:i,z:r}=p.projectTilePoint(x.x,x.y,T);S={anchor:new pf(e,i,r,0,void 0),up:p.upVector(T,x.x,x.y)}}!function(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,E,I,A,M,C,P,R){let z=e.addToLineVertexArray(i,a),D,L,F,O,k,B,V,N=0,U=0,j=0,G=0,q=-1,H=-1,$={},Z=t7(""),W=r?r.anchor:i,X="none"!==A,Y=0,K=0;if(void 0===h._unevaluatedLayout.getValue("text-radial-offset")){let e=h.layout.get("text-offset").evaluate(v,{},S);Y=24*e[0],K=24*e[1]}else Y=24*h.layout.get("text-radial-offset").evaluate(v,{},S),K=pF;if(e.allowVerticalPlacement&&n.vertical){let e=n.vertical;if(m)B=pK(e),l&&(V=pK(l));else{let r=h.layout.get("text-rotate").evaluate(v,{},S)+90;F=pY(u,W,i,c,d,p,e,f,r,_,R),l&&(O=pY(u,W,i,c,d,p,l,g,r,null,P))}}if(o){let a=h.layout.get("icon-rotate").evaluate(v,{},S),n=pA(o,a,w,X,b.iconScaleFactor),s=l?pA(l,a,w,X,b.iconScaleFactor):void 0;L=pY(u,W,i,c,d,p,o,g,a,null,C);let f=function(e,i,r,a,n,o,s,l,h){let u=e.layers[0],c=u.appearances,d=i.length;if(r&&(d=Math.max(d,r.length)),0===c.length)return d;let[p,f]=a.get("icon-size-scale-range"),m=tr(1,p,f);for(let i of c){let r=i.getUnevaluatedProperties();if(void 0!==r._values["icon-image"].value){let a=u.getAppearanceValueAndResolveTokens(i,"icon-image",o,s,h);if(a){let u=e.getResolvedImageFromTokens(a);if(u){let a=i.hasProperty("icon-size")?r._values["icon-size"]:n._values["icon-size"],c=pG(u,pc(e.zoom,a,e.worldview,h),a,s,e.zoom,o,e.pixelRatio,m,e.worldview,h),p=l.get(c.iconPrimary.toString());p&&(d=Math.max(d,function(e){let i=e.stretchY||[[0,e.paddedRect.h-2]];return e.stretchX||e.stretchY?pP(e.stretchX||[[0,e.paddedRect.w-2]])*pP(i):1}(p)))}}}}return d}(e,n,s,h.layout,h._unevaluatedLayout,v,S,e.iconAtlasPositions,T);N=4*f;let m=h.layout.get("icon-size").evaluate(v,{},S,T),_=b.compositeIconSizes?b.compositeIconSizes[0].evaluate(v,{},S,T):0,A=b.compositeIconSizes?b.compositeIconSizes[1].evaluate(v,{},S,T):0,M=pW(e.layerIds[0],e.iconSizeData,m,b.iconScaleFactor,_,A);e.addSymbols(e.icon,n,M,x,y,v,void 0,r,i,z.lineStartIndex,z.lineLength,-1,T,S,E,I,e.symbolInstances.length,f),q=e.icon.placedSymbolArray.length-1,s&&(U=4*f,e.addSymbols(e.icon,s,M,x,y,v,d5.vertical,r,i,z.lineStartIndex,z.lineLength,-1,T,S,E,I,e.symbolInstances.length,f),H=e.icon.placedSymbolArray.length-1)}for(let a in n.horizontal){let o=n.horizontal[a];D||(Z=t7(o.text),m?k=pK(o):D=pY(u,W,i,c,d,p,o,f,h.layout.get("text-rotate").evaluate(v,{},S),_,R));let l=1===o.positionedLines.length;if(j+=pZ(e,r,i,o,s,h,m,v,_,z,n.vertical?d5.horizontal:d5.horizontalOnly,l?pL(n.horizontal):[a],$,q,b,T,S,e.symbolInstances.length,E),l)break}n.vertical&&(G+=pZ(e,r,i,n.vertical,s,h,m,v,_,z,d5.vertical,["vertical"],$,H,b,T,S,e.symbolInstances.length,E));let J=-1,Q=(e,i)=>e?Math.max(e,i):i;J=Q(k,-1),J=Q(B,J);let ee=+((J=Q(V,J))>-1);e.glyphOffsetArray.length>=65535&&t_("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(i.x,i.y,W.x,W.y,W.z,$.right>=0?$.right:-1,$.center>=0?$.center:-1,$.left>=0?$.left:-1,$.vertical>=0?$.vertical:-1,q,H,Z,void 0!==D?D:e.collisionBoxArray.length,void 0!==D?D+1:e.collisionBoxArray.length,void 0!==F?F:e.collisionBoxArray.length,void 0!==F?F+1:e.collisionBoxArray.length,void 0!==L?L:e.collisionBoxArray.length,void 0!==L?L+1:e.collisionBoxArray.length,O||e.collisionBoxArray.length,O?O+1:e.collisionBoxArray.length,c,j,G,N,U,ee,0,Y,K,J,0,+!!X,M)}(e,x,S,l,r,a,o,n,e.layers[0],e.collisionBoxArray,i.index,i.sourceLayerIndex,e.index,z,y,h,D,F,g,i,s,u,c,d,f,m,_,B,v,b,w)};if("line"===x)for(let n of u0(i.geometry,0,0,8192,8192))for(let i of function(e,i,r,a,n,o,s){let l=a?.6*24*o:0,h=pg(a,n),u=h*o,c=0===e[0].x||8192===e[0].x||0===e[0].y||8192===e[0].y;return i-u=0&&y=0&&x=0&&f+c=0;i--)if(a.dist(e[i])1){let i=function(e,i,r,a,n){let o=r?.6*24*n:0,s=pg(r,a)*n,l=0,h=p_(e)/2;for(let r=0;rh){let c=(h-l)/u,d=new pf(im(a.x,n.x,c),im(a.y,n.y,c),0,n.angleTo(a),r);return!o||pm(e,d,s,o,i)?d:void 0}l+=u}}(e,L,r.vertical||A,a,P);i&&V(e,i,d)}}else if("Polygon"===i.type)for(let e of hI(i.geometry,0)){let i=function(e,i=1,r=!1){let a=1/0,n=1/0,o=-1/0,s=-1/0,l=e[0];for(let e=0;eo)&&(o=i.x),(!e||i.y>s)&&(s=i.y)}let h=Math.min(o-a,s-n),u=h/2,c=new rb([],pz);if(0===h)return new e4(a,n);for(let i=a;id.d||!d.d)&&(d=a,r&&console.log("found best %d after %d probes",Math.round(1e4*a.d)/1e4,p)),a.max-d.d=e.byteLength)&&t_("Invalid b3dm header information.")}return cM(e,i)},e.fG=function(e,i){let r=c6(e);for(let e of r){for(let i of e.meshes)!function(e){e.heightmap=new Float32Array(4096),e.heightmap.fill(-1);let i=e.vertexArray.float32,r=e.aabb.min[0]-1,a=e.aabb.min[1]-1,n=64/(e.aabb.max[0]-r+2),o=64/(e.aabb.max[1]-a+2);for(let s=0;se.heightmap[64*u+h]&&(e.heightmap[64*u+h]=l)}}(i);e.lights&&(e.lightMeshIndex=e.meshes.length,e.meshes.push(function(e,i){let r={};r.indexArray=new oT,r.vertexArray=new ou,r.colorArray=new o_,c8(e,i,r.indexArray,r.vertexArray,r.colorArray);let a={defined:!0};a.emissiveFactor=iu.black;let n={};return n.baseColorFactor=iu.white,a.pbrMetallicRoughness=n,r.material=a,r.aabb=new lt([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),r}(e.lights,i)))}return r},e.fH=fU,e.fI=tx,e.fJ=u7,e.fK=nM,e.fL=nx,e.fM=function(e){tN(),null!=l&&l.then(i=>{i.keys().then(r=>{for(let a=0;at_(e.message))}).catch(e=>t_(e.message))}).catch(e=>t_(e.message))},e.fa=function(){let e=S;e&&(e.isPreloaded()&&1===e.numActive()?(e.release(ct),S=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()"))},e.fb=function(){ca().acquire(ct)},e.fc=nI,e.fd=function(e,i,r=!1){if(nb===nx.deferred||nb===nx.loading||nb===nx.loaded)throw Error("setRTLTextPlugin cannot be called multiple times.");nw=tz.resolveURL(e),nb=nx.deferred,nv=i,nS(),r||nA()},e.fe=function(e){ch=tz.resolveURL(e),cc||(cc=new cr(ca(),new ia)),cc.broadcast("setMeshoptUrl",ch)},e.ff=c_,e.fg=function(e){cs=tz.resolveURL(e),cc||(cc=new cr(ca(),new ia)),cc.broadcast("setDracoUrl",cs)},e.fh=cm,e.fi=ce,e.fj=function(e){let i=tV();if(!i)return;let r=i.delete(tF);e&&r.then(()=>e()).catch(e)},e.fk=ci,e.fl=aW,e.fm=ht,e.fn=2,e.fo=rP,e.fp=_p,e.fq=_f,e.fr=dy,e.fs=sJ,e.ft="hd_road_elevation",e.fu=la,e.fv=tc,e.fw=hR,e.fx=pv,e.fy=1,e.fz=function(e,i,r,a,n,o,s,l=1,h,u,c,d){e.createArrays(),e.tilePixelRatio=8192/(512*e.overscaling),e.compareText={},e.iconsNeedLinear=!1;let p=e.layers[0].layout,f=e.layers[0]._unevaluatedLayout._values,m={};m.scaleFactor=l,m.textSizeScaleRange=p.get("text-size-scale-range"),m.iconSizeScaleRange=p.get("icon-size-scale-range");let[_,g]=m.textSizeScaleRange,[y,x]=m.iconSizeScaleRange;m.textScaleFactor=tr(m.scaleFactor,_,g),m.iconScaleFactor=tr(m.scaleFactor,y,x);let v=f["text-size"],b=f["icon-size"];if("composite"===e.textSizeData.kind){let{minZoom:i,maxZoom:r}=e.textSizeData;m.compositeTextSizes=[v.possiblyEvaluate(new nC(i,{worldview:c}),o),v.possiblyEvaluate(new nC(r,{worldview:c}),o)]}if("composite"===e.iconSizeData.kind){let{minZoom:i,maxZoom:r}=e.iconSizeData;m.compositeIconSizes=[b.possiblyEvaluate(new nC(i,{worldview:c}),o,d),b.possiblyEvaluate(new nC(r,{worldview:c}),o,d)]}m.layoutTextSize=v.possiblyEvaluate(new nC(s+1,{worldview:c}),o),m.layoutIconSize=b.possiblyEvaluate(new nC(s+1,{worldview:c}),o,d),m.textMaxSize=v.possiblyEvaluate(new nC(18,{worldview:c}),o);let w=p.get("symbol-placement"),T="map"===p.get("text-rotation-alignment")&&"point"!==w,S=p.get("text-size"),E=!1,I=[];for(let s of e.features){let l=p.get("text-font").evaluate(s,{},o).join(","),_=S.evaluate(s,{},o)*m.textScaleFactor,g=m.layoutTextSize.evaluate(s,{},o)*m.textScaleFactor,y=m.layoutIconSize.evaluate(s,{},o,d)*m.iconScaleFactor,x={horizontal:{},vertical:void 0},v=s.text,b,A=[0,0];if(v){let a=v.toString(),u=24*p.get("text-letter-spacing").evaluate(s,{},o),c=24*p.get("text-line-height").evaluate(s,{},o),d=!function(e){for(let r of e){var i;if(aJ(i=r.charCodeAt(0))||aQ(i)||a0(i)||nh(i)||np(i))return!1}return!0}(a)?0:u,f=p.get("text-anchor").evaluate(s,{},o),y=p.get("text-variable-anchor");if(!y){let e=p.get("text-radial-offset").evaluate(s,{},o);if(e)A=pB(f,[24*e,pF]);else{let e=p.get("text-offset").evaluate(s,{},o);A=[24*e[0],24*e[1]]}}let b=T?"center":p.get("text-justify").evaluate(s,{},o),S="point"===w,E=S?24*p.get("text-max-width").evaluate(s,{},o):1/0,I=o=>{e.allowVerticalPlacement&&nm(a)&&(x.vertical=d8(v,i,r,n,l,E,c,f,o,d,A,d5.vertical,!0,g,_,h,m.textScaleFactor))};if(!T&&y){let e="auto"===b?y.map(e=>p$(e)):[b],a=!1;for(let o=0;o=0||!nm(a)){let e=d8(v,i,r,n,l,E,c,f,b,d,A,d5.horizontal,!1,g,_,h,m.textScaleFactor);e&&(x.horizontal[b]=e)}I(S?"left":b)}}let M,C,P,R,z,D,L=!1,F=p.get("icon-text-fit").evaluate(s,{},o);if(s.icon&&s.icon.hasPrimary()){let i=pG(s.icon,e.iconSizeData,f["icon-size"],o,e.zoom,s,h,m.iconScaleFactor,c,d);M=i.iconPrimary,P=i.iconSecondary;let r=M.toString();if((C=a.get(r))&&(z=p.get("icon-offset").evaluate(s,{},o),D=p.get("icon-anchor").evaluate(s,{},o),b=po(n.get(r),P?n.get(P.toString()):void 0,z,D),L=C.sdf,void 0===e.sdfIcons?e.sdfIcons=C.sdf:e.sdfIcons!==C.sdf&&t_("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(C.pixelRatio!==e.pixelRatio||0!==p.get("icon-rotate").constantOr(1))&&(e.iconsNeedLinear=!0)),P){let e=P.toString();R=a.get(e)}}E=E||!(!s.icon||!s.icon.hasSecondary());let O=pX(x.horizontal)||x.vertical;e.iconsInText||(e.iconsInText=!!O&&O.iconsInText);let{defaultShapedIcon:k,verticallyShapedIcon:B}=function(e,i,r,a,n,o,s,l,h){let u=pX(o.horizontal)||o.vertical,c=r.get("icon-text-fit-padding").evaluate(a,{},n),d,p=i;return i&&"none"!==h&&(e.allowVerticalPlacement&&o.vertical&&(d=ps(i,o.vertical,h,c,l,s)),u&&(p=ps(i,u,h,c,l,s))),{defaultShapedIcon:p,verticallyShapedIcon:d}}(e,b,p,s,o,x,g*m.textScaleFactor/24,z,F);"none"!==F&&b&&(pl(b)||ph(b))&&(pU(0,C,M,b,k,F,u,a,n),pU(0,R,P,b,k,F,u,a,n),B&&(pU(0,C,M,b,B,F,u,a,n),pU(0,R,P,b,B,F,u,a,n)));let{iconBBox:V,iconVerticalBBox:N,textBBox:U,textVerticalBBox:j}=function(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m){let _=e.layers[0],g=_.appearances;if(0===g.length)return{iconBBox:null,iconVerticalBBox:null,textBBox:null,textVerticalBBox:null};let y={iconBBox:null,iconVerticalBBox:null},x={textBBox:null,textVerticalBBox:null},{baseIconRotate:v,baseTextRotate:b,iconScaleFactor:w}=function(e,i,r){let a=e.get("icon-rotate").evaluate(i,{},r),n=e.get("text-rotate").evaluate(i,{},r),[o,s]=e.get("icon-size-scale-range");return{baseIconRotate:a,baseTextRotate:n,iconScaleFactor:tr(1,o,s)}}(a,n,o);i&&(y.iconBBox=pk(i,y.iconBBox,v,s),r)&&(y.iconVerticalBBox=pk(r,y.iconVerticalBBox,v+90,s));let T=pX(d.horizontal);for(let r of(T&&(x.textBBox=pk(T,x.textBBox,b,1,f)),d.vertical&&(x.textVerticalBBox=pk(d.vertical,x.textVerticalBBox,b+90,1,f)),g))r.hasIconProperties()&&function(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m){let{appearanceIconOffset:_,appearanceIconRotate:g,appearanceIconSize:y}=pV(a,r,n,o,s,l,h,u.iconScaleFactor),x=null,v=null,b=null;a.hasProperty("icon-image")?b=function(e,i,r,a,n,o,s,l){let h=null,u=i.getAppearanceValueAndResolveTokens(r,"icon-image",a,n,l);if(u){let i=e.getResolvedImageFromTokens(u),c=r.getUnevaluatedProperty("icon-size"),d=pG(i,pc(e.zoom,c,e.worldview,l),c,n,e.zoom,a,e.pixelRatio,s,e.worldview,l);h=o.get(d.iconPrimary.toString())}return h}(i,r,a,n,o,d,p,m):c&&(b=c.imagePrimary),b&&(x=po(b,null,_,f),i.allowVerticalPlacement&&(v=po(b,null,_,f))),x&&(e.iconBBox=pk(x,e.iconBBox,g,y)),v&&(e.iconVerticalBBox=pk(v,e.iconVerticalBBox,g+90,y))}(y,e,_,r,n,o,l,v,s,h,i,u,w,c,m),r.hasTextProperties()&&function(e,i,r,a,n,o,s,l,h,u){let{appearanceTextOffset:c,appearanceTextRotate:d,appearanceTextSize:p}=pN(r,i,a,n,o,s,l),f=p/l;h&&(e.textBBox=pk(h,e.textBBox,d,f,c)),u&&(e.textVerticalBBox=pk(u,e.textVerticalBBox,d+90,f,c))}(x,_,r,n,o,f,b,p,T,d.vertical);return{iconBBox:y.iconBBox,iconVerticalBBox:y.iconVerticalBBox,textBBox:x.textBBox,textVerticalBBox:x.textVerticalBBox}}(e,b=k,B,p,s,o,y,z,m,n,D,x,g,A,d);I.push({feature:s,shapedTextOrientations:x,shapedText:O,shapedIcon:b,iconPrimary:M,iconSecondary:P,iconOffset:z,iconAnchor:D,verticallyShapedIcon:B,layoutTextSize:g,layoutIconSize:y,textOffset:A,isSDFIcon:L,iconTextFit:F,iconCollisionBounds:V,iconVerticalCollisionBounds:N,textCollisionBounds:U,textVerticalCollisionBounds:j})}return{featureData:I,sizes:m,hasAnySecondaryIcon:E,textAlongLine:T,symbolPlacement:w}},e.g=function(e,i){return tJ(Object.assign(e,{method:"GET"}),i)},e.h=function(e){return 0===e.indexOf("mapbox:")},e.i=function(e){return tM.API_STYLE_REGEX.test(e)&&!tP(e)},e.j=tC,e.k=tj,e.l=function(e){return decodeURIComponent(atob(e).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""))},e.m=function(e,i){return tJ(Object.assign(e,{type:"json"}),i)},e.n=t0,e.o=tz,e.p=function(e,i){return tJ(Object.assign(e,{method:"POST"}),i)},e.q=hi,e.r=tR,e.s=function(e){try{let i=self[e];return i.setItem("_mapbox_test_",1),i.removeItem("_mapbox_test_"),!0}catch(e){return!1}},e.t=function(){return E||(E=new ci("ImageRasterizer")),E},e.u=function(){return function e(i){return i?(i^Math.random()*(16>>i/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,e)}()},e.v=function(e){return!!e&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)},e.w=t_,e.x=mT,e.y=it,e.z=ie}),a(["./shared"],function(e){var i;function r(e){let i=e?e.url.toString():void 0;return i?performance.getEntriesByName(i):[]}function a(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e||null==e)return JSON.stringify(e);if(Array.isArray(e)){let i="[";for(let r of e)i+=`${a(r)},`;return`${i}]`}let i="{";for(let r of Object.keys(e).sort())i+=`${r}:${a(e[r])},`;return`${i}}`}class n{constructor(e){this.keyCache=Object.create(null),this._layers=Object.create(null),this._layerConfigs=Object.create(null),e&&this.replace(e)}replace(e,i){this._layerConfigs=Object.create(null),this._layers=Object.create(null),this.update(e,[],i)}update(i,r,n){for(let r of(this._options=n,i))this._layerConfigs[r.id]=r,(this._layers[r.id]=e.dw(r,this.scope,null,this._options)).compileFilter(n),this.keyCache[r.id]&&delete this.keyCache[r.id];for(let e of r)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];for(let i of(this.familiesBySource=Object.create(null),function(i,r){let n=Object.create(null);for(let o=0;othis._layers[e.id]),r=e[0];if("none"===r.visibility)continue;let a=r.source||"",n=this.familiesBySource[a];n||(n=this.familiesBySource[a]=Object.create(null));let o=r.sourceLayer||"_geojsonTileLayer",s=n[o];s||(s=n[o]=[]),s.push(e)}}}let o=+e.fn;class s{constructor(i){const r={},a=[];for(const e in i){const n=i[e],s=r[e]={};for(const e in n.glyphs){const i=n.glyphs[+e];if(!i||0===i.bitmap.width||0===i.bitmap.height)continue;const r=i.metrics.localGlyph?o:1,l={x:0,y:0,w:i.bitmap.width+2*r,h:i.bitmap.height+2*r};a.push(l),s[e]=l}}const{w:n,h:s}=e.G(a),l=new e.fm({width:n||1,height:s||1});for(const a in i){const n=i[a];for(const i in n.glyphs){const s=n.glyphs[+i];if(!s||0===s.bitmap.width||0===s.bitmap.height)continue;const h=r[a][i],u=s.metrics.localGlyph?o:1;e.fm.copy(s.bitmap,l,{x:0,y:0},{x:h.x+u,y:h.y+u},s.bitmap)}}this.image=l,this.positions=r}}function l(e,i,r){e[i]?r&&(e[i].center=r):e[i]={floorIds:new Set,center:r||[0,0],floors:{}}}function h(e,i){return i.every(i=>e.properties&&null!=e.properties[i])}e.fl(s,"GlyphAtlas");class u{constructor(i){this.tileID=new e.aQ(i.tileID.overscaledZ,i.tileID.wrap,i.tileID.canonical.z,i.tileID.canonical.x,i.tileID.canonical.y),this.tileZoom=i.tileZoom,this.uid=i.uid,this.zoom=i.zoom,this.lut=i.lut,this.canonical=i.tileID.canonical,this.pixelRatio=i.pixelRatio,this.tileSize=i.tileSize,this.source=i.source,this.scope=i.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=i.showCollisionBoxes,this.collectResourceTiming=!!i.request&&i.request.collectResourceTiming,this.promoteId=i.promoteId,this.isSymbolTile=i.isSymbolTile,this.tileTransform=e.aZ(i.tileID.canonical,i.projection),this.projection=i.projection,this.worldview=i.worldview,this.localizableLayerIds=i.localizableLayerIds,this.brightness=i.brightness,this.extraShadowCaster=!!i.extraShadowCaster,this.tessellationStep=i.tessellationStep,this.scaleFactor=i.scaleFactor,this.worldview=i.worldview,this.indoor=i.indoor}parse(i,r,a,n,o,u){this.status="parsing",this.data=i,this.collisionBoxArray=new e.b3;let d=new e.fp(Object.keys(i.layers).sort()),p=new e.fq(this.tileID,this.promoteId);p.bucketLayerIDs=[];let f={},m=new e.fr(256,256),_={featureIndex:p,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:m,availableImages:a,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0,activeFloors:void 0};this.indoor&&(_.activeFloors=function(i,r,a,n){let o=r.indoorState.activeFloorsVisible;if(!r.sourceLayers)return o?r.indoorState.activeFloors:void 0;let s=function(i,r){if(!i)return e.w("No source layers defined in indoor specification"),r;if(0===i.size)return r;for(let a of i.difference(r))e.w(`Missing source layer required in indoor specification: ${a}`);return r.intersection(r)}(r.sourceLayers,new Set(Object.keys(i.layers))),u=r.indoorState,c=function(i,r,a,n,o){let s={};for(let a of r){let r=i.layers[a];if(r)for(let i=0;ia.map(a=>e.fo(a,r,i.extent)));return 0===n.length?void 0:{type:"Polygon",coordinates:[n[0]]}}(u,c)});var u,c,d=i.buildings,p=i.id;for(let e of d)l(s,e),s[e].floors[p]=i,s[e].floorIds.add(p)}}else e.w(`indoor source layer not found: ${a}`)}return{buildings:s,activeFloors:e.di.calculate(s,n,a)}}(i,s,u.activeFloors,u.selectedFloorId,n);return a.send("setIndoorData",c),o?c.activeFloors:void 0}(i,this.indoor,o,this.canonical));let g=[],y=r.familiesBySource[this.source];for(let r in y){let o=i.layers[r];if(!o)continue;let s=!1,l=!1,h=!1;for(let e of y[r])"symbol"===e[0].type?s=!0:l=!0,e[0].is3D()&&"model"!==e[0].type&&(h=!0);if(this.extraShadowCaster&&!h||!0===this.isSymbolTile&&!s||!1===this.isSymbolTile&&!l)continue;1===o.version&&e.w(`Vector tile source "${this.source}" layer "${r}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let u=d.encode(r),m=[],x=this.localizableLayerIds&&this.localizableLayerIds.has(r),v=!1;for(let i=0,a=0;i=i.maxzoom||"none"===i.visibility)continue;c(o,this.zoom,_.brightness,a,this.worldview,_.activeFloors);let r=f[i.id]=i.createBucket({index:p.bucketLayerIDs.length,layers:o,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:u,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:n,worldview:this.worldview,localizable:x,availableImages:a});p.bucketLayerIDs.push(o.map(i=>e.B(i.id,i.scope)));let s=r.prepare?r.prepare():null;null!=s?(s=s.then(()=>r.populate(m,_,this.tileID.canonical,this.tileTransform)),g.push(s)):r.populate(m,_,this.tileID.canonical,this.tileTransform)}}let x=()=>{let r,n,l,h,g,y;m.trim();let x={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},v=()=>{if(r)return this.status="done",u(r);if(this.extraShadowCaster)this.status="done",u(null,{buckets:Object.values(f).filter(e=>!e.isEmpty()),featureIndex:p,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:_.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(n&&l&&h){let i=new s(n),r=new Map;for(let[i,a]of l.entries()){let{imagePosition:n}=e.fx(i,a,e.fy);r.set(i,n)}let u={};for(let o in f){let s=f[o];s instanceof e.b4&&(c(s.layers,this.zoom,_.brightness,a,this.worldview,_.activeFloors),u[o]=e.fz(s,n,i.positions,l,r,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,g,this.worldview,a))}let d={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(o,l,g,()=>{d.iconsPending=!1,b(u,i,d)}),this.rasterizeIfNeeded(o,h,y,()=>{d.patternsPending=!1,b(u,i,d)})}},b=(i,r,n,o)=>{if(n.iconsPending||n.patternsPending)return;let s=new e.fA(l,h,this.lut);for(let r in f){let n=f[r];if(r in i)e.fB(n,i[r],this.showCollisionBoxes,a,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,l,s);else if(n.hasPattern&&(n instanceof e.ba||n instanceof e.bb||n instanceof e.eb)){c(n.layers,this.zoom,_.brightness,a,this.worldview,_.activeFloors);let e=Object.fromEntries(s.patternPositions);n.addFeatures(_,this.tileID.canonical,e,a,this.tileTransform,this.brightness)}}this.status="done",u(null,{buckets:Object.values(f).filter(e=>!e.isEmpty()),featureIndex:p,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:r.image,lineAtlas:m,imageAtlas:s,brightness:_.brightness})};if(!this.extraShadowCaster){let i=e.fv(_.glyphDependencies,e=>Object.keys(e).map(Number));Object.keys(i).length?o.send("getGlyphs",{uid:this.uid,stacks:i},(e,i)=>{r||(r=e,n=i,v())},void 0,!1,x):n={};let a=Array.from(_.iconDependencies.keys()).map(i=>e.I.parse(i));a.length?o.send("getImages",{images:a,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(e,i)=>{r||(r=e,l=new Map,g=this.updateImageMapAndGetImageTaskQueue(l,i,_.iconDependencies),v())},void 0,!1,x):(l=new Map,g=new Map);let s=Array.from(_.patternDependencies.keys()).map(i=>e.I.parse(i));s.length?o.send("getImages",{images:s,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(e,i)=>{r||(r=e,h=new Map,y=this.updateImageMapAndGetImageTaskQueue(h,i,_.patternDependencies),v())},void 0,!1,x):(h=new Map,y=new Map)}if(_.elevationFeatures&&_.elevationFeatures.length>0){let r=[];for(let i of Object.values(f))if(i instanceof e.bb){let e=i.getUnevaluatedPortalGraph();e&&r.push(e)}let a=e.fw.evaluate(r);for(let r of Object.values(f))if(r instanceof e.bb){let e=i.layers[d.decode(r.sourceLayerIndex)];r.setEvaluatedPortalGraph(a,e,this.tileID.canonical,_.availableImages,_.brightness)}}v()};g.length>0?Promise.allSettled(g).then(x).catch(u):x()}updateParameters(i){this.scaleFactor=i.scaleFactor,this.showCollisionBoxes=i.showCollisionBoxes,this.projection=i.projection,this.brightness=i.brightness,this.tileTransform=e.aZ(i.tileID.canonical,i.projection),this.extraShadowCaster=i.extraShadowCaster,this.lut=i.lut,this.worldview=i.worldview,this.indoor=i.indoor}rasterizeIfNeeded(e,i,r,a){Array.from(i.values()).some(e=>e.usvg)?this.rasterize(e,i,r,a):a()}updateImageMapAndGetImageTaskQueue(e,i,r){let a=new Map;for(let n of i.keys())for(let o of r.get(n)||[]){let r=o.toString(),n=i.get(o.id.toString());n.usvg?a.has(r)||(a.set(r,o),e.set(r,Object.assign({},n))):e.set(r,n)}return a}rasterize(e,i,r,a){this.rasterizeTask=e.send("rasterizeImages",{scope:this.scope,tasks:r},(e,r)=>{if(!e)for(let[e,a]of r.entries()){let r=Object.assign(i.get(e),{data:a});i.set(e,r)}a()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function c(i,r,a,n,o,s){let l=new e.ac(r,{brightness:a,worldview:o,activeFloors:s});for(let e of i)e.recalculate(l,n)}class d extends e.E{constructor(i,r,a,n,o,s,l){super(),this.actor=i,this.layerIndex=r,this.availableImages=a,this.availableModels=n,this.loadVectorData=s||e.aL,this.loading={},this.loaded={},this.deduped=new e.aK(i.scheduler),this.isSpriteLoaded=o,this.scheduler=i.scheduler,this.brightness=l}loadTile(i,a){let n=i.uid,o=i&&i.request,s=o&&o.collectResourceTiming,l=this.loading[n]=new u(i);l.abort=this.loadVectorData(i,(h,u)=>{let c=!this.loading[n];if(delete this.loading[n],l.cancelRasterize(),c||h||!u)return l.status="done",c||(this.loaded[n]=l),a(h);let d=u.rawData,p={},f=e.aM(u.responseHeaders);f&&f.expires&&(p.expires=f.expires),f&&f.cacheControl&&(p.cacheControl=f.cacheControl),l.vectorTile=u.vectorTile||new e.fC(new e.bt(d));let m=()=>{l.parse(l.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(e,i)=>{if(e||!i)return a(e);let n={};if(s){let e=r(o);e.length>0&&(n.resourceTiming=JSON.parse(JSON.stringify(e)))}a(null,Object.assign({rawTileData:d.slice(0),responseHeaders:u.responseHeaders},i,p,n))})};this.isSpriteLoaded?m():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(m,{type:"parseTile",isSymbolTile:i.isSymbolTile,zoom:i.tileZoom}):m()}),this.loaded=this.loaded||{},this.loaded[n]=l})}reloadTile(e,i){let r=this.loaded,a=e.uid;if(r&&r[a]){let n=r[a];n.updateParameters(e);let o=(e,r)=>{let a=n.reloadCallback;a&&(delete n.reloadCallback,n.parse(n.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,a)),i(e,r)};"parsing"===n.status?n.reloadCallback=o:"done"===n.status&&(n.vectorTile?n.parse(n.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,o):o())}else i(null,void 0)}abortTile(e,i){let r=e.uid,a=this.loading[r];a&&(a.abort&&a.abort(),delete this.loading[r]),i()}removeTile(e,i){let r=this.loaded,a=e.uid;r&&r[a]&&delete r[a],i()}}class p{loadTile(i,r){let{uid:a,encoding:n,rawImageData:o,padding:s}=i,l=ImageBitmap&&o instanceof ImageBitmap?this.getImageData(o,s):o;r(null,new e.fD(a,l,n,sl.complete(null,e)).catch(e=>l.complete(e,null));n.push(u)}Promise.allSettled(n).then(()=>r(null,a)).catch(e=>r(e))}catch(e){r(e)}}}class m{constructor(e){this.actor=e,this.loading={},this.loaded={}}loadTile(i,r){let a=i.uid,n=i.request,o=this.loading[a]=new f(i),{cancel:s}=e.bu(n,(e,i,n)=>{let s=!this.loading[a];if(delete this.loading[a],s||e||!i)return o.status="done",s||(this.loaded[a]=o),r(e);o.parse(i,(e,i)=>{if(e||!i)return r(e);r(null,i,n)}),this.loaded[a]=o});o.abort=s}reloadTile(e,i){i(null,void 0)}abortTile(e,i){let r=e.uid,a=this.loading[r];a&&(a.abort&&a.abort(),delete this.loading[r]),i()}removeTile(e,i){let r=e.uid;this.loaded[r]&&delete this.loaded[r],i()}decodeRasterArray(i,r){e.bs.performDecoding(i.buffer,i.task).then(e=>r(null,e)).catch(e=>r(e))}}let _=e.fE.prototype.toGeoJSON;class g{constructor(i){this._feature=i,this.extent=e.al,this.type=i.type,this.properties=i.tags,"id"in i&&!isNaN(i.id)&&(this.id=parseInt(i.id,10))}loadGeometry(){if(1===this._feature.type){let i=[];for(let r of this._feature.geometry)i.push([new e.P(r[0],r[1])]);return i}{let i=[];for(let r of this._feature.geometry){let a=[];for(let i of r)a.push(new e.P(i[0],i[1]));i.push(a)}return i}}toGeoJSON(e,i,r){return _.call(this,e,i,r)}}class y{constructor(i,r){this.name=i,this.extent=e.al,this.length=r.length,this._jsonFeatures=r}feature(e){return new g(this._jsonFeatures[e])}}class x{constructor(i){for(const r of(this.layers={},this.extent=e.al,Object.keys(i)))this.layers[r]=new y(r,i[r])}}let v=64/4096;class b{constructor(){this.features=new Map}clear(){this.features.clear()}load(e=[],i){for(let r of e){let e=r.id;if(null==e)continue;let a=this.features.get(e);a&&this.updateCache(a,i),r.geometry?(a=function(e){let{id:i,geometry:r,properties:a}=e;if(!r)return;if("GeometryCollection"===r.type)throw Error("GeometryCollection not supported in dynamic mode.");let{type:n,coordinates:o}=r,s={id:i,type:1,geometry:[],tags:a,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},l=s.geometry;if("Point"===n)T(o,l,s);else if("MultiPoint"===n)for(let e of o)T(e,l,s);else if("LineString"===n)s.type=2,S(o,l,s);else if("MultiLineString"===n)s.type=2,E(o,l,s);else if("Polygon"===n)s.type=3,E(o,l,s,!0);else{if("MultiPolygon"!==n)throw Error("Input data is not a valid GeoJSON object.");for(let e of(s.type=3,o))E(e,l,s,!0)}return s}(r),this.updateCache(a,i),this.features.set(e,a)):this.features.delete(e),this.updateCache(a,i)}}updateCache(e,i){for(let{canonical:r,uid:a}of Object.values(i)){let{z:n,x:o,y:s}=r;w(e,Math.pow(2,n),o,s)&&delete i[a]}}getTile(i,r,a){let n=Math.pow(2,i),o=[];for(let i of this.features.values())w(i,n,r,a)&&o.push(function(i,r,a,n){let{id:o,type:s,geometry:l,tags:h}=i,u=[];if(1===s)for(let i=0;i=l&&d>=l||(u>=l?(c+=Math.round((l-u)/f*m),u=l):d>=l&&(p=c+Math.round((l-u)/f*m),d=l),c>=l&&p>=l||(c>=l?(u+=Math.round((l-c)/m*f),c=l):p>=l&&(d=u+Math.round((l-c)/m*f),p=l),s&&u===s[s.length-1][0]&&c===s[s.length-1][1]||(s=[[u,c]],o.push(s)),s.push([d,p])))))}}(i,r,a,n,u);else if(3===s)for(let i of l)!function(i,r,a,n,o){let s=(a-v)/r,l=(n-v)/r,h=(a+1+v)/r,u=(n+1+v)/r;function c(e,i){let r=0;return eh&&(r|=2),iu&&(r|=8),r}let d=[];for(let e=1;e(o-v)/n&&a>(s-v)/n}function T([i,r],a,n){let o=e.aF(i),s=e.aJ(r);s=s1?1:s,a.push(o,s),n.minX=Math.min(n.minX,o),n.minY=Math.min(n.minY,s),n.maxX=Math.max(n.maxX,o),n.maxY=Math.max(n.maxY,s)}function S(e,i,r,a=!1,n=!1){let o=[];for(let i of e)T(i,o,r);i.push(o),a&&function(e,i){let r=0;for(let i=0,a=e.length,n=a-2;i0===i)for(let i=0,r=e.length;i>31}function R(e,i){let{geometry:r,type:a}=e,n=0,o=0;if(1===a)for(let e of(i.writeVarint(C(1,r.length)),r)){let r=e[0]-n,a=e[1]-o;i.writeVarint(P(r)),i.writeVarint(P(a)),n+=r,o+=a}else for(let e of r){if(0===e.length)continue;i.writeVarint(C(1,1));let r=e.length-(3===a);for(let a=0;ae},L=Math.fround||(i=new Float32Array(1),e=>(i[0]=+e,i[0]));class F{constructor(e){this.options=Object.assign(Object.create(D),e),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){let{log:i,minZoom:r,maxZoom:a}=this.options;i&&console.time("total time");let n=`prepare ${e.length} points`;i&&console.time(n),this.points=e;let o=[];for(let i=0;i=r;e--){let r=+Date.now();s=this.trees[e]=this._createTree(this._cluster(s,e)),i&&console.log("z%d: %d clusters in %dms",e,s.numItems,Date.now()-r)}return i&&console.timeEnd("total time"),this}getClusters(e,i){let r=((e[0]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,e[1])),n=180===e[2]?180:((e[2]+180)%360+360)%360-180,o=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)r=-180,n=180;else if(r>n){let e=this.getClusters([r,a,180,o],i),s=this.getClusters([-180,a,n,o],i);return e.concat(s)}let s=this.trees[this._limitZoom(i)],l=s.range(B(r),V(o),B(n),V(a)),h=s.data,u=[];for(let e of l){let i=this.stride*e;u.push(h[i+5]>1?O(h,i,this.clusterProps):this.points[h[i+3]])}return u}getChildren(e){let i=this._getOriginId(e),r=this._getOriginZoom(e),a="No cluster with the specified id.",n=this.trees[r];if(!n)throw Error(a);let o=n.data;if(i*this.stride>=o.length)throw Error(a);let s=this.options.radius/(this.options.extent*Math.pow(2,r-1)),l=n.within(o[i*this.stride],o[i*this.stride+1],s),h=[];for(let i of l){let r=i*this.stride;o[r+4]===e&&h.push(o[r+5]>1?O(o,r,this.clusterProps):this.points[o[r+3]])}if(0===h.length)throw Error(a);return h}getLeaves(e,i,r){let a=[];return this._appendLeaves(a,e,i=i||10,r=r||0,0),a}getTile(e,i,r){let a=this.trees[this._limitZoom(e)],n=Math.pow(2,e),{extent:o,radius:s}=this.options,l=s/o,h=(r-l)/n,u=(r+1+l)/n,c={features:[]};return this._addTileFeatures(a.range((i-l)/n,h,(i+1+l)/n,u),a.data,i,r,n,c),0===i&&this._addTileFeatures(a.range(1-l/n,h,1,u),a.data,n,r,n,c),i===n-1&&this._addTileFeatures(a.range(0,h,l/n,u),a.data,-1,r,n,c),c.features.length?c:null}getClusterExpansionZoom(e){let i=this._getOriginZoom(e)-1;for(;i1;if(d)e=k(i,c,this.clusterProps),l=i[c],h=i[c+1];else{let r=this.points[i[c+3]];e=r.properties;let[a,n]=r.geometry.coordinates;l=B(a),h=V(n)}let p={type:1,geometry:[[Math.round(this.options.extent*(l*n-r)),Math.round(this.options.extent*(h*n-a))]],tags:e};void 0!==(u=d||this.options.generateId?i[c+3]:this.points[i[c+3]].id)&&(p.id=u),o.features.push(p)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,i){let{radius:r,extent:a,reduce:n,minPoints:o}=this.options,s=r/(a*Math.pow(2,i)),l=e.data,h=[],u=this.stride;for(let r=0;ri&&(f+=l[r+5])}if(f>p&&f>=o){let e,o=a*p,s=c*p,m=-1,_=(r/u1)for(let e of d){let r=e*u;if(!(l[r+2]>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,i,r){if(e[i+5]>1){let a=this.clusterProps[e[i+6]];return r?Object.assign({},a):a}let a=this.points[e[i+3]].properties,n=this.options.map(a);return r&&n===a?Object.assign({},n):n}}function O(e,i,r){return{type:"Feature",id:e[i+3],properties:k(e,i,r),geometry:{type:"Point",coordinates:[360*(e[i]-.5),360*Math.atan(Math.exp((180-360*e[i+1])*Math.PI/180))/Math.PI-90]}}}function k(e,i,r){let a=e[i+5],n=a>=1e4?`${Math.round(a/1e3)}k`:a>=1e3?Math.round(a/100)/10+"k":a,o=e[i+6];return Object.assign(-1===o?{}:Object.assign({},r[o]),{cluster:!0,cluster_id:e[i+3],point_count:a,point_count_abbreviated:n})}function B(e){return e/360+.5}function V(e){let i=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+i)/(1-i))/Math.PI;return r1?1:r}function N(e,i,r,a){let n={id:e??null,type:i,geometry:r,tags:a,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("Point"===i||"MultiPoint"===i||"LineString"===i)U(n,r);else if("Polygon"===i)U(n,r[0]);else if("MultiLineString"===i)for(let e of r)U(n,e);else if("MultiPolygon"===i)for(let e of r)U(n,e[0]);return n}function U(e,i){for(let r=0;r0&&(s+=a?(n*h-l*o)/2:Math.sqrt(Math.pow(l-n,2)+Math.pow(h-o,2))),n=l,o=h}let l=i.length-3;i[2]=1,function e(i,r,a,n){let o=n,s=r+(a-r>>1),l,h=a-r,u=i[r],c=i[r+1],d=i[a],p=i[a+1];for(let e=r+3;e1?(r=n,a=o):h>0&&(r+=s*h,a+=l*h)}return(s=e-r)*s+(l=i-a)*l}(i[e],i[e+1],u,c,d,p);if(r>o)l=e,o=r;else if(r===o){let i=Math.abs(e-s);in&&(l-r>3&&e(i,r,l,n),i[l+2]=o,a-l>3&&e(i,l,a,n))}(i,0,l,r),i[l+2]=1,i.size=Math.abs(s),i.start=0,i.end=i.size}function H(e,i,r,a){for(let n=0;n1?1:r}function Z(e,i,r,a,n,o,s,l){if(a/=i,o>=(r/=i)&&s=a)return null;let h=[];for(let i of e){let e=i.geometry,o=i.type,s=0===n?i.minX:i.minY,m=0===n?i.maxX:i.maxY;if(s>=r&&m=a)continue;let _=[];if("Point"===o||"MultiPoint"===o){var u=e,c=_,d=r,p=a,f=n;for(let e=0;e=d&&ir&&(c=h(l,f,m,g,y,r),s&&(l.start=d+u*c)):x>a?v=r&&(c=h(l,f,m,g,y,r),b=!0),v>a&&x=r&&_=3&&(l[p]!==l[0]||l[p+1]!==l[1])&&K(l,l[0],l[1],l[2]),l.length&&i.push(l)}function X(e){let i=[];return i.size=e.size,i.start=e.start,i.end=e.end,i}function Y(e,i,r,a,n,o){for(let s of e)W(s,i,r,a,n,o,!1)}function K(e,i,r,a){e.push(i,r,a)}function J(e,i,r,a,n,o){let s=(o-i)/(a-i);return K(e,o,r+(n-r)*s,1),s}function Q(e,i,r,a,n,o){let s=(o-r)/(n-r);return K(e,i+(a-i)*s,o,1),s}function ee(e,i){let r=[];for(let a=0;a0&&i.sizes)&&(r.numSimplified++,l.push(i[e],i[e+1])),r.numPoints++;n&&function(e,i){let r=0;for(let i=0,a=e.length,n=a-2;i