1import{bW as Ew,cP as Mw,V as Iw,ab as zp,f as $n,M as kp,a4 as fr,cQ as Qs,B as cn,aw as eo,bM as Bp,c as Ml,x as M_,o as zn,a as Np,H as to,I as Il,cR as Aw,aR as Gh,bb as I_,bc as A_,cS as qh,cT as Gc,aZ as d0,cU as jc,cV as Cw,cy as C_,bQ as P_,F as Pw,cW as Rw,i as Al,w as Vp,cX as zw,l as qr,aL as R_,T as S_,ag as z_,bI as p0,c0 as Lw}from"./Spz_2MDb.js";var Dw=Ew(function(fe,se){for(var he=[],Q=0,ve=fe.length,Ie=se.length,o=new Mw,Ce=0;Ce<Ie;Ce+=1)o.add(se[Ce]);for(;Q<ve;)o.add(fe[Q])&&(he[he.length]=fe[Q]),Q+=1;return he});const cT=Re=>{const{$i18n:fe}=Iw(),se=zp(()=>{var o,Ce,Oe,Ge;const Ie=new Date().getDay();return(Ge=(Oe=(Ce=(o=Re.value)==null?void 0:o.openingTimes)==null?void 0:Ce.regular)==null?void 0:Oe.find(qe=>qe.day===Ie))==null?void 0:Ge.endTime}),he=zp(()=>se.value?fe.t("store.closingTime",{closingTime:se.value}):fe.t("store.closedToday")),Q=zp(()=>{var Oe,Ge;const Ie=(Ge=(Oe=Re.value)==null?void 0:Oe.openingTimes)==null?void 0:Ge.regular;return Ie!=null&&Ie.length?Dw([0,1,2,3,4,5,6],Ie.map(qe=>qe.day)).map(qe=>({day:qe})):[]}),ve=zp(()=>{var Ce,Oe;const Ie=((Oe=(Ce=Re.value)==null?void 0:Ce.openingTimes)==null?void 0:Oe.regular)??[],o=Q.value;return[...Ie,...o].sort((Ge,qe)=>Ge.day===0||qe.day===0?qe.day-Ge.day:Ge.day-qe.day)});return{todayClosingTime:se,todayClosingTimeLabel:he,regularClosingTimes:Q,regularTimes:ve}};(function(){try{if(typeof document<"u"){var Re=document.createElement("style");Re.appendChild(document.createTextNode(".mapdiv[data-v-d05fc6bc]{width:100%;height:100%}.custom-control-wrapper[data-v-d099a3a6]{display:none}.mapdiv .custom-control-wrapper[data-v-d099a3a6]{display:inline-block}.info-window-wrapper[data-v-cbe1707b]{display:none}.mapdiv .info-window-wrapper[data-v-cbe1707b]{display:inline-block}.custom-marker-wrapper[data-v-2d2d343a]{display:none}.mapdiv .custom-marker-wrapper[data-v-2d2d343a]{display:inline-block}")),document.head.appendChild(Re)}}catch(fe){console.error("vite-plugin-css-injected-by-js",fe)}})();var Ow=Object.defineProperty,kw=(Re,fe,se)=>fe in Re?Ow(Re,fe,{enumerable:!0,configurable:!0,writable:!0,value:se}):Re[fe]=se,_x=(Re,fe,se)=>(kw(Re,typeof fe!="symbol"?fe+"":fe,se),se);const Up=Symbol("map"),jp=Symbol("api"),L_=Symbol("marker"),f0=Symbol("markerCluster"),m0=Symbol("CustomMarker"),Fw=Symbol("mapTilesLoaded"),_0=["click","dblclick","drag","dragend","dragstart","mousedown","mousemove","mouseout","mouseover","mouseup","rightclick"];/*! ***************************************************************************** 2Copyright (c) Microsoft Corporation. 3 4Permission to use, copy, modify, and/or distribute this software for any 5purpose with or without fee is hereby granted. 6 7THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 8REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 9AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 10INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 11LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 12OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 13PERFORMANCE OF THIS SOFTWARE. 14***************************************************************************** */function Bw(Re,fe,se,he){function Q(ve){return ve instanceof se?ve:new se(function(Ie){Ie(ve)})}return new(se||(se=Promise))(function(ve,Ie){function o(Ge){try{Oe(he.next(Ge))}catch(qe){Ie(qe)}}function Ce(Ge){try{Oe(he.throw(Ge))}catch(qe){Ie(qe)}}function Oe(Ge){Ge.done?ve(Ge.value):Q(Ge.value).then(o,Ce)}Oe((he=he.apply(Re,[])).next())})}var Nw=function Re(fe,se){if(fe===se)return!0;if(fe&&se&&typeof fe=="object"&&typeof se=="object"){if(fe.constructor!==se.constructor)return!1;var he,Q,ve;if(Array.isArray(fe)){if(he=fe.length,he!=se.length)return!1;for(Q=he;Q--!==0;)if(!Re(fe[Q],se[Q]))return!1;return!0}if(fe.constructor===RegExp)return fe.source===se.source&&fe.flags===se.flags;if(fe.valueOf!==Object.prototype.valueOf)return fe.valueOf()===se.valueOf();if(fe.toString!==Object.prototype.toString)return fe.toString()===se.toString();if(ve=Object.keys(fe),he=ve.length,he!==Object.keys(se).length)return!1;for(Q=he;Q--!==0;)if(!Object.prototype.hasOwnProperty.call(se,ve[Q]))return!1;for(Q=he;Q--!==0;){var Ie=ve[Q];if(!Re(fe[Ie],se[Ie]))return!1}return!0}return fe!==fe&&se!==se};const gx="__googleMapsScriptId";var qc;(function(Re){Re[Re.INITIALIZED=0]="INITIALIZED",Re[Re.LOADING=1]="LOADING",Re[Re.
14SUCCESS=2]="SUCCESS",Re[Re.FAILURE=3]="FAILURE"})(qc||(qc={}));class El{constructor({apiKey:fe,authReferrerPolicy:se,channel:he,client:Q,id:ve=gx,language:Ie,libraries:o=[],mapIds:Ce,nonce:Oe,region:Ge,retries:qe=3,url:ut="https://maps.googleapis.com/maps/api/js",version:It}){if(this.callbacks=[],this.done=!1,this.loading=!1,this.errors=[],this.apiKey=fe,this.authReferrerPolicy=se,this.channel=he,this.client=Q,this.id=ve||gx,this.language=Ie,this.libraries=o,this.mapIds=Ce,this.nonce=Oe,this.region=Ge,this.retries=qe,this.url=ut,this.version=It,El.instance){if(!Nw(this.options,El.instance.options))throw new Error(`Loader must not be called again with different options. ${JSON.stringify(this.options)} !== ${JSON.stringify(El.instance.options)}`);return El.instance}El.instance=this}get options(){return{version:this.version,apiKey:this.apiKey,channel:this.channel,client:this.client,id:this.id,libraries:this.libraries,language:this.language,region:this.region,mapIds:this.mapIds,nonce:this.nonce,url:this.url,authReferrerPolicy:this.authReferrerPolicy}}get status(){return this.errors.length?qc.FAILURE:this.done?qc.SUCCESS:this.loading?qc.LOADING:qc.INITIALIZED}get failed(){return this.done&&!this.loading&&this.errors.length>=this.retries+1}createUrl(){let fe=this.url;return fe+="?callback=__googleMapsCallback",this.apiKey&&(fe+=`&key=${this.apiKey}`),this.channel&&(fe+=`&channel=${this.channel}`),this.client&&(fe+=`&client=${this.client}`),this.libraries.length>0&&(fe+=`&libraries=${this.libraries.join(",")}`),this.language&&(fe+=`&language=${this.language}`),this.region&&(fe+=`®ion=${this.region}`),this.version&&(fe+=`&v=${this.version}`),this.mapIds&&(fe+=`&map_ids=${this.mapIds.join(",")}`),this.authReferrerPolicy&&(fe+=`&auth_referrer_policy=${this.authReferrerPolicy}`),fe}deleteScript(){const fe=document.getElementById(this.id);fe&&fe.remove()}load(){return this.loadPromise()}loadPromise(){return new Promise((fe,se)=>{this.loadCallback(he=>{he?se(he.error):fe(window.google)})})}importLibrary(fe){return this.execute(),google.maps.importLibrary(fe)}loadCallback(fe){this.callbacks.push(fe),this.execute()}setScript(){var fe,se;if(document.getElementById(this.id)){this.callback();return}const he={key:this.apiKey,channel:this.channel,client:this.client,libraries:this.libraries.length&&this.libraries,v:this.version,mapIds:this.mapIds,language:this.language,region:this.region,authReferrerPolicy:this.authReferrerPolicy};Object.keys(he).forEach(ve=>!he[ve]&&delete he[ve]),!((se=(fe=window==null?void 0:window.google)===null||fe===void 0?void 0:fe.maps)===null||se===void 0)&&se.importLibrary||(ve=>{let Ie,o,Ce,Oe="The Google Maps JavaScript API",Ge="google",qe="importLibrary",ut="__ib__",It=document,Fe=window;Fe=Fe[Ge]||(Fe[Ge]={});const ne=Fe.maps||(Fe.maps={}),Ue=new Set,rt=new URLSearchParams,Ct=()=>Ie||(Ie=new Promise((Tt,Xe)=>Bw(this,void 0,void 0,function*(){var tt;yield o=It.createElement("script"),o.id=this.id,rt.set("libraries",[...Ue]+"");for(Ce in ve)rt.set(Ce.replace(/[A-Z]/g,nt=>"_"+nt[0].toLowerCase()),ve[Ce]);rt.set("callback",Ge+".maps."+ut),o.src=this.url+"?"+rt,ne[ut]=Tt,o.onerror=()=>Ie=Xe(Error(Oe+" could not load.")),o.nonce=this.nonce||((tt=It.querySelector("script[nonce]"))===null||tt===void 0?void 0:tt.nonce)||"",It.head.append(o)})));ne[qe]?console.warn(Oe+" only loads once. Ignoring:",ve):ne[qe]=(Tt,...Xe)=>Ue.add(Tt)&&Ct().then(()=>ne[qe](Tt,...Xe))})(he);const Q=this.libraries.map(ve=>this.importLibrary(ve));Q.length||Q.push(this.importLibrary("core")),Promise.all(Q).then(()=>this.callback(),ve=>{const Ie=new ErrorEvent("error",{error:ve});this.loadErrorCallback(Ie)})}reset(){this.deleteScript(),this.done=!1,this.loading=!1,this.errors=[],this.onerrorEvent=null}resetIfRetryingFailed(){this.failed&&this.reset()}loadErrorCallback(fe){if(this.errors.push(fe),this.errors.length<=this.retries){const se=this.errors.length*Math.pow(2,this.errors.length);console.error(`Failed to load Google Maps script, retrying in ${se} ms.`),setTimeout(()=>{this.deleteScript(),this.setScript()},se)}else this.onerrorEvent=fe,this.callback()}callback(){this.done=!0,this.loading=!1,this.callbacks.forEach(fe=>{fe(this.onerrorEvent)}),this.callbacks=[]}execute(){if(this.resetIfRetryingFailed(),this.done)this.callback();else{if(window.google&&window.google.maps&&window.google.maps.version){console.warn("Google Maps already loaded outside @googlemaps/js-api-loader.This may result in undesirable behavior as options and script parameters may not match."),this.callback();return}this.loading||(this.loading=!0,this.setScript())}}}function Vw(Re){return class extends Re.OverlayView{constructor(fe){super(),_x(this,"element"),_x(this,"opts");const{element:se,...he}=fe;this.element=se,this.opts=he,this.opts.map&&this.setMap(this.opts.map)}getPosition(){return this.opts.position?this.opts.position instanceof Re.LatLng?this.opts.position:new Re.LatLng(this.opts.position):null}getVisible(){if(!this.element)return!1;const fe=this.element;return fe.style.display!=="none"&&fe.style.visibility!=="hidden"&&(fe.style.opacity===""||Number(fe.style.opacity)>.01)}onAdd(){if(!this.element)return;const fe=this.getPanes();fe&&fe.overlayMouseTarget.appendChild(this.element)}draw(){if(!this.element)return;const fe=this.getProjection(),se=fe==null?void 0:fe.fromLatLngToDivPixel(this.getPosition());if(se){this.element.style.position="absolute";let he,Q;switch(this.opts.anchorPoint){case"TOP_CENTER":he="-50%",Q="-100%";break;case"BOTTOM_CENTER":he="-50%",Q="0";break;case"LEFT_CENTER":he="-100%",Q="-50%";break;case"RIGHT_CENTER":he="0",Q="-50%";break;case"TOP_LEFT":he="-100%",Q="-100%";break;case"TOP_RIGHT":he="0",Q="-100%";break;case"BOTTOM_LEFT":he="-100%",Q="0";break;case"BOTTOM_RIGHT":he="0",Q="0";break;default:he="-50%",Q="-50%"}const ve=se.x+(this.opts.offsetX||0)+"px",Ie=se.y+(this.opts.offsetY||0)+"px";this.element.style.transform=`translateX(${he}) translateX(${ve}) translateY(${Q}) translateY(${Ie})`,this.opts.zIndex&&(this.element.style.zIndex=this.opts.zIndex.toString())}}onRemove(){this.element&&this.element.remove()}setOptions(fe){const{element:se,...he}=fe;this.element=se,this.opts=he,this.draw()}}}let yx;const vx=["bounds_changed","center_changed","click","contextmenu","dblclick","drag","dragend","dragstart","heading_changed","idle","isfractionalzoomenabled_changed","mapcapabilities_changed","maptypeid_changed","mousemove","mouseout","mouseover","projection_changed","renderingtype_changed","rightclick","tilesloaded","tilt_changed","zoom_
14changed"],Uw=$n({props:{apiPromise:{type:Promise},apiKey:{type:String,default:""},version:{type:String,default:"weekly"},libraries:{type:Array,default:()=>["places","marker"]},region:{type:String,required:!1},language:{type:String,required:!1},backgroundColor:{type:String,required:!1},center:{type:Object,default:()=>({lat:0,lng:0})},clickableIcons:{type:Boolean,required:!1,default:void 0},controlSize:{type:Number,required:!1},disableDefaultUi:{type:Boolean,required:!1,default:void 0},disableDoubleClickZoom:{type:Boolean,required:!1,default:void 0},draggable:{type:Boolean,required:!1,default:void 0},draggableCursor:{type:String,required:!1},draggingCursor:{type:String,required:!1},fullscreenControl:{type:Boolean,required:!1,default:void 0},fullscreenControlPosition:{type:String,required:!1},gestureHandling:{type:String,required:!1},heading:{type:Number,required:!1},isFractionalZoomEnabled:{type:Boolean,required:!1,default:void 0},keyboardShortcuts:{type:Boolean,required:!1,default:void 0},mapTypeControl:{type:Boolean,required:!1,default:void 0},mapTypeControlOptions:{type:Object,required:!1},mapTypeId:{type:[Number,String],required:!1},mapId:{type:String,required:!1},maxZoom:{type:Number,required:!1},minZoom:{type:Number,required:!1},noClear:{type:Boolean,required:!1,default:void 0},panControl:{type:Boolean,required:!1,default:void 0},panControlPosition:{type:String,required:!1},restriction:{type:Object,required:!1},rotateControl:{type:Boolean,required:!1,default:void 0},rotateControlPosition:{type:String,required:!1},scaleControl:{type:Boolean,required:!1,default:void 0},scaleControlStyle:{type:Number,required:!1},scrollwheel:{type:Boolean,required:!1,default:void 0},streetView:{type:Object,required:!1},streetViewControl:{type:Boolean,required:!1,default:void 0},streetViewControlPosition:{type:String,required:!1},styles:{type:Array,required:!1},tilt:{type:Number,required:!1},zoom:{type:Number,required:!1},zoomControl:{type:Boolean,required:!1,default:void 0},zoomControlPosition:{type:String,required:!1},nonce:{type:String,default:""}},emits:vx,setup(Re,{emit:fe}){const se=fr(),he=fr(!1),Q=fr(),ve=fr(),Ie=fr(!1);Gc(Up,Q),Gc(jp,ve),Gc(Fw,Ie);const o=()=>{const qe={...Re};Object.keys(qe).forEach(Fe=>{qe[Fe]===void 0&&delete qe[Fe]});const ut=Fe=>{var ne;return Fe?{position:(ne=ve.value)==null?void 0:ne.ControlPosition[Fe]}:{}},It={scaleControlOptions:Re.scaleControlStyle?{style:Re.scaleControlStyle}:{},panControlOptions:ut(Re.panControlPosition),zoomControlOptions:ut(Re.zoomControlPosition),rotateControlOptions:ut(Re.rotateControlPosition),streetViewControlOptions:ut(Re.streetViewControlPosition),fullscreenControlOptions:ut(Re.fullscreenControlPosition),disableDefaultUI:Re.disableDefaultUi};return{...qe,...It}},Ce=eo([ve,Q],([qe,ut])=>{const It=qe,Fe=ut;It&&Fe&&(It.event.addListenerOnce(Fe,"tilesloaded",()=>{Ie.value=!0}),setTimeout(Ce,0))},{immediate:!0}),Oe=()=>{try{const{apiKey:qe,region:ut,version:It,language:Fe,libraries:ne,nonce:Ue}=Re;yx=new El({apiKey:qe,region:ut,version:It,language:Fe,libraries:ne,nonce:Ue})}catch(qe){console.error(qe)}},Ge=qe=>{ve.value=qh(qe.maps),Q.value=qh(new qe.maps.Map(se.value,o()));const ut=Vw(ve.value);ve.value[m0]=ut,vx.forEach(Fe=>{var ne;(ne=Q.value)==null||ne.addListener(Fe,Ue=>fe(Fe,Ue))}),he.value=!0;const It=Object.keys(Re).filter(Fe=>!["apiPromise","apiKey","version","libraries","region","language","center","zoom","nonce"].includes(Fe)).map(Fe=>kp(Re,Fe));eo([()=>Re.center,()=>Re.zoom,...It],([Fe,ne],[Ue,rt])=>{var Ct,Tt,Xe;const{center:tt,zoom:nt,...Ye}=o();(Ct=Q.value)==null||Ct.setOptions(Ye),ne!==void 0&&ne!==rt&&((Tt=Q.value)==null||Tt.setZoom(ne));const Bt=!Ue||Fe.lng!==Ue.lng||Fe.lat!==Ue.lat;Fe&&Bt&&((Xe=Q.value)==null||Xe.panTo(Fe))})};return Gh(()=>{Re.apiPromise&&Re.apiPromise instanceof Promise?Re.apiPromise.then(Ge):(Oe(
14),yx.load().then(Ge))}),Bp(()=>{var qe;Ie.value=!1,Q.value&&((qe=ve.value)==null||qe.event.clearInstanceListeners(Q.value))}),{mapRef:se,ready:he,map:Q,api:ve,mapTilesLoaded:Ie}}}),g0=(Re,fe)=>{const se=Re.__vccOpts||Re;for(const[he,Q]of fe)se[he]=Q;return se},jw={ref:"mapRef",class:"mapdiv"};function qw(Re,fe,se,he,Q,ve){return zn(),Ml("div",null,[Np("div",jw,null,512),to(Re.$slots,"default",I_(A_({ready:Re.ready,map:Re.map,api:Re.api,mapTilesLoaded:Re.mapTilesLoaded})),void 0,!0)])}const Gw=g0(Uw,[["render",qw],["__scopeId","data-v-d05fc6bc"]]);function $w(Re){return Re&&Re.__esModule&&Object.prototype.hasOwnProperty.call(Re,"default")?Re.default:Re}var Hw=function Re(fe,se){if(fe===se)return!0;if(fe&&se&&typeof fe=="object"&&typeof se=="object"){if(fe.constructor!==se.constructor)return!1;var he,Q,ve;if(Array.isArray(fe)){if(he=fe.length,he!=se.length)return!1;for(Q=he;Q--!==0;)if(!Re(fe[Q],se[Q]))return!1;return!0}if(fe.constructor===RegExp)return fe.source===se.source&&fe.flags===se.flags;if(fe.valueOf!==Object.prototype.valueOf)return fe.valueOf()===se.valueOf();if(fe.toString!==Object.prototype.toString)return fe.toString()===se.toString();if(ve=Object.keys(fe),he=ve.length,he!==Object.keys(se).length)return!1;for(Q=he;Q--!==0;)if(!Object.prototype.hasOwnProperty.call(se,ve[Q]))return!1;for(Q=he;Q--!==0;){var Ie=ve[Q];if(!Re(fe[Ie],se[Ie]))return!1}return!0}return fe!==fe&&se!==se};const Fp=$w(Hw),xx=["click","drag","dragend","dragstart","gmp-click"],Zw=$n({name:"AdvancedMarker",props:{options:{type:Object,required:!0},pinOptions:{type:Object,required:!1}},emits:xx,setup(Re,{emit:fe,expose:se,slots:he}){const Q=kp(Re,"options"),ve=kp(Re,"pinOptions"),Ie=fr(),o=Qs(Up,fr()),Ce=Qs(jp,fr()),Oe=Qs(f0,fr()),Ge=cn(()=>!!(Oe.value&&Ce.value&&Ie.value instanceof google.maps.marker.AdvancedMarkerElement));return eo([o,Q,ve],async(qe,[ut,It,Fe])=>{var ne,Ue,rt;const Ct=!Fp(Q.value,It)||!Fp(ve.value,Fe)||o.value!==ut;if(!o.value||!Ce.value||!Ct)return;const{AdvancedMarkerElement:Tt,PinElement:Xe}=Ce.value.marker;if(Ie.value){const{map:tt,content:nt,...Ye}=Q.value;Object.assign(Ie.value,{content:ve.value?new Xe(ve.value).element:nt,...Ye}),Ge.value&&((ne=Oe.value)==null||ne.removeMarker(Ie.value),(Ue=Oe.value)==null||Ue.addMarker(Ie.value))}else ve.value&&(Q.value.content=new Xe(ve.value).element),Ie.value=qh(new Tt(Q.value)),Ge.value?(rt=Oe.value)==null||rt.addMarker(Ie.value):Ie.value.map=o.value,xx.forEach(tt=>{var nt;(nt=Ie.value)==null||nt.addListener(tt,Ye=>fe(tt,Ye))})},{immediate:!0}),Bp(()=>{var qe,ut;Ie.value&&((qe=Ce.value)==null||qe.event.clearInstanceListeners(Ie.value),Ge.value?(ut=Oe.value)==null||ut.removeMarker(Ie.value):Ie.value.map=null)}),Gc(L_,Ie),se({marker:Ie}),()=>{var qe;return(qe=he.default)==null?void 0:qe.call(he)}}}),Ww=(Re,fe,se,he)=>{const Q=fr(),ve=Qs(Up,fr()),Ie=Qs(jp,fr()),o=Qs(f0,fr()),Ce=cn(()=>!!(o.value&&Ie.value&&(Q.value instanceof Ie.value.Marker||Q.value instanceof Ie.value[m0])));return eo([ve,se],(Oe,[Ge,qe])=>{var ut,It,Fe;const ne=!Fp(se.value,qe)||ve.value!==Ge;!ve.value||!Ie.value||!ne||(Q.value?(Q.value.setOptions(se.value),Ce.value&&((ut=o.value)==null||ut.removeMarker(Q.value),(It=o.value)==null||It.addMarker(Q.value))):(Q.value=qh(new Ie.value[Re](se.value)),Ce.value?(Fe=o.value)==null||Fe.addMarker(Q.value):Q.value.setMap(ve.value),fe.forEach(Ue=>{var rt;(rt=Q.value)==null||rt.addListener(Ue,Ct=>he(Ue,Ct))})))},{immediate:!0}),Bp(()=>{var Oe,Ge;Q.value&&((Oe=Ie.value)==null||Oe.event.clearInstanceListeners(Q.value),Ce.value?(Ge=o.value)==null||Ge.removeMarker(Q.value):Q.value.setMap(null))}),Q},bx=["animation_changed","click","dblclick","rightclick","dragstart","dragend","drag","mouseover","mousedown","mouseout","mouseup","draggable_changed","clickable_changed","contextmenu","cursor_changed","flat_changed","rightclick","zindex_changed","icon_changed","position_changed","shape_changed","title_changed","visible_changed"],Xw=$n({name:"Marker",props:{options:{type:Object,required:!0}},emits:bx,setup(Re,{emit:fe,expose:se,slots:he}){const Q=kp(Re,"options"),ve=Ww("Marker",bx,Q,fe);return Gc(L_,ve),se({marker:ve}),()=>{var Ie;return(Ie=he.default)==null?void 0:Ie.call(he)}}});_0.concat(["bounds_changed"]);_0.concat(["center_changed","radius_changed"]);const wx=["closeclick","content_changed","domready","position_changed","visible","zindex_changed"],Yw=$n({inheritAttrs:!1,props:{options:{type:Object,default:()=>({})},modelValue:{type:Boolean}},emits:[...wx,"update:modelValue"],setup(Re,{slots:fe,emit:se,expose:he}){const Q=fr(),ve=fr(),Ie=Qs(Up,fr()),o=Qs(jp,fr()),Ce=Qs(L_,fr());let Oe,Ge=Re.modelValue;const qe=cn(()=>{var ne;return(ne=fe.default)==null?void 0:ne.call(fe).some(Ue=>Ue.type!==Aw)}),ut=ne=>{Ge=ne,se("update:modelValue",ne)},It=ne=>{Q.value&&(Q.value.open({map:Ie.value,anchor:Ce.value,...ne}),ut(!0))},Fe=()=>{Q.value&&(Q.value.close(),ut(!1))};return Gh(()=>{eo([Ie,()=>Re.options],([ne,Ue],[rt,Ct])=>{var Tt;const Xe=!Fp(Ue,Ct)||Ie.value!==rt;Ie.value&&o.value&&Xe&&(Q.value?(Q.value.setOptions({...Ue,content:qe.value?ve.value:Ue.content}),Ce.value||It()):(Q.value=qh(new o.value.InfoWindow({...Ue,content:qe.value?ve.value:Ue.content})),Ce.value&&(Oe=Ce.value.addListener("click",()=>{It()}
14)),(!Ce.value||Ge)&&It(),wx.forEach(tt=>{var nt;(nt=Q.value)==null||nt.addListener(tt,Ye=>se(tt,Ye))}),(Tt=Q.value)==null||Tt.addListener("closeclick",()=>ut(!1))))},{immediate:!0}),eo(()=>Re.modelValue,ne=>{ne!==Ge&&(ne?It():Fe())})}),Bp(()=>{var ne;Oe&&Oe.remove(),Q.value&&((ne=o.value)==null||ne.event.clearInstanceListeners(Q.value),Fe())}),he({infoWindow:Q,open:It,close:Fe}),{infoWindow:Q,infoWindowRef:ve,hasSlotContent:qe,open:It,close:Fe}}}),Kw={key:0,class:"info-window-wrapper"};function Jw(Re,fe,se,he,Q,ve){return Re.hasSlotContent?(zn(),Ml("div",Kw,[Np("div",Il({ref:"infoWindowRef"},Re.$attrs),[to(Re.$slots,"default",{},void 0,!0)],16)])):M_("",!0)}const uT=g0(Yw,[["render",Jw],["__scopeId","data-v-cbe1707b"]]);var E_;(function(Re){Re.CLUSTERING_BEGIN="clusteringbegin",Re.CLUSTERING_END="clusteringend",Re.CLUSTER_CLICK="click"})(E_||(E_={}));Object.values(E_);var Dp={exports:{}},Qw=Dp.exports,Tx;function e2(){return Tx||(Tx=1,function(Re,fe){(function(se,he){Re.exports=he()})(Qw,function(){var se,he,Q;function ve(o,Ce){if(!se)se=Ce;else if(!he)he=Ce;else{var Oe="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 = {}; ("+se+")(sharedChunk); ("+he+")(sharedChunk); self.onerror = null;",Ge={};se(Ge),Q=Ce(Ge),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(Q.workerUrl=window.URL.createObjectURL(new Blob([Oe],{type:"text/javascript"})))}}ve(["exports"],function(o){function Ce(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Oe,Ge={},qe={};function ut(){if(Oe)return qe;Oe=1,Object.defineProperty(qe,"__esModule",{value:!0}),qe.setMatrixArrayType=function(l){qe.ARRAY_TYPE=e=l},qe.toRadian=function(l){return l*s},qe.equals=function(l,a){return Math.abs(l-a)<=n*Math.max(1,Math.abs(l),Math.abs(a))},qe.RANDOM=qe.ARRAY_TYPE=qe.EPSILON=void 0;var n=1e-6;qe.EPSILON=n;var e=typeof Float32Array<"u"?Float32Array:Array;qe.ARRAY_TYPE=e;var i=Math.random;qe.RANDOM=i;var s=Math.PI/180;return Math.hypot||(Math.hypot=function(){for(var l=0,a=arguments.length;a--;)l+=arguments[a]*arguments[a];return Math.sqrt(l)}),qe}var It,Fe={};function ne(){if(It)return Fe;function n(a){return n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(h){return typeof h}:function(h){return h&&typeof Symbol=="function"&&h.constructor===Symbol&&h!==Symbol.prototype?"symbol":typeof h},n(a)}It=1,Object.defineProperty(Fe,"__esModule",{value:!0}),Fe.create=function(){var a=new e.ARRAY_TYPE(4);return e.ARRAY_TYPE!=Float32Array&&(a[1]=0,a[2]=0),a[0]=1,a[3]=1,a},Fe.clone=function(a){var h=new e.ARRAY_TYPE(4);return h[0]=a[0],h[1]=a[1],h[2]=a[2],h[3]=a[3],h},Fe.copy=function(a,h){return a[0]=h[0],a[1]=h[1],a[2]=h[2],a[3]=h[3],a},Fe.identity=function(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=1,a},Fe.fromValues=function(a,h,m,g){var x=new e.ARRAY_TYPE(4);return x[0]=a,x[1]=h,x[2]=m,x[3]=g,x},Fe.set=function(a,h,m,g,x){return a[0]=h,a[1]=m,a[2]=g,a[3]=x,a},Fe.transpose=function(a,h){if(a===h){var m=h[1];a[1]=h[2],a[2]=m}else a[0]=h[0],a[1]=h[2],a[2]=h[1],a[3]=h[3];return a},Fe.invert=function(a,h){var m=h[0],g=h[1],x=h[2],p=h[3],y=m*p-x*g;return y?(a[0]=p*(y=1/y),a[1]=-g*y,a[2]=-x*y,a[3]=m*y,a):null},Fe.adjoint=function(a,h){var m=h[0];return a[0]=h[3],a[1]=-h[1],a[2]=-h[2],a[3]=m,a},Fe.determinant=function(a){return a[0]*a[3]-a[2]*a[1]},Fe.multiply=s,Fe.rotate=function(a,h,m){var g=h[0],x=h[1],p=h[2],y=h[3],w=Math.sin(m),v=Math.cos(m);return a[0]=g*v+p*w,a[1]=x*v+y*w,a[2]=g*-w+p*v,a[3]=x*-w+y*v,a},Fe.scale=function(a,h,m){var g=h[1],x=h[2],p=h[3],y=m[0],w=m[1];return a[0]=h[0]*y,a[1]=g*y,a[2]=x*w,a[3]=p*w,a},Fe.fromRotation=function(a,h){var m=Math.sin(h),g=Math.cos(h);return a[0]=g,a[1]=m,a[2]=-m,a[3]=g,a},Fe.fromScaling=function(a,h){return a[0]=h[0],a[1]=0,a[2]=0,a[3]=h[1],a},Fe.str=function(a){return"mat2("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"},Fe.frob=function(a){return Math.hypot(a[0],a[1],a[2],a[3])},Fe.LDU=function(a,h,m,g){return a[2]=g[2]/g[0],m[0]=g[0],m[1]=g[1],m[3]=g[3]-a[2]*m[1],[a,h,m]},Fe.add=function(a,h,m){return a[0]=h[0]+m[0],a[1]=h[1]+m[1],a[2]=h[2]+m[2],a[3]=h[3]+m[3],a},Fe.subtract=l,Fe.exactEquals=function(a,h){return a[0]===h[0]&&a[1]===h[1]&&a[2]===
14h[2]&&a[3]===h[3]},Fe.equals=function(a,h){var m=a[0],g=a[1],x=a[2],p=a[3],y=h[0],w=h[1],v=h[2],b=h[3];return Math.abs(m-y)<=e.EPSILON*Math.max(1,Math.abs(m),Math.abs(y))&&Math.abs(g-w)<=e.EPSILON*Math.max(1,Math.abs(g),Math.abs(w))&&Math.abs(x-v)<=e.EPSILON*Math.max(1,Math.abs(x),Math.abs(v))&&Math.abs(p-b)<=e.EPSILON*Math.max(1,Math.abs(p),Math.abs(b))},Fe.multiplyScalar=function(a,h,m){return a[0]=h[0]*m,a[1]=h[1]*m,a[2]=h[2]*m,a[3]=h[3]*m,a},Fe.multiplyScalarAndAdd=function(a,h,m,g){return a[0]=h[0]+m[0]*g,a[1]=h[1]+m[1]*g,a[2]=h[2]+m[2]*g,a[3]=h[3]+m[3]*g,a},Fe.sub=Fe.mul=void 0;var e=function(a,h){if(a&&a.__esModule)return a;if(a===null||n(a)!=="object"&&typeof a!="function")return{default:a};var m=i(void 0);if(m&&m.has(a))return m.get(a);var g={},x=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in a)if(p!=="default"&&Object.prototype.hasOwnProperty.call(a,p)){var y=x?Object.getOwnPropertyDescriptor(a,p):null;y&&(y.get||y.set)?Object.defineProperty(g,p,y):g[p]=a[p]}return g.default=a,m&&m.set(a,g),g}(ut());function i(a){if(typeof WeakMap!="function")return null;var h=new WeakMap,m=new WeakMap;return(i=function(g){return g?m:h})(a)}function s(a,h,m){var g=h[0],x=h[1],p=h[2],y=h[3],w=m[0],v=m[1],b=m[2],S=m[3];return a[0]=g*w+p*v,a[1]=x*w+y*v,a[2]=g*b+p*S,a[3]=x*b+y*S,a}function l(a,h,m){return a[0]=h[0]-m[0],a[1]=h[1]-m[1],a[2]=h[2]-m[2],a[3]=h[3]-m[3],a}return Fe.mul=s,Fe.sub=l,Fe}var Ue,rt={};function Ct(){if(Ue)return rt;function n(a){return n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(h){return typeof h}:function(h){return h&&typeof Symbol=="function"&&h.constructor===Symbol&&h!==Symbol.prototype?"symbol":typeof h},n(a)}Ue=1,Object.defineProperty(rt,"__esModule",{value:!0}),rt.create=function(){var a=new e.ARRAY_TYPE(6);return e.ARRAY_TYPE!=Float32Array&&(a[1]=0,a[2]=0,a[4]=0,a[5]=0),a[0]=1,a[3]=1,a},rt.clone=function(a){var h=new e.ARRAY_TYPE(6);return h[0]=a[0],h[1]=a[1],h[2]=a[2],h[3]=a[3],h[4]=a[4],h[5]=a[5],h},rt.copy=function(a,h){return a[0]=h[0],a[1]=h[1],a[2]=h[2],a[3]=h[3],a[4]=h[4],a[5]=h[5],a},rt.identity=function(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=1,a[4]=0,a[5]=0,a},rt.fromValues=function(a,h,m,g,x,p){var y=new e.ARRAY_TYPE(6);return y[0]=a,y[1]=h,y[2]=m,y[3]=g,y[4]=x,y[5]=p,y},rt.set=function(a,h,m,g,x,p,y){return a[0]=h,a[1]=m,a[2]=g,a[3]=x,a[4]=p,a[5]=y,a},rt.invert=function(a,h){var m=h[0],g=h[1],x=h[2],p=h[3],y=h[4],w=h[5],v=m*p-g*x;return v?(a[0]=p*(v=1/v),a[1]=-g*v,a[2]=-x*v,a[3]=m*v,a[4]=(x*w-p*y)*v,a[5]=(g*y-m*w)*v,a):null},rt.determinant=function(a){return a[0]*a[3]-a[1]*a[2]},rt.multiply=s,rt.rotate=function(a,h,m){var g=h[0],x=h[1],p=h[2],y=h[3],w=h[4],v=h[5],b=Math.sin(m),S=Math.cos(m);return a[0]=g*S+p*b,a[1]=x*S+y*b,a[2]=g*-b+p*S,a[3]=x*-b+y*S,a[4]=w,a[5]=v,a},rt.scale=function(a,h,m){var g=h[1],x=h[2],p=h[3],y=h[4],w=h[5],v=m[0],b=m[1];return a[0]=h[0]*v,a[1]=g*v,a[2]=x*b,a[3]=p*b,a[4]=y,a[5]=w,a},rt.translate=function(a,h,m){var g=h[0],x=h[1],p=h[2],y=h[3],w=h[4],v=h[5],b=m[0],S=m[1];return a[0]=g,a[1]=x,a[2]=p,a[3]=y,a[4]=g*b+p*S+w,a[5]=x*b+y*S+v,a},rt.fromRotation=function(a,h){var m=Math.sin(h),g=Math.cos(h);return a[0]=g,a[1]=m,a[2]=-m,a[3]=g,a[4]=0,a[5]=0,a},rt.fromScaling=function(a,h){return a[0]=h[0],a[1]=0,a[2]=0,a[3]=h[1],a[4]=0,a[5]=0,a},rt.fromTranslation=function(a,h){return a[0]=1,a[1]=0,a[2]=0,a[3]=1,a[4]=h[0],a[5]=h[1],a},rt.str=function(a){return"mat2d("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+")"},rt.frob=function(a){return Math.hypot(a[0],a[1],a[2],a[3],a[4],a[5],1)},rt.add=function(a,h,m){return a[0]=h[0]+m[0],a[1]=h[1]+m[1],a[2]=h[2]+m[2],a[3]=h[3]+m[3],a[4]=h[4]+m[4],a[5]=h[5]+m[5],a},rt.subtract=l,rt.multiplyScalar=function(a,h,m){return a[0]=h[0]*m,a[1]=h[1]*m,a[2]=h[2]*m,a[3]=h[3]*m,a[4]=h[4]*m,a[5]=h[5]*m,a},rt.multiplyScalarAndAdd=function(a,h,m,g){return a[0]=h[0]+m[0]*g,a[1]=h[1]+m[1]*g,a[2]=h[2]+m[2]*g,a[3]=h[3]+m[3]*g,a[4]=h[4]+m[4]*g,a[5]=h[5]+m[5]*g,a},rt.exactEquals=function(a,h){return a[0]===h[0]&&a[1]===h[1]&&a[2]===h[2]&&a[3]===h[3]&&a[4]===h[4]&&a[5]===h[5]},rt.equals=function(a,h){var m=a[0],g=a[1],x=a[2],p=a[3],y=a[4],w=a[5],v=h[0],b=h[1],S=h[2],A=h[3],C=h[4],D=h[5];return Math.abs(m-v)<=e.EPSILON*Math.max(1,Math.abs(m),Math.abs(v))&&Math.abs(g-b)<=e.EPSILON*Math.max(1,Math.abs(g),Math.abs(b))&&Math.abs(x-S)<=e.EPSILON*Math.max(1,Math.abs(x),Math.abs(S))&&Math.abs(p-A)<=e.EPSILON*Math.max(1,Math.abs(p),Math.abs(A))&&Math.abs(y-C)<=e.EPSILON*Math.max(1,Math.abs(y),Math.abs(C))&&Math.abs(w-D)<=e.EPSILON*Math.max(1,Math.abs(w),Math.abs(D))},rt.sub=rt.mul=void 0;
14var e=function(a,h){if(a&&a.__esModule)return a;if(a===null||n(a)!=="object"&&typeof a!="function")return{default:a};var m=i(void 0);if(m&&m.has(a))return m.get(a);var g={},x=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in a)if(p!=="default"&&Object.prototype.hasOwnProperty.call(a,p)){var y=x?Object.getOwnPropertyDescriptor(a,p):null;y&&(y.get||y.set)?Object.defineProperty(g,p,y):g[p]=a[p]}return g.default=a,m&&m.set(a,g),g}(ut());function i(a){if(typeof WeakMap!="function")return null;var h=new WeakMap,m=new WeakMap;return(i=function(g){return g?m:h})(a)}function s(a,h,m){var g=h[0],x=h[1],p=h[2],y=h[3],w=h[4],v=h[5],b=m[0],S=m[1],A=m[2],C=m[3],D=m[4],L=m[5];return a[0]=g*b+p*S,a[1]=x*b+y*S,a[2]=g*A+p*C,a[3]=x*A+y*C,a[4]=g*D+p*L+w,a[5]=x*D+y*L+v,a}function l(a,h,m){return a[0]=h[0]-m[0],a[1]=h[1]-m[1],a[2]=h[2]-m[2],a[3]=h[3]-m[3],a[4]=h[4]-m[4],a[5]=h[5]-m[5],a}return rt.mul=s,rt.sub=l,rt}var Tt,Xe={};function tt(){if(Tt)return Xe;function n(a){return n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(h){return typeof h}:function(h){return h&&typeof Symbol=="function"&&h.constructor===Symbol&&h!==Symbol.prototype?"symbol":typeof h},n(a)}Tt=1,Object.defineProperty(Xe,"__esModule",{value:!0}),Xe.create=function(){var a=new e.ARRAY_TYPE(9);return e.ARRAY_TYPE!=Float32Array&&(a[1]=0,a[2]=0,a[3]=0,a[5]=0,a[6]=0,a[7]=0),a[0]=1,a[4]=1,a[8]=1,a},Xe.fromMat4=function(a,h){return a[0]=h[0],a[1]=h[1],a[2]=h[2],a[3]=h[4],a[4]=h[5],a[5]=h[6],a[6]=h[8],a[7]=h[9],a[8]=h[10],a},Xe.clone=function(a){var h=new e.ARRAY_TYPE(9);return h[0]=a[0],h[1]=a[1],h[2]=a[2],h[3]=a[3],h[4]=a[4],h[5]=a[5],h[6]=a[6],h[7]=a[7],h[8]=a[8],h},Xe.copy=function(a,h){return a[0]=h[0],a[1]=h[1],a[2]=h[2],a[3]=h[3],a[4]=h[4],a[5]=h[5],a[6]=h[6],a[7]=h[7],a[8]=h[8],a},Xe.fromValues=function(a,h,m,g,x,p,y,w,v){var b=new e.ARRAY_TYPE(9);return b[0]=a,b[1]=h,b[2]=m,b[3]=g,b[4]=x,b[5]=p,b[6]=y,b[7]=w,b[8]=v,b},Xe.set=function(a,h,m,g,x,p,y,w,v,b){return a[0]=h,a[1]=m,a[2]=g,a[3]=x,a[4]=p,a[5]=y,a[6]=w,a[7]=v,a[8]=b,a},Xe.identity=function(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=1,a[5]=0,a[6]=0,a[7]=0,a[8]=1,a},Xe.transpose=function(a,h){if(a===h){var m=h[1],g=h[2],x=h[5];a[1]=h[3],a[2]=h[6],a[3]=m,a[5]=h[7],a[6]=g,a[7]=x}else a[0]=h[0],a[1]=h[3],a[2]=h[6],a[3]=h[1],a[4]=h[4],a[5]=h[7],a[6]=h[2],a[7]=h[5],a[8]=h[8];return a},Xe.invert=function(a,h){var m=h[0],g=h[1],x=h[2],p=h[3],y=h[4],w=h[5],v=h[6],b=h[7],S=h[8],A=S*y-w*b,C=-S*p+w*v,D=b*p-y*v,L=m*A+g*C+x*D;return L?(a[0]=A*(L=1/L),a[1]=(-S*g+x*b)*L,a[2]=(w*g-x*y)*L,a[3]=C*L,a[4]=(S*m-x*v)*L,a[5]=(-w*m+x*p)*L,a[6]=D*L,a[7]=(-b*m+g*v)*L,a[8]=(y*m-g*p)*L,a):null},Xe.adjoint=function(a,h){var m=h[0],g=h[1],x=h[2],p=h[3],y=h[4],w=h[5],v=h[6],b=h[7],S=h[8];return a[0]=y*S-w*b,a[1]=x*b-g*S,a[2]=g*w-x*y,a[3]=w*v-p*S,a[4]=m*S-x*v,a[5]=x*p-m*w,a[6]=p*b-y*v,a[7]=g*v-m*b,a[8]=m*y-g*p,a},Xe.determinant=function(a){var h=a[3],m=a[4],g=a[5],x=a[6],p=a[7],y=a[8];return a[0]*(y*m-g*p)+a[1]*(-y*h+g*x)+a[2]*(p*h-m*x)},Xe.multiply=s,Xe.translate=function(a,h,m){var g=h[0],x=h[1],p=h[2],y=h[3],w=h[4],v=h[5],b=h[6],S=h[7],A=h[8],C=m[0],D=m[1];return a[0]=g,a[1]=x,a[2]=p,a[3]=y,a[4]=w,a[5]=v,a[6]=C*g+D*y+b,a[7]=C*x+D*w+S,a[8]=C*p+D*v+A,a},Xe.rotate=function(a,h,m){var g=h[0],x=h[1],p=h[2],y=h[3],w=h[4],v=h[5],b=h[6],S=h[7],A=h[8],C=Math.sin(m),D=Math.cos(m);return a[0]=D*g+C*y,a[1]=D*x+C*w,a[2]=D*p+C*v,a[3]=D*y-C*g,a[4]=D*w-C*x,a[5]=D*v-C*p,a[6]=b,a[7]=S,a[8]=A,a},Xe.scale=function(a,h,m){var g=m[0],x=m[1];return a[0]=g*h[0],a[1]=g*h[1],a[2]=g*h[2],a[3]=x*h[3],a[4]=x*h[4],a[5]=x*h[5],a[6]=h[6],a[7]=h[7],a[8]=h[8],a},Xe.fromTranslation=function(a,h){return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=1,a[5]=0,a[6]=h[0],a[7]=h[1],a[8]=1,a},Xe.fromRotation=function(a,h){var m=Math.sin(h),g=Math.cos(h);return a[0]=g,a[1]=m,a[2]=0,a[3]=-m,a[4]=g,a[5]=0,a[6]=0,a[7]=0,a[8]=1,a},Xe.fromScaling=function(a,h){return a[0]=h[0],a[1]=0,a[2]=0,a[3]=0,a[4]=h[1],a[5]=0,a[6]=0,a[7]=0,a[8]=1,a},Xe.fromMat2d=function(a,h){return a[0]=h[0],a[1]=h[1],a[2]=0,a[3]=h[2],a[4]=h[3],a[5]=0,a[6]=h[4],a[7]=h[5],a[8]=1,a},Xe.fromQuat=function(a,h){var m=h[0],g=h[1],x=h[2],p=h[3],y=m+m,w=g+g,v=x+x,b=m*y,S=g*y,A=g*w,C=x*y,D=x*w,L=x*v,z=p*y,k=p*w,B=p*v;return a[0]=1-A-L,a[3]=S-B,a[6]=C+k,a[1]=S+B,a[4]=1-b-L,a[7]=D-z,a[2]=C-k,a[5]=D+z,a[8]=1-b-A,a},Xe.normalFromMat4=function(a,h){var m=h[0],g=h[1],x=h[2],p=h[3],y=h[4],w=h[5],v=h[6],b=h[7],S=h[8],A=h[9],C=h[10],D=h[11],L=h[12],z=h[13],k=h[14],B=h[15],V=m*w-g*y,W=m*v-x*y,$=m*b-p*y,H=g*v-x*w,ae=g*b-p*w,Y=x*b-p*v,le=S*z-A*L,_e=S*k-C*L,pe=S*B-D*L,xe=A*k-C*z,ye=A*B-D*z,Me=C*B-D*k,Te=V*Me-W*ye+$*xe+H*pe-ae*_e+Y*le;return Te?(a[0]=(w*Me-v*ye+b*xe)*(Te=1/Te),a[1]=(v*pe-y*Me-b*_e)*Te,a[2]=(y*ye-w*pe+b*le)*Te,a[3]=(x*ye-g*Me-p*xe)*Te,a[4]=(m*Me-x*pe+p*_e)*Te,a[5]=(g*pe-m*ye-p*le)*Te,a[6]=(z*Y-k*ae+B*H)*Te,a[7]=(k*$-L*Y-B*W)*Te,a[8]=(L*ae-z*$+B*V)*Te,a):null},Xe.projection=function(a,h,m){return a[0]=2/h,a[1]=0,a[2]=0,a[3]=0,a[4]=-2/m,a[5]=0,a[6]=-1,a[7]=1,a[8]=1,a}
vendor: 1,689 bytes, line 14
14,Xe.str=function(a){return"mat3("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+")"},Xe.frob=function(a){return Math.hypot(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8])},Xe.add=function(a,h,m){return a[0]=h[0]+m[0],a[1]=h[1]+m[1],a[2]=h[2]+m[2],a[3]=h[3]+m[3],a[4]=h[4]+m[4],a[5]=h[5]+m[5],a[6]=h[6]+m[6],a[7]=h[7]+m[7],a[8]=h[8]+m[8],a},Xe.subtract=l,Xe.multiplyScalar=function(a,h,m){return a[0]=h[0]*m,a[1]=h[1]*m,a[2]=h[2]*m,a[3]=h[3]*m,a[4]=h[4]*m,a[5]=h[5]*m,a[6]=h[6]*m,a[7]=h[7]*m,a[8]=h[8]*m,a},Xe.multiplyScalarAndAdd=function(a,h,m,g){return a[0]=h[0]+m[0]*g,a[1]=h[1]+m[1]*g,a[2]=h[2]+m[2]*g,a[3]=h[3]+m[3]*g,a[4]=h[4]+m[4]*g,a[5]=h[5]+m[5]*g,a[6]=h[6]+m[6]*g,a[7]=h[7]+m[7]*g,a[8]=h[8]+m[8]*g,a},Xe.exactEquals=function(a,h){return a[0]===h[0]&&a[1]===h[1]&&a[2]===h[2]&&a[3]===h[3]&&a[4]===h[4]&&a[5]===h[5]&&a[6]===h[6]&&a[7]===h[7]&&a[8]===h[8]},Xe.equals=function(a,h){var m=a[0],g=a[1],x=a[2],p=a[3],y=a[4],w=a[5],v=a[6],b=a[7],S=a[8],A=h[0],C=h[1],D=h[2],L=h[3],z=h[4],k=h[5],B=h[6],V=h[7],W=h[8];return Math.abs(m-A)<=e.EPSILON*Math.max(1,Math.abs(m),Math.abs(A))&&Math.abs(g-C)<=e.EPSILON*Math.max(1,Math.abs(g),Math.abs(C))&&Math.abs(x-D)<=e.EPSILON*Math.max(1,Math.abs(x),Math.abs(D))&&Math.abs(p-L)<=e.EPSILON*Math.max(1,Math.abs(p),Math.abs(L))&&Math.abs(y-z)<=e.EPSILON*Math.max(1,Math.abs(y),Math.abs(z))&&Math.abs(w-k)<=e.EPSILON*Math.max(1,Math.abs(w),Math.abs(k))&&Math.abs(v-B)<=e.EPSILON*Math.max(1,Math.abs(v),Math.abs(B))&&Math.abs(b-V)<=e.EPSILON*Math.max(1,Math.abs(b),Math.abs(V))&&Math.abs(S-W)<=e.EPSILON*Math.max(1,Math.abs(S),Math.abs(W))},Xe.sub=Xe.mul=void 0;var e=function(a,h){if(a&&a.__esModule)return a;
14if(a===null||n(a)!=="object"&&typeof a!="function")return{default:a};var m=i(void 0);if(m&&m.has(a))return m.get(a);var g={},x=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in a)if(p!=="default"&&Object.prototype.hasOwnProperty.call(a,p)){var y=x?Object.getOwnPropertyDescriptor(a,p):null;y&&(y.get||y.set)?Object.defineProperty(g,p,y):g[p]=a[p]}return g.default=a,m&&m.set(a,g),g}(ut());function i(a){if(typeof WeakMap!="function")return null;var h=new WeakMap,m=new WeakMap;return(i=function(g){return g?m:h})(a)}function s(a,h,m){var g=h[0],x=h[1],p=h[2],y=h[3],w=h[4],v=h[5],b=h[6],S=h[7],A=h[8],C=m[0],D=m[1],L=m[2],z=m[3],k=m[4],B=m[5],V=m[6],W=m[7],$=m[8];return a[0]=C*g+D*y+L*b,a[1]=C*x+D*w+L*S,a[2]=C*p+D*v+L*A,a[3]=z*g+k*y+B*b,a[4]=z*x+k*w+B*S,a[5]=z*p+k*v+B*A,a[6]=V*g+W*y+$*b,a[7]=V*x+W*w+$*S,a[8]=V*p+W*v+$*A,a}function l(a,h,m){return a[0]=h[0]-m[0],a[1]=h[1]-m[1],a[2]=h[2]-m[2],a[3]=h[3]-m[3],a[4]=h[4]-m[4],a[5]=h[5]-m[5],a[6]=h[6]-m[6],a[7]=h[7]-m[7],a[8]=h[8]-m[8],a}return Xe.mul=s,Xe.sub=l,Xe}var nt,Ye={};function Bt(){if(nt)return Ye;function n(p){return n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(y){return typeof y}:function(y){return y&&typeof Symbol=="function"&&y.constructor===Symbol&&y!==Symbol.prototype?"symbol":typeof y},n(p)}nt=1,Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.create=function(){var p=new e.ARRAY_TYPE(16);return e.ARRAY_TYPE!=Float32Array&&(p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[11]=0,p[12]=0,p[13]=0,p[14]=0),p[0]=1,p[5]=1,p[10]=1,p[15]=1,p},Ye.clone=function(p){var y=new e.ARRAY_TYPE(16);return y[0]=p[0],y[1]=p[1],y[2]=p[2],y[3]=p[3],y[4]=p[4],y[5]=p[5],y[6]=p[6],y[7]=p[7],y[8]=p[8],y[9]=p[9],y[10]=p[10],y[11]=p[11],y[12]=p[12],y[13]=p[13],y[14]=p[14],y[15]=p[15],y},Ye.copy=function(p,y){return p[0]=y[0],p[1]=y[1],p[2]=y[2],p[3]=y[3],p[4]=y[4],p[5]=y[5],p[6]=y[6],p[7]=y[7],p[8]=y[8],p[9]=y[9],p[10]=y[10],p[11]=y[11],p[12]=y[12],p[13]=y[13],p[14]=y[14],p[15]=y[15],p},Ye.fromValues=function(p,y,w,v,b,S,A,C,D,L,z,k,B,V,W,$){var H=new e.ARRAY_TYPE(16);return H[0]=p,H[1]=y,H[2]=w,H[3]=v,H[4]=b,H[5]=S,H[6]=A,H[7]=C,H[8]=D,H[9]=L,H[10]=z,H[11]=k,H[12]=B,H[13]=V,H[14]=W,H[15]=$,H},Ye.set=function(p,y,w,v,b,S,A,C,D,L,z,k,B,V,W,$,H){return p[0]=y,p[1]=w,p[2]=v,p[3]=b,p[4]=S,p[5]=A,p[6]=C,p[7]=D,p[8]=L,p[9]=z,p[10]=k,p[11]=B,p[12]=V,p[13]=W,p[14]=$,p[15]=H,p},Ye.identity=s,Ye.transpose=function(p,y){if(p===y){var w=y[1],v=y[2],b=y[3],S=y[6],A=y[7],C=y[11];p[1]=y[4],p[2]=y[8],p[3]=y[12],p[4]=w,p[6]=y[9],p[7]=y[13],p[8]=v,p[9]=S,p[11]=y[14],p[12]=b,p[13]=A,p[14]=C}else p[0]=y[0],p[1]=y[4],p[2]=y[8],p[3]=y[12],p[4]=y[1],p[5]=y[5],p[6]=y[9],p[7]=y[13],p[8]=y[2],p[9]=y[6],p[10]=y[10],p[11]=y[14],p[12]=y[3],p[13]=y[7],p[14]=y[11],p[15]=y[15];return p},Ye.invert=function(p,y){var w=y[0],v=y[1],b=y[2],S=y[3],A=y[4],C=y[5],D=y[6],L=y[7],z=y[8],k=y[9],B=y[10],V=y[11],W=y[12],$=y[13],H=y[14],ae=y[15],Y=w*C-v*A,le=w*D-b*A,_e=w*L-S*A,pe=v*D-b*C,xe=v*L-S*C,ye=b*L-S*D,Me=z*$-k*W,Te=z*H-B*W,Ae=z*ae-V*W,et=k*H-B*$,Je=k*ae-V*$,xt=B*ae-V*H,st=Y*xt-le*Je+_e*et+pe*Ae-xe*Te+ye*Me;return st?(p[0]=(C*xt-D*Je+L*et)*(st=1/st),p[1]=(b*Je-v*xt-S*et)*st,p[2]=($*ye-H*xe+ae*pe)*st,p[3]=(B*xe-k*ye-V*pe)*st,p[4]=(D*Ae-A*xt-L*Te)*st,p[5]=(w*xt-b*Ae+S*Te)*st,p[6]=(H*_e-W*ye-ae*le)*st,p[7]=(z*ye-B*_e+V*le)*st,p[8]=(A*Je-C*Ae+L*Me)*st,p[9]=(v*Ae-w*Je-S*Me)*st,p[10]=(W*xe-$*_e+ae*Y)*st,p[11]=(k*_e-z*xe-V*Y)*st,p[12]=(C*Te-A*et-D*Me)*st,p[13]=(w*et-v*Te+b*Me)*st,p[14]=($*le-W*pe-H*Y)*st,p[15]=(z*pe-k*le+B*Y)*st,p):null},Ye.adjoint=function(p,y){var w=y[0],v=y[1],b=y[2],S=y[3],A=y[4],C=y[5],D=y[6],L=y[7],z=y[8],k=y[9],B=y[10],V=y[11],W=y[12],$=y[13],H=y[14],ae=y[15];return p[0]=C*(B*ae-V*H)-k*(D*ae-L*H)+$*(D*V-L*B),p[1]=-(v*(B*ae-V*H)-k*(b*ae-S*H)+$*(b*V-S*B)),p[2]=v*(D*ae-L*H)-C*(b*ae-S*H)+$*(b*L-S*D),p[3]=-(v*(D*V-L*B)-C*(b*V-S*B)+k*(b*L-S*D)),p[4]=-(A*(B*ae-V*H)-z*(D*ae-L*H)+W*(D*V-L*B)),p[5]=w*(B*ae-V*H)-z*(b*ae-S*H)+W*(b*V-S*B),p[6]=-(w*(D*ae-L*H)-A*(b*ae-S*H)+W*(b*L-S*D)),p[7]=w*(D*V-L*B)-A*(b*V-S*B)+z*(b*L-S*D),p[8]=A*(k*ae-V*$)-z*(C*ae-L*$)+W*(C*V-L*k),p[9]=-(w*(k*ae-V*$)-z*(v*ae-S*$)+W*(v*V-S*k)),p[10]=w*(C*ae-L*$)-A*(v*ae-S*$)+W*(v*L-S*C),p[11]=-(w*(C*V-L*k)-A*(v*V-S*k)+z*(v*L-S*C)),p[12]=-(A*(k*H-B*$)-z*(C*H-D*$)+W*(C*B-D*k)),p[13]=w*(k*H-B*$)-z*(v*H-b*$)+W*(v*B-b*k),p[14]=-(w*(C*H-D*$)-A*(v*H-b*$)+W*(v*D-b*C)),p[15]=w*(C*B-D*k)-A*(v*B-b*k)+z*(v*D-b*C),p},Ye.determinant=function(p){var y=p[0],w=p[1],v=p[2],b=p[3],S=p[4],A=p[5],C=p[6],D=p[7],L=p[8],z=p[9],k=p[10],B=p[11],V=p[12],W=p[13],$=p[14],H=p[15];return(y*A-w*S)*(k*H-B*$)-(y*C-v*S)*(z*H-B*W)+(y*D-b*S)*(z*$-k*W)+(w*C-v*A)*(L*H-B*V)-(w*D-b*A)*(L*$-k*V)+(v*D-b*C)*(L*W-z*V)},Ye.multiply=l,Ye.translate=function(p,y,w){var v,b,S,A,C,D,L,z,k,B,V,W,$=w[0],H=w[1],ae=w[2];return y===p?(p[12]=y[0]*$+y[4]*H+y[8]*ae+y[12],p[13]=y[1]*$+y[5]*H+y[9]*ae+y[13],p[14]=y[2]*$+y[6]*H+y[10]*ae+y[14],p[15]=y[3]*$+y[7]*H+y[11]*ae+y[15]):(b=y[1],S=y[2],A=y[3],C=y[4],D=y[5],L=y[6],z=y[7],k=y[8],B=y[9],V=y[10],W=y[11],p[0]=v=y[0],p[1]=b,p[2]=S,p[3]=A,p[4]=C,p[5]=D,p[6]=L,p[7]=z,p[8]=k,p[9]=B,p[10]=V,p[11]=W,p[12]=v*$+C*H+k*ae+y[12],p[13]=b*$+D*H+B*ae+y[13],p[14]=S*$+L*H+V*ae+y[14],p[15]=A*$+z*H+W*ae+y[15]),p},Ye.scale=function(p,y,w){var v=w[0],b=w[1],S=w[2];return p[0]=y[0]*v,p[1]=y[1]*v,p[2]=y[2]*v,p[3]=y[3]*v,p[4]=y[4]*b,p[5]=y[5
14]*b,p[6]=y[6]*b,p[7]=y[7]*b,p[8]=y[8]*S,p[9]=y[9]*S,p[10]=y[10]*S,p[11]=y[11]*S,p[12]=y[12],p[13]=y[13],p[14]=y[14],p[15]=y[15],p},Ye.rotate=function(p,y,w,v){var b,S,A,C,D,L,z,k,B,V,W,$,H,ae,Y,le,_e,pe,xe,ye,Me,Te,Ae,et,Je=v[0],xt=v[1],st=v[2],ct=Math.hypot(Je,xt,st);return ct<e.EPSILON?null:(Je*=ct=1/ct,xt*=ct,st*=ct,b=Math.sin(w),S=Math.cos(w),D=y[1],L=y[2],z=y[3],B=y[5],V=y[6],W=y[7],H=y[9],ae=y[10],Y=y[11],le=Je*Je*(A=1-S)+S,xe=Je*xt*A-st*b,ye=xt*xt*A+S,Me=st*xt*A+Je*b,Te=Je*st*A+xt*b,Ae=xt*st*A-Je*b,et=st*st*A+S,p[0]=(C=y[0])*le+(k=y[4])*(_e=xt*Je*A+st*b)+($=y[8])*(pe=st*Je*A-xt*b),p[1]=D*le+B*_e+H*pe,p[2]=L*le+V*_e+ae*pe,p[3]=z*le+W*_e+Y*pe,p[4]=C*xe+k*ye+$*Me,p[5]=D*xe+B*ye+H*Me,p[6]=L*xe+V*ye+ae*Me,p[7]=z*xe+W*ye+Y*Me,p[8]=C*Te+k*Ae+$*et,p[9]=D*Te+B*Ae+H*et,p[10]=L*Te+V*Ae+ae*et,p[11]=z*Te+W*Ae+Y*et,y!==p&&(p[12]=y[12],p[13]=y[13],p[14]=y[14],p[15]=y[15]),p)},Ye.rotateX=function(p,y,w){var v=Math.sin(w),b=Math.cos(w),S=y[4],A=y[5],C=y[6],D=y[7],L=y[8],z=y[9],k=y[10],B=y[11];return y!==p&&(p[0]=y[0],p[1]=y[1],p[2]=y[2],p[3]=y[3],p[12]=y[12],p[13]=y[13],p[14]=y[14],p[15]=y[15]),p[4]=S*b+L*v,p[5]=A*b+z*v,p[6]=C*b+k*v,p[7]=D*b+B*v,p[8]=L*b-S*v,p[9]=z*b-A*v,p[10]=k*b-C*v,p[11]=B*b-D*v,p},Ye.rotateY=function(p,y,w){var v=Math.sin(w),b=Math.cos(w),S=y[0],A=y[1],C=y[2],D=y[3],L=y[8],z=y[9],k=y[10],B=y[11];return y!==p&&(p[4]=y[4],p[5]=y[5],p[6]=y[6],p[7]=y[7],p[12]=y[12],p[13]=y[13],p[14]=y[14],p[15]=y[15]),p[0]=S*b-L*v,p[1]=A*b-z*v,p[2]=C*b-k*v,p[3]=D*b-B*v,p[8]=S*v+L*b,p[9]=A*v+z*b,p[10]=C*v+k*b,p[11]=D*v+B*b,p},Ye.rotateZ=function(p,y,w){var v=Math.sin(w),b=Math.cos(w),S=y[0],A=y[1],C=y[2],D=y[3],L=y[4],z=y[5],k=y[6],B=y[7];return y!==p&&(p[8]=y[8],p[9]=y[9],p[10]=y[10],p[11]=y[11],p[12]=y[12],p[13]=y[13],p[14]=y[14],p[15]=y[15]),p[0]=S*b+L*v,p[1]=A*b+z*v,p[2]=C*b+k*v,p[3]=D*b+B*v,p[4]=L*b-S*v,p[5]=z*b-A*v,p[6]=k*b-C*v,p[7]=B*b-D*v,p},Ye.fromTranslation=function(p,y){return p[0]=1,p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[5]=1,p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[10]=1,p[11]=0,p[12]=y[0],p[13]=y[1],p[14]=y[2],p[15]=1,p},Ye.fromScaling=function(p,y){return p[0]=y[0],p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[5]=y[1],p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[10]=y[2],p[11]=0,p[12]=0,p[13]=0,p[14]=0,p[15]=1,p},Ye.fromRotation=function(p,y,w){var v,b,S,A=w[0],C=w[1],D=w[2],L=Math.hypot(A,C,D);return L<e.EPSILON?null:(A*=L=1/L,C*=L,D*=L,v=Math.sin(y),b=Math.cos(y),p[0]=A*A*(S=1-b)+b,p[1]=C*A*S+D*v,p[2]=D*A*S-C*v,p[3]=0,p[4]=A*C*S-D*v,p[5]=C*C*S+b,p[6]=D*C*S+A*v,p[7]=0,p[8]=A*D*S+C*v,p[9]=C*D*S-A*v,p[10]=D*D*S+b,p[11]=0,p[12]=0,p[13]=0,p[14]=0,p[15]=1,p)},Ye.fromXRotation=function(p,y){var w=Math.sin(y),v=Math.cos(y);return p[0]=1,p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[5]=v,p[6]=w,p[7]=0,p[8]=0,p[9]=-w,p[10]=v,p[11]=0,p[12]=0,p[13]=0,p[14]=0,p[15]=1,p},Ye.fromYRotation=function(p,y){var w=Math.sin(y),v=Math.cos(y);return p[0]=v,p[1]=0,p[2]=-w,p[3]=0,p[4]=0,p[5]=1,p[6]=0,p[7]=0,p[8]=w,p[9]=0,p[10]=v,p[11]=0,p[12]=0,p[13]=0,p[14]=0,p[15]=1,p},Ye.fromZRotation=function(p,y){var w=Math.sin(y),v=Math.cos(y);return p[0]=v,p[1]=w,p[2]=0,p[3]=0,p[4]=-w,p[5]=v,p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[10]=1,p[11]=0,p[12]=0,p[13]=0,p[14]=0,p[15]=1,p},Ye.fromRotationTranslation=a,Ye.fromQuat2=function(p,y){var w=new e.ARRAY_TYPE(3),v=-y[0],b=-y[1],S=-y[2],A=y[3],C=y[4],D=y[5],L=y[6],z=y[7],k=v*v+b*b+S*S+A*A;return k>0?(w[0]=2*(C*A+z*v+D*S-L*b)/k,w[1]=2*(D*A+z*b+L*v-C*S)/k,w[2]=2*(L*A+z*S+C*b-D*v)/k):(w[0]=2*(C*A+z*v+D*S-L*b),w[1]=2*(D*A+z*b+L*v-C*S),w[2]=2*(L*A+z*S+C*b-D*v)),a(p,y,w),p},Ye.getTranslation=function(p,y){return p[0]=y[12],p[1]=y[13],p[2]=y[14],p},Ye.getScaling=h,Ye.getRotation=function(p,y){var w=new e.ARRAY_TYPE(3);h(w,y);var v=1/w[0],b=1/w[1],S=1/w[2],A=y[0]*v,C=y[1]*b,D=y[2]*S,L=y[4]*v,z=y[5]*b,k=y[6]*S,B=y[8]*v,V=y[9]*b,W=y[10]*S,$=A+z+W,H=0;return $>0?(H=2*Math.sqrt($+1),p[3]=.25*H,p[0]=(k-V)/H,p[1]=(B-D)/H,p[2]=(C-L)/H):A>z&&A>W?(H=2*Math.sqrt(1+A-z-W),p[3]=(k-V)/H,p[0]=.25*H,p[1]=(C+L)/H,p[2]=(B+D)/H):z>W?(H=2*Math.sqrt(1+z-A-W),p[3]=(B-D)/H,p[0]=(C+L)/H,p[1]=.25*H,p[2]=(k+V)/H):(H=2*Math.sqrt(1+W-A-z),p[3]=(C-L)/H,p[0]=(B+D)/H,p[1]=(k+V)/H,p[2]=.25*H),p},Ye.fromRotationTranslationScale=function(p,y,w,v){var b=y[0],S=y[1],A=y[2],C=y[3],D=b+b,L=S+S,z=A+A,k=b*D,B=b*L,V=b*z,W=S*L,$=S*z,H=A*z,ae=C*D,Y=C*L,le=C*z,_e=v[0],pe=v[1],xe=v[2];return p[0]=(1-(W+H))*_e,p[1]=(B+le)*_e,p[2]=(V-Y)*_e,p[3]=0,p[4]=(B-le)*pe,p[5]=(1-(k+H))*pe,p[6]=($+ae)*pe,p[7]=0,p[8]=(V+Y)*xe,p[9]=($-ae)*xe,p[10]=(1-(k+W))*xe,p[11]=0,p[12]=w[0],p[13]=w[1],p[14]=w[2],p[15]=1,p},Ye.fromRotationTranslationScaleOrigin=function(p,y,w,v,b){var S=y[0],A=y[1],C=y[2],D=y[3],L=S+S,z=A+A,k=C+C,B=S*L,V=S*z,W=S*k,$=A*z,H=A*k,ae=C*k,Y=D*L,le=D*z,_e=D*k,pe=v[0],xe=v[1],ye=v[2],Me=b[0],Te=b[1],Ae=b[2],et=(1-($+ae))*pe,Je=(V+_e)*pe,xt=(W-le)*pe,st=(V-_e)*xe,ct=(1-(B+ae))*xe,it=(H+Y)*xe,zt=(W+le)*ye,_t=(H-Y)*ye,St=(1-(B+$))*ye;return p[0]=et,p[1]=Je,p[2]=xt,p[3]=0,p[4]=st,p[5]=ct,p[6]=it,p[7]=0,p[8]=zt,p[9]=_t,p[10]=St,p[11]=0,p[12]=w[0]+Me-(et*Me+st*Te+zt*Ae),p[13]=w[1]+Te-(Je*Me+ct*Te+_t*Ae),p[14]=w[2]+Ae-(xt*Me+it*Te+St*Ae),p[15]=1,p},Ye.fromQuat=function(p,y){var w=y[0],v=y[1],b=y[2],S=y[3],A=w+w,C=v+v,D=b
14+b,L=w*A,z=v*A,k=v*C,B=b*A,V=b*C,W=b*D,$=S*A,H=S*C,ae=S*D;return p[0]=1-k-W,p[1]=z+ae,p[2]=B-H,p[3]=0,p[4]=z-ae,p[5]=1-L-W,p[6]=V+$,p[7]=0,p[8]=B+H,p[9]=V-$,p[10]=1-L-k,p[11]=0,p[12]=0,p[13]=0,p[14]=0,p[15]=1,p},Ye.frustum=function(p,y,w,v,b,S,A){var C=1/(w-y),D=1/(b-v),L=1/(S-A);return p[0]=2*S*C,p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[5]=2*S*D,p[6]=0,p[7]=0,p[8]=(w+y)*C,p[9]=(b+v)*D,p[10]=(A+S)*L,p[11]=-1,p[12]=0,p[13]=0,p[14]=A*S*2*L,p[15]=0,p},Ye.perspectiveNO=m,Ye.perspectiveZO=function(p,y,w,v,b){var S,A=1/Math.tan(y/2);return p[0]=A/w,p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[5]=A,p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[11]=-1,p[12]=0,p[13]=0,p[15]=0,b!=null&&b!==1/0?(p[10]=b*(S=1/(v-b)),p[14]=b*v*S):(p[10]=-1,p[14]=-v),p},Ye.perspectiveFromFieldOfView=function(p,y,w,v){var b=Math.tan(y.upDegrees*Math.PI/180),S=Math.tan(y.downDegrees*Math.PI/180),A=Math.tan(y.leftDegrees*Math.PI/180),C=Math.tan(y.rightDegrees*Math.PI/180),D=2/(A+C),L=2/(b+S);return p[0]=D,p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[5]=L,p[6]=0,p[7]=0,p[8]=-(A-C)*D*.5,p[9]=(b-S)*L*.5,p[10]=v/(w-v),p[11]=-1,p[12]=0,p[13]=0,p[14]=v*w/(w-v),p[15]=0,p},Ye.orthoNO=g,Ye.orthoZO=function(p,y,w,v,b,S,A){var C=1/(y-w),D=1/(v-b),L=1/(S-A);return p[0]=-2*C,p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[5]=-2*D,p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[10]=L,p[11]=0,p[12]=(y+w)*C,p[13]=(b+v)*D,p[14]=S*L,p[15]=1,p},Ye.lookAt=function(p,y,w,v){var b,S,A,C,D,L,z,k,B,V,W=y[0],$=y[1],H=y[2],ae=v[0],Y=v[1],le=v[2],_e=w[0],pe=w[1],xe=w[2];return Math.abs(W-_e)<e.EPSILON&&Math.abs($-pe)<e.EPSILON&&Math.abs(H-xe)<e.EPSILON?s(p):(z=W-_e,k=$-pe,B=H-xe,b=Y*(B*=V=1/Math.hypot(z,k,B))-le*(k*=V),S=le*(z*=V)-ae*B,A=ae*k-Y*z,(V=Math.hypot(b,S,A))?(b*=V=1/V,S*=V,A*=V):(b=0,S=0,A=0),C=k*A-B*S,D=B*b-z*A,L=z*S-k*b,(V=Math.hypot(C,D,L))?(C*=V=1/V,D*=V,L*=V):(C=0,D=0,L=0),p[0]=b,p[1]=C,p[2]=z,p[3]=0,p[4]=S,p[5]=D,p[6]=k,p[7]=0,p[8]=A,p[9]=L,p[10]=B,p[11]=0,p[12]=-(b*W+S*$+A*H),p[13]=-(C*W+D*$+L*H),p[14]=-(z*W+k*$+B*H),p[15]=1,p)},Ye.targetTo=function(p,y,w,v){var b=y[0],S=y[1],A=y[2],C=v[0],D=v[1],L=v[2],z=b-w[0],k=S-w[1],B=A-w[2],V=z*z+k*k+B*B;V>0&&(z*=V=1/Math.sqrt(V),k*=V,B*=V);var W=D*B-L*k,$=L*z-C*B,H=C*k-D*z;return(V=W*W+$*$+H*H)>0&&(W*=V=1/Math.sqrt(V),$*=V,H*=V),p[0]=W,p[1]=$,p[2]=H,p[3]=0,p[4]=k*H-B*$,p[5]=B*W-z*H,p[6]=z*$-k*W,p[7]=0,p[8]=z,p[9]=k,p[10]=B,p[11]=0,p[12]=b,p[13]=S,p[14]=A,p[15]=1,p},Ye.str=function(p){return"mat4("+p[0]+", "+p[1]+", "+p[2]+", "+p[3]+", "+p[4]+", "+p[5]+", "+p[6]+", "+p[7]+", "+p[8]+", "+p[9]+", "+p[10]+", "+p[11]+", "+p[12]+", "+p[13]+", "+p[14]+", "+p[15]+")"},Ye.frob=function(p){return Math.hypot(p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7],p[8],p[9],p[10],p[11],p[12],p[13],p[14],p[15])},Ye.add=function(p,y,w){return p[0]=y[0]+w[0],p[1]=y[1]+w[1],p[2]=y[2]+w[2],p[3]=y[3]+w[3],p[4]=y[4]+w[4],p[5]=y[5]+w[5],p[6]=y[6]+w[6],p[7]=y[7]+w[7],p[8]=y[8]+w[8],p[9]=y[9]+w[9],p[10]=y[10]+w[10],p[11]=y[11]+w[11],p[12]=y[12]+w[12],p[13]=y[13]+w[13],p[14]=y[14]+w[14],p[15]=y[15]+w[15],p},Ye.subtract=x,Ye.multiplyScalar=function(p,y,w){return p[0]=y[0]*w,p[1]=y[1]*w,p[2]=y[2]*w,p[3]=y[3]*w,p[4]=y[4]*w,p[5]=y[5]*w,p[6]=y[6]*w,p[7]=y[7]*w,p[8]=y[8]*w,p[9]=y[9]*w,p[10]=y[10]*w,p[11]=y[11]*w,p[12]=y[12]*w,p[13]=y[13]*w,p[14]=y[14]*w,p[15]=y[15]*w,p},Ye.multiplyScalarAndAdd=function(p,y,w,v){return p[0]=y[0]+w[0]*v,p[1]=y[1]+w[1]*v,p[2]=y[2]+w[2]*v,p[3]=y[3]+w[3]*v,p[4]=y[4]+w[4]*v,p[5]=y[5]+w[5]*v,p[6]=y[6]+w[6]*v,p[7]=y[7]+w[7]*v,p[8]=y[8]+w[8]*v,p[9]=y[9]+w[9]*v,p[10]=y[10]+w[10]*v,p[11]=y[11]+w[11]*v,p[12]=y[12]+w[12]*v,p[13]=y[13]+w[13]*v,p[14]=y[14]+w[14]*v,p[15]=y[15]+w[15]*v,p},Ye.exactEquals=function(p,y){return p[0]===y[0]&&p[1]===y[1]&&p[2]===y[2]&&p[3]===y[3]&&p[4]===y[4]&&p[5]===y[5]&&p[6]===y[6]&&p[7]===y[7]&&p[8]===y[8]&&p[9]===y[9]&&p[10]===y[10]&&p[11]===y[11]&&p[12]===y[12]&&p[13]===y[13]&&p[14]===y[14]&&p[15]===y[15]},Ye.equals=function(p,y){var w=p[0],v=p[1],b=p[2],S=p[3],A=p[4],C=p[5],D=p[6],L=p[7],z=p[8],k=p[9],B=p[10],V=p[11],W=p[12],$=p[13],H=p[14],ae=p[15],Y=y[0],le=y[1],_e=y[2],pe=y[3],xe=y[4],ye=y[5],Me=y[6],Te=y[7],Ae=y[8],et=y[9],Je=y[10],xt=y[11],st=y[12],ct=y[13],it=y[14],zt=y[15];return Math.abs(w-Y)<=e.EPSILON*Math.max(1,Math.abs(w),Math.abs(Y))&&Math.abs(v-le)<=e.EPSILON*Math.max(1,Math.abs(v),Math.abs(le))&&Math.abs(b-_e)<=e.EPSILON*Math.max(1,Math.abs(b),Math.abs(_e))&&Math.abs(S-pe)<=e.EPSILON*Math.max(1,Math.abs(S),Math.abs(pe))&&Math.abs(A-xe)<=e.EPSILON*Math.max(1,Math.abs(A),Math.abs(xe))&&Math.abs(C-ye)<=e.EPSILON*Math.max(1,Math.abs(C),Math.abs(ye))&&Math.abs(D-Me)<=e.EPSILON*Math.max(1,Math.abs(D),Math.abs(Me))&&Math.abs(L-Te)<=e.EPSILON*Math.max(1,Math.abs(L),Math.abs(Te))&&Math.abs(z-Ae)<=e.EPSILON*Math.max(1,Math.abs(z),Math.abs(Ae))&&Math.abs(k-et)<=e.EPSILON*Math.max(1,Math.abs(k),Math.abs(et))&&Math.abs(B-Je)<=e.EPSILON*Math.max(1,Math.abs(B),Math.abs(Je))&&Math.abs(V-xt)<=e.EPSILON*Math.max(1,Math.abs(V),Math.abs(xt))&&Math.abs(W-st)<=e.EPSILON*Math.max(1,Math.abs(W),Math.abs(st))&&Math.abs($-ct)<=e.EPSILON*Math.max(1,Math.abs($),Math.abs(ct))&&Math.abs(H-it)<=e.EPSILON*Math.max(1,Math.abs(H),Math.abs(it))&&Math.abs(ae-zt)<=e.EPSILON*Math.max(1,Math.abs(ae),Math.abs(zt))},Ye.sub=Ye.mul=Ye.ortho=Ye.perspective=void 0;
14var e=function(p,y){if(p&&p.__esModule)return p;if(p===null||n(p)!=="object"&&typeof p!="function")return{default:p};var w=i(void 0);if(w&&w.has(p))return w.get(p);var v={},b=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var S in p)if(S!=="default"&&Object.prototype.hasOwnProperty.call(p,S)){var A=b?Object.getOwnPropertyDescriptor(p,S):null;A&&(A.get||A.set)?Object.defineProperty(v,S,A):v[S]=p[S]}return v.default=p,w&&w.set(p,v),v}(ut());function i(p){if(typeof WeakMap!="function")return null;var y=new WeakMap,w=new WeakMap;return(i=function(v){return v?w:y})(p)}function s(p){return p[0]=1,p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[5]=1,p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[10]=1,p[11]=0,p[12]=0,p[13]=0,p[14]=0,p[15]=1,p}function l(p,y,w){var v=y[0],b=y[1],S=y[2],A=y[3],C=y[4],D=y[5],L=y[6],z=y[7],k=y[8],B=y[9],V=y[10],W=y[11],$=y[12],H=y[13],ae=y[14],Y=y[15],le=w[0],_e=w[1],pe=w[2],xe=w[3];return p[0]=le*v+_e*C+pe*k+xe*$,p[1]=le*b+_e*D+pe*B+xe*H,p[2]=le*S+_e*L+pe*V+xe*ae,p[3]=le*A+_e*z+pe*W+xe*Y,p[4]=(le=w[4])*v+(_e=w[5])*C+(pe=w[6])*k+(xe=w[7])*$,p[5]=le*b+_e*D+pe*B+xe*H,p[6]=le*S+_e*L+pe*V+xe*ae,p[7]=le*A+_e*z+pe*W+xe*Y,p[8]=(le=w[8])*v+(_e=w[9])*C+(pe=w[10])*k+(xe=w[11])*$,p[9]=le*b+_e*D+pe*B+xe*H,p[10]=le*S+_e*L+pe*V+xe*ae,p[11]=le*A+_e*z+pe*W+xe*Y,p[12]=(le=w[12])*v+(_e=w[13])*C+(pe=w[14])*k+(xe=w[15])*$,p[13]=le*b+_e*D+pe*B+xe*H,p[14]=le*S+_e*L+pe*V+xe*ae,p[15]=le*A+_e*z+pe*W+xe*Y,p}function a(p,y,w){var v=y[0],b=y[1],S=y[2],A=y[3],C=v+v,D=b+b,L=S+S,z=v*C,k=v*D,B=v*L,V=b*D,W=b*L,$=S*L,H=A*C,ae=A*D,Y=A*L;return p[0]=1-(V+$),p[1]=k+Y,p[2]=B-ae,p[3]=0,p[4]=k-Y,p[5]=1-(z+$),p[6]=W+H,p[7]=0,p[8]=B+ae,p[9]=W-H,p[10]=1-(z+V),p[11]=0,p[12]=w[0],p[13]=w[1],p[14]=w[2],p[15]=1,p}function h(p,y){var w=y[4],v=y[5],b=y[6],S=y[8],A=y[9],C=y[10];return p[0]=Math.hypot(y[0],y[1],y[2]),p[1]=Math.hypot(w,v,b),p[2]=Math.hypot(S,A,C),p}function m(p,y,w,v,b){var S,A=1/Math.tan(y/2);return p[0]=A/w,p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[5]=A,p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[11]=-1,p[12]=0,p[13]=0,p[15]=0,b!=null&&b!==1/0?(p[10]=(b+v)*(S=1/(v-b)),p[14]=2*b*v*S):(p[10]=-1,p[14]=-2*v),p}function g(p,y,w,v,b,S,A){var C=1/(y-w),D=1/(v-b),L=1/(S-A);return p[0]=-2*C,p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[5]=-2*D,p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[10]=2*L,p[11]=0,p[12]=(y+w)*C,p[13]=(b+v)*D,p[14]=(A+S)*L,p[15]=1,p}function x(p,y,w){return p[0]=y[0]-w[0],p[1]=y[1]-w[1],p[2]=y[2]-w[2],p[3]=y[3]-w[3],p[4]=y[4]-w[4],p[5]=y[5]-w[5],p[6]=y[6]-w[6],p[7]=y[7]-w[7],p[8]=y[8]-w[8],p[9]=y[9]-w[9],p[10]=y[10]-w[10],p[11]=y[11]-w[11],p[12]=y[12]-w[12],p[13]=y[13]-w[13],p[14]=y[14]-w[14],p[15]=y[15]-w[15],p}return Ye.perspective=m,Ye.ortho=g,Ye.mul=l,Ye.sub=x,Ye}var wi,wt={},Dt={};function Xi(){if(wi)return Dt;function n(b){return n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(S){return typeof S}:function(S){return S&&typeof Symbol=="function"&&S.constructor===Symbol&&S!==Symbol.prototype?"symbol":typeof S},n(b)}wi=1,Object.defineProperty(Dt,"__esModule",{value:!0}),Dt.create=s,Dt.clone=function(b){var S=new e.ARRAY_TYPE(3);return S[0]=b[0],S[1]=b[1],S[2]=b[2],S},Dt.length=l,Dt.fromValues=function(b,S,A){var C=new e.ARRAY_TYPE(3);return C[0]=b,C[1]=S,C[2]=A,C},Dt.copy=function(b,S){return b[0]=S[0],b[1]=S[1],b[2]=S[2],b},Dt.set=function(b,S,A,C){return b[0]=S,b[1]=A,b[2]=C,b},Dt.add=function(b,S,A){return b[0]=S[0]+A[0],b[1]=S[1]+A[1],b[2]=S[2]+A[2],b},Dt.subtract=a,Dt.multiply=h,Dt.divide=m,Dt.ceil=function(b,S){return b[0]=Math.ceil(S[0]),b[1]=Math.ceil(S[1]),b[2]=Math.ceil(S[2]),b},Dt.floor=function(b,S){return b[0]=Math.floor(S[0]),b[1]=Math.floor(S[1]),b[2]=Math.floor(S[2]),b},Dt.min=function(b,S,A){return b[0]=Math.min(S[0],A[0]),b[1]=Math.min(S[1],A[1]),b[2]=Math.min(S[2],A[2]),b},Dt.max=function(b,S,A){return b[0]=Math.max(S[0],A[0]),b[1]=Math.max(S[1],A[1]),b[2]=Math.max(S[2],A[2]),b},Dt.round=function(b,S){return b[0]=Math.round(S[0]),b[1]=Math.round(S[1]),b[2]=Math.round(S[2]),b},Dt.scale=function(b,S,A){return b[0]=S[0]*A,b[1]=S[1]*A,b[2]=S[2]*A,b},Dt.scaleAndAdd=function(b,S,A,C){return b[0]=S[0]+A[0]*C,b[1]=S[1]+A[1]*C,b[2]=S[2]+A[2]*C,b},Dt.distance=g,Dt.squaredDistance=x,Dt.squaredLength=p,Dt.negate=function(b,S){return b[0]=-S[0],b[1]=-S[1],b[2]=-S[2],b},Dt.inverse=function(b,S){return b[0]=1/S[0],b[1]=1/S[1],b[2]=1/S[2],b},Dt.normalize=function(b,S){var A=S[0],C=S[1],D=S[2],L=A*A+C*C+D*D;return L>0&&(L=1/Math.sqrt(L)),b[0]=S[0]*L,b[1]=S[1]*L,b[2]=S[2]*L,b},Dt.dot=y,Dt.cross=function(b,S,A){var C=S[0],D=S[1],L=S[2],z=A[0],k=A[1],B=A[2];return b[0]=D*B-L*k,b[1]=L*z-C*B,b[2]=C*k-D*z,b},Dt.lerp=function(b,S,A,C){var D=S[0],L=S[1],z=S[2];return b[0]=D+C*(A[0]-D),b[1]=L+C*(A[1]-L),b[2]=z+C*(A[2]-z),b},Dt.hermite=function(b,S,A,C,D,L){var z=L*L,k=z*(2*L-3)+1,B=z*(L-2)+L,V=z*(L-1),W=z*(3-2*L);return b[0]=S[0]*k+A[0]*B+C[0]*V+D[0]*W,b[1]=S[1]*k+A[1]*B+C[1]*V+D[1]*W,b[2]=S[2]*k+A[2]*B+C[2]*V+D[2]*W,b},Dt.bezier=function(b,S,A,C,D,L){var z=1-L,k=z*z,B=L*L,V=k*z,W=3*L*k,$=3*B*z,H=B*L;return b[0]=S[0]*V+A[0]*W+C[0]*$+D[0]*H,b[1]=S[1]*V+A[1]*W+C[1]*$+D[1]*H,b[2]=S[2]*V+A[2]*W+C[2]*$+D[2]*H,b},Dt.random=function(b,S){S=S||1;var A=2*e.RANDOM()*Math.PI,C=2*e.RANDOM()-1,D=Math.sqrt(1-C*C)*S;return b[0]=Math.cos(A)*D,b[1]=Math.sin(A)*D,b[2]=C*S,b},Dt.transformMat4=function(b,S,A){var C=S[0],D=S[1],L=S[2],z=A[3]*C+A[7]*D+A[11]*L+A[15];return b[0]=(A[0]*C+A[4]*D+A[8]*L+A[12])/(z=z||1),b[1]=(A[1]*C+A[5]*D+A[9]*L+A[13])/z,b[2]=(A[2]*C+A[6]*D+A[10]*L+A[14])/z,b},Dt.transformMat3=function(b,S,A){var C=S[0],D=S[1],L=S[2];return b[0]=C*A[0]+D*A[3]+L*A[6],b[1]=C*A[1]+D*A[4]+L*A[7],b[2]=C*A[2]+D*A[5]+L*A[8],b},Dt.transformQuat=function(b,S,A){var C=A[0],D=A[1],L=A[2],z=S[0],k=S[1],B=S[2],V=D*B-L*k,W=L*z-C*B,$=C*k-D*z,H=D*$-L*W,ae
14=L*V-C*$,Y=C*W-D*V,le=2*A[3];return W*=le,$*=le,ae*=2,Y*=2,b[0]=z+(V*=le)+(H*=2),b[1]=k+W+ae,b[2]=B+$+Y,b},Dt.rotateX=function(b,S,A,C){var D=[],L=[];return D[0]=S[0]-A[0],D[1]=S[1]-A[1],D[2]=S[2]-A[2],L[0]=D[0],L[1]=D[1]*Math.cos(C)-D[2]*Math.sin(C),L[2]=D[1]*Math.sin(C)+D[2]*Math.cos(C),b[0]=L[0]+A[0],b[1]=L[1]+A[1],b[2]=L[2]+A[2],b},Dt.rotateY=function(b,S,A,C){var D=[],L=[];return D[0]=S[0]-A[0],D[1]=S[1]-A[1],D[2]=S[2]-A[2],L[0]=D[2]*Math.sin(C)+D[0]*Math.cos(C),L[1]=D[1],L[2]=D[2]*Math.cos(C)-D[0]*Math.sin(C),b[0]=L[0]+A[0],b[1]=L[1]+A[1],b[2]=L[2]+A[2],b},Dt.rotateZ=function(b,S,A,C){var D=[],L=[];return D[0]=S[0]-A[0],D[1]=S[1]-A[1],D[2]=S[2]-A[2],L[0]=D[0]*Math.cos(C)-D[1]*Math.sin(C),L[1]=D[0]*Math.sin(C)+D[1]*Math.cos(C),L[2]=D[2],b[0]=L[0]+A[0],b[1]=L[1]+A[1],b[2]=L[2]+A[2],b},Dt.angle=function(b,S){var A=b[0],C=b[1],D=b[2],L=S[0],z=S[1],k=S[2],B=Math.sqrt(A*A+C*C+D*D)*Math.sqrt(L*L+z*z+k*k),V=B&&y(b,S)/B;return Math.acos(Math.min(Math.max(V,-1),1))},Dt.zero=function(b){return b[0]=0,b[1]=0,b[2]=0,b},Dt.str=function(b){return"vec3("+b[0]+", "+b[1]+", "+b[2]+")"},Dt.exactEquals=function(b,S){return b[0]===S[0]&&b[1]===S[1]&&b[2]===S[2]},Dt.equals=function(b,S){var A=b[0],C=b[1],D=b[2],L=S[0],z=S[1],k=S[2];return Math.abs(A-L)<=e.EPSILON*Math.max(1,Math.abs(A),Math.abs(L))&&Math.abs(C-z)<=e.EPSILON*Math.max(1,Math.abs(C),Math.abs(z))&&Math.abs(D-k)<=e.EPSILON*Math.max(1,Math.abs(D),Math.abs(k))},Dt.forEach=Dt.sqrLen=Dt.len=Dt.sqrDist=Dt.dist=Dt.div=Dt.mul=Dt.sub=void 0;var e=function(b,S){if(b&&b.__esModule)return b;if(b===null||n(b)!=="object"&&typeof b!="function")return{default:b};var A=i(void 0);if(A&&A.has(b))return A.get(b);var C={},D=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var L in b)if(L!=="default"&&Object.prototype.hasOwnProperty.call(b,L)){var z=D?Object.getOwnPropertyDescriptor(b,L):null;z&&(z.get||z.set)?Object.defineProperty(C,L,z):C[L]=b[L]}return C.default=b,A&&A.set(b,C),C}(ut());function i(b){if(typeof WeakMap!="function")return null;var S=new WeakMap,A=new WeakMap;return(i=function(C){return C?A:S})(b)}function s(){var b=new e.ARRAY_TYPE(3);return e.ARRAY_TYPE!=Float32Array&&(b[0]=0,b[1]=0,b[2]=0),b}function l(b){return Math.hypot(b[0],b[1],b[2])}function a(b,S,A){return b[0]=S[0]-A[0],b[1]=S[1]-A[1],b[2]=S[2]-A[2],b}function h(b,S,A){return b[0]=S[0]*A[0],b[1]=S[1]*A[1],b[2]=S[2]*A[2],b}function m(b,S,A){return b[0]=S[0]/A[0],b[1]=S[1]/A[1],b[2]=S[2]/A[2],b}function g(b,S){return Math.hypot(S[0]-b[0],S[1]-b[1],S[2]-b[2])}function x(b,S){var A=S[0]-b[0],C=S[1]-b[1],D=S[2]-b[2];return A*A+C*C+D*D}function p(b){var S=b[0],A=b[1],C=b[2];return S*S+A*A+C*C}function y(b,S){return b[0]*S[0]+b[1]*S[1]+b[2]*S[2]}Dt.sub=a,Dt.mul=h,Dt.div=m,Dt.dist=g,Dt.sqrDist=x,Dt.len=l,Dt.sqrLen=p;var w,v=(w=s(),function(b,S,A,C,D,L){var z,k;for(S||(S=3),A||(A=0),k=C?Math.min(C*S+A,b.length):b.length,z=A;z<k;z+=S)w[0]=b[z],w[1]=b[z+1],w[2]=b[z+2],D(w,w,L),b[z]=w[0],b[z+1]=w[1],b[z+2]=w[2];return b});return Dt.forEach=v,Dt}var mr,Qr,ti={};function _r(){if(mr)return ti;function n(v){return n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(b){return typeof b}:function(b){return b&&typeof Symbol=="function"&&b.constructor===Symbol&&b!==Symbol.prototype?"symbol":typeof b},n(v)}mr=1,Object.defineProperty(ti,"__esModule",{value:!0}),ti.create=s,ti.clone=function(v){var b=new e.ARRAY_TYPE(4);return b[0]=v[0],b[1]=v[1],b[2]=v[2],b[3]=v[3],b},ti.fromValues=function(v,b,S,A){var C=new e.ARRAY_TYPE(4);return C[0]=v,C[1]=b,C[2]=S,C[3]=A,C},ti.copy=function(v,b){return v[0]=b[0],v[1]=b[1],v[2]=b[2],v[3]=b[3],v},ti.set=function(v,b,S,A,C){return v[0]=b,v[1]=S,v[2]=A,v[3]=C,v},ti.add=function(v,b,S){return v[0]=b[0]+S[0],v[1]=b[1]+S[1],v[2]=b[2]+S[2],v[3]=b[3]+S[3],v},ti.subtract=l,ti.multiply=a,ti.divide=h,ti.ceil=function(v,b){return v[0]=Math.ceil(b[0]),v[1]=Math.ceil(b[1]),v[2]=Math.ceil(b[2]),v[3]=Math.ceil(b[3]),v},ti.floor=function(v,b){return v[0]=Math.floor(b[0]),v[1]=Math.floor(b[1]),v[2]=Math.floor(b[2]),v[3]=Math.floor(b[3]),v},ti.min=function(v,b,S){return v[0]=Math.min(b[0],S[0]),v[1]=Math.min(b[1],S[1]),v[2]=Math.min(b[2],S[2]),v[3]=Math.min(b[3],S[3]),v},ti.max=function(v,b,S){return v[0]=Math.max(b[0],S[0]),v[1]=Math.max(b[1],S[1]),v[2]=Math.max(b[2],S[2]),v[3]=Math.max(b[3],S[3]),v},ti.round=function(v,b){return v[0]=Math.round(b[0]),v[1]=Math.round(b[1]),v[2]=Math.round(b[2]),v[3]=Math.round(b[3]),v},ti.scale=function(v,b,S){return v[0]=b[0]*S,v[1]=b[1]*S,v[2]=b[2]*S,v[3]=b[3]*S,v},ti.scaleAndAdd=function(v,b,S,A){return v[0]=b[0]+S[0]*A,v[1]=b[1]+S[1]*A,v[2]=b[2]+S[2]*A,v[3]=b[3]+S[3]*A,v},ti.distance=m,ti.squaredDistance=g,ti.length=x,ti.squaredLength=p,ti.negate=function(v,b){return v[0]=-b[0],v[1]=-b[1],v[2]=-b[2],v[3]=-b[3],v},ti.inverse=function(v,b){return v[0]=1/b[0],v[1]=1/b[1],v[2]=1/b[2],v[3]=1/b[3],v},ti.normalize=function(v,b){var S=b[0],A=b[1],C=b[2],D=b[3],L=S*S+A*A+C*C+D*D;return L>0&&(L=1/Math.sqrt(L)),v[0]=S*L,v[1]=A*L,v[2]=C*L,v[3]=D*L,v},ti.dot=function(v,b){return v[0]*b[0]+v[1]*b[1]+v[2]*b[2]+v[3]*b[3]},ti.cross=function(v,b,S,A){var C=S[0]*A[1]-S[1]*A[0],D=S[0]*A[2]-S[2]*A[0],L=S[0]*A[3]-S[3]*A[0],z=S[1]*A[2]-S[2]*A[1],k=S[1]*A[3]-S[3]*A[1],B=S[2]*A[3]-S[3]*A[2],V=b[0],W=b[1],$=b[2],H=b[3];return v[0]=W*B-$*k+H*z,v[1]=-V*B+$*L-H*D,v[2]=V*k-W*L+H*C,v[3]=-V*z+W*D-$*C,v},ti.lerp=function(v,b,S,A){var C=b[0],D=b[1],L=b[2],z=b[3];return v[0]=C+A*(S[0]-C),v[1]=D+A*(S[1]-D),v[2]=L+A*(S[2]-L),v[3]=z+A*(S[3]-z),v},ti.random=function(v,b){var S,A,C,D,L,z;b=b||1;do L=(S=2*e.RANDOM()-1)*S+(A=2*e.RANDOM()-1)*A;while(L>=1);do z=(C=2*e.RANDOM()-1)*C+(D=2*e.RANDOM()-1)*D;while(z>=1);var k=Math.sqrt((1-L)/z);return v[0]=b*S,v[1]=b*A,v[2]=b*C*k,v[3]=b*D*k,v},ti.transformMat4=function(v,b,S){var A=b[0],C=b[1],D=b[2],L=b[3];
14return v[0]=S[0]*A+S[4]*C+S[8]*D+S[12]*L,v[1]=S[1]*A+S[5]*C+S[9]*D+S[13]*L,v[2]=S[2]*A+S[6]*C+S[10]*D+S[14]*L,v[3]=S[3]*A+S[7]*C+S[11]*D+S[15]*L,v},ti.transformQuat=function(v,b,S){var A=b[0],C=b[1],D=b[2],L=S[0],z=S[1],k=S[2],B=S[3],V=B*A+z*D-k*C,W=B*C+k*A-L*D,$=B*D+L*C-z*A,H=-L*A-z*C-k*D;return v[0]=V*B+H*-L+W*-k-$*-z,v[1]=W*B+H*-z+$*-L-V*-k,v[2]=$*B+H*-k+V*-z-W*-L,v[3]=b[3],v},ti.zero=function(v){return v[0]=0,v[1]=0,v[2]=0,v[3]=0,v},ti.str=function(v){return"vec4("+v[0]+", "+v[1]+", "+v[2]+", "+v[3]+")"},ti.exactEquals=function(v,b){return v[0]===b[0]&&v[1]===b[1]&&v[2]===b[2]&&v[3]===b[3]},ti.equals=function(v,b){var S=v[0],A=v[1],C=v[2],D=v[3],L=b[0],z=b[1],k=b[2],B=b[3];return Math.abs(S-L)<=e.EPSILON*Math.max(1,Math.abs(S),Math.abs(L))&&Math.abs(A-z)<=e.EPSILON*Math.max(1,Math.abs(A),Math.abs(z))&&Math.abs(C-k)<=e.EPSILON*Math.max(1,Math.abs(C),Math.abs(k))&&Math.abs(D-B)<=e.EPSILON*Math.max(1,Math.abs(D),Math.abs(B))},ti.forEach=ti.sqrLen=ti.len=ti.sqrDist=ti.dist=ti.div=ti.mul=ti.sub=void 0;var e=function(v,b){if(v&&v.__esModule)return v;if(v===null||n(v)!=="object"&&typeof v!="function")return{default:v};var S=i(void 0);if(S&&S.has(v))return S.get(v);var A={},C=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var D in v)if(D!=="default"&&Object.prototype.hasOwnProperty.call(v,D)){var L=C?Object.getOwnPropertyDescriptor(v,D):null;L&&(L.get||L.set)?Object.defineProperty(A,D,L):A[D]=v[D]}return A.default=v,S&&S.set(v,A),A}(ut());function i(v){if(typeof WeakMap!="function")return null;var b=new WeakMap,S=new WeakMap;return(i=function(A){return A?S:b})(v)}function s(){var v=new e.ARRAY_TYPE(4);return e.ARRAY_TYPE!=Float32Array&&(v[0]=0,v[1]=0,v[2]=0,v[3]=0),v}function l(v,b,S){return v[0]=b[0]-S[0],v[1]=b[1]-S[1],v[2]=b[2]-S[2],v[3]=b[3]-S[3],v}function a(v,b,S){return v[0]=b[0]*S[0],v[1]=b[1]*S[1],v[2]=b[2]*S[2],v[3]=b[3]*S[3],v}function h(v,b,S){return v[0]=b[0]/S[0],v[1]=b[1]/S[1],v[2]=b[2]/S[2],v[3]=b[3]/S[3],v}function m(v,b){return Math.hypot(b[0]-v[0],b[1]-v[1],b[2]-v[2],b[3]-v[3])}function g(v,b){var S=b[0]-v[0],A=b[1]-v[1],C=b[2]-v[2],D=b[3]-v[3];return S*S+A*A+C*C+D*D}function x(v){return Math.hypot(v[0],v[1],v[2],v[3])}function p(v){var b=v[0],S=v[1],A=v[2],C=v[3];return b*b+S*S+A*A+C*C}ti.sub=l,ti.mul=a,ti.div=h,ti.dist=m,ti.sqrDist=g,ti.len=x,ti.sqrLen=p;var y,w=(y=s(),function(v,b,S,A,C,D){var L,z;for(b||(b=4),S||(S=0),z=A?Math.min(A*b+S,v.length):v.length,L=S;L<z;L+=b)y[0]=v[L],y[1]=v[L+1],y[2]=v[L+2],y[3]=v[L+3],C(y,y,D),v[L]=y[0],v[L+1]=y[1],v[L+2]=y[2],v[L+3]=y[3];return v});return ti.forEach=w,ti}function Gr(){if(Qr)return wt;function n(Y){return n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(le){return typeof le}:function(le){return le&&typeof Symbol=="function"&&le.constructor===Symbol&&le!==Symbol.prototype?"symbol":typeof le},n(Y)}Qr=1,Object.defineProperty(wt,"__esModule",{value:!0}),wt.create=m,wt.identity=function(Y){return Y[0]=0,Y[1]=0,Y[2]=0,Y[3]=1,Y},wt.setAxisAngle=g,wt.getAxisAngle=function(Y,le){var _e=2*Math.acos(le[3]),pe=Math.sin(_e/2);return pe>e.EPSILON?(Y[0]=le[0]/pe,Y[1]=le[1]/pe,Y[2]=le[2]/pe):(Y[0]=1,Y[1]=0,Y[2]=0),_e},wt.getAngle=function(Y,le){var _e=S(Y,le);return Math.acos(2*_e*_e-1)},wt.multiply=x,wt.rotateX=function(Y,le,_e){_e*=.5;var pe=le[0],xe=le[1],ye=le[2],Me=le[3],Te=Math.sin(_e),Ae=Math.cos(_e);return Y[0]=pe*Ae+Me*Te,Y[1]=xe*Ae+ye*Te,Y[2]=ye*Ae-xe*Te,Y[3]=Me*Ae-pe*Te,Y},wt.rotateY=function(Y,le,_e){_e*=.5;var pe=le[0],xe=le[1],ye=le[2],Me=le[3],Te=Math.sin(_e),Ae=Math.cos(_e);return Y[0]=pe*Ae-ye*Te,Y[1]=xe*Ae+Me*Te,Y[2]=ye*Ae+pe*Te,Y[3]=Me*Ae-xe*Te,Y},wt.rotateZ=function(Y,le,_e){_e*=.5;var pe=le[0],xe=le[1],ye=le[2],Me=le[3],Te=Math.sin(_e),Ae=Math.cos(_e);return Y[0]=pe*Ae+xe*Te,Y[1]=xe*Ae-pe*Te,Y[2]=ye*Ae+Me*Te,Y[3]=Me*Ae-ye*Te,Y},wt.calculateW=function(Y,le){var _e=le[0],pe=le[1],xe=le[2];return Y[0]=_e,Y[1]=pe,Y[2]=xe,Y[3]=Math.sqrt(Math.abs(1-_e*_e-pe*pe-xe*xe)),Y},wt.exp=p,wt.ln=y,wt.pow=function(Y,le,_e){return y(Y,le),b(Y,Y,_e),p(Y,Y),Y},wt.slerp=w,wt.random=function(Y){var le=e.RANDOM(),_e=e.RANDOM(),pe=e.RANDOM(),xe=Math.sqrt(1-le),ye=Math.sqrt(le);return Y[0]=xe*Math.sin(2*Math.PI*_e),Y[1]=xe*Math.cos(2*Math.PI*_e),Y[2]=ye*Math.sin(2*Math.PI*pe),Y[3]=ye*Math.cos(2*Math.PI*pe),Y},wt.invert=function(Y,le){var _e=le[0],pe=le[1],xe=le[2],ye=le[3],Me=_e*_e+pe*pe+xe*xe+ye*ye,Te=
14Me?1/Me:0;return Y[0]=-_e*Te,Y[1]=-pe*Te,Y[2]=-xe*Te,Y[3]=ye*Te,Y},wt.conjugate=function(Y,le){return Y[0]=-le[0],Y[1]=-le[1],Y[2]=-le[2],Y[3]=le[3],Y},wt.fromMat3=v,wt.fromEuler=function(Y,le,_e,pe){var xe=.5*Math.PI/180;le*=xe,_e*=xe,pe*=xe;var ye=Math.sin(le),Me=Math.cos(le),Te=Math.sin(_e),Ae=Math.cos(_e),et=Math.sin(pe),Je=Math.cos(pe);return Y[0]=ye*Ae*Je-Me*Te*et,Y[1]=Me*Te*Je+ye*Ae*et,Y[2]=Me*Ae*et-ye*Te*Je,Y[3]=Me*Ae*Je+ye*Te*et,Y},wt.str=function(Y){return"quat("+Y[0]+", "+Y[1]+", "+Y[2]+", "+Y[3]+")"},wt.setAxes=wt.sqlerp=wt.rotationTo=wt.equals=wt.exactEquals=wt.normalize=wt.sqrLen=wt.squaredLength=wt.len=wt.length=wt.lerp=wt.dot=wt.scale=wt.mul=wt.add=wt.set=wt.copy=wt.fromValues=wt.clone=void 0;var e=h(ut()),i=h(tt()),s=h(Xi()),l=h(_r());function a(Y){if(typeof WeakMap!="function")return null;var le=new WeakMap,_e=new WeakMap;return(a=function(pe){return pe?_e:le})(Y)}function h(Y,le){if(Y&&Y.__esModule)return Y;if(Y===null||n(Y)!=="object"&&typeof Y!="function")return{default:Y};var _e=a(le);if(_e&&_e.has(Y))return _e.get(Y);var pe={},xe=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var ye in Y)if(ye!=="default"&&Object.prototype.hasOwnProperty.call(Y,ye)){var Me=xe?Object.getOwnPropertyDescriptor(Y,ye):null;Me&&(Me.get||Me.set)?Object.defineProperty(pe,ye,Me):pe[ye]=Y[ye]}return pe.default=Y,_e&&_e.set(Y,pe),pe}function m(){var Y=new e.ARRAY_TYPE(4);return e.ARRAY_TYPE!=Float32Array&&(Y[0]=0,Y[1]=0,Y[2]=0),Y[3]=1,Y}function g(Y,le,_e){_e*=.5;var pe=Math.sin(_e);return Y[0]=pe*le[0],Y[1]=pe*le[1],Y[2]=pe*le[2],Y[3]=Math.cos(_e),Y}function x(Y,le,_e){var pe=le[0],xe=le[1],ye=le[2],Me=le[3],Te=_e[0],Ae=_e[1],et=_e[2],Je=_e[3];return Y[0]=pe*Je+Me*Te+xe*et-ye*Ae,Y[1]=xe*Je+Me*Ae+ye*Te-pe*et,Y[2]=ye*Je+Me*et+pe*Ae-xe*Te,Y[3]=Me*Je-pe*Te-xe*Ae-ye*et,Y}function p(Y,le){var _e=le[0],pe=le[1],xe=le[2],ye=le[3],Me=Math.sqrt(_e*_e+pe*pe+xe*xe),Te=Math.exp(ye),Ae=Me>0?Te*Math.sin(Me)/Me:0;return Y[0]=_e*Ae,Y[1]=pe*Ae,Y[2]=xe*Ae,Y[3]=Te*Math.cos(Me),Y}function y(Y,le){var _e=le[0],pe=le[1],xe=le[2],ye=le[3],Me=Math.sqrt(_e*_e+pe*pe+xe*xe),Te=Me>0?Math.atan2(Me,ye)/Me:0;return Y[0]=_e*Te,Y[1]=pe*Te,Y[2]=xe*Te,Y[3]=.5*Math.log(_e*_e+pe*pe+xe*xe+ye*ye),Y}function w(Y,le,_e,pe){var xe,ye,Me,Te,Ae,et=le[0],Je=le[1],xt=le[2],st=le[3],ct=_e[0],it=_e[1],zt=_e[2],_t=_e[3];return(ye=et*ct+Je*it+xt*zt+st*_t)<0&&(ye=-ye,ct=-ct,it=-it,zt=-zt,_t=-_t),1-ye>e.EPSILON?(xe=Math.acos(ye),Me=Math.sin(xe),Te=Math.sin((1-pe)*xe)/Me,Ae=Math.sin(pe*xe)/Me):(Te=1-pe,Ae=pe),Y[0]=Te*et+Ae*ct,Y[1]=Te*Je+Ae*it,Y[2]=Te*xt+Ae*zt,Y[3]=Te*st+Ae*_t,Y}function v(Y,le){var _e,pe=le[0]+le[4]+le[8];if(pe>0)_e=Math.sqrt(pe+1),Y[3]=.5*_e,Y[0]=(le[5]-le[7])*(_e=.5/_e),Y[1]=(le[6]-le[2])*_e,Y[2]=(le[1]-le[3])*_e;else{var xe=0;le[4]>le[0]&&(xe=1),le[8]>le[3*xe+xe]&&(xe=2);var ye=(xe+1)%3,Me=(xe+2)%3;_e=Math.sqrt(le[3*xe+xe]-le[3*ye+ye]-le[3*Me+Me]+1),Y[xe]=.5*_e,Y[3]=(le[3*ye+Me]-le[3*Me+ye])*(_e=.5/_e),Y[ye]=(le[3*ye+xe]+le[3*xe+ye])*_e,Y[Me]=(le[3*Me+xe]+le[3*xe+Me])*_e}return Y}wt.clone=l.clone,wt.fromValues=l.fromValues,wt.copy=l.copy,wt.set=l.set,wt.add=l.add,wt.mul=x;var b=l.scale;wt.scale=b;var S=l.dot;wt.dot=S,wt.lerp=l.lerp;var A=l.length;wt.length=A,wt.len=A;var C=l.squaredLength;wt.squaredLength=C,wt.sqrLen=C;var D=l.normalize;wt.normalize=D,wt.exactEquals=l.exactEquals,wt.equals=l.equals;var L,z,k,B=(L=s.create(),z=s.fromValues(1,0,0),k=s.fromValues(0,1,0),function(Y,le,_e){var pe=s.dot(le,_e);return pe<-.999999?(s.cross(L,z,le),s.len(L)<1e-6&&s.cross(L,k,le),s.normalize(L,L),g(Y,L,Math.PI),Y):pe>.999999?(Y[0]=0,Y[1]=0,Y[2]=0,Y[3]=1,Y):(s.cross(L,le,_e),Y[0]=L[0],Y[1]=L[1],Y[2]=L[2],Y[3]=1+pe,D(Y,Y))});wt.rotationTo=B;var V,W,$=(V=m(),W=m(),function(Y,le,_e,pe,xe,ye){return w(V,le,xe,ye),w(W,_e,pe,ye),w(Y,V,W,2*ye*(1-ye)),Y});wt.sqlerp=$;var H,ae=(H=i.create(),function(Y,le,_e,pe){return H[0]=_e[0],H[3]=_e[1],H[6]=_e[2],H[1]=pe[0],H[4]=pe[1],H[7]=pe[2],H[2]=-le[0],H[5]=-le[1],H[8]=-le[2],D(Y,v(Y,H))});return wt.setAxes=ae,wt}var Hn,ni={};function en(){if(Hn)return ni;function n(w){return n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(v){return typeof v}:function(v){return v&&typeof Symbol=="function"&&v.constructor===Symbol&&v!==Symbol.prototype?"symbol":typeof v},n(w)}Hn=1,Object.defineProperty(ni,"__esModule",{value:!0}),ni.create=function(){var w=new e.ARRAY_TYPE(8);return e.ARRAY_TYPE!=Float32Array&&(w[0]=0,w[1]=0,w[2]=0,w[4]=0,w[5]=0,w[6]=0,w[7]=0),w[3]=1,w},ni.clone=function(w){var v=new e.ARRAY_TYPE(8);return v[0]=w[0],v[1]=w[1],v[2]=w[2],v[3]=w[3],v[4]=w[4],v[5]=w[5],v[6]=w[6],v[7]=w[7],v},ni.fromValues=function(w,v,b,S,A,C,D,L){var z=new e.ARRAY_TYPE(8);return z[0]=w,z[1]=v,z[2]=b,z[3]=S,z[4]=A,z[5]=C,z[6]=D,z[7]=L,z},ni.fromRotationTranslationValues=function(w,v,b,S,A,C,D){var L=new e.ARRAY_TYPE(8);L[0]=w,L[1]=v,L[2]=b,L[3]=S;var z=.5*A,k=.5*C,B=.5*D;return L[4]=z*S+k*b-B*v,L[5]=k*S+B*w-z*b,L[6]=B*S+z*v-k*w,L[7]=-z*w-k*v-B*b,L},ni.fromRotationTranslation=h,ni.fromTranslation=function(w,v){return w[0]=0,w[1]=0,w[2]=0,w[3]=1,w[4]=.5*v[0],w[5]=.5*v[1],w[6]=.5*v[2],w[7]=0,w},ni.fromRotation=function(w,v){return w[0]=v[0],w[1]=v[1],w[2]=v[2],w[3]=v[3],w[4]=0,w[5]=0,w[6]=0,w[7]=0,w},ni.fromMat4=function(w,v){var b=i.create();s.getRotation(b,v);var S=new e.ARRAY_TYPE(3);return s.getTranslation(S,v),h(w,b,S),w},ni.copy=m,ni.identity=function(w){return w[0]=0,w[1]=0,w[2]=0,w[3]=1,w[4]=0,w[5]=0,w[6]=0,w[7]=0,w},ni.set=function(w,v,b,S,A,C,D,L,z){return w[0]=v,w[1]=b,w[2]=S,w[3]=A,w[4]=C,w[5]=D,w[6]=L,w[7]=z,w},ni.getDual=function(w,v){return w[0]=v[4],w[1]=v[5],w[2]=v[6],w[3]=v[7],w},ni.setDual=function(w,v){return w[4]=v[0],w[5]=v[1],w[6]=v[2],w[7]=v[3],w},ni.getTranslation=function(w,v){var b=v[4],S=v[5],A=v[6],C=v[7],D=-v[0],L=-v[1],z=-v[2],k=v[3];return w[0]=2*(b*k+C*D+S*z-A*L),w[1]=2*(S*k+C*L+A*D-b*z),w[2]=2*(A*k+C*z+b*L-S*D),w},ni.translate=function(w,v,b){var S=v[0],A=v[1],C=v[2],D=v[3],L=.5*b[0],z=.5*b[1],k=.5*b[2],B=v[4],V=v[5],W=v[6],$=v[7];return w[0]=S,w[1]=A,w[2]=C,w[3]=D,w[4]=D*L+A*k-C*z+B,w[5]=D*z+C*L-S*k+V,w[6]=D*k+S*z-A*L+W,w[7]=-S*L-A*z-C*k+$,w},ni.rotateX=function(w,v,b){var S=-v[0],A=-v[1],C=-v[2],D=v[3],L=v[4],z=v[5],k=v[6],B=v[7],V=L*D+B*S+z*C-k*A,W=z*D+B*A+k*S-L*C,$=k*D+B*C+L*A-z*S,H=B*D-L*S-z*A-k*C;return i.rotateX(w,v,b),w[4]=V*(D=w[3])+H*(S=w[0])+W*(C=w[2])-$*(A=w[1]),w[5]=W*D+H*A+$*S-V*C,w[6]=$*D+H*C+V*A-W*S,w[7]=H*D-V*S-W*A-$*C,w},ni.rotateY=function(w,v,b){var S=-v[0],A=-v[1],C=-v[2],D=v[3],L=v[4],z=v[5],k=v[6],B=v[7],V=L*D+B*S+z*C-k*A,W=z*D+B*A+k*S-L*C,$=k*D+B*C+L*A-z*S,H=B*D-L*S-z*A-k*C;return i.rotateY(w,v,b),w[4]=V*(D=w[3])+H*(S=w[0])+W*(C=w[2])-$*(A=w[1]),w[5]=W*D+H*A+$*S-V*C,w[6]=$*D+H*C+V*A-W*S,w[7]=H*D-V*S-W*A-$*C,w},ni.rotateZ=function(w,v,b){var S=-v[0],A=-v[1],C=-v[2],D=v[3],L=v[4],z=v[5],k=v[6],B=v[7],V=L*D+B*S+z*C-k*A,W=z*D+B*A+k*S-L*C,$=k*D+B*C+L*A-z*S,H=B*D-L*S-z*A-k*C;return i.rotateZ(w,v,b),w[4]=V*(D=w[3])+H*(S=w[0])+W*(C=w[2])-$*(A=w[1]),w[5]=W*D+H*A+$*S-V*C,w[6]=$*D+H*C+V*A-W*S,w[7]=H*D-V*S-W*A-$*C,w},ni.rotateByQuatAppend=function(w,v,b){var S=b[0],A=b[1],C=b[2],D=b[3],L=v[0],z=v[1],k=v[2],B=v[3];return w[0]=L*D+B*S+z*C-k*A,w[1]=z*D+B*A+k*S-L*C,w[2]=k*D+B*C+L*A-z*S,w[3]=B*D-L*S-z*A-k*C,w[4]=(L=v[4])*D+(B=v[7])*S+(z=v[5])*C-(k=v[6])*A,w[5]=z*D+B*A+k*S-L*C,w[6]=k*D+B*C+L*A-z*S,w[7]=B*D-L*S-z*A-k*C,w},ni.rotateByQuatPrepend=function(w,v,b){var S=v[0],A=v[1],C=v[2],D=v[3],L=b[0],z=b[1],k=b[2],B=b[3];return w[0]=S*B+D*L+A*k-C*z,w[1]=A*B+D*z+C*L-S*k,w[2]=C*B+D*k+S*z-A*L,w[3]=D*B-S*L-A*z-C*k,w[4]=S*(B=b[7])+D*(L=b[4])+A*(k=b[6])-C*(z=b[5]),w[5]=A*B+D*z+C*L-S*k,w[6]=C*
14B+D*k+S*z-A*L,w[7]=D*B-S*L-A*z-C*k,w},ni.rotateAroundAxis=function(w,v,b,S){if(Math.abs(S)<e.EPSILON)return m(w,v);var A=Math.hypot(b[0],b[1],b[2]);S*=.5;var C=Math.sin(S),D=C*b[0]/A,L=C*b[1]/A,z=C*b[2]/A,k=Math.cos(S),B=v[0],V=v[1],W=v[2],$=v[3];w[0]=B*k+$*D+V*z-W*L,w[1]=V*k+$*L+W*D-B*z,w[2]=W*k+$*z+B*L-V*D,w[3]=$*k-B*D-V*L-W*z;var H=v[4],ae=v[5],Y=v[6],le=v[7];return w[4]=H*k+le*D+ae*z-Y*L,w[5]=ae*k+le*L+Y*D-H*z,w[6]=Y*k+le*z+H*L-ae*D,w[7]=le*k-H*D-ae*L-Y*z,w},ni.add=function(w,v,b){return w[0]=v[0]+b[0],w[1]=v[1]+b[1],w[2]=v[2]+b[2],w[3]=v[3]+b[3],w[4]=v[4]+b[4],w[5]=v[5]+b[5],w[6]=v[6]+b[6],w[7]=v[7]+b[7],w},ni.multiply=g,ni.scale=function(w,v,b){return w[0]=v[0]*b,w[1]=v[1]*b,w[2]=v[2]*b,w[3]=v[3]*b,w[4]=v[4]*b,w[5]=v[5]*b,w[6]=v[6]*b,w[7]=v[7]*b,w},ni.lerp=function(w,v,b,S){var A=1-S;return x(v,b)<0&&(S=-S),w[0]=v[0]*A+b[0]*S,w[1]=v[1]*A+b[1]*S,w[2]=v[2]*A+b[2]*S,w[3]=v[3]*A+b[3]*S,w[4]=v[4]*A+b[4]*S,w[5]=v[5]*A+b[5]*S,w[6]=v[6]*A+b[6]*S,w[7]=v[7]*A+b[7]*S,w},ni.invert=function(w,v){var b=y(v);return w[0]=-v[0]/b,w[1]=-v[1]/b,
14w[2]=-v[2]/b,w[3]=v[3]/b,w[4]=-v[4]/b,w[5]=-v[5]/b,w[6]=-v[6]/b,w[7]=v[7]/b,w},ni.conjugate=function(w,v){return w[0]=-v[0],w[1]=-v[1],w[2]=-v[2],w[3]=v[3],w[4]=-v[4],w[5]=-v[5],w[6]=-v[6],w[7]=v[7],w},ni.normalize=function(w,v){var b=y(v);if(b>0){b=Math.sqrt(b);var S=v[0]/b,A=v[1]/b,C=v[2]/b,D=v[3]/b,L=v[4],z=v[5],k=v[6],B=v[7],V=S*L+A*z+C*k+D*B;w[0]=S,w[1]=A,w[2]=C,w[3]=D,w[4]=(L-S*V)/b,w[5]=(z-A*V)/b,w[6]=(k-C*V)/b,w[7]=(B-D*V)/b}return w},ni.str=function(w){return"quat2("+w[0]+", "+w[1]+", "+w[2]+", "+w[3]+", "+w[4]+", "+w[5]+", "+w[6]+", "+w[7]+")"},ni.exactEquals=function(w,v){return w[0]===v[0]&&w[1]===v[1]&&w[2]===v[2]&&w[3]===v[3]&&w[4]===v[4]&&w[5]===v[5]&&w[6]===v[6]&&w[7]===v[7]},ni.equals=function(w,v){var b=w[0],S=w[1],A=w[2],C=w[3],D=w[4],L=w[5],z=w[6],k=w[7],B=v[0],V=v[1],W=v[2],$=v[3],H=v[4],ae=v[5],Y=v[6],le=v[7];return Math.abs(b-B)<=e.EPSILON*Math.max(1,Math.abs(b),Math.abs(B))&&Math.abs(S-V)<=e.EPSILON*Math.max(1,Math.abs(S),Math.abs(V))&&Math.abs(A-W)<=e.EPSILON*Math.max(1,Math.abs(A),Math.abs(W))&&Math.abs(C-$)<=e.EPSILON*Math.max(1,Math.abs(C),Math.abs($))&&Math.abs(D-H)<=e.EPSILON*Math.max(1,Math.abs(D),Math.abs(H))&&Math.abs(L-ae)<=e.EPSILON*Math.max(1,Math.abs(L),Math.abs(ae))&&Math.abs(z-Y)<=e.EPSILON*Math.max(1,Math.abs(z),Math.abs(Y))&&Math.abs(k-le)<=e.EPSILON*Math.max(1,Math.abs(k),Math.abs(le))},ni.sqrLen=ni.squaredLength=ni.len=ni.length=ni.dot=ni.mul=ni.setReal=ni.getReal=void 0;var e=a(ut()),i=a(Gr()),s=a(Bt());function l(w){if(typeof WeakMap!="function")return null;var v=new WeakMap,b=new WeakMap;return(l=function(S){return S?b:v})(w)}function a(w,v){if(w&&w.__esModule)return w;if(w===null||n(w)!=="object"&&typeof w!="function")return{default:w};var b=l(v);if(b&&b.has(w))return b.get(w);var S={},A=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var C in w)if(C!=="default"&&Object.prototype.hasOwnProperty.call(w,C)){var D=A?Object.getOwnPropertyDescriptor(w,C):null;D&&(D.get||D.set)?Object.defineProperty(S,C,D):S[C]=w[C]}return S.default=w,b&&b.set(w,S),S}function h(w,v,b){var S=.5*b[0],A=.5*b[1],C=.5*b[2],D=v[0],L=v[1],z=v[2],k=v[3];return w[0]=D,w[1]=L,w[2]=z,w[3]=k,w[4]=S*k+A*z-C*L,w[5]=A*k+C*D-S*z,w[6]=C*k+S*L-A*D,w[7]=-S*D-A*L-C*z,w}function m(w,v){return w[0]=v[0],w[1]=v[1],w[2]=v[2],w[3]=v[3],w[4]=v[4],w[5]=v[5],w[6]=v[6],w[7]=v[7],w}function g(w,v,b){var S=v[0],A=v[1],C=v[2],D=v[3],L=b[4],z=b[5],k=b[6],B=b[7],V=v[4],W=v[5],$=v[6],H=v[7],ae=b[0],Y=b[1],le=b[2],_e=b[3];return w[0]=S*_e+D*ae+A*le-C*Y,w[1]=A*_e+D*Y+C*ae-S*le,w[2]=C*_e+D*le+S*Y-A*ae,w[3]=D*_e-S*ae-A*Y-C*le,w[4]=S*B+D*L+A*k-C*z+V*_e+H*ae+W*le-$*Y,w[5]=A*B+D*z+C*L-S*k+W*_e+H*Y+$*ae-V*le,w[6]=C*B+D*k+S*z-A*L+$*_e+H*le+V*Y-W*ae,w[7]=D*B-S*L-A*z-C*k+H*_e-V*ae-W*Y-$*le,w}ni.getReal=i.copy,ni.setReal=i.copy,ni.mul=g;var x=i.dot;ni.dot=x;var p=i.length;ni.length=p,ni.len=p;var y=i.squaredLength;return ni.squaredLength=y,ni.sqrLen=y,ni}var Rs,Ln,Zt={};function Mo(){if(Rs)return Zt;function n(v){return n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(b){return typeof b}:function(b){return b&&typeof Symbol=="function"&&b.constructor===Symbol&&b!==Symbol.prototype?"symbol":typeof b},n(v)}Rs=1,Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.create=s,Zt.clone=function(v){var b=new e.ARRAY_TYPE(2);return b[0]=v[0],b[1]=v[1],b},Zt.fromValues=function(v,b){var S=new e.ARRAY_TYPE(2);return S[0]=v,S[1]=b,S},Zt.copy=function(v,b){return v[0]=b[0],v[1]=b[1],v},Zt.set=function(v,b,S){return v[0]=b,v[1]=S,v},Zt.add=function(v,b,S){return v[0]=b[0]+S[0],v[1]=b[1]+S[1],v},Zt.subtract=l,Zt.multiply=a,Zt.divide=h,Zt.ceil=function(v,b){return v[0]=Math.ceil(b[0]),v[1]=Math.ceil(b[1]),v},Zt.floor=function(v,b){return v[0]=Math.floor(b[0]),v[1]=Math.floor(b[1]),v},Zt.min=function(v,b,S){return v[0]=Math.min(b[0],S[0]),v[1]=Math.min(b[1],S[1]),v},Zt.max=function(v,b,S){return v[0]=Math.max(b[0],S[0]),v[1]=Math.max(b[1],S[1]),v},Zt.round=function(v,b){return v[0]=Math.round(b[0]),v[1]=Math.round(b[1]),v},Zt.scale=function(v,b,S){return v[0]=b[0]*S,v[1]=b[1]*S,v},Zt.scaleAndAdd=function(v,b,S,A){return v[0]=b[0]+S[0]*A,v[1]=b[1]+S[1]*A,v},Zt.distance=m,Zt.squaredDistance=g,Zt.length=x,Zt.squaredLength=p,Zt.negate=function(v,b){return v[0]=-b[0],v[1]=-b[1],v},Zt.inverse=function(v,b){return v[0]=1/b[0],v[1]=1/b[1],v},Zt.normalize=function(v,b){var S=b[0],A=b[1],C=S*S+A*A;return C>0&&(C=1/Math.sqrt(C)),v[0]=b[0]*C,v[1]=b[1]*C,v},Zt.dot=function(v,b){return v[0]*b[0]+v[1]*b[1]},Zt.cross=function(v,b,S){var A=b[0]*S[1]-b[1]*S[0];return v[0]=v[1]=0,v[2]=A,v},Zt.lerp=function(v,b,S,A){var C=b[0],D=b[1];return v[0]=C+A*(S[0]-C),v[1]=D+A*(S[1]-D),v},Zt.random=function(v,b){b=b||1;var S=2*e.RANDOM()*Math.PI;return v[0]=Math.cos(S)*b,v[1]=Math.sin(S)*b,v},Zt.transformMat2=function(v,b,S){var A=b[0],C=b[1];return v[0]=S[0]*A+S[2]*C,v[1]=S[1]*A+S[3]*C,v},Zt.transformMat2d=function(v,b,S){var A=b[0],C=b[1];return v[0]=S[0]*A+S[2]*C+S[4],v[1]=S[1]*A+S[3]*C+S[5],v},Zt.transformMat3=function(v,b,S){var A=b[0],C=b[1];return v[0]=S[0]*A+S[3]*C+S[6],v[1]=S[1]*A+S[4]*C+S[7],v},Zt.transformMat4=function(v,b,S){var A=b[0],C=b[1];return v[0]=S[0]*A+S[4]*C+S[12],v[1]=S[1]*A+S[5]*C+S[13],v},Zt.rotate=function(v,b,S,A){var C=b[0]-S[0],D=b[1]-S[1],L=Math.sin(A),z=Math.cos(A);return v[0]=C*z-D*L+S[0],v[1]=C*L+D*z+S[1],v},Zt.angle=function(v,b){var S=v[0],A=v[1],C=b[0],D=b[1],L=Math.sqrt(S*S+A*A)*Math.sqrt(C*C+D*D);return Math.acos(Math.min(Math.max(L&&(S*C+A*D)/L,-1),1))},Zt.zero=function(v){return v[0]=0,v[1]=0,v},Zt.str=function(v){return"vec2("+v[0]+", "+v[1]+")"},Zt.exactEquals=function(v,b){return v[0]===b[0]&&v[1]===b[1]},Zt.equals=function(v,b){var S=v[0],A=v[1],C=b[0],D=b[1];return Math.abs(S-C)<=e.EPSILON*Math.max(1,Math.abs(S),Math.abs(C))&&Math.abs(A-D)<=e.EPSILON*Math.max(1,Math.abs(A),Math.abs(D))},Zt.forEach=Zt.sqrLen=Zt.sqrDist=Zt.dist=Zt.div=Zt.mul=Zt.sub=Zt.len=void 0;
14var e=function(v,b){if(v&&v.__esModule)return v;if(v===null||n(v)!=="object"&&typeof v!="function")return{default:v};var S=i(void 0);if(S&&S.has(v))return S.get(v);var A={},C=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var D in v)if(D!=="default"&&Object.prototype.hasOwnProperty.call(v,D)){var L=C?Object.getOwnPropertyDescriptor(v,D):null;L&&(L.get||L.set)?Object.defineProperty(A,D,L):A[D]=v[D]}return A.default=v,S&&S.set(v,A),A}(ut());function i(v){if(typeof WeakMap!="function")return null;var b=new WeakMap,S=new WeakMap;return(i=function(A){return A?S:b})(v)}function s(){var v=new e.ARRAY_TYPE(2);return e.ARRAY_TYPE!=Float32Array&&(v[0]=0,v[1]=0),v}function l(v,b,S){return v[0]=b[0]-S[0],v[1]=b[1]-S[1],v}function a(v,b,S){return v[0]=b[0]*S[0],v[1]=b[1]*S[1],v}function h(v,b,S){return v[0]=b[0]/S[0],v[1]=b[1]/S[1],v}function m(v,b){return Math.hypot(b[0]-v[0],b[1]-v[1])}function g(v,b){var S=b[0]-v[0],A=b[1]-v[1];return S*S+A*A}function x(v){return Math.hypot(v[0],v[1])}function p(v){var b=v[0],S=v[1];return b*b+S*S}Zt.len=x,Zt.sub=l,Zt.mul=a,Zt.div=h,Zt.dist=m,Zt.sqrDist=g,Zt.sqrLen=p;var y,w=(y=s(),function(v,b,S,A,C,D){var L,z;for(b||(b=2),S||(S=0),z=A?Math.min(A*b+S,v.length):v.length,L=S;L<z;L+=b)y[0]=v[L],y[1]=v[L+1],C(y,y,D),v[L]=y[0],v[L+1]=y[1];return v});return Zt.forEach=w,Zt}function zs(){if(Ln)return Ge;function n(v){return n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(b){return typeof b}:function(b){return b&&typeof Symbol=="function"&&b.constructor===Symbol&&b!==Symbol.prototype?"symbol":typeof b},n(v)}Ln=1,Object.defineProperty(Ge,"__esModule",{value:!0}),Ge.vec4=Ge.vec3=Ge.vec2=Ge.quat2=Ge.quat=Ge.mat4=Ge.mat3=Ge.mat2d=Ge.mat2=Ge.glMatrix=void 0;var e=w(ut());Ge.glMatrix=e;var i=w(ne());Ge.mat2=i;var s=w(Ct());Ge.mat2d=s;var l=w(tt());Ge.mat3=l;var a=w(Bt());Ge.mat4=a;var h=w(Gr());Ge.quat=h;var m=w(en());Ge.quat2=m;var g=w(Mo());Ge.vec2=g;var x=w(Xi());Ge.vec3=x;var p=w(_r());function y(v){if(typeof WeakMap!="function")return null;var b=new WeakMap,S=new WeakMap;return(y=function(A){return A?S:b})(v)}function w(v,b){if(v&&v.__esModule)return v;if(v===null||n(v)!=="object"&&typeof v!="function")return{default:v};var S=y(b);if(S&&S.has(v))return S.get(v);var A={},C=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var D in v)if(D!=="default"&&Object.prototype.hasOwnProperty.call(v,D)){var L=C?Object.getOwnPropertyDescriptor(v,D):null;L&&(L.get||L.set)?Object.defineProperty(A,D,L):A[D]=v[D]}return A.default=v,S&&S.set(v,A),A}return Ge.vec4=p,Ge}var Br,Ni,$r,bn,X=zs(),ro=function(){if(Ni)return Br;function n(e,i,s,l){this.cx=3*e,this.bx=3*(s-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(l-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=s,this.p2y=l}return Ni=1,Br=n,n.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(i===void 0&&(i=1e-6),e<0)return 0;if(e>1)return 1;for(var s=e,l=0;l<8;l++){var a=this.sampleCurveX(s)-e;if(Math.abs(a)<i)return s;var h=this.sampleCurveDerivativeX(s);if(Math.abs(h)<1e-6)break;s-=a/h}var m=0,g=1;for(s=e,l=0;l<20&&(a=this.sampleCurveX(s),!(Math.abs(a-e)<i));l++)e>a?m=s:g=s,s=.5*(g-m)+m;return s},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},Br}(),Ls=Ce(ro);function Ds(){if(bn)return $r;function n(e,i){this.x=e,this.y=i}return bn=1,$r=n,n.prototype={clone:function(){return new n(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,i){return this.clone()._rotateAround(e,i)},matMult:function(e){return this.clone()._matMult(e)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var i=e.x-this.x,s=e.y-this.y;return i*i+s*s},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,i){return Math.atan2(this.x*i-this.y*e,this.x*e+this.y*i)},_matMult:function(e){var i=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=i,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this}
14,_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var i=Math.cos(e),s=Math.sin(e),l=s*this.x+i*this.y;return this.x=i*this.x-s*this.y,this.y=l,this},_rotateAround:function(e,i){var s=Math.cos(e),l=Math.sin(e),a=i.y+l*(this.x-i.x)+s*(this.y-i.y);return this.x=i.x+s*(this.x-i.x)-l*(this.y-i.y),this.y=a,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},n.convert=function(e){return e instanceof n?e:Array.isArray(e)?new n(e[0],e[1]):e},$r}var dt=Ce(Ds());function Dn(n,e){if(Array.isArray(n)){if(!Array.isArray(e)||n.length!==e.length)return!1;for(let i=0;i<n.length;i++)if(!Dn(n[i],e[i]))return!1;return!0}if(typeof n=="object"&&n!==null&&e!==null){if(typeof e!="object"||Object.keys(n).length!==Object.keys(e).length)return!1;for(const i in n)if(!Dn(n[i],e[i]))return!1;return!0}return n===e}const Hr=Math.PI/180,Zn=180/Math.PI;function hi(n){return n*Hr}function gr(n){return n*Zn}const Wn=[[0,0],[1,0],[1,1],[0,1]];function no(n){if(n<=0)return 0;if(n>=1)return 1;const e=n*n,i=e*n;return 4*(n<.5?i:3*(n-e)+i-.75)}function ss(n,e,i,s){const l=new Ls(n,e,i,s);return function(a){return l.solve(a)}}const Io=ss(.25,.1,.25,1);function Qt(n,e,i){return Math.min(i,Math.max(e,n))}function Zr(n,e,i){return(i=Qt((i-n)/(e-n),0,1))*i*(3-2*i)}function Os(n,e,i){const s=i-e,l=((n-e)%s+s)%s+e;return l===e?i:l}function so(n,e,i){if(!n.length)return i(null,[]);let s=n.length;const l=new Array(n.length);let a=null;
14n.forEach((h,m)=>{e(h,(g,x)=>{g&&(a=g),l[m]=x,--s==0&&i(a,l)})})}function Nr(n,...e){for(const i of e)for(const s in i)n[s]=i[s];return n}let os=1;function Xn(){return os++}function Aa(n){return n<=1?1:Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function Ca(n,e){n.forEach(i=>{e[i]&&(e[i]=e[i].bind(e))})}function oo(n,e,i){const s={};for(const l in n)s[l]=e.call(this,n[l],l,n);return s}function ao(n,e,i){const s={};for(const l in n)e.call(this,n[l],l,n)&&(s[l]=n[l]);return s}function un(n){return Array.isArray(n)?n.map(un):typeof n=="object"&&n?oo(n,un):n}const Ao={};function Hi(n){Ao[n]||(typeof console<"u"&&console.warn(n),Ao[n]=!0)}function Ci(n,e,i){return(i.y-n.y)*(e.x-n.x)>(e.y-n.y)*(i.x-n.x)}function Pa(n){let e=0;for(let i,s,l=0,a=n.length,h=a-1;l<a;h=l++)i=n[l],s=n[h],e+=(s.x-i.x)*(i.y+s.y);return e}function Co([n,e,i]){const s=hi(e+90),l=hi(i);return{x:n*Math.cos(s)*Math.sin(l),y:n*Math.sin(s)*Math.sin(l),z:n*Math.cos(l),azimuthal:e,polar:i}}function Wr(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function lo(n){const e={};if(n.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(i,s,l,a)=>{const h=l||a;return e[s]=!h||h.toLowerCase(),""}),e["max-age"]){const i=parseInt(e["max-age"],10);isNaN(i)?delete e["max-age"]:e["max-age"]=i}return e}let Ra=null;function Po(n,e){return[n[4*e],n[4*e+1],n[4*e+2],n[4*e+3]]}function Cl(n,e,i,s){for(;e<i;){const l=e+i>>1;n[l]<s?e=l+1:i=l}return e}function Pl(n,e,i,s){for(;e<i;){const l=e+i>>1;n[l]<=s?e=l+1:i=l}return e}function za(n){return n>0?1/(1.001-n):1+n}function Ne(n){return n>0?1-1/(1.001-n):-n}const j={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(!j.API_URL)return null;try{const n=new URL(j.API_URL);return n.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":n.hostname==="api.mapbox.com"?"https://events.mapbox.com/events/v2":null}catch{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",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function G(n){return j.API_URL_REGEX.test(n)}function ee(n){return j.API_SPRITE_REGEX.test(n)}let de,ce,ge,ze,be,ke;function je(){return de==null&&(de=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),de}const Be={now:()=>ze!==void 0?ze:performance.now(),setNow(n){ze=n},restoreNow(){ze=void 0},frame(n){const e=requestAnimationFrame(n);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(n,e=0){const{width:i,height:s}=n;be||(be=document.createElement("canvas"));const l=be.getContext("2d",{willReadFrequently:!0});if(!l)throw new Error("failed to create canvas 2d context");return(i>be.width||s>be.height)&&(be.width=i,be.height=s),l.clearRect(-e,-e,i+2*e,s+2*e),l.drawImage(n,0,0,i,s),l.getImageData(-e,-e,i+2*e,s+2*e)},resolveURL:n=>(ce||(ce=document.createElement("a")),ce.href=n,ce.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(ge==null&&(ge=window.matchMedia("(prefers-reduced-motion: reduce)")),ge.matches)},hasCanvasFingerprintNoise(){if(ke!==void 0)return ke;if(!je())return ke=!1,!1;const n=new OffscreenCanvas(85,1),e=n.getContext("2d",{willReadFrequently:!0});let i=0;for(let l=0;l<n.width;++l)e.fillStyle=`rgba(${i++},${i++},${i++}, 255)`,e.fillRect(l,0,1,1);const s=e.getImageData(0,0,n.width,n.height);i=0;for(let l=0;l<s.data.length;++l)if(l%4!=3&&i++!==s.data[l])return ke=!0,!0;return ke=!1,!1}};function at(n,e){const i=n.indexOf("?");if(i<0)return`${n}?${new URLSearchParams(e).toString()}`;const s=new URLSearchParams(n.slice(i));for(const l in e)s.set(l,e[l]);return`${n.slice(0,i)}?${s.toString()}`}
14function gt(n,e={persistentParams:[]}){const i=n.indexOf("?");if(i<0)return n;const s=new URLSearchParams,l=new URLSearchParams(n.slice(i));for(const h of e.persistentParams){const m=l.get(h);m&&s.set(h,m)}const a=s.toString();return`${n.slice(0,i)}${a.length>0?`?${a}`:""}`}const bt="mapbox-tiles";let Gt=500,Wt=50;const Xt=["language","worldview","jobid"];let Jt,Oi;function $i(){try{return caches}catch{}}function si(){const n=$i();n&&Jt==null&&(Jt=n.open(bt))}let Si=1/0;const Ei={supported:!1,testSupport:function(n){!yr&&Qi&&(zr?Vr(n):Ai=n)}};let Ai,Qi,yr=!1,zr=!1;const wn=typeof self<"u"?self:{};function Vr(n){const e=n.createTexture();n.bindTexture(n.TEXTURE_2D,e);try{if(n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,Qi),n.isContextLost())return;Ei.supported=!0}catch{}n.deleteTexture(e),yr=!0}wn.document&&(Qi=wn.document.createElement("img"),Qi.onload=function(){Ai&&Vr(Ai),Ai=null,zr=!0},Qi.onerror=function(){yr=!0,Ai=null},Qi.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const vr={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"};typeof Object.freeze=="function"&&Object.freeze(vr);class wr extends Error{constructor(e,i,s){i===401&&G(s)&&(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=s}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const Ro=Wr()?()=>self.worker&&self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,Tn=function(n,e){if(!(/^file:/.test(i=n.url)||/^file:/.test(Ro())&&!/^\w+:/.test(i))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(s,l){const a=new AbortController,h=new Request(s.url,{method:s.method||"GET",body:s.body,credentials:s.credentials,headers:s.headers,referrer:
14Ro(),referrerPolicy:s.referrerPolicy,signal:a.signal});let m=!1,g=!1;const x=(p=h.url).indexOf("sku=")>0&&G(p);var p;s.type==="json"&&h.headers.set("Accept","application/json");const y=(v,b,S)=>{if(g)return;if(v&&v.message!=="SecurityError"&&Hi(v.toString()),b&&S)return w(b);const A=Date.now();fetch(h).then(C=>{if(C.ok){const D=x?C.clone():null;return w(C,D,A)}return l(new wr(C.statusText,C.status,s.url))}).catch(C=>{C.name!=="AbortError"&&l(new Error(`${C.message} ${s.url}`))})},w=(v,b,S)=>{(s.type==="arrayBuffer"?v.arrayBuffer():s.type==="json"?v.json():v.text()).then(A=>{g||(b&&S&&function(C,D,L){if(si(),Jt==null)return;const z=lo(D.headers.get("Cache-Control")||"");if(z["no-store"])return;const k={status:D.status,statusText:D.statusText,headers:new Headers};D.headers.forEach((W,$)=>k.headers.set($,W)),z["max-age"]&&k.headers.set("Expires",new Date(L+1e3*z["max-age"]).toUTCString());const B=k.headers.get("Expires");if(!B||new Date(B).getTime()-L<42e4)return;let V=gt(C.url,{persistentParams:Xt});if(D.status===206){const W=C.headers.get("Range");if(!W)return;k.status=200,V=at(V,{range:W})}(function(W,$){if(Oi===void 0)try{new Response(new ReadableStream),Oi=!0}catch{Oi=!1}Oi?$(W.body):W.blob().then($)})(D,W=>{const $=new Response((H=D.status)!==200&&H!==404&&[101,103,204,205,304].includes(H)?null:W,k);var H;si(),Jt!=null&&Jt.then(ae=>ae.put(V,$)).catch(ae=>Hi(ae.message))})}(h,b,S),m=!0,l(null,A,v.headers.get("Cache-Control"),v.headers.get("Expires")))}).catch(A=>{g||l(new Error(A.message))})};return x?function(v,b){if(si(),Jt==null)return b(null);Jt.then(S=>
14{let A=gt(v.url,{persistentParams:Xt});const C=v.headers.get("Range");C&&(A=at(A,{range:C})),S.match(A).then(D=>{const L=function(z){if(!z)return!1;const k=new Date(z.headers.get("Expires")||0),B=lo(z.headers.get("Cache-Control")||"");return k>Date.now()&&!B["no-cache"]}(D);S.delete(A),L&&S.put(A,D.clone()),b(null,D,L)}).catch(b)}).catch(b)}(h,y):y(null,null),{cancel:()=>{g=!0,m||a.abort()}}}(n,e);if(Wr()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",n,e,void 0,!0)}var i;return function(s,l){const a=new XMLHttpRequest;a.open(s.method||"GET",s.url,!0),s.type==="arrayBuffer"&&(a.responseType="arraybuffer");for(const h in s.headers)a.setRequestHeader(h,s.headers[h]);return s.type==="json"&&(a.responseType="text",a.setRequestHeader("Accept","application/json")),a.withCredentials=s.credentials==="include",a.onerror=()=>{l(new Error(a.statusText))},a.onload=()=>{if((a.status>=200&&a.status<300||a.status===0)&&a.response!==null){let h=a.response;if(s.type==="json")try{h=JSON.parse(a.response)}catch(m){return l(m)}l(null,h,a.getResponseHeader("Cache-Control"),a.getResponseHeader("Expires"))}else l(new wr(a.statusText,a.status,s.url))},a.send(s.body),{cancel:()=>a.abort()}}(n,e)},as=function(n,e){return Tn(Nr(n,{type:"arrayBuffer"}),e)};function Hc(n){const e=document.createElement("a");return e.href=n,e.protocol===location.protocol&&e.host===location.host}const Rl="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let La,zo;La=[],zo=0;const Zc=function(n,e){if(Ei.supported&&(n.headers||(n.headers={}),n.headers.accept="image/webp,*/*"),zo>=j.MAX_PARALLEL_IMAGE_REQUESTS){const a={requestParameters:n,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return La.push(a),a}zo++;let i=!1;const s=()=>
14{if(!i)for(i=!0,zo--;La.length&&zo<j.MAX_PARALLEL_IMAGE_REQUESTS;){const a=La.shift(),{requestParameters:h,callback:m,cancelled:g}=a;g||(a.cancel=Zc(h,m).cancel)}},l=as(n,(a,h,m,g)=>{s(),a?e(a):h&&(self.createImageBitmap?function(x,p){const y=new Blob([new Uint8Array(x)],{type:"image/png"});createImageBitmap(y).then(w=>{p(null,w)}).catch(w=>{p(new Error(`Could not load image because of ${w.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(h,(x,p)=>e(x,p,m,g)):function(x,p){const y=new Image;y.onload=()=>{p(null,y),URL.revokeObjectURL(y.src),y.onload=null,requestAnimationFrame(()=>{y.src=Rl})},y.onerror=()=>p(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const w=new Blob([new Uint8Array(x)],{type:"image/png"});y.src=x.byteLength?URL.createObjectURL(w):Rl}(h,(x,p)=>e(x,p,m,g)))});return{cancel:()=>{l.cancel(),s()}}};var $h,Hh,Wc,Lo={exports:{}},hn={exports:{}},On={exports:{}},ks=function(){if(Wc)return Lo.exports;Wc=1;var n=($h||($h=1,hn.exports=function(i,s){var l,a,h,m,g,x,p,y;for(a=i.length-(l=3&i.length),h=s,g=3432918353,x=461845907,y=0;y<a;)p=255&i.charCodeAt(y)|(255&i.charCodeAt(++y))<<8|(255&i.charCodeAt(++y))<<16|(255&i.charCodeAt(++y))<<24,++y,h=27492+(65535&(m=5*(65535&(h=(h^=p=(65535&(p=(p=(65535&p)*g+(((p>>>16)*g&65535)<<16)&4294967295)<<15|p>>>17))*x+(((p>>>16)*x&65535)<<16)&4294967295)<<13|h>>>19))+((5*(h>>>16)&65535)<<16)&4294967295))+((58964+(m>>>16)&65535)<<16);switch(p=0,l){case 3:p^=(255&i.charCodeAt(y+2))<<16;case 2:p^=(255&i.charCodeAt(y+1))<<8;case 1:h^=p=(65535&(p=(p=(65535&(p^=255&i.charCodeAt(y)))*g+(((p>>>16)*g&65535)<<16)&4294967295)<<15|p>>>17))*x+(((p>>>16)*x&65535)<<16)&4294967295}return h^=i.length,h=2246822507*(65535&(h^=h>>>16))+((2246822507*(h>>>16)&65535)<<16)&4294967295,h=3266489909*(65535&(h^=h>>>13))+((3266489909*(h>>>16)&65535)<<16)&4294967295,(h^=h>>>16)>>>0}),hn.exports),e=(Hh||(Hh=1,On.exports=function(i,s){for(var l,a=i.length,h=s^a,m=0;a>=4;)l=1540483477*(65535&(l=255&i.charCodeAt(m)|(255&i.charCodeAt(++m))<<8|(255&i.charCodeAt(++m))<<16|(255&i.charCodeAt(++m))<<24))+((1540483477*(l>>>16)&65535)<<16),h=1540483477*(65535&h)+((1540483477*(h>>>16)&65535)<<16)^(l=1540483477*(65535&(l^=l>>>24))+((1540483477*(l>>>16)&65535)<<16)),a-=4,++m;switch(a){case 3:h^=(255&i.charCodeAt(m+2))<<16;case 2:h^=(255&i.charCodeAt(m+1))<<8;case 1:h=1540483477*(65535&(h^=255&i.charCodeAt(m)))+((1540483477*(h>>>16)&65535)<<16)}return h=1540483477*(65535&(h^=h>>>13))+((1540483477*(h>>>16)&65535)<<16),(h^=h>>>15)>>>0}),On.exports);return Lo.exports=n,Lo.exports.murmur3=n,Lo.exports.murmur2=e,Lo.exports}(),dn=Ce(ks);class tn{constructor(e,...i){Nr(this,i[0]||{}),this.type=e}}class Do extends tn{constructor(e,i={}){super("error",Nr({error:e},i))}}function Xc(n,e,i){i[n]&&i[n].indexOf(e)!==-1||(i[n]=i[n]||[],i[n].push(e))}function zl(n,e,i){if(i&&i[n]){const s=i[n].indexOf(e);s!==-1&&i[n].splice(s,1)}}class kn{on(e,i){return this._listeners=this._listeners||{},Xc(e,i,this._listeners),this}off(e,i){return zl(e,i,this._listeners),zl(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},Xc(e,i,this._oneTimeListeners),this):new Promise(s=>{this.once(e,s)})}fire(e,i){const s=typeof e=="string"?new tn(e,i):e,l=s.type;if(this.listens(l)){s.target=this;const a=this._listeners&&this._listeners[l]?this._listeners[l].slice():[];for(const g of a)g.call(this,s);const h=this._oneTimeListeners&&this._oneTimeListeners[l]?this._oneTimeListeners[l].slice():[];for(const g of h)zl(l,g,this._oneTimeListeners),g.call(this,s);const m=this._eventedParent;m&&(Nr(s,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),m.fire(s))}else s instanceof Do&&console.error(s.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 Xr{constructor(e){typeof e=="string"?this.name=e:(this.name=e.name,this.iconsetId=e.iconsetId)}static from(e){return new Xr(e)}static toString(e){return e.iconsetId?`${e.name}�${e.iconsetId}`:e.name}static parse(e){const[i,s]=e.split("�");return new Xr({name:i,iconsetId:s})}
14static isEqual(e,i){return e.name===i.name&&e.iconsetId===i.iconsetId}toString(){return Xr.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var Zh,Yc={},Sn=function(){if(Zh)return Yc;Zh=1;var n={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function e(a){return(a=Math.round(a))<0?0:a>255?255:a}function i(a){return e(a[a.length-1]==="%"?parseFloat(a)/100*255:parseInt(a))}function s(a){return(h=a[a.length-1]==="%"?parseFloat(a)/100:parseFloat(a))<0?0:h>1?1:h;var h}function l(a,h,m){return m<0?m+=1:m>1&&(m-=1),6*m<1?a+(h-a)*m*6:2*m<1?h:3*m<2?a+(h-a)*(2/3-m)*6:a}try{Yc.parseCSSColor=function(a){var h,m=a.replace(/ /g,"").toLowerCase();if(m in n)return n[m].slice();if(m[0]==="#")return m.length===4?(h=parseInt(m.substr(1),16))>=0&&h<=4095?[(3840&h)>>4|(3840&h)>>8,240&h|(240&h)>>4,15&h|(15&h)<<4,1]:null:m.length===7&&(h=parseInt(m.substr(1),16))>=0&&h<=16777215?[(16711680&h)>>16,(65280&h)>>8,255&h,1]:null;var g=m.indexOf("("),x=m.indexOf(")");if(g!==-1&&x+1===m.length){var p=m.substr(0,g),y=m.substr(g+1,x-(g+1)).split(","),w=1;switch(p){case"rgba":if(y.length!==4)return null;w=s(y.pop());case"rgb":return y.length!==3?null:[i(y[0]),i(y[1]),i(y[2]),w];case"hsla":if(y.length!==4)return null;w=s(y.pop());case"hsl":if(y.length!==3)return null;var v=(parseFloat(y[0])%360+360)%360/360,b=s(y[1]),S=s(y[2]),A=S<=.5?S*(b+1):S+b-S*b,C=2*S-A;return[e(255*l(C,A,v+1/3)),e(255*l(C,A,v)),e(255*l(C,A,v-1/3)),w];default:return null}}return null}}catch{}return Yc}();class Mi{constructor(e,i,s,l=1){this.r=e,this.g=i,this.b=s,this.a=l}static parse(e){if(!e)return;if(e instanceof Mi)return e;if(typeof e!="string")return;const i=Sn.parseCSSColor(e);return i?new Mi(i[0]/255*i[3],i[1]/255*i[3],i[2]/255*i[3],i[3]):void 0}toStringPremultipliedAlpha(){const[e,i,s,l]=this.a===0?[0,0,0,0]:[255*this.r/this.a,255*this.g/this.a,255*this.b/this.a,this.a];return`rgba(${Math.round(e)},${Math.round(i)},${Math.round(s)},${l})`}toString(){const[e,i,s,l]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*s)},${l})`}toRenderColor(e){const{r:i,g:s,b:l,a}=this;return new Kc(e,i,s,l,a)}clone(){return new Mi(this.r,this.g,this.b,this.a)}}class Kc{constructor(e,i,s,l,a){if(e){const h=e.image.height,m=h*h;
14i=a===0?0:i/a*(h-1),s=a===0?0:s/a*(h-1),l=a===0?0:l/a*(h-1);const g=Math.floor(i),x=Math.floor(s),p=Math.floor(l),y=Math.ceil(i),w=Math.ceil(s),v=Math.ceil(l),b=i-g,S=s-x,A=l-p,C=e.image.data,D=4*(g+x*m+p*h),L=4*(g+x*m+v*h),z=4*(g+w*m+p*h),k=4*(g+w*m+v*h),B=4*(y+x*m+p*h),V=4*(y+x*m+v*h),W=4*(y+w*m+p*h),$=4*(y+w*m+v*h);if(D<0||$>=C.length)throw new Error("out of range");this.r=Ot(Ot(Ot(C[D],C[L],A),Ot(C[z],C[k],A),S),Ot(Ot(C[B],C[V],A),Ot(C[W],C[$],A),S),b)/255*a,this.g=Ot(Ot(Ot(C[D+1],C[L+1],A),Ot(C[z+1],C[k+1],A),S),Ot(Ot(C[B+1],C[V+1],A),Ot(C[W+1],C[$+1],A),S),b)/255*a,this.b=Ot(Ot(Ot(C[D+2],C[L+2],A),Ot(C[z+2],C[k+2],A),S),Ot(Ot(C[B+2],C[V+2],A),Ot(C[W+2],C[$+2],A),S),b)/255*a,this.a=a}else this.r=i,this.g=s,this.b=l,this.a=a}toArray(){const{r:e,g:i,b:s,a:l}=this;return l===0?[0,0,0,0]:[255*e/l,255*i/l,255*s/l,l]}toHslaArray(){if(this.a===0)return[0,0,0,0];const{r:e,g:i,b:s,a:l}=this,a=Math.min(Math.max(e/l,0),1),h=Math.min(Math.max(i/l,0),1),m=Math.min(Math.max(s/l,0),1),g=Math.min(a,h,m),x=Math.max(a,h,m),p=(g+x)/2;if(g===x)return[0,0,100*p,l];const y=x-g,w=p>.5?y/(2-x-g):y/(x+g);let v=0;return x===a?v=(h-m)/y+(h<m?6:0):x===h?v=(m-a)/y+2:x===m&&(v=(a-h)/y+4),v*=60,[Math.min(Math.max(v,0),360),Math.min(Math.max(100*w,0),100),Math.min(Math.max(100*p,0),100),l]}toArray01(){const{r:e,g:i,b:s,a:l}=this;return l===0?[0,0,0,0]:[e/l,i/l,s/l,l]}toArray01Scaled(e){const{r:i,g:s,b:l,a}=this;return a===0?[0,0,0]:[i/a*e,s/a*e,l/a*e]}toArray01PremultipliedAlpha(){const{r:e,g:i,b:s,a:l}=this;return[e,i,s,l]}toArray01Linear(){const{r:e,g:i,b:s,a:l}=this;return l===0?[0,0,0,0]:[Math.pow(e/l,2.2),Math.pow(i/l,2.2),Math.pow(s/l,2.2),l]}}function Ot(n,e,i){return n*(1-i)+e*i}function Wh(n,e,i){return n.map((s,l)=>Ot(s,e[l],i))}function Xh(n){return n*n*n*n*n}Mi.black=new Mi(0,0,0,1),Mi.white=new Mi(1,1,1,1),Mi.transparent=new Mi(0,0,0,0),Mi.red=new Mi(1,0,0,1),Mi.blue=new Mi(0,0,1,1);var Da=Object.freeze({__proto__:null,array:Wh,color:function(n,e,i){return new Mi(Ot(n.r,e.r,i),Ot(n.g,e.g,i),Ot(n.b,e.b,i),Ot(n.a,e.a,i))},easeIn:Xh,number:Ot});function _i(n,...e){for(const i of e)for(const s in i)n[s]=i[s];return n}
14class En extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class Ll{constructor(e,i=[]){this.parent=e,this.bindings={};for(const[s,l]of i)this.bindings[s]=l}concat(e){return new Ll(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const Oo={kind:"null"},At={kind:"number"},Ti={kind:"string"},pi={kind:"boolean"},Lr={kind:"color"},ko={kind:"object"},gi={kind:"value"},ls={kind:"collator"},Oa={kind:"formatted"},cs={kind:"resolvedImage"};function Ir(n,e){return{kind:"array",itemType:n,N:e}}function er(n){if(n.kind==="array"){const e=er(n.itemType);return typeof n.N=="number"?`array<${e}, ${n.N}>`:n.itemType.kind==="value"?"array":`array<${e}>`}return n.kind}const Fn=[Oo,At,Ti,pi,Lr,Oa,ko,Ir(gi),cs];function Fo(n,e){if(e.kind==="error")return null;if(n.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Fo(n.itemType,e.itemType))&&(typeof n.N!="number"||n.N===e.N))return null}else{if(n.kind===e.kind)return null;if(n.kind==="value"){for(const i of Fn)if(!Fo(i,e))return null}}return`Expected ${er(n)} but found ${er(e)} instead.`}function Jc(n,e){return e.some(i=>i.kind===n.kind)}function Bo(n,e){return e.some(i=>i==="null"?n===null:i==="array"?Array.isArray(n):i==="object"?n&&!Array.isArray(n)&&typeof n=="object":i===typeof n)}class Dl{constructor(e,i,s){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=s,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 ka{constructor(e,i,s,l,a){this.text=e.normalize?e.normalize():e,this.image=i,this.scale=s,this.fontStack=l,this.textColor=a}}class Dr{constructor(e){this.sections=e}static fromString(e){return new Dr([new ka(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||!!e.image&&e.image.hasPrimary())}static factory(e){return e instanceof Dr?e:Dr.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}serialize(){const e=["format"];for(const i of this.sections){if(i.image){const l=i.image.getPrimary().id.toString();e.push(["image",l]);continue}e.push(i.text);const s={};i.fontStack&&(s["text-font"]=["literal",i.fontStack.split(",")]),i.scale&&(s["font-scale"]=i.scale),i.textColor&&(s["text-color"]=["rgba"].concat(i.textColor.toRenderColor(null).toArray())),e.push(s)}return e}}class Yn{constructor(e,i={}){if(this.id=Xr.from(e),this.options=Object.assign({},i),i.transform){const{a:s,b:l,c:a,d:h,e:m,f:g}=i.transform;this.options.transform=new DOMMatrix([s,l,a,h,m,g])}else this.options.transform=new DOMMatrix([1,0,0,1,0,0])}toString(){const{a:e,b:i,c:s,d:l,e:a,f:h}=this.options.transform;return JSON.stringify({name:this.id.name,iconsetId:this.id.iconsetId,params:this.options.params,transform:{a:e,b:i,c:s,d:l,e:a,f:h}})}static parse(e){let i,s,l,a;try{({name:i,iconsetId:s,params:l,transform:a}=JSON.parse(e)||{})}catch{return null}if(!i)return null;const{a:h,b:m,c:g,d:x,e:p,f:y}=a||{};return new Yn({name:i,iconsetId:s},{params:l,transform:new DOMMatrix([h,m,g,x,p,y])})}scaleSelf(e){return this.options.transform.scaleSelf(e),this}}class Or{constructor(e,i,s,l,a=!1){this.primaryId=Xr.from(e),this.primaryOptions=i,s&&(this.secondaryId=Xr.from(s)),this.secondaryOptions=l,this.available=a}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new Yn(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new Yn(this.secondaryId,this.secondaryOptions):null}static from(e){return typeof e=="string"?Or.build({name:e}):e}static build(e,i,s,l){return!e||typeof e=="object"&&!("name"in e)?null:new Or(e,s,i,l)}}function Fa(n,e,i,s){return typeof n=="number"&&n>=0&&n<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof i=="number"&&i>=0&&i<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[n,e,i,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[n,e,i,s]:[n,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Bn(n){if(n===null||typeof n=="string"||typeof n=="boolean"||typeof n=="number"||n instanceof Mi||n instanceof Dl||n instanceof Dr||n instanceof Or)return!0;
vendor: 15,506 bytes, line 14
14if(Array.isArray(n)){for(const e of n)if(!Bn(e))return!1;return!0}if(typeof n=="object"){for(const e in n)if(!Bn(n[e]))return!1;return!0}return!1}function or(n){if(n===null)return Oo;if(typeof n=="string")return Ti;if(typeof n=="boolean")return pi;if(typeof n=="number")return At;if(n instanceof Mi)return Lr;if(n instanceof Dl)return ls;if(n instanceof Dr)return Oa;if(n instanceof Or)return cs;if(Array.isArray(n)){const e=n.length;let i;for(const s of n){const l=or(s);if(i){if(i===l)continue;i=gi;break}i=l}return Ir(i||gi,e)}return ko}function xr(n){const e=typeof n;return n===null?"":e==="string"||e==="number"||e==="boolean"?String(n):n instanceof Mi?n.toStringPremultipliedAlpha():n instanceof Dr||n instanceof Or?n.toString():JSON.stringify(n)}class us{constructor(e,i){this.type=e,this.value=i}static parse(e,i){if(e.length!==2)return i.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Bn(e[1]))return i.error("invalid value");const s=e[1];let l=or(s);const a=i.expectedType;return l.kind!=="array"||l.N!==0||!a||a.kind!=="array"||typeof a.N=="number"&&a.N!==0||(l=a),new us(l,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof Mi?["rgba"].concat(this.value.toRenderColor(null).toArray()):this.value instanceof Dr?this.value.serialize():this.value}}class ir{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Qc={string:Ti,number:At,boolean:pi,object:ko};class pn{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let s,l=1;const a=e[0];if(a==="array"){let m,g;if(e.length>2){const x=e[1];if(typeof x!="string"||!(x in Qc)||x==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);m=Qc[x],l++}else m=gi;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return i.error('The length argument to "array" must be a positive integer literal',2);g=e[2],l++}s=Ir(m,g)}else s=Qc[a];const h=[];for(;l<e.length;l++){const m=i.parse(e[l],l,gi);if(!m)return null;h.push(m)}return new pn(s,h)}evaluate(e){for(let i=0;i<this.args.length;i++){const s=this.args[i].evaluate(e);if(!Fo(this.type,or(s)))return s;if(i===this.args.length-1)throw new ir(`The expression ${JSON.stringify(this.args[i].serialize())} evaluated to ${er(or(s))} but was expected to be of type ${er(this.type)}.`)}return null}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=this.type,i=[e.kind];if(e.kind==="array"){const s=e.itemType;if(s.kind==="string"||s.kind==="number"||s.kind==="boolean"){i.push(s.kind);const l=e.N;(typeof l=="number"||this.args.length>1)&&i.push(l)}}return i.concat(this.args.map(s=>s.serialize()))}}class No{constructor(e){this.type=Oa,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const s=e[1];if(!Array.isArray(s)&&typeof s=="object")return i.error("First argument must be an image or text section.");const l=[];let a=!1;for(let h=1;h<=e.length-1;++h){const m=e[h];if(a&&typeof m=="object"&&!Array.isArray(m)){a=!1;let g=null;if(m["font-scale"]&&(g=i.parseObjectValue(m["font-scale"],h,"font-scale",At),!g))return null;let x=null;if(m["text-font"]&&(x=i.parseObjectValue(m["text-font"],h,"text-font",Ir(Ti)),!x))return null;let p=null;if(m["text-color"]&&(p=i.parseObjectValue(m["text-color"],h,"text-color",Lr),!p))return null;const y=l[l.length-1];y.scale=g,y.font=x,y.textColor=p}else{const g=i.parse(e[h],h,gi);if(!g)return null;const x=g.type.kind;if(x!=="string"&&x!=="value"&&x!=="null"&&x!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");a=!0,l.push({content:g,scale:null,font:null,textColor:null})}}return new No(l)}evaluate(e){return new Dr(this.sections.map(i=>{const s=i.content.evaluate(e);return or(s)===cs?new ka("",s,null,null,null):new ka(xr(s),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(const 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(){const e=["format"];for(const i of this.sections){e.push(i.content.serialize());const s={};i.scale&&(s["font-scale"]=i.scale.serialize()),i.font&&(s["text-font"]=i.font.serialize()),i.textColor&&(s["text-color"]=i.textColor.serialize()),e.push(s)}return e}}class Fs{constructor(e,i,s,l){this._imageWarnHistory={},this.type=cs,this.namePrimary=e,this.nameSecondary=i,s&&(this.paramsPrimary=s.params,this.iconsetIdPrimary=s.iconset?s.iconset.id:void 0),l&&(this.paramsSecondary=l.params,this.iconsetIdSecondary=l.iconset?l.iconset.id:void 0)}static parse(e,i){if(e.length<2)return i.error("Expected two or more arguments.");let s=1;const l=[];function a(){if(s<e.length){const m=i.parse(e[s],s++,Ti);return m?(l.push({image:m,options:{}}),!0):(i.error(l.length?"Secondary image variant is not a string.":"No image name provided."),!1)}return!0}function h(){if(s<e.length){const g=e[s];if((m=g)===null||typeof m!="object"||Array.isArray(m))return!0;const x=g.params,p=g.iconset,y=i.concat(s);if(!x&&!p)return s++,!0;if(x){if(typeof x!="object"||x.constructor!==Object)return y.error('Image options "params" should be an object'),!1;const w={},v=y.concat(void 0,"params");for(const b in x){if(!b)return v.error("Image parameter name should be non-empty"),!1;const S=v.concat(void 0,b).parse(x[b],void 0,Lr,void 0,{typeAnnotation:"coerce"});if(!S)return!1;w[b]=S}l[l.length-1].options.params=w}if(p){if(typeof p!="object"||p.constructor!==Object)return y.error('Image options "iconset" should be an object'),!1;if(!p.id)return y.error('Image options "iconset" should have an "id" property'),!1;l[l.length-1].options.iconset=p}return s++,!0}var m;return!0}for(let m=0;m<2;m++)if(!a()||!h())return;return new Fs(l[0].image,l[1]?l[1].image:void 0,l[0].options,l[1]?l[1].options:void 0)}evaluateParams(e,i){const s={};if(i){for(const l in i)if(i[l])try{s[l]=i[l].evaluate(e)}catch{continue}if(Object.keys(s).length!==0)return{params:s}}}evaluate(e){const i={name:this.namePrimary.evaluate(e),iconsetId:this.iconsetIdPrimary},s=this.nameSecondary?{name:this.nameSecondary.evaluate(e),iconsetId:this.iconsetIdSecondary}:void 0,l=Or.build(i,s,this.paramsPrimary?this.evaluateParams(e,this.paramsPrimary):void 0,this.paramsSecondary?this.evaluateParams(e,this.paramsSecondary):void 0);if(l&&e.availableImages){const a=l.getPrimary().id;if(l.available=e.availableImages.some(h=>Xr.isEqual(h,a)),l.available){const h=l.getSecondary()?l.getSecondary().id:null;h&&(l.available=e.availableImages.some(m=>Xr.isEqual(m,h)))}}return l}eachChild(e){if(e(this.namePrimary),this.paramsPrimary)for(const i in this.paramsPrimary)this.paramsPrimary[i]&&e(this.paramsPrimary[i]);if(this.nameSecondary&&(e(this.nameSecondary),this.paramsSecondary))for(const i in this.paramsSecondary)this.paramsSecondary[i]&&e(this.paramsSecondary[i])}outputDefined(){return!1}serializeOptions(e,i){const s={};if(i&&(s.iconset={id:i}),e){s.params={};for(const l in e)e[l]&&(s.params[l]=e[l].serialize())}return Object.keys(s).length>0?s:void 0}serialize(){const e=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const i=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);i&&e.push(i)}if(this.nameSecondary&&(e.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const i=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);i&&e.push(i)}return e}}function hs(n){return n instanceof Number?"number":n instanceof String?"string":n instanceof Boolean?"boolean":Array.isArray(n)?"array":n===null?"null":typeof n}const Gp={"to-boolean":pi,"to-color":Lr,"to-number":At,"to-string":Ti};class ds{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const s=e[0],l=[];let a=Oo;if(s==="to-array"){if(!Array.isArray(e[1]))return null;const h=e[1].length;if(i.expectedType){if(i.expectedType.kind!=="array")return i.error(`Expected ${i.expectedType.kind} but found array.`);a=Ir(i.expectedType.itemType,h)}else{if(!(h>0&&Bn(e[1][0])))return null;a=Ir(or(e[1][0]),h)}for(let m=0;m<h;m++){const g=e[1][m];let x;if(hs(g)==="array")x=i.parse(g,void 0,a.itemType);else{const p=hs(g);if(p!==a.itemType.kind)return i.error(`Expected ${a.itemType.kind} but found ${p}.`);x=i.registry.literal.parse(["literal",g===void 0?null:g],i)}if(!x)return null;l.push(x)}}else{if((s==="to-boolean"||s==="to-string")&&e.length!==2)return i.error("Expected one argument.");a=Gp[s];for(let h=1;h<e.length;h++){const m=i.parse(e[h],h,gi);if(!m)return null;l.push(m)}}return new ds(a,l)}evaluate(e){if(this.type.kind==="boolean")return!!this.args[0].evaluate(e);if(this.type.kind==="color"){let i,s;for(const l of this.args){if(i=l.evaluate(e),s=null,i instanceof Mi)return i;if(typeof i=="string"){const a=e.parseColor(i);if(a)return a}else if(Array.isArray(i)&&(s=i.length<3||i.length>4?`Invalid rbga value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:Fa(i[0],i[1],i[2],i[3]),!s))return new Mi(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new ir(s||`Could not parse color from value '${typeof i=="string"?i:String(JSON.stringify(i))}'`)}if(this.type.kind==="number"){let i=null;for(const s of this.args){if(i=s.evaluate(e),i===null)return 0;const l=Number(i);if(!isNaN(l))return l}throw new ir(`Could not convert ${JSON.stringify(i)} to number.`)}return this.type.kind==="formatted"?Dr.fromString(xr(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?Or.build(xr(this.args[0].evaluate(e))):this.type.kind==="array"?this.args.map(i=>i.evaluate(e)):xr(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){if(this.type.kind==="formatted")return new No([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new Fs(this.args[0]).serialize();const e=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(i=>{e.push(i.serialize())}),e}}const $p=["Unknown","Point","LineString","Polygon"];class Ol{constructor(e,i){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}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?$p[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}measureLight(e){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const e=this.featureDistanceData.center,i=this.featureDistanceData.scale,{x:s,y:l}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(s*i-e[0])+this.featureDistanceData.bearing[1]*(l*i-e[1])}return 0}parseColor(e){let i=this._parseColorCache[e];return i||(i=this._parseColorCache[e]=Mi.parse(e)),i}getConfig(e){return this.options?this.options.get(e):null}}class Ur{constructor(e,i,s,l,a){this.name=e,this.type=i,this._evaluate=s,this.args=l,this._overloadIndex=a}evaluate(e){if(!this._evaluate){const i=Ur.definitions[this.name];this._evaluate=Array.isArray(i)?i[2]:i.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){const s=e[0],l=Ur.definitions[s];if(!l)return i.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0);const a=Array.isArray(l)?l[0]:l.type,h=Array.isArray(l)?[[l[1],l[2]]]:l.overloads,m=[];let g=null,x=-1;for(const[p,y]of h){if(Array.isArray(p)&&p.length!==e.length-1)continue;m.push(p),x++,g=new ou(i.registry,i.path,null,i.scope,void 0,i._scope,i.options);const w=[];let v=!1;for(let b=1;b<e.length;b++){const S=e[b],A=Array.isArray(p)?p[b-1]:p.type,C=g.parse(S,1+w.length,A);if(!C){v=!0;break}w.push(C)}if(!v)if(Array.isArray(p)&&p.length!==w.length)g.error(`Expected ${p.length} arguments, but found ${w.length} instead.`);else{for(let b=0;b<w.length;b++){const S=Array.isArray(p)?p[b]:p.type,A=w[b];g.concat(b+1).checkSubtype(S,A.type)}if(g.errors.length===0)return new Ur(s,a,y,w,x)}}if(m.length===1)i.errors.push(...g.errors);else{const p=(m.length?m:h.map(([w])=>w)).map(Hp).join(" | "),y=[];for(let w=1;w<e.length;w++){const v=i.parse(e[w],1+y.length);if(!v)return null;y.push(er(v.type))}i.error(`Expected arguments of type ${p}, but found (${y.join(", ")}) instead.`)}return null}static register(e,i){Ur.definitions=i;for(const s in i)e[s]=Ur}}function Hp(n){return Array.isArray(n)?`(${n.map(er).join(", ")})`:`(${er(n.type)}...)`}class co{constructor(e,i,s){this.type=ls,this.locale=s,this.caseSensitive=e,this.diacriticSensitive=i}static parse(e,i){if(e.length!==2)return i.error("Expected one argument.");const s=e[1];if(typeof s!="object"||Array.isArray(s))return i.error("Collator options argument must be an object.");const l=s["case-sensitive"]===void 0?i.parse(!1,1,pi):i.parseObjectValue(s["case-sensitive"],1,"case-sensitive",pi);if(!l)return null;const a=s["diacritic-sensitive"]===void 0?i.parse(!1,1,pi):i.parseObjectValue(s["diacritic-sensitive"],1,"diacritic-sensitive",pi);if(!a)return null;let h=null;return s.locale&&(h=i.parseObjectValue(s.locale,1,"locale",Ti),!h)?null:new co(l,a,h)}evaluate(e){return new Dl(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}serialize(){const e={};return e["case-sensitive"]=this.caseSensitive.serialize(),e["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(e.locale=this.locale.serialize()),["collator",e]}}function Yh(n,e,i=0,s=n.length-1,l=Zp){for(;s>i;){if(s-i>600){const g=s-i+1,x=e-i+1,p=Math.log(g),y=.5*Math.exp(2*p/3),w=.5*Math.sqrt(p*y*(g-y)/g)*(x-g/2<0?-1:1);Yh(n,e,Math.max(i,Math.floor(e-x*y/g+w)),Math.min(s,Math.floor(e+(g-x)*y/g+w)),l)}const a=n[e];let h=i,m=s;for(Ba(n,i,e),l(n[s],a)>0&&Ba(n,i,s);h<m;){for(Ba(n,h,m),h++,m--;l(n[h],a)<0;)h++;for(;l(n[m],a)>0;)m--}l(n[i],a)===0?Ba(n,i,m):(m++,Ba(n,m,s)),m<=e&&(i=m+1),e<=m&&(s=m-1)}}function Ba(n,e,i){const s=n[e];n[e]=n[i],n[i]=s}function Zp(n,e){return n<e?-1:n>e?1:0}function Wp(n){let e=0;for(let i,s,l=0,a=n.length,h=a-1;l<a;h=l++)i=n[l],s=n[h],e+=(s.x-i.x)*(i.y+s.y);return e}function Na(n,e){n[0]=Math.min(n[0],e[0]),n[1]=Math.min(n[1],e[1]),n[2]=Math.max(n[2],e[0]),n[3]=Math.max(n[3],e[1])}function Va(n,e){return!(n[0]<=e[0]||n[2]>=e[2]||n[1]<=e[1]||n[3]>=e[3])}function Xp(n,e,i){const s=n[0]-e[0],l=n[1]-e[1],a=n[0]-i[0],h=n[1]-i[1];return s*h-a*l==0&&s*a<=0&&l*h<=0}function uo(n,e,i=!1){let s=!1;for(let m=0,g=e.length;m<g;m++){const x=e[m];for(let p=0,y=x.length,w=y-1;p<y;
14w=p++){const v=x[w],b=x[p];if(Xp(n,v,b))return i;(a=v)[1]>(l=n)[1]!=(h=b)[1]>l[1]&&l[0]<(h[0]-a[0])*(l[1]-a[1])/(h[1]-a[1])+a[0]&&(s=!s)}}var l,a,h;return s}function ho(n,e,i,s){const l=s[0]-i[0],a=s[1]-i[1],h=(n[0]-i[0])*a-l*(n[1]-i[1]),m=(e[0]-i[0])*a-l*(e[1]-i[1]);return h>0&&m<0||h<0&&m>0}function kl(n,e,i,s){return(l=[s[0]-i[0],s[1]-i[1]])[0]*(a=[e[0]-n[0],e[1]-n[1]])[1]-l[1]*a[0]!=0&&!(!ho(n,e,i,s)||!ho(i,s,n,e));var l,a}const Bs=8192;function eu(n,e){const i=(180+n[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n[1]*Math.PI/360)))/360,l=Math.pow(2,e.z);return[Math.round(i*l*Bs),Math.round(s*l*Bs)]}function Yp(n,e){for(let i=0;i<e.length;i++)if(uo(n,e[i]))return!0;return!1}function Kp(n,e,i){for(const s of i)for(let l=0,a=s.length,h=a-1;l<a;h=l++)if(kl(n,e,s[h],s[l]))return!0;return!1}function Kh(n,e){for(let i=0;i<n.length;++i)if(!uo(n[i],e))return!1;for(let i=0;i<n.length-1;++i)if(Kp(n[i],n[i+1],e))return!1;return!0}function Jp(n,e){for(let i=0;i<e.length;i++)if(Kh(n,e[i]))return!0;return!1}function Ns(n,e,i){const s=[];for(let l=0;l<n.length;l++){const a=[];for(let h=0;h<n[l].length;h++){const m=eu(n[l][h],i);Na(e,m),a.push(m)}s.push(a)}return s}function ii(n,e,i){const s=[];for(let l=0;l<n.length;l++){const a=Ns(n[l],e,i);s.push(a)}return s}function Pt(n,e,i,s){if(n[0]<i[0]||n[0]>i[2]){const l=.5*s;let a=n[0]-i[0]>l?-s:i[0]-n[0]>l?s:0;a===0&&(a=n[0]-i[2]>l?-s:i[2]-n[0]>l?s:0),n[0]+=a}Na(e,n)}function Fl(n,e,i,s){const l=Math.pow(2,s.z)*Bs,a=[s.x*Bs,s.y*Bs],h=[];if(!n)return h;for(const m of n)for(const g of m){const x=[g.x+a[0],g.y+a[1]];Pt(x,e,i,l),h.push(x)}return h}function $t(n,e,i,s){const l=Math.pow(2,s.z)*Bs,a=[s.x*Bs,s.y*Bs],h=[];if(!n)return h;for(const g of n){const x=[];for(const p of g){const y=[p.x+a[0],p.y+a[1]];Na(e,y),x.push(y)}h.push(x)}if(e[2]-e[0]<=l/2){(m=e)[0]=m[1]=1/0,m[2]=m[3]=-1/0;for(const g of h)for(const x of g)Pt(x,e,i,l)}var m;return h}class ps{constructor(e,i){this.type=pi,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Bn(e[1])){const s=e[1];if(s.type==="FeatureCollection")for(let l=0;l<s.features.length;++l){const a=s.features[l].geometry.type;if(a==="Polygon"||a==="MultiPolygon")return new ps(s,s.features[l].geometry)}else if(s.type==="Feature"){const l=s.geometry.type;if(l==="Polygon"||l==="MultiPolygon")return new ps(s,s.geometry)}else if(s.type==="Polygon"||s.type==="MultiPolygon")return new ps(s,s)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(i,s){const l=[1/0,1/0,-1/0,-1/0],a=[1/0,1/0,-1/0,-1/0],h=i.canonicalID();if(!h)return!1;if(s.type==="Polygon"){const m=Ns(s.coordinates,a,h),g=Fl(i.geometry(),l,a,h);if(!Va(l,a))return!1;for(const x of g)if(!uo(x,m))return!1}if(s.type==="MultiPolygon"){const m=ii(s.coordinates,a,h),g=Fl(i.geometry(),l,a,h);if(!Va(l,a))return!1;for(const x of g)if(!Yp(x,m))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(i,s){const l=[1/0,1/0,-1/0,-1/0],a=[1/0,1/0,-1/0,-1/0],h=i.canonicalID();if(!h)return!1;if(s.type==="Polygon"){const m=Ns(s.coordinates,a,h),g=$t(i.geometry(),l,a,h);if(!Va(l,a))return!1;for(const x of g)if(!Kh(x,m))return!1}if(s.type==="MultiPolygon"){const m=ii(s.coordinates,a,h),g=$t(i.geometry(),l,a,h);if(!Va(l,a))return!1;for(const x of g)if(!Jp(x,m))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}const Vo={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},jt=1/298.257223563,tu=jt*(2-jt),po=Math.PI/180;class Uo{static fromTile(e,i,s){const l=Math.PI*(1-2*(e+.5)/Math.pow(2,i)),a=Math.atan(.5*(Math.exp(l)-Math.exp(-l)))/po;return new Uo(a,s)}static get units(){return Vo}constructor(e,i){if(e===void 0)throw new Error("No latitude given.");if(i&&!Vo[i])throw new Error(`Unknown unit ${i}. Use one of: ${Object.keys(Vo).join(", ")}`);const s=6378.137*po*(i?Vo[i]:1),l=Math.cos(e*po),a=1/(1-tu*(1-l*l)),h=Math.sqrt(a);this.kx=s*h*l,this.ky=s*h*a*(1-tu)}distance(e,i){const s=Ji(e[0]-i[0])*this.kx,l=(e[1]-i[1])*this.ky;return Math.sqrt(s*s+l*l)}bearing(e,i){const s=Ji(i[0]-e[0])*this.kx;return Math.atan2(s,(i[1]-e[1])*this.ky)/po}destination(e,i,s){const l=s*po;return this.offset(e,Math.sin(l)*i,Math.cos(l)*i)}offset(e,i,s){return[e[0]+i/this.kx,e[1]+s/this.ky]}lineDistance(e){let i=0;for(let s=0;s<e.length-1;s++)i+=this.distance(e[s],e[s+1]);return i}area(e){let i=0;for(let s=0;s<e.length;s++){const l=e[s];for(let a=0,h=l.length,m=h-1;a<h;m=a++)i+=Ji(l[a][0]-l[m][0])*(l[a][1]+l[m][1])*(s?-1:1)}return Math.abs(i)/2*this.kx*this.ky}along(e,i){let s=0;if(i<=0)return e[0];for(let l=0;l<e.length-1;l++){const a=e[l],h=e[l+1],m=this.distance(a,h);if(s+=m,s>i)return jo(a,h,(i-(s-m))/m)}return e[e.length-1]}pointToSegmentDistance(e,i,s){let[l,a]=i,h=Ji(s[0]-l)*this.kx,m=(s[1]-a)*this.ky;if(h!==0||m!==0){const g=(Ji(e[0]-l)*this.kx*h+(e[1]-a)*this.ky*m)/(h*h+m*m);g>1?(l=s[0],a=s[1]):g>0&&(l+=h/this.kx*g,a+=m/this.ky*g)}return h=Ji(e[0]-l)*this.kx,m=(e[1]-a)*this.ky,Math.sqrt(h*h+m*m)}pointOnLine(e,i){let s=1/0,l=e[0][0],a=e[0][1],h=0,m=0;for(let g=0;g<e.length-1;g++){let x=e[g][0],p=e[g][1],y=Ji(e[g+1][0]-x)*this.kx,w=(e[g+1][1]-p)*this.ky,v=0;y===0&&w===0||(v=(Ji(i[0]-x)*this.kx*y+(i[1]-p)*this.ky*w)/(y*y+w*w),v>1?(x=e[g+1][0],p=e[g+1][1]):v>0&&(x+=y/this.kx*v,p+=w/this.ky*v)),y=Ji(i[0]-x)*this.kx,w=(i[1]-p)*this.ky;const b=y*y+w*w;b<s&&(s=b,l=x,a=p,h=g,m=v)}return{point:[l,a],index:h,t:Math.max(0,Math.min(1,m))}}lineSlice(e,i,s){let l=this.pointOnLine(s,e),a=this.pointOnLine(s,i);if(l.index>a.index||l.index===a.index&&l.t>a.t){const x=l;l=a,a=x}const h=[l.point],m=l.index+1,g=a.index;!iu(s[m],h[0])&&m<=g&&h.push(s[m]);for(let x=m+1;x<=g;x++)h.push(s[x]);return iu(s[g],a.point)||h.push(a.point),h}lineSliceAlong(e,i,s){let l=0;const a=[];for(let h=0;h<s.length-1;h++){const m=s[h],g=s[h+1],x=this.distance(m,g);if(l+=x,l>e&&a.length===0&&a.push(jo(m,g,(e-(l-x))/x)),l>=i)return a.push(jo(m,g,(i-(l-x))/x)),a;l>e&&a.push(g)}return a}bufferPoint(e,i){const s=i/this.ky,l=i/this.kx;return[e[0]-l,e[1]-s,e[0]+l,e[1]+s]}bufferBBox(e,i){const s=i/this.ky,l=i/this.kx;return[e[0]-l,e[1]-s,e[2]+l,e[3]+s]}insideBBox(e,i){return Ji(e[0]-i[0])>=0&&Ji(e[0]-i[2])<=0&&e[1]>=i[1]&&e[1]<=i[3]}}function iu(n,e){return n[0]===e[0]&&n[1]===e[1]}function jo(n,e,i){const s=Ji(e[0]-n[0]);return[n[0]+s*i,n[1]+(e[1]-n[1])*i]}function Ji(n){for(;n<-180;)n+=360;for(;n>180;)n-=360;return n}class Ua{constructor(e=[],i=(s,l)=>s<l?-1:s>l?1:0){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const 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){const{data:i,compare:s}=this,l=i[e];for(;e>0;){const a=e-1>>1,h=i[a];if(s(l,h)>=0)break;i[e]=h,e=a}i[e]=l}_down(e){const{data:i,compare:s}=this,l=this.length>>1,a=i[e];for(;e<l;){let h=1+(e<<1);const m=h+1;if(m<this.length&&s(i[m],i[h])<0&&(h=m),s(i[h],a)>=0)break;i[e]=i[h],e=h}i[e]=a}}var ht=8192;function Bl(n,e){return e.dist-n.dist}const fs=100,Ar=50;function Jh(n){const e=[1/0,1/0,-1/0,-1/0];if(e.length!==n.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==n[i])return!1;return!0}function Nl(n){return n[1]-n[0]+1}function ms(n,e){const i=n[1]>=n[0]&&n[1]<e;return i||console.warn("Distance Expression: Index is out of range"),i}function qo(n,e){if(n[0]>
14n[1])return[null,null];const i=Nl(n);if(e){if(i===2)return[n,null];const s=Math.floor(i/2);return[[n[0],n[0]+s],[n[0]+s,n[1]]]}{if(i===1)return[n,null];const s=Math.floor(i/2)-1;return[[n[0],n[0]+s],[n[0]+s+1,n[1]]]}}function Vs(n,e){const i=[1/0,1/0,-1/0,-1/0];if(!ms(e,n.length))return i;for(let s=e[0];s<=e[1];++s)Na(i,n[s]);return i}function Go(n){const e=[1/0,1/0,-1/0,-1/0];for(let i=0;i<n.length;++i)for(let s=0;s<n[i].length;++s)Na(e,n[i][s]);return e}function $o(n,e,i){if(Jh(n)||Jh(e))return NaN;let s=0,l=0;return n[2]<e[0]&&(s=e[0]-n[2]),n[0]>e[2]&&(s=n[0]-e[2]),n[1]>e[3]&&(l=n[1]-e[3]),n[3]<e[1]&&(l=e[1]-n[3]),i.distance([0,0],[s,l])}function Qp(n){return 360*n-180}function ef(n){return 360/Math.PI*Math.atan(Math.exp((180-360*n)*Math.PI/180))-90}function ru(n,e){const i=Math.pow(2,e.z),s=(n.y/ht+e.y)/i;return[Qp((n.x/ht+e.x)/i),ef(s)]}function Qh(n,e){const i=[];for(let s=0;s<n.length;++s)i.push(ru(n[s],e));return i}function ed(n,e,i){const s=i.pointOnLine(e,n).point;return i.distance(n,s)}function td(n,e,i,s,l){const a=i.slice(s[0],s[1]+1);let h=1/0;for(let m=e[0];m<=e[1];++m)if((h=Math.min(h,ed(n[m],a,l)))===0)return 0;return h}function Vl(n,e,i,s,l){const a=Math.min(l.pointToSegmentDistance(n,i,s),l.pointToSegmentDistance(e,i,s)),h=Math.min(l.pointToSegmentDistance(i,n,e),l.pointToSegmentDistance(s,n,e));return Math.min(a,h)}function tf(n,e,i,s,l){if(!ms(e,n.length)||!ms(s,i.length))return NaN;let a=1/0;for(let h=e[0];h<e[1];++h)for(let m=s[0];m<s[1];++m){if(kl(n[h],n[h+1],i[m],i[m+1]))return 0;a=Math.min(a,Vl(n[h],n[h+1],i[m],i[m+1],l))}return a}function fo(n,e,i,s,l){if(!ms(e,n.length)||!ms(s,i.length))return NaN;let a=1/0;for(let h=e[0];h<=e[1];++h)for(let m=s[0];m<=s[1];++m)if((a=Math.min(a,l.distance(n[h],i[m])))===0)return a;return a}function rf(n,e,i){if(uo(n,e,!0))return 0;let s=1/0;for(const l of e){const a=l.length;if(a<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(l[0]!==l[a-1]&&(s=Math.min(s,i.pointToSegmentDistance(n,l[a-1],l[0])))===0||(s=Math.min(s,ed(n,l,i)))===0)return s}return s}function nf(n,e,i,s){if(!ms(e,n.length))return NaN;for(let a=e[0];a<=e[1];++a)if(uo(n[a],i,!0))return 0;let l=1/0;for(let a=e[0];a<e[1];++a)for(const h of i)for(let m=0,g=h.length,x=g-1;m<g;x=m++){if(kl(n[a],n[a+1],h[x],h[m]))return 0;l=Math.min(l,Vl(n[a],n[a+1],h[x],h[m],s))}return l}function Ul(n,e){for(const i of n)for(let s=0;s<=i.length-1;++s)if(uo(i[s],e,!0))return!0;return!1}function id(n,e,i,s=1/0){const l=Go(n),a=Go(e);if(s!==1/0&&$o(l,a,i)>=s)return s;if(Va(l,a)){if(Ul(n,e))return 0}else if(Ul(e,n))return 0;let h=s;for(const m of n)for(let g=0,x=m.length,p=x-1;g<x;p=g++)for(const y of e)for(let w=0,v=y.length,b=v-1;w<v;b=w++){if(kl(m[p],m[g],y[b],y[w]))return 0;h=Math.min(h,Vl(m[p],m[g],y[b],y[w],i))}return h}function ja(n,e,i,s,l,a,h){if(a===null||h===null)return;const m=$o(Vs(s,a),Vs(l,h),i);m<e&&n.push({dist:m,range1:a,range2:h})}function Nn(n,e,i,s,l=1/0){let a=Math.min(s.distance(n[0],i[0][0]),l);if(a===0)return a;const h=new Ua([{dist:0,range1:[0,n.length-1],range2:[0,0]}],Bl),m=e?Ar:fs,g=Go(i);for(;h.length;){const x=h.pop();if(x.dist>=a)continue;const p=x.range1;if(Nl(p)<=m){if(!ms(p,n.length))return NaN;if(e){const y=nf(n,p,i,s);if((a=Math.min(a,y))===0)return a}else for(let y=p[0];y<=p[1];++y){const w=rf(n[y],i,s);if((a=Math.min(a,w))===0)return a}}else{const y=qo(p,e);if(y[0]!==null){const w=$o(Vs(n,y[0]),g,s);w<a&&h.push({dist:w,range1:y[0],range2:[0,0]})}if(y[1]!==null){const w=$o(Vs(n,y[1]),g,s);w<a&&h.push({dist:w,range1:y[1],range2:[0,0]})}}}return a}function nu(n,e,i,s,l,a=1/0){let h=Math.min(a,l.distance(n[0],i[0]));if(h===0)return h;const m=new Ua([{dist:0,range1:[0,n.length-1],range2:[0,i.length-1]}],Bl),g=e?Ar:fs,x=s?Ar:fs;for(;m.length;){const p=m.pop();if(p.dist>=h)continue;const y=p.range1,w=p.range2;if(Nl(y)<=g&&Nl(w)<=x){if(!ms(y,n.length)||!ms(w,i.length))return NaN;if(e&&s?h=Math.min(h,tf(n,y,i,w,l)):e||s?e&&!s?h=Math.min(h,td(i,w,n,y,l)):!e&&s&&(h=Math.min(h,td(n,y,i,w,l))):h=Math.min(h,fo(n,y,i,w,l)),h===0)return h}else{const v=qo(y,e),b=qo(w,s);ja(m,h,l,n,i,v[0],b[0]),ja(m,h,l,n,i,v[0],b[1]),ja(m,h,l,n,i,v[1],b[0]),ja(m,h,l,n,i,v[1],b[1])}}return h}function jl(n,e,i,s,l=1/0){let a=l;const h=Vs(n,[0,n.length-1]);for(const m of i)if(!(a!==1/0&&$o(h,Vs(m,[0,m.length-1]),s)>=a)&&(a=Math.min(a,nu(n,e,m,!0,s,a)),a===0))return a;return a}function qa(n,e,i,s,l=1/0){let a=l;const h=Vs(n,[0,n.length-1]);for(const m of i){if(a!==1/0&&$o(h,Go(m),s)>=a)continue;const g=Nn(n,e,m,s,a);if(isNaN(g))return g;if((a=Math.min(a,g))===0)return a}return a}function ql(n){return n==="Point"||n==="MultiPoint"||n==="LineString"||n==="MultiLineString"||n==="Polygon"||n==="MultiPolygon"}class Us{constructor(e,i){this.type=At,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'distance' expression requires either one argument, but found ' ${e.length-1} instead.`);if(Bn(e[1])){const s=e[1];if(s.type==="FeatureCollection"){for(let l=0;l<s.features.length;++l)if(ql(s.features[l].geometry.type))return new Us(s,s.features[l].geometry)}else if(s.type==="Feature"){if(ql(s.geometry.type))return new Us(s,s.geometry)}else if(ql(s.type))return new Us(s,s)}return i.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(e){const i=e.geometry(),s=e.canonicalID();if(i!=null&&s!=null){if(e.geometryType()==="Point")return function(l,a,h){const m=[];for(const x of l)for(const p of x)m.push(ru(p,a));const g=new Uo(m[0][1],"meters");return h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString"?nu(m,!1,h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",g):h.type==="MultiLineString"?jl(m,!1,h.coordinates,g):h.type==="Polygon"||h.type==="MultiPolygon"?qa(m,!1,h.type==="Polygon"?[h.coordinates]:h.coordinates,g):null}(i,s,this.geometries);if(e.geometryType()==="LineString")return function(l,a,h){const m=[];for(const x of l){const p=[];for(const y of x)p.push(ru(y,a));m.push(p)}const g=new Uo(m[0][0][1],"meters");if(h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString")return jl(h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",m,g);if(h.type==="MultiLineString"){let x=1/0;for(let p=0;p<h.coordinates.length;p++){const y=jl(h.coordinates[p],!0,m,g,x);if(isNaN(y))return y;if((x=Math.min(x,y))===0)return x}return x}if(h.type==="Polygon"||h.type==="MultiPolygon"){let x=1/0;for(let p=0;p<m.length;p++){const y=qa(m[p],!0,h.type==="Polygon"?[h.coordinates]:h.coordinates,g,x);if(isNaN(y))return y;if((x=Math.min(x,y))===0)return x}return x}return null}(i,s,this.geometries);if(e.geometryType()==="Polygon")return function(l,a,h){const m=[];for(const x of function(p,y){const w=p.length;
14if(w<=1)return[p];const v=[];let b,S;for(let A=0;A<w;A++){const C=Wp(p[A]);C!==0&&(p[A].area=Math.abs(C),S===void 0&&(S=C<0),S===C<0?(b&&v.push(b),b=[p[A]]):b.push(p[A]))}return b&&v.push(b),v}(l)){const p=[];for(let y=0;y<x.length;++y)p.push(Qh(x[y],a));m.push(p)}const g=new Uo(m[0][0][0][1],"meters");if(h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString")return qa(h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",m,g);if(h.type==="MultiLineString"){let x=1/0;for(let p=0;p<h.coordinates.length;p++){const y=qa(h.coordinates[p],!0,m,g,x);if(isNaN(y))return y;if((x=Math.min(x,y))===0)return x}return x}return h.type==="Polygon"||h.type==="MultiPolygon"?function(x,p,y){let w=1/0;for(const v of x)for(const b of p){const S=id(v,b,y,w);if(isNaN(S))return S;if((w=Math.min(w,S))===0)return w}return w}(h.type==="Polygon"?[h.coordinates]:h.coordinates,m,g):null}(i,s,this.geometries);console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries.")}else console.warn("Distance Expression: requirs valid feature and canonical information.");return null}eachChild(){}outputDefined(){return!0}serialize(){return["distance",this.geojson]}}function Gl(n,e){switch(n){case"string":return xr(e);case"number":return+e;case"boolean":return!!e;case"color":return Mi.parse(e);case"formatted":return Dr.fromString(xr(e));case"resolvedImage":return Or.build(xr(e))}return e}function su(n,e,i,s){return s!==void 0&&(n=s*Math.round(n/s)),e!==void 0&&n<e&&(n=e),i!==void 0&&n>i&&(n=i),n}class mo{constructor(e,i,s){this.type=e,this.key=i,this.scope=s}static parse(e,i){let s=i.expectedType;if(s==null&&(s=gi),e.length<2||e.length>3)return i.error("Invalid number of arguments for 'config' expression.");const l=i.parse(e[1],1);if(!(l instanceof us))return i.error("Key name of 'config' expression must be a string literal.");if(e.length>=3){const a=i.parse(e[2],2);return a instanceof us?new mo(s,xr(l.value),xr(a.value)):i.error("Scope of 'config' expression must be a string literal.")}return new mo(s,xr(l.value))}evaluate(e){const i=[this.key,this.scope,e.scope].filter(Boolean).join("�"),s=e.getConfig(i);if(!s)return null;const{type:l,value:a,values:h,minValue:m,maxValue:g,stepValue:x}=s,p=s.default.evaluate(e);let y=p;if(a){const w=e.scope;e.scope=(w||"").split("�").slice(1).join("�"),y=a.evaluate(e),e.scope=w}return l&&(y=Gl(l,y)),y===void 0||m===void 0&&g===void 0&&x===void 0||(typeof y=="number"?y=su(y,m,g,x):Array.isArray(y)&&(y=y.map(w=>typeof w=="number"?su(w,m,g,x):w))),a!==void 0&&y!==void 0&&h&&!h.includes(y)&&(y=p,l&&(y=Gl(l,y))),(l&&l!==this.type||y!==void 0&&or(y)!==this.type)&&(y=Gl(this.t
14ype.kind,y)),y}eachChild(){}outputDefined(){return!1}serialize(){const e=["config",this.key];return this.scope&&e.concat(this.key),e}}function Ho(n){if(n instanceof Ur&&(n.name==="get"&&n.args.length===1||n.name==="feature-state"||n.name==="has"&&n.args.length===1||n.name==="properties"||n.name==="geometry-type"||n.name==="id"||/^filter-/.test(n.name))||n instanceof ps||n instanceof Us)return!1;let e=!0;return n.eachChild(i=>{e&&!Ho(i)&&(e=!1)}),e}function Ga(n){if(n instanceof Ur&&n.name==="feature-state")return!1;let e=!0;return n.eachChild(i=>{e&&!Ga(i)&&(e=!1)}),e}function $a(n){if(n instanceof mo)return new Set([n.key]);let e=new Set;return n.eachChild(i=>{e=new Set([...e,...$a(i)])}),e}function _s(n,e){if(n instanceof Ur&&e.indexOf(n.name)>=0)return!1;let i=!0;return n.eachChild(s=>{i&&!_s(s,e)&&(i=!1)}),i}class _o{constructor(e,i){this.type=i.type,this.name=e,this.boundExpression=i}static parse(e,i){if(e.length!==2||typeof e[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");const s=e[1];return i.scope.has(s)?new _o(s,i.scope.get(s)):i.error(`Unknown variable "${s}". Make sure "${s}" 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 Zo{constructor(e,i=[],s,l=new Ll,a=[],h,m){this.registry=e,this.path=i,this.key=i.map(g=>typeof g=="string"?`['${g}']`:`[${g}]`).join(""),this.scope=l,this.errors=a,this.expectedType=s,this._scope=h,this.options=m}parse(e,i,s,l,a={}){return i||s?this.concat(i,null,s,l)._parse(e,a):this._parse(e,a)}parseObjectValue(e,i,s,l,a,h={}){return this.concat(i,s,l,a)._parse(e,h)}_parse(e,i){function s(l,a,h){return h==="assert"?new pn(a,[l]):h==="coerce"?new ds(a,[l]):l}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const l=typeof e[0]=="string"?this.registry[e[0]]:void 0;if(l){let a=l.parse(e,this);if(!a)return null;if(this.expectedType){const h=this.expectedType,m=a.type;if(h.kind!=="string"&&h.kind!=="number"&&h.kind!=="boolean"&&h.kind!=="object"&&h.kind!=="array"||m.kind!=="value")if(h.kind!=="color"&&h.kind!=="formatted"&&h.kind!=="resolvedImage"||m.kind!=="value"&&m.kind!=="string"){if(this.checkSubtype(h,m))return null}else a=s(a,h,i.typeAnnotation||"coerce");else a=s(a,h,i.typeAnnotation||"assert")}if(!(a instanceof us)&&a.type.kind!=="resolvedImage"&&$l(a)){const h=new Ol(this._scope,this.options);try{a=new us(a.type,a.evaluate(h))}catch(m){return this.error(m.message),null}}return a}return ds.parse(["to-array",e],this)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,i,s,l){let a=typeof e=="number"?this.path.concat(e):this.path;a=typeof i=="string"?a.concat(i):a;const h=l?this.scope.concat(l):this.scope;return new Zo(this.registry,a,s||null,h,this.errors,this._scope,this.options)}error(e,...i){const s=`${this.key}${i.map(l=>`[${l}]`).join("")}`;this.errors.push(new En(s,e))}checkSubtype(e,i){const s=Fo(e,i);return s&&this.error(s),s}}var ou=Zo;function $l(n){if(n instanceof _o)return $l(n.boundExpression);if(n instanceof Ur&&n.name==="error"||n instanceof co||n instanceof ps||n instanceof Us||n instanceof mo)return!1;const e=n instanceof ds||n instanceof pn;let i=!0;return n.eachChild(s=>{i=e?i&&$l(s):i&&s instanceof us}),!!i&&Ho(n)&&_s(n,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])}function Ha(n,e){const i=n.length-1;let s,l,a=0,h=i,m=0;for(;a<=h;)if(m=Math.floor((a+h)/2),s=n[m],l=n[m+1],s<=e){if(m===i||e<l)return m;a=m+1}else{if(!(s>e))throw new ir("Input is not a number.");h=m-1}return 0}class Kn{constructor(e,i,s){this.type=e,this.input=i,this.labels=[],this.outputs=[];for(const[l,a]of s)this.labels.push(l),this.outputs.push(a)}static parse(e,i){if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");const s=i.parse(e[1],1,At);if(!s)return null;const l=[];let a=null;i.expectedType&&i.expectedType.kind!=="value"&&(a=i.expectedType);for(let h=1;h<e.length;h+=2){const m=h===1?-1/0:e[h],g=e[h+1],x=h,p=h+1;if(typeof m!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not c
14omputed expressions) for the input values.',x);if(l.length&&l[l.length-1][0]>=m)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',x);const y=i.parse(g,p,a);if(!y)return null;a=a||y.type,l.push([m,y])}return new Kn(a,s,l)}evaluate(e){const i=this.labels,s=this.outputs;if(i.length===1)return s[0].evaluate(e);const l=this.input.evaluate(e);if(l<=i[0])return s[0].evaluate(e);const a=i.length;return l>=i[a-1]?s[a-1].evaluate(e):s[Ha(i,l)].evaluate(e)}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){const e=["step",this.input.serialize()];for(let i=0;i<this.labels.length;i++)i>0&&e.push(this.labels[i]),e.push(this.outputs[i].serialize());return e}}const li=.95047,rd=1.08883,nd=4/29,Wo=6/29,au=3*Wo*Wo,sf=Wo*Wo*Wo,Vi=Math.PI/180,of=180/Math.PI;function lu(n){return n>sf?Math.pow(n,1/3):n/au+nd}function cu(n){return n>Wo?n*n*n:au*(n-nd)}function uu(n){return 255*(n<=.0031308?12.92*n:1.055*Math.pow(n,1/2.4)-.055)}function hu(n){return(n/=255)<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function sd(n){const e=hu(n.r),i=hu(n.g),s=hu(n.b),l=lu((.4124564*e+.3575761*i+.1804375*s)/li),a=lu((.2126729*e+.7151522*i+.072175*s)/1);return{l:116*a-16,a:500*(l-a),b:200*(a-lu((.0193339*e+.119192*i+.9503041*s)/rd)),alpha:n.a}}function od(n){let e=(n.l+16)/116,i=isNaN(n.a)?e:e+n.a/500,s=isNaN(n.b)?e:e-n.b/200;return e=1*cu(e),i=li*cu(i),s=rd*cu(s),new Mi(uu(3.2404542*i-1.5371385*e-.4985314*s),uu(-.969266*i+1.8760108*e+.041556*s),uu(.0556434*i-.2040259*e+1.0572252*s),n.alpha)}function af(n,e,i){const s=e-n;return n+i*(s>180||s<-180?s-360*Math.round(s/360):s)}const Za={forward:sd,reverse:od,interpolate:function(n,e,i){return{l:Ot(n.l,e.l,i),a:Ot(n.a,e.a,i),b:Ot(n.b,e.b,i),alpha:Ot(n.alpha,e.alpha,i)}}},Wa={forward:function(n){const{l:e,a:i,b:s}=sd(n),l=Math.atan2(s,i)*of;return{h:l<0?l+360:l,c:Math.sqrt(i*i+s*s),l:e,alpha:n.a}},reverse:function(n){const e=n.h*Vi,i=n.c;return od({l:n.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:n.alpha})},interpolate:function(n,e,i){return{h:af(n.h,e.h,i),c:Ot(n.c,e.c,i),l:Ot(n.l,e.l,i),alpha:Ot(n.alpha,e.alpha,i)}}};var ad=Object.freeze({__proto__:null,hcl:Wa,lab:Za});class fn{constructor(e,i,s,l,a){this.type=e,this.operator=i,this.interpolation=s,this.input=l,this.labels=[],this.outputs=[];for(const[h,m]of a)this.labels.push(h),this.outputs.push(m)}static interpolationFactor(e,i,s,l){let a=0;if(e.name==="exponential")a=du(i,e.base,s,l);else if(e.name==="linear")a=du(i,1,s,l);else if(e.name==="cubic-bezier"){const h=e.controlPoints;a=new Ls(h[0],h[1],h[2],h[3]).solve(du(i,1,s,l))}return a}static parse(e,i){let[s,l,a,...h]=e;if(!Array.isArray(l)||l.length===0)return i.error("Expected an interpolation type expression.",1);if(l[0]==="linear")l={name:"linear"};else if(l[0]==="exponential"){const x=l[1];if(typeof x!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);l={name:"exponential",base:x}}else{if(l[0]!=="cubic-bezier")return i.error(`Unknown interpolation type ${String(l[0])}`,1,0);{const x=l.slice(1);if(x.length!==4||x.some(p=>typeof p!="number"||p<0||p>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);l={name:"cubic-bezier",controlPoints:x}}}if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length-1>3&&(e.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(a=i.parse(a,2,At),!a)return null;const m=[];let g=null;s==="interpolate-hcl"||s==="interpolate-lab"?g=Lr:i.expectedType&&i.expectedType.kind!=="value"&&(g=i.expectedType);for(let x=0;x<h.length;x+=2){const p=h[x],y=h[x+1],w=x+3,v=x+4;if(typeof p!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',w);if(m.length&&m[m.length-1][0]>=p)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',w);const b=i.parse(y,v,g);if(!b)return null;g=g||b.type,m.push([p,b])}return g.kind==="number"||g.kind==="color"||g.kind==="array"&&g.itemType.kind==="number"&&typeof g.
14N=="number"?new fn(g,s,l,a,m):i.error(`Type ${er(g)} is not interpolatable.`)}evaluate(e){const i=this.labels,s=this.outputs;if(i.length===1)return s[0].evaluate(e);const l=this.input.evaluate(e);if(l<=i[0])return s[0].evaluate(e);const a=i.length;if(l>=i[a-1])return s[a-1].evaluate(e);const h=Ha(i,l),m=fn.interpolationFactor(this.interpolation,l,i[h],i[h+1]),g=s[h].evaluate(e),x=s[h+1].evaluate(e);return this.operator==="interpolate"?Da[this.type.kind.toLowerCase()](g,x,m):this.operator==="interpolate-hcl"?Wa.reverse(Wa.interpolate(Wa.forward(g),Wa.forward(x),m)):Za.reverse(Za.interpolate(Za.forward(g),Za.forward(x),m))}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e;e=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];const i=[this.operator,e,this.input.serialize()];for(let s=0;s<this.labels.length;s++)i.push(this.labels[s],this.outputs[s].serialize());return i}}function du(n,e,i,s){const l=s-i,a=n-i;return l===0?0:e===1?a/l:(Math.pow(e,a)-1)/(Math.pow(e,l)-1)}class Hl{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expectected at least one argument.");let s=null;const l=i.expectedType;l&&l.kind!=="value"&&(s=l);const a=[];for(const m of e.slice(1)){const g=i.parse(m,1+a.length,s,void 0,{typeAnnotation:"omit"});if(!g)return null;s=s||g.type,a.push(g)}const h=l&&a.some(m=>Fo(l,m.type));return new Hl(h?gi:s,a)}evaluate(e){let i,s=null,l=0;for(const a of this.args){if(l++,s=a.evaluate(e),s&&s instanceof Or&&!s.available&&(i||(i=s),s=null,l===this.args.length))return i;if(s!==null)break}return s}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=["coalesce"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class Zl{constructor(e,i){this.type=i.type,this.bindings=[].concat(e),this.result=i}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const i of this.bindings)e(i[1]);e(this.result)}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const s=[];for(let a=1;a<e.length-1;a+=2){const h=e[a];if(typeof h!="string")return i.error(`Expected string, but found ${typeof h} instead.`,a);if(/[^a-zA-Z0-9_]/.test(h))return i.error("Variable names must contain only alphanumeric characters or '_'.",a);const m=i.parse(e[a+1],a+1);if(!m)return null;s.push([h,m])}const l=i.parse(e[e.length-1],e.length-1,i.expectedType,s);return l?new Zl(s,l):null}outputDefined(){return this.result.outputDefined()}serialize(){const e=["let"];for(const[i,s]of this.bindings)e.push(i,s.serialize());return e.push(this.result.serialize()),e}}class pu{constructor(e,i,s){this.type=e,this.index=i,this.input=s}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,At),l=i.parse(e[2],2,Ir(i.expectedType||gi));return s&&l?new pu(l.type.itemType,s,l):null}evaluate(e){const i=this.index.evaluate(e),s=this.input.evaluate(e);if(i<0)throw new ir(`Array index out of bounds: ${i} < 0.`);if(i>=s.length)throw new ir(`Array index out of bounds: ${i} > ${s.length-1}.`);if(i!==Math.floor(i))throw new ir(`Array index must be an integer, but found ${i} instead. Use at-interpolated to retrieve interpolated result with a fractional index.`);return s[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class fu{constructor(e,i,s){this.type=e,this.index=i,this.input=s}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,At),l=i.parse(e[2],2,Ir(i.expectedType||gi));return s&&l?new fu(l.type.itemType,s,l):null}evaluate(e){const i=this.index.evaluate(e),s=this.input.evaluate(e);if(i<0)throw new ir(`Array index out of bounds: ${i} < 0.`);if(i>s.length-1)throw new ir(`Array index out of bounds: ${i} > ${s.length-1}.`);if(i===Math.floor(i))return s[i];const l=Math.floor(i),a=Math.ceil(i),h=s[l],m=s[a];if(typeof h!="number"||typeof m!="number")throw new ir(`Cannot interpolate between non-number values at index ${i}.`);const g=i-l;return h*(1-g)+m*g}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class mu{constructor(e,i){this.type=pi,this.needle=e,this.haystack=i}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,gi),l=i.parse(e[2],2,gi);return s&&l?Jc(s.type,[pi,Ti,At,Oo,gi])?new mu(s,l):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${er(s.type)} instead`):null}evaluate(e){const i=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(s==null)return!1;if(!Bo(i,["boolean","string","number","null"]))throw new ir(`Expected first argument to be of type boolean, string, number or null, but found ${er(or(i))} instead.`);if(!Bo(s,["string","array"]))throw new ir(`Expected second argument to be of type array or string, but found ${er(or(s))} instead.`);return s.indexOf(i)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class Wl{constructor(e,i,s){this.type=At,this.needle=e,this.haystack=i,this.fromIndex=s}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,gi),l=i.parse(e[2],2,gi);if(!s||!l)return null;if(!Jc(s.type,[pi,Ti,At,Oo,gi]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${er(s.type)} instead`);if(e.length===4){const a=i.parse(e[3],3,At);return a?new Wl(s,l,a):null}return new Wl(s,l)}evaluate(e){const i=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!Bo(i,["boolean","string","number","null"]))throw new ir(`Expected first argument to be of type boolean, string, number or null, but found ${er(or(i))} instead.`);if(!Bo(s,["string","array"]))throw new ir(`Expected second argument to be of type array or string, but found ${er(or(s))} instead.`);if(this.fromIndex){const l=this.fromIndex.evaluate(e);return s.indexOf(i,l)}return s.indexOf(i)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){const e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class _u{constructor(e,i,s,l,a,h){this.inputType=e,this.type=i,this.input=s,this.cases=l,this.outputs=a,this.otherwise=h}static parse(e,i){if(e.length<5)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return i.error("Expected an even number of arguments.");let s,l;i.expectedType&&i.expectedType.kind!=="value"&&(l=i.expectedType);const a={},h=[];for(let x=2;x<e.length-1;x+=2){let p=e[x];const y=e[x+1];Array.isArray(p)||(p=[p]);const w=i.concat(x);if(p.length===0)return w.error("Expected at least one branch label.");for(const b of p){if(typeof b!="number"&&typeof b!="string")return w.error("Branch labels must be numbers or strings.");if(typeof b=="number"&&Math.abs(b)>Number.MAX_SAFE_INTEGER)return w.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof b=="number"&&Math.floor(b)!==b)return w.error("Numeric branch labels must be integer values.");if(s){if(w.checkSubtype(s,or(b)))return null}else s=or(b);if(a[String(b)]!==void 0)return w.error("Branch labels must be unique.");a[String(b)]=h.length}const v=i.parse(y,x,l);if(!v)return null;l=l||v.type,h.push(v)}const m=i.parse(e[1],1,gi);if(!m)return null;const g=i.parse(e[e.length-1],e.length-1,l);return g?m.type.kind!=="value"&&i.concat(1).checkSubtype(s,m.type)?null:new _u(s,l,m,a,h,g):null}evaluate(e){const i=this.input.evaluate(e);return(or(i)===this.inputType&&this.outputs[this.cases[i]]||this.otherwise).evaluate(e)}
vendor: 18,056 bytes, line 14
14eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["match",this.input.serialize()],i=Object.keys(this.cases).sort(),s=[],l={};for(const h of i){const m=l[this.cases[h]];m===void 0?(l[this.cases[h]]=s.length,s.push([this.cases[h],[h]])):s[m][1].push(h)}const a=h=>this.inputType.kind==="number"?Number(h):h;for(const[h,m]of s)e.push(m.length===1?a(m[0]):m.map(a)),e.push(this.outputs[h].serialize());return e.push(this.otherwise.serialize()),e}}class gu{constructor(e,i,s){this.type=e,this.branches=i,this.otherwise=s}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return i.error("Expected an odd number of arguments.");let s;i.expectedType&&i.expectedType.kind!=="value"&&(s=i.expectedType);const l=[];for(let h=1;h<e.length-1;h+=2){const m=i.parse(e[h],h,pi);if(!m)return null;const g=i.parse(e[h+1],h+1,s);if(!g)return null;l.push([m,g]),s=s||g.type}const a=i.parse(e[e.length-1],e.length-1,s);return a?new gu(s,l,a):null}evaluate(e){for(const[i,s]of this.branches)if(i.evaluate(e))return s.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[i,s]of this.branches)e(i),e(s);e(this.otherwise)}outputDefined(){return this.branches.every(([e,i])=>i.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class Xl{constructor(e,i,s,l){this.type=e,this.input=i,this.beginIndex=s,this.endIndex=l}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,gi),l=i.parse(e[2],2,At);if(!s||!l)return null;if(!Jc(s.type,[Ir(gi),Ti,gi]))return i.error(`Expected first argument to be of type array or string, but found ${er(s.type)} instead`);if(e.length===4){const a=i.parse(e[3],3,At);return a?new Xl(s.type,s,l,a):null}return new Xl(s.type,s,l)}evaluate(e){const i=this.input.evaluate(e),s=this.beginIndex.evaluate(e);if(!Bo(i,["string","array"]))throw new ir(`Expected first argument to be of type array or string, but found ${er(or(i))} instead.`);if(this.endIndex){const l=this.endIndex.evaluate(e);return i.slice(s,l)}return i.slice(s)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){const e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function ld(n,e){return n==="=="||n==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function cd(n,e,i,s){return s.compare(e,i)===0}function Xo(n,e,i){const s=n!=="=="&&n!=="!=";return class y0{constructor(a,h,m){this.type=pi,this.lhs=a,this.rhs=h,this.collator=m,this.hasUntypedArgument=a.type.kind==="value"||h.type.kind==="value"}static parse(a,h){if(a.length!==3&&a.length!==4)return h.error("Expected two or three arguments.");const m=a[0];let g=h.parse(a[1],1,gi);if(!g)return null;if(!ld(m,g.type))return h.concat(1).error(`"${m}" comparisons are not supported for type '${er(g.type)}'.`);let x=h.parse(a[2],2,gi);if(!x)return null;if(!ld(m,x.type))return h.concat(2).error(`"${m}" comparisons are not supported for type '${er(x.type)}'.`);if(g.type.kind!==x.type.kind&&g.type.kind!=="value"&&x.type.kind!=="value")return h.error(`Cannot compare types '${er(g.type)}' and '${er(x.type)}'.`);s&&(g.type.kind==="value"&&x.type.kind!=="value"?g=new pn(x.type,[g]):g.type.kind!=="value"&&x.type.kind==="value"&&(x=new pn(g.type,[x])));let p=null;if(a.length===4){if(g.type.kind!=="string"&&x.type.kind!=="string"&&g.type.kind!=="value"&&x.type.kind!=="value")return h.error("Cannot use collator to compare non-string types.");if(p=h.parse(a[3],3,ls),!p)return null}return new y0(g,x,p)}evaluate(a){const h=this.lhs.evaluate(a),m=this.rhs.evaluate(a);if(s&&this.hasUntypedArgument){const g=or(h),x=or(m);if(g.kind!==x.kind||g.kind!=="string"&&g.kind!=="number")throw new ir(`Expected arguments for "${n}" to be (string, string) or (number, number), but found (${g.kind}, ${x.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const g=or(h),x=or(m);if(g.kind!=="string"||x.kind!=="string")return e(a,h,m)}return this.collator?i(a,h,m,this.collator.evaluate(a)):e(a,h,m)}eachChild(a){a(this.lhs),a(this.rhs),this.collator&&a(this.collator)}outputDefined(){return!0}serialize(){const a=[n];return this.eachChild(h=>{a.push(h.serialize())}),a}}}const lf=Xo("==",function(n,e,i){return e===i},cd),cf=Xo("!=",function(n,e,i){return e!==i},function(n,e,i,s){return!cd(0,e,i,s)}),uf=Xo("<",function(n,e,i){return e<i},function(n,e,i,s){return s.compare(e,i)<0}),hf=Xo(">",function(n,e,i){return e>i},function(n,e,i,s){return s.compare(e,i)>0}),df=Xo("<=",function(n,e,i){return e<=i},function(n,e,i,s){return s.compare(e,i)<=0}),pf=Xo(">=",function(n,e,i){return e>=i},function(n,e,i,s){return s.compare(e,i)>=0});class Xa{constructor(e,i,s,l,a,h){this.type=Ti,this.number=e,this.locale=i,this.currency=s,this.unit=l,this.minFractionDigits=a,this.maxFractionDigits=h}static parse(e,i){if(e.length!==3)return i.error("Expected two arguments.");const s=i.parse(e[1],1,At);if(!s)return null;const l=e[2];if(typeof l!="object"||Array.isArray(l))return i.error("NumberFormat options argument must be an object.");let a=null;if(l.locale&&(a=i.parseObjectValue(l.locale,2,"locale",Ti),!a))return null;let h=null;if(l.currency&&(h=i.parseObjectValue(l.currency,2,"currency",Ti),!h))return null;let m=null;if(l.unit&&(m=i.parseObjectValue(l.unit,2,"unit",Ti),!m))return null;let g=null;if(l["min-fraction-digits"]&&(g=i.parseObjectValue(l["min-fraction-digits"],2,"min-fraction-digits",At),!g))return null;let x=null;return l["max-fraction-digits"]&&(x=i.parseObjectValue(l["max-fraction-digits"],2,"max-fraction-digits",At),!x)?null:new Xa(s,a,h,m,g,x)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class yu{constructor(e){this.type=At,this.input=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const s=i.parse(e[1],1);return s?s.type.kind!=="array"&&s.type.kind!=="string"&&s.type.kind!=="value"?i.error(`Expected argument of type string or array, but found ${er(s.type)} instead.`):new yu(s):null}evaluate(e){const i=this.input.evaluate(e);if(typeof i=="string"||Array.isArray(i))return i.length;throw new ir(`Expected value to be of type string or array, but found ${er(or(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild(i=>{e.push(i.serialize())}),e}}function vu(n){return function(){n=1831565813+(n|=0)|0;let e=Math.imul(n^n>>>15,1|n);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}const Yo={"==":lf,"!=":cf,">":hf,"<":uf,">=":pf,"<=":df,array:pn,at:pu,"at-interpolated":fu,boolean:pn,case:gu,coalesce:Hl,collator:co,format:No,image:Fs,in:mu,"index-of":Wl,interpolate:fn,"interpolate-hcl":fn,"interpolate-lab":fn,length:yu,let:Zl,literal:us,match:_u,number:pn,"number-format":Xa,object:pn,slice:Xl,step:Kn,string:pn,"to-boolean":ds,"to-color":ds,"to-number":ds,"to-string":ds,var:_o,within:ps,distance:Us,config:mo};function ud(n,[e,i,s,l]){e=e.evaluate(n),i=i.evaluate(n),s=s.evaluate(n);const a=l?l.evaluate(n):1,h=Fa(e,i,s,a);if(h)throw new ir(h);return new Mi(e/255*a,i/255*a,s/255*a,a)}function hd(n,[e,i,s,l]){e=e.evaluate(n),i=i.evaluate(n),s=s.evaluate(n);const a=l?l.evaluate(n):1,h=function(x,p,y,w){return typeof x=="number"&&x>=0&&x<=360?typeof p=="number"&&p>=0&&p<=100&&typeof y=="number"&&y>=0&&y<=100?w===void 0||typeof w=="number"&&w>=0&&w<=1?null:`Invalid hsla value [${[x,p,y,w].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof w=="number"?[x,p,y,w]:[x,p,y]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof w=="number"?[x,p,y,w]:[x,p,y]).join(", ")}]: 'h' must be between 0 and 360.`}(e,i,s,a);if(h)throw new ir(h);const m=`hsla(${e}, ${i}%, ${s}%, ${a})`,g=Mi.parse(m);if(!g)throw new ir(`Failed to parse HSLA color: ${m}`);return g}function xu(n,e){return n in e}function Yl(n,e){const i=e[n];return i===void 0?null:i}function Mn(n){return{type:n}}function bu(n){return{result:"success",value:n}}function gs(n){return{result:"error",value:n}}function wu(n,e){return!!n&&!!n.parameters&&n.parameters.indexOf(e)>-1}function Ko(n){return n["property-type"]==="data-driven"}function Kl(n){return wu(n.expression,"measure-light")}function dd(n){return wu(n.expression,"zoom")}function Tu(n){return!!n.expression&&n.expression.interpolated}function Jl(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function pd(n){return n}function fd(n,e){const i=e.type==="color",s=n.stops&&typeof n.stops[0][0]=="object",l=s||!(s||n.property!==void 0),a=n.type||(Tu(e)?"exponential":"interval");if(i&&((n=_i({},n)).stops&&(n.stops=n.stops.map(x=>[x[0],Mi.parse(x[1])])),n.default=Mi.parse(n.default?n.default:e.default)),n.colorSpace&&n.colorSpace!=="rgb"&&!ad[n.colorSpace])throw new Error(`Unknown color space: ${n.colorSpace}`);let h,m,g;if(a==="exponential")h=Su;else if(a==="interval")h=md;else if(a==="categorical"){h=ff,m=Object.create(null);for(const x of n.stops)m[x[0]]=x[1];g=typeof n.stops[0][0]}else{if(a!=="identity")throw new Error(`Unknown function type "${a}"`);h=Ql}if(s){const x={},p=[];for(let v=0;v<n.stops.length;v++){const b=n.stops[v],S=b[0].zoom;x[S]===void 0&&(x[S]={zoom:S,type:n.type,property:n.property,default:n.default,stops:[]},p.push(S)),x[S].stops.push([b[0].value,b[1]])}const y=[];for(const v of p)y.push([x[v].zoom,fd(x[v],e)]);const w={name:"linear"};return{kind:"composite",interpolationType:w,interpolationFactor:fn.interpolationFactor.bind(void 0,w),zoomStops:y.map(v=>v[0]),evaluate:({zoom:v},b)=>Su({stops:y,base:n.base},e,v).evaluate(v,b)}}if(l){const x=a==="exponential"?{name:"exponential",base:n.base!==void 0?n.base:1}:null;return{kind:"camera",interpolationType:x,interpolationFactor:fn.interpolationFactor.bind(void 0,x),zoomStops:n.stops.map(p=>p[0]),evaluate:({zoom:p})=>h(n,e,p,m,g)}}return{kind:"source",evaluate(x,p){const y=p&&p.properties?p.properties[n.property]:void 0;return y===void 0?Ya(n.default,e.default):h(n,e,y,m,g)}}}function Ya(n,e,i){return n!==void 0?n:e!==void 0?e:i!==void 0?i:void 0}function ff(n,e,i,s,l){return Ya(typeof i===l?s[i]:void 0,n.default,e.default)}function md(n,e,i){if(hs(i)!=="number")return Ya(n.default,e.default);const s=n.stops.length;if(s===1||i<=n.stops[0][0])return n.stops[0][1];if(i>=n.stops[s-1][0])return n.stops[s-1][1];const l=Ha(n.stops.map(a=>a[0]),i);return n.stops[l][1]}function Su(n,e,i){const s=n.base!==void 0?n.base:1;if(hs(i)!=="number")return Ya(n.default,e.default);const l=n.stops.length;if(l===1||i<=n.stops[0][0])return n.stops[0][1];if(i>=n.stops[l-1][0])return n.stops[l-1][1];const a=Ha(n.stops.map(p=>p[0]),i),h=function(p,y,w,v){const b=v-w,S=p-w;return b===0?0:y===1?S/b:(Math.pow(y,S)-1)/(Math.pow(y,b)-1)}(i,s,n.stops[a][0],n.stops[a+1][0]),m=n.stops[a][1],g=n.stops[a+1][1];let x=Da[e.type]||pd;if(n.colorSpace&&n.colorSpace!=="rgb"){const p=ad[n.colorSpace];x=(y,w)=>p.reverse(p.interpolate(p.forward(y),p.forward(w),h))}return typeof m.evaluate=="function"?{evaluate(...p){const y=m.evaluate.apply(void 0,p),w=g.evaluate.apply(void 0,p);if(y!==void 0&&w!==void 0)return x(y,w,h)}}:x(m,g,h)}function Ql(n,e,i){return e.type==="color"?i=Mi.parse(i):e.type==="formatted"?i=Dr.fromString(i.toString()):e.type==="resolvedImage"?i=Or.build(i.toString()):hs(i)===e.type||e.type==="enum"&&e.values[i]||(i=void 0),Ya(i,n.default,e.default)}Ur.register(Yo,{error:[{kind:"error"},[Ti],(n,[e])=>{throw new ir(e.evaluate(n))}],typeof:[Ti,[gi],(n,[e])=>er(or(e.evaluate(n)))],"to-rgba":[Ir(At,4),[Lr],(n,[e])=>e.evaluate(n).toRenderColor(null).toArray()],"to-hsla":[Ir(At,4),[Lr],(n,[e])=>e.evaluate(n).toRenderColor(null).toHslaArray()],rgb:[Lr,[At,At,At],ud],rgba:[Lr,[At,At,At,At],ud],hsl:[Lr,[At,At,At],hd],hsla:[Lr,[At,At,At,At],hd],has:{type:pi,overloads:[[[Ti],(n,[e])=>xu(e.evaluate(n),n.properties())],[[Ti,ko],(n,[e,i])=>xu(e.evaluate(n),i.evaluate(n))]]},get:{type:gi,overloads:[[[Ti],(n,[e])=>Yl(e.evaluate(n),n.properties())],[[Ti,ko],(n,[e,i])=>Yl(e.evaluate(n),i.evaluate(n))]]},"feature-state":[gi,[Ti],(n,[e])=>Yl(e.evaluate(n),n.featureState||{})],properties:[ko,[],n=>n.properties()],"geometry-type":[Ti,[],n=>n.geometryType()],id:[gi,[],n=>n.id()],zoom:[At,[],n=>n.globals.zoom],pitch:[At,[],n=>n.globals.pitch||0],"distance-from-center":[At,[],n=>n.distanceFromCenter()],"measure-light":[At,[Ti],(n,[e])=>n.measureLight(e.evaluate(n))],"heatmap-density":[At,[],n=>n.globals.heatmapDensity||0],"line-progress":[At,[],n=>n.globals.lineProgress||0],"raster-value":[At,[],n=>n.globals.rasterValue||0],"raster-particle-speed":[At,[],n=>n.globals.rasterParticleSpeed||0],"sky-radial-progress":[At,[],n=>n.globals.skyRadialProgress||0],accumulated:[gi,[],n=>n.globals.accumulated===void 0?null:n.globals.accumulated],"+":[At,Mn(At),(n,e)=>{let i=0;for(const s of e)i+=s.evaluate(n);return i}],"*":[At,Mn(At),(n,e)=>{let i=1;for(const s of e)i*=s.evaluate(n);return i}],"-":{type:At,overloads:[[[At,At],(n,[e,i])=>e.evaluate(n)-i.evaluate(n)],[[At],(n,[e])=>-e.evaluate(n)]]},"/":[At,[At,At],(n,[e,i])=>e.evaluate(n)/i.evaluate(n)],"%":[At,[At,At],(n,[e,i])=>e.evaluate(n)%i.evaluate(n)],ln2:[At,[],()=>Math.LN2],pi:[At,[],()=>Math.PI],e:[At,[],()=>Math.E],"^":[At,[At,At],(n,[e,i])=>Math.pow(e.evaluate(n),i.evaluate(n))],sqrt:[At,[At],(n,[e])=>Math.sqrt(e.evaluate(n))],log10:[At,[At],(n,[e])=>Math.log(e.evaluate(n))/Math.LN10],ln:[At,[At],(n,[e])=>Math.log(e.evaluate(n))],log2:[At,[At],(n,[e])=>Math.log(e.evaluate(n))/Math.LN2],sin:[At,[At],(n,[e])=>Math.sin(e.evaluate(n))],cos:[At,[At],(n,[e])=>Math.cos(e.evaluate(n))],tan:[At,[At],(n,[e])=>Math.tan(e.evaluate(n))],asin:[At,[At],(n,[e])=>Math.asin(e.evaluate(n))],acos:[At,[At],(n,[e])=>Math.acos(e.evaluate(n))],atan:[At,[At],(n,[e])=>Math.atan(e.evaluate(n))],min:[At,Mn(At),(n,e)=>Math.min(...e.map(i=>i.evaluate(n)))],max:[At,Mn(At),(n,e)=>Math.max(...e.map(i=>i.evaluate(n)))],abs:[At,[At],(n,[e])=>Math.abs(e.evaluate(n))],round:[At,[At],(n,[e])=>{const i=e.evaluate(n);return i<0?-Math.round(-i):Math.round(i)}],floor:[At,[At],(n,[e])=>Math.floor(e.evaluate(n))],ceil:[At,[At],(n,[e])=>Math.ceil(e.evaluate(n))],"filter-==":[pi,[Ti,gi],(n,[e,i])=>n.properties()[e.value]===i.value],"filter-id-==":[pi,[gi],(n,[e])=>n.id()===e.value],"filter-type-==":[pi,[Ti],(n,[e])=>n.geometryType()===e.value],"filter-<":[pi,[Ti,gi],(n,[e,i])=>{const s=n.properties()[e.value],l=i.value;return typeof s==typeof l&&s<l}],"filter-id-<":[pi,[gi],(n,[e])=>{const i=n.id(),s=e.value;return typeof i==typeof s&&i<s}],"filter->":[pi,[Ti,gi],(n,[e,i])=>{const s=n.properties()[e.value],l=i.value;return typeof s==typeof l&&s>l}],"filter-id->":[pi,[gi],(n,[e])=>{const i=n.id(),s=e.value;return typeof i==typeof s&&i>s}],"filter-<=":[pi,[Ti,gi],(n,[e,i])=>{const s=n.properties()[e.value],l=i.value;return typeof s==typeof l&&s<=l}],"filter-id-<=":[pi,[gi],(n,[e])=>{const i=n.id(),s=e.value;return typeof i==typeof s&&i<=s}],"filter->=":[pi,[Ti,gi],(n,[e,i])=>{const s=n.properties()[e.value],l=i.value;return typeof s==typeof l&&s>=l}],"filter-id->=":[pi,[gi],(n,[e])=>{const i=n.id(),s=e.value;return typeof i==typeof s&&i>=s}],"filter-has":[pi,[gi],(n,[e])=>e.value in n.properties()],"filter-has-id":[pi,[],n=>n.id()!==null&&n.id()!==void 0],"filter-type-in":[pi,[Ir(Ti)],(n,[e])=>e.value.indexOf(n.geometryType())>=0],"filter-id-in":[pi,[Ir(gi)],(n,[e])=>e.value.indexOf(n.id())>=0],"filter-in-small":[pi,[Ti,Ir(gi)],(n,[e,i])=>i.value.indexOf(n.properties()[e.value])>=0],"filter-in-large":[pi,[Ti,Ir(gi)],(n,[e,i])=>function(s,l,a,h){for(;a<=h;){const m=a+h>>1;if(l[m]===s)return!0;l[m]>s?h=m-1:a=m+1}return!1}(n.properties()[e.value],i.value,0,i.value.length-1)],all:{type:pi,overloads:[[[pi,pi],(n,[e,i])=>e.evaluate(n)&&i.evaluate(n)],[Mn(pi),(n,e)=>{for(const i of e)if(!i.evaluate(n))return!1;return!0}]]},any:{type:pi,overloads:[[[pi,pi],(n,[e,i])=>e.evaluate(n)||i.evaluate(n)],[Mn(pi),(n,e)=>{for(const i of e)if(i.evaluate(n))return!0;return!1}]]},"!":[pi,[pi],(n,[e])=>!e.evaluate(n)],"is-supported-script":[pi,[Ti],(n,[e])=>{const i=n.globals&&n.globals.isSupportedScript;return!i||i(e.evaluate(n))}],upcase:[Ti,[Ti],(n,[e])=>e.evaluate(n).toUpperCase()],downcase:[Ti,[Ti],(n,[e])=>e.evaluate(n).toLowerCase()],concat:[Ti,Mn(gi),(n,e)=>e.map(i=>xr(i.evaluate(n))).join("")],"resolved-locale":[Ti,[ls],(n,[e])=>e.evaluate(n).resolvedLocale()],random:[At,[At,At,gi],(n,e)=>{const[i,s,l]=e.map(h=>h.evaluate(n));if(i>s||i===s)return i;let a;if(typeof l=="string")a=function(h){let m=0;if(h.length===0)return m;for(let g=0;g<h.length;
14g++)m=(m<<5)-m+h.charCodeAt(g),m|=0;return m}(l);else{if(typeof l!="number")throw new ir(`Invalid seed input: ${l}`);a=l}return i+vu(a)()*(s-i)}]});class Eu{constructor(e,i,s,l){this.expression=e,this._warningHistory={},this._evaluator=new Ol(s,l),this._defaultValue=i?function(a){return a.type==="color"&&(Jl(a.default)||Array.isArray(a.default))?new Mi(0,0,0,0):a.type==="color"?Mi.parse(a.default)||null:a.default===void 0?null:a.default}(i):null,this._enumValues=i&&i.type==="enum"?i.values:null,this.configDependencies=$a(e)}evaluateWithoutErrorHandling(e,i,s,l,a,h,m,g){return this._evaluator.globals=e,this._evaluator.feature=i,this._evaluator.featureState=s,this._evaluator.canonical=l||null,this._evaluator.availableImages=a||null,this._evaluator.formattedSection=h,this._evaluator.featureTileCoord=m||null,this._evaluator.featureDistanceData=g||null,this.expression.evaluate(this._evaluator)}evaluate(e,i,s,l,a,h,m,g){this._evaluator.globals=e,this._evaluator.feature=i||null,this._evaluator.featureState=s||null,this._evaluator.canonical=l||null,this._evaluator.availableImages=a||null,this._evaluator.formattedSection=h||null,this._evaluator.featureTileCoord=m||null,this._evaluator.featureDistanceData=g||null;try{const x=this.expression.evaluate(this._evaluator);if(x==null||typeof x=="number"&&x!=x)return this._defaultValue;if(this._enumValues&&!(x in this._enumValues))throw new ir(`Expected value to be one of ${Object.keys(this._enumValues).map(p=>JSON.stringify(p)).join(", ")}, but found ${JSON.stringify(x)} instead.`);return x}catch(x){return this._warningHistory[x.message]||(this._warningHistory[x.message]=!0,typeof console<"u"&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${x.message}`)),this._defaultValue}}}function ec(n){return Array.isArray(n)&&n.length>0&&typeof n[0]=="string"&&n[0]in Yo}function Jo(n,e,i,s){const l=new ou(Yo,[],e?function(h){const m={color:Lr,string:Ti,number:At,enum:Ti,boolean:pi,formatted:Oa,resolvedImage:cs};return h.type==="array"?Ir(m[h.value]||gi,h.length):m[h.type]}(e):void 0,void 0,void 0,i,s),a=l.parse(n,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return a?bu(new Eu(a,e,i,s)):gs(l.errors)}class Mu{constructor(e,i,s,l){this.kind=e,this._styleExpression=i,this.isLightConstant=s,this.isLineProgressConstant=l,this.isStateDependent=e!=="constant"&&!Ga(i.expression),this.configDependencies=$a(i.expression)}evaluateWithoutErrorHandling(e,i,s,l,a,h){return this._styleExpression.evaluateWithoutErrorHandling(e,i,s,l,a,h)}evaluate(e,i,s,l,a,h){return this._styleExpression.evaluate(e,i,s,l,a,h)}}class Qo{constructor(e,i,s,l,a,h){this.kind=e,this.zoomStops=s,this._styleExpression=i,this.isStateDependent=e!=="camera"&&!Ga(i.expression),this.isLightConstant=a,this.isLineProgressConstant=h,this.configDependencies=$a(i.expression),this.interpolationType=l}evaluateWithoutErrorHandling(e,i,s,l,a,h){return this._styleExpression.evaluateWithoutErrorHandling(e,i,s,l,a,h)}evaluate(e,i,s,l,a,h){return this._styleExpression.evaluate(e,i,s,l,a,h)}interpolationFactor(e,i,s){return this.interpolationType?fn.interpolationFactor(this.interpolationType,e,i,s):0}}function Iu(n,e,i,s){if((n=Jo(n,e,i,s)).result==="error")return n;const l=n.value.expression,a=Ho(l);if(!a&&!Ko(e))return gs([new En("","data expressions not supported")]);const h=_s(l,["zoom","pitch","distance-from-center"]);if(!h&&!dd(e))return gs([new En("","zoom expressions not supported")]);const m=_s(l,["measure-light"]);if(!m&&!Kl(e))return gs([new En("","measure-light expression not supported")]);const g=_s(l,["line-progress"]);if(!g&&!function(y){return wu(y.expression,"line-progress")}(e))return gs([new En("","line-progress expression not supported")]);const x=e.expression&&e.expression.relaxZoomRestriction,p=ic(l);return p||h||x?p instanceof En?gs([p]):p instanceof fn&&!Tu(e)?gs([new En("",'"interpolate" expressions cannot be used with this property')]):bu(p?new Qo(a&&g?"camera":"composite",n.value,p.labels,p instanceof fn?p.interpolation:void 0,m,g):new Mu(a&&g?"constant":"source",n.value,m,g)):gs([new En("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class tc{constructor(e,i){this._parameters=e,this._specification=i,_i(this,fd(this._parameters,this._specification))}static deserialize(e){return new tc(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function ic(n){let e=null;if(n instanceof Zl)e=ic(n.result);else if(n instanceof Hl){for(const i of n.args)if(e=ic(i),e)break}else(n instanceof Kn||n instanceof fn)&&n.input instanceof Ur&&n.input.name==="zoom"&&(e=n);return e instanceof En||n.eachChild(i=>{const s=ic(i);s instanceof En?e=s:e&&s&&e!==s&&(e=new En("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}var Ka,_d,gd=function(){if(_d)return Ka;_d=1,Ka=e;var n=3;function e(i,s,l){var a=this.cells=[];if(i instanceof ArrayBuffer){this.arrayBuffer=i;var h=new Int32Array(this.arrayBuffer);i=h[0],this.d=(s=h[1])+2*(l=h[2]);for(var m=0;m<this.d*this.d;m++){var g=h[n+m],x=h[n+m+1];a.push(g===x?null:h.subarray(g,x))}var p=h[n+a.length+1];this.keys=h.subarray(h[n+a.length],p),this.bboxes=h.subarray(p),this.insert=this._insertReadonly}else{this.d=s+2*l;for(var y=0;y<this.d*this.d;y++)a.push([]);this.keys=[],this.bboxes=[]}this.n=s,this.extent=i,this.padding=l,this.scale=s/i,this.uid=0;var w=l/s*i;this.min=-w,this.max=i+w}
14return e.prototype.insert=function(i,s,l,a,h){this._forEachCell(s,l,a,h,this._insertCell,this.uid++),this.keys.push(i),this.bboxes.push(s),this.bboxes.push(l),this.bboxes.push(a),this.bboxes.push(h)},e.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},e.prototype._insertCell=function(i,s,l,a,h,m){this.cells[h].push(m)},e.prototype.query=function(i,s,l,a,h){var m=this.min,g=this.max;if(i<=m&&s<=m&&g<=l&&g<=a&&!h)return Array.prototype.slice.call(this.keys);var x=[];return this._forEachCell(i,s,l,a,this._queryCell,x,{},h),x},e.prototype._queryCell=function(i,s,l,a,h,m,g,x){var p=this.cells[h];if(p!==null)for(var y=this.keys,w=this.bboxes,v=0;v<p.length;v++){var b=p[v];if(g[b]===void 0){var S=4*b;(x?x(w[S+0],w[S+1],w[S+2],w[S+3]):i<=w[S+2]&&s<=w[S+3]&&l>=w[S+0]&&a>=w[S+1])?(g[b]=!0,m.push(y[b])):g[b]=!1}}},e.prototype._forEachCell=function(i,s,l,a,h,m,g,x){for(var p=this._convertToCellCoord(i),y=this._convertToCellCoord(s),w=this._convertToCellCoord(l),v=this._convertToCellCoord(a),b=p;b<=w;b++)for(var S=y;S<=v;S++){var A=this.d*S+b;if((!x||x(this._convertFromCellCoord(b),this._convertFromCellCoord(S),this._convertFromCellCoord(b+1),this._convertFromCellCoord(S+1)))&&h.call(this,i,s,l,a,A,m,g,x))return}},e.prototype._convertFromCellCoord=function(i){return(i-this.padding)/this.scale},e.prototype._convertToCellCoord=function(i){return Math.max(0,Math.min(this.d-1,Math.floor(i*this.scale)+this.padding))},e.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var i=this.cells,s=n+this.cells.length+1+1,l=0,a=0;a<this.cells.length;a++)l+=this.cells[a].length;var h=new Int32Array(s+l+this.keys.length+this.bboxes.length);h[0]=this.extent,h[1]=this.n,h[2]=this.padding;for(var m=s,g=0;g<i.length;g++){var x=i[g];h[n+g]=m,h.set(x,m),m+=x.length}return h[n+i.length]=m,h.set(this.keys,m),h[n+i.length+1]=m+=this.keys.length,h.set(this.bboxes,m),m+=this.bboxes.length,h.buffer},Ka}(),ea=Ce(gd);const rc={};function vt(n,e,i={}){Object.defineProperty(n,"_classRegistryKey",{value:e,writable:!1}),rc[e]={klass:n,omit:i.omit||[]}}vt(Object,"Object"),ea.serialize=function(n,e){const i=n.toArrayBuffer();return e&&e.add(i),{buffer:i}},ea.deserialize=function(n){return new ea(n.buffer)},Object.defineProperty(ea,"name",{value:"Grid"}),vt(ea,"Grid"),typeof DOMMatrix<"u"&&vt(DOMMatrix,"DOMMatrix"),vt(Mi,"Color"),vt(Error,"Error"),vt(Dr,"Formatted"),vt(ka,"FormattedSection"),vt(wr,"AJAXError"),vt(Or,"ResolvedImage"),vt(tc,"StylePropertyFunction"),vt(Eu,"StyleExpression",{omit:["_evaluator"]}),vt(Xr,"ImageId"),vt(Yn,"ImageVariant"),vt(Qo,"ZoomDependentExpression"),vt(Mu,"ZoomConstantExpression"),vt(Ur,"CompoundExpression",{omit:["_evaluate"]});for(const n in Yo)rc[Yo[n]._classRegistryKey]||vt(Yo[n],`Expression${n}`);function Au(n){return n&&typeof ArrayBuffer<"u"&&(n instanceof ArrayBuffer||n.constructor&&n.constructor.name==="ArrayBuffer")}function Cu(n){return self.ImageBitmap&&n instanceof ImageBitmap}function js(n,e){if(n==null||typeof n=="boolean"||typeof n=="number"||typeof n=="string"||n instanceof Boolean||n instanceof Number||n instanceof String||n instanceof Date||n instanceof RegExp)return n;if(Au(n)||Cu(n))return e&&e.add(n),n;if(ArrayBuffer.isView(n))return e&&e.add(n.buffer),n;if(n instanceof ImageData)return e&&e.add(n.data.buffer),n;if(Array.isArray(n)){const i=[];for(const s of n)i.push(js(s,e));return i}if(n instanceof Map){const i={$name:"Map",entries:[]};for(const[s,l]of n.entries())i.entries.push(js(s),js(l));return i}if(n instanceof Set){const i={$name:"Set"};let s=0;for(const l of n.values())i[++s]=js(l);return i}if(n instanceof DOMMatrix){const i={$name:"DOMMatrix"},s=["is2D","m11","m12","m13","m14","m21","m22","m23","m24","m31","m32","m33","m34","m41","m42","m43","m44","a","b","c","d","e","f"];for(const l of s)i[l]=n[l];return i}if(typeof n=="bigint")return{$name:"BigInt",value:n.toString()};if(typeof n=="object"){const i=n.constructor,s=i._classRegistryKey;if(!s)throw new Error(`Can't serialize object of unregistered class "${i.name}".`);const l=i.serialize?i.serialize(n,e):{};if(!i.serialize){for(const a in n)n.hasOwnProperty(a)&&(rc[s].omit.indexOf(a)>=0||(l[a]=js(n[a],e)));n instanceof Error&&(l.message=n.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return s!=="Object"&&(l.$name=s),l}throw new Error("can't serialize object of type "+typeof n)}function mn(n){if(n==null||typeof n=="boolean"||typeof n=="number"||typeof n=="string"||n instanceof Boolean||n instanceof Number||n instanceof String||n instanceof Date||n instanceof RegExp||Au(n)||Cu(n)||ArrayBuffer.isView(n)||n instanceof ImageData)return n;if(Array.isArray(n))return n.map(mn);if(typeof n=="object"){const e=n.$name||"Object";if(e==="Map"){const l=n.entries||[],a=new Map;for(let h=0;h<l.length;h+=2)a.set(mn(l[h]),mn(l[h+1]));return a}if(e==="Set"){const l=new Set;for(const a of Object.keys(n))a!=="$name"&&l.add(mn(n[a]));return l}if(e==="DOMMatrix"){let l;return l=n.is2D?[n.a,n.b,n.c,n.d,n.e,n.f]:[n.m11,n.m12,n.m13,n.m14,n.m21,n.m22,n.m23,n.m24,n.m31,n.m32,n.m33,n.m34,n.m41,n.m42,n.m43,n.m44],new DOMMatrix(l)}if(e==="BigInt")return BigInt(n.value);const{klass:i}=rc[e];if(!i)throw new Error(`Can't deserialize unregistered class "${e}".`);if(i.deserialize)return i.deserialize(n);const s=Object.create(i.prototype);for(const l of Object.keys(n))l!=="$name"&&(s[l]=mn(n[l]));return s}throw new Error("can't deserialize object of type "+typeof n)}const Rt={"Latin-1 Supplement":n=>n>=128&&n<=255,Arabic:n=>n>=1536&&n<=1791,"Arabic Supplement":n=>n>=1872&&n<=1919,"Arabic Extended-A":n=>n>=2208&&n<=2303,"Hangul Jamo":n=>n>=4352&&n<=4607,"Unified Canadian Aboriginal Syllabics":n=>n>=5120&&n<=5759,Khmer:n=>n>=6016&&n<=6143,"Unified Canadian Aboriginal Syllabics Extended":n=>n>=6320&&n<=6399,"General Punctuation":n=>n>=8192&&n<=8303,"Letterlike Symbols":n=>n>=8448&&n<=8527,"Number Forms":n=>n>=8528&&n<=8591,"Miscellaneous Technical":n=>n>=8960&&n<=9215,"Control Pictures":n=>n>=9216&&n<=9279,"Optical Character Recognition":n=>n>=9280&&n<=9311,"Enclosed Alphanumerics":n=>n>=9312&&n<=9471,"Geometric Shapes":n=>n>=9632&&n<=9727,"Miscellaneous Symbols":n=>n>=9728&&n<=9983,"Miscellaneous Symbols and Arrows":n=>n>=11008&&n<=11263,"CJK Radicals Supplement":n=>n>=11904&&n<=12031,"Kangxi Radicals":n=>n>=12032&&n<=12255,"Ideographic Description Characters":n=>n>=12272&&n<=12287,"CJK Symbols and Punctuation":n=>n>=12288&&n<=12351,Hiragana:n=>n>=12352&&n<=12447,Katakana:n=>n>=12448&&n<=12543,Bopomofo:n=>n>=12544&&n<=12591,"Hangul Compatibility Jamo":n=>n>=12592&&n<=12687,Kanbun:n=>n>=12688&&n<=12703,"Bopomofo Extended":n=>n>=12704&&n<=12735,"CJK Strokes":n=>n>
14=12736&&n<=12783,"Katakana Phonetic Extensions":n=>n>=12784&&n<=12799,"Enclosed CJK Letters and Months":n=>n>=12800&&n<=13055,"CJK Compatibility":n=>n>=13056&&n<=13311,"CJK Unified Ideographs Extension A":n=>n>=13312&&n<=19903,"Yijing Hexagram Symbols":n=>n>=19904&&n<=19967,"CJK Unified Ideographs":n=>n>=19968&&n<=40959,"Yi Syllables":n=>n>=40960&&n<=42127,"Yi Radicals":n=>n>=42128&&n<=42191,"Hangul Jamo Extended-A":n=>n>=43360&&n<=43391,"Hangul Syllables":n=>n>=44032&&n<=55215,"Hangul Jamo Extended-B":n=>n>=55216&&n<=55295,"Private Use Area":n=>n>=57344&&n<=63743,"CJK Compatibility Ideographs":n=>n>=63744&&n<=64255,"Arabic Presentation Forms-A":n=>n>=64336&&n<=65023,"Vertical Forms":n=>n>=65040&&n<=65055,"CJK Compatibility Forms":n=>n>=65072&&n<=65103,"Small Form Variants":n=>n>=65104&&n<=65135,"Arabic Presentation Forms-B":n=>n>=65136&&n<=65279,"Halfwidth and Fullwidth Forms":n=>n>=65280&&n<=65519,Osage:n=>n>=66736&&n<=66815,"CJK Unified Ideographs Extension B":n=>n>=131072&&n<=173791};function Pu(n){for(const e of n)if(nc(e.charCodeAt(0)))return!0;return!1}function mf(n){for(const e of n)if(!yd(e.charCodeAt(0)))return!1;return!0}function yd(n){return!(Rt.Arabic(n)||Rt["Arabic Supplement"](n)||Rt["Arabic Extended-A"](n)||Rt["Arabic Presentation Forms-A"](n)||Rt["Arabic Presentation Forms-B"](n))}function nc(n){return!(n!==746&&n!==747&&(n<4352||!(Rt["Bopomofo Extended"](n)||Rt.Bopomofo(n)||Rt["CJK Compatibility Forms"](n)&&!(n>=65097&&n<=65103)||Rt["CJK Compatibility Ideographs"](n)||Rt["CJK Compatibility"](n)||Rt["CJK Radicals Supplement"](n)||Rt["CJK Strokes"](n)||!(!Rt["CJK Symbols and Punctuation"](n)||n>=12296&&n<=12305||n>=12308&&n<=12319||n===12336)||Rt["CJK Unified Ideographs Extension A"](n)||Rt["CJK Unified Ideographs"](n)||Rt["Enclosed CJK Letters and Months"](n)||Rt["Hangul Compatibility Jamo"](n)||Rt["Hangul Jamo Extended-A"](n)||Rt["Hangul Jamo Extended-B"](n)||Rt["Hangul Jamo"](n)||Rt["Hangul Syllables"](n)||Rt.Hiragana(n)||Rt["Ideographic Description Characters"](n)||Rt.Kanbun(n)||Rt["Kangxi Radicals"](n)||Rt["Katakana Phonetic Extensions"](n)||Rt.Katakana(n)&&n!==12540||!(!Rt["Halfwidth and Fullwidth Forms"](n)||n===65288||n===65289||n===65293||n>=65306&&n<=65310||n===65339||n===65341||n===65343||n>=65371&&n<=65503||n===65507||n>=65512&&n<=65519)||!(!Rt["Small Form Variants"](n)||n>=65112&&n<=65118||n>=65123&&n<=65126)||Rt["Unified Canadian Aboriginal Syllabics"](n)||Rt["Unified Canadian Aboriginal Syllabics Extended"](n)||Rt["Vertical Forms"](n)||Rt["Yijing Hexagram Symbols"](n)||Rt["Yi Syllables"](n)||Rt["Yi Radicals"](n))))}function Ru(n){return!(nc(n)||function(e){return!!(Rt["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||Rt["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||Rt["Letterlike Symbols"](e)||Rt["Number Forms"](e)||Rt["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||Rt["Control Pictures"](e)&&e!==9251||Rt["Optical Character Recognition"](e)||Rt["Enclosed Alphanumerics"](e)||Rt["Geometric Shapes"](e)||Rt["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||Rt["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Rt["CJK Symbols and Punctuation"](e)||Rt.Katakana(e)||Rt["Private Use Area"](e)||Rt["CJK Compatibility Forms"](e)||Rt["Small Form Variants"](e)||Rt["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(n))}function vd(n){return Rt.Arabic(n)||Rt["Arabic Supplement"](n)||Rt["Arabic Extended-A"](n)||Rt["Arabic Presentation Forms-A"](n)||Rt["Arabic Presentation Forms-B"](n)}function sc(n){return n>=1424&&n<=2303||Rt["Arabic Presentation Forms-A"](n)||Rt["Arabic Presentation Forms-B"](n)}function zu(n,e){return!(!e&&sc(n)||n>=2304&&n<=3583||n>=3840&&n<=4255||Rt.Khmer(n))}function xd(n){for(const e of n)if(sc(e.charCodeAt(0)))return!0;return!1}const Lu="deferred",Jn="loading",Du="loaded";let Ou=null,Yr="unavailable",qs=null;const Ja=function(n){n&&typeof n=="string"&&n.indexOf("NetworkError")>-1&&(Yr="error"),Ou&&Ou(n)};function oc(){ta.fire(new tn("pluginStateChange",{pluginStatus:Yr,pluginURL:qs}))}const ta=new kn,ac=function(){return Yr},bd=function(){if(Yr!==Lu||!qs)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");
14Yr=Jn,oc(),qs&&as({url:qs},n=>{n?Ja(n):(Yr=Du,oc())})},In={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Yr===Du||In.applyArabicShaping!=null,isLoading:()=>Yr===Jn,setState(n){Yr=n.pluginStatus,qs=n.pluginURL},isParsed:()=>In.applyArabicShaping!=null&&In.processBidirectionalText!=null&&In.processStyledBidirectionalText!=null,getPluginURL:()=>qs};class zi{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.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(e){return function(i,s){for(const l of i)if(!zu(l.charCodeAt(0),s))return!1;return!0}(e,In.isLoaded())}}class ia{constructor(e,i,s,l){this.property=e,this.value=i,this.expression=function(a,h,m,g){if(Jl(a))return new tc(a,h);if(ec(a)||Array.isArray(a)&&a.length>0){const x=Iu(a,h,m,g);if(x.result==="error")throw new Error(x.value.map(p=>`${p.key}: ${p.message}`).join(", "));return x.value}{let x=a;return typeof a=="string"&&h.type==="color"&&(x=Mi.parse(a)),{kind:"constant",configDependencies:new Set,evaluate:()=>x}}}(i===void 0?e.specification.default:i,e.specification,s,l)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,i,s){return this.property.possiblyEvaluate(this,e,i,s)}}class ku{constructor(e,i,s){this.property=e,this.value=new ia(e,void 0,i,s)}transitioned(e,i){return new lc(this.property,this.value,i,Nr({},e.transition,this.transition),e.now)}untransitioned(){return new lc(this.property,this.value,null,{},0)}}class Fu{constructor(e,i,s){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=i,this._options=s,this.configDependencies=new Set}getValue(e){return un(this._values[e].value.value)}setValue(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new ku(this._values[e].property,this._scope,this._options)),this._values[e].value=new ia(this._values[e].property,i===null?void 0:un(i),this._scope,this._options),this._values[e].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].value.expression.configDependencies]))}setTransitionOrValue(e,i){i&&(this._options=i);const s=this._properties.properties;if(e)for(const l in e){const a=e[l];if(l.endsWith("-transition")){const h=l.slice(0,-11);s[h]&&this.setTransition(h,a)}else s.hasOwnProperty(l)&&this.setValue(l,a)}}getTransition(e){return un(this._values[e].transition)}setTransition(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new ku(this._values[e].property)),this._values[e].transition=un(i)||void 0}serialize(){const e={};for(const i of Object.keys(this._values)){const s=this.getValue(i);s!==void 0&&(e[i]=s);const l=this.getTransition(i);l!==void 0&&(e[`${i}-transition`]=l)}return e}transitioned(e,i){const s=new Qa(this._properties);for(const l of Object.keys(this._values))s._values[l]=this._values[l].transitioned(e,i._values[l]);return s}untransitioned(){const e=new Qa(this._properties);for(const i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}}class lc{constructor(e,i,s,l,a){const h=l.delay||0,m=l.duration||0;a=a||0,this.property=e,this.value=i,this.begin=a+h,this.end=this.begin+m,e.specification.transition&&(l.delay||l.duration)&&(this.prior=s)}possiblyEvaluate(e,i,s){const l=e.now||0,a=this.value.possiblyEvaluate(e,i,s),h=this.prior;if(h){if(l>this.end)return this.prior=null,a;if(this.value.isDataDriven())return this.prior=null,a;if(l<this.begin)return h.possiblyEvaluate(e,i,s);{const m=(l-this.begin)/(this.end-this.begin);return this.property.interpolate(h.possiblyEvaluate(e,i,s),a,no(m))}}return a}}class Qa{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,i,s){const l=new sa(this._properties);for(const a of Object.keys(this._values))l._values[a]=this._values[a].possiblyEvaluate(e,i,s);return l}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class ra{constructor(e,i,s){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._scope=i,this._options=s,this.configDependencies=new Set}getValue(e){return un(this._values[e].value)}setValue(e,i){this._values[e]=new ia(this._values[e].property,i===null?void 0:un(i),this._scope,this._options),this._values[e].expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].expression.configDependencies]))}serialize(){const e={};for(const i of Object.keys(this._values)){const s=this.getValue(i);s!==void 0&&(e[i]=s)}return e}possiblyEvaluate(e,i,s){const l=new sa(this._properties);for(const a of Object.keys(this._values))l._values[a]=this._values[a].possiblyEvaluate(e,i,s);return l}}class na{constructor(e,i,s){this.property=e,this.value=i,this.parameters=s}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,i,s,l){return this.property.evaluate(this.value,this.parameters,e,i,s,l)}}class sa{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class lt{constructor(e){this.specification=e}
vendor: 6,652 bytes, line 14
14possiblyEvaluate(e,i){return e.expression.evaluate(i)}interpolate(e,i,s){const l=Da[this.specification.type];return l?l(e,i,s):e}}class yt{constructor(e,i){this.specification=e,this.overrides=i}possiblyEvaluate(e,i,s,l){return new na(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(i,null,{},s,l)}:e.expression,i)}interpolate(e,i,s){if(e.value.kind!=="constant"||i.value.kind!=="constant")return e;if(e.value.value===void 0||i.value.value===void 0)return new na(this,{kind:"constant",value:void 0},e.parameters);const l=Da[this.specification.type];return l?new na(this,{kind:"constant",value:l(e.value.value,i.value.value,s)},e.parameters):e}evaluate(e,i,s,l,a,h){return e.kind==="constant"?e.value:e.evaluate(i,s,l,a,h)}}class oa{constructor(e){this.specification=e}possiblyEvaluate(e,i,s,l){return!!e.expression.evaluate(i,null,{},s,l)}interpolate(){return!1}}class Zi{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const i=new zi(0,{});for(const s in e){const l=e[s];l.specification.overridable&&this.overridableProperties.push(s);const a=this.defaultPropertyValues[s]=new ia(l,void 0),h=this.defaultTransitionablePropertyValues[s]=new ku(l);this.defaultTransitioningPropertyValues[s]=h.untransitioned(),this.defaultPossiblyEvaluatedValues[s]=a.possiblyEvaluate(i)}}}vt(yt,"DataDrivenProperty"),vt(lt,"DataConstantProperty"),vt(oa,"ColorRampProperty");var Pe=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"required":false,"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"snow":{"type":"snow","experimental":true},"rain":{"type":"rain","experimental":true},"camera":{"type":"camera"},"color-theme":{"type":"colorTheme"},"indoor":{"type":"indoor","experimental":true},"imports":{"type":"array","value":"import"},"iconsets":{"experimental":true,"type":"iconsets"},"schema":{"type":"schema"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"type":"array","value":"layer"},"models":{"type":"models"},"featuresets":{"experimental":true,"type":"featuresets"}},"featuresets":{"experimental":true,"*":{"type":"featureset"}},"featureset":{"experimental":true,"metadata":{"experimental":true,"type":"*"},"selectors":{"experimental":true,"type":"array","value":"selector"}},"selector":{"experimental":true,"layer":{"experimental":true,"type":"string","required":true},"properties":{"experimental":true,"type":"selectorProperty","required":false},"featureNamespace":{"experimental":true,"type":"string","required":false},"_uniqueFeatureID":{"experimental":true,"type":"boolean","private":true,"required":false}},"selectorProperty":{"experimental":true,"*":{"experimental":true,"type":"*"}},"model":{"type":"string","required":true},"import":{"id":{"type":"string","required":true},"url":{"type":"string","required":true},"config":{"type":"config"},"data":{"type":"$root"},"color-theme":{"type":"colorTheme","optional":true}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"default":{"type":"*","property-type":"data-constant","expression":{},"required":true},"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1}},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"values":{"type":"array","value":"*"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"id":{"type":"string","required":true},"properties":{"type":"properties"},"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"cast-shadows":{"type":"boolean","default":false,"property-type":"data-constant"},"shadow-quality":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"expression":{"parameters":["zoom"]},"experimental":true},"shadow-intensity":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_ambient":{"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_flat":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"property-type":"data-constant","expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"iconsets":{"*":{"type":"iconset"}},"iconset":["iconset_sprite","iconset_source"],"iconset_sprite":{"type":{"required":true,"type":"enum","values":{"sprite":1}},"url":{"required":true,"type":"string"}},"iconset_source":{"type":{"required":true,"type":"enum","values":{"source":1}}
14,"source":{"required":true,"type":"string"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_raster_array","source_geojson","source_video","source_image","source_model"],"source_vector":{"type":{"required":true,"type":"enum","values":{"vector":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"type":"enum","values":{"raster":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"type":"enum","values":{"raster-dem":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":1,"mapbox":1},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"experimental":true,"type":{"required":true,"type":"enum","values":{"raster-array":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"rasterLayers":{"type":"*"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"},"dynamic":{"type":"boolean","default":false}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":1}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":1}},"url":{"required":false,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_model":{"type":{"required":true,"type":"enum","values":{"model":1,"batched-model":1}},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"raster-particle":{"experimental":true},"hillshade":{},"model":{"experimental":true},"background":{},"sky":{},"slot":{},"clip":{}},"required":true},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"}},"layout":["layout_clip","layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_raster-particle","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_model":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"},"model-id":{"type":"string","default":"","property-type":"data-driven","expression":{"parameters":["zoom","feature"]}}},"layout_clip":{"clip-layer-types":{"type":"array","value":"enum","values":{"model":1,"symbol":1},"default":[],"expression":{},"property-type":"data-constant"},"clip-layer-scope":{"type":"array","value":"string","default":[],"expression":{},"property-type":"data-constant"}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"},"fill-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-base":1,"hd-road-markup":1},"default":"none","experimental":true,"private":true,"expression":{},"property-type":"data-constant"},"fill-construct-bridge-guard-rail":{"type":"boolean","default":"true","experimental":true,"private":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"circle-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-markup":1},"default":"none","experimental":true,"expression":{},"property-type":"data-constant"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"},"fill-extrusion-edge-radius":{"type":"number","experimental":true,"default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"constant"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":1,"round":1,"square":1},"default":"butt","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":1,"round":1,"miter":1,"none":1},"default":"miter","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","experimental":true,"default":0,"expression":{"parameters":["zoom","feature","line-progress"]},"property-type":"data-driven"},"line-elevation-reference":{"type":"enum","values":{"none":1,"sea":1,"ground":1,"hd-road-markup":1},"default":"none","experimental":true,"expression":{},"property-type":"data-constant"},"line-cross-slope":{"type":"number","experimental":true,"expression":{},"property-type":"constant"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"},"line-width-unit":{"type":"enum","values":{"pixels":1,"meters":1},"default":"pixels","experimental":true,"private":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":1,"line":1,"line-center":1},"default":"point","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":1,"viewport-y":1,"source":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","experimental":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-size":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":0.1,"maximum":10,"experimental":true,"private":true,"expression":{},"property-type":"data-constant"},"icon-text-fit":{"type":"enum","values":{"none":1,"width":1,"height":1,"both":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}
14,"icon-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":0.1,"maximum":10,"experimental":true,"private":true,"expression":{},"property-type":"data-constant"},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":1,"left":1,"center":1,"right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":1,"uppercase":1,"lowercase":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_raster-particle":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_hillshade":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster-particle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_clip":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_model":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*","required":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"snow":{"density":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"opacity":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","property-type":"data-constant","default":"#ffffff","experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"center-thinning":{"type":"number","property-type":"data-constant","default":0.4,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","property-type":"data-constant","transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"flake-size":{"type":"number","property-type":"data-constant","default":0.71,"minimum":0,"maximum":5,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"rain":{"density":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"opacity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"center-thinning":{"type":"number","property-type":"data-constant","default":0.57,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","property-type":"data-constant","transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","property-type":"data-constant","transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"distortion-strength":{"type":"number","property-type":"data-constant","default":0.7,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective","property-type":"data-constant"}},"colorTheme":{"data":{"type":"string","property-type":"data-constant","expression":{}}},"indoor":{"floorplanFeaturesetId":{"type":"string","experimental":true,"property-type":"data-constant","expression":{}},"buildingFeaturesetId":{"type":"string","experimental":true,"property-type":"data-constant","expression":{}}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"property-type":"data-constant","expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"expression":
14{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","experimental":true,"private":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","transition":true,"experimental":true,"private":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","experimental":true,"values":{"terrain":1,"flat":1},"default":"flat","property-type":"data-constant"},"fill-extrusion-base-alignment":{"type":"enum","experimental":true,"values":{"terrain":1,"flat":1},"default":"terrain","property-type":"data-constant"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant","type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant","type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"property-type":"data-constant","type":"number","experimental":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"property-type":"data-constant","type":"number","experimental":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"property-type":"data-constant","type":"number","experimental":true,"default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"property-type":"data-constant","type":"color","experimental":true,"default":"#ffffff","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"property-type":"data-constant","type":"number","experimental":true,"default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","experimental":true,"default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","experimental":true,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"property-type":"data-constant","type":"number","experimental":true,"default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"property-type":"data-constant","type":"number","experimental":true,"default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"property-type":"data-constant","type":"boolean","default":true,"experimental":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true,"property-type":"data-constant"}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light","line-progress"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"}
14,"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-gradient":{"type":"color","expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"property-type":"constant"},"line-trim-fade-range":{"type":"array","value":"number","experimental":true,"length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-trim-color":{"type":"color","experimental":true,"default":"transparent","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-border-width":{"type":"number","private":true,"default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","private":true,"default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"property-type":"data-constant"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-image-cross-fade":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"transition":true},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-color":{"type":"color","expression":{"interpolated":true,"parameters":["raster-value"]},"property-type":"color-ramp"},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"raster-array-band":{"type":"string","required":false,"experimental":true,"property-type":"data-constant"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string","required":false,"property-type":"data-constant"},"raster-particle-count":{"type":"number","default":512,"minimum":1,"property-type":"data-constant"},"raster-particle-color":{"type":"color","expression":{"interpolated":true,"parameters":["raster-particle-speed"]},"property-type":"color-ramp"},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1,"property-type":"data-constant"},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1,"property-type":"data-constant"},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]},"experimental":true,"property-type":"data-constant"},"background-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":
14{"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"property-type":"data-driven"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d","property-type":"data-constant"},"model-cast-shadows":{"type":"boolean","default":true,"property-type":"data-constant"},"model-receive-shadows":{"type":"boolean","default":true,"property-type":"data-constant"},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant","transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"model-front-cutoff":{"type":"array","private":true,"value":"number","property-type":"data-constant","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"property-type":{"data-driven":{"type":"property-type"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"*"}}}');function wd(n){return n instanceof Number||n instanceof String||n instanceof Boolean?n.valueOf():n}function cc(n){if(Array.isArray(n))return n.map(cc);if(n instanceof Object&&!(n instanceof Number||n instanceof String||n instanceof Boolean)){const e={};for(const i in n)e[i]=cc(n[i]);return e}return wd(n)}function Bu(n){if(n===!0||n===!1)return!0;
14if(!Array.isArray(n)||n.length===0)return!1;switch(n[0]){case"has":return n.length>=2&&n[1]!=="$id"&&n[1]!=="$type";case"in":return n.length>=3&&(typeof n[1]!="string"||Array.isArray(n[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return n.length!==3||Array.isArray(n[1])||Array.isArray(n[2]);case"any":case"all":for(const e of n.slice(1))if(!Bu(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}function Nu(n,e="",i=null,s="fill"){if(n==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};Bu(n)||(n=uc(n));const l=n;let a=!0;try{a=function(p){if(!aa(p))return p;let y=cc(p);return Sd(y),y=Td(y),y}(l)}catch{console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate. 15This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md 16and paste the contents of this message in the report. 17Thank you! 18Filter Expression: 19${JSON.stringify(l,null,2)} 20 `)}let h=null,m=null;if(s!=="background"&&s!=="sky"&&s!=="slot"){m=Pe[`filter_${s}`];const p=Jo(a,m,e,i);if(p.result==="error")throw new Error(p.value.map(y=>`${y.key}: ${y.message}`).join(", "));h=(y,w,v)=>p.value.evaluate(y,w,{},v)}let g=null,x=null;if(a!==l){const p=Jo(l,m,e,i);if(p.result==="error")throw new Error(p.value.map(y=>`${y.key}: ${y.message}`).join(", "));g=(y,w,v,b,S)=>p.value.evaluate(y,w,{},v,void 0,void 0,b,S),x=!Ho(p.value.expression)}return{filter:h,dynamicFilter:g||void 0,needGeometry:Ed(a),needFeature:!!x}}function Td(n){if(!Array.isArray(n))return n;const e=function(i){if(_f.has(i[0])){for(let s=1;s<i.length;s++)if(aa(i[s]))return!0}return i}(n);return e===!0?e:e.map(i=>Td(i))}function Sd(n){let e=!1;const i=[];if(n[0]==="case"){for(let s=1;s<n.length-1;s+=2)e=e||aa(n[s]),i.push(n[s+1]);i.push(n[n.length-1])}else if(n[0]==="match"){e=e||aa(n[1]);for(let s=2;s<n.length-1;s+=2)i.push(n[s+1]);i.push(n[n.length-1])}else if(n[0]==="step"){e=e||aa(n[1]);for(let s=1;s<n.length-1;s+=2)i.push(n[s+1])}e&&(n.length=0,n.push("any",...i));for(let s=1;s<n.length;s++)Sd(n[s])}function aa(n){if(!Array.isArray(n))return!1;if((e=n[0])==="pitch"||e==="distance-from-center")return!0;var e;for(let i=1;i<n.length;i++)if(aa(n[i]))return!0;return!1}const _f=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function gf(n,e){return n<e?-1:n>e?1:0}function Ed(n){if(!Array.isArray(n))return!1;if(n[0]==="within"||n[0]==="distance")return!0;for(let e=1;e<n.length;e++)if(Ed(n[e]))return!0;return!1}function uc(n){if(!n)return!0;const e=n[0];return n.length<=1?e!=="any":e==="=="?Gs(n[1],n[2],"=="):e==="!="?go(Gs(n[1],n[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Gs(n[1],n[2],e):e==="any"?(i=n.slice(1),["any"].concat(i.map(uc))):e==="all"?["all"].concat(n.slice(1).map(uc)):e==="none"?["all"].concat(n.slice(1).map(uc).map(go)):e==="in"?Vu(n[1],n.slice(2)):e==="!in"?go(Vu(n[1],n.slice(2))):e==="has"?Uu(n[1]):e!=="!has"||go(Uu(n[1]));var i}function Gs(n,e,i){switch(n){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,n,e]}}function Vu(n,e){if(e.length===0)return!1;switch(n){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(i=>typeof i!=typeof e[0])?["filter-in-large",n,["literal",e.sort(gf)]]:["filter-in-small",n,["literal",e]]}}function Uu(n){switch(n){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",n]}}function go(n){return["!",n]}const hc="�";function la(n,e){return e?`${n}${hc}${e}`:n}const ys="-transition",Md=new Set(["fill","line","background","hillshade","raster"]);class br extends kn{constructor(e,i,s,l,a){if(super(),this.id=e.id,this.fqid=la(this.id,s),this.type=e.type,this.scope=s,this.lut=l,this.options=a,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.configDependencies=new Set,e.type!=="custom"){if(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type&&e.type!=="background"&&e.type!=="sky"&&e.type!=="slot"){this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter;const h=Jo(this.filter,Pe[`filter_${e.type}`]);h.result!=="error"&&(this.configDependencies=new Set([...this.configDependencies,...h.value.configDependencies]))}if(e.slot&&(this.slot=e.slot),i.layout&&(this._unevaluatedLayout=new ra(i.layout,this.scope,a),this.configDependencies=new Set([...this.configDependencies,...this._unevaluatedLayout.configDependencies])),i.paint){this._transitionablePaint=new Fu(i.paint,this.scope,a);for(const h in e.paint)this.setPaintProperty(h,e.paint[h]);for(const h in e.layout)this.setLayoutProperty(h,e.layout[h]);this.configDependencies=new Set([...this.configDependencies,...this._transitionablePaint.configDependencies]),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new sa(i.paint)}}}onAdd(e){}onRemove(e){}isDraped(e){return!this.is3D(!0)&&Md.has(this.type)}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}
20setLayoutProperty(e,i){if(this.type==="custom"&&e==="visibility")return void(this.visibility=i);const s=this._unevaluatedLayout;s._properties.properties[e]&&(s.setValue(e,i),this.configDependencies=new Set([...this.configDependencies,...s.configDependencies]),e==="visibility"&&this.possiblyEvaluateVisibility())}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(e){return e.endsWith(ys)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,i){const s=this._transitionablePaint,l=s._properties.properties;if(e.endsWith(ys)){const y=e.slice(0,-11);return l[y]&&s.setTransition(y,i||void 0),!1}if(!l[e])return!1;const a=s._values[e],h=a.value.isDataDriven(),m=a.value;s.setValue(e,i),this.configDependencies=new Set([...this.configDependencies,...s.configDependencies]),this._handleSpecialPaintPropertyUpdate(e);const g=s._values[e].value,x=g.isDataDriven(),p=e.endsWith("pattern")||e==="line-dasharray";return x||h||p||this._handleOverridablePaintPropertyUpdate(e,m,g)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,i,s){return null}_handleOverridablePaintPropertyUpdate(e,i,s){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||this.visibility==="none"}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.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,i)}
20serialize(){return ao({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()},(e,i)=>!(e===void 0||i==="layout"&&!Object.keys(e).length||i==="paint"&&!Object.keys(e).length))}is3D(e){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(){}isStateDependent(){for(const e in this.paint._values){const i=this.paint.get(e);if(i instanceof na&&Ko(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}return!1}compileFilter(e){this._filterCompiled||(this._featureFilter=Nu(this.filter,this.scope,e),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(e){this._stats&&(e.renderPass==="shadow"?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}queryRadius(e){}queryIntersectsFeature(e,i,s,l,a,h,m,g,x){}}const yf={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class el{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}}class ki{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,i){return e._trim(),i&&(e.isTransferred=!0,i.add(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const i=Object.create(this.prototype);return i.arrayBuffer=e.arrayBuffer,i.length=e.length,i.capacity=e.arrayBuffer.byteLength/i.bytesPerElement,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.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...e){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...e){throw new Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function yi(n,e=1){let i=0,s=0;return{members:n.map(l=>{const a=yf[l.type].BYTES_PER_ELEMENT,h=i=Id(i,Math.max(e,a)),m=l.components||1;return s=Math.max(s,a),i+=a*m,{name:l.name,type:l.type,components:m,offset:h}}),size:Id(i,Math.max(s,e)),alignment:e}}function Id(n,e){return Math.ceil(n/e)*e}class vs extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const l=2*e;return this.int16[l+0]=i,this.int16[l+1]=s,e}}vs.prototype.bytesPerElement=4,vt(vs,"StructArrayLayout2i4");class ca extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,s)}emplace(e,i,s,l){const a=3*e;return this.int16[a+0]=i,this.int16[a+1]=s,this.int16[a+2]=l,e}}ca.prototype.bytesPerElement=6,vt(ca,"StructArrayLayout3i6");class xs extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,l){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s,l)}emplace(e,i,s,l,a){const h=4*e;return this.int16[h+0]=i,this.int16[h+1]=s,this.int16[h+2]=l,this.int16[h+3]=a,e}}xs.prototype.bytesPerElement=8,vt(xs,"StructArrayLayout4i8");class yo extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.float32[1*e+0]=i,e}}yo.prototype.bytesPerElement=4,vt(yo,"StructArrayLayout1f4");class tl extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,s)}emplace(e,i,s,l){const a=4*e,h=2*e;return this.int16[a+0]=i,this.int16[a+1]=s,this.float32[h+1]=l,e}}tl.prototype.bytesPerElement=8,vt(tl,"StructArrayLayout2i1f8");class ju extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,s)}emplace(e,i,s,l){const a=4*e;return this.int16[a+0]=i,this.int16[a+1]=s,this.int16[a+2]=l,e}}ju.prototype.bytesPerElement=8,vt(ju,"StructArrayLayout3i8");class An extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,l,a){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,s,l,a)}emplace(e,i,s,l,a,h){const m=5*e;return this.int16[m+0]=i,this.int16[m+1]=s,this.int16[m+2]=l,this.int16[m+3]=a,this.int16[m+4]=h,e}}An.prototype.bytesPerElement=10,vt(An,"StructArrayLayout5i10");class qu extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,l,a,h,m){const g=this.length;return this.resize(g+1),this.emplace(g,e,i,s,l,a,h,m)}emplace(e,i,s,l,a,h,m,g){const x=6*e,p=12*e,y=3*e;return this.int16[x+0]=i,this.int16[x+1]=s,this.uint8[p+4]=l,this.uint8[p+5]=a,this.uint8[p+6]=h,this.uint8[p+7]=m,this.float32[y+2]=g,e}}qu.prototype.bytesPerElement=12,vt(qu,"StructArrayLayout2i4ub1f12");class Vn extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,s)}emplace(e,i,s,l){const a=3*e;return this.float32[a+0]=i,this.float32[a+1]=s,this.float32[a+2]=l,e}}Vn.prototype.bytesPerElement=12,vt(Vn,"StructArrayLayout3f12");class $s extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,l,a){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,s,l,a)}emplace(e,i,s,l,a,h){const m=6*e,g=3*e;return this.uint16[m+0]=i,this.uint16[m+1]=s,this.uint16[m+2]=l,this.uint16[m+3]=a,this.float32[g+2]=h,e}}$s.prototype.bytesPerElement=12,vt($s,"StructArrayLayout4ui1f12");class dc extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,l){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s,l)}emplace(e,i,s,l,a){const h=4*e;return this.uint16[h+0]=i,this.uint16[h+1]=s,this.uint16[h+2]=l,this.uint16[h+3]=a,e}}dc.prototype.bytesPerElement=8,vt(dc,"StructArrayLayout4ui8");class pc extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,l,a,h){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,s,l,a,h)}emplace(e,i,s,l,a,h,m){const g=6*e;return this.int16[g+0]=i,this.int16[g+1]=s,this.int16[g+2]=l,this.int16[g+3]=a,this.int16[g+4]=h,this.int16[g+5]=m,e}}pc.prototype.bytesPerElement=12,vt(pc,"StructArrayLayout6i12");class Gu extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,l,a,h,m,g,x,p,y,w){const v=this.length;return this.resize(v+1),this.emplace(v,e,i,s,l,a,h,m,g,x,p,y,w)}emplace(e,i,s,l,a,h,m,g,x,p,y,w,v){const b=12*e;return this.int16[b+0]=i,this.int16[b+1]=s,this.int16[b+2]=l,this.int16[b+3]=a,this.uint16[b+4]=h,this.uint16[b+5]=m,this.uint16[b+6]=g,this.uint16[b+7]=x,this.int16[b+8]=p,this.int16[b+9]=y,this.int16[b+10]=w,this.int16[b+11]=v,e}}Gu.prototype.bytesPerElement=24,vt(Gu,"StructArrayLayout4i4ui4i24");class $u extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,l,a,h){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,s,l,a,h)}emplace(e,i,s,l,a,h,m){const g=10*e,x=5*e;return this.int16[g+0]=i,this.int16[g+1]=s,this.int16[g+2]=l,this.float32[x+2]=a,this.float32[x+3]=h,this.float32[x+4]=m,e}}$u.prototype.bytesPerElement=20,vt($u,"StructArrayLayout3i3f20");class vo extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,l){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s,l)}emplace(e,i,s,l,a){const h=4*e;return this.float32[h+0]=i,this.float32[h+1]=s,this.float32[h+2]=l,this.float32[h+3]=a,e}}vo.prototype.bytesPerElement=16,vt(vo,"StructArrayLayout4f16");class Hu extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint32[1*e+0]=i,e}}Hu.prototype.bytesPerElement=4,vt(Hu,"StructArrayLayout1ul4");class Hs extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const l=2*e;return this.uint16[l+0]=i,this.uint16[l+1]=s,e}}Hs.prototype.bytesPerElement=4,vt(Hs,"StructArrayLayout2ui4");class Zu extends ki{_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,s,l,a,h,m,g,x,p,y,w,v){const b=this.length;return this.resize(b+1),this.emplace(b,e,i,s,l,a,h,m,g,x,p,y,w,v)}emplace(e,i,s,l,a,h,m,g,x,p,y,w,v,b){const S=20*e,A=10*e;return this.int16[S+0]=i,this.int16[S+1]=s,this.int16[S+2]=l,this.int16[S+3]=a,this.int16[S+4]=h,this.float32[A+3]=m,this.float32[A+4]=g,this.float32[A+5]=x,this.float32[A+6]=p,this.int16[S+14]=y,this.uint32[A+8]=w,this.uint16[S+18]=v,this.uint16[S+19]=b,e}}Zu.prototype.bytesPerElement=40,vt(Zu,"StructArrayLayout5i4f1i1ul2ui40");class il extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,l,a,h,m){const g=this.length;return this.resize(g+1),this.emplace(g,e,i,s,l,a,h,m)}emplace(e,i,s,l,a,h,m,g){const x=8*e;return this.int16[x+0]=i,this.int16[x+1]=s,this.int16[x+2]=l,this.int16[x+4]=a,this.int16[x+5]=h,this.int16[x+6]=m,this.int16[x+7]=g,e}}il.prototype.bytesPerElement=16,vt(il,"StructArrayLayout3i2i2i16");class Wu extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,l,a){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,s,l,a)}emplace(e,i,s,l,a,h){const m=4*e,g=8*e;return this.float32[m+0]=i,this.float32[m+1]=s,this.float32[m+2]=l,this.int16[g+6]=a,this.int16[g+7]=h,e}}Wu.prototype.bytesPerElement=16,vt(Wu,"StructArrayLayout2f1f2i16");class Xu extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,l,a,h){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,s,l,a,h)}emplace(e,i,s,l,a,h,m){const g=20*e,x=5*e;return this.uint8[g+0]=i,this.uint8[g+1]=s,this.float32[x+1]=l,this.float32[x+2]=a,this.float32[x+3]=h,this.float32[x+4]=m,e}}Xu.prototype.bytesPerElement=20,vt(Xu,"StructArrayLayout2ub4f20");class Tr extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,s)}emplace(e,i,s,l){const a=3*e;return this.uint16[a+0]=i,this.uint16[a+1]=s,this.uint16[a+2]=l,e}}Tr.prototype.bytesPerElement=6,vt(Tr,"StructArrayLayout3ui6");class fc extends ki{_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,s,l,a,h,m,g,x,p,y,w,v,b,S,A,C,D,L,z,k){const B=this.length;return this.resize(B+1),this.emplace(B,e,i,s,l,a,h,m,g,x,p,y,w,v,b,S,A,C,D,L,z,k)}emplace(e,i,s,l,a,h,m,g,x,p,y,w,v,b,S,A,C,D,L,z,k,B){const V=30*e,W=15*e,$=60*e;return this.int16[V+0]=i,this.int16[V+1]=s,this.int16[V+2]=l,this.float32[W+2]=a,this.float32[W+3]=h,this.uint16[V+8]=m,this.uint16[V+9]=g,this.uint32[W+5]=x,this.uint32[W+6]=p,this.uint32[W+7]=y,this.uint16[V+16]=w,this.uint16[V+17]=v,this.uint16[V+18]=b,this.float32[W+10]=S,this.float32[W+11]=A,this.uint8[$+48]=C,this.uint8[$+49]=D,this.uint8[$+50]=L,this.uint32[W+13]=z,this.int16[V+28]=k,this.uint8[$+58]=B,e}}
vendor: 9,671 bytes, line 20
20fc.prototype.bytesPerElement=60,vt(fc,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class mc extends ki{_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,s,l,a,h,m,g,x,p,y,w,v,b,S,A,C,D,L,z,k,B,V,W,$,H,ae,Y,le,_e,pe,xe,ye){const Me=this.length;return this.resize(Me+1),this.emplace(Me,e,i,s,l,a,h,m,g,x,p,y,w,v,b,S,A,C,D,L,z,k,B,V,W,$,H,ae,Y,le,_e,pe,xe,ye)}emplace(e,i,s,l,a,h,m,g,x,p,y,w,v,b,S,A,C,D,L,z,k,B,V,W,$,H,ae,Y,le,_e,pe,xe,ye,Me){const Te=20*e,Ae=40*e,et=80*e;return this.float32[Te+0]=i,this.float32[Te+1]=s,this.int16[Ae+4]=l,this.int16[Ae+5]=a,this.int16[Ae+6]=h,this.int16[Ae+7]=m,this.int16[Ae+8]=g,this.int16[Ae+9]=x,this.int16[Ae+10]=p,this.int16[Ae+11]=y,this.int16[Ae+12]=w,this.uint16[Ae+13]=v,this.uint16[Ae+14]=b,this.uint16[Ae+15]=S,this.uint16[Ae+16]=A,this.uint16[Ae+17]=C,this.uint16[Ae+18]=D,this.uint16[Ae+19]=L,this.uint16[Ae+20]=z,this.uint16[Ae+21]=k,this.uint16[Ae+22]=B,this.uint16[Ae+23]=V,this.uint16[Ae+24]=W,this.uint16[Ae+25]=$,this.uint16[Ae+26]=H,this.uint16[Ae+27]=ae,this.uint32[Te+14]=Y,this.float32[Te+15]=le,this.float32[Te+16]=_e,this.float32[Te+17]=pe,this.float32[Te+18]=xe,this.uint8[et+76]=ye,this.uint16[Ae+39]=Me,e}}mc.prototype.bytesPerElement=80,vt(mc,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class rn extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,l,a){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,s,l,a)}emplace(e,i,s,l,a,h){const m=5*e;return this.float32[m+0]=i,this.float32[m+1]=s,this.float32[m+2]=l,this.float32[m+3]=a,this.float32[m+4]=h,e}}rn.prototype.bytesPerElement=20,vt(rn,"StructArrayLayout5f20");class _c extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,l,a,h,m){const g=this.length;return this.resize(g+1),this.emplace(g,e,i,s,l,a,h,m)}emplace(e,i,s,l,a,h,m,g){const x=7*e;return this.float32[x+0]=i,this.float32[x+1]=s,this.float32[x+2]=l,this.float32[x+3]=a,this.float32[x+4]=h,this.float32[x+5]=m,this.float32[x+6]=g,e}}_c.prototype.bytesPerElement=28,vt(_c,"StructArrayLayout7f28");class Yu extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,l,a,h,m,g,x,p,y){const w=this.length;return this.resize(w+1),this.emplace(w,e,i,s,l,a,h,m,g,x,p,y)}emplace(e,i,s,l,a,h,m,g,x,p,y,w){const v=11*e;return this.float32[v+0]=i,this.float32[v+1]=s,this.float32[v+2]=l,this.float32[v+3]=a,this.float32[v+4]=h,this.float32[v+5]=m,this.float32[v+6]=g,this.float32[v+7]=x,this.float32[v+8]=p,this.float32[v+9]=y,this.float32[v+10]=w,e}}Yu.prototype.bytesPerElement=44,vt(Yu,"StructArrayLayout11f44");class Ku extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,l,a,h,m,g,x){const p=this.length;return this.resize(p+1),this.emplace(p,e,i,s,l,a,h,m,g,x)}emplace(e,i,s,l,a,h,m,g,x,p){const y=9*e;return this.float32[y+0]=i,this.float32[y+1]=s,this.float32[y+2]=l,this.float32[y+3]=a,this.float32[y+4]=h,this.float32[y+5]=m,this.float32[y+6]=g,this.float32[y+7]=x,this.float32[y+8]=p,e}}Ku.prototype.bytesPerElement=36,vt(Ku,"StructArrayLayout9f36");class ua extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const l=2*e;return this.float32[l+0]=i,this.float32[l+1]=s,e}}ua.prototype.bytesPerElement=8,vt(ua,"StructArrayLayout2f8");class rl extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,l){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s,l)}emplace(e,i,s,l,a){const h=6*e;return this.uint32[3*e+0]=i,this.uint16[h+2]=s,this.uint16[h+3]=l,this.uint16[h+4]=a,e}}rl.prototype.bytesPerElement=12,vt(rl,"StructArrayLayout1ul3ui12");class gc extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint16[1*e+0]=i,e}}gc.prototype.bytesPerElement=2,vt(gc,"StructArrayLayout1ui2");class yc extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,l,a,h,m,g,x,p,y,w,v,b,S,A){const C=this.length;return this.resize(C+1),this.emplace(C,e,i,s,l,a,h,m,g,x,p,y,w,v,b,S,A)}emplace(e,i,s,l,a,h,m,g,x,p,y,w,v,b,S,A,C){const D=16*e;return this.float32[D+0]=i,this.float32[D+1]=s,this.float32[D+2]=l,this.float32[D+3]=a,this.float32[D+4]=h,this.float32[D+5]=m,this.float32[D+6]=g,this.float32[D+7]=x,this.float32[D+8]=p,this.float32[D+9]=y,this.float32[D+10]=w,this.float32[D+11]=v,this.float32[D+12]=b,this.float32[D+13]=S,this.float32[D+14]=A,this.float32[D+15]=C,e}}yc.prototype.bytesPerElement=64,vt(yc,"StructArrayLayout16f64");class vc extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,l,a,h,m){const g=this.length;return this.resize(g+1),this.emplace(g,e,i,s,l,a,h,m)}emplace(e,i,s,l,a,h,m,g){const x=10*e,p=5*e;return this.uint16[x+0]=i,this.uint16[x+1]=s,this.uint16[x+2]=l,this.uint16[x+3]=a,this.float32[p+2]=h,this.float32[p+3]=m,this.float32[p+4]=g,e}}vc.prototype.bytesPerElement=20,vt(vc,"StructArrayLayout4ui3f20");class xc extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.int16[1*e+0]=i,e}}xc.prototype.bytesPerElement=2,vt(xc,"StructArrayLayout1i2");class Ju extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint8[1*e+0]=i,e}}Ju.prototype.bytesPerElement=1,vt(Ju,"StructArrayLayout1ub1");class Qu extends el{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}Qu.prototype.size=40;class nl extends Zu{get(e){return new Qu(this,e)}}vt(nl,"CollisionBoxArray");class Ad extends el{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}}Ad.prototype.size=60;class Cd extends fc{get(e){return new Ad(this,e)}}vt(Cd,"PlacedSymbolArray");class Pd extends el{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}
vendor: 4,429 bytes, line 20
20get 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]}}Pd.prototype.size=80;class Rd extends mc{get(e){return new Pd(this,e)}}vt(Rd,"SymbolInstanceArray");class zd extends yo{getoffsetX(e){return this.float32[1*e+0]}}vt(zd,"GlyphOffsetArray");class sl extends vs{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}vt(sl,"SymbolLineVertexArray");class ol extends el{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]}}ol.prototype.size=12;class nn extends rl{get(e){return new ol(this,e)}}vt(nn,"FeatureIndexArray");class al extends Hs{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}vt(al,"FillExtrusionCentroidArray");class Ld extends el{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]}}Ld.prototype.size=6;class Dd extends ca{get(e){return new Ld(this,e)}}vt(Dd,"FillExtrusionWallArray");const vf=yi([{name:"a_pos",components:2,type:"Int16"}],4),xf=yi([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class Ui{constructor(e=[]){this.segments=e}_prepareSegment(e,i,s,l){let a=this.segments[this.segments.length-1];return e>Ui.MAX_VERTEX_ARRAY_LENGTH&&Hi(`Max vertices per segment is ${Ui.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!a||a.vertexLength+e>Ui.MAX_VERTEX_ARRAY_LENGTH||a.sortKey!==l)&&(a={vertexOffset:i,primitiveOffset:s,vertexLength:0,primitiveLength:0},l!==void 0&&(a.sortKey=l),this.segments.push(a)),a}prepareSegment(e,i,s,l){return this._prepareSegment(e,i.length,s.length,l)}get(){return this.segments}destroy(){for(const e of this.segments)for(const i in e.vaos)e.vaos[i].destroy()}static simpleSegment(e,i,s,l){return new Ui([{vertexOffset:e,primitiveOffset:i,vertexLength:s,primitiveLength:l,vaos:{},sortKey:0}])}}function Od(n,e){return 256*(n=Qt(Math.floor(n),0,255))+Qt(Math.floor(e),0,255)}Ui.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,vt(Ui,"SegmentVector");const eh=yi([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),bf=yi([{name:"a_dash",components:4,type:"Uint16"}]);class ll{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}
20add(e,i,s,l){this.ids.push(th(e)),this.positions.push(i,s,l)}eachPosition(e,i){const s=th(e);let l=0,a=this.ids.length-1;for(;l<a;){const h=l+a>>1;this.ids[h]>=s?a=h:l=h+1}for(;this.ids[l]===s;)i(this.positions[3*l],this.positions[3*l+1],this.positions[3*l+2]),l++}static serialize(e,i){const s=new Float64Array(e.ids),l=new Uint32Array(e.positions);return cl(s,l,0,s.length-1),i&&(i.add(s.buffer),i.add(l.buffer)),{ids:s,positions:l}}static deserialize(e){const i=new ll;let s;i.ids=e.ids,i.positions=e.positions;for(const l of i.ids)l!==s&&i.uniqueIds.push(l),s=l;return i.indexed=!0,i}}function th(n){const e=+n;return!isNaN(e)&&Number.MIN_SAFE_INTEGER<=e&&e<=Number.MAX_SAFE_INTEGER?e:dn(String(n))}function cl(n,e,i,s){for(;i<s;){const l=n[i+s>>1];let a=i-1,h=s+1;for(;;){do a++;while(n[a]<l);do h--;while(n[h]>l);if(a>=h)break;bc(n,a,h),bc(e,3*a,3*h),bc(e,3*a+1,3*h+1),bc(e,3*a+2,3*h+2)}h-i<s-h?(cl(n,e,i,h),i=h+1):(cl(n,e,h+1,s),s=h)}}function bc(n,e,i){const s=n[e];n[e]=n[i],n[i]=s}vt(ll,"FeaturePositionMap");class Qn{constructor(e){this.gl=e.gl,this.initialized=!1}fetchUniformLocation(e,i){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(e,i),this.initialized=!0),!!this.location}set(e,i,s){throw new Error("Uniform#set() must be implemented by each concrete Uniform")}}class ul extends Qn{constructor(e){super(e),this.current=0}set(e,i,s){this.fetchUniformLocation(e,i)&&this.current!==s&&(this.current=s,this.gl.uniform1i(this.location,s))}}class rr extends Qn{constructor(e){super(e),this.current=0}set(e,i,s){this.fetchUniformLocation(e,i)&&this.current!==s&&(this.current=s,this.gl.uniform1f(this.location,s))}}class Cn extends Qn{constructor(e){super(e),this.current=[0,0]}set(e,i,s){this.fetchUniformLocation(e,i)&&(s[0]===this.current[0]&&s[1]===this.current[1]||(this.current=s,this.gl.uniform2f(this.location,s[0],s[1])))}}class ha extends Qn{constructor(e){super(e),this.current=[0,0,0]}set(e,i,s){this.fetchUniformLocation(e,i)&&(s[0]===this.current[0]&&s[1]===this.current[1]&&s[2]===this.current[2]||(this.current=s,this.gl.uniform3f(this.location,s[0],s[1],s[2])))}}class hl extends Qn{constructor(e){super(e),this.current=[0,0,0,0]}set(e,i,s){this.fetchUniformLocation(e,i)&&(s[0]===this.current[0]&&s[1]===this.current[1]&&s[2]===this.current[2]&&s[3]===this.current[3]||(this.current=s,this.gl.uniform4f(this.location,s[0],s[1],s[2],s[3])))}}class kd extends Qn{constructor(e){super(e),this.current=Mi.transparent.toRenderColor(null)}set(e,i,s){this.fetchUniformLocation(e,i)&&(s.r===this.current.r&&s.g===this.current.g&&s.b===this.current.b&&s.a===this.current.a||(this.current=s,this.gl.uniform4f(this.location,s.r,s.g,s.b,s.a)))}}const Fd=new Float32Array(16);class dl extends Qn{constructor(e){super(e),this.current=Fd}set(e,i,s){if(this.fetchUniformLocation(e,i)){if(s[12]!==this.current[12]||s[0]!==this.current[0])return this.current=s,void this.gl.uniformMatrix4fv(this.location,!1,s);for(let l=1;l<16;l++)if(s[l]!==this.current[l]){this.current=s,this.gl.uniformMatrix4fv(this.location,!1,s);break}}}}const ih=new Float32Array(9),wf=new Float32Array(4);class rh extends Qn{constructor(e){super(e),this.current=wf}set(e,i,s){if(this.fetchUniformLocation(e,i)){for(let l=0;l<4;l++)if(s[l]!==this.current[l]){this.current=s,this.gl.uniformMatrix2fv(this.location,!1,s);break}}}}function nh(n){return[Od(255*n.r,255*n.g),Od(255*n.b,255*n.a)]}class pl{constructor(e,i,s,l){this.value=e,this.uniformNames=i.map(a=>`u_${a}`),this.type=s,this.context=l}setUniform(e,i,s,l,a){const h=l.constantOr(this.value);i.set(e,a,h instanceof Mi?h.toRenderColor(this.lutExpression&&this.lutExpression.value==="none"?null:this.context.lut):h)}getBinding(e,i){return this.type==="color"?new kd(e):new rr(e)}}class xo{constructor(e,i){this.uniformNames=i.map(s=>`u_${s}`),this.pattern=null,this.pixelRatio=1}setConstantPatternPositions(e){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br)}setUniform(e,i,s,l,a){const h=a==="u_pattern"||a==="u_dash"?this.pattern:a==="u_pixel_ratio"?this.pixelRatio:null;h&&i.set(e,a,h)}getBinding(e,i){return i==="u_pattern"||i==="u_dash"?new hl(e):new rr(e)}}class bs{constructor(e,i,s,l){this.expression=e,this.type=s,this.maxValue=0,this.paintVertexAttributes=i.map(a=>({name:`a_${a}`,type:"Float32",components:s==="color"?2:1,offset:0})),this.paintVertexArray=new l}populatePaintArray(e,i,s,l,a,h,m){const g=this.paintVertexArray.length,x=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new zi(0,{brightness:h}),i,{},a,l,m):this.expression.kind==="constant"&&this.expression.value,p=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new zi(0,{brightness:h}),i,{},a,l,m):this.lutExpression.value)==="none";this.paintVertexArray.resize(e),this._setPaintValue(g,e,x,p?null:this.context.lut)}updatePaintArray(e,i,s,l,a,h,m){const g=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:m},s,l,void 0,a):this.expression.kind==="constant"&&this.expression.value,x=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new zi(0,{brightness:m}),s,l,void 0,a):this.lutExpression.value)==="none";this._setPaintValue(e,i,g,x?null:this.context.lut)}
20_setPaintValue(e,i,s,l){if(this.type==="color"){const a=nh(s.toRenderColor(l));for(let h=e;h<i;h++)this.paintVertexArray.emplace(h,a[0],a[1])}else{for(let a=e;a<i;a++)this.paintVertexArray.emplace(a,s);this.maxValue=Math.max(this.maxValue,Math.abs(s))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.lutExpression&&this.lutExpression.kind!=="constant"&&(this.lutExpression.isStateDependent||!this.lutExpression.isLightConstant)||this.expression.kind!=="constant"&&(this.expression.isStateDependent||!this.expression.isLightConstant)))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Un{constructor(e,i,s,l,a,h){this.expression=e,this.uniformNames=i.map(m=>`u_${m}_t`),this.type=s,this.useIntegerZoom=l,this.context=a,this.maxValue=0,this.paintVertexAttributes=i.map(m=>({name:`a_${m}`,type:"Float32",components:s==="color"?4:2,offset:0})),this.paintVertexArray=new h}populatePaintArray(e,i,s,l,a,h,m){const g=this.expression.evaluate(new zi(this.context.zoom,{brightness:h}),i,{},a,l,m),x=this.expression.evaluate(new zi(this.context.zoom+1,{brightness:h}),i,{},a,l,m),p=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new zi(0,{brightness:h}),i,{},a,l,m):this.lutExpression.value)==="none",y=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(y,e,g,x,p?null:this.context.lut)}updatePaintArray(e,i,s,l,a,h,m){const g=this.expression.evaluate({zoom:this.context.zoom,brightness:m},s,l,void 0,a),x=this.expression.evaluate({zoom:this.context.zoom+1,brightness:m},s,l,void 0,a),p=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new zi(0,{brightness:m}),s,l,void 0,a):this.lutExpression.value)==="none";this._setPaintValue(e,i,g,x,p?null:this.context.lut)}_setPaintValue(e,i,s,l,a){if(this.type==="color"){const h=nh(s.toRenderColor(a)),m=nh(s.toRenderColor(a));for(let g=e;g<i;g++)this.paintVertexArray.emplace(g,h[0],h[1],m[0],m[1])}else{for(let h=e;h<i;h++)this.paintVertexArray.emplace(h,s,l);this.maxValue=Math.max(this.maxValue,Math.abs(s),Math.abs(l))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,i,s,l,a){const h=this.useIntegerZoom?Math.floor(s.zoom):s.zoom,m=Qt(this.expression.interpolationFactor(h,this.context.zoom,this.context.zoom+1),0,1);i.set(e,a,m)}getBinding(e,i){return new rr(e)}}class Zs{constructor(e,i,s,l,a){this.expression=e,this.layerId=a,this.paintVertexAttributes=(s==="array"?bf:eh).members;for(let h=0;h<i.length;++h);this.paintVertexArray=new l}populatePaintArray(e,i,s,l){const a=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValues(a,e,i.patterns&&i.patterns[this.layerId],s)}updatePaintArray(e,i,s,l,a,h,m){this._setPaintValues(e,i,s.patterns&&s.patterns[this.layerId],h)}_setPaintValues(e,i,s,l){if(!l||!s)return;const a=l[s];if(!a)return;const{tl:h,br:m,pixelRatio:g}=a;for(let x=e;x<i;x++)this.paintVertexArray.emplace(x,h[0],h[1],m[0],m[1],g)}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class bo{constructor(e,i,s=()=>!0){this.binders={},this._buffers=[],this.context=i;const l=[];for(const a in e.paint._values){const h=e.paint.get(a);if(a.endsWith("-use-theme")||!s(a)||!(h instanceof na&&Ko(h.property.specification)))continue;const m=Sf(a,e.type),g=h.value,x=h.property.specification.type,p=!!h.property.useIntegerZoom,y=a==="line-dasharray"||a.endsWith("pattern"),w=e.paint.get(`${a}-use-theme`),v=a==="line-dasharray"&&e.layout.get("line-cap").value.kind!=="constant"||w&&w.value.kind!=="constant";if(g.kind!=="constant"||v)if(g.kind==="source"||v||y){const b=Bd(a,x,"source");this.binders[a]=y?new Zs(g,m,x,b,e.id):new bs(g,m,x,b),l.push(`/a_${a}`)}else{const b=Bd(a,x,"composite");this.binders[a]=new Un(g,m,x,p,i,b),l.push(`/z_${a}`)}else this.binders[a]=y?new xo(g.value,m):new pl(g.value,m,x,i),l.push(`/u_${a}`);w&&(this.binders[a].lutExpression=w.value)}this.cacheKey=l.sort().join("")}getMaxValue(e){const i=this.binders[e];return i instanceof bs||i instanceof Un?i.maxValue:0}populatePaintArrays(e,i,s,l,a,h,m){for(const g in this.binders){const x=this.binders[g];
vendor: 4,286 bytes, line 20
20x.context=this.context,(x instanceof bs||x instanceof Un||x instanceof Zs)&&x.populatePaintArray(e,i,s,l,a,h,m)}}setConstantPatternPositions(e){for(const i in this.binders){const s=this.binders[i];s instanceof xo&&s.setConstantPatternPositions(e)}}updatePaintArrays(e,i,s,l,a,h,m,g,x){let p=!1;const y=Object.keys(e),w=y.length!==0&&!g,v=w?y:i.uniqueIds;this.context.lut=a.lut;for(const b in this.binders){const S=this.binders[b];if(S.context=this.context,(S instanceof bs||S instanceof Un||S instanceof Zs)&&S.expression&&S.expression.kind&&S.expression.kind!=="constant"&&(S.expression.isStateDependent===!0||S.expression.isLightConstant===!1)){const A=a.paint.get(b);S.expression=A.value;for(const C of v){const D=e[C.toString()];i.eachPosition(C,(L,z,k)=>{const B=l.feature(L);S.updatePaintArray(z,k,B,D,h,m,x)})}if(!w)for(const C of s.uniqueIds){const D=e[C.toString()];s.eachPosition(C,(L,z,k)=>{const B=l.feature(L);S.updatePaintArray(z,k,B,D,h,m,x)})}p=!0}}return p}defines(){const e=[];for(const i in this.binders){const s=this.binders[i];(s instanceof pl||s instanceof xo)&&e.push(...s.uniformNames.map(l=>`#define HAS_UNIFORM_${l}`))}return e}getBinderAttributes(){const e=[];for(const i in this.binders){const s=this.binders[i];if(s instanceof bs||s instanceof Un||s instanceof Zs)for(let l=0;l<s.paintVertexAttributes.length;l++)e.push(s.paintVertexAttributes[l].name)}return e}getBinderUniforms(){const e=[];for(const i in this.binders){const s=this.binders[i];if(s instanceof pl||s instanceof xo||s instanceof Un)for(const l of s.uniformNames)e.push(l)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){const i=[];for(const s in this.binders){const l=this.binders[s];if(l instanceof pl||l instanceof xo||l instanceof Un)for(const a of l.uniformNames)i.push({name:a,property:s,binding:l.getBinding(e,a)})}return i}setUniforms(e,i,s,l,a){for(const{name:h,property:m,binding:g}of s)this.binders[m].setUniform(e,g,a,l.get(m),h)}updatePaintBuffers(){this._buffers=[];for(const e in this.binders){const i=this.binders[e];(i instanceof bs||i instanceof Un||i instanceof Zs)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(e){for(const i in this.binders){const s=this.binders[i];(s instanceof bs||s instanceof Un||s instanceof Zs)&&s.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const i=this.binders[e];(i instanceof bs||i instanceof Un||i instanceof Zs)&&i.destroy()}}}class Ws{constructor(e,i,s=()=>!0){this.programConfigurations={};for(const l of e)this.programConfigurations[l.id]=new bo(l,i,s);this.needsUpload=!1,this._featureMap=new ll,this._featureMapWithoutIds=new ll,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,i,s,l,a,h,m,g){for(const x in this.programConfigurations)this.programConfigurations[x].populatePaintArrays(e,i,l,a,h,m,g);i.id!==void 0?this._featureMap.add(i.id,s,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,s,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,s,l,a,h,m){for(const g of s)this.needsUpload=this.programConfigurations[g.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,i,g,l,a,h,m||0)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const i in this.programConfigurations)this.programConfigurations[i].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}const Tf={"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"],"fill-pattern":["pattern","pixel_ratio"],"fill-extrusion-pattern":["pattern","pixel_ratio"],"line-dasharray":["dash"]};function Sf(n,e){return Tf[n]||[n.replace(`${e}
20-`,"").replace(/-/g,"_")]}const Ef={"line-pattern":{source:$s,composite:$s},"fill-pattern":{source:$s,composite:$s},"fill-extrusion-pattern":{source:$s,composite:$s},"line-dasharray":{source:dc,composite:dc}},wc={color:{source:ua,composite:vo},number:{source:yo,composite:ua}};function Bd(n,e,i){const s=Ef[n];return s&&s[i]||wc[e][i]}vt(pl,"ConstantBinder"),vt(xo,"PatternConstantBinder"),vt(bs,"SourceExpressionBinder"),vt(Zs,"PatternCompositeBinder"),vt(Un,"CompositeExpressionBinder"),vt(bo,"ProgramConfiguration",{omit:["_buffers"]}),vt(Ws,"ProgramConfigurationSet");const jr=ht/Math.PI/2,da=5,Nd=6,Vd=16383,pa=64,Tc=[pa,32,16],_n=-jr,gn=jr;function fa(n,e,i,s=jr){return i=hi(i),[n*Math.sin(i)*s,-e*s,n*Math.cos(i)*s]}function wo(n,e,i){return fa(Math.cos(hi(n)),Math.sin(hi(n)),e,i)}const To=63710088e-1,sh=2*Math.PI*To;class vi{constructor(e,i){if(isNaN(e)||isNaN(i))throw new Error(`Invalid LngLat object: (${e}, ${i})`);if(this.lng=+e,this.lat=+i,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new vi(Os(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const i=Math.PI/180,s=this.lat*i,l=e.lat*i,a=Math.sin(s)*Math.sin(l)+Math.cos(s)*Math.cos(l)*Math.cos((e.lng-this.lng)*i);return To*Math.acos(Math.min(a,1))}
20toBounds(e=0){const i=360*e/40075017,s=i/Math.cos(Math.PI/180*this.lat);return new Xs({lng:this.lng-s,lat:this.lat-i},{lng:this.lng+s,lat:this.lat+i})}toEcef(e){return wo(this.lat,this.lng,jr+e*jr/To)}static convert(e){if(e instanceof vi)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new vi(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new vi(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class Xs{constructor(e,i){if(e)if(i)this.setSouthWest(e).setNorthEast(i);else if(e.length===4){const s=e;this.setSouthWest([s[0],s[1]]).setNorthEast([s[2],s[3]])}else{const s=e;this.setSouthWest(s[0]).setNorthEast(s[1])}}setNorthEast(e){return this._ne=e instanceof vi?new vi(e.lng,e.lat):vi.convert(e),this}setSouthWest(e){return this._sw=e instanceof vi?new vi(e.lng,e.lat):vi.convert(e),this}extend(e){const i=this._sw,s=this._ne;let l,a;if(e instanceof vi)l=e,a=e;else{if(!(e instanceof Xs))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(Xs.convert(e)):this.extend(vi.convert(e)):typeof e=="object"&&e!==null&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(vi.convert(e)):this;if(l=e._sw,a=e._ne,!l||!a)return this}return i||s?(i.lng=Math.min(l.lng,i.lng),i.lat=Math.min(l.lat,i.lat),s.lng=Math.max(a.lng,s.lng),s.lat=Math.max(a.lat,s.lat)):(this._sw=new vi(l.lng,l.lat),this._ne=new vi(a.lng,a.lat)),this}getCenter(){return new vi((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 vi(this.getWest(),this.getNorth())}getSouthEast(){return new vi(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:i,lat:s}=vi.convert(e);let l=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(l=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=s&&s<=this._ne.lat&&l}static convert(e){if(e)return e instanceof Xs?e:new Xs(e)}}const Mf=0,If=25.5;function Sc(n){return sh*Math.cos(n*Math.PI/180)}function es(n){return(180+n)/360}function sn(n){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n*Math.PI/360)))/360}function Cr(n,e){return n/Sc(e)}function on(n){return 360*n-180}function Sr(n){return 360/Math.PI*Math.atan(Math.exp((180-360*n)*Math.PI/180))-90}function oh(n,e){return n*Sc(Sr(e))}const tr=85.051129;function Ud(n){return Math.cos(hi(Qt(n,-tr,tr)))}function Ys(n,e){const i=Qt(e,Mf,If),s=Math.pow(2,i);return Ud(n)*sh/(512*s)}function Af(n){return 1/Math.cos(n*Math.PI/180)}function u(n,e=0){const i=Math.exp(Math.PI*(1-(n.y+e/ht)/(1<<n.z)*2));return 80150034*i/(i*i+1)/ht/(1<<n.z)}class t{constructor(e,i,s=0){this.x=+e,this.y=+i,this.z=+s}static fromLngLat(e,i=0){const s=vi.convert(e);return new t(es(s.lng),sn(s.lat),Cr(i,s.lat))}toLngLat(){return new vi(on(this.x),Sr(this.y))}toAltitude(){return oh(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/sh*Af(Sr(this.y))}}function r(n,e,i,s,l,a,h,m,g){const x=(e+s)/2,p=(i+l)/2,y=new dt(x,p);m(y),function(w,v,b,S,A,C){const D=b-A,L=S-C;return Math.abs((S-v)*D-(b-w)*L)/Math.hypot(D,L)}(y.x,y.y,a.x,a.y,h.x,h.y)>=g?(r(n,e,i,x,p,a,y,m,g),r(n,x,p,s,l,y,h,m,g)):n.push(h)}function c(n,e,i){let s=n[0],l=s.x,a=s.y;e(s);const h=[s];for(let m=1;m<n.length;m++){const g=n[m],{x,y:p}=g;e(g),r(h,l,a,x,p,s,g,e,i),l=x,a=p,s=g}return h}function d(n,e,i,s){if(s(e,i)){const l=e.add(i)._mult(.5);d(n,e,l,s),d(n,l,i,s)}else n.push(i)}function f(n,e){let i=n[0];const s=[i];for(let l=1;l<n.length;l++){const a=n[l];d(s,i,a,e),i=a}return s}const _=Math.pow(2,14)-1,T=-_-1;function E(n,e){const i=Math.round(n.x*e),s=Math.round(n.y*e);return n.x=Qt(i,T,_),n.y=Qt(s,T,_),(i<n.x||i>n.x+1||s<n.y||s>n.y+1)&&Hi("Geometry exceeds allowed extent, reduce your vector tile buffer size"),n}function M(n,e,i){const s=n.loadGeometry(),l=n.extent,a=ht/l;if(e&&i&&i.projection.isReprojectedInTileSpace){const h=1<<e.z,{scale:m,x:g,y:x,projection:p}=i,y=w=>{const v=on((e.x+w.x/l)/h),b=Sr((e.y+w.y/l)/h),S=p.project(v,b);w.x=(S.x*m-g)*l,w.y=(S.y*m-x)*l};for(let w=0;w<s.length;w++)if(n.type!==1)s[w]=c(s[w],y,1);else{const v=[];for(const b of s[w])b.x<0||b.x>=l||b.y<0||b.y>=l||(y(b),v.push(b));s[w]=v}}for(const h of s)for(const m of h)E(m,a);return s}function I(n,e){return{type:n.type,id:n.id,properties:n.properties,geometry:e?M(n):[]}}function P(n,e,i,s,l){n.emplaceBack(2*e+(s+1)/2,2*i+(l+1)/2)}function R(n,e,i){n.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}class O{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new vs,this.indexArray=new Tr,this.segments=new Ui,this.programConfigurations=new Ws(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}updateFootprints(e,i){}populate(e,i,s,l){const a=this.layers[0],h=[];let m=null;
20a.type==="circle"&&(m=a.layout.get("circle-sort-key"));for(const{feature:x,id:p,index:y,sourceLayerIndex:w}of e){const v=this.layers[0]._featureFilter.needGeometry,b=I(x,v);if(!this.layers[0]._featureFilter.filter(new zi(this.zoom),b,s))continue;const S=m?m.evaluate(b,{},s):void 0,A={id:p,properties:x.properties,type:x.type,sourceLayerIndex:w,index:y,geometry:v?b.geometry:M(x,s,l),patterns:{},sortKey:S};h.push(A)}m&&h.sort((x,p)=>x.sortKey-p.sortKey);let g=null;l.projection.name==="globe"&&(this.globeExtVertexArray=new pc,g=l.projection);for(const x of h){const{geometry:p,index:y,sourceLayerIndex:w}=x,v=e[y].feature;this.addFeature(x,p,y,i.availableImages,s,g,i.brightness),i.featureIndex.insert(v,p,y,w,this.index)}}update(e,i,s,l,a,h,m){this.programConfigurations.updatePaintArrays(e,i,a,s,l,h,m)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,vf.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,xf.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())}addFeature(e,i,s,l,a,h,m){for(const g of i)for(const x of g){const p=x.x,y=x.y;if(p<0||p>=ht||y<0||y>=ht)continue;if(h){const b=h.projectTilePoint(p,y,a),S=h.upVector(a,p,y),A=this.globeExtVertexArray;R(A,b,S),R(A,b,S),R(A,b,S),R(A,b,S)}const w=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),v=w.vertexLength;P(this.layoutVertexArray,p,y,-1,-1),P(this.layoutVertexArray,p,y,1,-1),P(this.layoutVertexArray,p,y,1,1),P(this.layoutVertexArray,p,y,-1,1),this.indexArray.emplaceBack(v,v+1,v+2),this.indexArray.emplaceBack(v,v+2,v+3),w.vertexLength+=4,w.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{},l,a,m)}}function N(n,e){for(let i=0;i<n.length;i++)if(ie(e,n[i]))return!0;for(let i=0;i<e.length;i++)if(ie(n,e[i]))return!0;return!!Z(n,e)}function F(n,e,i){return!!ie(n,e)||!!K(e,n,i)}function U(n,e){if(n.length===1)return te(e,n[0]);for(let i=0;i<e.length;i++){const s=e[i];for(let l=0;l<s.length;l++)if(ie(n,s[l]))return!0}for(let i=0;i<n.length;i++)if(te(e,n[i]))return!0;for(let i=0;i<e.length;i++)if(Z(n,e[i]))return!0;return!1}function q(n,e,i){if(n.length>1){if(Z(n,e))return!0;for(let s=0;s<e.length;s++)if(K(e[s],n,i))return!0}for(let s=0;s<n.length;s++)if(K(n[s],e,i))return!0;return!1}function Z(n,e){if(n.length===0||e.length===0)return!1;for(let i=0;i<n.length-1;i++){const s=n[i],l=n[i+1];for(let a=0;a<e.length-1;a++)if(J(s,l,e[a],e[a+1]))return!0}return!1}function J(n,e,i,s){return Ci(n,i,s)!==Ci(e,i,s)&&Ci(n,e,i)!==Ci(n,e,s)}function K(n,e,i){const s=i*i;if(e.length===1)return n.distSqr(e[0])<s;for(let l=1;l<e.length;l++)if(oe(n,e[l-1],e[l])<s)return!0;return!1}function oe(n,e,i){const s=e.distSqr(i);if(s===0)return n.distSqr(e);const l=((n.x-e.x)*(i.x-e.x)+(n.y-e.y)*(i.y-e.y))/s;return n.distSqr(l<0?e:l>1?i:i.sub(e)._mult(l)._add(e))}function te(n,e){let i,s,l,a=!1;for(let h=0;h<n.length;h++){i=n[h];for(let m=0,g=i.length-1;m<i.length;g=m++)s=i[m],l=i[g],s.y>e.y!=l.y>e.y&&e.x<(l.x-s.x)*(e.y-s.y)/(l.y-s.y)+s.x&&(a=!a)}return a}function ie(n,e){let i=!1;for(let s=0,l=n.length-1;s<n.length;l=s++){const a=n[s],h=n[l];a.y>e.y!=h.y>e.y&&e.x<(h.x-a.x)*(e.y-a.y)/(h.y-a.y)+a.x&&(i=!i)}return i}function re(n,e,i,s,l){for(const h of n)if(e<=h.x&&i<=h.y&&s>=h.x&&l>=h.y)return!0;const a=[new dt(e,i),new dt(e,l),new dt(s,l),new dt(s,i)];if(n.length>2){for(const h of a)if(ie(n,h))return!0}for(let h=0;h<n.length-1;h++)if(ue(n[h],n[h+1],a))return!0;return!1}function ue(n,e,i){const s=i[0],l=i[2];if(n.x<s.x&&e.x<s.x||n.x>l.x&&e.x>l.x||n.y<s.y&&e.y<s.y||n.y>l.y&&e.y>l.y)return!1;const a=Ci(n,e,i[0]);return a!==Ci(n,e,i[1])||a!==Ci(n,e,i[2])||a!==Ci(n,e,i[3])}function me(n,e,i,s,l,a){let h=e.y-n.y,m=n.x-e.x;if(a=a||0){const g=h*h+m*m;if(g===0)return!0;const x=Math.sqrt(g);h/=x,m/=x}return!((i.x-n.x)*h+(i.y-n.y)*m-a<0||(s.x-n.x)*h+(s.y-n.y)*m-a<0||(l.x-n.x)*h+(l.y-n.y)*m-a<0)}function Le(n,e,i,s,l,a,h){return!(me(n,e,s,l,a,h)||me(e,i,s,l,a,h)||me(i,n,s,l,a,h)||me(s,l,n,e,i,h)||me(l,a,n,e,i,h)||me(a,s,n,e,i,h))}function Ee(n,e,i){const s=e.paint.get(n).value;return s.kind==="constant"?s.value:i.programConfigurations.get(e.id).getMaxValue(n)}function Ze(n){return Math.sqrt(n[0]*n[0]+n[1]*n[1])}function We(n,e,i,s,l){if(!e[0]&&!e[1])return n;const a=dt.convert(e)._mult(l);i==="viewport"&&a._rotate(-s);const h=[];for(let m=0;m<n.length;m++)h.push(n[m].sub(a));return h}function ot(n,e,i,s){const l=dt.convert(n)._mult(s);return e==="viewport"&&l._rotate(-i),l}let Se,He;vt(O,"CircleBucket",{omit:["layers"]});var we,$e={exports:{}},Ve=(we||(we=1,function(n,e){(function(i){function s(a,h,m){var g=l(256*a,256*(h=Math.pow(2,m)-h-1),m),x=l(256*(a+1),256*(h+1),m);return g[0]+","+g[1]+","+x[0]+","+x[1]}function l(a,h,m){var g=2*Math.PI*6378137/256/Math.pow(2,m);return[a*g-2*Math.PI*6378137/2,h*g-2*Math.PI*6378137/2]}i.getURL=function(a,h,m,g,x,p){return p=p||{},a+"?"+["bbox="+s(m,g,x),"format="+(p.format||"image/png"),"service="+(p.service||"WMS"),"version="+(
vendor: 4,917 bytes, line 20
20p.version||"1.1.1"),"request="+(p.request||"GetMap"),"srs="+(p.srs||"EPSG:3857"),"width="+(p.width||256),"height="+(p.height||256),"layers="+h].join("&")},i.getTileBBox=s,i.getMercCoords=l,Object.defineProperty(i,"__esModule",{value:!0})})(e)}(0,$e.exports)),$e.exports);class Ke{constructor(e,i,s){this.z=e,this.x=i,this.y=s,this.key=pt(0,e,e,i,s)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,i){const s=Ve.getTileBBox(this.x,this.y,this.z),l=function(a,h,m){let g,x="";for(let p=a;p>0;p--)g=1<<p-1,x+=(h&g?1:0)+(m&g?2:0);return x}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(i==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",l).replace("{bbox-epsg-3857}",s)}toString(){return`${this.z}/${this.x}/${this.y}`}}class De{constructor(e,i){this.wrap=e,this.canonical=i,this.key=pt(e,i.z,i.z,i.x,i.y)}}class Qe{constructor(e,i,s,l,a){this.overscaledZ=e,this.wrap=i,this.canonical=new Ke(s,+l,+a),this.key=i===0&&e===s?this.canonical.key:pt(i,e,s,l,a)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){const i=this.canonical.z-e;return e>this.canonical.z?new Qe(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Qe(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 pt(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y);{const s=this.canonical.z-e;return pt(this.wrap*+i,e,e,this.canonical.x>>s,this.canonical.y>>s)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;const i=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.z<this.canonical.z&&e.canonical.x===this.canonical.x>>i&&e.canonical.y===this.canonical.y>>i}children(e){if(this.overscaledZ>=e)return[new Qe(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const i=this.canonical.z+1,s=2*this.canonical.x,l=2*this.canonical.y;return[new Qe(i,this.wrap,i,s,l),new Qe(i,this.wrap,i,s+1,l),new Qe(i,this.wrap,i,s,l+1),new Qe(i,this.wrap,i,s+1,l+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Qe(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Qe(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new De(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function pt(n,e,i,s,l){const a=1<<Math.min(i,22);let h=a*(l%a)+s%a;return n&&i<22&&(h+=a*a*((n<0?-2*n-1:2*n)%(1<<2*(22-i)))),16*(32*h+i)+(e-i)}const ft=[n=>{let e=n.canonical.x-1,i=n.wrap;return e<0&&(e=(1<<n.canonical.z)-1,i--),new Qe(n.overscaledZ,i,n.canonical.z,e,n.canonical.y)},n=>{let e=n.canonical.x+1,i=n.wrap;return e===1<<n.canonical.z&&(e=0,i++),new Qe(n.overscaledZ,i,n.canonical.z,e,n.canonical.y)},n=>new Qe(n.overscaledZ,n.wrap,n.canonical.z,n.canonical.x,(n.canonical.y===0?1<<n.canonical.z:n.canonical.y)-1),n=>new Qe(n.overscaledZ,n.wrap,n.canonical.z,n.canonical.x,n.canonical.y===(1<<n.canonical.z)-1?0:n.canonical.y+1)];vt(Ke,"CanonicalTileID"),vt(Qe,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});const mt=yi([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:Et}=mt,qt=yi([{name:"a_pos_3",components:3,type:"Int16"}]);var Lt=yi([{name:"a_pos",type:"Int16",components:2}]);class Vt{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,s){const l=X.vec2.dot(i,this.dir);if(Math.abs(l)<1e-6)return!1;const a=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1])/l;return s[0]=this.pos[0]+this.dir[0]*a,s[1]=this.pos[1]+this.dir[1]*a,!0}}class kt{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,s){const l=X.vec3.dot(i,this.dir);if(Math.abs(l)<1e-6)return!1;const a=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1]+(e[2]-this.pos[2])*i[2])/l;return s[0]=this.pos[0]+this.dir[0]*a,s[1]=this.pos[1]+this.dir[1]*a,s[2]=this.pos[2]+this.dir[2]*a,!0}closestPointOnSphere(e,i,s){if(X.vec3.equals(this.pos,e)||i===0)return s[0]=s[1]=s[2]=0,!1;const[l,a,h]=this.dir,m=this.pos[0]-e[0],g=this.pos[1]-e[1],x=this.pos[2]-e[2],p=l*l+a*a+h*h,y=2*(m*l+g*a+x*h),w=y*y-4*p*(m*m+g*g+x*x-i*i);if(w<0){const v=Math.max(-y/2,0),b=m+l*v,S=g+a*v,A=x+h*v,C=Math.hypot(b,S,A);return s[0]=b*i/C,s[1]=S*i/C,s[2]=A*i/C,!1}{const v=(-y-Math.sqrt(w))/(2*p);if(v<0){const b=Math.hypot(m,g,x);return s[0]=m*i/b,s[1]=g*i/b,s[2]=x*i/b,!1}
20return s[0]=m+l*v,s[1]=g+a*v,s[2]=x+h*v,!0}}}class ai{constructor(e,i,s,l,a){this.TL=e,this.TR=i,this.BR=s,this.BL=l,this.horizon=a}static fromInvProjectionMatrix(e,i,s){const l=[-1,1,1],a=[1,1,1],h=[1,-1,1],m=[-1,-1,1],g=X.vec3.transformMat4(l,l,e),x=X.vec3.transformMat4(a,a,e),p=X.vec3.transformMat4(h,h,e),y=X.vec3.transformMat4(m,m,e);return new ai(g,x,p,y,i/s)}}function xi(n,e,i){let s=1/0,l=-1/0;const a=[];for(const h of n){X.vec3.sub(a,h,e);const m=X.vec3.dot(a,i);s=Math.min(s,m),l=Math.max(l,m)}return[s,l]}function Di(n,e){let i=!0;for(let s=0;s<n.planes.length;s++){const l=n.planes[s];let a=0;for(let h=0;h<e.length;h++)a+=X.vec3.dot(l,e[h])+l[3]>=0;if(a===0)return 0;a!==e.length&&(i=!1)}return i?2:1}function ei(n,e){for(const i of n.projections){const s=xi(e,n.points[0],i.axis);if(i.projection[1]<s[0]||i.projection[0]>s[1])return 0}return 1}function ji(n,e){let i=0;const s=[0,0,0,0];for(let l=0;l<n.length;l++)s[0]=n[l][0],s[1]=n[l][1],s[2]=n[l][2],s[3]=1,X.vec4.dot(s,e)>=0&&i++;return i}class Ht{constructor(e,i){this.points=e||new Array(8).fill([0,0,0]),this.planes=i||new Array(6).fill([0,0,0,0]),this.bounds=Mt.fromPoints(this.points),this.projections=[],this.frustumEdges=[X.vec3.sub([],this.points[2],this.points[3]),X.vec3.sub([],this.points[0],this.points[3]),X.vec3.sub([],this.points[4],this.points[0]),X.vec3.sub([],this.points[5],this.points[1]),X.vec3.sub([],this.points[6],this.points[2]),X.vec3.sub([],this.points[7],this.points[3])];for(const s of this.frustumEdges){const l=[0,-s[2],s[1]],a=[s[2],0,-s[0]];this.projections.push({axis:l,projection:xi(this.points,this.points[0],l)}),this.projections.push({axis:a,projection:xi(this.points,this.points[0],a)})}}static fromInvProjectionMatrix(e,i,s,l){const a=Math.pow(2,s),h=[[-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(x=>{const p=X.vec4.transformMat4([],x,e),y=1/p[3]/i*a;return X.vec4.mul(p,p,[y,y,l?1/p[3]:y,y])}),m=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(x=>{const p=X.vec3.sub([],h[x[0]],h[x[1]]),y=X.vec3.sub([],h[x[2]],h[x[1]]),w=X.vec3.normalize([],X.vec3.cross([],p,y)),v=-X.vec3.dot(w,h[x[1]]);return w.concat(v)}),g=[];for(let x=0;x<h.length;x++)g.push([h[x][0],h[x][1],h[x][2]]);return new Ht(g,m)}intersectsPrecise(e,i,s){for(let l=0;l<i.length;l++)if(!ji(e,i[l]))return 0;for(let l=0;l<this.planes.length;l++)if(!ji(e,this.planes[l]))return 0;for(const l of s)for(const a of this.frustumEdges){const h=X.vec3.cross([],l,a),m=X.vec3.length(h);if(m===0)continue;X.vec3.scale(h,h,1/m);const g=xi(this.points,this.points[0],h),x=xi(e,this.points[0],h);if(g[0]>x[1]||x[0]>g[1])return 0}return 1}containsPoint(e){for(const i of this.planes){const s=i[3];if(X.vec3.dot([i[0],i[1],i[2]],e)+s<0)return!1}return!0}}class Mt{static fromPoints(e){const i=[1/0,1/0,1/0],s=[-1/0,-1/0,-1/0];for(const l of e)X.vec3.min(i,i,l),X.vec3.max(s,s,l);return new Mt(i,s)}static fromTileIdAndHeight(e,i,s){const l=1<<e.canonical.z,a=e.canonical.x,h=e.canonical.y;return new Mt([a/l,h/l,i],[(a+1)/l,(h+1)/l,s])}static applyTransform(e,i){const s=e.getCorners();for(let l=0;l<s.length;++l)X.vec3.transformMat4(s[l],s[l],i);return Mt.fromPoints(s)}static applyTransformFast(e,i){const s=[i[12],i[13],i[14]],l=[...s];for(let a=0;a<3;a++)for(let h=0;h<3;h++){const m=i[4*h+a],g=m*e.min[h],x=m*e.max[h];s[a]+=Math.min(g,x),l[a]+=Math.max(g,x)}return new Mt(s,l)}static projectAabbCorners(e,i){const s=e.getCorners();for(let l=0;l<s.length;++l)X.vec3.transformMat4(s[l],s[l],i);return s}constructor(e,i){this.min=e,this.max=i,this.center=X.vec3.scale([],X.vec3.add([],this.min,this.max),.5)}quadrant(e){const i=[e%2==0,e<2],s=X.vec3.clone(this.min),l=X.vec3.clone(this.max);for(let a=0;a<i.length;a++)s[a]=i[a]?this.min[a]:this.center[a],l[a]=i[a]?this.center[a]:this.max[a];return l[2]=this.max[2],new Mt(s,l)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}distanceZ(e){return Math.max(Math.min(this.max[2],e[2]),this.min[2])-e[2]}getCorners(){const e=this.min,i=this.max;return[[e[0],e[1],e[2]],[i[0],e[1],e[2]],[i[0],i[1],e[2]],[e[0],i[1],e[2]],[e[0],e[1],i[2]],[i[0],e[1],i[2]],[i[0],i[1],i[2]],[e[0],i[1],i[2]]]}intersects(e){return this.intersectsAabb(e.bounds)?Di(e,this.getCorners()):0}intersectsFlat(e){return this.intersectsAabb(e.bounds)?Di(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsPrecise(e,i){return i||this.intersects(e)?ei(e,this.getCorners()):0}intersectsPreciseFlat(e,i){return i||this.intersectsFlat(e)?ei(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsAabb(e){for(let i=0;i<3;++i)if(this.min[i]>e.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<3;i++)this.min[i]=Math.min(this.min[i],e.min[i]),this.max[i]=Math.max(this.max[i],e.max[i])}encapsulatePoint(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e[i]),this.max[i]=Math.max(this.max[i],e[i])}closestPoint(e){return[Math.max(Math.min(this.max[0],e[0]),this.min[0]),Math.max(Math.min(this.max[1],e[1]),this.min[1]),Math.max(Math.min(this.max[2],e[2]),this.min[2])]}}function ci(n){return n*jr/To}vt(Mt,"Aabb");const Ii=[new Mt([_n,_n,_n],[gn,gn,gn]),new Mt([_n,_n,_n],[0,0,gn]),new Mt([0,_n,_n],[gn,0,gn]),new Mt([_n,0,_n],[0,gn,gn]),new Mt([0,0,_n],[gn,gn,gn])];function fi(n,e,i,s=!0){const l=X.vec3.scale([],n._camera.position,n.worldSize),a=[e,i,1,1];X.vec4.transformMat4(a,a,n.pixelMatrixInverse),X.vec4.scale(a,a,1/a[3]);const h=X.vec3.sub([],a,l),m=X.vec3.normalize([],h),g=n.globeMatrix,x=[g[12],g[13],g[14]],p=X.vec3.sub([],x,l),y=X.vec3.length(p),w=X.vec3.normalize([],p),v=n.worldSize/(2*Math.PI),b=X.vec3.dot(w,m),S=Math.asin(v/y);if(S<Math.acos(b)){if(!s)return null;const ae=[],Y=[];X.vec3.scale(ae,m,y/b),X.vec3.normalize(Y,X.vec3.sub(Y,ae,p)),X.vec3.normalize(m,X.vec3.add(m,p,X.vec3.scale(m,Y,Math.tan(S)*y)))}const A=[];new kt(l,m).closestPointOnSphere(x,v,A);const C=X.vec3.normalize([],Po(g,0)),D=X.vec3.normalize([],Po(g,1)),L=X.vec3.normalize([],Po(g,2)),z=X.vec3.dot(C,A),k=X.vec3.dot(D,A),B=X.vec3.dot(L,A),V=gr(Math.asin(-k/v));let W=gr(Math.atan2(z,B));W=n.center.lng+function(ae,Y){const le=(Y-ae+180)%360-180;return le<-180?le+360:le}(n.center.lng,W);const $=es(W),H=Qt(sn(V),0,1);return new t($,H)}class Yi{constructor(e,i,s){this.a=X.vec3.sub([],e,s),this.b=X.vec3.sub([],i,s),this.center=s;const l=X.vec3.normalize([],this.a),a=X.vec3.normalize([],this.b);this.angle=Math.acos(X.vec3.dot(l,a))}}function nr(n,e){if(n.angle===0)return null;let i;return i=n.a[e]===0?1/n.angle*.5*Math.PI:1/n.angle*Math.atan(n.b[e]/n.a[e]/Math.sin(n.angle)-1/Math.tan(n.angle)),i<0||i>1?null:function(s,l,a,h){const m=Math.sin(a);return s*(Math.sin((1-h)*a)/m)+l*(Math.sin(h*a)/m)}(n.a[e],n.b[e],n.angle,Qt(i,0,1))+n.center[e]}function cr(n){if(n.z<=1)return Ii[n.z+2*n.y+n.x];const e=qi(di(n));return Mt.fromPoints(e)}function hr(n,e,i){return X.vec3.scale(n,n,1-i),X.vec3.scaleAndAdd(n,n,e,i)}function yn(n,e,i){for(const s of n)X.vec3.transformMat4(s,s,e),X.vec3.scale(s,s,i)}function kr(n,e,i,s){const l=e/n.worldSize,a=n.globeMatrix;if(i.z<=1){const $=cr(i).getCorners();return yn($,a,l),Mt.fromPoints($)}const h=di(i,s),m=qi(h,jr+ci(n._tileCoverLift));yn(m,a,l);const g=Number.MAX_VALUE,x=[-g,-g,-g],p=[g,g,g];if(h.contains(n.center)){for(const ae of m)X.vec3.min(p,p,ae),X.vec3.max(x,x,ae);x[2]=0;const $=n.point,H=[$.x*l,$.y*l,0];return X.vec3.min(p,p,H),X.vec3.max(x,x,H),new Mt(p,x)}if(n._tileCoverLift>0){for(const $ of m)X.vec3.min(p,p,$),X.vec3.max(x,x,$);return new Mt(p,x)}const y=[a[12]*l,a[13]*l,a[14]*l],w=h.getCenter(),v=Qt(n.center.lat,-tr,tr),b=Qt(w.lat,-tr,tr),S=es(n.center.lng),A=sn(v);let C=S-es(w.lng);const D=A-sn(b);C>.5?C-=1:C<-.5&&(C+=1);let L=0;if(Math.abs(C)>Math.abs(D))L=C>=0?1:3;else{L=D>=0?0:2;const $=[a[4]*l,a[5]*l,a[6]*l],H=-Math.sin(hi(D>=0?h.getSouth():h.getNorth()))*jr;X.vec3.scaleAndAdd(y,y,$,H)}const z=m[L],k=m[(L+1)%4],B=new Yi(z,k,y),V=[nr(B,0)||z[0],nr(B,1)||z[1],nr(B,2)||z[2]],W=Kr(n.zoom);if(W>0){const $=function({x:ae,y:Y,z:le},_e,pe,xe,ye){const Me=1/(1<<le);let Te=ae*Me,Ae=Te+Me,et=Y*Me,Je=et+Me,xt=0;const st=(Te+Ae)/2-xe;return st>.5?xt=-1:st<-.5&&(xt=1),Te=((Te+xt)*_e-(xe*=_e))*pe+xe,Ae=((Ae+xt)*_e-xe)*pe+
20xe,et=(et*_e-(ye*=_e))*pe+ye,Je=(Je*_e-ye)*pe+ye,[[Te,Je,0],[Ae,Je,0],[Ae,et,0],[Te,et,0]]}(i,e,n._pixelsPerMercatorPixel,S,A);for(let ae=0;ae<m.length;ae++)hr(m[ae],$[ae],W);const H=X.vec3.add([],$[L],$[(L+1)%4]);X.vec3.scale(H,H,.5),hr(V,H,W)}for(const $ of m)X.vec3.min(p,p,$),X.vec3.max(x,x,$);return p[2]=Math.min(z[2],k[2]),X.vec3.min(p,p,V),X.vec3.max(x,x,V),new Mt(p,x)}function di({x:n,y:e,z:i},s=!1){const l=1/(1<<i),a=new vi(on(n*l),e===(1<<i)-1&&s?-90:Sr((e+1)*l)),h=new vi(on((n+1)*l),e===0&&s?90:Sr(e*l));return new Xs(a,h)}function qi(n,e=jr){const i=hi(n.getNorth()),s=hi(n.getSouth()),l=Math.cos(i),a=Math.cos(s),h=Math.sin(i),m=Math.sin(s),g=n.getWest(),x=n.getEast();return[fa(a,m,g,e),fa(a,m,x,e),fa(l,h,x,e),fa(l,h,g,e)]}function bi(n,e,i,s){const l=1<<i.z,a=(n/ht+i.x)/l;return wo(Sr((e/ht+i.y)/l),on(a),s)}function Pi({min:n,max:e}){return Vd/Math.max(e[0]-n[0],e[1]-n[1],e[2]-n[2])}const Er=new Float64Array(16);function Fi(n){const e=Pi(n),i=X.mat4.fromScaling(Er,[e,e,e]);return X.mat4.translate(i,i,X.vec3.negate([],n.min))}function ur(n){const e=X.mat4.fromTranslation(Er,n.min),i=1/Pi(n);return X.mat4.scale(e,e,[i,i,i])}function ts(n){const e=ht/(2*Math.PI);return n/(2*Math.PI)/e}function an(n,e){return ht/(512*Math.pow(2,n))*Pi(cr(e))}function Pn(n,e,i,s,l){const a=ts(i),h=[n,e,-i/(2*Math.PI)],m=X.mat4.identity(new Float64Array(16));return X.mat4.translate(m,m,h),X.mat4.scale(m,m,[a,a,a]),X.mat4.rotateX(m,m,hi(-l)),X.mat4.rotateY(m,m,hi(-s)),m}function Kr(n){return Zr(da,Nd,n)}function Rn(n,e){const i=wo(e.lat,e.lng),s=function(a){const h=wo(a._center.lat,a._center.lng),m=X.vec3.fromValues(0,1,0);let g=X.vec3.cross([],m,h);const x=X.mat4.fromRotation([],-a.angle,h);g=X.vec3.transformMat4(g,g,x),X.mat4.fromRotation(x,-a._pitch,g);const p=X.vec3.normalize([],h);return X.vec3.scale(p,p,ci(a.cameraToCenterDistance/a.pixelsPerMeter)),X.vec3.transformMat4(p,p,x),X.vec3.add([],h,p)}(n),l=X.vec3.subtract([],s,i);return X.vec3.angle(l,i)}function ln(n,e){return Rn(n,e)>Math.PI/2*1.01}const ws=hi(85),is=Math.cos(ws),Ts=Math.sin(ws),ah=X.mat4.create(),ma=n=>{const e=[];return n.paint.get("circle-pitch-alignment")==="map"&&e.push("PITCH_WITH_MAP"),n.paint.get("circle-pitch-scale")==="map"&&e.push("SCALE_WITH_MAP"),e};function Ec(n,e,i,s,l,a,h,m,g){if(a&&n.queryGeometry.isAboveHorizon)return!1;a&&(g*=n.pixelToTileUnitsFactor);const x=n.tileID.canonical,p=i.projection.upVectorScale(x,i.center.lat,i.worldSize).metersToTile;for(const y of e)for(const w of y){const v=w.add(m),b=l&&i.elevation?i.elevation.exaggeration()*l.getElevationAt(v.x,v.y,!0):0,S=i.projection.projectTilePoint(v.x,v.y,x);if(b>0){const L=i.projection.upVector(x,v.x,v.y);S.x+=L[0]*p*b,S.y+=L[1]*p*b,S.z+=L[2]*p*b}const A=a?v:lh(S.x,S.y,S.z,s),C=a?n.tilespaceRays.map(L=>M0(L,b)):n.queryGeometry.screenGeometry,D=X.vec4.transformMat4([],[S.x,S.y,S.z,1],s);if(!h&&a?g*=D[3]/i.cameraToCenterDistance:h&&!a&&(g*=i.cameraToCenterDistance/D[3]),a){const L=Sr((w.y/ht+x.y)/(1<<x.z));g/=i.projection.pixelsPerMeter(L,1)/Cr(1,L)}if(F(C,A,g))return!0}return!1}function lh(n,e,i,s){const l=X.vec4.transformMat4([],[n,e,i,1],s);return new dt(l[0]/l[3],l[1]/l[3])}const k_=X.vec3.fromValues(0,0,0),E0=X.vec3.fromValues(0,0,1);function M0(n,e){const i=X.vec3.create();return k_[2]=e,n.intersectsPlane(k_,E0,i),new dt(i[0],i[1])}class F_ extends O{}let B_,N_,V_,U_;function j_(n,{width:e,height:i},s,l){if(l){if(l instanceof Uint8ClampedArray)l=new Uint8Array(l.buffer);else if(l.length!==e*i*s)throw new RangeError("mismatched image size")}else l=new Uint8Array(e*i*s);return n.width=e,n.height=i,n.data=l,n}function q_(n,e,i){const{width:s,height:l}=e;s===n.width&&l===n.height||(Cf(n,e,{x:0,y:0},{x:0,y:0},{width:Math.min(n.width,s),height:Math.min(n.height,l)},i,null),n.width=s,n.height=l,n.data=e.data)}function Cf(n,e,i,s,l,a,h,m){if(l.width===0||l.height===0)return e;if(l.width>n.width||l.height>n.height||i.x>n.width-l.width||i.y>n.height-l.height)throw new RangeError("out of range source coordinates for image copy");if(l.width>e.width||l.height>e.height||s.x>e.width-l.width||s.y>e.height-l.height)throw new RangeError("out of range destination coordinates for image copy");const g=n.data,x=e.data,p=a===4&&m;for(let y=0;y<l.height;y++){const w=((i.y+y)*n.width+i.x)*a,v=((s.y+y)*e.width+s.x)*a;if(p)for(let b=0;b<l.width;b++){const S=w+b*a+3,A=v+b*a;x[A+0]=255,x[A+1]=255,x[A+2]=255,x[A+3]=g[S]}else if(h)for(let b=0;b<l.width;b++){const S=w+b*a,A=v+b*a,C=g[S+3],D=new Mi(g[S+0]/255*C,g[S+1]/255*C,g[S+2]/255*C,C).toRenderColor(h).toArray();x[A+0]=D[0],x[A+1]=D[1],x[A+2]=D[2],x[A+3]=D[3]}else for(let b=0;b<l.width*a;b++)x[v+b]=g[w+b]}return e}vt(F_,"HeatmapBucket",{omit:["layers"]});class _a{constructor(e,i){j_(this,e,1,i)}resize(e){q_(this,new _a(e),1)}clone(){return new _a({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,s,l,a){Cf(e,i,s,l,a,1,null)}}class Pr{constructor(e,i){j_(this,e,4,i)}resize(e){q_(this,new Pr(e),4)}replace(e,i){i?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Pr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,s,l,a,h,m){Cf(e,i,s,l,a,4,h,m)}}class G_{constructor(e,i){this.width=e.width,this.height=e.height,this.data=i instanceof Uint8Array?new Float32Array(i.buffer):i}}function ch(n){const e={},i=n.resolution||256,s=n.clips?n.clips.length:1,l=n.image||new Pr({width:i,height:s}),a=(h,m,g)=>{e[n.evaluationKey]=g;const x=n.expression.evaluate(e);x&&(l.data[h+m+0]=Math.floor(255*x.r/x.a),l.data[h+m+1]=Math.floor(255*x.g/x.a),l.data[h+m+2]=Math.floor(255*x.b/x.a),l.data[h+m+3]=Math.floor(255*x.a))};if(n.clips)for(let h=0,m=0;h<s;++h,m+=4*i)for(let g=0,x=0;g<i;g++,x+=4){const p=g/(i-1),{start:y,end:w}=n.clips[h];a(m,x,y*(1-p)+w*p)}else for(let h=0,m=0;h<i;h++,m+=4)a(0,m,h/(i-1));return l}vt(_a,"AlphaImage"),vt(Pr,"RGBAImage");const I0=yi([{name:"a_pos",components:2,type:"Int16"}],4),A0=yi([{name:"a_road_z_offset",components:1,type:"Float32"}],4),C0=yi([{name:"a_pos",components:2,type:"Int16"},{name:"a_height",components:1,type:"Float32"}],4),P0=yi([{name:"a_pos_normal_3",components:3,type:"Int16"}],4);function uh(n,e,i=2){const s=e&&e.length,l=s?e[0]*i:n.length;let a=$_(n,0,l,i,!0);const h=[];if(!a||a.next===a.prev)return h;let m,g,x;if(s&&(a=function(p,y,w,v){const b=[];for(let S=0,A=y.length;S<A;S++){const C=$_(p,y[S]*v,S<A-1?y[S+1]*v:p.length,v,!1);C===C.next&&(C.steiner=!0),b.push(B0(C))}b.sort(O0);for(let S=0;S<b.length;S++)w=k0(b[S],w);return w}(n,e,a,i)),n.length>80*i){m=1/0,g=1/0;let p=-1/0,y=-1/0;for(let w=i;w<l;w+=i){const v=n[w],b=n[w+1];v<m&&(m=v),b<g&&(g=b),v>p&&(p=v),b>y&&(y=b)}x=Math.max(p-m,y-g),x=x!==0?32767/x:0}return hh(a,h,i,m,g,x,0),h}function $_(n,e,i,s,l){let a;if(l===function(h,m,g,x){let p=0;for(let y=m,w=g-x;y<g;y+=x)p+=(h[w]-h[y])*(h[y+1]+h[w+1]),w=y;return p}(n,e,i,s)>0)for(let h=e;h<i;h+=s)a=W_(h/s|0,n[h],n[h+1],a);else for(let h=i-s;h>=e;h-=s)a=W_(h/s|0,n[h],n[h+1],a);return a&&jd(a,a.next)&&(ph(a),a=a.next),a}function fl(n,e){if(!n)return n;e||(e=n);let i,s=n;do if(i=!1,s.steiner||!jd(s,s.next)&&dr(s.prev,s,s.next)!==0)s=s.next;else{if(ph(s),s=e=s.prev,s===s.next)break;
vendor: 4,430 bytes, line 20
20i=!0}while(i||s!==e);return e}function hh(n,e,i,s,l,a,h){if(!n)return;!h&&a&&function(g,x,p,y){let w=g;do w.z===0&&(w.z=Pf(w.x,w.y,x,p,y)),w.prevZ=w.prev,w.nextZ=w.next,w=w.next;while(w!==g);w.prevZ.nextZ=null,w.prevZ=null,function(v){let b,S=1;do{let A,C=v;v=null;let D=null;for(b=0;C;){b++;let L=C,z=0;for(let B=0;B<S&&(z++,L=L.nextZ,L);B++);let k=S;for(;z>0||k>0&&L;)z!==0&&(k===0||!L||C.z<=L.z)?(A=C,C=C.nextZ,z--):(A=L,L=L.nextZ,k--),D?D.nextZ=A:v=A,A.prevZ=D,D=A;C=L}D.nextZ=null,S*=2}while(b>1)}(w)}(n,s,l,a);let m=n;for(;n.prev!==n.next;){const g=n.prev,x=n.next;if(a?z0(n,s,l,a):R0(n))e.push(g.i,n.i,x.i),ph(n),n=x.next,m=x.next;else if((n=x)===m){h?h===1?hh(n=L0(fl(n),e),e,i,s,l,a,2):h===2&&D0(n,e,i,s,l,a):hh(fl(n),e,i,s,l,a,1);break}}}function R0(n){const e=n.prev,i=n,s=n.next;if(dr(e,i,s)>=0)return!1;const l=e.x,a=i.x,h=s.x,m=e.y,g=i.y,x=s.y,p=l<a?l<h?l:h:a<h?a:h,y=m<g?m<x?m:x:g<x?g:x,w=l>a?l>h?l:h:a>h?a:h,v=m>g?m>x?m:x:g>x?g:x;let b=s.next;for(;b!==e;){if(b.x>=p&&b.x<=w&&b.y>=y&&b.y<=v&&Mc(l,m,a,g,h,x,b.x,b.y)&&dr(b.prev,b,b.next)>=0)return!1;b=b.next}return!0}function z0(n,e,i,s){const l=n.prev,a=n,h=n.next;if(dr(l,a,h)>=0)return!1;const m=l.x,g=a.x,x=h.x,p=l.y,y=a.y,w=h.y,v=m<g?m<x?m:x:g<x?g:x,b=p<y?p<w?p:w:y<w?y:w,S=m>g?m>x?m:x:g>x?g:x,A=p>y?p>w?p:w:y>w?y:w,C=Pf(v,b,e,i,s),D=Pf(S,A,e,i,s);let L=n.prevZ,z=n.nextZ;for(;L&&L.z>=C&&z&&z.z<=D;){if(L.x>=v&&L.x<=S&&L.y>=b&&L.y<=A&&L!==l&&L!==h&&Mc(m,p,g,y,x,w,L.x,L.y)&&dr(L.prev,L,L.next)>=0||(L=L.prevZ,z.x>=v&&z.x<=S&&z.y>=b&&z.y<=A&&z!==l&&z!==h&&Mc(m,p,g,y,x,w,z.x,z.y)&&dr(z.prev,z,z.next)>=0))return!1;z=z.nextZ}for(;L&&L.z>=C;){if(L.x>=v&&L.x<=S&&L.y>=b&&L.y<=A&&L!==l&&L!==h&&Mc(m,p,g,y,x,w,L.x,L.y)&&dr(L.prev,L,L.next)>=0)return!1;L=L.prevZ}for(;z&&z.z<=D;){if(z.x>=v&&z.x<=S&&z.y>=b&&z.y<=A&&z!==l&&z!==h&&Mc(m,p,g,y,x,w,z.x,z.y)&&dr(z.prev,z,z.next)>=0)return!1;z=z.nextZ}return!0}function L0(n,e){let i=n;do{const s=i.prev,l=i.next.next;!jd(s,l)&&H_(s,i,i.next,l)&&dh(s,l)&&dh(l,s)&&(e.push(s.i,i.i,l.i),ph(i),ph(i.next),i=n=l),i=i.next}while(i!==n);return fl(i)}function D0(n,e,i,s,l,a){let h=n;do{let m=h.next.next;for(;m!==h.prev;){if(h.i!==m.i&&N0(h,m)){let g=Z_(h,m);return h=fl(h,h.next),g=fl(g,g.next),hh(h,e,i,s,l,a,0),void hh(g,e,i,s,l,a,0)}m=m.next}h=h.next}while(h!==n)}function O0(n,e){return n.x-e.x}function k0(n,e){const i=function(l,a){let h=a;const m=l.x,g=l.y;let x,p=-1/0;do{if(g<=h.y&&g>=h.next.y&&h.next.y!==h.y){const S=h.x+(g-h.y)*(h.next.x-h.x)/(h.next.y-h.y);if(S<=m&&S>p&&(p=S,x=h.x<h.next.x?h:h.next,S===m))return x}h=h.next}while(h!==a);if(!x)return null;const y=x,w=x.x,v=x.y;let b=1/0;h=x;do{if(m>=h.x&&h.x>=w&&m!==h.x&&Mc(g<v?m:p,g,w,v,g<v?p:m,g,h.x,h.y)){const S=Math.abs(g-h.y)/(m-h.x);dh(h,l)&&(S<b||S===b&&(h.x>x.x||h.x===x.x&&F0(x,h)))&&(x=h,b=S)}h=h.next}while(h!==y);return x}(n,e);if(!i)return e;const s=Z_(i,n);return fl(s,s.next),fl(i,i.next)}function F0(n,e){return dr(n.prev,n,e.prev)<0&&dr(e.next,n,n.next)<0}function Pf(n,e,i,s,l){return(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-i)*l|0)|n<<8))|n<<4))|n<<2))|n<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-s)*l|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function B0(n){let e=n,i=n;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==n);return i}function Mc(n,e,i,s,l,a,h,m){return(l-h)*(e-m)>=(n-h)*(a-m)&&(n-h)*(s-m)>=(i-h)*(e-m)&&(i-h)*(a-m)>=(l-h)*(s-m)}function N0(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!function(i,s){let l=i;do{if(l.i!==i.i&&l.next.i!==i.i&&l.i!==s.i&&l.next.i!==s.i&&H_(l,l.next,i,s))return!0;l=l.next}while(l!==i);return!1}(n,e)&&(dh(n,e)&&dh(e,n)&&function(i,s){let l=i,a=!1;const h=(i.x+s.x)/2,m=(i.y+s.y)/2;do l.y>m!=l.next.y>m&&l.next.y!==l.y&&h<(l.next.x-l.x)*(m-l.y)/(l.next.y-l.y)+l.x&&(a=!a),l=l.next;while(l!==i);return a}(n,e)&&(dr(n.prev,n,e.prev)||dr(n,e.prev,e))||jd(n,e)&&dr(n.prev,n,n.next)>0&&dr(e.prev,e,e.next)>0)}function dr(n,e,i){return(e.y-n.y)*(i.x-e.x)-(e.x-n.x)*(i.y-e.y)}function jd(n,e){return n.x===e.x&&n.y===e.y}function H_(n,e,i,s){const l=Gd(dr(n,e,i)),a=Gd(dr(n,e,s)),h=Gd(dr(i,s,n)),m=Gd(dr(i,s,e));return l!==a&&h!==m||!(l!==0||!qd(n,i,e))||!(a!==0||!qd(n,s,e))||!(h!==0||!qd(i,n,s))||!(m!==0||!qd(i,e,s))}function qd(n,e,i){return e.x<=Math.max(n.x,i.x)&&e.x>=Math.min(n.x,i.x)&&e.y<=Math.max(n.y,i.y)&&e.y>=Math.min(n.y,i.y)}function Gd(n){return n>0?1:n<0?-1:0}function dh(n,e){return dr(n.prev,n,n.next)<0?dr(n,e,n.next)>=0&&dr(n,n.prev,e)>
20=0:dr(n,e,n.prev)<0||dr(n,n.next,e)<0}function Z_(n,e){const i=Rf(n.i,n.x,n.y),s=Rf(e.i,e.x,e.y),l=n.next,a=e.prev;return n.next=e,e.prev=n,i.next=l,l.prev=i,s.next=i,i.prev=s,a.next=s,s.prev=a,s}function W_(n,e,i,s){const l=Rf(n,e,i);return s?(l.next=s.next,l.prev=s,s.next.prev=l,s.next=l):(l.prev=l,l.next=l),l}function ph(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function Rf(n,e,i){return{i:n,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function $d(n,e){const i=n.length;if(i<=1)return[n];const s=[];let l,a;for(let h=0;h<i;h++){const m=Pa(n[h]);m!==0&&(n[h].area=Math.abs(m),a===void 0&&(a=m<0),a===m<0?(l&&s.push(l),l=[n[h]]):l.push(n[h]))}if(l&&s.push(l),e>1)for(let h=0;h<s.length;h++)s[h].length<=e||(Yh(s[h],e,1,s[h].length-1,V0),s[h]=s[h].slice(0,e));return s}function V0(n,e){return e.area-n.area}function X_(n,e,i=1){if(!n)return null;const s=typeof n=="string"?Or.from(n).getPrimary():n.getPrimary(),l=s.id.toString();return e.has(l)||e.set(l,[]),s.scaleSelf(i),e.get(l).push(s),s.toString()}function zf(n,e,i,s){const l=s.patternDependencies;let a=!1;for(const h of e){const m=h.paint.get(`${n}-pattern`);m.isConstant()||(a=!0),X_(m.constantOr(null),l,i)&&(a=!0)}return a}function Lf(n,e,i,s,l,a){const h=a.patternDependencies;for(const m of e){const g=m.paint.get(`${n}-pattern`).value;if(g.kind!=="constant"){let x=g.evaluate({zoom:s},i,{},a.availableImages);x=x&&x.name?x.name:x;const p=X_(x,h,l);p&&(i.patterns[m.id]=p)}}return i}var Df,Y_,Of,K_,kf,J_,Q_,Hd={};function eg(){if(Y_)return Df;Y_=1;var n=Ds();function e(l,a,h,m,g){this.properties={},this.extent=h,this.type=0,this._pbf=l,this._geometry=-1,this._keys=m,this._values=g,l.readFields(i,this,a)}function i(l,a,h){l==1?a.id=h.readVarint():l==2?function(m,g){for(var x=m.readVarint()+m.pos;m.pos<x;){var p=g._keys[m.readVarint()],y=g._values[m.readVarint()];g.properties[p]=y}}(h,a):l==3?a.type=h.readVarint():l==4&&(a._geometry=h.pos)}function s(l){for(var a,h,m=0,g=0,x=l.length,p=x-1;g<x;p=g++)m+=((h=l[p]).x-(a=l[g]).x)*(a.y+h.y);return m}return Df=e,e.types=["Unknown","Point","LineString","Polygon"],e.prototype.loadGeometry=function(){var l=this._pbf;l.pos=this._geometry;for(var a,h=l.readVarint()+l.pos,m=1,g=0,x=0,p=0,y=[];l.pos<h;){if(g<=0){var w=l.readVarint();m=7&w,g=w>>3}if(g--,m===1||m===2)x+=l.readSVarint(),p+=l.readSVarint(),m===1&&(a&&y.push(a),a=[]),a.push(new n(x,p));else{if(m!==7)throw new Error("unknown command "+m);a&&a.push(a[0].clone())}}return a&&y.push(a),y},e.prototype.bbox=function(){var l=this._pbf;l.pos=this._geometry;for(var a=l.readVarint()+l.pos,h=1,m=0,g=0,x=0,p=1/0,y=-1/0,w=1/0,v=-1/0;l.pos<a;){if(m<=0){var b=l.readVarint();h=7&b,m=b>>3}if(m--,h===1||h===2)(g+=l.readSVarint())<p&&(p=g),g>y&&(y=g),(x+=l.readSVarint())<w&&(w=x),x>v&&(v=x);else if(h!==7)throw new Error("unknown command "+h)}return[p,w,y,v]},e.prototype.toGeoJSON=function(l,a,h){var m,g,x=this.extent*Math.pow(2,h),p=this.extent*l,y=this.extent*a,w=this.loadGeometry(),v=e.types[this.type];function b(C){for(var D=0;D<C.length;D++){var L=C[D];C[D]=[360*(L.x+p)/x-180,360/Math.PI*Math.atan(Math.exp((180-360*(L.y+y)/x)*Math.PI/180))-90]}}switch(this.type){case 1:var S=[];for(m=0;m<w.length;m++)S[m]=w[m][0];b(w=S);break;case 2:for(m=0;m<w.length;m++)b(w[m]);break;case 3:for(w=function(C){var D=C.length;if(D<=1)return[C];for(var L,z,k=[],B=0;B<D;B++){var V=s(C[B]);V!==0&&(z===void 0&&(z=V<0),z===V<0?(L&&k.push(L),L=[C[B]]):L.push(C[B]))}return L&&k.push(L),k}(w),m=0;m<w.length;m++)for(g=0;g<w[m].length;g++)b(w[m][g])}w.length===1?w=w[0]:v="Multi"+v;var A={type:"Feature",geometry:{type:v,coordinates:w},properties:this.properties};return"id"in this&&(A.id=this.id),A},Df}function tg(){if(K_)return Of;K_=1;var n=eg();function e(s,l){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=s,this._keys=[],this._values=[],this._features=[],s.readFields(i,this,l),this.length=this._features.length}function i(s,l,a){s===15?l.version=a.readVarint():s===1?l.name=a.readString():s===5?l.extent=a.readVarint():s===2?l._features.push(a.pos):s===3?l._keys.push(a.readString()):s===4&&l._values.push(function(h){for(var m=null,g=h.readVarint()+h.pos;h.pos<g;){var x=h.readVarint()>>3;m=x===1?h.readString():x===2?h.readFloat():x===3?h.readDouble():x===4?h.readVarint64():x===5?h.readVarint():x===6?h.readSVarint():x===7?h.readBoolean():null}return m}(a))}return Of=e,e.prototype.feature=function(s){if(s<0||s>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[s];var l=this._pbf.readVarint()+this._pbf.pos;return new n(this._pbf,l,this.extent,this._keys,this._values)},Of}function ig(){return Q_||(Q_=1,Hd.VectorTile=function(){if(J_)return kf;J_=1;var n=tg();function e(i,s,l){if(i===3){var a=new n(l,l.readVarint()+l.pos);a.length&&(s[a.name]=a)}}return kf=function(i,s){this.layers=i.readFields(e,{},s)},kf}(),Hd.VectorTileFeature=eg(),Hd.VectorTileLayer=tg()),Hd}var ga=ig();const ml="3d_elevation_id",rg="level";
20class U0{constructor(){this._valid=!1}reset(e){return this.feature=e,this._valid=!0,this._geometry=e.loadGeometry(),this._geometry.length!==0&&this._geometry[0].length!==0||(this._valid=!1),this}geometry(e,i){return this._valid&&e(i(this._geometry)),this}require(e,i,s){return this.get(e,!0,i,s)}optional(e,i,s){return this.get(e,!1,i,s)}success(){return this._valid}get(e,i,s,l){const a=this.feature.properties.hasOwnProperty(e)?+this.feature.properties[e]:void 0;return this._valid&&a!==void 0?s(l?l(a):a):i&&(this._valid=!1),this}}class ng{constructor(e,i){this.featureFunc=e,this.vertexFunc=i}parseFeature(e,i,s){return this.featureFunc(e,i,s)}parseVertex(e,i,s){return this.vertexFunc(e,i,s)}}const j0=new ng((n,e,i)=>n.reset(e).require(ml,s=>{i.id=s}).optional("fixed_height_relative",s=>{i.constantHeight=s},So.decodeRelativeHeight).geometry(s=>{i.bounds=s},So.computeBounds).success(),(n,e,i)=>n.reset(e).require(ml,s=>{i.id=s}).require("elevation_idx",s=>{i.idx=s}).require("extent",s=>{i.extent=s}).require("height_relative",s=>{i.height=s},So.decodeRelativeHeight).geometry(s=>{i.position=s},So.getPoint).success()),q0=new ng((n,e,i)=>n.reset(e).require(ml,s=>{i.id=s}).optional("fixed_height",s=>{i.constantHeight=s},So.decodeMetricHeight).geometry(s=>{i.bounds=s},So.computeBounds).success(),(n,e,i)=>n.reset(e).require(ml,s=>{i.id=s}).require("elevation_idx",s=>{i.idx=s}).require("extent",s=>{i.extent=s}).require("height",s=>{i.height=s},So.decodeMetricHeight).geometry(s=>{i.position=s},So.getPoint).success());class So{static computeBounds(e){const i=new dt(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),s=new dt(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const l of e[0])i.x>l.x&&(i.x=l.x),i.y>l.y&&(i.y=l.y),s.x<l.x&&(s.x=l.x),s.y<l.y&&(s.y=l.y);return{min:i,max:s}}static getPoint(e){return X.vec2.fromValues(e[0][0].x,e[0][0].y)}static decodeRelativeHeight(e){return 1e-4*e*5}static decodeMetricHeight(e){return 1e-4*e}static parse(e){const i=[],s=[],l=e.length,a=new U0;for(let m=0;m<l;m++){const g=e.feature(m),x=g.properties.hasOwnProperty("version")?String(g.properties.version):void 0,p=(h=x)?h==="1.0.1"?q0:void 0:j0;if(p===void 0){Hi(`Unknown elevation feature version number ${x||"(unknown)"}`);continue}const y=g.properties.hasOwnProperty("type")?g.properties.type:void 0;if(y){if(ga.VectorTileFeature.types[g.type]==="Point"&&y==="curve_point"){const w={};p.parseVertex(a,g,w)&&i.push(w)}else if(ga.VectorTileFeature.types[g.type]==="Polygon"&&y==="curve_meta"){const w={};p.parseFeature(a,g,w)&&s.push(w)}}}var h;return{vertices:i,features:s}}}class Ff{constructor(e,i,s,l,a,h){if(this.vertices=new Array,this.vertexProps=new Array,this.edges=new Array,this.edgeProps=new Array,this.id=e,this.heightRange={min:s,max:s},this.safeArea=i,this.constantHeight=s,this.constantHeight==null&&(this.constantHeight!=null||l.length!==0)){this.vertices=l,this.edges=a,this.edges=this.edges.filter(m=>m.a<this.vertices.length&&m.b<this.vertices.length&&!X.vec2.exactEquals(this.vertices[m.a].position,this.vertices[m.b].position)),this.heightRange={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};for(const m of this.vertices)this.vertexProps.push({dir:X.vec2.fromValues(0,0)}),this.heightRange.min=Math.min(this.heightRange.min,m.height),this.heightRange.max=Math.max(this.heightRange.max,m.height);for(const m of this.edges){const g=this.vertices[m.a].position,x=this.vertices[m.b].position,p=X.vec2.subtract(X.vec2.create(),x,g),y=X.vec2.length(p),w=X.vec2.scale(X.vec2.create(),p,1/y);this.edgeProps.push({vec:p,dir:w,len:y});const v=this.vertexProps[m.a].dir,b=this.vertexProps[m.b].dir;X.vec2.add(v,v,w),X.vec2.add(b,b,w)}for(const m of this.vertexProps)m.dir[0]===0&&m.dir[1]===0||X.vec2.normalize(m.dir,m.dir);this.tessellate(h)}}pointElevation(e){if(this.constantHeight!=null)return this.constantHeight;const i=this.getClosestEdge(e);if(i==null)return 0;const[s,l]=i;return((a,h,m)=>(1-m)*a+m*h)(this.vertices[this.edges[s].a].height,this.vertices[this.edges[s].b].height,l)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(e){if(this.edges.length===0)return;let i=0,s=Number.POSITIVE_INFINITY,l=0;const a=X.vec2.fromValues(e.x,e.y);for(let h=0;h<this.edges.length;h++){const m=this.edges[h],g=this.edgeProps[h].dir,x=new Vt(a,this.edgeProps[h].dir),p=this.vertices[m.a].position,y=this.vertices[m.b].position,w=X.vec2.create(),v=X.vec2.create(),b=x.intersectsPlane(p,this.vertexProps[m.a].dir,w),S=x.intersectsPlane(y,this.vertexProps[m.b].dir,v);if(!b||!S)continue;
20const A=X.vec2.subtract(X.vec2.create(),v,w),C=X.vec2.subtract(X.vec2.create(),a,w),D=X.vec2.dot(A,A),L=D>0?X.vec2.dot(C,A)/D:0,z=Qt(L,0,1),k=Math.abs((L-z)*this.edgeProps[h].len),B=X.vec2.subtract(X.vec2.create(),a,p),V=k+Math.abs(X.vec2.dot(B,X.vec2.fromValues(g[1],-g[0])));V<s&&(i=h,s=V,l=z)}return[i,l]}tessellate(e){for(let i=this.edges.length-1;i>=0;--i){const s=this.edges[i].a,l=this.edges[i].b,{position:a,height:h,extent:m}=this.vertices[s],{position:g,height:x,extent:p}=this.vertices[l],y=this.vertexProps[s].dir,w=this.vertexProps[l].dir,v=X.vec3.fromValues(a[0]/e,a[1]/e,h),b=X.vec3.fromValues(g[0]/e,g[1]/e,x),S=X.vec3.fromValues(y[1],-y[0],0);X.vec3.scale(S,S,m);const A=X.vec3.fromValues(w[1],-w[0],0);if(X.vec3.scale(A,A,p),this.distSqLines(X.vec3.fromValues(v[0]+.5*S[0],v[1]+.5*S[1],v[2]+.5*S[2]),X.vec3.fromValues(b[0]-.5*A[0],b[1]-.5*A[1],b[2]-.5*A[2]),X.vec3.fromValues(v[0]-.5*S[0],v[1]-.5*S[1],v[2]-.5*S[2]),X.vec3.fromValues(b[0]+.5*A[0],b[1]+.5*A[1],b[2]+.5*A[2]))<=.05*.05)continue;const C=this.vertices.length,D=X.vec2.add(X.vec2.create(),a,g);this.vertices.push({position:X.vec2.scale(D,D,.5),height:.5*(h+x),extent:.5*(m+p)});const L=X.vec2.add(X.vec2.create(),y,w);this.vertexProps.push({dir:X.vec2.normalize(L,L)}),this.edges.splice(i,1),this.edgeProps.splice(i,1),this.edges.push({a:s,b:C}),this.edges.push({a:C,b:l});const z=X.vec2.subtract(X.vec2.create(),this.vertices[C].position,a),k=X.vec2.length(z),B={vec:z,dir:X.vec2.scale(X.vec2.create(),z,1/k),len:k};this.edgeProps.push(B),this.edgeProps.push(B)}}distSqLines(e,i,s,l){const a=X.vec3.subtract(X.vec3.create(),i,e),h=X.vec3.subtract(X.vec3.create(),l,s),m=X.vec3.subtract(X.vec3.create(),e,s),g=X.vec3.dot(a,a),x=X.vec3.dot(a,h),p=X.vec3.dot(a,m),y=X.vec3.dot(h,h),w=X.vec3.dot(h,m),v=g*y-x*x;if(v===0){const D=X.vec3.dot(m,h)/X.vec3.dot(h,h),L=X.vec3.lerp(X.vec3.create(),s,l,D);return X.vec3.squaredDistance(L,e)}const b=(x*w-p*y)/v,S=(g*w-x*p)/v,A=X.vec3.lerp(X.vec3.create(),e,i,b),C=X.vec3.lerp(X.vec3.create(),s,l,S);return X.vec3.squaredDistance(A,C)}}class G0{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)*ht,this.yOffset=(e.y*this.zScale-i.y)*ht)}constantElevation(e,i){if(e.constantHeight!=null)return this.computeBiasedHeight(e.constantHeight,i)}pointElevation(e,i,s){const l=this.constantElevation(i,s);return l??(e.x=e.x*this.zScale+this.xOffset,e.y=e.y*this.zScale+this.yOffset,this.computeBiasedHeight(i.pointElevation(e),s))}computeBiasedHeight(e,i){return i<=0?e:e+i*Zr(0,i,e>=0?e:Math.abs(.5*e))}}vt(Ff,"ElevationFeature");class sg{constructor(){this.polygons=new Map}add(e,...i){this.polygons.has(e)?this.polygons.get(e).push(...i):this.polygons.set(e,i)}merge(e){for(const[i,s]of e.polygons)this.add(i,...s)}}class _l{constructor(){this.portals=[]}static evaluate(e){if(e.length===0)return new _l;let i=[];for(const x of e)i.push(...x.portals);if(i.length===0)return new _l;const s=(x,p)=>x<=0&&p<=0||x>=ht&&p>=ht;for(const x of i){const p=x.va,y=x.vb;(s(p.x,y.x)||s(p.y,y.y))&&(x.type="border")}const l=i.filter(x=>x.type!=="unevaluated"),a=i.filter(x=>x.type==="unevaluated");if(a.length===0)return new _l;a.sort((x,p)=>x.hash===p.hash?x.isTunnel===p.isTunnel?0:x.isTunnel?-1:1:x.hash<p.hash?1:-1),i=l.concat(a);let h=l.length,m=h,g=h;do if(m++,m===i.length||i[h].hash!==i[m].hash){if(m-h==2){g<h&&(i[g]=i[h],i[h]=null);const x=i[g],p=i[m-1];x.type=x.isTunnel!==p.isTunnel?"tunnel":"polygon",x.connection={a:x.connection.a,b:p.connection.a},g++}h=m}while(h!==i.length);return i.splice(g),i.sort((x,p)=>x.hash<p.hash?1:-1),{portals:i}}}vt(_l,"ElevationPortalGraph"),vt(sg,"ElevationPolygons");class $0{constructor(e,i,s){this.outPositions=e,this.outNormals=i,this.outIndices=s,this.vertexLookup=new Map,this.buffer=new ArrayBuffer(4),this.view=new DataView(this.buffer)}addVertex(e,i,s){let l=e[2];s!=null&&(l*=s);const a=this.getVec3Bits(e)<<96n|this.getVec3Bits(i),h=this.vertexLookup.get(a);if(h!=null)return h;const m=this.outPositions.length;this.vertexLookup.set(a,m);const g=Math.trunc(16384*i[0]),x=Math.trunc(16384*i[1]),p=Math.trunc(16384*i[2]);return this.outPositions.emplaceBack(e[0],e[1],l),this.outNormals.emplaceBack(g,x,p),m}addVertices(e,i,...s){const l=[];for(const a of s){const h=this.addVertex(a,e,i);l.push(h)}return l}addTriangles(e,i,s){if(i&&s){const l=s.length===1,a=X.vec3.fromValues(0,0,0);for(let h=0;h<e.length;h+=3){const m=i[e[h+0]],g=i[e[h+1]],x=i[e[h+2]],p=l?s[0]:s[e[h+1]],y=l?s[0]:s[e[h+2]],w=this.addVertex(X.vec3.fromValues(m.x,m.y,l?s[0]:s[e[h+0]]),a),v=this.addVertex(X.vec3.fromValues(g.x,g.y,p),a),b=this.addVertex(X.vec3.fromValues(x.x,x.y,y),a);this.outIndices.emplaceBack(w,v,b)}}else for(let l=0;l<e.length;l+=3)this.outIndices.emplaceBack(e[l+0],e[l+1],e[l+2])}addQuad(e,i){const s=this.addVertices(i,void 0,...e.map(g=>X.vec3.fromValues(g.coord.x,g.coord.y,g.height))),[l,a,h,m]=s;this.addTriangles([l,a,h,h,m,l])}getBits(e){return this.view.setFloat32(0,e),BigInt(this.view.getUint32(0))}getVec3Bits(e){return this.getBits(e[0])<<64n|this.getBits(e[1])<<32n|this.getBits(e[2])}}class Ss{constructor(e){this.unevaluatedPortals=new _l,this.portalPolygons=new sg,this.vertexHashLookup=new Map,this.unevalVertices=[],this.unevalHeights=[],this.unevalTriangles=[],this.unevalTunnelTriangles=[],this.unevalEdges=[],this.vertexPositions=new tl,this.vertexNormals=new ju,this.indexArray=new Tr,this.tileToMeters=u(e)}addVertices(e,i){const s=this.unevalVertices.length;for(let l=0;l<e.length;l++)this.unevalVertices.push(e[l]),this.unevalHeights.push(i[l]);return s}addTriangles(e,i,s){const l=s?this.unevalTunnelTriangles:this.unevalTriangles;for(const a of e)l.push(a+i)}addRenderableRing(e,i,s,l,a){const h=[new dt(a.min.x,a.min.y),new dt(a.max.x,a.min.y),new dt(a.max.x,a.max.y),new dt(a.min.x,a.max.y)];for(let m=0;m<s-1;m++){const g=i+m,x=g+1,p=this.unevalVertices[g],y=this.unevalVertices[x];if(!(p.x>=a.min.x&&p.x<=a.max.x&&p.y>=a.min.y&&p.y<=a.max.y||y.x>=a.min.x&&y.x<=a.max.x&&y.y>=a.min.y&&y.y<=a.max.y||ue(p,y,h))||this.isOnBorder(p.x,y.x)||this.isOnBorder(p.y,y.y))continue;const w=Ss.computeEdgeHash(this.unevalVertices[g],this.unevalVertices[x]);let v,b=this.vertexHashLookup.get(Ss.computePosHash(p));b!=null?v=b.next:(b=this.vertexHashLookup.get(Ss.computePosHash(y)),v=b!=null?b.prev:w),this.unevalEdges.push({polygonIdx:e,a:g,b:x,hash:w,portalHash:v,isTunnel:l,type:"unevaluated"})}}addPortalCandidates(e,i,s,l,a){if(i.length===0)return;this.portalPolygons.add(e,{geometry:i,zLevel:a});const h=i[0];this.vertexHashLookup.clear();
20let m=Ss.computeEdgeHash(h[h.length-2],h[h.length-1]);for(let g=0;g<h.length-1;g++){const x=h[g+0],p=h[g+1],y=X.vec2.fromValues(p.x-x.x,p.y-x.y),w=X.vec2.length(y);if(w===0)continue;let v="unevaluated";const b=l.pointElevation(x),S=l.pointElevation(p);Math.abs(b)<.01&&Math.abs(S)<.01?v="entrance":(this.isOnBorder(x.x,p.x)||this.isOnBorder(x.y,p.y))&&(v="border");const A=Ss.computeEdgeHash(x,p);this.unevaluatedPortals.portals.push({connection:{a:e,b:void 0},va:x,vb:p,vab:y,length:w,hash:A,isTunnel:s,type:v});const C=Ss.computePosHash(x);this.vertexHashLookup.set(C,{prev:m,next:A}),m=A}}construct(e){if(this.unevalVertices.length===0)return;const i=()=>({vertexOffset:0,primitiveOffset:this.indexArray.length}),s=y=>{y.primitiveLength=this.indexArray.length-y.primitiveOffset},l=new $0(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(e.portals,this.unevalEdges);const a=i(),h=i(),m=i(),g=(y,w)=>{y.sort((b,S)=>b.type===w&&S.type!==w?-1:b.type!==w&&S.type===w?1:0);const v=y.findIndex(b=>b.type!==w);return v>=0?v:y.length};let x=0;this.unevalEdges.length>0&&(x=g(this.unevalEdges,"none"),this.constructBridgeStructures(l,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:x},this.tileToMeters));const p=i();if(this.unevalEdges.length>0){const y=this.unevalEdges.splice(x),w=g(y,"tunnel")+x;this.unevalEdges.push(...y),this.constructTunnelStructures(l,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:x},{min:x,max:w})}s(m),l.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),s(p),l.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),s(h),l.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),s(a),this.maskSegments=Ui.simpleSegment(0,p.primitiveOffset,0,p.primitiveLength),this.depthSegments=Ui.simpleSegment(0,h.primitiveOffset,0,h.primitiveLength),this.renderableSegments=Ui.simpleSegment(0,m.primitiveOffset,0,m.primitiveLength),this.shadowCasterSegments=Ui.simpleSegment(0,a.primitiveOffset,0,a.primitiveLength)}upload(e){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=e.createVertexBuffer(this.vertexPositions,C0.members),this.vertexBufferNormal=e.createVertexBuffer(this.vertexNormals,P0.members),this.indexBuffer=e.createIndexBuffer(this.indexArray))}destroy(){this.vertexBuffer&&(this.vertexBuffer.destroy(),this.vertexBufferNormal.destroy(),this.indexBuffer.destroy()),this.maskSegments&&(this.maskSegments.destroy(),this.depthSegments.destroy(),this.renderableSegments.destroy(),this.shadowCasterSegments.destroy())}computeVertexConnections(e,i,s,l){const a=new Map;for(let h=s;h<l;h++){const m=i[h],g=m.a,x=m.b;a.has(g)||a.set(g,{}),a.has(x)||a.set(x,{});const p=a.get(g),y=a.get(x);e[x]>0&&(p.to=x),e[g]>0&&(y.from=g)}return a}constructBridgeStructures(e,i,s,l,a,h){const m=this.computeVertexConnections(s,l,a.min,a.max),g=1/h,x=.5*g,p=w=>X.vec3.fromValues(i[w].x,i[w].y,s[w]*g),y=w=>{const v=m.get(w),b=v.from,S=v.to;if(!b||!S)return;const A=p(b),C=p(w),D=p(S),L=X.vec3.fromValues(0,0,0);if(!X.vec3.exactEquals(A,C)){const k=X.vec3.sub(X.vec3.create(),C,A);X.vec3.add(L,L,X.vec3.normalize(k,k))}if(!X.vec3.exactEquals(D,C)){const k=X.vec3.sub(X.vec3.create(),D,C);X.vec3.add(L,L,X.vec3.normalize(k,k))}const z=X.vec3.len(L);return z>0?X.vec3.scale(L,L,1/z):void 0};for(let w=a.min;w<a.max;w++){const v=l[w],b=this.prepareEdgePoints(i,s,v,(it,zt)=>it>=zt);if(b==null)continue;const S=b[0],A=b[1],C=X.vec3.fromValues(S.coord.x,S.coord.y,g*S.height),D=X.vec3.fromValues(A.coord.x,A.coord.y,g*A.height);if(X.vec3.exactEquals(C,D))continue;const L=X.vec3.sub(X.vec3.create(),D,C);X.vec3.normalize(L,L);const z=it=>X.vec3.normalize(it,it),k=y(v.a)||L,B=y(v.b)||L,V=z(X.vec3.fromValues(k[1],-k[0],0)),W=z(X.vec3.fromValues(B[1],-B[0],0)),$=z(X.vec3.cross(X.vec3.create(),V,k)),H=z(X.vec3.cross(X.vec3.create(),W,B)),ae=X.vec3.create(),Y=[X.vec3.add(X.vec3.create(),C,X.vec3.scale(ae,X.vec3.sub(ae,V,$),x)),X.vec3.add(X.vec3.create(),C,X.vec3.scale(ae,X.vec3.add(ae,V,$),x)),X.vec3.add(X.vec3.create(),C,X.vec3.scale(ae,$,x)),C],le=[X.vec3.add(X.vec3.create(),D,X.vec3.scale(ae,X.vec3.sub(ae,W,H),x)),X.vec3.add(X.vec3.create(),D,X.vec3.scale(ae,X.vec3.add(ae,W,H),x)),X.vec3.add(X.vec3.create(),D,X.vec3.scale(ae,H,x)),D],[_e,pe]=e.addVertices(V,h,Y[0],Y[1]),[xe,ye]=e.addVertices(W,h,le[0],le[1]);e.addTriangles([_e,pe,xe,pe,ye,xe]);const[Me,Te]=e.addVertices($,h,Y[1],Y[2]),[Ae,et]=e.addVertices(H,h,le[1],le[2]);e.addTriangles([Me,Te,Ae,Te,et,Ae]);const[Je,xt]=e.addVertices(X.vec3.negate(V,V),h,Y[2],Y[3]),[st,ct]=e.addVertices(X.vec3.negate(W,W),h,le[2],le[3]);e.addTriangles([Je,xt,st,xt,ct,st])}}constructTunnelStructures(e,i,s,l,a,h){const m=g=>X.vec3.normalize(g,g);for(let g=a.min;g<a.max;g++){const x=this.prepareEdgePoints(i,s,l[g],(v,b)=>v<=b);if(x==null)continue;const[p,y]=x,w=m(X.vec3.fromValues(y.coord.y-p.coord.y,-(y.coord.x-p.coord.x),0));e.addQuad([p,y,{coord:y.coord,height:l[g].isTunnel?-.1:0},{coord:p.coord,height:l[g].isTunnel?-.1:0}],w)}for(let g=h.min;g<h.max;g++){const x=l[g],p=i[x.a],y=i[x.b],w=m(X.vec3.fromValues(y.y-p.y,-(y.x-p.x),0));e.addQuad([{coord:y,height:0},{coord:p,height:0},{coord:p,height:s[x.a]+4},{coord:y,height:s[x.b]+4}],w),e.addQuad([{coord:p,height:0},{coord:y,height:0},{coord:y,height:s[x.b]+4},{coord:p,height:s[x.a]+4}],w)}}prepareEdgePoints(e,i,s,l){const a=e[s.a],h=e[s.b];let m=i[s.a],g=i[s.b];if(!(m!==0&&l(m,0)||g!==0&&l(g,0)))return;const x=a.clone(),p=h.clone();if(l(m,0)){if(!l(g,0)){const y=g/(g-m);p.x=Ot(p.x,x.x,y),p.y=Ot(p.y,x.y,y),g=Ot(g,m,y)}}else{const y=m/(m-g);x.x=Ot(x.x,p.x,y),x.y=Ot(x.y,p.y,y),m=Ot(m,g,y)}return[{coord:x,height:m},{coord:p,height:g}]}prepareEdges(e,i){if(i.length===0)return;i.sort((m,g)=>m.hash===g.hash?g.polygonIdx-m.polygonIdx:g.hash>m.hash?1:-1);let s=0,l=0,a=0,h=i[s].polygonIdx;do l++,(l===i.length||i[s].hash!==i[l].hash)&&((l-s==1||i[l-1].polygonIdx!==h)&&
20(a<s&&(i[a]=i[s],i[s]=null),i[a].type="none",a++),s=l,s!==i.length&&(h=i[s].polygonIdx));while(s!==i.length);if(i.splice(a),i.length!==0&&e.length!==0){i.sort((x,p)=>x.hash<p.hash?1:-1);let m=0,g=0;for(;m!==i.length&&g!==e.length;){const x=i[m],p=e[g];x.portalHash>p.hash?m++:p.hash>x.portalHash?g++:(x.type=p.type,m++)}}}isOnBorder(e,i){return e<=0&&i<=0||e>=ht&&i>=ht}static computeEdgeHash(e,i){return(e.y===i.y&&e.x>i.x||e.y>i.y)&&([e,i]=[i,e]),BigInt(Ss.computePosHash(e))<<32n|BigInt(Ss.computePosHash(i))}static computePosHash(e){return((65535&e.x)<<16|65535&e.y)>>>0}}class Bf{constructor(e,i){this.layoutVertexArray=new vs,this.indexArray=new Tr,this.lineIndexArray=new Hs,this.triangleSegments=new Ui,this.lineSegments=new Ui,this.programConfigurations=new Ws(e.layers,{zoom:e.zoom,lut:e.lut}),this.uploaded=!1,i&&(this.elevatedLayoutVertexArray=new yo)}update(e,i,s,l,a,h,m){this.programConfigurations.updatePaintArrays(e,i,a,s,l,h,m)}isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,I0.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,A0.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,s,l,a,h){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,s,l,a,h)}}class Nf{constructor(e){this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.bufferData=new Bf(e,!1),this.elevationBufferData=new Bf(e,!0),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=e.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference")}updateFootprints(e,i){}populate(e,i,s,l){this.hasPattern=zf("fill",this.layers,this.pixelRatio,i);const a=this.layers[0].layout.get("fill-sort-key"),h=[];for(const{feature:m,id:g,index:x,sourceLayerIndex:p}of e){const y=this.layers[0]._featureFilter.needGeometry,w=I(m,y);if(!this.layers[0]._featureFilter.filter(new zi(this.zoom),w,s))continue;const v=a?a.evaluate(w,{},s,i.availableImages):void 0,b={id:g,properties:m.properties,type:m.type,sourceLayerIndex:p,index:x,geometry:y?w.geometry:M(m,s,l),patterns:{},sortKey:v};h.push(b)}a&&h.sort((m,g)=>m.sortKey-g.sortKey);for(const m of h){const{geometry:g,index:x,sourceLayerIndex:p}=m;if(this.hasPattern){const y=Lf("fill",this.layers,m,this.zoom,this.pixelRatio,i);this.patternFeatures.push(y)}else this.addFeature(m,g,x,s,{},i.availableImages,i.brightness,i.elevationFeatures);i.featureIndex.insert(e[x].feature,g,x,p,this.index)}}update(e,i,s,l,a,h,m){this.bufferData.update(e,i,s,l,a,h,m),this.elevationBufferData.update(e,i,s,l,a,h,m)}addFeatures(e,i,s,l,a,h){for(const m of this.patternFeatures)this.addFeature(m,m.geometry,m.index,i,s,l,h,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,s,l,a,h=[],m,g){const x=$d(i,500);this.elevationMode!=="none"?this.addElevatedRoadFeature(e,x,l,s,g):this.addGeometry(x,this.bufferData),this.bufferData.populatePaintArrays(e,s,a,h,l,m),this.elevationBufferData.populatePaintArrays(e,s,a,h,l,m)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}getElevationPolygons(){return this.elevatedStructures?this.elevatedStructures.portalPolygons:void 0}setEvaluatedPortalGraph(e){this.elevatedStructures&&this.elevatedStructures.construct(e)}addElevatedRoadFeature(e,i,s,l,a){const h=new Array,m=this.getElevationFeature(e,a);if(m){h.push({polygons:i,elevationFeature:m,elevationTileID:s});for(const g of h)if(g.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new Ss(g.elevationTileID));const p=g.elevationFeature.isTunnel();let y=0;e.properties.hasOwnProperty(rg)&&(y=+e.properties[rg]);for(const w of g.polygons)this.elevatedStructures.addPortalCandidates(g.elevationFeature.i
vendor: 40,139 bytes, line 20
20d,w,p,g.elevationFeature,y)}const x=new G0(s,g.elevationTileID);this.addElevatedGeometry(g.polygons,x,g.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,l)}}else this.addGeometry(i,this.bufferData)}addElevatedGeometry(e,i,s,l,a){const h={elevation:s,elevationSampler:i,bias:l,index:a},[m,g]=this.addGeometry(e,this.elevationBufferData,h);this.elevationBufferData.heightRange==null?this.elevationBufferData.heightRange={min:m,max:g}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,m),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,g))}addGeometry(e,i,s){let l=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,h=null;s&&(h=s.elevationSampler.constantElevation(s.elevation,s.bias),h!=null&&(l=h,a=h));const m=(g,x,p)=>{if(s!=null)if(x.push(g),h!=null)i.elevatedLayoutVertexArray.emplaceBack(h),p.push(h);else{const y=s.elevationSampler.pointElevation(g,s.elevation,s.bias);i.elevatedLayoutVertexArray.emplaceBack(y),p.push(y),l=Math.min(l,y),a=Math.max(a,y)}};for(const g of e){let x=0;for(const L of g)x+=L.length;const p=i.triangleSegments.prepareSegment(x,i.layoutVertexArray,i.indexArray),y=p.vertexLength,w=[],v=[],b=[],S=[],A=[],C=i.layoutVertexArray.length;for(const L of g){if(L.length===0)continue;L!==g[0]&&v.push(w.length/2);const z=i.lineSegments.prepareSegment(L.length,i.layoutVertexArray,i.lineIndexArray),k=z.vertexLength;s&&A.push(i.layoutVertexArray.length-C),m(L[0],b,S),i.layoutVertexArray.emplaceBack(L[0].x,L[0].y),i.lineIndexArray.emplaceBack(k+L.length-1,k),w.push(L[0].x),w.push(L[0].y);for(let B=1;B<L.length;B++)m(L[B],b,S),i.layoutVertexArray.emplaceBack(L[B].x,L[B].y),i.lineIndexArray.emplaceBack(k+B-1,k+B),w.push(L[B].x),w.push(L[B].y);z.vertexLength+=L.length,z.primitiveLength+=L.length}const D=uh(w,v);for(let L=0;L<D.length;L+=3)i.indexArray.emplaceBack(y+D[L],y+D[L+1],y+D[L+2]);if(s&&this.elevationMode==="hd-road-base"){const L=s.elevation.isTunnel(),z=s.elevation.safeArea,k=this.elevatedStructures.addVertices(b,S);this.elevatedStructures.addTriangles(D,k,L);const B=A.length;if(B>0){for(let V=0;V<B-1;V++)this.elevatedStructures.addRenderableRing(s.index,A[V]+k,A[V+1]-A[V],L,z);this.elevatedStructures.addRenderableRing(s.index,A[B-1]+k,b.length-A[B-1],L,z)}}p.vertexLength+=x,p.primitiveLength+=D.length/3}return[l,a]}getElevationFeature(e,i){if(!i)return;const s=+e.properties[ml];return s!=null?i.find(l=>l.id===s):void 0}}let og,ag,lg,cg;vt(Nf,"FillBucket",{omit:["layers","patternFeatures"]}),vt(Bf,"FillBufferData"),vt(Ss,"ElevatedStructures");class Vf{constructor(e,i,s,l){if(this.triangleCount=i.length/3,this.min=new dt(0,0),this.max=new dt(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],this.triangleCount===0||e.length===0)return;const[a,h]=[e[0].clone(),e[0].clone()];for(let y=1;y<e.length;++y){const w=e[y];a.x=Math.min(a.x,w.x),a.y=Math.min(a.y,w.y),h.x=Math.max(h.x,w.x),h.y=Math.max(h.y,w.y)}if(l){const y=Math.ceil(Math.max(h.x-a.x,h.y-a.y)/l);s=Math.max(s,y)}if(s===0)return;this.min=a,this.max=h;const m=this.max.sub(this.min);m.x=Math.max(m.x,1),m.y=Math.max(m.y,1);const g=Math.max(m.x,m.y)/s;this.cellsX=Math.max(1,Math.ceil(m.x/g)),this.cellsY=Math.max(1,Math.ceil(m.y/g)),this.xScale=1/g,this.yScale=1/g;const x=[];for(let y=0;y<this.triangleCount;y++){const w=e[i[3*y+0]].sub(this.min),v=e[i[3*y+1]].sub(this.min),b=e[i[3*y+2]].sub(this.min),S=Ks(Math.floor(Math.min(w.x,v.x,b.x)),this.xScale,this.cellsX),A=Ks(Math.floor(Math.max(w.x,v.x,b.x)),this.xScale,this.cellsX),C=Ks(Math.floor(Math.min(w.y,v.y,b.y)),this.yScale,this.cellsY),D=Ks(Math.floor(Math.max(w.y,v.y,b.y)),this.yScale,this.cellsY),L=new dt(0,0),z=new dt(0,0),k=new dt(0,0),B=new dt(0,0);for(let V=C;V<=D;++V){L.y=z.y=V*g,k.y=B.y=(V+1)*g;for(let W=S;W<=A;++W)L.x=k.x=W*g,z.x=B.x=(W+1)*g,(Le(w,v,b,L,z,B)||Le(w,v,b,L,B,k))&&x.push({cellIdx:V*this.cellsX+W,triIdx:y})}}if(x.length===0)return;x.sort((y,w)=>y.cellIdx-w.cellIdx||y.triIdx-w.triIdx);let p=0;for(;p<x.length;){const y=x[p].cellIdx,w={start:this.payload.length,len:0};for(;p<x.length&&x[p].cellIdx===y;)++w.len,this.payload.push(x[p++].triIdx);this.cells[y]=w}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(e,i){if(this.triangleCount===0||this.cells.length===0||e.x>this.max.x||this.min.x>e.x||e.y>this.max.y||this.min.y>e.y)return;const s=Ks(e.x-this.min.x,this.xScale,this.cellsX),l=Ks(e.y-this.min.y,this.yScale,this.cellsY),a=this.cells[l*this.cellsX+s];if(a){this._lazyInitLookup();for(let h=0;h<a.len;h++){const m=this.payload[a.start+h],g=Math.floor(m/8),x=1<<m%8;if(!(this.lookup[g]&x)&&(this.lookup[g]|=x,i.push(m),i.length===this.triangleCount))return}}}query(e,i,s){if(this.triangleCount===0||this.cells.length===0||e.x>this.max.x||this.min.x>i.x||e.y>this.max.y||this.min.y>i.y)return;this._lazyInitLookup();const l=Ks(e.x-this.min.x,this.xScale,this.cellsX),a=Ks(i.x-this.min.x,this.xScale,this.cellsX),h=Ks(e.y-this.min.y,this.yScale,this.cellsY),m=Ks(i.y-this.min.y,this.yScale,this.cellsY);for(let g=h;g<=m;g++)for(let x=l;x<=a;x++){const p=this.cells[g*this.cellsX+x];if(p)for(let y=0;y<p.len;y++){const w=this.payload[p.start+y],v=Math.floor(w/8),b=1<<w%8;if(!(this.lookup[v]&b)&&(this.lookup[v]|=b,s.push(w),s.length===this.triangleCount))return}}}}function Ks(n,e,i){return Math.max(0,Math.min(i-1,Math.floor(n*e)))}vt(Vf,"TriangleGridIndex");class ug{constructor(e){this.zoom=e.zoom,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.footprints=[]}updateFootprints(e,i){for(const s of this.footprints)i.push({footprint:s,id:e})}populate(e,i,s,l){const a=[];for(const{feature:h,id:m,index:g,sourceLayerIndex:x}of e){const p=this.layers[0]._featureFilter.needGeometry,y=I(h,p);if(!this.layers[0]._featureFilter.filter(new zi(this.zoom),y,s))continue;const w={id:m,properties:h.properties,type:h.type,sourceLayerIndex:x,index:g,geometry:p?y.geometry:M(h,s,l),patterns:{}};a.push(w)}for(const h of a){const{geometry:m,index:g,sourceLayerIndex:x}=h;this.addFeature(h,m,g,s,{},i.availableImages,i.brightness),i.featureIndex.insert(e[g].feature,m,g,x,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(e){}update(e,i,s,l,a,h,m){}destroy(){}addFeature(e,i,s,l,a,h=[],m){for(const g of $d(i,2)){const x=[],p=[],y=[],w=new dt(1/0,1/0),v=new dt(-1/0,-1/0);for(const A of g)if(A.length!==0){A!==g[0]&&y.push(p.length/2);for(let C=0;C<A.length;C++)p.push(A[C].x),p.push(A[C].y),x.push(A[C]),w.x=Math.min(w.x,A[C].x),w.y=Math.min(w.y,A[C].y),v.x=Math.max(v.x,A[C].x),v.y=Math.max(v.y,A[C].y)}const b=uh(p,y),S=new Vf(x,b,8,256);this.footprints.push({vertices:x,indices:b,grid:S,min:w,max:v})}}}vt(ug,"ClipBucket",{omit:["layers"]});const H0=yi([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),Z0=yi([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),W0=yi([{name:"a_centroid_pos",components:2,type:"Uint16"}]),X0=yi([{name:"a_join_normal_inside",components:3,type:"Int16"}]),Y0=yi([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),K0=yi([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:J0}=H0;class gl extends dt{constructor(e,i,s){super(e,i),this.z=s}}class hg extends gl{constructor(e,i,s,l){super(e,i,s),this.w=l}}function Zd(n,e,i,s){const l=[],a=s===0?(h,m,g,x,p,y)=>{h.push(new dt(y,g+(y-m)/(x-m)*(p-g)))}:(h,m,g,x,p,y)=>{h.push(new dt(m+(y-g)/(p-g)*(x-m),y))};for(const h of n){const m=[];for(const g of h){if(g.length<=2)continue;const x=[];for(let w=0;w<g.length-1;w++){const v=g[w].x,b=g[w].y,S=g[w+1].x,A=g[w+1].y,C=s===0?v:b,D=s===0?S:A;C<e?D>e&&a(x,v,b,S,A,e):C>i?D<i&&a(x,v,b,S,A,i):x.push(g[w]),D<e&&C>=e&&a(x,v,b,S,A,e),D>i&&C<=i&&a(x,v,b,S,A,i)}let p=g[g.length-1];const y=s===0?p.x:p.y;y>=e&&y<=i&&x.push(p),x.length&&(p=x[x.length-1],x[0].x===p.x&&x[0].y===p.y||x.push(x[0]),m.push(x))}m.length&&l.push(m)}return l}function dg(n,e,i,s){const l=i==="x"?"y":"x",a=(s-n[i])/(e[i]-n[i]);n[l]=n[l]+(e[l]-n[l])*a,n[i]=s,n.hasOwnProperty("z")&&(n.z=Ot(n.z,e.z,a)),n.hasOwnProperty("w")&&(n.w=Ot(n.w,e.w,a))}function pg(n,e,i,s){const l=i,a=s;for(const h of["x","y"]){let m=n,g=e;m[h]>=g[h]&&(m=e,g=n),m[h]<l&&g[h]>l&&dg(m,g,h,l),m[h]<a&&g[h]>a&&dg(g,m,h,a)}}const Wd=Number.MAX_SAFE_INTEGER;function fg(n,e,i,s){return n.order<e||n.order===Wd||!(n.clipMask&i)||function(l,a){return a.length!==0&&a.find(h=>h===l)===void 0}(s,n.clipScope)}function Xd(n,e){return n.x-e.x||n.y-e.y}function mg(n,e){return Xd(n.min,e.min)===0&&Xd(n.max,e.max)===0}function Uf(n,e){return!(n.min.x>e.max.x||n.max.x<e.min.x||n.min.y>e.max.y||n.max.y<e.min.y)}function jf(n,e){if(n.length!==e.length)return!1;for(let i=0;i<n.length;i++)if(n[i].sourceId!==e[i].sourceId||!mg(n[i],e[i])||n[i].order!==e[i].order||n[i].clipMask!==e[i].clipMask||!Dn(n[i].clipScope,e[i].clipScope))return!1;return!0}function _g(n,e,i){const s=1/ht,l=1/(1<<i.canonical.z),a=(e.x*s+i.canonical.x)*l+i.wrap,h=(e.y*s+i.canonical.y)*l;return{min:new dt((n.x*s+i.canonical.x)*l+i.wrap,(n.y*s+i.canonical.y)*l),max:new dt(a,h)}}function Q0(n,e,i){const s=1<<i.canonical.z,l=((e.x-i.wrap)*s-i.canonical.x)*ht,a=(e.y*s-i.canonical.y)*ht;return{min:new dt(((n.x-i.wrap)*s-i.canonical.x)*ht,(n.y*s-i.canonical.y)*ht),max:new dt(l,a)}}function gg(n,e,i,s,l,a,h){const m=n.indices,g=n.vertices,x=[];for(let p=s;p<s+l;p+=3){const y=e[i[p+0]+a],w=e[i[p+1]+a],v=e[i[p+2]+a],b=Math.min(y.x,w.x,v.x),S=Math.max(y.x,w.x,v.x),A=Math.min(y.y,w.y,v.y),C=Math.max(y.y,w.y,v.y);x.length=0,n.grid.query(new dt(b,A),new dt(S,C),x);for(let D=0;D<x.length;D++){const L=x[D];if(Le(g[m[3*L+0]],g[m[3*L+1]],g[m[3*L+2]],y,w,v,h))return!0}}return!1}function yg(n,e,i,s){if(!n||!i)return!1;let l=n.vertices;if(!e.canonical.equals(s.canonical)||e.wrap!==s.wrap){if(i.vertices.length<n.vertices.length)return yg(i,s,n,e);const a=e.canonical,h=s.canonical,m=Math.pow(2,h.z-a.z);l=n.vertices.map(g=>new dt((g.x+a.x*ht)*m-h.x*ht,(g.y+a.y*ht)*m-h.y*ht))}return gg(i,l,n.indices,0,n.indices.length,0,0)}function vg(n,e,i,s){const l=Math.pow(2,s.z-i.z);return new dt((n+i.x*ht)*l-s.x*ht,(e+i.y*ht)*l-s.y*ht)}function xg(n,e){const i=[];e.grid.queryPoint(n,i);const s=e.indices,l=e.vertices;for(let a=0;a<i.length;a++){const h=i[a];if(ie([l[s[3*h+0]],l[s[3*h+1]],l[s[3*h+2]]],n))return!0}return!1}const qf=[new dt(0,0),new dt(ht,0),new dt(ht,ht),new dt(0,ht)];function bg(n,e){const i=[];let s=[];if(!e||n.length<2)return[n];if(n.length===2)return ue(n[0],n[1],qf)?[n]:[];for(let l=0;l<n.length+2;l++){const a=n[l%n.length],h=n[(l+1)%n.length],m=ue(l===0?n[n.length-1]:n[(l-1)%n.length],a,qf),g=ue(a,h,qf),x=m||g;x&&s.push(a),x&&g||s.length>0&&(s.length>1&&i.push(s),s=[])}return s.length>1&&i.push(s),i}const Gf=ga.VectorTileFeature.types,e1=["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"],t1=["fill-extrusion-flood-light-ground-radius"],i1=Math.pow(2,13),r1=Math.pow(2,15)-1,wg=new dt(0,1),ya=2147483648;function fh(n,e,i,s,l,a,h,m){n.emplaceBack((e<<1)+h,(i<<1)+a,(Math.floor(s*i1)<<1)+l,Math.round(m))}function mh(n,e,i){n.emplaceBack(e.x*ht,e.y*ht,i?1:0)}function Yd(n,e,i,s,l,a){n.emplaceBack(e.x,e.y,(i.x<<1)+s,(i.y<<1)+l,a)}function _h(n,e,i){n.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}class Tg{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class Sg{constructor(){this.centroidXY=new dt(0,0),this.vertexArrayOffset=0,this.vertexCount=0,this.groundVertexArrayOffset=0,this.groundVertexCount=0,this.flags=0,this.footprintSegIdx=-1,this.footprintSegLen=0,this.polygonSegIdx=-1,this.polygonSegLen=0,this.min=new dt(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new dt(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0}span(){return new dt(this.max.x-this.min.x,this.max.y-this.min.y)}}class Eg{constructor(){this.acc=new dt(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(e,i){e.min.x===Number.MAX_VALUE&&(e.min.x=e.max.x=i.x,e.min.y=e.max.y=i.y)}appendEdge(e,i,s){this.accCount++,this.acc._add(i);let l=!!this.borders;i.x<e.min.x?(e.min.x=i.x,l=!0):i.x>e.max.x&&(e.max.x=i.x,l=!0),i.y<e.min.y?(e.min.y=i.y,l=!0):i.y>e.max.y&&(e.max.y=i.y,l=!0),((i.x===0||i.x===ht)&&i.x===s.x)!=((i.y===0||i.y===ht)&&i.y===s.y)&&this.processBorderOverlap(i,s),l&&this.checkBorderIntersection(i,s)}checkBorderIntersection(e,i){i.x<0!=e.x<0&&this.addBorderIntersection(0,Ot(i.y,e.y,(0-i.x)/(e.x-i.x))),i.x>ht!=e.x>ht&&this.addBorderIntersection(1,Ot(i.y,e.y,(ht-i.x)/(e.x-i.x))),i.y<0!=e.y<0&&this.addBorderIntersection(2,Ot(i.x,e.x,(0-i.y)/(e.y-i.y))),i.y>ht!=e.y>ht&&this.addBorderIntersection(3,Ot(i.x,e.x,(ht-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]]);const s=this.borders[e];i<s[0]&&(s[0]=i),i>s[1]&&(s[1]=i)}processBorderOverlap(e,i){if(e.x===i.x){if(e.y===i.y)return;const s=e.x===0?0:1;this.addBorderIntersection(s,i.y),this.addBorderIntersection(s,e.y)}else{const s=e.y===0?2:3;this.addBorderIntersection(s,i.x),this.addBorderIntersection(s,e.x)}}centroid(){return this.accCount===0?new dt(0,0):new dt(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 Mg(n,e){const i=n.add(e)._unit(),s=Qt(n.x*i.x+n.y*i.y,-1,1);var l,a,h;return h=Math.acos(s),Math.min(4,Math.max(-4,Math.tan(h)))/4*r1*((l=n).x*(a=e).y-l.y*a.x<0?-1:1)}const n1=[n=>n.x<0,n=>n.x>ht,n=>n.y<0,n=>n.y>ht];function s1(n,e,i,s){const l=[4];if(s===0)return l;i._mult(s);const a=n.sub(i),h=e.sub(i),m=[n,e,a,h];for(let g=0;g<4;g++)for(const x of m)if(n1[g](x)){l.push(g);break}return l}class Ig{constructor(e){this.vertexArray=new An,this.indexArray=new Tr,this.programConfigurations=new Ws(e.layers,{zoom:e.zoom,lut:e.lut},i=>t1.includes(i)),this._segments=new Ui,this.hiddenByLandmarkVertexArray=new Ju,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new Ui}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(e,i,s,l=!1){const a=e.length;if(a>2){let h=Math.max(0,this._segments.get().length-1);const m=this._segments._prepareSegment(4*a,this.vertexArray.length,2*this._segmentToGroundQuads[h].length);let g;h!==this._segments.get().length-1&&(h++,this._segmentToGroundQuads[h]=[],this._segmentToRegionTriCounts[h]=[0,0,0,0,0]);{const x=e[0],p=e[1];g=Mg(x.sub(e[a-1])._perp()._unit(),p.sub(x)._perp()._unit())}for(let x=0;x<a;x++){const p=x===a-1?0:x+1,y=e[x],w=e[p],v=e[p===a-1?0:p+1],b=w.sub(y)._perp()._unit(),S=Mg(b,v.sub(w)._perp()._unit()),A=g,C=S;if($f(y,w,i)||l&&Pg(y,i)&&Pg(w,i)){g=S;continue}const D=m.vertexLength;Yd(this.vertexArray,y,w,1,1,A),Yd(this.vertexArray,y,w,1,0,A),Yd(this.vertexArray,y,w,0,1,C),Yd(this.vertexArray,y,w,0,0,C),m.vertexLength+=4;const L=s1(y,w,b,s);for(const z of L)this._segmentToGroundQuads[h].push({id:D,region:z}),this._segmentToRegionTriCounts[h][z]+=2,m.primitiveLength+=2;g=S}}}prepareBorderSegments(){if(!this.hasData())return;const e=this._segments.get(),i=e.length;for(let s=0;s<i;s++)this._segmentToGroundQuads[s].sort((l,a)=>l.region-a.region);for(let s=0;s<i;s++){const l=this._segmentToGroundQuads[s],a=e[s],h=this._segmentToRegionTriCounts[s];h.reduce((g,x)=>g+x,0);let m=0;for(let g=0;g<=4;g++){const x=h[g];if(x!==0){let p=this.regionSegments[g];p||(p=this.regionSegments[g]=new Ui);const y={vertexOffset:a.vertexOffset,primitiveOffset:a.primitiveOffset+m,vertexLength:a.vertexLength,primitiveLength:x};p.get().push(y)}m+=x}for(let g=0;g<l.length;g++){const x=l[g].id;this.indexArray.emplaceBack(x,x+1,x+3),this.indexArray.emplaceBack(x,x+3,x+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(e,i,s,l,a,h){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,e,i,s,l,a,h)}upload(e){this.hasData()&&(this.vertexBuffer=e.createVertexBuffer(this.vertexArray,Z0.members),this.indexBuffer=e.createIndexBuffer(this.indexArray))}uploadPaintProperties(e){this.hasData()&&this.programConfigurations.upload(e)}update(e,i,s,l,a,h,m){this.hasData()&&this.programConfigurations.updatePaintArrays(e,i,s,l,a,h,m)}updateHiddenByLandmark(e){if(!this.hasData())return;const i=e.groundVertexCount+e.groundVertexArrayOffset;if(e.groundVertexCount===0)return;const s=e.flags&ya?1:0;for(let l=e.groundVertexArrayOffset;l<i;++l)this.hiddenByLandmarkVertexArray.emplace(l,s);this._needsHiddenByLandmarkUpdate=!0}uploadHiddenByLandmark(e){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,Y0.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._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let e=0;e<=4;e++){const i=this.regionSegments[e];i&&i.destroy()}}}}class Kd{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.pixelRatio=e.pixelRatio,this.layerIds=this.layers.map(i=>i.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 Tr,this.footprintVertices=new vs,this.footprintSegments=[],this.layoutVertexArray=new xs,this.centroidVertexArray=new al,this.wallVertexArray=new Dd,this.indexArray=new Tr,this.programConfigurations=new Ws(e.layers,{zoom:e.zoom,lut:e.lut},i=>e1.includes(i)),this.segments=new Ui,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.groundEffect=new Ig(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[]}updateFootprints(e,i){}populate(e,i,s,l){this.features=[],this.hasPattern=zf("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=u(s),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1)!==0;for(const{feature:a,id:h,index:m,sourceLayerIndex:g}of e){const x=this.layers[0]._featureFilter.needGeometry,p=I(a,x);if(!this.layers[0]._featureFilter.filter(new zi(this.zoom),p,s))continue;const y={id:h,sourceLayerIndex:g,index:m,geometry:x?p.geometry:M(a,s,l),properties:a.properties,type:a.type,patterns:{}},w=this.layoutVertexArray.length,v=Gf[y.type]==="Polygon";if(this.hasPattern)this.features.push(Lf("fill-extrusion",this.layers,y,this.zoom,this.pixelRatio,i));else if(this.wallMode)for(const b of y.geometry)for(const S of bg(b,v))this.addFeature(y,[S],m,s,{},i.availableImages,l,i.brightness);else this.addFeature(y,y.geometry,m,s,{},i.availableImages,l,i.brightness);i.featureIndex.insert(a,y.geometry,m,g,this.index,w)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,i,s,l,a,h){for(const m of this.features){const g=Gf[m.type]==="Polygon",{geometry:x}=m;if(this.wallMode)for(const p of x)for(const y of bg(p,g))this.addFeature(m,[y],m.index,i,s,l,a,h);else this.addFeature(m,x,m.index,i,s,l,a,h)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(e,i,s,l,a,h,m){this.programConfigurations.updatePaintArrays(e,i,a,s,l,h,m),this.groundEffect.update(e,i,a,s,l,h,m)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,J0),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,X0.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,K0.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,W0.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,s,l,a,h,m,g){const x=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(e,{})/this.tileToMeter,p=[new dt(0,0),new dt(ht,ht)],y=m.projection,w=y.name==="globe",v=this.wallMode||Gf[e.type]==="Polygon",b=new Eg;b.centroidDataIndex=this.centroidData.length;const S=new Sg,A=this.layers[0].paint.get("fill-extrusion-base").evaluate(e,{},l)<=0,C=this.layers[0].paint.get("fill-extrusion-height").evaluate(e,{},l);let D;if(S.height=C,S.vertexArrayOffset=this.layoutVertexArray.length,S.groundVertexArrayOffset=this.groundEffect.vertexArray.length,w&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new pc),this.wallMode){if(w)return void Hi("Non zero fill-extrusion-line-width is not yet supported on globe.");if(i.length!==1)return;D=function(H){const ae=H[0].x===H[H.length-1].x&&H[0].y===H[H.length-1].y;(function(ct){let it=0;const zt=ct.length;for(let _t=0;_t<zt;_t++)it+=(ct[(_t+1)%zt].x-ct[_t].x)*(ct[(_t+1)%zt].y+ct[_t].y);return it>=0})(H)||(H=H.reverse());const le={geometry:[],joinNormals:[],indices:[]},_e=[],pe=[],xe=[];let ye=H.length;for(;ye>=2&&H[ye-1].equals(H[ye-2]);)ye--;if(ye<(ae?3:2))return le;let Me,Te,Ae,et,Je,xt=0;for(;xt<ye-1&&H[xt].equals(H[xt+1]);)xt++;ae&&(Me=H[ye-2],Je=H[xt].sub(Me)._unit()._perp());for(let ct=xt;ct<ye;ct++){if(Ae=ct===ye-1?ae?H[xt+1]:void 0:H[ct+1],Ae&&H[ct].equals(Ae))continue;Je&&(et=Je),Me&&(Te=Me),Me=H[ct],Je=Ae?Ae.sub(Me)._unit()._perp():et,et=et||Je;let it=et.add(Je);it.x===0&&it.y===0||it._unit();const zt=it.x*Je.x+it.y*Je.y,_t=zt!==0?1/zt:1/0,St=et.x*Je.y-et.y*Je.x>0;let Ft="miter";const Kt=2;Ft==="miter"&&_t>Kt&&(Ft="bevel"),Ft==="bevel"&&(_t>100&&(Ft="flipbevel"),_t<Kt&&(Ft="miter"));const Ut=(ri,Yt,oi,mi)=>{const Li=new dt(ri.x,ri.y),Nt=new dt(ri.x,ri.y);Li.x+=Yt.x*mi,Li.y+=Yt.y*mi,Nt.x-=Yt.x*Math.max(oi,1),Nt.y-=Yt.y*Math.max(oi,1),xe.push(Yt),_e.push(Li),pe.push(Nt)};if(Ft==="miter")it._mult(_t),Ut(Me,it,0,0);else if(Ft==="flipbevel")it=Je.mult(-1),Ut(Me,it,0,0),Ut(Me,it.mult(-1),0,0);else{const ri=-Math.sqrt(_t*_t-1),Yt=St?ri:0,oi=St?0:ri;Te&&Ut(Me,et,Yt,oi),Ae&&Ut(Me,Je,Yt,oi)}}le.geometry=[..._e,...pe.reverse(),_e[0]],le.joinNormals=[...xe,...xe.reverse(),xe[xe.length-1]];const st=le.geometry.length-1;for(let ct=0;ct<st/2;ct++)if(ct+1<st/2){let it=ct,zt=ct+1,_t=st-1-ct,St=st-2-ct;it=it===0?st-1:it-1,zt=zt===0?st-1:zt-1,_t=_t===0?st-1:_t-1,St=St===0?st-1:St-1,le.indices.push(_t),le.indices.push(zt),le.indices.push(it),le.indices.push(_t),le.indices.push(St),le.indices.push(zt)}return le}(i[0]),i=[D.geometry]}const L=(H,ae)=>H<(ae.length-1)/2||H===ae.length-1,z=this.wallMode?[i]:$d(i,500);for(let H=z.length-1;H>=0;H--){const ae=z[H];(ae.length===0||(k=ae[0]).every(Y=>Y.x<=0)||k.every(Y=>Y.x>=ht)||k.every(Y=>Y.y<=0)||k.every(Y=>Y.y>=ht))&&z.splice(H,1)}var k;let B;if(w)B=Dg(z,p,l);else{B=[];for(const H of z)B.push({polygon:H,bounds:p})}const V=v?this.edgeRadius:0,W=V>0&&this.zoom<17,$=(H,ae)=>{if(H.length===0)return!1;const Y=H[H.length-1];return ae.x===Y.x&&ae.y===Y.y};for(const{polygon:H,bounds:ae}of B){let Y=0,le=0;for(const ye of H)v&&!ye[0].equals(ye[ye.length-1])&&ye.push(ye[0]),le+=v?ye.length-1:ye.length;const _e=this.segments.prepareSegment((v?5:4)*le,this.layoutVertexArray,this.indexArray);S.footprintSegIdx<0&&(S.footprintSegIdx=this.footprintSegments.length),S.polygonSegIdx<0&&(S.polygonSegIdx=this.polygonSegments.length);const pe={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},xe=new Tg;if(xe.vertexOffset=this.footprintVertices.length,xe.indexOffset=3*this.footprintIndices.length,xe.ringIndices=[],v){const ye=[],Me=[];Y=_e.vertexLength;for(let Ae=0;Ae<H.length;Ae++){const et=H[Ae];et.length&&Ae!==0&&Me.push(ye.length/2);const Je=[];let xt,st;xt=et[1].sub(et[0])._perp()._unit(),xe.ringIndices.push(et.length-1);for(let ct=1;ct<et.length;ct++){const it=et[ct],zt=et[ct===et.length-1?1:ct+1],_t=it.clone();if(V){st=zt.sub(it)._perp()._unit();const St=xt.add(st)._unit(),Ft=V*Math.min(4,1/(xt.x*St.x+xt.y*St.y));_t.x+=Ft*St.x,_t.y+=Ft*St.y,_t.x=Math.round(_t.x),_t.y=Math.round(_t.y),xt=st}if(!A||V!==0&&!W||$(Je,_t)||Je.push(_t),fh(this.layoutVertexArray,_t.x,_t.y,0,0,1,1,0),this.wallMode){const St=L(ct,et);mh(this.wallVertexArray,D.joinNormals[ct],!St)}_e.vertexLength++,this.footprintVertices.emplaceBack(it.x,it.y),ye.push(it.x,it.y),w&&_h(this.layoutVertexExtArray,y.projectTilePoint(_t.x,_t.y,l),y.upVector(l,_t.x,_t.y))}A&&(V===0||W)&&(Je.length!==0&&$(Je,Je[0])&&Je.pop(),this.groundEffect.addData(Je,ae,x))}const Te=this.wallMode?D.indices:uh(ye,Me);for(let Ae=0;Ae<Te.length;Ae+=3)this.footprintIndices.emplaceBack(xe.vertexOffset+Te[Ae+0],xe.vertexOffset+Te[Ae+1],xe.vertexOffset+Te[Ae+2]),this.indexArray.emplaceBack(Y+Te[Ae],Y+Te[Ae+2],Y+Te[Ae+1]),_e.primitiveLength++;xe.indexCount+=Te.length,xe.vertexCount+=this.footprintVertices.length-xe.vertexOffset}for(let ye=0;ye<H.length;ye++){const Me=H[ye];b.startRing(S,Me[0]);let Te=Me.length>4&&Rg(Me[Me.length-2],Me[0],Me[1]),Ae=V?o1(Me[Me.length-2],Me[0],Me[1],V):0;const et=[];let Je,xt,st;xt=Me[1].sub(Me[0])._perp()._unit();let ct=!0;for(let it=1,zt=0;it<Me.length;it++){let _t=Me[it-1],St=Me[it];const Ft=Me[it===Me.length-1?1:it+1];if(b.appendEdge(S,St,_t),$f(St,_t,ae)){V&&(xt=Ft.sub(St)._perp()._unit(),ct=!ct);continue}const Kt=St.sub(_t)._perp(),Ut=Kt.x/(Math.abs(Kt.x)+Math.abs(Kt.y)),ri=Kt.y>0?1:0,Yt=_t.dist(St);if(zt+Yt>32768&&(zt=0),V){st=Ft.sub(St)._perp()._unit();let Nt=Cg(_t,St,Ft,Ag(xt,st),V);isNaN(Nt)&&(Nt=0);const ui=St.sub(_t)._unit();_t=_t.add(ui.mult(Ae))._round(),St=St.add(ui.mult(-Nt))._round(),Ae=Nt,xt=st,A&&this.zoom>=17&&($(et,_t)||et.push(_t),$(et,St)||et.push(St))}const oi=_e.vertexLength,mi=Me.length>4&&Rg(_t,St,Ft);let Li=zg(zt,Te,ct);if(fh(this.layoutVertexArray,_t.x,_t.y,Ut,ri,0,0,Li),fh(this.layoutVertexArray,_t.x,_t.y,Ut,ri,0,1,Li),this.wallMode){const Nt=L(it-1,Me),ui=D.joinNormals[it-1];mh(this.wallVertexArray,ui,Nt),mh(this.wallVertexArray,ui,Nt)}if(zt+=Yt,Li=zg(zt,mi,!ct),Te=mi,fh(this.layoutVertexArray,St.x,St.y,Ut,ri,0,0,Li),fh(this.layoutVertexArray,St.x,St.y,Ut,ri,0,1,Li),this.wallMode){const Nt=L(it,Me),ui=D.joinNormals[it];mh(this.wallVertexArray,ui,Nt),mh(this.wallVertexArray,ui,Nt)}if(_e.vertexLength+=4,this.indexArray.emplaceBack(oi+0,oi+1,oi+2),this.indexArray.emplaceBack(oi+1,oi+3,oi+2),_e.primitiveLength+=2,V){const Nt=Y+(it===1?Me.length-2:it-2),ui=it===1?Y:Nt+1;if(this.indexArray.emplaceBack(oi+1,Nt,oi+3),this.indexArray.emplaceBack(Nt,ui,oi+3),_e.primitiveLength+=2,Je===void 0&&(Je=oi),!$f(Ft,Me[it],ae)){const Bi=it===Me.length-1?Je:_e.vertexLength;this.indexArray.emplaceBack(oi+2,oi+3,Bi),this.indexArray.emplaceBack(oi+3,Bi+1,Bi),this.indexArray.emplaceBack(oi+3,ui,Bi+1),_e.primitiveLength+=3}ct=!ct}if(w){const Nt=this.layoutVertexExtArray,ui=y.projectTilePoint(_t.x,_t.y,l),Bi=y.projectTilePoint(St.x,St.y,l),Gi=y.upVector(l,_t.x,_t.y),Wi=y.upVector(l,St.x,St.y);_h(Nt,ui,Gi),_h(Nt,ui,Gi),_h(Nt,Bi,Wi),_h(Nt,Bi,Wi)}}v&&(Y+=Me.length-1),A&&V&&this.zoom>=17&&(et.length!==0&&$(et,et[0])&&et.pop(),this.groundEffect.addData(et,ae,x,V>0))}this.footprintSegments.push(xe),pe.triangleCount=this.indexArray.length-pe.triangleArrayOffset,this.polygonSegments.push(pe),++S.footprintSegLen,++S.polygonSegLen}if(S.vertexCount=this.layoutVertexArray.length-S.vertexArrayOffset,S.groundVertexCount=this.groundEffect.vertexArray.length-S.groundVertexArrayOffset,S.vertexCount!==0){if(S.centroidXY=b.borders?wg:this.encodeCentroid(b,S),this.centroidData.push(S),b.borders){this.featuresOnBorder.push(b);const H=this.featuresOnBorder.length-1;for(let ae=0;ae<b.borders.length;ae++)b.borders[ae][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[ae].push(H)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,a,h,l,g),this.groundEffect.addPaintPropertiesData(e,s,a,h,l,g),this.maxHeight=Math.max(this.maxHeight,C)}}sortBorders(){for(let e=0;e<this.borderFeatureIndices.length;e++)this.borderFeatureIndices[e].sort((i,s)=>this.featuresOnBorder[i].borders[e][0]-this.featuresOnBorder[s].borders[e][0])}splitToSubtiles(){const e=[];for(let m=0;m<this.centroidData.length;m++){const g=this.centroidData[m],x=+(g.min.y+g.max.y>ht),p=2*x+(+(g.min.x+g.max.x>ht)^x);for(let y=0;y<g.polygonSegLen;y++){const w=g.polygonSegIdx+y;e.push({centroidIdx:m,subtile:p,polygonSegmentIdx:w,triangleSegmentIdx:this.polygonSegments[w].triangleSegIdx})}}const i=new Tr;e.sort((m,g)=>m.triangleSegmentIdx===g.triangleSegmentIdx?m.subtile-g.subtile:m.triangleSegmentIdx-g.triangleSegmentIdx);let s=0,l=0,a=0;for(const m of e){if(m.triangleSegmentIdx!==s)break;a++}const h=e.length;for(;l!==e.length;){s=e[l].triangleSegmentIdx;let m=0,g=l,x=l;for(let p=g;p<a&&e[p].subtile===m;p++)x++;for(;g!==a;){const p=e[g];m=p.subtile;const y=this.centroidData[p.centroidIdx].min.clone(),w=this.centroidData[p.centroidIdx].max.clone(),v={vertexOffset:this.segments.segments[s].vertexOffset,primitiveOffset:i.length,vertexLength:this.segments.segments[s].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let b=g;b<x;b++){const S=e[b],A=this.polygonSegments[S.polygonSegmentIdx],C=this.centroidData[S.centroidIdx].min,D=this.centroidData[S.centroidIdx].max,L=this.indexArray.uint16;for(let z=A.triangleArrayOffset;z<A.triangleArrayOffset+A.triangleCount;z++)i.emplaceBack(L[3*z],L[3*z+1],L[3*z+2]);v.primitiveLength+=A.triangleCount,y.x=Math.min(y.x,C.x),y.y=Math.min(y.y,C.y),w.x=Math.max(w.x,D.x),w.y=Math.max(w.y,D.y)}v.primitiveLength>0&&this.triangleSubSegments.push({segment:v,min:y,max:w}),g=x;for(let b=g;b<a&&e[b].subtile===e[g].subtile;b++)x++}l=a;for(let p=l;p<h&&e[p].triangleSegmentIdx===e[l].triangleSegmentIdx;p++)a++}i._trim(),this.indexArray=i}getVisibleSegments(e,i,s){const l=new Ui;if(this.wallMode){for(const S of this.triangleSubSegments)l.segments.push(S.segment);return l}let a=0,h=0;const m=1<<e.canonical.z;if(i){const S=i.getMinMaxForTile(e);S&&(a=S.min,h=S.max)}h+=this.maxHeight;const g=e.toUnwrapped();let x;const p=[g.canonical.x/m+g.wrap,g.canonical.y/m],y=[(g.canonical.x+1)/m+g.wrap,(g.canonical.y+1)/m],w=(S,A,C)=>[S[0]*(1-C[0])+A[0]*C[0],S[1]*(1-C[1])+A[1]*C[1]],v=[],b=[];for(const S of this.triangleSubSegments){v[0]=S.min.x/ht,v[1]=S.min.y/ht,b[0]=S.max.x/ht,b[1]=S.max.y/ht;const A=w(p,y,v),C=w(p,y,b);if(new Mt([A[0],A[1],a],[C[0],C[1],h]).intersectsPrecise(s)===0){x&&(l.segments.push(x),x=void 0);continue}const D=S.segment;x&&x.vertexOffset!==D.vertexOffset&&(l.segments.push(x),x=void 0),x?(x.vertexLength+=D.vertexLength,x.primitiveLength+=D.primitiveLength):x={vertexOffset:D.vertexOffset,primitiveLength:D.primitiveLength,vertexLength:D.vertexLength,primitiveOffset:D.primitiveOffset,sortKey:void 0,vaos:{}}}return x&&l.segments.push(x),l}encodeCentroid(e,i){const s=e.centroid(),l=i.span(),a=Math.min(7,Math.round(l.x*this.tileToMeter/10)),h=Math.min(7,Math.round(l.y*this.tileToMeter/10));return new dt(Qt(s.x,1,ht-1)<<3|a,Qt(s.y,1,ht-1)<<3|h)}encodeBorderCentroid(e){if(!e.borders)return new dt(0,0);const i=e.borders,s=Number.MAX_VALUE;if(i[0][0]!==s||i[1][0]!==s){const l=i[0][0]!==s?0:1;return new dt(6|(i[0][0]!==s?0:65528),(i[l][0]+i[l][1])/2<<3|6)}{const l=i[2][0]!==s?2:3;return new dt((i[l][0]+i[l][1])/2<<3|6,6|(i[2][0]!==s?0:65528))}}showCentroid(e){const i=this.centroidData[e.centroidDataIndex];i.flags&=ya,i.centroidXY.x=0,i.centroidXY.y=0,this.writeCentroidToBuffer(i)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);const i=e.vertexArrayOffset,s=e.vertexCount+e.vertexArrayOffset,l=e.flags&ya?wg:e.centroidXY,a=this.centroidVertexArray.geta_centroid_pos0(i);if(this.centroidVertexArray.geta_centroid_pos1(i)!==l.y||a!==l.x){for(let h=i;h<s;++h)this.centroidVertexArray.emplace(h,l.x,l.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const e of this.centroidData)this.writeCentroidToBuffer(e)}updateReplacement(e,i,s){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const l=i.getReplacementRegionsForTile(e.toUnwrapped());if(jf(this.activeReplacements,l))return;if(this.activeReplacements=l,this.centroidVertexArray.length===0)this.createCentroidsBuffer();else for(const h of this.centroidData)h.flags&=2147483647;const a=[];for(const h of this.activeReplacements){if(h.order<s)continue;const m=Math.max(1,Math.pow(2,h.footprintTileId.canonical.z-e.canonical.z));for(const g of this.centroidData)if(!(g.flags&ya||h.min.x>g.max.x||g.min.x>h.max.x||h.min.y>g.max.y||g.min.y>h.max.y))for(let x=0;x<g.footprintSegLen;x++){const p=this.footprintSegments[g.footprintSegIdx+x];if(a.length=0,a1(this.footprintVertices,p.vertexOffset,p.vertexCount,h.footprintTileId.canonical,e.canonical,a),gg(h.footprint,a,this.footprintIndices.uint16,p.indexOffset,p.indexCount,-p.vertexOffset,-m)){g.flags|=ya;break}}}for(const h of this.centroidData)this.writeCentroidToBuffer(h);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(e,i,s){let l=!1;for(let a=0;a<s.footprintSegLen;a++){const h=this.footprintSegments[s.footprintSegIdx+a];let m=0;for(const g of h.ringIndices){for(let x=m,p=g+m-1;x<g+m;p=x++){const y=this.footprintVertices.int16[2*(x+h.vertexOffset)+0],w=this.footprintVertices.int16[2*(x+h.vertexOffset)+1],v=this.footprintVertices.int16[2*(p+h.vertexOffset)+1];w>i!=v>i&&e<(this.footprintVertices.int16[2*(p+h.vertexOffset)+0]-y)*(i-w)/(v-w)+y&&(l=!l)}m=g}}return l}getHeightAtTileCoord(e,i){let s=Number.NEGATIVE_INFINITY,l=!0;const a=4*(e+ht)*ht+(i+ht);if(this.partLookup.hasOwnProperty(a)){const h=this.partLookup[a];return h?{height:h.height,hidden:!!(h.flags&ya)}:void 0}for(const h of this.centroidData)e>h.max.x||h.min.x>e||i>h.max.y||h.min.y>i||this.footprintContainsPoint(e,i,h)&&h&&h.height>s&&(s=h.height,this.partLookup[a]=h,l=!!(h.flags&ya));if(s!==Number.NEGATIVE_INFINITY)return{height:s,hidden:l};this.partLookup[a]=void 0}}function Ag(n,e){const i=n.add(e)._unit();return n.x*i.x+n.y*i.y}function o1(n,e,i,s){const l=e.sub(n)._perp()._unit(),a=i.sub(e)._perp()._unit();return Cg(n,e,i,Ag(l,a),s)}function Cg(n,e,i,s,l){const a=Math.sqrt(1-s*s);return Math.min(n.dist(e)/3,e.dist(i)/3,l*a/s)}function $f(n,e,i){return n.x<i[0].x&&e.x<i[0].x||n.x>i[1].x&&e.x>i[1].x||n.y<i[0].y&&e.y<i[0].y||n.y>i[1].y&&e.y>i[1].y}function Pg(n,e){return n.x<e[0].x||n.x>e[1].x||n.y<e[0].y||n.y>e[1].y}function Rg(n,e,i){if(n.x<0||n.x>=ht||e.x<0||e.x>=ht||i.x<0||i.x>=ht)return!1;const s=i.sub(e),l=s.perp(),a=n.sub(e);return(s.x*a.x+s.y*a.y)/Math.sqrt((s.x*s.x+s.y*s.y)*(a.x*a.x+a.y*a.y))>-.866&&l.x*a.x+l.y*a.y<0}function zg(n,e,i){const s=e?2|n:-3&n;return i?1|s:-2&s}function Lg(){const n=Math.PI/32,e=Math.tan(n),i=To;return i*Math.sqrt(1+2*e*e)-i}function Dg(n,e,i){const s=1<<i.z,l=on(i.x/s),a=on((i.x+1)/s),h=Sr(i.y/s),m=Sr((i.y+1)/s);return function(g,x,p,y,w=0,v){const b=[];if(!g.length||!p||!y)return b;const S=(B,V)=>{for(const W of B)b.push({polygon:W,bounds:V})},A=Math.ceil(Math.log2(p)),C=Math.ceil(Math.log2(y)),D=A-C,L=[];for(let B=0;B<Math.abs(D);B++)L.push(D>0?0:1);for(let B=0;B<Math.min(A,C);B++)L.push(0),L.push(1);let z=g;if(z=Zd(z,x[0].y-w,x[1].y+w,1),z=Zd(z,x[0].x-w,x[1].x+w,0),!z.length)return b;const k=[];for(L.length?k.push({polygons:z,bounds:x,depth:0}):S(z,x);k.length;){const B=k.pop(),V=B.depth,W=L[V],$=B.bounds[0],H=B.bounds[1],ae=W===0?$.x:$.y,Y=W===0?H.x:H.y,le=v?v(W,ae,Y):.5*(ae+Y),_e=Zd(B.polygons,ae-w,le+w,W),pe=Zd(B.polygons,le-w,Y+w,W);if(_e.length){const xe=[$,new dt(W===0?le:H.x,W===1?le:H.y)];L.length>V+1?k.push({polygons:_e,bounds:xe,depth:V+1}):S(_e,xe)}if(pe.length){const xe=[new dt(W===0?le:$.x,W===1?le:$.y),H];L.length>V+1?k.push({polygons:pe,bounds:xe,depth:V+1}):S(pe,xe)}}return b}(n,e,Math.ceil((a-l)/11.25),Math.ceil((h-m)/11.25),1,(g,x,p)=>{if(g===0)return .5*(x+p);{const y=Sr((i.y+x/ht)/s);return(sn(.5*(Sr((i.y+p/ht)/s)+y))*s-i.y)*ht}})}function a1(n,e,i,s,l,a){const h=Math.pow(2,s.z-l.z);for(let m=0;m<i;m++){let g=n.int16[2*(m+e)+0],x=n.int16[2*(m+e)+1];g=(g+l.x*ht)*h-s.x*ht,x=(x+l.y*ht)*h-s.y*ht,a.push(new dt(g,x))}}let Og,kg;function gh(n,e){return n.x*e.x+n.y*e.y}function Fg(n,e){if(n.length===1){let i=0;const s=e[i++];let l;for(;!l||s.equals(l);)if(l=e[i++],!l)return 1/0;for(;i<e.length;i++){const a=e[i],h=n[0],m=l.sub(s),g=a.sub(s),x=h.sub(s),p=gh(m,m),y=gh(m,g),w=gh(g,g),v=gh(x,m),b=gh(x,g),S=p*w-y*y,A=(w*v-y*b)/S,C=(p*b-y*v)/S,D=s.z*(1-A-C)+l.z*A+a.z*C;if(isFinite(D))return D}return 1/0}{let i=1/0;for(const s of e)i=Math.min(i,s.z);return i}}function Bg(n,e,i,s,l,a,h,m){const g=h*l.getElevationAt(n,e,!0,!0),x=a[0]!==0,p=x?a[1]===0?h*(a[0]/7-450):h*function(y,w,v){const b=Math.floor(w[0]/8),S=Math.floor(w[1]/8),A=10*(w[0]-8*b),C=10*(w[1]-8*S),D=y.getElevationAt(b,S,!0,!0),L=y.getMeterToDEM(v),z=Math.floor(.5*(A*L-1)),k=Math.floor(.5*(C*L-1)),B=y.tileCoordToPixel(b,S),V=2*z+1,W=2*k+1,$=function(pe,xe,ye,Me,Te){return[pe.getElevationAtPixel(xe,ye,!0),pe.getElevationAtPixel(xe+Te,ye,!0),pe.getElevationAtPixel(xe,ye+Te,!0),pe.getElevationAtPixel(xe+Me,ye+Te,!0)]}(y,B.x-z,B.y-k,V,W),H=Math.abs($[0]-$[1]),ae=Math.abs($[2]-$[3]),Y=Math.abs($[0]-$[2])+Math.abs($[1]-$[3]),le=Math.min(.25,.5*L*(H+ae)/V),_e=Math.min(.25,.5*L*Y/W);return D+Math.max(le*A,_e*C)}(l,a,m):g;return{base:g+(i===0?-1:i),top:x?Math.max(p+s,g+i+2):g+s}}vt(Kd,"FillExtrusionBucket",{omit:["layers","features"]}),vt(Sg,"PartData"),vt(Tg,"FootprintSegment"),vt(Eg,"BorderCentroidData"),vt(Ig,"GroundEffect");const l1=yi([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),c1=yi([{name:"a_z_offset_width",components:3,type:"Float32"}],4),{members:u1}=l1,h1=yi([{name:"a_packed",components:3,type:"Float32"}]),{members:d1}=h1,p1=yi([{name:"a_pattern_data",components:3,type:"Float32"}]),{members:f1}=p1;class Ng{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.image=new _a({width:e,height:i}),this.positions={},this.uploaded=!1}getDash(e,i){const s=this.getKey(e,i);return this.positions[s]}trim(){const e=this.width,i=this.height=Aa(this.nextRow);this.image.resize({width:e,height:i})}
20getKey(e,i){return e.join(",")+i}getDashRanges(e,i,s){const l=[];let a=e.length%2==1?-e[e.length-1]*s:0,h=e[0]*s,m=!0;l.push({left:a,right:h,isDash:m,zeroLength:e[0]===0});let g=e[0];for(let x=1;x<e.length;x++){m=!m;const p=e[x];a=g*s,g+=p,h=g*s,l.push({left:a,right:h,isDash:m,zeroLength:p===0})}return l}addRoundDash(e,i,s){const l=i/2;for(let a=-s;a<=s;a++){const h=this.width*(this.nextRow+s+a);let m=0,g=e[m];for(let x=0;x<this.width;x++){x/g.right>1&&(g=e[++m]);const p=Math.abs(x-g.left),y=Math.abs(x-g.right),w=Math.min(p,y);let v;const b=a/s*(l+1);if(g.isDash){const S=l-Math.abs(b);v=Math.sqrt(w*w+S*S)}else v=l-Math.sqrt(w*w+b*b);this.image.data[h+x]=Math.max(0,Math.min(255,v+128))}}}addRegularDash(e,i){for(let g=e.length-1;g>=0;--g){const x=e[g],p=e[g+1];x.zeroLength?e.splice(g,1):p&&p.isDash===x.isDash&&(p.left=x.left,e.splice(g,1))}const s=e[0],l=e[e.length-1];s.isDash===l.isDash&&(s.left=l.left-this.width,l.right=s.right+this.width);const a=this.width*this.nextRow;let h=0,m=e[h];for(let g=0;g<this.width;g++){g/m.right>1&&(m=e[++h]);const x=Math.abs(g-m.left),p=Math.abs(g-m.right),y=Math.min(x,p);this.image.data[a+g]=Math.max(0,Math.min(255,(m.isDash?y:-y)+i+128))}}addDash(e,i){const s=this.getKey(e,i);if(this.positions[s])return this.positions[s];const l=i==="round",a=l?7:0,h=2*a+1;if(this.nextRow+h>this.height)return Hi("LineAtlas out of space"),null;e.length===0&&e.push(1);let m=0;for(let p=0;p<e.length;p++)e[p]<0&&(Hi("Negative value is found in line dasharray, replacing values with 0"),e[p]=0),m+=e[p];if(m!==0){const p=this.width/m,y=this.getDashRanges(e,this.width,p);l?this.addRoundDash(y,p,a):this.addRegularDash(y,i==="square"?.5*p:0)}const g=this.nextRow+a;this.nextRow+=h;const x={tl:[g,a],br:[m,0]};return this.positions[s]=x,x}}vt(Ng,"LineAtlas");const m1=ga.VectorTileFeature.types,_1=Math.cos(Math.PI/180*37.5),g1=Math.cos(Math.PI/180*5);class Hf{constructor(e){this.evaluationGlobals={zoom:0,lineProgress:void 0},this.zoom=e.zoom,this.evaluationGlobals.zoom=this.zoom,this.overscaling=e.overscaling,this.pixelRatio=e.pixelRatio,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.hasZOffset=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(i=>{this.gradients[i.id]={}}),this.layoutVertexArray=new qu,this.layoutVertexArray2=new Vn,this.patternVertexArray=new Vn,this.indexArray=new Tr,this.programConfigurations=new Ws(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new Ui,this.maxLineLength=0,this.zOffsetVertexArray=new Vn,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.tessellationStep=e.tessellationStep?e.tessellationStep:ht/64}updateFootprints(e,i){}populate(e,i,s,l){this.hasPattern=zf("line",this.layers,this.pixelRatio,i);const a=this.layers[0].layout.get("line-sort-key");this.tileToMeter=u(s);const h=this.layers[0].layout.get("line-z-offset"),m=h.isConstant()&&!h.constantOr(0),g=this.layers[0].layout.get("line-elevation-reference");this.hasZOffset=g==="sea"||g==="ground"||!m&&g==="none",this.hasZOffset&&g==="none"&&Hi(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`);const x=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.hasZOffset&&x!==void 0;const p=[];for(const{feature:b,id:S,index:A,sourceLayerIndex:C}of e){const D=this.layers[0]._featureFilter.needGeometry,L=I(b,D);if(!this.layers[0]._featureFilter.filter(new zi(this.zoom),L,s))continue;const z=a?a.evaluate(L,{},s):void 0,k={id:S,properties:b.properties,type:b.type,sourceLayerIndex:C,index:A,geometry:D?L.geometry:M(b,s,l),patterns:{},sortKey:z};p.push(k)}a&&p.sort((b,S)=>b.sortKey-S.sortKey);const{lineAtlas:y,featureIndex:w}=i,v=this.addConstantDashes(y);for(const b of p){const{geometry:S,index:A,sourceLayerIndex:C}=b;if(v&&this.addFeatureDashes(b,y),this.hasPattern){const D=Lf("line",this.layers,b,this.zoom,this.pixelRatio,i);this.patternFeatures.push(D)}else this.addFeature(b,S,A,s,y.positions,i.availableImages,i.brightness);w.insert(e[A].feature,S,A,C,this.index)}}addConstantDashes(e){let i=!1;for(const s of this.layers){const l=s.paint.get("line-dasharray").value,a=s.layout.get("line-cap").value;if(l.kind!=="constant"||a.kind!=="constant")i=!0;else{const h=a.value,m=l.value;if(!m)continue;e.addDash(m,h)}}return i}addFeatureDashes(e,i){const s=this.zoom;for(const l of this.layers){const a=l.paint.get("line-dasharray").value,h=l.layout.get("line-cap").value;if(a.kind==="constant"&&h.kind==="constant")continue;let m,g;if(a.kind==="constant"){if(m=a.value,!m)continue}else m=a.evaluate({zoom:s},e);g=h.kind==="constant"?h.value:h.evaluate({zoom:s},e),i.addDash(m,g),e.patterns[l.id]=i.getKey(m,g)}}update(e,i,s,l,a,h,m){this.programConfigurations.updatePaintArrays(e,i,a,s,l,h,m)}addFeatures(e,i,s,l,a,h){for(const m of this.patternFeatures)this.addFeature(m,m.geometry,m.index,i,s,l,h)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,d1)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,f1)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,c1.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,u1),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&e.properties.hasOwnProperty("mapbox_clip_start")&&e.properties.hasOwnProperty("mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,i,s,l,a,h,m){const g=this.layers[0].layout,x=g.get("line-join").evaluate(e,{}),p=g.get("line-cap").evaluate(e,{}),y=g.get("line-miter-limit"),w=g.get("line-round-limit");this.lineClips=this.lineFeatureClips(e),this.lineFeature=e,this.zOffsetValue=g.get("line-z-offset").value;const v=this.layers[0].paint.get("line-width").value;v.kind!=="constant"&&v.isLineProgressConstant===!1&&(this.variableWidthValue=v);for(const b of i)this.addLine(b,e,l,x,p,y,w);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,a,h,l,m)}addLine(e,i,s,l,a,h,m){this.distance=0,this.prevDistance=0,this.scaledDistance=0,this.totalDistance=0,this.totalFeatureLength=0,this.lineS
20oFar=0,this.currentVertex=void 0;const g=l==="none";if(this.patternJoinNone=this.hasPattern&&g,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[],this.lineClips){this.lineClipsArray.push(this.lineClips);for(let L=0;L<e.length-1;L++)this.totalDistance+=e[L].dist(e[L+1]);this.totalFeatureLength=this.totalDistance/(this.lineClips.end-this.lineClips.start),this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const x=m1[i.type]==="Polygon";let p=e.length;for(;p>=2&&e[p-1].equals(e[p-2]);)p--;let y=0;for(;y<p-1&&e[y].equals(e[y+1]);)y++;if(p<(x?3:2))return;l==="bevel"&&(h=1.05);const w=this.segments.prepareSegment(10*p,this.layoutVertexArray,this.indexArray);let v,b,S,A,C,D;this.e1=this.e2=-1,x&&(v=e[p-2],C=e[y].sub(v)._unit()._perp());for(let L=y;L<p;L++){if(S=L===p-1?x?e[y+1]:void 0:e[L+1],S&&e[L].equals(S))continue;C&&(A=C),v&&(b=v),v=e[L],D=this.evaluateLineProgressFeatures(b?b.dist(v):0),C=S?S.sub(v)._unit()._perp():A,A=A||C;const z=b&&S;let k=z?l:x||g?"butt":a;const B=A.x*C.x+A.y*C.y;if(g){const _e=function(pe){if(pe.patternJoinNone){const xe=pe.segmentPoints.length/2,ye=pe.lineSoFar-pe.segmentStart;for(let Me=0;Me<xe;++Me){const Te=pe.segmentPoints[2*Me+1],Ae=Math.round(pe.segmentPoints[2*Me])+.5+.25*Te;pe.patternVertexArray.emplaceBack(Ae,ye,pe.segmentStart),pe.patternVertexArray.emplaceBack(Ae,ye,pe.segmentStart)}pe.segmentPoints.length=0}pe.e1=pe.e2=-1};if(z&&B<g1){this.updateDistance(b,v),this.addCurrentVertex(v,A,1,1,w,D),_e(this),this.addCurrentVertex(v,C,-1,-1,w,D);continue}if(b){if(!S){this.updateDistance(b,v),this.addCurrentVertex(v,A,1,1,w,D),_e(this);continue}k="miter"}}let V=A.add(C);V.x===0&&V.y===0||V._unit();const W=V.x*C.x+V.y*C.y,$=W!==0?1/W:1/0,H=2*Math.sqrt(2-2*W),ae=W<_1&&b&&S,Y=A.x*C.y-A.y*C.x>0,le=this.overscaling<=16?15*ht/(512*this.overscaling):0;if(z&&k==="round"){if($<m)k="miter";else if($<=2){const _e=Zf(v,-10,ht+10);k=this.hasZOffset&&(_e||this.hasCrossSlope)?"miter":"fakeround"}}if(k==="miter"&&$>h&&(k="bevel"),k==="bevel"&&($>2&&(k="flipbevel"),$<h&&(k="miter")),b&&!(k==="miter"&&ae)&&this.updateDistance(b,v),k==="miter")if(ae){const _e=v.dist(b);if(_e>2*le){const xe=v.sub(v.sub(b)._mult(le/_e)._round());this.updateDistance(b,xe),this.addCurrentVertex(xe,A,0,0,w,D),b=xe}this.updateDistance(b,v),V._mult($),this.addCurrentVertex(v,V,0,0,w,D);const pe=v.dist(S);if(pe>2*le){const xe=v.add(S.sub(v)._mult(le/pe)._round());this.updateDistance(v,xe),this.addCurrentVertex(xe,C,0,0,w,D),v=xe}}else V._mult($),this.addCurrentVertex(v,V,0,0,w,D);else if(k==="flipbevel"){if($>100)V=C.mult(-1);else{const _e=$*A.add(C).mag()/A.sub(C).mag();V._perp()._mult(_e*(Y?-1:1))}this.addCurrentVertex(v,V,0,0,w,D),this.addCurrentVertex(v,V.mult(-1),0,0,w,D)}
20else if(k==="bevel"||k==="fakeround"){D!=null&&b&&this.addCurrentVertex(v,A,-1,-1,w,D);const _e=v.dist(b)<=2*le&&k!=="bevel",pe=V.mult(Y?1:-1);pe._mult($);const xe=C.mult(Y?-1:1),ye=A.mult(Y?-1:1),Me=this.evaluateLineProgressFeatures(this.distance);if(D==null&&(this.addHalfVertex(v,pe.x,pe.y,!1,!Y,0,w,Me),_e||this.addHalfVertex(v,pe.x+2*ye.x,pe.y+2*ye.y,!1,Y,0,w,Me)),k==="fakeround"){const Te=Math.round(180*H/Math.PI/20);this.addHalfVertex(v,ye.x,ye.y,!1,Y,0,w,Me);for(let Ae=0;Ae<Te;Ae++){let et=Ae/Te;if(et!==.5){const xt=et-.5;et+=et*xt*(et-1)*((1.0904+B*(B*(3.55645-1.43519*B)-3.2452))*xt*xt+(.848013+B*(.215638*B-1.06021)))}const Je=xe.sub(ye)._mult(et)._add(ye)._unit();this.addHalfVertex(v,Je.x,Je.y,!1,Y,0,w,Me)}this.addHalfVertex(v,xe.x,xe.y,!1,Y,0,w,Me)}_e||D!=null||this.addHalfVertex(v,pe.x+2*xe.x,pe.y+2*xe.y,!1,Y,0,w,Me),D!=null&&S&&this.addCurrentVertex(v,C,1,1,w,D)}else k==="butt"?this.addCurrentVertex(v,V,0,0,w,D):k==="square"?(b||this.addCurrentVertex(v,V,-1,-1,w,D),this.addCurrentVertex(v,V,0,0,w,D),b&&this.addCurrentVertex(v,V,1,1,w,D)):k==="round"&&(b&&(this.addCurrentVertex(v,A,0,0,w,D),this.addCurrentVertex(v,A,1,1,w,D,!0)),S&&(this.addCurrentVertex(v,C,-1,-1,w,D,!0),this.addCurrentVertex(v,C,0,0,w,D)))}}addVerticesTo(e,i,s,l,a,h,m,g,x,p){const y=(i.w-e.w)/this.tessellationStep|0;let w=0;const v=this.scaledDistance;if(y>1){this.lineSoFar=e.w;const S=(i.x-e.x)/y,A=(i.y-e.y)/y,C=(i.z-e.z)/y,D=(i.w-e.w)/y;for(let L=1;L<y;++L){e.x+=S,e.y+=A,e.z+=C,this.lineSoFar+=D,w+=D;const z=this.evaluateLineProgressFeatures(this.prevDistance+w);this.scaledDistance=(this.prevDistance+w)/this.totalDistance,this.addHalfVertex(e,s,l,p,!1,m,x,z),this.addHalfVertex(e,a,h,p,!0,-g,x,z)}}this.lineSoFar=i.w,this.scaledDistance=v;const b=this.evaluateLineProgressFeatures(this.distance);this.addHalfVertex(i,s,l,p,!1,m,x,b),this.addHalfVertex(i,a,h,p,!0,-g,x,b)}evaluateLineProgressFeatures(e){if(!this.variableWidthValue&&!this.hasZOffset)return null;this.evaluationGlobals.lineProgress=0,this.lineClips?this.evaluationGlobals.lineProgress=Math.min(1,(this.totalFeatureLength*this.lineClips.start+e)/this.totalFeatureLength):Hi(`line-progress evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`);let i=0;return this.variableWidthValue&&this.variableWidthValue.kind!=="constant"&&(i=this.variableWidthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0),this.hasZOffset?this.zOffsetValue.kind==="constant"?{zOffset:this.zOffsetValue.value,variableWidth:i}:{zOffset:this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,variableWidth:i}:{zOffset:0,variableWidth:i}}addCurrentVertex(e,i,s,l,a,h,m=!1){const g=i.x+i.y*s,x=i.y-i.x*s,p=i.y*l-i.x,y=-i.y-i.x*l;if(h!=null){const w=this.hasZOffset,v=-10,b=ht+10,S=h.zOffset,A=new hg(e.x,e.y,S,this.lineSoFar),C=!!w&&Zf(e,v,b),D=this.lineSoFar,L=this.distance;if(this.currentVertex)if(C){const z=this.currentVertexIsOutside,k=this.currentVertex,B=new hg(e.x,e.y,S,this.lineSoFar);if(pg(k,B,v,b),!Zf(B,v,b)){if(z){this.e1=this.e2=-1,this.distance-=k.dist(A),this.lineSoFar=k.w;const V=this.evaluateLineProgressFeatures(k.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(k,g,x,m,!1,s,a,V),this.addHalfVertex(k,p,y,m,!0,-l,a,V),this.prevDistance=this.distance}this.distance=this.prevDistance+k.dist(B),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(k,B,g,x,p,y,s,l,a,m),this.distance=L,this.scaledDistance=this.distance/this.totalDistance}}else{const z=this.currentVertex;if(this.currentVertexIsOutside){pg(z,A,v,b),this.e1=this.e2=-1,this.distance-=z.dist(A),this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=z.w;const k=this.evaluateLineProgressFeatures(z.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(z,g,x,m,!1,s,a,k),this.addHalfVertex(z,p,y,m,!0,-l,a,k),this.prevDistance=this.distance,this.distance=L,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo(z,A,g,x,p,y,s,l,a,m)}else C||(this.addHalfVertex(e,g,x,m,!1,s,a,h),this.addHalfVertex(e,p,y,m,!0,-l,a,h));
20this.currentVertex=A,this.currentVertexIsOutside=C,this.lineSoFar=D}else this.addHalfVertex(e,g,x,m,!1,s,a,h),this.addHalfVertex(e,p,y,m,!0,-l,a,h)}addHalfVertex({x:e,y:i},s,l,a,h,m,g,x){if(this.patternJoinNone&&(this.segmentPoints.length===0&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),h||this.segmentPoints.push(this.lineSoFar-this.segmentStart,m)),this.layoutVertexArray.emplaceBack((e<<1)+(a?1:0),(i<<1)+(h?1:0),Math.round(63*s)+128,Math.round(63*l)+128,1+(m===0?0:m<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips){const y=Ot(this.lineClips.start,this.lineClips.end,this.scaledDistance);this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,y)}const p=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,p),g.primitiveLength++),h?this.e2=p:this.e1=p,x!=null&&this.zOffsetVertexArray.emplaceBack(x.zOffset,x.variableWidth,x.variableWidth)}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 Zf(n,e,i){return n.x<e||n.x>i||n.y<e||n.y>i}let Vg,Ug;function jg(n,e,i){return e*(ht/(n.tileSize*Math.pow(2,i-n.tileID.overscaledZ)))}vt(Hf,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const qg=(n,e,i)=>(1-i)*n+i*e;function Gg(n,e){return 1/jg(n,1,e.tileZoom)}function $g(n,e,i,s){return n.translatePosMatrix(s||e.tileID.projMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const Hg=n=>{const e=[];Zg(n)&&e.push("RENDER_LINE_DASH"),n.paint.get("line-gradient")&&e.push("RENDER_LINE_GRADIENT");const i=n.paint.get("line-trim-offset");i[0]===0&&i[1]===0||e.push("RENDER_LINE_TRIM_OFFSET"),n.paint.get("line-border-width").constantOr(1)!==0&&e.push("RENDER_LINE_BORDER");const s=n.layout.get("line-join").constantOr("miter")==="none",l=!!n.paint.get("line-pattern").constantOr(1);return s&&l&&e.push("LINE_JOIN_NONE"),e};function Zg(n){const e=n.paint.get("line-dasharray").value;return e.value||e.kind!=="constant"}let Wf;const Wg=()=>Wf||(Wf={layout:Vg||(Vg=new Zi({"line-cap":new yt(Pe.layout_line["line-cap"]),"line-join":new yt(Pe.layout_line["line-join"]),"line-miter-limit":new lt(Pe.layout_line["line-miter-limit"]),"line-round-limit":new lt(Pe.layout_line["line-round-limit"]),"line-sort-key":new yt(Pe.layout_line["line-sort-key"]),"line-z-offset":new yt(Pe.layout_line["line-z-offset"]),"line-elevation-reference":new lt(Pe.layout_line["line-elevation-reference"]),"line-cross-slope":new lt(Pe.layout_line["line-cross-slope"]),visibility:new lt(Pe.layout_line.visibility),"line-width-unit":new lt(Pe.layout_line["line-width-unit"])})),paint:Ug||(Ug=new Zi({"line-opacity":new yt(Pe.paint_line["line-opacity"]),"line-color":new yt(Pe.paint_line["line-color"]),"line-translate":new lt(Pe.paint_line["line-translate"]),"line-translate-anchor":new lt(Pe.paint_line["line-translate-anchor"]),"line-width":new yt(Pe.paint_line["line-width"]),"line-gap-width":new yt(Pe.paint_line["line-gap-width"]),"line-offset":new yt(Pe.paint_line["line-offset"]),"line-blur":new yt(Pe.paint_line["line-blur"]),"line-dasharray":new yt(Pe.paint_line["line-dasharray"]),"line-pattern":new yt(Pe.paint_line["line-pattern"]),"line-gradient":new oa(Pe.paint_line["line-gradient"]),"line-trim-offset":new lt(Pe.paint_line["line-trim-offset"]),"line-trim-fade-range":new lt(Pe.paint_line["line-trim-fade-range"]),"line-trim-color":new lt(Pe.paint_line["line-trim-color"]),"line-emissive-strength":new lt(Pe.paint_line["line-emissive-strength"]),"line-border-width":new yt(Pe.paint_line["line-border-width"]),"line-border-color":new yt(Pe.paint_line["line-border-color"]),"line-occlusion-opacity":new lt(Pe.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new yt({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new yt({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new yt({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new yt({type:"string",default:"default","property-type":"data-driven"})}))},Wf);class y1 extends yt{possiblyEvaluate(e,i){return i=new zi(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,transition:i.transition}),super.possiblyEvaluate(e,i)}evaluate(e,i,s,l){return i=Nr({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(e,i,s,l)}}let yh;function Xg(n,e){return e>0?e+2*n:n}const v1=yi([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),x1=yi([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),b1=yi([{name:"a_projected_pos",components:4,type:"Float32"}],4);yi([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const w1=yi([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),T1=yi([{name:"a_texb",components:2,type:"Uint16"}]),S1=yi([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),E1=yi([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);yi([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Yg=yi([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),M1=yi([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);yi([{name:"triangle",components:3,type:"Uint16"}
20]),yi([{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"}]),yi([{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"}]),yi([{type:"Float32",name:"offsetX"}]),yi([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var Rr=24;const Es=128;function Kg(n,e,i,s,l){if(n.kind==="camera")return n.maxSize;if(n.kind==="composite"){const a=e.possiblyEvaluate(new zi(n.maxZoom),i).evaluate(l,{},i),h=e.possiblyEvaluate(new zi(n.minZoom),i).evaluate(l,{},i);return Math.max(a,h)}return e.possiblyEvaluate(new zi(s)).evaluate(l,{},i)}function Xf(n,e){const{expression:i}=e;if(i.kind==="constant")return{kind:"constant",layoutSize:i.evaluate(new zi(n+1))};if(i.kind==="source")return{kind:"source"};{const{zoomStops:s,interpolationType:l}=i;let a=0;for(;a<s.length&&s[a]<=n;)a++;a=Math.max(0,a-1);let h=a;for(;h<s.length&&s[h]<n+1;)h++;h=Math.min(s.length-1,h);const m=s[a],g=s[h];return i.kind==="composite"?{kind:"composite",minZoom:m,maxZoom:g,interpolationType:l}:{kind:"camera",minZoom:m,maxZoom:g,minSize:i.evaluate(new zi(m)),maxSize:i.evaluate(new zi(g)),interpolationType:l}}}function Jd(n,{uSize:e,uSizeT:i},{lowerSize:s,upperSize:l}){return n.kind==="source"?s/Es:n.kind==="composite"?Ot(s/Es,l/Es,i):e}function Ic(n,e,i=1){let s=0,l=0;if(n.kind==="constant")l=n.layoutSize*i;else if(n.kind!=="source"){const{interpolationType:a,minZoom:h,maxZoom:m}=n,g=a?Qt(fn.interpolationFactor(a,e,h,m),0,1):0;n.kind==="camera"?l=Ot(n.minSize,n.maxSize,g)*i:s=g*i}return{uSizeT:s,uSize:l}}var I1=Object.freeze({__proto__:null,SIZE_PACK_FACTOR:Es,evaluateSizeForFeature:Jd,evaluateSizeForZoom:Ic,getRasterizedIconSize:Kg,getSizeData:Xf});function A1(n,e,i){return n.sections.forEach(s=>{s.text=function(l,a,h){const m=a.layout.get("text-transform").evaluate(h,{});return m==="uppercase"?l=l.toLocaleUpperCase():m==="lowercase"&&(l=l.toLocaleLowerCase()),In.applyArabicShaping&&(l=In.applyArabicShaping(l)),l}(s.text,e,i)}),n}const vh={"!":"ï¸","#":"ï¼",$:"ï¼","%":"ï¼
","&":"ï¼","(":"︵",")":"︶","*":"ï¼","+":"ï¼",",":"ï¸","-":"︲",".":"ã»","/":"ï¼",":":"ï¸",";":"ï¸","<":"︿","=":"ï¼",">":"ï¹","?":"ï¸","@":"ï¼ ","[":"ï¹","\\":"ï¼¼","]":"ï¹","^":"ï¼¾",_:"︳","`":"ï½","{":"︷","|":"â","}":"︸","~":"ï½","¢":"ï¿ ","£":"ï¿¡","Â¥":"ï¿¥","¦":"¦","¬":"ï¿¢","¯":"ï¿£","â":"︲","â":"︱","â":"ï¹","â":"ï¹","â":"ï¹","â":"ï¹","â¦":"ï¸","â§":"ã»","â©":"₩","ã":"ï¸","ã":"ï¸","ã":"︿","ã":"ï¹","ã":"︽","ã":"︾","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"︻","ã":"︼","ã":"︹","ã":"︺","ã":"ï¸","ã":"ï¸","ï¼":"ï¸","ï¼":"︵","ï¼":"︶","ï¼":"ï¸","ï¼":"︲","ï¼":"ã»","ï¼":"ï¸","ï¼":"ï¸","ï¼":"︿","ï¼":"ï¹","ï¼":"ï¸","ï¼»":"ï¹","ï¼½":"ï¹","_":"︳","ï½":"︷","ï½":"â","ï½":"︸","ï½":"︵","ï½ ":"︶","。":"ï¸","ï½¢":"ï¹","ï½£":"ï¹","â":"â","â":"â"};function C1(n){return n==="︶"||n==="ï¹"||n==="︸"||n==="ï¹"||n==="ï¹"||n==="︾"||n==="︼"||n==="︺"||n==="ï¸"||n==="ï¹"||n==="ï¸"||n==="ï¸"||n==="ï¸"||n==="ï½"||n==="ï¿£"||n==="ï¸"||n==="ï¸"}function P1(n){return n==="︵"||n==="ï¹"||n==="︷"||n==="ï¹"||n==="ï¹"||n==="︽"||n==="︻"||n==="︹"||n==="ï¸"||n==="︿"}var Jg,Yf,Qg,Kf={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */function R1(){return Jg||(Jg=1,Kf.read=function(n,e,i,s,l){var a,h,m=8*l-s-1,g=(1<<m)-1,x=g>>
vendor: 4,687 bytes, line 20
201,p=-7,y=i?l-1:0,w=i?-1:1,v=n[e+y];for(y+=w,a=v&(1<<-p)-1,v>>=-p,p+=m;p>0;a=256*a+n[e+y],y+=w,p-=8);for(h=a&(1<<-p)-1,a>>=-p,p+=s;p>0;h=256*h+n[e+y],y+=w,p-=8);if(a===0)a=1-x;else{if(a===g)return h?NaN:1/0*(v?-1:1);h+=Math.pow(2,s),a-=x}return(v?-1:1)*h*Math.pow(2,a-s)},Kf.write=function(n,e,i,s,l,a){var h,m,g,x=8*a-l-1,p=(1<<x)-1,y=p>>1,w=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,v=s?0:a-1,b=s?1:-1,S=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(m=isNaN(e)?1:0,h=p):(h=Math.floor(Math.log(e)/Math.LN2),e*(g=Math.pow(2,-h))<1&&(h--,g*=2),(e+=h+y>=1?w/g:w*Math.pow(2,1-y))*g>=2&&(h++,g/=2),h+y>=p?(m=0,h=p):h+y>=1?(m=(e*g-1)*Math.pow(2,l),h+=y):(m=e*Math.pow(2,y-1)*Math.pow(2,l),h=0));l>=8;n[i+v]=255&m,v+=b,m/=256,l-=8);for(h=h<<l|m,x+=l;x>0;n[i+v]=255&h,v+=b,h/=256,x-=8);n[i+v-b]|=128*S}),Kf}function ey(){if(Qg)return Yf;Qg=1,Yf=e;var n=R1();function e(z){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(z)?z:new Uint8Array(z||0),this.pos=0,this.type=0,this.length=this.buf.length}e.Varint=0,e.Fixed64=1,e.Bytes=2,e.Fixed32=5;var i=4294967296,s=1/i,l=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function a(z){return z.type===e.Bytes?z.readVarint()+z.pos:z.pos+1}function h(z,k,B){return B?4294967296*k+(z>>>0):4294967296*(k>>>0)+(z>>>0)}function m(z,k,B){var V=k<=16383?1:k<=2097151?2:k<=268435455?3:Math.floor(Math.log(k)/(7*Math.LN2));B.realloc(V);for(var W=B.pos-1;W>=z;W--)B.buf[W+V]=B.buf[W]}function g(z,k){for(var B=0;B<z.length;B++)k.writeVarint(z[B])}function x(z,k){for(var B=0;B<z.length;B++)k.writeSVarint(z[B])}function p(z,k){for(var B=0;B<z.length;B++)k.writeFloat(z[B])}function y(z,k){for(var B=0;B<z.length;B++)k.writeDouble(z[B])}function w(z,k){for(var B=0;B<z.length;B++)k.writeBoolean(z[B])}function v(z,k){for(var B=0;B<z.length;B++)k.writeFixed32(z[B])}function b(z,k){for(var B=0;B<z.length;B++)k.writeSFixed32(z[B])}function S(z,k){for(var B=0;B<z.length;B++)k.writeFixed64(z[B])}function A(z,k){for(var B=0;B<z.length;B++)k.writeSFixed64(z[B])}function C(z,k){return(z[k]|z[k+1]<<8|z[k+2]<<16)+16777216*z[k+3]}function D(z,k,B){z[B]=k,z[B+1]=k>>>8,z[B+2]=k>>>16,z[B+3]=k>>>24}function L(z,k){return(z[k]|z[k+1]<<8|z[k+2]<<16)+(z[k+3]<<24)}return e.prototype={destroy:function(){this.buf=null},readFields:function(z,k,B){for(B=B||this.length;this.pos<B;){var V=this.readVarint(),W=V>>3,$=this.pos;this.type=7&V,z(W,k,this),this.pos===$&&this.skip(V)}return k},readMessage:function(z,k){return this.readFields(z,k,this.readVarint()+this.pos)},readFixed32:function(){var z=C(this.buf,this.pos);return this.pos+=4,z},readSFixed32:function(){var z=L(this.buf,this.pos);return this.pos+=4,z},readFixed64:function(){var z=C(this.buf,this.pos)+C(this.buf,this.pos+4)*i;return this.pos+=8,z},readSFixed64:function(){var z=C(this.buf,this.pos)+L(this.buf,this.pos+4)*i;return this.pos+=8,z},readFloat:function(){var z=n.read(this.buf,this.pos,!0,23,4);return this.pos+=4,z},readDouble:function(){var z=n.read(this.buf,this.pos,!0,52,8);return this.pos+=8,z},readVarint:function(z){var k,B,V=this.buf;return k=127&(B=V[this.pos++]),B<128?k:(k|=(127&(B=V[this.pos++]))<<7,B<128?k:(k|=(127&(B=V[this.pos++]))<<14,B<128?k:(k|=(127&(B=V[this.pos++]))<<21,B<128?k:function(W,$,H){var ae,Y,le=H.buf;if(ae=(112&(Y=le[H.pos++]))>>4,Y<128||(ae|=(127&(Y=le[H.pos++]))<<3,Y<128)||(ae|=(127&(Y=le[H.pos++]))<<10,Y<128)||(ae|=(127&(Y=le[H.pos++]))<<17,Y<128)||(ae|=(127&(Y=le[H.pos++]))<<24,Y<128)||(ae|=(1&(Y=le[H.pos++]))<<31,Y<128))return h(W,ae,$);throw new Error("Expected varint not more than 10 bytes")}(k|=(15&(B=V[this.pos]))<<28,z,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var z=this.readVarint();return z%2==1?(z+1)/-2:z/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var z=this.readVarint()+this.pos,k=this.pos;return this.pos=z,z-k>=12&&l?function(B,V,W){return l.decode(B.subarray(V,W))}(this.buf,k,z):function(B,V,W){for(var $="",H=V;H<W;){var ae,Y,le,_e=B[H],pe=null,xe=_e>239?4:_e>223?3:_e>191?2:1;if(H+xe>W)break;xe===1?_e<128&&(pe=_e):xe===2?(192&(ae=B[H+1]))==128&&(pe=(31&_e)<<6|63&ae)<=127&&(pe=null):xe===3?(Y=B[H+2],(192&(ae=B[H+1]))==128&&(192&Y)==128&&((pe=(15&_e)<<12|(63&ae)<<6|63&Y)<=2047||pe>=55296&&pe<=57343)&&(pe=null)):xe===4&&(Y=B[H+2],le=B[H+3],(192&(ae=B[H+1]))==128&&(192&Y)==128&&(192&le)==128&&((pe=(15&_e)<<18|(63&ae)<<12|(63&Y)<<6|63&le)<=65535||pe>=1114112)&&(pe=null)),pe===null?(pe=65533,xe=1):pe>65535&&(pe-=65536,$+=String.fromCharCode(pe>>>10&1023|55296),pe=56320|1023&pe),$+=String.fromCharCode(pe),H+=xe}return $}(this.buf,k,z)},readBytes:function(){var z=this.readVarint()+this.pos,k=this.buf.subarray(this.pos,z);return this.pos=z,k}
vendor: 5,612 bytes, line 20
20,readPackedVarint:function(z,k){if(this.type!==e.Bytes)return z.push(this.readVarint(k));var B=a(this);for(z=z||[];this.pos<B;)z.push(this.readVarint(k));return z},readPackedSVarint:function(z){if(this.type!==e.Bytes)return z.push(this.readSVarint());var k=a(this);for(z=z||[];this.pos<k;)z.push(this.readSVarint());return z},readPackedBoolean:function(z){if(this.type!==e.Bytes)return z.push(this.readBoolean());var k=a(this);for(z=z||[];this.pos<k;)z.push(this.readBoolean());return z},readPackedFloat:function(z){if(this.type!==e.Bytes)return z.push(this.readFloat());var k=a(this);for(z=z||[];this.pos<k;)z.push(this.readFloat());return z},readPackedDouble:function(z){if(this.type!==e.Bytes)return z.push(this.readDouble());var k=a(this);for(z=z||[];this.pos<k;)z.push(this.readDouble());return z},readPackedFixed32:function(z){if(this.type!==e.Bytes)return z.push(this.readFixed32());var k=a(this);for(z=z||[];this.pos<k;)z.push(this.readFixed32());return z},readPackedSFixed32:function(z){if(this.type!==e.Bytes)return z.push(this.readSFixed32());var k=a(this);for(z=z||[];this.pos<k;)z.push(this.readSFixed32());return z},readPackedFixed64:function(z){if(this.type!==e.Bytes)return z.push(this.readFixed64());var k=a(this);for(z=z||[];this.pos<k;)z.push(this.readFixed64());return z},readPackedSFixed64:function(z){if(this.type!==e.Bytes)return z.push(this.readSFixed64());var k=a(this);for(z=z||[];this.pos<k;)z.push(this.readSFixed64());return z},skip:function(z){var k=7&z;if(k===e.Varint)for(;this.buf[this.pos++]>127;);else if(k===e.Bytes)this.pos=this.readVarint()+this.pos;else if(k===e.Fixed32)this.pos+=4;else{if(k!==e.Fixed64)throw new Error("Unimplemented type: "+k);this.pos+=8}},writeTag:function(z,k){this.writeVarint(z<<3|k)},realloc:function(z){for(var k=this.length||16;k<this.pos+z;)k*=2;if(k!==this.length){var B=new Uint8Array(k);B.set(this.buf),this.buf=B,this.length=k}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(z){this.realloc(4),D(this.buf,z,this.pos),this.pos+=4},writeSFixed32:function(z){this.realloc(4),D(this.buf,z,this.pos),this.pos+=4},writeFixed64:function(z){this.realloc(8),D(this.buf,-1&z,this.pos),D(this.buf,Math.floor(z*s),this.pos+4),this.pos+=8},writeSFixed64:function(z){this.realloc(8),D(this.buf,-1&z,this.pos),D(this.buf,Math.floor(z*s),this.pos+4),this.pos+=8},writeVarint:function(z){(z=+z||0)>268435455||z<0?function(k,B){var V,W;if(k>=0?(V=k%4294967296|0,W=k/4294967296|0):(W=~(-k/4294967296),4294967295^(V=~(-k%4294967296))?V=V+1|0:(V=0,W=W+1|0)),k>=18446744073709552e3||k<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");B.realloc(10),function($,H,ae){ae.buf[ae.pos++]=127&$|128,$>>>=7,ae.buf[ae.pos++]=127&$|128,$>>>=7,ae.buf[ae.pos++]=127&$|128,$>>>=7,ae.buf[ae.pos++]=127&$|128,ae.buf[ae.pos]=127&($>>>=7)}(V,0,B),function($,H){var ae=(7&$)<<4;H.buf[H.pos++]|=ae|(($>>>=3)?128:0),$&&(H.buf[H.pos++]=127&$|(($>>>=7)?128:0),$&&(H.buf[H.pos++]=127&$|(($>>>=7)?128:0),$&&(H.buf[H.pos++]=127&$|(($>>>=7)?128:0),$&&(H.buf[H.pos++]=127&$|(($>>>=7)?128:0),$&&(H.buf[H.pos++]=127&$)))))}(W,B)}(z,this):(this.realloc(4),this.buf[this.pos++]=127&z|(z>127?128:0),z<=127||(this.buf[this.pos++]=127&(z>>>=7)|(z>127?128:0),z<=127||(this.buf[this.pos++]=127&(z>>>=7)|(z>127?128:0),z<=127||(this.buf[this.pos++]=z>>>7&127))))},writeSVarint:function(z){this.writeVarint(z<0?2*-z-1:2*z)},writeBoolean:function(z){this.writeVarint(!!z)},writeString:function(z){z=String(z),this.realloc(4*z.length),this.pos++;var k=this.pos;this.pos=function(V,W,$){for(var H,ae,Y=0;Y<W.length;Y++){if((H=W.charCodeAt(Y))>55295&&H<57344){if(!ae){H>56319||Y+1===W.length?(V[$++]=239,V[$++]=191,V[$++]=189):ae=H;continue}if(H<56320){V[$++]=239,V[$++]=191,V[$++]=189,ae=H;continue}H=ae-55296<<10|H-56320|65536,ae=null}else ae&&(V[$++]=239,V[$++]=191,V[$++]=189,ae=null);H<128?V[$++]=H:(H<2048?V[$++]=H>>6|192:(H<65536?V[$++]=H>>12|224:(V[$++]=H>>18|240,V[$++]=H>>12&63|128),V[$++]=H>>6&63|128),V[$++]=63&H|128)}return $}(this.buf,z,this.pos);var B=this.pos-k;B>=128&&m(k,B,this),this.pos=k-1,this.writeVarint(B),this.pos+=B},writeFloat:function(z){this.realloc(4),n.write(this.buf,z,this.pos,!0,23,4),this.pos+=4},writeDouble:function(z){this.realloc(8),n.write(this.buf,z,this.pos,!0,52,8),this.pos+=8},writeBytes:function(z){var k=z.length;this.writeVarint(k),this.realloc(k);for(var B=0;B<k;B++)this.buf[this.pos++]=z[B]},writeRawMessage:function(z,k){this.pos++;var B=this.pos;z(k,this);var V=this.pos-B;V>=128&&m(B,V,this),this.pos=B-1,this.writeVarint(V),this.pos+=V},writeMessage:function(z,k,B){this.writeTag(z,e.Bytes),this.writeRawMessage(k,B)},writePackedVarint:function(z,k){k.length&&this.writeMessage(z,g,k)},writePackedSVarint:function(z,k){k.length&&this.writeMessage(z,x,k)},writePackedBoolean:function(z,k){k.length&&this.writeMessage(z,w,k)},writePackedFloat:function(z,k){k.length&&this.writeMessage(z,p,k)},writePackedDouble:function(z,k){k.length&&this.writeMessage(z,y,k)},writePackedFixed32:function(z,k){k.length&&this.writeMessage(z,v,k)},writePackedSFixed32:function(z,k){k.length&&this.writeMessage(z,b,k)},writePackedFixed64:function(z,k){k.length&&this.writeMessage(z,S,k)},writePackedSFixed64:function(z,k){k.length&&this.writeMessage(z,A,k)},writeBytesField:function(z,k){this.writeTag(z,e.Bytes),this.writeBytes(k)},writeFixed32Field:function(z,k){this.writeTag(z,e.Fixed32),this.writeFixed32(k)},writeSFixed32Field:function(z,k){this.writeTag(z,e.Fixed32),this.writeSFixed32(k)},writeFixed64Field:function(z,k){this.writeTag(z,e.Fixed64),this.writeFixed64
20(k)},writeSFixed64Field:function(z,k){this.writeTag(z,e.Fixed64),this.writeSFixed64(k)},writeVarintField:function(z,k){this.writeTag(z,e.Varint),this.writeVarint(k)},writeSVarintField:function(z,k){this.writeTag(z,e.Varint),this.writeSVarint(k)},writeStringField:function(z,k){this.writeTag(z,e.Bytes),this.writeString(k)},writeFloatField:function(z,k){this.writeTag(z,e.Fixed32),this.writeFloat(k)},writeDoubleField:function(z,k){this.writeTag(z,e.Fixed64),this.writeDouble(k)},writeBooleanField:function(z,k){this.writeVarintField(z,!!k)}},Yf}var Qd=Ce(ey());const Jf=3;function z1(n,e,i){e.glyphs=[],n===1&&i.readMessage(L1,e)}function L1(n,e,i){if(n===3){const{id:s,bitmap:l,width:a,height:h,left:m,top:g,advance:x}=i.readMessage(D1,{});e.glyphs.push({id:s,bitmap:new _a({width:a+2*Jf,height:h+2*Jf},l),metrics:{width:a,height:h,left:m,top:g,advance:x}})}else n===4?e.ascender=i.readSVarint():n===5&&(e.descender=i.readSVarint())}function D1(n,e,i){n===1?e.id=i.readVarint():n===2?e.bitmap=i.readBytes():n===3?e.width=i.readVarint():n===4?e.height=i.readVarint():n===5?e.left=i.readSVarint():n===6?e.top=i.readSVarint():n===7&&(e.advance=i.readVarint())}const ty=Jf,vn={horizontal:1,vertical:2,horizontalOnly:3};class xh{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(e,i){const s=new xh;return s.scale=e||1,s.fontStack=i,s}static forImage(e){const i=new xh;return i.image=e,i}}class Ac{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,i,s){const l=new Ac;for(let a=0;a<e.sections.length;a++){const h=e.sections[a];h.image?l.addImageSection(h,s):l.addTextSection(h,i)}return l}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSections(){return this.sections}getSectionIndex(e){return this.sectionIndex[e]}getCodePoint(e){return this.text.codePointAt(e)}verticalizePunctuation(e){this.text=function(i,s){let l="";for(let a=0;a<i.length;a++){const h=i.charCodeAt(a+1)||null,m=i.charCodeAt(a-1)||null;l+=!s&&(h&&Ru(h)&&!vh[i[a+1]]||m&&Ru(m)&&!vh[i[a-1]])||!vh[i[a]]?i[a]:vh[i[a]]}return l}(this.text,e)}trim(){let e=0;for(let s=0;s<this.text.length&&ep[this.text.charCodeAt(s)];s++)e++;let i=this.text.length;for(let s=this.text.length-1;s>=0&&s>=e&&ep[this.text.charCodeAt(s)];s--)i--;this.text=this.text.substring(e,i),this.sectionIndex=this.sectionIndex.slice(e,i)}substring(e,i){const s=new Ac;return s.text=this.text.substring(e,i),s.sectionIndex=this.sectionIndex.slice(e,i),s.sections=this.sections,s}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(xh.forText(e.scale,e.fontStack||i));const s=this.sections.length-1;for(let l=0;l<e.text.length;++l)this.sectionIndex.push(s)}addImageSection(e,i){const s=e.image?e.image.getPrimary():null;if(!s)return void Hi("Can't add FormattedSection with an empty image.");s.scaleSelf(i);const l=this.getNextImageSectionCharCode();l?(this.text+=String.fromCodePoint(l),this.sections.push(xh.forImage(s)),this.sectionIndex.push(this.sections.length-1)):Hi("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Qf(n,e,i,s,l,a,h,m,g,x,p,y,w,v,b,S=1){const A=Ac.fromFeature(n,l,S);y===vn.vertical&&A.verticalizePunctuation(w);let C=[];const D=function(V,W,$,H,ae,Y){if(!V)return[];const le=[],_e=function(Me,Te,Ae,et,Je,xt){let st=0;for(let ct=0;ct<Me.length();ct++){const it=Me.getSection(ct);st+=iy(Me.getCodePoint(ct),it,et,Je,Te,xt)}return st/Math.max(1,Math.ceil(st/Ae))}(V,W,$,H,ae,Y),pe=V.text.indexOf("â")>=0;let xe=0;for(let Me=0;Me<V.length();Me++){const Te=V.getSection(Me),Ae=V.getCodePoint(Me);if(ep[Ae]||(xe+=iy(Ae,Te,H,ae,W,Y)),Me<V.length()-1){const et=!((ye=Ae)<11904||!(Rt["Bopomofo Extended"](ye)||Rt.Bopomofo(ye)||Rt["CJK Compatibility Forms"](ye)||Rt["CJK Compatibility Ideographs"](ye)||Rt["CJK Compatibility"](ye)||Rt["CJK Radicals Supplement"](ye)||Rt["CJK Strokes"](ye)||Rt["CJK Symbols and Punctuation"](ye)||Rt["CJK
20Unified Ideographs Extension A"](ye)||Rt["CJK Unified Ideographs"](ye)||Rt["Enclosed CJK Letters and Months"](ye)||Rt["Halfwidth and Fullwidth Forms"](ye)||Rt.Hiragana(ye)||Rt["Ideographic Description Characters"](ye)||Rt["Kangxi Radicals"](ye)||Rt["Katakana Phonetic Extensions"](ye)||Rt.Katakana(ye)||Rt["Vertical Forms"](ye)||Rt["Yi Radicals"](ye)||Rt["Yi Syllables"](ye)));(O1[Ae]||et||Te.image)&&le.push(ny(Me+1,xe,_e,le,k1(Ae,V.getCodePoint(Me+1),et&&pe),!1))}}var ye;return sy(ny(V.length(),xe,_e,le,0,!0))}(A,x,a,e,s,v),{processBidirectionalText:L,processStyledBidirectionalText:z}=In;if(L&&A.sections.length===1){const V=L(A.toString(),D);for(const W of V){const $=new Ac;$.text=W,$.sections=A.sections;for(let H=0;H<W.length;H++)$.sectionIndex.push(0);C.push($)}}else if(z){const V=z(A.text,A.sectionIndex,D);for(const W of V){const $=new Ac;$.text=W[0],$.sectionIndex=W[1],$.sections=A.sections,C.push($)}}else C=function(V,W){const $=[],H=V.text;let ae=0;for(const Y of W)$.push(V.substring(ae,Y)),ae=Y;return ae<H.length&&$.push(V.substring(ae,H.length)),$}(A,D);const k=[],B={positionedLines:k,text:A.toString(),top:p[1],bottom:p[1],left:p[0],right:p[0],writingMode:y,iconsInText:!1,verticalizable:!1,hasBaseline:!1};if(function(V,W,$,H,ae,Y,le,_e,pe,xe,ye,Me){let Te=0,Ae=0,et=0;const Je=_e==="right"?1:_e==="left"?0:.5;let xt=!1;for(const St of ae){const Ft=St.getSections();for(const Kt of Ft){if(Kt.image)continue;const Ut=W[Kt.fontStack];if(Ut&&(xt=Ut.ascender!==void 0&&Ut.descender!==void 0,!xt))break}if(!xt)break}let st=0;for(const St of ae){St.trim();const Ft=St.getMaxScale(),Kt=(Ft-1)*Rr,Ut={positionedGlyphs:[],lineOffset:0};V.positionedLines[st]=Ut;const ri=Ut.positionedGlyphs;let Yt=0;if(!St.length()){Ae+=Y,++st;continue}let oi=0,mi=0;for(let Nt=0;Nt<St.length();Nt++){const ui=St.getSection(Nt),Bi=St.getSectionIndex(Nt),Gi=St.getCodePoint(Nt);let Wi=ui.scale,Ki=null,Ri=null,pr=null,Jr=Rr,sr=0;pe===vn.vertical&&((ct=Gi)===12312||ct===12313||ct===12316||ct===12540||ct===12448)&&(pe=vn.horizontal);const lr=!(pe===vn.horizontal||!ye&&!nc(Gi)||ye&&(ep[Gi]||vd(Gi)));if(ui.image){const Fr=H.get(ui.image.toString());if(!Fr)continue;pr=ui.image,V.iconsInText=V.iconsInText||!0,Ri=Fr.paddedRect;const Mr=Fr.displaySize;Wi=Wi*Rr/Me,Ki={width:Mr[0],height:Mr[1],left:0,top:-ty,advance:lr?Mr[1]:Mr[0],localGlyph:!1},sr=xt?-Ki.height*Wi:Ft*Rr-17-Mr[1]*Wi,Jr=Ki.advance;const qn=(lr?Mr[0]:Mr[1])*Wi-Rr*Ft;qn>0&&qn>Yt&&(Yt=qn)}else{const Fr=$[ui.fontStack];if(!Fr)continue;Fr[Gi]&&(Ri=Fr[Gi]);const Mr=W[ui.fontStack];if(!Mr)continue;const qn=Mr.glyphs[Gi];if(!qn)continue;if(Ki=qn.metrics,Jr=Gi!==8203?Rr:0,xt){const Sa=Mr.ascender!==void 0?Math.abs(Mr.ascender):0,ns=Mr.descender!==void 0?Math.abs(Mr.descender):0,Ps=(Sa+ns)*Wi;oi<Ps&&(oi=Ps,mi=(Sa-ns)/2*Wi),sr=-Sa*Wi}else sr=(Ft-Wi)*Rr-17}lr?(V.verticalizable=!0,ri.push({glyph:Gi,image:pr,x:Te,y:Ae+sr,vertical:lr,scale:Wi,localGlyph:Ki.localGlyph,fontStack:ui.fontStack,sectionIndex:Bi,metrics:Ki,rect:Ri}),Te+=Jr*Wi+xe):(ri.push({glyph:Gi,image:pr,x:Te,y:Ae+sr,vertical:lr,scale:Wi,localGlyph:Ki.localGlyph,fontStack:ui.fontStack,sectionIndex:Bi,metrics:Ki,rect:Ri}),Te+=Ki.advance*Wi+xe)}ri.length!==0&&(et=Math.max(Te-xe,et),xt?oy(ri,Je,Yt,mi,Y*Ft/2):oy(ri,Je,Yt,0,Y/2)),Te=0;const Li=Y*Ft+Yt;Ut.lineOffset=Math.max(Yt,Kt),Ae+=Li,++st}var ct;const it=Ae,{horizontalAlign:zt,verticalAlign:_t}=em(le);(function(St,Ft,Kt,Ut,ri,Yt){const oi=(Ft-Kt)*ri,mi=-Yt*Ut;for(const Li of St)for(const Nt of Li.positionedGlyphs)Nt.x+=oi,Nt.y+=mi})(V.positionedLines,Je,zt,_t,et,it),V.top+=-_t*it,V.bottom=V.top+it,V.left+=-zt*et,V.right=V.left+et,V.hasBaseline=xt}(B,e,i,s,C,h,m,g,y,x,w,b),!function(V){for(const W of V)if(W.positionedGlyphs.length!==0)return!1;return!0}(k))return B}const ep={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},O1={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function iy(n,e,i,s,l,a){if(e.image){const h=s.get(e.image.toString());return h?h.displaySize[0]*e.scale*Rr/a+l:0}{const h=i[e.fontStack],m=h&&h.glyphs[n];return m?m.metrics.advance*e.scale+l:0}}function ry(n,e,i,s){const l=Math.pow(n-e,2);
vendor: 4,256 bytes, line 20
20return s?n<e?l/2:2*l:l+Math.abs(i)*i}function k1(n,e,i){let s=0;return n===10&&(s-=1e4),i&&(s+=150),n!==40&&n!==65288||(s+=50),e!==41&&e!==65289||(s+=50),s}function ny(n,e,i,s,l,a){let h=null,m=ry(e,i,l,a);for(const g of s){const x=ry(e-g.x,i,l,a)+g.badness;x<=m&&(h=g,m=x)}return{index:n,x:e,priorBreak:h,badness:m}}function sy(n){return n?sy(n.priorBreak).concat(n.index):[]}function em(n){let e=.5,i=.5;switch(n){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(n){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function oy(n,e,i,s,l){if(!(e||i||s||l))return;const a=n.length-1,h=n[a],m=(h.x+h.metrics.advance*h.scale)*e;for(let g=0;g<=a;g++)n[g].x-=m,n[g].y+=i+s+l}function F1(n,e,i,s){const{horizontalAlign:l,verticalAlign:a}=em(s),h=i[0]-n.displaySize[0]*l,m=i[1]-n.displaySize[1]*a;return{imagePrimary:n,imageSecondary:e,top:m,bottom:m+n.displaySize[1],left:h,right:h+n.displaySize[0]}}function ay(n,e,i,s,l,a){const h=n.imagePrimary;let m;if(h.content){const A=h.content,C=h.pixelRatio||1;m=[A[0]/C,A[1]/C,h.displaySize[0]-A[2]/C,h.displaySize[1]-A[3]/C]}const g=e.left*a,x=e.right*a;let p,y,w,v;i==="width"||i==="both"?(v=l[0]+g-s[3],y=l[0]+x+s[1]):(v=l[0]+(g+x-h.displaySize[0])/2,y=v+h.displaySize[0]);const b=e.top*a,S=e.bottom*a;return i==="height"||i==="both"?(p=l[1]+b-s[0],w=l[1]+S+s[2]):(p=l[1]+(b+S-h.displaySize[1])/2,w=p+h.displaySize[1]),{imagePrimary:h,imageSecondary:void 0,top:p,right:y,bottom:w,left:v,collisionPadding:m}}class Eo extends dt{constructor(e,i,s,l,a){super(e,i),this.angle=l,this.z=s,a!==void 0&&(this.segment=a)}clone(){return new Eo(this.x,this.y,this.z,this.angle,this.segment)}}function ly(n,e,i,s,l){if(e.segment===void 0)return!0;let a=e,h=e.segment+1,m=0;for(;m>-i/2;){if(h--,h<0)return!1;m-=n[h].dist(a),a=n[h]}m+=n[h].dist(n[h+1]),h++;const g=[];let x=0;for(;m<i/2;){const p=n[h],y=n[h+1];if(!y)return!1;let w=n[h-1].angleTo(p)-p.angleTo(y);for(w=Math.abs((w+3*Math.PI)%(2*Math.PI)-Math.PI),g.push({distance:m,angleDelta:w}),x+=w;m-g[0].distance>s;)x-=g.shift().angleDelta;if(x>l)return!1;h++,m+=p.dist(y)}return!0}function cy(n){let e=0;for(let i=0;i<n.length-1;i++)e+=n[i].dist(n[i+1]);return e}function uy(n,e,i){return n?.6*e*i:0}function hy(n,e){return Math.max(n?n.right-n.left:0,e?e.right-e.left:0)}function B1(n,e,i,s,l,a){const h=uy(i,l,a),m=hy(i,s)*a;let g=0;const x=cy(n)/2;for(let p=0;p<n.length-1;p++){const y=n[p],w=n[p+1],v=y.dist(w);if(g+v>x){const b=(x-g)/v,S=Ot(y.x,w.x,b),A=Ot(y.y,w.y,b),C=new Eo(S,A,0,w.angleTo(y),p);return!h||ly(n,C,m,h,e)?C:void 0}g+=v}}function N1(n,e,i,s,l,a,h,m,g){const x=uy(s,a,h),p=hy(s,l),y=p*h,w=n[0].x===0||n[0].x===g||n[0].y===0||n[0].y===g;return e-y<e/4&&(e=y+e/4),dy(n,w?e/2*m%e:(p/2+2*a)*h*m%e,e,x,i,y,w,!1,g)}function dy(n,e,i,s,l,a,h,m,g){const x=a/2,p=cy(n);let y=0,w=e-i,v=[];for(let b=0;b<n.length-1;b++){const S=n[b],A=n[b+1],C=S.dist(A),D=A.angleTo(S);for(;w+i<y+C;){w+=i;const L=(w-y)/C,z=Ot(S.x,A.x,L),k=Ot(S.y,A.y,L);if(z>=0&&z<g&&k>=0&&k<g&&w-x>=0&&w+x<=p){const B=new Eo(z,k,0,D,b);s&&!ly(n,B,a,s,l)||v.push(B)}}y+=C}return m||v.length||h||(v=dy(n,y/2,i,s,l,a,h,!0,g)),v}function py(n,e,i,s,l){const a=[];for(let h=0;h<n.length;h++){const m=n[h];let g;for(let x=0;x<m.length-1;x++){let p=m[x],y=m[x+1];p.x<e&&y.x<e||(p.x<e?p=new dt(e,p.y+(e-p.x)/(y.x-p.x)*(y.y-p.y))._round():y.x<e&&(y=new dt(e,p.y+(e-p.x)/(y.x-p.x)*(y.y-p.y))._round()),p.y<i&&y.y<i||(p.y<i?p=new dt(p.x+(i-p.y)/(y.y-p.y)*(y.x-p.x),i)._round():y.y<i&&(y=new dt(p.x+(i-p.y)/(y.y-p.y)*(y.x-p.x),i)._round()),p.x>=s&&y.x>=s||(p.x>=s?p=new dt(s,p.y+(s-p.x)/(y.x-p.x)*(y.y-p.y))._round():y.x>=s&&(y=new dt(s,p.y+(s-p.x)/(y.x-p.x)*(y.y-p.y))._round()),p.y>=l&&y.y>=l||(p.y>=l?p=new dt(p.x+(l-p.y)/(y.y-p.y)*(y.x-p.x),l)._round():y.y>=l&&(y=new dt(p.x+(l-p.y)/(y.y-p.y)*(y.x-p.x),l)._round()),g&&p.equals(g[g.length-1])||(g=[p],a.push(g)),g.push(y)))))}}return a}function fy(n){let e=0,i=0;for(const h of n)e+=h.w*h.h,i=Math.max(i,h.w);n.sort((h,m)=>m.h-h.h);const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let l=0,a=0;for(const h of n)for(let m=s.length-1;m>=0;m--){const g=s[m];if(!(h.w>g.w||h.h>
20g.h)){if(h.x=g.x,h.y=g.y,a=Math.max(a,h.y+h.h),l=Math.max(l,h.x+h.w),h.w===g.w&&h.h===g.h){const x=s.pop();m<s.length&&(s[m]=x)}else h.h===g.h?(g.x+=h.w,g.w-=h.w):h.w===g.w?(g.y+=h.h,g.h-=h.h):(s.push({x:g.x+h.w,y:g.y,w:g.w-h.w,h:h.h}),g.y+=h.h,g.h-=h.h);break}}return{w:l,h:a,fill:e/(l*a)||0}}vt(Eo,"Anchor");const Cc=1;class bh{static getImagePositionScale(e,i,s){if(i&&e&&e.options&&e.options.transform){const l=e.options.transform;return{x:l.a,y:l.d}}return{x:s,y:s}}constructor(e,i,s,l){this.paddedRect=e;const{pixelRatio:a,version:h,stretchX:m,stretchY:g,content:x,sdf:p,usvg:y}=i;this.pixelRatio=a,this.stretchX=m,this.stretchY=g,this.content=x,this.version=h,this.padding=s,this.sdf=p,this.scale=bh.getImagePositionScale(l,y,a)}get tl(){return[this.paddedRect.x+this.padding,this.paddedRect.y+this.padding]}get br(){return[this.paddedRect.x+this.paddedRect.w-this.padding,this.paddedRect.y+this.paddedRect.h-this.padding]}get displaySize(){return[(this.paddedRect.w-2*this.padding)/this.scale.x,(this.paddedRect.h-2*this.padding)/this.scale.y]}}function my(n,e,i){const s=Yn.parse(n),l=function(a,h,m=[1,1]){return{x:0,y:0,w:(a.data?a.data.width:a.width*m[0])+2*h,h:(a.data?a.data.height:a.height*m[1])+2*h}}(e,i,[s.options.transform.a,s.options.transform.d]);return{bin:l,imagePosition:new bh(l,e,i,s),imageVariant:s}}class _y{constructor(e,i,s){const l=new Map,a=new Map;this.haveRenderCallbacks=[];const h=[];this.addImages(e,l,Cc,h),this.addImages(i,a,2,h);const{w:m,h:g}=fy(h),x=new Pr({width:m||1,height:g||1});for(const[p,y]of e.entries()){const w=l.get(p).paddedRect;Pr.copy(y.data,x,{x:0,y:0},{x:w.x+Cc,y:w.y+Cc},y.data,s,y.sdf)}for(const[p,y]of i.entries()){const w=a.get(p),v=w.paddedRect;let b=w.padding;const S=v.x+b,A=v.y+b,C=y.data.width,D=y.data.height;b=b>1?b-1:b,Pr.copy(y.data,x,{x:0,y:0},{x:S,y:A},y.data,s),Pr.copy(y.data,x,{x:0,y:D-b},{x:S,y:A-b},{width:C,height:b},s),Pr.copy(y.data,x,{x:0,y:0},{x:S,y:A+D},{width:C,height:b},s),Pr.copy(y.data,x,{x:C-b,y:0},{x:S-b,y:A},{width:b,height:D},s),Pr.copy(y.data,x,{x:0,y:0},{x:S+C,y:A},{width:b,height:D},s),Pr.copy(y.data,x,{x:C-b,y:D-b},{x:S-b,y:A-b},{width:b,height:b},s),Pr.copy(y.data,x,{x:0,y:D-b},{x:S+C,y:A-b},{width:b,height:b},s),Pr.copy(y.data,x,{x:0,y:0},{x:S+C,y:A+D},{width:b,height:b},s),Pr.copy(y.data,x,{x:C-b,y:0},{x:S-b,y:A+D},{width:b,height:b},s)}this.lut=s,this.image=x,this.iconPositions=l,this.patternPositions=a}addImages(e,i,s,l){for(const[a,h]of e.entries()){const{bin:m,imagePosition:g,imageVariant:x}=my(a,h,s);i.set(a,g),l.push(m),h.hasRenderCallback&&this.haveRenderCallbacks.push(x.id)}}patchUpdatedImages(e,i,s){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(l=>e.hasImage(l,s)),e.dispatchRenderCallbacks(this.haveRenderCallbacks,s);for(const l of e.getUpdatedImages(s)){for(const a of this.iconPositions.keys()){const h=Yn.parse(a);if(Xr.isEqual(h.id,l)){const m=e.getImage(l,s);this.patchUpdatedImage(this.iconPositions.get(a),m,i)}}for(const a of this.patternPositions.keys()){const h=Yn.parse(a);if(Xr.isEqual(h.id,l)){const m=e.getImage(l,s);this.patchUpdatedImage(this.patternPositions.get(a),m,i)}}}}patchUpdatedImage(e,i,s){if(!e||!i||e.version===i.version)return;e.version=i.version;const[l,a]=e.tl,h=e.sdf;if(this.lut||h){const m={width:i.data.width,height:i.data.height},g=new Pr(m);Pr.copy(i.data,g,{x:0,y:0},{x:0,y:0},m,this.lut,h),s.update(g,{position:{x:l,y:a}})}else s.update(i.data,{position:{x:l,y:a}})}}vt(bh,"ImagePosition"),vt(_y,"ImageAtlas");const wh=1e20;function gy(n,e,i,s,l,a,h,m,g){for(let x=e;x<e+s;x++)yy(n,i*a+x,a,l,h,m,g);for(let x=i;x<i+l;x++)yy(n,x*a+e,1,s,h,m,g)}function yy(n,e,i,s,l,a,h){a[0]=0,h[0]=-wh,h[1]=wh,l[0]=n[e];for(let m=1,g=0,x=0;m<s;m++){l[m]=n[e+m*i];const p=m*m;do{const y=a[g];x=(l[m]-l[y]+p-y*y)/(m-y)/2}while(x<=h[g]&&--g>-1);g++,a[g]=m,h[g]=x,h[g+1]=wh}for(let m=0,g=0;m<s;m++){for(;h[g+1]<m;)g++;const x=a[g],p=m-x;n[e+m*i]=l[x]+p*p}}const Ms=2,tm={none:0,ideographs:1,all:2};class Pc{constructor(e,i,s){this.requestManager=e,this.localGlyphMode=i,this.localFontFamily=s,this.urls={},this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(e,i){this.urls[i]=e}getGlyphs(e,i,s){const l=[],a=this.urls[i]||j.GLYPHS_URL;for(const h in e)for(const m of e[h])l.push({stack:h,id:m});so(l,({stack:h,id:m},g)=>{let x=this.entries[h];x||(x=this.entries[h]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let p=x.glyphs[m];if(p!==void 0)return void g(null,{stack:h,id:m,glyph:p});if(p=this._tinySDF(x,h,m),p)return x.glyphs[m]=p,void g(null,{stack:h,id:m,glyph:p});const y=Math.floor(m/256);if(256*y>65535)return Hi("glyphs > 65535 not supported"),void g(null,{stack:h,id:m,glyph:p});if(x.ranges[y])return void g(null,{stack:h,id:m,glyph:p});let w=x.requests[y];w||(w=x.requests[y]=[],Pc.loadGlyphRange(h,y,a,this.requestManager,(v,b)=>{if(b){x.ascender=b.ascender,x.descender=b.descender;for(const S in b.glyphs)this._doesCharSupportLocalGlyph(+S)||(x.glyphs[+S]=b.glyphs[+S]);x.ranges[y]=!0}for(const S of w)S(v,b);delete x.requests[y]})),w.push((v,b)=>{v?g(v):b&&g(null,{stack:h,id:m,glyph:b.glyphs[m]||null})})},(h,m)=>{if(h)s(h);else if(m){const g={};for(const{stack:x,id:p,glyph:y}of m)g[x]===void 0&&(g[x]={}),g[x].glyphs===void 0&&(g[x].glyphs={}),g[x].glyphs[p]=y&&{id:y.id,bitmap:y.bitmap.clone(),metrics:y.metrics},g[x].ascender=this.entries[x].ascender,g[x].descender=this.entries[x].descender;s(null,g)}})}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==tm.none&&(this.localGlyphMode===tm.all?!!this.localFontFamily:!!this.localFontFamily&&
20(Rt["CJK Unified Ideographs"](e)||Rt["Hangul Syllables"](e)||Rt.Hiragana(e)||Rt.Katakana(e)||Rt["CJK Symbols and Punctuation"](e)||Rt["CJK Unified Ideographs Extension A"](e)||Rt["CJK Unified Ideographs Extension B"](e)||Rt.Osage(e)))}_tinySDF(e,i,s){const l=this.localFontFamily;if(!l||!this._doesCharSupportLocalGlyph(s))return;let a=e.tinySDF;if(!a){let S="400";/bold/i.test(i)?S="900":/medium/i.test(i)?S="500":/light/i.test(i)&&(S="200"),a=e.tinySDF=new Pc.TinySDF({fontFamily:l,fontWeight:S,fontSize:24*Ms,buffer:3*Ms,radius:8*Ms}),a.fontWeight=S}if(this.localGlyphs[a.fontWeight][s])return this.localGlyphs[a.fontWeight][s];const h=String.fromCodePoint(s),{data:m,width:g,height:x,glyphWidth:p,glyphHeight:y,glyphLeft:w,glyphTop:v,glyphAdvance:b}=a.draw(h);return this.localGlyphs[a.fontWeight][s]={id:s,bitmap:new _a({width:g,height:x},m),metrics:{width:p/Ms,height:y/Ms,left:w/Ms,top:v/Ms-27,advance:b/Ms,localGlyph:!0}}}}Pc.loadGlyphRange=function(n,e,i,s,l){const a=256*e,h=a+255,m=s.transformRequest(s.normalizeGlyphsURL(i).replace("{fontstack}",n).replace("{range}",`${a}-${h}`),vr.Glyphs);as(m,(g,x)=>{if(g)l(g);else if(x){const p={},y=function(w){return new Qd(w).readFields(z1,{})}(x);for(const w of y.glyphs)p[w.id]=w;l(null,{glyphs:p,ascender:y.ascender,descender:y.descender})}})},Pc.TinySDF=class{constructor({fontSize:n=24,buffer:e=3,radius:i=8,cutoff:s=.25,fontFamily:l="sans-serif",fontWeight:a="normal",fontStyle:h="normal"}={}){this.buffer=e,this.cutoff=s,this.radius=i;const m=this.size=n+4*e,g=this._createCanvas(m),x=this.ctx=g.getContext("2d",{willReadFrequently:!0});x.font=`${h} ${a} ${n}px ${l}`,x.textBaseline="alphabetic",x.textAlign="left",x.fillStyle="black",this.gridOuter=new Float64Array(m*m),this.gridInner=new Float64Array(m*m),this.f=new Float64Array(m),this.z=new Float64Array(m+1),this.v=new Uint16Array(m)}_createCanvas(n){const e=document.createElement("canvas");return e.width=e.height=n,e}draw(n){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:s,actualBoundingBoxLeft:l,actualBoundingBoxRight:a}=this.ctx.measureText(n),h=Math.ceil(i),m=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(a-l))),g=Math.min(this.size-this.buffer,h+Math.ceil(s)),x=m+2*this.buffer,p=g+2*this.buffer,y=Math.max(x*p,0),w=new Uint8ClampedArray(y),v={data:w,width:x,height:p,glyphWidth:m,glyphHeight:g,glyphTop:h,glyphLeft:0,glyphAdvance:e};if(m===0||g===0)return v;const{ctx:b,buffer:S,gridInner:A,gridOuter:C}=this;b.clearRect(S,S,m,g),b.fillText(n,S,S+h);const D=b.getImageData(S,S,m,g);C.fill(wh,0,y),A.fill(0,0,y);for(let L=0;L<g;L++)for(let z=0;z<m;z++){const k=D.data[4*(L*m+z)+3]/255;if(k===0)continue;const B=(L+S)*x+z+S;if(k===1)C[B]=0,A[B]=wh;else{const V=.5-k;C[B]=V>0?V*V:0,A[B]=V<0?V*V:0}}gy(C,0,0,x,p,x,this.f,this.v,this.z),gy(A,S,S,m,g,x,this.f,this.v,this.z);for(let L=0;L<y;L++){const z=Math.sqrt(C[L])-Math.sqrt(A[L]);w[L]=Math.round(255-255*(z/this.radius+this.cutoff))}return v}};const va=Cc;function vy(n,e){return n+e[1]-e[0]}function xy(n,e,i,s,l=1){const a=[],h=n.imagePrimary,m=h.pixelRatio,g=h.paddedRect.w-2*va,x=h.paddedRect.h-2*va,p=(n.right-n.left)*l,y=(n.bottom-n.top)*l,w=h.stretchX||[[0,g]],v=h.stretchY||[[0,x]],b=w.reduce(vy,0),S=v.reduce(vy,0),A=g-b,C=x-S;let D=0,L=b,z=0,k=S,B=0,V=A,W=0,$=C;if(h.content&&s){const ae=h.content;D=tp(w,0,ae[0]),z=tp(v,0,ae[1]),L=tp(w,ae[0],ae[2]),k=tp(v,ae[1],ae[3]),B=ae[0]-D,W=ae[1]-z,V=ae[2]-ae[0]-L,$=ae[3]-ae[1]-k}const H=(ae,Y,le,_e)=>{const pe=ip(ae.stretch-D,L,p,n.left*l),xe=rp(ae.fixed-B,V,ae.stretch,b),ye=ip(Y.stretch-z,k,y,n.top*l),Me=rp(Y.fixed-W,$,Y.stretch,S),Te=ip(le.stretch-D,L,p,n.left*l),Ae=rp(le.fixed-B,V,le.stretch,b),et=ip(_e.stretch-z,k,y,n.top*l),Je=rp(_e.fixed-W,$,_e.stretch,S),xt=new dt(pe,ye),st=new dt(Te,ye),ct=new dt(Te,et),it=new dt(pe,et),zt=new dt(xe/m,Me/m),_t=new dt(Ae/m,Je/m),St=e*Math.PI/180;if(St){const oi=Math.sin(St),mi=Math.cos(St),Li=[mi,-oi,oi,mi];xt._matMult(Li),st._matMult(Li),it._matMult(Li),ct._matMult(Li)}const Ft=ae.stretch+ae.fixed,Kt=le.stretch+le.fixed,Ut=Y.stretch+Y.fixed,ri=_e.stretch+_e.fixed,Yt=n.imageSecondary;
20return{tl:xt,tr:st,bl:it,br:ct,texPrimary:{x:h.paddedRect.x+va+Ft,y:h.paddedRect.y+va+Ut,w:Kt-Ft,h:ri-Ut},texSecondary:Yt?{x:Yt.paddedRect.x+va+Ft,y:Yt.paddedRect.y+va+Ut,w:Kt-Ft,h:ri-Ut}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:zt,pixelOffsetBR:_t,minFontScaleX:V/m/p,minFontScaleY:$/m/y,isSDF:i}};if(s&&(h.stretchX||h.stretchY)){const ae=by(w,A,b),Y=by(v,C,S);for(let le=0;le<ae.length-1;le++){const _e=ae[le],pe=ae[le+1];for(let xe=0;xe<Y.length-1;xe++)a.push(H(_e,Y[xe],pe,Y[xe+1]))}}else a.push(H({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:g+1},{fixed:0,stretch:x+1}));return a}function tp(n,e,i){let s=0;for(const l of n)s+=Math.max(e,Math.min(i,l[1]))-Math.max(e,Math.min(i,l[0]));return s}function by(n,e,i){const s=[{fixed:-va,stretch:0}];for(const[l,a]of n){const h=s[s.length-1];s.push({fixed:l-h.stretch,stretch:h.stretch}),s.push({fixed:l-h.stretch,stretch:h.stretch+(a-l)})}return s.push({fixed:e+va,stretch:i}),s}function ip(n,e,i,s){return n/e*i+s}function rp(n,e,i,s){return n-e*i/s}function V1(n,e,i,s){const l=e+n.positionedLines[s].lineOffset;return s===0?i+l/2:i+(l+(e+n.positionedLines[s-1].lineOffset))/2}function U1(n,e=1,i=!1){let s=1/0,l=1/0,a=-1/0,h=-1/0;const m=n[0];for(let v=0;v<m.length;v++){const b=m[v];(!v||b.x<s)&&(s=b.x),(!v||b.y<l)&&(l=b.y),(!v||b.x>a)&&(a=b.x),(!v||b.y>h)&&(h=b.y)}const g=Math.min(a-s,h-l);let x=g/2;const p=new Ua([],j1);if(g===0)return new dt(s,l);for(let v=s;v<a;v+=g)for(let b=l;b<h;b+=g)p.push(new Rc(v+x,b+x,x,n));let y=function(v){let b=0,S=0,A=0;const C=v[0];for(let D=0,L=C.length,z=L-1;D<L;z=D++){const k=C[D],B=C[z],V=k.x*B.y-B.x*k.y;S+=(k.x+B.x)*V,A+=(k.y+B.y)*V,b+=3*V}return new Rc(S/b,A/b,0,v)}(n),w=p.length;for(;p.length;){const v=p.pop();(v.d>y.d||!y.d)&&(y=v,i&&console.log("found best %d after %d probes",Math.round(1e4*v.d)/1e4,w)),v.max-y.d<=e||(x=v.h/2,p.push(new Rc(v.p.x-x,v.p.y-x,x,n)),p.push(new Rc(v.p.x+x,v.p.y-x,x,n)),p.push(new Rc(v.p.x-x,v.p.y+x,x,n)),p.push(new Rc(v.p.x+x,v.p.y+x,x,n)),w+=4)}return i&&(console.log(`num probes: ${w}`),console.log(`best distance: ${y.d}`)),y.p}function j1(n,e){return e.max-n.max}class Rc{constructor(e,i,s,l){this.p=new dt(e,i),this.h=s,this.d=function(a,h){let m=!1,g=1/0;for(let x=0;x<h.length;x++){const p=h[x];for(let y=0,w=p.length,v=w-1;y<w;v=y++){const b=p[y],S=p[v];b.y>a.y!=S.y>a.y&&a.x<(S.x-b.x)*(a.y-b.y)/(S.y-b.y)+b.x&&(m=!m),g=Math.min(g,oe(a,b,S))}}return(m?1:-1)*Math.sqrt(g)}(this.p,l),this.max=this.d+this.h*Math.SQRT2}}const im=Number.POSITIVE_INFINITY,q1=Math.sqrt(2);function wy(n,[e,i]){let s=0,l=0;if(i===im){e<0&&(e=0);const a=e/q1;switch(n){case"top-right":case"top-left":l=a-7;break;case"bottom-right":case"bottom-left":l=7-a;break;case"bottom":l=7-e;break;case"top":l=e-7}switch(n){case"top-right":case"bottom-right":s=-a;break;case"top-left":case"bottom-left":s=a;break;case"left":s=e;break;case"right":s=-e}}else{switch(e=Math.abs(e),i=Math.abs(i),n){case"top-right":case"top-left":case"top":l=i-7;break;case"bottom-right":case"bottom-left":case"bottom":l=7-i}switch(n){case"top-right":case"bottom-right":case"right":s=-e;break;case"top-left":case"bottom-left":case"left":s=e}}return[s,l]}function Ty(n,e,i,s,l,a,h,m){if(!n)return;const g=Kg(e,i,s,l,a);return n.scaleSelf(g*m*h)}function Sy(n,e,i,s,l,a,h,m){return{iconPrimary:Ty(n.getPrimary(),e,i,s,l,a,h,m),iconSecondary:Ty(n.getSecondary(),e,i,s,l,a,h,m)}}function Ey(n,e,i,s){if(!n)return;const l=e.get(i.toString());if(n.imagePrimary=l,s){const a=e.get(s.toString());n.imageSecondary=a}}function G1(n,e){for(const i in n.horizontal)My(n.horizontal[i],e);My(n.vertical,e)}function My(n,e){if(n){for(const i of n.positionedLines)for(const s of i.positionedGlyphs)if(s.image!==null){const l=s.image.toString();s.rect=e.get(l).paddedRect}}}function rm(n){switch(n){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function $1(n,e,i,s,l,a,h,m,g){const x=nm(a.horizontal)||a.vertical,p=i.get("icon-text-fit-padding").evaluate(s,{},l);let y,w=e;return e&&g!=="none"&&(n.allowVerticalPlacement&&a.vertical&&(y=ay(e,a.vertical,g,p,m,h)),x&&(w=ay(e,x,g,p,m,h))),{defaultShapedIcon:w,verticallyShapedIcon:y}}function H1(n,e,i,s,l,a,h,m,g,x,p,y,w,v,b,S,A,C,D,L){let z=h.textMaxSize.evaluate(e,{},w);z===void 0?z=m*h.textScaleFactor:z*=h.textScaleFactor;
20const k=n.layers[0].layout,B=nm(i.horizontal)||i.vertical,V=v.name==="globe",W=Rr,$=n.tilePixelRatio*z/W,H=(xe=n.overscaling,n.zoom>18&&xe>2&&(xe>>=1),Math.max(ht/(512*xe),1)*k.get("symbol-spacing")),ae=k.get("text-padding")*n.tilePixelRatio,Y=k.get("icon-padding")*n.tilePixelRatio,le=hi(k.get("text-max-angle")),_e=k.get("icon-rotation-alignment")==="map"&&L!=="point",pe=H/2;var xe;n.hasAnyIconTextFit===!1&&A!=="none"&&(n.hasAnyIconTextFit=!0);const ye=e.properties?+e.properties[ml]:null,Me=ye&&n.elevationFeatureIdToIndex?n.elevationFeatureIdToIndex.get(ye):65535,Te=(Ae,et,Je)=>{if(et.x<0||et.x>=ht||et.y<0||et.y>=ht)return;let xt=null;if(V){const{x:st,y:ct,z:it}=v.projectTilePoint(et.x,et.y,Je);xt={anchor:new Eo(st,ct,it,0,void 0),up:v.upVector(Je,et.x,et.y)}}(function(st,ct,it,zt,_t,St,Ft,Kt,Ut,ri,Yt,oi,mi,Li,Nt,ui,Bi,Gi,Wi,Ki,Ri,pr,Jr,sr,lr,Fr,Mr,qn,Sa){const ns=st.addToLineVertexArray(ct,zt);let Ps,Ea,Ma,wl,lx,cx,ux,hx=0,dx=0,px=0,fx=0,Fm=-1,Bm=-1;const Js={};let mx=dn("");const Tl=it?it.anchor:ct,Nm=qn!=="none";let Vm=0,Um=0;if(Ut._unevaluatedLayout.getValue("text-radial-offset")===void 0?[Vm,Um]=Ut.layout.get("text-offset").evaluate(Ri,{},lr).map(Gn=>Gn*Rr):(Vm=Ut.layout.get("text-radial-offset").evaluate(Ri,{},lr)*Rr,Um=im),st.allowVerticalPlacement&&_t.vertical){const Gn=_t.vertical;if(Nt)cx=sm(Gn),Kt&&(ux=sm(Kt));else{const xn=Ut.layout.get("text-rotate").evaluate(Ri,{},lr)+90;Ma=np(ri,Tl,ct,Yt,oi,mi,Gn,Li,xn,ui),Kt&&(wl=np(ri,Tl,ct,Yt,oi,mi,Kt,Gi,xn))}}if(St){const Gn=st.iconSizeData,xn=Ut.layout.get("icon-rotate").evaluate(Ri,{},lr),Uh=xy(St,xn,Jr,Nm,pr.iconScaleFactor),qm=Kt?xy(Kt,xn,Jr,Nm,pr.iconScaleFactor):void 0;Ea=np(ri,Tl,ct,Yt,oi,mi,St,Gi,xn,null),hx=4*Uh.length;let Sl=null;Gn.kind==="source"?(Sl=[Es*Ut.layout.get("icon-size").evaluate(Ri,{},lr)*pr.iconScaleFactor],Sl[0]>xa&&Hi(`${st.layerIds[0]}: Value for "icon-size" is >= ${Th}. Reduce your "icon-size".`)):Gn.kind==="composite"&&(Sl=[Es*pr.compositeIconSizes[0].evaluate(Ri,{},lr)*pr.iconScaleFactor,Es*pr.compositeIconSizes[1].evaluate(Ri,{},lr)*pr.iconScaleFactor],(Sl[0]>xa||Sl[1]>xa)&&Hi(`${st.layerIds[0]}: Value for "icon-size" is >= ${Th}. Reduce your "icon-size".`)),st.addSymbols(st.icon,Uh,Sl,Ki,Wi,Ri,!1,it,ct,ns.lineStartIndex,ns.lineLength,-1,sr,lr,Fr,Mr),Fm=st.icon.placedSymbolArray.length-1,qm&&(dx=4*qm.length,st.addSymbols(st.icon,qm,Sl,Ki,Wi,Ri,vn.vertical,it,ct,ns.lineStartIndex,ns.lineLength,-1,sr,lr,Fr,Mr),Bm=st.icon.placedSymbolArray.length-1)}for(const Gn in _t.horizontal){const xn=_t.horizontal[Gn];Ps||(mx=dn(xn.text),Nt?lx=sm(xn):Ps=np(ri,Tl,ct,Yt,oi,mi,xn,Li,Ut.layout.get("text-rotate").evaluate(Ri,{},lr),ui));const Uh=xn.positionedLines.length===1;if(px+=Iy(st,it,ct,xn,Ft,Ut,Nt,Ri,ui,ns,_t.vertical?vn.horizontal:vn.horizontalOnly,Uh?Object.keys(_t.horizontal):[Gn],Js,Fm,pr,sr,lr,Fr),Uh)break}_t.vertical&&(fx+=Iy(st,it,ct,_t.vertical,Ft,Ut,Nt,Ri,ui,ns,vn.vertical,["vertical"],Js,Bm,pr,sr,lr,Fr));let Ia=-1;const jm=(Gn,xn)=>Gn?Math.max(Gn,xn):xn;Ia=jm(lx,Ia),Ia=jm(cx,Ia),Ia=jm(ux,Ia);const Sw=Ia>-1?1:0;st.glyphOffsetArray.length>=65535&&Hi("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Ri.sortKey!==void 0&&st.addToSortKeyRanges(st.symbolInstances.length,Ri.sortKey),st.symbolInstances.emplaceBack(ct.x,ct.y,Tl.x,Tl.y,Tl.z,Js.right>=0?Js.right:-1,Js.center>=0?Js.center:-1,Js.left>=0?Js.left:-1,Js.vertical>=0?Js.vertical:-1,Fm,Bm,mx,Ps!==void 0?Ps:st.collisionBoxArray.length,Ps!==void 0?Ps+1:st.collisionBoxArray.length,Ma!==void 0?Ma:st.collisionBoxArray.length,Ma!==void 0?Ma+1:st.collisionBoxArray.length,Ea!==void 0?Ea:st.collisionBoxArray.length,Ea!==void 0?Ea+1:st.collisionBoxArray.length,wl||st.collisionBoxArray.length,wl?wl+1:st.collisionBoxArray.length,Yt,px,fx,hx,dx,Sw,0,Vm,Um,Ia,0,Nm?1:0,Sa)})(n,et,xt,Ae,i,s,a,l,n.layers[0],n.collisionBoxArray,e.index,e.sourceLayerIndex,n.index,ae,D,x,0,Y,_e,C,e,h,p,y,w,b,S,A,Me)};if(L==="line")for(const Ae of py(e.geometry,0,0,ht,ht)){const et=N1(Ae,H,le,i.vertical||B,s,W,$,n.overscaling,ht);for(const Je of et)B&&Z1(n,B.text,pe,Je)||Te(Ae,Je,w)}else if(L==="line-center"){for(const Ae of e.geometry)if(Ae.length>1){const et=B1(Ae,le,i.vertical||B,s,W,$);et&&Te(Ae,et,w)}}else if(e.type==="Polygon")for(const Ae of $d(e.geometry,0)){const et=U1(Ae,16);Te(Ae[0],new Eo(et.x,et.y,0,0,void 0),w)}else if(e.type==="LineString")for(const Ae of e.geometry)Te(Ae,new Eo(Ae[0].x,Ae[0].y,0,0,void 0),w);else if(e.type==="Point")for(const Ae of e.geometry)for(const et of Ae)Te([et],new Eo(et.x,et.y,0,0,void 0),w)}const Th=255,xa=Th*Es;function Iy(n,e,i,s,l,a,h,m,g,x,p,y,w,v,b,S,A,C){const D=function(k,B,V,W,$,H,ae,Y){const le=[];
20if(B.positionedLines.length===0)return le;const _e=W.layout.get("text-rotate").evaluate(H,{})*Math.PI/180,pe=function(Ae){const et=Ae[0],Je=Ae[1],xt=et*Je;return xt>0?[et,-Je]:xt<0?[-et,Je]:et===0?[Je,et]:[Je,-et]}(V);let xe=Math.abs(B.top-B.bottom);for(const Ae of B.positionedLines)xe-=Ae.lineOffset;const ye=B.positionedLines.length,Me=xe/ye;let Te=B.top-V[1];for(let Ae=0;Ae<ye;++Ae){const et=B.positionedLines[Ae];Te=V1(B,Me,Te,Ae);for(const Je of et.positionedGlyphs){if(!Je.rect)continue;const xt=Je.rect||{};let st=ty+1,ct=!0,it=1,zt=0;if(Je.image){const Ri=ae.get(Je.image.toString());if(!Ri)continue;if(Ri.sdf){Hi("SDF images are not supported in formatted text and will be ignored.");continue}ct=!1,it=Ri.pixelRatio,st=Cc/it}const _t=($||Y)&&Je.vertical,St=Je.metrics.advance*Je.scale/2,Ft=Je.metrics,Kt=Je.rect;if(Kt===null)continue;Y&&B.verticalizable&&(zt=Je.image?St-Je.metrics.width*Je.scale/2:0);const Ut=$?[Je.x+St,Je.y]:[0,0];let ri=[0,0],Yt=[0,0],oi=!1;$||(_t?(Yt=[Je.x+St+pe[0],Je.y+pe[1]-zt],oi=!0):ri=[Je.x+St+V[0],Je.y+V[1]-zt]);const mi=Kt.w*Je.scale/(it*(Je.localGlyph?Ms:1)),Li=Kt.h*Je.scale/(it*(Je.localGlyph?Ms:1));let Nt,ui,Bi,Gi;if(_t){const Ri=Je.y-Te,pr=new dt(-St,St-Ri),Jr=-Math.PI/2,sr=new dt(...Yt);Nt=new dt(-St+ri[0],ri[1]),Nt._rotateAround(Jr,pr)._add(sr),Nt.x+=-Ri+St,Nt.y-=(Ft.left-st)*Je.scale;const lr=Je.image?Ft.advance*Je.scale:Rr*Je.scale,Fr=String.fromCodePoint(Je.glyph);C1(Fr)?Nt.x+=(1-st)*Je.scale:P1(Fr)?Nt.x+=lr-Ft.height*Je.scale+(-st-1)*Je.scale:Nt.x+=Je.image||Ft.width+2*st===Kt.w&&Ft.height+2*st===Kt.h?(lr-Li)/2:(lr-(Ft.height+2*st)*Je.scale)/2,ui=new dt(Nt.x,Nt.y-mi),Bi=new dt(Nt.x+Li,Nt.y),Gi=new dt(Nt.x+Li,Nt.y-mi)}else{const Ri=(Ft.left-st)*Je.scale-St+ri[0],pr=(-Ft.top-st)*Je.scale+ri[1],Jr=Ri+mi,sr=pr+Li;Nt=new dt(Ri,pr),ui=new dt(Jr,pr),Bi=new dt(Ri,sr),Gi=new dt(Jr,sr)}if(_e){let Ri;Ri=$?new dt(0,0):oi?new dt(pe[0],pe[1]):new dt(V[0],V[1]),Nt._rotateAround(_e,Ri),ui._rotateAround(_e,Ri),Bi._rotateAround(_e,Ri),Gi._rotateAround(_e,Ri)}const Wi=new dt(0,0),Ki=new dt(0,0);le.push({tl:Nt,tr:ui,bl:Bi,br:Gi,texPrimary:xt,texSecondary:void 0,writingMode:B.writingMode,glyphOffset:Ut,sectionIndex:Je.sectionIndex,isSDF:ct,pixelOffsetTL:Wi,pixelOffsetBR:Ki,minFontScaleX:0,minFontScaleY:0})}}return le}(0,s,g,a,h,m,l,n.allowVerticalPlacement),L=n.textSizeData;let z=null;L.kind==="source"?(z=[Es*a.layout.get("text-size").evaluate(m,{},A)*b.textScaleFactor],z[0]>xa&&Hi(`${n.layerIds[0]}: Value for "text-size" is >= ${Th}. Reduce your "text-size".`)):L.kind==="composite"&&(z=[Es*b.compositeTextSizes[0].evaluate(m,{},A)*b.textScaleFactor,Es*b.compositeTextSizes[1].evaluate(m,{},A)*b.textScaleFactor],(z[0]>xa||z[1]>xa)&&Hi(`${n.layerIds[0]}: Value for "text-size" is >= ${Th}. Reduce your "text-size".`)),n.addSymbols(n.text,D,z,g,h,m,p,e,i,x.lineStartIndex,x.lineLength,v,S,A,C,!1);for(const k of y)w[k]=n.text.placedSymbolArray.length-1;return 4*D.length}function nm(n){for(const e in n)return n[e];return null}function np(n,e,i,s,l,a,h,m,g,x){let p=h.top,y=h.bottom,w=h.left,v=h.right;const b=h.collisionPadding;if(b&&(w-=b[0],p-=b[1],v+=b[2],y+=b[3]),g){const S=new dt(w,p),A=new dt(v,p),C=new dt(w,y),D=new dt(v,y),L=hi(g);let z=new dt(0,0);x&&(z=new dt(x[0],x[1])),S._rotateAround(L,z),A._rotateAround(L,z),C._rotateAround(L,z),D._rotateAround(L,z),w=Math.min(S.x,A.x,C.x,D.x),v=Math.max(S.x,A.x,C.x,D.x),p=Math.min(S.y,A.y,C.y,D.y),y=Math.max(S.y,A.y,C.y,D.y)}return n.emplaceBack(e.x,e.y,e.z,i.x,i.y,w,p,v,y,m,s,l,a),n.length-1}function sm(n){n.collisionPadding&&(n.top-=n.collisionPadding[1],n.bottom+=n.collisionPadding[3]);const e=n.bottom-n.top;return e>0?Math.max(10,e):null}function Z1(n,e,i,s){const l=n.compareText;if(e in l){const a=l[e];for(let h=a.length-1;h>=0;h--)if(s.dist(a[h])<i)return!0}else l[e]=[];return l[e].push(s),!1}function Ay(n,e){const i=n.fovAboveCenter,s=n.elevation?n.elevation.getMinElevationBelowMSL()*e:0,l=(n._camera.position[2]*n.worldSize-s)/Math.cos(n._pitch),a=Math.sin(i)*l/Math.sin(Math.max(Math.PI/2-n._pitch-i,.01));let h=Math.sin(n._pitch)*a+l;const m=l*(1/n._horizonShift);if(!n.elevation||n.elevation.exaggeration()===0){let g=Math.max(n.zoom-17,0);n.isOrthographic&&(g/=10),h*=1+g}return Math.min(1.01*h,m)}function Sh(n,e){if(!e.isReprojectedInTileSpace)return{scale:1<<n.z,x:n.x,y:n.y,x2:n.x+1,y2:n.y+1,projection:e};const i=Math.pow(2,-n.z),s=n.x*i,l=(n.x+1)*i,a=n.y*i,h=(n.y+1)*i,m=on(s),g=
vendor: 6,460 bytes, line 20
20on(l),x=Sr(a),p=Sr(h),y=e.project(m,x),w=e.project(g,x),v=e.project(g,p),b=e.project(m,p);let S=Math.min(y.x,w.x,v.x,b.x),A=Math.min(y.y,w.y,v.y,b.y),C=Math.max(y.x,w.x,v.x,b.x),D=Math.max(y.y,w.y,v.y,b.y);const L=i/16;function z(B,V,W,$,H,ae){const Y=(W+H)/2,le=($+ae)/2,_e=e.project(on(Y),Sr(le)),pe=Math.max(0,S-_e.x,A-_e.y,_e.x-C,_e.y-D);S=Math.min(S,_e.x),C=Math.max(C,_e.x),A=Math.min(A,_e.y),D=Math.max(D,_e.y),pe>L&&(z(B,_e,W,$,Y,le),z(_e,V,Y,le,H,ae))}z(y,w,s,a,l,a),z(w,v,l,a,l,h),z(v,b,l,h,s,h),z(b,y,s,h,s,a),S-=L,A-=L,C+=L,D+=L;const k=1/Math.max(C-S,D-A);return{scale:k,x:S*k,y:A*k,x2:C*k,y2:D*k,projection:e}}function Cy(n,{x:e,y:i},s=0){return new dt(((e-s)*n.scale-n.x)*ht,(i*n.scale-n.y)*ht)}const W1=X.mat4.identity(new Float32Array(16));class ba{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 vi(0,0)}projectTilePoint(e,i,s){return{x:e,y:i,z:0}}locationPoint(e,i,s,l=!0){return e._coordinatePoint(e.locationCoordinate(i,s),l)}pixelsPerMeter(e,i){return Cr(1,e)*i}pixelSpaceConversion(e,i,s){return 1}farthestPixelDistance(e){return Ay(e,e.pixelsPerMeter)}pointCoordinate(e,i,s,l){const a=e.horizonLineFromTop(!1),h=new dt(i,Math.max(a,s));return e.rayIntersectionCoordinate(e.pointRayIntersection(h,l))}pointCoordinate3D(e,i,s){const l=new dt(i,s);if(e.elevation)return e.elevation.pointCoordinate(l);{const a=this.pointCoordinate(e,l.x,l.y,0);return[a.x,a.y,a.z]}}isPointAboveHorizon(e,i){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,i.x,i.y);const s=e.horizonLineFromTop();return i.y<s}createInversionMatrix(e,i){return W1}createTileMatrix(e,i,s){let l,a,h;const m=s.canonical,g=X.mat4.identity(new Float64Array(16));if(this.isReprojectedInTileSpace){const x=Sh(m,this);l=1,a=x.x+s.wrap*x.scale,h=x.y,X.mat4.scale(g,g,[l/x.scale,l/x.scale,e.pixelsPerMeter/i])}else l=i/e.zoomScale(m.z),a=(m.x+Math.pow(2,m.z)*s.wrap)*l,h=m.y*l;return X.mat4.translate(g,g,[a,h,0]),X.mat4.scale(g,g,[l/ht,l/ht,1]),g}upVector(e,i,s){return[0,0,1]}upVectorScale(e,i,s){return{metersToTile:1}}}class X1 extends ba{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];const[i,s]=this.parallels=e.parallels||[29.5,45.5],l=Math.sin(hi(i));this.n=(l+Math.sin(hi(s)))/2,this.c=1+l*(2*this.n-l),this.r0=Math.sqrt(this.c)/this.n}project(e,i){const{n:s,c:l,r0:a}=this,h=hi(e-this.center[0]),m=hi(i),g=Math.sqrt(l-2*s*Math.sin(m))/s;return{x:g*Math.sin(h*s),y:g*Math.cos(h*s)-a,z:0}}unproject(e,i){const{n:s,c:l,r0:a}=this,h=a+i;let m=Math.atan2(e,Math.abs(h))*Math.sign(h);h*s<0&&(m-=Math.PI*Math.sign(e)*Math.sign(h));const g=hi(this.center[0])*s;m=Os(m,-Math.PI-g,Math.PI-g);const x=Qt(gr(m/s)+this.center[0],-180,180),p=Math.asin(Qt((l-(e*e+h*h)*s*s)/(2*s),-1,1)),y=Qt(gr(p),-tr,tr);return new vi(x,y)}}const Eh=1.340264,Mh=-.081106,Ih=893e-6,Ah=.003796,sp=Math.sqrt(3)/2;class Y1 extends ba{project(e,i){i=i/180*Math.PI,e=e/180*Math.PI;const s=Math.asin(sp*Math.sin(i)),l=s*s,a=l*l*l;return{x:.5*(e*Math.cos(s)/(sp*(Eh+3*Mh*l+a*(7*Ih+9*Ah*l)))/Math.PI+.5),y:1-.5*(s*(Eh+Mh*l+a*(Ih+Ah*l))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let s=i=(2*(1-i)-1)*Math.PI,l=s*s,a=l*l*l;for(let p,y,w,v=0;v<12&&(y=s*(Eh+Mh*l+a*(Ih+Ah*l))-i,w=Eh+3*Mh*l+a*(7*Ih+9*Ah*l),p=y/w,s=Qt(s-p,-Math.PI/3,Math.PI/3),l=s*s,a=l*l*l,!(Math.abs(p)<1e-12));++v);const h=sp*e*(Eh+3*Mh*l+a*(7*Ih+9*Ah*l))/Math.cos(s),m=Math.asin(Math.sin(s)/sp),g=Qt(180*h/Math.PI,-180,180),x=Qt(180*m/Math.PI,-tr,tr);return new vi(g,x)}}class K1 extends ba{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){const s=360*(e-.5),l=Qt(360*(.5-i),-tr,tr);return new vi(s,l)}}const zc=Math.PI/2;function op(n){return Math.tan((zc+n)/2)}class J1 extends ba{constructor(e){super(e),this.center=e.center||[0,30];const[i,s]=this.parallels=e.parallels||[30,30];let l=hi(i),a=hi(s);this.southernCenter=l+a<0,this.southernCenter&&(l=-l,a=-a);const h=Math.cos(l),m=op(l);this.n=l===a?Math.sin(l):Math.log(h/Math.cos(a))/Math.log(op(a)/m),this.f=h*Math.pow(op(l),this.n)/this.n}project(e,i){i=hi(i),this.southernCenter&&(i=-i),e=hi(e-this.center[0]);const s=1e-6,{n:l,f:a}=this;a>0?i<-zc+s&&(i=-zc+s):i>zc-s&&(i=zc-s);const h=a/Math.pow(op(i),l);let m=h*Math.sin(l*e),g=a-h*Math.cos(l*e);return m=.5*(m/Math.PI+.5),g=.5*(g/Math.PI+.5),{x:m,y:this.southernCenter?g:1-g,z:0}}unproject(e,i){e=(2*e-.5)*Math.PI,this.southernCenter&&(i=1-i),i=(2*(1-i)-.5)*Math.PI;const{n:s,f:l}=this,a=l-i,h=Math.sign(a),m=Math.sign(s)*Math.sqrt(e*e+a*a);let g=Math.atan2(e,Math.abs(a))*h;a*s<0&&(g-=Math.PI*Math.sign(e)*h);const x=Qt(gr(g/s)+this.center[0],-180,180),p=Qt(gr(2*Math.atan(Math.pow(l/m,1/s))-zc),-tr,tr);return new vi(x,this.southernCenter?-p:p)}}class Py extends ba{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(e,i){return{x:es(e),y:sn(i),z:0}}unproject(e,i){const s=on(e),l=Sr(i);return new vi(s,l)}}const Ry=hi(tr);class Q1 extends ba{project(e,i){const s=(i=hi(i))*i,l=s*s;return{x:.5*((e=hi(e))*(.8707-.131979*s+l*(l*(.003971*s-.001529*l)-.013791))/Math.PI+.5),y:1-.5*(i*(1.007226+s*(.015085+l*(.028874*s-.044475-.005916*l)))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let s=i=(2*(1-i)-1)*Math.PI,l=25,a=0,h=s*s;do{h=s*s;const x=h*h;a=(s*(1.007226+h*(.015085+x*(.028874*h-.044475-.005916*x)))-i)/(1.007226+h*(.045255+x*(.259866*h-.311325-.005916*11*x))),s=Qt(s-a,-Ry,Ry)}while(Math.abs(a)>1e-6&&--l>0);h=s*s;const m=Qt(gr(e/(.8707+h*(h*(h*h*h*(.003971-.001529*h)-.013791)-.131979))),-180,180),g=gr(s);return new vi(m,g)}}const zy=hi(tr);class eb extends ba{project(e,i){i=hi(i),e=hi(e);const s=Math.cos(i),l=2/Math.PI,a=Math.acos(s*Math.cos(e/2)),h=Math.sin(a)/a,m=.5*(e*l+2*s*Math.sin(e/2)/h)||0,g=.5*(i+Math.sin(i)/h)||0;return{x:.5*(m/Math.PI+.5),y:1-.5*(g/Math.PI+1),z:0}}unproject(e,i){let s=e=(2*e-.5)*Math.PI,l=i=(2*(1-i)-1)*Math.PI,a=25;const h=1e-6;let m=0,g=0;do{const x=Math.cos(l),p=Math.sin(l),y=2*p*x,w=p*p,v=x*x,b=Math.cos(s/2),S=Math.sin(s/2),A=2*b*S,C=S*S,D=1-v*b*b,
vendor: 6,892 bytes, line 20
20L=D?1/D:0,z=D?Math.acos(x*b)*Math.sqrt(1/D):0,k=.5*(2*z*x*S+2*s/Math.PI)-e,B=.5*(z*p+l)-i,V=.5*L*(v*C+z*x*b*w)+1/Math.PI,W=L*(A*y/4-z*p*S),$=.125*L*(y*S-z*p*v*A),H=.5*L*(w*b+z*C*x)+.5,ae=W*$-H*V;m=(B*W-k*H)/ae,g=(k*$-B*V)/ae,s=Qt(s-m,-Math.PI,Math.PI),l=Qt(l-g,-zy,zy)}while((Math.abs(m)>h||Math.abs(g)>h)&&--a>0);return new vi(gr(s),gr(l))}}class Ly extends ba{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(hi(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){const{scale:s,cosPhi:l}=this;return{x:hi(e)*l*s+.5,y:-Math.sin(hi(i))/l*s+.5,z:0}}unproject(e,i){const{scale:s,cosPhi:l}=this,a=-(i-.5)/s,h=Qt(gr((e-.5)/s)/l,-180,180),m=Math.asin(Qt(a*l,-1,1)),g=Qt(gr(m),-tr,tr);return new vi(h,g)}}class tb extends Py{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,s){const l=bi(e,i,s),a=Fi(cr(s));return X.vec3.transformMat4(l,l,a),{x:l[0],y:l[1],z:l[2]}}locationPoint(e,i,s){const l=wo(i.lat,i.lng),a=X.vec3.normalize([],l),h=s?e._centerAltitude+s:e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(i),e._centerAltitude):e._centerAltitude,m=Cr(1,0)*ht*h;X.vec3.scaleAndAdd(l,l,a,m);const g=X.mat4.identity(new Float64Array(16));return X.mat4.multiply(g,e.pixelMatrix,e.globeMatrix),X.vec3.transformMat4(l,l,g),new dt(l[0],l[1])}pixelsPerMeter(e,i){return Cr(1,0)*i}pixelSpaceConversion(e,i,s){const l=Cr(1,e)*i,a=Ot(Cr(1,45)*i,l,s);return this.pixelsPerMeter(e,i)/a}createTileMatrix(e,i,s){const l=ur(cr(s.canonical));return X.mat4.multiply(new Float64Array(16),e.globeMatrix,l)}createInversionMatrix(e,i){const{center:s}=e,l=Fi(cr(i));return X.mat4.rotateY(l,l,hi(s.lng)),X.mat4.rotateX(l,l,hi(s.lat)),X.mat4.scale(l,l,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(l)}pointCoordinate(e,i,s,l){return fi(e,i,s,!0)||new t(0,0)}pointCoordinate3D(e,i,s){const l=this.pointCoordinate(e,i,s,0);return[l.x,l.y,l.z]}isPointAboveHorizon(e,i){return!fi(e,i.x,i.y,!1)}farthestPixelDistance(e){const i=function(l,a){const h=l.cameraToCenterDistance,m=l._centerAltitude*a,g=l._camera,x=l._camera.forward(),p=X.vec3.add([],X.vec3.scale([],x,-h),[0,0,m]),y=l.worldSize/(2*Math.PI),w=[0,0,-y],v=l.width/l.height,b=Math.tan(l.fovAboveCenter),S=X.vec3.scale([],g.up(),b),A=X.vec3.scale([],g.right(),b*v),C=X.vec3.normalize([],X.vec3.add([],X.vec3.add([],x,S),A)),D=[];let L;if(new kt(p,C).closestPointOnSphere(w,y,D)){const z=X.vec3.add([],D,w),k=X.vec3.sub([],z,p);L=Math.cos(l.fovAboveCenter)*X.vec3.length(k)}else{const z=X.vec3.sub([],p,w),k=X.vec3.sub([],w,p);X.vec3.normalize(k,k);const B=X.vec3.length(z)-y;L=Math.sqrt(B*(B+2*y));const V=Math.acos(L/(y+B))-Math.acos(X.vec3.dot(x,k));L*=Math.cos(V)}return 1.01*L}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),s=Kr(e.zoom);if(s>0){const l=Ay(e,Cr(1,e.center.lat)*e.worldSize),a=e.worldSize/(2*Math.PI),h=Math.max(e.width,e.height)/e.worldSize*Math.PI;return Ot(i,l+a*(1-Math.cos(h)),Math.pow(s,10))}return i}upVector(e,i,s){return bi(i,s,e,1)}upVectorScale(e){return{metersToTile:ci(Pi(cr(e)))}}}function Dy(n){const e=n.parallels,i=!!e&&Math.abs(e[0]+e[1])<.01;switch(n.name){case"mercator":return new Py(n);case"equirectangular":return new K1(n);case"naturalEarth":return new Q1(n);case"equalEarth":return new Y1(n);case"winkelTripel":return new eb(n);case"albers":return i?new Ly(n):new X1(n);case"lambertConformalConic":return i?new Ly(n):new J1(n);case"globe":return new tb(n)}throw new Error(`Invalid projection name: ${n.name}`)}const ib=ga.VectorTileFeature.types,rb=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function ap(n,e,i,s,l,a,h,m,g,x,p,y,w){const v=m?Math.min(xa,Math.round(m[0])):0,b=m?Math.min(xa,Math.round(m[1])):0;n.emplaceBack(e,i,Math.round(32*s),Math.round(32*l),a,h,(v<<1)+(g?1:0),b,16*x,16*p,256*y,256*w)}function lp(n,e,i){n.emplaceBack(e,i)}function cp(n,e,i,s,l,a,h){n.emplaceBack(e,i,s,l,a,h)}function up(n,e,i,s,l){n.emplaceBack(e,i,s,l),n.emplaceBack(e,i,s,l),n.emplaceBack(e,i,s,l),n.emplaceBack(e,i,s,l)}function nb(n){for(const e of n.sections)if(xd(e.text))return!0;return!1}class om{constructor(e){this.layoutVertexArray=new Gu,this.indexArray=new Tr,this.programConfigurations=e,this.segments=new Ui,this.dynamicLayoutVertexArray=new vo,this.opacityVertexArray=new Hu,this.placedSymbolArray=new Cd,this.iconTransitioningVertexArray=new Hs,this.globeExtVertexArray=new $u,this.zOffsetVertexArray=new yo}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0&&this.iconTransitioningVertexArray.length===0}upload(e,i,s,l,a){this.isEmpty()||(s&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,v1.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,b1.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,rb,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,T1.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,x1.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||a)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,w1.members,!0)),this.opacityVertexBuffer.itemSize=1),(s||l)&&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())}}vt(om,"SymbolBuffers");class am{constructor(e,i,s){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new s,this.segments=new Ui,this.collisionVertexArray=new Xu,this.collisionVertexArrayExt=new vo}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,S1.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,E1.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.de
20stroy())}}vt(am,"CollisionBuffers");class hp{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.lut=e.lut,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(h=>h.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=X.mat4.identity([]),this.placementViewportMatrix=X.mat4.identity([]);const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Xf(this.zoom,i["text-size"]),this.iconSizeData=Xf(this.zoom,i["icon-size"]);const s=this.layers[0].layout,l=s.get("symbol-sort-key"),a=s.get("symbol-z-order");this.canOverlap=s.get("text-allow-overlap")||s.get("icon-allow-overlap")||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=a!=="viewport-y"&&l.constantOr(1)!==void 0,this.sortFeaturesByY=(a==="viewport-y"||a==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=s.get("text-writing-mode").map(h=>vn[h]),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.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}createArrays(){this.text=new om(new Ws(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("text")||e.startsWith("symbol"))),this.icon=new om(new Ws(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("icon")||e.startsWith("symbol"))),this.glyphOffsetArray=new zd,this.lineVertexArray=new sl,this.symbolInstances=new Rd}calculateGlyphDependencies(e,i,s,l,a){for(const h of e){const m=h.codePointAt(0);if(m===void 0)break;if(i[m]=!0,l&&a&&m<=65535){const g=vh[h];g&&(i[g.charCodeAt(0)]=!0)}}}updateFootprints(e,i){}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const s=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);return!jf(this.activeReplacements,s)&&(this.activeReplacements=s,!0)}populate(e,i,s,l){const a=this.layers[0],h=a.layout,m=this.projection.name==="globe",g=h.get("text-font"),x=h.get("text-field"),p=h.get("icon-image"),[y,w]=h.get("icon-size-scale-range"),v=Qt(i.scaleFactor||1,y,w),b=(x.value.kind!=="constant"||x.value.value instanceof Dr&&!x.value.value.isEmpty()||x.value.value.toString().length>0)&&(g.value.kind!=="constant"||g.value.value.length>0),S=p.value.kind!=="constant"||!!p.value.value||Object.keys(p.parameters).length>0,A=h.get("symbol-sort-key");if(this.features=[],!b&&!S)return;const C=i.iconDependencies,D=i.glyphDependencies,L=i.availableImages,z=new zi(this.zoom);for(const{feature:k,id:B,index:V,sourceLayerIndex:W}of e){const $=a._featureFilter.needGeometry,H=I(k,$);if(!a._featureFilter.filter(z,H,s))continue;if($||(H.geometry=M(k,s,l)),m&&k.type!==1&&s.z<=5){const pe=H.geometry,xe=.98078528056,ye=(Me,Te)=>{const Ae=bi(Me.x,Me.y,s,1),et=bi(Te.x,Te.y,s,1);return X.vec3.dot(Ae,et)<xe};for(let Me=0;Me<pe.length;Me++)pe[Me]=f(pe[Me],ye)}let ae,Y;if(b){const pe=a.getValueAndResolveTokens("text-field",H,s,L),xe=Dr.factory(pe);nb(xe)&&(this.hasRTLText=!0),(!this.hasRTLText||ac()==="unavailable"||this.hasRTLText&&In.isParsed())&&(ae=A1(xe,a,H))}if(S){const pe=a.getValueAndResolveTokens("icon-image",H,s,L);Y=pe instanceof Or?pe:Or.build(pe)}if(!ae&&!Y)continue;const le=this.sortFeaturesByKey?A.evaluate(H,{},s):void 0,_e={id:B,text:ae,icon:Y,index:V,sourceLayerIndex:W,geometry:H.geometry,properties:k.properties,type:ib[k.type],sortKey:le};if(this.features.push(_e),Y){const pe=this.layers[0]._unevaluatedLayout._values,{iconPrimary:xe,iconSecondary:ye}=Sy(Y,this.iconSizeData,pe["icon-size"],s,this.zoom,_e,this.pixelRatio,v),Me=xe.id.toString();if(C.has(Me)?C.get(Me).push(xe):C.set(Me,[xe]),ye){const Te=ye.id.toString();C.has(Te)?C.get(Te).push(ye):C.set(Te,[ye])}}if(ae){const pe=g.evaluate(H,{},s).join(","),xe=h.get("text-rotation-alignment")==="map"&&h.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(vn.vertical)>=0;for(const ye of ae.sections)if(ye.image){const Me=ye.image.getPrimary().scaleSelf(this.pixelRatio),Te=Me.id.toString(),Ae=C.get(Te)||[];Ae.push(Me),C.set(Te,Ae)}else{const Me=Pu(ae.toString()),Te=ye.fontStack||pe,Ae=D[Te]=D[Te]||{};this.calculateGlyphDependencies(ye.text,Ae,xe,this.allowVerticalPlacement,Me)}}}if(h.get("symbol-placement")==="line"&&(this.features=function(k){const B={},V={},W=[];let $=0;function H(_e){W.push(k[_e]),$++}function ae(_e,pe,xe){const ye=V[_e];return delete V[_e],V[pe]=ye,W[ye].geometry[0].pop(),W[ye].geometry[0]=W[ye].geometry[0].concat(xe[0]),ye}function Y(_e,pe,xe){const ye=B[pe];return delete B[pe],B[_e]=ye,W[ye].geometry[0].shift(),W[ye].geometry[0]=xe[0].concat(W[ye].geometry[0]),ye}function le(_e,pe,xe){const ye=xe?pe[0][pe[0].length-1]:pe[0][0];return`${_e}:${ye.x}:${ye.y}`}for(let _e=0;_e<k.length;_e++){const pe=k[_e],xe=pe.geometry,ye=pe.text?pe.text.toString():null;if(!ye){H(_e);continue}const Me=le(ye,xe),Te=le(ye,xe,!0);if(Me in V&&Te in B&&V[Me]!==B[Te]){const Ae=Y(Me,Te,xe),et=ae(Me,Te,W[Ae].geometry);delete B[Me],delete V[Te],V[le(ye,W[et].geometry,!0)]=et,W[Ae].geometry=null}else Me in V?ae(Me,Te,xe):Te in B?Y(Me,Te,xe):(H(_e),B[Me]=$-1,V[Te]=$-1)}
20return W.filter(_e=>_e.geometry)}(this.features)),h.get("symbol-elevation-reference")==="hd-road-markup"){if(this.elevationType="road",i.elevationFeatures){!this.elevationFeatures&&i.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map);for(const k of i.elevationFeatures)this.elevationFeatureIdToIndex.set(k.id,this.elevationFeatures.length),this.elevationFeatures.push(k)}}else h.get("symbol-z-elevate")&&(this.elevationType="offset");this.elevationType!=="none"&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((k,B)=>k.sortKey-B.sortKey)}update(e,i,s,l,a,h,m){this.text.programConfigurations.updatePaintArrays(e,i,a,s,l,h,m),this.icon.programConfigurations.updatePaintArrays(e,i,a,s,l,h,m)}updateRoadElevation(){if(this.elevationType!=="road"||!this.elevationFeatures||this.elevationStateComplete)return;this.elevationStateComplete=!0,this.hasAnyZOffset=!1;let e=!1;for(let i=0;i<this.symbolInstances.length;i++){const s=this.symbolInstances.get(i);if(s.elevationFeatureIndex===65535)continue;const l=this.elevationFeatures[s.elevationFeatureIndex];if(l){const a=.05+l.pointElevation(new dt(s.tileAnchorX,s.tileAnchorY));s.zOffset!==a&&(e=!0,s.zOffset=a)}}e&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const e=(a,h,m)=>{s+=h,s>a.length&&a.resize(s);for(let g=-h;g<0;g++)a.emplace(g+s,m)},i=(a,h,m)=>{l+=h,l>a.length&&a.resize(l);for(let g=-h;g<0;g++)a.emplace(g+l,m)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let s=0,l=0;for(let a=0;a<this.symbolInstances.length;a++){const h=this.symbolInstances.get(a),{numHorizontalGlyphVertices:m,numVerticalGlyphVertices:g,numIconVertices:x}=h,p=h.zOffset,y=x>0;if((m>0||g>0)&&(e(this.text.zOffsetVertexArray,m,p),e(this.text.zOffsetVertexArray,g,p)),y){const{placedIconSymbolIndex:w,verticalPlacedIconSymbolIndex:v}=h;w>=0&&i(this.icon.zOffsetVertexArray,x,p),v>=0&&i(this.icon.zOffsetVertexArray,h.numVerticalIconVertices,p)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=Dy(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,i){const s=this.lineVertexArray.length;if(e.segment!==void 0)for(const{x:l,y:a}of i)this.lineVertexArray.emplaceBack(l,a);return{lineStartIndex:s,lineLength:this.lineVertexArray.length-s}}addSymbols(e,i,s,l,a,h,m,g,x,p,y,w,v,b,S,A){const C=e.indexArray,D=e.layoutVertexArray,L=e.globeExtVertexArray,z=e.segments.prepareSegment(4*i.length,D,C,this.canOverlap?h.sortKey:void 0),k=this.glyphOffsetArray.length,B=z.vertexLength,V=this.allowVerticalPlacement&&m===vn.vertical?Math.PI/2:0,W=h.text&&h.text.sections;for(let H=0;H<i.length;H++){const{tl:ae,tr:Y,bl:le,br:_e,texPrimary:pe,texSecondary:xe,pixelOffsetTL:ye,pixelOffsetBR:Me,minFontScaleX:Te,minFontScaleY:Ae,glyphOffset:et,isSDF:Je,sectionIndex:xt}=i[H],st=z.vertexLength,ct=et[1];if(ap(D,x.x,x.y,ae.x,ct+ae.y,pe.x,pe.y,s,Je,ye.x,ye.y,Te,Ae),ap(D,x.x,x.y,Y.x,ct+Y.y,pe.x+pe.w,pe.y,s,Je,Me.x,ye.y,Te,Ae),ap(D,x.x,x.y,le.x,ct+le.y,pe.x,pe.y+pe.h,s,Je,ye.x,Me.y,Te,Ae),ap(D,x.x,x.y,_e.x,ct+_e.y,pe.x+pe.w,pe.y+pe.h,s,Je,Me.x,Me.y,Te,Ae),g){const{x:it,y:zt,z:_t}=g.anchor,[St,Ft,Kt]=g.up;cp(L,it,zt,_t,St,Ft,Kt),cp(L,it,zt,_t,St,Ft,Kt),cp(L,it,zt,_t,St,Ft,Kt),cp(L,it,zt,_t,St,Ft,Kt),up(e.dynamicLayoutVertexArray,it,zt,_t,V)}else up(e.dynamicLayoutVertexArray,x.x,x.y,x.z,V);if(A){const it=xe||pe;lp(e.iconTransitioningVertexArray,it.x,it.y),lp(e.iconTransitioningVertexArray,it.x+it.w,it.y),lp(e.iconTransitioningVertexArray,it.x,it.y+it.h),lp(e.iconTransitioningVertexArray,it.x+it.w,it.y+it.h)}C.emplaceBack(st,st+1,st+2),C.emplaceBack(st+1,st+2,st+3),z.vertexLength+=4,z.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(et[0]),H!==i.length-1&&xt===i[H+1].sectionIndex||e.programConfigurations.populatePaintArrays(D.length,h,h.index,{},v,b,S,W&&W[xt])}const $=g?g.anchor:x;e.placedSymbolArray.emplaceBack($.x,$.y,$.z,x.x,x.y,k,this.glyphOffsetArray.length-k,B,p,y,x.segment,s?s[0]:0,s?s[1]:0,l[0],l[1],m,0,!1,0,w,0)}_commitLayoutVertex(e,i,s,l,a,h,m){e.emplaceBack(i,s,l,a,h,Math.round(m.x),Math.round(m.y))}_addCollisionDebugVertices(e,i,s,l,a,h,m){const g=s.segments.prepareSegment(4,s.layoutVertexArray,s.indexArray),x=g.vertexLength,p=m.tileAnchorX,y=m.tileAnchorY;for(let v=0;v<4;v++)s.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(s.collisionVertexArrayExt,i,e.padding,m.zOffset),this._commitLayoutVertex(s.layoutVertexArray,l,a,h,p,y,new dt(e.x1,e.y1)),this._commitLayoutVertex(s.layoutVertexArray,l,a,h,p,y,new dt(e.x2,e.y1)),this._commitLayoutVertex(s.layoutVertexArray,l,a,h,p,y,new dt(e.x2,e.y2)),this._commitLayoutVertex(s.layoutVertexArray,l,a,h,p,y,new dt(e.x1,e.y2)),g.vertexLength+=4;const w=s.indexArray;w.emplaceBack(x,x+1),w.emplaceBack(x+1,x+2),w.emplaceBack(x+2,x+3),w.emplaceBack(x+3,x),g.primitiveLength+=4}_addTextDebugCollisionBoxes(e,i,s,l,a,h){for(let m=l;m<a;m++){const g=s.get(m),x=this.getSymbolInstanceTextSize(e,h,i,m);this._addCollisionDebugVertices(g,x,this.textCollisionBox,g.projectedAnchorX,g.projectedAnchorY,g.projectedAnchorZ,h)}}_addIconDebugCollisionBoxes(e,i,s,l,a,h){for(let m=l;m<a;m++){const g=s.get(m),x=this.getSymbolInstanceIconSize(e,i,h.placedIconSymbolIndex);this._addCollisionDebugVertices(g,x,this.iconCollisionBox,g.projectedAnchorX,g.projectedAnchorY,g.projectedAnchorZ,h)}}generateCollisionDebugBuffers(e,i,s){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new am(il,Yg.members,Hs),this.iconCollisionBox=new am(il,Yg.members,Hs);const l=Ic(this.iconSizeData,e),a=Ic(this.textSizeData,e,s);for(let h=0;h<this.symbolInstances.length;h++){const m=this.symbolInstances.get(h);this._addTextDebugCollisionBoxes(a,e,i,m.textBoxStartIndex,m.textBoxEndIndex,m),this._addTextDebugCollisionBoxes(a,e,i,m.verticalTextBoxStartIndex,m.verticalTextBoxEndIndex,m),this._addIconDebugCollisionBoxes(l,e,i,m.iconBoxStartIndex,m.iconBoxEndIndex,m),this._addIconDebugCollisionBoxes(l,e,i,m.verticalIconBoxStartIndex,m.verticalIconBoxEndIndex,m)}}getSymbolInstanceTextSize(e,i,s,l){const a=this.text.placedSymbolArray.get(i.rightJustifiedTextSymbolIndex>=0?i.rightJustifiedTextSymbolIndex:i.centerJustifiedTextSymbolIndex>=0?i.centerJustifiedTextSymbolIndex:i.leftJustifiedTextSymbolIndex>=0?i.leftJustifiedTextSymbolIndex:i.verticalPlacedTextSymbolIndex>=0?i.verticalPlacedTextSymbolIndex:l),h=Jd(this.textSizeData,e,a)/Rr;return this.tilePixelRatio*h}getSymbolInstanceIconSize(e,i,s){const l=this.icon.placedSymbolArray.get(s),a=Jd(this.iconSizeData,e,l);return this.tilePixelRatio*a}_commitDebugCollisionVertexUpdate(e,i,s,l){e.emplaceBack(i,-s,-s,l),e.emplaceBack(i,s,-s,l),e.emplaceBack(i,s,s,l),e.emplaceBack(i,-s,s,l)}_updateTextDebugCollisionBoxes(e,i,s,l,a,h,m){for(let g=l;g<a;g++){const x=s.get(g),p=this.getSymbolInstanceTextSize(e,h,i,g);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,p,x.padding,h.zOffset)}}_updateIconDebugCollisionBoxes(e,i,s,l,a,h,m){for(let g=l;g<a;g++){const x=s.get(g),p=this.getSymbolInstanceIconSize(e,i,h.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,p,x.padding,h.zOffset)}}updateCollisionDebugBuffers(e,i,s,l){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const a=Ic(this.iconSizeData,e,l),h=Ic(this.textSizeData,e,s);for(let m=0;m<this.symbolInstances.length;m++){const g=this.symbolInstances.get(m);this._updateTextDebugCollisionBoxes(h,e,i,g.textBoxStartIndex,g.textBoxEndIndex,g,s),this._updateTextDebugCollisionBoxes(h,e,i,g.verticalTextBoxStartIndex,g.verticalTextBoxEndIndex,g,s),this._updateIconDebugCollisionBoxes(a,e,i,g.iconBoxStartIndex,g.iconBoxEndIndex,g,l),this._updateIconDebugCollisionBoxes(a,e,i,g.verticalIconBoxStartIndex,g.verticalIconBoxEndIndex,g,l)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(e,i,s,l,a,h,m,g,x){const p={};if(i<s){const{x1:y,y1:w,x2:v,y2:b,padding:S,projectedAnchorX:A,projectedAnchorY:C,projectedAnchorZ:D,tileAnchorX:L,tileAnchorY:z,featureIndex:k}=e.get(i);p.textBox={x1:y,y1:w,x2:v,y2:b,padding:S,projectedAnchorX:A,projectedAnchorY:C,projectedAnchorZ:D,tileAnchorX:L,tileAnchorY:z},p.textFeatureIndex=k}if(l<a){const{x1:y,y1:w,x2:v,y2:b,padding:S,projectedAnchorX:A,projectedAnchorY:C,projectedAnchorZ:D,tileAnchorX:L,tileAnchorY:z,featureIndex:k}=e.get(l);p.verticalTextBox={x1:y,y1:w,x2:v,y2:b,padding:S,projectedAnchorX:A,projectedAnchorY:C,projectedAnchorZ:D,tileAnchorX:L,tileAnchorY:z},p.verticalTextFeatureIndex=k}if(h<m){const{x1:y,y1:w,x2:v,y2:b,padding:S,projectedAnchorX:A,projectedAnchorY:C,projectedAnchorZ:D,tileAnchorX:L,tileAnchorY:z,featureIndex:k}=e.get(h);p.iconBox={x1:y,y1:w,x2:v,y2:b,padding:S,projectedAnchorX:A,projectedAnchorY:C,projectedAnchorZ:D,tileAnchorX:L,tileAnchorY:z},p.iconFeatureIndex=k}if(g<x){const{x1:y,y1:w,x2:v,y2:b,padding:S,projectedAnchorX:A,projectedAnchorY:C,projectedAnchorZ:D,tileAnchorX:L,tileAnchorY:z,featureIndex:k}=e.get(g);p.verticalIconBox={x1:y,y1:w,x2:v,y2:b,padding:S,projectedAnchorX:A,projectedAnchorY:C,projectedAnchorZ:D,tileAnchorX:L,tileAnchorY:z},p.verticalIconFeatureIndex=k}return p}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){const s=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,s.textBoxStartIndex,s.textBoxEndIndex,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s.iconBoxStartIndex,s.iconBoxEndIndex,s.verticalIconBoxStartIndex,s.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(e,i){const s=e.placedSymbolArray.get(i),l=s.vertexStartIndex+4*s.numGlyphs;for(let a=s.vertexStartIndex;a<l;a+=4)e.indexArray.emplaceBack(a,a+1,a+2),e.indexArray.emplaceBack(a+1,a+2,a+3)}
vendor: 16,384 bytes, line 20
20getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const i=Math.sin(e),s=Math.cos(e),l=[],a=[],h=[];for(let m=0;m<this.symbolInstances.length;++m){h.push(m);const g=this.symbolInstances.get(m);l.push(0|Math.round(i*g.tileAnchorX+s*g.tileAnchorY)),a.push(g.featureIndex)}return h.sort((m,g)=>l[m]-l[g]||a[g]-a[m]),h}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let e=0;e<this.symbolInstances.length;++e)this.symbolInstanceIndexesSortedZOffset.push(e)}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort((e,i)=>this.symbolInstances.get(i).zOffset-this.symbolInstances.get(e).zOffset)}addToSortKeyRanges(e,i){const s=this.sortKeyRanges[this.sortKeyRanges.length-1];s&&s.sortKey===i?s.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:i,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const i of this.symbolInstanceIndexes){const s=this.symbolInstances.get(i);this.featureSortOrder.push(s.featureIndex);const{rightJustifiedTextSymbolIndex:l,centerJustifiedTextSymbolIndex:a,leftJustifiedTextSymbolIndex:h,verticalPlacedTextSymbolIndex:m,placedIconSymbolIndex:g,verticalPlacedIconSymbolIndex:x}=s;l>=0&&this.addIndicesForPlacedSymbol(this.text,l),a>=0&&a!==l&&this.addIndicesForPlacedSymbol(this.text,a),h>=0&&h!==a&&h!==l&&this.addIndicesForPlacedSymbol(this.text,h),m>=0&&this.addIndicesForPlacedSymbol(this.text,m),g>=0&&this.addIndicesForPlacedSymbol(this.icon,g),x>=0&&this.addIndicesForPlacedSymbol(this.icon,x)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Oy,ky,lm;vt(hp,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),hp.addDynamicAttributes=up;class Fy{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:Oo,this.defaultValue=e}evaluate(e){if(e.formattedSection){const 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}}vt(Fy,"FormatSectionOverride",{omit:["defaultValue"]});const cm=()=>lm||(lm={layout:Oy||(Oy=new Zi({"symbol-placement":new lt(Pe.layout_symbol["symbol-placement"]),"symbol-spacing":new lt(Pe.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new lt(Pe.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new yt(Pe.layout_symbol["symbol-sort-key"]),"symbol-z-order":new lt(Pe.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new lt(Pe.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new lt(Pe.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new lt(Pe.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new lt(Pe.layout_symbol["icon-ignore-placement"]),"icon-optional":new lt(Pe.layout_symbol["icon-optional"]),"icon-rotation-alignment":new lt(Pe.layout_symbol["icon-rotation-alignment"]),"icon-size":new yt(Pe.layout_symbol["icon-size"]),"icon-size-scale-range":new lt(Pe.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new yt(Pe.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new yt(Pe.layout_symbol["icon-text-fit-padding"]),"icon-image":new yt(Pe.layout_symbol["icon-image"]),"icon-rotate":new yt(Pe.layout_symbol["icon-rotate"]),"icon-padding":new lt(Pe.layout_symbol["icon-padding"]),"icon-keep-upright":new lt(Pe.layout_symbol["icon-keep-upright"]),"icon-offset":new yt(Pe.layout_symbol["icon-offset"]),"icon-anchor":new yt(Pe.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new lt(Pe.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new lt(Pe.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new lt(Pe.layout_symbol["text-rotation-alignment"]),"text-field":new yt(Pe.layout_symbol["text-field"]),"text-font":new yt(Pe.layout_symbol["text-font"]),"text-size":new yt(Pe.layout_symbol["text-size"]),"text-size-scale-range":new lt(Pe.layout_symbol["text-size-scale-range"]),"text-max-width":new yt(Pe.layout_symbol["text-max-width"]),"text-line-height":new yt(Pe.layout_symbol["text-line-height"]),"text-letter-spacing":new yt(Pe.layout_symbol["text-letter-spacing"]),"text-justify":new yt(Pe.layout_symbol["text-justify"]),"text-radial-offset":new yt(Pe.layout_symbol["text-radial-offset"]),"text-variable-anchor":new lt(Pe.layout_symbol["text-variable-anchor"]),"text-anchor":new yt(Pe.layout_symbol["text-anchor"]),"text-max-angle":new lt(Pe.layout_symbol["text-max-angle"]),"text-writing-mode":new lt(Pe.layout_symbol["text-writing-mode"]),"text-rotate":new yt(Pe.layout_symbol["text-rotate"]),"text-padding":new lt(Pe.layout_symbol["text-padding"]),"text-keep-upright":new lt(Pe.layout_symbol["text-keep-upright"]),"text-transform":new yt(Pe.layout_symbol["text-transform"]),"text-offset":new yt(Pe.layout_symbol["text-offset"]),"text-allow-overlap":new lt(Pe.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new lt(Pe.layout_symbol["text-ignore-placement"]),"text-optional":new lt(Pe.layout_symbol["text-optional"]),visibility:new lt(Pe.layout_symbol.visibility)})),paint:ky||(ky=new Zi({"icon-opacity":new yt(Pe.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new yt(Pe.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new yt(Pe.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new yt(Pe.paint_symbol["text-emissive-strength"]),"icon-color":new yt(Pe.paint_symbol["icon-color"]),"icon-halo-color":new yt(Pe.paint_symbol["icon-halo-color"]),"icon-halo-width":new yt(Pe.paint_symbol["icon-halo-width"]),"icon-halo-blur":new yt(Pe.paint_symbol["icon-halo-blur"]),"icon-translate":new lt(Pe.paint_symbol["icon-translate"]),"icon-translate-anchor":new lt(Pe.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new yt(Pe.paint_symbol["icon-image-cross-fade"]),"text-opacity":new yt(Pe.paint_symbol["text-opacity"]),"text-occlusion-opacity":new yt(Pe.paint_symbol["text-occlusion-opacity"]),"text-color":new yt(Pe.paint_symbol["text-color"],{runtimeType:Lr,getOverride:n=>n.textColor,hasOverride:n=>!!n.textColor}),"text-halo-color":new yt(Pe.paint_symbol["text-halo-color"]),"text-halo-width":new yt(Pe.paint_symbol["text-halo-width"]),"text-halo-blur":new yt(Pe.paint_symbol["text-halo-blur"]),"text-translate":new lt(Pe.paint_symbol["text-translate"]),"text-translate-anchor":new lt(Pe.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new lt(Pe.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new lt(Pe.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new lt(Pe.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new lt(Pe.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new yt(Pe.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new yt({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new yt({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new yt({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new yt({type:"string",default:"default","property-type":"data-driven"})}))},lm);class dp extends br{constructor(e,i,s,l){super(e,cm(),i,s,l),this._colorAdjustmentMatrix=X.mat4.identity([]),this.hasInitialOcclusionOpacityProperties=e.paint!==void 0&&("icon-occlusion-opacity"in e.paint||"text-occlusion-opacity"in e.paint)}recalculate(e,i){super.recalculate(e,i),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const s=this.layout.get("text-writing-mode");if(s){const l=[];for(const a of s)l.indexOf(a)<0&&l.push(a);this.layout._values["text-writing-mode"]=l}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(e,i,s,l){return this._saturation===e&&this._contrast===i&&this._brightnessMin===s&&this._brightnessMax===l||(this._colorAdjustmentMatrix=function(a,h,m,g){a=Ne(a),h=za(h);const x=X.mat4.create(),p=a/3,y=1-2*p,w=[y,p,p,0,p,y,p,0,p,p,y,0,0,0,0,1],v=.5-.5*h,b=g-m;return X.mat4.multiply(x,[b,0,0,0,0,b,0,0,0,0,b,0,m,m,m,1],[h,0,0,0,0,h,0,0,0,0,h,0,v,v,v,1]),X.mat4.multiply(x,x,w),x}(e,i,s,l),this._saturation=e,this._contrast=i,this._brightnessMin=s,this._brightnessMax=l),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,i,s,l){const a=this.layout.get(e).evaluate(i,{},s,l),h=this._unevaluatedLayout._values[e];return h.isDataDriven()||ec(h.value)||!a?a:function(m,g){return g.replace(/{([^{}]+)}/g,(x,p)=>p in m?String(m[p]):"")}(i.properties,a)}createBucket(e){return new hp(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of cm().paint.overridableProperties){if(!dp.hasPaintOverride(this.layout,e))continue;const i=this.paint.get(e),s=new Fy(i),l=new Eu(s,i.property.specification,this.scope,this.options);let a=null;a=i.value.kind==="constant"||i.value.kind==="source"?new Mu("source",l):new Qo("composite",l,i.value.zoomStops,i.value._interpolationType),this.paint._values[e]=new na(i.property,a,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,s){return!(!this.layout||i.isDataDriven()||s.isDataDriven())&&dp.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){const s=e.get("text-field"),l=cm().paint.properties[i];let a=!1;const h=m=>{for(const g of m)if(l.overrides&&l.overrides.hasOverride(g))return void(a=!0)};if(s.value.kind==="constant"&&s.value.value instanceof Dr)h(s.value.value.sections);else if(s.value.kind==="source"){const m=x=>{a||(x instanceof us&&or(x.value)===Oa?h(x.value.sections):x instanceof No?h(x.sections):x.eachChild(m))},g=s.value;g._styleExpression&&m(g._styleExpression.expression)}return a}getProgramIds(){return["symbol"]}getDefaultProgramParams(e,i,s){return{config:new bo(this,{zoom:i,lut:s}),overrideFog:!1}}}let By,Ny,Vy,Uy;var um=yi([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function hm(n){switch(n){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 dm(n){switch(n){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 pm{constructor(e,i,s,l){this.context=e,this.format=s,this.useMipmap=l&&l.useMipmap,this.texture=e.gl.createTexture(),this.update(i,{premultiply:l&&l.premultiply})}update(e,i){const s=e&&e instanceof HTMLVideoElement&&e.width===0?e.videoWidth:e.width,l=e&&e instanceof HTMLVideoElement&&e.height===0?e.videoHeight:e.height,{context:a}=this,{gl:h}=a,{x:m,y:g}=i&&i.position?i.position:{x:0,y:0},x=m+s,p=g+l;!this.size||this.size[0]===x&&this.size[1]===p||(h.bindTexture(h.TEXTURE_2D,null),h.deleteTexture(this.texture),this.texture=h.createTexture(),this.size=null),h.bindTexture(h.TEXTURE_2D,this.texture),a.pixelStoreUnpackFlipY.set(!1),a.pixelStoreUnpack.set(1),a.pixelStoreUnpackPremultiplyAlpha.set(this.format===h.RGBA8&&(!i||i.premultiply!==!1));const y=e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap;if(!this.size&&x>0&&p>0){const w=this.useMipmap?Math.floor(Math.log2(Math.max(x,p)))+1:1;h.texStorage2D(h.TEXTURE_2D,w,this.format,x,p),this.size=[x,p]}if(this.size)if(y)h.texSubImage2D(h.TEXTURE_2D,0,m,g,hm(this.format),dm(this.format),e);else{const w=e.data;w&&h.texSubImage2D(h.TEXTURE_2D,0,m,g,s,l,hm(this.format),dm(this.format),w)}this.useMipmap&&h.generateMipmap(h.TEXTURE_2D)}bind(e,i,s=!1){const{context:l}=this,{gl:a}=l;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,this.useMipmap&&!s?e===a.NEAREST?a.NEAREST_MIPMAP_NEAREST:a.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),i!==this.wrapS&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,i),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,i),this.wrapS=i)}bindExtraParam(e,i,s,l){const{context:a}=this,{gl:h}=a;h.bindTexture(h.TEXTURE_2D,this.texture),i!==this.magFilter&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,i),this.magFilter=i),e!==this.minFilter&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,this.useMipmap?e===h.NEAREST?h.NEAREST_MIPMAP_NEAREST:h.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),s!==this.wrapS&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,s),this.wrapS=s),l!==this.wrapT&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,l),this.wrapT=l)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class pp{constructor(e,i){this.context=e,this.texture=i}bind(e,i){const{context:s}=this,{gl:l}=s;l.bindTexture(l.TEXTURE_2D,this.texture),e!==this.minFilter&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,e),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,e),this.minFilter=e),i!==this.wrapS&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,i),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,i),this.wrapS=i)}}function fp(n,e,i,s,l,a,h,m){const g=[n,e,1,i,s,1,l,a,1],x=[h,m,1],p=X.mat3.adjoint([],g),[y,w,v]=X.vec3.transformMat3(x,x,p);return X.mat3.multiply(g,g,[y,0,0,0,w,0,0,0,v])}function jy(n,e,i,s,l,a,h,m){const g=function(x,p,y,w,v,b,S,A){const C=fp(0,0,1,0,1,1,0,1),D=fp(x,p,y,w,v,b,S,A),L=X.mat3.adjoint([],C);return X.mat3.multiply(D,D,L)}(n,e,i,s,l,a,h,m);return[g[2]/g[8]/ht,g[5]/g[8]/ht]}function mp(n){return[n[0],Math.min(Math.max(n[1],-tr),tr)]}class qy extends kn{constructor(e,i,s,l){super(),this.id=e,this.dispatcher=s,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(l),this.options=i,this._dirty=!1}load(e,i){if(this._loaded=i||!1,this.fire(new tn("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();this._imageRequest=Zc(this.map._requestManager.transformRequest(this.url,vr.Image),(s,l)=>{this._imageRequest=null,this._loaded=!0,s?this.fire(new Do(s)):l&&(this.image=l instanceof HTMLImageElement?Be.getImageData(l):l,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,e&&(this.coordinates=e),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):this}setTexture(e){if(!(e.handle instanceof WebGLTexture))throw new Error("The provide
20d handle is not a WebGLTexture instance");return this.texture=new pp(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 tn("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 pp||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],s=e[0][1];for(const a of e)a[1]>s&&(s=a[1]),a[1]<i&&(i=a[1]);const l=(s+i)/2;if(l>tr?this.onNorthPole=!0:l<-tr&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const a=e.map(t.fromLngLat);this.tileID=function(h){let m=1/0,g=1/0,x=-1/0,p=-1/0;for(const S of h)m=Math.min(m,S.x),g=Math.min(g,S.y),x=Math.max(x,S.x),p=Math.max(p,S.y);const y=Math.max(x-m,p-g),w=Math.max(0,Math.floor(-Math.log(y)/Math.LN2)),v=Math.pow(2,w);let b=Math.floor((m+x)/2*v);return b>1&&(b-=1),new Ke(w,b,Math.floor((g+p)/2*v))}(a),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new tn("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(e){for(const C in this.tiles){const D=this.tiles[C];D.state!=="loaded"&&(D.state="loaded",D.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const i=Sh(new Ke(0,0,0),this.map.transform.projection),s=[i.projection.project(this.coordinates[0][0],this.coordinates[0][1]),i.projection.project(this.coordinates[1][0],this.coordinates[1][1]),i.projection.project(this.coordinates[2][0],this.coordinates[2][1]),i.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(C){const D=C[1].x-C[0].x,L=C[1].y-C[0].y,z=C[2].x-C[1].x,k=C[2].y-C[1].y,B=C[3].x-C[2].x,V=C[3].y-C[2].y,W=C[0].x-C[3].x,$=C[0].y-C[3].y,H=D*k-z*L,ae=z*V-B*k,Y=B*$-W*V,le=W*L-D*$;return H>0&&ae>0&&Y>0&&le>0||H<0&&ae<0&&Y<0&&le<0}(s))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const l=Sh(this.tileID,this.map.transform.projection),[a,h,m,g]=this.coordinates.map(C=>{const D=l.projection.project(C[0],C[1]);return Cy(l,D)._round()});this.perspectiveTransform=jy(a.x,a.y,h.x,h.y,m.x,m.y,g.x,g.y);const x=this._boundsArray=new xs;x.emplaceBack(a.x,a.y,0,0),x.emplaceBack(h.x,h.y,ht,0),x.emplaceBack(g.x,g.y,0,ht),x.emplaceBack(m.x,m.y,ht,ht),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(x,um.members),this.boundsSegments=Ui.simpleSegment(0,0,4,2);const p=[],y=[mp((w=this.coordinates)[0]),mp(w[1]),mp(w[2]),mp(w[3])];var w;const[v,b,S,A]=function(C){let D=C[0][0],L=D,z=C[0][1],k=z;for(let B=1;B<C.length;B++)C[B][0]<D?D=C[B][0]:C[B][0]>L&&(L=C[B][0]),C[B][1]<z?z=C[B][1]:C[B][1]>k&&(k=C[B][1]);return[D,z,L-D,k-z]}(y);{const C=new xs,[D,L,z,k]=function(ye){let Me=ye[0].x,Te=Me,Ae=ye[0].y,et=Ae;for(let Je=1;Je<ye.length;Je++)ye[Je].x<Me?Me=ye[Je].x:ye[Je].x>Te&&(Te=ye[Je].x),ye[Je].y<Ae?Ae=ye[Je].y:ye[Je].y>et&&(et=ye[Je].y);return[Me,Ae,Te-Me,et-Ae]}(s),B=ye=>[(ye.x-D)/z,(ye.y-L)/k],[V,W,$,H]=s.map(B),ae=function(ye,Me,Te,Ae,et,Je,xt,st){const ct=fp(0,0,1,0,1,1,0,1),it=fp(ye,Me,Te,Ae,et,Je,xt,st),zt=X.mat3.adjoint([],it);return X.mat3.multiply(ct,ct,zt)}(V[0],V[1],W[0],W[1],$[0],$[1],H[0],H[1]);this.elevatedGlobePerspectiveTransform=jy(V[0],V[1],W[0],W[1],$[0],$[1],H[0],H[1]);const Y=(ye,Me)=>{p.push(ye.lng);const Te=Math.round((ye.lng-v)/S*ht),Ae=Math.round((ye.lat-b)/A*ht),et=B(Me),Je=X.vec3.transformMat3([],[et[0],et[1],1],ae),xt=Math.round(Je[0]/Je[2]*ht),st=Math.round(Je[1]/Je[2]*ht);C.emplaceBack(Te,Ae,xt,st)},le=s[3].x-s[0].x,_e=s[3].y-s[0].y,pe=s[2].x-s[1].x,xe=s[2].y-s[1].y;for(let ye=0;ye<65;ye++){const Me=ye/64,Te=[s[0].x+Me*le,s[0].y+Me*_e],Ae=[s[1].x+Me*pe,s[1].y+Me*xe],et=Ae[0]-Te[0],Je=Ae[1]-Te[1];for(let xt=0;xt<65;xt++){const st=xt/64,ct={x:Te[0]+et*st,y:Te[1]+Je*st};Y(i.projection.unproject(ct.x,ct.y),ct)}
20}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(C,um.members)}{this.maxLongitudeTriangleSize=0;let C=[],D=new Tr;const L=(z,k,B)=>{D.emplaceBack(z,k,B);const V=p[z],W=p[k],$=p[B],H=Math.min(Math.min(V,W),$),ae=Math.max(Math.max(V,W),$)-H;ae>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=ae),C.push(H+ae/2)};for(let z=0;z<64;z++)for(let k=0;k<64;k++){const B=65*z+k,V=B+1,W=B+65,$=W+1;L(B,W,V),L(V,W,$)}[C,D]=function(z,k){const B=Array.from({length:z.length},($,H)=>H);B.sort(($,H)=>z[$]-z[H]);const V=[],W=new Tr;for(let $=0;$<B.length;$++){const H=B[$];V.push(z[H]);const ae=3*H,Y=ae+1;W.emplaceBack(k.uint16[ae],k.uint16[Y],k.uint16[Y+1])}return[V,W]}(C,D),this.elevatedGlobeTrianglesCenterLongitudes=C,this.elevatedGlobeIndexBuffer=e.createIndexBuffer(D)}this.elevatedGlobeSegments=Ui.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,S/ht,0,A/ht,0,0,b,v,0])}prepare(){const e=Object.keys(this.tiles).length!==0;if(this.tileID&&!e)return;const i=this.map.painter.context,s=i.gl;!this._dirty||this.texture instanceof pp||(this.texture?this.texture.update(this.image):(this.texture=new pm(i,this.image,s.RGBA8),this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE)),this._dirty=!1),e&&this._prepareData(i)}loadTile(e,i){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},i(null)):(e.state="errored",i(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(e){const i=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!i)return null;const s=this.elevatedGlobeTrianglesCenterLongitudes;let l=(a=e+180)+360*Math.round((s[0]-a)/360);var a;const h=new Ui,m=(y,w)=>{h.segments.push({vertexOffset:0,primitiveOffset:y,vertexLength:i.segments[0].vertexLength,primitiveLength:w,sortKey:void 0,vaos:{}})},g=.51*this.maxLongitudeTriangleSize;if(Math.abs(s[0]-l)<=g){const y=Pl(s,0,s.length,l+g);return y===s.length||m(y,Cl(s,y+1,s.length,l+360-g)-y),h}l<s[0]&&(l+=360);const x=Cl(s,0,s.length,l-g);if(x===s.length)return m(0,s.length),h;m(0,x-0);const p=Pl(s,x+1,s.length,l+g);return p!==s.length&&m(p,s.length-p),h}}const sb=(Math.pow(256,2)-1)/16907520;class Gy extends br{constructor(e,i,s,l){super(e,{layout:Vy||(Vy=new Zi({visibility:new lt(Pe.layout_raster.visibility)})),paint:Uy||(Uy=new Zi({"raster-opacity":new lt(Pe.paint_raster["raster-opacity"]),"raster-color":new oa(Pe.paint_raster["raster-color"]),"raster-color-mix":new lt(Pe.paint_raster["raster-color-mix"]),"raster-color-range":new lt(Pe.paint_raster["raster-color-range"]),"raster-hue-rotate":new lt(Pe.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new lt(Pe.paint_raster["raster-brightness-min"]),"raster-brightness-max":new lt(Pe.paint_raster["raster-brightness-max"]),"raster-saturation":new lt(Pe.paint_raster["raster-saturation"]),"raster-contrast":new lt(Pe.paint_raster["raster-contrast"]),"raster-resampling":new lt(Pe.paint_raster["raster-resampling"]),"raster-fade-duration":new lt(Pe.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new lt(Pe.paint_raster["raster-emissive-strength"]),"raster-array-band":new lt(Pe.paint_raster["raster-array-band"]),"raster-elevation":new lt(Pe.paint_raster["raster-elevation"]),"raster-color-use-theme":new yt({type:"string",default:"default","property-type":"data-driven"})}))},i,s,l),this.updateColorRamp(),this._curRampRange=[NaN,NaN]}getProgramIds(){return["raster"]}hasColorMap(){return!!this._transitionablePaint._values["raster-color"].value.value}tileCoverLift(){return this.paint.get("raster-elevation")}isDraped(e){return!(e&&e._source instanceof qy&&(e._source.onNorthPole||e._source.onSouthPole))&&this.paint.get("raster-elevation")===0}_handleSpecialPaintPropertyUpdate(e){e!=="raster-color"&&e!=="raster-color-range"||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}updateColorRamp(e){if(!this.hasColorMap()||!this._curRampRange)return;const i=this._transitionablePaint._values["raster-color"].value.expression,[s,l]=e||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(s)&&isNaN(l)||s===this._curRampRange[0]&&l===this._curRampRange[1]||(this.colorRamp=ch({expression:i,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:s,end:l}],resolution:256}),this.colorRampTexture=null,this._curRampRange=[s,l])}}let $y,Hy,Zy,Wy,Xy;class Yy extends br{constructor(e,i,s,l){super(e,{layout:$y||($y=new Zi({visibility:new lt(Pe["layout_raster-particle"].visibility)})),paint:Hy||(Hy=new Zi({"raster-particle-array-band":new lt(Pe["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new lt(Pe["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new oa(Pe["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new lt(Pe["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new lt(Pe["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new lt(Pe["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new lt(Pe["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new lt(Pe["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new yt({type:"string",default:"default","property-type":"data-driven"})}))},i,s,l),this._updateColorRamp(),this.lastInvalidatedAt=Be.now()}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 this.visibility!=="none"}isDraped(e){return!1}_handleSpecialPaintPropertyUpdate(e){e!=="raster-particle-color"&&e!=="raster-particle-max-speed"||(this._updateColorRamp(),this._invalidateAnimationState()),e==="raster-particle-count"&&this._invalidateAnimationState()}_updateColorRamp(){if(!this.hasColorMap())return;const e=this._transitionablePaint._values["raster-particle-color"].value.expression,i=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=ch({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:i}],resolution:256}),this.colorRampTexture=null}
20_invalidateAnimationState(){this.lastInvalidatedAt=Be.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class ob extends br{constructor(e,i){super(e,{},i,null),this.implementation=e,e.slot&&(this.slot=e.slot)}is3D(e){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}isDraped(e){return this.implementation.renderToTile!==void 0}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 fm(n,e,i){const s=[0,0,1],l=X.quat.identity([]);return X.quat.rotateY(l,l,i?-hi(n)+Math.PI:hi(n)),X.quat.rotateX(l,l,-hi(e)),X.vec3.transformQuat(s,s,l),X.vec3.normalize(s,s)}function Ky(n,e){const i=_p(n.projection,n.zoom,n.width,n.height),s=function(a,h,m,g,x){const p=new vi(m.lng-180*wa,m.lat),y=new vi(m.lng+180*wa,m.lat),w=a.project(p.lng,p.lat),v=a.project(y.lng,y.lat),b=-Math.atan2(v.y-w.y,v.x-w.x),S=t.fromLngLat(m);S.y=Qt(S.y,-1+wa,1-wa);const A=S.toLngLat(),C=a.project(A.lng,A.lat),D=t.fromLngLat(A);D.x+=wa;const L=D.toLngLat(),z=a.project(L.lng,L.lat),k=Qy(z.x-C.x,z.y-C.y,b),B=t.fromLngLat(A);B.y+=wa;const V=B.toLngLat(),W=a.project(V.lng,V.lat),$=Qy(W.x-C.x,W.y-C.y,b),H=Math.abs(k.x)/Math.abs($.y),ae=X.mat4.identity([]);X.mat4.rotateZ(ae,ae,-b*(1-(x?0:g)));const Y=X.mat4.identity([]);return X.mat4.scale(Y,Y,[1,1-(1-H)*g,1]),Y[4]=-$.x/$.y*g,X.mat4.rotateZ(Y,Y,b),X.mat4.multiply(Y,ae,Y),Y}(n.projection,0,n.center,i,e),l=Jy(n);return X.mat4.scale(s,s,[l,l,1]),s}function Jy(n){const e=n.projection,i=_p(n.projection,n.zoom,n.width,n.height),s=mm(e,n.center),l=mm(e,vi.convert(e.center));return Math.pow(2,s*i+(1-i)*l)}function _p(n,e,i,s,l=1/0){const a=n.range;if(!a)return 0;const h=Math.min(l,Math.max(i,s)),m=Math.log(h/1024)/Math.LN2;return Zr(a[0]+m,a[1]+m,e)}const wa=1/4e4;function mm(n,e){const i=Qt(e.lat,-tr,tr),s=new vi(e.lng-180*wa,i),l=new vi(e.lng+180*wa,i),a=n.project(s.lng,i),h=n.project(l.lng,i),m=t.fromLngLat(s),g=t.fromLngLat(l),x=h.x-a.x,p=h.y-a.y,y=g.x-m.x,w=g.y-m.y,v=Math.sqrt((y*y+w*w)/(x*x+p*p));return Math.log(v)/Math.LN2}function Qy(n,e,i){const s=Math.cos(i),l=Math.sin(i);return{x:n*s-e*l,y:n*l+e*s}}function ev(n,e,i){X.mat4.identity(n),X.mat4.rotateZ(n,n,hi(e[2])),X.mat4.rotateX(n,n,hi(e[0])),X.mat4.rotateY(n,n,hi(e[1])),X.mat4.scale(n,n,i),X.mat4.multiply(n,n,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function gp(n,e,i,s,l,a,h,m){const g=[i[0]-e[0],i[1]-e[1],0],x=[s[0]-e[0],s[1]-e[1],0];if(X.vec3.length(g)<1e-12||X.vec3.length(x)<1e-12)return X.quat.identity(n);const p=X.vec3.cross([],g,x);X.vec3.normalize(p,p),X.vec3.subtract(x,s,e),g[2]=(a-l)*m,x[2]=(h-l)*m;const y=g;return X.vec3.cross(y,g,x),X.vec3.normalize(y,y),X.quat.rotationTo(n,p,y)}function _m(n,e,i=!1){const s=Kr(e.zoom),l=function(a,h,m){const g=h.worldSize,x=[a[12],a[13],a[14]],p=Sr(x[1]/g),y=on(x[0]/g),w=X.mat4.identity([]),v=Cr(1,p)*g,b=Cr(1,0)*g*Ys(p,h.zoom),S=1/ts(g);let A=b*S;if(m){const z=_p(h.projection,h.zoom,h.width,h.height,1024);A=S*h.projection.pixelSpaceConversion(h.center.lat,g,z)}const C=wo(p,y);X.vec3.add(C,C,X.vec3.scale([],X.vec3.normalize([],C),v*A*x[2]));const D=function(z){const k=[z[0],z[1],z[2]];let B=[0,1,0];const V=X.vec3.cross([],B,k);return X.vec3.cross(B,k,V),X.vec3.squaredLength(B)===0&&(B=[0,1,0],X.vec3.cross(V,k,B)),X.vec3.normalize(V,V),X.vec3.normalize(B,B),X.vec3.normalize(k,k),[V[0],V[1],V[2],0,B[0],B[1],B[2],0,k[0],k[1],k[2],0,z[0],z[1],z[2],1]}(C);X.mat4.scale(w,w,[A,A,A*v]),X.mat4.translate(w,w,[-x[0],-x[1],-x[2]]
20);const L=X.mat4.multiply([],h.globeMatrix,D);return X.mat4.multiply(L,L,w),X.mat4.multiply(L,L,a),L}(n,e,i);if(s>0){const a=function(h,m){const g=m.worldSize,x=Cr(1,0)*g*Ys(m.center.lat,m.zoom)/ts(g),p=Cr(1,m.center.lat)*g,y=X.mat4.identity([]);return X.mat4.rotateY(y,y,hi(m.center.lng)),X.mat4.rotateX(y,y,hi(m.center.lat)),X.mat4.translate(y,y,[0,0,jr]),X.mat4.scale(y,y,[x,x,x*p]),X.mat4.translate(y,y,[m.point.x-.5*g,m.point.y-.5*g,0]),X.mat4.multiply(y,y,h),X.mat4.multiply(y,m.globeMatrix,y)}(n,e);return function(h,m,g){const x=(b,S,A)=>{const C=X.vec3.length(b),D=X.vec3.length(S),L=hr(b,S,A);return X.vec3.scale(L,L,1/X.vec3.length(L)*Ot(C,D,A))},p=x([h[0],h[1],h[2]],[m[0],m[1],m[2]],g),y=x([h[4],h[5],h[6]],[m[4],m[5],m[6]],g),w=x([h[8],h[9],h[10]],[m[8],m[9],m[10]],g),v=hr([h[12],h[13],h[14]],[m[12],m[13],m[14]],g);return[p[0],p[1],p[2],0,y[0],y[1],y[2],0,w[0],w[1],w[2],0,v[0],v[1],v[2],1]}(l,a,s)}return l}function tv(n,e,i,s){const l=Mt.projectAabbCorners(s,i);let a=Number.MAX_VALUE,h=-1;for(let x=0;x<l.length;++x){const p=l[x];p[0]=(.5*p[0]+.5)*e.width,p[1]=(.5-.5*p[1])*e.height,p[2]<a&&(h=x,a=p[2])}const m=x=>new dt(l[x][0],l[x][1]);let g;switch(h){case 0:case 6:g=[m(1),m(5),m(4),m(7),m(3),m(2),m(1)];break;case 1:case 7:g=[m(0),m(4),m(5),m(6),m(2),m(3),m(0)];break;case 3:case 5:g=[m(1),m(0),m(4),m(7),m(6),m(2),m(1)];break;default:g=[m(1),m(5),m(6),m(7),m(3),m(0),m(1)]}if(N(n,g))return a}const ab=yi([{name:"a_pos_3f",components:3,type:"Float32"}]),lb=yi([{name:"a_color_3f",components:3,type:"Float32"}]),cb=yi([{name:"a_color_4f",components:4,type:"Float32"}]),ub=yi([{name:"a_uv_2f",components:2,type:"Float32"}]),hb=yi([{name:"a_normal_3f",components:3,type:"Float32"}]),db=yi([{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"}]),pb=yi([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]),iv={None:0,Model:1,Symbol:2,FillExtrusion:4,All:7};class yp{constructor(e,i,s,l){this.message=(e?`${e}: `:"")+s,l&&(this.identifier=l),i!=null&&i.__line__&&(this.line=i.__line__)}}function rv(n,e){const i=n.indexOf("://")===-1;try{return new URL(n,i&&e?"http://example.com":void 0),!0}catch{return!1}}class nv{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 sv{constructor(){this.instancedDataArray=new yc,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}}class gm{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.projection=e.projection,this.index=e.index,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.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?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}updateFootprints(e,i){}populate(e,i,s,l){this.tileToMeter=u(s);const a=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:h,id:m,index:g,sourceLayerIndex:x}of e){const p=m??(h.properties&&h.properties.hasOwnProperty("id")?h.properties.id:void 0),y=I(h,a);if(!this.layers[0]._featureFilter.filter(new zi(this.zoom),y,s))continue;const w={id:p,sourceLayerIndex:x,index:g,geometry:a?y.geometry:M(h,s,l),properties:h.properties,type:h.type,patterns:{}},v=this.addFeature(w,w.geometry,y);v&&i.featureIndex.insert(h,w.geometry,g,x,this.index,this.instancesPerModel[v].instancedDataArray.length,ht/32)}this.lookup=null}update(e,i,s,l){for(const a in this.instancesPerModel){const h=this.instancesPerModel[a];for(const m in e)h.idToFeaturesIndex.hasOwnProperty(m)&&(this.evaluate(h.features[h.idToFeaturesIndex[m]],e[m],h,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(const i in this.instancesPerModel){const s=this.instancesPerModel[i];for(const l of s.features){const a=this.layers[0],h=l.feature,m=this.canonical,g=a.paint.get("model-rotation").evaluate(h,{},m),x=a.paint.get("model-scale").evaluate(h,{},m),p=a.paint.get("model-translation").evaluate(h,{},m);X.vec3.exactEquals(l.rotation,g)&&X.vec3.exactEquals(l.scale,x)&&X.vec3.exactEquals(l.translation,p)||(this.evaluate(l,l.featureStates,s,!0),e=!0)}}return e}updateReplacement(e,i,s,l){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const a=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);if(jf(this.activeReplacements,a))return!1;this.activeReplacements=a;let h=!1;for(const m in this.instancesPerModel){const g=this.instancesPerModel[m],x=g.instancedDataArray;for(const p of g.features){const y=p.instancedDataOffset,w=p.instancedDataCount;for(let v=0;v<w;v++){const b=16*(v+y);let S=x.float32[b+0];const A=S>ht;S=A?S-ht:S;const C=Math.floor(S),D=x.float32[b+1];let L=!1;for(const z of this.activeReplacements)if(!fg(z,s,iv.Model,l)&&!(z.min.x>C||C>z.max.x||z.min.y>D||D>z.max.y)&&(L=xg(vg(C,D,e.canonical,z.footprintTileId.canonical),z.footprint),L))break;x.float32[b]=L?S+ht:S,h=h||L!==A}}}return h}isEmpty(){for(const e in this.instancesPerModel)if(this.instancesPerModel[e].instancedDataArray.length!==0)return!1;return!0}uploadPending(){return!this.uploaded}upload(e){if(!this.uploaded)for(const i in this.instancesPerModel){const s=this.instancesPerModel[i];s.instancedDataArray.length<0||s.instancedDataArray.length===0||(s.instancedDataBuffer?s.instancedDataBuffer.updateData(s.instancedDataArray):s.instancedDataBuffer=e.createVertexBuffer(s.instancedDataArray,db.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(){for(const i in this.instancesPerModel){const s=this.instancesPerModel[i];s.instancedDataArray.length!==0&&s.instancedDataBuffer&&s.instancedDataBuffer.destroy()}const e=this.layers[0].modelManager;if(e&&this.modelUris)for(const i of this.modelUris)e.removeModel(i,"")}addFeature(e,i,s){const l=this.layers[0],a=l.layout.get("model-id").evaluate(s,{},this.canonical);if(!a)return Hi(`modelId is not evaluated for layer ${l.id} and it is not going to get rendered.`),a;rv(a,!1)&&(this.modelUris.includes(a)||this.modelUris.push(a)),this.instancesPerModel[a]||(this.instancesPerModel[a]=new sv);const h=this.instancesPerModel[a],m=h.instancedDataArray,g=new nv(s,m.length);for(const x of i)for(const p of x){if(p.x<0||p.x>=ht||p.y<0||p.y>=ht)continue;const y=(this.lookupDim-1)/ht,w=this.lookupDim*(p.y*y|0)+p.x*y|0;if(this.lookup){if(this.lookup[w]!==0)continue;this.lookup[w]=1}this.instanceCount++;const v=m.length;m.resize(v+1),h.instancesEvaluatedElevation.push(0),m.float32[16*v]=p.x,m.float32[16*v+1]=p.y}return g.instancedDataCount=h.instancedDataArray.length-g.instancedDataOffset,g.instancedDataCount>0&&(e.id&&(h.idToFeaturesIndex[e.id]=h.features.length),h.features.push(g),this.evaluate(g,{},h,!1)),a}getModelUris(){return this.modelUris}evaluate(e,i,s,l){const a=this.layers[0],h=e.feature,m=this.canonical,g=e.rotation=a.paint.get("model-rotation").evaluate(h,i,m),x=e.scale=a.paint.get("model-scale").evaluate(h,i,m),p=e.translation=a.paint.get("model-translation").evaluate(h,i,m),y=a.paint.get("model-color").evaluate(h,i,m);y.a=a.paint.get("model-color-mix-intensity").evaluate(h,i,m);const w=[];this.maxVerticalOffset<p[2]&&(this.maxVerticalOffset=p[2]),this.maxScale=Math.max(Math.max(this.maxScale,x[0]),Math.max(x[1],x[2])),ev(w,g,x);const v=Math.round(100*y.a)+y.b/1.05;for(let b=0;b<e.instancedDataCount;++b){const S=e.instancedDataOffset+b,A=16*S,C=s.instancedDataArray.float32;let D=0;l&&(D=C[A+6]-s.instancesEvaluatedElevation[S]);const L=0|C[A+1];
20C[A]=(0|C[A])+y.r/1.05,C[A+1]=L+y.g/1.05,C[A+2]=v,C[A+3]=1/(m.z>10?this.tileToMeter:u(m,L)),C[A+4]=p[0],C[A+5]=p[1],C[A+6]=p[2]+D,C[A+7]=w[0],C[A+8]=w[1],C[A+9]=w[2],C[A+10]=w[4],C[A+11]=w[5],C[A+12]=w[6],C[A+13]=w[8],C[A+14]=w[9],C[A+15]=w[10],s.instancesEvaluatedElevation[S]=p[2]}}}let ov,av;vt(gm,"ModelBucket",{omit:["layers"]}),vt(sv,"PerModelAttributes"),vt(nv,"ModelFeature");const yl=64,Lc={CoordinateSpaceTile:1,CoordinateSpaceYUp:2,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function lv(n,e,i,s,l,a,h,m,g,x=!1){const p=i.zoom,y=i.project(s),w=Ys(s.lat,p),v=1/w;X.mat4.identity(n),X.mat4.translate(n,n,[y.x+h[0]*v,y.y+h[1]*v,h[2]]);let b=1,S=1;const A=i.worldSize;if(x){if(i.projection.name==="mercator"){let z=0;i.elevation&&(z=i.elevation.getAtPointOrZero(new t(y.x/A,y.y/A),0));const k=X.vec4.transformMat4([],[y.x,y.y,z,1],i.projMatrix)[3]/i.cameraToCenterDistance;b=k,S=k*Ys(i.center.lat,p)}else if(i.projection.name==="globe"){const z=_m(n,i),k=X.mat4.multiply([],i.projMatrix,z),B=[0,0,0,1];X.vec4.transformMat4(B,B,k);const V=B[3]/i.cameraToCenterDistance,W=Kr(p),$=i.projection.pixelsPerMeter(s.lat,A)*Ys(s.lat,p),H=i.projection.pixelsPerMeter(i.center.lat,A)*Ys(i.center.lat,p);b=V/Ot($,Ud(i.center.lat),W),S=V*w/$,b*=H,S*=H}}else b=v;X.mat4.scale(n,n,[b,b,S]);const C=[...n],D=e.orientation,L=[];if(ev(L,[D[0]+l[0],D[1]+l[1],D[2]+l[2]],a),X.mat4.multiply(n,C,L),m&&i.elevation){let z=0;const k=[];if(g&&i.elevation){z=function(W,$,H,ae,Y){const le=$.elevation;if(!le)return 0;const _e=Mt.projectAabbCorners(H,ae),pe=Cr(1,Y.lat)*$.worldSize,xe=function(zt,_t){const St=[0,0,1],Ft=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(const Kt of Ft){const Ut=zt[Kt.corners[0]],ri=zt[Kt.corners[1]],Yt=zt[Kt.corners[2]],oi=[ri[0]-Ut[0],ri[1]-Ut[1],_t*(ri[2]-Ut[2])],mi=X.vec3.cross(oi,oi,[Yt[0]-Ut[0],Yt[1]-Ut[1],_t*(Yt[2]-Ut[2])]);X.vec3.normalize(mi,mi),Kt.dotProductWithUp=X.vec3.dot(mi,St)}return Ft.sort((Kt,Ut)=>Kt.dotProductWithUp-Ut.dotProductWithUp),Ft[0].corners}(_e,pe),ye=_e[xe[0]],Me=_e[xe[1]],Te=_e[xe[2]],Ae=_e[xe[3]],et=le.getAtPointOrZero(new t(ye[0]/$.worldSize,ye[1]/$.worldSize),0),Je=le.getAtPointOrZero(new t(Me[0]/$.worldSize,Me[1]/$.worldSize),0),xt=le.getAtPointOrZero(new t(Te[0]/$.worldSize,Te[1]/$.worldSize),0),st=le.getAtPointOrZero(new t(Ae[0]/$.worldSize,Ae[1]/$.worldSize),0),ct=(et+st)/2,it=(Je+xt)/2;return ct>it?Je<xt?gp(W,Me,Ae,ye,Je,st,et,pe):gp(W,Te,ye,Ae,xt,et,st,pe):et<st?gp(W,ye,Me,Te,et,Je,xt,pe):gp(W,Ae,Te,Me,st,xt,Je,pe),Math.max(ct,it)}(k,i,e.aabb,n,s);const B=X.mat4.fromQuat([],k),V=X.mat4.multiply([],B,L);X.mat4.multiply(n,C,V)}else z=i.elevation.getAtPointOrZero(new t(y.x/A,y.y/A),0);z!==0&&(n[14]+=z)}}function Ch(n,e,i=!1){n.uploaded||(n.gfxTexture=new pm(e,n.image,i?e.gl.R8:e.gl.RGBA8,{useMipmap:n.sampler.minFilter>=e.gl.NEAREST_MIPMAP_NEAREST}),n.uploaded=!0,n.image=null)}function fb(n,e,i){n.indexBuffer=e.createIndexBuffer(n.indexArray,!1,!0),n.vertexBuffer=e.createVertexBuffer(n.vertexArray,ab.members,!1,!0),n.normalArray&&(n.normalBuffer=e.createVertexBuffer(n.normalArray,hb.members,!1,!0)),n.texcoordArray&&(n.texcoordBuffer=e.createVertexBuffer(n.texcoordArray,ub.members,!1,!0)),n.colorArray&&(n.colorBuffer=e.createVertexBuffer(n.colorArray,(n.colorArray.bytesPerElement===12?lb:cb).members,!1,!0)),n.featureArray&&(n.pbrBuffer=e.createVertexBuffer(n.featureArray,pb.members,!0)),n.segments=Ui.simpleSegment(0,0,n.vertexArray.length,n.indexArray.length);const s=n.material;s.pbrMetallicRoughness.baseColorTexture&&Ch(s.pbrMetallicRoughness.baseColorTexture,e),s.pbrMetallicRoughness.metallicRoughnessTexture&&Ch(s.pbrMetallicRoughness.metallicRoughnessTexture,e),s.normalTexture&&Ch(s.normalTexture,e),s.occlusionTexture&&Ch(s.occlusionTexture,e,i),s.emissionTexture&&Ch(s.emissionTexture,e)}function ym(n,e,i){if(n.meshes)for(const s of n.meshes)fb(s,e,i);if(n.children)for(const s of n.children)ym(s,e,i)}function vp(n){if(n.meshes)for(const e of n.meshes)e.indexArray.destroy(),e.vertexArray.destroy(),e.colorArray&&e.colorArray.destroy(),e.normalArray&&e.normalArray.destroy(),e.texcoordArray&&e.texcoordArray.destroy(),e.featureArray&&e.featureArray.destroy();if(n.children)for(const e of n.children)vp(e)}function vm(n){if(n.meshes)for(const i of n.meshes)i.vertexBuffer&&(i.vertexBuffer.destroy(),i.indexBuffer.destroy(),i.normalBuffer&&i.normalBuffer.destroy(),i.texcoordBuffer&&i.texcoordBuffer.destroy(),i.colorBuffer&&i.colorBuffer.destroy(),i.pbrBuffer&&i.pbrBuffer.destroy(),i.segments.destroy(),i.material&&((e=i.material).pbrMetallicRoughness.baseColorTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),e.pbrMetallicRoughness.metallicRoughnessTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),e.normalTexture&&e.normalTexture.gfxTexture&&e.normalTexture.gfxTexture.destroy(),e.emissionTexture&&e.emissionTexture.gfxTexture&&e.emissionTexture.gfxTexture.destroy(),e.occlusionTexture&&e.occlusionTexture.gfxTexture&&e.occlusionTexture.gfxTexture.destroy()));var e;if(n.children)for(const i of n.children)vm(i)}class Dc{constructor(e,i,s){this._demTile=e,this._dem=this._demTile.dem,this._scale=i,this._offset=s}static create(e,i,s){const l=s||e.findDEMTileFor(i);if(!l||!l.dem)return;const a=l.dem,h=l.tileID,m=1<<i.canonical.z-h.canonical.z;return new Dc(l,a.dim/ht/m,[(i.canonical.x/m-h.canonical.x)*a.dim,(i.canonical.y/m-h.canonical.y)*a.dim])}tileCoordToPixel(e,i){const s=i*this._scale+this._offset[1],l=Math.floor(e*this._scale+this._offset[0]),a=Math.floor(s);return new dt(l,a)}getElevationAt(e,i,s,l){const a=e*this._scale+this._offset[0],h=i*this._scale+this._offset[1],m=Math.floor(a),g=Math.floor(h),x=this._dem;return l=!!l,s?Ot(Ot(x.get(m,g,l),x.get(m,g+1,l),h-g),Ot(x.get(m+1,g,l),x.get(m+1,g+1,l),h-g),a-m):x.get(m,g,l)}getElevationAtPixel(e,i,s){return this._dem.get(e,i,!!s)}getMeterToDEM(e){return(1<<this._demTile.tileID.canonical.z)*Cr(1,e)*this._dem.stride}}const xm=new Float32Array(262144),vl=new Uint8Array(262144);function cv(n){let e=0;if(n.meshes)for(const i of n.meshes)e=Math.max(e,i.aabb.max[2]);if(n.children)for(const i of n.children)e=Math.max(e,cv(i));return e}function uv(n,e,i){if(n.meshes)for(const s of n.meshes){if(s.aabb.min[0]===1/0)continue;const l=Mt.applyTransform(s.aabb,n.matrix);i.insert(e,l.min[0],l.min[1],l.max[0],l.max[1])}if(n.children)for(const s of n.children)uv(s,e,i)}const hv=["","wall","door","roof","window","lamp","logo"];class dv{constructor(e){this.node=e,this.evaluatedRMEA=[[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[.4,1,0,1],[1,0,0,1],[1,0,0,1]],this.hiddenByReplacement=!1,this.evaluatedScale=[1,1,1],this.evaluatedColor=[],this.emissionHeightBasedParams=[],this.cameraCollisionOpacity=1,this.feature={type:"Point",id:e.id,geometry:[],properties:{height:cv(e)}},this.aabb=this._getLocalBounds(),this.state=null}_getLocalBounds(){if(!this.node.meshes)return new Mt([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0;const i=new Mt([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const s of this.node.meshes)this.node.lightMeshIndex!==e&&(s.transformedAabb=Mt.applyTransformFast(s.aabb,this.node.matrix),i.encapsulate(s.transformedAabb)),e++;this.aabb=i}return this.aabb}}class xp{constructor(e,i,s,l,a,h,m){this.id=s,this.layers=e,this.layerIds=this.layers.map(g=>g.fqid),this.stateDependentLayerIds=this.layers.filter(g=>g.isStateDependent()).map(g=>g.id),this.modelTraits|=Lc.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,l&&(this.modelTraits|=Lc.HasMapbox
20MeshFeatures),a&&(this.modelTraits|=Lc.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=h,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const g of i)this.nodesInfo.push(new dv(g)),uv(g,m.featureIndexArray.length,m.grid),m.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,m.bucketLayerIDs.length-1,0);this.states={}}updateFootprints(e,i){for(const s of this.getNodesInfo()){const l=s.node;l.footprint&&i.push({footprint:l.footprint,id:e})}}update(e){const i=Object.keys(e).length!==0;if(i&&!this.stateDependentLayers.length)return;const s=i?this.stateDependentLayers:this.layers;if(!Dn(e,this.states))for(const l of s)this.evaluate(l,e);this.states=structuredClone(e)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(e){if(!this.needsUpload)return;const i=this.getNodesInfo();for(const s of i){const l=s.node;this.uploaded?this.updatePbrBuffer(l):ym(l,e,!0)}for(const s of i)vp(s.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let i=!1;if(!e.meshes)return i;for(const s of e.meshes)s.pbrBuffer&&(s.pbrBuffer.updateData(s.featureArray),i=!0);return i}needsReEvaluation(e,i,s){const l=e.transform.projectionOptions,a=e.style.getBrightness(),h=this.brightness!==a;if(!this.uploaded||this.dirty||l.name!==this.projection.name||Ph(s.paint.get("model-color").value,h)||Ph(s.paint.get("model-color-mix-intensity").value,h)||Ph(s.paint.get("model-roughness").value,h)||Ph(s.paint.get("model-emissive-strength").value,h)||Ph(s.paint.get("model-height-based-emissive-strength-multiplier").value,h)){this.projection=l,this.brightness=a;const m=this.getNodesInfo();for(const g of m)g.state=null;return!0}return!1}evaluateScale(e,i){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;const s=this.getNodesInfo(),l=this.id.canonical;for(const a of s){const h=a.feature;a.evaluatedScale=i.paint.get("model-scale").evaluate(h,{},l)}}evaluate(e,i){const s=this.getNodesInfo();for(const l of s){if(!l.node.meshes)continue;const a=l.feature,h=i&&i[a.id];if(Dn(h,l.state))continue;l.state=structuredClone(h);const m=l.node.meshes&&l.node.meshes[0].featureData,g=l.evaluatedColor[2],x=l.evaluatedRMEA[2],p=this.id.canonical;if(l.hasTranslucentParts=!1,m){for(let y=0;y<hv.length;y++){const w=hv[y];w.length&&(a.properties.part=w);const v=e.paint.get("model-color").evaluate(a,h,p).toRenderColor(null),b=e.paint.get("model-color-mix-intensity").evaluate(a,h,p);l.evaluatedColor[y]=[v.r,v.g,v.b,b],l.evaluatedRMEA[y][0]=e.paint.get("model-roughness").evaluate(a,h,p),l.evaluatedRMEA[y][2]=e.paint.get("model-emissive-strength").evaluate(a,h,p),l.evaluatedRMEA[y][3]=v.a,l.emissionHeightBasedParams[y]=e.paint.get("model-height-based-emissive-strength-multiplier").evaluate(a,h,p),!l.hasTranslucentParts&&v.a<1&&(l.hasTranslucentParts=!0)}delete a.properties.part,_b(l,g!==l.evaluatedColor[2]||x!==l.evaluatedRMEA[2],this.modelTraits)}else l.evaluatedRMEA[0][2]=e.paint.get("model-emissive-strength").evaluate(a,h,p);l.evaluatedScale=e.paint.get("model-scale").evaluate(a,h,p),this.updatePbrBuffer(l.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(e,i,s,l){const a=e.findDEMTileFor(s);if(a&&(a.tileID.canonical!==this.terrainTile||i!==this.terrainExaggeration)){if(a.dem&&a.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=a.tileID.overscaledZ;const h=Dc.create(e,s,a);if(!h)return;this.modelTraits&Lc.HasMapboxMeshFeatures&&this.updateDEM(e,h,s,l);for(const m of this.getNodesInfo()){const g=m.node;if(!g.footprint||!g.footprint.vertices||!g.footprint.vertices.length)continue;const x=g.footprint.vertices;let p=h.getElevationAt(x[0].x,x[0].y,!0,!0);for(let y=1;y<x.length;y++)p=Math.min(p,h.getElevationAt(x[y].x,x[y].y,!0,!0));g.elevation=p}}this.terrainTile=a.tileID.canonical,this.terrainExaggeration=i}}updateDEM(e,i,s,l){let a=i._dem._modifiedForSources[l];if(a===void 0&&(i._dem._modifiedForSources[l]=[],a=i._dem._modifiedForSources[l]),a.includes(s.canonical))return;const h=i._dem.dim;a.push(s.canonical);let m=!1;for(const g of this.getNodesInfo()){const x=g.node;if(!x.footprint||!x.footprint.grid)continue;const p=x.footprint.grid,y=i.tileCoordToPixel(p.min.x,p.min.y),w=i.tileCoordToPixel(p.max.x,p.max.y),v=Math.min(Math.min(h-w.y,y.x),Math.min(y.y,h-w.x));if(v<0)continue;const b=Qt(v,2,5);let S=Math.max(0,y.x-b),A=Math.max(0,y.y-b),C=Math.min(w.x+b,h-1),D=Math.min(w.y+b,h-1);for(let B=A;B<=D;++B)for(let V=S;V<=C;++V)vl[B*h+V]=255;let L=0,z=0;for(let B=0;B<p.cellsY;++B)for(let V=0;V<p.cellsX;++V){if(!p.cells[B*p.cellsX+V])continue;const W=i.tileCoordToPixel(p.min.x+V/p.xScale,p.min.y+B/p.yScale),$=i.tileCoordToPixel(p.min.x+(V+1)/p.xScale,p.min.y+(B+1)/p.yScale);for(let H=W.y;H<=Math.min($.y+1,h-1);++H)for(let ae=W.x;ae<=Math.min($.x+1,h-1);++ae)vl[H*h+ae]===255&&(vl[H*h+ae]=0,L+=i.getElevationAtPixel(ae,H),z++)}const k=L/z;S=Math.max(1,y.x-b),A=Math.max(1,y.y-b),C=Math.min(w.x+b,h-2),D=Math.min(w.y+b,h-2),m=!0;for(let B=A;B<=D;++B)for(let V=S;V<=C;++V)vl[B*h+V]===0&&(xm[B*h+V]=i._dem.set(V,B,k));for(let B=1;B<b;++B){S=Math.max(1,y.x-B),A=Math.max(1,y.y-B),C=Math.min(w.x+B,h-2),D=Math.min(w.y+B,h-2);for(let V=A;V<=D;++V)for(let W=S;W<=C;++W){const $=V*h+W;if(vl[$]===255){let H=0,ae=0,Y=-1,le=-1;for(let _e=-1;_e<=1;++_e)for(let pe=-1;pe<=1;++pe){const xe=(V+_e)*h+W+pe;if(vl[xe]>=B)continue;const ye=xm[xe],Me=Math.abs(ye);Me>ae&&(H=ye,ae=Me,Y=pe,le=_e)}
20if(ae>.1){const _e=1-(B+.5*Math.abs(Y*le))/b;let pe=i._dem.get(W,V)+H*_e;const xe=i._dem.get(W+Y,V+le),ye=i._dem.get(W-Y,V-le,!0);(pe-xe)*(pe-ye)>0&&(pe=(xe+ye)/2),xm[$]=i._dem.set(W,V,pe),vl[$]=B}}}}}m&&(i._demTile.needsDEMTextureUpload=!0,i._dem._timestamp=Be.now())}setFilter(e){this.filter=e?Nu(e):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(e=>this.filter.filter(new zi(this.id.overscaledZ),e.feature,this.id.canonical)):this.nodesInfo}destroy(){const e=this.getNodesInfo();for(const i of e)vp(i.node),vm(i.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const s=i.getReplacementRegionsForTile(e.toUnwrapped()),l=this.getNodesInfo();for(let a=0;a<this.nodesInfo.length;a++){const h=l[a].node;l[a].hiddenByReplacement=!!h.footprint&&!s.find(m=>m.footprint===h.footprint)}}getHeightAtTileCoord(e,i){const s=this.getNodesInfo(),l=[],a=[0,0,0],h=X.mat4.identity([]);for(let m=0;m<this.nodesInfo.length;m++){const g=s[m],x=g.node.meshes[0],p=x.transformedAabb;if(e<p.min[0]||i<p.min[1]||e>p.max[0]||i>p.max[1])continue;if(g.node.hidden===!0)return{height:1/0,maxHeight:g.feature.properties.height,hidden:!1,verticalScale:g.evaluatedScale[2]};X.mat4.invert(h,g.node.matrix),a[0]=e,a[1]=i,X.vec3.transformMat4(a,a,h);const y=(a[0]-x.aabb.min[0])/(x.aabb.max[0]-x.aabb.min[0])*yl|0,w=Math.min(63,(a[1]-x.aabb.min[1])/(x.aabb.max[1]-x.aabb.min[1])*yl|0)*yl+Math.min(63,y),v=x.heightmap[w];if(!(v<0&&g.node.footprint))return g.hiddenByReplacement?void 0:{height:v,maxHeight:g.feature.properties.height,hidden:!1,verticalScale:g.evaluatedScale[2]};if(g.node.footprint.grid.query(new dt(e,i),new dt(e,i),l),l.length>0)return{height:void 0,maxHeight:g.feature.properties.height,hidden:g.hiddenByReplacement,verticalScale:g.evaluatedScale[2]}}}}function Ph(n,e){return!n.isLightConstant&&e}function mb(n,e,i,s,l,a,h,m){let g=(61440&e|(61440&e)>>4)>>8,x=(3840&e|(3840&e)>>4)>>4,p=240&e|(240&e)>>4;i[3]>0&&(g=Ot(g,255*i[0],i[3]),x=Ot(x,255*i[1],i[3]),p=Ot(p,255*i[2],i[3]));const y=g<<8|x,w=p<<8|Math.floor(255*s[3]),v=function(B){const V=Qt(B,0,2);return Math.min(Math.round(.5*V*255),255)}(s[2])<<8|15*s[0]<<4|15*s[1],b=Qt(l[0],0,1),S=Qt(l[1],0,1),A=Qt(l[2],0,1),C=Qt(l[3],0,1);let D,L,z,k;if(b!==S&&h!==a&&S!==b){const B=h-a;L=1/(B*(S-b)),z=-(a+B*b)/(B*(S-b));const V=Qt(l[4],-1,1);k=Math.pow(10,V),D=255*A<<8|255*C}else D=65535,L=0,z=1,k=1;if(n.emplaceBack(y,w,v,D,L,z,k),m){const B=m.length;m.clear();for(let V=0;V<B;V++)m.emplaceBack(y,w,v,D,L,z,k)}}function _b(n,e,i){const s=n.node;let l=0;const a=i&Lc.HasMeshoptCompression;for(const h of s.meshes){if(s.lights&&s.lightMeshIndex===l||!h.featureData)continue;h.featureArray=new vc,h.featureArray.reserve(h.featureData.length);let m=e;for(const g of h.featureData){const x=a?65535&g:g>>16&65535,p=a?g>>16&65535:65535&g,y=(15&p)<8?15&p:0,w=n.evaluatedRMEA[y],v=n.evaluatedColor[y],b=n.emissionHeightBasedParams[y];let S;if(m&&y===2&&s.lights&&(S=new vc,S.resize(10*s.lights.length)),mb(h.featureArray,x,v,w,b,h.aabb.min[2],h.aabb.max[2],S),S&&m){m=!1;const A=s.meshes[s.lightMeshIndex];A.featureArray=S,A.featureArray._trim()}}h.featureArray._trim(),l++}}function pv(n,e,i,s){const l=1<<n.z;e.lat=Sr((s/ht+n.y)/l),e.lng=on((i/ht+n.x)/l)}vt(xp,"Tiled3dModelBucket",{omit:["layers"]}),vt(dv,"Tiled3dModelFeature");const gb={circle:class extends br{constructor(n,e,i,s){super(n,{layout:Se||(Se=new Zi({"circle-sort-key":new yt(Pe.layout_circle["circle-sort-key"]),"circle-elevation-reference":new lt(Pe.layout_circle["circle-elevation-reference"]),visibility:new lt(Pe.layout_circle.visibility)})),paint:He||(He=new Zi({"circle-radius":new yt(Pe.paint_circle["circle-radius"]),"circle-color":new yt(Pe.paint_circle["circle-color"]),"circle-blur":new yt(Pe.paint_circle["circle-blur"]),"circle-opacity":new yt(Pe.paint_circle["circle-opacity"]),"circle-translate":new lt(Pe.paint_circle["circle-translate"]),"circle-translate-anchor":new lt(Pe.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new lt(Pe.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new lt(Pe.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new yt(Pe.paint_circle["circle-stroke-width"]),"circle-stroke-color":new yt(Pe.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new yt(Pe.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new lt(Pe.paint_circle["circle-emissive-strength"]),"circle-color-use-theme":new yt({type:"string",default:"default","property-type":"data-driven"}),"circle-stroke-color-use-theme":new yt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s)}createBucket(n){return new O(n)}queryRadius(n){const e=n;return Ee("circle-radius",this,e)+Ee("circle-stroke-width",this,e)+Ze(this.paint.get("circle-translate"))}queryIntersectsFeature(n,e,i,s,l,a,h,m){const g=ot(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),a.angle,n.pixelToTileUnitsFactor),x=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i);return Ec(n,s,a,h,m,this.paint.get("circle-pitch-alignment")==="map",this.paint.get("circle-pitch-scale")==="map",g,x)}getProgramIds(){return["circle"]}getDefaultProgramParams(n,e,i){const s=ma(this);return{config:new bo(this,{zoom:e,lut:i}
vendor: 13,050 bytes, line 20
20),defines:s,overrideFog:!1}}},heatmap:class extends br{createBucket(n){return new F_(n)}constructor(n,e,i,s){super(n,{layout:B_||(B_=new Zi({visibility:new lt(Pe.layout_heatmap.visibility)})),paint:N_||(N_=new Zi({"heatmap-radius":new yt(Pe.paint_heatmap["heatmap-radius"]),"heatmap-weight":new yt(Pe.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new lt(Pe.paint_heatmap["heatmap-intensity"]),"heatmap-color":new oa(Pe.paint_heatmap["heatmap-color"]),"heatmap-opacity":new lt(Pe.paint_heatmap["heatmap-opacity"]),"heatmap-color-use-theme":new yt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(n){n==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=ch({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(n){return Ee("heatmap-radius",this,n)}queryIntersectsFeature(n,e,i,s,l,a,h,m){const g=this.paint.get("heatmap-radius").evaluate(e,i);return Ec(n,s,a,h,m,!0,!0,new dt(0,0),g)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(n,e,i){return n==="heatmap"?{config:new bo(this,{zoom:e,lut:i}),overrideFog:!1}:{}}},hillshade:class extends br{constructor(n,e,i,s){super(n,{layout:V_||(V_=new Zi({visibility:new lt(Pe.layout_hillshade.visibility)})),paint:U_||(U_=new Zi({"hillshade-illumination-direction":new lt(Pe.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new lt(Pe.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new lt(Pe.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new lt(Pe.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new lt(Pe.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new lt(Pe.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new lt(Pe.paint_hillshade["hillshade-emissive-strength"]),"hillshade-shadow-color-use-theme":new yt({type:"string",default:"default","property-type":"data-driven"}),"hillshade-highlight-color-use-theme":new yt({type:"string",default:"default","property-type":"data-driven"}),"hillshade-accent-color-use-theme":new yt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s)}shouldRedrape(){return this.hasOffscreenPass()&&this.paint.get("hillshade-illumination-anchor")==="viewport"}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}getProgramIds(){return["hillshade","hillshadePrepare"]}getDefaultProgramParams(n,e,i){return{overrideFog:!1}}},fill:class extends br{constructor(n,e,i,s){super(n,{layout:og||(og=new Zi({"fill-sort-key":new yt(Pe.layout_fill["fill-sort-key"]),visibility:new lt(Pe.layout_fill.visibility),"fill-elevation-reference":new lt(Pe.layout_fill["fill-elevation-reference"]),"fill-construct-bridge-guard-rail":new yt(Pe.layout_fill["fill-construct-bridge-guard-rail"])})),paint:ag||(ag=new Zi({"fill-antialias":new lt(Pe.paint_fill["fill-antialias"]),"fill-opacity":new yt(Pe.paint_fill["fill-opacity"]),"fill-color":new yt(Pe.paint_fill["fill-color"]),"fill-outline-color":new yt(Pe.paint_fill["fill-outline-color"]),"fill-translate":new lt(Pe.paint_fill["fill-translate"]),"fill-translate-anchor":new lt(Pe.paint_fill["fill-translate-anchor"]),"fill-pattern":new yt(Pe.paint_fill["fill-pattern"]),"fill-emissive-strength":new lt(Pe.paint_fill["fill-emissive-strength"]),"fill-z-offset":new yt(Pe.paint_fill["fill-z-offset"]),"fill-bridge-guard-rail-color":new yt(Pe.paint_fill["fill-bridge-guard-rail-color"]),"fill-tunnel-structure-color":new yt(Pe.paint_fill["fill-tunnel-structure-color"]),"fill-color-use-theme":new yt({type:"string",default:"default","property-type":"data-driven"}),"fill-outline-color-use-theme":new yt({type:"string",default:"default","property-type":"data-driven"}),"fill-bridge-guard-rail-color-use-theme":new yt({type:"string",default:"default","property-type":"data-driven"}),"fill-tunnel-structure-color-use-theme":new yt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s)}getProgramIds(){const n=this.paint.get("fill-pattern"),e=n&&n.constantOr(1),i=[e?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&i.push(e&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),i}getDefaultProgramParams(n,e,i){return{config:new bo(this,{zoom:e,lut:i}),overrideFog:!1}}recalculate(n,e){super.recalculate(n,e);const i=this.paint._values["fill-outline-color"];i.value.kind==="constant"&&i.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(n){return new Nf(n)}queryRadius(){return Ze(this.paint.get("fill-translate"))}queryIntersectsFeature(n,e,i,s,l,a){return!n.queryGeometry.isAboveHorizon&&U(We(n.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),a.angle,n.pixelToTileUnitsFactor),s)}isTileClipped(){return this.paint.get("fill-z-offset").constantOr(1)===0}is3D(n){if(this.paint.get("fill-z-offset").constantOr(1)!==0)return!0;const e=this.layout&&this.layout.get("fill-elevation-reference")!=="none";return n!=null?e&&!n:e}},"fill-extrusion":class extends br{constructor(n,e,i,s){super(n,{layout:Og||(Og=new Zi({visibility:new lt(Pe["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new lt(Pe["layout_fill-extrusion"]["fill-extrusion-edge-radius"])})),paint:kg||(kg=new Zi({"fill-extrusion-opacity":new lt(Pe["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new yt(Pe["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new lt(Pe["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new lt(Pe["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new yt(Pe["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new yt(Pe["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new yt(Pe["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new lt(Pe["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new lt(Pe["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new lt(Pe["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new lt(Pe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new lt(Pe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new lt(Pe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new lt(Pe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new lt(Pe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new lt(Pe["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new lt(Pe["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new yt(Pe["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new yt(Pe["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new lt(Pe["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new lt(Pe["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new lt(Pe["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new lt(Pe["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-emissive-strength":new yt(Pe["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new yt(Pe["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new lt(Pe["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]),"fill-extrusion-color-use-theme":new yt({type:"string",default:"default","property-type":"data-driven"}),"fill-extrusion-flood-light-color-use-theme":new yt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(n){return new Kd(n)}queryRadius(){return Ze(this.paint.get("fill-extrusion-translate"))}is3D(n){return!0}hasShadowPass(){return this.paint.get("fill-extrusion-cast-shadows")}cutoffRange(){return this.paint.get("fill-extrusion-cutoff-fade-range")}canCastShadows(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}queryIntersectsFeature(n,e,i,s,l,a,h,m,g){const x=ot(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),a.angle,n.pixelToTileUnitsFactor),p=this.paint.get("fill-extrusion-height").evaluate(e,i),y=this.paint.get("fill-extrusion-base").evaluate(e,i),w=[0,0],v=m&&a.elevation,b=a.elevation?a.elevation.exaggeration():1,S=n.tile.getBucket(this);if(v&&S instanceof Kd){const z=S.centroidVertexArray,k=g+1;k<z.length&&(w[0]=z.geta_centroid_pos0(k),w[1]=z.geta_centroid_pos1(k))}if(w[0]===0&&w[1]===1)return!1;a.projection.name==="globe"&&(s=Dg([s],[new dt(0,0),new dt(ht,ht)],n.tileID.canonical).map(z=>z.polygon).flat());const A=v?m:null,[C,D]=function(z,k,B,V,W,$,H,ae,Y,le,_e){return z.projection.name==="globe"?function(pe,xe,ye,Me,Te,Ae,et,Je,xt,st,ct){const it=[],zt=[],_t=pe.projection.upVectorScale(ct,pe.center.lat,pe.worldSize).metersToTile,St=[0,0,0,1],Ft=[0,0,0,1],Kt=(ri,Yt,oi,mi)=>{ri[0]=Yt,ri[1]=oi,ri[2]=mi,ri[3]=1},Ut=Lg();ye>0&&(ye+=Ut),Me+=Ut;for(const ri of xe){const Yt=[],oi=[];for(const mi of ri){const Li=mi.x+Te.x,Nt=mi.y+Te.y,ui=pe.projection.projectTilePoint(Li,Nt,ct),Bi=pe.projection.upVector(ct,mi.x,mi.y);let Gi=ye,Wi=Me;if(et){const Ki=Bg(Li,Nt,ye,Me,et,Je,xt,st);Gi+=Ki.base,Wi+=Ki.top}ye!==0?Kt(St,ui.x+Bi[0]*_t*Gi,ui.y+Bi[1]*_t*Gi,ui.z+Bi[2]*_t*Gi):Kt(St,ui.x,ui.y,ui.z),Kt(Ft,ui.x+Bi[0]*_t*Wi,ui.y+Bi[1]*_t*Wi,ui.z+Bi[2]*_t*Wi),X.vec3.transformMat4(St,St,Ae),X.vec3.transformMat4(Ft,Ft,Ae),Yt.push(new gl(St[0],St[1],St[2])),oi.push(new gl(Ft[0],Ft[1],Ft[2]))}it.push(Yt),zt.push(oi)}return[it,zt]}(z,k,B,V,W,$,H,ae,Y,le,_e):H?function(pe,xe,ye,Me,Te,Ae,et,Je,xt){const st=[],ct=[],it=[0,0,0,1];for(const zt of pe){const _t=[],St=[];for(const Ft of zt){const Kt=Ft.x+Me.x,Ut=Ft.y+Me.y,ri=Bg(Kt,Ut,xe,ye,Ae,et,Je,xt);it[0]=Kt,it[1]=Ut,it[2]=ri.base,it[3]=1,X.vec4.transformMat4(it,it,Te),it[3]=Math.max(it[3],1e-5);const Yt=new gl(it[0]/it[3],it[1]/it[3],it[2]/it[3]);it[0]=Kt,it[1]=Ut,it[2]=ri.top,it[3]=1,X.vec4.transformMat4(it,it,Te),it[3]=Math.max(it[3],1e-5);const oi=new gl(it[0]/it[3],it[1]/it[3],it[2]/it[3]);_t.push(Yt),St.push(oi)}st.push(_t),ct.push(St)}return[st,ct]}(k,B,V,W,$,H,ae,Y,le):function(pe,xe,ye,Me,Te){const Ae=[],et=[],Je=Te[8]*xe,xt=Te[9]*xe,st=Te[10]*xe,ct=Te[11]*xe,it=Te[8]*ye,zt=Te[9]*ye,_t=Te[10]*ye,St=Te[11]*ye;for(const Ft of pe){const Kt=[],Ut=[];for(const ri of Ft){const Yt=ri.x+Me.x,oi=ri.y+Me.y,mi=Te[0]*Yt+Te[4]*oi+Te[12],Li=Te[1]*Yt+Te[5]*oi+Te[13],Nt=Te[2]*Yt+Te[6]*oi+Te[14],ui=Te[3]*Yt+Te[7]*oi+Te[15],Bi=mi+Je,Gi=Li+xt,Wi=Nt+st,Ki=Math.max(ui+ct,1e-5),Ri=mi+it,pr=Li+zt,Jr=Nt+_t,sr=Math.max(ui+St,1e-5);Kt.push(new gl(Bi/Ki,Gi/Ki,Wi/Ki)),Ut.push(new gl(Ri/sr,pr/sr,Jr/sr))}Ae.push(Kt),et.push(Ut)}return[Ae,et]}(k,B,V,W,$)}(a,s,y,p,x,h,A,w,b,a.center.lat,n.tileID.canonical),L=n.queryGeometry;return function(z,k,B){let V=1/0;U(B,k)&&(V=Fg(B,k[0]));for(let W=0;W<k.length;W++){const $=k[W],H=z[W];for(let ae=0;ae<$.length-1;ae++){const Y=$[ae],le=[Y,$[ae+1],H[ae+1],H[ae],Y];N(B,le)&&(V=Math.min(V,Fg(B,le)))}}return V!==1/0&&V}(C,D,L.isPointQuery()?L.screenBounds:L.screenGeometry)}},line:class extends br{constructor(n,e,i,s){const l=Wg();super(n,l,e,i,s),l.layout&&(this.layout=new sa(l.layout)),this.gradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1}_handleSpecialPaintPropertyUpdate(n){if(n==="line-gradient"){const e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof Kn,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}recalculate(n,e){super.recalculate(n,e),this.paint._values["line-floorwidth"]=(()=>
20{if(yh)return yh;const i=Wg();return yh=new y1(i.paint.properties["line-width"].specification),yh.useIntegerZoom=!0,yh})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,n)}createBucket(n){return new Hf(n)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(n,e,i){const s=Hg(this);return{config:new bo(this,{zoom:e,lut:i}),defines:s,overrideFog:!1}}queryRadius(n){const e=n,i=Xg(Ee("line-width",this,e),Ee("line-gap-width",this,e)),s=Ee("line-offset",this,e);return i/2+Math.abs(s)+Ze(this.paint.get("line-translate"))}queryIntersectsFeature(n,e,i,s,l,a){if(n.queryGeometry.isAboveHorizon)return!1;const h=We(n.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),a.angle,n.pixelToTileUnitsFactor),m=n.pixelToTileUnitsFactor/2*Xg(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),g=this.paint.get("line-offset").evaluate(e,i);return g&&(s=function(x,p){const y=[],w=new dt(0,0);for(let v=0;v<x.length;v++){const b=x[v],S=[];for(let A=0;A<b.length;A++){const C=b[A],D=b[A+1],L=A===0?w:C.sub(b[A-1])._unit()._perp(),z=A===b.length-1?w:D.sub(C)._unit()._perp(),k=L._add(z)._unit();k._mult(1/(k.x*z.x+k.y*z.y)),S.push(k._mult(p)._add(C))}y.push(S)}return y}(s,g*n.pixelToTileUnitsFactor)),function(x,p,y){for(let w=0;w<p.length;w++){const v=p[w];if(x.length>=3){for(let b=0;b<v.length;b++)if(ie(x,v[b]))return!0}if(q(x,v,y))return!0}return!1}(h,s,m)}isTileClipped(){return this.hasNonElevatedBuckets}isDraped(n){return!this.hasElevatedBuckets}},symbol:dp,background:class extends br{constructor(n,e,i,s){super(n,{layout:By||(By=new Zi({visibility:new lt(Pe.layout_background.visibility)})),paint:Ny||(Ny=new Zi({"background-pitch-alignment":new lt(Pe.paint_background["background-pitch-alignment"]),"background-color":new lt(Pe.paint_background["background-color"]),"background-pattern":new lt(Pe.paint_background["background-pattern"]),"background-opacity":new lt(Pe.paint_background["background-opacity"]),"background-emissive-strength":new lt(Pe.paint_background["background-emissive-strength"]),"background-color-use-theme":new yt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(n,e,i){return{overrideFog:!1}}is3D(n){return this.paint.get("background-pitch-alignment")==="viewport"}},raster:Gy,"raster-particle":Yy,sky:class extends br{constructor(n,e,i,s){super(n,{layout:Zy||(Zy=new Zi({visibility:new lt(Pe.layout_sky.visibility)})),paint:Wy||(Wy=new Zi({"sky-type":new lt(Pe.paint_sky["sky-type"]),"sky-atmosphere-sun":new lt(Pe.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new lt(Pe.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new lt(Pe.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new lt(Pe.paint_sky["sky-gradient-radius"]),"sky-gradient":new oa(Pe.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new lt(Pe.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new lt(Pe.paint_sky["sky-atmosphere-color"]),"sky-opacity":new lt(Pe.paint_sky["sky-opacity"]),"sky-gradient-use-theme":new yt({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new yt({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new yt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(n){n==="sky-gradient"?this._updateColorRamp():n!=="sky-atmosphere-sun"&&n!=="sky-atmosphere-halo-color"&&n!=="sky-atmosphere-color"&&n!=="sky-atmosphere-sun-intensity"||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=ch({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}
20needsSkyboxCapture(n){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const e=n.style.light.properties.get("position");return this._lightPosition.azimuthal!==e.azimuthal||this._lightPosition.polar!==e.polar}return!1}getCenter(n,e){if(this.paint.get("sky-type")==="atmosphere"){const s=this.paint.get("sky-atmosphere-sun"),l=!s,a=n.style.light,h=a.properties.get("position");return l&&a.properties.get("anchor")==="viewport"&&Hi("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),l?fm(h.azimuthal,90-h.polar,e):fm(s[0],90-s[1],e)}const i=this.paint.get("sky-gradient-center");return fm(i[0],90-i[1],e)}isSky(){return!0}markSkyboxValid(n){this._skyboxInvalidated=!1,this._lightPosition=n.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const n=this.paint.get("sky-type");return n==="atmosphere"?["skyboxCapture","skybox"]:n==="gradient"?["skyboxGradient"]:null}},slot:class extends br{constructor(n,e,i,s){super(n,{paint:Xy||(Xy=new Zi({}))},e,null)}},model:class extends br{constructor(n,e,i,s){super(n,{layout:ov||(ov=new Zi({visibility:new lt(Pe.layout_model.visibility),"model-id":new yt(Pe.layout_model["model-id"])})),paint:av||(av=new Zi({"model-opacity":new yt(Pe.paint_model["model-opacity"]),"model-rotation":new yt(Pe.paint_model["model-rotation"]),"model-scale":new yt(Pe.paint_model["model-scale"]),"model-translation":new yt(Pe.paint_model["model-translation"]),"model-color":new yt(Pe.paint_model["model-color"]),"model-color-mix-intensity":new yt(Pe.paint_model["model-color-mix-intensity"]),"model-type":new lt(Pe.paint_model["model-type"]),"model-cast-shadows":new lt(Pe.paint_model["model-cast-shadows"]),"model-receive-shadows":new lt(Pe.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new lt(Pe.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new yt(Pe.paint_model["model-emissive-strength"]),"model-roughness":new yt(Pe.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new yt(Pe.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new lt(Pe.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new lt(Pe.paint_model["model-front-cutoff"]),"model-color-use-theme":new yt({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(n){return new gm(n)}getProgramIds(){return["model"]}is3D(n){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(n){return n instanceof xp?ht-1:0}queryIntersectsFeature(n,e,i,s,l,a){if(!this.modelManager)return!1;const h=this.modelManager,m=n.tile.getBucket(this);if(!(m&&m instanceof gm))return!1;for(const g in m.instancesPerModel){const x=m.instancesPerModel[g],p=e.id!==void 0?e.id:e.properties&&e.properties.hasOwnProperty("id")?e.properties.id:void 0;if(x.idToFeaturesIndex.hasOwnProperty(p)){const y=x.features[x.idToFeaturesIndex[p]],w=h.getModel(g,this.scope);if(!w)return!1;let v=X.mat4.create();const b=new vi(0,0),S=m.canonical;let A=Number.MAX_VALUE;for(let C=0;C<y.instancedDataCount;++C){const D=16*(y.instancedDataOffset+C),L=x.instancedDataArray.float32,z=[L[D+4],L[D+5],L[D+6]];pv(S,b,L[D],0|L[D+1]),lv(v,w,a,b,y.rotation,y.scale,z,!1,!1,!1),a.projection.name==="globe"&&(v=_m(v,a));const k=X.mat4.multiply([],a.projMatrix,v),B=n.queryGeometry,V=tv(B.isPointQuery()?B.screenBounds:B.screenGeometry,a,k,w.aabb);V!=null&&(A=Math.min(V,A))}return A!==Number.MAX_VALUE&&A}}return!1}_handleOverridablePaintPropertyUpdate(n,e,i){return!(!this.layout||e.isDataDriven()||i.isDataDriven()||n!=="model-color"&&n!=="model-color-mix-intensity"&&n!=="model-rotation"&&n!=="model-scale"&&n!=="model-translation"&&n!=="model-emissive-strength")}_isPropertyZoomDependent(n){const e=this._transitionablePaint._values[n];return e!=null&&e.value!=null&&e.value.expression!=null&&e.value.expression instanceof Qo}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}},clip:class extends br{constructor(n,e,i,s){super(n,{layout:lg||(lg=new Zi({"clip-layer-types":ne
20w lt(Pe.layout_clip["clip-layer-types"]),"clip-layer-scope":new lt(Pe.layout_clip["clip-layer-scope"])})),paint:cg||(cg=new Zi({}))},e,i,s)}recalculate(n,e){super.recalculate(n,e)}createBucket(n){return new ug(n)}is3D(n){return!0}}};class yb{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(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 vb{constructor(){this.tasks={},this.taskQueue=[],Ca(["process"],this),this.invoker=new yb(this.process),this.nextId=0}add(e,i){const s=this.nextId++,l=function({type:a,isSymbolTile:h,zoom:m}){return m=m||0,a==="message"?0:a!=="maybePrepare"||h?a!=="parseTile"||h?a==="parseTile"&&h?300-m:a==="maybePrepare"&&h?400-m:500:200-m:100-m}(i);if(l===0){try{e()}finally{}return null}return this.tasks[s]={fn:e,metadata:i,priority:l,id:s},this.taskQueue.push(s),this.invoker.trigger(),{cancel:()=>{delete this.tasks[s]}}}process(){try{if(this.taskQueue=this.taskQueue.filter(s=>!!this.tasks[s]),!this.taskQueue.length)return;const e=this.pick();if(e===null)return;const i=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!i)return;i.fn()}finally{}}pick(){let e=null,i=1/0;for(let l=0;l<this.taskQueue.length;l++){const a=this.tasks[this.taskQueue[l]];a.priority<i&&(i=a.priority,e=l)}if(e===null)return null;const s=this.taskQueue[e];return this.taskQueue.splice(e,1),s}remove(){this.invoker.remove()}}class fv{constructor(e,i,s){this.target=e,this.parent=i,this.mapId=s,this.callbacks={},this.cancelCallbacks={},Ca(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler=new vb}send(e,i,s,l,a=!1,h){const m=Math.round(1e18*Math.random()).toString(36).substring(0,10);s&&(s.metadata=h,this.callbacks[m]=s);const g=new Set;return this.target.postMessage({id:m,type:e,hasCallback:!!s,targetMapId:l,mustQueue:a,sourceMapId:this.mapId,data:js(i,g)},g),{cancel:()=>{s&&delete this.callbacks[m],this.target.postMessage({id:m,type:"<cancel>",targetMapId:l,sourceMapId:this.mapId})}}}receive(e){const i=e.data;if(!i)return;const s=i.id;if(s&&(!i.targetMapId||this.mapId===i.targetMapId))if(i.type==="<cancel>"){const l=this.cancelCallbacks[s];delete this.cancelCallbacks[s],l&&l.cancel()}else if(i.mustQueue||Wr()){const l=this.callbacks[s],a=this.scheduler.add(()=>this.processTask(s,i),l&&l.metadata||{type:"message"});a&&(this.cancelCallbacks[s]=a)}else this.processTask(s,i)}processTask(e,i){if(delete this.cancelCallbacks[e],i.type==="<response>"){const s=this.callbacks[e];delete this.callbacks[e],s&&(i.error?s(mn(i.error)):s(null,mn(i.data)))}else{const s=new Set,l=i.hasCallback?(h,m)=>{this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:h?js(h):null,data:js(m,s)},s)}:()=>{},a=mn(i.data);if(this.parent[i.type])this.parent[i.type](i.sourceMapId,a,l);else if(this.parent.getWorkerSource){const h=i.type.split(".");this.parent.getWorkerSource(i.sourceMapId,h[0],a.source,a.scope)[h[1]](a,l)}else l(new Error(`Could not find function ${i.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var Rh={workerUrl:"",workerClass:null,workerParams:void 0};const bm="mapboxgl_preloaded_worker_pool";class xl{constructor(){this.active={}}acquire(e,i=xl.workerCount){if(!this.workers)for(this.workers=[];this.workers.length<i;)this.workers.push(Rh.workerClass!=null?new Rh.workerClass:new self.Worker(Rh.workerUrl,Rh.workerParams));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.workers&&this.numActive()===0&&(this.workers.forEach(i=>{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[bm]}numActive(){return Object.keys(this.active).length}}xl.workerCount=2;class Oc{constructor(e,i,s="Worker",l=xl.workerCount){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=Xn();const a=this.workerPool.acquire(this.id,l);for(let h=0;h<a.length;h++){const m=new Oc.Actor(a[h],i,this.id);m.name=`${s} ${h}`,this.actors.push(m)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(e,i,s){so(this.actors,(l,a)=>{l.send(e,i,a)},s=s||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}
20remove(){this.actors.forEach(e=>{e.remove()}),this.actors=[],this.workerPool.release(this.id)}}let zh,wm;function bp(){return zh||(zh=new xl),zh}Oc.Actor=fv;const Tm=new Mi(0,0,0);var Sm=(n=>(n[n.PATH_RULE_UNSPECIFIED=0]="PATH_RULE_UNSPECIFIED",n[n.PATH_RULE_NON_ZERO=1]="PATH_RULE_NON_ZERO",n[n.PATH_RULE_EVEN_ODD=2]="PATH_RULE_EVEN_ODD",n))(Sm||{}),wp=(n=>(n[n.LINE_CAP_UNSPECIFIED=0]="LINE_CAP_UNSPECIFIED",n[n.LINE_CAP_BUTT=1]="LINE_CAP_BUTT",n[n.LINE_CAP_ROUND=2]="LINE_CAP_ROUND",n[n.LINE_CAP_SQUARE=3]="LINE_CAP_SQUARE",n))(wp||{}),Lh=(n=>(n[n.LINE_JOIN_UNSPECIFIED=0]="LINE_JOIN_UNSPECIFIED",n[n.LINE_JOIN_MITER=1]="LINE_JOIN_MITER",n[n.LINE_JOIN_MITER_CLIP=2]="LINE_JOIN_MITER_CLIP",n[n.LINE_JOIN_ROUND=3]="LINE_JOIN_ROUND",n[n.LINE_JOIN_BEVEL=4]="LINE_JOIN_BEVEL",n))(Lh||{}),mv=(n=>(n[n.PAINT_ORDER_UNSPECIFIED=0]="PAINT_ORDER_UNSPECIFIED",n[n.PAINT_ORDER_FILL_AND_STROKE=1]="PAINT_ORDER_FILL_AND_STROKE",n[n.PAINT_ORDER_STROKE_AND_FILL=2]="PAINT_ORDER_STROKE_AND_FILL",n))(mv||{}),kc=(n=>(n[n.PATH_COMMAND_UNSPECIFIED=0]="PATH_COMMAND_UNSPECIFIED",n[n.PATH_COMMAND_MOVE=1]="PATH_COMMAND_MOVE",n[n.PATH_COMMAND_LINE=2]="PATH_COMMAND_LINE",n[n.PATH_COMMAND_QUAD=3]="PATH_COMMAND_QUAD",n[n.PATH_COMMAND_CUBIC=4]="PATH_COMMAND_CUBIC",n[n.PATH_COMMAND_CLOSE=5]="PATH_COMMAND_CLOSE",n))(kc||{}),_v=(n=>(n[n.MASK_TYPE_UNSPECIFIED=0]="MASK_TYPE_UNSPECIFIED",n[n.MASK_TYPE_LUMINANCE=1]="MASK_TYPE_LUMINANCE",n[n.MASK_TYPE_ALPHA=2]="MASK_TYPE_ALPHA",n))(_v||{});function xb(n,e,i){n===1&&e.icons.push(function(s,l){return function(a){if(a.usvg_tree.height||(a.usvg_tree.height=a.usvg_tree.width),!a.metadata)return a;const{metadata:h}=a;if(h.content_area){const{content_area:m}=h;m.top==null&&(m.top=m.left),m.width==null&&(m.width=a.usvg_tree.width),m.height==null&&(m.height=m.width)}return h.stretch_x&&h.stretch_x.length&&gv(h,"x"),h.stretch_y&&h.stretch_y.length&&gv(h,"y"),a}(s.readFields(bb,{name:void 0},l))}(i,i.readVarint()+i.pos))}function gv(n,e){const i=[],s=n[`stretch_${e}`];let l=null;for(let a=0;a<s.length;a++)l===null?l=i.length===0?s[0]:i[i.length-1][1]+s[a]:(i.push([l,l+s[a]]),l=null);n[`stretch_${e}_areas`]=i}function bb(n,e,i){n===1?e.name=i.readString():n===2?e.metadata=function(s,l){return s.readFields(wb,{stretch_x:null,stretch_y:null,stretch_x_areas:null,stretch_y_areas:null,variables:[]},l)}(i,i.readVarint()+i.pos):n===3&&(e.usvg_tree=function(s,l){return s.readFields(Eb,{width:20,children:[],linear_gradients:[],radial_gradients:[],clip_paths:[],masks:[]},l)}(i,i.readVarint()+i.pos),e.data="usvg_tree")}function wb(n,e,i){n===1?e.stretch_x=i.readPackedVarint():n===2?e.stretch_y=i.readPackedVarint():n===3?e.content_area=function(s,l){return s.readFields(Tb,{left:0},l)}(i,i.readVarint()+i.pos):n===4&&e.variables.push(function(s,l){return s.readFields(Sb,{name:void 0},l)}(i,i.readVarint()+i.pos))}function Tb(n,e,i){n===1?e.left=i.readVarint():n===2?e.width=i.readVarint():n===3?e.top=i.readVarint():n===4&&(e.height=i.readVarint())}function Sb(n,e,i){n===1?e.name=i.readString():n===2&&(e.rgb_color=Ep(i.readVarint()),e.value="rgb_color")}function Eb(n,e,i){n===1?e.width=e.height=i.readVarint():n===2?e.height=i.readVarint():n===3?e.children.push(Tp(i,i.readVarint()+i.pos)):n===4?e.linear_gradients.push(function(s,l){return s.readFields(zb,{spread_method:1,stops:[],x1:0,y1:0,x2:1,y2:0},l)}(i,i.readVarint()+i.pos)):n===5?e.radial_gradients.push(function(s,l){return s.readFields(Db,{spread_method:1,stops:[],cx:.5,cy:.5,r:.5,fx:.5,fy:.5,fr:0},l)}(i,i.readVarint()+i.pos)):n===7?e.clip_paths.push(function(s,l){return s.readFields(Ob,{children:[]},l)}(i,i.readVarint()+i.pos)):n===8&&e.masks.push(function(s,l){const a=s.readFields(kb,{left:0,width:20,mask_type:1,children:[]},l);return a.height==null&&(a.height=a.width),a.top==null&&(a.top=a.left),a}(i,i.readVarint()+i.pos))}function Tp(n,e){return n.readFields(Mb,{},e)}function Mb(n,e,i){n===1?(e.group=function(s,l){return s.readFields(Ib,{opacity:255,children:[]},l)}(i,i.readVarint()+i.pos),e.node="group"):n===2&&(e.path=function(s,l){return s.readFields(Cb,{paint_order:1,commands:[],step:1,diffs:[],rule:1},l)}(i,i.readVarint()+i.pos),e.node="path")}function Ib(n,e,i){n===1?e.transform=Sp(i,i.readVarint()+i.pos):n===2?e.opacity=i.readVarint():n===5?e.clip_path_idx=i.readVarint():n===6?e.mask_idx=i.readVarint():n===7&&e.children.push(Tp(i,i.readVarint()+i.pos))}function Sp(n,e){return n.readFields(Ab,{sx:1,ky:0,kx:0,sy:1,tx:0,ty:0},e)}
20function Ab(n,e,i){n===1?e.sx=i.readFloat():n===2?e.ky=i.readFloat():n===3?e.kx=i.readFloat():n===4?e.sy=i.readFloat():n===5?e.tx=i.readFloat():n===6&&(e.ty=i.readFloat())}function Cb(n,e,i){n===1?e.fill=function(s,l){return s.readFields(Pb,{rgb_color:Tm,paint:"rgb_color",opacity:255},l)}(i,i.readVarint()+i.pos):n===2?e.stroke=function(s,l){return s.readFields(Rb,{rgb_color:Tm,paint:"rgb_color",dasharray:[],dashoffset:0,miterlimit:4,opacity:255,width:1,linecap:1,linejoin:1},l)}(i,i.readVarint()+i.pos):n===3?e.paint_order=i.readVarint():n===5?i.readPackedVarint(e.commands):n===6?e.step=i.readFloat():n===7?i.readPackedSVarint(e.diffs):n===8&&(e.rule=i.readVarint())}function Pb(n,e,i){n===1?(e.rgb_color=Ep(i.readVarint()),e.paint="rgb_color"):n===2?(e.linear_gradient_idx=i.readVarint(),e.paint="linear_gradient_idx"):n===3?(e.radial_gradient_idx=i.readVarint(),e.paint="radial_gradient_idx"):n===5&&(e.opacity=i.readVarint())}function Ep(n){return new Mi((n>>16&255)/255,(n>>8&255)/255,(255&n)/255,1)}function Rb(n,e,i){n===1?(e.rgb_color=Ep(i.readVarint()),e.paint="rgb_color"):n===2?(e.linear_gradient_idx=i.readVarint(),e.paint="linear_gradient_idx"):n===3?(e.radial_gradient_idx=i.readVarint(),e.paint="radial_gradient_idx"):n===5?i.readPackedFloat(e.dasharray):n===6?e.dashoffset=i.readFloat():n===7?e.miterlimit=i.readFloat():n===8?e.opacity=i.readVarint():n===9?e.width=i.readFloat():n===10?e.linecap=i.readVarint():n===11&&(e.linejoin=i.readVarint())}function zb(n,e,i){n===1?e.transform=Sp(i,i.readVarint()+i.pos):n===2?e.spread_method=i.readVarint():n===3?e.stops.push(yv(i,i.readVarint()+i.pos)):n===4?e.x1=i.readFloat():n===5?e.y1=i.readFloat():n===6?e.x2=i.readFloat():n===7&&(e.y2=i.readFloat())}function yv(n,e){return n.readFields(Lb,{offset:0,opacity:255,rgb_color:Tm},e)}function Lb(n,e,i){n===1?e.offset=i.readFloat():n===2?e.opacity=i.readVarint():n===3&&(e.rgb_color=Ep(i.readVarint()))}function Db(n,e,i){n===1?e.transform=Sp(i,i.readVarint()+i.pos):n===2?e.spread_method=i.readVarint():n===3?e.stops.push(yv(i,i.readVarint()+i.pos)):n===4?e.cx=i.readFloat():n===5?e.cy=i.readFloat():n===6?e.r=i.readFloat():n===7?e.fx=i.readFloat():n===8?e.fy=i.readFloat():n===9&&(e.fr=i.readFloat())}function Ob(n,e,i){n===1?e.transform=Sp(i,i.readVarint()+i.pos):n===2?e.clip_path_idx=i.readVarint():n===3&&e.children.push(Tp(i,i.readVarint()+i.pos))}function kb(n,e,i){n===1?e.left=e.top=i.readFloat():n===2?e.width=e.height=i.readFloat():n===3?e.top=i.readFloat():n===4?e.height=i.readFloat():n===5?e.mask_type=i.readVarint():n===6?e.mask_idx=i.readVarint():n===7&&e.children.push(Tp(i,i.readVarint()+i.pos))}class Fb{static calculate(e={},i=[]){const s=new Map,l=new Map;if(Object.keys(e).length===0)return s;i.forEach(a=>{l.set(a.name,a.rgb_color||new Mi(0,0,0))});for(const[a,h]of Object.entries(e))l.has(a)?s.set(l.get(a).toStringPremultipliedAlpha(),h):console.warn(`Ignoring unknown image variable "${a}"`);return s}}function Fc(n,e=255,i){const s=e/255,l=n.toStringPremultipliedAlpha(),a=i.has(l)?i.get(l).clone():n.clone();return a.a*=s,a.toString()}function Dh(n,e){if(!je()){const i=document.createElement("canvas");return i.width=n,i.height=e,i}return new OffscreenCanvas(n,e)}function Bb(n,e){const i=Fb.calculate(e.params,n.metadata?n.metadata.variables:[]),s=n.usvg_tree,l=s.width,a=s.height,h=e.transform?e.transform:new DOMMatrix,m=Math.max(1,Math.round(l*h.a)),g=Math.max(1,Math.round(a*h.d)),x=new DOMMatrix([m/l,0,0,g/a,0,0]),p=Dh(m,g).getContext("2d");return Em(p,x,s,s,i),p.getImageData(0,0,m,g)}function Em(n,e,i,s,l){for(const a of s.children)vv(n,e,i,a,l)}function vv(n,e,i,s,l){s.group?(n.save(),function(a,h,m,g,x){const p=g.mask_idx!=null?m.masks[g.mask_idx]:null,y=g.clip_path_idx!=null?m.clip_paths[g.clip_path_idx]:null;if(g.transform&&(h=Mp(g.transform).preMultiplySelf(h)),!function(b,S,A){return b.opacity!==255||S||A}(g,y!=null,p!=null))return void Em(a,h,m,g,x);const w=Dh(a.canvas.width,a.canvas.height),v=w.getContext("2d");Em(v,h,m,g,x),y&&Mv(v,h,m,y),p&&Iv(v,h,m,p,x),a.globalAlpha=g.opacity/255,a.drawImage(w,0,0)}
20(n,e,i,s.group,l),n.restore()):s.path&&(n.save(),function(a,h,m,g,x){const p=Av(g);a.setTransform(h),g.paint_order===mv.PAINT_ORDER_FILL_AND_STROKE?(xv(a,m,g,p,x),wv(a,m,g,p,x)):(wv(a,m,g,p,x),xv(a,m,g,p,x))}(n,e,i,s.path,l),n.restore())}function xv(n,e,i,s,l){const a=i.fill;if(!a)return;const h=a.opacity/255;switch(a.paint){case"rgb_color":n.fillStyle=Fc(a.rgb_color,a.opacity,l);break;case"linear_gradient_idx":n.fillStyle=Tv(n,e.linear_gradients[a.linear_gradient_idx],h,l);break;case"radial_gradient_idx":n.fillStyle=Sv(n,e.radial_gradients[a.radial_gradient_idx],h,l)}n.fill(s,bv(i))}function bv(n){return n.rule===Sm.PATH_RULE_NON_ZERO?"nonzero":n.rule===Sm.PATH_RULE_EVEN_ODD?"evenodd":void 0}function wv(n,e,i,s,l){const a=i.stroke;if(!a)return;n.lineWidth=a.width,n.miterLimit=a.miterlimit,n.setLineDash(a.dasharray),n.lineDashOffset=a.dashoffset;const h=a.opacity/255;switch(a.paint){case"rgb_color":n.strokeStyle=Fc(a.rgb_color,a.opacity,l);break;case"linear_gradient_idx":n.strokeStyle=Tv(n,e.linear_gradients[a.linear_gradient_idx],h,l);break;case"radial_gradient_idx":n.strokeStyle=Sv(n,e.radial_gradients[a.radial_gradient_idx],h,l)}switch(a.linejoin){case Lh.LINE_JOIN_MITER_CLIP:case Lh.LINE_JOIN_MITER:n.lineJoin="miter";break;case Lh.LINE_JOIN_ROUND:n.lineJoin="round";break;case Lh.LINE_JOIN_BEVEL:n.lineJoin="bevel"}switch(a.linecap){case wp.LINE_CAP_BUTT:n.lineCap="butt";break;case wp.LINE_CAP_ROUND:n.lineCap="round";break;case wp.LINE_CAP_SQUARE:n.lineCap="square"}n.stroke(s)}function Tv(n,e,i,s){if(e.stops.length===1){const w=e.stops[0];return Fc(w.rgb_color,w.opacity*i,s)}const l=Mp(e.transform),{x1:a,y1:h,x2:m,y2:g}=e,x=l.transformPoint(new DOMPoint(a,h)),p=l.transformPoint(new DOMPoint(m,g)),y=n.createLinearGradient(x.x,x.y,p.x,p.y);for(const w of e.stops)y.addColorStop(w.offset,Fc(w.rgb_color,w.opacity*i,s));return y}function Sv(n,e,i,s){if(e.stops.length===1){const w=e.stops[0];return Fc(w.rgb_color,w.opacity*i,s)}const l=Mp(e.transform),{fx:a,fy:h,cx:m,cy:g}=e,x=l.transformPoint(new DOMPoint(a,h)),p=l.transformPoint(new DOMPoint(m,g)),y=n.createRadialGradient(x.x,x.y,0,p.x,p.y,e.r*((l.a+l.d)/2));for(const w of e.stops)y.addColorStop(w.offset,Fc(w.rgb_color,w.opacity*i,s));return y}function Ev(n,e,i,s){const l=s.transform?Mp(s.transform).preMultiplySelf(e):e,a=Dh(n.canvas.width,n.canvas.height),h=a.getContext("2d");for(const g of s.children)if(g.group)Ev(h,l,i,g.group);else if(g.path){const x=g.path,p=new Path2D;p.addPath(Av(x),l),h.fill(p,bv(x))}const m=s.clip_path_idx!=null?i.clip_paths[s.clip_path_idx]:null;m&&Mv(h,l,i,m),n.globalCompositeOperation="source-over",n.drawImage(a,0,0)}function Mv(n,e,i,s){const l=Dh(n.canvas.width,n.canvas.height);Ev(l.getContext("2d"),e,i,s),n.globalCompositeOperation="destination-in",n.drawImage(l,0,0)}function Iv(n,e,i,s,l){if(s.children.length===0)return;const a=s.mask_idx!=null?i.masks[s.mask_idx]:null;a&&Iv(n,e,i,a,l);const h=n.canvas.width,m=n.canvas.height,g=Dh(h,m),x=g.getContext("2d"),p=s.width,y=s.height,w=s.left,v=s.top,b=new Path2D,S=new Path2D;S.rect(w,v,p,y),b.addPath(S,e),x.clip(b);for(const D of s.children)vv(x,e,i,D,l);const A=x.getImageData(0,0,h,m),C=A.data;if(s.mask_type===_v.MASK_TYPE_LUMINANCE)for(let D=0;D<C.length;D+=4)C[D+3]=C[D+3]/255*(.2126*C[D]+.7152*C[D+1]+.0722*C[D+2]);x.putImageData(A,0,0),n.globalCompositeOperation="destination-in",n.drawImage(g,0,0)}function Mp(n){return n?new DOMMatrix([n.sx,n.ky,n.kx,n.sy,n.tx,n.ty]):new DOMMatrix}function Av(n){const e=new Path2D,i=n.step;let s=n.diffs[0]*i,l=n.diffs[1]*i;e.moveTo(s,l);for(let a=0,h=2;a<n.commands.length;a++)switch(n.commands[a]){case kc.PATH_COMMAND_MOVE:s+=n.diffs[h++]*i,l+=n.diffs[h++]*i,e.moveTo(s,l);break;case kc.PATH_COMMAND_LINE:s+=n.diffs[h++]*i,l+=n.diffs[h++]*i,e.lineTo(s,l);break;case kc.PATH_COMMAND_QUAD:{const m=s+n.diffs[h++]*i,g=l+n.diffs[h++]*i;s=m+n.diffs[h++]*i,l=g+n.diffs[h++]*i,e.quadraticCurveTo(m,g,s,l);break}case kc.PATH_COMMAND_CUBIC:{const m=s+n.diffs[h++]*i,g=l+n.diffs[h++]*i,x=m+n.diffs[h++]*i,p=g+n.diffs[h++]*i;s=x+n.diffs[h++]*i,l=p+n.diffs[h++]*i,e.bezierCurveTo(m,g,x,p,s,l);break}case kc.PATH_COMMAND_CLOSE:e.closePath()}return e}class Ip{constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;const i=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,i),i}put(e,i){this.cache.has(e)?this.cache.delete(e):this.cache.size===this.capacity&&this.cache.delete(this.cache.keys().next().value),this.cache.set(e,i)}delete(e){this.cache.delete(e)}}vt(Ip,"LRUCache");class Mm{constructor(){this.cacheMap=new Map,this.cacheDependenciesMap=new Map}static _getImage(e){return new Pr(e,e.data)}getFromCache(e,i,s){return this.cacheMap.has(s)||this.cacheMap.set(s,new Ip(150)),this.cacheMap.get(s).get(la(e.toString(),i))}setInCache(e,i,s,l){this.cacheDependenciesMap.has(l)||this.cacheDependenciesMap.set(l,new Map),this.cacheMap.has(l)||this.cacheMap.set(l,new Ip(150));const a=this.cacheDependenciesMap.get(l),h=la(e.id.toString(),s);a.get(h)||a.set(h,new Set);const m=this.cacheMap.get(l),g=e.toString();a.get(h).add(g),m.put(la(e.toString(),s),i)}removeImagesFromCacheByIds(e,i,s=0){if(!this.cacheMap.has(s)||!this.cacheDependenciesMap.has(s))return;const l=this.cacheMap.get(s),a=this.cacheDependenciesMap.get(s);for(const h of e){const m=la(h.toString(),i);if(a.has(m)){for(const g of a.get(m))l.delete(g);a.delete(m)}}}rasterize(e,i,s,l,a=Bb){const h=this.getFromCache(e,s,l);if(h)return h.clone();const m=a(i.icon,e.options),g=Mm._getImage(m);return this.setInCache(e,g,s,l),g.clone()}}class Cv{constructor(e){this.size=e,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(e,i){const s=this.toIdx(e,i);return{min:this.minimums[s],max:this.maximums[s]}}isLeaf(e,i){return this.leaves[this.toIdx(e,i)]}toIdx(e,i){return i*this.size+e}}function Pv(n,e,i,s){let l=0,a=Number.MAX_VALUE;for(let h=0;h<3;h++)if(Math.abs(s[h])<1e-15){if(i[h]<n[h]||i[h]>e[h])return null}else{const m=1/s[h];let g=(n[h]-i[h])*m,x=(e[h]-i[h])*m;if(g>x){const p=g;g=x,x=p}if(g>l&&(l=g),x<a&&(a=x),l>a)return null}return l}function Rv(n,e,i,s,l,a,h,m,g,x,p){const y=s-n,w=l-e,v=a-i,b=h-n,S=m-e,A=g-i,C=p[1]*A-p[2]*S,D=p[2]*b-p[0]*A,L=p[0]*S-p[1]*b,z=y*C+w*D+v*L;if(Math.abs(z)<1e-15)return null;
vendor: 4,889 bytes, line 20
20const k=1/z,B=x[0]-n,V=x[1]-e,W=x[2]-i,$=(B*C+V*D+W*L)*k;if($<0||$>1)return null;const H=V*v-W*w,ae=W*y-B*v,Y=B*w-V*y,le=(p[0]*H+p[1]*ae+p[2]*Y)*k;return le<0||$+le>1?null:(b*H+S*ae+A*Y)*k}function zv(n,e,i){return(n-e)/(i-e)}function Lv(n,e,i,s,l,a,h,m,g){const x=1<<i,p=a-s,y=h-l,w=(n+1)/x*p+s,v=(e+0)/x*y+l,b=(e+1)/x*y+l;m[0]=(n+0)/x*p+s,m[1]=v,g[0]=w,g[1]=b}class Dv{constructor(e){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=e,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const i=function(a){const h=Math.ceil(Math.log2(a.dim/8)),m=[];let g=Math.ceil(Math.pow(2,h));const x=1/g,p=(v,b,S,A,C)=>{const D=A?1:0,L=(v+1)*S-D,z=b*S,k=(b+1)*S-D;C[0]=v*S,C[1]=z,C[2]=L,C[3]=k};let y=new Cv(g);const w=[];for(let v=0;v<g*g;v++){p(v%g,Math.floor(v/g),x,!1,w);const b=Ta(w[0],w[1],a),S=Ta(w[2],w[1],a),A=Ta(w[2],w[3],a),C=Ta(w[0],w[3],a);y.minimums.push(Math.min(b,S,A,C)),y.maximums.push(Math.max(b,S,A,C)),y.leaves.push(1)}for(m.push(y),g/=2;g>=1;g/=2){const v=m[m.length-1];y=new Cv(g);for(let b=0;b<g*g;b++){p(b%g,Math.floor(b/g),2,!0,w);const S=v.getElevation(w[0],w[1]),A=v.getElevation(w[2],w[1]),C=v.getElevation(w[2],w[3]),D=v.getElevation(w[0],w[3]),L=v.isLeaf(w[0],w[1]),z=v.isLeaf(w[2],w[1]),k=v.isLeaf(w[2],w[3]),B=v.isLeaf(w[0],w[3]),V=Math.min(S.min,A.min,C.min,D.min),W=Math.max(S.max,A.max,C.max,D.max),$=L&&z&&k&&B;y.maximums.push(W),y.minimums.push(V),y.leaves.push(W-V<=5&&$?1:0)}m.push(y)}return m}(this.dem),s=i.length-1,l=i[s];this._addNode(l.minimums[0],l.maximums[0],l.leaves[0]),this._construct(i,0,0,s,0)}raycastRoot(e,i,s,l,a,h,m=1){return Pv([e,i,-100],[s,l,this.maximums[0]*m],a,h)}raycast(e,i,s,l,a,h,m=1){if(!this.nodeCount)return null;const g=this.raycastRoot(e,i,s,l,a,h,m);if(g==null)return null;const x=[],p=[],y=[],w=[],v=[{idx:0,t:g,nodex:0,nodey:0,depth:0}];for(;v.length>0;){const{idx:b,t:S,nodex:A,nodey:C,depth:D}=v.pop();if(this.leaves[b]){Lv(A,C,D,e,i,s,l,y,w);const z=1<<D,k=(A+0)/z,B=(A+1)/z,V=(C+0)/z,W=(C+1)/z,$=Ta(k,V,this.dem)*m,H=Ta(B,V,this.dem)*m,ae=Ta(B,W,this.dem)*m,Y=Ta(k,W,this.dem)*m,le=Rv(y[0],y[1],$,w[0],y[1],H,w[0],w[1],ae,a,h),_e=Rv(w[0],w[1],ae,y[0],w[1],Y,y[0],y[1],$,a,h),pe=Math.min(le!==null?le:Number.MAX_VALUE,_e!==null?_e:Number.MAX_VALUE);if(pe!==Number.MAX_VALUE)return pe;{const xe=X.vec3.scaleAndAdd([],a,h,S);if(Ov($,H,Y,ae,zv(xe[0],y[0],w[0]),zv(xe[1],y[1],w[1]))>=xe[2])return S}continue}let L=0;for(let z=0;z<this._siblingOffset.length;z++){Lv((A<<1)+this._siblingOffset[z][0],(C<<1)+this._siblingOffset[z][1],D+1,e,i,s,l,y,w),y[2]=-100,w[2]=this.maximums[this.childOffsets[b]+z]*m;const k=Pv(y,w,a,h);if(k!=null){const B=k;x[z]=B;let V=!1;for(let W=0;W<L&&!V;W++)B>=x[p[W]]&&(p.splice(W,0,z),V=!0);V||(p[L]=z),L++}}for(let z=0;z<L;z++){const k=p[z];v.push({idx:this.childOffsets[b]+k,t:x[k],nodex:(A<<1)+this._siblingOffset[k][0],nodey:(C<<1)+this._siblingOffset[k][1],depth:D+1})}}return null}_addNode(e,i,s){return this.minimums.push(e),this.maximums.push(i),this.leaves.push(s),this.childOffsets.push(0),this.nodeCount++}_construct(e,i,s,l,a){if(e[l].isLeaf(i,s)===1)return;this.childOffsets[a]||(this.childOffsets[a]=this.nodeCount);const h=l-1,m=e[h];let g=0,x=0;for(let p=0;p<this._siblingOffset.length;p++){const y=2*i+this._siblingOffset[p][0],w=2*s+this._siblingOffset[p][1],v=m.getElevation(y,w),b=m.isLeaf(y,w),S=this._addNode(v.min,v.max,b);b&&(g|=1<<p),x||(x=S)}for(let p=0;p<this._siblingOffset.length;p++)g&1<<p||this._construct(e,2*i+this._siblingOffset[p][0],2*s+this._siblingOffset[p][1],h,x+p)}}function Ov(n,e,i,s,l,a){return Ot(Ot(n,i,a),Ot(e,s,a),l)}function Ta(n,e,i){const s=i.dim,l=Qt(n*s-.5,0,s-1),a=Qt(e*s-.5,0,s-1),h=Math.floor(l),m=Math.floor(a),g=Math.min(h+1,s-1),x=Math.min(m+1,s-1);return Ov(i.get(h,m),i.get(g,m),i.get(h,x),i.get(g,x),l-h,a-m)}const Nb={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function Vb(n,e,i){return(256*n*256+256*e+i)/10-1e4}function Ub(n,e,i){return 256*n+e+i/256-32768}class Ap{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(e,i,s,l=!1){if(this.uid=e,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(s&&s!=="mapbox"&&s!=="terrarium")return void Hi(`"${s}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=i.height;const a=this.dim=i.height-2,h=new Uint32Array(i.data.buffer);if(this.pixels=new Uint8Array(i.data.buffer),this.floatView=new Float32Array(i.data.buffer),this.borderReady=l,this._modifiedForSources={},!l){for(let g=0;g<a;g++)h[this._idx(-1,g)]=h[this._idx(0,g)],h[this._idx(a,g)]=h[this._idx(a-1,g)],h[this._idx(g,-1)]=h[this._idx(g,0)],h[this._idx(g,a)]=h[this._idx(g,a-1)];h[this._idx(-1,-1)]=h[this._idx(0,0)],h[this._idx(a,-1)]=h[this._idx(a-1,0)],h[this._idx(-1,a)]=h[this._idx(0,a-1)],h[this._idx(a,a)]=h[this._idx(a-1,a-1)]}const m=s==="terrarium"?Ub:Vb;
vendor: 10,923 bytes, line 20
20for(let g=0;g<h.length;++g){const x=4*g;this.floatView[g]=m(this.pixels[x],this.pixels[x+1],this.pixels[x+2])}this._timestamp=Be.now()}_buildQuadTree(){this._tree=new Dv(this)}get(e,i,s=!1){s&&(e=Qt(e,-1,this.dim),i=Qt(i,-1,this.dim));const l=this._idx(e,i);return this.floatView[l]}set(e,i,s){const l=this._idx(e,i),a=this.floatView[l];return this.floatView[l]=s,s-a}static getUnpackVector(e){return Nb[e]}_idx(e,i){if(e<-1||e>=this.dim+1||i<-1||i>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(i+1)*this.stride+(e+1)}static pack(e,i){const s=[0,0,0,0],l=Ap.getUnpackVector(i);let a=Math.floor((e+l[3])/l[2]);return s[2]=a%256,a=Math.floor(a/256),s[1]=a%256,a=Math.floor(a/256),s[0]=a,s}getPixels(){return new G_({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,i,s){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let l=i*this.dim,a=i*this.dim+this.dim,h=s*this.dim,m=s*this.dim+this.dim;switch(i){case-1:l=a-1;break;case 1:a=l+1}switch(s){case-1:h=m-1;break;case 1:m=h+1}const g=-i*this.dim,x=-s*this.dim;for(let p=h;p<m;p++)for(let y=l;y<a;y++){const w=4*this._idx(y,p),v=4*this._idx(y+g,p+x);this.pixels[w+0]=e.pixels[v+0],this.pixels[w+1]=e.pixels[v+1],this.pixels[w+2]=e.pixels[v+2],this.pixels[w+3]=e.pixels[v+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}function jb(n,e,i){n===1?e.headerLength=i.readFixed32():n===2?e.x=i.readVarint():n===3?e.y=i.readVarint():n===4?e.z=i.readVarint():n===5&&e.layers.push(function(s,l){return s.readFields(Zb,{version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]},l)}(i,i.readVarint()+i.pos))}function qb(n,e,i){n===1?(e.delta_filter=function(s,l){return s.readFields(Gb,{blockSize:0},l)}(i,i.readVarint()+i.pos),e.filter="delta_filter"):n===2?(i.readVarint(),e.filter="zigzag_filter"):n===3?(i.readVarint(),e.filter="bitshuffle_filter"):n===4&&(i.readVarint(),e.filter="byteshuffle_filter")}function Gb(n,e,i){n===1&&(e.blockSize=i.readVarint())}function $b(n,e,i){n===1?(i.readVarint(),e.codec="gzip_data"):n===2?(i.readVarint(),e.codec="jpeg_image"):n===3?(i.readVarint(),e.codec="webp_image"):n===4&&(i.readVarint(),e.codec="png_image")}function Hb(n,e,i){let s=0,l=0;n===1?e.firstByte=i.readFixed64():n===2?e.lastByte=i.readFixed64():n===3?e.filters.push(function(a,h){return a.readFields(qb,{},h)}(i,i.readVarint()+i.pos)):n===4?e.codec=function(a,h){return a.readFields($b,{},h)}(i,i.readVarint()+i.pos):n===5?l=i.readFloat():n===6?s=i.readFloat():n===7?e.bands.push(i.readString()):n===8?e.offset=i.readDouble():n===9&&(e.scale=i.readDouble()),e.offset===0&&(e.offset=l),e.scale===0&&(e.scale=s)}function Zb(n,e,i){n===1?e.version=i.readVarint():n===2?e.name=i.readString():n===3?e.units=i.readString():n===4?e.tileSize=i.readVarint():n===5?e.buffer=i.readVarint():n===6?e.pixelFormat=i.readVarint():n===7&&e.dataIndex.push(function(s,l){return s.readFields(Hb,{firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},l)}(i,i.readVarint()+i.pos))}function Wb(n,e,i){if(n===2)(function(s,l,a){s.readFields(Xb,a,l)})(i,i.readVarint()+i.pos,e);else if(n===3)throw new Error("Not implemented")}function Xb(n,e,i){if(n===1){let s=0;const l=i.readVarint()+i.pos;for(;i.pos<l;)e[s++]=i.readVarint()}}function Yb(n,e){if(e.length!==4)throw new Error(`Expected data of dimension 4 but got ${e.length}.`);let i=e[3];for(let s=2;s>=1;s--){const l=s===1?1:0,a=s===2?1:0;for(let h=0;h<e[0];h++){const m=e[1]*h;for(let g=l;g<e[1];g++){const x=e[2]*(g+m);for(let p=a;p<e[2];p++){const y=e[3]*(p+x);for(let w=0;w<e[3];w++){const v=y+w;n[v]+=n[v-i]}}}}i*=e[s]}return n}function Kb(n){for(let e=0,i=n.length;e<i;e++)n[e]=n[e]>>>1^-(1&n[e]);return n}function Jb(n,e){switch(e){case"uint32":return n;case"uint16":for(let i=0;i<n.length;i+=2){const s=n[i],l=n[i+1];n[i]=(240&s)>>4|(61440&s)>>8|(240&l)<<4|61440&l,n[i+1]=15&s|(3840&s)>>4|(15&l)<<8|(3840&l)<<4}return n;case"uint8":for(let i=0;i<n.length;i+=4){const s=n[i],l=n[i+1],a=n[i+2],h=n[i+3];n[i+0]=(192&s)>>6|(192&l)>>4|(192&a)>>2|192&h,n[i+1]=(48&s)>>4|(48&l)>>2|48&a|(48&h)<<2,n[i+2]=(12&s)>>2|12&l|(12&a)<<2|(12&h)<<4,n[i+3]=3&s|(3&l)<<2|(3&a)<<4|(3&h)<<6}return n;default:throw new Error(`Invalid pixel format, "${e}"`)}}vt(Ap,"DEMData"),vt(Dv,"DemMinMaxQuadTree",{omit:["dem"]});var jn=Uint8Array,Oh=Uint16Array,Qb=Int32Array,kv=new jn([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Fv=new jn([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),ew=new jn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Bv=function(n,e){for(var i=new Oh(31),s=0;s<31;++s)i[s]=e+=1<<n[s-1];var l=new Qb(i[30]);for(s=1;s<30;++s)for(var a=i[s];a<i[s+1];++a)l[a]=a-i[s]<<5|s;return{b:i,r:l}},Nv=Bv(kv,2),Vv=Nv.b,tw=Nv.r;Vv[28]=258,tw[258]=28;for(var iw=Bv(Fv,0).b,Uv=new Oh(32768),ar=0;ar<32768;++ar){var Bc=(43690&ar)>>1|(21845&ar)<<1;Uv[ar]=((65280&(Bc=(61680&(Bc=(52428&Bc)>>2|(13107&Bc)<<2))>>4|(3855&Bc)<<4))>>8|(255&Bc)<<8)>>1}var kh=function(n,e,i){for(var s=n.length,l=0,a=new Oh(e);l<s;++l)n[l]&&++a[n[l]-1];var h,m=new Oh(e);for(l=1;l<e;++l)m[l]=m[l-1]+a[l-1]<<1;h=new Oh(1<<e);var g=15-e;for(l=0;l<s;++l)if(n[l])for(var x=l<<4|n[l],p=e-n[l],y=m[n[l]-1]++<<p,w=y|(1<<p)-1;y<=w;++y)h[Uv[y]>>g]=x;return h},Fh=new jn(288);for(ar=0;ar<144;++ar)Fh[ar]=8;for(ar=144;ar<256;++ar)Fh[ar]=9;for(ar=256;ar<280;++ar)Fh[ar]=7;for(ar=280;ar<288;++ar)Fh[ar]=8;var jv=new jn(32);for(ar=0;ar<32;++ar)jv[ar]=5;var rw=kh(Fh,9),nw=kh(jv,5),Im=function(n){for(var e=n[0],i=1;i<n.length;++i)n[i]>e&&(e=n[i]);return e},Is=function(n,e,i){var s=e/8|0;return(n[s]|n[s+1]<<8)>>(7&e)&i},Am=function(n,e){var i=e/8|0;return(n[i]|n[i+1]<<8|n[i+2]<<16)>>(7&e)},sw=["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"],As=function(n,e,i){var s=new Error(e||sw[n]);if(s.code=n,Error.captureStackTrace&&Error.captureStackTrace(s,As),!i)throw s;return s},ow=new jn(0),aw=typeof TextDecoder<"u"&&new TextDecoder;try{aw.decode(ow,{stream:!0})}catch{}const lw={gzip_data:"gzip"};class rs extends Error{constructor(e){super(e),this.name="MRTError"}}const cw={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},qv={uint32:1,uint16:2,uint8:4},uw={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let Cm;class Cp{constructor(e=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=e}getLayer(e){const i=this.layers[e];if(!i)throw new rs(`Layer '${e}' not found`);return i}getHeaderLength(e){const i=new Uint8Array(e),s=new DataView(e);if(i[0]!==13)throw new rs("File is not a valid MRT.");return s.getUint32(1,!0)}parseHeader(e){const i=new Uint8Array(e),s=this.getHeaderLength(e);if(i.length<s)throw new rs(`Expected header with length >= ${s} but got buffer of length ${i.length}`);const l=function(a,h){return a.readFields(jb,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0)}(new Cm(i.subarray(0,s)));if(!isNaN(this.x)&&(this.x!==l.x||this.y!==l.y||this.z!==l.z))throw new rs(`Invalid attempt to parse header ${l.z}/${l.x}/${l.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=l.x,this.y=l.y,this.z=l.z;for(const a of l.layers)this.layers[a.name]=new Gv(a,{cacheSize:this._cacheSize});return this}createDecodingTask(e){const i=[],s=this.getLayer(e.layerName);for(let l of e.blockIndices){const a=s.dataIndex[l],h=a.firstByte-e.firstByte,m=a.lastByte-e.firstByte;if(s._blocksInProgress.has(l))continue;const g={layerName:s.name,firstByte:h,lastByte:m,pixelFormat:s.pixelFormat,blockIndex:l,blockShape:[a.bands.length].concat(s.bandShape),buffer:s.buffer,codec:a.codec.codec,filters:a.filters.map(x=>x.filter)};s._blocksInProgress.add(l),i.push(g)}return new $v(i,()=>{i.forEach(l=>s._blocksInProgress.delete(l.blockIndex))},(l,a)=>{if(i.forEach(h=>s._blocksInProgress.delete(h.blockIndex)),l)throw l;a.forEach(h=>{this.getLayer(h.layerName).processDecodedData(h)})})}}class Gv{constructor({version:e,name:i,units:s,tileSize:l,pixelFormat:a,buffer:h,dataIndex:m},g){if(this.version=e,this.version!==1)throw new rs(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=i,this.units=s,this.tileSize=l,this.buffer=h,this.pixelFormat=cw[a],this.dataIndex=m,this.bandShape=[l+2*h,l+2*h,qv[this.pixelFormat]],this._decodedBlocks=new Ip(g?g.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return qv[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:e})=>e).flat()}processDecodedData(e){const 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(const[s,l]of this.dataIndex.entries()){for(const[a,h]of l.bands.entries())if(h===e)return{bandIndex:i+a,blockIndex:s,blockBandIndex:a};i+=l.bands.length}break;case"number":for(const[s,l]of this.dataIndex.entries()){if(e>=i&&e<i+l.bands.length)return{bandIndex:e,blockIndex:s,blockBandIndex:e-i};i+=l.bands.length}break;default:throw new rs(`Invalid band \`${JSON.stringify(e)}\`. Expected string or integer.`)}throw new rs(`Band not found: ${JSON.stringify(e)}`)}getDataRange(e){let i=1/0,s=-1/0;const l=[],a=new Set;for(const h of e){const{blockIndex:m}=this.getBlockForBand(h);if(m<0)throw new rs(`Invalid band: ${JSON.stringify(h)}`);const g=this.dataIndex[m];l.includes(m)||l.push(m),a.add(m),i=Math.min(i,g.firstByte),s=Math.max(s,g.lastByte)}if(a.size>this.cacheSize)throw new rs(`Number of blocks to decode (${a.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:i,lastByte:s,blockIndices:l}}hasBand(e){const{blockIndex:i}=this.getBlockForBand(e);return i>=0}hasDataForBand(e){const{blockIndex:i}=this.getBlockForBand(e);return i>=0&&!!this._decodedBlocks.get(i.toString())}getBandView(e){const{blockIndex:i,blockBandIndex:s}=this.getBlockForBand(e),l=this._decodedBlocks.get(i.toString());if(!l)throw new rs(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);const a=this.dataIndex[i],h=this.bandShape.reduce((x,p)=>x*p,1),m=s*h,g=l.subarray(m,m+h);return{data:g,bytes:new Uint8Array(g.buffer).subarray(g.byteOffset,g.byteOffset+g.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:a.offset,scale:a.scale}}}Cp.setPbf=function(n){Cm=n};class $v{constructor(e,i,s){this.tasks=e,this._onCancel=i,this._onComplete=s,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,i){this._finalized||(this._onComplete(e,i),this._finalized=!0)}}Cp.performDecoding=function(n,e){const i=new Uint8Array(n);return Promise.all(e.tasks.map(s=>{const{layerName:l,firstByte:a,lastByte:h,pixelFormat:m,blockShape:g,blockIndex:x,filters:p,codec:y}=s,w=i.subarray(a,h+1),v=new Uint32Array(g[0]*g[1]*g[2]);let b;
20if(y!=="gzip_data")throw new rs(`Unhandled codec: ${y}`);return b=function(S,A){if(!globalThis.DecompressionStream&&A==="gzip_data")return Promise.resolve(((z=function(V){V[0]==31&&V[1]==139&&V[2]==8||As(6,"invalid gzip data");var W=V[3],$=10;4&W&&($+=2+(V[10]|V[11]<<8));for(var H=(W>>3&1)+(W>>4&1);H>0;H-=!V[$++]);return $+(2&W)}(L=S))+8>L.length&&As(6,"invalid gzip data"),function(V,W,$,H){var ae=V.length;if(!ae||W.f&&!W.l)return $||new jn(0);var Y=!$,le=Y||W.i!=2,_e=W.i;Y&&($=new jn(3*ae));var pe,xe,ye=function(Ea){var Ma=$.length;if(Ea>Ma){var wl=new jn(Math.max(2*Ma,Ea));wl.set($),$=wl}},Me=W.f||0,Te=W.p||0,Ae=W.b||0,et=W.l,Je=W.d,xt=W.m,st=W.n,ct=8*ae;do{if(!et){Me=Is(V,Te,1);var it=Is(V,Te+1,3);if(Te+=3,!it){var zt=V[(Nt=4+((Te+7)/8|0))-4]|V[Nt-3]<<8,_t=Nt+zt;if(_t>ae){_e&&As(0);break}le&&ye(Ae+zt),$.set(V.subarray(Nt,_t),Ae),W.b=Ae+=zt,W.p=Te=8*_t,W.f=Me;continue}if(it==1)et=rw,Je=nw,xt=9,st=5;else if(it==2){var St=Is(V,Te,31)+257,Ft=Is(V,Te+10,15)+4,Kt=St+Is(V,Te+5,31)+1;Te+=14;for(var Ut=new jn(Kt),ri=new jn(19),Yt=0;Yt<Ft;++Yt)ri[ew[Yt]]=Is(V,Te+3*Yt,7);Te+=3*Ft;var oi=Im(ri),mi=(1<<oi)-1,Li=kh(ri,oi);for(Yt=0;Yt<Kt;){var Nt,ui=Li[Is(V,Te,mi)];if(Te+=15&ui,(Nt=ui>>4)<16)Ut[Yt++]=Nt;else{var Bi=0,Gi=0;for(Nt==16?(Gi=3+Is(V,Te,3),Te+=2,Bi=Ut[Yt-1]):Nt==17?(Gi=3+Is(V,Te,7),Te+=3):Nt==18&&(Gi=11+Is(V,Te,127),Te+=7);Gi--;)Ut[Yt++]=Bi}}var Wi=Ut.subarray(0,St),Ki=Ut.subarray(St);xt=Im(Wi),st=Im(Ki),et=kh(Wi,xt),Je=kh(Ki,st)}else As(1);if(Te>ct){_e&&As(0);break}}le&&ye(Ae+131072);for(var Ri=(1<<xt)-1,pr=(1<<st)-1,Jr=Te;;Jr=Te){var sr=(Bi=et[Am(V,Te)&Ri])>>4;if((Te+=15&Bi)>ct){_e&&As(0);break}if(Bi||As(2),sr<256)$[Ae++]=sr;else{if(sr==256){Jr=Te,et=null;break}var lr=sr-254;sr>264&&(lr=Is(V,Te,(1<<(qn=kv[Yt=sr-257]))-1)+Vv[Yt],Te+=qn);var Fr=Je[Am(V,Te)&pr],Mr=Fr>>4;if(Fr||As(3),Te+=15&Fr,Ki=iw[Mr],Mr>3){var qn=Fv[Mr];Ki+=Am(V,Te)&(1<<qn)-1,Te+=qn}if(Te>ct){_e&&As(0);break}le&&ye(Ae+131072);var Sa=Ae+lr;if(Ae<Ki){var ns=0-Ki,Ps=Math.min(Ki,Sa);for(ns+Ae<0&&As(3);Ae<Ps;++Ae)$[Ae]=(void 0)[ns+Ae]}for(;Ae<Sa;++Ae)$[Ae]=$[Ae-Ki]}}W.l=et,W.p=Jr,W.b=Ae,W.f=Me,et&&(Me=1,W.m=xt,W.d=Je,W.n=st)}while(!Me);return Ae!=$.length&&Y?(pe=$,((xe=Ae)==null||xe>pe.length)&&(xe=pe.length),new jn(pe.subarray(0,xe))):$.subarray(0,Ae)}(L.subarray(z,-8),{i:2},new jn(((C=L)[(D=C.length)-4]|C[D-3]<<8|C[D-2]<<16|C[D-1]<<24)>>>0))));var C,D,L,z;const k=lw[A];if(!k)throw new Error(`Unhandled codec: ${A}`);const B=new globalThis.DecompressionStream(k);return new Response(new Blob([S]).stream().pipeThrough(B)).arrayBuffer().then(V=>new Uint8Array(V))}(w,y).then(S=>(function(A,C){A.readFields(Wb,C)}(new Cm(S),v),new uw[m](v.buffer))),b.then(S=>{for(let A=p.length-1;A>=0;A--)switch(p[A]){case"delta_filter":Yb(S,g);break;case"zigzag_filter":Kb(S);break;case"bitshuffle_filter":Jb(S,m);break;default:throw new rs(`Unhandled filter "${p[A]}"`)}return{layerName:l,blockIndex:x,data:S}}).catch(S=>{throw S})}))},vt($v,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),vt(Cp,"MapboxRasterTile"),vt(Gv,"MapboxRasterLayer",{omit:["_blocksInProgress"]});let Bh,Pm,Cs,Nc,Rm,Vc=null;function Hv(){return Wr()&&self.worker&&self.worker.dracoUrl?self.worker.dracoUrl:Pm||j.DRACO_URL}function Zv(){if(Wr()&&self.worker&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(Nc)return Nc;const n=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);if(typeof WebAssembly!="object")throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer");return Nc=WebAssembly.validate(n)?j.MESHOPT_SIMD_URL:j.MESHOPT_URL,Nc}const Pp={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},hw={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},Nh={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function Wv(n,e,i){const s=i.json.bufferViews.length,l=i.buffers.length;e.bufferView=s,i.json.bufferViews[s]={buffer:l,byteLength:n.byteLength},i.buffers[l]=n}const zm="KHR_draco_mesh_compression";function dw(n,e){const i=n.extensions&&n.extensions[zm];
20if(!i)return;const s=new Cs.Decoder,l=Jv(e,i.bufferView),a=new Cs.Mesh;if(!s.DecodeArrayToMesh(l,l.byteLength,a))throw new Error("Failed to decode Draco mesh");const h=e.json.accessors[n.indices],m=Pp[h.componentType],g=h.count*m.BYTES_PER_ELEMENT,x=Cs._malloc(g);m===Uint16Array?s.GetTrianglesUInt16Array(a,g,x):s.GetTrianglesUInt32Array(a,g,x),Wv(Cs.memory.buffer.slice(x,x+g),h,e),Cs._free(x);for(const p of Object.keys(i.attributes)){const y=s.GetAttributeByUniqueId(a,i.attributes[p]),w=e.json.accessors[n.attributes[p]],v=hw[w.componentType],b=w.count*Nh[w.type]*Pp[w.componentType].BYTES_PER_ELEMENT,S=Cs._malloc(b);s.GetAttributeDataArrayForAllPoints(a,y,Cs[v],b,S),Wv(Cs.memory.buffer.slice(S,S+b),w,e),Cs._free(S)}s.destroy(),a.destroy(),delete n.extensions[zm]}const Rp="EXT_meshopt_compression";function pw(n,e){if(!n.extensions||!n.extensions[Rp])return;const i=n.extensions[Rp],s=new Uint8Array(e.buffers[i.buffer],i.byteOffset||0,i.byteLength||0),l=new Uint8Array(i.count*i.byteStride);Rm.decodeGltfBuffer(l,i.count,i.byteStride,s,i.mode,i.filter),n.buffer=e.buffers.length,n.byteOffset=0,e.buffers[n.buffer]=l.buffer,delete n.extensions[Rp]}const Xv=1179937895,Yv=new TextDecoder("utf8");function Kv(n,e){return new URL(n,e).href}function fw(n,e,i,s){return fetch(Kv(n.uri,s)).then(l=>l.arrayBuffer()).then(l=>{e.buffers[i]=l})}function Jv(n,e){const i=n.json.bufferViews[e];return new Uint8Array(n.buffers[i.buffer],i.byteOffset||0,i.byteLength)}function mw(n,e,i,s){if(n.uri){const l=Kv(n.uri,s);return fetch(l).then(a=>a.blob()).then(a=>createImageBitmap(a)).then(a=>{e.images[i]=a})}if(n.bufferView!==void 0){const l=Jv(e,n.bufferView),a=new Blob([l],{type:n.mimeType});return createImageBitmap(a).then(h=>{e.images[i]=h})}}function Qv(n,e=0,i){const s={json:null,images:[],buffers:[]};if(new Uint32Array(n,e,1)[0]===Xv){const p=new Uint32Array(n,e);let y=2;const w=(p[y++]>>2)-3,v=p[y++]>>2;if(y++,s.json=JSON.parse(Yv.decode(p.subarray(y,y+v))),y+=v,y<w){const b=p[y++];y++;const S=e+(y<<2);s.buffers[0]=n.slice(S,S+b)}}else s.json=JSON.parse(Yv.decode(new Uint8Array(n,e)));const{buffers:l,images:a,meshes:h,extensionsUsed:m,bufferViews:g}=s.json;let x=Promise.resolve();if(l){const p=[];for(let y=0;y<l.length;y++){const w=l[y];w.uri?p.push(fw(w,s,y,i)):s.buffers[y]||(s.buffers[y]=null)}x=Promise.all(p)}return x.then(()=>{const p=[],y=m&&m.includes(zm),w=m&&m.includes(Rp);if(y&&p.push(function(){if(!Cs)return Bh??(Bh=function(v){let b,S=null;function A(){b=new Uint8Array(S.buffer)}function C(){throw new Error("Unexpected Draco error.")}const D={a:{a:C,d:function(L,z,k){return b.copyWithin(L,z,z+k)},c:function(L){const z=b.length,k=Math.max(L>>>0,Math.ceil(1.2*z)),B=Math.ceil((k-z)/65536);try{return S.grow(B),A(),!0}catch{return!1}},b:C}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(v,D):v.then(L=>L.arrayBuffer()).then(L=>WebAssembly.instantiate(L,D))).then(L=>{const{Rb:z,Qb:k,P:B,T:V,X:W,Ja:$,La:H,Qa:ae,Va:Y,Wa:le,eb:_e,jb:pe,f:xe,e:ye,yb:Me,zb:Te,Ab:Ae,Bb:et,Db:Je,Gb:xt}=L.instance.exports;S=ye;const st=(()=>{let ct=0,it=0,zt=0,_t=0;return St=>{zt&&(z(_t),z(ct),it+=zt,zt=ct=0),ct||(it+=128,ct=k(it));const Ft=St.length+7&-8;let Kt=ct;Ft>=it&&(zt=Ft,Kt=_t=k(Ft));for(let Ut=0;Ut<St.length;Ut++)b[Kt+Ut]=St[Ut];return Kt}})();return A(),xe(),{memory:ye,_free:z,_malloc:k,Mesh:class{constructor(){this.ptr=B()}destroy(){V(this.ptr)}},Decoder:class{constructor(){this.ptr=$()}destroy(){pe(this.ptr)}DecodeArrayToMesh(ct,it,zt){const _t=st(ct),St=H(this.ptr,_t,it,zt.ptr);return!!W(St)}GetAttributeByUniqueId(ct,it){return{ptr:ae(this.ptr,ct.ptr,it)}}GetTrianglesUInt16Array(ct,it,zt){Y(this.ptr,ct.ptr,it,zt)}GetTrianglesUInt32Array(ct,it,zt){le(this.ptr,ct.ptr,it,zt)}GetAttributeDataArrayForAllPoints(ct,it,zt,_t,St){_e(this.ptr,ct.ptr,it.ptr,zt,_t,St)}},DT_INT8:Me(),DT_UINT8:Te(),DT_INT16:Ae(),DT_UINT16:et(),DT_UINT32:Je(),DT_FLOAT32:xt()}})}(fetch(Hv())),Bh.then(v=>{Cs=v,Bh=void 0}))}()),w&&p.push(function(){if(Rm)return;const v=function(b){let S;const A=WebAssembly.instantiateStreaming(b,{}).then(L=>{S=L.instance,S.exports.__wasm_call_ctors()}),C={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},D={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:A,supported:!0,decodeGltfBuffer(L,z,k,B,V,W){(function($,H,ae,Y,le,_e,pe){const xe=$.exports.sbrk,ye=Y+3&-4,Me=xe(ye*le),Te=xe(_e.length),Ae=new Uint8Array($.exports.memory.buffer);Ae.set(_e,Te);const et=H(Me,Y,le,Te,_e.length);if(et===0&&pe&&pe(Me,ye,le),ae.set(Ae.subarray(Me,Me+Y*le)),xe(Me-xe(0)),et!==0)throw new Error(`Malformed buffer data: ${et}`)})(S,S.exports[D[V]],L,z,k,B,S.exports[C[W]])}}}(fetch(Zv()));return v.ready.then(()=>{Rm=v})}()),a)for(let v=0;v<a.length;v++)p.push(mw(a[v],s,v,i));return(p.length?Promise.all(p):Promise.resolve()).then(()=>
20{if(y&&h)for(const{primitives:v}of h)for(const b of v)dw(b,s);if(w&&h&&g)for(const v of g)pw(v,s);return s})})}function bl(n,e){const i=n.json.bufferViews[e.bufferView],s=Pp[e.componentType];return new s(n.buffers[i.buffer],(e.byteOffset||0)+(i.byteOffset||0),e.count*(i.byteStride&&i.byteStride!==Nh[e.type]*s.BYTES_PER_ELEMENT?i.byteStride/s.BYTES_PER_ELEMENT:Nh[e.type]))}function Lm(n,e,i,s){const l=Pp[e.componentType],a=function(p){switch(p){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(l),h=n.json.bufferViews[e.bufferView],m=h.byteStride?h.byteStride/l.BYTES_PER_ELEMENT:Nh[e.type],g=i.float32,x=g.length/i.capacity;for(let p=0,y=0;p<e.count*m;p+=m,y+=x)for(let w=0;w<x;w++)g[y+w]=s[p+w]*a;i._trim()}function _w(n,e,i){const s=n.indices,l=n.attributes,a={};a.indexArray=new Tr;const h=e.json.accessors[s],m=h.count/3;a.indexArray.reserve(m);const g=bl(e,h);for(let w=0;w<m;w++)a.indexArray.emplaceBack(g[3*w],g[3*w+1],g[3*w+2]);a.indexArray._trim(),a.vertexArray=new Vn;const x=e.json.accessors[l.POSITION];a.vertexArray.reserve(x.count);const p=bl(e,x);for(let w=0;w<x.count;w++)a.vertexArray.emplaceBack(p[3*w],p[3*w+1],p[3*w+2]);if(a.vertexArray._trim(),a.aabb=new Mt(x.min,x.max),a.centroid=function(w,v){const b=[0,0,0],S=w.length;if(S>0){for(let A=0;A<S;A++){const C=3*w[A];b[0]+=v[C],b[1]+=v[C+1],b[2]+=v[C+2]}b[0]/=S,b[1]/=S,b[2]/=S}return b}(g,p),l.COLOR_0!==void 0){const w=e.json.accessors[l.COLOR_0],v=Nh[w.type],b=bl(e,w);a.colorArray=v===3?new Vn:new vo,a.colorArray.resize(w.count),Lm(e,w,a.colorArray,b)}if(l.NORMAL!==void 0){a.normalArray=new Vn;const w=e.json.accessors[l.NORMAL];a.normalArray.resize(w.count);const v=bl(e,w);Lm(e,w,a.normalArray,v)}if(l.TEXCOORD_0!==void 0&&i.length>0){a.texcoordArray=new ua;const w=e.json.accessors[l.TEXCOORD_0];a.texcoordArray.resize(w.count);const v=bl(e,w);Lm(e,w,a.texcoordArray,v)}if(l._FEATURE_ID_RGBA4444!==void 0){const w=e.json.accessors[l._FEATURE_ID_RGBA4444];e.json.extensionsUsed&&e.json.extensionsUsed.includes("EXT_meshopt_compression")&&(a.featureData=bl(e,w))}l._FEATURE_RGBA4444!==void 0&&(a.featureData=new Uint32Array(bl(e,e.json.accessors[l._FEATURE_RGBA4444]).buffer));const y=n.material;return a.material=function(w,v){const{emissiveFactor:b=[0,0,0],alphaMode:S="OPAQUE",alphaCutoff:A=.5,normalTexture:C,occlusionTexture:D,emissiveTexture:L,doubleSided:z}=w,{baseColorFactor:k=[1,1,1,1],metallicFactor:B=1,roughnessFactor:V=1,baseColorTexture:W,metallicRoughnessTexture:$}=w.pbrMetallicRoughness||{},H=D?v[D.index]:void 0;if(D&&D.extensions&&D.extensions.KHR_texture_transform&&H){const ae=D.extensions.KHR_texture_transform;H.offsetScale=[ae.offset[0],ae.offset[1],ae.scale[0],ae.scale[1]]}return{pbrMetallicRoughness:{baseColorFactor:new Mi(...k),metallicFactor:B,roughnessFactor:V,baseColorTexture:W?v[W.index]:void 0,metallicRoughnessTexture:$?v[$.index]:void 0},doubleSided:z,emissiveFactor:b,alphaMode:S,alphaCutoff:A,normalTexture:C?v[C.index]:void 0,occlusionTexture:H,emissionTexture:L?v[L.index]:void 0,defined:w.defined===void 0}}(y!==void 0?e.json.materials[y]:{defined:!1},i),a}function ex(n,e,i){const{matrix:s,rotation:l,translation:a,scale:h,mesh:m,extras:g,children:x}=n,p={};if(p.matrix=s||X.mat4.fromRotationTranslationScale([],l||[0,0,0,1],a||[0,0,0],h||[1,1,1]),m!==void 0){p.meshes=i[m];const y=p.anchor=[0,0];for(const w of p.meshes){const{min:v,max:b}=w.aabb;y[0]+=v[0]+b[0],y[1]+=v[1]+b[1]}y[0]=Math.floor(y[0]/p.meshes.length/2),y[1]=Math.floor(y[1]/p.meshes.length/2)}if(g&&(g.id&&(p.id=g.id),g.lights&&(p.lights=function(y){if(!y.length)return[];const w=function(C){const D=atob(C),L=new Uint8Array(D.length);for(let z=0;z<D.length;z++)L[z]=D.codePointAt(z);return L}(y),v=[],b=w.length/24,S=new Uint16Array(w.buffer),A=new Float32Array(w.buffer);for(let C=0;C<b;C++){const D=S[2*C*6]/30,L=S[2*C*6+1]/30,z=S[2*C*6+10]/100,k=A[6*C+1],B=A[6*C+2],V=A[6*C+3],W=A[6*C+4],$=V-k,H=W-B,ae=Math.hypot($,H);v.push({pos:[k+.5*$,B+.5*H,L],normal:[H/ae,-$/ae,0],width:ae,height:D,depth:z,points:[k,B,V,W]})}return v}(g.lights))),x){const y=[];for(const w of x)y.push(ex(e.json.nodes[w],e,i));p.children=y}return p}
20function gw(n){if(n.vertices.length===0||n.indices.length===0)return null;const e=new Vf(n.vertices,n.indices,8,256),[i,s]=[e.min.clone(),e.max.clone()];return{vertices:n.vertices,indices:n.indices,grid:e,min:i,max:s}}function yw(n){if(!n.extras||!n.extras.ground)return null;const e=n.extras.ground;if(!e||!Array.isArray(e)||e.length===0)return null;const i=e[0];if(!i||!Array.isArray(i)||i.length===0)return null;const s=[];for(const h of i){if(!Array.isArray(h)||h.length!==2)continue;const m=h[0],g=h[1];typeof m=="number"&&typeof g=="number"&&s.push(new dt(m,g))}if(s.length<3)return null;s.length>1&&s[s.length-1].equals(s[0])&&s.pop();let l=0;for(let h=0;h<s.length;h++){const m=s[h],g=s[(h+1)%s.length],x=s[(h+2)%s.length];l+=(m.x-g.x)*(x.y-g.y)-(x.x-g.x)*(m.y-g.y)}l>0&&s.reverse();const a=uh(s.flatMap(h=>[h.x,h.y]),[]);return a.length===0?null:{vertices:s,indices:a}}function vw(n,e){const i=[],s=[];let l=0;const a=[];for(const h of n){l=i.length;const m=h.vertexArray.float32,g=h.indexArray.uint16;for(let x=0;x<h.vertexArray.length;x++)a[0]=m[3*x+0],a[1]=m[3*x+1],a[2]=m[3*x+2],X.vec3.transformMat4(a,a,e),i.push(new dt(a[0],a[1]));for(let x=0;x<3*h.indexArray.length;x++)s.push(g[x]+l)}if(s.length%3!=0)return null;for(let h=0;h<s.length;h+=3){const m=i[s[h+0]],g=i[s[h+1]],x=i[s[h+2]];(m.x-g.x)*(x.y-g.y)-(x.x-g.x)*(m.y-g.y)>0&&([s[h+1],s[h+2]]=[s[h+2],s[h+1]])}return{vertices:i,indices:s}}function tx(n){const e=function(g,x){const p=[],y=WebGL2RenderingContext;if(g.json.textures)for(const w of g.json.textures){const v={magFilter:y.LINEAR,minFilter:y.NEAREST,wrapS:y.REPEAT,wrapT:y.REPEAT};w.sampler!==void 0&&Object.assign(v,g.json.samplers[w.sampler]),p.push({image:x[w.source],sampler:v,uploaded:!1})}return p}(n,n.images),i=function(g,x){const p=[];for(const y of g.json.meshes){const w=[];for(const v of y.primitives)w.push(_w(v,g,x));p.push(w)}return p}(n,e),{scenes:s,scene:l,nodes:a}=n.json,h=s?s[l||0].nodes:a,m=[];for(const g of h)m.push(ex(a[g],n,i));return function(g,x,p){const y={},w=new Set;for(let v=0;v<g.length;v++){const b=p[x[v]];if(!b.extras)continue;const S=b.extras["mapbox:footprint:version"],A=b.extras["mapbox:footprint:id"];(S||A)&&w.add(v),S==="1.0.0"&&A&&(y[A]=v)}for(let v=0;v<g.length;v++){if(w.has(v))continue;const b=g[v],S=p[x[v]];if(!S.extras)continue;let A=null;b.id in y&&(A=vw(g[y[b.id]].meshes,b.matrix)),A||(A=yw(S)),A&&(b.footprint=gw(A))}if(w.size>0){const v=Array.from(w.values()).sort((b,S)=>b-S);for(let b=v.length-1;b>=0;b--)g.splice(v[b],1)}}(m,h,n.json.nodes),m}function xw(n){n.heightmap=new Float32Array(4096),n.heightmap.fill(-1);const e=n.vertexArray.float32,i=n.aabb.min[0]-1,s=n.aabb.min[1]-1,l=yl/(n.aabb.max[0]-i+2),a=yl/(n.aabb.max[1]-s+2);for(let h=0;h<e.length;h+=3){const m=e[h+2],g=(e[h+0]-i)*l|0,x=(e[h+1]-s)*a|0;m>n.heightmap[x*yl+g]&&(n.heightmap[x*yl+g]=m)}}function bw(n,e){const i={};i.indexArray=new Tr,i.indexArray.reserve(4*n.length),i.vertexArray=new Vn,i.vertexArray.reserve(10*n.length),i.colorArray=new vo,i.vertexArray.reserve(10*n.length);let s=0;for(const h of n){const m=Math.min(10,Math.max(4,1.3*h.height))*e,g=[-h.normal[1],h.normal[0],0],x=Math.min(.29,.1*h.width/h.depth),p=h.width-2*h.depth*e*(x+.01),y=X.vec3.scaleAndAdd([],h.pos,g,p/2),w=X.vec3.scaleAndAdd([],h.pos,g,-p/2),v=[y[0],y[1],y[2]+h.height],b=[w[0],w[1],w[2]+h.height],S=X.vec3.scaleAndAdd([],h.normal,g,x);X.vec3.scale(S,S,m);const A=X.vec3.scaleAndAdd([],h.normal,g,-x);X.vec3.scale(A,A,m),X.vec3.add(S,y,S),X.vec3.add(A,w,A),y[2]+=.1,w[2]+=.1,i.vertexArray.emplaceBack(S[0],S[1],S[2]),i.vertexArray.emplaceBack(A[0],A[1],A[2]),i.vertexArray.emplaceBack(y[0],y[1],y[2]),i.vertexArray.emplaceBack(w[0],w[1],w[2]),i.vertexArray.emplaceBack(v[0],v[1],v[2]),i.vertexArray.emplaceBack(b[0],b[1],b[2]),i.vertexArray.emplaceBack(y[0],y[1],y[2]),i.vertexArray.emplaceBack(w[0],w[1],w[2]),i.vertexArray.emplaceBack(S[0],S[1],S[2]),i.vertexArray.emplaceBack(A[0],A[1],A[2]);const C=p/m/2;i.colorArray.emplaceBack(-C-x,-1,C,.8),i.colorArray.emplaceBack(C+x,-1,C,.8),i.colorArray.emplaceBack(-C,0,C,1.3),i.colorArray.emplaceBack(C,0,C,1.3),i.colorArray.emplaceBack(C+x,-.8,C,.7),i.colorArray.emplaceBack(C+x,-.8,C,.7),i.colorArray.emplaceBack(0,0,C,1.3),i.colorArray.emplaceBack(0,0,C,1.3),i.colorArray.emplaceBack(C+x,-1.2,C,.8),i.colorArray.emplaceBack(C+x,-1.2,C,.8),i.indexArray.emplaceBack(6+s,4+s,8+s),i.indexArray.emplaceBack(7+s,9+s,5+s),i.indexArray.emplaceBack(0+s,1+s,2+s),i.indexArray.emplaceBack(1+s,3+s,2+s),s+=10}const l={defined:!0,emissiveFactor:[0,0,0]},a={};return a.baseColorFactor=Mi.white,l.pbrMetallicRoughness=a,i.material=l,i.aabb=new Mt([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),i}class ix{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i<e.length;i++){const s=e[i];this._stringToNumber[s]=i,this._numberToString[i]=s}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}const ww=["id","tile","layer","source","sourceLayer","state"];class Uc{constructor(e,i,s,l,a){this.type="Feature",this._vectorTileFeature=e,this._z=i,this._x=s,this._y=l,this.properties=e.properties,this.id=a}clone(){const e=new Uc(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 this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const i of ww)this[i]!==void 0&&(e[i]=this[i]);return e}}class rx{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new ea(ht,16,0),this.featureIndexArray=new nn,this.promoteId=i,this.is3DTile=!1,this.serializedLayersCache=new Map}insert(e,i,s,l,a,h=0,m=0){const g=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,l,a,h);const x=this.grid;for(let p=0;p<i.length;p++){const y=i[p],w=[1/0,1/0,-1/0,-1/0];for(let v=0;v<y.length;v++){const b=y[v];w[0]=Math.min(w[0],b.x),w[1]=Math.min(w[1],b.y),w[2]=Math.max(w[2],b.x),w[3]=Math.max(w[3],b.y)}m!==0&&(w[0]-=m,w[1]-=m,w[2]+=m,w[3]+=m),w[0]<ht&&w[1]<ht&&w[2]>=0&&w[3]>=0&&x.insert(g,w[0],w[1],w[2],w[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new ga.VectorTile(new Qd(this.rawTileData)).layers,this.sourceLayerCoder=new ix(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const e in this.vtLayers)this.vtFeatures[e]=[]}return this.vtLayers}query(e,i){const{tilespaceGeometry:s,transform:l,tileTransform:a,pixelPosMatrix:h,availableImages:m}=i;this.loadVTLayers(),this.serializedLayersCache.clear();const g=s.bufferedTilespaceBounds,x=this.grid.query(g.min.x,g.min.y,g.max.x,g.max.y,(v,b,S,A)=>re(s.bufferedTilespaceGeometry,v,b,S,A));x.sort(Tw);let p=null;l.elevation&&x.length>0&&(p=Dc.create(l.elevation,this.tileID));const y={};let w;for(let v=0;v<x.length;v++){const b=x[v];if(b===w)continue;w=b;const S=this.featureIndexArray.get(b);let A=null;
20this.is3DTile?this.loadMatchingModelFeature(y,S,e,s,l):this.loadMatchingFeature(y,S,e,m,(C,D,L,z=0)=>(A||(A=M(C,this.tileID.canonical,a)),D.queryIntersectsFeature(s,C,L,A,this.z,l,h,p,z)))}return y}loadMatchingFeature(e,i,s,l,a){const{featureIndex:h,bucketIndex:m,sourceLayerIndex:g,layoutVertexArrayOffset:x}=i,p=this.bucketLayerIDs[m],y=s.layers,w=Object.keys(y);if(w.length&&!function(C,D){for(let L=0;L<C.length;L++)if(D.indexOf(C[L])>=0)return!0;return!1}(w,p))return;const v=s.sourceCache,b=this.sourceLayerCoder.decode(g),S=this.vtLayers[b].feature(h),A=this.getId(S,b);for(let C=0;C<p.length;C++){const D=p[C];if(!y[D])continue;const{styleLayer:L,targets:z}=y[D];let k={};A!==void 0&&(k=v.getFeatureState(L.sourceLayer,A));const B=!a||a(S,L,k,x);if(!B)continue;const V=new Uc(S,this.z,this.x,this.y,A);V.tile=this.tileID.canonical,V.state=k;let W=this.serializedLayersCache.get(D);W||(W=L.serialize(),W.id=D,this.serializedLayersCache.set(D,W)),V.source=W.source,V.sourceLayer=W["source-layer"],V.layer=Nr({},W),V.layer.paint=nx(W.paint,L.paint,S,k,l),V.layer.layout=nx(W.layout,L.layout,S,k,l);let $=!1;for(const H of z){this.updateFeatureProperties(V,H);const{filter:ae}=H;if(ae){if(S.properties=V.properties,ae.needGeometry){const Y=I(S,!0);if(!ae.filter(new zi(this.tileID.overscaledZ),Y,this.tileID.canonical))continue}else if(!ae.filter(new zi(this.tileID.overscaledZ),S))continue}$=!0,H.targetId&&this.addFeatureVariant(V,H)}$&&this.appendToResult(e,D,h,V,B)}}loadMatchingModelFeature(e,i,s,l,a){const h=this.bucketLayerIDs[0][0],m=s.layers;if(!m[h])return;const{styleLayer:g,targets:x}=m[h];if(g.type!=="model")return;const p=l.tile,y=i.featureIndex,w=p.getBucket(g);if(!(w&&w instanceof xp))return;const v=function(W,$,H,ae){const Y=W.getNodesInfo()[$];if(Y.hiddenByReplacement||!Y.node.meshes)return;let le=Number.MAX_VALUE;const _e=Y.node,pe=H.tile,xe=ae.calculatePosMatrix(pe.tileID.toUnwrapped(),ae.worldSize),ye=Y.evaluatedScale;let Me=0;ae.elevation&&_e.elevation&&(Me=_e.elevation*ae.elevation.exaggeration()),X.mat4.translate(xe,xe,[(_e.anchor?_e.anchor[0]:0)*(ye[0]-1),(_e.anchor?_e.anchor[1]:0)*(ye[1]-1),Me]),X.mat4.scale(xe,xe,ye);const Te=H.queryGeometry,Ae=Te.isPointQuery()?Te.screenBounds:Te.screenGeometry,et=function(xt){const st=X.mat4.multiply([],xe,xt.matrix);X.mat4.multiply(st,ae.expandedFarZProjMatrix,st);for(let ct=0;ct<xt.meshes.length;++ct){const it=xt.meshes[ct];if(ct===xt.lightMeshIndex)continue;const zt=tv(Ae,ae,st,it.aabb);zt!=null&&(le=Math.min(zt,le))}if(xt.children)for(const ct of xt.children)et(ct)};if(et(_e),le===Number.MAX_VALUE)return;const Je=new vi(0,0);return pv(pe.tileID.canonical,Je,Y.node.anchor[0],Y.node.anchor[1]),{intersectionZ:le,position:Je,feature:Y.feature}}(w,y,l,a);if(!v)return;const{z:b,x:S,y:A}=p.tileID.canonical,{feature:C,intersectionZ:D,position:L}=v;let z={};C.id!==void 0&&(z=s.sourceCache.getFeatureState(g.sourceLayer,C.id));const k=new Uc({},b,S,A,C.id);k.tile=this.tileID.canonical,k.state=z,k.properties=C.properties,k.geometry={type:"Point",coordinates:[L.lng,L.lat]};let B=this.serializedLayersCache.get(h);B||(B=g.serialize(),B.id=h,this.serializedLayersCache.set(h,B)),k.source=B.source,k.sourceLayer=B["source-layer"],k.layer=Nr({},B);let V=!1;for(const W of x){this.updateFeatureProperties(k,W);const{filter:$}=W;if($){if(C.properties=k.properties,$.needGeometry){if(!$.filter(new zi(this.tileID.overscaledZ),C,this.tileID.canonical))continue}else if(!$.filter(new zi(this.tileID.overscaledZ),C))continue}V=!0,W.targetId&&this.addFeatureVariant(k,W)}V&&this.appendToResult(e,h,y,k,D)}updateFeatureProperties(e,i,s){if(i.properties){const l={};for(const a in i.properties){const h=i.properties[a].evaluate({zoom:this.z},e._vectorTileFeature,e.state,e.tile,s);h!=null&&(l[a]=h)}e.properties=l}}addFeatureVariant(e,i,s){const l={target:i.target,namespace:i.namespace,uniqueFeatureID:i.uniqueFeatureID};i.properties&&(l.properties=e.properties),e.variants=e.variants||{},e.variants[i.targetId]=e.variants[i.targetId]||[],e.variants[i.targetId].push(l)}appendToResult(e,i,s,l,a){let h=e[i];h===void 0&&(h=e[i]=[]),h.push({featureIndex:s,feature:l,intersectionZ:a})}lookupSymbolFeatures(e,i,s,l,a){const h={};this.loadVTLayers();
20for(const m of e)this.loadMatchingFeature(h,{bucketIndex:i,sourceLayerIndex:s,featureIndex:m,layoutVertexArrayOffset:0},l,a);return h}loadFeature(e){const{featureIndex:i,sourceLayerIndex:s}=e;this.loadVTLayers();const l=this.sourceLayerCoder.decode(s),a=this.vtFeatures[l];if(a[i])return a[i];const h=this.vtLayers[l].feature(i);return a[i]=h,h}hasLayer(e){for(const i of this.bucketLayerIDs)for(const s of i)if(e===s)return!0;return!1}getId(e,i){let s=e.id;if(this.promoteId){const l=Array.isArray(this.promoteId)||typeof this.promoteId!="object"?this.promoteId:this.promoteId[i];if(l!=null)if(Array.isArray(l)){if(!this.promoteIdExpression){const a=Jo(l);if(a.result!=="success"){const h=a.value.map(m=>`${m.key}: ${m.message}`).join(", ");return void Hi(`Failed to create expression for promoteId: ${h}`)}this.promoteIdExpression=a.value}this.promoteIdExpression._evaluator||(this.promoteIdExpression._evaluator=new Ol),s=this.promoteIdExpression.evaluate({zoom:0},e)}else s=e.properties[l];typeof s=="boolean"&&(s=Number(s))}return s}}function nx(n,e,i,s,l){return oo(n,(a,h)=>{const m=e instanceof sa?e.get(h):null;return m&&m.evaluate?m.evaluate(i,s,l):m})}function Tw(n,e){return e-n}vt(rx,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const sx=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Dm{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,s]=new Uint8Array(e,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");const l=s>>4;if(l!==1)throw new Error(`Got v${l} data when expected v1.`);const a=sx[15&s];if(!a)throw new Error("Unrecognized array type.");const[h]=new Uint16Array(e,2,1),[m]=new Uint32Array(e,4,1);return new Dm(m,h,a,e)}constructor(e,i=64,s=Float64Array,l){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=s,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const a=sx.indexOf(this.ArrayType),h=2*e*this.ArrayType.BYTES_PER_ELEMENT,m=e*this.IndexArrayType.BYTES_PER_ELEMENT,g=(8-m%8)%8;if(a<0)throw new Error(`Unexpected typed array class: ${s}.`);l&&l instanceof ArrayBuffer?(this.data=l,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+m+g,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+h+m+g),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+m+g,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+a]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=e)}add(e,i){const s=this._pos>>1;return this.ids[s]=s,this.coords[this._pos++]=e,this.coords[this._pos++]=i,s}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Om(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,s,l){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:a,coords:h,nodeSize:m}=this,g=[0,a.length-1,0],x=[];for(;g.length;){const p=g.pop()||0,y=g.pop()||0,w=g.pop()||0;if(y-w<=m){for(let A=w;A<=y;A++){const C=h[2*A],D=h[2*A+1];C>=e&&C<=s&&D>=i&&D<=l&&x.push(a[A])}continue}const v=w+y>>1,b=h[2*v],S=h[2*v+1];b>=e&&b<=s&&S>=i&&S<=l&&x.push(a[v]),(p===0?e<=b:i<=S)&&(g.push(w),g.push(v-1),g.push(1-p)),(p===0?s>=b:l>=S)&&(g.push(v+1),g.push(y),g.push(1-p))}return x}within(e,i,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:a,nodeSize:h}=this,m=[0,l.length-1,0],g=[],x=s*s;for(;m.length;){const p=m.pop()||0,y=m.pop()||0,w=m.pop()||0;if(y-w<=h){for(let A=w;A<=y;A++)ax(a[2*A],a[2*A+1],e,i)<=x&&g.push(l[A]);continue}const v=w+y>>1,b=a[2*v],S=a[2*v+1];ax(b,S,e,i)<=x&&g.push(l[v]),(p===0?e-s<=b:i-s<=S)&&(m.push(w),m.push(v-1),m.push(1-p)),(p===0?e+s>=b:i+s>=S)&&(m.push(v+1),m.push(y),m.push(1-p))}return g}}function Om(n,e,i,s,l,a){if(l-s<=i)return;const h=s+l>>1;ox(n,e,h,s,l,a),Om(n,e,i,s,h-1,1-a),Om(n,e,i,h+1,l,1-a)}function ox(n,e,i,s,l,a){for(;l>s;){if(l-s>600){const x=l-s+1,p=i-s+1,y=Math.log(x),w=.5*Math.exp(2*y/3),v=.5*Math.sqrt(y*w*(x-w)/x)*(p-x/2<0?-1:1);ox(n,e,i,Math.max(s,Math.floor(i-p*w/x+v)),Math.min(l,Math.floor(i+(x-p)*w/x+v)),a)}const h=e[2*i+a];let m=s,g=l;for(Vh(n,e,s,i),e[2*l+a]>h&&Vh(n,e,s,l);m<g;){for(Vh(n,e,m,g),m++,g--;e[2*m+a]<h;)m++;for(;e[2*g+a]>h;)g--}e[2*s+a]===h?Vh(n,e,s,g):(g++,Vh(n,e,g,l)),g<=i&&(s=g+1),i<=g&&(l=g-1)}}function Vh(n,e,i,s){km(n,i,s),km(e,2*i,2*s),km(e,2*i+1,2*s+1)}function km(n,e,i){const s=n[e];n[e]=n[i],n[i]=s}function ax(n,e,i,s){const l=n-i,a=e-s;return l*l+a*a}o.$=Ur,o.A=tn,o.B=Yn,o.C=la,o.D=Oc,o.E=kn,o.F=2,o.G=bh,o.H=fy,o.I=Xr,o.J=class extends yp{},o.K=hs,o.L=_i,o.M=wd,o.N=Tu,o.O=Ko,o.P=dt,o.Q=dd,o.R=vr,o.S=ec,o.T=pm,o.U=cc,o.V=yp,o.W=Iu,o.X=Jo,o.Y=Ga,o.Z=_s,o._=Ho,o.a=function(n){return j.API_CDN_URL_REGEX.test(n)},o.a$=I,o.a0=Sn,o.a1=Bu,o.a2=Jl,o.a3=Kl,o.a4=function(n){const e=n.value;let i=[];if(!e)return i;const s=hs(e);return s!=="string"?(i=i.concat([new yp(n.key,e,`string expected, "${s}" found`)]),i):(rv(e,!0)||(i=i.concat([new yp(n.key,e,`invalid url "${e}"`)])),i)},o.a5=Pe,o.a6=Fu,o.a7=Zi,o.a8=lt,o.a9=class{constructor(n){this.specification=n}possiblyEvaluate(n,e){return Co(n.expression.evaluate(e))}interpolate(n,e,i){return{x:Ot(n.x,e.x,i),y:Ot(n.y,e.y,i),z:Ot(n.z,e.z,i),azimuthal:Ot(n.azimuthal,e.azimuthal,i),polar:Ot(n.polar,e.polar,i)}}},o.aA=function(n,e){const i={};for(let s=0;s<e.length;s++){const l=e[s];l in n&&(i[l]=n[l])}return i},o.aB=Xs,o.aC=sn,o.aD=class{constructor(n){this.entries={}
20,this.scheduler=n}request(n,e,i,s){const l=this.entries[n]=this.entries[n]||{callbacks:[]};if(l.result){const[a,h]=l.result;return this.scheduler?this.scheduler.add(()=>{s(a,h)},e):s(a,h),()=>{}}return l.callbacks.push(s),l.cancel||(l.cancel=i((a,h)=>{l.result=[a,h];for(const m of l.callbacks)this.scheduler?this.scheduler.add(()=>{m(a,h)},e):m(a,h);setTimeout(()=>delete this.entries[n],3e3)})),()=>{l.result||(l.callbacks=l.callbacks.filter(a=>a!==s),l.callbacks.length||(l.cancel(),delete this.entries[n]))}}},o.aE=function(n,e,i){const s=JSON.stringify(n.request);return n.data&&(this.deduped.entries[s]={result:[null,n.data]}),this.deduped.request(s,{type:"parseTile",isSymbolTile:n.isSymbolTile,zoom:n.tileZoom},l=>{const a=as(n.request,(h,m,g,x)=>{h?l(h):m&&l(null,{vectorTile:i?void 0:new ga.VectorTile(new Qd(m)),rawData:m,cacheControl:g,expires:x})});return()=>{a.cancel(),l()}},e)},o.aF=function(n){Si++,Si>Wt&&(n.getActor().send("enforceCacheSizeLimit",Gt),Si=0)},o.aG=function(n){return n<=1?1:Math.pow(2,Math.floor(Math.log(n)/Math.LN2))},o.aH=Qe,o.aI=Gy,o.aJ=Yy,o.aK=qy,o.aL=function(n,e){const i=document.createElement("video");i.muted=!0,i.onloadstart=function(){e(null,i)};for(let s=0;s<n.length;s++){const l=document.createElement("source");Hc(n[s])||(i.crossOrigin="Anonymous"),l.src=n[s],i.appendChild(l)}return{cancel:()=>{}}},o.aM=pp,o.aN=function(n){return fetch(n).then(e=>e.arrayBuffer()).then(e=>Qv(e,0,n))},o.aO=tx,o.aP=class{constructor(n,e,i,s){this.id=n,this.position=e!=null?new vi(e[0],e[1]):new vi(0,0),this.orientation=i??[0,0,0],this.nodes=s,this.uploaded=!1,this.aabb=new Mt([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(n,e){if(X.mat4.multiply(n.matrix,e,n.matrix),n.meshes)for(const i of n.meshes){const s=Mt.applyTransformFast(i.aabb,n.matrix);this.aabb.encapsulate(s)}if(n.children)for(const i of n.children)this._applyTransformations(i,n.matrix)}computeBoundsAndApplyParent(){const n=X.mat4.identity([]);for(const e of this.nodes)this._applyTransformations(e,n)}computeModelMatrix(n,e,i,s,l,a,h=!1){lv(this.matrix,this,n.transform,this.position,e,i,s,l,a,h)}upload(n){if(!this.uploaded){for(const e of this.nodes)ym(e,n);for(const e of this.nodes)vp(e);this.uploaded=!0}}destroy(){for(const n of this.nodes)vm(n)}},o.aQ=Ca,o.aR=Sh,o.aS=on,o.aT=Sr,o.aU=xs,o.aV=Tr,o.aW=Xn,o.aX=nl,o.aY=hp,o.aZ=function(){In.isLoading()||In.isLoaded()||ac()!=="deferred"||bd()},o.a_=Nu,o.aa=zi,o.ab=Qo,o.ac=t,o.ad=X,o.ae=Zr,o.af=sa,o.ag=Kr,o.ah=Ot,o.ai=ht,o.aj=Wh,o.ak=hi,o.al=Mi,o.am=class{constructor(n){this.specification=n}possiblyEvaluate(n,e){return function([i,s]){const l=Co([1,i,s]);return{x:l.x,y:l.y,z:l.z}}(n.expression.evaluate(e))}interpolate(n,e,i){return{x:Ot(n.x,e.x,i),y:Ot(n.y,e.y,i),z:Ot(n.z,e.z,i)}}},o.an=function(n,e,i=0,s=!0){const l=new dt(i,i),a=n.sub(l),h=e.add(l),m=[a,new dt(h.x,a.y),h,new dt(a.x,h.y)];return s&&m.push(a.clone()),m},o.ao=function(n,e){const i=[];for(let s=0;s<n.length;s++){const l=Os(s-1,-1,n.length-1),a=Os(s+1,-1,n.length-1),h=n[s],m=n[a],g=n[l].sub(h).unit(),x=m.sub(h).unit(),p=x.angleWithSep(g.x,g.y),y=g.add(x).unit().mult(-1*e/Math.sin(p/2));i.push(h.add(y))}return i},o.ap=Cy,o.aq=re,o.ar=function(n,e,i=0){return X.vec3.fromValues(((e.x-i)*n.scale-n.x)*ht,(e.y*n.scale-n.y)*ht,oh(e.z,e.y))},o.as=kt,o.at=jg,o.au=function(n){let e=1/0,i=1/0,s=-1/0,l=-1/0;for(const a of n)e=Math.min(e,a.x),i=Math.min(i,a.y),s=Math.max(s,a.x),l=Math.max(l,a.y);return{min:new dt(e,i),max:new dt(s,l)}},o.av=es,o.aw=ie,o.ax=c,o.ay=Qt,o.az=jr,o.b=function(n){return j.API_FONTS_REGEX.test(n)},o.b$=_p,o.b0=Uc,o.b1=lo,o.b2=Hf,o.b3=Nf,o.b4=M,o.b5=vs,o.b6=gc,o.b7=Lt,o.b8=Ui,o.b9=uh,o.bA=xg,o.bB=rm,o.bC=wy,o.bD=em,o.bE=Dm,o.bF=Os,o.bG=Po,o.bH=Cr,o.bI=function(n,e,i){n[4*e+0]=i[0],n[4*e+1]=i[1],n[4*e+2]=i[2],n[4*e+3]=i[3]},o.bJ=dl,o.bK=Cn,o.bL=ha,o.bM=rr,o.bN=ul,o.bO=vi,o.bP=Dy,o.bQ=De,o.bR=Ht,o.bS=Jy,o.bT=Ke,o.bU=kr,o.bV=function(n,e,i,s,l,a,h,m,g){if(g.name==="globe")return kr(n,e,new Ke(i,s,l),!1);const x=Sh({z:i,x:s,y:l},g);return new Mt([(a+x.x/x.scale)*e,e*(x.y/x.scale),h],[(a+x.x2/x.scale)*e,e*(x.y2/x.scale),m])},o.bW=function(n,e,i){let s=0;for(let l=0;l<2;++l)n[l]>0&&(s+=(n[l]-0)*(n[l]-0)),e[l]<0&&(s+=(0-e[l])*(0-e[l]));return s},o.bX=tr,o.bY=Nd,o.bZ=function(n){const e=X.mat4.identity(new Float64Array(16));X.mat4.multiply(e,n.pixelMatrix,n.globeMatrix);const i=[0,_n,0],s=[0,gn,0];return X.vec3.transformMat4(i,i,e),X.vec3.transformMat4(s,s,e),[i[0]>0&&i[0]<=n.width&&i[1]>0&&i[1]<=n.height&&!ln(n,new vi(n.center.lat,90)),s[0]>0&&s[0]<=n.width&&s[1]>0&&s[1]<=n.height&&!ln(n,new vi(n.center.lat,-90))]},o.b_=function(n,e){const{scale:i}=n.tileTransform,s=i*ht/(n.tileSize*Math.pow(2,e.zoom-n.tileID.overscaledZ+n.tileID.canonical.z));return X.mat2.scale(new Float32Array(4),e.inverseAdjustmentMatrix,[s,s])},o.ba=um,o.bb=function(n,e){const i=Kr(e.zoom);if(i===0)return cr(n);const s=di(n),l=qi(s),a=es(s.getWest())*e.worldSize,h=es(s.getEast())*e.worldSize,m=sn(s.getNorth())*e.worldSize,g=sn(s.getSouth())*e.worldSize,x=[a,m,0],p=[h,m,0],y=[a,g,0],w=[h,g,0],v=X.mat4.invert([],e.globeMatrix);return X.vec3.transformMat4(x,x,v),X.vec3.transformMat4(p,p,v),X.vec3.transformMat4(y,y,v),X.vec3.transformMat4(w,w,v),l[0]=hr(l[0],y,i),l[1]=hr(l[1],w,i),l[2]=hr(l[2],p,i),l[3]=hr(l[3],x,i),Mt.fromPoints(l)},o.bc=Fi,o.bd=bi,o.be=hr,o.bf=ca,o.bg=qt,o.bh=Cp,o.bi=Qd,o.bj=as,o.bk=function(n,e){const i=[];for(const s in n)s in e||i.push(s);return i},o.bl=so,o.bm=["type","source","source-layer","minzoom","maxzoom","filter","layout"],o.bn=Dn,o.bo=function(n,e){const{x:i,y:s}=n.point,l=Pn(i,s,n.worldSize/n._pixelsPerMercatorPixel,0,0);
20return X.mat4.multiply(l,l,ur(cr(e)))},o.bp=Ic,o.bq=vn,o.br=Jd,o.bs=function(n,e,i,s,l){const a=5*e+2;n.float32[a+0]=i,n.float32[a+1]=s,n.float32[a+2]=l},o.bt=up,o.bu=py,o.bv=N,o.bw=Rr,o.bx=fg,o.by=iv,o.bz=vg,o.c=ee,o.c$=Hg,o.c0=Ky,o.c1=function(n){const e=Ky(n,!0);return X.mat2.invert([],[e[0],e[1],e[4],e[5]])},o.c2=ai,o.c3=function(n){const{x:e,y:i}=n.point,{lng:s,lat:l}=n._center;return Pn(e,i,n.worldSize,s,l)},o.c4=gr,o.c5=pt,o.c6=da,o.c7=function(n){const e=Math.round((n+45+360)%360/90)%4;return Wn[e]},o.c8=45,o.c9=Xh,o.cA=kd,o.cB=class extends Qn{constructor(n){super(n),this.current=ih}set(n,e,i){if(this.fetchUniformLocation(n,e)){for(let s=0;s<9;s++)if(i[s]!==this.current[s]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}}},o.cC=no,o.cD=function(n,e,i){const s=Kr(i.zoom),l=n.style.map._antialias,a=n.terrain&&n.terrain.exaggeration()>0;return s===0&&!l&&!a},o.cE=function(n){const e=n.pixelsPerMeter,i=e/Cr(1,n.center.lat),s=X.mat4.identity(new Float64Array(16));return X.mat4.translate(s,s,[n.point.x,n.point.y,0]),X.mat4.scale(s,s,[i,i,e]),Float32Array.from(s)},o.cF=di,o.cG=function(n){const e=tr-5;n=Qt(n,-e,e)/e*90;const i=Math.pow(Math.abs(Math.sin(hi(n))),3);return Math.round(i*(Tc.length-1))},o.cH=function(n,e,i,s){const l=e.getNorth(),a=e.getSouth(),h=e.getWest(),m=e.getEast(),g=1<<n.z,x=m-h,p=l-a,y=x/pa,w=-p/Tc[i],v=[0,y,0,w,0,0,l,h,0];if(n.z>0){const b=180/s;X.mat3.multiply(v,v,[b/x+1,0,0,0,b/p+1,0,-.5*b/y,.5*b/w,1])}return v[2]=g,v[5]=n.x,v[8]=n.y,v},o.cI=cr,o.cJ=function(n,e,i){const s=X.mat4.identity(new Float64Array(16)),l=(e/(1<<n)-.5)*Math.PI*2;return X.mat4.rotateY(s,i.globeMatrix,l),Float32Array.from(s)},o.cK=class{isDataAvailableAtPoint(n){const e=this._source();if(this.isUsingMockSource()||!e||n.y<0||n.y>1)return!1;const i=e.getSource().maxzoom,s=1<<i,l=Math.floor(n.x),a=Math.floor((n.x-l)*s),h=Math.floor(n.y*s),m=this.findDEMTileFor(new Qe(i,l,i,a,h));return!(!m||!m.dem)}getAtPointOrZero(n,e=0){return this.getAtPoint(n,e)||0}getAtPoint(n,e,i=!0){if(this.isUsingMockSource())return null;e==null&&(e=null);const s=this._source();if(!s||n.y<0||n.y>1)return e;const l=s.getSource().maxzoom,a=1<<l,h=Math.floor(n.x),m=n.x-h,g=new Qe(l,h,l,Math.floor(m*a),Math.floor(n.y*a)),x=this.findDEMTileFor(g);if(!x||!x.dem)return e;const p=x.dem,y=1<<x.tileID.canonical.z,w=(m*y-x.tileID.canonical.x)*p.dim,v=(n.y*y-x.tileID.canonical.y)*p.dim,b=Math.floor(w),S=Math.floor(v);return(i?this.exaggeration():1)*Ot(Ot(p.get(b,S),p.get(b,S+1),v-S),Ot(p.get(b+1,S),p.get(b+1,S+1),v-S),w-b)}getAtTileOffset(n,e,i){const s=1<<n.canonical.z;return this.getAtPointOrZero(new t(n.wrap+(n.canonical.x+e/ht)/s,(n.canonical.y+i/ht)/s))}getAtTileOffsetFunc(n,e,i,s){return l=>{const a=this.getAtTileOffset(n,l.x,l.y),h=s.upVector(n.canonical,l.x,l.y),m=s.upVectorScale(n.canonical,e,i).metersToTile;return X.vec3.scale(h,h,a*m),h}}getForTilePoints(n,e,i,s){if(this.isUsingMockSource())return!1;const l=Dc.create(this,n,s);return!!l&&(e.forEach(a=>{a[2]=this.exaggeration()*l.getElevationAt(a[0],a[1],i)}),!0)}getMinMaxForTile(n){if(this.isUsingMockSource())return null;const e=this.findDEMTileFor(n);if(!e||!e.dem)return null;const i=e.dem.tree,s=e.tileID,l=1<<n.canonical.z-s.canonical.z;let a=n.canonical.x/l-s.canonical.x,h=n.canonical.y/l-s.canonical.y,m=0;for(let g=0;g<n.canonical.z-s.canonical.z&&!i.leaves[m];g++){a*=2,h*=2;const x=2*Math.floor(h)+Math.floor(a);m=i.childOffsets[m]+x,a%=1,h%=1}return{min:this.exaggeration()*i.minimums[m],max:this.exaggeration()*i.maximums[m]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(n,e,i){throw new Error("Pure virtual method called.")}pointCoordinate(n){throw new Error("Pure virtual method called.")}_source(){throw new Error("Pure virtual method called.")}isUsingMockSource(){throw new Error("Pure virtual method called.")}exaggeration(){throw new Error("Pure virtual method called.")}findDEMTileFor(n){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){const n=this.visibleDemTiles;if(n.length===0)return null;let e=!1,i=Number.MAX_VALUE,s=Number.MIN_VALUE;for(const l of n){const a=this.getMinMaxForTile(l.tileID);a&&(i=Math.min(i,a.min),s=Math.max(s,a.max),e=!0)}return e?{min:i,max:s}:null}},o.cL=G_,o.cM=ci,o.cN=function(n,e){return[Math.pow(n[0],2.2)*e,Math.pow(n[1],2.2)*e,Math.pow(n[2],2.2)*e]},o.cO=an,o.cP=Ne,o.cQ=za,o.cR=256,o.cS=function(n,e){const i=[0,0,0],s=Fi(cr(e.canonical));return X.vec3.transformMat4(i,i,s),X.vec3.transformMat4(i,i,n),i},o.cT=n=>({u_camera_to_center_distance:new rr(n),u_extrude_scale:new rh(n),u_device_pixel_ratio:new rr(n),u_matrix:new dl(n),u_inv_rot_matrix:new dl(n),u_merc_center:new Cn(n),u_tile_id:new ha(n),u_zoom_transition:new rr(n),u_up_dir:new ha(n),u_emissive_strength:new rr(n)}),o.cU=n=>({u_matrix:new dl(n),u_pixels_to_tile_units:new rh(n),u_device_pixel_ratio:new rr(n),u_width_scale:new rr(n),u_floor_width_scale:new rr(n),u_units_to_pixels:new Cn(n),u_dash_image:new ul(n),u_gradient_image:new ul(n),u_image_height:new rr(n),u_texsize:new Cn(n),u_tile_units_to_pixels:new rr(n),u_alph
20a_discard_threshold:new rr(n),u_trim_offset:new Cn(n),u_trim_fade_range:new Cn(n),u_trim_color:new hl(n),u_emissive_strength:new rr(n),u_zbias_factor:new rr(n),u_tile_to_meter:new rr(n)}),o.cV=n=>({u_matrix:new dl(n),u_texsize:new Cn(n),u_pixels_to_tile_units:new rh(n),u_device_pixel_ratio:new rr(n),u_width_scale:new rr(n),u_floor_width_scale:new rr(n),u_image:new ul(n),u_units_to_pixels:new Cn(n),u_tile_units_to_pixels:new rr(n),u_alpha_discard_threshold:new rr(n),u_trim_offset:new Cn(n),u_trim_fade_range:new Cn(n),u_trim_color:new hl(n),u_emissive_strength:new rr(n),u_zbias_factor:new rr(n),u_tile_to_meter:new rr(n)}),o.cW=Wu,o.cX=M1,o.cY=I1,o.cZ=ma,o.c_=(n,e,i,s,l,a)=>{const h=n.transform,m=h.projection.name==="globe";let g;if(a.paint.get("circle-pitch-alignment")==="map")if(m){const p=an(h.zoom,e.canonical)*h._pixelsPerMercatorPixel;g=Float32Array.from([p,0,0,p])}else g=h.calculatePixelsToTileUnitsMatrix(i);else g=new Float32Array([h.pixelsToGLUnits[0],0,0,h.pixelsToGLUnits[1]]);const x={u_camera_to_center_distance:n.transform.getCameraToCenterDistance(h.projection),u_matrix:n.translatePosMatrix(e.projMatrix,i,a.paint.get("circle-translate"),a.paint.get("circle-translate-anchor")),u_device_pixel_ratio:Be.devicePixelRatio,u_extrude_scale:g,u_inv_rot_matrix:ah,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:a.paint.get("circle-emissive-strength")};if(m){x.u_inv_rot_matrix=s,x.u_merc_center=l,x.u_tile_id=[e.canonical.x,e.canonical.y,1<<e.canonical.z],x.u_zoom_transition=Kr(h.zoom);const p=l[0]*ht,y=l[1]*ht;x.u_up_dir=h.projection.upVector(new Ke(0,0,0),p,y)}return x},o.ca=Sc,o.cb=hl,o.cc=function(n,e,i){const s=Math.sqrt(n*n+e*e+i*i),l=s>0?Math.acos(i/s)*Zn:0;let a=n!==0||e!==0?Math.atan2(-e,-n)*Zn+90:0;return a<0&&(a+=360),[s,a,l]},o.cd=u,o.ce=Mt,o.cf=Co,o.cg=function(n){return[Math.pow(n[0],1/2.2),Math.pow(n[1],1/2.2),Math.pow(n[2],1/2.2)]},o.ch=function(n,e){return n.readFields(xb,{icons:[]},e)},o.ci=function(n){return n({pluginStatus:Yr,pluginURL:qs}),ta.on("pluginStateChange",n),n},o.cj=bp,o.ck=Pc,o.cl=tm,o.cm=Ro,o.cn=Ja,o.co=gt,o.cp=dn,o.cq=un,o.cr=function(n){const e=n.indexOf(hc);return e>=0?n.slice(0,e):n},o.cs=function(n){return n.indexOf(hc)>=0},o.ct=function(n){const e=n.indexOf(hc);return e>=0?n.slice(e+1):""},o.cu=function(n){const e=[],i=n.id;return i===void 0&&e.push({message:`layers.${i}: missing required property "id"`}),n.render===void 0&&e.push({message:`layers.${i}: missing required method "render"`}),n.renderingMode&&n.renderingMode!=="2d"&&n.renderingMode!=="3d"&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},o.cv=function(n,e,i,s){return n.type==="custom"?new ob(n,e):new gb[n.type](n,e,i,s)},o.cw=ao,o.cx=class extends Uc{constructor(n,e){super(n._vectorTileFeature,n._z,n._x,n._y,n.id),n.state&&(this.state=Object.assign({},n.state)),this.target=e.target,this.namespace=e.namespace,e.properties&&(this.properties=e.properties),this.target&&("featuresetId"in this.target&&!this.target.importId||"layerId"in this.target)&&(this.source=n.source,this.sourceLayer=n.sourceLayer,this.layer=n.layer)}toJSON(){const n=super.toJSON();return n.target=this.target,n.namespace=this.namespace,n}},o.cy=ta,o.cz=Tn,o.d=function(n){return j.API_TILEJSON_REGEX.test(n)},o.d$=ix,o.d0=Or,o.d1=(n,e,i,s,l,a,h,m)=>{const g=n.transform,x=g.pitch<15?qg(.07,.7,Qt((14-g.zoom)/5,0,1)):.07,p=i.paint.get("line-trim-color-use-theme").constantOr("default")==="none";return{u_matrix:$g(n,e,i,s),u_texsize:e.imageAtlasTexture?e.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:g.calculatePixelsToTileUnitsMatrix(e),u_device_pixel_ratio:l,u_width_scale:a,u_floor_width_scale:h,u_image:0,u_tile_units_to_pixels:Gg(e,g),u_units_to_pixels:[1/g.pixelsToGLUnits[0],1/g.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:m,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_color:i.paint.get("line-trim-color").toRenderColor(p?null:i.lut).toArray01(),u_emissive_strength:i.paint.get("line-emissive-strength"),u_zbias_factor:x,u_tile_to_meter:u(e.tileID.canonical,0)}},o.d2=(n,e,i,s,l,a,h,m,g)=>{const x=n.transform,p=x.calculatePixelsToTileUnitsMatrix(e),y=i.paint.get("line-trim-color-use-theme").
20constantOr("default")==="none",w=x.pitch<15?qg(.07,.7,Qt((14-x.zoom)/5,0,1)):.07;return{u_matrix:$g(n,e,i,s),u_pixels_to_tile_units:p,u_device_pixel_ratio:a,u_width_scale:h,u_floor_width_scale:m,u_units_to_pixels:[1/x.pixelsToGLUnits[0],1/x.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:l,u_texsize:Zg(i)&&e.lineAtlasTexture?e.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:Gg(e,n.transform),u_alpha_discard_threshold:0,u_trim_offset:g,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_color:i.paint.get("line-trim-color").toRenderColor(y?null:i.lut).toArray01(),u_emissive_strength:i.paint.get("line-emissive-strength"),u_zbias_factor:w,u_tile_to_meter:u(e.tileID.canonical,0)}},o.d3=Aa,o.d4=ch,o.d5=oh,o.d6=Lg,o.d7=ft,o.d8=Kd,o.d9=ya,o.dA=Wd,o.dB=ss,o.dC=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},o.dD=Io,o.dE=Af,o.dF=wo,o.dG=function([n,e,i]){const s=Math.hypot(n,e,i),l=Math.atan2(n,i),a=.5*Math.PI-Math.acos(-e/s);return new vi(gr(l),gr(a))},o.dH=mm,o.dI=function(n){const e=n.navigator?n.navigator.userAgent:null;return!!function(i){if(Ra==null){const s=i.navigator?i.navigator.userAgent:null;Ra=!!i.safari||!(!s||!(/\b(iPad|iPhone|iPod)\b/.test(s)||s.match("Safari")&&!s.match("Chrome")))}return Ra}(n)&&e&&(e.match("Version/15.4")||e.match("Version/15.5")||e.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},o.dJ=function(n,e){Gt=n,Wt=e},o.dK=ln,o.dL=Rn,o.dM=function(n){const e=[0,0,0],i=X.mat4.identity(new Float64Array(16));return X.mat4.multiply(i,n.pixelMatrix,n.globeMatrix),X.vec3.transformMat4(e,e,i),new dt(e[0],e[1])},o.dN=function(n,e,i=!1){if(Yr===Lu||Yr===Jn||Yr===Du)throw new Error("setRTLTextPlugin cannot be called multiple times.");qs=Be.resolveURL(n),Yr=Lu,Ou=e,oc(),i||bd()},o.dO=ac,o.dP=function(){bp().acquire(bm)},o.dQ=function(){const n=zh;n&&(n.isPreloaded()&&n.numActive()===1?(n.release(bm),zh=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()"))},o.dR=xl,o.dS=function(n){const e=$i();if(!e)return;const i=e.delete(bt);n&&i.catch(n).then(()=>n())},o.dT=Rh,o.dU=Hv,o.dV=function(n){Pm=Be.resolveURL(n),Vc||(Vc=new Oc(bp(),new kn)),Vc.broadcast("setDracoUrl",Pm)},o.dW=Zv,o.dX=function(n){Nc=Be.resolveURL(n),Vc||(Vc=new Oc(bp(),new kn)),Vc.broadcast("setMeshoptUrl",Nc)},o.dY=vt,o.dZ=_a,o.d_=Ms,o.da=450,o.db=7,o.dc=sb,o.dd=yi,o.de=xc,o.df=256,o.dg=ur,o.dh=Vn,o.di=rn,o.dj=_c,o.dk=function(n,e,i,s,l){return Qt((n-e)/(i-e)*(l-s)+s,s,l)},o.dl=vu,o.dm=Ys,o.dn=class{constructor(n,e,i,s){this.context=n,this.format=s,this.size=i,this.texture=n.gl.createTexture();const[l,a,h]=this.size,{gl:m}=n;m.bindTexture(m.TEXTURE_3D,this.texture),n.pixelStoreUnpackFlipY.set(!1),n.pixelStoreUnpack.set(1),n.pixelStoreUnpackPremultiplyAlpha.set(!1),m.texImage3D(m.TEXTURE_3D,0,this.format,l,a,h,0,hm(this.format),dm(this.format),e.data)}bind(n,e){const{context:i}=this,{gl:s}=i;s.bindTexture(s.TEXTURE_3D,this.texture),n!==this.minFilter&&(s.texParameteri(s.TEXTURE_3D,s.TEXTURE_MAG_FILTER,n),s.texParameteri(s.TEXTURE_3D,s.TEXTURE_MIN_FILTER,n),this.minFilter=n),e!==this.wrapS&&(s.texParameteri(s.TEXTURE_3D,s.TEXTURE_WRAP_S,e),s.texParameteri(s.TEXTURE_3D,s.TEXTURE_WRAP_T,e),this.wrapS=e)}destroy(){const{gl:n}=this.context;n.deleteTexture(this.texture),this.texture=null}},o.dp=_m,o.dq=[1,1,1],o.dr=Dc,o.ds=Lc,o.dt=Hs,o.du=ua,o.dv=To,o.dw=Ku,o.dx=Yu,o.dy=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new dt(1/0,1/0),max:new dt(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(n,e=!1){const i=_g(new dt(0,0),new dt(ht,ht),n),s=[];if(e&&!Uf(i,this._globalClipBounds))return s;for(const l of this._activeRegions){if(l.hiddenByOverlap||!Uf(i,l))continue;const a=Q0(l.min,l.max,n);s.push({min:a.min,max:a.max,sourceId:this._sourceIds[l.priority],footprint:l.footprint,footprintTileId:l.tileId,order:l.order,clipMask:l.clipMask,clipScope:l.clipScope})}return s}
vendor: 4,530 bytes, line 20
20setSources(n){this._setSources(n.map(e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{const i=[];for(const s of e.cache.getVisibleCoordinates()){const l=e.cache.getTile(s).buckets[e.layer];l&&l.updateFootprints(s.toUnwrapped(),i)}return i},getOrder:()=>e.order,getClipMask:()=>e.clipMask,getClipScope:()=>e.clipScope})))}_addSource(n){const e=n.getFootprints();if(e.length===0)return;const i=n.getOrder(),s=n.getClipMask(),l=n.getClipScope();for(const a of e){if(!a.footprint)continue;const h=_g(a.footprint.min,a.footprint.max,a.id);this._activeRegions.push({min:h.min,max:h.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:a.id,footprint:a.footprint,order:i,clipMask:s,clipScope:l})}this._sourceIds.push(n.getSourceId())}_computeReplacement(){this._activeRegions.sort((e,i)=>e.priority-i.priority||Xd(e.min,i.min)||Xd(e.max,i.max)||e.order-i.order||e.clipMask-i.clipMask||function(s,l){const a=(h,m)=>h+m;return s.length-l.length||s.reduce(a,"").localeCompare(l.reduce(a,""))}(e.clipScope,i.clipScope));let n=this._activeRegions.length!==this._prevRegions.length;if(!n){let e=0;for(;!n&&e!==this._activeRegions.length;){const i=this._activeRegions[e],s=this._prevRegions[e];n=i.priority!==s.priority||!mg(i,s)||i.order!==s.order||i.clipMask!==s.clipMask||!Dn(i.clipScope,s.clipScope),++e}}if(n){++this._updateTime;for(const i of this._activeRegions)i.order!==Wd&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,i.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,i.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,i.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,i.max.y));const e=i=>{const s=this._activeRegions;if(i>=s.length)return i;const l=s[i].priority;for(;i<s.length&&s[i].priority===l;)++i;return i};if(this._sourceIds.length>1){let i=0,s=e(i);for(;i!==s;){let l=i;const a=i;for(;l!==s;){const h=this._activeRegions[l];h.hiddenByOverlap=!1;for(let m=0;m<a;m++){const g=this._activeRegions[m];if(!g.hiddenByOverlap&&h.order===Wd&&Uf(h,g)&&(h.hiddenByOverlap=yg(h.footprint,h.tileId,g.footprint,g.tileId),h.hiddenByOverlap))break}++l}i=s,s=e(i)}}}}_setSources(n){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let e=n.length-1;e>=0;e--)this._addSource(n[e]);this._computeReplacement()}},o.dz=class{constructor(n){this._createGrid(n),this._createPoles(n)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const n of this._poleSegments)n.destroy();for(const n of this._gridSegments)n.withSkirts.destroy(),n.withoutSkirts.destroy()}_fillGridMeshWithLods(n,e){const i=new vs,s=new Tr,l=[],a=n+1+2,h=e[0]+1,m=e[0]+1+(1+e.length),g=(x,p,y)=>{let w=x===a-1?x-2:x===0?x:x-1;return w+=y?24575:0,[w,p]};for(let x=0;x<a;++x)i.emplaceBack(...g(x,0,!0));for(let x=0;x<h;++x)for(let p=0;p<a;++p)i.emplaceBack(...g(p,x,(p===0||p===a-1)&&!0));for(let x=0;x<e.length;++x){const p=e[x];for(let y=0;y<a;++y)i.emplaceBack(...g(y,p,!0))}for(let x=0;x<e.length;++x){const p=s.length,y=e[x]+1+2,w=new Tr;for(let S=0;S<y-1;S++){const A=S===y-2,C=A?a*(m-e.length+x-S):a;for(let D=0;D<a-1;D++){const L=S*a+D;S===0||A||D===0||D===a-2?(w.emplaceBack(L+1,L,L+C),w.emplaceBack(L+C,L+C+1,L+1)):(s.emplaceBack(L+1,L,L+C),s.emplaceBack(L+C,L+C+1,L+1))}}const v=Ui.simpleSegment(0,p,i.length,s.length-p);for(let S=0;S<w.uint16.length;S+=3)s.emplaceBack(w.uint16[S],w.uint16[S+1],w.uint16[S+2]);const b=Ui.simpleSegment(0,p,i.length,s.length-p);l.push({withoutSkirts:v,withSkirts:b})}return{vertices:i,indices:s,segments:l}}_createGrid(n){const e=this._fillGridMeshWithLods(pa,Tc);this._gridSegments=e.segments,this._gridBuffer=n.createVertexBuffer(e.vertices,Lt.members),this._gridIndexBuffer=n.createIndexBuffer(e.indices,!0)}_createPoles(n){const e=new Tr;for(let h=0;h<=pa;h++)e.emplaceBack(0,h+1,h+2);this._poleIndexBuffer=n.createIndexBuffer(e,!0);const i=new rn,s=new rn,l=new rn,a=new rn;this._poleSegments=[];for(let h=0,m=0;h<da;h++){const g=360/(1<<h);i.emplaceBack(0,-jr,0,.5,0),s.emplaceBack(0,-jr,0,.5,1),l.emplaceBack(0,-jr,0,.5,.5),a.emplaceBack(0,-jr,0,.5,.5);for(let x=0;x<=pa;x++){let p=x/pa,y=0;const w=Ot(0,g,p),[v,b,S]=fa(is,Ts,w,jr);i.emplaceBack(v,b,S,p,y),s.emplaceBack(v,b,S,p,1-y);const A=hi(w);p=.5+.5*Math.sin(A),y=.5+.5*Math.cos(A),l.emplaceBack(v,b,S,p,y),a.emplaceBack(v,b,S,p,1-y)}this._poleSegments.push(Ui.simpleSegment(m,0,66,64)),m+=66}
20this._poleNorthVertexBuffer=n.createVertexBuffer(i,Et,!1),this._poleSouthVertexBuffer=n.createVertexBuffer(s,Et,!1),this._texturedPoleNorthVertexBuffer=n.createVertexBuffer(l,Et,!1),this._texturedPoleSouthVertexBuffer=n.createVertexBuffer(a,Et,!1)}getGridBuffers(n,e){return[this._gridBuffer,this._gridIndexBuffer,e?this._gridSegments[n].withSkirts:this._gridSegments[n].withoutSkirts]}getPoleBuffers(n,e){return[e?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,e?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[n]]}},o.e=j,o.e0=rx,o.e1=Ng,o.e2=ml,o.e3="hd_road_elevation",o.e4=class{static parseFrom(n,e){const i=So.parse(n);if(!i)return[];let{vertices:s,features:l}=i;const a=1/u(e);l.sort((x,p)=>x.id-p.id),s.sort((x,p)=>x.id-p.id||x.idx-p.idx),s=s.filter((x,p,y)=>p===y.findIndex(w=>w.id===x.id&&w.idx===x.idx));const h=new Array;let m=0;const g=s.length;for(const x of l){if(x.constantHeight){h.push(new Ff(x.id,x.bounds,x.constantHeight));continue}for(;m!==g&&s[m].id<x.id;)m++;if(m===g||s[m].id!==x.id)continue;const p=new Array,y=new Array,w=m;for(;m!==g&&s[m].id===x.id;){const v=s[m];if(p.push({position:v.position,height:v.height,extent:v.extent}),m!==w&&s[m-1].idx===v.idx-1){const b=m-w;y.push({a:b-1,b})}m++}h.push(new Ff(x.id,x.bounds,void 0,p,y,a))}return h}},o.e5=oo,o.e6=_l,o.e7=my,o.e8=Cc,o.e9=function(n,e,i,s,l,a,h,m=1,g){n.createArrays(),n.tilePixelRatio=ht/(512*n.overscaling),n.compareText={},n.iconsNeedLinear=!1;const x=n.layers[0].layout,p=n.layers[0]._unevaluatedLayout._values,y={};y.scaleFactor=m,y.textSizeScaleRange=x.get("text-size-scale-range"),y.iconSizeScaleRange=x.get("icon-size-scale-range");const[w,v]=y.textSizeScaleRange,[b,S]=y.iconSizeScaleRange;y.textScaleFactor=Qt(y.scaleFactor,w,v),y.iconScaleFactor=Qt(y.scaleFactor,b,S);const A=p["text-size"],C=p["icon-size"];if(n.textSizeData.kind==="composite"){const{minZoom:V,maxZoom:W}=n.textSizeData;y.compositeTextSizes=[A.possiblyEvaluate(new zi(V),a),A.possiblyEvaluate(new zi(W),a)]}if(n.iconSizeData.kind==="composite"){const{minZoom:V,maxZoom:W}=n.iconSizeData;y.compositeIconSizes=[C.possiblyEvaluate(new zi(V),a),C.possiblyEvaluate(new zi(W),a)]}y.layoutTextSize=A.possiblyEvaluate(new zi(h+1),a),y.layoutIconSize=C.possiblyEvaluate(new zi(h+1),a),y.textMaxSize=A.possiblyEvaluate(new zi(18),a);const D=x.get("symbol-placement"),L=x.get("text-rotation-alignment")==="map"&&D!=="point",z=x.get("text-size");let k=!1;const B=[];for(const V of n.features){const W=x.get("text-font").evaluate(V,{},a).join(","),$=z.evaluate(V,{},a)*y.textScaleFactor,H=y.layoutTextSize.evaluate(V,{},a)*y.textScaleFactor,ae=y.layoutIconSize.evaluate(V,{},a)*y.iconScaleFactor,Y={horizontal:{},vertical:void 0},le=V.text;let _e,pe=[0,0];if(le){const it=le.toString(),zt=x.get("text-letter-spacing").evaluate(V,{},a)*Rr,_t=x.get("text-line-height").evaluate(V,{},a)*Rr,St=mf(it)?zt:0,Ft=x.get("text-anchor").evaluate(V,{},a),Kt=x.get("text-variable-anchor");if(!Kt){const mi=x.get("text-radial-offset").evaluate(V,{},a);pe=mi?wy(Ft,[mi*Rr,im]):x.get("text-offset").evaluate(V,{},a).map(Li=>Li*Rr)}let Ut=L?"center":x.get("text-justify").evaluate(V,{},a);const ri=D==="point",Yt=ri?x.get("text-max-width").evaluate(V,{},a)*Rr:1/0,oi=mi=>{n.allowVerticalPlacement&&Pu(it)&&(Y.vertical=Qf(le,e,i,l,W,Yt,_t,Ft,mi,St,pe,vn.vertical,!0,H,$,g))};if(!L&&Kt){const mi=Ut==="auto"?Kt.map(Nt=>rm(Nt)):[Ut];let Li=!1;for(let Nt=0;Nt<mi.length;Nt++){const ui=mi[Nt];if(!Y.horizontal[ui])if(Li)Y.horizontal[ui]=Y.horizontal[0];else{const Bi=Qf(le,e,i,l,W,Yt,_t,"center",ui,St,pe,vn.horizontal,!1,H,$,g);Bi&&(Y.horizontal[ui]=Bi,Li=Bi.positionedLines.length===1)}}oi("left")}else{if(Ut==="auto"&&(Ut=rm(Ft)),ri||x.get("text-writing-mode").indexOf("horizontal")>=0||!Pu(it)){const mi=Qf(le,e,i,l,W,Yt,_t,Ft,Ut,St,pe,vn.horizontal,!1,H,$,g);mi&&(Y.horizontal[Ut]=mi)}oi(ri?"left":Ut)}}let xe,ye,Me,Te,Ae,et=!1;if(V.icon&&V.icon.hasPrimary()){const it=Sy(V.icon,n.iconSizeData,p["icon-size"],a,n.zoom,V,g,y.iconScaleFactor);xe=it.iconPrimary,ye=it.iconSecondary;
20const zt=xe.toString(),_t=s.get(zt);_t&&(Me=x.get("icon-offset").evaluate(V,{},a),Te=x.get("icon-anchor").evaluate(V,{},a),Ae=x.get("icon-text-fit").evaluate(V,{},a),_e=F1(l.get(zt),ye?l.get(ye.toString()):void 0,Me,Te),et=_t.sdf,n.sdfIcons===void 0?n.sdfIcons=_t.sdf:n.sdfIcons!==_t.sdf&&Hi("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(_t.pixelRatio!==n.pixelRatio||x.get("icon-rotate").constantOr(1)!==0)&&(n.iconsNeedLinear=!0))}k=k||!(!V.icon||!V.icon.hasSecondary());const Je=nm(Y.horizontal)||Y.vertical;n.iconsInText||(n.iconsInText=!!Je&&Je.iconsInText);const xt=H*y.textScaleFactor/Rr,{defaultShapedIcon:st,verticallyShapedIcon:ct}=$1(n,_e,x,V,a,Y,xt,Me,Ae);_e=st,B.push({feature:V,shapedTextOrientations:Y,shapedText:Je,shapedIcon:_e,iconPrimary:xe,iconSecondary:ye,iconOffset:Me,iconAnchor:Te,verticallyShapedIcon:ct,layoutTextSize:H,layoutIconSize:ae,textOffset:pe,isSDFIcon:et,iconTextFit:Ae})}return{featureData:B,sizes:y,hasAnySecondaryIcon:k,textAlongLine:L,symbolPlacement:D}},o.ea=_y,o.eb=function(n,e,i,s,l,a,h,m,g,x){const{featureData:p,hasAnySecondaryIcon:y,sizes:w,textAlongLine:v,symbolPlacement:b}=e;for(const S of p){const{shapedIcon:A,verticallyShapedIcon:C,feature:D,shapedTextOrientations:L,shapedText:z,layoutTextSize:k,textOffset:B,isSDFIcon:V,iconPrimary:W,iconSecondary:$,iconTextFit:H,iconOffset:ae}=S;Ey(A,x.iconPositions,W,$),Ey(C,x.iconPositions,W,$),G1(L,x.iconPositions),(z||A)&&H1(n,D,L,A,C,g,w,k,0,B,V,s,l,h,m,y,H,ae,v,b)}i&&n.generateCollisionDebugBuffers(a,n.collisionBoxArray,w.textScaleFactor)},o.ec=ga,o.ed=Ap,o.ee=Ds,o.ef=ig,o.eg=ey,o.eh=Ce,o.ei=function(n){let e=0;if(new Uint32Array(n,0,1)[0]!==Xv){const i=new Uint32Array(n,0,7),[,,s,l,a,h]=i;e=i.byteLength+l+a+h+a,(s!==n.byteLength||e>=n.byteLength)&&Hi("Invalid b3dm header information.")}return Qv(n,e)},o.ej=function(n,e){const i=tx(n);for(const s of i){for(const l of s.meshes)xw(l);s.lights&&(s.lightMeshIndex=s.meshes.length,s.meshes.push(bw(s.lights,e)))}return i},o.ek=xp,o.el=fv,o.em=In,o.en=function(n){si(),Jt!=null&&Jt.then(e=>{e.keys().then(i=>{for(let s=0;s<i.length-n;s++)e.delete(i[s])})})},o.f=function(n){return n.indexOf("mapbox:")===0},o.g=function(n,e){return Tn(Nr(n,{method:"GET"}),e)},o.h=G,o.i=function(n){return j.API_STYLE_REGEX.test(n)&&!ee(n)},o.j=function(n){return decodeURIComponent(atob(n).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""))},o.k=function(n){return btoa(encodeURIComponent(n).replace(/%([0-9A-F]{2})/g,(e,i)=>String.fromCharCode(+("0x"+i))))},o.l=Nr,o.m=Ei,o.n=function(n,e){return Tn(Nr(n,{type:"json"}),e)},o.o=Zc,o.p=function(n,e){return Tn(Nr(n,{method:"POST"}),e)},o.q=Be,o.r=Pr,o.s=function(n){try{const e=self[n];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch{return!1}},o.t=je,o.u=function(){return function n(e){return e?(e^Math.random()*(16>>e/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,n)}()},o.v=function(n){return!!n&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(n)},o.w=Hi,o.x=function(){return wm||(wm=new xl),wm},o.y=Mm,o.z=Do}),ve(["./shared"],function(o){function Ce(Ne){const j=Ne?Ne.url.toString():void 0;return j?performance.getEntriesByName(j):[]}function Oe(Ne){if(typeof Ne=="number"||typeof Ne=="boolean"||typeof Ne=="string"||Ne==null)return JSON.stringify(Ne);if(Array.isArray(Ne)){let G="[";for(const ee of Ne)G+=`${Oe(ee)},`;return`${G}]`}let j="{";for(const G of Object.keys(Ne).sort())j+=`${G}:${Oe(Ne[G])},`;return`${j}}`}function Ge(Ne){let j="";for(const G of o.bm)(Ne.type!=="model"||G!=="minzoom"&&G!=="maxzoom")&&(j+=`/${Oe(Ne[G])}`);return j}class qe{constructor(j){this.keyCache={},this._layers={},this._layerConfigs={},j&&this.replace(j)}replace(j,G){this._layerConfigs={},this._layers={},this.update(j,[],G)}update(j,G,ee){this._options=ee;for(const ce of j)this._layerConfigs[ce.id]=ce,(this._layers[ce.id]=o.cv(ce,this.scope,null,this._options)).compileFilter(ee),this.keyCache[ce.id]&&delete this.keyCache[ce.id];for(const ce of G)delete this.keyCache[ce],delete this._layerConfigs[ce],delete this._layers[ce];this.familiesBySource={};const de=function(ce,ge){const ze={};for(let ke=0;ke<ce.length;ke++){const je=ce[ke];let Be=ge&&ge[je.id];!Be&&(Be=Ge(je),je.type==="line"&&je.paint)&&function gt(bt){return typeof bt=="string"&&bt
20==="line-progress"||(Array.isArray(bt)?bt.some(gt):!(!bt||typeof bt!="object")&&Object.values(bt).some(gt))}(je.paint["line-width"])&&(Be+=`/${Oe(je.paint["line-width"])}`),ge&&(ge[je.id]=Be);let at=ze[Be];at||(at=ze[Be]=[]),at.push(je)}const be=[];for(const ke in ze)be.push(ze[ke]);return be}(Object.values(this._layerConfigs),this.keyCache);for(const ce of de){const ge=ce.map(at=>this._layers[at.id]),ze=ge[0];if(ze.visibility==="none")continue;const be=ze.source||"";let ke=this.familiesBySource[be];ke||(ke=this.familiesBySource[be]={});const je=ze.sourceLayer||"_geojsonTileLayer";let Be=ke[je];Be||(Be=ke[je]=[]),Be.push(ge)}}}const ut=1*o.d_;class It{constructor(j){const G={},ee=[];for(const ze in j){const be=j[ze],ke=G[ze]={};for(const je in be.glyphs){const Be=be.glyphs[+je];if(!Be||Be.bitmap.width===0||Be.bitmap.height===0)continue;const at=Be.metrics.localGlyph?ut:1,gt={x:0,y:0,w:Be.bitmap.width+2*at,h:Be.bitmap.height+2*at};ee.push(gt),ke[je]=gt}}const{w:de,h:ce}=o.H(ee),ge=new o.dZ({width:de||1,height:ce||1});for(const ze in j){const be=j[ze];for(const ke in be.glyphs){const je=be.glyphs[+ke];if(!je||je.bitmap.width===0||je.bitmap.height===0)continue;const Be=G[ze][ke],at=je.metrics.localGlyph?ut:1;o.dZ.copy(je.bitmap,ge,{x:0,y:0},{x:Be.x+at,y:Be.y+at},je.bitmap)}}this.image=ge,this.positions=G}}o.dY(It,"GlyphAtlas");class Fe{constructor(j){this.tileID=new o.aH(j.tileID.overscaledZ,j.tileID.wrap,j.tileID.canonical.z,j.tileID.canonical.x,j.tileID.canonical.y),this.tileZoom=j.tileZoom,this.uid=j.uid,this.zoom=j.zoom,this.lut=j.lut,this.canonical=j.tileID.canonical,this.pixelRatio=j.pixelRatio,this.tileSize=j.tileSize,this.source=j.source,this.scope=j.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=j.showCollisionBoxes,this.collectResourceTiming=!!j.request&&j.request.collectResourceTiming,this.promoteId=j.promoteId,this.isSymbolTile=j.isSymbolTile,this.tileTransform=o.aR(j.tileID.canonical,j.projection),this.projection=j.projection,this.worldview=j.worldview,this.localizableLayerIds=j.localizableLayerIds,this.brightness=j.brightness,this.extraShadowCaster=!!j.extraShadowCaster,this.tessellationStep=j.tessellationStep,this.scaleFactor=j.scaleFactor}parse(j,G,ee,de,ce){this.status="parsing",this.data=j,this.collisionBoxArray=new o.aX;const ge=new o.d$(Object.keys(j.layers).sort()),ze=new o.e0(this.tileID,this.promoteId);ze.bucketLayerIDs=[];const be={},ke=new o.e1(256,256),je={featureIndex:ze,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:ke,availableImages:ee,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0},Be=G.familiesBySource[this.source];for(const si in Be){const Si=j.layers[si];if(!Si)continue;let Ei=!1,Ai=!1,Qi=!1;for(const Vr of Be[si])Vr[0].type==="symbol"?Ei=!0:Ai=!0,Vr[0].is3D()&&Vr[0].type!=="model"&&(Qi=!0);if(this.extraShadowCaster&&!Qi||this.isSymbolTile===!0&&!Ei||this.isSymbolTile===!1&&!Ai)continue;Si.version===1&&o.w(`Vector tile source "${this.source}" layer "${si}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const yr=ge.encode(si),zr=[];let wn=!1;for(let Vr=0,vr=0;Vr<Si.length;Vr++){const wr=Si.feature(Vr),Ro=ze.getId(wr,si);if(this.localizableLayerIds&&this.localizableLayerIds.has(si)){const Tn=wr.properties?wr.properties.worldview:null;if(this.worldview&&typeof Tn=="string")if(Tn==="all")wr.properties.$localized=!0;else{if(!Tn.split(",").includes(this.worldview))continue;wr.properties.$localized=!0,wr.properties.worldview=this.worldview}}!wn&&wr.properties&&wr.properties.hasOwnProperty(o.e2)&&(wn=!0),zr.push({feature:wr,id:Ro,index:vr,sourceLayerIndex:yr}),vr++}wn&&!je.elevationFeatures&&j.layers.hasOwnProperty(o.e3)&&(je.elevationFeatures=o.e4.parseFrom(j.layers[o.e3],this.canonical));for(const Vr of Be[si]){const vr=Vr[0];(!this.extraShadowCaster||vr.is3D()&&vr.type!=="model")&&(this.isSymbolTile!==void 0&&vr.type==="symbol"!==this.isSymbolTile||vr.minzoom&&this.zoom<Math.floor(vr.minzoom)||vr.maxzoom&&this.zoom>=vr.maxzoom||vr.visibility!=="none"&&(ne(Vr,this.zoom,je.brightness,ee),(be[vr.id]=vr.createBucket({index:ze.bucketLayerIDs.length,layers:Vr,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:yr,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep})).populate(zr,je,this.tileID.canonical,this.tileTransform),ze.bucketLayerIDs.push(Vr.map(wr=>o.C(wr.id,wr.scope)))))}}let at,gt,bt,Gt,Wt,Xt;ke.trim();const Jt={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},Oi=()=>
20{if(at)return this.status="done",ce(at);if(this.extraShadowCaster)this.status="done",ce(null,{buckets:Object.values(be).filter(si=>!si.isEmpty()),featureIndex:ze,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:je.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(gt&&bt&&Gt){const si=new It(gt),Si=new Map;for(const[Qi,yr]of bt.entries()){const{imagePosition:zr}=o.e7(Qi,yr,o.e8);Si.set(Qi,zr)}const Ei={};for(const Qi in be){const yr=be[Qi];yr instanceof o.aY&&(ne(yr.layers,this.zoom,je.brightness,ee),Ei[Qi]=o.e9(yr,gt,si.positions,bt,Si,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio))}const Ai={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(de,bt,Wt,()=>{Ai.iconsPending=!1,$i(Ei,si,Ai)}),this.rasterizeIfNeeded(de,Gt,Xt,()=>{Ai.patternsPending=!1,$i(Ei,si,Ai)})}},$i=(si,Si,Ei,Ai)=>{if(Ei.iconsPending||Ei.patternsPending)return;const Qi=new o.ea(bt,Gt,this.lut);for(const yr in be){const zr=be[yr];if(yr in si)o.eb(zr,si[yr],this.showCollisionBoxes,ee,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,bt,Qi);else if(zr.hasPattern&&(zr instanceof o.b2||zr instanceof o.b3||zr instanceof o.d8)){ne(zr.layers,this.zoom,je.brightness,ee);const wn=Object.fromEntries(Qi.patternPositions);zr.addFeatures(je,this.tileID.canonical,wn,ee,this.tileTransform,this.brightness)}}this.status="done",ce(null,{buckets:Object.values(be).filter(yr=>!yr.isEmpty()),featureIndex:ze,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Si.image,lineAtlas:ke,imageAtlas:Qi,brightness:je.brightness})};if(!this.extraShadowCaster){const si=o.e5(je.glyphDependencies,Ai=>Object.keys(Ai).map(Number));Object.keys(si).length?de.send("getGlyphs",{uid:this.uid,stacks:si,scope:this.scope},(Ai,Qi)=>{at||(at=Ai,gt=Qi,Oi())},void 0,!1,Jt):gt={};const Si=Array.from(je.iconDependencies.keys()).map(Ai=>o.I.parse(Ai));Si.length?de.send("getImages",{images:Si,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(Ai,Qi)=>{at||(at=Ai,bt=new Map,Wt=this.updateImageMapAndGetImageTaskQueue(bt,Qi,je.iconDependencies),Oi())},void 0,!1,Jt):(bt=new Map,Wt=new Map);const Ei=Array.from(je.patternDependencies.keys()).map(Ai=>o.I.parse(Ai));Ei.length?de.send("getImages",{images:Ei,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(Ai,Qi)=>{at||(at=Ai,Gt=new Map,Xt=this.updateImageMapAndGetImageTaskQueue(Gt,Qi,je.patternDependencies),Oi())},void 0,!1,Jt):(Gt=new Map,Xt=new Map)}if(je.elevationFeatures&&je.elevationFeatures.length>0){const si=[];for(const Ei of Object.values(be))if(Ei instanceof o.b3){const Ai=Ei.getUnevaluatedPortalGraph();Ai&&si.push(Ai)}const Si=o.e6.evaluate(si);for(const Ei of Object.values(be))Ei instanceof o.b3&&Ei.setEvaluatedPortalGraph(Si)}Oi()}rasterizeIfNeeded(j,G,ee,de){Array.from(G.values()).some(ce=>ce.usvg)?this.rasterize(j,G,ee,de):de()}updateImageMapAndGetImageTaskQueue(j,G,ee){const de=new Map;for(const ce of G.keys()){const ge=ee.get(ce)||[];for(const ze of ge){const be=ze.toString(),ke=G.get(ze.id.toString());ke.usvg?de.has(be)||(de.set(be,ze),j.set(be,Object.assign({},ke))):j.set(be,ke)}}return de}rasterize(j,G,ee,de){this.rasterizeTask=j.send("rasterizeImages",{scope:this.scope,tasks:ee},(ce,ge)=>{if(!ce)for(const[ze,be]of ge.entries()){const ke=Object.assign(G.get(ze),{data:be});G.set(ze,ke)}de()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function ne(Ne,j,G,ee){const de=new o.aa(j,{brightness:G});for(const ce of Ne)ce.recalculate(de,ee)}class Ue extends o.E{constructor(j,G,ee,de,ce,ge){super(),this.actor=j,this.layerIndex=G,this.availableImages=ee,this.loadVectorData=ce||o.aE,this.loading={},this.loaded={},this.deduped=new o.aD(j.scheduler),this.isSpriteLoaded=de,this.scheduler=j.scheduler,this.brightness=ge}loadTile(j,G){const ee=j.uid,de=j&&j.request,ce=de&&de.collectResourceTiming,ge=this.loading[ee]=new Fe(j);ge.abort=this.loadVectorData(j,(ze,be)=>{const ke=!this.loading[ee];if(delete this.loading[ee],ge.cancelRasterize(),ke||ze||!be)return ge.status="done",ke||(this.loaded[ee]=ge),G(ze);const je=be.rawData,Be={};be.expires&&(Be.expires=be.expires),be.cacheControl&&(Be.cacheControl=be.cacheControl),ge.vectorTile=be.vectorTile||new o.ec.VectorTile(new o.bi(je));const at=()=>{ge.parse(ge.vectorTile,this.layerIndex,this.availableImages,this.actor,(gt,bt)=>{if(gt||!bt)return G(gt);const Gt={};if(ce){const Wt=Ce(de);Wt.length>0&&(Gt.resourceTiming=JSON.parse(JSON.stringify(Wt)))}G(null,o.l({rawTileData:je.slice(0)},bt,Be,Gt))})};this.isSpriteLoaded?at():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(at,{type:"parseTile",isSymbolTile:j.isSymbolTile,zoom:j.tileZoom}):at()}),this.loaded=this.loaded||{},this.loaded[ee]=ge})}reloadTile(j,G){const ee=this.loaded,de=j.uid;if(ee&&ee[de]){const ce=ee[de];ce.scaleFactor=j.scaleFactor,ce.showCollisionBoxes=j.showCollisionBoxes,ce.projection=j.projection,ce.brightness=j.brightness,ce.tileTransform=o.aR(j.tileID.canonical,j.projection),ce.extraShadowCaster=j.extraShadowCaster,ce.lut=j.lut;const ge=(ze,be)=>{const ke=ce.reloadCallback;ke&&(delete ce.reloadCallback,ce.parse(ce.vectorTile,this.layerIndex,this.availableImages,this.actor,ke)),G(ze,be)};ce.status==="parsing"?ce.reloadCallback=ge:ce.status==="done"&&(ce.vectorTile?ce.parse(ce.vectorTile,this.layerIndex,this.availableImages,this.actor,ge):ge())}else G(null,void 0)}abortTile(j,G){const ee=j.uid,de=this.loading[ee];de&&(de.abort&&de.abort(),delete this.loading[ee]),G()}removeTile(j,G){const ee=this.loaded,de=j.uid;ee&&ee[de]&&delete ee[de],G()}}class rt{loadTile(j,G){const{uid:ee,encoding:de,rawImageData:ce,padding:ge}=j,ze=ImageBitmap&&ce instanceof ImageBitmap?this.getImageData(ce,ge):ce;G(null,new o.ed(ee,ze,de,ge<1))}reloadTile(j,G){G(null,null)}abortTile(j,G){G()}removeTile(j,G){G()}getImageData(j,G){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(j.width,j.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=j.width,this.offscreenCanvas.height=j.height,this.offscreenCanvasContext.drawImage(j,
200,0,j.width,j.height);const ee=this.offscreenCanvasContext.getImageData(-G,-G,j.width+2*G,j.height+2*G);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),ee}}o.bh.setPbf(o.bi);class Ct{constructor(j){this._mrt=new o.bh(j.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=j.uid,this.tileID=j.tileID,this.source=j.source}parse(j,G){const ee=this._mrt;this.status="parsing",this._entireBuffer=j;try{ee.parseHeader(j),this._isHeaderLoaded=!0;const de=[];for(const ce in ee.layers){const ge=ee.getLayer(ce),ze=ge.getDataRange(ge.getBandList()),be=ee.createDecodingTask(ze),ke=j.slice(ze.firstByte,ze.lastByte+1),je=o.bh.performDecoding(ke,be).then(Be=>be.complete(null,Be)).catch(Be=>be.complete(Be,null));de.push(je)}Promise.allSettled(de).then(()=>G(null,ee))}catch(de){G(de)}}}class Tt{constructor(j){this.actor=j,this.loading={},this.loaded={}}loadTile(j,G){const ee=j.uid,de=j.request,ce=this.loading[ee]=new Ct(j),{cancel:ge}=o.bj(de,(ze,be,ke,je)=>{const Be=!this.loading[ee];if(delete this.loading[ee],Be||ze||!be)return ce.status="done",Be||(this.loaded[ee]=ce),G(ze);ce.parse(be,(at,gt)=>{if(at||!gt)return G(at);G(null,gt,ke,je)}),this.loaded[ee]=ce});ce.abort=ge}reloadTile(j,G){G(null,void 0)}abortTile(j,G){const ee=j.uid,de=this.loading[ee];de&&(de.abort&&de.abort(),delete this.loading[ee]),G()}removeTile(j,G){const ee=j.uid;this.loaded[ee]&&delete this.loaded[ee],G()}decodeRasterArray({task:j,buffer:G},ee){o.bh.performDecoding(G,j).then(de=>ee(null,de)).catch(de=>ee(de))}}const Xe=o.ec.VectorTileFeature.prototype.toGeoJSON;class tt{constructor(j){this._feature=j,this.extent=o.ai,this.type=j.type,this.properties=j.tags,"id"in j&&!isNaN(j.id)&&(this.id=parseInt(j.id,10))}loadGeometry(){if(this._feature.type===1){const j=[];for(const G of this._feature.geometry)j.push([new o.P(G[0],G[1])]);return j}{const j=[];for(const G of this._feature.geometry){const ee=[];for(const de of G)ee.push(new o.P(de[0],de[1]));j.push(ee)}return j}}toGeoJSON(j,G,ee){return Xe.call(this,j,G,ee)}}class nt{constructor(j){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=o.ai,this.length=j.length,this._features=j}feature(j){return new tt(this._features[j])}}const Ye=64/4096,Bt=128;class wi{constructor(){this.features=new Map}clear(){this.features.clear()}load(j=[],G){for(const ee of j){const de=ee.id;if(de==null)continue;let ce=this.features.get(de);ce&&this.updateCache(ce,G),ee.geometry?(ce=Dt(ee),this.updateCache(ce,G),this.features.set(de,ce)):this.features.delete(de),this.updateCache(ce,G)}}updateCache(j,G){for(const{canonical:ee,uid:de}of Object.values(G)){const{z:ce,x:ge,y:ze}=ee;wt(j,Math.pow(2,ce),ge,ze)&&delete G[de]}}getTile(j,G,ee){const de=Math.pow(2,j),ce=[];for(const ge of this.features.values())wt(ge,de,G,ee)&&ce.push(ti(ge,de,G,ee));return{features:ce}}getFeatures(){return[...this.features.values()]}}function wt({minX:Ne,minY:j,maxX:G,maxY:ee},de,ce,ge){return Ne<(ce+1+Ye)/de&&j<(ge+1+Ye)/de&&G>(ce-Ye)/de&&ee>(ge-Ye)/de}function Dt(Ne){const{id:j,geometry:G,properties:ee}=Ne;if(!G)return;if(G.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:de,coordinates:ce}=G,ge={id:j,type:1,geometry:[],tags:ee,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},ze=ge.geometry;if(de==="Point")Xi(ce,ze,ge);else if(de==="MultiPoint")for(const be of ce)Xi(be,ze,ge);else if(de==="LineString")ge.type=2,mr(ce,ze,ge);else if(de==="MultiLineString")ge.type=2,Qr(ce,ze,ge);else if(de==="Polygon")ge.type=3,Qr(ce,ze,ge,!0);else{if(de!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");ge.type=3;for(const be of ce)Qr(be,ze,ge,!0)}return ge}function Xi([Ne,j],G,ee){const de=o.av(Ne);let ce=o.aC(j);ce=ce<0?0:ce>1?1:ce,G.push(de,ce),ee.minX=Math.min(ee.minX,de),ee.minY=Math.min(ee.minY,ce),ee.maxX=Math.max(ee.maxX,de),ee.maxY=Math.max(ee.maxY,ce)}function mr(Ne,j,G,ee=!1,de=!1){const ce=[];for(const ge of Ne)Xi(ge,ce,G);j.push(ce),ee&&function(ge,ze){let be=0;for(let ke=0,je=ge.length,Be=je-2;ke<je;Be=ke,ke+=2)be+=(ge[ke]-ge[Be])*(ge[ke+1]+ge[Be+1]);if(be>0===ze)for(let ke=0,je=ge.length;ke<je/2;ke+=2){const Be=ge[ke],at=ge[ke+1];ge[ke]=ge[je-2-ke],ge[ke+1]=ge[je-1-ke],ge[je-2-ke]=Be,ge[je-1-ke]=at}}(ce,de)}function Qr(Ne,j,G,ee=!1){for(let de=0;de<Ne.length;de++)mr(Ne[de],j,G,ee,de===0)}function ti(Ne,j,G,ee){const{id:de,type:ce,geometry:ge,tags:ze}=Ne,be=[];if(ce===1)(function(ke,je,Be,at,gt){for(let bt=0;bt<ke.length;bt+=2){const Gt=Math.round(o.ai*(ke[bt+0]*je-Be)),Wt=Math.round(o.ai*(ke[bt+1]*je-at));gt.push([Gt,Wt])}})(ge,j,G,ee,be);else for(const ke of ge)_r(ke,j,G,ee,be);return{id:de,type:ce,geometry:be,tags:ze}}function _r(Ne,j,G,ee,de){const ce=-Bt,ge=o.ai+Bt;let ze;for(let be=0;be<Ne.length-2;be+=2){let ke=Math.round(o.ai*(Ne[be+0]*j-G)),je=Math.round(o.ai*(Ne[be+1]*j-ee)),Be=Math.round(o.ai*(Ne[be+2]*j-G)),at=Math.round(o.ai*(Ne[be+3]*j-ee));const gt=Be-ke,bt=at-je;ke<ce&&Be<ce||(ke<ce?(je+=Math.round(bt*((ce-ke)/gt)),ke=ce):Be<ce&&(at=je+Math.round(bt*((ce-ke)/gt)),Be=ce),je<ce&&at<ce||(je<ce?(ke+=Math.round(gt*((ce-je)/bt)),je=ce):at<ce&&(Be=ke+Math.round(gt*((ce-je)/bt)),at=ce),ke>=ge&&Be>=ge||(ke>=ge?(je+=Math.round(bt*((ge-ke)/gt)),ke=ge):Be>=ge&&(at=je+Math.round(bt*((ge-ke)/gt)),Be=ge),je>=ge&&at>=ge||(je>=ge?(ke+=Math.round(gt*((ge-je)/bt)),je=ge):at>=ge&&(Be=ke+Math.round(gt*((ge-je)/bt)),at=ge),ze&&ke===ze[ze.length-1][0]&&je===ze[ze.length-1][1]||(ze=[[ke,je]],de.push(ze)),ze.push([Be,at])))))}}
20var Gr,Hn,ni,en={exports:{}},Rs=function(){if(ni)return en.exports;ni=1;var Ne=o.eg(),j=function(){if(Hn)return Gr;Hn=1;var je=o.ee(),Be=o.ef().VectorTileFeature;function at(bt,Gt){this.options=Gt||{},this.features=bt,this.length=bt.length}function gt(bt,Gt){this.id=typeof bt.id=="number"?bt.id:void 0,this.type=bt.type,this.rawGeometry=bt.type===1?[bt.geometry]:bt.geometry,this.properties=bt.tags,this.extent=Gt||4096}return Gr=at,at.prototype.feature=function(bt){return new gt(this.features[bt],this.options.extent)},gt.prototype.loadGeometry=function(){var bt=this.rawGeometry;this.geometry=[];for(var Gt=0;Gt<bt.length;Gt++){for(var Wt=bt[Gt],Xt=[],Jt=0;Jt<Wt.length;Jt++)Xt.push(new je(Wt[Jt][0],Wt[Jt][1]));this.geometry.push(Xt)}return this.geometry},gt.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var bt=this.geometry,Gt=1/0,Wt=-1/0,Xt=1/0,Jt=-1/0,Oi=0;Oi<bt.length;Oi++)for(var $i=bt[Oi],si=0;si<$i.length;si++){var Si=$i[si];Gt=Math.min(Gt,Si.x),Wt=Math.max(Wt,Si.x),Xt=Math.min(Xt,Si.y),Jt=Math.max(Jt,Si.y)}return[Gt,Xt,Wt,Jt]},gt.prototype.toGeoJSON=Be.prototype.toGeoJSON,Gr}();function G(je){var Be=new Ne;return function(at,gt){for(var bt in at.layers)gt.writeMessage(3,ee,at.layers[bt])}(je,Be),Be.finish()}function ee(je,Be){var at;Be.writeVarintField(15,je.version||1),Be.writeStringField(1,je.name||""),Be.writeVarintField(5,je.extent||4096);var gt={keys:[],values:[],keycache:{},valuecache:{}};for(at=0;at<je.length;at++)gt.feature=je.feature(at),Be.writeMessage(2,de,gt);var bt=gt.keys;for(at=0;at<bt.length;at++)Be.writeStringField(3,bt[at]);var Gt=gt.values;for(at=0;at<Gt.length;at++)Be.writeMessage(4,ke,Gt[at])}function de(je,Be){var at=je.feature;at.id!==void 0&&Be.writeVarintField(1,at.id),Be.writeMessage(2,ce,je),Be.writeVarintField(3,at.type),Be.writeMessage(4,be,at)}function ce(je,Be){var at=je.feature,gt=je.keys,bt=je.values,Gt=je.keycache,Wt=je.valuecache;for(var Xt in at.properties){var Jt=at.properties[Xt],Oi=Gt[Xt];if(Jt!==null){Oi===void 0&&(gt.push(Xt),Gt[Xt]=Oi=gt.length-1),Be.writeVarint(Oi);var $i=typeof Jt;$i!=="string"&&$i!=="boolean"&&$i!=="number"&&(Jt=JSON.stringify(Jt));var si=$i+":"+Jt,Si=Wt[si];Si===void 0&&(bt.push(Jt),Wt[si]=Si=bt.length-1),Be.writeVarint(Si)}}}function ge(je,Be){return(Be<<3)+(7&je)}function ze(je){return je<<1^je>>31}function be(je,Be){for(var at=je.loadGeometry(),gt=je.type,bt=0,Gt=0,Wt=at.length,Xt=0;Xt<Wt;Xt++){var Jt=at[Xt],Oi=1;gt===1&&(Oi=Jt.length),Be.writeVarint(ge(1,Oi));for(var $i=gt===3?Jt.length-1:Jt.length,si=0;si<$i;si++){si===1&>!==1&&Be.writeVarint(ge(2,$i-1));var Si=Jt[si].x-bt,Ei=Jt[si].y-Gt;Be.writeVarint(ze(Si)),Be.writeVarint(ze(Ei)),bt+=Si,Gt+=Ei}gt===3&&Be.writeVarint(ge(7,1))}}function ke(je,Be){var at=typeof je;at==="string"?Be.writeStringField(1,je):at==="boolean"?Be.writeBooleanField(7,je):at==="number"&&(je%1!=0?Be.writeDoubleField(3,je):je<0?Be.writeSVarintField(6,je):Be.writeVarintField(5,je))}return en.exports=G,en.exports.fromVectorTileJs=G,en.exports.fromGeojsonVt=function(je,Be){Be=Be||{};var at={};for(var gt in je)at[gt]=new j(je[gt].features,Be),at[gt].name=gt,at[gt].version=Be.version,at[gt].extent=Be.extent;return G({layers:at})},en.exports.GeoJSONWrapper=j,en.exports}(),Ln=o.eh(Rs);const Zt={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:Ne=>Ne},Mo=Math.fround||(zs=new Float32Array(1),Ne=>(zs[0]=+Ne,zs[0]));var zs;const Br=3,Ni=5,$r=6;class bn{constructor(j){this.options=Object.assign(Object.create(Zt),j),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(j){const{log:G,minZoom:ee,maxZoom:de}=this.options;G&&console.time("total time");const ce=`prepare ${j.length} points`;G&&console.time(ce),this.points=j;const ge=[];for(let be=0;be<j.length;be++){const ke=j[be];if(!ke.geometry)continue;const[je,Be]=ke.geometry.coordinates,at=Mo(Ls(je)),gt=Mo(Ds(Be));ge.push(at,gt,1/0,be,-1,1),this.options.reduce&&ge.push(0)}let ze=this.trees[de+1]=this._createTree(ge);G&&console.timeEnd(ce);for(let be=de;be>=ee;be--){const ke=+Date.now();ze=this.trees[be]=this._createTree(this._cluster(ze,be)),G&&console.log("z%d: %d clusters in %dms",be,ze.numItems,+Date.now()-ke)}return G&&console.timeEnd("total time"),this}getClusters(j,G){let ee=((j[0]+180)%360+360)%360-180;const de=Math.max(-90,Math.min(90,j[1]));let ce=j[2]===180?180:((j[2]+180)%360+360)%360-180;const ge=Math.max(-90,Math.min(90,j[3]));if(j[2]-j[0]>=360)ee=-180,ce=180;else if(ee>ce){const Be=this.getClusters([ee,de,180,ge],G),at=this.getClusters([-180,de,ce,ge],G);return Be.concat(at)}const ze=this.trees[this._limitZoom(G)],be=ze.range(Ls(ee),Ds(ge),Ls(ce),Ds(de)),ke=ze.data,je=[];for(const Be of be){const at=this.stride*Be;je.push(ke[at+Ni]>1?X(ke,at,this.clusterProps):this.points[ke[at+Br]])}return je}getChildren(j){const G=this._getOriginId(j),ee=this._getOriginZoom(j),de="No cluster with the specified id.",ce=this.trees[ee];if(!ce)throw new Error(de);const ge=ce.data;if(G*this.stride>=ge.length)throw new Error(de);const ze=this.options.radius/(this.options.extent*Math.pow(2,ee-1)),be=ce.within(ge[G*this.stride],ge[G*this.stride+1],ze),ke=[];for(const je of be){const Be=je*this.stride;ge[Be+4]===j&&ke.push(ge[Be+Ni]>1?X(ge,Be,this.clusterProps):this.points[ge[Be+Br]])}if(ke.length===0)throw new Error(de);return ke}getLeaves(j,G,ee){const de=[];return this._appendLeaves(de,j,G=G||10,ee=ee||0,0),de}getTile(j,G,ee){const de=this.trees[this._limitZoom(j)],ce=Math.pow(2,j),{extent:ge,radius:ze}=this.options,be=ze/ge,ke=(ee-be)/ce,je=(ee+1+be)/ce,Be={features:[]};return this._addTileFeatures(de.range((G-be)/ce,ke,(G+1+be)/ce,je),de.data,G,ee,ce,Be),G===0&&this._addTileFeatures(de.range(1-be/ce,ke,1,je),de.data,ce,ee,ce,Be),G===ce-1&&this._addTileFeatures(de.range(0,ke,be/ce,je),de.data,-1,ee,ce,Be),Be.features.length?Be:null}getClusterExpansionZoom(j){let G=this._getOriginZoom(j)-1;for(;G<=this.options.maxZoom;){const ee=this.getChildren(j);if(G++,ee.length!==1)break;j=ee[0].properties.cluster_id}return G}_appendLeaves(j,G,ee,de,ce){const ge=this.getChildren(G);for(const ze of ge){const be=ze.properties;if(be&&be.cluster?ce+be.point_count<=de?ce+=be.point_count:ce=this._appendLeaves(j,be.cluster_id,ee,de,ce):ce<de?
vendor: 3,056 bytes, line 20
20ce++:j.push(ze),j.length===ee)break}return ce}_createTree(j){const G=new o.bE(j.length/this.stride|0,this.options.nodeSize,Float32Array);for(let ee=0;ee<j.length;ee+=this.stride)G.add(j[ee],j[ee+1]);return G.finish(),G.data=j,G}_addTileFeatures(j,G,ee,de,ce,ge){for(const ze of j){const be=ze*this.stride,ke=G[be+Ni]>1;let je,Be,at;if(ke)je=ro(G,be,this.clusterProps),Be=G[be],at=G[be+1];else{const Gt=this.points[G[be+Br]];je=Gt.properties;const[Wt,Xt]=Gt.geometry.coordinates;Be=Ls(Wt),at=Ds(Xt)}const gt={type:1,geometry:[[Math.round(this.options.extent*(Be*ce-ee)),Math.round(this.options.extent*(at*ce-de))]],tags:je};let bt;bt=ke||this.options.generateId?G[be+Br]:this.points[G[be+Br]].id,bt!==void 0&&(gt.id=bt),ge.features.push(gt)}}_limitZoom(j){return Math.max(this.options.minZoom,Math.min(Math.floor(+j),this.options.maxZoom+1))}_cluster(j,G){const{radius:ee,extent:de,reduce:ce,minPoints:ge}=this.options,ze=ee/(de*Math.pow(2,G)),be=j.data,ke=[],je=this.stride;for(let Be=0;Be<be.length;Be+=je){if(be[Be+2]<=G)continue;be[Be+2]=G;const at=be[Be],gt=be[Be+1],bt=j.within(be[Be],be[Be+1],ze),Gt=be[Be+Ni];let Wt=Gt;for(const Xt of bt){const Jt=Xt*je;be[Jt+2]>G&&(Wt+=be[Jt+Ni])}if(Wt>Gt&&Wt>=ge){let Xt,Jt=at*Gt,Oi=gt*Gt,$i=-1;const si=(Be/je<<5)+(G+1)+this.points.length;for(const Si of bt){const Ei=Si*je;if(be[Ei+2]<=G)continue;be[Ei+2]=G;const Ai=be[Ei+Ni];Jt+=be[Ei]*Ai,Oi+=be[Ei+1]*Ai,be[Ei+4]=si,ce&&(Xt||(Xt=this._map(be,Be,!0),$i=this.clusterProps.length,this.clusterProps.push(Xt)),ce(Xt,this._map(be,Ei)))}be[Be+4]=si,ke.push(Jt/Wt,Oi/Wt,1/0,si,-1,Wt),ce&&ke.push($i)}else{for(let Xt=0;Xt<je;Xt++)ke.push(be[Be+Xt]);if(Wt>1)for(const Xt of bt){const Jt=Xt*je;if(!(be[Jt+2]<=G)){be[Jt+2]=G;for(let Oi=0;Oi<je;Oi++)ke.push(be[Jt+Oi])}}}}return ke}_getOriginId(j){return j-this.points.length>>5}_getOriginZoom(j){return(j-this.points.length)%32}_map(j,G,ee){if(j[G+Ni]>1){const ge=this.clusterProps[j[G+$r]];return ee?Object.assign({},ge):ge}const de=this.points[j[G+Br]].properties,ce=this.options.map(de);return ee&&ce===de?Object.assign({},ce):ce}}function X(Ne,j,G){return{type:"Feature",id:Ne[j+Br],properties:ro(Ne,j,G),geometry:{type:"Point",coordinates:[(ee=Ne[j],360*(ee-.5)),dt(Ne[j+1])]}};var ee}function ro(Ne,j,G){const ee=Ne[j+Ni],de=ee>=1e4?`${Math.round(ee/1e3)}k`:ee>=1e3?Math.round(ee/100)/10+"k":ee,ce=Ne[j+$r],ge=ce===-1?{}:Object.assign({},G[ce]);return Object.assign(ge,{cluster:!0,cluster_id:Ne[j+Br],point_count:ee,point_count_abbreviated:de})}function Ls(Ne){return Ne/360+.5}function Ds(Ne){const j=Math.sin(Ne*Math.PI/180),G=.5-.25*Math.log((1+j)/(1-j))/Math.PI;return G<0?0:G>1?1:G}function dt(Ne){const j=(180-360*Ne)*Math.PI/180;return 360*Math.atan(Math.exp(j))/Math.PI-90}function Dn(Ne,j,G,ee){let de=ee;const ce=j+(G-j>>1);let ge,ze=G-j;const be=Ne[j],ke=Ne[j+1],je=Ne[G],Be=Ne[G+1];for(let at=j+3;at<G;at+=3){const gt=Hr(Ne[at],Ne[at+1],be,ke,je,Be);if(gt>de)ge=at,de=gt;else if(gt===de){const bt=Math.abs(at-ce);bt<ze&&(ge=at,ze=bt)}}de>ee&&(ge-j>3&&Dn(Ne,j,ge,ee),Ne[ge+2]=de,G-ge>3&&Dn(Ne,ge,G,ee))}
vendor: 7,480 bytes, line 20
20function Hr(Ne,j,G,ee,de,ce){let ge=de-G,ze=ce-ee;if(ge!==0||ze!==0){const be=((Ne-G)*ge+(j-ee)*ze)/(ge*ge+ze*ze);be>1?(G=de,ee=ce):be>0&&(G+=ge*be,ee+=ze*be)}return ge=Ne-G,ze=j-ee,ge*ge+ze*ze}function Zn(Ne,j,G,ee){const de={id:Ne??null,type:j,geometry:G,tags:ee,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(j==="Point"||j==="MultiPoint"||j==="LineString")hi(de,G);else if(j==="Polygon")hi(de,G[0]);else if(j==="MultiLineString")for(const ce of G)hi(de,ce);else if(j==="MultiPolygon")for(const ce of G)hi(de,ce[0]);return de}function hi(Ne,j){for(let G=0;G<j.length;G+=3)Ne.minX=Math.min(Ne.minX,j[G]),Ne.minY=Math.min(Ne.minY,j[G+1]),Ne.maxX=Math.max(Ne.maxX,j[G]),Ne.maxY=Math.max(Ne.maxY,j[G+1])}function gr(Ne,j,G,ee){if(!j.geometry)return;const de=j.geometry.coordinates;if(de&&de.length===0)return;const ce=j.geometry.type,ge=Math.pow(G.tolerance/((1<<G.maxZoom)*G.extent),2);let ze=[],be=j.id;if(G.promoteId?be=j.properties[G.promoteId]:G.generateId&&(be=ee||0),ce==="Point")Wn(de,ze);else if(ce==="MultiPoint")for(const ke of de)Wn(ke,ze);else if(ce==="LineString")no(de,ze,ge,!1);else if(ce==="MultiLineString"){if(G.lineMetrics){for(const ke of de)ze=[],no(ke,ze,ge,!1),Ne.push(Zn(be,"LineString",ze,j.properties));return}ss(de,ze,ge,!1)}else if(ce==="Polygon")ss(de,ze,ge,!0);else{if(ce!=="MultiPolygon"){if(ce==="GeometryCollection"){for(const ke of j.geometry.geometries)gr(Ne,{id:be,geometry:ke,properties:j.properties},G,ee);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const ke of de){const je=[];ss(ke,je,ge,!0),ze.push(je)}}Ne.push(Zn(be,ce,ze,j.properties))}function Wn(Ne,j){j.push(Io(Ne[0]),Qt(Ne[1]),0)}function no(Ne,j,G,ee){let de,ce,ge=0;for(let be=0;be<Ne.length;be++){const ke=Io(Ne[be][0]),je=Qt(Ne[be][1]);j.push(ke,je,0),be>0&&(ge+=ee?(de*je-ke*ce)/2:Math.sqrt(Math.pow(ke-de,2)+Math.pow(je-ce,2))),de=ke,ce=je}const ze=j.length-3;j[2]=1,Dn(j,0,ze,G),j[ze+2]=1,j.size=Math.abs(ge),j.start=0,j.end=j.size}function ss(Ne,j,G,ee){for(let de=0;de<Ne.length;de++){const ce=[];no(Ne[de],ce,G,ee),j.push(ce)}}function Io(Ne){return Ne/360+.5}function Qt(Ne){const j=Math.sin(Ne*Math.PI/180),G=.5-.25*Math.log((1+j)/(1-j))/Math.PI;return G<0?0:G>1?1:G}function Zr(Ne,j,G,ee,de,ce,ge,ze){if(ee/=j,ce>=(G/=j)&&ge<ee)return Ne;if(ge<G||ce>=ee)return null;const be=[];for(const ke of Ne){const je=ke.geometry;let Be=ke.type;const at=de===0?ke.minX:ke.minY,gt=de===0?ke.maxX:ke.maxY;if(at>=G&><ee){be.push(ke);continue}if(gt<G||at>=ee)continue;let bt=[];if(Be==="Point"||Be==="MultiPoint")Os(je,bt,G,ee,de);else if(Be==="LineString")so(je,bt,G,ee,de,!1,ze.lineMetrics);else if(Be==="MultiLineString")os(je,bt,G,ee,de,!1);else if(Be==="Polygon")os(je,bt,G,ee,de,!0);else if(Be==="MultiPolygon")for(const Gt of je){const Wt=[];os(Gt,Wt,G,ee,de,!0),Wt.length&&bt.push(Wt)}if(bt.length){if(ze.lineMetrics&&Be==="LineString"){for(const Gt of bt)be.push(Zn(ke.id,Be,Gt,ke.tags));continue}Be!=="LineString"&&Be!=="MultiLineString"||(bt.length===1?(Be="LineString",bt=bt[0]):Be="MultiLineString"),Be!=="Point"&&Be!=="MultiPoint"||(Be=bt.length===3?"Point":"MultiPoint"),be.push(Zn(ke.id,Be,bt,ke.tags))}}return be.length?be:null}function Os(Ne,j,G,ee,de){for(let ce=0;ce<Ne.length;ce+=3){const ge=Ne[ce+de];ge>=G&&ge<=ee&&Xn(j,Ne[ce],Ne[ce+1],Ne[ce+2])}}function so(Ne,j,G,ee,de,ce,ge){let ze=Nr(Ne);const be=de===0?Aa:Ca;let ke,je,Be=Ne.start;for(let Wt=0;Wt<Ne.length-3;Wt+=3){const Xt=Ne[Wt],Jt=Ne[Wt+1],Oi=Ne[Wt+2],$i=Ne[Wt+3],si=Ne[Wt+4],Si=de===0?Xt:Jt,Ei=de===0?$i:si;let Ai=!1;ge&&(ke=Math.sqrt(Math.pow(Xt-$i,2)+Math.pow(Jt-si,2))),Si<G?Ei>G&&(je=be(ze,Xt,Jt,$i,si,G),ge&&(ze.start=Be+ke*je)):Si>ee?Ei<ee&&(je=be(ze,Xt,Jt,$i,si,ee),ge&&(ze.start=Be+ke*je)):Xn(ze,Xt,Jt,Oi),Ei<G&&Si>=G&&(je=be(ze,Xt,Jt,$i,si,G),Ai=!0),Ei>ee&&Si<=ee&&(je=be(ze,Xt,Jt,$i,si,ee),Ai=!0),!ce&&Ai&&(ge&&(ze.end=Be+ke*je),j.push(ze),ze=Nr(Ne)),ge&&(Be+=ke)}let at=Ne.length-3;const gt=Ne[at],bt=Ne[at+1],Gt=de===0?gt:bt;Gt>=G&&Gt<=ee&&Xn(ze,gt,bt,Ne[at+2]),at=ze.length-3,ce&&at>=3&&(ze[at]!==ze[0]||ze[at+1]!==ze[1])&&Xn(ze,ze[0],ze[1],ze[2]),ze.length&&j.push(ze)}function Nr(Ne){const j=[];return j.size=Ne.size,j.start=Ne.start,j.end=Ne.end,j}function os(Ne,j,G,ee,de,ce){for(const ge of Ne)so(ge,j,G,ee,de,ce,!1)}function Xn(Ne,j,G,ee){Ne.push(j,G,ee)}function Aa(Ne,j,G,ee,de,ce){const ge=(ce-j)/(ee-j);return Xn(Ne,ce,G+(de-G)*ge,1),ge}function Ca(Ne,j,G,ee,de,ce){const ge=(ce-G)/(de-G);return Xn(Ne,j+(ee-j)*ge,ce,1),ge}function oo(Ne,j){const G=[];for(let ee=0;ee<Ne.length;ee++){const de=Ne[ee],ce=de.type;let ge;if(ce==="Point"||ce==="MultiPoint"||ce==="LineString")ge=ao(de.geometry,j);else if(ce==="MultiLineString"||ce==="Polygon"){ge=[];for(const ze of de.geometry)ge.push(ao(ze,j))}else if(ce==="MultiPolygon"){ge=[];for(const ze of de.geometry){const be=[];for(const ke of ze)be.push(ao(ke,j));ge.push(be)}}G.push(Zn(de.id,ce,ge,de.tags))}return G}function ao(Ne,j){const G=[];G.size=Ne.size,Ne.start!==void 0&&(G.start=Ne.start,G.end=Ne.end);for(let ee=0;ee<Ne.length;ee+=3)G.push(Ne[ee]+j,Ne[ee+1],Ne[ee+2]);return G}function un(Ne,j){if(Ne.transformed)return Ne;const G=1<<Ne.z,ee=Ne.x,de=Ne.y;for(const ce of Ne.features){const ge=ce.geometry,ze=ce.type;if(ce.geometry=[],ze===1)for(let be=0;be<ge.length;be+=2)ce.geometry.push(Ao(ge[be],ge[be+1],j,G,ee,de));else for(let be=0;be<ge.length;be++){const ke=[];for(let je=0;je<ge[be].length;je+=2)ke.push(Ao(ge[be][je],ge[be][je+1],j,G,ee,de));ce.geometry.push(ke)}}return Ne.transformed=!0,Ne}function Ao(Ne,j,G,ee,de,ce){return[Math.round(G*(Ne*ee-de)),Math.round(G*(j*ee-ce))]}function Hi(Ne,j,G,ee,de){const ce=j===de.maxZoom?0:de.tolerance/((1<<j)*de.extent),ge={features:[],numPoints:0,numSimplified:0,numFeatures:Ne.length,source:null,x:G,y:ee,z:j,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const ze of Ne)Ci(ge,ze,ce,de);return ge}function Ci(Ne,j,G,ee){const de=j.geometry,ce=j.type,ge=[];if(Ne.minX=Math.min(Ne.minX,j.minX),Ne.minY=Math.min(Ne.minY,j.minY),Ne.maxX=Math.max(Ne.maxX,j.maxX),Ne.maxY=Math.max(Ne.maxY,j.maxY),ce==="Point"||ce==="MultiPoint")for(let ze=0;ze<de.length;ze+=3)ge.push(de[ze],de[ze+1]),Ne.numPoints++,Ne.numSimplified++;else if(ce==="LineString")Pa(ge,de,Ne,G,!1,!1);else if(ce==="MultiLineString"||ce==="Polygon")for(let ze=0;ze<de.length;ze++)Pa(ge,de[ze],Ne,G,ce==="Polygon",ze===0);else if(ce==="MultiPolygon")for(let ze=0;ze<de.length;ze++){const be=de[ze];for(let ke=0;ke<be.length;ke++)Pa(ge,be[ke],Ne,G,!0,ke===0)}if(ge.length){let ze=j.tags||null;if(ce==="LineString"&&ee.lineMetrics){ze={};for(const ke in j.tags)ze[ke]=j.tags[ke];ze.mapbox_clip_start=de.start/de.size,ze.mapbox_clip_end=de.end/de.size}const be={geometry:ge,type:ce==="Polygon"||ce==="MultiPolygon"?3:ce==="LineString"||ce==="MultiLineString"?2:1,tags:ze};j.id!==null&&(be.id=j.id),Ne.features.push(be)}}function Pa(Ne,j,G,ee,de,ce){const ge=ee*ee;if(ee>0&&j.size<(de?ge:ee))return void(G.numPoints+=j.length/3);const ze=[];for(let be=0;be<j.length;be+=3)(ee===0||j[be+2]>ge)&&(G.numSimplified++,ze.push(j[be],j[be+1])),G.numPoints++;de&&function(be,ke){let je=0;for(let Be=0,at=be.length,gt=at-2;Be<at;gt=Be,Be+=2)je+=(be[Be]-be[gt])*(be[Be+1]+be[gt+1]);if(je>0===ke)for(let Be=0,at=be.length;Be<at/2;Be+=2){const gt=be[Be],bt=be[Be+1];be[Be]=be[at-2-Be],be[Be+1]=be[at-1-Be],be[at-2-Be]=gt,be[at-1-Be]=bt}}(ze,ce),Ne.push(ze)}const Co={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};
20class Wr{constructor(j,G){const ee=(G=this.options=function(ce,ge){for(const ze in ge)ce[ze]=ge[ze];return ce}(Object.create(Co),G)).debug;if(ee&&console.time("preprocess data"),G.maxZoom<0||G.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(G.promoteId&&G.generateId)throw new Error("promoteId and generateId cannot be used together.");let de=function(ce,ge){const ze=[];if(ce.type==="FeatureCollection")for(let be=0;be<ce.features.length;be++)gr(ze,ce.features[be],ge,be);else gr(ze,ce.type==="Feature"?ce:{geometry:ce},ge);return ze}(j,G);this.tiles={},this.tileCoords=[],ee&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",G.indexMaxZoom,G.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),de=function(ce,ge){const ze=ge.buffer/ge.extent;let be=ce;const ke=Zr(ce,1,-1-ze,ze,0,-1,2,ge),je=Zr(ce,1,1-ze,2+ze,0,-1,2,ge);return(ke||je)&&(be=Zr(ce,1,-ze,1+ze,0,-1,2,ge)||[],ke&&(be=oo(ke,1).concat(be)),je&&(be=be.concat(oo(je,-1)))),be}(de,G),de.length&&this.splitTile(de,0,0,0),ee&&(de.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(j,G,ee,de,ce,ge,ze){const be=[j,G,ee,de],ke=this.options,je=ke.debug;for(;be.length;){de=be.pop(),ee=be.pop(),G=be.pop(),j=be.pop();const Be=1<<G,at=lo(G,ee,de);let gt=this.tiles[at];if(!gt&&(je>1&&console.time("creation"),gt=this.tiles[at]=Hi(j,G,ee,de,ke),this.tileCoords.push({z:G,x:ee,y:de}),je)){je>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",G,ee,de,gt.numFeatures,gt.numPoints,gt.numSimplified),console.timeEnd("creation"));const Ai=`z${G}`;this.stats[Ai]=(this.stats[Ai]||0)+1,this.total++}if(gt.source=j,ce==null){if(G===ke.indexMaxZoom||gt.numPoints<=ke.indexMaxPoints)continue}else{if(G===ke.maxZoom||G===ce)continue;if(ce!=null){const Ai=ce-G;if(ee!==ge>>Ai||de!==ze>>Ai)continue}}if(gt.source=null,j.length===0)continue;je>1&&console.time("clipping");const bt=.5*ke.buffer/ke.extent,Gt=.5-bt,Wt=.5+bt,Xt=1+bt;let Jt=null,Oi=null,$i=null,si=null,Si=Zr(j,Be,ee-bt,ee+Wt,0,gt.minX,gt.maxX,ke),Ei=Zr(j,Be,ee+Gt,ee+Xt,0,gt.minX,gt.maxX,ke);j=null,Si&&(Jt=Zr(Si,Be,de-bt,de+Wt,1,gt.minY,gt.maxY,ke),Oi=Zr(Si,Be,de+Gt,de+Xt,1,gt.minY,gt.maxY,ke),Si=null),Ei&&($i=Zr(Ei,Be,de-bt,de+Wt,1,gt.minY,gt.maxY,ke),si=Zr(Ei,Be,de+Gt,de+Xt,1,gt.minY,gt.maxY,ke),Ei=null),je>1&&console.timeEnd("clipping"),be.push(Jt||[],G+1,2*ee,2*de),be.push(Oi||[],G+1,2*ee,2*de+1),be.push($i||[],G+1,2*ee+1,2*de),be.push(si||[],G+1,2*ee+1,2*de+1)}}getTile(j,G,ee){j=+j,G=+G,ee=+ee;const de=this.options,{extent:ce,debug:ge}=de;if(j<0||j>24)return null;const ze=1<<j,be=lo(j,G=G+ze&ze-1,ee);if(this.tiles[be])return un(this.tiles[be],ce);ge>1&&console.log("drilling down to z%d-%d-%d",j,G,ee);let ke,je=j,Be=G,at=ee;for(;!ke&&je>0;)je--,Be>>=1,at>>=1,ke=this.tiles[lo(je,Be,at)];return ke&&ke.source?(ge>1&&(console.log("found parent tile z%d-%d-%d",je,Be,at),console.time("drilling down")),this.splitTile(ke.source,je,Be,at,j,G,ee),ge>1&&console.timeEnd("drilling down"),this.tiles[be]?un(this.tiles[be],ce):null):null}}function lo(Ne,j,G){return 32*((1<<Ne)*G+j)+Ne}function Ra(Ne,j){const G=Ne.tileID.canonical;if(!this._geoJSONIndex)return void j(null,null);const ee=this._geoJSONIndex.getTile(G.z,G.x,G.y);if(!ee)return void j(null,null);const de=new nt(ee.features);let ce=Ln(de);ce.byteOffset===0&&ce.byteLength===ce.buffer.byteLength||(ce=new Uint8Array(ce)),j(null,{vectorTile:de,rawData:ce.buffer})}class Po extends Ue{constructor(j,G,ee,de,ce,ge){super(j,G,ee,de,Ra,ge),ce&&(this.loadGeoJSON=ce),this._dynamicIndex=new wi}loadData(j,G){const ee=j&&j.request,de=ee&&ee.collectResourceTiming;this.loadGeoJSON(j,(ce,ge)=>{if(ce||!ge)return G(ce);if(typeof ge!="object")return G(new Error(`Input data given to '${j.source}' is not a valid GeoJSON object.`));{try{if(j.filter){const be=o.X(j.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(be.result==="error")throw new Error(be.value.map(ke=>`${ke.key}
20: ${ke.message}`).join(", "));ge.features=ge.features.filter(ke=>be.value.evaluate({zoom:0},ke))}j.dynamic?(ge.type==="Feature"&&(ge={type:"FeatureCollection",features:[ge]}),j.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(ge.features,this.loaded),j.cluster&&(ge.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=j.cluster?new bn(function({superclusterOptions:be,clusterProperties:ke}){if(!ke||!be)return be;const je={},Be={},at={accumulated:null,zoom:0},gt={properties:null},bt=Object.keys(ke);for(const Gt of bt){const[Wt,Xt]=ke[Gt],Jt=o.X(Xt),Oi=o.X(typeof Wt=="string"?[Wt,["accumulated"],["get",Gt]]:Wt);je[Gt]=Jt.value,Be[Gt]=Oi.value}return be.map=Gt=>{gt.properties=Gt;const Wt={};for(const Xt of bt)Wt[Xt]=je[Xt].evaluate(at,gt);return Wt},be.reduce=(Gt,Wt)=>{gt.properties=Wt;for(const Xt of bt)at.accumulated=Gt[Xt],Gt[Xt]=Be[Xt].evaluate(at,gt)},be}(j)).load(ge.features):j.dynamic?this._dynamicIndex:function(be,ke){return new Wr(be,ke)}(ge,j.geojsonVtOptions)}catch(be){return G(be)}const ze={};if(de){const be=Ce(ee);be&&(ze.resourceTiming={},ze.resourceTiming[j.source]=JSON.parse(JSON.stringify(be)))}G(null,ze)}})}reloadTile(j,G){const ee=this.loaded;return ee&&ee[j.uid]?j.partial?G(null,void 0):super.reloadTile(j,G):this.loadTile(j,G)}loadGeoJSON(j,G){if(j.request)o.n(j.request,G);else{if(typeof j.data!="string")return G(new Error(`Input data given to '${j.source}' is not a valid GeoJSON object.`));try{return G(null,JSON.parse(j.data))}catch{return G(new Error(`Input data given to '${j.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(j,G){try{G(null,this._geoJSONIndex.getClusterExpansionZoom(j.clusterId))}catch(ee){G(ee)}}getClusterChildren(j,G){try{G(null,this._geoJSONIndex.getChildren(j.clusterId))}catch(ee){G(ee)}}getClusterLeaves(j,G){try{G(null,this._geoJSONIndex.getLeaves(j.clusterId,j.limit,j.offset))}catch(ee){G(ee)}}}class Cl{constructor(j,G){this.tileID=new o.aH(j.tileID.overscaledZ,j.tileID.wrap,j.tileID.canonical.z,j.tileID.canonical.x,j.tileID.canonical.y),this.tileZoom=j.tileZoom,this.uid=j.uid,this.zoom=j.zoom,this.canonical=j.tileID.canonical,this.pixelRatio=j.pixelRatio,this.tileSize=j.tileSize,this.source=j.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=j.projection,this.brightness=G}parse(j,G,ee,de){this.status="parsing";const ce=new o.aH(ee.tileID.overscaledZ,ee.tileID.wrap,ee.tileID.canonical.z,ee.tileID.canonical.x,ee.tileID.canonical.y),ge=[],ze=G.familiesBySource[ee.source],be=new o.e0(ce,ee.promoteId);return be.bucketLayerIDs=[],be.is3DTile=!0,o.ei(j).then(ke=>{if(!ke)return de(new Error("Could not parse tile"));const je=o.ej(ke,1/o.cd(ee.tileID.canonical)),Be=ke.json.extensionsUsed&&ke.json.extensionsUsed.includes("MAPBOX_mesh_features")||ke.json.asset.extras&&ke.json.asset.extras.MAPBOX_mesh_features,at=ke.json.extensionsUsed&&ke.json.extensionsUsed.includes("EXT_meshopt_compression"),gt=new o.aa(this.zoom,{brightness:this.brightness});for(const bt in ze)for(const Gt of ze[bt]){const Wt=Gt[0];be.bucketLayerIDs.push(Gt.map(Jt=>o.C(Jt.id,Jt.scope))),Wt.recalculate(gt,[]);const Xt=new o.ek(Gt,je,ce,Be,at,this.brightness,be);Be||(Xt.needsUpload=!0),ge.push(Xt),Xt.evaluate(Wt)}this.status="done",de(null,{buckets:ge,featureIndex:be,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(ke=>de(new Error(ke.message)))}}class Pl{constructor(j,G,ee,de,ce,ge){this.actor=j,this.layerIndex=G,this.availableImages=ee,this.brightness=ge,this.loading={},this.loaded={}}loadTile(j,G){const ee=j.uid,de=this.loading[ee]=new Cl(j,this.brightness);o.bj(j.request,(ce,ge)=>{const ze=!this.loading[ee];return delete this.loading[ee],ze||ce?(de.status="done",ze||(this.loaded[ee]=de),G(ce)):ge&&ge.byteLength!==0?void de.parse(ge,this.layerIndex,j,(be,ke)=>{de.status="done",this.loaded=this.loaded||{},this.loaded[ee]=de,be||!ke?G(be):G(null,ke)}):(de.status="done",this.loaded[ee]=de,G())})}reloadTile(j,G){const ee=this.loaded,de=j.uid;if(ee&&ee[de]){const ce=ee[de];ce.projection=j.projection,ce.brightness=j.brightness;const ge=(ze,be)=>{ce.reloadCallback&&(delete ce.reloadCallback,this.loadTile(j,G)),G(ze,be)};ce.status==="parsing"?ce.reloadCallback=ge:ce.status==="done"&&this.loadTile(j,G)}}abortTile(j,G){const ee=j.uid;this.loading[ee]&&delete this.loading[ee],G()}removeTile(j,G){const ee=this.loaded,de=j.uid;ee&&ee[de]&&delete ee[de],G()}}class za{constructor(j){this.self=j,this.actor=new o.el(j,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.imageRasterizer=new o.y,this.projections={},this.defaultProjection=o.bP({name:"mercator"}),this.workerSourceTypes={vector:Ue,geojson:Po,"raster-dem":rt,"raster-array":Tt,"batched-model":Pl},this.workerSources={}
20,this.self.registerWorkerSource=(G,ee)=>{if(this.workerSourceTypes[G])throw new Error(`Worker source with name "${G}" already registered.`);this.workerSourceTypes[G]=ee},this.self.registerRTLTextPlugin=G=>{if(o.em.isParsed())throw new Error("RTL text plugin already registered.");o.em.applyArabicShaping=G.applyArabicShaping,o.em.processBidirectionalText=G.processBidirectionalText,o.em.processStyledBidirectionalText=G.processStyledBidirectionalText}}clearCaches(j,G,ee){delete this.layerIndexes[j],delete this.availableImages[j],delete this.workerSources[j],ee()}checkIfReady(j,G,ee){ee()}setReferrer(j,G){this.referrer=G}spriteLoaded(j,{scope:G,isLoaded:ee}){if(this.isSpriteLoaded[j]||(this.isSpriteLoaded[j]={}),this.isSpriteLoaded[j][G]=ee,this.workerSources[j]&&this.workerSources[j][G])for(const de in this.workerSources[j][G]){const ce=this.workerSources[j][G][de];for(const ge in ce){const ze=ce[ge];ze instanceof Ue&&(ze.isSpriteLoaded=ee,ze.fire(new o.A("isSpriteLoaded")))}}}setImages(j,{scope:G,images:ee},de){if(this.availableImages[j]||(this.availableImages[j]={}),this.availableImages[j][G]=ee,this.workerSources[j]&&this.workerSources[j][G]){for(const ce in this.workerSources[j][G]){const ge=this.workerSources[j][G][ce];for(const ze in ge)ge[ze].availableImages=ee}de()}else de()}setProjection(j,G){this.projections[j]=o.bP(G)}setBrightness(j,G,ee){this.brightness=G,ee()}setLayers(j,G,ee){this.getLayerIndex(j,G.scope).replace(G.layers,G.options),ee()}updateLayers(j,G,ee){this.getLayerIndex(j,G.scope).update(G.layers,G.removedIds,G.options),ee()}loadTile(j,G,ee){G.projection=this.projections[j]||this.defaultProjection,this.getWorkerSource(j,G.type,G.source,G.scope).loadTile(G,ee)}decodeRasterArray(j,G,ee){this.getWorkerSource(j,G.type,G.source,G.scope).decodeRasterArray(G,ee)}reloadTile(j,G,ee){G.projection=this.projections[j]||this.defaultProjection,this.getWorkerSource(j,G.type,G.source,G.scope).reloadTile(G,ee)}abortTile(j,G,ee){this.getWorkerSource(j,G.type,G.source,G.scope).abortTile(G,ee)}removeTile(j,G,ee){this.getWorkerSource(j,G.type,G.source,G.scope).removeTile(G,ee)}removeSource(j,G,ee){if(!(this.workerSources[j]&&this.workerSources[j][G.scope]&&this.workerSources[j][G.scope][G.type]&&this.workerSources[j][G.scope][G.type][G.source]))return;const de=this.workerSources[j][G.scope][G.type][G.source];delete this.workerSources[j][G.scope][G.type][G.source],de.removeSource!==void 0?de.removeSource(G,ee):ee()}loadWorkerSource(j,G,ee){try{this.self.importScripts(G.url),ee()}catch(de){ee(de.toString())}}syncRTLPluginState(j,G,ee){try{o.em.setState(G);const de=o.em.getPluginURL();if(o.em.isLoaded()&&!o.em.isParsed()&&de!=null){this.self.importScripts(de);const ce=o.em.isParsed();ee(ce?void 0:new Error(`RTL Text Plugin failed to import scripts from ${de}`),ce)}}catch(de){ee(de.toString())}}setDracoUrl(j,G){this.dracoUrl=G}getAvailableImages(j,G){this.availableImages[j]||(this.availableImages[j]={});let ee=this.availableImages[j][G];return ee||(ee=[]),ee}getLayerIndex(j,G){this.layerIndexes[j]||(this.layerIndexes[j]={});let ee=this.layerIndexes[j][G];return ee||(ee=this.layerIndexes[j][G]=new qe,ee.scope=G),ee}getWorkerSource(j,G,ee,de){const ce=this.workerSources;return ce[j]||(ce[j]={}),ce[j][de]||(ce[j][de]={}),ce[j][de][G]||(ce[j][de][G]={}),this.isSpriteLoaded[j]||(this.isSpriteLoaded[j]={}),ce[j][de][G][ee]||(ce[j][de][G][ee]=new this.workerSourceTypes[G]({send:(ge,ze,be,ke,je,Be)=>{this.actor.send(ge,ze,be,j,je,Be)},scheduler:this.actor.scheduler},this.getLayerIndex(j,de),this.getAvailableImages(j,de),this.isSpriteLoaded[j][de],void 0,this.brightness)),ce[j][de][G][ee]}rasterizeImages(j,G,ee){const de=new Map;for(const[ce,{image:ge,imageVariant:ze}]of G.tasks.entries()){const be=this.imageRasterizer.rasterize(ze,ge,G.scope,j);de.set(ce,be)}ee(void 0,de)}removeRasterizedImages(j,G,ee){this.imageRasterizer.removeImagesFromCacheByIds(G.imageIds,G.scope,j),ee()}enforceCacheSizeLimit(j,G){o.en(G)}getWorkerPerformanceMetrics(j,G,ee){ee(void 0,void 0)}}return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope&&(self.worker=new za(self)),za}),ve(["./shared"],function(o){var Ce="3.11.0";const Oe={create:"create",load:"load",fullLoad:"fullLoad"},Ge={mark(u){performance.mark(u)},measure(u,t,r){performance.measure(u,t,r)}};function qe(u){const t=u.name.split("?")[0];return o.a(t)&&t.includes("mapbox-gl.js")?"javascript":o.a(t)&&t.includes("mapbox-gl.css")?"css":o.b(t)?"fontRange":o.c(t)?"sprite":o.i(t)?"style":o.d(t)?"tilejson":"other"}var ut,It={},Fe=function(){if(ut)return It;function u(c){return!t(c)}function t(c){return typeof window>"u"||typeof document>"u"?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var f,_,T=new Blob([""],{type:"text/javascript"}),E=URL.createObjectURL(T);try{_=new Worker(E),f=!0}catch{f=!1}return _&&_.terminate(),URL.revokeObjectURL(E),f}()?function(){var f=document.createElement("canvas");f.width=f.height=1;var _=f.getContext("2d");if(!_)return!1;var T=_.getImageData(0,0,1,1);return T&&T.width===f.width}()?(r[d=c&&c.failIfMajorPerformanceCaveat]===void 0&&(r[d]=function(f){var _,T=function(E){var M=document.createElement("canvas"),I=Object.create(u.webGLContextAttributes);return I.failIfMajorPerformanceCaveat=E,M.getContext("webgl2",I)}(f);if(!T)return!1;try{_=T.createShader(T.VERTEX_SHADER)}catch{return!1}return!(!_||T.isContextLost())&&(T.shaderSource(_,"void main() {}"),T.compileShader(_),T.getShaderParameter(_,T.COMPILE_STATUS)===!0)}(d)),r[d]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var d}ut=1,It.supported=u,It.notSupportedReason=t;var r={};return u.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},It}();function ne(u,t,r){const c=document.createElement(u);return t!=null&&(c.className=t),r&&r.appendChild(c),c}function Ue(u,t,r){const c=document.createElementNS("http://www.w3.org/2000/svg",u);for(const d of Object.keys(t))c.setAttributeNS(null,d,String(t[d]));return r&&r.appendChild(c),c}const rt=typeof document<"u"?document.documentElement&&document.documentElement.style:null,Ct=rt&&rt.userSelect!==void 0?"userSelect":"WebkitUserSelect";let Tt;function Xe(){rt&&Ct&&(Tt=rt[Ct],rt[Ct]="none")}function tt(){rt&&Ct&&(rt[Ct]=Tt)}function nt(u){u.preventDefault(),u.stopPropagation(),window.removeEventListener("click",nt,!0)}function Ye(){window.addEventListener("click",nt,!0),window.setTimeout(()=>{window.removeEventListener("click",nt,!0)},0)}function Bt(u,t){const r=u.getBoundingClientRect();return Dt(u,r,t)}function wi(u,t){const r=u.getBoundingClientRect(),c=[];for(let d=0;d<t.length;d++)c.push(Dt(u,r,t[d]));return c}function wt(u){return/firefox/i.test(navigator.userAgent)&&/macintosh/i.test(navigator.userAgent)&&u.button===2&&u.ctrlKey?0:u.button}function Dt(u,t,r){const c=u.offsetWidth===t.width?1:u.offsetWidth/t.width;return new o.P((r.clientX-t.left)*c,(r.clientY-t.top)*c)}const Xi="01",mr="NO_ACCESS_TOKEN";class Qr{constructor(t,r,c){this._transformRequestFn=t,this._customAccessToken=r,this._silenceAuthErrors=!!c,this._createSkuToken()}_createSkuToken(){const t=function(){let r="";for(let c=0;c<10;c++)r+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",Xi,r].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(t,r){return this._transformRequestFn&&this._transformRequestFn(t,r)||{url:t}}normalizeStyleURL(t,r){if(!o.f(t))return t;const c=_r(t);return c.params.push(`sdk=js-${Ce}`),c.path=`/styles/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||r)}normalizeGlyphsURL(t,r){if(!o.f(t))return t;const c=_r(t);return c.path=`/fonts/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||r)}normalizeModelURL(t,r){if(!o.f(t))return t;const c=_r(t);return c.path=`/models/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||r)}normalizeSourceURL(t,r,c,d){if(!o.f(t))return t;const f=_r(t);return f.path=`/v4/${f.authority}.json`,f.params.push("secure"),c&&f.params.push(`language=${c}`),d&&f.params.push(`worldview=${d}`),this._makeAPIURL(f,this._customAccessToken||r)}normalizeIconsetURL(t,r){const c=_r(t);return o.f(t)?(c.path=`/styles/v1${c.path}/iconset.pbf`,this._makeAPIURL(c,this._customAccessToken||r)):Gr(c)}normalizeSpriteURL(t,r,c,d){const f=_r(t);return o.f(t)?(f.path=`/styles/v1${f.path}/sprite${r}${c}`,this._makeAPIURL(f,this._customAccessToken||d)):(f.path+=`${r}${c}`,Gr(f))}normalizeTileURL(t,r,c){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!o.f(t))return t;const d=_r(t);d.path=d.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${r||c&&d.authority!=="raster"&&c===512?"@2x":""}${o.m.supported?".webp":"$1"}`),d.authority==="raster"?d.path=`/${o.e.RASTER_URL_PREFIX}${d.path}`:d.authority==="rasterarrays"?d.path=`/${o.e.RASTERARRAYS_URL_PREFIX}${d.path}`:d.authority==="3dtiles"?d.path=`/${o.e.TILES3D_URL_PREFIX}${d.path}`:(d.path=d.path.replace(/^.+\/v4\//,"/"),d.path=`/${o.e.TILE_URL_VERSION}${d.path}`);const f=this._customAccessToken||function(_){for(const T of _){const E=T.match(/^access_token=(.*)$/);if(E)return E[1]}return null}(d.params)||o.e.ACCESS_TOKEN;return o.e.REQUIRE_ACCESS_TOKEN&&f&&this._skuToken&&d.params.push(`sku=${this._skuToken}`),this._makeAPIURL(d,f)}canonicalizeTileURL(t,r){const c=_r(t);if(!c.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!c.path.match(/\.[\w]+$/))return t;let d="mapbox://";c.path.match(/^\/raster\/v1\//)?d+=`raster/${c.path.replace(`/${o.e.RASTER_URL_PREFIX}/`,"")}`:c.path.match(/^\/rasterarrays\/v1\//)?d+=`rasterarrays/${c.path.replace(`/${o.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:d+=`tiles/${c.path.replace(`/${o.e.TILE_URL_VERSION}/`,"")}`;let f=c.params;return r&&(f=f.filter(_=>!_.match(/^access_token=/))),f.length&&(d+=`?${f.join("&")}`),d}canonicalizeTileset(t,r){const c=!!r&&o.f(r),d=[];for(const f of t.tiles||[])o.h(f)?d.push(this.canonicalizeTileURL(f,c)):d.push(f);return d}_makeAPIURL(t,r){const c="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",d=_r(o.e.API_URL);if(t.protocol=d.protocol,t.authority=d.authority,t.protocol==="http"){const f=t.params.indexOf("secure");f>=0&&t.params.splice(f,1)}if(d.path!=="/"&&(t.path=`${d.path}${t.path}`),!o.e.REQUIRE_ACCESS_TOKEN)return Gr(t);if(r=r||o.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!r)throw new Error(`An API access token is required to use Mapbox GL. ${c}`);if(r[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${c}`)}return t.params=t.params.filter(f=>f.indexOf("access_token")===-1),t.params.push(`access_token=${r||""}`),Gr(t)}}const ti=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function _r(u){const t=u.match(ti);if(!t)throw new Error("Unable to parse URL object");return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&"):[]}}function Gr(u){const t=u.params.length?`?${u.params.join("&")}`:"";return`${u.protocol}://${u.authority}${u.path}${t}`}const Hn="mapbox.eventData";function ni(u){if(!u)return null;const t=u.split(".");if(!t||t.length!==3)return null;try{return JSON.parse(o.j(t[1]))}catch{return null}}class en{constructor(t){this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(t){const r=ni(o.e.ACCESS_TOKEN);let c="";return c=r&&r.u?o.k(r.u):o.e.ACCESS_TOKEN||"",t?`${Hn}.${t}:${c}`:`${Hn}:${c}`}fetchEventData(){const t=o.s("localStorage"),r=this.getStorageKey(),c=this.getStorageKey("uuid");if(t)try{const d=localStorage.getItem(r);d&&(this.eventData=JSON.parse(d));const f=localStorage.getItem(c);f&&(this.anonId=f)}catch{o.w("Unable to read from LocalStorage")}}saveEventData(){const t=o.s("localStorage"),r=this.getStorageKey(),c=this.getStorageKey("uuid"),d=this.anonId;if(t&&d)try{localStorage.setItem(c,d),Object.keys(this.eventData).length>=1&&localStorage.setItem(r,JSON.stringify(this.eventData))}catch{o.w("Unable to write to LocalStorage")}}processRequests(t){}postEvent(t,r,c,d){if(!o.e.EVENTS_URL)return;const f=_r(o.e.EVENTS_URL);f.params.push(`access_token=${d||o.e.ACCESS_TOKEN||""}`);const _={event:this.type,created:new Date(t).toISOString()},T=r?o.l(_,r):_,E={url:Gr(f),headers:{"Content-Type":"text/plain"},body:JSON.stringify([T])};this.pendingRequest=o.p(E,M=>{this.pendingRequest=null,c(M),this.saveEventData(),this.processRequests(d)})}queueRequest(t,r){this.queue.push(t),this.processRequests(r)}}const Rs=new class extends en{constructor(u){super("appUserTurnstile"),this._customAccessToken=u}postTurnstileEvent(u,t){o.e.EVENTS_URL&&o.e.ACCESS_TOKEN&&Array.isArray(u)&&u.some(r=>o.f(r)||o.h(r))&&this.queueRequest(Date.now(),t)}processRequests(u){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const t=ni(o.e.ACCESS_TOKEN),r=t?t.u:o.e.ACCESS_TOKEN;let c=r!==this.eventData.tokenU;
20o.v(this.anonId)||(this.anonId=o.u(),c=!0);const d=this.queue.shift();if(this.eventData.lastSuccess){const f=new Date(this.eventData.lastSuccess),_=new Date(d),T=(d-this.eventData.lastSuccess)/864e5;c=c||T>=1||T<-1||f.getDate()!==_.getDate()}else c=!0;c?this.postEvent(d,{sdkIdentifier:"mapbox-gl-js",sdkVersion:Ce,skuId:Xi,"enabled.telemetry":!1,userId:this.anonId},f=>{f||(this.eventData.lastSuccess=d,this.eventData.tokenU=r)},u):this.processRequests()}},Ln=Rs.postTurnstileEvent.bind(Rs),Zt=new class extends en{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(u,t,r,c){this.skuToken=t,this.errorCb=c,o.e.EVENTS_URL&&(r||o.e.ACCESS_TOKEN?this.queueRequest({id:u,timestamp:Date.now()},r):this.errorCb(new Error(mr)))}processRequests(u){if(this.pendingRequest||this.queue.length===0)return;const{id:t,timestamp:r}=this.queue.shift();t&&this.success[t]||(this.anonId||this.fetchEventData(),o.v(this.anonId)||(this.anonId=o.u()),this.postEvent(r,{sdkIdentifier:"mapbox-gl-js",sdkVersion:Ce,skuId:Xi,skuToken:this.skuToken,userId:this.anonId},c=>{c?this.errorCb(c):t&&(this.success[t]=!0)},u))}remove(){this.errorCb=null}},Mo=Zt.postMapLoadEvent.bind(Zt),zs=new class extends en{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(u){let t=this.mapInstanceIdMap.get(u);return t||(t=o.u(),this.mapInstanceIdMap.set(u,t)),t}getEventId(u){const t=this.eventIdPerMapInstanceMap.get(u)||0;return this.eventIdPerMapInstanceMap.set(u,t+1),t}postStyleLoadEvent(u,t){const{map:r,style:c,importedStyles:d}=t;if(!o.e.EVENTS_URL||!u&&!o.e.ACCESS_TOKEN)return;const f=this.getMapInstanceId(r),_={mapInstanceId:f,eventId:this.getEventId(f),style:c};d.length&&(_.importedStyles=d),this.queueRequest({timestamp:Date.now(),payload:_},u)}processRequests(u){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:t,payload:r}=this.queue.shift();this.postEvent(t,r,()=>{},u)}},Br=zs.postStyleLoadEvent.bind(zs),Ni=new class extends en{constructor(){super("gljs.performance")}postPerformanceEvent(u,t){o.e.EVENTS_URL&&(u||o.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:t},u)}processRequests(u){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:t,performanceData:r}=this.queue.shift(),c=function(d){const f=performance.getEntriesByType("resource"),_=performance.getEntriesByType("mark"),T=function(O){const N={};if(O){for(const F in O)if(F!=="other")for(const U of O[F]){const q=`${F}ResolveRangeMin`,Z=`${F}ResolveRangeMax`,J=`${F}RequestCount`,K=`${F}RequestCachedCount`;N[q]=Math.min(N[q]||1/0,U.startTime),N[Z]=Math.max(N[Z]||-1/0,U.responseEnd);const oe=te=>{N[te]===void 0&&(N[te]=0),++N[te]};U.transferSize!==void 0&&U.transferSize===0&&oe(K),oe(J)}}return N}(function(O,N){const F={};if(O)for(const U of O){const q=N(U);F[q]===void 0&&(F[q]=[]),F[q].push(U)}return F}(f,qe)),E=window.devicePixelRatio,M=navigator.connection||navigator.mozConnection||navigator.webkitConnection,I=M?M.effectiveType:void 0,P={counters:[],metadata:[],attributes:[]},R=(O,N,F)=>{F!=null&&O.push({name:N,value:F.toString()})};for(const O in T)R(P.counters,O,T[O]);if(d.interactionRange[0]!==1/0&&d.interactionRange[1]!==-1/0&&(R(P.counters,"interactionRangeMin",d.interactionRange[0]),R(P.counters,"interactionRangeMax",d.interactionRange[1])),_)for(const O of Object.keys(Oe)){const N=Oe[O],F=_.find(U=>U.name===N);F&&R(P.counters,N,F.startTime)}return R(P.counters,"visibilityHidden",d.visibilityHidden),R(P.attributes,"style",function(O){if(O)for(const N of O){const F=N.name.split("?")[0];if(o.i(F)){const U=F.split("/").slice(-2);if(U.length===2)return`mapbox://styles/${U[0]}/${U[1]}`}}}(f)),R(P.attributes,"terrainEnabled",d.terrainEnabled?"true":"false"),R(P.attributes,"fogEnabled",d.fogEnabled?"true":"false"),R(P.attributes,"projection",d.projection),R(P.attributes,"zoom",d.zoom),R(P.metadata,"devicePixelRatio",E),R(P.metadata,"connectionEffectiveType",I),R(P.metadata,"navigatorUserAgent",navigator.userAgent),R(P.metadata,"screenWidth",window.screen.width),R(P.metadata,"screenHeight",window.screen.height),R(P.metadata,"windowWidth",window.innerWidth),R(P.metadata,"windowHeight",window.innerHeight),R(P.metadata,"mapWidth",d.width/E),R(P.metadata,"mapHeight",d.height/E),R(P.metadata,"webglRenderer",d.renderer),R(P.metadata,"webglVendor",d.vendor),R(P.metadata,"sdkVersion",Ce),R(P.metadata,"sdkIdentifier","mapbox-gl-js"),P}(r);for(const d of c.metadata);for(const d of c.counters);for(const d of c.attributes);this.postEvent(t,c,()=>{},u)}},$r=Ni.postPerformanceEvent.bind(Ni),bn=new class extends en{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(u,t,r,c){if(!o.e.API_URL||!o.e.SESSION_PATH)return;const d=_r(o.e.API_URL+o.e.SESSION_PATH);d.params.push(`sku=${t||""}`),d.params.push(`access_token=${c||o.e.ACCESS_TOKEN||""}`);const f={url:Gr(d),headers:{"Content-Type":"text/plain"}};this.pendingRequest=o.g(f,_=>{this.pendingRequest=null,r(_),this.saveEventData(),this.processRequests(c)})}getSessionAPI(u,t,r,c){this.skuToken=t,this.errorCb=c,o.e.SESSION_PATH&&o.e.API_URL&&(r||o.e.ACCESS_TOKEN?this.queueRequest({id:u,timestamp:Date.now()},r):this.errorCb(new Error(mr)))}processRequests(u){if(this.pendingRequest||this.queue.length===0)return;const{id:t,timestamp:r}=this.queue.shift();
20t&&this.success[t]||this.getSession(r,this.skuToken,c=>{c?this.errorCb(c):t&&(this.success[t]=!0)},u)}remove(){this.errorCb=null}},X=bn.getSessionAPI.bind(bn),ro=new Set;function Ls(u,t){t?ro.add(u):ro.delete(u)}class Ds{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages=new Set}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(t,r){this._updatedSourceCaches[t]=r,this.setDirty()}discardSourceCacheUpdate(t){delete this._updatedSourceCaches[t]}updateLayer(t){const r=t.scope;this._updatedLayers[r]=this._updatedLayers[r]||new Set,this._updatedLayers[r].add(t.id),this.setDirty()}removeLayer(t){const r=t.scope;this._removedLayers[r]=this._removedLayers[r]||{},this._updatedLayers[r]=this._updatedLayers[r]||new Set,this._removedLayers[r][t.id]=t,this._updatedLayers[r].delete(t.id),this._updatedPaintProps.delete(t.fqid),this.setDirty()}getRemovedLayer(t){return this._removedLayers[t.scope]?this._removedLayers[t.scope][t.id]:null}discardLayerRemoval(t){this._removedLayers[t.scope]&&delete this._removedLayers[t.scope][t.id]}getLayerUpdatesByScope(){const t={};for(const r in this._updatedLayers)t[r]=t[r]||{},t[r].updatedIds=Array.from(this._updatedLayers[r].values());for(const r in this._removedLayers)t[r]=t[r]||{},t[r].removedIds=Object.keys(this._removedLayers[r]);return t}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(t){this._updatedPaintProps.add(t.fqid),this.setDirty()}getUpdatedImages(){return Array.from(this._updatedImages.values())}updateImage(t){this._updatedImages.add(o.I.toString(t)),this.setDirty()}resetUpdatedImages(){this._updatedImages.clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages.clear()}}function dt(u){const{userImage:t}=u;return!!(t&&t.render&&t.render())&&(u.data.replace(new Uint8Array(t.data.buffer)),!0)}class Dn extends o.E{constructor(t){super(),this._images={},this._iconsets={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded={},this.requestors=[],this.patterns={},this.patternsInFlight=new Set,this.atlasImage={},this.atlasTexture={},this.dirty=!0,this.spriteFormat=t,t!=="raster"&&o.t()&&(this.imageRasterizerDispatcher=new o.D(o.x(),this,"Image Rasterizer Worker",1))}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new o.y),this._imageRasterizer}createScope(t){this._images[t]={},this._iconsets[t]={},this.loaded[t]=!1,this.updatedImages[t]=new Set,this.patterns[t]={},this.callbackDispatchedThisFrame[t]=new Set,this.atlasImage[t]=new o.r({width:1,height:1})}createIconset(t,r){this._iconsets[t][r]={}}isLoaded(){for(const t in this.loaded)if(!this.loaded[t])return!1;return!0}setLoaded(t,r){if(this.loaded[r]!==t&&(this.loaded[r]=t,t)){for(const{ids:c,callback:d}of this.requestors)this._notify(c,r,d);this.requestors=[]}}hasImage(t,r){return!!this.getImage(t,r)}getImage(t,r){return(t.iconsetId?this._iconsets[r][t.iconsetId]:this._images[r])[t.name]}addImage(t,r,c){const d=t.iconsetId?this._iconsets[r][t.iconsetId]:this._images[r];this._validate(t,c)&&(d[t.name]=c)}_validate(t,r){let c=!0;return this._validateStretch(r.stretchX,r.data&&r.data.width)||(this.fire(new o.z(new Error(`Image "${t.name}" has invalid "stretchX" value`))),c=!1),this._validateStretch(r.stretchY,r.data&&r.data.height)||(this.fire(new o.z(new Error(`Image "${t.name}" has invalid "stretchY" value`))),c=!1),this._validateContent(r.content,r)||(this.fire(new o.z(new Error(`Image "${t.name}" has invalid "content" value`))),c=!1),c}_validateStretch(t,r){if(!t)return!0;let c=0;for(const d of t){if(d[0]<c||d[1]<d[0]||r<d[1])return!1;c=d[1]}return!0}_validateContent(t,r){return t?t.length!==4||!r.usvg&&(t[0]<0||r.data.width<t[0]||t[1]<0||r.data.height<t[1]||t[2]<0||r.data.width<t[2]||t[3]<0||r.data.height<t[3])?!1:!(t[2]<t[0]||t[3]<t[1]):!0}updateImage(t,r,c){const d=t.iconsetId?this._iconsets[r][t.iconsetId]:this._images[r];
20c.version=d[t.name].version+1,d[t.name]=c,this.updatedImages[r].add(t),this.removeFromImageRasterizerCache(t,r)}clearUpdatedImages(t){this.updatedImages[t].clear()}removeFromImageRasterizerCache(t,r){if(this.spriteFormat!=="raster")if(o.t()){const c={imageIds:[t],scope:r};this.imageRasterizerDispatcher.getActor().send("removeRasterizedImages",c)}else this.imageRasterizer.removeImagesFromCacheByIds([t],r)}removeImage(t,r){const c=t.iconsetId?this._iconsets[r][t.iconsetId]:this._images[r],d=c[t.name];delete c[t.name],delete this.patterns[r][t.name],this.removeFromImageRasterizerCache(t,r),d.userImage&&d.userImage.onRemove&&d.userImage.onRemove()}listImages(t){const r=[];for(const c of Object.keys(this._images[t]))r.push(new o.I(c));for(const c in this._iconsets[t])for(const d of Object.keys(this._iconsets[t][c]))r.push(new o.I({name:d,iconsetId:c}));return r}getImages(t,r,c){let d=!0;const f=!!this.loaded[r];if(!f)for(const _ of t)(_.iconsetId?this._iconsets[r][_.iconsetId]:this._images[r])[_.name]||(d=!1);f||d?this._notify(t,r,c):this.requestors.push({ids:t,scope:r,callback:c})}rasterizeImages({scope:t,tasks:r},c){const d=new Map;for(const[f,_]of r.entries()){const T=this.getImage(_.id,t);T&&d.set(f,{image:T,imageVariant:_})}this._rasterizeImages(t,d,c)}_rasterizeImages(t,r,c){if(o.t())this.imageRasterizerDispatcher.getActor().send("rasterizeImages",{tasks:r,scope:t},c);else{const d=new Map;for(const[f,{image:_,imageVariant:T}]of r.entries())d.set(f,this.imageRasterizer.rasterize(T,_,t,0));c(void 0,d)}}getUpdatedImages(t){return this.updatedImages[t]||new Set}_notify(t,r,c){const d=new Map;for(const f of t){f.iconsetId&&(this._iconsets[r][f.iconsetId]=this._iconsets[r][f.iconsetId]||{});const _=(f.iconsetId?this._iconsets[r][f.iconsetId]:this._images[r])[f.name];if(!_){if(f.iconsetId)continue;o.w(`Image "${f.name}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`),this.fire(new o.A("styleimagemissing",{id:f.name}));continue}const T={data:_.usvg?null:_.data.clone(),pixelRatio:_.pixelRatio,sdf:_.sdf,usvg:_.usvg,version:_.version,stretchX:_.stretchX,stretchY:_.stretchY,content:_.content,hasRenderCallback:!!(_.userImage&&_.userImage.render)};_.usvg&&Object.assign(T,{width:_.icon.usvg_tree.width,height:_.icon.usvg_tree.height}),d.set(o.I.toString(f),T)}c(null,d)}getPixelSize(t){const{width:r,height:c}=this.atlasImage[t];return{width:r,height:c}}getPattern(t,r,c){const d=this.patterns[r][t.name],f=this.getImage(t,r);if(!f)return null;if(d){if(d.position.version===f.version)return d.position;d.position.version=f.version}else{if(f.usvg&&!f.data){const _=this.getPatternInFlightId(t.toString(),r);if(this.patternsInFlight.has(_))return null;this.patternsInFlight.add(_);const T=new o.B(t).scaleSelf(o.q.devicePixelRatio),E=new Map([[T.toString(),{image:f,imageVariant:T}]]);return this._rasterizeImages(r,E,(M,I)=>this.storePatternImage(T,r,f,c,I)),null}this.storePattern(t,r,f)}return this._updatePatternAtlas(r,c),this.patterns[r][t.name].position}getPatternInFlightId(t,r){return o.C(t,r)}hasPatternsInFlight(){return this.patternsInFlight.size!==0}storePatternImage(t,r,c,d,f){const _=t.toString(),T=f?f.get(_):void 0;T&&(c.data=T,this.storePattern(t.id,r,c),this._updatePatternAtlas(r,d),this.patternsInFlight.delete(this.getPatternInFlightId(t.id.toString(),r)))}storePattern(t,r,c){const d={w:c.data.width+2*o.F,h:c.data.height+2*o.F,x:0,y:0},f=new o.G(d,c,o.F);this.patterns[r][t.name]={bin:d,position:f}}bind(t,r){const c=t.gl;let d=this.atlasTexture[r];d?this.dirty&&(d.update(this.atlasImage[r]),this.dirty=!1):(d=new o.T(t,this.atlasImage[r],c.RGBA8),this.atlasTexture[r]=d),d.bind(c.LINEAR,c.CLAMP_TO_EDGE)}_updatePatternAtlas(t,r){const c=[];for(const T in this.patterns[t])c.push(this.patterns[t][T].bin);const{w:d,h:f}=o.H(c),_=this.atlasImage[t];_.resize({width:d||1,height:f||1});for(const T in this.patterns[t]){const{bin:E,position:M}=this.patterns[t][T];let I=M.padding;const P=E.x+I,R=E.y+I,O=this._images[t][T].data,N=O.width,F=O.height;I=I>1?I-1:I,o.r.copy(O,_,{x:0,y:0},{x:P,y:R},{width:N,height:F},r),o.r.copy(O,_,{x:0,y:F-I},{x:P,y:R-I},{width:N,height:I},r),o.r.copy(O,_,{x:0,y:0},{x:P,y:R+F},{width:N,height:I},r),o.r.copy(O,_,{x:N-I,y:0},{x:P-I,y:R},{width:I,height:F},r),o.r.copy(O,_,{x:0,y:0},{x:P+N,y:R},{width:I,height:F},r),o.r.copy(O,_,{x:N-I,y:F-I},{x:P-I,y:R-I},{width:I,height:I},r),o.r.copy(O,_,{x:0,y:F-I},{x:P+N,y:R-I},{width:I,height:I},r),o.r.copy(O,_,{x:0,y:0},{x:P+N,y:R+F},{width:I,height:I},r),o.r.copy(O,_,{x:N-I,y:0},{x:P-I,y:R+F},{width:I,height:I},r)}this.dirty=!0}beginFrame(){for(const t in this._images)this.callbackDispatchedThisFrame[t]=new Set}dispatchRenderCallbacks(t,r){for(const c of t){if(this.callbackDispatchedThisFrame[r].has(c.toString()))continue;this.callbackDispatchedThisFrame[r].add(c.toString());const d=(c.iconsetId?this._iconsets[r][c.iconsetId]:this._images[r])[c.name];dt(d)&&this.updateImage(c,r,d)}}}function Hr(u){const t=u.key,r=u.value,c=u.valueSpec||{},d=u.objectElementValidators||{},f=u.style,_=u.styleSpec;let T=[];const E=o.K(r);if(E!=="object")return[new o.V(t,r,`object expected, ${E} found`)];for(const M in r){const I=M.split(".")[0];let P;d[I]?P=d[I]:c[I]?P=Ci:d["*"]?P=d["*"]:c["*"]&&(P=Ci),P?T=T.concat(P({key:(t&&`${t}.`)+M,value:r[M],valueSpec:c[I]||c["*"],style:f,styleSpec:_,object:r,objectKey:M},r)):T.push(new o.J(t,r[M],`unknown property "${M}"`))}for(const M in c)d[M]||c[M].required&&c[M].default===void 0&&r[M]===void 0&&T.push(new o.V(t,r,`missing required property "${M}"`));return T}function Zn(u){const t=u.value,r=u.valueSpec,c=u.style,d=u.styleSpec,f=u.key,_=u.arrayElementValidator||Ci;if(o.K(t)!=="array")return[new o.V(f,t,`array expected, ${o.K(t)} found`)];if(r.length&&t.length!==r.length)return[new o.V(f,t,`array length ${r.length} expected, length ${t.length} found`)];if(r["min-length"]&&t.length<r["min-length"])return[new o.V(f,t,`array length at least ${r["min-length"]} expected, length ${t.length} found`)];let T={type:r.value,values:r.values,minimum:r.minimum,maximum:r.maximum,function:void 0};d.$version<7&&(T.function=r.function),o.K(r.value)==="object"&&(T=r.value);let E=[];for(let M=0;M<t.length;M++)E=E.concat(_({array:t,arrayIndex:M,value:t[M],valueSpec:T,style:c,styleSpec:d,key:`${f}[${M}]`},!0));return E}function hi(u){const t=u.key,r=u.value,c=u.valueSpec;let d=o.K(r);if(d==="number"&&r!=r&&(d="NaN"),d!=="number")return[new o.V(t,r,`number expected, ${d} found`)];if("minimum"in c){let f=c.minimum;if(o.K(c.minimum)==="array"&&(f=c.minimum[u.arrayIndex]),r<f)return[new o.V(t,r,`${r} is less than the minimum value ${f}`)]}if("maximum"in c){let f=c.maximum;if(o.K(c.maximum)==="array"&&(f=c.maximum[u.arrayIndex]),r>f)return[new o.V(t,r,`${r} is greater than the maximum value ${f}`)]}return[]}function gr(u){const t=u.valueSpec,r=o.M(u.value.type);let c,d,f,_={};const T=r!=="categorical"&&u.value.property===void 0,E=!T,M=o.K(u.value.stops)==="array"&&o.K(u.value.stops[0])==="array"&&o.K(u.value.stops[0][0])==="object",I=Hr({key:u.key,value:u.value,valueSpec:u.styleSpec.function,style:u.style,styleSpec:u.styleSpec,objectElementValidators:{stops:function(O){if(r==="identity")return[new o.V(O.key,O.value,'identity function may not have a "stops" property')];let N=[];const F=O.value;return N=N.concat(Zn({key:O.key,value:F,valueSpec:O.valueSpec,style:O.style,styleSpec:O.styleSpec,arrayElementValidator:P})),o.K(F)==="array"&&F.length===0&&N.push(new o.V(O.key,F,"array must have at least one stop")),N},default:function(O){return Ci({key:O.key,value:O.value,valueSpec:t,style:O.style,styleSpec:O.styleSpec})}}});return r==="identity"&&T&&I.push(new o.V(u.key,u.value,'missing required property "property"')),r==="identity"||u.value.stops||I.push(new o.V(u.key,u.value,'missing required property "stops"')),r==="exponential"&&u.valueSpec.expression&&!o.N(u.valueSpec)&&I.push(new o.V(u.key,u.value,"exponential functions not supported")),u.styleSpec.$version>=8&&(E&&!o.O(u.valueSpec)?I.push(new o.V(u.key,u.value,"property functions not supported")):T&&!o.Q(u.valueSpec)&&I.push(new o.V(u.key,u.value,"zoom functions not supported"))),r!=="categorical"&&!M||u.value.property!==void 0||I.push(new o.V(u.key,u.value,'"property" property is required')),I;function P(O){let N=[];const F=O.value,U=O.key;if(o.K(F)!=="array")return[new o.V(U,F,`array expected, ${o.K(F)} found`)];if(F.length!==2)return[new o.V(U,F,`array length 2 expected, length ${F.length} found`)];if(M){if(o.K(F[0])!=="object")return[new o.V(U,F,`object expected, ${o.K(F[0])} found`)];if(F[0].zoom===void 0)return[new o.V(U,F,"object stop key must have zoom")];if(F[0].value===void 0)return[new o.V(U,F,"object stop key must have value")];const q=o.M(F[0].zoom);if(typeof q!="number")return[new o.V(U,F[0].zoom,"stop zoom values must be numbers")];if(f&&f>q)return[new o.V(U,F[0].zoom,"stop zoom values must appear in ascending order")];q!==f&&(f=q,d=void 0,_={}),N=N.concat(Hr({key:`${U}[0]`,value:F[0],valueSpec:{zoom:{}},style:O.style,styleSpec:O.styleSpec,objectElementValidators:{zoom:hi,value:R}}))}else N=N.concat(R({key:`${U}[0]`,value:F[0],style:O.style,styleSpec:O.styleSpec},F));return o.S(o.U(F[1]))?N.concat([new o.V(`${U}[1]`,F[1],"expressions are not allowed in function stops.")]):N.concat(Ci({key:`${U}[1]`,value:F[1],valueSpec:t,style:O.style,styleSpec:O.styleSpec}))}function R(O,N){const F=o.K(O.value),U=o.M(O.value),q=O.value!==null?O.value:N;if(c){if(F!==c)return[new o.V(O.key,q,`${F} stop domain type must match previous stop domain type ${c}`)]}else c=F;
20if(F!=="number"&&F!=="string"&&F!=="boolean"&&typeof U!="number"&&typeof U!="string"&&typeof U!="boolean")return[new o.V(O.key,q,"stop domain value must be a number, string, or boolean")];if(F!=="number"&&r!=="categorical"){let Z=`number expected, ${F} found`;return o.O(t)&&r===void 0&&(Z+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new o.V(O.key,q,Z)]}return r!=="categorical"||F!=="number"||typeof U=="number"&&isFinite(U)&&Math.floor(U)===U?r!=="categorical"&&F==="number"&&typeof U=="number"&&typeof d=="number"&&d!==void 0&&U<d?[new o.V(O.key,q,"stop domain values must appear in ascending order")]:(d=U,r==="categorical"&&U in _?[new o.V(O.key,q,"stop domain values must be unique")]:(_[U]=!0,[])):[new o.V(O.key,q,`integer expected, found ${String(U)}`)]}}function Wn(u){const t=(u.expressionContext==="property"?o.W:o.X)(o.U(u.value),u.valueSpec);if(t.result==="error")return t.value.map(c=>new o.V(`${u.key}${c.key}`,u.value,c.message));const r=t.value.expression||t.value._styleExpression.expression;if(u.expressionContext==="property"&&u.propertyKey==="text-font"&&!r.outputDefined())return[new o.V(u.key,u.value,`Invalid data expression for "${u.propertyKey}". Output values must be contained as literals within the expression.`)];if(u.expressionContext==="property"&&u.propertyType==="layout"&&!o.Y(r))return[new o.V(u.key,u.value,'"feature-state" data expressions are not supported with layout properties.')];if(u.expressionContext==="filter")return no(r,u);if(u.expressionContext&&u.expressionContext.indexOf("cluster")===0){if(!o.Z(r,["zoom","feature-state"]))return[new o.V(u.key,u.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(u.expressionContext==="cluster-initial"&&!o._(r))return[new o.V(u.key,u.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function no(u,t){const r=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(t.valueSpec&&t.valueSpec.expression)for(const d of t.valueSpec.expression.parameters)r.delete(d);if(r.size===0)return[];const c=[];return u instanceof o.$&&r.has(u.name)?[new o.V(t.key,t.value,`["${u.name}"] expression is not supported in a filter for a ${t.object.type} layer with id: ${t.object.id}`)]:(u.eachChild(d=>{c.push(...no(d,t))}),c)}function ss(u){const t=u.key,r=u.value,c=u.valueSpec,d=[];return Array.isArray(c.values)?c.values.indexOf(o.M(r))===-1&&d.push(new o.V(t,r,`expected one of [${c.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(c.values).indexOf(o.M(r))===-1&&d.push(new o.V(t,r,`expected one of [${Object.keys(c.values).join(", ")}], ${JSON.stringify(r)} found`)),d}function Io(u){return o.a1(o.U(u.value))?Wn(o.L({},u,{expressionContext:"filter",valueSpec:u.styleSpec[`filter_${u.layerType||"fill"}`]})):Qt(u)}function Qt(u){const t=u.value,r=u.key;if(o.K(t)!=="array")return[new o.V(r,t,`array expected, ${o.K(t)} found`)];const c=u.styleSpec;let d,f=[];if(t.length<1)return[new o.V(r,t,"filter array must have at least 1 element")];switch(f=f.concat(ss({key:`${r}[0]`,value:t[0],valueSpec:c.filter_operator,style:u.style,styleSpec:u.styleSpec})),o.M(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&o.M(t[1])==="$type"&&f.push(new o.V(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&f.push(new o.V(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(d=o.K(t[1]),d!=="string"&&f.push(new o.V(`${r}[1]`,t[1],`string expected, ${d} found`)));for(let _=2;_<t.length;_++)d=o.K(t[_]),o.M(t[1])==="$type"?f=f.concat(ss({key:`${r}[${_}]`,value:t[_],valueSpec:c.geometry_type,style:u.style,styleSpec:u.styleSpec})):d!=="string"&&d!=="number"&&d!=="boolean"&&f.push(new o.V(`${r}[${_}]`,t[_],`string, number, or boolean expected, ${d} found`));break;case"any":case"all":case"none":for(let _=1;_<t.length;_++)f=f.concat(Qt({key:`${r}[${_}]`,value:t[_],style:u.style,styleSpec:u.styleSpec}));break;case"has":case"!has":d=o.K(t[1]),t.length!==2?f.push(new o.V(r,t,`filter array for "${t[0]}" operator must have 2 elements`)):d!=="string"&&f.push(new o.V(`${r}[1]`,t[1],`string expected, ${d} found`))}return f}function Zr(u,t){const r=u.key,c=u.style,d=u.layer,f=u.styleSpec,_=u.value,T=u.objectKey,E=f[`${t}_${u.layerType}`];if(!E)return[];const M=T.match(/^(.*)-use-theme$/);if(t==="paint"&&M&&E[M[1]])return o.S(_)?[].concat(Ci({key:u.key,value:_,valueSpec:{type:"string",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},style:c,styleSpec:f,expressionContext:"property",propertyType:t,propertyKey:T})):Ci({key:r,value:_,valueSpec:{type:"string"},style:c,styleSpec:f});const I=T.match(/^(.*)-transition$/);if(t==="paint"&&I&&E[I[1]]&&E[I[1]].transition)return Ci({key:r,value:_,valueSpec:f.transition,style:c,styleSpec:f});const P=u.valueSpec||E[T];if(!P)return[new o.J(r,_,`unknown property "${T}"`)];let R;if(o.K(_)==="string"&&o.O(P)&&!P.tokens&&(R=/^{([^}]+)}$/.exec(_))){const N=`\`{ "type": "identity", "property": ${R?JSON.stringify(R[1]):'"_"'} }\``;return[new o.V(r,_,`"${T}" does not support interpolation syntax 21Use an identity property function instead: ${N}.`)]}const O=[];if(u.layerType==="symbol")T!=="text-field"||!c||c.glyphs||c.imports||O.push(new o.V(r,_,'use of "text-field" requires a style "glyphs" property')),T==="text-font"&&o.a2(o.U(_))&&o.M(_.type)==="identity"&&O.push(new o.V(r,_,'"text-font" does not support identity functions'));else if(u.layerType==="model"&&t==="paint"&&d&&d.layout&&d.layout.hasOwnProperty("model-id")&&o.O(P)&&(o.a3(P)||o.Q(P))){const N=o.W(o.U(_),P),F=N.value.expression||N.value._styleExpression.expression;F&&!o.Z(F,["measure-light"])&&(T==="model-emissive-strength"&&o._(F)&&o.Y(F)||O.push(new o.V(r,_,`${T} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return O.concat(Ci({key:u.key,value:_,valueSpec:P,style:c,styleSpec:f,expressionContext:"property",propertyType:t,propertyKey:T}))}function Os(u){return Zr(u,"paint")}function so(u){return Zr(u,"layout")}function Nr(u){let t=[];const r=u.value,c=u.key,d=u.style,f=u.styleSpec;r.type||r.ref||t.push(new o.V(c,r,'either "type" or "ref" is required'));let _=o.M(r.type);const T=o.M(r.ref);if(r.id){const E=o.M(r.id);for(let M=0;M<u.arrayIndex;M++){const I=d.layers[M];o.M(I.id)===E&&t.push(new o.V(c,r.id,`duplicate layer id "${r.id}", previously used at line ${I.id.__line__}`))}}if("ref"in r){let E;["type","source","source-layer","filter","layout"].forEach(M=>{M in r&&t.push(new o.V(c,r[M],`"${M}" is prohibited for ref layers`))}
21),d.layers.forEach(M=>{o.M(M.id)===T&&(E=M)}),E?E.ref?t.push(new o.V(c,r.ref,"ref cannot reference another ref layer")):_=o.M(E.type):typeof T=="string"&&t.push(new o.V(c,r.ref,`ref layer "${T}" not found`))}else if(_!=="background"&&_!=="sky"&&_!=="slot")if(r.source){const E=d.sources&&d.sources[r.source],M=E&&o.M(E.type);E?M==="vector"&&_==="raster"?t.push(new o.V(c,r.source,`layer "${r.id}" requires a raster source`)):M==="raster"&&_!=="raster"?t.push(new o.V(c,r.source,`layer "${r.id}" requires a vector source`)):M!=="vector"||r["source-layer"]?M==="raster-dem"&&_!=="hillshade"?t.push(new o.V(c,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):M!=="raster-array"||["raster","raster-particle"].includes(_)?_!=="line"||!r.paint||!r.paint["line-gradient"]&&!r.paint["line-trim-offset"]||M==="geojson"&&E.lineMetrics?_==="raster-particle"&&M!=="raster-array"&&t.push(new o.V(c,r.source,`layer "${r.id}" requires a 'raster-array' source.`)):t.push(new o.V(c,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new o.V(c,r.source,"raster-array source can only be used with layer type 'raster'.")):t.push(new o.V(c,r,`layer "${r.id}" must specify a "source-layer"`)):t.push(new o.V(c,r.source,`source "${r.source}" not found`))}else t.push(new o.V(c,r,'missing required property "source"'));return t=t.concat(Hr({key:c,value:r,valueSpec:f.layer,style:u.style,styleSpec:u.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Ci({key:`${c}.type`,value:r.type,valueSpec:f.layer.type,style:u.style,styleSpec:u.styleSpec,object:r,objectKey:"type"}),filter:E=>Io(o.L({layerType:_},E)),layout:E=>Hr({layer:r,key:E.key,value:E.value,valueSpec:{},style:E.style,styleSpec:E.styleSpec,objectElementValidators:{"*":M=>so(o.L({layerType:_},M))}}),paint:E=>Hr({layer:r,key:E.key,value:E.value,valueSpec:{},style:E.style,styleSpec:E.styleSpec,objectElementValidators:{"*":M=>Os(o.L({layerType:_,layer:r},M))}})}})),t}function os(u){const t=u.value,r=u.key,c=o.K(t);return c!=="string"?[new o.V(r,t,`string expected, ${c} found`)]:[]}const Xn={promoteId:function u({key:t,value:r}){if(o.K(r)==="string")return os({key:t,value:r});if(Array.isArray(r)){const c=[],d=o.U(r),f=o.X(d);return f.result==="error"&&f.value.forEach(_=>{c.push(new o.V(`${t}${_.key}`,null,`${_.message}`))}),o.Z(f.value.expression,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])||c.push(new o.V(`${t}`,null,"promoteId expression should be only feature dependent")),c}{const c=[];for(const d in r)c.push(...u({key:`${t}.${d}`,value:r[d]}));return c}}};function Aa(u){const t=u.value,r=u.key,c=u.styleSpec,d=u.style;if(!t.type)return[new o.V(r,t,'"type" is required')];const f=o.M(t.type);let _=[];switch(["vector","raster","raster-dem","raster-array"].includes(f)&&(t.url||t.tiles||_.push(new o.J(r,t,'Either "url" or "tiles" is required.'))),f){case"vector":case"raster":case"raster-dem":case"raster-array":return _=_.concat(Hr({key:r,value:t,valueSpec:c[`source_${f.replace("-","_")}`],style:u.style,styleSpec:c,objectElementValidators:Xn})),_;case"geojson":if(_=Hr({key:r,value:t,valueSpec:c.source_geojson,style:d,styleSpec:c,objectElementValidators:Xn}),t.cluster)for(const T in t.clusterProperties){const[E,M]=t.clusterProperties[T],I=typeof E=="string"?[E,["accumulated"],["get",T]]:E;_.push(...Wn({key:`${r}.${T}.map`,value:M,expressionContext:"cluster-map"})),_.push(...Wn({key:`${r}.${T}.reduce`,value:I,expressionContext:"cluster-reduce"}))}return _;case"video":return Hr({key:r,value:t,valueSpec:c.source_video,style:d,styleSpec:c});case"image":return Hr({key:r,value:t,valueSpec:c.source_image,style:d,styleSpec:c});case"canvas":return[new o.V(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ss({key:`${r}.type`,value:t.type,valueSpec:{values:Ca(c)}})}}function Ca(u){return u.source.reduce((t,r)=>{const c=u[r];return c.type.type==="enum"&&(t=t.concat(Object.keys(c.type.values))),t},[])}function oo(u){const t=u.value,r=u.styleSpec,c=r.light,d=u.style;let f=[];const _=o.K(t);if(t===void 0)return f;if(_!=="object")return f=f.concat([new o.V("light",t,`object expected, ${_}
21 found`)]),f;for(const T in t){const E=T.match(/^(.*)-transition$/),M=T.match(/^(.*)-use-theme$/);f=f.concat(M&&c[M[1]]?Ci({key:T,value:t[T],valueSpec:{type:"string"},style:d,styleSpec:r}):E&&c[E[1]]&&c[E[1]].transition?Ci({key:T,value:t[T],valueSpec:r.transition,style:d,styleSpec:r}):c[T]?Ci({key:T,value:t[T],valueSpec:c[T],style:d,styleSpec:r}):[new o.V(T,t[T],`unknown property "${T}"`)])}return f}function ao(u){const t=u.value;let r=[];if(!t)return r;const c=o.K(t);if(c!=="object")return r=r.concat([new o.V("light-3d",t,`object expected, ${c} found`)]),r;const d=u.styleSpec,f=d["light-3d"],_=u.key,T=u.style,E=u.style.lights;for(const P of["type","id"])if(!(P in t))return r=r.concat([new o.V("light-3d",t,`missing property ${P} on light`)]),r;if(t.type&&E)for(let P=0;P<u.arrayIndex;P++){const R=o.M(t.type),O=E[P];o.M(O.type)===R&&r.push(new o.V(_,t.id,`duplicate light type "${t.type}", previously defined at line ${O.id.__line__}`))}const M=`properties_light_${t.type}`;if(!(M in d))return r=r.concat([new o.V("light-3d",t,`Invalid light type ${t.type}`)]),r;const I=d[M];for(const P in t)if(P==="properties"){const R=t[P],O=o.K(R);if(O!=="object")return r=r.concat([new o.V("properties",R,`object expected, ${O} found`)]),r;for(const N in R)r=r.concat(I[N]?Ci({key:N,value:R[N],valueSpec:I[N],style:T,styleSpec:d}):[new o.J(u.key,R[N],`unknown property "${N}"`)])}else{const R=P.match(/^(.*)-transition$/),O=P.match(/^(.*)-use-theme$/);r=r.concat(O&&f[O[1]]?Ci({key:P,value:t[P],valueSpec:{type:"string"},style:T,styleSpec:d}):R&&f[R[1]]&&f[R[1]].transition?Ci({key:P,value:t[P],valueSpec:d.transition,style:T,styleSpec:d}):f[P]?Ci({key:P,value:t[P],valueSpec:f[P],style:T,styleSpec:d}):[new o.J(P,t[P],`unknown property "${P}"`)])}return r}function un(u){const t=u.value,r=u.key,c=u.style,d=u.styleSpec,f=d.terrain;let _=[];const T=o.K(t);if(t===void 0||T==="null")return _;if(T!=="object")return _=_.concat([new o.V("terrain",t,`object expected, ${T} found`)]),_;for(const E in t){const M=E.match(/^(.*)-transition$/),I=E.match(/^(.*)-use-theme$/);_=_.concat(I&&f[I[1]]?Ci({key:E,value:t[E],valueSpec:{type:"string"},style:c,styleSpec:d}):M&&f[M[1]]&&f[M[1]].transition?Ci({key:E,value:t[E],valueSpec:d.transition,style:c,styleSpec:d}):f[E]?Ci({key:E,value:t[E],valueSpec:f[E],style:c,styleSpec:d}):[new o.J(E,t[E],`unknown property "${E}"`)])}if(t.source){const E=c.sources&&c.sources[t.source],M=E&&o.M(E.type);E?M!=="raster-dem"&&_.push(new o.V(r,t.source,`terrain cannot be used with a source of type ${String(M)}, it only be used with a "raster-dem" source type`)):_.push(new o.V(r,t.source,`source "${t.source}" not found`))}else _.push(new o.V(r,t,'terrain is missing required property "source"'));return _}function Ao(u){const t=u.value,r=u.style,c=u.styleSpec,d=c.fog;let f=[];const _=o.K(t);if(t===void 0)return f;if(_!=="object")return f=f.concat([new o.V("fog",t,`object expected, ${_} found`)]),f;for(const T in t){const E=T.match(/^(.*)-transition$/),M=T.match(/^(.*)-use-theme$/);f=f.concat(M&&d[M[1]]?Ci({key:T,value:t[T],valueSpec:{type:"string"},style:r,styleSpec:c}):E&&d[E[1]]&&d[E[1]].transition?Ci({key:T,value:t[T],valueSpec:c.transition,style:r,styleSpec:c}):d[T]?Ci({key:T,value:t[T],valueSpec:d[T],style:r,styleSpec:c}):[new o.J(T,t[T],`unknown property "${T}"`)])}return f}const Hi={"*":()=>[],array:Zn,boolean:function(u){const t=u.value,r=u.key,c=o.K(t);return c!=="boolean"?[new o.V(r,t,`boolean expected, ${c} found`)]:[]},number:hi,color:function(u){const t=u.key,r=u.value,c=o.K(r);return c!=="string"?[new o.V(t,r,`color expected, ${c} found`)]:o.a0.parseCSSColor(r)===null?[new o.V(t,r,`color expected, "${r}" found`)]:[]},enum:ss,filter:Io,function:gr,layer:Nr,object:Hr,source:Aa,model:o.a4,light:oo,"light-3d":ao,terrain:un,fog:Ao,string:os,formatted:function(u){return os(u).length===0?[]:Wn(u)},resolvedImage:function(u){return os(u).length===0?[]:Wn(u)},projection:function(u){const t=u.value,r=u.styleSpec,c=r.projection,d=u.style;let f=[];const _=o.K(t);if(_==="object")for(const T in t)f=f.concat(Ci({key:T,value:t[T],valueSpec:c[T],style:d,styleSpec:r}));else _!=="string"&&(f=f.concat([new o.V("projection",t,`object or string expected, ${_}
21 found`)]));return f},import:function(u){const{value:t,styleSpec:r}=u,{data:c,...d}=t;Object.defineProperty(d,"__line__",{value:t.__line__,enumerable:!1});let f=Hr(o.L({},u,{value:d,valueSpec:r.import}));return o.M(d.id)===""&&f.push(new o.V(`${u.key}.id`,d,"import id can't be an empty string")),c&&(f=f.concat(Co(c,r,{key:`${u.key}.data`}))),f},iconset:function(u){const t=u.value,r=u.key,c=u.styleSpec,d=u.style;if(!t.type)return[new o.V(r,t,'"type" is required')];const f=o.M(t.type);let _=[];if(_=_.concat(Hr({key:r,value:t,valueSpec:c[`iconset_${f}`],style:d,styleSpec:c})),f==="source"&&t.source){const T=d.sources&&d.sources[t.source],E=T&&o.M(T.type);T?E!=="raster-array"&&_.push(new o.V(r,t.source,`iconset cannot be used with a source of type ${String(E)}, it only be used with a "raster-array" source type`)):_.push(new o.V(r,t.source,`source "${t.source}" not found`))}return _}};function Ci(u,t=!1){const r=u.value,c=u.valueSpec,d=u.styleSpec;if(c.expression&&o.a2(o.M(r)))return gr(u);if(c.expression&&o.S(o.U(r)))return Wn(u);if(c.type&&Hi[c.type]){const f=Hi[c.type](u);return t===!0&&f.length>0&&o.K(u.value)==="array"?Wn(u):f}return Hr(o.L({},u,{valueSpec:c.type?d[c.type]:c}))}function Pa(u){const t=u.value,r=u.key,c=os(u);return c.length||(t.indexOf("{fontstack}")===-1&&c.push(new o.V(r,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&c.push(new o.V(r,t,'"glyphs" url must include a "{range}" token'))),c}function Co(u,t=o.a5,r={}){return Ci({key:r.key||"",value:u,valueSpec:t.$root,styleSpec:t,style:u,objectElementValidators:{glyphs:Pa,"*":()=>[]}})}function Wr(u,t=o.a5){return ge(Co(u,t))}const lo=u=>ge(Aa(u)),Ra=u=>ge(oo(u)),Po=u=>ge(ao(u)),Cl=u=>ge(un(u)),Pl=u=>ge(Ao(u)),za=u=>ge(function(t){const r=t.value,c=t.style,d=t.styleSpec,f=d.snow;let _=[];const T=o.K(r);if(r===void 0)return _;if(T!=="object")return _=_.concat([new o.V("snow",r,`object expected, ${T} found`)]),_;for(const E in r){const M=E.match(/^(.*)-transition$/);_=_.concat(M&&f[M[1]]&&f[M[1]].transition?Ci({key:E,value:r[E],valueSpec:d.transition,style:c,styleSpec:d}):f[E]?Ci({key:E,value:r[E],valueSpec:f[E],style:c,styleSpec:d}):[new o.J(E,r[E],`unknown property "${E}"`)])}return _}(u)),Ne=u=>ge(function(t){const r=t.value,c=t.style,d=t.styleSpec,f=d.rain;let _=[];const T=o.K(r);if(r===void 0)return _;if(T!=="object")return _=_.concat([new o.V("rain",r,`object expected, ${T} found`)]),_;for(const E in r){const M=E.match(/^(.*)-transition$/);_=_.concat(M&&f[M[1]]&&f[M[1]].transition?Ci({key:E,value:r[E],valueSpec:d.transition,style:c,styleSpec:d}):f[E]?Ci({key:E,value:r[E],valueSpec:f[E],style:c,styleSpec:d}):[new o.J(E,r[E],`unknown property "${E}"`)])}return _}(u)),j=u=>ge(Nr(u)),G=u=>ge(Io(u)),ee=u=>ge(Os(u)),de=u=>ge(so(u)),ce=u=>ge(o.a4(u));function ge(u){return u.slice().sort((t,r)=>t.line&&r.line?t.line-r.line:0)}function ze(u,t){let r=!1;if(t&&t.length)for(const c of t)c instanceof o.J?o.w(c.message):(u.fire(new o.z(new Error(c.message))),r=!0);return r}let be;class ke extends o.E{constructor(t,r="flat"){super(),this._transitionable=new o.a6(be||(be=new o.a7({anchor:new o.a8(o.a5.light.anchor),position:new o.a9(o.a5.light.position),color:new o.a8(o.a5.light.color),intensity:new o.a8(o.a5.light.intensity)}))),this.setLight(t,r),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,r,c={}){this._validate(Ra,t,c)||(this._transitionable.setTransitionOrValue(t),this.id=r)}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,r,c){return(!c||c.validate!==!1)&&ze(this,t.call(Wr,o.l({value:r,style:{glyphs:!0,sprite:!0},styleSpec:o.a5})))}}let je=class extends o.E{constructor(u,t,r,c){super(),this.scope=r,this._transitionable=new o.a6(new o.a7({source:new o.a8(o.a5.terrain.source),exaggeration:new o.a8(o.a5.terrain.exaggeration)}),r,c),this._transitionable.setTransitionOrValue(u,c),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=t}get(){return this._transitionable.serialize()}set(u,t){this._transitionable.setTransitionOrValue(u,t)}updateTransitions(u){this._transitioning=this._transitionable.transitioned(u,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(u){this.properties=this._transitioning.possiblyEvaluate(u)}getExaggeration(u){return this._transitioning.possiblyEvaluate(new o.aa(u)).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const u=this._transitionable._values.exaggeration;if(!u)return null;const t=u.value.expression;if(!t)return null;let r=-1,c=-1,d=1;for(const f of t.zoomStops)d=t.evaluate(new o.aa(f)),d>.01?(r=f,c=-1):c=f;return d<.01&&r>0&&c>r?[r,c]:null}isZoomDependent(){const u=this._transitionable._values.exaggeration;return u!=null&&u.value!=null&&u.value.expression!=null&&u.value.expression instanceof o.ab}};const Be=45,at=65,gt=.05;function bt(u,t,r,c){const d=o.ae(Be,at,r),[f,_]=Gt(u,c);let T=1-Math.min(1,Math.exp((t-f)/(_-f)*-6));return T*=T*T,T=Math.min(1,1.00747*T),T*d*u.alpha}function Gt(u,t){const r=.5/Math.tan(.5*t);return[u.range[0]+r,u.range[1]+r]}function Wt(u,t,r,c,d){const f=o.ad.vec3.transformMat4([],[t,r,c],d.mercatorFogMatrix);return bt(u,o.ad.vec3.length(f),d.pitch,d._fov)}function Xt(u,t,r,c,d,f,_){const T=[[r,c,0],[d,c,0],[d,f,0],[r,f,0]];let E=Number.MAX_VALUE,M=-Number.MAX_VALUE;for(const I of T){const P=o.ad.vec3.transformMat4([],I,t),R=o.ad.vec3.length(P);E=Math.min(E,R),M=Math.max(M,R)}return[bt(u,E,_.pitch,_._fov),bt(u,M,_.pitch,_._fov)]}class Jt extends o.E{constructor(t,r,c,d){super();const f=new o.a7({range:new o.a8(o.a5.fog.range),color:new o.a8(o.a5.fog.color),"color-use-theme":new o.a8({type:"string","property-type":"data-constant",default:"default"}),"high-color":new o.a8(o.a5.fog["high-color"]),"high-color-use-theme":new o.a8({type:"string","property-type":"data-constant",default:"default"}),"space-color":new o.a8(o.a5.fog["space-color"]),"space-color-use-theme":new o.a8({type:"string","property-type":"data-constant",default:"default"}
21),"horizon-blend":new o.a8(o.a5.fog["horizon-blend"]),"star-intensity":new o.a8(o.a5.fog["star-intensity"]),"vertical-range":new o.a8(o.a5.fog["vertical-range"])});this._transitionable=new o.a6(f,c,new Map(d)),this.set(t,d),this._transitioning=this._transitionable.untransitioned(),this._transform=r,this.properties=new o.af(f),this.scope=c}get state(){const t=this._transform,r=t.projection.name==="globe",c=o.ag(t.zoom),d=this.properties.get("range"),f=[.5,3];return{range:r?[o.ah(f[0],d[0],c),o.ah(f[1],d[1],c)]:d,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(t,r,c={}){if(this._validate(Pl,t,c))return;const d=o.l({},t);for(const f of Object.keys(o.a5.fog))d[f]===void 0&&(d[f]=o.a5.fog[f].default);this._options=d,this._transitionable.setTransitionOrValue(this._options,r)}getOpacity(t){if(!this._transform.projection.supportsFog)return 0;const r=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:o.ae(Be,at,t))*r.a}getOpacityAtLatLng(t,r){return this._transform.projection.supportsFog?function(c,d,f){const _=o.ac.fromLngLat(d),T=f.elevation?f.elevation.getAtPointOrZero(_):0;return Wt(c,_.x,_.y,T,f)}(this.state,t,r):0}getOpacityForTile(t){if(!this._transform.projection.supportsFog)return[1,1];const r=this._transform.calculateFogTileMatrix(t.toUnwrapped());return Xt(this.state,r,0,0,o.ai,o.ai,this._transform)}getOpacityForBounds(t,r,c,d,f){return this._transform.projection.supportsFog?Xt(this.state,t,r,c,d,f,this._transform):[1,1]}getFovAdjustedRange(t){return this._transform.projection.supportsFog?Gt(this.state,t):[0,1]}isVisibleOnFrustum(t){if(!this._transform.projection.supportsFog)return!1;const r=[4,5,6,7];for(const c of r){const d=t.points[c];let f;if(d[2]>=0)f=d;else{const _=t.points[c-4];f=o.aj(_,d,_[2]/(_[2]-d[2]))}if(Wt(this.state,f[0],f[1],0,this._transform)>=gt)return!0}return!1}updateConfig(t){this._transitionable.setTransitionOrValue(this._options,new Map(t))}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,r,c){return(!c||c.validate!==!1)&&ze(this,t.call(Wr,o.l({value:r,style:{glyphs:!0,sprite:!0},styleSpec:o.a5})))}}let Oi,$i,si,Si,Ei=class extends o.E{constructor(u,t,r,c){super();const d=Oi||(Oi=new o.a7({density:new o.a8(o.a5.snow.density),intensity:new o.a8(o.a5.snow.intensity),color:new o.a8(o.a5.snow.color),opacity:new o.a8(o.a5.snow.opacity),vignette:new o.a8(o.a5.snow.vignette),"vignette-color":new o.a8(o.a5.snow["vignette-color"]),"center-thinning":new o.a8(o.a5.snow["center-thinning"]),direction:new o.a8(o.a5.snow.direction),"flake-size":new o.a8(o.a5.snow["flake-size"])}));this._transitionable=new o.a6(d,r,new Map(c)),this.set(u,c),this._transitioning=this._transitionable.untransitioned(),this.properties=new o.af(d),this.scope=r}get state(){const u=this.properties.get("opacity"),t=this.properties.get("color"),r=this.properties.get("direction"),c=o.ak(r[0]),d=-Math.max(o.ak(r[1]),.01),f=[Math.cos(c)*Math.cos(d),Math.sin(c)*Math.cos(d),Math.sin(d)],_=this.properties.get("vignette"),T=this.properties.get("vignette-color");return T.a=_,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new o.al(t.r,t.g,t.b,t.a*u),direction:f,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:T}}get(){return this._transitionable.serialize()}set(u,t,r={}){if(this._validate(za,u,r))return;const c=o.l({},u);for(const d of Object.keys(o.a5.snow))c[d]===void 0&&(c[d]=o.a5.snow[d].default);this._options=c,this._transitionable.setTransitionOrValue(this._options,t)}updateConfig(u){this._transitionable.setTransitionOrValue(this._options,new Map(u))}updateTransitions(u){this._transitioning=this._transitionable.transitioned(u,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(u){this.properties=this._transitioning.possiblyEvaluate(u)}_validate(u,t,r){return(!r||r.validate!==!1)&&ze(this,u.call(Wr,o.l({value:t,style:{glyphs:!0,sprite:!0},styleSpec:o.a5})))}},Ai=class extends o.E{constructor(u,t,r,c){super();const d=$i||($i=new o.a7({density:new o.a8(o.a5.rain.density),intensity:new o.a8(o.a5.rain.intensity),color:new o.a8(o.a5.rain.color),opacity:new o.a8(o.a5.rain.opacity),vignette:new o.a8(o.a5.rain.vignette),"vignette-color":new o.a8(o.a5.rain["vignette-color"]),"center-thinning":new o.a8(o.a5.rain["center-thinning"]),direction:new o.a8(o.a5.rain.direction),"droplet-size":new o.a8(o.a5.rain["droplet-size"]),"distortion-strength":new o.a8(o.a5.rain["distortion-strength"])}));this._transitionable=new o.a6(d,r,new Map(c)),this.set(u,c),this._transitioning=this._transitionable.untransitioned(),this.properties=new o.af(d),this.scope=r}get state(){const u=this.properties.get("opacity"),t=this.properties.get("color"),r=this.properties.get("direction"),c=o.ak(r[0]),d=-Math.max(o.ak(r[1]),.01),f=[Math.cos(c)*Math.cos(d),Math.sin(c)*Math.cos(d),Math.sin(d)],_=this.properties.get("vignette-color");return _.a=this.properties.get("vignette"),{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new o.al(t.r,t.g,t.b,t.a*u),direction:f,centerThinning:this.properties.get("center-thinning"),droplet
21Size:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:_}}get(){return this._transitionable.serialize()}set(u,t,r={}){if(this._validate(Ne,u,r))return;const c=o.l({},u);for(const d of Object.keys(o.a5.rain))c[d]===void 0&&(c[d]=o.a5.rain[d].default);this._options=c,this._transitionable.setTransitionOrValue(this._options,t)}updateConfig(u){this._transitionable.setTransitionOrValue(this._options,new Map(u))}updateTransitions(u){this._transitioning=this._transitionable.transitioned(u,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(u){this.properties=this._transitioning.possiblyEvaluate(u)}_validate(u,t,r){return(!r||r.validate!==!1)&&ze(this,u.call(Wr,o.l({value:t,style:{glyphs:!0,sprite:!0},styleSpec:o.a5})))}};class Qi extends o.E{constructor(t,r,c,d){super(),this.scope=c,this._options=t,this.properties=new o.af(r),this._transitionable=new o.a6(r,c,new Map(d)),this._transitionable.setTransitionOrValue(t.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(t){this._transitionable.setTransitionOrValue(this._options.properties,new Map(t))}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(t,r){this._options=t,this._transitionable.setTransitionOrValue(t.properties,r)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}class yr{constructor(t,r,c,d){this.screenBounds=t,this.cameraPoint=r,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=c,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,d)}static createFromScreenPoints(t,r){let c,d;if(t instanceof o.P||typeof t[0]=="number"){const f=o.P.convert(t);c=[f],d=r.isPointAboveHorizon(f)}else{const f=o.P.convert(t[0]),_=o.P.convert(t[1]);c=[f,_],d=o.an(f,_).every(T=>r.isPointAboveHorizon(T))}return new yr(c,r.getCameraPoint(),d,r)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(t){return o.an(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],t)}bufferedCameraGeometry(t){const r=this.screenBounds[0],c=this.screenBounds.length===1?this.screenBounds[0].add(new o.P(1,1)):this.screenBounds[1],d=o.an(r,c,0,!1);return this.cameraPoint.y>c.y&&(this.cameraPoint.x>r.x&&this.cameraPoint.x<c.x?d.splice(3,0,this.cameraPoint):this.cameraPoint.x>=c.x?d[2]=this.cameraPoint:this.cameraPoint.x<=r.x&&(d[3]=this.cameraPoint)),o.ao(d,t)}bufferedCameraGeometryGlobe(t){const r=this.screenBounds[0],c=this.screenBounds.length===1?this.screenBounds[0].add(new o.P(1,1)):this.screenBounds[1],d=o.an(r,c,t),f=this.cameraPoint.clone();switch(3*((f.y>r.y)+(f.y>c.y))+((f.x>r.x)+(f.x>c.x))){case 0:d[0]=f,d[4]=f.clone();break;case 1:d.splice(1,0,f);break;case 2:d[1]=f;break;case 3:d.splice(4,0,f);break;case 5:d.splice(2,0,f);break;case 6:d[3]=f;break;case 7:d.splice(3,0,f);break;case 8:d[2]=f}return d}containsTile(t,r,c,d=0){const f=t.queryPadding/r._pixelsPerMercatorPixel+1,_=c?this._bufferedCameraMercator(f,r):this._bufferedScreenMercator(f,r);let T=t.tileID.wrap+(_.unwrapped?d:0);const E=_.polygon.map(U=>o.ap(t.tileTransform,U,T));if(!o.aq(E,0,0,o.ai,o.ai))return;T=t.tileID.wrap+(this.screenGeometryMercator.unwrapped?d:0);const M=this.screenGeometryMercator.polygon.map(U=>o.ar(t.tileTransform,U,T)),I=M.map(U=>new o.P(U[0],U[1])),P=r.getFreeCameraOptions().position||new o.ac(0,0,0),R=o.ar(t.tileTransform,P,T),O=M.map(U=>{const q=o.ad.vec3.sub(U,U,R);return o.ad.vec3.normalize(q,q),new o.as(R,q)}),N=o.at(t,1,r.zoom)*r._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:I,tilespaceRays:O,bufferedTilespaceGeometry:E,bufferedTilespaceBounds:(F=o.au(E),F.min.x=o.ay(F.min.x,0,o.ai),F.min.y=o.ay(F.min.y,0,o.ai),F.max.x=o.ay(F.max.x,0,o.ai),F.max.y=o.ay(F.max.y,0,o.ai),F),tile:t,t
21ileID:t.tileID,pixelToTileUnitsFactor:N};var F}_bufferedScreenMercator(t,r){const c=Vr(t);if(this._screenRaycastCache[c])return this._screenRaycastCache[c];{let d;return d=r.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(t),r):{polygon:this.bufferedScreenGeometry(t).map(f=>r.pointCoordinate3D(f)),unwrapped:!0},this._screenRaycastCache[c]=d,d}}_bufferedCameraMercator(t,r){const c=Vr(t);if(this._cameraRaycastCache[c])return this._cameraRaycastCache[c];{let d;return d=r.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(t),r):{polygon:this.bufferedCameraGeometry(t).map(f=>r.pointCoordinate3D(f)),unwrapped:!0},this._cameraRaycastCache[c]=d,d}}_projectAndResample(t,r){const c=function(f,_){const T=o.ad.mat4.multiply([],_.pixelMatrix,_.globeMatrix),E=[0,-o.az,0,1],M=[0,o.az,0,1],I=[0,0,0,1];o.ad.vec4.transformMat4(E,E,T),o.ad.vec4.transformMat4(M,M,T),o.ad.vec4.transformMat4(I,I,T);const P=new o.P(E[0]/E[3],E[1]/E[3]),R=new o.P(M[0]/M[3],M[1]/M[3]),O=o.aw(f,P)&&E[3]<I[3],N=o.aw(f,R)&&M[3]<I[3];if(!O&&!N)return null;const F=function(ie,re,ue){for(let me=1;me<ie.length;me++){const Le=wn(re.pointCoordinate3D(ie[me-1]).x),Ee=wn(re.pointCoordinate3D(ie[me]).x);if(ue<0){if(Le<Ee)return{idx:me,t:-Le/(Ee-1-Le)}}else if(Ee<Le)return{idx:me,t:(1-Le)/(Ee+1-Le)}}return null}(f,_,O?-1:1);if(!F)return null;const{idx:U,t:q}=F;let Z=U>1?zr(f.slice(0,U),_):[],J=U<f.length?zr(f.slice(U),_):[];Z=Z.map(ie=>new o.P(wn(ie.x),ie.y)),J=J.map(ie=>new o.P(wn(ie.x),ie.y));const K=[...Z];K.length===0&&K.push(J[J.length-1]);const oe=o.ah(K[K.length-1].y,(J.length===0?Z[0]:J[0]).y,q);let te;return te=O?[new o.P(0,oe),new o.P(0,0),new o.P(1,0),new o.P(1,oe)]:[new o.P(1,oe),new o.P(1,1),new o.P(0,1),new o.P(0,oe)],K.push(...te),J.length===0?K.push(Z[0]):K.push(...J),{polygon:K.map(ie=>new o.ac(ie.x,ie.y)),unwrapped:!1}}(t,r);if(c)return c;const d=function(f,_){let T=!1,E=-1/0,M=0;for(let P=0;P<f.length-1;P++)f[P].x>E&&(E=f[P].x,M=P);for(let P=0;P<f.length-1;P++){const R=(M+P)%(f.length-1),O=f[R],N=f[R+1];Math.abs(O.x-N.x)>.5&&(O.x<N.x?(O.x+=1,R===0&&(f[f.length-1].x+=1)):(N.x+=1,R+1===f.length-1&&(f[0].x+=1)),T=!0)}const I=o.av(_.center.lng);return T&&I<Math.abs(I-1)&&f.forEach(P=>{P.x-=1}),{polygon:f,unwrapped:T}}(zr(t,r).map(f=>new o.P(wn(f.x),f.y)),r);return{polygon:d.polygon.map(f=>new o.ac(f.x,f.y)),unwrapped:d.unwrapped}}}function zr(u,t){return o.ax(u,r=>{const c=t.pointCoordinate3D(r);r.x=c.x,r.y=c.y},1/256)}function wn(u){return u<0?1+u%1:u%1}function Vr(u){return 100*u|0}function vr(u,t,r,c,d){const f=function(T,E){if(T)return d(T);if(E){if(u.url&&E.tiles&&u.tiles&&delete u.tiles,E.variants){if(!Array.isArray(E.variants))return d(new Error("variants must be an array"));for(const I of E.variants){if(I==null||typeof I!="object"||I.constructor!==Object)return d(new Error("variant must be an object"));if(!Array.isArray(I.capabilities))return d(new Error("capabilities must be an array"));if(I.capabilities.length===1&&I.capabilities[0]==="meshopt"){E=o.l(E,I);break}}}const M=o.aA(o.l({},E,u),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);M.tiles=t.canonicalizeTileset(M,u.url),d(null,M)}},_=function(T,E,M){if(!T)return null;if(!E&&!M)return T;M=M||T.worldview_default;const I=Object.values(T.language||{});if(I.length===0)return null;const P=Object.values(T.worldview||{});if(P.length===0)return null;const R=I.every(N=>N===E),O=P.every(N=>N===M);return R&&O?T:E in(T.language_options||{})||M in(T.worldview_options||{})?null:T.language_options&&T.worldview_options?T:null}(u.data,r,c);return _?o.q.frame(()=>f(null,_)):u.url?o.n(t.transformRequest(t.normalizeSourceURL(u.url,null,r,c),o.R.Source),f):o.q.frame(()=>{const{data:T,...E}=u;f(null,E)})}class wr{constructor(t,r,c){this.bounds=o.aB.convert(this.validateBounds(t)),this.minzoom=r||0,this.maxzoom=c||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const r=Math.pow(2,t.z),c=Math.floor(o.av(this.bounds.getWest())*r),d=Math.floor(o.aC(this.bounds.getNorth())*r),f=Math.ceil(o.av(this.bounds.getE
21ast())*r),_=Math.ceil(o.aC(this.bounds.getSouth())*r);return t.x>=c&&t.x<f&&t.y>=d&&t.y<_}}class Ro extends o.E{constructor(t,r,c,d){if(super(),this.id=t,this.dispatcher=c,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,o.l(this,o.aA(r,["url","scheme","tileSize","promoteId"])),this._options=o.l({type:"vector"},r),this._collectResourceTiming=!!r.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(d),this._tileWorkers={},this._deduped=new o.aD}load(t){this._loaded=!1,this.fire(new o.A("dataloading",{dataType:"source"}));const r=Array.isArray(this.map._language)?this.map._language.join():this.map._language,c=this.map.getWorldview();this._tileJSONRequest=vr(this._options,this.map._requestManager,r,c,(d,f)=>{if(this._tileJSONRequest=null,this._loaded=!0,d)r&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${r}`),c&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${c}`),this.fire(new o.z(d));else if(f){if(o.l(this,f),this.hasWorldviews=!!f.worldview_options,f.worldview_default&&(this.worldviewDefault=f.worldview_default),f.vector_layers){this.vectorLayers=f.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set;for(const _ of f.vector_layers)this.vectorLayerIds.push(_.id),f.worldview&&f.worldview[_.source]&&this.localizableLayerIds.add(_.id)}f.bounds&&(this.tileBounds=new wr(f.bounds,this.minzoom,this.maxzoom)),Ln(f.tiles,this.map._requestManager._customAccessToken),this.fire(new o.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.A("data",{dataType:"source",sourceDataType:"content"}))}t&&t(d)})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}reload(){this.cancelTileJSONRequest();const t=o.C(this.id,this.scope);this.load(()=>this.map.style.clearSource(t))}setTiles(t){return this._options.tiles=t,this.reload(),this}setUrl(t){return this.url=t,this._options.url=t,this.reload(),this}onRemove(t){this.cancelTileJSONRequest()}serialize(){return o.l({},this._options)}loadTile(t,r){const c=t.tileID.canonical.url(this.tiles,this.scheme),d=this.map._requestManager.normalizeTileURL(c),f=this.map._requestManager.transformRequest(d,o.R.Tile),_=this.map.style?this.map.style.getLut(this.scope):null,T=_?{image:_.image.clone()}:null,E={request:f,data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,lut:T,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.t
21ype,source:this.id,scope:this.scope,pixelRatio:o.q.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:t.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:t.isExtraShadowCaster,tessellationStep:this.map._tessellationStep,scaleFactor:this.map.getScaleFactor()};if(this.hasWorldviews&&o.f(c)&&(E.worldview=this.map.getWorldview()||this.worldviewDefault,E.localizableLayerIds=this.localizableLayerIds),E.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired")t.state==="loading"?t.reloadCallback=r:t.request=t.actor.send("reloadTile",E,M.bind(this));else if(t.actor=this._tileWorkers[d]=this._tileWorkers[d]||this.dispatcher.getActor(),this.dispatcher.ready)t.request=t.actor.send("loadTile",E,M.bind(this),void 0,!0);else{const I=o.aE.call({deduped:this._deduped},E,(P,R)=>{P||!R?M.call(this,P):(E.data={cacheControl:R.cacheControl,expires:R.expires,rawData:R.rawData.slice(0)},t.actor&&t.actor.send("loadTile",E,M.bind(this),void 0,!0))},!0);t.request={cancel:I}}function M(I,P){return delete t.request,t.aborted?r(null):I&&I.status!==404?r(I):(P&&P.resourceTiming&&(t.resourceTiming=P.resourceTiming),this.map._refreshExpiredTiles&&P&&t.setExpiryData(P),t.loadVectorData(P,this.map.painter),o.aF(this.dispatcher),r(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.t
21ype,source:this.id,scope:this.scope})}unloadTile(t,r){t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id,scope:this.scope}),t.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class Tn extends o.E{constructor(t,r,c,d){super(),this.id=t,this.dispatcher=c,this.setEventedParent(d),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=o.l({type:"raster"},r),o.l(this,o.aA(r,["url","scheme","tileSize"]))}load(t){this._loaded=!1,this.fire(new o.A("dataloading",{dataType:"source"})),this._tileJSONRequest=vr(this._options,this.map._requestManager,null,null,(r,c)=>{this._tileJSONRequest=null,this._loaded=!0,r?this.fire(new o.z(r)):c&&(o.l(this,c),c.raster_layers&&(this.rasterLayers=c.raster_layers,this.rasterLayerIds=this.rasterLayers.map(d=>d.id)),c.bounds&&(this.tileBounds=new wr(c.bounds,this.minzoom,this.maxzoom)),Ln(c.tiles),this.fire(new o.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.A("data",{dataType:"source",sourceDataType:"content"}))),t&&t(r)})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}reload(){this.cancelTileJSONRequest();const t=o.C(this.id,this.scope);this.load(()=>this.map.style.clearSource(t))}setTiles(t){return this._options.tiles=t,this.reload(),this}setUrl(t){return this.url=t,this._options.url=t,this.reload(),this}onRemove(t){this.cancelTileJSONRequest()}serialize(){return o.l({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,r){const c=o.q.devicePixelRatio>=2,d=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),c,this.tileSize);t.request=o.o(this.map._requestManager.transformRequest(d,o.R.Tile),(f,_,T,E)=>(delete t.request,t.aborted?(t.state="unloaded",r(null)):f?(t.state="errored",r(f)):_?(this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:T,expires:E}),t.setTexture(_,this.map.painter),t.state="loaded",o.aF(this.dispatcher),void r(null)):r(null)))}abortTile(t,r){t.request&&(t.request.cancel(),delete t.request),r&&r()}unloadTile(t,r){t.texture&&t.texture instanceof o.T?(t.destroy(!0),t.texture&&t.texture instanceof o.T&&this.map.painter.saveTileTexture(t.texture)):t.destroy(),r&&r()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class as extends Tn{constructor(t,r,c,d){super(t,r,c,d),this.type="raster-array",this.maxzoom=22,this.partial=!0,this.iconsets={},this._options=o.l({type:"raster-array"},r)}triggerRepaint(t){const r=this.map.painter._terrain,c=this.map.style.getSourceCache(this.id);r&&r.enabled&&c&&r._clearRenderCacheForTile(c.id,t.tileID),this.map.triggerRepaint()}loadTile(t,r){const c=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),d=this.map._requestManager.transformRequest(c,o.R.Tile),f={request:d,uid:t.uid,tileID:t.tileID,type:this.t
21ype,source:this.id,scope:this.scope,partial:this.partial};t.source=this.id,t.scope=this.scope,t.requestParams=d,t.actor||(t.actor=this.dispatcher.getActor());const _=(T,E,M,I)=>{if(delete t.request,t.aborted)return t.state="unloaded",r(null);if(T)return T.name==="AbortError"?void 0:(t.state="errored",r(T));if(this.map._refreshExpiredTiles&&E&&t.setExpiryData({cacheControl:M,expires:I}),this.partial)t.state="empty";else{if(!E)return r(null);t.state="loaded",t._isHeaderLoaded=!0,t._mrt=E;const P=new Map;for(const R in t._mrt.layers){const O=t.getLayer(R);if(O)for(const N of O.getBandList()){const{bytes:F,tileSize:U,buffer:q}=O.getBandView(N),Z=U+2*q,J={data:new o.r({width:Z,height:Z},F),pixelRatio:2,sdf:!1,usvg:!1,version:0};P.set(`${R}/${N}`,J)}}for(const R in this.iconsets)this.iconsets[R].addIcons(P)}r(null)};t.request=this.partial?t.fetchHeader(void 0,_.bind(this)):t.actor.send("loadTile",f,_.bind(this),void 0,!0)}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.t
21ype,source:this.id,scope:this.scope})}unloadTile(t,r){const c=t.texture;c&&c instanceof o.T?(t.destroy(!0),this.map.painter.saveTileTexture(c)):(t.destroy(),t.flushQueues(),t._isHeaderLoaded=!1,delete t._mrt,delete t.textureDescriptor),t.fbo&&(t.fbo.destroy(),delete t.fbo),delete t.request,delete t.requestParams,delete t.neighboringTiles,t.state="unloaded"}prepareTile(t,r,c){t._isHeaderLoaded&&(t.state!=="empty"&&(t.state="reloading"),t.fetchBand(r,c,(d,f)=>{if(d)return t.state="errored",this.fire(new o.z(d)),void this.triggerRepaint(t);f&&(t._isHeaderLoaded=!0,t.setTexture(f,this.map.painter),t.state="loaded",this.triggerRepaint(t))}))}getInitialBand(t){if(!this.rasterLayers)return 0;const r=this.rasterLayers.find(({id:f})=>f===t),c=r&&r.fields,d=c&&c.bands&&c.bands;return d?d[0]:0}getTextureDescriptor(t,r,c){if(!t)return;const d=r.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!d)return;let f=null;r instanceof o.aI?f=r.paint.get("raster-array-band"):r instanceof o.aJ&&(f=r.paint.get("raster-particle-array-band"));const _=f||this.getInitialBand(d);if(_!=null)if(t.textureDescriptor){if(!t.updateNeeded(d,_)||c)return Object.assign({},t.textureDescriptor,{texture:t.texture})}else this.prepareTile(t,d,_)}addIconset(t,r){this.iconsets[t]=r,this.partial=!1}}const Hc={vector:Ro,raster:Tn,"raster-dem":class extends Tn{constructor(u,t,r,c){super(u,t,r,c),this.type="raster-dem",this.maxzoom=22,this._options=o.l({type:"raster-dem"},t),this.encoding=t.encoding||"mapbox"}loadTile(u,t){const r=this.map._requestManager.normalizeTileURL(u.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function c(d,f){d&&(u.state="errored",t(d)),f&&(u.dem=f,u.dem.onDeserialize(),u.needsHillshadePrepare=!0,u.needsDEMTextureUpload=!0,u.state="loaded",t(null))}u.request=o.o(this.map._requestManager.transformRequest(r,o.R.Tile),(function(d,f,_,T){if(delete u.request,u.aborted)u.state="unloaded",t(null);else if(d)u.state="errored",t(d);else if(f){this.map._refreshExpiredTiles&&u.setExpiryData({cacheControl:_,expires:T});const E=ImageBitmap&&f instanceof ImageBitmap&&o.t(),M=1-(f.width-o.aG(f.width))/2;M<1||u.neighboringTiles||(u.neighboringTiles=this._getNeighboringTiles(u.tileID));const I=E?f:o.q.getImageData(f,M),P={uid:u.uid,tileID:u.tileID,source:this.id,type:this.t
21ype,scope:this.scope,rawImageData:I,encoding:this.encoding,padding:M};u.actor&&u.state!=="expired"||(u.actor=this.dispatcher.getActor(),u.actor.send("loadTile",P,c.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(u){const t=u.canonical,r=Math.pow(2,t.z),c=(t.x-1+r)%r,d=t.x===0?u.wrap-1:u.wrap,f=(t.x+1+r)%r,_=t.x+1===r?u.wrap+1:u.wrap,T={};return T[new o.aH(u.overscaledZ,d,t.z,c,t.y).key]={backfilled:!1},T[new o.aH(u.overscaledZ,_,t.z,f,t.y).key]={backfilled:!1},t.y>0&&(T[new o.aH(u.overscaledZ,d,t.z,c,t.y-1).key]={backfilled:!1},T[new o.aH(u.overscaledZ,u.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},T[new o.aH(u.overscaledZ,_,t.z,f,t.y-1).key]={backfilled:!1}),t.y+1<r&&(T[new o.aH(u.overscaledZ,d,t.z,c,t.y+1).key]={backfilled:!1},T[new o.aH(u.overscaledZ,u.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},T[new o.aH(u.overscaledZ,_,t.z,f,t.y+1).key]={backfilled:!1}),T}},"raster-array":as,geojson:class extends o.E{constructor(u,t,r,c){super(),this.id=u,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=r.getActor(),this.setEventedParent(c),this._data=t.data,this._options=o.l({},t),this._collectResourceTiming=t.collectResourceTiming,t.maxzoom!==void 0&&(this.maxzoom=t.maxzoom),t.minzoom!==void 0&&(this.minzoom=t.minzoom),t.type&&(this.type=t.type),t.attribution&&(this.attribution=t.attribution),this.promoteId=t.promoteId;const d=o.ai/this.tileSize;this.workerOptions=o.l({source:this.id,scope:this.scope,cluster:t.cluster||!1,geojsonVtOptions:{buffer:(t.buffer!==void 0?t.buffer:128)*d,tolerance:(t.tolerance!==void 0?t.tolerance:.375)*d,extent:o.ai,maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1},superclusterOptions:{maxZoom:t.clusterMaxZoom!==void 0?t.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,t.clusterMinPoints||2),extent:o.ai,radius:(t.clusterRadius!==void 0?t.clusterRadius:50)*d,log:!1,generateId:t.generateId||!1},clusterProperties:t.clusterProperties,filter:t.filter,dynamic:t.dynamic},t.workerOptions)}onAdd(u){this.map=u,this.setData(this._data)}setData(u){return this._data=u,this._updateWorkerData(),this}updateData(u){if(!this._options.dynamic)return this.fire(new o.z(new Error("Can't call updateData on a GeoJSON source with dynamic set to false.")));if(typeof u!="string"&&(u.type==="Feature"&&(u={type:"FeatureCollection",features:[u]}),u.type!=="FeatureCollection"))return this.fire(new o.z(new Error("Data to update should be a feature or a feature collection.")));if(this._coalesce&&typeof u!="string"&&typeof this._data!="string"&&this._data.type==="FeatureCollection"){const t=new Map;for(const r of this._data.features)t.set(r.id,r);for(const r of u.features)t.set(r.id,r);this._data.features=[...t.values()]}else this._data=u;return this._updateWorkerData(!0),this}getClusterExpansionZoom(u,t){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:u,source:this.id,scope:this.scope},t),this}getClusterChildren(u,t){return this.actor.send("geojson.getClusterChildren",{clusterId:u,source:this.id,scope:this.scope},t),this}getClusterLeaves(u,t,r,c){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:u,limit:t,offset:r},c),this}_updateWorkerData(u=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new o.A("dataloading",{dataType:"source"})),this._loaded=!1;const t=o.l({append:u},this.workerOptions);t.scope=this.scope;const r=this._data;typeof r=="string"?(t.request=this.map._requestManager.transformRequest(o.q.resolveURL(r),o.R.Source),t.request.collectResourceTiming=this._collectResourceTiming):t.data=JSON.stringify(r),this._pendingLoad=this.actor.send(`${this.type}.loadData`,t,(c,d)=>{if(this._loaded=!0,this._pendingLoad=null,c)this.fire(new o.z(c));else{const f={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&d&&d.resourceTiming&&d.resourceTiming[this.id]&&(f.resourceTiming=d.resourceTiming[this.id]),u&&(this._partialReload=!0),this.fire(new o.A("data",f)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(u),this._coalesce=!1)})}loaded(){return this._loaded}reload(){const u=o.C(this.id,this.scope);this.map.style.clearSource(u),this._updateWorkerData()}loadTile(u,t){const r=u.actor?"reloadTile":"loadTile";u.actor=this.actor;const c=this.map.style?this.map.style.getLut(this.scope):null,d=c?{image:c.image.clone()}
21:null,f=this._partialReload,_={type:this.type,uid:u.uid,tileID:u.tileID,tileZoom:u.tileZoom,zoom:u.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:d,scope:this.scope,pixelRatio:o.q.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,scaleFactor:this.map.getScaleFactor(),partial:f};u.request=this.actor.send(r,_,(T,E)=>f&&!E?(u.state="loaded",t(null)):(delete u.request,u.destroy(),u.aborted?t(null):T?t(T):(u.loadVectorData(E,this.map.painter,r==="reloadTile"),t(null))),void 0,r==="loadTile")}abortTile(u){u.request&&(u.request.cancel(),delete u.request),u.aborted=!0}unloadTile(u,t){this.actor.send("removeTile",{uid:u.uid,type:this.type,source:this.id,scope:this.scope}),u.destroy()}onRemove(u){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return o.l({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends o.aK{constructor(u,t,r,c){super(u,t,r,c),this.roundZoom=!0,this.type="video",this.options=t}load(){this._loaded=!1;const u=this.options;this.urls=[];for(const t of u.urls)this.urls.push(this.map._requestManager.transformRequest(t,o.R.Source).url);o.aL(this.urls,(t,r)=>{this._loaded=!0,t?this.fire(new o.z(t)):r&&(this.video=r,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(u){if(this.video){const t=this.video.seekable;u<t.start(0)||u>t.end(0)?this.fire(new o.z(new o.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${t.start(0)} and ${t.end(0)}-second mark.`))):this.video.currentTime=u}}getVideo(){return this.video}onAdd(u){this.map||(this.map=u,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const u=this.map.painter.context,t=u.gl;this.texture?this.video.paused||(this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.texture=new o.T(u,this.video,t.RGBA8),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(u)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:o.aK,model:class extends o.E{constructor(u,t,r,c){super(),this.id=u,this.type="model",this.models=[],this._loaded=!1,this._options=t}load(){const u=[];for(const t in this._options.models){const r=this._options.models[t],c=o.aN(this.map._requestManager.transformRequest(r.uri,o.R.Model).url).then(d=>{if(!d)return;const f=o.aO(d),_=new o.aP(t,r.position,r.orientation,f);_.computeBoundsAndApplyParent(),this.models.push(_)}).catch(d=>{this.fire(new o.z(new Error(`Could not load model ${t} from ${r.uri}: ${d.message}`)))});u.push(c)}return Promise.allSettled(u).then(()=>{this._loaded=!0,this.fire(new o.A("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(t=>{this.fire(new o.z(new Error(`Could not load models: ${t.message}`)))})}onAdd(u){this.map=u,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(u,t){}serialize(){return{type:"model"}}},"batched-model":class extends o.E{constructor(u,t,r,c){super(),this.type="batched-model",this.id=u,this.tileSize=512,this._options=t,this.tiles=this._options.tiles,this.maxzoom=t.maxzoom||19,this.minzoom=t.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=r,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(c)}onAdd(u){this.map=u,this.load()}reload(){this.cancelTileJSONRequest();const u=o.C(this.id,this.scope);this.load(()=>this.map.style.clearSource(u))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(u){this._loaded=!1,this.fire(new o.A("dataloading",{dataType:"source"}));const t=Array.isArray(this.map._language)?this.map._language.join():this.map._language,r=this.map.getWorldview();this._tileJSONRequest=vr(this._options,this.map._requestManager,t,r,(c,d)=>{this._tileJSONRequest=null,this._loaded=!0,c?(t&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${t}`),r&&r.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${r}`),this.fire(new o.z(c))):d&&(o.l(this,d),d.bounds&&(this.tileBounds=new wr(d.bounds,this.minzoom,this.maxzoom)),Ln(d.tiles,this.map._requestManager._customAccessToken),this.fire(new o.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.A("data",{dataType:"source",sourceDataType:"content"}))),u&&u(c)})}hasTransition(){return!1}hasTile(u){return!this.tileBounds||this.tileBounds.contains(u.canonical)}loaded(){return this._loaded}loadTile(u,t){const r=this.map._requestManager.normalizeTileURL(u.tileID.canonical.url(this.tiles,this.scheme)),c={request:this.map._requestManager.transformRequest(r,o.R.Tile),data:void 0,uid:u.uid,tileID:u.tileID,tileZoom:u.tileZoom,zoom:u.tileID.overscaledZ,tileSize:this.tileSize*u.tileID.overscaleFactor(),type:this.t
21ype,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:u.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:o.q.devicePixelRatio,promoteId:this.promoteId};if(u.actor&&u.state!=="expired")if(u.state==="loading")u.reloadCallback=t;else{if(u.buckets){const f=Object.values(u.buckets);for(const _ of f)_.dirty=!0;return void(u.state="loaded")}u.request=u.actor.send("reloadTile",c,d.bind(this))}else u.actor=this.dispatcher.getActor(),u.request=u.actor.send("loadTile",c,d.bind(this),void 0,!0);function d(f,_){return u.aborted?t(null):f&&f.status!==404?t(f):(this.map._refreshExpiredTiles&&_&&u.setExpiryData(_),u.loadModelData(_,this.map.painter),u.state="loaded",void t(null))}}serialize(){return o.l({},this._options)}},canvas:class extends o.aK{constructor(u,t,r,c){super(u,t,r,c),t.coordinates?Array.isArray(t.coordinates)&&t.coordinates.length===4&&!t.coordinates.some(d=>!Array.isArray(d)||d.length!==2||d.some(f=>typeof f!="number"))||this.fire(new o.z(new o.V(`sources.${u}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new o.z(new o.V(`sources.${u}`,null,'missing required property "coordinates"'))),t.animate&&typeof t.animate!="boolean"&&this.fire(new o.z(new o.V(`sources.${u}`,null,'optional "animate" property must be a boolean value'))),t.canvas?typeof t.canvas=="string"||t.canvas instanceof HTMLCanvasElement||this.fire(new o.z(new o.V(`sources.${u}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new o.z(new o.V(`sources.${u}`,null,'missing required property "canvas"'))),this.options=t,this.animate=t.animate===void 0||t.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new o.z(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(u){this.map=u,this.load(),this.canvas&&this.animate&&this.play()}onRemove(u){this.pause()}prepare(){let u=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,u=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,u=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const t=this.map.painter.context;this.texture?!u&&!this._playing||this.texture instanceof o.aM||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new o.T(t,this.canvas,t.gl.RGBA8,{premultiply:!0}),this._prepareData(t)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const u of[this.canvas.width,this.canvas.height])if(isNaN(u)||u<=0)return!0;return!1}},custom:class extends o.E{constructor(u,t,r,c){super(),this.id=u,this.type="custom",this._dataType="raster",this._dispatcher=r,this._implementation=t,this.setEventedParent(c),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new o.z(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new o.z(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new wr(this._implementation.bounds,this.minzoom,this.maxzoom)),t.update=this._update.bind(this),t.clearTiles=this._clearTiles.bind(this),t.coveringTiles=this._coveringTiles.bind(this),o.l(this,o.aA(t,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return o.aA(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new o.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.A("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(u){this.map=u,this._loaded=!1,this.fire(new o.A("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(u),this.load()}onRemove(u){this._implementation.onRemove&&this._implementation.onRemove(u)}hasTile(u){if(this._implementation.hasTile){const{x:t,y:r,z:c}=u.canonical;return this._implementation.hasTile({x:t,y:r,z:c})}return!this.tileBounds||this.tileBounds.contains(u.canonical)}loadTile(u,t){const{x:r,y:c,z:d}=u.tileID.canonical,f=new AbortController;u.request=Promise.resolve(this._implementation.loadTile({x:r,y:c,z:d}
21,{signal:f.signal})).then((function(_){return delete u.request,u.aborted?(u.state="unloaded",t(null)):_===void 0?(u.state="errored",t(null)):_===null?(this.loadTileData(u,{width:this.tileSize,height:this.tileSize,data:null}),u.state="loaded",t(null)):function(T){return T instanceof ImageData||T instanceof HTMLCanvasElement||T instanceof ImageBitmap||T instanceof HTMLImageElement}(_)?(this.loadTileData(u,_),u.state="loaded",void t(null)):(u.state="errored",t(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(_=>{_.name!=="AbortError"&&(u.state="errored",t(_))}),u.request.cancel=()=>f.abort()}loadTileData(u,t){u.setTexture(t,this.map.painter)}unloadTile(u,t){if(u.texture&&u.texture instanceof o.T?(u.destroy(!0),u.texture&&u.texture instanceof o.T&&this.map.painter.saveTileTexture(u.texture)):u.destroy(),this._implementation.unloadTile){const{x:r,y:c,z:d}=u.tileID.canonical;this._implementation.unloadTile({x:r,y:c,z:d})}t&&t()}abortTile(u,t){u.request&&u.request.cancel&&(u.request.cancel(),delete u.request),t&&t()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(u=>({x:u.canonical.x,y:u.canonical.y,z:u.canonical.z}))}_clearTiles(){const u=o.C(this.id,this.scope);this.map.style.clearSource(u)}_update(){this.fire(new o.A("data",{dataType:"source",sourceDataType:"content"}))}}},Rl=function(u,t,r,c){const d=new Hc[t.type](u,t,r,c);if(d.id!==u)throw new Error(`Expected Source id to be ${u} instead of ${d.id}`);return o.aQ(["load","abort","unload","serialize","prepare"],d),d};function La(u,t,r=""){return`${r}:${t.id||""}:${t.layer.id}:${function(c){if("layerId"in c)return`layer:${c.layerId}`;{const{featuresetId:d,importId:f}=c;return`featureset:${d}${f?`:import:${f}`:""}`}}(u.target)}`}function zo(u,t,r,c=""){if(u.uniqueFeatureID){const d=La(u,t,c);if(r.has(d))return!0;r.add(d)}return!1}function Zc(u,t,r,c,d=!1){const f=t.sourceCache.transform,_=t.sourceCache.tilesIn(u,t.has3DLayers,d);_.sort(Wc);const T=[];for(const E of _){const M=E.tile.queryRenderedFeatures(t,E,r,c,f,d);Object.keys(M).length&&T.push({wrappedTileID:E.tile.tileID.wrapped().key,queryResults:M})}return T.length===0?{}:function(E){const M={},I={};for(const P of E){const R=P.queryResults,O=P.wrappedTileID,N=I[O]=I[O]||{};for(const F in R){const U=R[F],q=N[F]=N[F]||{},Z=M[F]=M[F]||[];for(const J of U)q[J.featureIndex]||(q[J.featureIndex]=!0,Z.push(J))}}return M}(T)}function $h(u,t,r,c,d){const f={},_=c.queryRenderedSymbols(u),T=[];for(const E of Object.keys(_).map(Number))T.push(d[E]);T.sort(Wc);for(const E of T){const M=E.featureIndex.lookupSymbolFeatures(_[E.bucketInstanceId],E.bucketIndex,E.sourceLayerIndex,t,r);for(const I in M){const P=f[I]=f[I]||[],R=M[I];R.sort((O,N)=>{const F=E.featureSortOrder;if(F){const U=F.indexOf(O.featureIndex);return F.indexOf(N.featureIndex)-U}return N.featureIndex-O.featureIndex});for(const O of R)P.push(O)}}return f}function Hh(u,t){const r=u.getRenderableIds().map(f=>u.getTileByID(f)),c=[],d={};for(let f=0;f<r.length;f++){const _=r[f],T=_.tileID.canonical.key;d[T]||(d[T]=!0,_.querySourceFeatures(c,t))}return c}function Wc(u,t){const r=u.tileID,c=t.tileID;return r.overscaledZ-c.overscaledZ||r.canonical.y-c.canonical.y||r.wrap-c.wrap||r.canonical.x-c.canonical.x}function Lo(u,t){const r={};if(!t)return r;for(const c of u){const d=c.layerIds.map(f=>t.getLayer(f)).filter(Boolean);if(d.length!==0){c.layers=d,c.stateDependentLayerIds&&(c.stateDependentLayers=c.stateDependentLayerIds.map(f=>d.filter(_=>_.id===f)[0]));for(const f of d)r[f.fqid]=c}}return r}const hn=32,On=33,ks=new Uint16Array(8184);for(let u=0;u<2046;u++){let t=u+2,r=0,c=0,d=0,f=0,_=0,T=0;for(1&t?d=f=_=hn:r=c=T=hn;(t>>=1)>1;){const M=r+d>>1,I=c+f>>1;1&t?(d=r,f=c,r=_,c=T):(r=d,c=f,d=_,f=T),_=M,T=I}const E=4*u;ks[E+0]=r,ks[E+1]=c,ks[E+2]=d,ks[E+3]=f}const dn=new Uint16Array(2178),tn=new Uint8Array(1089),Do=new Uint16Array(1089);function Xc(u){return u===0?-.03125:u===32?.03125:0}const zl={type:2,extent:o.ai,loadGeometry:()=>[[new o.P(0,0),new o.P(o.ai+1,0),new o.P(o.ai+1,o.ai+1),new o.P(0,o.ai+1),new o.P(0,0)]]};class kn{constructor(t,r,c,d,f){this.tileID=t,this.uid=o.aW(),this.uses=0,this.tileSize=r,this.tileZoom=c,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=f,d&&d.style&&(this._lastUpdatedBrightness=d.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",d&&d.transform&&(this.projection=d.transform.projection)}registerFadeDuration(t){const r=t+this.timeAdded;r<o.q.now()||this.fadeEndTime&&r<this.fadeEndTime||(this.fadeEndTime=r)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}get tileTransform(){return this._tileTransform||(this._tileTransform=o.aR(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(t,r,c){if(this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=Lo(t.buckets,r.style),this.hasSymbolBuckets=!1;for(const d in this.buckets){const f=this.buckets[d];if(f instanceof o.aY){if(this.hasSymbolBuckets=!0,!c)break;f.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const d in this.buckets){const f=this.buckets[d];if(f instanceof o.aY&&f.hasRTLText){this.hasRTLText=!0,o.aZ();break}}this.queryPadding=0;for(const d in this.buckets){const f=this.buckets[d],_=r.style.getOwnLayer(d);if(!_)continue;const T=_.queryRadius(f);this.queryPadding=Math.max(this.queryPadding,T)}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),t.lineAtlas&&(this.lineAtlas=t.lineAtlas),this._lastUpdatedBrightness=t.brightness}else this.collisionBoxArray=new o.aX}unloadVectorData(){if(this.hasData()){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}loadModelData(t,r,c){t&&(t.resourceTiming&&(this.resourceTiming=t.resourceTiming),this.buckets=Object.assign({},this.buckets,Lo(t.buckets,r.style)),t.featureIndex&&(this.latestFeatureIndex=t.featureIndex))}getBucket(t){return this.buckets[t.fqid]}upload(t){for(const d in this.buckets){const f=this.buckets[d];f.uploadPending()&&f.upload(t)}const r=t.gl,c=this.imageAtlas;c&&!c.uploaded&&(this.imageAtlasTexture=new o.T(t,c.image,r.RGBA8,{useMipmap:!!c.patternPositions.size}),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new o.T(t,this.glyphAtlasImage,r.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new o.T(t,this.lineAtlas.image,r.R8),this.lineAtlas.uploaded=!0)}prepare(t,r,c){if(this.imageAtlas&&this.imageAtlasTexture&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture,c),!r||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;const d=r.style.getBrightness();(this._lastUpdatedBrightness||d)&&(this._lastUpdatedBrightness&&d&&Math.abs(this._lastUpdatedBrightness-d)<.001||(this.updateBuckets(r,this._lastUpdatedBrightness!==d),this._lastUpdatedBrightness=d))}queryRenderedFeatures(t,r,c,d,f,_){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile)return{};const T=function(E,M){const I=o.ad.mat4.fromScaling([],[.5*E.width,.5*-E.height,1]);return o.ad.mat4.translate(I,I,[1,-1,0]),o.ad.mat4.multiply(I,I,E.calculateProjMatrix(M.toUnwrapped())),Float32Array.from(I)}(f,this.tileID);return this.latestFeatureIndex.query(t,{tilespaceGeometry:r,pixelPosMatrix:T,transform:d,availableImages:c,tileTransform:this.tileTransform})}querySourceFeatures(t,r){const c=this.latestFeatureIndex;if(!c||!c.rawTileData)return;const d=c.loadVTLayers(),f=r?r.sourceLayer:"",_=d._geojsonTileLayer||d[f];if(!_)return;const T=o.a_(r&&r.filter),{z:E,x:M,y:I}=this.tileID.canonical,P={z:E,x:M,y:I};for(let R=0;R<_.length;R++){const O=_.feature(R);if(T.needGeometry){const U=o.a$(O,!0);
vendor: 5,572 bytes, line 21
21if(!T.filter(new o.aa(this.tileID.overscaledZ),U,this.tileID.canonical))continue}else if(!T.filter(new o.aa(this.tileID.overscaledZ),O))continue;const N=c.getId(O,f),F=new o.b0(O,E,M,I,N);F.tile=P,t.push(F)}}loaded(){return this.state==="loaded"||this.state==="errored"}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return!!this.imageAtlas&&!!this.imageAtlas.patternPositions.size}setExpiryData(t){const r=this.expirationTime;if(t.cacheControl){const c=o.b1(t.cacheControl);c["max-age"]&&(this.expirationTime=Date.now()+1e3*c["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const c=Date.now();let d=!1;if(this.expirationTime>c)d=!1;else if(r)if(this.expirationTime<r)d=!0;else{const f=this.expirationTime-r;f?this.expirationTime=c+Math.max(f,3e4):d=!0}else d=!0;d?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}refreshFeatureState(t){this.latestFeatureIndex&&(this.latestFeatureIndex.rawTileData||this.latestFeatureIndex.is3DTile)&&t&&this.updateBuckets(t)}updateBuckets(t,r){if(!this.latestFeatureIndex||!t.style)return;const c=this.latestFeatureIndex.loadVTLayers(),d=t.style.listImages(),f=t.style.getBrightness();for(const _ in this.buckets){if(!t.style.hasLayer(_))continue;const T=this.buckets[_],E=T.layers[0],M=E.sourceLayer||"_geojsonTileLayer",I=c[M],P=t.style.getLayerSourceCache(E);let R={};P&&(R=P._state.getState(M,void 0));const O=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},N=Object.keys(R).length>0&&!r;N&&!T.stateDependentLayers.length&&!r||T.update(R,I,d,O,N?T.stateDependentLayers:T.layers,r,f),(T instanceof o.b2||T instanceof o.b3)&&t._terrain&&t._terrain.enabled&&P&&T.uploadPending()&&t._terrain._clearRenderCacheForTile(P.id,this.tileID);const F=t&&t.style&&t.style.getOwnLayer(_);F&&(this.queryPadding=Math.max(this.queryPadding,F.queryRadius(T)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<o.q.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=o.q.now()+t}setTexture(t,r){const c=r.context,d=c.gl;this.texture=this.texture||r.getTileTexture(t.width),this.texture&&this.texture instanceof o.T?this.texture.update(t):(this.texture=new o.T(c,t,d.RGBA8,{useMipmap:!0}),this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE))}setDependencies(t,r){const c={};for(const d of r)c[d]=!0;this.dependencies[t]=c}hasDependency(t,r){for(const c of t){const d=this.dependencies[c];if(d){for(const f of r)if(d[f])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(t,r){if(!r||r.name==="mercator"||this._tileDebugBuffer)return;const c=o.b4(zl,this.tileID.canonical,this.tileTransform)[0],d=new o.b5,f=new o.b6;for(let _=0;_<c.length;_++){const{x:T,y:E}=c[_];d.emplaceBack(T,E),f.emplaceBack(_)}f.emplaceBack(0),this._tileDebugIndexBuffer=t.createIndexBuffer(f),this._tileDebugBuffer=t.createVertexBuffer(d,o.b7.members),this._tileDebugSegments=o.b8.simpleSegment(0,0,d.length,f.length)}_makeTileBoundsBuffers(t,r){if(this._tileBoundsBuffer||!r||r.name==="mercator")return;const c=o.b4(zl,this.tileID.canonical,this.tileTransform)[0];let d,f;if(this.isRaster){const _=function(T,E){const M=o.aR(T,E),I=Math.pow(2,T.z);for(let U=0;U<On;U++)for(let q=0;q<On;q++){const Z=o.aS((T.x+(q+Xc(q))/hn)/I),J=o.aT((T.y+(U+Xc(U))/hn)/I),K=E.project(Z,J),oe=U*On+q;dn[2*oe+0]=Math.round((K.x*M.scale-M.x)*o.ai),dn[2*oe+1]=Math.round((K.y*M.scale-M.y)*o.ai)}tn.fill(0),Do.fill(0);for(let U=2045;U>=0;U--){const q=4*U,Z=ks[q+0],J=ks[q+1],K=ks[q+2],oe=ks[q+3],te=Z+K>>1,ie=J+oe>>1,re=te+ie-J,ue=ie+Z-te,me=J*On+Z,Le=oe*On+K,Ee=ie*On+te,Ze=Math.hypot((dn[2*me+0]+dn[2*Le+0])/2-dn[2*Ee+0],(dn[2*me+1]+dn[2*Le+1])/2-dn[2*Ee+1])>=16;tn[Ee]=tn[Ee]||(Ze?1:0),U<1022&&(tn[Ee]=tn[Ee]||tn[(J+ue>>1)*On+(Z+re>>1)]||tn[(oe+ue>>1)*On+(K+re>>1)])}const P=new o.aU,R=new o.aV;let O=0;function N(U,q){const Z=q*On+U;return Do[Z]===0&&(P.emplaceBack(dn[2*Z+0],dn[2*Z+1],U*o.ai/hn,q*o.ai/hn),Do[Z]=++O),Do[Z]-1}function F(U,q,Z,J,K,oe){const te=U+Z>>1,ie=q+J>>1;if(Math.abs(U-K)+Math.abs(q-oe)>1&&tn[ie*On+te])F(K,oe,U,q,te,ie),F(Z,J,K,oe,te,ie);else{const re=N(U,q),ue=N(Z,J),me=N(K,oe);R.emplaceBack(re,ue,me)}}return F(0,0,hn,hn,hn,0),F(hn,hn,0,0,0,hn),{vertices:P,indices:R}}(this.tileID.canonical,r);d=_.vertices,f=_.indices}else{d=new o.aU,f=new o.aV;for(const{x:T,y:E}of c)d.emplaceBack(T,E,0,0);const _=o.b9(d.int16,void 0,4);for(let T=0;T<_.length;T+=3)f.emplaceBack(_[T],_[T+1],_[T+2])}this._tileBoundsBuffer=t.createVertexBuffer(d,o.ba.members),this._tileBoundsIndexBuffer=t.createIndexBuffer(f),this._tileBoundsSegments=o.b8.simpleSegment(0,0,d.length,f.length)}_makeGlobeTileDebugBuffers(t,r){const c=r.projection;if(!c||c.name!=="globe"||r.freezeTileCoverage)return;const d=this.tileID.canonical,f=o.bb(d,r),_=o.bc(f),T=o.ag(r.zoom);let E;T>0&&(E=o.ad.mat4.invert(new Float64Array(16),r.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(t,d,r,_,E,T),this._makeGlobeTileDebugTextBuffer(t,d,r,_,E,T)}_globePoint(t,r,c,d,f,_,T){let E=o.bd(t,r,c);if(_){const M=1<<c.z,I=o.av(d.center.lng),P=o.aC(d.center.lat),R=(c.x+.5)/M-I;let O=0;R>.5?O=-1:R<-.5&&(O=1);let N=(t/o.ai+c.x)/M+O,F=(r/o.ai+c.y)/M;N=(N-I)*d._pixelsPerMercatorPixel+I,F=(F-P)*d._pixelsPerMercatorPixel+P;
21const U=[N*d.worldSize,F*d.worldSize,0];o.ad.vec3.transformMat4(U,U,_),E=o.be(E,U,T)}return o.ad.vec3.transformMat4(E,E,f)}_makeGlobeTileDebugBorderBuffer(t,r,c,d,f,_){const T=new o.b5,E=new o.b6,M=new o.bf,I=(R,O,N,F,U)=>{const q=(N-R)/(U-1),Z=(F-O)/(U-1),J=T.length;for(let K=0;K<U;K++){const oe=R+K*q,te=O+K*Z;T.emplaceBack(oe,te);const ie=this._globePoint(oe,te,r,c,d,f,_);M.emplaceBack(ie[0],ie[1],ie[2]),E.emplaceBack(J+K)}},P=o.ai;I(0,0,P,0,16),I(P,0,P,P,16),I(P,P,0,P,16),I(0,P,0,0,16),this._tileDebugIndexBuffer=t.createIndexBuffer(E),this._tileDebugBuffer=t.createVertexBuffer(T,o.b7.members),this._globeTileDebugBorderBuffer=t.createVertexBuffer(M,o.bg.members),this._tileDebugSegments=o.b8.simpleSegment(0,0,T.length,E.length)}_makeGlobeTileDebugTextBuffer(t,r,c,d,f,_){const T=o.ai/4,E=new o.b5,M=new o.aV,I=new o.bf,P=25;M.reserve(32),E.reserve(P),I.reserve(P);const R=(O,N)=>P*O+N;for(let O=0;O<P;O++){const N=O*T;for(let F=0;F<P;F++){const U=F*T;E.emplaceBack(U,N);const q=this._globePoint(U,N,r,c,d,f,_);I.emplaceBack(q[0],q[1],q[2])}}for(let O=0;O<4;O++)for(let N=0;N<4;N++){const F=R(O,N),U=R(O,N+1),q=R(O+1,N),Z=R(O+1,N+1);M.emplaceBack(F,U,q),M.emplaceBack(q,U,Z)}this._tileDebugTextIndexBuffer=t.createIndexBuffer(M),this._tileDebugTextBuffer=t.createVertexBuffer(E,o.b7.members),this._globeTileDebugTextBuffer=t.createVertexBuffer(I,o.bg.members),this._tileDebugTextSegments=o.b8.simpleSegment(0,0,P,32)}destroy(t=!1){for(const r in this.buckets)this.buckets[r].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&(this.imageAtlasTexture.destroy(),delete this.imageAtlasTexture),this.glyphAtlasTexture&&(this.glyphAtlasTexture.destroy(),delete this.glyphAtlasTexture),this.lineAtlasTexture&&(this.lineAtlasTexture.destroy(),delete this.lineAtlasTexture),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),!t&&this.texture&&this.texture instanceof o.T&&(this.texture.destroy(),delete this.texture),this.hillshadeFBO&&(this.hillshadeFBO.destroy(),delete this.hillshadeFBO),this.dem&&delete this.dem,this.neighboringTiles&&delete this.neighboringTiles,this.demTexture&&(this.demTexture.destroy(),delete this.demTexture),this.rasterParticleState&&(this.rasterParticleState.destroy(),delete this.rasterParticleState),this.latestFeatureIndex=null,this.state="unloaded"}}o.bh.setPbf(o.bi);class Xr extends kn{constructor(t,r,c,d,f){super(t,r,c,d,f),this._workQueue=[],this._fetchQueue=[],this._isHeaderLoaded=!1}getLayers(){return this._mrt?Object.values(this._mrt.layers):[]}getLayer(t){return this._mrt&&this._mrt.getLayer(t)}setTexture(t,r){const c=r.context,d=c.gl;this.texture=this.texture||r.getTileTexture(t.width),this.texture&&this.texture instanceof o.T?this.texture.update(t,{premultiply:!1}):this.texture=new o.T(c,t,d.RGBA8,{premultiply:!1})}flushQueues(){for(;this._workQueue.length;)this._workQueue.pop()();for(;this._fetchQueue.length;)this._fetchQueue.pop()()}fetchHeader(t=16384,r){const c=this._mrt=new o.bh(30),d=Object.assign({},this.requestParams,{headers:{Range:"bytes=0-"+(t-1)}});return this.entireBuffer=null,this.request=o.bj(d,(f,_,T,E)=>{if(f)r(f);else try{const M=c.getHeaderLength(_);if(M>t)return void(this.request=this.fetchHeader(M,r));c.parseHeader(_),this._isHeaderLoaded=!0;let I=0;for(const P of Object.values(c.layers))I=Math.max(I,P.dataIndex[P.dataIndex.length-1].lastByte);_.byteLength>=I&&(this.entireBuffer=_),r(null,this.entireBuffer||_,T,E)}catch(M){r(M)}}),this.request}fetchBand(t,r,c){const d=this._mrt;if(!this._isHeaderLoaded||!d)return void c(new Error("Tile header is not ready"));const f=this.actor;if(!f)return void c(new Error("Can't fetch tile band without an actor"));let _;const T=(P,R)=>
21{_.complete(P,R),P?c(P):(this.updateTextureDescriptor(t,r),c(null,this.textureDescriptor&&this.textureDescriptor.img))},E=(P,R)=>{if(P)return c(P);const O=f.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:R,task:_},T,void 0,!0);this._workQueue.push(()=>{O&&O.cancel(),_.cancel()})},M=d.getLayer(t);if(!M)return void c(new Error(`Unknown sourceLayer "${t}"`));if(M.hasDataForBand(r))return this.updateTextureDescriptor(t,r),void c(null,this.textureDescriptor?this.textureDescriptor.img:null);const I=M.getDataRange([r]);if(_=d.createDecodingTask(I),!_||_.tasks.length)if(this.flushQueues(),this.entireBuffer)E(null,this.entireBuffer.slice(I.firstByte,I.lastByte+1));else{const P=Object.assign({},this.requestParams,{headers:{Range:`bytes=${I.firstByte}-${I.lastByte}`}}),R=o.bj(P,E);this._fetchQueue.push(()=>{R.cancel(),_.cancel()})}else c(null)}updateNeeded(t,r){return(!this.textureDescriptor||this.textureDescriptor.band!==r||this.textureDescriptor.layer!==t)&&this.state!=="errored"}updateTextureDescriptor(t,r){if(!this._mrt)return;const c=this._mrt.getLayer(t);if(!c||!c.hasBand(r)||!c.hasDataForBand(r))return;const{bytes:d,tileSize:f,buffer:_,offset:T,scale:E}=c.getBandView(r),M=f+2*_,I=new o.r({width:M,height:M},d),P=this.texture;P&&P instanceof o.T&&P.update(I,{premultiply:!1}),this.textureDescriptor={layer:t,band:r,img:I,buffer:_,offset:T,tileSize:f,format:c.pixelFormat,mix:[E,256*E,65536*E,16777216*E]}}}class Zh{constructor(t,r){this.max=t,this.onRemove=r,this.reset()}reset(){for(const t in this.data)for(const r of this.data[t])r.timeout&&clearTimeout(r.timeout),this.onRemove(r.value);return this.data={},this.order=[],this}add(t,r,c){const d=t.wrapped().key;this.data[d]===void 0&&(this.data[d]=[]);const f={value:r,timeout:void 0};if(c!==void 0&&(f.timeout=setTimeout(()=>{this.remove(t,f)},c)),this.data[d].push(f),this.order.push(d),this.order.length>this.max){const _=this._getAndRemoveByKey(this.order[0]);_&&this.onRemove(_)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const r=this.data[t].shift();return r.timeout&&clearTimeout(r.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),r.value}getByKey(t){const r=this.data[t];return r?r[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,r){if(!this.has(t))return this;const c=t.wrapped().key,d=r===void 0?0:this.data[c].indexOf(r),f=this.data[c][d];return this.data[c].splice(d,1),f.timeout&&clearTimeout(f.timeout),this.data[c].length===0&&delete this.data[c],this.onRemove(f.value),this.order.splice(this.order.indexOf(c),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const r=this._getAndRemoveByKey(this.order[0]);r&&this.onRemove(r)}return this}filter(t){const r=[];for(const c in this.data)for(const d of this.data[c])t(d.value)||r.push(d);for(const c of r)this.remove(c.value.tileID,c)}}class Yc{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,r,c){const d=String(r);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][d]=this.stateChanges[t][d]||{},o.l(this.stateChanges[t][d],c),this.deletedStates[t]===null){this.deletedStates[t]={};for(const f in this.state[t])f!==d&&(this.deletedStates[t][f]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][d]===null){this.deletedStates[t][d]={};for(const f in this.state[t][d])c[f]||(this.deletedStates[t][d][f]=null)}else for(const f in c)this.deletedStates[t]&&this.deletedStates[t][d]&&this.deletedStates[t][d][f]===null&&delete this.deletedStates[t][d][f]}removeFeatureState(t,r,c){if(this.deletedStates[t]===null)return;const d=String(r);if(this.deletedStates[t]=this.deletedStates[t]||{},c&&r!==void 0)this.deletedStates[t][d]!==null&&(this.deletedStates[t][d]=this.deletedStates[t][d]||{},this.deletedStates[t][d][c]=null);else if(r!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][d])for(c in this.deletedStates[t][d]={},this.stateChanges[t][d])this.deletedStates[t][d][c]=null;else this.deletedStates[t][d]=null;else this.deletedStates[t]=null}getState(t,r){const c=this.state[t]||{},d=this.stateChanges[t]||{},f=this.deletedStates[t];if(f===null)return{};if(r!==void 0){const T=String(r),E=o.l({},c[T],d[T]);if(f){const M=f[r];if(M===null)return{};for(const I in M)delete E[I]}return E}const _=o.l({},c,d);if(f)for(const T in f)delete _[T];return _}initializeTileState(t,r){t.refreshFeatureState(r)}coalesceChanges(t,r){const c={};for(const d in this.stateChanges){this.state[d]=this.state[d]||{};const f={};for(const _ in this.stateChanges[d])this.state[d][_]||(this.state[d][_]={}),o.l(this.state[d][_],this.stateChanges[d][_]),f[_]=this.state[d][_];c[d]=f}for(const d in this.deletedStates){this.state[d]=this.state[d]||{};const f={};if(this.deletedStates[d]===null)for(const _ in this.state[d])f[_]={},this.state[d][_]={};else for(const _ in this.deletedStates[d]){if(this.deletedStates[d][_]===null)this.state[d][_]={};else if(this.state[d][_])for(const T of Object.keys(this.deletedStates[d][_]))delete this.state[d][_][T];f[_]=this.state[d][_]}c[d]=c[d]||{},o.l(c[d],f)}if(this.stateChanges={},this.deletedStates={},Object.keys(c).length!==0)for(const d in t)t[d].refreshFeatureState(r)}}class Sn extends o.E{constructor(t,r,c){super(),this.id=t,this._onlySymbols=c,r.on("data",d=>{d.dataType==="source"&&d.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&d.dataType==="source"&&d.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),r.on("error",()=>{this._sourceErrored=!0}),this._source=r,this._tiles={},this._cache=new Zh(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={}
vendor: 4,500 bytes, line 21
21,this._minTileCacheSize=r.minTileCacheSize,this._maxTileCacheSize=r.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new Yc,this._isRaster=this._source.type==="raster"||this._source.type==="raster-dem"||this._source.type==="raster-array"||this._source.type==="custom"&&this._source._dataType==="raster"}onAdd(t){this.map=t,this._minTileCacheSize=this._minTileCacheSize===void 0&&t?t._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&t?t._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const t in this._tiles)if(!this._tiles[t].loaded())return!1;return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(t,r){return t.isSymbolTile=this._onlySymbols,t.isExtraShadowCaster=this._shadowCasterTiles[t.tileID.key],this._source.loadTile(t,r)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t)}_abortTile(t){if(this._source.abortTile)return this._source.abortTile(t)}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const r in this._tiles){const c=this._tiles[r];c.upload(t),c.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(Mi).map(t=>t.key)}getRenderableIds(t,r){const c=[];for(const d in this._tiles)this._isIdRenderable(+d,t,r)&&c.push(this._tiles[d]);return t?c.sort((d,f)=>{const _=d.tileID,T=f.tileID,E=new o.P(_.canonical.x,_.canonical.y)._rotate(this.transform.angle),M=new o.P(T.canonical.x,T.canonical.y)._rotate(this.transform.angle);return _.overscaledZ-T.overscaledZ||M.y-E.y||M.x-E.x}).map(d=>d.tileID.key):c.map(d=>d.tileID).sort(Mi).map(d=>d.key)}hasRenderableParent(t){const r=this.findLoadedParent(t,0);return!!r&&this._isIdRenderable(r.tileID.key)}_isIdRenderable(t,r,c){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(r||!this._tiles[t].holdingForFade())&&(c||!this._shadowCasterTiles[t])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(+t,"reloading")}}_reloadTile(t,r){const c=this._tiles[t];c&&(c.state!=="loading"&&(c.state=r),this._loadTile(c,this._tileLoaded.bind(this,c,t,r)))}_tileLoaded(t,r,c,d){if(d)if(t.state="errored",d.status!==404)this._source.fire(new o.z(d,{tile:t}));else{if(this._source.fire(new o.A("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:t})),!(t.tileID.key in this._loadedParentTiles))return;if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const f=this.map.painter.terrain;this.update(this.transform,f.getScaledDemTileSize(),!0),f.resetTileLookupCache(this.id)}else this.update(this.transform)}else t.timeAdded=o.q.now(),c==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(r,t),this._source.type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),this._source.fire(new o.A("data",{dataType:"source",tile:t,coord:t.tileID,sourceCacheId:this.id}))}_backfillDEM(t){const r=this.getRenderableIds();for(let d=0;d<r.length;d++){const f=r[d];if(t.neighboringTiles&&t.neighboringTiles[f]){const _=this.getTileByID(f);c(t,_),c(_,t)}}function c(d,f){if(!d.dem||d.dem.borderReady)return;d.needsHillshadePrepare=!0,d.needsDEMTextureUpload=!0;let _=f.tileID.canonical.x-d.tileID.canonical.x;const T=f.tileID.canonical.y-d.tileID.canonical.y,E=Math.pow(2,d.tileID.canonical.z),M=f.tileID.key;_===0&&T===0||Math.abs(T)>1||(Math.abs(_)>1&&(Math.abs(_+E)===1?_+=E:Math.abs(_-E)===1&&(_-=E)),f.dem&&d.dem&&(d.dem.backfillBorder(f.dem,_,T),d.neighboringTiles&&d.neighboringTiles[M]&&(d.neighboringTiles[M].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,r,c,d){for(const f in this._tiles){let _=this._tiles[f];if(d[f]||!_.hasData()||_.tileID.overscaledZ<=r||_.tileID.overscaledZ>c)continue;let T=_.tileID;for(;_&&_.tileID.overscaledZ>
21r+1;){const M=_.tileID.scaledTo(_.tileID.overscaledZ-1);_=this._tiles[M.key],_&&_.hasData()&&(T=M)}let E=T;for(;E.overscaledZ>r;)if(E=E.scaledTo(E.overscaledZ-1),t[E.key]){d[T.key]=T;break}}}findLoadedParent(t,r){if(t.key in this._loadedParentTiles){const c=this._loadedParentTiles[t.key];return c&&c.tileID.overscaledZ>=r?c:null}for(let c=t.overscaledZ-1;c>=r;c--){const d=t.scaledTo(c),f=this._getLoadedTile(d);if(f)return f}}_getLoadedTile(t){const r=this._tiles[t.key];return r&&r.hasData()?r:this._cache.getByKey(this._source.reparseOverscaled?t.wrapped().key:t.canonical.key)}updateCacheSize(t,r){r=r||this._source.tileSize;const c=Math.ceil(t.width/r)+1,d=Math.ceil(t.height/r)+1,f=Math.floor(c*d*5),_=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,f):f,T=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,_):_;this._cache.setMaxSize(T)}handleWrapJump(t){const r=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,r){const c={};for(const d in this._tiles){const f=this._tiles[d];f.tileID=f.tileID.unwrapTo(f.tileID.wrap+r),c[f.tileID.key]=f}this._tiles=c;for(const d in this._timers)clearTimeout(this._timers[d]),delete this._timers[d];for(const d in this._tiles)this._setTileReloadTimer(+d,this._tiles[d])}}update(t,r,c,d){if(this.transform=t,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!c)return;this.updateCacheSize(t,r),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const f=this._source.type==="batched-model";let _,T=this._source.maxzoom;const E=this.map&&this.map.painter?this.map.painter._terrain:null;if(E&&E.sourceCache===this&&E.attenuationRange()){const P=E.attenuationRange()[0],R=Math.floor(P)-Math.log2(E.getDemUpscale());T>R&&(T=R)}if(this.used||this.usedForTerrain){if(this._source.tileID)_=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(P=>new o.aH(P.canonical.z,P.wrap,P.canonical.z,P.canonical.x,P.canonical.y));else if(this.tileCoverLift!==0){const P=t.clone();P.tileCoverLift=this.tileCoverLift,_=P.coveringTiles({tileSize:r||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:T,roundZoom:this._source.roundZoom&&!c,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:f}),this._source.minzoom<=1&&t.projection.name==="globe"&&(_.push(new o.aH(1,0,1,0,0)),_.push(new o.aH(1,0,1,1,0)),_.push(new o.aH(1,0,1,0,1)),_.push(new o.aH(1,0,1,1,1)))}else if(_=t.coveringTiles({tileSize:r||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:T,roundZoom:this._source.roundZoom&&!c,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:f}),this._source.hasTile){const P=this._source.hasTile.bind(this._source);_=_.filter(R=>P(R))}}else _=[];if(_.length>0&&this.castsShadows&&d&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!Kc(this._source.type)){const P=t.coveringZoomLevel({tileSize:r||this._source.tileSize,roundZoom:this._source.roundZoom&&!c}),R=Math.min(P,this._source.maxzoom);if(f){const O=t.extendTileCover(_,R);for(const N of O)_.push(N)}else{const O=t.extendTileCover(_,R,d);for(const N of O)this._shadowCasterTiles[N.key]=!0,_.push(N)}}const M=this._updateRetainedTiles(_);if(Kc(this._source.type)&&_.length!==0){const P={},R={},O=Object.keys(M);for(const F of O){const U=M[F],q=this._tiles[F];if(!q||q.fadeEndTime&&q.fadeEndTime<=o.q.now())continue;const Z=this.findLoadedParent(U,Math.max(U.overscaledZ-Sn.maxOverzooming,this._source.minzoom));Z&&(this._addTile(Z.tileID),P[Z.tileID.key]=Z.tileID),R[F]=U}const N=_[_.length-1].overscaledZ;for(const F in this._tiles){const U=this._tiles[F];if(M[F]||!U.hasData())continue;let q=U.tileID;for(;q.overscaledZ>N;){q=q.scaledTo(q.overscaledZ-1);const Z=this._tiles[q.key];if(Z&&Z.hasData()&&R[q.key]){M[F]=U.tileID;break}}}for(const F in P)M[F]||(this._coveredTiles[F]=!0,M[F]=P[F])}for(const P in M)this._tiles[P].clearFadeHold();const I=o.bk(this._tiles,M);for(const P of I){const R=this._tiles[P];R.hasSymbolBuckets&&!R.holdingForFade()?R.setHoldDuration(this.map._fadeDuration):R.hasSymbolBuckets&&!R.symbolFadeFinished()||this._removeTile(+P)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(+t)}_updateRetainedTiles(t){const r={};if(t.length===0)return r;const c={},d=t.reduce((M,I)=>
vendor: 4,319 bytes, line 21
21Math.min(M,I.overscaledZ),1/0),f=t[0].overscaledZ,_=Math.max(f-Sn.maxOverzooming,this._source.minzoom),T=Math.max(f+Sn.maxUnderzooming,this._source.minzoom),E={};for(const M of t){const I=this._addTile(M);r[M.key]=M,I.hasData()||d<this._source.maxzoom&&(E[M.key]=M)}this._retainLoadedChildren(E,d,T,r);for(const M of t){let I=this._tiles[M.key];if(I.hasData())continue;if(M.canonical.z>=this._source.maxzoom){const R=M.children(this._source.maxzoom)[0],O=this.getTile(R);if(O&&O.hasData()){r[R.key]=R;continue}}else{const R=M.children(this._source.maxzoom);if(r[R[0].key]&&r[R[1].key]&&r[R[2].key]&&r[R[3].key])continue}let P=I.wasRequested();for(let R=M.overscaledZ-1;R>=_;--R){const O=M.scaledTo(R);if(c[O.key]||(c[O.key]=!0,I=this.getTile(O),!I&&P&&(I=this._addTile(O)),I&&(r[O.key]=O,P=I.wasRequested(),I.hasData())))break}}return r}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const r=[];let c,d=this._tiles[t].tileID;for(;d.overscaledZ>0;){if(d.key in this._loadedParentTiles){c=this._loadedParentTiles[d.key];break}r.push(d.key);const f=d.scaledTo(d.overscaledZ-1);if(c=this._getLoadedTile(f),c)break;d=f}for(const f of r)this._loadedParentTiles[f]=c}}_addTile(t){let r=this._tiles[t.key];if(r)return r.isExtraShadowCaster!==!0||this._shadowCasterTiles[t.key]||this._reloadTile(t.key,"reloading"),r;r=this._cache.getAndRemove(t),r&&(this._setTileReloadTimer(t.key,r),r.tileID=t,this._state.initializeTileState(r,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,r)));const c=!!r;if(!c){const d=this.map?this.map.painter:null,f=this._source.tileSize*t.overscaleFactor();r=this._source.type==="raster-array"?new Xr(t,f,this.transform.tileZoom,d,this._isRaster):new kn(t,f,this.transform.tileZoom,d,this._isRaster),this._loadTile(r,this._tileLoaded.bind(this,r,t.key,r.state))}return r?(r.uses++,this._tiles[t.key]=r,c||this._source.fire(new o.A("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r):null}_setTileReloadTimer(t,r){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const c=r.getExpiryTimeout();c&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},c))}_removeTile(t){const r=this._tiles[t];r&&(r.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),r.uses>0||(r.hasData()&&r.state!=="reloading"||r.state==="empty"?this._cache.add(r.tileID,r,r.getExpiryTimeout()):(r.aborted=!0,this._abortTile(r),this._unloadTile(r))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(+t);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(t,r,c){const d=[],f=this.transform;if(!f)return d;const _=f.projection.name==="globe",T=o.av(f.center.lng);for(const E in this._tiles){const M=this._tiles[E];if(c&&M.clearQueryDebugViz(),M.holdingForFade())continue;let I;if(_){const P=M.tileID.canonical;if(P.z===0){const R=[Math.abs(o.ay(T,...Ot(P,-1))-T),Math.abs(o.ay(T,...Ot(P,1))-T)];I=[0,2*R.indexOf(Math.min(...R))-1]}else{const R=[Math.abs(o.ay(T,...Ot(P,-1))-T),Math.abs(o.ay(T,...Ot(P,0))-T),Math.abs(o.ay(T,...Ot(P,1))-T)];I=[R.indexOf(Math.min(...R))-1]}}else I=[0];for(const P of I){const R=t.containsTile(M,f,r,P);R&&d.push(R)}}return d}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(t){return this._getRenderableCoordinates(t)}_getRenderableCoordinates(t,r){const c=this.getRenderableIds(t,r).map(f=>this._tiles[f].tileID),d=this.transform.projection.name==="globe";for(const f of c)f.projMatrix=this.transform.calculateProjMatrix(f.toUnwrapped()),f.expandedProjMatrix=d?this.transform.calculateProjMatrix(f.toUnwrapped(),!1,!0):f.projMatrix;return c}sortCoordinatesByDistance(t){const r=t.slice(),c=this.transform._camera.position,d=this.transform._camera.forward(),f={};for(const _ of r){const T=1/(1<<_.canonical.z);f[_.key]=((_.canonical.x+.5)*T+_.wrap-c[0])*d[0]+((_.canonical.y+.5)*T-c[1])*d[1]-c[2]*d[2]}return r.sort((_,T)=>f[_.key]-f[T.key]),r}hasTransition(){if(this._source.hasTransition())return!0;
21if(Kc(this._source.type))for(const t in this._tiles){const r=this._tiles[t];if(r.fadeEndTime!==void 0&&r.fadeEndTime>=o.q.now())return!0}return!1}setFeatureState(t,r,c){this._state.updateState(t=t||"_geojsonTileLayer",r,c)}removeFeatureState(t,r,c){this._state.removeFeatureState(t=t||"_geojsonTileLayer",r,c)}getFeatureState(t,r){return this._state.getState(t=t||"_geojsonTileLayer",r)}setDependencies(t,r,c){const d=this._tiles[t];d&&d.setDependencies(r,c)}reloadTilesForDependencies(t,r){for(const c in this._tiles)this._tiles[c].hasDependency(t,r)&&this._reloadTile(+c,"reloading");this._cache.filter(c=>!c.hasDependency(t,r))}_preloadTiles(t,r){if(!this._sourceLoaded){const E=()=>{this._sourceLoaded&&(this._source.off("data",E),this._preloadTiles(t,r))};return void this._source.on("data",E)}const c=new Map,d=Array.isArray(t)?t:[t],f=this.map.painter.terrain,_=this.usedForTerrain&&f?f.getScaledDemTileSize():this._source.tileSize;for(const E of d){const M=E.coveringTiles({tileSize:_,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const I of M)c.set(I.key,I);this.usedForTerrain&&E.updateElevation(!1)}const T=Array.from(c.values());o.bl(T,(E,M)=>{const I=new kn(E,this._source.tileSize*E.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(I,P=>{this._source.type==="raster-dem"&&I.dem&&this._backfillDEM(I),M(P,I)})},r)}}function Mi(u,t){const r=Math.abs(2*u.wrap)-+(u.wrap<0),c=Math.abs(2*t.wrap)-+(t.wrap<0);return u.overscaledZ-t.overscaledZ||c-r||t.canonical.y-u.canonical.y||t.canonical.x-u.canonical.x}function Kc(u){return u==="raster"||u==="image"||u==="video"||u==="custom"}function Ot(u,t){const r=1<<u.z;return[u.x/r+t,(u.x+1)/r+t]}Sn.maxOverzooming=10,Sn.maxUnderzooming=3;class Wh{constructor(t){this.style=t,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){this.layers=[];const t=!1,r=!1;for(const c in this.style._mergedLayers){const d=this.style._mergedLayers[c];if(d.type==="fill-extrusion")this.layers.push({layer:d,visible:t,visibilityChanged:r});else if(d.type==="model"){const f=this.style.getLayerSource(d);f&&f.type==="batched-model"&&this.layers.push({layer:d,visible:t,visibilityChanged:r})}}}onNewFrame(t){this.layersGotHidden=!1;for(const r of this.layers){const c=r.layer;let d=!1;c.type==="fill-extrusion"?d=!c.isHidden(t)&&c.paint.get("fill-extrusion-opacity")>0:c.type==="model"&&(d=!c.isHidden(t)&&c.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!d&&r.visible,r.visible=d}}updateZOffset(t,r){this.currentBuildingBuckets=[];for(const d of this.layers){const f=d.layer,_=this.style.getLayerSourceCache(f);let T=1;f.type==="fill-extrusion"&&(T=d.visible?f.paint.get("fill-extrusion-vertical-scale"):0);let E=_?_.getTile(r):null;if(!E&&_&&r.canonical.z>_.getSource().minzoom){let M=r.scaledTo(Math.min(_.getSource().maxzoom,r.overscaledZ-1));for(;M.overscaledZ>=_.getSource().minzoom&&(E=_.getTile(M),!E&&M.overscaledZ!==0);)M=M.scaledTo(M.overscaledZ-1)}this.currentBuildingBuckets.push({bucket:E?E.getBucket(f):null,tileID:E?E.tileID:r,verticalScale:T})}t.hasAnyZOffset=!1;let c=!1;for(let d=0;d<t.symbolInstances.length;d++){const f=t.symbolInstances.get(d),_=f.zOffset,T=this._getHeightAtTileOffset(r,f.tileAnchorX,f.tileAnchorY);f.zOffset=T!==Number.NEGATIVE_INFINITY?T:_,c||_===f.zOffset||(c=!0),t.hasAnyZOffset||f.zOffset===0||(t.hasAnyZOffset=!0)}c&&(t.zOffsetBuffersNeedUpload=!0,t.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(t,r,c,d){let f=r,_=c;if(t.canonical.z!==d.canonical.z){const T=d.canonical,E=1/(1<<t.canonical.z-T.z);f=(r+t.canonical.x*o.ai)*E-T.x*o.ai|0,_=(c+t.canonical.y*o.ai)*E-T.y*o.ai|0}return{tileX:f,tileY:_}}_getHeightAtTileOffset(t,r,c){let d,f;for(let _=0;_<this.layers.length;++_){if(this.layers[_].layer.type!=="fill-extrusion")continue;const{bucket:T,tileID:E,verticalScale:M}=this.currentBuildingBuckets[_];if(!T)continue;const{tileX:I,tileY:P}=this._mapCoordToOverlappingTile(t,r,c,E),R=T.getHeightAtTileCoord(I,P);R&&R.height!==void 0&&(R.hidden?d=R.height:f=Math.max(R.height*M,f||0
21))}if(f!==void 0)return f;for(let _=0;_<this.layers.length;++_){const T=this.layers[_];if(T.layer.type!=="model"||!T.visible)continue;const{bucket:E,tileID:M}=this.currentBuildingBuckets[_];if(!E)continue;const{tileX:I,tileY:P}=this._mapCoordToOverlappingTile(t,r,c,M),R=E.getHeightAtTileCoord(I,P);if(R&&!R.hidden)return R.height===void 0&&d!==void 0?Math.min(R.maxHeight,d)*R.verticalScale:R.height?R.height*R.verticalScale:Number.NEGATIVE_INFINITY}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}function Xh(u,t){const r={};for(const c in u)c!=="ref"&&(r[c]=u[c]);return o.bm.forEach(c=>{c in t&&(r[c]=t[c])}),r}function Da(u){u=u.slice();const t=Object.create(null);for(let r=0;r<u.length;r++)t[u[r].id]=u[r];for(let r=0;r<u.length;r++)"ref"in u[r]&&(u[r]=Xh(u[r],t[u[r].ref]));return u}const _i={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setSlot:"setSlot",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog",setSnow:"setSnow",setRain:"setRain",setCamera:"setCamera",setLights:"setLights",setProjection:"setProjection",addImport:"addImport",removeImport:"removeImport",updateImport:"updateImport"};function En(u,t,r){r.push({command:_i.addSource,args:[u,t[u]]})}function Ll(u,t,r){t.push({command:_i.removeSource,args:[u]}),r[u]=!0}function Oo(u,t,r,c){Ll(u,r,c),En(u,t,r)}function At(u,t,r){let c;for(c in u[r])if(u[r].hasOwnProperty(c)&&c!=="data"&&!o.bn(u[r][c],t[r][c]))return!1;for(c in t[r])if(t[r].hasOwnProperty(c)&&c!=="data"&&!o.bn(u[r][c],t[r][c]))return!1;return!0}function Ti(u,t,r,c,d,f){let _;for(_ in t=t||{},u=u||{})u.hasOwnProperty(_)&&(o.bn(u[_],t[_])||r.push({command:f,args:[c,_,t[_],d]}));for(_ in t)t.hasOwnProperty(_)&&!u.hasOwnProperty(_)&&(o.bn(u[_],t[_])||r.push({command:f,args:[c,_,t[_],d]}))}function pi(u){return u.id}function Lr(u,t){return u[t.id]=t,u}class ko{constructor(t,r){this.reset(t,r)}reset(t,r){this.points=t||[],this._distances=[0];for(let c=1;c<this.points.length;c++)this._distances[c]=this._distances[c-1]+this.points[c].dist(this.points[c-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(r||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=o.ay(t,0,1);let r=1,c=this._distances[r];const d=t*this.paddedLength+this.padding;for(;c<d&&r<this._distances.length;)c=this._distances[++r];const f=r-1,_=this._distances[f],T=c-_,E=T>0?(d-_)/T:0;return this.points[f].mult(1-E).add(this.points[r].mult(E))}}class gi{constructor(t,r,c){const d=this.boxCells=[],f=this.circleCells=[];this.xCellCount=Math.ceil(t/c),this.yCellCount=Math.ceil(r/c);for(let _=0;_<this.xCellCount*this.yCellCount;_++)d.push([]),f.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=r,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/r,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,r,c,d,f){this._forEachCell(r,c,d,f,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(r),this.bboxes.push(c),this.bboxes.push(d),this.bboxes.push(f)}
21insertCircle(t,r,c,d){this._forEachCell(r-d,c-d,r+d,c+d,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(r),this.circles.push(c),this.circles.push(d)}_insertBoxCell(t,r,c,d,f,_){this.boxCells[f].push(_)}_insertCircleCell(t,r,c,d,f,_){this.circleCells[f].push(_)}_query(t,r,c,d,f,_){if(c<0||t>this.width||d<0||r>this.height)return!f&&[];const T=[];if(t<=0&&r<=0&&this.width<=c&&this.height<=d){if(f)return!0;for(let E=0;E<this.boxKeys.length;E++)T.push({key:this.boxKeys[E],x1:this.bboxes[4*E],y1:this.bboxes[4*E+1],x2:this.bboxes[4*E+2],y2:this.bboxes[4*E+3]});for(let E=0;E<this.circleKeys.length;E++){const M=this.circles[3*E],I=this.circles[3*E+1],P=this.circles[3*E+2];T.push({key:this.circleKeys[E],x1:M-P,y1:I-P,x2:M+P,y2:I+P})}return _?T.filter(_):T}return this._forEachCell(t,r,c,d,this._queryCell,T,{hitTest:f,seenUids:{box:{},circle:{}}},_),f?T.length>0:T}_queryCircle(t,r,c,d,f){const _=t-c,T=t+c,E=r-c,M=r+c;if(T<0||_>this.width||M<0||E>this.height)return!d&&[];const I=[];return this._forEachCell(_,E,T,M,this._queryCellCircle,I,{hitTest:d,circle:{x:t,y:r,radius:c},seenUids:{box:{},circle:{}}},f),d?I.length>0:I}query(t,r,c,d,f){return this._query(t,r,c,d,!1,f)}hitTest(t,r,c,d,f){return this._query(t,r,c,d,!0,f)}hitTestCircle(t,r,c,d){return this._queryCircle(t,r,c,!0,d)}_queryCell(t,r,c,d,f,_,T,E){const M=T.seenUids,I=this.boxCells[f];if(I!==null){const R=this.bboxes;for(const O of I)if(!M.box[O]){M.box[O]=!0;const N=4*O;if(t<=R[N+2]&&r<=R[N+3]&&c>=R[N+0]&&d>=R[N+1]&&(!E||E(this.boxKeys[O]))){if(T.hitTest)return _.push(!0),!0;_.push({key:this.boxKeys[O],x1:R[N],y1:R[N+1],x2:R[N+2],y2:R[N+3]})}}}const P=this.circleCells[f];if(P!==null){const R=this.circles;for(const O of P)if(!M.circle[O]){M.circle[O]=!0;const N=3*O;if(this._circleAndRectCollide(R[N],R[N+1],R[N+2],t,r,c,d)&&(!E||E(this.circleKeys[O]))){if(T.hitTest)return _.push(!0),!0;{const F=R[N],U=R[N+1],q=R[N+2];_.push({key:this.circleKeys[O],x1:F-q,y1:U-q,x2:F+q,y2:U+q})}}}}}_queryCellCircle(t,r,c,d,f,_,T,E){const M=T.circle,I=T.seenUids,P=this.boxCells[f];if(P!==null){const O=this.bboxes;for(const N of P)if(!I.box[N]){I.box[N]=!0;const F=4*N;if(this._circleAndRectCollide(M.x,M.y,M.radius,O[F+0],O[F+1],O[F+2],O[F+3])&&(!E||E(this.boxKeys[N])))return _.push(!0),!0}}const R=this.circleCells[f];if(R!==null){const O=this.circles;for(const N of R)if(!I.circle[N]){I.circle[N]=!0;const F=3*N;if(this._circlesCollide(O[F],O[F+1],O[F+2],M.x,M.y,M.radius)&&(!E||E(this.circleKeys[N])))return _.push(!0),!0}}}_forEachCell(t,r,c,d,f,_,T,E){const M=this._convertToXCellCoord(t),I=this._convertToYCellCoord(r),P=this._convertToXCellCoord(c),R=this._convertToYCellCoord(d);for(let O=M;O<=P;O++)for(let N=I;N<=R;N++)if(f.call(this,t,r,c,d,this.xCellCount*N+O,_,T,E))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,r,c,d,f,_){const T=d-t,E=f-r,M=c+_;return M*M>T*T+E*E}_circleAndRectCollide(t,r,c,d,f,_,T){const E=(_-d)/2,M=Math.abs(t-(d+E));if(M>E+c)return!1;const I=(T-f)/2,P=Math.abs(r-(f+I));if(P>I+c)return!1;if(M<=E||P<=I)return!0;const R=M-E,O=P-I;return R*R+O*O<=c*c}}const ls={unknown:0,flipRequired:1,flipNotRequired:2},Oa=Math.tan(85*Math.PI/180);function cs(u,t,r,c,d,f,_){const T=o.ad.mat4.create();if(r)if(f.name==="globe"){const E=o.bo(d,t);o.ad.mat4.multiply(T,T,E)}else{const E=o.ad.mat2.invert([],_);T[0]=E[0],T[1]=E[1],T[4]=E[2],T[5]=E[3],c||o.ad.mat4.rotateZ(T,T,d.angle)}else o.ad.mat4.multiply(T,d.labelPlaneMatrix,u);return T}function Ir(u,t,r,c,d,f,_){const T=cs(u,t,r,c,d,f,_);return f.name==="globe"&&r||(T[2]=T[6]=T[10]=T[14]=0),T}function er(u,t,r,c,d,f,_){if(r){if(f.name==="globe"){const T=cs(u,t,r,c,d,f,_);return o.ad.mat4.invert(T,T),o.ad.mat4.multiply(T,u,T),T}{const T=o.ad.mat4.clone(u),E=o.ad.mat4.identity([]);return E[0]=_[0],E[1]=_[1],E[4]=_[2],E[5]=_[3],o.ad.mat4.multiply(T,T,E),c||o.ad.mat4.rotateZ(T,T,-d.angle),T}}return d.glCoordMatrix}function Fn(u,t,r,c){const d=[u,t,r,1];r?o.ad.vec4.transformMat4(d,d,c):or(d,d,c);const f=d[3];return d[0]/=f,d[1]/=f,d[2]/=f,d}function Fo(u,t){return Math.min(.5+u/t*.5,1.5)}
21function Jc(u,t){const r=u[0]/u[3],c=u[1]/u[3];return r>=-t[0]&&r<=t[0]&&c>=-t[1]&&c<=t[1]}function Bo(u,t,r,c,d,f,_,T,E,M){const I=r.transform,P=c?u.textSizeData:u.iconSizeData,R=o.bp(P,r.transform.zoom),O=I.projection.name==="globe",N=[256/r.width*2+1,256/r.height*2+1],F=c?u.text.dynamicLayoutVertexArray:u.icon.dynamicLayoutVertexArray;F.clear();let U=null;O&&(U=c?u.text.globeExtVertexArray:u.icon.globeExtVertexArray);const q=u.lineVertexArray,Z=c?u.text.placedSymbolArray:u.icon.placedSymbolArray,J=r.transform.width/r.transform.height;let K,oe=!1;for(let te=0;te<Z.length;te++){const ie=Z.get(te),{numGlyphs:re,writingMode:ue}=ie;if(ue!==o.bq.vertical||oe||K===o.bq.horizontal||(oe=!0),K=ue,(ie.hidden||ue===o.bq.vertical)&&!oe){Bn(re,F);continue}oe=!1;const me=new o.P(ie.tileAnchorX,ie.tileAnchorY);let{x:Le,y:Ee,z:Ze}=I.projection.projectTilePoint(me.x,me.y,M.canonical);if(E){const[ft,mt,Et]=E(me);Le+=ft,Ee+=mt,Ze+=Et}const We=[Le,Ee,Ze,1];if(o.ad.vec4.transformMat4(We,We,t),!Jc(We,N)){Bn(re,F);continue}const ot=We[3],Se=Fo(r.transform.getCameraToCenterDistance(I.projection),ot),He=o.br(P,R,ie),we=_?He/Se:He*Se,$e=Fn(Le,Ee,Ze,d);if($e[3]<=0){Bn(re,F);continue}let Ve={};const Ke=o.ak(u.layers[0].layout.get("text-max-angle")),De=Math.cos(Ke),Qe=_?null:E,pt=Dr(ie,we,!1,T,t,d,f,u.glyphOffsetArray,q,F,U,$e,me,Ve,J,Qe,I.projection,M,_,De);oe=pt.useVertical,Qe&&pt.needsFlipping&&(Ve={}),(pt.notEnoughRoom||oe||pt.needsFlipping&&Dr(ie,we,!0,T,t,d,f,u.glyphOffsetArray,q,F,U,$e,me,Ve,J,Qe,I.projection,M,_,De).notEnoughRoom)&&Bn(re,F)}c?(u.text.dynamicLayoutVertexBuffer.updateData(F),U&&u.text.globeExtVertexBuffer&&u.text.globeExtVertexBuffer.updateData(U)):(u.icon.dynamicLayoutVertexBuffer.updateData(F),U&&u.icon.globeExtVertexBuffer&&u.icon.globeExtVertexBuffer.updateData(U))}function Dl(u,t,r,c,d,f,_,T,E,M,I,P,R,O,N,F,U){const{lineStartIndex:q,glyphStartIndex:Z,segment:J}=T,K=Z+T.numGlyphs,oe=q+T.lineLength,te=t.getoffsetX(Z),ie=t.getoffsetX(K-1),re=Fa(u*te,r,c,d,f,_,J,q,oe,E,M,I,P,R,!0,O,N,F,U);if(!re)return null;const ue=Fa(u*ie,r,c,d,f,_,J,q,oe,E,M,I,P,R,!0,O,N,F,U);return ue?{first:re,last:ue}:null}function ka(u,t,r,c){return u===o.bq.horizontal&&Math.abs(c)>Math.abs(r)?{useVertical:!0}:u===o.bq.vertical?c>0?{needsFlipping:!0}:null:t!==ls.unknown&&function(d,f){return d===0||Math.abs(f/d)>Oa}(r,c)?t===ls.flipRequired?{needsFlipping:!0}:null:r<0?{needsFlipping:!0}:null}function Dr(u,t,r,c,d,f,_,T,E,M,I,P,R,O,N,F,U,q,Z,J){const K=t/24,oe=u.lineOffsetX*K,te=u.lineOffsetY*K,{lineStartIndex:ie,glyphStartIndex:re,numGlyphs:ue,segment:me,writingMode:Le,flipState:Ee}=u,Ze=ie+u.lineLength,We=ot=>{if(I){const[$e,Ve,Ke]=ot.up,De=M.length;o.bs(I,De+0,$e,Ve,Ke),o.bs(I,De+1,$e,Ve,Ke),o.bs(I,De+2,$e,Ve,Ke),o.bs(I,De+3,$e,Ve,Ke)}const[Se,He,we]=ot.point;o.bt(M,Se,He,we,ot.angle)};if(ue>1){const ot=Dl(K,T,oe,te,r,P,R,u,E,f,O,F,!1,U,q,Z,J);if(!ot)return{notEnoughRoom:!0};if(c&&!r){let[Se,He,we]=ot.first.point,[$e,Ve,Ke]=ot.last.point;[Se,He]=Fn(Se,He,we,_),[$e,Ve]=Fn($e,Ve,Ke,_);const De=ka(Le,Ee,($e-Se)*N,Ve-He);if(u.flipState=De&&De.needsFlipping?ls.flipRequired:ls.flipNotRequired,De)return De}We(ot.first);for(let Se=re+1;Se<re+ue-1;Se++){const He=Fa(K*T.getoffsetX(Se),oe,te,r,P,R,me,ie,Ze,E,f,O,F,!1,!1,U,q,Z,J);if(!He)return M.length-=4*(Se-re),{notEnoughRoom:!0};We(He)}We(ot.last)}else{if(c&&!r){const Se=Fn(R.x,R.y,0,d),He=ie+me+1,we=new o.P(E.getx(He),E.gety(He)),$e=Fn(we.x,we.y,0,d),Ve=$e[3]>0?$e:Or(R,we,Se,1,d,void 0,U,q.canonical),Ke=ka(Le,Ee,(Ve[0]-Se[0])*N,Ve[1]-Se[1]);if(u.flipState=Ke&&Ke.needsFlipping?ls.flipRequired:ls.flipNotRequired,Ke)return Ke}const ot=Fa(K*T.getoffsetX(re),oe,te,r,P,R,me,ie,Ze,E,f,O,F,!1,!1,U,q,Z,J);if(!ot)return{notEnoughRoom:!0};We(ot)}return{}}function Yn(u,t,r,c,d){const{x:f,y:_,z:T}=c.projectTilePoint(u.x,u.y,t);if(!d)return Fn(f,_,T,r);const[E,M,I]=d(u);return Fn(f+E,_+M,T+I,r)}function Or(u,t,r,c,d,f,_,T){const E=Yn(u.sub(t)._unit()._add(u),T,d,_,f);return o.ad.vec3.sub(E,r,E),o.ad.vec3.normalize(E,E),o.ad.vec3.scaleAndAdd(E,r,E,c)}function Fa(u,t,r,c,d,f,_,T,E,M,I,P,R,O,N,F,U,q,Z){const J=c?u-t:u+t;let K=J>0?1:-1,oe=0;c&&(K*=-1,oe=Math.PI),K<0&&(oe+=Math.PI);let te=T+_+(K>0?0:1)|0,ie=d,re=d,ue=0,me=0;const Le=Math.abs(J),Ee=[],Ze=[];let We=f,ot=We,Se=o.ad.vec3.zero([]);const He=()=>Or(ot,We,re,Le-ue+1,I,R,F,U.canonical);for(;ue+me<=Le;){if(te+=K,te<T||te>=E)return null;if(re=ie,ot=We,Ee.push(re),O&&Ze.push(ot),We=new o.P(M.getx(te),M.gety(te)),ie=P[te],!ie){const Et=Yn(We,U.canonical,I,F,R);ie=Et[3]>0?P[te]=Et:He()}ue+=me;
21const ft=o.ad.vec3.sub([],ie,re),mt=o.ad.vec3.distance(re,ie);if(r&&mt>0&&me>0&&o.ad.vec3.dot(Se,ft)/(me*mt)<Z)return null;me=mt,Se=ft}N&&R&&(P[te]&&(ie=He(),me=o.ad.vec3.distance(re,ie),Se=o.ad.vec3.sub([],ie,re)),P[te]=ie);const we=(Le-ue)/me,$e=We.sub(ot)._mult(we)._add(ot),Ve=o.ad.vec3.scaleAndAdd([],re,Se,we);let Ke=[0,0,1],De=Se[0],Qe=Se[1];if(q&&(Ke=F.upVector(U.canonical,$e.x,$e.y),Ke[0]!==0||Ke[1]!==0||Ke[2]!==1)){const ft=[Ke[2],0,-Ke[0]],mt=o.ad.vec3.cross([],Ke,ft);o.ad.vec3.normalize(ft,ft),o.ad.vec3.normalize(mt,mt),De=o.ad.vec3.dot(Se,ft),Qe=o.ad.vec3.dot(Se,mt)}if(r){const ft=o.ad.vec3.cross([],Ke,Se);o.ad.vec3.normalize(ft,ft),o.ad.vec3.scaleAndAdd(Ve,Ve,ft,r*K)}const pt=oe+Math.atan2(Qe,De);return Ee.push(Ve),O&&Ze.push($e),{point:Ve,angle:pt,path:Ee,tilePath:Ze,up:Ke}}function Bn(u,t){const r=t.length,c=r+4*u;t.resize(c),t.float32.fill(-1/0,4*r,4*c)}function or(u,t,r){const c=t[0],d=t[1];return u[0]=r[0]*c+r[4]*d+r[12],u[1]=r[1]*c+r[5]*d+r[13],u[3]=r[3]*c+r[7]*d+r[15],u}const xr=100;class us{constructor(t,r,c=new gi(t.width+200,t.height+200,25),d=new gi(t.width+200,t.height+200,25)){this.transform=t,this.grid=c,this.ignoredGrid=d,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+xr,this.screenBottomBoundary=t.height+xr,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.fogState=r}placeCollisionBox(t,r,c,d,f,_,T,E){let M=c.projectedAnchorX,I=c.projectedAnchorY,P=c.projectedAnchorZ;const R=c.elevation,O=c.tileID,N=t.getProjection();if(R&&O){const[te,ie,re]=N.upVector(O.canonical,c.tileAnchorX,c.tileAnchorY),ue=N.upVectorScale(O.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;M+=te*R*ue,I+=ie*R*ue,P+=re*R*ue}const F=this.projectAndGetPerspectiveRatio(T,M,I,P,c.tileID,N.name==="globe"||!!R||this.transform.pitch>0,N),U=_*F.perspectiveRatio,q=(c.x1*r+d.x-c.padding)*U+F.point.x,Z=(c.y1*r+d.y-c.padding)*U+F.point.y,J=(c.x2*r+d.x+c.padding)*U+F.point.x,K=(c.y2*r+d.y+c.padding)*U+F.point.y,oe=F.perspectiveRatio<=.55||F.occluded;return!this.isInsideGrid(q,Z,J,K)||!f&&this.grid.hitTest(q,Z,J,K,E)||oe?{box:[],offscreen:!1,occluded:F.occluded}:{box:[q,Z,J,K],offscreen:this.isOffscreen(q,Z,J,K),occluded:!1}}placeCollisionCircles(t,r,c,d,f,_,T,E,M,I,P,R,O,N,F){const U=[],q=this.transform.elevation,Z=t.getProjection(),J=q?q.getAtTileOffsetFunc(F,this.transform.center.lat,this.transform.worldSize,Z):null,K=new o.P(c.tileAnchorX,c.tileAnchorY);let{x:oe,y:te,z:ie}=Z.projectTilePoint(K.x,K.y,F.canonical);if(J){const[Ke,De,Qe]=J(K);oe+=Ke,te+=De,ie+=Qe}const re=Z.name==="globe",ue=this.projectAndGetPerspectiveRatio(T,oe,te,ie,F,re||!!q||this.transform.pitch>0,Z),{perspectiveRatio:me}=ue,Le=(P?_/me:_*me)/o.bw,Ee=Fn(oe,te,ie,E),Ze=c.lineOffsetX*Le,We=c.lineOffsetY*Le,ot=o.ak(t.layers[0].layout.get("text-max-angle")),Se=Math.cos(ot),He=ue.signedDistanceFromCamera>0?Dl(Le,f,Ze,We,!1,Ee,K,c,d,E,{},q&&!P?J:null,P&&!!q,Z,F,P,Se):null;let we=!1,$e=!1,Ve=!0;if(He&&!ue.occluded){const Ke=.5*O*me+N,De=new o.P(-100,-100),Qe=new o.P(this.screenRightBoundary,this.screenBottomBoundary),pt=new ko,{first:ft,last:mt}=He,Et=ft.path.length;let qt=[];for(let kt=Et-1;kt>=1;kt--)qt.push(ft.path[kt]);for(let kt=1;kt<mt.path.length;kt++)qt.push(mt.path[kt]);const Lt=2.5*Ke;M&&(qt=qt.map(([kt,ai,xi],Di)=>(J&&!re&&(xi=J(Di<Et-1?ft.tilePath[Et-1-Di]:mt.tilePath[Di-Et+2])[2]),Fn(kt,ai,xi,M))),qt.some(kt=>kt[3]<=0)&&(qt=[]));let Vt=[];if(qt.length>0){let kt=1/0,ai=-1/0,xi=1/0,Di=-1/0;for(const ei of qt)kt=Math.min(kt,ei[0]),xi=Math.min(xi,ei[1]),ai=Math.max(ai,ei[0]),Di=Math.max(Di,ei[1]);ai>=De.x&&kt<=Qe.x&&Di>=De.y&&xi<=Qe.y&&(Vt=[qt.map(ei=>new o.P(ei[0],ei[1]))],(kt<De.x||ai>Qe.x||xi<De.y||Di>Qe.y)&&(Vt=o.bu(Vt,De.x,De.y,Qe.x,Qe.y)))}for(const kt of Vt){pt.reset(kt,.25*Ke);let ai=0;ai=pt.length<=.5*Ke?1:Math.ceil(pt.paddedLength/Lt)+1;for(let xi=0;xi<ai;xi++){const Di=xi/Math.max(ai-1,1),ei=pt.lerp(Di),ji=ei.x+xr,Ht=ei.y+xr;U.push(ji,Ht,Ke,0);const Mt=ji-Ke,ci=Ht-Ke,Ii=ji+Ke,fi=Ht+Ke;if(Ve=Ve&&this.isOffscreen(Mt,ci,Ii,fi),$e=$e||this.isInsideGrid(Mt,ci,Ii,fi),!r&&this.grid.hitTestCircle(ji,Ht,Ke,R)&&(we=!0,!I))return{circles:[],offscreen:!1,collisionDetected:we,occluded:!1}}}}return{circles:!I&&we||!$e?[]:U,offscreen:Ve,collisionDetected:we,occluded:ue.occluded}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const r=[];let c=1/0,d=1/0,f=-1/0,_=-1/0;for(const I of t){const P=new o.P(I.x+xr,I.y+xr);c=Math.min(c,P.x),d=Math.min(d,P.y),f=Math.max(f,P.x),_=Math.max(_,P.y),r.push(P)}const T=this.grid.query(c,d,f,_).concat(this.ignoredGrid.query(c,d,f,_)),E={},M={};for(const I of T){const P=I.key;if(E[P.bucketInstanceId]===void 0&&(E[P.bucketInstanceId]={}),E[P.bucketInstanceId][P.featureIndex])continue;const R=[new o.P(I.x1,I.y1),new o.P(I.x2,I.y1),new o.P(I.x2,I.y2),new o.P(I.x1,I.y2)];o.bv(r,R)&&(E[P.bucketInstanceId][P.featureIndex]=!0,M[P.bucketInstanceId]===void 0&&(M[P.bucketInstanceId]=[]),M[P.bucketInstanceId].push(P.featureIndex))}return M}insertCollisionBox(t,r,c,d,f){(r?this.ignoredGrid:this.grid).insert({bucketInstanceId:c,featureIndex:d,collisionGroupID:f},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,r,c,d,f){const _=r?this.ignoredGrid:this.grid,T={bucketInstanceId:c,featureIndex:d,collisionGroupID:f};for(let E=0;E<t.length;
21E+=4)_.insertCircle(T,t[E],t[E+1],t[E+2])}projectAndGetPerspectiveRatio(t,r,c,d,f,_,T){const E=[r,c,d,1];let M=!1;d||this.transform.pitch>0?(o.ad.vec4.transformMat4(E,E,t),this.fogState&&f&&T.name!=="globe"&&(M=function(R,O,N,F,U,q){const Z=q.calculateFogTileMatrix(U),J=[O,N,F];return o.ad.vec3.transformMat4(J,J,Z),bt(R,o.ad.vec3.length(J),q.pitch,q._fov)}(this.fogState,r,c,d,f.toUnwrapped(),this.transform)>.9)):or(E,E,t);const I=E[3];return{point:new o.P((E[0]/I+1)/2*this.transform.width+xr,(-E[1]/I+1)/2*this.transform.height+xr),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(T)/I*.5,1.5),signedDistanceFromCamera:I,occluded:_&&E[2]>I||M}}isOffscreen(t,r,c,d){return c<xr||t>=this.screenRightBoundary||d<xr||r>this.screenBottomBoundary}isInsideGrid(t,r,c,d){return c>=0&&t<this.gridRightBoundary&&d>=0&&r<this.gridBottomBoundary}getViewportMatrix(){const t=o.ad.mat4.identity([]);return o.ad.mat4.translate(t,t,[-100,-100,0]),t}}function ir(u,t,r){const c=t.createTileMatrix(u,u.worldSize,r.toUnwrapped());return o.ad.mat4.multiply(new Float32Array(16),u.projMatrix,c)}function Qc(u,t,r){if(t.projection.name===r.projection.name)return u.projMatrix;const c=r.clone();return c.setProjection(t.projection),ir(c,t.getProjection(),u)}function pn(u,t,r){return t.name===r.projection.name?u.projMatrix:ir(r,t,u)}class No{constructor(t,r,c,d){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?r:-r))):d&&c?1:0,this.placed=c}isHidden(){return this.opacity===0&&!this.placed}}class Fs{constructor(t,r,c,d,f,_=!1){this.text=new No(t?t.text:null,r,c,f),this.icon=new No(t?t.icon:null,r,d,f),this.clipped=_}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class hs{constructor(t,r,c,d=!1){this.text=t,this.icon=r,this.skipFade=c,this.clipped=d}}class Gp{constructor(){this.invProjMatrix=o.ad.mat4.create(),this.viewportMatrix=o.ad.mat4.create(),this.circles=[]}}class ds{constructor(t,r,c,d,f){this.bucketInstanceId=t,this.featureIndex=r,this.sourceLayerIndex=c,this.bucketIndex=d,this.tileID=f}}class $p{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const r=++this.maxGroupID;this.collisionGroups[t]={ID:r,predicate:c=>c.collisionGroupID===r}}return this.collisionGroups[t]}}function Ol(u,t,r,c,d){const{horizontalAlign:f,verticalAlign:_}=o.bD(u),T=-(f-.5)*t,E=-(_-.5)*r,M=o.bC(u,c);return new o.P(T+M[0]*d,E+M[1]*d)}function Ur(u,t,r,c,d){const f=new o.P(u,t);return r&&f._rotate(c?d:-d),f}class Hp{constructor(t,r,c,d,f,_){this.transform=t.clone(),this.projection=t.projection.name,this.collisionIndex=new us(this.transform,f),this.buildingIndex=_,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=r,this.retainedQueryData={},this.collisionGroups=new $p(c),this.collisionCircleArrays={},this.prevPlacement=d,d&&(d.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,r,c,d,f=1){const _=c.getBucket(r),T=c.latestFeatureIndex;if(!_||!T||r.fqid!==_.layerIds[0])return;const E=_.layers[0].layout,M=_.layers[0].paint,I=c.collisionBoxArray,P=Math.pow(2,this.transform.zoom-c.tileID.overscaledZ),R=c.tileSize/o.ai,O=c.tileID.toUnwrapped();this.transform.setProjection(_.projection);const N=(F=c.tileID,U=_.getProjection(),q=this.transform,U.name===this.projection?q.calculateProjMatrix(F.toUnwrapped()):ir(q,U,F));var F,U,q;const Z=E.get("text-pitch-alignment")==="map",J=E.get("text-rotation-alignment")==="map";r.compileFilter(r.options);const K=r.dynamicFilter(),oe=r.dynamicFilterNeedsFeature(),te=this.transform.calculatePixelsToTileUnitsMatrix(c),ie=Ir(N,c.tileID.canonical,Z,J,this.transform,_.getProjection(),te);let re=null;if(Z){const He=er(N,c.tileID.canonical,Z,J,this.transform,_.getProjection(),te);re=o.ad.mat4.multiply([],this.transform.labelPlaneMatrix,He)}let ue=null;K&&c.latestFeatureIndex&&(ue={unwrappedTileID:O,dynamicFilter:K,dynamicFilterNeedsFeature:oe}),this.retainedQueryData[_.bucketInstanceId]=new ds(_.bucketInstanceId,T,_.sourceLayerIndex,_.index,c.tileID);const[me,Le]=_.layers[0].layout.get("text-size-scale-range"),Ee=o.ay(f,me,Le),[Ze,We]=E.get("icon-size-scale-range"),ot=o.ay(f,Ze,We),Se={bucket:_,layout:E,paint:M,posMatrix:N,textLabelPlaneMatr
21ix:ie,labelToScreenMatrix:re,clippingData:ue,scale:P,textPixelRatio:R,holdingForFade:c.holdingForFade(),collisionBoxArray:I,partiallyEvaluatedTextSize:o.bp(_.textSizeData,this.transform.zoom,Ee),partiallyEvaluatedIconSize:o.bp(_.iconSizeData,this.transform.zoom,ot),collisionGroup:this.collisionGroups.get(_.sourceID),latestFeatureIndex:c.latestFeatureIndex};if(d)for(const He of _.sortKeyRanges){const{sortKey:we,symbolInstanceStart:$e,symbolInstanceEnd:Ve}=He;t.push({sortKey:we,symbolInstanceStart:$e,symbolInstanceEnd:Ve,parameters:Se})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:_.symbolInstances.length,parameters:Se})}attemptAnchorPlacement(t,r,c,d,f,_,T,E,M,I,P,R,O,N,F,U,q,Z){const{textOffset0:J,textOffset1:K,crossTileID:oe}=R,te=[J,K],ie=Ol(t,c,d,te,f),re=this.collisionIndex.placeCollisionBox(N,f,r,Ur(ie.x,ie.y,_,T,this.transform.angle),P,E,M,I.predicate);if(U){const ue=N.getSymbolInstanceIconSize(Z,this.transform.zoom,R.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(N,ue,U,Ur(ie.x,ie.y,_,T,this.transform.angle),P,E,M,I.predicate).box.length===0)return}if(re.box.length>0){let ue;return this.prevPlacement&&this.prevPlacement.variableOffsets[oe]&&this.prevPlacement.placements[oe]&&this.prevPlacement.placements[oe].text&&(ue=this.prevPlacement.variableOffsets[oe].anchor),this.variableOffsets[oe]={textOffset:te,width:c,height:d,anchor:t,textScale:f,prevAnchor:ue},this.markUsedJustification(N,t,R,F),N.allowVerticalPlacement&&(this.markUsedOrientation(N,F,R),this.placedOrientations[oe]=F),{shift:ie,placedGlyphBoxes:re}}}placeLayerBucketPart(t,r,c,d,f=1){const{bucket:_,layout:T,paint:E,posMatrix:M,textLabelPlaneMatrix:I,labelToScreenMatrix:P,clippingData:R,textPixelRatio:O,holdingForFade:N,collisionBoxArray:F,partiallyEvaluatedTextSize:U,partiallyEvaluatedIconSize:q,collisionGroup:Z,latestFeatureIndex:J}=t.parameters,K=T.get("text-optional"),oe=T.get("icon-optional"),te=T.get("text-allow-overlap"),ie=T.get("icon-allow-overlap"),re=T.get("text-rotation-alignment")==="map",ue=T.get("text-pitch-alignment")==="map",me=E.get("symbol-z-offset"),Le=T.get("symbol-elevation-reference")==="sea",[Ee,Ze]=T.get("text-size-scale-range"),[We,ot]=T.get("icon-size-scale-range"),Se=o.ay(f,Ee,Ze),He=o.ay(f,We,ot);this.transform.setProjection(_.projection);let we=te&&(ie||!_.hasIconData()||oe),$e=ie&&(te||!_.hasTextData()||K);const Ve=!me.isConstant();!_.collisionArrays&&F&&_.deserializeCollisionBoxes(F),c&&d&&_.updateCollisionDebugBuffers(this.transform.zoom,F,Se,He);const Ke=(De,Qe,pt)=>{const{crossTileID:ft,numVerticalGlyphVertices:mt}=De;let Et=null;if(R&&R.dynamicFilterNeedsFeature||Ve){const di=this.retainedQueryData[_.bucketInstanceId];Et=J.loadFeature({featureIndex:De.featureIndex,bucketIndex:di.bucketIndex,sourceLayerIndex:di.sourceLayerIndex,layoutVertexArrayOffset:0})}if(R&&!(0,R.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch},Et,this.retainedQueryData[_.bucketInstanceId].tileID.canonical,new o.P(De.tileAnchorX,De.tileAnchorY),this.transform.calculateDistanceTileData(R.unwrappedTileID)))return this.placements[ft]=new hs(!1,!1,!1,!0),void r.add(ft);const qt=me.evaluate(Et,{});if(r.has(ft))return;if(N)return void(this.placements[ft]=new hs(!1,!1,!1));let Lt=!1,Vt=!1,kt=!0,ai=!1,xi=!1,Di=null,ei={box:null,offscreen:null,occluded:null},ji={box:null},Ht=null,Mt=null,ci=null,Ii=0,fi=0,Yi=0;pt.textFeatureIndex?Ii=pt.textFeatureIndex:De.useRuntimeCollisionCircles&&(Ii=De.featureIndex),pt.verticalTextFeatureIndex&&(fi=pt.verticalTextFeatureIndex);const nr=di=>{di.tileID=this.retainedQueryData[_.bucketInstanceId].tileID;const qi=this.transform.elevation;di.elevation=Le?qt:qt+(qi?qi.getAtTileOffset(di.tileID,di.tileAnchorX,di.tileAnchorY):0),di.elevation+=De.zOffset},cr=pt.textBox;if(cr){nr(cr);const di=bi=>{let Pi=o.bq.horizontal;if(_.allowVerticalPlacement&&!bi&&this.prevPlacement){const Er=this.prevPlacement.placedOrientations[ft];Er&&(this.placedOrientations[ft]=Er,Pi=Er,this.markUsedOrientation(_,Pi,De))}return Pi},qi=(bi,Pi)=>{if(_.allowVerticalPlacement&&mt>0&&pt.verticalTextBox){for(const Er of _.writingModes)if(Er===o.bq.vertical?(ei=Pi(),ji=ei):ei=bi(),ei&&ei.box&&ei.box.length)break}else ei=bi()};if(T.get("text-variable-anchor")){let bi=T.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[ft]){const Fi=this.prevPlacement.variableOffsets[ft];
vendor: 18,900 bytes, line 21
21bi.indexOf(Fi.anchor)>0&&(bi=bi.filter(ur=>ur!==Fi.anchor),bi.unshift(Fi.anchor))}const Pi=(Fi,ur,ts)=>{const an=_.getSymbolInstanceTextSize(U,De,this.transform.zoom,Qe),Pn=(Fi.x2-Fi.x1)*an+2*Fi.padding,Kr=(Fi.y2-Fi.y1)*an+2*Fi.padding,Rn=De.hasIconTextFit&&!ie?ur:null;Rn&&nr(Rn);let ln={box:[],offscreen:!1,occluded:!1};const ws=te?2*bi.length:bi.length;for(let is=0;is<ws;++is){const Ts=this.attemptAnchorPlacement(bi[is%bi.length],Fi,Pn,Kr,an,re,ue,O,M,Z,is>=bi.length,De,Qe,_,ts,Rn,U,q);if(Ts&&(ln=Ts.placedGlyphBoxes,ln&&ln.box&&ln.box.length)){Lt=!0,Di=Ts.shift;break}}return ln};qi(()=>Pi(cr,pt.iconBox,o.bq.horizontal),()=>{const Fi=pt.verticalTextBox;return Fi&&nr(Fi),_.allowVerticalPlacement&&!(ei&&ei.box&&ei.box.length)&&mt>0&&Fi?Pi(Fi,pt.verticalIconBox,o.bq.vertical):{box:null,offscreen:null,occluded:null}}),ei&&(Lt=ei.box,kt=ei.offscreen,ai=ei.occluded);const Er=di(!(!ei||!ei.box));if(!Lt&&this.prevPlacement){const Fi=this.prevPlacement.variableOffsets[ft];Fi&&(this.variableOffsets[ft]=Fi,this.markUsedJustification(_,Fi.anchor,De,Er))}}else{const bi=(Pi,Er)=>{const Fi=_.getSymbolInstanceTextSize(U,De,this.transform.zoom,Qe,f),ur=this.collisionIndex.placeCollisionBox(_,Fi,Pi,new o.P(0,0),te,O,M,Z.predicate);return ur&&ur.box&&ur.box.length&&(this.markUsedOrientation(_,Er,De),this.placedOrientations[ft]=Er),ur};qi(()=>bi(cr,o.bq.horizontal),()=>{const Pi=pt.verticalTextBox;return _.allowVerticalPlacement&&mt>0&&Pi?(nr(Pi),bi(Pi,o.bq.vertical)):{box:null,offscreen:null,occluded:null}}),di(!!(ei&&ei.box&&ei.box.length))}}if(Ht=ei,Lt=Ht&&Ht.box&&Ht.box.length>0,kt=Ht&&Ht.offscreen,ai=Ht&&Ht.occluded,De.useRuntimeCollisionCircles){const di=_.text.placedSymbolArray.get(De.centerJustifiedTextSymbolIndex>=0?De.centerJustifiedTextSymbolIndex:De.verticalPlacedTextSymbolIndex),qi=o.br(_.textSizeData,U,di),bi=T.get("text-padding");Mt=this.collisionIndex.placeCollisionCircles(_,te,di,_.lineVertexArray,_.glyphOffsetArray,qi,M,I,P,c,ue,Z.predicate,De.collisionCircleDiameter*qi/o.bw,bi,this.retainedQueryData[_.bucketInstanceId].tileID),Lt=te||Mt.circles.length>0&&!Mt.collisionDetected,kt=kt&&Mt.offscreen,ai=Mt.occluded}if(pt.iconFeatureIndex&&(Yi=pt.iconFeatureIndex),pt.iconBox){const di=qi=>{nr(qi);const bi=De.hasIconTextFit&&Di?Ur(Di.x,Di.y,re,ue,this.transform.angle):new o.P(0,0),Pi=_.getSymbolInstanceIconSize(q,this.transform.zoom,De.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(_,Pi,qi,bi,ie,O,M,Z.predicate)};ji&&ji.box&&ji.box.length&&pt.verticalIconBox?(ci=di(pt.verticalIconBox),Vt=ci.box.length>0):(ci=di(pt.iconBox),Vt=ci.box.length>0),kt=kt&&ci.offscreen,xi=ci.occluded}const hr=K||De.numHorizontalGlyphVertices===0&&mt===0,yn=oe||De.numIconVertices===0;if(hr||yn?yn?hr||(Vt=Vt&&Lt):Lt=Vt&&Lt:Vt=Lt=Vt&&Lt,Lt&&Ht&&Ht.box&&this.collisionIndex.insertCollisionBox(Ht.box,T.get("text-ignore-placement"),_.bucketInstanceId,ji&&ji.box&&fi?fi:Ii,Z.ID),Vt&&ci&&this.collisionIndex.insertCollisionBox(ci.box,T.get("icon-ignore-placement"),_.bucketInstanceId,Yi,Z.ID),Mt&&(Lt&&this.collisionIndex.insertCollisionCircles(Mt.circles,T.get("text-ignore-placement"),_.bucketInstanceId,Ii,Z.ID),c)){const di=_.bucketInstanceId;let qi=this.collisionCircleArrays[di];qi===void 0&&(qi=this.collisionCircleArrays[di]=new Gp);for(let bi=0;bi<Mt.circles.length;bi+=4)qi.circles.push(Mt.circles[bi+0]),qi.circles.push(Mt.circles[bi+1]),qi.circles.push(Mt.circles[bi+2]),qi.circles.push(Mt.collisionDetected?1:0)}const kr=_.projection.name!=="globe";we=we&&(kr||!ai),$e=$e&&(kr||!xi),this.placements[ft]=new hs(Lt||we,Vt||$e,kt||_.justReloaded),r.add(ft)};if(_.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(_,this.retainedQueryData[_.bucketInstanceId].tileID),_.elevationType==="road"&&_.updateRoadElevation(),_.updateZOffset(),_.sortFeaturesByY){const De=_.getSortedSymbolIndexes(this.transform.angle);for(let Qe=De.length-1;Qe>=0;--Qe){const pt=De[Qe];Ke(_.symbolInstances.get(pt),pt,_.collisionArrays[pt])}_.hasAnyZOffset&&o.w(`${_.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(_.hasAnyZOffset){const De=_.getSortedIndexesByZOffset();for(let Qe=0;Qe<De.length;++Qe){const pt=De[Qe];Ke(_.symbolInstances.get(pt),pt,_.collisionArrays[pt])}}else for(let De=t.symbolInstanceStart;De<t.symbolInstanceEnd;De++)Ke(_.symbolInstances.get(De),De,_.collisionArrays[De]);if(c&&_.bucketInstanceId in this.collisionCircleArrays){const De=this.collisionCircleArrays[_.bucketInstanceId];o.ad.mat4.invert(De.invProjMatrix,M),De.viewportMatrix=this.collisionIndex.getViewportMatrix()}_.justReloaded=!1}markUsedJustification(t,r,c,d){const{leftJustifiedTextSymbolIndex:f,centerJustifiedTextSymbolIndex:_,rightJustifiedTextSymbolIndex:T,verticalPlacedTextSymbolIndex:E,crossTileID:M}=c,I=o.bB(r),P=d===o.bq.vertical?E:I==="left"?f:I==="center"?_:I==="right"?T:-1;f>=0&&(t.text.placedSymbolArray.get(f).crossTileID=P>=0&&f!==P?0:M),_>=0&&(t.text.placedSymbolArray.get(_).crossTileID=P>=0&&_!==P?0:M),T>=0&&(t.text.placedSymbolArray.get(T).crossTileID=P>=0&&T!==P?0:M),E>=0&&(t.text.placedSymbolArray.get(E).crossTileID=P>=0&&E!==P?0:M)}markUsedOrientation(t,r,c){const d=r===o.bq.horizontal||r===o.bq.horizontalOnly?r:0,f=r===o.bq.vertical?r:0,{leftJustifiedTextSymbolIndex:_,centerJustifiedTextSymbolIndex:T,rightJustifiedTextSymbolIndex:E,verticalPlacedTextSymbolIndex:M}=c,I=t.text.placedSymbolArray;_>=0&&(I.get(_).placedOrientation=d),T>=0&&(I.get(T).placedOrientation=d),E>=0&&(I.get(E).placedOrientation=d),M>=0&&(I.get(M).placedOrientation=f)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const r=this.prevPlacement;let c=!1;this.prevZoomAdjustment=r?r.zoomAdjustment(this.transform.zoom):0;const d=r?r.symbolFadeChange(t):1,f=r?r.opacities:{},_=r?r.variableOffsets:{},T=r?r.placedOrientations:{};for(const E in this.placements){const M=this.placements[E],I=f[E];I?(this.opacities[E]=new Fs(I,d,M.text,M.icon,null,M.clipped),c=c||M.text!==I.text.placed||M.icon!==I.icon.placed):(this.opacities[E]=new Fs(null,d,M.text,M.icon,M.skipFade,M.clipped),c=c||M.text||M.icon)}for(const E in f){const M=f[E];if(!this.opacities[E]){const I=new Fs(M,d,!1,!1);I.isHidden()||(this.opacities[E]=I,c=c||M.text.placed||M.icon.placed)}}for(const E in _)this.variableOffsets[E]||!this.opacities[E]||this.opacities[E].isHidden()||(this.variableOffsets[E]=_[E]);for(const E in T)this.placedOrientations[E]||!this.opacities[E]||this.opacities[E].isHidden()||(this.placedOrientations[E]=T[E]);c?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=r?r.lastPlacementChangeTime:t)}updateLayerOpacities(t,r,c,d){const f=new Set;for(const _ of r){const T=_.getBucket(t);T&&_.latestFeatureIndex&&t.fqid===T.layerIds[0]&&(this.updateBucketOpacities(T,f,_,_.collisionBoxArray,c,d,_.tileID,t.scope),T.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(T,_.tileID),T.elevationType==="road"&&T.updateRoadElevation(),T.updateZOffset())}}updateBucketOpacities(t,r,c,d,f,_,T,E){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const M=t.layers[0].layout,I=t.layers[0].paint,P=!!t.layers[0].dynamicFilter(),R=new Fs(null,0,!1,!1,!0),O=M.get("text-allow-overlap"),N=M.get("icon-allow-overlap"),F=M.get("text-variable-anchor"),U=M.get("text-rotation-alignment")==="map",q=M.get("text-pitch-alignment")==="map",Z=I.get("symbol-z-offset"),J=M.get("symbol-elevation-reference")==="sea",K=!Z.isConstant(),oe=new Fs(null,0,O&&(N||!t.hasIconData()||M.get("icon-optional")),N&&(O||!t.hasTextData()||M.get("text-optional")),!0);!t.collisionArrays&&d&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(d);const te=(re,ue,me)=>{for(let Le=0;Le<ue/4;Le++)re.opacityVertexArray.emplaceBack(me)};let ie=0;_&&t.updateReplacement(T,_);for(let re=0;re<t.symbolInstances.length;re++){const ue=t.symbolInstances.get(re),{numHorizontalGlyphVertices:me,numVerticalGlyphVertices:Le,crossTileID:Ee,numIconVertices:Ze,tileAnchorX:We,tileAnchorY:ot}=ue;let Se=null;const He=this.retainedQueryData[t.bucketInstanceId];K&&ue&&He&&(Se=c.latestFeatureIndex.loadFeature({featureIndex:ue.featureIndex,bucketIndex:He.bucketIndex,sourceLayerIndex:He.sourceLayerIndex,layoutVertexArrayOffset:0}));const we=Z.evaluate(Se,{}),$e=r.has(Ee);let Ve=this.opacities[Ee];$e?Ve=R:Ve||(Ve=oe,this.opacities[Ee]=Ve),r.add(Ee);const Ke=me>0||Le>0,De=Ze>0,Qe=this.placedOrientations[Ee],pt=Qe===o.bq.vertical,ft=Qe===o.bq.horizontal||Qe===o.bq.horizontalOnly;!Ke&&!De||Ve.isHidden()||ie++;let mt=!1;if((Ke||De)&&_)for(const Et of t.activeReplacements){if(o.bx(Et,f,o.by.Symbol,E)||Et.min.x>We||We>Et.max.x||Et.min.y>ot||ot>Et.max.y)continue;const qt=o.bz(We,ot,T.canonical,Et.footprintTileId.canonical);if(mt=o.bA(qt,Et.footprint),mt)break}if(Ke){const Et=mt?ho:uo(Ve.text);te(t.text,me,pt?ho:Et),te(t.text,Le,ft?ho:Et);const qt=Ve.text.isHidden(),{leftJustifiedTextSymbolIndex:Lt,centerJustifiedTextSymbolIndex:Vt,rightJustifiedTextSymbolIndex:kt,verticalPlacedTextSymbolIndex:ai}=ue,xi=t.text.placedSymbolArray,Di=qt||pt?1:0;Lt>=0&&(xi.get(Lt).hidden=Di),Vt>=0&&(xi.get(Vt).hidden=Di),kt>=0&&(xi.get(kt).hidden=Di),ai>=0&&(xi.get(ai).hidden=qt||ft?1:0);const ei=this.variableOffsets[Ee];ei&&this.markUsedJustification(t,ei.anchor,ue,Qe);const ji=this.placedOrientations[Ee];ji&&(this.markUsedJustification(t,"left",ue,ji),this.markUsedOrientation(t,ji,ue))}if(De){const Et=mt?ho:uo(Ve.icon),{placedIconSymbolIndex:qt,verticalPlacedIconSymbolIndex:Lt}=ue,Vt=t.icon.placedSymbolArray,kt=Ve.icon.isHidden()?1:0;qt>=0&&(te(t.icon,Ze,pt?ho:Et),Vt.get(qt).hidden=kt),Lt>=0&&(te(t.icon,ue.numVerticalIconVertices,ft?ho:Et),Vt.get(Lt).hidden=kt)}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const Et=t.collisionArrays[re];if(Et){let qt=new o.P(0,0),Lt=!0;if(Et.textBox||Et.verticalTextBox){if(F){const kt=this.variableOffsets[Ee];kt?(qt=Ol(kt.anchor,kt.width,kt.height,kt.textOffset,kt.textScale),U&&qt._rotate(q?this.transform.angle:-this.transform.angle)):Lt=!1}P&&(Lt=!Ve.clipped),Et.textBox&&co(t.textCollisionBox.collisionVertexArray,Ve.text.placed,!Lt||pt,we,J,qt.x,qt.y),Et.verticalTextBox&&co(t.textCollisionBox.collisionVertexArray,Ve.text.placed,!Lt||ft,we,J,qt.x,qt.y)}const Vt=Lt&&!!(!ft&&Et.verticalIconBox);Et.iconBox&&co(t.iconCollisionBox.collisionVertexArray,Ve.icon.placed,Vt,we,J,ue.hasIconTextFit?qt.x:0,ue.hasIconTextFit?qt.y:0),Et.verticalIconBox&&co(t.iconCollisionBox.collisionVertexArray,Ve.icon.placed,!Vt,we,J,ue.hasIconTextFit?qt.x:0,ue.hasIconTextFit?qt.y:0)}}}if(t.fullyClipped=ie===0,t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.bucketInstanceId in this.collisionCircleArrays){const re=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=re.invProjMatrix,t.placementViewportMatrix=re.viewportMatrix,t.collisionCircleArray=re.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,r){const c=this.zoomAtLastRecencyCheck===r?1-this.zoomAdjustment(r):1;return this.zoomAtLastRecencyCheck=r,this.commitTime+this.fadeDuration*c>t}setStale(){this.stale=!0}}function co(u,t,r,c,d,f,_){u.emplaceBack(t?1:0,r?1:0,f||0,_||0,c,d?1:0),u.emplaceBack(t?1:0,r?1:0,f||0,_||0,c,d?1:0),u.emplaceBack(t?1:0,r?1:0,f||0,_||0,c,d?1:0),u.emplaceBack(t?1:0,r?1:0,f||0,_||0,c,d?1:0)}const Yh=Math.pow(2,25),Ba=Math.pow(2,24),Zp=Math.pow(2,17),Wp=Math.pow(2,16),Na=Math.pow(2,9),Va=Math.pow(2,8),Xp=Math.pow(2,1);function uo(u){if(u.opacity===0&&!u.placed)return 0;if(u.opacity===1&&u.placed)return 4294967295;const t=u.placed?1:0,r=Math.floor(127*u.opacity);return r*Yh+t*Ba+r*Zp+t*Wp+r*Na+t*Va+r*Xp+t}const ho=0;class kl{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&t.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(t,r,c,d,f,_){const T=this._bucketParts;for(;this._currentTileIndex<t.length;)if(r.getBucketParts(T,d,t[this._currentTileIndex],this._sortAcrossTiles,_),this._currentTileIndex++,f())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,T.sort((E,M)=>E.sortKey-M.sortKey));this._currentPartIndex<T.length;){const E=T[this._currentPartIndex];if(r.placeLayerBucketPart(E,this._seenCrossTileIDs,c,E.symbolInstanceStart===0,_),this._currentPartIndex++,f())return!0}return!1}}class Bs{constructor(t,r,c,d,f,_,T,E,M){this.placement=new Hp(t,f,_,T,E,M),this._currentPlacementIndex=r.length-1,this._forceFullPlacement=c,this._showCollisionBoxes=d,this._done=!1}isDone(){return this._done}continuePlacement(t,r,c,d,f){const _=o.q.now(),T=()=>{const E=o.q.now()-_;return!this._forceFullPlacement&&E>2};for(;this._currentPlacementIndex>=0;){const E=r[t[this._currentPlacementIndex]],M=this.placement.collisionIndex.transform.zoom;if(E.type==="symbol"&&(!E.minzoom||E.minzoom<=M)&&(!E.maxzoom||E.maxzoom>M)){const I=E,P=I.layout.get("symbol-z-elevate"),R=I.layout.get("symbol-sort-key").constantOr(1)!==void 0,O=I.layout.get("symbol-z-order"),N=O==="viewport-y"||O==="auto"&&!(O!=="viewport-y"&&R),F=I.layout.get("text-allow-overlap")||I.layout.get("icon-allow-overlap")||I.layout.get("text-ignore-placement")||I.layout.get("icon-ignore-placement"),U=N&&F,q=this._inProgressLayer=this._inProgressLayer||new kl(I),Z=o.C(E.source,E.scope);if(q.continuePlacement(P||U?d[Z]:c[Z],this.placement,this._showCollisionBoxes,E,T,f))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const eu=512/o.ai/2;class Yp{constructor(t,r,c){this.tileID=t,this.bucketInstanceId=c,this.index=new o.bE(r.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const d=t.canonical.x*o.ai,f=t.canonical.y*o.ai;for(let _=0;_<r.length;_++){const{key:T,crossTileID:E,tileAnchorX:M,tileAnchorY:I}=r.get(_),P=Math.floor((d+M)*eu),R=Math.floor((f+I)*eu);this.index.add(P,R),this.keys.push(T),this.crossTileIDs.push(E)}this.index.finish()}findMatches(t,r,c){const d=this.tileID.canonical.z<r.canonical.z?1:Math.pow(2,this.tileID.canonical.z-r.canonical.z),f=eu/Math.pow(2,r.canonical.z-this.tileID.canonical.z),_=r.canonical.x*o.ai,T=r.canonical.y*o.ai;for(let E=0;E<t.length;E++){const M=t.get(E);if(M.crossTileID)continue;const{key:I,tileAnchorX:P,tileAnchorY:R}=M,O=Math.floor((_+P)*f),N=Math.floor((T+R)*f),F=this.index.range(O-d,N-d,O+d,N+d);for(const U of F){const q=this.crossTileIDs[U];if(this.keys[U]===I&&!c.has(q)){c.add(q),M.crossTileID=q;break}}}}}class Kp{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Kh{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const r=Math.round((t-this.lng)/360);if(r!==0)for(const c in this.indexes){const d=this.indexes[c],f={};for(const _ in d){const T=d[_];T.tileID=T.tileID.unwrapTo(T.tileID.wrap+r),f[T.tileID.key]=T}this.indexes[c]=f}this.lng=t}addBucket(t,r,c){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===r.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let f=0;f<r.symbolInstances.length;f++)r.symbolInstances.get(f).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]=new Set);const d=this.usedCrossTileIDs[t.overscaledZ];for(const f in this.indexes){const _=this.indexes[f];if(Number(f)>t.overscaledZ)for(const T in _){const E=_[T];E.tileID.isChildOf(t)&&E.findMatches(r.symbolInstances,t,d)}else{const T=_[t.scaledTo(Number(f)).key];T&&T.findMatches(r.symbolInstances,t,d)}}for(let f=0;f<r.symbolInstances.length;f++){const _=r.symbolInstances.get(f);_.crossTileID||(_.crossTileID=c.generate(),d.add(_.crossTileID))}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Yp(t,r.symbolInstances,r.bucketInstanceId),!0}removeBucketCrossTileIDs(t,r){for(const c of r.crossTileIDs)this.usedCrossTileIDs[t].delete(c)}removeStaleBuckets(t){let r=!1;for(const c in this.indexes){const d=this.indexes[c];for(const f in d)t[d[f].bucketInstanceId]||(this.removeBucketCrossTileIDs(c,d[f]),delete d[f],r=!0)}return r}}class Jp{constructor(){this.layerIndexes={},this.crossTileIDs=new Kp,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,r,c,d){let f=this.layerIndexes[t.fqid];f===void 0&&(f=this.layerIndexes[t.fqid]=new Kh);let _=!1;const T={};d.name!=="globe"&&f.handleWrapJump(c);for(const E of r){const M=E.getBucket(t);M&&t.fqid===M.layerIds[0]&&(M.bucketInstanceId||(M.bucketInstanceId=++this.maxBucketInstanceId),f.addBucket(E.tileID,M,this.crossTileIDs)&&(_=!0),T[M.bucketInstanceId]=!0)}return f.removeStaleBuckets(T)&&(_=!0),_}pruneUnusedLayers(t){const r={};t.forEach(c=>{r[c]=!0});for(const c in this.layerIndexes)r[c]||delete this.layerIndexes[c]}}const Ns=771;class ii{constructor(t,r,c,d){this.blendFunction=t,this.blendColor=r,this.mask=c,this.blendEquation=d}}ii.Replace=[1,0,1,0],ii.disabled=new ii(ii.Replace,o.al.transparent,[!1,!1,!1,!1]),ii.unblended=new ii(ii.Replace,o.al.transparent,[!0,!0,!0,!0]),ii.alphaBlended=new ii([1,Ns,1,Ns],o.al.transparent,[!0,!0,!0,!0]),ii.alphaBlendedNonPremultiplied=new ii([770,Ns,770,Ns],o.al.transparent,[!0,!0,!0,!0]),ii.multiply=new ii([774,0,774,0],o.al.transparent,[!0,!0,!0,!0]);class Pt{constructor(t,r,c){this.func=t,this.mask=r,this.range=c}}Pt.ReadOnly=!1,Pt.ReadWrite=!0,Pt.disabled=new Pt(519,Pt.ReadOnly,[0,1]);const Fl=7680;class $t{constructor(t,r,c,d,f,_){this.test=t,this.ref=r,this.mask=c,this.fail=d,this.depthFail=f,this.pass=_}}$t.disabled=new $t({func:519,mask:0},0,0,Fl,Fl,Fl);const ps=1029,Vo=2305;
21class jt{constructor(t,r,c){this.enable=t,this.mode=r,this.frontFace=c}}function tu(u,t){const r=o.bG(u,3);o.ad.mat4.fromQuat(u,t),o.bI(u,3,r)}function po(u,t){const r=o.ad.quat.identity([]);return o.ad.quat.rotateZ(r,r,-t),o.ad.quat.rotateX(r,r,-u),r}function Uo(u,t){const r=[u[0],u[1],0],c=[t[0],t[1],0];if(o.ad.vec3.length(r)>=1e-15){const _=o.ad.vec3.normalize([],r);o.ad.vec3.scale(c,_,o.ad.vec3.dot(c,_)),t[0]=c[0],t[1]=c[1]}const d=o.ad.vec3.cross([],t,u);if(o.ad.vec3.len(d)<1e-15)return null;const f=Math.atan2(-d[1],d[0]);return po(Math.atan2(Math.sqrt(u[0]*u[0]+u[1]*u[1]),-u[2]),f)}jt.disabled=new jt(!1,ps,Vo),jt.backCCW=new jt(!0,ps,Vo),jt.backCW=new jt(!0,ps,2304),jt.frontCW=new jt(!0,1028,2304),jt.frontCCW=new jt(!0,1028,Vo);class iu{constructor(t,r){this.position=t,this.orientation=r}get position(){return this._position}set position(t){if(t){const r=t instanceof o.ac?t:new o.ac(t[0],t[1],t[2]);this._renderWorldCopies&&(r.x=o.bF(r.x,0,1)),this._position=r}else this._position=null}lookAtPoint(t,r){if(this.orientation=null,!this.position)return;const c=this.position,d=this._elevation?this._elevation.getAtPointOrZero(o.ac.fromLngLat(t)):0,f=o.ac.fromLngLat(t,d),_=[f.x-c.x,f.y-c.y,f.z-c.z];r||(r=[0,0,1]),r[2]=Math.abs(r[2]),this.orientation=Uo(_,r)}setPitchBearing(t,r){this.orientation=po(o.ak(t),o.ak(-r))}}class jo{constructor(t,r){this._transform=o.ad.mat4.identity([]),this.orientation=r,this.position=t}get mercatorPosition(){const t=this.position;return new o.ac(t[0],t[1],t[2])}get position(){const t=o.bG(this._transform,3);return[t[0],t[1],t[2]]}set position(t){var r;t&&o.bI(this._transform,3,[(r=t)[0],r[1],r[2],1])}get orientation(){return this._orientation}set orientation(t){this._orientation=t||o.ad.quat.identity([]),t&&tu(this._transform,this._orientation)}getPitchBearing(){const t=this.forward(),r=this.right();return{bearing:Math.atan2(-r[1],r[0]),pitch:Math.atan2(Math.sqrt(t[0]*t[0]+t[1]*t[1]),-t[2])}}setPitchBearing(t,r){this._orientation=po(t,r),tu(this._transform,this._orientation)}forward(){const t=o.bG(this._transform,2);return[-t[0],-t[1],-t[2]]}up(){const t=o.bG(this._transform,1);return[-t[0],-t[1],-t[2]]}right(){const t=o.bG(this._transform,0);return[t[0],t[1],t[2]]}getCameraToWorld(t,r){const c=new Float64Array(16);return o.ad.mat4.invert(c,this.getWorldToCamera(t,r)),c}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(t,r,c){const d=this.position;o.ad.vec3.scale(d,d,-t);const f=new Float64Array(16);return o.ad.mat4.fromScaling(f,[c,c,c]),o.ad.mat4.translate(f,f,d),f[10]*=r,f}getWorldToCamera(t,r){const c=new Float64Array(16),d=new Float64Array(4),f=this.position;return o.ad.quat.conjugate(d,this._orientation),o.ad.vec3.scale(f,f,-t),o.ad.mat4.fromQuat(c,d),o.ad.mat4.translate(c,c,f),c[1]*=-1,c[5]*=-1,c[9]*=-1,c[13]*=-1,c[8]*=r,c[9]*=r,c[10]*=r,c[11]*=r,c}getCameraToClipPerspective(t,r,c,d){const f=new Float64Array(16);return o.ad.mat4.perspective(f,t,r,c,d),f}getCameraToClipOrthographic(t,r,c,d,f,_){const T=new Float64Array(16);return o.ad.mat4.ortho(T,t,r,c,d,f,_),T}getDistanceToElevation(t,r=!1){const c=t===0?0:o.bH(t,r?o.aT(this.position[1]):this.position[1]),d=this.forward();return(c-this.position[2])/d[2]}clone(){return new jo([...this.position],[...this.orientation])}}const Ji={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11};class Ua{constructor(t=0,r=0,c=0,d=0){if(isNaN(t)||t<0||isNaN(r)||r<0||isNaN(c)||c<0||isNaN(d)||d<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=r,this.left=c,this.right=d}interpolate(t,r,c){return r.top!=null&&t.top!=null&&(this.top=o.ah(t.top,r.top,c)),r.bottom!=null&&t.bottom!=null&&(this.bottom=o.ah(t.bottom,r.bottom,c)),r.left!=null&&t.left!=null&&(this.left=o.ah(t.left,r.left,c)),r.right!=null&&t.right!=null&&(this.right=o.ah(t.right,r.right,c)),this}getCenter(t,r){const c=o.ay((this.left+t-this.right)/2,0,t),d=o.ay((this.top+r-this.bottom)/2,0,r);return new o.P(c,d)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Ua(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const ht=15;class Bl{constructor(t,r,c,d,f,_,T){this.tileSize=512,this._renderWorldCopies=f===void 0||f,this._minZoom=t||0,this._maxZoom=r||22,this._minPitch=c??0,this._maxPitch=d??60,this.setProjection(_),this.setMaxBounds(T),this.width=0,this.height=0,this._center=new o.bO(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new Ua,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new jo,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1,this._allowWorldUnderZoom=!1}clone(){const t=new Bl(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return t._elevation=this._elevation,t._centerAltitude=this._centerAltitude,t._centerAltitudeValidForE
vendor: 1,249 bytes, line 21
21xaggeration=this._centerAltitudeValidForExaggeration,t.tileSize=this.tileSize,t.mercatorFromTransition=this.mercatorFromTransition,t.width=this.width,t.height=this.height,t.cameraElevationReference=this.cameraElevationReference,t._center=this._center,t._setZoom(this.zoom),t._seaLevelZoom=this._seaLevelZoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._nearZ=this._nearZ,t._farZ=this._farZ,t._averageElevation=this._averageElevation,t._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._camera=this._camera.clone(),t._calcMatrices(),t.freezeTileCoverage=this.freezeTileCoverage,t.frustumCorners=this.frustumCorners,t._allowWorldUnderZoom=this._allowWorldUnderZoom,t}get isOrthographic(){return this.projection.name!=="globe"&&this._orthographicProjectionAtLowPitch&&this.pitch<ht}get elevation(){return this._elevation}set elevation(t){this._elevation!==t&&(this._elevation=t,this._updateCameraOnTerrain(),this._calcMatrices())}get depthOcclusionForSymbolsAndCircles(){return this.projection.name!=="globe"&&!this.isOrthographic}updateElevation(t,r=!1){const c=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForE
21xaggeration;(this._seaLevelZoom==null||c)&&this._updateCameraOnTerrain(),(t||c)&&this._constrainCamera(r),this._calcMatrices()}getProjection(){return o.aA(this.projection,["name","center","parallels"])}setProjection(t){this.projectionOptions=t||{name:"mercator"};const r=this.projection?this.getProjection():void 0;this.projection=o.bP(this.projectionOptions);const c=this.getProjection(),d=!o.bn(r,c);return d&&this._calcMatrices(),this.mercatorFromTransition=!1,d}setOrthographicProjectionAtLowPitch(t){return this._orthographicProjectionAtLowPitch!==t&&(this._orthographicProjectionAtLowPitch=t,this._calcMatrices(),!0)}setMercatorFromTransition(){const t=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=o.bP({name:"mercator"});const r=t!==this.projection.name;return r&&this._calcMatrices(),r}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies&&this.projection.supportsWorldCopies===!0}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const t=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(t))}get cameraWorldSize(){const t=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(t))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return o.bH(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new o.P(this.width,this.height)}get bearing(){return o.bF(this.rotation,-180,180)}set bearing(t){this.rotation=t}get rotation(){return-this.angle/Math.PI*180}set rotation(t){const r=-t*Math.PI/180;this.angle!==r&&(this._unmodified=!1,this.angle=r,this._calcMatrices(),this.rotationMatrix=o.ad.mat2.create(),o.ad.mat2.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const r=o.ay(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==r&&(this._unmodified=!1,this._pitch=r,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=o.ak(t),this._calcMatrices())}get fovX(){return this._fov}get fovY(){const t=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/t)}get averageElevation(){return this._averageElevation}set averageElevation(t){this._averageElevation=t,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(t){const r=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==r&&(this._unmodified=!1,this._setZoom(r),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(t){this._zoom=t,this.scale=this.zoomScale(t),this.tileZoom=Math.floor(t),this.zoomFraction=t-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(t){this._tileCoverLift!==t&&(this._tileCoverLift=t)}_updateCameraOnTerrain(){const t=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,r=this.elevation&&t===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>
210&&this._centerAltitudeValidForExaggeration;if(!this._elevation||t===Number.NEGATIVE_INFINITY&&(!r||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const c=this._elevation;r||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&c.exaggeration()&&this._centerAltitudeValidForExaggeration!==c.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*c.exaggeration(),this._centerAltitudeValidForExaggeration=c.exaggeration()):(this._centerAltitude=t||0,this._centerAltitudeValidForExaggeration=c.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){this._centerAltitudeValidForExaggeration!==void 0&&(this._seaLevelZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize))}sampleAverageElevation(){if(!this._elevation)return 0;const t=this._elevation,r=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],c=this.horizonLineFromTop();let d=0,f=0;for(let _=0;_<r.length;_++){const T=new o.P(r[_][0]*this.width,c+r[_][1]*(this.height-c)),E=t.pointCoordinate(T);if(!E)continue;const M=1/Math.hypot(E[0]-this._camera.position[0],E[1]-this._camera.position[1]);d+=E[3]*M,f+=M}return f===0?NaN:d/f}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._terrainEnabled()&&(this.cameraElevationReference==="ground"?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(this._seaLevelZoom==null||!this._elevation)return;const t=this._seaLevelZoom,r=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),c=this.pixelsPerMeter/this.worldSize*r,d=this._mercatorZfromZoom(t),f=this._mercatorZfromZoom(this._maxZoom),_=Math.max(d-c,f);this._setZoom(this._zoomFromMercatorZ(_))}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}computeZoomRelativeTo(t){const r=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,t.toAltitude()));let c;c=t.z<this._camera.position[2]?[r.x,r.y,r.z]:[t.x,t.y,t.z];const d=o.ad.vec3.length(o.ad.vec3.sub([],this._camera.position,c));return o.ay(this._zoomFromMercatorZ(d),this._minZoom,this._maxZoom)}setFreeCameraOptions(t){if(!this.height||!t.position&&!t.orientation)return;this._updateCameraState();let r=!1;if(t.orientation&&!o.ad.quat.exactEquals(t.orientation,this._camera.orientation)&&(r=this._setCameraOrientation(t.orientation)),t.position){const c=[t.position.x,t.position.y,t.position.z];o.ad.vec3.exactEquals(c,this._camera.position)||(this._setCameraPosition(c),r=!0)}r&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const t=this._camera.position,r=new iu;return r.position=new o.ac(t[0],t[1],t[2]),r.orientation=this._camera.orientation,r._elevation=this.elevation,r._renderWorldCopies=this.renderWorldCopies,r}_setCameraOrientation(t){if(!o.ad.quat.length(t))return!1;o.ad.quat.normalize(t,t);const r=o.ad.vec3.transformQuat([],[0,0,-1],t),c=o.ad.vec3.transformQuat([],[0,-1,0],t);if(c[2]<0)return!1;const d=Uo(r,c);return!!d&&(this._camera.orientation=d,!0)}_setCameraPosition(t){const r=this.zoomScale(this.minZoom)*this.tileSize,c=this.zoomScale(this.maxZoom)*this.tileSize,d=this.cameraToCenterDistance;t[2]=o.ay(t[2],d/c,d/r),this._camera.position=t}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,r,c){this._unmodified=!1,this._edgeInsets.interpolate(t,r,c),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const r=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,r)}getVisibleUnwrappedCoordinates(t){const r=[new o.bQ(0,t)];if(this.renderWorldCopies){const c=this.pointCoordinate(new o.P(0,0)),d=this.pointCoordinate(new o.P(this.width,0)),f=this.pointCoordinate(new o.P(this.width,this.height)),_=this.pointCoordinate(new o.P(0,this.height)),T=Math.floor(Math.min(c.x,d.x,f.x,_.x)),E=Math.floor(Math.max(c.x,d.x,f.x,_.x)),M=1;for(let I=T-M;I<=E+M;I++)I!==0&&r.push(new o.bQ(I,t))}return r}isLODDisabled(t){return(!t||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCover(t,r,c){let d=[];const f=c!==void 0,_=!f;if(_&&this.zoom<r||f&&c[0]===0&&c[1]===0)return d;const T=new Set,E=(I,P,R,O,N)=>{const F=o.c5(P,I,R,O,N);T.has(F)||(d.push(new o.aH(I,P,R,O,N)),T.add(F))};for(let I=0;I<t.length;I++){const P=t[I];if(_&&P.canonical.z!==r)continue;const R=P.canonical,O=P.overscaledZ,N=P.wrap,F=1<<R.z,U=R.x+1<F,q=R.x>0,Z=R.y+1<F,J=R.y>0,K=P.wrap-(q?0:1),oe=P.wrap+(U?0:1),te=q?R.x-1:F-1,ie=U?R.x+1:0;if(f)c[0]<0?(E(O,oe,R.z,ie,R.y),c[1]<0&&Z&&(E(O,N,R.z,R.x,R.y+1),E(O,oe,R.z,ie,R.y+1)),c[1]>0&&J&&(E(O,N,R.z,R.x,R.y-1),E(O,oe,R.z,ie,R.y-1))):c[0]>0?(E(O,K,R.z,te,R.y),c[1]<0&&Z&&(E(O,N,R.z,R.x,R.y+1),E(O,K,R.z,te,R.y+1)),c[1]>0&&J&&(E(O,N,R.z,R.x,R.y-1),E(O,K,R.z,te,R.y-1))):c[1]<0&&Z?E(O,N,R.z,R.x,R.y+1):J&&E(O,N,R.z,R.x,R.y-1);else{const re=P.visibleQuadrants;1&re&&(E(O,K,R.z,te,R.y),J&&(E(O,N,R.z,R.x,R.y-1),E(O,K,R.z,te,R.y-1))),2&re&&(E(O,oe,R.z,ie,R.y),J&&(E(O,N,R.z,R.x,R.y-1),E(O,oe,R.z,ie,R.y-1))),4&re&&(E(O,K,R.z,te,R.y),Z&&(E(O,N,R.z,R.x,R.y+1),E(O,K,R.z,te,R.y+1))),8&re&&(E(O,oe,R.z,ie,R.y),Z&&(E(O,N,R.z,R.x,R.y+1),E(O,oe,R.z,ie,R.y+1)))}}const M=[];for(const I of d)d.some(P=>I.isChildOf(P))||M.push(I);if(d=M.filter(I=>!t.some(P=>!!(I.overscaledZ<r&&P.isChildOf(I))||I.equals(P)||I.isChildOf(P))),_){const I=1<<r,P=this.projection.name==="globe"?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),R=[I*P.x,I*P.y],O=4,N=O*O;d=d.filter(F=>
21{const U=F.canonical.x+.5-R[0],q=F.canonical.y+.5-R[1];return U*U+q*q<N})}return d}coveringTiles(t){let r=this.coveringZoomLevel(t);const c=r,d=this.elevation&&this.elevation.exaggeration(),f=d&&!t.isTerrainDEM,_=this.projection.name==="mercator";if(t.minzoom!==void 0&&r<t.minzoom)return[];t.maxzoom!==void 0&&r>t.maxzoom&&(r=t.maxzoom);const T=this.locationCoordinate(this.center),E=this.center.lat,M=1<<r,I=[M*T.x,M*T.y,0],P=this.projection.name==="globe",R=!P,O=o.bR.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,r,R),N=P?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),F=M*o.bH(1,this.center.lat),U=this._camera.position[2]/o.bH(1,this.center.lat),q=[M*N.x,M*N.y,U*(R?1:F)],Z=P||d,J=this.cameraToCenterDistance/t.tileSize*(t.roundZoom?1:.502),K=this.isLODDisabled(!0)?r:0;let oe;if(this._elevation&&t.isTerrainDEM)oe=1e4*this._elevation.exaggeration();else if(this._elevation){const we=this._elevation.getMinMaxForVisibleTiles();oe=we?we.max:this._centerAltitude}else oe=this._centerAltitude;const te=t.isTerrainDEM?-oe:this._elevation?this._elevation.getMinElevationBelowMSL():0,ie=this.projection.isReprojectedInTileSpace?o.bS(this):1,re=we=>{const Ve=new o.ac(we.x+25e-6,we.y,we.z),Ke=new o.ac(we.x,we.y+25e-6,we.z),De=we.toLngLat(),Qe=Ve.toLngLat(),pt=Ke.toLngLat(),ft=this.locationCoordinate(De),mt=this.locationCoordinate(Qe),Et=this.locationCoordinate(pt),qt=Math.hypot(mt.x-ft.x,mt.y-ft.y),Lt=Math.hypot(Et.x-ft.x,Et.y-ft.y);return Math.sqrt(qt*Lt)*ie/25e-6},ue=we=>{const $e=oe,Ve=te;return{aabb:o.bV(this,M,0,0,0,we,Ve,$e,this.projection),zoom:0,x:0,y:0,minZ:Ve,maxZ:$e,wrap:we,fullyVisible:!1}},me=[];let Le=[];const Ee=r,Ze=t.reparseOverscaled?c:r,We=(U-this._centerAltitude)*F,ot=we=>{if(!this._elevation||!we.tileID||!_)return;const $e=this._elevation.getMinMaxForTile(we.tileID),Ve=we.aabb;$e?(Ve.min[2]=$e.min,Ve.max[2]=$e.max,Ve.center[2]=(Ve.min[2]+Ve.max[2])/2):(we.shouldSplit=He(we),we.shouldSplit||(Ve.min[2]=Ve.max[2]=Ve.center[2]=this._centerAltitude))},Se=(we,$e)=>{if(.707*$e<we)return 1;const Ve=$e/we;return Ve/(1.4144271570014144+(Math.pow(1.1,Ve-1.4144271570014144+1)-1)/(1.1-1)-1)},He=we=>{if(we.zoom<K)return!0;if(we.zoom===Ee)return!1;if(we.shouldSplit!=null)return we.shouldSplit;const $e=we.aabb.distanceX(q),Ve=we.aabb.distanceY(q);let Ke=We,De=1;if(P){Ke=we.aabb.distanceZ(q);const Lt=Math.pow(2,we.zoom),Vt=o.aT((we.y+1)/Lt),kt=o.aT(we.y/Lt),ai=Math.min(Math.max(E,Vt),kt),xi=o.ca(ai)/o.ca(E);if(De=ai===E?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,xi/this._mercatorScaleRatio),this.zoom<=o.c6&&we.zoom===Ee-1&&xi>=.9)return!0}else if(f&&(Ke=we.aabb.distanceZ(q)*F),this.projection.isReprojectedInTileSpace&&c<=5){const Lt=Math.pow(2,we.zoom),Vt=re(new o.ac((we.x+.5)/Lt,(we.y+.5)/Lt));De=Vt>.85?1:Vt}if(!_){const Lt=Math.sqrt($e*$e+Ve*Ve+Ke*Ke);let Vt=(1<<Ee-we.zoom)*J*De;return Vt*=Se(Math.max(Ke,We),Lt),Lt<Vt}let Qe=Number.MAX_VALUE,pt=0;const ft=we.aabb.getCorners(),mt=[];for(const Lt of ft){o.ad.vec3.sub(mt,Lt,q),P||(f?mt[2]*=F:mt[2]=We);const Vt=o.ad.vec3.dot(mt,this._camera.forward());Vt<Qe&&(Qe=Vt,pt=Math.abs(mt[2]))}let Et=(1<<Ee-we.zoom)*J*De;if(Et*=Se(Math.max(pt,We),Qe),Qe<Et)return!0;const qt=we.aabb.closestPoint(I);return qt[0]===I[0]&&qt[1]===I[1]};if(this.renderWorldCopies)for(let we=1;we<=3;we++)me.push(ue(-we)),me.push(ue(we));for(me.push(ue(0));me.length>0;){const we=me.pop(),$e=we.x,Ve=we.y;let Ke=we.fullyVisible;const De=()=>this.projection.name==="globe"&&(we.y===0||we.y===(1<<we.zoom)-1);if(!Ke){let Qe=Z?we.aabb.intersects(O):we.aabb.intersectsFlat(O);if(Qe===0&&De()){const pt=new o.bT(we.zoom,$e,Ve);Qe=o.bU(this,M,pt,!0).intersects(O)}if(Qe===0)continue;Ke=Qe===2}if(we.zoom!==Ee&&He(we))for(let Qe=0;Qe<4;Qe++){const pt=($e<<1)+Qe%2,ft=(Ve<<1)+(Qe>>1),mt={aabb:_?we.aabb.quadrant(Qe):o.bV(this,M,we.zoom+1,pt,ft,we.wrap,we.minZ,we.maxZ,this.projection),zoom:we.zoom+1,x:pt,y:ft,wrap:we.wrap,fullyVisible:Ke,tileID:void 0,shouldSplit:void 0,minZ:we.minZ,maxZ:we.maxZ};f&&!P&&(mt.tileID=new o.aH(we.zoom+1===Ee?Ze:we.zoom+1,we.wrap,we.zoom+1,pt,ft),ot(mt)),me.push(mt)}else{const Qe=we.zoom===Ee?Ze:we.zoom;if(t.minzoom&&t.minzoom>Qe)continue;let pt=0;if(!Ke){let qt=Z?we.aabb.intersectsPrecise(O):we.aabb.intersectsPreciseFlat(O);if(qt===0&&De()){const Lt=new o.bT(we.zoom,$e,Ve);qt=o.bU(this,M,Lt,!0).intersectsPrecise(O)}if(qt===0)continue;if(t.calculateQuadrantVisibility)if(O.containsPoint(we.aabb.center))pt=15;else for(let Lt=0;Lt<4;Lt++)we.aabb.quadrant(Lt).intersects(O)!==0&&(pt|=1<<Lt)}const ft=I[0]-(.5+$e+(we.wrap<<we.zoom))*(1<<r-we.zoom),mt=I[1]-.5-Ve,Et=we.tileID?we.tileID:new o.aH(Qe,we.wrap,we.zoom,$e,Ve);t.calculateQuadrantVisibility&&(Et.visibleQuadrants=pt),Le.push({tileID:Et,distanceSq:ft*ft+mt*mt})}}if(this.fogCullDistSq){const we=this.fogCullDistSq,$e=this.horizonLineFromTop();
21Le=Le.filter(Ve=>{const Ke=[0,0,0,1],De=[o.ai,o.ai,0,1],Qe=this.calculateFogTileMatrix(Ve.tileID.toUnwrapped());o.ad.vec4.transformMat4(Ke,Ke,Qe),o.ad.vec4.transformMat4(De,De,Qe);const pt=o.ad.vec4.min([],Ke,De),ft=o.ad.vec4.max([],Ke,De),mt=o.bW(pt,ft);if(mt===0)return!0;let Et=!1;const qt=this._elevation;if(qt&&mt>we&&$e!==0){const Lt=this.calculateProjMatrix(Ve.tileID.toUnwrapped());let Vt;t.isTerrainDEM||(Vt=qt.getMinMaxForTile(Ve.tileID)),Vt||(Vt={min:te,max:oe});const kt=o.c7(this.rotation),ai=[kt[0]*o.ai,kt[1]*o.ai,Vt.max];o.ad.vec3.transformMat4(ai,ai,Lt),Et=(1-ai[1])*this.height*.5<$e}return mt<we||Et})}return Le.sort((we,$e)=>we.distanceSq-$e.distanceSq).map(we=>we.tileID)}resize(t,r){this.width=t,this.height=r,this.pixelsToGLUnits=[2/t,-2/r],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const r=o.ay(t.lat,-o.bX,o.bX),c=this.projection.project(t.lng,r);return new o.P(c.x*this.worldSize,c.y*this.worldSize)}unproject(t){return this.projection.unproject(t.x/this.worldSize,t.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/o.bH(1,this.center.lat)/this.worldSize}setLocationAtPoint(t,r){let c,d;const f=this.centerPoint;if(this.projection.name==="globe"){const T=this.worldSize;c=(r.x-f.x)/T,d=(r.y-f.y)/T}else{const T=this.pointCoordinate(r),E=this.pointCoordinate(f);c=T.x-E.x,d=T.y-E.y}const _=this.locationCoordinate(t);this.setLocation(new o.ac(_.x-c,_.y-d))}setLocation(t){this.center=this.coordinateLocation(t),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(t,r){return this.projection.locationPoint(this,t,r)}locationPoint3D(t,r){return this.projection.locationPoint(this,t,r,!0)}pointLocation(t){return this.coordinateLocation(this.pointCoordinate(t))}pointLocation3D(t,r){return this.coordinateLocation(this.pointCoordinate3D(t,r))}locationCoordinate(t,r){const c=r?o.bH(r,t.lat):void 0,d=this.projection.project(t.lng,t.lat);return new o.ac(d.x,d.y,c)}coordinateLocation(t){return this.projection.unproject(t.x,t.y)}pointRayIntersection(t,r){const c=r??this._centerAltitude,d=[t.x,t.y,0,1],f=[t.x,t.y,1,1];o.ad.vec4.transformMat4(d,d,this.pixelMatrixInverse),o.ad.vec4.transformMat4(f,f,this.pixelMatrixInverse);const _=f[3];o.ad.vec4.scale(d,d,1/d[3]),o.ad.vec4.scale(f,f,1/_);const T=d[2],E=f[2];return{p0:d,p1:f,t:T===E?0:(c-T)/(E-T)}}screenPointToMercatorRay(t){const r=[t.x,t.y,0,1],c=[t.x,t.y,1,1];return o.ad.vec4.transformMat4(r,r,this.pixelMatrixInverse),o.ad.vec4.transformMat4(c,c,this.pixelMatrixInverse),o.ad.vec4.scale(r,r,1/r[3]),o.ad.vec4.scale(c,c,1/c[3]),r[2]=o.bH(r[2],this._center.lat)*this.worldSize,c[2]=o.bH(c[2],this._center.lat)*this.worldSize,o.ad.vec4.scale(r,r,1/this.worldSize),o.ad.vec4.scale(c,c,1/this.worldSize),new o.as([r[0],r[1],r[2]],o.ad.vec3.normalize([],o.ad.vec3.sub([],c,r)))}rayIntersectionCoordinate(t){const{p0:r,p1:c,t:d}=t,f=o.bH(r[2],this._center.lat),_=o.bH(c[2],this._center.lat);return new o.ac(o.ah(r[0],c[0],d)/this.worldSize,o.ah(r[1],c[1],d)/this.worldSize,o.ah(f,_,d))}pointCoordinate(t,r=this._centerAltitude){return this.projection.pointCoordinate(this,t.x,t.y,r)}pointCoordinate3D(t,r){if(!this.elevation)return this.pointCoordinate(t,r);let c=this.projection.pointCoordinate3D(this,t.x,t.y);if(c)return new o.ac(c[0],c[1],c[2]);let d=0,f=this.horizonLineFromTop();if(t.y>f)return this.pointCoordinate(t,r);const _=.02*f,T=t.clone();for(let E=0;E<10&&f-d>_;E++){T.y=o.ah(d,f,.66);const M=this.projection.pointCoordinate3D(this,T.x,T.y);M?(f=T.y,c=M):d=T.y}return c?new o.ac(c[0],c[1],c[2]):this.pointCoordinate(t)}isPointAboveHorizon(t){return this.projection.isPointAboveHorizon(this,t)}isPointOnSurface(t){if(t.y<0||t.y>this.height||t.x<0||t.x>this.width)return!1;if(this.elevation||this.zoom>=o.bY)return!this.isPointAboveHorizon(t);const r=this.pointCoordinate(t);return r.y>=0&&r.y<=1}_coordinatePoint(t,r){const c=r&&this.elevation?this.elevation.getAtPointOrZero(t,this._centerAltitude):this._centerAltitude,d=[t.x*this.worldSize,t.y*this.worldSize,c+t.toAltitude(),1];return o.ad.vec4.transformMat4(d,d,this.pixelMatrix),d[3]>0?new o.P(d[0]/d[3],d[1]/d[3]):new o.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:t,left:r}=this._edgeInsets,c=this.height-this._edgeInsets.bottom,d=this.width-this._edgeInsets.right,f=this.pointLocation3D(new o.P(r,t)),_=this.pointLocation3D(new o.P(d,t)),T=this.pointLocation3D(new o.P(d,c)),E=this.pointLocation3D(new o.P(r,c));
21let M=Math.min(f.lng,_.lng,T.lng,E.lng),I=Math.max(f.lng,_.lng,T.lng,E.lng),P=Math.min(f.lat,_.lat,T.lat,E.lat),R=Math.max(f.lat,_.lat,T.lat,E.lat);const O=Math.pow(2,-this.zoom)/16*270,N=this.projection.name==="globe"?1:4,F=(U,q,Z,J,K)=>{const oe=(U+Z)/2,te=(q+J)/2,ie=new o.P(oe,te),{lng:re,lat:ue}=this.pointLocation3D(ie),me=Math.max(0,M-re,P-ue,re-I,ue-R);M=Math.min(M,re),I=Math.max(I,re),P=Math.min(P,ue),R=Math.max(R,ue),(K<N||me>O)&&(F(U,q,oe,te,K+1),F(oe,te,Z,J,K+1))};if(F(r,t,d,t,1),F(d,t,d,c,1),F(d,c,r,c,1),F(r,c,r,t,1),this.projection.name==="globe"){const[U,q]=o.bZ(this);U?(R=90,I=180,M=-180):q&&(P=-90,I=180,M=-180)}return new o.aB(new o.bO(M,P),new o.bO(I,R))}_getBoundsRectangular(t,r){const{top:c,left:d}=this._edgeInsets,f=this.height-this._edgeInsets.bottom,_=this.width-this._edgeInsets.right,T=new o.P(d,c),E=new o.P(_,c),M=new o.P(_,f),I=new o.P(d,f);let P=this.pointCoordinate(T,t),R=this.pointCoordinate(E,t);const O=this.pointCoordinate(M,r),N=this.pointCoordinate(I,r),F=(U,q)=>(q.y-U.y)/(q.x-U.x);return P.y>1&&R.y>=0?P=new o.ac((1-N.y)/F(N,P)+N.x,1):P.y<0&&R.y<=1&&(P=new o.ac(-N.y/F(N,P)+N.x,0)),R.y>1&&P.y>=0?R=new o.ac((1-O.y)/F(O,R)+O.x,1):R.y<0&&P.y<=1&&(R=new o.ac(-O.y/F(O,R)+O.x,0)),new o.aB().extend(this.coordinateLocation(P)).extend(this.coordinateLocation(R)).extend(this.coordinateLocation(N)).extend(this.coordinateLocation(O))}_getBoundsRectangularTerrain(){const t=this.elevation;if(!t.visibleDemTiles.length||t.isUsingMockSource())return this._getBoundsRectangular(0,0);const r=t.visibleDemTiles.reduce((c,d)=>{if(d.dem){const f=d.dem.tree;c.min=Math.min(c.min,f.minimums[0]),c.max=Math.max(c.max,f.maximums[0])}return c},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(r.min*t.exaggeration(),r.max*t.exaggeration())}getBounds(){return this.projection.name==="mercator"||this.projection.name==="equirectangular"?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(t=!0){const r=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,c=this.height/2-r*(1-this._horizonShift);return t?Math.max(0,c):c}getMaxBounds(){return this.maxBounds}setMaxBounds(t){this.maxBounds=t,this.minLat=-o.bX,this.maxLat=o.bX,this.minLng=-180,this.maxLng=180,t&&(this.minLat=t.getSouth(),this.maxLat=t.getNorth(),this.minLng=t.getWest(),this.maxLng=t.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=o.av(this.minLng)*this.tileSize,this.worldMaxX=o.av(this.maxLng)*this.tileSize,this.worldMinY=o.aC(this.maxLat)*this.tileSize,this.worldMaxY=o.aC(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(t,r){return this.projection.createTileMatrix(this,r,t)}calculateDistanceTileData(t){const r=t.key,c=this._distanceTileDataCache;if(c[r])return c[r];const d=t.canonical,f=1/this.height,_=this.cameraWorldSize,T=_/this.zoomScale(d.z),E=(d.x+Math.pow(2,d.z)*t.wrap)*T,M=d.y*T,I=this.point;I.x*=_/this.worldSize,I.y*=_/this.worldSize;const P=this.angle,R=Math.sin(-P),O=-Math.cos(-P);return c[r]={bearing:[R,O],center:[(I.x-E)*f,(I.y-M)*f],scale:T/o.ai*f},c[r]}calculateFogTileMatrix(t){const r=t.key,c=this._fogTileMatrixCache;if(c[r])return c[r];const d=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,t);return o.ad.mat4.multiply(d,this.worldToFogMatrix,d),c[r]=new Float32Array(d),c[r]}calculateProjMatrix(t,r=!1,c=!1){const d=t.key;let f;if(f=c?this._expandedProjMatrixCache:r?this._alignedProjMatrixCache:this._projMatrixCache,f[d])return f[d];const _=this.calculatePosMatrix(t,this.worldSize);let T;return T=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:c?this.expandedFarZProjMatrix:r?this.alignedProjMatrix:this.projMatrix,o.ad.mat4.multiply(_,T,_),f[d]=new Float32Array(_),f[d]}calculatePixelsToTileUnitsMatrix(t){const r=t.tileID.key,c=this._pixelsToTileUnitsCache;if(c[r])return c[r];const d=o.b_(t,this);return c[r]=d,c[r]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if(this.projection.name==="globe"){const t=1/this.worldSize,r=o.ad.mat4.fromScaling([],[t,t,t]);return o.ad.mat4.multiply(r,r,this.globeMatrix),r}}recenterOnTerrain(){if(!this._elevation||this.projection.name==="globe")return;const t=this._elevation;this._updateCameraState();const r=o.bH(1,this._center.lat)*this.worldSize,c=this._computeCameraPosition(r),d=this._camera.forward(),f=o.bH(1,this._center.lat);c[2]/=f,d[2]/=f,o.ad.vec3.normalize(d,d);const _=t.raycast(c,d,t.exaggeration());if(_){const T=o.ad.vec3.scaleAndAdd([],c,d,_),E=new o.ac(T[0],T[1],o.bH(T[2],o.aT(T[1]))),M=(E.z+o.ad.vec3.length([E.x-c[0],E.y-c[1],E.z-c[2]*f]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(M),this._centerAltitude=E.toAltitude(),this._center=this.coordinateLocation(E),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(t=!1){if(!this._elevation)return;const r=this._elevation,c=o.bH(1,this._center.lat)*this.worldSize,d=this._computeCameraPosition(c),f=r.getAtPointOrZero(new o.ac(...d)),_=this.pixelsPerMeter/this.worldSize*f,T=this._minimumHeightOverTerrain(),E=d[2]-_;if(E<=T)if(E<0||t){const M=this.locationCoordinate(this._center,this._centerAltitude),I=[d[0],d[1],M.z-d[2]],P=o.ad.vec3.length(I);I[2]-=(T-E)/this._pixelsPerMercatorPixel;const R=o.ad.vec3.length(I);if(R===0)return;o.ad.vec3.scale(I,I,P/R*this._pixelsPerMercatorPixel),this._camera.position=[d[0],d[1],M.z*this._pixelsPerMercatorPixel-
21I[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const t=this.projection.name==="globe"||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||t){const R=this.center;return R.lat=o.ay(R.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!t)&&(R.lng=o.ay(R.lng,this.minLng,this.maxLng)),this.center=R,void(this._constraining=!1)}const r=this._unmodified,{x:c,y:d}=this.point;let f=0,_=c,T=d;const E=this.width/2,M=this.height/2,I=this.worldMinY*this.scale,P=this.worldMaxY*this.scale;if(d-M<I&&(T=I+M),d+M>P&&(T=P-M),P-I<this.height&&(f=Math.max(f,this.height/(P-I)),T=(P+I)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const R=this.worldMinX*this.scale,O=this.worldMaxX*this.scale,N=this.worldSize/2-(R+O)/2;_=(c+N+this.worldSize)%this.worldSize-N,_-E<R&&(_=R+E),_+E>O&&(_=O-E),O-R<this.width&&(f=Math.max(f,this.width/(O-R)),_=(O+R)/2)}_===c&&T===d||this._allowWorldUnderZoom||(this.center=this.unproject(new o.P(_,T))),f&&!this._allowWorldUnderZoom&&(this.zoom+=this.scaleZoom(f)),this._constrainCamera(),this._unmodified=r,this._constraining=!1}_minZoomForBounds(){let t=Math.max(0,this.scaleZoom(this.height/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(t=Math.max(t,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),t}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,r=this.projection.name==="globe",c=this.pixelsPerMeter;this.projection.name==="globe"&&(this._mercatorScaleRatio=o.bH(1,this.center.lat)/o.bH(1,o.c8));const d=o.b$(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,d),this.cameraToCenterDistance=.5/Math.tan(.5*this._fov)*this.height*this._pixelsPerMercatorPixel,this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;const f=this.projection.zAxisUnit==="meters"?c:1,_=this._camera.getWorldToCamera(this.worldSize,f);let T;const E=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(E[8]=2*-t.x/this.width,E[9]=2*t.y/this.height,this.isOrthographic){let ue=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),me=ue*this.aspect,Le=-me,Ee=-ue;me-=t.x,Le-=t.x,ue+=t.y,Ee+=t.y,T=this._camera.getCameraToClipOrthographic(Le,me,Ee,ue,this._nearZ,this._farZ),((Ze,We,ot,Se)=>{for(let He=0;He<16;He++)Ze[He]=o.ah(We[He],ot[He],Se)})(T,T,E,o.c9(this.pitch>=ht?1:this.pitch/ht))}else T=E;const M=o.ad.mat4.mul([],E,_);let I=o.ad.mat4.mul([],T,_);if(this.projection.isReprojectedInTileSpace){const ue=this.locationCoordinate(this.center),me=o.ad.mat4.identity([]);o.ad.mat4.translate(me,me,[ue.x*this.worldSize,ue.y*this.worldSize,0]),o.ad.mat4.multiply(me,me,o.c0(this)),o.ad.mat4.translate(me,me,[-ue.x*this.worldSize,-ue.y*this.worldSize,0]),o.ad.mat4.multiply(I,I,me),o.ad.mat4.multiply(M,M,me),this.inverseAdjustmentMatrix=o.c1(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=o.ad.mat4.scale([],I,[this.worldSize,this.worldSize,this.worldSize/f,1]),this.projMatrix=I,this.invProjMatrix=o.ad.mat4.invert(new Float64Array(16),this.projMatrix),r){const ue=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);ue[8]=2*-t.x/this.width,ue[9]=2*t.y/this.height,this.expandedFarZProjMatrix=o.ad.mat4.mul([],ue,_)}else this.expandedFarZProjMatrix=this.projMatrix;const P=o.ad.mat4.invert([],T);this.frustumCorners=o.c2.fromInvProjectionMatrix(P,this.horizonLineFromTop(),this.height),this.cameraFrustum=o.bR.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!r);const R=new Float32Array(16);o.ad.mat4.identity(R),o.ad.mat4.scale(R,R,[1,-1,1]),o.ad.mat4.rotateX(R,R,this._pitch),o.ad.mat4.rotateZ(R,R,this.angle);const O=o.ad.mat4.perspective(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=o.ad.mat4.clone(O);const N=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;O[8]=2*-t.x/this.width,O[9]=2*(t.y+N)/this.height,this.skyboxMatrix=o.ad.mat4.multiply(R,O,R);const F=this.point,U=F.x,q=F.y,Z=this.width%2/2,J=this.height%2/2,K=Math.cos(this.angle),oe=Math.sin(this.angle),te=U-Math.round(U)+K*Z+oe*J,ie=q-Math.round(q)+K*J+oe*Z,re=new Float64Array(I);if(o.ad.mat4.translate(re,re,[te>.5?te-1:te,ie>.5?ie-1:ie,0]),this.alignedProjMatrix=re,I=o.ad.mat4.create(),o.ad.mat4.scale(I,I,[this.width/2,-this.height/2,1]),o.ad.mat4.translate(I,I,[1,-1,0]),this.labelPlaneMatr
21ix=I,I=o.ad.mat4.create(),o.ad.mat4.scale(I,I,[1,-1,1]),o.ad.mat4.translate(I,I,[-1,-1,0]),o.ad.mat4.scale(I,I,[2/this.width,2/this.height,1]),this.glCoordMatrix=I,this.pixelMatrix=o.ad.mat4.multiply(new Float64Array(16),this.labelPlaneMatrix,M),this._calcFogMatrices(),this._distanceTileDataCache={},I=o.ad.mat4.invert(new Float64Array(16),this.pixelMatrix),!I)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=I,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=o.c3(this);const ue=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=o.ad.vec3.transformMat4(ue,ue,_),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=I;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const t=this.cameraWorldSizeForFog,r=this.cameraPixelsPerMeter,c=this._camera.position,d=1/this.height/this._pixelsPerMercatorPixel,f=[t,t,r];o.ad.vec3.scale(f,f,d),o.ad.vec3.scale(c,c,-1),o.ad.vec3.multiply(c,c,f);const _=o.ad.mat4.create();o.ad.mat4.translate(_,_,c),o.ad.mat4.scale(_,_,f),this.mercatorFogMatrix=_,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(t,r,d)}_computeCameraPosition(t){const r=(t=t||this.pixelsPerMeter)/this.pixelsPerMeter,c=this._camera.forward(),d=this.point,f=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*r-t/this.worldSize*this._centerAltitude;return[d.x/this.worldSize-c[0]*f,d.y/this.worldSize-c[1]*f,t/this.worldSize*this._centerAltitude-c[2]*f]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(t){const r=this._maxCameraBoundsDistance()*Math.cos(this._pitch),c=this._camera.position[2],d=t[2];let f=1;this.projection.wrap&&(this.center=this.center.wrap()),d>0&&(f=Math.min((r-c)/d,1)),this._camera.position=o.ad.vec3.scaleAndAdd([],this._camera.position,t,f),this._updateStateFromCamera()}_updateStateFromCamera(){const t=this._camera.position,r=this._camera.forward(),{pitch:c,bearing:d}=this._camera.getPitchBearing(),f=o.bH(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,_=this._mercatorZfromZoom(this._maxZoom)*Math.cos(o.ak(this._maxPitch)),T=Math.max((t[2]-f)/Math.cos(c),_),E=this._zoomFromMercatorZ(T);o.ad.vec3.scaleAndAdd(t,t,r,T),this._pitch=o.ay(c,o.ak(this.minPitch),o.ak(this.maxPitch)),this.angle=o.bF(d,-Math.PI,Math.PI),this._setZoom(o.ay(E,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new o.ac(t[0],t[1],t[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(t){return Math.pow(2,t)*this.tileSize}_mercatorZfromZoom(t){return this.cameraToCenterDistance/this._worldSizeFromZoom(t)}_minimumHeightOverTerrain(){const t=Math.min(this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(t)}_zoomFromMercatorZ(t){return this.scaleZoom(this.cameraToCenterDistance/(t*this.tileSize))}zoomFromMercatorZAdjusted(t){let r=0,c=o.bY,d=0,f=1/0;for(;c-r>1e-6&&c>r;){const _=r+.5*(c-r),T=this.tileSize*Math.pow(2,_),E=this.getCameraToCenterDistance(this.projection,_,T),M=this.scaleZoom(E/(t*this.tileSize)),I=Math.abs(_-M);I<f&&(f=I,d=_),_<M?r=_:c=_}return d}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(o.w("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(t,r){const c=Math.min(t.x,r.x),d=Math.max(t.x,r.x),f=Math.min(t.y,r.y),_=Math.max(t.y,r.y);if(f<this.horizonLineFromTop(!1))return!0;if(this.projection.name!=="mercator")return!1;const T=[new o.P(c,f),new o.P(d,_),new o.P(c,_),new o.P(d,f)],E=this.renderWorldCopies?-3:0,M=this.renderWorldCopies?4:1;for(const I of T){const P=this.pointRayIntersection(I);if(P.t<0)return!0;const R=this.rayIntersectionCoordinate(P);if(R.x<E||R.y<0||R.x>M||R.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+o.c4(this.fovAboveCenter)>88||this.anyCornerOffEdge(new o.P(0,0),new o.P(this.width,this.height))}zoomDeltaToMovement(t,r){const c=o.ad.vec3.length(o.ad.vec3.sub([],this._camera.position,t)),d=this._zoomFromMercatorZ(c)+r;return c-this._mercatorZfromZoom(d)}getCameraPoint(){if(this.projection.name==="globe"){const t=function([r,c,d],f){const _=[r,c,d,1];o.ad.vec4.transformMat4(_,_,f);const T=_[3]=Math.max(_[3],1e-6);return _[0]/=T,_[1]/=T,_[2]/=T,_}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new o.P(t[0],t[1])}{const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new o.P(0,t))}}getCameraToCenterDistance(t,r=this.zoom,c=this.worldSize){const d=o.b$(t,r,this.width,this.height,1024),f=t.pixelSpaceConversion(this.center.lat,c,d);let _=.5/Math.tan(.5*this._fov)*this.height*f;return this.isOrthographic&&(_=o.ah(1,_,o.c9(this.pitch>=ht?1:this.pitch/ht))),_}getWorldToCameraMatrix(){const t=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&o.ad.mat4.multiply(t,t,this.globeMatrix),t}getFrustum(t){return o.bR.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,t,this.projection.zAxisUnit==="meters")}}const fs=(u,t)=>
21{if(t>0&&u.terrain&&o.w("Cutoff is currently disabled on terrain"),t<=0||u.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const r=u.transform,c=Math.max(Math.abs(r._zoom-(u.minCutoffZoom-1)),1),d=r.isLODDisabled(!1)?o.ae(60,45,r.pitch):o.ae(30,15,r.pitch),f=r._farZ-r._nearZ,_=t*r.height,T=((1-(E=d))*r.cameraToCenterDistance+E*(r._farZ+_))*c;var E;return{shouldRenderCutoff:d<1,uniformValues:{u_cutoff_params:[r._nearZ,r._farZ,(T-r._nearZ)/f,(T-_-r._nearZ)/f]}}},Ar={cascadeCount:2,normalOffset:3,shadowMapResolution:2048};class Jh{constructor(t,r){this.aabb=t,this.lastCascade=r}}class Nl{add(t,r){const c=this.receivers[t.key];c!==void 0?(c.aabb.min[0]=Math.min(c.aabb.min[0],r.min[0]),c.aabb.min[1]=Math.min(c.aabb.min[1],r.min[1]),c.aabb.min[2]=Math.min(c.aabb.min[2],r.min[2]),c.aabb.max[0]=Math.max(c.aabb.max[0],r.max[0]),c.aabb.max[1]=Math.max(c.aabb.max[1],r.max[1]),c.aabb.max[2]=Math.max(c.aabb.max[2],r.max[2])):this.receivers[t.key]=new Jh(r,null)}clear(){this.receivers={}}get(t){return this.receivers[t.key]}computeRequiredCascades(t,r,c){const d=o.ce.fromPoints(t.points);let f=0;for(const _ in this.receivers){const T=this.receivers[_];if(!T||!d.intersectsAabb(T.aabb))continue;T.aabb.min=d.closestPoint(T.aabb.min),T.aabb.max=d.closestPoint(T.aabb.max);const E=T.aabb.getCorners();for(let M=0;M<c.length;M++){let I=!0;for(const P of E){const R=[P[0]*r,P[1]*r,P[2]];if(o.ad.vec3.transformMat4(R,R,c[M].matrix),R[0]<-1||R[0]>1||R[1]<-1||R[1]>1){I=!1;break}}if(T.lastCascade=M,f=Math.max(f,M),I)break}}return f+1}}class ms{constructor(t){this.painter=t,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new Nl,this._depthMode=new Pt(t.context.gl.LEQUAL,Pt.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1,t.tp.registerParameter(this,["Shadows"],"_forceDisable",{label:"forceDisable"},()=>{this.painter.style.map.triggerRepaint()}),t.tp.registerParameter(Ar,["Shadows"],"cascadeCount",{min:1,max:2,step:1}),t.tp.registerParameter(Ar,["Shadows"],"normalOffset",{min:0,max:10,step:.05}),t.tp.registerParameter(Ar,["Shadows"],"shadowMapResolution",{min:32,max:2048,step:32}),t.tp.registerBinding(this,["Shadows"],"_numCascadesToRender",{readonly:!0,label:"numCascadesToRender"})}destroy(){for(const t of this._cascades)t.texture.destroy(),t.framebuffer.destroy();this._cascades=[]}updateShadowParameters(t,r){const c=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!r||!r.properties)return;const d=r.properties.get("shadow-intensity");if(!r.shadowsEnabled()||d<=0||(this._shadowLayerCount=c.style.order.reduce((N,F)=>{const U=c.style._mergedLayers[F];return N+(U.hasShadowPass()&&!U.isHidden(t.zoom)?1:0)},0),this._enabled=this._shadowLayerCount>0,!this.enabled))return;const f=c.context,_=Ar.shadowMapResolution,T=Ar.shadowMapResolution;if(this._cascades.length===0||Ar.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let N=0;N<Ar.cascadeCount;++N){const F=c._shadowMapDebug,U=f.gl,q=f.createFramebuffer(_,T,F,"texture"),Z=new o.T(f,{width:_,height:T,data:null},U.DEPTH_COMPONENT16);if(q.depthAttachment.set(Z.texture),F){const J=new o.T(f,{width:_,height:T,data:null},U.RGBA8);q.colorAttachment.set(J.texture)}this._cascades.push({framebuffer:q,texture:Z,matrix:[],far:0,boundingSphereRadius:0,frustum:new o.bR,scale:0})}}this.shadowDirection=Vs(r);let E=0;if(t.elevation){const N=t.elevation,F=[1e4,-1e4];N.visibleDemTiles.filter(U=>U.dem).forEach(U=>{const q=U.dem.tree;F[0]=Math.min(F[0],q.minimums[0]),F[1]=Math.max(F[1],q.maximums[0])}),F[0]!==1e4&&(E=(F[1]-F[0])*N.exaggeration())}const M=1.5*t.cameraToCenterDistance,I=3*M,P=new Float64Array(16);for(let N=0;N<this._cascades.length;++N){const F=this._cascades[N];let U=t.height/50,q=1;Ar.cascadeCount===1?q=I:N===0?q=M:(U=M,q=I);const[Z,J]=$o(t,this.shadowDirection,U,q,Ar.shadowMapResolution,E);F.scale=t.scale,F.matrix=Z,F.boundingSphereRadius=J,o.ad.mat4.invert(P,F.matrix
vendor: 1,737 bytes, line 21
21),F.frustum=o.bR.fromInvProjectionMatrix(P,1,0,!0),F.far=q}const R=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[R].far,this._cascades[R].far],this._uniformValues.u_shadow_intensity=d,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=1/Ar.shadowMapResolution,this._uniformValues.u_shadow_map_resolution=Ar.shadowMapResolution,this._uniformValues.u_shadowmap_0=Ji.ShadowMap0,this._uniformValues.u_shadowmap_1=Ji.ShadowMap0+1,this._groundShadowTiles=c.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});const O=c.transform.elevation;for(const N of this._groundShadowTiles){let F={min:0,max:0};if(O){const U=O.getMinMaxForTile(N);U&&(F=U)}this.addShadowReceiver(N.toUnwrapped(),F.min,F.max)}}get enabled(){return this._enabled&&!this._forceDisable}set enabled(t){this._enabled=t}drawShadowPass(t,r){if(!this.enabled)return;const c=this.painter,d=c.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(c.transform.getFrustum(0),c.transform.worldSize,this._cascades),d.viewport.set([0,0,Ar.shadowMapResolution,Ar.shadowMapResolution]);for(let f=0;f<this._numCascadesToRender;++f){c.currentShadowCascade=f,d.bindFramebuffer.set(this._cascades[f].framebuffer.framebuffer),d.clear({color:o.al.white,depth:1});for(const _ of t.order){const T=t._mergedLayers[_];if(!T.hasShadowPass()||T.isHidden(c.transform.zoom))continue;const E=t.getLayerSourceCache(T),M=E?r[E.id]:void 0;(T.type==="model"||M&&M.length)&&c.renderLayer(c,E,T,M)}}c.currentShadowCascade=0}drawGroundShadows(){if(!this.enabled)return;const t=this.painter,r=t.style,c=t.context,d=r.directionalLight,f=r.ambientLight;
21if(!d||!f)return;const _=[],T=fs(t,t.longestCutoffRange);T.shouldRenderCutoff&&_.push("RENDER_CUTOFF"),_.push("RENDER_SHADOWS","DEPTH_TEXTURE"),this.useNormalOffset&&_.push("NORMAL_OFFSET");const E=Go(r,d,f),M=new Pt(c.gl.LEQUAL,Pt.ReadOnly,t.depthRangeFor3D);for(const I of this._groundShadowTiles){const P=I.toUnwrapped(),R=t.isTileAffectedByFog(I),O=t.getOrCreateProgram("groundShadow",{defines:_,overrideFog:R});this.setupShadows(P,O),t.uploadCommonUniforms(c,O,P,null,T);const N={u_matrix:t.transform.calculateProjMatrix(P),u_ground_shadow_factor:E};O.draw(t,c.gl.TRIANGLES,M,$t.disabled,ii.multiply,jt.disabled,N,"ground_shadow",t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments,null,t.transform.zoom,null,null)}}getShadowPassColorMode(){return this.painter._shadowMapDebug?ii.unblended:ii.disabled}getShadowPassDepthMode(){return this._depthMode}getShadowCastingLayerCount(){return this._shadowLayerCount}calculateShadowPassMatrixFromTile(t){const r=this.painter.transform,c=r.calculatePosMatrix(t,r.worldSize);return o.ad.mat4.multiply(c,this._cascades[this.painter.currentShadowCascade].matrix,c),Float32Array.from(c)}calculateShadowPassMatrixFromMatrix(t){return o.ad.mat4.multiply(t,this._cascades[this.painter.currentShadowCascade].matrix,t),Float32Array.from(t)}setupShadows(t,r,c,d=0){if(!this.enabled)return;const f=this.painter.transform,_=this.painter.context,T=_.gl,E=this._uniformValues,M=new Float64Array(16),I=f.calculatePosMatrix(t,f.worldSize);for(let P=0;P<this._cascades.length;P++)o.ad.mat4.multiply(M,this._cascades[P].matrix,I),E[P===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(M),_.activeTexture.set(T.TEXTURE0+Ji.ShadowMap0+P),this._cascades[P].texture.bind(T.NEAREST,T.CLAMP_TO_EDGE);if(this.useNormalOffset=!!c,this.useNormalOffset){const P=o.cd(t.canonical),R=2/f.tileSize*o.ai/Ar.shadowMapResolution,O=R*this._cascades[0].boundingSphereRadius,N=R*this._cascades[this._cascades.length-1].boundingSphereRadius,F=(c==="vector-tile"?1:3)/Math.pow(2,d-t.canonical.z-(1-f.zoom+Math.floor(f.zoom)));E.u_shadow_normal_offset=[P,O*F,N*F],E.u_shadow_bias=[6e-5,.0012,.012]}else E.u_shadow_bias=[36e-5,.0012,.012];r.setShadowUniformValues(_,E)}setupShadowsFromMatrix(t,r,c=!1){if(!this.enabled)return;const d=this.painter.context,f=d.gl,_=this._uniformValues,T=new Float64Array(16);for(let E=0;E<Ar.cascadeCount;E++)o.ad.mat4.multiply(T,this._cascades[E].matrix,t),_[E===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(T),d.activeTexture.set(f.TEXTURE0+Ji.ShadowMap0+E),this._cascades[E].texture.bind(f.NEAREST,f.CLAMP_TO_EDGE);if(this.useNormalOffset=c,c){const E=Ar.normalOffset;_.u_shadow_normal_offset=[1,E,E],_.u_shadow_bias=[6e-5,.0012,.012]}else _.u_shadow_bias=[36e-5,.0012,.012];r.setShadowUniformValues(d,_)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(t,r,c,d){if(d[2]>=0)return{};const f=function(E,M,I){const P=I/(1<<E.canonical.z);return new o.ce([E.canonical.x*P+E.wrap*I,E.canonical.y*P+E.wrap*I,0],[(E.canonical.x+1)*P+E.wrap*I,(E.canonical.y+1)*P+E.wrap*I,M])}(t,r,c).getCorners(),_=r/-d[2];d[0]<0?(o.ad.vec3.add(f[0],f[0],[d[0]*_,0,0]),o.ad.vec3.add(f[3],f[3],[d[0]*_,0,0])):d[0]>0&&(o.ad.vec3.add(f[1],f[1],[d[0]*_,0,0]),o.ad.vec3.add(f[2],f[2],[d[0]*_,0,0])),d[1]<0?(o.ad.vec3.add(f[0],f[0],[0,d[1]*_,0]),o.ad.vec3.add(f[1],f[1],[0,d[1]*_,0])):d[1]>0&&(o.ad.vec3.add(f[2],f[2],[0,d[1]*_,0]),o.ad.vec3.add(f[3],f[3],[0,d[1]*_,0]));const T={};return T.vertices=f,T.planes=[qo(f[1],f[0],f[4]),qo(f[2],f[1],f[5]),qo(f[3],f[2],f[6]),qo(f[0],f[3],f[7])],T}addShadowReceiver(t,r,c){this._receivers.add(t,o.ce.fromTileIdAndHeight(t,r,c))}getMaxCascadeForTile(t){const r=this._receivers.get(t);return r&&r.lastCascade?r.lastCascade:0}}function qo(u,t,r){const c=o.ad.vec3.sub([],r,t),d=o.ad.vec3.sub([],u,t),f=o.ad.vec3.cross([],c,d),_=o.ad.vec3.length(f);return _===0?[0,0,1,0]:(o.ad.vec3.scale(f,f,1/_),[f[0],f[1],f[2],-o.ad.vec3.dot(f,t)])}function Vs(u){const t=u.properties.get("direction"),r=o.cc(t.x,t.y,t.z);r[2]=o.ay(r[2],0,75);const c=o.cf([r[0],r[1],r[2]]);return o.ad.vec3.fromValues(c.x,c.y,c.z)}function Go(u,t,r){const c=t.properties.get("color-use-theme")==="none",d=t.properties.get("color"),f=t.properties.get("intensity"),_=t.properties.get("direction"),T=[_.x,_.y,_.z],E=r.properties.get("color-use-theme")==="none",M=r.properties.get("color"),I=r.properties.get("intensity"),P=Math.max(o.ad.vec3.dot([0,0,1],T),0),R=[0,0,0];o.ad.vec3.scale(R,M.toRenderColor(E?null:u.getLut(t.scope)).toArray01Linear().slice(0,3),I);const O=[0,0,0];return o.ad.vec3.scale(O,d.toRenderColor(c?null:u.getLut(r.scope)).toArray01Linear().slice(0,3),P*f),o.cg([R[0]>0?R[0]/(R[0]+O[0]):0,R[1]>0?R[1]/(R[1]+O[1]):0,R[2]>0?R[2]/(R[2]+O[2]):0])}function $o(u,t,r,c,d,f){const _=u.zoom,T=u.scale,E=u.worldSize,M=1/E,I=u.aspect,P=Math.sqrt(1+I*I)*Math.tan(.5*u.fovX),R=P*P,O=c-r,N=c+r;let F,U;R>O/N?(F=c,U=c*P):(F=.5*N*(1+R),U=.5*Math.sqrt(O*O+2*(c*c+r*r)*R+N*N*R*R));const q=u.projection.pixelsPerMeter(u.center.lat,E),Z=u._camera.getCameraToWorldMercator(),J=[0,0,-F*M];o.ad.vec3.transformMat4(J,J,Z);let K=U*M;const oe=u._edgeInsets;if(!(oe.left===0&&oe.top===0&&oe.right===0&&oe.bottom===0||oe.left===oe.right&&oe.top===oe.bottom)){const Ke=u._camera.getWorldToCamera(u.worldSize,u.projection.zAxisUnit==="meters"?q:1),De=u._camera.getCameraToClipPerspective(u._fov,u.width/u.height,r,c);De[8]=2*-u.centerOffset.x/u.width,De[9]=2*u.centerOffset.y/u.height;const Qe=new Float64Array(16);o.ad.mat4.mul(Qe,De,Ke);const pt=new Float64Array(16);o.ad.mat4.invert(pt,Qe);
21const ft=o.bR.fromInvProjectionMatrix(pt,E,_,!0);for(const mt of ft.points){const Et=((te=mt)[0]/=T,te[1]/=T,te[2]=o.bH(te[2],u._center.lat),te);K=Math.max(K,o.ad.vec3.len(o.ad.vec3.subtract([],J,Et)))}}var te;K*=d/(d-1);const ie=Math.acos(t[2]),re=Math.atan2(-t[0],-t[1]),ue=new jo;ue.position=J,ue.setPitchBearing(ie,re);const me=ue.getWorldToCamera(E,q),Le=K*E,Ee=Math.min(u._mercatorZfromZoom(17)*E*-2,-2*Le),Ze=ue.getCameraToClipOrthographic(-Le,Le,-Le,Le,Ee,(Le+f*q)/t[2]),We=new Float64Array(16);o.ad.mat4.multiply(We,Ze,me);const ot=o.ad.vec3.fromValues(Math.floor(1e6*J[0])/1e6*E,Math.floor(1e6*J[1])/1e6*E,0),Se=.5*d,He=[0,0,0];o.ad.vec3.transformMat4(He,ot,We),o.ad.vec3.scale(He,He,Se);const we=[Math.floor(He[0]),Math.floor(He[1]),Math.floor(He[2])],$e=[0,0,0];o.ad.vec3.sub($e,He,we),o.ad.vec3.scale($e,$e,-1/Se);const Ve=new Float64Array(16);return o.ad.mat4.identity(Ve),o.ad.mat4.translate(Ve,Ve,$e),o.ad.mat4.multiply(We,Ve,We),[We,Le]}class Qp extends o.E{constructor(t){super(),this.requestManager=t,this.models={"":{}},this.modelUris={"":{}},this.numModelsLoading={}}loadModel(t,r){return o.aN(this.requestManager.transformRequest(r,o.R.Model).url).then(c=>{if(!c)return;const d=o.aO(c),f=new o.aP(t,void 0,void 0,d);return f.computeBoundsAndApplyParent(),f}).catch(c=>{if(c&&c.status===404)return null;this.fire(new o.z(new Error(`Could not load model ${t} from ${r}: ${c.message}`)))})}load(t,r,c={keepNumReferences:!1}){this.models[r]||(this.models[r]={});const d=Object.keys(t);this.numModelsLoading[r]=(this.numModelsLoading[r]||0)+d.length;const f=[];for(const _ of d)f.push(this.loadModel(_,t[_]));Promise.allSettled(f).then(_=>{for(let T=0;T<_.length;T++){const{status:E,value:M}=_[T];if(E==="fulfilled"&&M){const I=this.models[r][d[T]];this.models[r][d[T]]={model:M,numReferences:c.keepNumReferences&&I?I.numReferences:1}}}this.numModelsLoading[r]-=d.length,this.fire(new o.A("data",{dataType:"style"}))}).catch(_=>{this.fire(new o.z(new Error(`Could not load models: ${_.message}`)))})}isLoaded(){for(const t in this.numModelsLoading)if(this.numModelsLoading[t]>0)return!1;return!0}hasModel(t,r){return!!this.getModel(t,r)}getModel(t,r){return this.models[r]||(this.models[r]={}),this.models[r][t]?this.models[r][t].model:void 0}
21addModel(t,r,c){this.models[c]||(this.models[c]={}),this.modelUris[c]||(this.modelUris[c]={}),this.hasModel(t,c)&&this.models[c][t].numReferences++,this.modelUris[c][t]=this.requestManager.normalizeModelURL(r),this.load({[t]:this.modelUris[c][t]},c)}addModels(t,r){this.models[r]||(this.models[r]={}),this.modelUris[r]||(this.modelUris[r]={});const c=this.modelUris[r];for(const d in t)this.models[r][d]={},c[d]=this.requestManager.normalizeModelURL(t[d]);this.load(c,r,{keepNumReferences:!0})}reloadModels(t){this.load(this.modelUris[t],t)}addModelsFromBucket(t,r){this.models[r]||(this.models[r]={}),this.modelUris[r]||(this.modelUris[r]={});const c={};for(const d of t)this.hasModel(d,r)?this.models[r][d].numReferences++:(this.modelUris[r][d]=this.requestManager.normalizeModelURL(d),c[d]=this.modelUris[r][d]);this.load(c,r)}removeModel(t,r){if(this.models[r]&&this.models[r][t]&&(this.models[r][t].numReferences--,this.models[r][t].numReferences===0)){const c=this.models[r][t].model;delete this.models[r][t],delete this.modelUris[r][t],c.destroy()}}listModels(t){return this.models[t]||(this.models[t]={}),Object.keys(this.models[t])}upload(t,r){this.models[r]||(this.models[r]={});for(const c in this.models[r])this.models[r][c].model&&this.models[r][c].model.upload(t.context)}}const ef=new o.a7({data:new o.a8(o.a5.colorTheme.data)}),ru={"mbx-indoor-active-floorplans":{default:["literal",[]]},"mbx-indoor-underground":{default:["literal",!1]},"mbx-indoor-loaded-levels":{default:["literal",[]]},"mbx-indoor-level-height":{default:["literal",{}]},"mbx-indoor-level-base":{default:["literal",{}]},"mbx-indoor-level-selected":{default:["literal",{}]},"mbx-indoor-level-overlapped":{default:["literal",{}]}};function Qh(u){return u=u||{},Object.assign(u,ru)}class ed extends o.E{constructor(t){super(),this.mergeFloors=!0,this._scope=void 0,this._queryFeatureSetId=void 0,this._buildingEntryFeatureSetId=void 0,this._selectedFloorplan=void 0,this._indoorData=void 0,this._selectedLevel=void 0,this._floorplanStates={},o.aQ(["_onLoad","_onMove","_checkFloorplanVisible"],this),this._map=t,this._checkFloorplanVisible(!0),this._map.on("load",this._onLoad),this._map.on("move",this._onMove)}destroy(){this._map.indoor.off("load",this._onLoad),this._map.indoor.off("move",this._onMove),this._map=void 0}_onLoad(){this._map.style.forEachFragmentStyle(t=>{t.stylesheet.indoor&&(this._queryFeatureSetId?this.fire(new o.z(new Error("Multiple indoor map styles detected, simultaneous usage is not allowed currently."))):(this._queryFeatureSetId=t.stylesheet.indoor.floorplanFeaturesetId,this._buildingEntryFeatureSetId=t.stylesheet.indoor.buildingFeaturesetId,this._scope=t.scope))}),this._queryFeatureSetId&&this._buildingEntryFeatureSetId&&this._map.addInteraction("mbx-indoor-buildingclick",{type:"click",target:{featuresetId:this._buildingEntryFeatureSetId,importId:this._scope},handler:t=>(t.feature&&t.feature.properties.floorplan&&this.selectFloorplan(t.feature.properties.floorplan),!0)}),this._checkFloorplanVisible(!0)}_onMove(){this._checkFloorplanVisible(!1)}_checkFloorplanVisible(t){if(!this._queryFeatureSetId||!this._map.isStyleLoaded()||this._map.transform.zoom<13)return;this._indoorData&&!function(_,T){const[E,M]=_,{center:I,radius:P}=T,[R,O]=I,N=Math.abs(E-R);return Math.sqrt((N>180?360-N:N)**2+(M-O)**2)<=P}([this._map.getCenter().lng,this._map.getCenter().lat],this._indoorData.circumCircle)&&(this._indoorData=void 0,this._selectedFloorplan=void 0,this._map.setConfigProperty(this._scope,"mbx-indoor-underground",!1),this._map.setConfigProperty(this._scope,"mbx-indoor-active-floorplans",["literal",[]]),this.fire(new o.A("floorplangone")));const r={target:{featuresetId:this._queryFeatureSetId,importId:this._scope}},c=new o.P(this._map.transform.width/2,this._map.transform.height/2),d=[new o.P(0,0),new o.P(this._map.transform.width,this._map.transform.height)],f=this._map.queryRenderedFeatures(t?d:c,r);f.length>0&&(this._selectedFloorplan&&f[0].properties.id===this._selectedFloorplan.properties.id||(this._selectedFloorplan=f[0],this._floorplanSelected(!1)))}
21_floorplanSelected(t){this._indoorData=JSON.parse(this._selectedFloorplan.properties["indoor-data"]),this._indoorData.id=this._selectedFloorplan.properties.id,this._indoorData.circumCircle=function(f){const[[_,T],[E,M]]=f,I=(E-_+360)%360,P=I>180?360-I:I;return{center:[(_+P/2+360)%360,(T+M)/2],radius:Math.sqrt(P**2+(M-T)**2)/2}}(this._indoorData.extent),this._floorplanStates[this._indoorData.id]||(this._floorplanStates[this._indoorData.id]={});const r=this._floorplanStates[this._indoorData.id].selectedBuilding,c=this._floorplanStates[this._indoorData.id].selectedLevel;let d;if(this._map.setConfigProperty(this._scope,"mbx-indoor-active-floorplans",this._indoorData.floorplanIDs),this._selectedLevel)for(const f of this._indoorData.levels)f.id===this._selectedLevel.id&&(d=f.id);if(this.fire(new o.A("floorplanselected",{buildings:this._indoorData.buildings,levels:this._indoorData.levels,selectedLevelId:d})),r){const f=this._indoorData.buildings.find(_=>_.id===r);this._buildingSelected(f,!1)}else this._indoorData.buildings.length>0&&this._buildingSelected(this._indoorData.buildings[0],!1);if(c){const f=this._indoorData.levels.find(_=>_.id===c);this._updateLevels(f,t)}else t&&this._indoorData["default-levels"].length>0&&this.selectLevel(this._indoorData["default-levels"][0])}_buildingSelected(t,r){r&&t&&t.extent&&this._map.fitBounds(t.extent,{pitch:this._map.getPitch(),bearing:this._map.getBearing()}),this._floorplanStates[this._indoorData.id].selectedBuilding=t?t.id:void 0;const c=this._indoorData.levels.filter(d=>t.levels.includes(d.id));this.fire(new o.A("buildingselected",{buildingId:t.id,levels:c}))}_levelSelected(t){if(t==="overview")this._updateLevels(void 0,!0);else{const r=this._indoorData.levels.find(c=>c.id===t);this._updateLevels(r,!0)}this.fire(new o.A("levelselected",{levelId:t==="overview"?void 0:t}))}_updateLevels(t,r){if(!t)return this._map.setConfigProperty(this._scope,"mbx-indoor-loaded-levels",["literal",[]]),this._map.setConfigProperty(this._scope,"mbx-indoor-underground",!1),this._floorplanStates[this._indoorData.id].selectedLevel=void 0,void(r&&this._indoorData.extent&&this._map.fitBounds(this._indoorData.extent,{pitch:this._map.getPitch(),bearing:this._map.getBearing()}));function c(M){const I=M.indexOf("/floor/");if(I===-1)return M;const P=I+7,R=M.indexOf("/",P);return R===-1?M.slice(P):M.slice(P,R)}this._selectedLevel=t,this._floorplanStates[this._indoorData.id].selectedLevel=t?t.id:void 0;const d=[],f={},_={},T={},E={};for(const M of this._indoorData.levels)if(d.push(M.id),f[M.id]=M.height,_[M.id]=M.base,t){if(this.mergeFloors){const I=c(t.id),P=c(M.id);T[M.id]=P===I?"true":"false"}else T[M.id]=M.id===t.id?"true":"false";E[M.id]=M.base<t.base?"true":"false"}else E[M.id]=!0;if(this._map.setConfigProperty(this._scope,"mbx-indoor-loaded-levels",["literal",d]),this._map.setConfigProperty(this._scope,"mbx-indoor-level-height",["literal",f]),this._map.setConfigProperty(this._scope,"mbx-indoor-level-base",["literal",_]),this._map.setConfigProperty(this._scope,"mbx-indoor-level-selected",["literal",T]),this._map.setConfigProperty(this._scope,"mbx-indoor-level-overlapped",["literal",E]),t&&(this._map.setConfigProperty(this._scope,"mbx-indoor-underground",!!t.isUnderground),r&&t.extent)){const M=this._map.cameraForBounds(t.extent,{pitch:this._map.getPitch(),bearing:this._map.getBearing()}),I=this._map.getZoom(),P=M.zoom?Math.abs(I-M.zoom):0;this._map.fitBounds(t.extent,P>=1?{pitch:this._map.getPitch(),bearing:this._map.getBearing()}:{pitch:this._map.getPitch(),bearing:this._map.getBearing(),zoom:I})}}selectFloorplan(t){const r={target:{featuresetId:this._queryFeatureSetId,importId:this._scope}},c=[new o.P(0,0),new o.P(this._map.transform.width,this._map.transform.height)],d=this._map.queryRenderedFeatures(c,r);if(d.length>0){for(const f of d)if(JSON.parse(f.properties["indoor-data"]).floorplanIDs.includes(t)){this._selectedFloorplan=f,this._floorplanSelected(!0);break}}}selectBuilding(t){const r=this._indoorData.buildings.find(c=>c.id===t);this._buildingSelected(r,!0)}selectLevel(t){this._levelSelected(t)}}function td(u){if(!u.metadata||!u.metadata.content_area)return;const t=o.q.devicePixelRatio,{left:r,top:c,width:d,height:f}=u.metadata.content_area,_=r*t,T=c*t;return[_,T,_+d*t,T+f*t]}function Vl(u){if(u)return u.map(([t,r])=>[t*o.q.devicePixelRatio,r*o.q.devicePixelRatio])}class tf{constructor(t,r){this.id=t,this.style=r}addIcons(t){const r=new Map;for(const[c,d]of t.entries()){const f=o.I.from({name:c,iconsetId:this.id});r.set(f,d)}this.style.addImages(r)}}const fo=(u,t)=>ze(u,t&&t.filter(r=>r.identifier!=="source.canvas")),rf=o.aA(_i,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setSnow","setRain","setProjection","setCamera","addImport","removeImport","updateImport"]),nf=o.aA(_i,["setCenter","setZoom","setBearing","setP
21itch"]),Ul=new Set(["background","sky","slot","custom"]),id={version:8,layers:[],sources:{}},ja={duration:300,delay:0};class Nn extends o.E{constructor(t,r={}){super(),this.map=t,this.scope=r.scope||"",this.globalId=null,this.fragments=[],this.importDepth=r.importDepth||0,this.importsCache=r.importsCache||new Map,this.resolvedImports=r.resolvedImports||new Set,this.transition=o.l({},ja),this._buildingIndex=new Wh(this),this.crossTileSymbolIndex=new Jp,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._clipLayerPresent=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._changes=r.styleChanges||new Ds,this.dispatcher=r.dispatcher?r.dispatcher:new o.D(o.cj(),this),r.imageManager?this.imageManager=r.imageManager:(this.imageManager=new Dn(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.createScope(this.scope),this.glyphManager=r.glyphManager?r.glyphManager:new o.ck(t._requestManager,r.localFontFamily?o.cl.all:r.localIdeographFontFamily?o.cl.ideographs:o.cl.none,r.localFontFamily||r.localIdeographFontFamily),r.modelManager?this.modelManager=r.modelManager:(this.modelManager=new Qp(t._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._order=[],this._markersNeedUpdate=!1,this.options=r.configOptions?r.configOptions:new Map,this._configDependentLayers=r.configDependentLayers?r.configDependentLayers:new Set,this._config=r.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:r.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=r.initialConfig,this.dispatcher.broadcast("setReferrer",o.cm());const c=this;this._rtlTextPluginCallback=Nn.registerForPluginStateChange(d=>{c.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:d.pluginStatus,pluginURL:d.pluginURL},(f,_)=>{if(o.cn(f),_&&_.every(T=>T))for(const T in c._sourceCaches){const E=c._sourceCaches[T],M=E.getSource().type;M!=="vector"&&M!=="geojson"||E.reload()}})}),this.on("data",d=>{if(d.dataType!=="source"||d.sourceDataType!=="metadata")return;const f=this.getOwnSource(d.sourceId);if(f&&f.vectorLayerIds)for(const _ in this._layers){const T=this._layers[_];T.source===f.id&&this._validateLayer(T)}})}load(t){return t?(typeof t=="string"?this.loadURL(t):this.loadJSON(t),this):this}_getGlobalId(t){if(!t)return null;if(typeof t=="string"){if(o.f(t))return t;const r=o.co(t);if(!r.startsWith("http"))try{return new URL(r,location.href).toString()}catch{return r}return r}return`json://${o.cp(JSON.stringify(t))}`}_diffStyle(t,r,c){this.globalId=this._getGlobalId(t);const d=(f,_)=>{try{_(null,this.setState(f,c))}catch(T){_(T,!1)}};if(typeof t=="string"){const f=this.map._requestManager.normalizeStyleURL(t),_=this.map._requestManager.transformRequest(f,o.R.Style);o.n(_,(T,E)=>{T?this.fire(new o.z(T)):E&&d(E,r)})}else typeof t=="object"&&d(t,r)}loadURL(t,r={}){this.fire(new o.A("dataloading",{dataType:"style"}));const c=typeof r.validate=="boolean"?r.validate:!o.f(t);this.globalId=this._getGlobalId(t),t=this.map._requestManager.normalizeStyleURL(t,r.accessToken),this.resolvedImports.add(t);const d=this.importsCache.get(t);if(d)return this._load(d,c);const f=this.map._requestManager.transformRequest(t,o.R.Style);this._request=o.n(f,(_,T)=>{if(this._request=null,_)this.fire(new o.z(_));else if(T)return this.importsCache.set(t,T),this._load(T,c)})}loadJSON(t,r={}){this.fire(new o.A("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(t),this._request=o.q.frame(()=>{this._request=null,this._load(t,r.validate!==!1)})}loadEmpty(){this.fire(new o.A("dataloading",{dataType:"style"})),this._load(id,!1)}_loadImports(t,r,c){if(this.importDepth>=4)return o.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const d=[];for(const f of t){const _=this._createFragmentStyle(f),T=new Promise(I=>{_.once("style.import.load",I),_.once("error",I)}).then(()=>this.mergeAll());if(d.push(T),this.resolvedImports.has(f.url)){_.loadEmpty();continue}const E=f.data||this.importsCache.get(f.url);E?(_.loadJSON(E,{validate:r}),this._isInternalStyle(E)&&(_.globalId=null)):f.url?_.loadURL(f.url,{validate:r}):_.loadEmpty();const M={style:_,id:f.id,config:f.config};if(c){const I=this.fragments.findIndex(({id:P})=>P===c);this.fragments=this.fragments.slice(0,I).concat(M).concat(this.fragments.slice(I))}else this.fragments.push(M)}return Promise.allSettled(d)}getImportGlobalIds(t=this,r=new Set){for(const c of t.fragments)c.style.globalId&&r.add(c.style.globalId),this.getImportGlobalIds(c.style,r);return[...r.values()]}_createFragmentStyle(t){const r=this.scope?o.C(t.id,this.scope):t.id;let c;const d=this._initialConfig&&this._initialConfig[r];(t.config||d)&&(c=o.l({},t.config,d));const f=new Nn(this.map,{scope:r,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:c,configOptions:this.options,colorThemeOverride:t["color-theme"],configDependentLayers:this._configDependentLayers});return f.setEventedParent(this.map,{style:f}),f}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.map._precompilePrograms&&this.isRootStyle()}_isInternalStyle(t){return this.isRootStyle()&&(t.fragment||!!t.schema&&t.fragment!==!1)}_load(t,r){const c=t.indoor?Qh(t.schema):t.schema;if(this._isInternalStyle(t)){const _=o.l({},id,{imports:[{id:"basemap",data:t,url:""}]});return void this._load(_,r)}if(this.updateConfig(this._config,c),r&&fo(this,Wr(t)))return;this._loaded=!0,this.stylesheet=o.cq(t);const d=()=>{for(const M in t.sources)this.addSource(M,t.sources[M],{validate:!1,isInitialLoad:!0});
21if(t.iconsets)for(const M in t.iconsets)this.addIconset(M,t.iconsets[M]);t.sprite?this._loadIconset(t.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),this.setGlyphsUrl(t.glyphs);const _=Da(this.stylesheet.layers);if(this._order=_.map(M=>M.id),this.stylesheet.light&&o.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(this.stylesheet.lights.length===1&&this.stylesheet.lights[0].type==="flat"){const M=this.stylesheet.lights[0];this.light=new ke(M.properties,M.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new ke(this.stylesheet.light)),this._layers={};for(const M of _){const I=o.cv(M,this.scope,this._styleColorTheme.lut,this.options);I.configDependencies.size!==0&&this._configDependentLayers.add(I.fqid),I.setEventedParent(this,{layer:{id:I.id}}),this._layers[I.id]=I;const P=this.getOwnLayerSourceCache(I),R=!!this.directionalLight&&this.directionalLight.shadowsEnabled();P&&I.canCastShadows()&&R&&(P.castsShadows=!0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.modelManager.addModels(this.stylesheet.models,this.scope);const T=this.stylesheet.terrain;T&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(T,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.snow&&this._createSnow(this.stylesheet.snow),this.stylesheet.rain&&this._createRain(this.stylesheet.rain),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new o.A("data",{dataType:"style"}));const E=this.isRootStyle();t.imports?this._loadImports(t.imports,r).then(()=>{this._reloadImports(),this.fire(new o.A(E?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new o.A(E?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];const f=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(f){const _=this._evaluateColorThemeData(f);this._loadColorTheme(_).then(()=>{d()}).catch(T=>{o.w(`Couldn't load color theme from the stylesheet: ${T}`),d()})}else this._styleColorTheme.lut=null,d()}isRootStyle(){return this.importDepth===0}mergeAll(){let t,r,c,d,f,_,T,E,M,I;const P={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(R=>{if(R.stylesheet){if(R.light!=null&&(t=R.light),R.stylesheet.lights)for(const O of R.stylesheet.lights)O.type==="ambient"&&R.ambientLight!=null&&(r=R.ambientLight),O.type==="directional"&&R.directionalLight!=null&&(c=R.directionalLight);d=this._prioritizeTerrain(d,R.terrain,R.stylesheet.terrain),R.stylesheet.fog&&R.fog!=null&&(f=R.fog),R.stylesheet.snow&&R.snow!=null&&(_=R.snow),R.stylesheet.rain&&R.rain!=null&&(T=R.rain),R.stylesheet.camera!=null&&(I=R.stylesheet.camera),R.stylesheet.projection!=null&&(E=R.stylesheet.projection),R.stylesheet.transition!=null&&(M=R.stylesheet.transition),P[R.scope]=R._styleColorTheme}}),this.light=t,this.ambientLight=r,this.directionalLight=c,this.fog=f,this.snow=_,this.rain=T,this._styleColorThemeForScope=P,d===null?delete this.terrain:this.terrain=d,this.camera=I||{"camera-projection":"perspective"},this.projection=E||{name:"mercator"},this.transition=o.l({},ja,M),this.mergeSources(),this.mergeLayers()}forEachFragmentStyle(t){const r=c=>{for(const d of c.fragments)r(d.style);t(c)};r(this)}_prioritizeTerrain(t,r,c){const d=t&&t.drapeRenderMode===0;return c===null?r&&r.drapeRenderMode===0?r:d?t:null:r!=null&&(!t||d||r&&r.drapeRenderMode===1)?r:t}mergeTerrain(){let t;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(r=>{t=this._prioritizeTerrain(t,r.terrain,r.stylesheet.terrain)}),t===null?delete this.terrain:this.terrain=t}mergeProjection(){let t;this.forEachFragmentStyle(r=>{r.stylesheet.projection!=null&&(t=r.stylesheet.projection)}),this.projection=t||{name:"mercator"}}mergeSources(){const t={},r={},c={};this.forEachFragmentStyle(d=>{for(const f in d._sourceCaches){const _=o.C(f,d.scope);t[_]=d._sourceCaches[f]}for(const f in d._otherSourceCaches){const _=o.C(f,d.scope);r[_]=d._otherSourceCaches[f]}for(const f in d._symbolSourceCaches){const _=o.C(f,d.scope);c[_]=d._symbolSourceCaches[f]}}),this._mergedSourceCaches=t,this._mergedOtherSourceCaches=r,this._mergedSymbolSourceCaches=c}mergeLayers(){const t={},r=[],c={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(f=>{for(const _ of f._order){const T=f._layers[_];if(T.type==="slot"){const E=o.cr(_);if(t[E])continue;t[E]=[]}T.slot&&t[T.slot]?t[T.slot].push(T):r.push(T)}}),this._mergedOrder=[];const d=(f=[])=>{for(const _ of f)if(_.type==="slot"){const T=o.cr(_.id);t[T]&&d(t[T]),this._mergedSlots.push(T)}else{const T=o.C(_.id,_.scope);this._mergedOrder.push(T),c[T]=_,_.is3D(!!this.terrain)&&(this._has3DLayers=!0),_.type==="circle"&&(this._hasCircleLayers=!0),_.type==="symbol"&&(this._hasSymbolLayers=!0),_.type==="clip"&&(this._clipLayerPresent=!0)}};d(r),this._mergedOrder.sort((f,_)=>{const T=c[f],E=c[_];return T.hasInitialOcclusionOpacityProperties?E.is3D(!!this.terrain)?1:0:T.is3D(!!this.terrain)&&E.hasInitialOcclusionOpacityProperties?-1:0}),this._mergedLayers=c,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged()}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}getCamera(){return this.stylesheet.camera}setCamera(t){return this.stylesheet.camera=o.l({},this.stylesheet.camera,t),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(t){return t.data?function(r,c,d){const f=o.l({},c);for(const T of Object.keys(o.a5.colorTheme))f[T]===void 0&&(f[T]=o.a5.colorTheme[T].default);const _=new o.a6(ef,r,new Map(d));return _.setTransitionOrValue(f,d),_.untransitioned().possiblyEvaluate(new o.aa(0))}(this.scope,t,this.options).get("data"):null}_loadColorTheme(t){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const r=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((c,d)=>{const f="data:image/png;base64,";if(!t||t.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void c();let _=t;_.startsWith(f)||(_=f+_);const T=o.I.from("mapbox-reserved-lut"),E=new Image;E.src=_,E.onerror=()=>{this._styleColorTheme.lutLoading=!1,d(new Error("Failed to load image data"))},E.onload=()=>
21{if(this._styleColorTheme.lutLoadingCorrelationID!==r)return void c();this._styleColorTheme.lutLoading=!1;const{width:M,height:I,data:P}=o.q.getImageData(E);if(I>32)return void d(new Error("The height of the image must be less than or equal to 32 pixels."));if(M!==I*I)return void d(new Error("The width of the image must be equal to the height squared."));this.getImage(T)&&this.removeImage(T),this.addImage(T,{data:new o.r({width:M,height:I},P),pixelRatio:1,sdf:!1,usvg:!1,version:0});const R=this.imageManager.getImage(T,this.scope);R?(this._styleColorTheme.lut={image:R.data,data:t},c()):d(new Error("Missing LUT image."))}})}getLut(t){const r=this._styleColorThemeForScope[t];return r?r.lut:null}setProjection(t){t?this.stylesheet.projection=t:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(t){this._spriteRequest=function(r,c,d){let f,_,T;const E=o.q.devicePixelRatio>1?"@2x":"";let M=o.n(c.transformRequest(c.normalizeSpriteURL(r,E,".json"),o.R.SpriteJSON),(R,O)=>{M=null,T||(T=R,f=O,P())}),I=o.o(c.transformRequest(c.normalizeSpriteURL(r,E,".png"),o.R.SpriteImage),(R,O)=>{I=null,T||(T=R,_=O,P())});function P(){if(T)d(T);else if(f&&_){const R=o.q.getImageData(_),O={};for(const N in f){const{width:F,height:U,x:q,y:Z,sdf:J,pixelRatio:K,stretchX:oe,stretchY:te,content:ie}=f[N],re=new o.r({width:F,height:U});o.r.copy(R,re,{x:q,y:Z},{x:0,y:0},{width:F,height:U},null),O[N]={data:re,pixelRatio:K,sdf:J,stretchX:oe,stretchY:te,content:ie,usvg:!1}}d(null,O)}}return{cancel(){M&&(M.cancel(),M=null),I&&(I.cancel(),I=null)}}}(t,this.map._requestManager,(r,c)=>{if(this._spriteRequest=null,r)this.fire(new o.z(r));else if(c){const d=new Map;for(const f in c)d.set(o.I.from(f),c[f]);this.addImages(d)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new o.A("data",{dataType:"style"}))})}addIconset(t,r){if(r.type==="sprite")return void this._loadSprite(r.url);const c=this.getOwnSource(r.source);if(!c)return void this.fire(new o.z(new Error(`Source "${r.source}" as specified by iconset "${t}" does not exist and cannot be used as an iconset source`)));if(c.type!=="raster-array")return void this.fire(new o.z(new Error(`Source "${r.source}" as specified by iconset "${t}" is not a "raster-array" source and cannot be used as an iconset source`)));this.imageManager.createIconset(this.scope,t);const d=new tf(t,this);c.addIconset(t,d)}_loadIconset(t){if(!o.f(t)&&this.map._spriteFormat!=="icon_set"||this.map._spriteFormat==="raster")return void this._loadSprite(t);const r=this.map._spriteFormat==="auto";var c,d;this._spriteRequest=(d=(f,_)=>{if(this._spriteRequest=null,f)r?this._loadSprite(t):this.fire(new o.z(f));else if(_){const T=new Map;for(const E in _)T.set(o.I.from(E),_[E]);this.addImages(T)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new o.A("data",{dataType:"style"}))},o.bj((c=this.map._requestManager).transformRequest(c.normalizeIconsetURL(t),o.R.Iconset),(f,_)=>{if(f)return void d(f);const T={},E=o.ch(new o.bi(_));for(const M of E.icons){const I={version:1,pixelRatio:o.q.devicePixelRatio,content:td(M),stretchX:M.metadata?Vl(M.metadata.stretch_x_areas):void 0,stretchY:M.metadata?Vl(M.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:M};T[M.name]=I}d(null,T)}))}_validateLayer(t){const r=this.getOwnSource(t.source);if(!r)return;const c=t.sourceLayer;c&&(r.type==="geojson"||r.vectorLayerIds&&r.vectorLayerIds.indexOf(c)===-1)&&this.fire(new o.z(new Error(`Source layer "${c}" does not exist on source "${r.id}" as specified by style layer "${t.id}"`)))}
21loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const t in this._sourceCaches)if(!this._sourceCaches[t].loaded())return!1;if(!this.imageManager.isLoaded()||this.imageManager.hasPatternsInFlight()||!this.modelManager.isLoaded()||this._styleColorTheme.lutLoading)return!1;for(const{style:t}of this.fragments)if(!t.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((t,r)=>{const c=this.fragments[r];return c&&c.style&&(t.data=c.style.serialize()),t})}_serializeSources(){const t={};for(const r in this._sourceCaches){const c=this._sourceCaches[r].getSource();t[c.id]||(t[c.id]=c.serialize())}return t}_serializeLayers(t){const r=[];for(const c of t){const d=this._layers[c];d&&d.type!=="custom"&&r.push(d.serialize())}return r}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasSnowTransition(){return!!this.snow&&this.snow.hasTransition()}hasRainTransition(){return!!this.rain&&this.rain.hasTransition()}hasTransitions(){if(this.hasLightTransitions()||this.hasFogTransition()||this.hasSnowTransition()||this.hasRainTransition())return!0;for(const t in this._sourceCaches)if(this._sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(t){return t?this.order:this._mergedOrder}isLayerDraped(t){return!!this.terrain&&t.isDraped(this.getLayerSourceCache(t))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(t){const r=this.getOwnLayer(t);if(r)return r;this.fire(new o.z(new Error(`The layer '${t}' does not exist in the map's style.`)))}_checkSource(t){const r=this.getOwnSource(t);if(r)return r;this.fire(new o.z(new Error(`The source '${t}' does not exist in the map's style.`)))}precompilePrograms(t,r){const c=this.map.painter;if(c)for(let d=t.minzoom||0;d<(t.maxzoom||25.5);d++){const f=t.getProgramIds();if(f)for(const _ of f){const T=t.getDefaultProgramParams(_,r.zoom,this._styleColorTheme.lut);T&&(c.style=this,this.fog&&(c._fogVisible=!0,T.overrideFog=!0,c.getOrCreateProgram(_,T)),c._fogVisible=!1,T.overrideFog=!1,c.getOrCreateProgram(_,T),(this.stylesheet.terrain||this.stylesheet.projection&&this.stylesheet.projection.name==="globe")&&(T.overrideRtt=!0,c.getOrCreateProgram(_,T)))}}}update(t){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(t),this.directionalLight&&this.directionalLight.recalculate(t);const r=this.calculateLightsBrightness();t.brightness=r||0,r!==this._brightness&&(this._brightness=r,this.dispatcher.broadcast("setBrightness",r));const c=this._changes.isDirty();let d=!1;if(this._changes.isDirty()){const _=this._changes.getLayerUpdatesByScope();for(const T in _){const{updatedIds:E,removedIds:M}=_[T];(E||M)&&(this._updateWorkerLayers(T,E,M),d=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(t),this.light&&this.light.updateTransitions(t),this.ambientLight&&this.ambientLight.updateTransitions(t),this.directionalLight&&this.directionalLight.updateTransitions(t),this.fog&&this.fog.updateTransitions(t),this.snow&&this.snow.updateTransitions(t),this.rain&&this.rain.updateTransitions(t),this._changes.reset()}const f={};for(const _ in this._mergedSourceCaches){const T=this._mergedSourceCaches[_];
21f[_]=T.used,T.used=!1,T.tileCoverLift=0}for(const _ of this._mergedOrder){const T=this._mergedLayers[_];if(T.recalculate(t,this._availableImages),!T.isHidden(t.zoom)){const E=this.getLayerSourceCache(T);E&&(E.used=!0,E.tileCoverLift=Math.max(E.tileCoverLift,T.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback(()=>{this.precompilePrograms(T,t)}):this.precompilePrograms(T,t))}for(const _ in this._mergedSourceCaches){const T=this._mergedSourceCaches[_];if(!T)continue;const E=T._source;E.type==="raster-array"&&E.iconsets&&(T.used=!0)}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&d&&this.mergeLayers();for(const _ in f){const T=this._mergedSourceCaches[_];f[_]!==T.used&&T.getSource().fire(new o.A("data",{sourceDataType:"visibility",dataType:"source",sourceId:T.getSource().id}))}this.light&&this.light.recalculate(t),this.terrain&&this.terrain.recalculate(t),this.fog&&this.fog.recalculate(t),this.snow&&this.snow.recalculate(t),this.rain&&this.rain.recalculate(t),this.z=t.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),c&&this.fire(new o.A("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=this._changes.getUpdatedImages();if(t.length){for(const r in this._mergedSourceCaches)this._mergedSourceCaches[r].reloadTilesForDependencies(["icons","patterns"],t);this._changes.resetUpdatedImages()}}_updateWorkerLayers(t,r,c){const d=this.getFragmentStyle(t);d&&this.dispatcher.broadcast("updateLayers",{layers:r?d._serializeLayers(r):[],scope:t,removedIds:c||[],options:d.options})}setState(t,r){if(this._checkLoaded(),fo(this,Wr(t)))return!1;(t=o.cq(t)).layers=Da(t.layers);const c=function(_,T){if(!_)return[{command:_i.setStyle,args:[T]}];let E=[];try{if(!o.bn(_.version,T.version))return[{command:_i.setStyle,args:[T]}];if(o.bn(_.center,T.center)||E.push({command:_i.setCenter,args:[T.center]}),o.bn(_.zoom,T.zoom)||E.push({command:_i.setZoom,args:[T.zoom]}),o.bn(_.bearing,T.bearing)||E.push({command:_i.setBearing,args:[T.bearing]}),o.bn(_.pitch,T.pitch)||E.push({command:_i.setPitch,args:[T.pitch]}),o.bn(_.sprite,T.sprite)||E.push({command:_i.setSprite,args:[T.sprite]}),o.bn(_.glyphs,T.glyphs)||E.push({command:_i.setGlyphs,args:[T.glyphs]}),o.bn(_.imports,T.imports)||function(O=[],N=[],F){N=N||[];const U=(O=O||[]).map(pi),q=N.map(pi),Z=O.reduce(Lr,{}),J=N.reduce(Lr,{}),K=U.slice();let oe,te,ie,re;for(oe=0,te=0;oe<U.length;oe++)ie=U[oe],J.hasOwnProperty(ie)?te++:(F.push({command:_i.removeImport,args:[ie]}),K.splice(K.indexOf(ie,te),1));for(oe=0,te=0;oe<q.length;oe++)ie=q[q.length-1-oe],K[K.length-1-oe]!==ie&&(Z.hasOwnProperty(ie)?(F.push({command:_i.removeImport,args:[ie]}),K.splice(K.lastIndexOf(ie,K.length-te),1)):te++,re=K[K.length-oe],F.push({command:_i.addImport,args:[J[ie],re]}),K.splice(K.length-oe,0,ie));for(const ue of N){const me=Z[ue.id];me&&!o.bn(me,ue)&&F.push({command:_i.updateImport,args:[ue.id,ue]})}}(_.imports,T.imports,E),o.bn(_.transition,T.transition)||E.push({command:_i.setTransition,args:[T.transition]}),o.bn(_.light,T.light)||E.push({command:_i.setLight,args:[T.light]}),o.bn(_.fog,T.fog)||E.push({command:_i.setFog,args:[T.fog]}),o.bn(_.snow,T.snow)||E.push({command:_i.setSnow,args:[T.snow]}),o.bn(_.rain,T.rain)||E.push({command:_i.setRain,args:[T.rain]}),o.bn(_.projection,T.projection)||E.push({command:_i.setProjection,args:[T.projection]}),o.bn(_.lights,T.lights)||E.push({command:_i.setLights,args:[T.lights]}),o.bn(_.camera,T.camera)||E.push({command:_i.setCamera,args:[T.camera]}),!o.bn(_["color-theme"],T["color-theme"]))return[{command:_i.setStyle,args:[T]}];const M={},I=[];(function(O,N,F,U){let q;for(q in N=N||{},O=O||{})O.hasOwnProperty(q)&&(N.hasOwnProperty(q)||Ll(q,F,U));for(q in N){if(!N.hasOwnProperty(q))continue;const Z=N[q];O.hasOwnProperty(q)?o.bn(O[q],Z)||(O[q].type==="geojson"&&Z.type==="geojson"&&At(O,N,q)?F.push({command:_i.setGeoJSONSourceData,args:[q,Z.data]}):Oo(q,N,F,U)):En(q,N,F)}})(_.sources,T.sources,I,M);const P=[];
21_.layers&&_.layers.forEach(O=>{O.source&&M[O.source]?E.push({command:_i.removeLayer,args:[O.id]}):P.push(O)});let R=_.terrain;R&&M[R.source]&&(E.push({command:_i.setTerrain,args:[void 0]}),R=void 0),E=E.concat(I),o.bn(R,T.terrain)||E.push({command:_i.setTerrain,args:[T.terrain]}),function(O,N,F){N=N||[];const U=(O=O||[]).map(pi),q=N.map(pi),Z=O.reduce(Lr,{}),J=N.reduce(Lr,{}),K=U.slice(),oe=Object.create(null);let te,ie,re,ue,me,Le,Ee;for(te=0,ie=0;te<U.length;te++)re=U[te],J.hasOwnProperty(re)?ie++:(F.push({command:_i.removeLayer,args:[re]}),K.splice(K.indexOf(re,ie),1));for(te=0,ie=0;te<q.length;te++)re=q[q.length-1-te],K[K.length-1-te]!==re&&(Z.hasOwnProperty(re)?(F.push({command:_i.removeLayer,args:[re]}),K.splice(K.lastIndexOf(re,K.length-ie),1)):ie++,Le=K[K.length-te],F.push({command:_i.addLayer,args:[J[re],Le]}),K.splice(K.length-te,0,re),oe[re]=!0);for(te=0;te<q.length;te++)if(re=q[te],ue=Z[re],me=J[re],!oe[re]&&!o.bn(ue,me))if(o.bn(ue.source,me.source)&&o.bn(ue["source-layer"],me["source-layer"])&&o.bn(ue.type,me.type)){for(Ee in Ti(ue.layout,me.layout,F,re,null,_i.setLayoutProperty),Ti(ue.paint,me.paint,F,re,null,_i.setPaintProperty),o.bn(ue.slot,me.slot)||F.push({command:_i.setSlot,args:[re,me.slot]}),o.bn(ue.filter,me.filter)||F.push({command:_i.setFilter,args:[re,me.filter]}),o.bn(ue.minzoom,me.minzoom)&&o.bn(ue.maxzoom,me.maxzoom)||F.push({command:_i.setLayerZoomRange,args:[re,me.minzoom,me.maxzoom]}),ue)ue.hasOwnProperty(Ee)&&Ee!=="layout"&&Ee!=="paint"&&Ee!=="filter"&&Ee!=="metadata"&&Ee!=="minzoom"&&Ee!=="maxzoom"&&Ee!=="slot"&&(Ee.indexOf("paint.")===0?Ti(ue[Ee],me[Ee],F,re,Ee.slice(6),_i.setPaintProperty):o.bn(ue[Ee],me[Ee])||F.push({command:_i.setLayerProperty,args:[re,Ee,me[Ee]]}));for(Ee in me)me.hasOwnProperty(Ee)&&!ue.hasOwnProperty(Ee)&&Ee!=="layout"&&Ee!=="paint"&&Ee!=="filter"&&Ee!=="metadata"&&Ee!=="minzoom"&&Ee!=="maxzoom"&&Ee!=="slot"&&(Ee.indexOf("paint.")===0?Ti(ue[Ee],me[Ee],F,re,Ee.slice(6),_i.setPaintProperty):o.bn(ue[Ee],me[Ee])||F.push({command:_i.setLayerProperty,args:[re,Ee,me[Ee]]}))}else F.push({command:_i.removeLayer,args:[re]}),Le=K[K.lastIndexOf(re)+1],F.push({command:_i.addLayer,args:[me,Le]})}(P,T.layers,E)}catch(M){console.warn("Unable to compute style diff:",M),E=[{command:_i.setStyle,args:[T]}]}return E}(this.serialize(),t).filter(_=>!(_.command in nf));if(c.length===0)return!1;const d=c.filter(_=>!(_.command in rf));if(d.length>0)throw new Error(`Unimplemented: ${d.map(_=>_.command).join(", ")}.`);const f=[];return c.forEach(_=>{f.push(this[_.command].apply(this,_.args))}),r&&Promise.all(f).then(r),this.stylesheet=t,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}_updateWorkerImages(){this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages})}addImages(t){for(const[r,c]of t.entries()){if(this.getImage(r)&&!r.iconsetId)return this.fire(new o.z(new Error(`An image with the name "${r.name}" already exists.`)));this.imageManager.addImage(r,this.scope,c),this._changes.updateImage(r)}return this._updateWorkerImages(),this.fire(new o.A("data",{dataType:"style"})),this}addImage(t,r){return this.getImage(t)&&!t.iconsetId?this.fire(new o.z(new Error(`An image with the name "${t.name}" already exists.`))):(this.imageManager.addImage(t,this.scope,r),this._changes.updateImage(t),this._updateWorkerImages(),this.fire(new o.A("data",{dataType:"style"})),this)}updateImage(t,r,c=!1){this.imageManager.updateImage(t,this.scope,r),c&&(this._changes.updateImage(t),this._updateWorkerImages(),this.fire(new o.A("data",{dataType:"style"})))}getImage(t){return this.imageManager.getImage(t,this.scope)}removeImage(t){return this.getImage(t)?(this.imageManager.removeImage(t,this.scope),this._changes.updateImage(t),this._updateWorkerImages(),this.fire(new o.A("data",{dataType:"style"})),this):this.fire(new o.z(new Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addModel(t,r,c={}
21){return this._checkLoaded(),this._validate(ce,`models.${t}`,r,null,c)||(this.modelManager.addModel(t,r,this.scope),this._changes.setDirty()),this}hasModel(t){return this.modelManager.hasModel(t,this.scope)}removeModel(t){return this.hasModel(t)?(this.modelManager.removeModel(t,this.scope),this):this.fire(new o.z(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.scope)}addSource(t,r,c={}){if(this._checkLoaded(),this.getOwnSource(t)!==void 0)throw new Error(`There is already a source with ID "${t}".`);if(!r.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(r).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(r.type)>=0&&this._validate(lo,`sources.${t}`,r,null,c))return;this.map&&this.map._collectResourceTiming&&(r.collectResourceTiming=!0);const d=Rl(t,r,this.dispatcher,this);d.scope=this.scope,d.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(d.id),source:d.serialize(),sourceId:d.id}));const f=_=>{const T=(_?"symbol:":"other:")+d.id,E=o.C(T,this.scope),M=this._sourceCaches[T]=new Sn(E,d,_);(_?this._symbolSourceCaches:this._otherSourceCaches)[d.id]=M,M.onAdd(this.map)};f(!1),r.type!=="vector"&&r.type!=="geojson"||f(!0),d.onAdd&&d.onAdd(this.map),c.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(t){this._checkLoaded();const r=this.getOwnSource(t);if(!r)throw new Error("There is no source with this ID");for(const d in this._layers)if(this._layers[d].source===t)return this.fire(new o.z(new Error(`Source "${t}" cannot be removed while layer "${d}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===t)return this.fire(new o.z(new Error(`Source "${t}" cannot be removed while terrain is using it.`)));const c=this.getOwnSourceCaches(t);for(const d of c){const f=o.cr(d.id);delete this._sourceCaches[f],this._changes.discardSourceCacheUpdate(d.id),d.fire(new o.A("data",{sourceDataType:"metadata",dataType:"source",sourceId:d.getSource().id})),d.setEventedParent(null),d.clearTiles()}return delete this._otherSourceCaches[t],delete this._symbolSourceCaches[t],this.mergeSources(),r.setEventedParent(null),r.onRemove&&r.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(t,r){this._checkLoaded(),this.getOwnSource(t).setData(r),this._changes.setDirty()}getOwnSource(t){const r=this.getOwnSourceCache(t);return r&&r.getSource()}getOwnSources(){const t=[];for(const r in this._otherSourceCaches){const c=this.getOwnSourceCache(r);c&&t.push(c.getSource())}return t}areTilesLoaded(){const t=this._mergedSourceCaches;for(const r in t){const c=t[r]._tiles;for(const d in c){const f=c[d];if(f.state!=="loaded"&&f.state!=="errored")return!1}}return!0}setLights(t){if(this._checkLoaded(),!t)return delete this.ambientLight,void delete this.directionalLight;const r=this._getTransitionParameters();for(const d of t){if(this._validate(Po,"lights",d))return;switch(d.type){case"ambient":if(this.ambientLight){const f=this.ambientLight;f.set(d),f.updateTransitions(r)}else this.ambientLight=new Qi(d,si||(si=new o.a7({color:new o.a8(o.a5.properties_light_ambient.color),"color-use-theme":new o.a8({type:"string",default:"default","property-type":"data-constant"}),intensity:new o.a8(o.a5.properties_light_ambient.intensity)})),this.scope,this.options);break;case"directional":if(this.directionalLight){const f=this.directionalLight;f.set(d),f.updateTransitions(r)}else this.directionalLight=new Qi(d,Si||(Si=new o.a7({direction:new o.am(o.a5.properties_light_directional.direction),color:new o.a8(o.a5.properties_light_directional.color),"color-use-theme":new o.a8({type:"string",default:"default","property-type":"data-constant"}),intensity:new o.a8(o.a5.properties_light_directional.intensity),"cast-shadows":new o.a8(o.a5.properties_light_directional["cast-shadows"]),"shadow-quality":new o.a8(o.a5.properties_light_directional["shadow-quality"]),"shadow-intensity":new o.a8(o.a5.properties_light_directional["shadow-intensity"])})),this.scope,this.options)}}const c=new o.aa(this.z||0,r);this.ambientLight&&this.ambientLight.recalculate(c),this.directionalLight&&this.directionalLight.recalculate(c),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const t=this.directionalLight,r=this.ambientLight;if(!t||!r)return;const c=R=>.2126*(R[0]<=.03928?R[0]/12.92:Math.pow((R[0]+.055)/1.055,2.4))+.7152*(R[1]<=.03928?R[1]/12.92:Math.pow((R[1]+.055)/1.055,2.4))+.0722*(R[2]<=.03928?R[2]/12.92:Math.pow((R[2]+.055)/1.055,2.4)),d=t.properties.get("color").toRenderColor(null).toArray01(),f=t.properties.get("intensity"),_=t.properties.get("direction"),T=1-o.cc(_.x,_.y,_.z)[2]/90,E=c(d)*f*T,M=r.properties.get("color").toRenderColor(null).toArray01(),I=r.properties.get("intensity"),P=c(M)*I;return Number(((E+P)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const t=[];return this.directionalLight&&t.push(this.directionalLight.get()),this.ambientLight&&t.push(this.ambientLight.get()),t}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(t){if(!t)return this;if(o.cs(t)){const r=o.ct(t),c=this.fragments.find(({id:f})=>f===r);if(!c)throw new Error(`Style import '${t}' not found`);const d=o.cr(t);return c.style.getFragmentStyle(d)}{const r=this.fragments.find(({id:c})=>c===t);return r?r.style:void 0}}setFeaturesetSelectors(t){if(!t)return;const r={},c=(d,f="")=>`${d}::${f}`;this._featuresetSelectors={};for(const d in t){const f=this._featuresetSelectors[d]=[];
21for(const _ of t[d].selectors){if(_.featureNamespace){const E=this.getOwnLayer(_.layer);if(!E){o.w(`Layer is undefined for selector: ${_.layer}`);continue}const M=c(E.source,E.sourceLayer);if(M in r&&r[M]!==_.featureNamespace){o.w(`"featureNamespace ${_.featureNamespace} of featureset ${d}'s selector is not associated to the same source, skip this selector`);continue}r[M]=_.featureNamespace}let T;if(_.properties)for(const E in _.properties){const M=o.X(_.properties[E]);M.result==="success"&&(T=T||{},T[E]=M.value)}f.push({layerId:_.layer,namespace:_.featureNamespace,properties:T,uniqueFeatureID:_._uniqueFeatureID})}}}getFeaturesetDescriptors(t){const r=this.getFragmentStyle(t);if(!r||!r.stylesheet.featuresets)return[];const c=[];for(const d in r.stylesheet.featuresets)c.push({featuresetId:d,importId:r.scope?r.scope:void 0});return c}getFeaturesetLayers(t,r){const c=this.getFragmentStyle(r),d=c.stylesheet.featuresets;if(!d||!d[t])return this.fire(new o.z(new Error(`The featureset '${t}' does not exist in the map's style and cannot be queried.`))),[];const f=[];for(const _ of d[t].selectors){const T=c.getOwnLayer(_.layer);T&&f.push(T)}return f}getConfigProperty(t,r){const c=this.getFragmentStyle(t);if(!c)return null;const d=o.C(r,c.scope),f=c.options.get(d),_=f?f.value||f.default:null;return _?_.serialize():null}setConfigProperty(t,r,c){const d=this.getFragmentStyle(t);if(!d)return;const f=d.stylesheet.indoor?Qh(d.stylesheet.schema):d.stylesheet.schema;if(!f||!f[r])return;const _=o.X(c);if(_.result!=="success")return void fo(this,_.value);const T=_.value.expression,E=o.C(r,d.scope),M=d.options.get(E);if(!M)return;let I;const{minValue:P,maxValue:R,stepValue:O,type:N,values:F}=f[r],U=o.X(f[r].default);U.result==="success"&&(I=U.value.expression),I?(this.options.set(E,Object.assign({},M,{value:T,default:I,minValue:P,maxValue:R,stepValue:O,type:N,values:F})),this.updateConfigDependencies(r)):this.fire(new o.z(new Error(`No schema defined for the config option "${r}" in the "${t}" fragment.`)))}getConfig(t){const r=this.getFragmentStyle(t);if(!r)return null;const c=r.stylesheet.schema;if(!c)return null;const d={};for(const f in c){const _=o.C(f,r.scope),T=r.options.get(_),E=T?T.value||T.default:null;d[f]=E?E.serialize():null}return d}setConfig(t,r){const c=this.getFragmentStyle(t);c&&(c.updateConfig(r,c.stylesheet.schema),this.updateConfigDependencies())}getSchema(t){const r=this.getFragmentStyle(t);return r?r.stylesheet.schema:null}setSchema(t,r){const c=this.getFragmentStyle(t);c&&(c.stylesheet.schema=r,c.updateConfig(c._config,r),this.updateConfigDependencies())}updateConfig(t,r){if(this._config=t,t||r)if(r)for(const c in r){let d,f;const _=o.X(r[c].default);if(_.result==="success"&&(d=_.value.expression),t&&t[c]!==void 0){const R=o.X(t[c]);R.result==="success"&&(f=R.value.expression)}const{minValue:T,maxValue:E,stepValue:M,type:I,values:P}=r[c];if(d){const R=o.C(c,this.scope);this.options.set(R,{default:d,value:f,minValue:T,maxValue:E,stepValue:M,type:I,values:P})}else this.fire(new o.z(new Error(`No schema defined for config option "${c}".`)))}else this.fire(new o.z(new Error("Attempting to set config for a style without schema.")))}updateConfigDependencies(t){for(const r of this._configDependentLayers){const c=this.getLayer(r);if(c){if(t&&!c.configDependencies.has(t))continue;c.possiblyEvaluateVisibility(),this._updateLayer(c)}}this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.snow&&this.snow.updateConfig(this.options),this.rain&&this.rain.updateConfig(this.options),this.forEachFragmentStyle(r=>{const c=r._styleColorTheme.colorThemeOverride?r._styleColorTheme.colorThemeOverride:r._styleColorTheme.colorTheme;if(c){const d=r._evaluateColorThemeData(c);(!r._styleColorTheme.lut&&d!==""||r._styleColorTheme.lut&&d!==r._styleColorTheme.lut.data)&&r.setColorTheme(c)}}),this._changes.setDirty()}addLayer(t,r,c={}){this._checkLoaded();const d=t.id;if(this._layers[d])return void this.fire(new o.z(new Error(`Layer with i
21d "${d}" already exists on this map`)));let f;if(t.type==="custom"){if(fo(this,o.cu(t)))return;f=o.cv(t,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof t.source=="object"&&(this.addSource(d,t.source),t=o.cq(t),t=o.l(t,{source:d})),this._validate(j,`layers.${d}`,t,{arrayIndex:-1},c))return;f=o.cv(t,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(f),f.setEventedParent(this,{layer:{id:d}})}f.configDependencies.size!==0&&this._configDependentLayers.add(f.fqid);let _=this._order.length;if(r){const I=this._order.indexOf(r);if(I===-1)return void this.fire(new o.z(new Error(`Layer with id "${r}" does not exist on this map.`)));f.slot===this._layers[r].slot?_=I:o.w(`Layer with id "${r}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(_,0,d),this._layerOrderChanged=!0,this._layers[d]=f;const T=this.getOwnLayerSourceCache(f),E=!!this.directionalLight&&this.directionalLight.shadowsEnabled();T&&f.canCastShadows()&&E&&(T.castsShadows=!0);const M=this._changes.getRemovedLayer(f);if(M&&f.source&&T&&f.type!=="custom"){this._changes.discardLayerRemoval(f);const I=o.C(f.source,f.scope);M.type!==f.type?this._changes.updateSourceCache(I,"clear"):(this._changes.updateSourceCache(I,"reload"),T.pause())}this._updateLayer(f),f.onAdd&&f.onAdd(this.map),f.scope=this.scope,this.mergeLayers()}moveLayer(t,r){this._checkLoaded();const c=this._checkLayer(t);if(!c||t===r)return;const d=this._order.indexOf(t);this._order.splice(d,1);let f=this._order.length;if(r){const _=this._order.indexOf(r);
21if(_===-1)return void this.fire(new o.z(new Error(`Layer with id "${r}" does not exist on this map.`)));c.slot===this._layers[r].slot?f=_:o.w(`Layer with id "${r}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(f,0,t),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(t){this._checkLoaded();const r=this._checkLayer(t);if(!r)return;r.setEventedParent(null);const c=this._order.indexOf(t);this._order.splice(c,1),delete this._layers[t],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(r.fqid),this._changes.removeLayer(r);const d=this.getOwnLayerSourceCache(r);if(d&&d.castsShadows){let f=!1;for(const _ in this._layers)if(this._layers[_].source===r.source&&this._layers[_].canCastShadows()){f=!0;break}d.castsShadows=f}r.onRemove&&r.onRemove(this.map),this.mergeLayers()}getOwnLayer(t){return this._layers[t]}hasLayer(t){return t in this._mergedLayers}hasLayerType(t){for(const r in this._layers)if(this._layers[r].type===t)return!0;return!1}setLayerZoomRange(t,r,c){this._checkLoaded();const d=this._checkLayer(t);d&&(d.minzoom===r&&d.maxzoom===c||(r!=null&&(d.minzoom=r),c!=null&&(d.maxzoom=c),this._updateLayer(d)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(t,r){this._checkLoaded();const c=this._checkLayer(t);c&&c.slot!==r&&(c.slot=r,this._updateLayer(c))}setFilter(t,r,c={}){this._checkLoaded();const d=this._checkLayer(t);if(d&&!o.bn(d.filter,r))return r==null?(d.filter=void 0,void this._updateLayer(d)):void(this._validate(G,`layers.${d.id}.filter`,r,{layerType:d.type},c)||(d.filter=o.cq(r),this._updateLayer(d)))}getFilter(t){const r=this._checkLayer(t);if(r)return o.cq(r.filter)}setLayoutProperty(t,r,c,d={}){this._checkLoaded();const f=this._checkLayer(t);if(f&&!o.bn(f.getLayoutProperty(r),c)){if(c!=null&&(!d||d.validate!==!1)&&fo(f,de.call(Wr,{key:`layers.${t}.layout.${r}`,layerType:f.type,objectKey:r,value:c,styleSpec:o.a5,style:{glyphs:!0,sprite:!0}})))return;f.setLayoutProperty(r,c),f.configDependencies.size!==0&&this._configDependentLayers.add(f.fqid),this._updateLayer(f)}}getLayoutProperty(t,r){const c=this._checkLayer(t);if(c)return c.getLayoutProperty(r)}setPaintProperty(t,r,c,d={}){this._checkLoaded();const f=this._checkLayer(t);if(!f||o.bn(f.getPaintProperty(r),c)||c!=null&&(!d||d.validate!==!1)&&fo(f,ee.call(Wr,{key:`layers.${t}.paint.${r}`,layerType:f.type,objectKey:r,value:c,styleSpec:o.a5})))return;const _=f.setPaintProperty(r,c);f.configDependencies.size!==0&&this._configDependentLayers.add(f.fqid),_&&this._updateLayer(f),this._changes.updatePaintProperties(f)}getPaintProperty(t,r){const c=this._checkLayer(t);if(c)return c.getPaintProperty(r)}setFeatureState(t,r){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:E,importId:M}=t.target,I=this.getFragmentStyle(M),P=I.getFeaturesetLayers(E);for(const{source:R,sourceLayer:O}of P)I.setFeatureState({id:t.id,source:R,sourceLayer:O},r)}else if("layerId"in t.target){const{layerId:E}=t.target,M=this.getLayer(E);this.setFeatureState({id:t.id,source:M.source,sourceLayer:M.sourceLayer},r)}return}const c=t.source,d=t.sourceLayer,f=this._checkSource(c);if(!f)return;const _=f.type;if(_==="geojson"&&d)return void this.fire(new o.z(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(_==="vector"&&!d)return void this.fire(new o.z(new Error("The sourceLayer parameter must be provided for vector source types.")));t.id===void 0&&this.fire(new o.z(new Error("The feature id parameter must be provided.")));const T=this.getOwnSourceCaches(c);for(const E of T)E.setFeatureState(d,t.id,r)}removeFeatureState(t,r){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:E,importId:M}=t.target,I=this.getFragmentStyle(M),P=I.getFeaturesetLayers(E);for(const{source:R,sourceLayer:O}of P)I.removeFeatureState({id:t.id,source:R,sourceLayer:O},r)}else if("layerId"in t.target){const{layerId:E}=t.target,M=this.getLayer(E);this.removeFeatureState({id:t.id,source:M.source,sourceLayer:M.sourceLayer},r)}return}const c=t.source,d=this._checkSource(c);if(!d)return;const f=d.type,_=f==="vector"?t.sourceLayer:void 0;
vendor: 4,418 bytes, line 21
21if(f==="vector"&&!_)return void this.fire(new o.z(new Error("The sourceLayer parameter must be provided for vector source types.")));if(r&&typeof t.id!="string"&&typeof t.id!="number")return void this.fire(new o.z(new Error("A feature id is required to remove its specific state property.")));const T=this.getOwnSourceCaches(c);for(const E of T)E.removeFeatureState(_,t.id,r)}getFeatureState(t){if(this._checkLoaded(),"target"in t){let f;if("featuresetId"in t.target){const{featuresetId:_,importId:T}=t.target,E=this.getFragmentStyle(T),M=E.getFeaturesetLayers(_);for(const{source:I,sourceLayer:P}of M){const R=E.getFeatureState({id:t.id,source:I,sourceLayer:P});if(R&&!f)f=R;else if(!o.bn(f,R))return void this.fire(new o.z(new Error("The same feature id exists in multiple sources in the featureset, but their feature states are not consistent through the sources.")))}}else if("layerId"in t.target){const{layerId:_}=t.target,T=this.getLayer(_);f=this.getFeatureState({id:t.id,source:T.source,sourceLayer:T.sourceLayer})}return f}const r=t.source,c=t.sourceLayer,d=this._checkSource(r);if(d){if(d.type!=="vector"||c)return t.id===void 0&&this.fire(new o.z(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(r)[0].getFeatureState(c,t.id);this.fire(new o.z(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(t){return this.stylesheet.transition=o.l({},this.stylesheet.transition,t),this.transition=this.stylesheet.transition,this}getTransition(){return o.l({},this.stylesheet.transition)}serialize(){this._checkLoaded();const t=this.getTerrain(),r=t&&this.terrain&&this.terrain.scope===this.scope?t:this.stylesheet.terrain;return o.cw({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,iconsets:this.stylesheet.iconsets,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:r,fog:this.stylesheet.fog,snow:this.stylesheet.snow,rain:this.stylesheet.rain,center:this.stylesheet.center,"color-theme":this.stylesheet["color-theme"],zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},c=>c!==void 0)}_updateFilteredLayers(t){for(const r of Object.values(this._mergedLayers))t(r)&&this._updateLayer(r)}_updateLayer(t){this._changes.updateLayer(t);const r=this.getLayerSourceCache(t),c=o.C(t.source,t.scope),d=this._changes.getUpdatedSourceCaches();t.source&&!d[c]&&r&&r.getSource().type!=="raster"&&(this._changes.updateSourceCache(c,"reload"),r.pause()),t.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(t){const r=T=>this._mergedLayers[T].is3D(!!this.terrain),c=this.order,d={},f=[];for(let T=c.length-1;T>=0;T--){const E=c[T];if(r(E)){d[E]=T;for(const M of t){const I=M[E];if(I)for(const P of I)f.push(P)}}}f.sort((T,E)=>E.intersectionZ-T.intersectionZ);const _=[];for(let T=c.length-1;T>=0;T--){const E=c[T];if(r(E))for(let M=f.length-1;M>=0;M--){const I=f[M].feature;if(I.layer&&d[I.layer.id]<T)break;_.push(I),f.pop()}else for(const M of t){const I=M[E];if(I)for(const P of I)_.push(P.feature)}}return _}queryRenderedFeatures(t,r,c){let d;r&&!Array.isArray(r)&&r.filter&&(this._validate(G,"queryRenderedFeatures.filter",r.filter,null,r),d=o.a_(r.filter));const f={},_=I=>{if(Ul.has(I.type))return;const P=this.getOwnLayerSourceCache(I),R=f[P.id]=f[P.id]||{sourceCache:P,layers:{},has3DLayers:!1};I.is3D(!!this.terrain)&&(R.has3DLayers=!0),R.layers[I.fqid]=R.layers[I.fqid]||{styleLayer:I,targets:[]},R.layers[I.fqid].targets.push({filter:d})};if(r&&r.layers){if(!Array.isArray(r.layers))return this.fire(new o.z(new Error("parameters.layers must be an Array."))),[];for(const I of r.layers){const P=this._layers[I];if(!P)return this.fire(new o.z(new Error(`The layer '${I}' does not exist in the map's style and cannot be queried for features.`))),[];_(P)}}else for(const I in this._layers)_(this._layers[I]);const T=this._queryRenderedFeatures(t,f,c),E=this._flattenAndSortRenderedFeatures(T),M=[];for(const I of E)o.ct(I.layer.id)===this.scope&&M.push(I);return M}queryRenderedFeatureset(t,r,c){let d;
21r&&!Array.isArray(r)&&r.filter&&(this._validate(G,"queryRenderedFeatures.filter",r.filter,null,r),d=o.a_(r.filter));const f="mock",_=[];if(r&&r.target)_.push(Object.assign({},r,{targetId:f,filter:d}));else{const I=this.getFeaturesetDescriptors();for(const P of I)_.push({targetId:f,filter:d,target:P});for(const{style:P}of this.fragments){const R=P.getFeaturesetDescriptors();for(const O of R)_.push({targetId:f,filter:d,target:O})}}const T=this.queryRenderedTargets(t,_,c),E=[],M=new Set;for(const I of T)for(const P of I.variants[f])zo(P,I,M)||E.push(new o.cx(I,P));return E}queryRenderedTargets(t,r,c){const d={},f=(T,E,M,I)=>{const P=d[E.id]=d[E.id]||{sourceCache:E,layers:{},has3DLayers:!1};if(P.layers[T.fqid]=P.layers[T.fqid]||{styleLayer:T,targets:[]},T.is3D(!!this.terrain)&&(P.has3DLayers=!0),!I)return M.uniqueFeatureID=!1,void P.layers[T.fqid].targets.push(M);P.layers[T.fqid].targets.push(Object.assign({},M,{namespace:I.namespace,properties:I.properties,uniqueFeatureID:I.uniqueFeatureID}))};for(const T of r)if("featuresetId"in T.target){const{featuresetId:E,importId:M}=T.target,I=this.getFragmentStyle(M);if(!I||!I._featuresetSelectors)continue;const P=I._featuresetSelectors[E];if(!P){this.fire(new o.z(new Error(`The featureset '${E}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const R of P){const O=I.getOwnLayer(R.layerId);O&&!Ul.has(O.type)&&f(O,I.getOwnLayerSourceCache(O),T,R)}}else if("layerId"in T.target){const{layerId:E}=T.target,M=this.getLayer(E);if(!M||Ul.has(M.type))continue;f(M,this.getLayerSourceCache(M),T)}const _=this._queryRenderedFeatures(t,d,c);return this._flattenAndSortRenderedFeatures(_)}_queryRenderedFeatures(t,r,c){const d=[],f=!!this.map._showQueryGeometry,_=yr.createFromScreenPoints(t,c);for(const T in r){const E=Zc(_,r[T],this._availableImages,c,f);Object.keys(E).length&&d.push(E)}if(this.placement)for(const T in r){if(!r[T].sourceCache._onlySymbols)continue;const E=$h(_.screenGeometry,r[T],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData);Object.keys(E).length&&d.push(E)}return d}querySourceFeatures(t,r){const c=r&&r.filter;c&&this._validate(G,"querySourceFeatures.filter",c,null,r);let d=[];const f=this.getOwnSourceCaches(t);for(const _ of f)d=d.concat(Hh(_,r));return d}addSourceType(t,r,c){return Nn.getSourceType(t)?c(new Error(`A source type called "${t}" already exists.`)):(Nn.setSourceType(t,r),r.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:r.workerSourceURL},c):c(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(t,r,c={}){this._checkLoaded();const d=this.light.getLight();let f=!1;for(const T in t)if(!o.bn(t[T],d[T])){f=!0;break}if(!f)return;const _=this._getTransitionParameters();this.light.setLight(t,r,c),this.light.updateTransitions(_)}getTerrain(){return this.terrain&&this.terrain.drapeRenderMode===1?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){this.disableElevatedTerrain===void 0&&(this.disableElevatedTerrain=o.q.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&o.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(t,r=1){if(this._checkLoaded(),!t)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),r===0&&delete this.terrain,t===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let c=t;const d=t.source==null;if(r===1){if(this.disableElevatedTerrain)return;if(typeof c.source=="object"){const T="terrain-dem-src";this.addSource(T,c.source),c=o.cq(c),c=o.l(c,{source:T})}const f=o.l({},c),_={};if(this.terrain&&d){f.source=this.terrain.get().source;const T=this.terrain?this.getFragmentStyle(this.terrain.scope):null;T&&(_.style=T.serialize())}if(this._validate(Cl,"terrain",f,_))return}if(!this.terrain||this.terrain.scope!==this.scope&&!d||this.terrain&&r!==this.terrain.drapeRenderMode){if(!c)return;this._createTerrain(c,r),this.fire(new o.A("data",{dataType:"style"}))}else{const f=this.terrain,_=f.get();for(const T of Object.keys(o.a5.terrain))!c.hasOwnProperty(T)&&o.a5.terrain[T].default&&(c[T]=o.a5.terrain[T].default);for(const T in t)if(!o.bn(t[T],_[T])){f.set(t,this.options),this.stylesheet.terrain=t;const E=this._getTransitionParameters({duration:0});f.updateTransitions(E),this.fire(new o.A("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedU
21pdate=!0}_createFog(t){const r=this.fog=new Jt(t,this.map.transform,this.scope,this.options);this.stylesheet.fog=r.get();const c=this._getTransitionParameters({duration:0});r.updateTransitions(c)}_createSnow(t){const r=this.snow=new Ei(t,this.map.transform,this.scope,this.options);this.stylesheet.snow=r.get();const c=this._getTransitionParameters({duration:0});r.updateTransitions(c)}_createRain(t){const r=this.rain=new Ai(t,this.map.transform,this.scope,this.options);this.stylesheet.rain=r.get();const c=this._getTransitionParameters({duration:0});r.updateTransitions(c)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const t of this.map._markers)t._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(t){if(this._checkLoaded(),!t)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const r=this.fog;if(!o.bn(r.get(),t)){r.set(t,this.options),this.stylesheet.fog=r.get();const c=this._getTransitionParameters({duration:0});r.updateTransitions(c)}}else this._createFog(t);this._markersNeedUpdate=!0}getSnow(){return this.snow?this.snow.get():null}setSnow(t){if(this._checkLoaded(),!t)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){const r=this.snow;if(!o.bn(r.get(),t)){r.set(t,this.options),this.stylesheet.snow=r.get();const c=this._getTransitionParameters({duration:0});r.updateTransitions(c)}}else this._createSnow(t);this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(t){if(this._checkLoaded(),!t)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){const r=this.rain;if(!o.bn(r.get(),t)){r.set(t,this.options),this.stylesheet.rain=r.get();const c=this._getTransitionParameters({duration:0});r.updateTransitions(c)}}else this._createRain(t);this._markersNeedUpdate=!0}_reloadColorTheme(){const t=()=>{for(const d in this._layers)this._layers[d].lut=this._styleColorTheme.lut;for(const d in this._sourceCaches)this._sourceCaches[d].clearTiles()},r=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!r)return this._styleColorTheme.lut=null,void t();const c=this._evaluateColorThemeData(r);this._loadColorTheme(c).then(()=>{this.fire(new o.A("colorthemeset")),t()}).catch(d=>{o.w(`Couldn't set color theme: ${d}`)})}setColorTheme(t){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&o.w("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=t,this._reloadColorTheme()}setImportColorTheme(t,r){const c=this.getFragmentStyle(t);c&&(c._styleColorTheme.colorThemeOverride=r,c._reloadColorTheme())}_getTransitionParameters(t){return{now:o.q.now(),transition:o.l(this.transition,t)}}updateDrapeFirstLayers(){if(!this.terrain)return;const t=[],r=[];for(const c of this._mergedOrder)this.isLayerDraped(this._mergedLayers[c])?t.push(c):r.push(c);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...t),this._drapedFirstOrder.push(...r)}_createTerrain(t,r){const c=this.terrain=new je(t,r,this.scope,this.options);r===1&&(this.stylesheet.terrain=t),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const d=this._getTransitionParameters({duration:0});c.updateTransitions(d)}_force3DLayerUpdate(){for(const t in this._layers){const r=this._layers[t];r.type==="fill-extrusion"&&this._updateLayer(r)}}_forceSymbolLayerUpdate(){for(const t in this._layers){const r=this._layers[t];r.type==="symbol"&&this._updateLayer(r)}}_validate(t,r,c,d,f={}){if(f&&f.validate===!1)return!1;const _=o.l({},this.serialize());return fo(this,t.call(Wr,o.l({key:r,style:_,value:c,styleSpec:o.a5},d)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),o.cy.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._mergedLayers)this._mergedLayers[t].setEventedParent(null);for(const t in this._mergedSourceCaches)this._mergedSourceCaches[t].clearTiles(),this._mergedSourceCaches[t].setEventedParent(null);this.setEventedParent(null),delete this.fog,delete this.snow,delete this.rain,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.modelManager.setEventedParent(null),this.dispatcher.remove())}clearSource(t){const r=this.getSourceCaches(t);for(const c of r)c.clearTiles()}clearSources(){for(const t in this._mergedSourceCaches)this._mergedSourceCaches[t].clearTiles()}reloadSource(t){const r=this.getSourceCaches(t);for(const c of r)c.resume(),c.reload()}
21reloadSources(){for(const t of this.getSources())t.reload&&t.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle(t=>{t.modelManager.reloadModels(t.scope)})}updateSources(t){let r;this.directionalLight&&(r=Vs(this.directionalLight));for(const c in this._mergedSourceCaches)this._mergedSourceCaches[c].update(t,void 0,void 0,r)}_generateCollisionBoxes(){for(const t in this._sourceCaches){const r=this._sourceCaches[t];r.resume(),r.reload()}}_updatePlacement(t,r,c,d,f,_,T=!1){let E=!1,M=!1;const I={},P={};for(const R of this._mergedOrder){const O=this._mergedLayers[R];if(O.type!=="symbol")continue;const N=o.C(O.source,O.scope);let F=I[N];if(!F){const q=this.getLayerSourceCache(O);if(!q)continue;const Z=q.getRenderableIds(!0).map(J=>q.getTileByID(J));P[N]=Z.slice(),F=I[N]=Z.sort((J,K)=>K.tileID.overscaledZ-J.tileID.overscaledZ||(J.tileID.isLessThan(K.tileID)?-1:1))}const U=this.crossTileSymbolIndex.addLayer(O,F,r.center.lng,r.projection);E=E||U}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),T=T||this._layerOrderChanged||d===0,this._layerOrderChanged&&this.fire(new o.A("neworder")),(T||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(o.q.now(),r.zoom))&&(this.pauseablePlacement=new Bs(r,this._mergedOrder,T,c,d,f,this.placement,this.fog&&r.projection.supportsFog?this.fog.state:null,this._buildingIndex),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,I,P,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(o.q.now()),M=!0),E&&this.pauseablePlacement.placement.setStale()),M||E){this._buildingIndex.onNewFrame(r.zoom);for(let R=0;R<this._mergedOrder.length;R++){const O=this._mergedLayers[this._mergedOrder[R]];if(O.type!=="symbol")continue;const N=this.isLayerClipped(O);this.placement.updateLayerOpacities(O,I[o.C(O.source,O.scope)],R,N?_:null)}}return{needsRerender:!this.pauseablePlacement.isDone()||this.placement.hasTransitions(o.q.now())}}_releaseSymbolFadeTiles(){for(const t in this._sourceCaches)this._sourceCaches[t].releaseSymbolFadeTiles()}addImport(t,r){this._checkLoaded();const c=this.stylesheet.imports=this.stylesheet.imports||[];if(c.findIndex(({id:f})=>f===t.id)!==-1)return void this.fire(new o.z(new Error(`Import with id '${t.id}' already exists in the map's style.`)));if(!r)return c.push(t),this._loadImports([t],!0);const d=c.findIndex(({id:f})=>f===r);return d===-1&&this.fire(new o.z(new Error(`Import with id "${r}" does not exist on this map.`))),this.stylesheet.imports=c.slice(0,d).concat(t).concat(c.slice(d)),this._loadImports([t],!0,r)}updateImport(t,r){this._checkLoaded();const c=this.stylesheet.imports||[],d=this.getImportIndex(t);return d===-1?this:typeof r=="string"?(this.setImportUrl(t,r),this):(r.url&&r.url!==c[d].url&&this.setImportUrl(t,r.url),o.bn(r.config,c[d].config)||this.setImportConfig(t,r.config,r.data.schema),o.bn(r.data,c[d].data)||this.setImportData(t,r.data),this)}moveImport(t,r){this._checkLoaded();let c=this.stylesheet.imports||[];const d=this.getImportIndex(t);if(d===-1)return this;const f=this.getImportIndex(r);if(f===-1)return this;const _=c[d],T=this.fragments[d];return c=c.filter(({id:E})=>E!==t),this.fragments=this.fragments.filter(({id:E})=>E!==t),this.stylesheet.imports=c.slice(0,f).concat(_).concat(c.slice(f)),this.fragments=this.fragments.slice(0,f).concat(T).concat(this.fragments.slice(f)),this.mergeLayers(),this}setImportUrl(t,r){this._checkLoaded();const c=this.stylesheet.imports||[],d=this.getImportIndex(t);if(d===-1)return this;c[d].url=r;const f=this.fragments[d];return f.style=this._createFragmentStyle(c[d]),f.style.on("style.import.load",()=>this.mergeAll()),f.style.loadURL(r),this}setImportData(t,r){this._checkLoaded();const c=this.getImportIndex(t),d=this.stylesheet.imports||[];return c===-1?this:r?(this.fragments[c].style.setState(r),this._reloadImports(),this):(delete d[c].data,this.setImportUrl(t,d[c].url))}setImportConfig(t,r,c){this._checkLoaded();const d=this.getImportIndex(t),f=this.stylesheet.imports||[];if(d===-1)return this;r?f[d].config=r:delete f[d].config;const _=this.fragments[d];c&&_.style.stylesheet&&(_.style.stylesheet.schema=c);const T=_.style.stylesheet&&_.style.stylesheet.schema;return _.config=r,_.style.updateConfig(r,T),this.updateConfigDependencies(),this}removeImport(t){this._checkLoaded();const r=this.stylesheet.imports||[],c=this.getImportIndex(t);c!==-1&&(r.splice(c,1),this.fragments[c].style._remove(),this.fragments.splice(c,1),this._reloadImports())}getImportIndex(t){const r=(this.stylesheet.imports||[]).findIndex(c=>c.id===t);
21return r===-1&&this.fire(new o.z(new Error(`Import '${t}' does not exist in the map's style and cannot be updated.`))),r}getLayer(t){return this._mergedLayers[t]}getSources(){const t=[];for(const r in this._mergedOtherSourceCaches){const c=this._mergedOtherSourceCaches[r];c&&t.push(c.getSource())}return t}getSource(t,r){const c=this.getSourceCache(t,r);return c&&c.getSource()}getLayerSource(t){const r=this.getLayerSourceCache(t);return r&&r.getSource()}getSourceCache(t,r){const c=o.C(t,r);return this._mergedOtherSourceCaches[c]}getLayerSourceCache(t){const r=o.C(t.source,t.scope);return t.type==="symbol"?this._mergedSymbolSourceCaches[r]:this._mergedOtherSourceCaches[r]}getSourceCaches(t){if(t==null)return Object.values(this._mergedSourceCaches);const r=[];return this._mergedOtherSourceCaches[t]&&r.push(this._mergedOtherSourceCaches[t]),this._mergedSymbolSourceCaches[t]&&r.push(this._mergedSymbolSourceCaches[t]),r}updateSourceCaches(){const t=this._changes.getUpdatedSourceCaches();for(const r in t){const c=t[r];c==="reload"?this.reloadSource(r):c==="clear"&&this.clearSource(r)}}updateLayers(t){const r=this._changes.getUpdatedPaintProperties();for(const c of r){const d=this.getLayer(c);d&&d.updateTransitions(t)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(t){this.stylesheet.glyphs=t,this.glyphManager.setURL(t,this.scope)}getImages(t,r,c){this.imageManager.getImages(r.images,r.scope,c),this._updateTilesForChangedImages();const d=_=>{if(_){const T=r.images.map(E=>o.I.toString(E));_.setDependencies(r.tileID.key,r.type,T)}},f=o.C(r.source,r.scope);d(this._mergedOtherSourceCaches[f]),d(this._mergedSymbolSourceCaches[f])}rasterizeImages(t,r,c){this.imageManager.rasterizeImages(r,c)}getGlyphs(t,r,c){this.glyphManager.getGlyphs(r.stacks,r.scope,c)}getResource(t,r,c){return o.cz(r,c)}getOwnSourceCache(t){return this._otherSourceCaches[t]}getOwnLayerSourceCache(t){return t.type==="symbol"?this._symbolSourceCaches[t.source]:this._otherSourceCaches[t.source]}getOwnSourceCaches(t){const r=[];return this._otherSourceCaches[t]&&r.push(this._otherSourceCaches[t]),this._symbolSourceCaches[t]&&r.push(this._symbolSourceCaches[t]),r}_isSourceCacheLoaded(t){const r=this.getOwnSourceCaches(t);return r.length===0?(this.fire(new o.z(new Error(`There is no source with ID '${t}'`))),!1):r.every(c=>c.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(t,r){if(!this._clipLayerPresent&&t.type!=="fill-extrusion")return!1;const c=t.type==="fill-extrusion"&&t.sourceLayer==="building";if(t.is3D(!!this.terrain)){if(c||r&&r.type==="batched-model"||t.type==="model")return!0}else if(t.type==="symbol")return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.fragments.forEach(t=>{t.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}Nn.getSourceType=function(u){return Hc[u]},Nn.setSourceType=function(u,t){Hc[u]=t},Nn.registerForPluginStateChange=o.ci;var nu=` 22#define EPSILON 0.0000001 23#define PI 3.141592653589793 24#ifdef RENDER_CUTOFF 25float cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);} 26#endif`,jl=` 27out vec4 glFragColor;highp float unpack_depth(highp vec4 rgba_depth) 28{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;} 29#ifdef INDICATOR_CUTOUT 30uniform vec3 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params; 31#endif 32vec4 applyCutout(vec4 color,float height) { 33#ifdef INDICATOR_CUTOUT 34float verticalFadeRange=u_indicator_cutout_centers.z*0.25;float holeMinOpacity=mix(1.0,u_indicator_cutout_params.x,smoothstep(u_indicator_cutout_centers.z,u_indicator_cutout_centers.z+verticalFadeRange,height));float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;
34float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0); 35#else 36return color; 37#endif 38} 39#ifdef DEBUG_WIREFRAME 40#define HANDLE_WIREFRAME_DEBUG \\ 41glFragColor=vec4(0.7,0.0,0.0,0.7); \\ 42gl_FragDepth=gl_FragCoord.z-0.0001; 43#else 44#define HANDLE_WIREFRAME_DEBUG 45#endif 46#ifdef RENDER_CUTOFF 47uniform highp vec4 u_cutoff_params;in float v_cutoff_opacity; 48#endif 49vec4 textureLodCustom(sampler2D image,highp vec2 pos,highp vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 applyLUT(highp sampler3D lut,vec4 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return vec4(texture(lut,uvw).rgb,col.a);}vec3 applyLUT(highp sampler3D lut,vec3 col) {return applyLUT(lut,vec4(col,1.0)).rgb;}`,qa=` 50#define EXTENT 8192.0 51#define RAD_TO_DEG 180.0/PI 52#define DEG_TO_RAD PI/180.0 53#define GLOBE_RADIUS EXTENT/PI/2.0 54float wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;} 55#ifdef PROJECTION_GLOBE_VIEW 56vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) { 57#ifndef PROJECTED_POS_ON_VIEWPORT 58float tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz; 59#else 60return vec3(0.0); 61#endif 62}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);} 63#endif 64vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4( 65unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0 66);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const vec2 units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (units_to_pixels*pos+offset)/pattern_size;}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {return get_pattern_pos(pixel_coord_upper,pixel_coord_lower,pattern_size,vec2(tile_units_to_pixels),pos);}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);} 67#ifdef RENDER_CUTOFF 68uniform vec4 u_cutoff_params;out float v_cutoff_opacity; 69#endif 70const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt) 71{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}`,ql="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;
71void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",Us=` 72#define ELEVATION_SCALE 7.0 73#define ELEVATION_OFFSET 450.0 74#ifdef PROJECTION_GLOBE_VIEW 75uniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix( 76mix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;} 77#else 78vec3 elevationVector(vec2 pos) { return vec3(0,0,1); } 79#endif 80#ifdef TERRAIN 81uniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float currentElevation(vec2 apos) { 82#ifdef TERRAIN_DEM_FLOAT_FORMAT 83vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r; 84#else 85float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y); 86#endif 87}float prevElevation(vec2 apos) { 88#ifdef TERRAIN_DEM_FLOAT_FORMAT 89vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r; 90#else 91float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y); 92#endif 93} 94#ifdef TERRAIN_VERTEX_MORPHING 95float elevation(vec2 apos) { 96#ifdef ZERO_EXAGGERATION 97return 0.0; 98#endif 99float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);} 100#else 101float elevation(vec2 apos) { 102#ifdef ZERO_EXAGGERATION 103return 0.0; 104#endif 105return currentElevation(apos);} 106#endif 107vec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);} 108#else 109float elevation(vec2 pos) { return 0.0; } 110#endif 111#ifdef DEPTH_OCCLUSION 112uniform highp sampler2D u_depth;uniform highp vec2 u_depth_size_inv;uniform highp vec2 u_depth_range_unpack;uniform highp float u_occluder_half_size;uniform highp float u_occlusion_depth_offset; 113#ifdef DEPTH_D24 114float unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}vec4 unpack_depth4(vec4 depth) {return depth*u_depth_range_unpack.x+vec4(u_depth_range_unpack.y);} 115#else 116highp float unpack_depth_rgba(vec4 rgba_depth) 117{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;} 118#endif 119bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w; 120#ifdef DEPTH_D24 121float depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r); 122#else 123float depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5)); 124#endif 125return coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_
125size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5; 126#ifdef DEPTH_D24 127highp vec4 depth=vec4( 128texture(u_depth,uv-df.xz).r,texture(u_depth,uv+df.xz).r,texture(u_depth,uv-df.zy).r,texture(u_depth,uv+df.zy).r 129);depth=unpack_depth4(depth); 130#else 131highp vec4 depth=vec4( 132unpack_depth_rgba(texture(u_depth,uv-df.xz)),unpack_depth_rgba(texture(u_depth,uv+df.xz)),unpack_depth_rgba(texture(u_depth,uv-df.zy)),unpack_depth_rgba(texture(u_depth,uv+df.zy)) 133); 134#endif 135return depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5;int NX=3;int NY=4;highp vec2 df=u_occluder_half_size*u_depth_size_inv;highp vec2 oneStep=2.0*u_occluder_half_size*u_depth_size_inv/vec2(NX-1,NY-1);highp float res=0.0;for (int y=0; y < NY;++y) {for (int x=0; x < NX;++x) { 136#ifdef DEPTH_D24 137highp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r); 138#else 139highp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y))); 140#endif 141res+=1.0-clamp(300.0*(coord.z+u_occlusion_depth_offset-depth),0.0,1.0);}}res=clamp(2.0*res/float(NX*NY)-0.5,0.0,1.0);return res;}highp float occlusionFade(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec4 depth=getCornerDepths(coord.xy);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z+u_occlusion_depth_offset)-depth),0.0,1.0));} 142#else 143bool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; } 144#endif//DEPTH_OCCLUSION`,Gl=`#ifdef FOG 145uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);} 146#endif`,su=`#ifdef FOG 147uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix( 148mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}
148vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {return color;}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);} 149#endif`,mo=`#ifdef RASTER_ARRAY 150uniform highp sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0) 151);}vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0) 152);}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);} 153#endif`,Ho=`#ifdef RASTER_ARRAY 154uniform sampler2D u_velocity;uniform mediump vec2 u_velocity_res;uniform mediump float u_max_speed;const vec4 NO_DATA=vec4(1);const vec2 INVALID_VELOCITY=vec2(-1);uniform highp vec2 u_uv_offset;uniform highp float u_data_offset;uniform highp vec2 u_data_scale;ivec4 rasterArrayLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}highp vec2 lookup_velocity(highp vec2 uv) {uv=u_uv_offset.x+u_uv_offset.y*uv;highp vec2 fxy;ivec4 c=rasterArrayLinearCoord(uv,u_velocity_res,fxy);highp vec4 tl=texelFetch(u_velocity,c.yz,0);highp vec4 tr=texelFetch(u_velocity,c.xz,0);highp vec4 bl=texelFetch(u_velocity,c.yw,0);highp vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NO_DATA) {return INVALID_VELOCITY;}if (tr==NO_DATA) {return INVALID_VELOCITY;}if (bl==NO_DATA) {return INVALID_VELOCITY;}if (br==NO_DATA) {return INVALID_VELOCITY;}highp vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);highp vec2 velocity=u_data_offset+vec2(dot(t.rg,u_data_scale),dot(t.ba,u_data_scale));velocity.y=-velocity.y;velocity/=max(u_max_speed,length(velocity));return velocity;} 155#endif 156uniform highp float u_particle_pos_scale;uniform highp vec2 u_particle_pos_offset;highp vec4 pack_pos_to_rgba(highp vec2 p) {highp vec2 v=(p+u_particle_pos_offset)/u_particle_pos_scale;highp vec4 r=vec4(v.x,fract(v.x*255.0),v.y,fract(v.y*255.0));return vec4(r.x-r.y/255.0,r.y,r.z-r.w/255.0,r.w);}highp vec2 unpack_pos_from_rgba(highp vec4 v) {v=floor(v*255.0+0.5)/255.0;highp vec2 p=vec2(v.x+(v.y/255.0),v.z+(v.w/255.0));return u_particle_pos_scale*p-u_particle_pos_offset;}`,Ga=`#ifdef RENDER_SHADOWS 157uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {vec3 transformed_normal=vec3(-normal.xy,normal.z);float NDotL=dot(normalize(transformed_normal),u_shadow_direction);float dotScale=min(1.0-NDotL,1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];} 158#endif//RENDER_SHADOWS`,$a=`#ifdef RENDER_SHADOWS 159#ifdef DEPTH_TEXTURE 160uniform highp sampler2D u_shadowmap_0;uniform highp sampler2D u_shadowmap_1; 161#else 162uniform sampler2D u_shadowmap_0;uniform sampler2D u_shadowmap_1; 163#endif 164uniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;highp float shadow_sample_1(highp vec2 uv,highp float compare) {highp float shadow_depth; 165#ifdef DEPTH_TEXTURE
166shadow_depth=texture(u_shadowmap_1,uv).r; 167#else 168shadow_depth=unpack_depth(texture(u_shadowmap_1,uv))*0.5+0.5; 169#endif 170return step(shadow_depth,compare);}highp float shadow_sample_0(highp vec2 uv,highp float compare) {highp float shadow_depth; 171#ifdef DEPTH_TEXTURE 172shadow_depth=texture(u_shadowmap_0,uv).r; 173#else 174shadow_depth=unpack_depth(texture(u_shadowmap_0,uv))*0.5+0.5; 175#endif 176return step(shadow_depth,compare);}float shadow_occlusion_1(highp vec4 pos,highp float bias) {highp vec2 uv=pos.xy;return shadow_sample_1(uv,pos.z-bias);}float shadow_occlusion_0(highp vec4 pos,highp float bias) {highp float compare0=pos.z-bias; 177#ifdef TEXTURE_GATHER 178highp vec2 uv=pos.xy;highp vec4 samples=textureGather(u_shadowmap_0,uv,0);lowp vec4 stepSamples=step(samples,vec4(compare0)); 179#else 180highp vec2 uv00=pos.xy-vec2(0.5*u_shadow_texel_size);highp vec2 uv10=uv00+vec2(u_shadow_texel_size,0.0);highp vec2 uv01=uv00+vec2(0.0,u_shadow_texel_size);highp vec2 uv11=uv01+vec2(u_shadow_texel_size,0.0);lowp vec4 stepSamples=vec4( 181shadow_sample_0(uv01,compare0),shadow_sample_0(uv11,compare0),shadow_sample_0(uv10,compare0),shadow_sample_0(uv00,compare0) 182); 183#endif 184vec2 f=fract(pos.xy*u_shadow_map_resolution-vec2(0.5));lowp vec2 lerpx=mix(stepSamples.wx,stepSamples.zy,f.xx);return clamp(mix(lerpx.x,lerpx.y,f.y),0.0,1.0);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) { 185#ifdef SHADOWS_SINGLE_CASCADE 186light_view_pos0.xyz/=light_view_pos0.w;vec2 abs_bounds=abs(light_view_pos0.xy);if (abs_bounds.x >=1.0 || abs_bounds.y >=1.0) {return 0.0;}light_view_pos0.xyz=light_view_pos0.xyz*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias); 187#else 188light_view_pos0.xyz/=light_view_pos0.w;light_view_pos1.xyz/=light_view_pos1.w;vec4 uv=vec4(light_view_pos0.xy,light_view_pos1.xy);vec4 abs_bounds=abs(uv);if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {light_view_pos0.xyz=light_view_pos0.xyz*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}light_view_pos1.xyz=light_view_pos1.xyz*0.5+0.5;float occlusion1=shadow_occlusion_1(light_view_pos1,bias);return clamp(mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth)),0.0,1.0); 189#endif 190}highp float calculate_shadow_bias(float NDotL) { 191#ifdef NORMAL_OFFSET 192return 0.5*u_shadow_bias.x; 193#else 194return 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z)); 195#endif 196}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_opacity(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,float shadow_opacity) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias)*shadow_opacity;return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}highp vec2 compute_receiver_plane_depth_bias(highp vec3 pos_dx,highp vec3 pos_dy) 197{highp vec2 biasUV=vec2( 198pos_dy.y*pos_dx.z-pos_dx.y*pos_dy.z,pos_dx.x*pos_dy.z-pos_dy.x*pos_dx.z);biasUV*=1.0/((pos_dx.x*pos_dy.y)-(pos_dx.y*pos_dy.x));return biasUV;}float shadowed_light_factor_plane_bias(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {highp vec3 light_view_pos0_xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;highp vec3 light_view_pos0_ddx=dFdx(light_view_pos0_xyz);highp vec3 light_view_pos0_ddy=dFdy(light_view_pos0_xyz);highp vec2 plane_depth_bias=compute_receiver_plane_depth_bias(light_view_pos0_ddx,light_view_pos0_ddy);highp float bias=dot(vec2(u_shadow_texel_size,u_shadow_texel_size),plane_depth_bias)+0.0001;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);} 199#endif`;const _s=[];Kn(nu,_s),Kn(qa,_s),Kn(jl,_s);const _o={"_prelude_fog.vertex.glsl":Gl,"_prelude_terrain.vertex.glsl":Us,"_prelude_shadow.vertex.glsl":Ga,"_prelude_fog.fragment.glsl":su,"_prelude_shadow.fragment.glsl":$a,"_prelude_lighting.glsl":` 200#ifdef LIGHTING_3D_MODE 201uniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0
201));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);} 202#endif//LIGHTING_3D_MODE`,"_prelude_raster_array.glsl":mo,"_prelude_raster_particle.glsl":Ho},Zo={};li("",Us),li(su,Gl),li($a,Ga),li(mo,""),li(Ho,"");const ou=li(jl,qa),$l=nu;var Ha={background:li(`#include "_prelude_fog.fragment.glsl" 203#include "_prelude_lighting.glsl" 204uniform vec4 u_color;uniform float u_opacity; 205#ifdef LIGHTING_3D_MODE 206in vec4 v_color; 207#endif 208void main() {vec4 out_color; 209#ifdef LIGHTING_3D_MODE 210out_color=v_color; 211#else 212out_color=u_color; 213#endif 214#ifdef FOG 215out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 216#endif 217glFragColor=out_color*u_opacity; 218#ifdef OVERDRAW_INSPECTOR 219glFragColor=vec4(1.0); 220#endif 221HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 222#include "_prelude_lighting.glsl" 223in vec2 a_pos;uniform mat4 u_matrix; 224#ifdef LIGHTING_3D_MODE 225uniform mediump vec4 u_color;out vec4 v_color;uniform float u_emissive_strength; 226#endif 227void main() {gl_Position=u_matrix*vec4(a_pos,0,1); 228#ifdef LIGHTING_3D_MODE 229v_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength); 230#endif 231#ifdef FOG 232v_fog_pos=fog_position(a_pos); 233#endif 234}`),backgroundPattern:li(`#include "_prelude_fog.fragment.glsl" 235#include "_prelude_lighting.glsl" 236uniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in highp vec2 v_pos;void main() {highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos); 237#ifdef LIGHTING_3D_MODE 238out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 239#endif 240#ifdef FOG 241out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 242#endif 243glFragColor=out_color*u_opacity; 244#ifdef OVERDRAW_INSPECTOR 245glFragColor=vec4(1.0); 246#endif 247HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 248uniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec2 u_pattern_units_to_pixels;in vec2 a_pos;out highp vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_pattern_units_to_pixels,a_pos); 249#ifdef FOG 250v_fog_pos=fog_position(a_pos); 251#endif 252}`),circle:li(`#include "_prelude_fog.fragment.glsl" 253#include "_prelude_lighting.glsl" 254in vec3 v_data;in float v_visibility; 255#pragma mapbox: define highp vec4 color 256#pragma mapbox: define mediump float radius 257#pragma mapbox: define lowp float blur 258#pragma mapbox: define lowp float opacity 259#pragma mapbox: define highp vec4 stroke_color 260#pragma mapbox: define mediump float stroke_width 261#pragma mapbox: define lowp float stroke_opacity 262uniform float u_emissive_strength;void main() { 263#pragma mapbox: initialize highp vec4 color 264#pragma mapbox: initialize mediump float radius 265#pragma mapbox: initialize lowp float blur 266#pragma mapbox: initialize lowp float opacity 267#pragma mapbox: initialize highp vec4 stroke_color 268#pragma mapbox: initialize mediump float stroke_width 269#pragma mapbox: initialize lowp float stroke_opacity 270vec2 extrude=v_data.xy;float blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);
270float antialiase_blur_opacity=smoothstep(0.0,antialiasblur,extrude_length-1.0);float opacity_t=blur_positive==1.0 ? 271smoothstep(0.0,-antialiased_blur,1.0-extrude_length) : 272smoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_opacity;float color_t=stroke_width < 0.01 ? 0.0 : smoothstep( 273antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width) 274);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t); 275#ifdef LIGHTING_3D_MODE 276out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 277#endif 278#ifdef FOG 279out_color=fog_apply_premultiplied(out_color,v_fog_pos); 280#endif 281glFragColor=out_color*(v_visibility*opacity_t); 282#ifdef OVERDRAW_INSPECTOR 283glFragColor=vec4(1.0); 284#endif 285}`,`#include "_prelude_fog.vertex.glsl" 286#include "_prelude_terrain.vertex.glsl" 287#define NUM_VISIBILITY_RINGS 2 288#define INV_SQRT2 0.70710678 289#define ELEVATION_BIAS 0.0001 290#define NUM_SAMPLES_PER_RING 16 291uniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in vec2 a_pos; 292#ifdef PROJECTION_GLOBE_VIEW 293in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir; 294#endif 295#ifdef ELEVATED_ROADS 296in float a_circle_z_offset; 297#endif 298out vec3 v_data;out float v_visibility; 299#pragma mapbox: define highp vec4 color 300#pragma mapbox: define mediump float radius 301#pragma mapbox: define lowp float blur 302#pragma mapbox: define lowp float opacity 303#pragma mapbox: define highp vec4 stroke_color 304#pragma mapbox: define mediump float stroke_width 305#pragma mapbox: define lowp float stroke_opacity 306vec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) { 307#if defined(TERRAIN) 308return elevation(pos)+ELEVATION_BIAS; 309#else 310return 0.0; 311#endif 312}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale); 313#ifdef PITCH_WITH_MAP 314#ifdef PROJECTION_GLOBE_VIEW 315return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) ); 316#else 317return u_matrix*( world_center+vec4(sample_offset,0,0) ); 318#endif 319#else 320return projected_center+vec4(sample_offset,0,0); 321#endif 322}float get_sample_step() { 323#ifdef PITCH_WITH_MAP 324return 2.0*PI/float(NUM_SAMPLES_PER_RING); 325#else 326return PI/float(NUM_SAMPLES_PER_RING); 327#endif 328}void main(void) { 329#pragma mapbox: initialize highp vec4 color 330#pragma mapbox: initialize mediump float radius 331#pragma mapbox: initialize lowp float blur 332#pragma mapbox: initialize lowp float opacity 333#pragma mapbox: initialize highp vec4 stroke_color 334#pragma mapbox: initialize mediump float stroke_width 335#pragma mapbox: initialize lowp float stroke_opacity 336vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors; 337#ifdef PROJECTION_GLOBE_VIEW 338vec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1); 339#else
340surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1); 341#endif 342#ifdef ELEVATED_ROADS 343world_center.z+=a_circle_z_offset+ELEVATION_BIAS; 344#endif 345vec4 projected_center=u_matrix*world_center;float view_scale=0.0; 346#ifdef PITCH_WITH_MAP 347#ifdef SCALE_WITH_MAP 348view_scale=1.0; 349#else 350view_scale=projected_center.w/u_camera_to_center_distance; 351#endif 352#else 353#ifdef SCALE_WITH_MAP 354view_scale=u_camera_to_center_distance; 355#else 356view_scale=projected_center.w; 357#endif 358#endif 359gl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0; 360#ifdef TERRAIN 361float step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center; 362#ifdef PITCH_WITH_MAP 363float cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center; 364#else 365occlusion_world_center=world_center;occlusion_projected_center=projected_center; 366#endif 367for(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING); 368#else 369visibility=1.0; 370#endif 371#ifdef PROJECTION_GLOBE_VIEW 372visibility=1.0; 373#endif 374v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur); 375#ifdef FOG 376v_fog_pos=fog_position(world_center.xyz); 377#endif 378}`),clippingMask:li("void main() {glFragColor=vec4(1.0);}","in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:li(`#include "_prelude_fog.fragment.glsl" 379uniform highp float u_intensity;in vec2 v_extrude; 380#pragma mapbox: define highp float weight 381#define GAUSS_COEF 0.3989422804014327 382void main() { 383#pragma mapbox: initialize highp float weight 384float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);glFragColor=vec4(val,1.0,1.0,1.0); 385#ifdef FOG 386if (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);} 387#endif 388#ifdef OVERDRAW_INSPECTOR 389glFragColor=vec4(1.0); 390#endif 391HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" 392#include "_prelude_fog.vertex.glsl" 393uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos; 394#ifdef PROJECTION_GLOBE_VIEW 395in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir; 396#endif 397out vec2 v_extrude; 398#pragma mapbox: define highp float weight 399#pragma mapbox: define mediump float radius 400const highp float ZERO=1.0/255.0/16.0; 401#define GAUSS_COEF 0.3989422804014327 402void main(void) { 403#pragma mapbox: initialize highp float weight 404#pragma mapbox: initialize mediump float radius 405vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);vec3 pos; 406#ifdef PROJECTION_GLOBE_VIEW 407vec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); 408#else 409pos=vec3(tilePos+extrude,elevation(tilePos)); 410#endif 411gl_Position=u_matrix*vec4(pos,1); 412#ifdef FOG 413v_fog_pos=fog_position(pos); 414#endif 415}`),heatmapTexture:li(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));glFragColor=color*u_opacity; 416#ifdef OVERDRAW_INSPECTOR 417glFragColor=vec4(0.0); 418#endif 419HANDLE_WIREFRAME_DEBUG;}`,"in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:li("in float v_placed;in float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",`#include "_prelude_terrain.vertex.glsl" 420in vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;in vec2 a_elevation_from_sea;in float a_size_scale;in vec2 a_padding;in float a_auto_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;out float v_placed;out float v_notUsed;void main() {float feature_elevation=a_elevation_from_sea.x+a_auto_z_offset;float terrain_elevation=(a_elevation_from_sea.y==1.0 ? 0.0 : elevation(a_anchor_pos));vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*(feature_elevation+terrain_elevation),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp( 4210.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}`),collisionCircle:li("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);glFragColor=color*alpha*opacity_t;}",`in vec2 a_pos_2f;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2( 422mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp( 4230.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}`),debug:li("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}",`#include "_prelude_terrain.vertex.glsl" 424in vec2 a_pos; 425#ifdef PROJECTION_GLOBE_VIEW 426in vec3 a_pos_3; 427#endif 428out vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0; 429#ifdef PROJECTION_GLOBE_VIEW
430gl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1); 431#else 432gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1); 433#endif 434}`),elevatedStructuresDepth:li(`void main() { 435#ifndef DEPTH_TEXTURE 436glFragColor=vec4(0.); 437#endif 438}`,"in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform float u_depth_bias;void main() {gl_Position=u_matrix*vec4(a_pos,a_height,1);gl_Position.z=gl_Position.z+u_depth_bias;}"),elevatedStructuresDepthReconstruct:li(`#ifdef DEPTH_RECONSTRUCTION 439in float v_height; 440#endif 441void main() { 442#ifdef DEPTH_RECONSTRUCTION 443if (v_height >=0.0) 444discard; 445#endif 446glFragColor=vec4(1.0,0.0,0.0,1.0);}`,`in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform vec3 u_camera_pos;uniform highp float u_depth_bias;uniform lowp float u_height_scale;uniform lowp float u_reset_depth; 447#ifdef DEPTH_RECONSTRUCTION 448out float v_height; 449#endif 450void main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale); 451#ifdef DEPTH_RECONSTRUCTION 452if (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height; 453#endif 454gl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}`),elevatedStructures:li(`#include "_prelude_fog.fragment.glsl" 455#include "_prelude_lighting.glsl" 456#include "_prelude_shadow.fragment.glsl" 457in vec3 v_normal;in float v_height; 458#ifdef RENDER_SHADOWS 459in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth; 460#endif 461void main() {vec3 color=vec3(241.0/255.0,236.0/255.0,225.0/255.0); 462#ifdef LIGHTING_3D_MODE 463vec3 normal=normalize(v_normal); 464#ifdef RENDER_SHADOWS 465float shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,v_depth);color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor); 466#else 467color=apply_lighting(color,normal); 468#endif 469if (v_height < 0.0) {float penetration=max(v_height+7.5,0.0);float occlusion=1.0-1.0/PI*acos(1.0-penetration/4.0);color=color*(1.0-pow(occlusion,2.0)*0.3);} 470#endif 471#ifdef FOG 472color=fog_apply(color,v_fog_pos); 473#endif 474vec4 out_color=vec4(color,1.0); 475#ifdef INDICATOR_CUTOUT 476out_color=applyCutout(out_color,v_height); 477#endif 478glFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 479#include "_prelude_shadow.vertex.glsl" 480in vec2 a_pos;in float a_height;in vec3 a_pos_normal_3;uniform mat4 u_matrix;out vec3 v_normal;out float v_height; 481#ifdef RENDER_SHADOWS 482uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth; 483#endif 484void main() {v_normal=a_pos_normal_3/16384.0;v_height=a_height;vec3 pos=vec3(a_pos,a_height);gl_Position=u_matrix*vec4(pos,1); 485#ifdef RENDER_SHADOWS 486vec3 shd_pos0=pos;vec3 shd_pos1=pos; 487#ifdef NORMAL_OFFSET 488vec3 offset=shadow_normal_offset(v_normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 489#endif 490v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 491#endif 492#ifdef FOG 493v_fog_pos=fog_position(a_pos); 494#endif 495}`),fill:li(`#include "_prelude_fog.fragment.glsl" 496#include "_prelude_lighting.glsl" 497#include "_prelude_shadow.fragment.glsl" 498#pragma mapbox: define highp vec4 color 499#pragma mapbox: define lowp float opacity 500uniform float u_emissive_strength; 501#ifdef RENDER_SHADOWS 502uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; 503#endif 504#ifdef INDICATOR_CUTOUT 505in highp float v_z_offset; 506#endif 507void main() { 508#pragma mapbox: initialize highp vec4 color 509#pragma mapbox: initialize lowp float opacity 510vec4 out_color=color; 511#ifdef LIGHTING_3D_MODE 512out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 513#ifdef RENDER_SHADOWS 514float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 515#endif 516#endif 517#ifdef FOG 518out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 519#endif 520out_color*=opacity; 521#ifdef INDICATOR_CUTOUT 522if (v_z_offset >=0.0) {out_color=applyCutout(out_color,v_z_offset);} 523#endif 524glFragColor=out_color; 525#ifdef OVERDRAW_INSPECTOR 526glFragColor=vec4(1.0); 527#endif 528HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 529#include "_prelude_shadow.vertex.glsl" 530in vec2 a_pos; 531#ifdef ELEVATED_ROADS 532in float a_road_z_offset; 533#endif 534#ifdef RENDER_SHADOWS 535uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; 536#endif 537#ifdef INDICATOR_CUTOUT 538out highp float v_z_offset; 539#endif 540uniform mat4 u_matrix; 541#pragma mapbox: define highp vec4 color 542#pragma mapbox: define lowp float opacity 543#pragma mapbox: define highp float z_offset 544void main() { 545#pragma mapbox: initialize highp vec4 color 546#pragma mapbox: initialize lowp float opacity 547#pragma mapbox: initialize highp float z_offset 548#ifdef ELEVATED_ROADS 549z_offset+=a_road_z_offset; 550#endif 551float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden); 552#ifdef RENDER_SHADOWS 553vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); 554#ifdef NORMAL_OFFSET 555vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 556#endif 557v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 558#endif 559#ifdef FOG 560v_fog_pos=fog_position(a_pos); 561#endif 562#ifdef INDICATOR_CUTOUT 563v_z_offset=z_offset; 564#endif 565}`),fillOutline:li(`#include "_prelude_fog.fragment.glsl" 566#include "_prelude_lighting.glsl" 567#include "_prelude_shadow.fragment.glsl" 568in highp vec2 v_pos;uniform float u_emissive_strength; 569#ifdef RENDER_SHADOWS 570uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; 571#endif 572#pragma mapbox: define highp vec4 outline_color 573#pragma mapbox: define lowp float opacity 574void main() { 575#pragma mapbox: initialize highp vec4 outline_color 576#pragma mapbox: initialize lowp float opacity 577float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color; 578#ifdef LIGHTING_3D_MODE 579out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 580#ifdef RENDER_SHADOWS 581float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 582#endif 583#endif 584#ifdef FOG 585out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 586#endif 587glFragColor=out_color*(alpha*opacity); 588#ifdef OVERDRAW_INSPECTOR 589glFragColor=vec4(1.0); 590#endif 591HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 592#include "_prelude_shadow.vertex.glsl" 593in vec2 a_pos; 594#ifdef ELEVATED_ROADS 595in float a_road_z_offset; 596#endif 597#ifdef RENDER_SHADOWS 598uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; 599#endif 600uniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos; 601#pragma mapbox: define highp vec4 outline_color 602#pragma mapbox: define lowp float opacity 603#pragma mapbox: define highp float z_offset 604void main() { 605#pragma mapbox: initialize highp vec4 outline_color 606#pragma mapbox: initialize lowp float opacity 607#pragma mapbox: initialize highp float z_offset 608#ifdef ELEVATED_ROADS 609z_offset+=a_road_z_offset; 610#endif 611float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; 612#ifdef RENDER_SHADOWS 613vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); 614#ifdef NORMAL_OFFSET 615vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 616#endif 617v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 618#endif 619#ifdef FOG 620v_fog_pos=fog_position(a_pos); 621#endif 622}`),fillOutlinePattern:li(`#include "_prelude_fog.fragment.glsl" 623#include "_prelude_lighting.glsl" 624#include "_prelude_shadow.fragment.glsl" 625uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_emissive_strength; 626#ifdef RENDER_SHADOWS 627uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; 628#endif 629in highp vec2 v_pos;in highp vec2 v_pos_world; 630#pragma mapbox: define lowp float opacity 631#pragma mapbox: define lowp vec4 pattern 632void main() { 633#pragma mapbox: initialize lowp float opacity 634#pragma mapbox: initialize mediump vec4 pattern 635vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); 636#ifdef LIGHTING_3D_MODE 637out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 638#ifdef RENDER_SHADOWS 639float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 640#endif 641#endif 642#ifdef FOG 643out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 644#endif 645glFragColor=out_color*(alpha*opacity); 646#ifdef OVERDRAW_INSPECTOR 647glFragColor=vec4(1.0); 648#endif 649HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 650#include "_prelude_shadow.vertex.glsl" 651uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos; 652#ifdef ELEVATED_ROADS 653in float a_road_z_offset; 654#endif 655#ifdef RENDER_SHADOWS 656uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; 657#endif 658out highp vec2 v_pos;out highp vec2 v_pos_world; 659#pragma mapbox: define lowp float opacity 660#pragma mapbox: define lowp vec4 pattern 661#pragma mapbox: define lowp float pixel_ratio 662#pragma mapbox: define highp float z_offset 663void main() { 664#pragma mapbox: initialize lowp float opacity 665#pragma mapbox: initialize mediump vec4 pattern 666#pragma mapbox: initialize lowp float pixel_ratio 667#pragma mapbox: initialize highp float z_offset 668vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw; 669#ifdef ELEVATED_ROADS 670z_offset+=a_road_z_offset; 671#endif 672float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; 673#ifdef RENDER_SHADOWS 674vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); 675#ifdef NORMAL_OFFSET 676vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 677#endif 678v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 679#endif 680#ifdef FOG 681v_fog_pos=fog_position(a_pos); 682#endif 683}`),fillPattern:li(`#include "_prelude_fog.fragment.glsl" 684#include "_prelude_lighting.glsl" 685#include "_prelude_shadow.fragment.glsl" 686uniform vec2 u_texsize;uniform sampler2D u_image;in highp vec2 v_pos;uniform float u_emissive_strength; 687#ifdef RENDER_SHADOWS 688uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; 689#endif 690#pragma mapbox: define lowp float opacity 691#pragma mapbox: define lowp vec4 pattern 692void main() { 693#pragma mapbox: initialize lowp float opacity 694#pragma mapbox: initialize mediump vec4 pattern 695vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); 696#ifdef LIGHTING_3D_MODE 697out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 698#ifdef RENDER_SHADOWS 699float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 700#endif 701#endif 702#ifdef FOG 703out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 704#endif 705glFragColor=out_color*opacity; 706#ifdef OVERDRAW_INSPECTOR 707glFragColor=vec4(1.0); 708#endif 709HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 710#include "_prelude_shadow.vertex.glsl" 711uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos; 712#ifdef ELEVATED_ROADS 713in float a_road_z_offset; 714#endif 715#ifdef RENDER_SHADOWS 716uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; 717#endif 718out highp vec2 v_pos; 719#pragma mapbox: define lowp float opacity 720#pragma mapbox: define lowp vec4 pattern 721#pragma mapbox: define lowp float pixel_ratio 722#pragma mapbox: define highp float z_offset 723void main() { 724#pragma mapbox: initialize lowp float opacity 725#pragma mapbox: initialize mediump vec4 pattern 726#pragma mapbox: initialize lowp float pixel_ratio 727#pragma mapbox: initialize highp float z_offset 728vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio; 729#ifdef ELEVATED_ROADS 730z_offset+=a_road_z_offset; 731#endif 732float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos); 733#ifdef RENDER_SHADOWS 734vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); 735#ifdef NORMAL_OFFSET 736vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 737#endif 738v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 739#endif 740#ifdef FOG 741v_fog_pos=fog_position(a_pos); 742#endif 743}`),fillExtrusion:li(`#include "_prelude_fog.fragment.glsl" 744#include "_prelude_shadow.fragment.glsl" 745#include "_prelude_lighting.glsl" 746in vec4 v_color;in vec4 v_flat; 747#ifdef RENDER_SHADOWS 748in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1; 749#endif 750uniform lowp float u_opacity; 751#ifdef FAUX_AO 752uniform lowp vec2 u_ao;in vec2 v_ao; 753#endif 754#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) 755in vec4 v_roof_color; 756#endif 757#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 758in highp vec3 v_normal; 759#endif 760uniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor; 761#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)
762in float v_flood_radius;in float v_has_floodlight; 763#endif 764in float v_height; 765#pragma mapbox: define highp float emissive_strength 766void main() { 767#pragma mapbox: initialize highp float emissive_strength 768#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 769vec3 normal=normalize(v_normal); 770#endif 771float z;vec4 color=v_color; 772#ifdef ZERO_ROOF_RADIUS 773z=float(normal.z > 0.00001); 774#ifdef LIGHTING_3D_MODE 775normal=mix(normal,vec3(0.0,0.0,1.0),z); 776#else 777color=mix(v_color,v_roof_color,z); 778#endif 779#endif 780float h=max(0.0,v_height);float ao_shade=1.0; 781#ifdef FAUX_AO 782float intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x; 783#ifdef ZERO_ROOF_RADIUS 784concave*=(1.0-z); 785#endif 786float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave); 787#ifdef LIGHTING_3D_MODE 788#ifdef FLOOD_LIGHT 789color.rgb*=mix(ao_shade,1.0,v_has_floodlight); 790#else 791color.rgb*=ao_shade; 792#endif 793#else 794color.rgb*=ao_shade; 795#endif 796#endif 797#ifdef LIGHTING_3D_MODE 798float flood_radiance=0.0; 799#ifdef FLOOD_LIGHT 800flood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight; 801#endif 802#ifdef RENDER_SHADOWS 803#ifdef FLOOD_LIGHT 804float ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance); 805#else 806float shadowed_lighting_factor; 807#ifdef RENDER_CUTOFF 808shadowed_lighting_factor=shadowed_light_factor_normal_opacity(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;} 809#else 810shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w); 811#endif 812color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor); 813#endif 814#else 815color.rgb=apply_lighting(color.rgb,normal); 816#ifdef FLOOD_LIGHT 817color.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance); 818#endif 819#endif 820color.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity; 821#endif 822#ifdef FOG 823color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h)); 824#endif 825#ifdef INDICATOR_CUTOUT 826color=applyCutout(color,h); 827#endif 828glFragColor=color; 829#ifdef OVERDRAW_INSPECTOR 830glFragColor=vec4(1.0); 831#endif 832HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 833#include "_prelude_terrain.vertex.glsl" 834#include "_prelude_shadow.vertex.glsl" 835#include "_prelude_lighting.glsl" 836uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;uniform float u_width_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; 837#ifdef RENDER_WALL_MODE 838in vec3 a_join_normal_inside; 839#endif 840#ifdef PROJECTION_GLOBE_VIEW 841in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift; 842#endif 843#ifdef TERRAIN 844uniform int u_height_type;uniform int u_base_type; 845#endif 846uniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat; 847#ifdef RENDER_SHADOWS 848uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1; 849#endif 850#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) 851out vec4 v_roof_color; 852#endif 853#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 854out highp vec3 v_normal; 855#endif 856#ifdef FAUX_AO 857uniform lowp vec2 u_ao;out vec2 v_ao; 858#endif 859#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)
860out float v_flood_radius;out float v_has_floodlight; 861#endif 862out float v_height;vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));} 863#pragma mapbox: define highp float base 864#pragma mapbox: define highp float height 865#pragma mapbox: define highp vec4 color 866#pragma mapbox: define highp float flood_light_wall_radius 867#pragma mapbox: define highp float line_width 868#pragma mapbox: define highp float emissive_strength 869void main() { 870#pragma mapbox: initialize highp float base 871#pragma mapbox: initialize highp float height 872#pragma mapbox: initialize highp vec4 color 873#pragma mapbox: initialize highp float flood_light_wall_radius 874#pragma mapbox: initialize highp float line_width 875#pragma mapbox: initialize highp float emissive_strength 876base*=u_vertical_scale;height*=u_vertical_scale;vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0)); 877#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 878v_normal=normal; 879#endif 880base=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0); 881#if defined(HAS_CENTROID) || defined(TERRAIN) 882centroid_pos=a_centroid_pos; 883#endif 884float ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos; 885#ifdef TERRAIN 886bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h); 887#else 888h=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h); 889#endif 890#ifdef PROJECTION_GLOBE_VIEW 891float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); 892#endif 893float cutoff=1.0;vec3 scaled_pos=pos; 894#ifdef RENDER_CUTOFF 895vec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0);cutoff=cutoff_opacity(u_cutoff_params,ground.z);if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale); 896#endif 897float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0)); 898#ifdef RENDER_WALL_MODE 899vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);scaled_pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;scaled_pos.xy-=a_join_normal_inside.z*wall_offset*0.5; 900#endif 901gl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h; 902#ifdef RENDER_SHADOWS 903vec3 shd_pos0=pos;vec3 shd_pos1=pos; 904#ifdef NORMAL_OFFSET 905vec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 906#endif 907v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1); 908#endif 909float NdotL=0.0;float colorvalue=0.0; 910#ifndef LIGHTING_3D_MODE 911colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=( 912(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} 913#endif 914#ifdef FAUX_AO
915float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height; 916#ifdef TERRAIN 917top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height); 918#endif 919v_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]); 920#ifdef PROJECTION_GLOBE_VIEW 921top_height+=u_height_lift; 922#endif 923gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; 924#endif 925#ifdef LIGHTING_3D_MODE 926#ifdef FLOOD_LIGHT 927float is_wall=1.0-float(t > 0.0 && top_up_ny.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale; 928#endif 929v_color=vec4(color.rgb,1.0);float ndotl=calculate_NdotL(normal);v_flat.rgb=sRGBToLinear(color.rgb);v_flat.rgb=v_flat.rgb*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);v_flat=vec4(linearTosRGB(v_flat.rgb),1.0); 930#else 931v_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity; 932#endif 933#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) 934float roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity; 935#endif 936#ifdef FOG 937v_fog_pos=fog_position(pos); 938#endif 939}`),fillExtrusionDepth:li(`in highp float v_depth;void main() { 940#ifndef DEPTH_TEXTURE 941glFragColor=pack_depth(v_depth); 942#endif 943}`,`#include "_prelude_terrain.vertex.glsl" 944uniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale; 945#ifdef TERRAIN 946uniform int u_height_type;uniform int u_base_type; 947#endif 948in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; 949#ifdef RENDER_WALL_MODE 950in vec3 a_join_normal_inside; 951#endif 952#pragma mapbox: define highp float base 953#pragma mapbox: define highp float height 954#pragma mapbox: define highp float line_width 955#pragma mapbox: define highp vec4 color 956out highp float v_depth;void main() { 957#pragma mapbox: initialize highp float base 958#pragma mapbox: initialize highp float height 959#pragma mapbox: initialize highp float line_width 960#pragma mapbox: initialize highp vec4 color 961base*=u_vertical_scale;height*=u_vertical_scale;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0); 962#if defined(HAS_CENTROID) || defined(TERRAIN) 963centroid_pos=a_centroid_pos; 964#endif 965vec3 pos; 966#ifdef TERRAIN 967bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;float ele=elevation(pos_nx.xy);float c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);float h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h); 968#else 969pos=vec3(pos_nx.xy,t > 0.0 ? height : base); 970#endif 971#ifdef RENDER_WALL_MODE 972vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;pos.xy-=a_join_normal_inside.z*wall_offset*0.5; 973#endif 974float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);v_depth=gl_Position.z/gl_Position.w;}`),fillExtrusionPattern:li(`#include "_prelude_fog.fragment.glsl" 975#include "_prelude_lighting.glsl" 976uniform vec2 u_texsize;uniform sampler2D u_image; 977#ifdef FAUX_AO 978uniform lowp vec2 u_ao;in vec3 v_ao; 979#endif 980#ifdef LIGHTING_3D_MODE 981in vec3 v_normal; 982#endif 983in highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity; 984#pragma mapbox: define highp float base 985#pragma mapbox: define highp float height 986#pragma mapbox: define mediump vec4 pattern 987#pragma mapbox: define highp float pixel_ratio 988void main() { 989#pragma mapbox: initialize highp float base 990#pragma mapbox: initialize highp float height 991#pragma mapbox: initialize mediump vec4 pattern 992#pragma mapbox: initialize highp float pixel_ratio 993vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); 994#ifdef LIGHTING_3D_MODE 995out_color=apply_lighting(out_color,normalize(v_normal))*u_opacity; 996#else 997out_color=out_color*v_lighting; 998#endif 999#ifdef FAUX_AO 1000float intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0
1000),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade; 1001#endif 1002#ifdef FOG 1003out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 1004#endif 1005#ifdef INDICATOR_CUTOUT 1006out_color=applyCutout(out_color,height); 1007#endif 1008glFragColor=out_color; 1009#ifdef OVERDRAW_INSPECTOR 1010glFragColor=vec4(1.0); 1011#endif 1012HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1013#include "_prelude_terrain.vertex.glsl" 1014#include "_prelude_lighting.glsl" 1015uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_width_scale;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; 1016#ifdef RENDER_WALL_MODE 1017in vec3 a_join_normal_inside; 1018#endif 1019#ifdef PROJECTION_GLOBE_VIEW 1020in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift; 1021#endif 1022#ifdef TERRAIN 1023uniform int u_height_type;uniform int u_base_type; 1024#endif 1025out highp vec2 v_pos;out vec4 v_lighting; 1026#ifdef FAUX_AO 1027uniform lowp vec2 u_ao;out vec3 v_ao; 1028#endif 1029#ifdef LIGHTING_3D_MODE 1030out vec3 v_normal; 1031#endif 1032#pragma mapbox: define highp float base 1033#pragma mapbox: define highp float height 1034#pragma mapbox: define highp vec4 color 1035#pragma mapbox: define mediump vec4 pattern 1036#pragma mapbox: define highp float pixel_ratio 1037#pragma mapbox: define highp float line_width 1038void main() { 1039#pragma mapbox: initialize highp float base 1040#pragma mapbox: initialize highp float height 1041#pragma mapbox: initialize highp vec4 color 1042#pragma mapbox: initialize mediump vec4 pattern 1043#pragma mapbox: initialize highp float pixel_ratio 1044#pragma mapbox: initialize highp float line_width 1045vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0); 1046#if defined(HAS_CENTROID) || defined(TERRAIN) 1047centroid_pos=a_centroid_pos; 1048#endif 1049float ele=0.0;float h=z;vec3 p;float c_ele; 1050#ifdef TERRAIN 1051bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;p=vec3(pos_nx.xy,h); 1052#else 1053p=vec3(pos_nx.xy,z); 1054#endif 1055#ifdef PROJECTION_GLOBE_VIEW 1056float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); 1057#endif 1058#ifdef RENDER_WALL_MODE 1059vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);p.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;p.xy-=a_join_normal_inside.z*wall_offset*0.5; 1060#endif 1061float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0 1062? pos_nx.xy 1063: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0; 1064#ifdef LIGHTING_3D_MODE 1065NdotL=calculate_NdotL(normal); 1066#else 1067NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL); 1068#endif 1069if (normal.y !=0.0) {float r=0.84; 1070#ifndef LIGHTING_3D_MODE 1071r=mix(0.7,0.98,1.0-u_lightintensity); 1072#endif 1073NdotL*=( 1074(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} 1075#ifdef FAUX_AO
1076float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height; 1077#ifdef TERRAIN 1078top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height); 1079#endif 1080v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]); 1081#ifdef PROJECTION_GLOBE_VIEW 1082top_height+=u_height_lift; 1083#endif 1084gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; 1085#endif 1086#ifdef LIGHTING_3D_MODE 1087v_normal=normal; 1088#else 1089v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity; 1090#endif 1091#ifdef FOG 1092v_fog_pos=fog_position(p); 1093#endif 1094}`),groundShadow:li(`#include "_prelude_shadow.fragment.glsl" 1095precision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1; 1096#ifdef FOG 1097in float v_fog_opacity; 1098#endif 1099void main() {float light=shadowed_light_factor_plane_bias(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light); 1100#ifdef RENDER_CUTOFF 1101shadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w)); 1102#endif 1103#ifdef FOG 1104shadow=mix(shadow,vec3(1.0),v_fog_opacity); 1105#endif 1106#ifdef INDICATOR_CUTOUT 1107shadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r); 1108#endif 1109glFragColor=vec4(shadow,1.0);}`,`#include "_prelude_fog.vertex.glsl" 1110uniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in vec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1; 1111#ifdef FOG 1112out float v_fog_opacity; 1113#endif 1114void main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0); 1115#ifdef FOG 1116v_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos); 1117#endif 1118}`),fillExtrusionGroundEffect:li(`uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size; 1119#ifdef SDF_SUBPASS 1120in highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);} 1121#ifdef FOG 1122in highp float v_fog; 1123#endif 1124#endif 1125void main() { 1126#ifdef CLEAR_SUBPASS 1127vec4 color=vec4(1.0); 1128#ifdef CLEAR_FROM_TEXTURE 1129color=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)); 1130#endif 1131glFragColor=color; 1132#else 1133#ifdef SDF_SUBPASS 1134highp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0; 1135#ifdef FOG 1136fog=v_fog; 1137#endif 1138#ifdef RENDER_CUTOFF 1139fog*=v_cutoff_opacity; 1140#endif 1141glFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog)); 1142#else 1143vec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass); 1144#ifdef OVERDRAW_INSPECTOR 1145color=vec4(1.0); 1146#endif 1147glFragColor=color; 1148#endif 1149HANDLE_WIREFRAME_DEBUG; 1150#endif 1151}`,`#include "_prelude_fog.vertex.glsl" 1152in highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark; 1153#ifdef SDF_SUBPASS 1154out highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao; 1155#ifdef FOG 1156out highp float v_fog; 1157#endif 1158#endif 1159uniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp float u_dynamic_offset;uniform highp vec2 u_ao; 1160#pragma mapbox: define highp float flood_light_ground_radius 1161const float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {
1162#pragma mapbox: initialize highp float flood_light_ground_radius 1163vec2 p=a_pos_end.xy;vec2 q=floor(a_pos_end.zw*0.5);vec2 start_bottom=a_pos_end.zw-q*2.0;float fl_ground_radius=flood_light_ground_radius;fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=a_angular_offset_factor/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(u_dynamic_offset,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp; 1164#ifdef SDF_SUBPASS 1165v_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius); 1166#ifdef FOG 1167v_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos); 1168#endif 1169#endif 1170float hidden_by_landmark=0.0; 1171#ifdef HAS_CENTROID 1172hidden_by_landmark=a_hidden_by_landmark; 1173#endif 1174float isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0)); 1175#ifdef RENDER_CUTOFF 1176v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); 1177#endif 1178}`),hillshadePrepare:li(`precision highp float;uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2( 1179(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c) 1180)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4( 1181deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:li(`#include "_prelude_fog.fragment.glsl" 1182#include "_prelude_lighting.glsl" 1183uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);glFragColor=accent_color*(1.0-shade_color.a)+shade_color; 1184#ifdef LIGHTING_3D_MODE 1185glFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength); 1186#endif 1187#ifdef FOG 1188glFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos)); 1189#endif 1190#ifdef OVERDRAW_INSPECTOR 1191glFragColor=vec4(1.0); 1192#endif 1193HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1194uniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0; 1195#ifdef FOG 1196v_fog_pos=fog_position(a_pos); 1197#endif 1198}`),line:li(`#include "_prelude_fog.fragment.glsl" 1199#include "_prelude_lighting.glsl" 1200#include "_prelude_shadow.fragment.glsl" 1201uniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_floor_width_scale;
1201uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec3 v_uv; 1202#ifdef ELEVATED_ROADS 1203in highp float v_road_z_offset; 1204#endif 1205#ifdef RENDER_LINE_DASH 1206uniform sampler2D u_dash_image;in vec2 v_tex; 1207#endif 1208#ifdef RENDER_LINE_GRADIENT 1209uniform sampler2D u_gradient_image; 1210#endif 1211#ifdef INDICATOR_CUTOUT 1212in highp float v_z_offset; 1213#endif 1214#ifdef RENDER_SHADOWS 1215uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; 1216#endif 1217float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}uniform float u_emissive_strength; 1218#pragma mapbox: define highp vec4 color 1219#pragma mapbox: define lowp float floorwidth 1220#pragma mapbox: define lowp vec4 dash 1221#pragma mapbox: define lowp float blur 1222#pragma mapbox: define lowp float opacity 1223#pragma mapbox: define lowp float border_width 1224#pragma mapbox: define lowp vec4 border_color 1225float linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() { 1226#pragma mapbox: initialize highp vec4 color 1227#pragma mapbox: initialize lowp float floorwidth 1228#pragma mapbox: initialize lowp vec4 dash 1229#pragma mapbox: initialize lowp float blur 1230#pragma mapbox: initialize lowp float opacity 1231#pragma mapbox: initialize lowp float border_width 1232#pragma mapbox: initialize lowp vec4 border_color 1233float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0); 1234#ifdef RENDER_LINE_DASH 1235float sdfdist=texture(u_dash_image,v_tex).r;
1235float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;float scaled_floorwidth=(floorwidth*u_floor_width_scale);alpha*=linearstep(0.5-sdfgamma/scaled_floorwidth,0.5+sdfgamma/scaled_floorwidth,sdfdist); 1236#endif 1237highp vec4 out_color; 1238#ifdef RENDER_LINE_GRADIENT 1239out_color=texture(u_gradient_image,v_uv.xy); 1240#else 1241out_color=color; 1242#endif 1243float trim_alpha=1.0; 1244#ifdef RENDER_LINE_TRIM_OFFSET 1245highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);out_color=mix(out_color,u_trim_color,transition_factor);trim_alpha=1.0-transition_factor;} 1246#endif 1247if (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}} 1248#ifdef RENDER_LINE_BORDER 1249float edgeBlur=((border_width*u_width_scale)+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color=mix(border_color*trim_alpha,out_color,smoothAlpha);}} 1250#endif 1251#ifdef LIGHTING_3D_MODE 1252out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 1253#ifdef RENDER_SHADOWS 1254float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); 1255#ifdef ELEVATED_ROADS 1256out_color.rgb*=mix(v_road_z_offset > 0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 1257#else 1258out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 1259#endif 1260#endif 1261#endif 1262#ifdef FOG 1263out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 1264#endif 1265out_color*=(alpha*opacity); 1266#ifdef INDICATOR_CUTOUT 1267out_color=applyCutout(out_color,v_z_offset); 1268#endif 1269glFragColor=out_color; 1270#ifdef OVERDRAW_INSPECTOR 1271glFragColor=vec4(1.0); 1272#endif 1273HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1274#include "_prelude_shadow.vertex.glsl" 1275#include "_prelude_terrain.vertex.glsl" 1276#define EXTRUDE_SCALE 0.015873016 1277in vec2 a_pos_normal;in vec4 a_data; 1278#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH) 1279in vec3 a_z_offset_width; 1280#endif 1281#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) 1282in highp vec3 a_packed; 1283#endif 1284#ifdef RENDER_LINE_DASH 1285in float a_linesofar; 1286#endif 1287uniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;uniform float u_width_scale;uniform highp float u_floor_width_scale; 1288#ifdef ELEVATED 1289uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) { 1290#ifdef ELEVATION_REFERENCE_SEA 1291return 0.0; 1292#else 1293return elevation(apos); 1294#endif 1295} 1296#endif 1297out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec3 v_uv; 1298#ifdef ELEVATED_ROADS 1299out highp float v_road_z_offset; 1300#endif 1301#ifdef RENDER_LINE_DASH 1302uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex; 1303#endif 1304#ifdef RENDER_LINE_GRADIENT 1305uniform float u_image_height; 1306#endif 1307#ifdef INDICATOR_CUTOUT 1308out highp float v_z_offset; 1309#endif 1310#ifdef RENDER_SHADOWS 1311uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; 1312#endif 1313#pragma mapbox: define highp vec4 color 1314#pragma mapbox: define lowp float floorwidth 1315#pragma mapbox: define lowp vec4 dash 1316#pragma mapbox: define lowp float blur 1317#pragma mapbox: define lowp float opacity 1318#pragma mapbox: define mediump float gapwidth 1319#pragma mapbox: define lowp float offset 1320#pragma mapbox: define mediump float width 1321#pragma mapbox: define lowp float border_width 1322#pragma mapbox: define lowp vec4 border_color 1323void main() { 1324#pragma mapbox: initialize highp vec4 color 1325#pragma mapbox: initialize lowp float floorwidth 1326#pragma mapbox: initialize lowp vec4 dash 1327#pragma mapbox: initialize lowp float blur 1328#pragma mapbox: initialize lowp float opacity 1329#pragma mapbox: initialize mediump float gapwidth 1330#pragma mapbox: initialize lowp float offset 1331#pragma mapbox: initialize mediump float width 1332#pragma mapbox: initialize lowp float border_width 1333#pragma mapbox: initialize lowp vec4 border_color 1334float a_z_offset; 1335#if defined(ELEVATED) || defined(ELEVATED_ROADS) 1336a_z_offset=a_z_offset_width.x; 1337#endif 1338float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth; 1339#ifdef VARIABLE_LINE_WIDTH 1340float left=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);halfwidth=(u_width_scale*(left==1.0 ? a_z_offset_width.y : a_z_offset_width.z))/2.0; 1341#else 1342halfwidth=(u_width_scale*width)/2.0; 1343#endif 1344offset=-1.0*offset*u_width_scale;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;
1344vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy; 1345#ifdef ELEVATED_ROADS 1346v_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude; 1347#else 1348#ifdef ELEVATED 1349vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0; 1350#ifdef CROSS_SLOPE_VERTICAL 1351float top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0); 1352#else 1353#ifdef CROSS_SLOPE_HORIZONTAL 1354float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset; 1355#else 1356float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset; 1357#endif 1358#endif 1359gl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden); 1360#else 1361gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden); 1362#endif 1363#endif 1364#ifdef ELEVATED_ROADS 1365#ifdef RENDER_SHADOWS 1366vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos; 1367#ifdef NORMAL_OFFSET 1368vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1(); 1369#endif 1370v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 1371#endif 1372#endif 1373#ifndef RENDER_TO_TEXTURE 1374float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=max(length(projected_extrude_xy/gl_Position.w*u_units_to_pixels),0.001);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur)); 1375#else 1376v_gamma_scale=1.0; 1377#endif 1378#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) 1379highp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float line_progress=a_packed[2]; 1380#ifdef RENDER_LINE_GRADIENT 1381highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec3(a_uv_x,a_split_index*texel_height-half_texel_height,line_progress); 1382#else 1383v_uv=vec3(a_uv_x,0.0,line_progress); 1384#endif 1385#endif 1386#ifdef RENDER_LINE_DASH 1387float scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/(floorwidth*u_floor_width_scale),(-normal.y*height+dash.x+0.5)/u_texsize.y); 1388#endif 1389v_width2=vec2(outset,inset); 1390#ifdef FOG 1391v_fog_pos=fog_position(pos); 1392#endif 1393#ifdef INDICATOR_CUTOUT 1394v_z_offset=a_z_offset; 1395#endif 1396}`),linePattern:li(`#include "_prelude_fog.fragment.glsl" 1397#include "_prelude_lighting.glsl" 1398#include "_prelude_shadow.fragment.glsl" 1399uniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_alpha_discard_threshold;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width; 1400#ifdef RENDER_LINE_TRIM_OFFSET 1401in highp vec3 v_uv; 1402#endif 1403#ifdef ELEVATED_ROADS 1404in highp float v_road_z_offset; 1405#endif 1406#ifdef LINE_JOIN_NONE 1407in vec2 v_pattern_data; 1408#endif 1409#ifdef INDICATOR_CUTOUT 1410in highp float v_z_offset; 1411#endif 1412#ifdef RENDER_SHADOWS 1413uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; 1414#endif 1415uniform float u_emissive_strength; 1416#pragma mapbox: define mediump vec4 pattern 1417#pragma mapbox: define mediump float pixel_ratio 1418#pragma mapbox: define mediump float blur 1419#pragma mapbox: define mediump float opacity 1420void main() { 1421#pragma mapbox: initialize mediump vec4 pattern 1422#pragma mapbox: initialize mediump float pixel_ratio 1423#pragma mapbox: initialize mediump float blur 1424#pragma mapbox: initialize mediump float opacity 1425vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;highp float pattern_size=display_size.x/u_tile_units_to_pixels;float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);highp float pattern_x=v_linesofar/pattern_size*aspect;highp float x=mod(pattern_x,1.0);highp float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;highp vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));highp vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos); 1426#ifdef RENDER_LINE_TRIM_OFFSET 1427highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);color=mix(color,color.a*u_trim_color,transition_factor);} 1428#endif 1429#ifdef LINE_JOIN_NONE 1430highp float pattern_len=pattern_size/aspect;highp float segment_phase=pattern_len-mod(v_linesofar-v_pattern_data.x+pattern_len,pattern_len);highp float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;highp float visible_end=floor((v_pattern_data.y-segment_phase)/pattern_len)*pattern_len+segment_phase;visible_end+=step(pattern_len*0.5,v_pattern_data.y-visible_end)*pattern_len;if (v_pattern_data.x < visible_start || v_pattern_data.x >=visible_end) {color=vec4(0.0);} 1431#endif 1432#ifdef LIGHTING_3D_MODE 1433color=apply_lighting_with_emission_ground(color,u_emissive_strength); 1434#ifdef RENDER_SHADOWS 1435float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); 1436#ifdef ELEVATED_ROADS 1437color.rgb*=mix(v_road_z_offset > 0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 1438#else 1439color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 1440#endif 1441#endif 1442#endif 1443#ifdef FOG 1444color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 1445#endif 1446color*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}} 1447#ifdef INDICATOR_CUTOUT 1448color=applyCutout(color,v_z_offset); 1449#endif 1450glFragColor=color; 1451#ifdef OVERDRAW_INSPECTOR 1452glFragColor=vec4(1.0); 1453#endif 1454HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1455#include "_prelude_shadow.vertex.glsl" 1456#include "_prelude_terrain.vertex.glsl" 1457#define scale 0.015873016 1458in vec2 a_pos_normal;in vec4 a_data; 1459#if defined(ELEVATED) || defined(ELEVATED_ROADS) 1460in vec3 a_z_offset_width; 1461#endif 1462#ifdef RENDER_LINE_TRIM_OFFSET 1463in highp vec3 a_packed; 1464#endif 1465in highp float a_linesofar; 1466#ifdef LINE_JOIN_NONE 1467in highp vec3 a_pattern_data;out vec2 v_pattern_data; 1468#endif 1469#ifdef INDICATOR_CUTOUT 1470out highp float v_z_offset; 1471#endif 1472uniform mat4 u_matrix;uniform float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_floor_width_scale; 1473#ifdef ELEVATED 1474uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) { 1475#ifdef ELEVATION_REFERENCE_SEA 1476return 0.0; 1477#else 1478return elevation(apos); 1479#endif 1480} 1481#endif 1482out vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width; 1483#ifdef RENDER_LINE_TRIM_OFFSET 1484out highp vec3 v_uv; 1485#endif 1486#ifdef ELEVATED_ROADS 1487out highp float v_road_z_offset; 1488#endif 1489#ifdef RENDER_SHADOWS 1490uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; 1491#endif 1492#pragma mapbox: define mediump float blur 1493#pragma mapbox: define mediump float opacity 1494#pragma mapbox: define mediump float offset 1495#pragma mapbox: define mediump float gapwidth 1496#pragma mapbox: define mediump float width 1497#pragma mapbox: define mediump float floorwidth 1498#pragma mapbox: define mediump vec4 pattern 1499#pragma mapbox: define mediump float pixel_ratio 1500void main() { 1501#pragma mapbox: initialize mediump float blur 1502#pragma mapbox: initialize mediump float opacity 1503#pragma mapbox: initialize mediump float offset 1504#pragma mapbox: initialize mediump float gapwidth 1505#pragma mapbox: initialize mediump float width 1506#pragma mapbox: initialize mediump float floorwidth 1507#pragma mapbox: initialize mediump vec4 pattern 1508#pragma mapbox: initialize mediump float pixel_ratio 1509float a_z_offset; 1510#if defined(ELEVATED) || defined(ELEVATED_ROADS) 1511a_z_offset=a_z_offset_width.x; 1512#endif 1513float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=(u_width_scale*width)/2.0;offset=-1.0*offset*u_width_scale;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);vec2 dist=outset*a_extrude*scale;float u=0.5*a_direction;float t=1.0-abs(u);vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;
1513vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy; 1514#ifdef ELEVATED_ROADS 1515v_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude; 1516#else 1517#ifdef ELEVATED 1518vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0; 1519#ifdef CROSS_SLOPE_VERTICAL 1520float top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0); 1521#else 1522#ifdef CROSS_SLOPE_HORIZONTAL 1523float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset; 1524#else 1525float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset; 1526#endif 1527#endif 1528gl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden); 1529#else 1530gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden); 1531#endif 1532#endif 1533#ifdef ELEVATED_ROADS 1534#ifdef RENDER_SHADOWS 1535vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos; 1536#ifdef NORMAL_OFFSET 1537vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1(); 1538#endif 1539v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 1540#endif 1541#endif 1542#ifndef RENDER_TO_TEXTURE 1543float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude_xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur)); 1544#else 1545v_gamma_scale=1.0; 1546#endif 1547#ifdef RENDER_LINE_TRIM_OFFSET 1548highp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress); 1549#endif 1550v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale); 1551#ifdef LINE_JOIN_NONE 1552v_width=(floorwidth*u_floor_width_scale)+ANTIALIASING;mediump float pixels_to_tile_units=1.0/u_tile_units_to_pixels;mediump float pixel_ratio_inverse=1.0/pixel_ratio;mediump float aspect=v_width/((pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y); 1553#endif 1554#ifdef FOG 1555v_fog_pos=fog_position(pos); 1556#endif 1557#ifdef INDICATOR_CUTOUT 1558v_z_offset=a_z_offset; 1559#endif 1560}`),raster:li(`#include "_prelude_fog.fragment.glsl" 1561#include "_prelude_lighting.glsl" 1562#include "_prelude_raster_array.glsl" 1563uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth; 1564#ifdef PROJECTION_GLOBE_VIEW 1565in float v_split_fade; 1566#endif 1567uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength; 1568#ifndef RASTER_ARRAY 1569uniform highp sampler2D u_image0;uniform sampler2D u_image1; 1570#endif 1571#ifdef RASTER_COLOR 1572uniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res; 1573#endif 1574void main() {vec4 color0,color1,color;vec2 value; 1575#ifdef RASTER_COLOR 1576#ifdef RASTER_ARRAY 1577#ifdef RASTER_ARRAY_LINEAR 1578value=mix( 1579raTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t 1580); 1581#else 1582value=mix( 1583raTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t 1584); 1585#endif 1586if (value.y > 0.0) value.x/=value.y; 1587#else 1588color=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a); 1589#endif 1590color=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y; 1591#else 1592color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t); 1593#endif 1594color.a*=u_opacity; 1595#ifdef GLOBE_POLES 1596color.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition); 1597#endif 1598vec3 rgb=color.rgb;rgb=vec3( 1599dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb); 1600#ifdef LIGHTING_3D_MODE 1601out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb; 1602#endif 1603#ifdef FOG 1604highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit)); 1605#endif 1606glFragColor=vec4(out_color*color.a,color.a); 1607#ifdef PROJECTION_GLOBE_VIEW 1608glFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade)); 1609#endif 1610#ifdef RENDER_CUTOFF 1611glFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth); 1612#endif 1613#ifdef OVERDRAW_INSPECTOR 1614glFragColor=vec4(1.0); 1615#endif 1616HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1617uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center; 1618#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8 1619#ifdef GLOBE_POLES 1620in vec3 a_globe_pos;in vec2 a_uv; 1621#else 1622in vec2 a_pos;in vec2 a_texture_pos; 1623#endif 1624out vec2 v_pos0;out vec2 v_pos1;out float v_depth; 1625#ifdef PROJECTION_GLOBE_VIEW 1626out float v_split_fade; 1627#endif 1628void main() {vec2 uv; 1629#ifdef GLOBE_POLES 1630vec3 globe_pos=a_globe_pos;globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos ,1.0);uv=a_uv; 1631#ifdef FOG 1632v_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz); 1633#endif 1634#else 1635float w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0; 1636#ifdef PROJECTION_GLOBE_VIEW 1637vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]); 1638v_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}float tiles=u_grid_matrix[0][2];
1638if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos; 1639#ifdef FOG 1640v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); 1641#endif 1642#else 1643gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w); 1644#ifdef FOG 1645v_fog_pos=fog_position(a_pos); 1646#endif 1647#endif 1648#endif 1649v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1; 1650#ifdef RENDER_CUTOFF 1651v_depth=gl_Position.z; 1652#endif 1653}`),rasterParticle:li(`#include "_prelude_fog.fragment.glsl" 1654#include "_prelude_lighting.glsl" 1655uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;uniform sampler2D u_image0;uniform sampler2D u_image1;void main() {vec4 color0,color1,color;color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 out_color=color.rgb; 1656#ifdef LIGHTING_3D_MODE 1657out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),0.0).rgb; 1658#endif 1659#ifdef FOG 1660highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit)); 1661#endif 1662glFragColor=vec4(out_color*color.a,color.a); 1663#ifdef OVERDRAW_INSPECTOR 1664glFragColor=vec4(1.0); 1665#endif 1666HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1667uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center; 1668#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8 1669in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv; 1670#ifdef PROJECTION_GLOBE_VIEW 1671vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvX=mercatorX*tiles-idx;float uvY=mercatorY*tiles-idy;uv=vec2(uvX,uvY);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos; 1672#ifdef FOG 1673v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); 1674#endif 1675#else 1676uv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w); 1677#ifdef FOG 1678v_fog_pos=fog_position(a_pos); 1679#endif 1680#endif 1681v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),rasterParticleDraw:li("uniform sampler2D u_color_ramp;in float v_particle_speed;void main() {glFragColor=texture(u_color_ramp,vec2(v_particle_speed,0.5));}",`#include "_prelude_raster_particle.glsl" 1682in float a_index;uniform sampler2D u_particle_texture;uniform float u_particle_texture_side_len;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {ivec2 pixel_coord=ivec2( 1683mod(a_index,u_particle_texture_side_len),a_index/u_particle_texture_side_len);vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);vec2 pos=unpack_pos_from_rgba(pixel)+u_tile_offset;vec2 tex_coord=fract(pos);vec2 velocity=lookup_velocity(tex_coord);if (velocity==INVALID_VELOCITY) {gl_Position=AWAY;v_particle_speed=0.0;} else {gl_Position=vec4(2.0*pos-1.0,0,1);v_particle_speed=length(velocity);}gl_PointSize=1.0;}`),rasterParticleTexture:li("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}","in vec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*a_pos+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}"),rasterParticleUpdate:li(`#include "_prelude_raster_particle.glsl" 1684uniform sampler2D u_particle_texture;uniform mediump float u_particle_texture_side_len;uniform mediump float u_speed_factor;uniform highp float u_reset_rate;uniform highp float u_rand_seed;in highp vec2 v_tex_coord;
1684vec2 linearstep(vec2 edge0,vec2 edge1,vec2 x) {return clamp((x-edge0)/(edge1-edge0),vec2(0),vec2(1));}const highp vec3 rand_constants=vec3(12.9898,78.233,4375.85453);highp float rand(const highp vec2 co) {highp float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}void main() {ivec2 pixel_coord=ivec2(v_tex_coord*u_particle_texture_side_len);highp vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);highp vec2 pos=unpack_pos_from_rgba(pixel);highp vec2 velocity=lookup_velocity(clamp(pos,0.0,1.0));highp vec2 dp=velocity==INVALID_VELOCITY ? vec2(0) : velocity*u_speed_factor;pos=pos+dp;highp vec2 seed=(pos+v_tex_coord)*u_rand_seed;highp vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));highp vec2 persist_rate=pow( 1685linearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4) 1686);highp vec2 per_frame_persist=pow(persist_rate,abs(dp)/u_particle_pos_offset);highp float drop_rate=1.0-per_frame_persist.x*per_frame_persist.y;drop_rate=any(greaterThanEqual(abs(pos-0.5),vec2(0.5+u_particle_pos_offset))) ? 1.0 : drop_rate;highp float drop=step(1.0-drop_rate-u_reset_rate,rand(seed));highp vec2 next_pos=mix(pos,random_pos,drop);glFragColor=pack_pos_to_rgba(next_pos);}`,"in vec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*(a_pos+vec2(1.0));gl_Position=vec4(a_pos,0.0,1.0);}"),symbol:li(`#include "_prelude_lighting.glsl" 1687#define SDF_PX 8.0 1688#define SDF 1.0 1689#define ICON 0.0 1690uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;uniform lowp float u_scale_factor; 1691#ifdef ICON_TRANSITION 1692uniform float u_icon_transition; 1693#endif 1694#ifdef COLOR_ADJUSTMENT 1695uniform mat4 u_color_adj_mat; 1696#endif 1697#ifdef INDICATOR_CUTOUT 1698in highp float v_z_offset; 1699#endif 1700in vec2 v_tex_a; 1701#ifdef ICON_TRANSITION 1702in vec2 v_tex_b; 1703#endif 1704in float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity; 1705#ifdef RENDER_TEXT_AND_SYMBOL 1706in float is_sdf;in vec2 v_tex_a_icon; 1707#endif 1708#pragma mapbox: define highp vec4 fill_color 1709#pragma mapbox: define highp vec4 halo_color 1710#pragma mapbox: define lowp float opacity 1711#pragma mapbox: define lowp float halo_width 1712#pragma mapbox: define lowp float halo_blur 1713#pragma mapbox: define lowp float emissive_strength 1714void main() { 1715#pragma mapbox: initialize highp vec4 fill_color 1716#pragma mapbox: initialize highp vec4 halo_color 1717#pragma mapbox: initialize lowp float opacity 1718#pragma mapbox: initialize lowp float halo_width 1719#pragma mapbox: initialize lowp float halo_blur 1720#pragma mapbox: initialize lowp float emissive_strength 1721vec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2]; 1722#ifdef RENDER_TEXT_AND_SYMBOL 1723if (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha; 1724#ifdef OVERDRAW_INSPECTOR 1725glFragColor=vec4(1.0); 1726#endif 1727return;} 1728#endif 1729#ifdef RENDER_SDF 1730float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_gamma_scale_size_fade_opacity.x;float size=v_gamma_scale_size_fade_opacity.y;float fontScale=u_is_text ? size/24.0 : size;out_color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {out_color=halo_color;gamma=(halo_blur*u_scale_factor*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width*u_scale_factor/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,v_tex_a).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);out_color*=alpha; 1731#else 1732#ifdef ICON_TRANSITION 1733vec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b); 1734#else 1735out_color=texture(u_texture,v_tex_a); 1736#endif 1737#ifdef COLOR_ADJUSTMENT 1738out_color=u_color_adj_mat*out_color; 1739#endif 1740#endif 1741out_color*=opacity*fade_opacity; 1742#ifdef LIGHTING_3D_MODE 1743out_color=apply_lighting_with_emission_ground(out_color,emissive_strength); 1744#endif 1745#ifdef INDICATOR_CUTOUT 1746out_color=applyCutout(out_color,v_z_offset); 1747#endif 1748glFragColor=out_color; 1749#ifdef OVERDRAW_INSPECTOR 1750glFragColor=vec4(1.0); 1751#endif 1752HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" 1753in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity; 1754#ifdef Z_OFFSET 1755in float a_auto_z_offset; 1756#endif 1757#ifdef PROJECTION_GLOBE_VIEW 1758in vec3 a_globe_anchor;in vec3 a_globe_normal; 1759#endif 1760#ifdef ICON_TRANSITION 1761in vec2 a_texb; 1762#endif 1763#ifdef OCCLUSION_QUERIES 1764in float a_occlusion_query_opacity; 1765#endif 1766#ifdef INDICATOR_CUTOUT 1767out highp float v_z_offset; 1768#endif 1769uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_elevation_from_sea;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo; 1770#ifdef PROJECTION_GLOBE_VIEW 1771uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix; 1772#endif 1773out vec2 v_tex_a; 1774#ifdef ICON_TRANSITION 1775out vec2 v_tex_b; 1776#endif 1777out float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity; 1778#ifdef RENDER_TEXT_AND_SYMBOL 1779out float is_sdf;out vec2 v_tex_a_icon; 1780#endif 1781#pragma mapbox: define highp vec4 fill_color 1782#pragma mapbox: define highp vec4 halo_color 1783#pragma mapbox: define lowp float opacity 1784#pragma mapbox: define lowp float halo_width 1785#pragma mapbox: define lowp float halo_blur 1786#pragma mapbox: define lowp float emissive_strength 1787#pragma mapbox: define lowp float occlusion_opacity 1788#pragma mapbox: define lowp float z_offset 1789void main() { 1790#pragma mapbox: initialize highp vec4 fill_color 1791#pragma mapbox: initialize highp vec4 halo_color 1792#pragma mapbox: initialize lowp float opacity 1793#pragma mapbox: initialize lowp float halo_width 1794#pragma mapbox: initialize lowp float halo_blur 1795#pragma mapbox: initialize lowp float emissive_strength 1796#pragma mapbox: initialize lowp float occlusion_opacity 1797#pragma mapbox: initialize lowp float z_offset 1798vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=u_elevation_from_sea ? z_offset : z_offset+elevation(tile_anchor); 1799#ifdef Z_OFFSET 1800e+=a_auto_z_offset; 1801#endif 1802vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe; 1803#ifdef PROJECTION_GLOBE_VIEW 1804mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=a_globe_anchor+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0; 1805#else 1806world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0; 1807#endif 1808vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ? 1809camera_to_anchor_distance/u_camera_to_center_distance : 1810u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp( 18110.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;vec2 a; 1812#ifdef PROJECTION_GLOBE_VIEW 1813vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w; 1814#else 1815offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w; 1816#endif 1817vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos; 1818#ifdef PROJECTION_GLOBE_VIEW 1819#ifdef PROJECTED_POS_ON_VIEWPORT 1820projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0); 1821#else 1822vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz,mercator_pos,u_zoom_transition)+h;projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); 1823#endif 1824#else 1825projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0); 1826#endif 1827highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0); 1828#ifdef TERRAIN 1829#ifdef PITCH_WITH_MAP_TERRAIN 1830vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy); 1831#endif 1832#endif 1833#ifdef Z_OFFSET 1834z+=u_pitch_with_map ? a_auto_z_offset+(u_elevation_from_sea ? z_offset : z_offset) : 0.0; 1835#else 1836z+=u_pitch_with_map ? (u_elevation_from_sea ? z_offset : z_offset) : 0.0; 1837#endif 1838float occlusion_fade=globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float out_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change)); 1839#ifdef DEPTH_OCCLUSION 1840float depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier; 1841#endif 1842#ifdef OCCLUSION_QUERIES 1843float occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier; 1844#endif 1845float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0); 1846#ifdef PROJECTION_GLOBE_VIEW 1847vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden); 1848#else 1849gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden); 1850#endif 1851float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_gamma_scale_size_fade_opacity=vec3(gamma_scale,size,out_fade_opacity);v_tex_a=a_tex/u_texsize; 1852#ifdef RENDER_TEXT_AND_SYMBOL 1853is_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon; 1854#endif 1855#ifdef ICON_TRANSITION 1856v_tex_b=a_texb/u_texsize; 1857#endif 1858#ifdef INDICATOR_CUTOUT 1859v_z_offset=e; 1860#endif 1861}`),terrainRaster:li(`#include "_prelude_fog.fragment.glsl" 1862#include "_prelude_shadow.fragment.glsl" 1863#include "_prelude_lighting.glsl" 1864uniform sampler2D u_image0;in vec2 v_pos0; 1865#ifdef FOG 1866in float v_fog_opacity; 1867#endif 1868#ifdef RENDER_SHADOWS 1869in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1; 1870#endif 1871uniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color; 1872#ifdef LIGHTING_3D_MODE 1873const vec3 normal=vec3(0.0,0.0,1.0); 1874#ifdef RENDER_SHADOWS 1875float cutoffOpacity=1.0; 1876#ifdef RENDER_CUTOFF 1877cutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w); 1878#endif 1879#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 1880vec3 unlit_base=image_color.rgb*(1.0-image_color.a);vec3 emissive_base=image_color.rgb*image_color.a;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0; 1881#else 1882float lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity)); 1883#endif 1884#else 1885float lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor); 1886#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 1887color.rgb=mix(color.rgb,image_color.rgb,image_color.a);color.a=1.0; 1888#endif 1889#endif 1890#else 1891color=image_color; 1892#endif 1893#ifdef FOG 1894#ifdef ZERO_EXAGGERATION 1895color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 1896#else 1897color=fog_dither(fog_apply_from_vert(color,v_fog_opacity)); 1898#endif 1899#endif 1900glFragColor=color; 1901#ifdef OVERDRAW_INSPECTOR 1902glFragColor=vec4(1.0); 1903#endif 1904HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1905#include "_prelude_terrain.vertex.glsl" 1906uniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0; 1907#ifdef FOG 1908out float v_fog_opacity; 1909#endif 1910#ifdef RENDER_SHADOWS 1911uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;out float v_depth; 1912#endif 1913void main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0); 1914#ifdef FOG 1915#ifdef ZERO_EXAGGERATION 1916v_fog_pos=fog_position(decodedPos); 1917#else 1918v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation))); 1919#endif 1920#endif 1921#ifdef RENDER_SHADOWS 1922vec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.); 1923#endif 1924}`),terrainDepth:li("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",`#include "_prelude_terrain.vertex.glsl" 1925uniform mat4 u_matrix;in vec2 a_pos;out float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}`),skybox:li(`#include "_prelude_fog.fragment.glsl" 1926in lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep( 1927cos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(e
1927nd-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb; 1928#ifdef FOG 1929sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color); 1930#endif 1931sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity); 1932#ifdef OVERDRAW_INSPECTOR 1933glFragColor=vec4(1.0); 1934#endif 1935}`,ql),skyboxGradient:li(`#include "_prelude_fog.fragment.glsl" 1936in highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture(u_color_ramp,vec2(progress,0.5)); 1937#ifdef FOG 1938color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a; 1939#endif 1940color*=u_opacity;glFragColor=color; 1941#ifdef OVERDRAW_INSPECTOR 1942glFragColor=vec4(1.0); 1943#endif 1944}`,ql),skyboxCapture:li
vendor: 3,792 bytes, lines 1944-1955
1944(` 1945in highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float; 1946#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6) 1947#define BETA_M vec3(21e-6,21e-6,21e-6) 1948#define MIE_G 0.76 1949#define DENSITY_HEIGHT_SCALE_R 8000.0 1950#define DENSITY_HEIGHT_SCALE_M 1200.0 1951#define PLANET_RADIUS 6360e3 1952#define ATMOSPHERE_RADIUS 6420e3 1953#define SAMPLE_STEPS 10 1954#define DENSITY_STEPS 4 1955float ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}`,"in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globe
1955Raster:li(`#include "_prelude_fog.fragment.glsl" 1956#include "_prelude_lighting.glsl" 1957uniform sampler2D u_image0;uniform float u_far_z_cutoff;in vec2 v_pos0; 1958#ifndef FOG 1959uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport; 1960#endif 1961void main() {vec4 color; 1962#ifdef CUSTOM_ANTIALIASING 1963highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix( 1964mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;highp float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);highp float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0); 1965#ifdef LIGHTING_3D_MODE 1966#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 1967raster=apply_lighting_with_emission_ground(raster,raster.a);color=vec4(clamp(raster.rgb,vec3(0),vec3(1))*antialias,antialias); 1968#else 1969raster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias); 1970#endif 1971#else 1972color=vec4(raster.rgb*antialias,raster.a*antialias); 1973#endif 1974#else 1975color=texture(u_image0,v_pos0); 1976#ifdef LIGHTING_3D_MODE 1977#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 1978color=apply_lighting_with_emission_ground(color,color.a);color.a=1.0; 1979#else 1980color=apply_lighting_ground(color); 1981#endif 1982#endif 1983#endif 1984#ifdef FOG 1985color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 1986#endif 1987color*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color; 1988#ifdef OVERDRAW_INSPECTOR 1989glFragColor=vec4(1.0); 1990#endif 1991HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1992#include "_prelude_terrain.vertex.glsl" 1993uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height; 1994#ifdef GLOBE_POLES 1995in vec3 a_globe_pos;in vec2 a_uv; 1996#else 1997in vec2 a_pos; 1998#endif 1999out vec2 v_pos0;void main() { 2000#ifdef GLOBE_POLES 2001vec3 globe_pos=a_globe_pos;vec2 uv=a_uv; 2002#else 2003float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY); 2004#endif 2005v_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale; 2006#ifdef GLOBE_POLES 2007vec3 up_vector=globe_derived_up_vector; 2008#else 2009vec3 up_vector=elevationVector(tile_pos); 2010#endif 2011float height=elevation(tile_pos);globe_pos+=up_vector*height; 2012#ifndef GLOBE_POLES 2013globe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z; 2014#endif 2015#ifdef GLOBE_POLES 2016vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0); 2017#else 2018vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0); 2019#endif 2020gl_Position=u_proj_matrix*interpolated_pos; 2021#ifdef FOG 2022v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); 2023#endif 2024}`),globeAtmosphere:li(`#include "_prelude_fog.fragment.glsl" 2025uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir; 2026#ifdef PROJECTION_GLOBE_VIEW 2027globe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) { 2028#ifdef ALPHA_PASS 2029glFragColor=vec4(0,0,0,0);return; 2030#else 2031#ifdef NATIVE 2032glFragColor=vec4(1,1,1,1); 2033#else 2034glFragColor=vec4(0,0,0,1); 2035#endif 2036return; 2037#endif 2038} 2039#endif 2040highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ? 20410.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle; 2042#ifdef PROJECTION_GLOBE_VIEW 2043highp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ? 2044PI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t); 2045#else 2046horizon_angle=horizon_angle_mercator; 2047#endif 2048horizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;
2048vec3 color_stop_2=u_space_color.rgb; 2049#ifdef ALPHA_PASS 2050float a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a); 2051#else 2052vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;glFragColor=vec4(c*t,t); 2053#endif 2054}`,`in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix( 2055mix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix( 2056mix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}`),model:li(`#include "_prelude_fog.fragment.glsl" 2057#include "_prelude_shadow.fragment.glsl" 2058#include "_prelude_lighting.glsl" 2059uniform float u_opacity;uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix; 2060#ifdef RENDER_SHADOWS 2061in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows; 2062#endif 2063#ifdef OCCLUSION_TEXTURE_TRANSFORM 2064uniform vec4 u_occlusionTextureTransform; 2065#endif 2066#pragma mapbox: define-attribute highp vec3 normal_3f 2067#pragma mapbox: define-attribute highp vec3 color_3f 2068#pragma mapbox: define-attribute highp vec4 color_4f 2069#pragma mapbox: define-attribute highp vec2 uv_2f 2070#pragma mapbox: initialize-attribute highp vec3 normal_3f 2071#pragma mapbox: initialize-attribute highp vec3 color_3f 2072#pragma mapbox: initialize-attribute highp vec4 color_4f 2073#pragma mapbox: initialize-attribute highp vec2 uv_2f 2074#ifdef HAS_ATTRIBUTE_a_pbr 2075in lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params; 2076#endif 2077#ifdef HAS_TEXTURE_u_baseColorTexture 2078uniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff; 2079#endif 2080#ifdef HAS_TEXTURE_u_metallicRoughnessTexture 2081uniform sampler2D u_metallicRoughnessTexture; 2082#endif 2083#ifdef HAS_TEXTURE_u_occlusionTexture 2084uniform sampler2D u_occlusionTexture;uniform float u_aoIntensity; 2085#endif 2086#ifdef HAS_TEXTURE_u_normalTexture 2087uniform sampler2D u_normalTexture; 2088#endif 2089#ifdef HAS_TEXTURE_u_emissionTexture 2090uniform sampler2D u_emissionTexture; 2091#endif 2092#ifdef APPLY_LUT_ON_GPU 2093uniform highp sampler3D u_lutTexture; 2094#endif 2095#ifdef TERRAIN_FRAGMENT_OCCLUSION 2096in highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack; 2097#ifdef DEPTH_D24 2098highp float unpack_depth(highp float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;} 2099#else 2100highp float unpack_depth_rgba(highp vec4 rgba_depth) 2101{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;} 2102#endif 2103bool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size; 2104#ifdef DEPTH_D24 2105highp float depth=unpack_depth(texture(u_depthTexture,coord).r); 2106#else 2107highp float depth=unpack_depth_rgba(texture(u_depthTexture,coord)); 2108#endif 2109return v_depth > depth+0.0005;} 2110#endif 2111#define saturate(_x) clamp(_x,0.,1.) 2112vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor) 2113{ 2114#ifdef LIGHTING_3D_MODE 2115vec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor; 2116#ifdef RENDER_SHADOWS 2117lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); 2118#else 2119lighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir)); 2120#endif 2121return apply_lighting(albedo,transformed_normal,lighting_factor); 2122#else 2123vec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-light
2123Color),vec3(1.0));return c3; 2124#endif 2125}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor; 2126#ifdef HAS_ATTRIBUTE_a_color_3f 2127albedo*=vec4(color_3f,1.0); 2128#endif 2129#ifdef HAS_ATTRIBUTE_a_pbr 2130#else 2131#ifdef HAS_ATTRIBUTE_a_color_4f 2132albedo*=color_4f; 2133#endif 2134#endif 2135#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f) 2136vec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}} 2137#ifdef UNPREMULT_TEXTURE_IN_SHADER 2138if(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0; 2139#endif 2140if(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;} 2141#endif 2142vec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a); 2143#ifdef APPLY_LUT_ON_GPU 2144color=applyLUT(u_lutTexture,color); 2145#endif 2146return color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) { 2147#ifdef HAS_TEXTURE_u_normalTexture 2148highp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y;highp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res; 2149#else 2150return mat3(1.0); 2151#endif 2152}highp vec3 getNormal(){highp vec3 n; 2153#ifdef HAS_ATTRIBUTE_a_normal_3f 2154n=normalize(normal_3f); 2155#else 2156highp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z));n=normalize(cross(fdx,fdy))*-1.0; 2157#endif 2158#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 2159vec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap); 2160#endif 2161return n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor; 2162#ifdef HAS_ATTRIBUTE_a_pbr 2163mat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w; 2164#endif 2165#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 2166vec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b; 2167#endif 2168const float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness) 2169{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH) 2170{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH) 2171{float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness) 2172{highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV) 2173{float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat) 2174{ 2175#ifdef LIGHTING_3D_MODE 2176return mat.diffuseColor; 2177#else 2178return mat.diffuseColor/PI; 2179#endif 2180}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV) 2181{vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal) 2182{vec3 env_light=vec3(0.65,0.65,0.65); 2183#ifdef LIGHTING_3D_MODE 2184float ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor; 2185#endif 2186vec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor) 2187{highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor; 2188#ifdef RENDER_SHADOWS 2189lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); 2190#else 2191lighting_factor=NdotL; 2192#endif 2193vec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*light
2193Color;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0; 2194#if !defined(LIGHTING_3D_MODE) 2195const vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL); 2196#endif 2197color*=intensityFactor;return color;}void main() { 2198#ifdef TERRAIN_FRAGMENT_OCCLUSION 2199if (isOccluded()) {discard;} 2200#endif 2201vec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor; 2202#ifdef LIGHTING_3D_MODE 2203lightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color; 2204#endif 2205vec4 finalColor; 2206#ifdef DIFFUSE_SHADED 2207vec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor); 2208#ifdef HAS_TEXTURE_u_occlusionTexture 2209float ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao; 2210#endif 2211finalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity; 2212#else 2213Material mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0; 2214#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 2215#ifdef OCCLUSION_TEXTURE_TRANSFORM 2216vec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy; 2217#else 2218vec2 uv=uv_2f; 2219#endif 2220ao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao; 2221#endif 2222vec4 emissive=u_emissiveFactor; 2223#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 2224emissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb); 2225#endif 2226#ifdef APPLY_LUT_ON_GPU 2227float emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength; 2228#endif 2229color+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity; 2230#ifdef HAS_ATTRIBUTE_a_pbr 2231float resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);vec3 color_mix=v_color_mix.rgb; 2232#ifdef APPLY_LUT_ON_GPU 2233color_mix=applyLUT(u_lutTexture,color_mix); 2234#endif 2235color=mix(color,color_mix,min(1.0,resEmission)); 2236#ifdef HAS_ATTRIBUTE_a_color_4f 2237float distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.
2237y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance); 2238#endif 2239#endif 2240vec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity); 2241#endif 2242#ifdef FOG 2243finalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w)); 2244#endif 2245#ifdef RENDER_CUTOFF 2246finalColor*=v_cutoff_opacity; 2247#endif 2248#ifdef INDICATOR_CUTOUT 2249finalColor=applyCutout(finalColor,v_position_height.w); 2250#endif 2251glFragColor=finalColor; 2252#ifdef OVERDRAW_INSPECTOR 2253glFragColor=vec4(1.0); 2254#endif 2255HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2256#include "_prelude_shadow.vertex.glsl" 2257in vec3 a_pos_3f; 2258#pragma mapbox: define-attribute highp vec3 normal_3f 2259#pragma mapbox: define-attribute highp vec2 uv_2f 2260#pragma mapbox: define-attribute highp vec3 color_3f 2261#pragma mapbox: define-attribute highp vec4 color_4f 2262#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr 2263#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength 2264uniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix; 2265#ifdef INSTANCED_ARRAYS 2266in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3; 2267#else 2268uniform highp mat4 u_normal_matrix; 2269#endif 2270#ifdef RENDER_SHADOWS 2271uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows; 2272#endif 2273out vec4 v_position_height;out lowp vec4 v_color_mix; 2274#ifdef TERRAIN_FRAGMENT_OCCLUSION 2275out highp float v_depth; 2276#endif 2277#ifdef HAS_ATTRIBUTE_a_pbr 2278out lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params; 2279#endif 2280vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() { 2281#pragma mapbox: initialize-attribute highp vec3 normal_3f 2282#pragma mapbox: initialize-attribute highp vec2 uv_2f 2283#pragma mapbox: initialize-attribute highp vec3 color_3f 2284#pragma mapbox: initialize-attribute highp vec4 color_4f 2285#pragma mapbox: initialize-attribute-custom highp vec4 pbr 2286#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength 2287highp mat4 normal_matrix; 2288#ifdef INSTANCED_ARRAYS 2289normal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3); 2290#else 2291normal_matrix=u_normal_matrix; 2292#endif 2293vec3 local_pos;mat3 rs; 2294#ifdef MODEL_POSITION_ON_GPU 2295vec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float hidden=float(pos_a.x > EXTENT);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=mix(u_matrix*pos,AWAY,hidden);pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos; 2296#else 2297local_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a); 2298#endif 2299v_position_height.w=a_pos_3f.z; 2300#ifdef HAS_ATTRIBUTE_a_pbr 2301vec4 albedo_c=decode_color(pbr.xy);vec2 e_r_m=unpack_float(pbr.z);vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(pbr.w)/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x; 2302#endif 2303#ifdef FOG 2304v_fog_pos=fog_position(local_pos); 2305#endif 2306#ifdef RENDER_CUTOFF 2307v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); 2308#endif 2309#ifdef TERRAIN_FRAGMENT_OCCLUSION 2310v_depth=gl_Position.z/gl_Position.w; 2311#endif 2312#ifdef HAS_ATTRIBUTE_a_normal_3f 2313#ifdef MODEL_POSITION_ON_GPU 2314float x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f); 2315#else
2316normal_3f=vec3(normal_matrix*vec4(normal_3f,0)); 2317#endif 2318#endif 2319#ifdef HAS_ATTRIBUTE_a_pbr 2320#ifdef HAS_ATTRIBUTE_a_color_4f 2321v_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0); 2322#endif 2323#endif 2324#ifdef RENDER_SHADOWS 2325vec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0); 2326#ifdef NORMAL_OFFSET 2327#ifdef HAS_ATTRIBUTE_a_normal_3f 2328#ifdef MODEL_POSITION_ON_GPU 2329vec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0(); 2330#else 2331vec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0(); 2332#endif 2333#endif 2334#endif 2335v_pos_light_view_0=u_light_matrix_0*shadow_pos;v_pos_light_view_1=u_light_matrix_1*shadow_pos;v_depth_shadows=gl_Position.w; 2336#endif 2337}`),modelDepth:li(`in highp float v_depth;void main() { 2338#ifndef DEPTH_TEXTURE 2339glFragColor=pack_depth(v_depth); 2340#endif 2341}`,`in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth; 2342#ifdef MODEL_POSITION_ON_GPU 2343#ifdef INSTANCED_ARRAYS 2344in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3; 2345#else 2346uniform highp mat4 u_instance; 2347#endif 2348uniform highp mat4 u_node_matrix; 2349#endif 2350void main() { 2351#ifdef MODEL_POSITION_ON_GPU 2352highp mat4 instance; 2353#ifdef INSTANCED_ARRAYS 2354instance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3); 2355#else 2356instance=u_instance; 2357#endif 2358vec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float hidden=float(pos_a.x > EXTENT);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;
2358rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=mix(u_matrix*pos,AWAY,hidden); 2359#else 2360gl_Position=u_matrix*vec4(a_pos_3f,1); 2361#endif 2362v_depth=gl_Position.z/gl_Position.w;}`),stars:li(`in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv) 2363{float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}`,` 2364in vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_fade_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_fade_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}`),snowParticle:li("in highp vec2 uv;in highp float alphaMultiplier;uniform vec4 u_particleColor;uniform vec2 u_simpleShapeParameters;void main() {float t=clamp((length(uv)-u_simpleShapeParameters.x)/(1.0-u_simpleShapeParameters.x),0.0,1.0);float alpha=1.0-pow(t,pow(10.0,u_simpleShapeParameters.y));alpha*=alphaMultiplier;alpha*=u_particleColor.a;vec3 color=u_particleColor.rgb*alpha;glFragColor=vec4(color,alpha) ;HANDLE_WIREFRAME_DEBUG;}",` 2365in highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_snowParticleData;in highp vec4 a_snowParticleDataHorizontalOscillation;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform vec2 u_screenSize;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; 2366uniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; 2367uniform float u_horizontalOscillationRate; 2368uniform float u_billboardSize;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;out highp vec2 uv;out highp float alphaMultiplier;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos.xyz*=halfBoxSize;pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_snowParticleData.z;float coneAngleHeadingRad=a_snowParticleData.w*radians(360.0);vec3 localZ=normalize(u_direction);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 direction;direction.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.z=cos(coneAnglePichRad);direction=normalize(direction);vec3 simPosLocal=vec3(0,0,0);float velocityScale=(1.0+3.0*a_snowParticleData.y)*u_velocity;simPosLocal+=direction*velocityScale*u_time;float horizontalOscillationRadius=u_horizontalOscillationRadius*a_snowParticleDataHorizontalOscillation.x;float horizontalOscillationAngle=u_horizontalOscillationRate*u_time*(-1.0+2.0*a_snowParticleDataHorizontalOscillation.y);simPosLocal.xy+=horizontalOscillationRadius*vec2(cos(horizontalOscillationAngle),sin(horizontalOscillationAngle));vec3 simPos=localX*simPosLocal.x+ 2369localY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);float clipZ=-u_cam_pos.z+pos.z;vec4 posView=u_modelview*vec4(pos,1.0);float size=u_billboardSize;alphaMultiplier=1.0;vec4 posScreen=u_projection*posView;posScreen/=posScreen.w;posScreen.xy=vec2(0.5)+posScreen.xy*0.5;posScreen.xy*=u_screenSize;vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=u_screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-posScreen.xy)/(0.5*u_screenSize));screenDist+=a_snowParticleData.x*u_thinningParticleOffset;float scaleFactorMode=0.0;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);if (a_snowParticleData.x < u_thinningAffectedRatio) {scaleFactorMode=1.0-thinningFadeRatio;alphaMultiplier=thinningFadeRatio;}}vec4 posScreen1=u_projection*vec4(posView.x-size,posView.yzw);posScreen1/=posScreen1.w;vec4 posScreen2=u_projection*vec4(posView.x+size,posView.yzw);posScreen2/=posScreen2.w;posScreen1.xy=vec2(0.5)+posScreen1.xy*0.5;posScreen1.xy*=u_screenSize;posScreen2.xy=vec2(0.5)+posScreen2.xy*0.5;posScreen2.xy*=u_screenSize;float screenLength=length(posScreen1.xy-posScreen2.xy);float screenEpsilon=3.0;float scaleFactor=1.0;if (screenLength < screenEpsilon) {scaleFactor=screenEpsilon/max(screenLength,0.01);scaleFactor=mix(scaleFactor,1.0,scaleFactorMode);}float screenEpsilon2=15.0;if (screenLength > screenEpsilon2) {scaleFactor=screenEpsilon2/max(screenLength,0.01);}size*=scaleFactor;vec2 right=size*vec2(1,0);vec2 up=size*vec2(0,1);posView.xy+=right*a_uv.x;posView.xy+=up*a_uv.y;uv=a_uv;gl_Position=u_projection*posView;}`),rainParticle:li("in highp vec2 uv;in highp float particleRandomValue;uniform sampler2D u_texScreen;uniform float u_distortionStrength;uniform vec4 u_color;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;uniform float u_shapeDirectionalPower;uniform float u_mode;void main() {vec2 st=uv*0.5+vec2(0.5);vec2 uvm=uv;uvm.y=-1.0+2.0*pow(st.y,u_shapeDirectionalPower);float shape=clamp(1.0-length(uvm),0.0,1.0);float alpha=abs(shape)*u_color.a;vec2 screenSize=vec2(textureSize(u_texScreen,0));vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-gl_FragCoord.xy)/(0.5*screenSize));screenDist+=(0.5+0.5*particleRandomValue)*u_thinningParticleOffset;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;float thinningAlpha=1.0;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);thinningAlpha*=thinningFadeRatio;}vec2 offsetXY=normalize(uvm)*abs(shape);vec2 stScreen=(gl_FragCoord.xy+offsetXY*u_distortionStrength*thinningAlpha)/screenSize;vec3 colorScreen=texture(u_texScreen,stScreen).rgb;alpha*=thinningAlpha;glFragColor=mix(vec4(colorScreen,1.0),vec4(u_color.rgb*alpha,alpha),u_mode);HANDLE_WIREFRAME_DEBUG;}",` 2370in highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_rainParticleData;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; 2371uniform float u_velocity; 2372uniform vec2 u_rainDropletSize;uniform vec3 u_rainDirection;out highp vec2 uv;out highp float particleRandomValue;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;
2372pos*=halfBoxSize; 2373pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_rainParticleData.z;float coneAngleHeadingRad=a_rainParticleData.w*radians(360.0);vec3 localZ=normalize(u_rainDirection);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 directionLocal;directionLocal.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.z=cos(coneAnglePichRad);directionLocal=normalize(directionLocal);vec3 directionWorld=localX*directionLocal.x+localY*directionLocal.y+localZ*directionLocal.z;float velocityScale=(1.0+3.0*a_rainParticleData.y)*u_velocity;vec3 simPosLocal=vec3(0,0,0);simPosLocal+=directionLocal*velocityScale*u_time;vec3 simPos=localX*simPosLocal.x+ 2374localY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);vec4 posView=u_modelview*vec4(pos,1.0);vec3 directionView=normalize((u_modelview*vec4(directionWorld,0.0)).xyz);vec3 side=cross(directionView,normalize(posView.xyz));posView.xyz+=side*a_uv.x*u_rainDropletSize.x;posView.xyz+=directionView*a_uv.y*u_rainDropletSize.y;uv=a_uv;particleRandomValue=a_rainParticleData.x;gl_Position=u_projection*posView;}`),vignette:li("uniform vec3 u_vignetteShape;uniform vec4 u_vignetteColor;in vec2 st;void main() {float screenDist=length(st);float alpha=clamp((screenDist-u_vignetteShape.x)/u_vignetteShape.y,0.0,1.0);alpha=pow(alpha,u_vignetteShape.z)*u_vignetteColor.a;vec3 color=u_vignetteColor.rgb;glFragColor=vec4(color*alpha,alpha) ;}","in vec2 a_pos_2f;out vec2 st;void main() {st=a_pos_2f;gl_Position=vec4(a_pos_2f,0,1);}"),occlusion:li("uniform vec4 u_color;void main() {glFragColor=u_color;}",`#include "_prelude_terrain.vertex.glsl" 2375in highp vec2 a_offset_xy;uniform highp vec3 u_anchorPos;uniform mat4 u_matrix;uniform vec2 u_screenSizePx;uniform vec2 u_occluderSizePx;void main() {vec3 world_pos=u_anchorPos; 2376#ifdef TERRAIN 2377float e=elevation(world_pos.xy);world_pos.z+=e; 2378#endif 2379vec4 projected_point=u_matrix*vec4(world_pos,1.0);projected_point.xy+=projected_point.w*a_offset_xy*0.5*u_occluderSizePx/u_screenSizePx;gl_Position=projected_point;}`)};function Kn(u,t){const r=u.replace(/\s*\/\/[^\n]*\n/g,` 2380`).split(` 2381`);for(let c of r)if(c=c.trim(),c[0]==="#"&&c.includes("if")&&!c.includes("endif")){c=c.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim();const d=c.split(" ");for(const f of d)t.includes(f)||t.push(f)}}function li(u,t){const r=/#include\s+"([^"]+)"/g,c=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g;let d=t.match(/(attribute(\S*)|(^\s*|;)in) (highp |mediump |lowp )?([\w]+) ([\w]+)/gm);d&&(d=d.map(M=>{const I=M.split(" ");return I[I.length-1]}),d=[...new Set(d)]);const f={},_=[],T=[];if(u=u.replace(r,(M,I)=>(T.push(I),"")),(t=t.replace(r,(M,I)=>(_.push(I),""))).includes("flat out"))return void console.error('The usage of "flat" qualifier is disallowed, see: https://bugs.webkit.org/show_bug.cgi?id=268071');let E=[..._s];Kn(u,E),Kn(t,E);for(const M of[..._,...T])_o[M]||console.error(`Undefined include: ${M}`),Zo[M]||(Zo[M]=[],Kn(_o[M],Zo[M])),E=[...E,...Zo[M]];return{fragmentSource:u=u.replace(c,(M,I,P,R,O)=>(f[O]=!0,I==="define"?` 2382#ifndef HAS_UNIFORM_u_${O} 2383in ${P} ${R} ${O}; 2384#else 2385uniform ${P} ${R} u_${O}; 2386#endif 2387`:I==="initialize"?` 2388#ifdef HAS_UNIFORM_u_${O} 2389 ${P} ${R} ${O} = u_${O}; 2390#endif 2391`:I==="define-attribute"?` 2392#ifdef HAS_ATTRIBUTE_a_${O} 2393 in ${P} ${R} ${O}; 2394#endif 2395`:I==="initialize-attribute"?"":void 0)),vertexSource:t=t.replace(c,(M,I,P,R,O)=>{const N=R==="float"?"vec2":R,F=O.match(/color/)?"color":N;return I==="define-attribute-vertex-shader-only"?` 2396#ifdef HAS_ATTRIBUTE_a_${O} 2397in ${P} ${R} a_${O}; 2398#endif 2399`:f[O]?I==="define"?` 2400#ifndef HAS_UNIFORM_u_${O} 2401uniform lowp float u_${O}_t; 2402in ${P} ${N} a_${O}; 2403out ${P} ${R} ${O}; 2404#else 2405uniform ${P} ${R} u_${O}; 2406#endif 2407`:I==="initialize"?F==="vec4"?` 2408#ifndef HAS_UNIFORM_u_${O} 2409 ${O} = a_${O}; 2410#else 2411 ${P} ${R} ${O} = u_${O}; 2412#endif 2413`:` 2414#ifndef HAS_UNIFORM_u_${O} 2415 ${O} = unpack_mix_${F}(a_${O}, u_${O}_t); 2416#else 2417 ${P} ${R} ${O} = u_${O}; 2418#endif 2419`:I==="define-attribute"?` 2420#ifdef HAS_ATTRIBUTE_a_${O} 2421 in ${P} ${R} a_${O}; 2422 out ${P} ${R} ${O}; 2423#endif 2424`:I==="initialize-attribute"?` 2425#ifdef HAS_ATTRIBUTE_a_${O} 2426 ${O} = a_${O}; 2427#endif 2428`:void 0:I==="define"?` 2429#ifndef HAS_UNIFORM_u_${O} 2430uniform lowp float u_${O}_t; 2431in ${P} ${N} a_${O}; 2432#else 2433uniform ${P} ${R} u_${O}; 2434#endif 2435`:I==="define-instanced"?F==="mat4"?` 2436#ifdef INSTANCED_ARRAYS 2437in vec4 a_${O}0; 2438in vec4 a_${O}1; 2439in vec4 a_${O}2; 2440in vec4 a_${O}3; 2441#else 2442uniform ${P} ${R} u_${O}; 2443#endif 2444`:` 2445#ifdef INSTANCED_ARRAYS 2446in ${P} ${N} a_${O}; 2447#else 2448uniform ${P} ${R} u_${O}; 2449#endif 2450`:I==="initialize-attribute-custom"?` 2451#ifdef HAS_ATTRIBUTE_a_${O} 2452 ${P} ${R} ${O} = a_${O}; 2453#endif 2454`:F==="vec4"?` 2455#ifndef HAS_UNIFORM_u_${O} 2456 ${P} ${R} ${O} = a_${O}; 2457#else 2458 ${P} ${R} ${O} = u_${O}; 2459#endif 2460`:` 2461#ifndef HAS_UNIFORM_u_${O} 2462 ${P} ${R} ${O} = unpack_mix_${F}(a_${O}, u_${O}_t); 2463#else 2464 ${P} ${R} ${O} = u_${O}; 2465#endif 2466`}),staticAttributes:d,usedDefines:E,vertexIncludes:_,fragmentIncludes:T}}class rd{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(t,r,c,d,f,_,T,E){this.context=t;let M=this.boundPaintVertexBuffers.length!==d.length;for(let P=0;!M&&P<d.length;P++)this.boundPaintVertexBuffers[P]!==d[P]&&(M=!0);let I=this.boundDynamicVertexBuffers.length!==T.length;for(let P=0;!I&&P<T.length;P++)this.boundDynamicVertexBuffers[P]!==T[P]&&(I=!0);if(!this.vao||this.boundProgram!==r||this.boundLayoutVertexBuffer!==c||M||I||this.boundIndexBuffer!==f||this.boundVertexOffset!==_)this.freshBind(r,c,d,f,_,T,E);else{t.bindVertexArrayOES.set(this.vao);for(const P of T)P&&(P.bind(),E&&P.instanceCount&&P.setVertexAttribDivisor(t.gl,r,E));f&&f.dynamicDraw&&f.bind()}}freshBind(t,r,c,d,f,_,T){const E=t.numAttributes,M=this.context,I=M.gl;this.vao&&this.destroy(),this.vao=M.gl.createVertexArray(),M.bindVertexArrayOES.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=r,this.boundPaintVertexBuffers=c,this.boundIndexBuffer=d,this.boundVertexOffset=f,this.boundDynamicVertexBuffers=_,r.enableAttributes(I,t),r.bind(),r.setVertexAttribPointers(I,t,f);for(const P of c)P.enableAttributes(I,t),P.bind(),P.setVertexAttribPointers(I,t,f);for(const P of _)P&&(P.enableAttributes(I,t),P.bind(),P.setVertexAttribPointers(I,t,f),T&&P.instanceCount&&P.setVertexAttribDivisor(I,t,T));d&&d.bind(),M.currentNumAttributes=E}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}
vendor: 10,919 bytes, line 2466
2466function nd(u,t){const r=Math.pow(2,t.canonical.z),c=t.canonical.y;return[new o.ac(0,c/r).toLngLat().lat,new o.ac(0,(c+1)/r).toLngLat().lat]}function Wo(u,t,r,c,d,f,_){const T=u.context,E=T.gl,M=r.hillshadeFBO;if(!M)return;u.prepareDrawTile();const I=u.isTileAffectedByFog(t),P=u.getOrCreateProgram("hillshade",{overrideFog:I});T.activeTexture.set(E.TEXTURE0),E.bindTexture(E.TEXTURE_2D,M.colorAttachment.get());const R=((U,q,Z,J)=>{const K=Z.paint.get("hillshade-shadow-color"),oe=Z.paint.get("hillshade-shadow-color-use-theme").constantOr("default")==="none",te=Z.paint.get("hillshade-highlight-color"),ie=Z.paint.get("hillshade-highlight-color-use-theme").constantOr("default")==="none",re=Z.paint.get("hillshade-accent-color"),ue=Z.paint.get("hillshade-accent-color-use-theme").constantOr("default")==="none",me=Z.paint.get("hillshade-emissive-strength");let Le=o.ak(Z.paint.get("hillshade-illumination-direction"));if(Z.paint.get("hillshade-illumination-anchor")==="viewport")Le-=U.transform.angle;else if(U.style&&U.style.enable3dLights()&&U.style.directionalLight){const Ze=U.style.directionalLight.properties.get("direction"),We=o.cc(Ze.x,Ze.y,Ze.z);Le=o.ak(We[1])}const Ee=!U.options.moving;return{u_matrix:J||U.transform.calculateProjMatrix(q.tileID.toUnwrapped(),Ee),u_image:0,u_latrange:nd(0,q.tileID),u_light:[Z.paint.get("hillshade-exaggeration"),Le],u_shadow:K.toRenderColor(oe?null:Z.lut),u_highlight:te.toRenderColor(ie?null:Z.lut),u_emissive_strength:me,u_accent:re.toRenderColor(ue?null:Z.lut)}})(u,r,c,u.terrain?t.projMatrix:null);u.uploadCommonUniforms(T,P,t.toUnwrapped());const{tileBoundsBuffer:O,tileBoundsIndexBuffer:N,tileBoundsSegments:F}=u.getTileBoundsBuffers(r);P.draw(u,E.TRIANGLES,d,f,_,jt.disabled,R,c.id,O,N,F)}function au(u,t,r){if(!t.needsDEMTextureUpload)return;const c=u.context,d=c.gl;c.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||u.getTileTexture(r.stride);const f=r.getPixels();t.demTexture?t.demTexture.update(f,{premultiply:!1}):t.demTexture=new o.T(c,f,d.R32F,{premultiply:!1}),t.needsDEMTextureUpload=!1}function sf(u,t,r){const c=u.context,d=c.gl;if(!t.dem)return;const f=t.dem;if(c.activeTexture.set(d.TEXTURE1),au(u,t,f),!t.demTexture)return;t.demTexture.bind(d.NEAREST,d.CLAMP_TO_EDGE);const _=f.dim;c.activeTexture.set(d.TEXTURE0);let T=t.hillshadeFBO;if(!T){const R=new o.T(c,{width:_,height:_,data:null},d.RGBA8);R.bind(d.LINEAR,d.CLAMP_TO_EDGE),T=t.hillshadeFBO=c.createFramebuffer(_,_,!0,"renderbuffer"),T.colorAttachment.set(R.texture)}c.bindFramebuffer.set(T.framebuffer),c.viewport.set([0,0,_,_]);const{tileBoundsBuffer:E,tileBoundsIndexBuffer:M,tileBoundsSegments:I}=u.getMercatorTileBoundsBuffers(),P=[];u.linearFloatFilteringSupported()&&P.push("TERRAIN_DEM_FLOAT_FORMAT"),u.getOrCreateProgram("hillshadePrepare",{defines:P}).draw(u,d.TRIANGLES,Pt.disabled,$t.disabled,ii.unblended,jt.disabled,((R,O)=>{const N=O.stride,F=o.ad.mat4.create();return o.ad.mat4.ortho(F,0,o.ai,-o.ai,0,0,1),o.ad.mat4.translate(F,F,[0,-o.ai,0]),{u_matrix:F,u_image:1,u_dimension:[N,N],u_zoom:R.overscaledZ}})(t.tileID,f),r.id,E,M,I),t.needsHillshadePrepare=!1}class Vi{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class of extends Vi{getDefault(){return o.al.transparent}set(t){const r=this.current;(t.r!==r.r||t.g!==r.g||t.b!==r.b||t.a!==r.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class lu extends Vi{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class cu extends Vi{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class uu extends Vi{getDefault(){return[!0,!0,!0,!0]}set(t){const r=this.current;(t[0]!==r[0]||t[1]!==r[1]||t[2]!==r[2]||t[3]!==r[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class hu extends Vi{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class sd extends Vi{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class od extends Vi{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const r=this.current;(t.func!==r.func||t.ref!==r.ref||t.mask!==r.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class af extends Vi{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const r=this.current;(t[0]!==r[0]||t[1]!==r[1]||t[2]!==r[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class Za extends Vi{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const r=this.gl;t?r.enable(r.STENCIL_TEST):r.disable(r.STENCIL_TEST),this.current=t,this.dirty=!1}}class Wa extends Vi{getDefault(){return[0,1]}set(t){const r=this.current;(t[0]!==r[0]||t[1]!==r[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class ad extends Vi{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const r=this.gl;t?r.enable(r.DEPTH_TEST):r.disable(r.DEPTH_TEST),this.current=t,this.dirty=!1}}class fn extends Vi{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class du extends Vi{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const r=this.gl;t?r.enable(r.BLEND):r.disable(r.BLEND),this.current=t,this.dirty=!1}}class Hl extends Vi{getDefault(){const t=this.gl;return[t.ONE,t.ZERO,t.ONE,t.ZERO]}set(t){const r=this.current;(t[0]!==r[0]||t[1]!==r[1]||t[2]!==r[2]||t[3]!==r[3]||this.dirty)&&(this.gl.blendFuncSeparate(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Zl extends Vi{getDefault(){return o.al.transparent}set(t){const r=this.current;(t.r!==r.r||t.g!==r.g||t.b!==r.b||t.a!==r.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class pu extends Vi{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(t,t),this.current=t,this.dirty=!1)}}class fu extends Vi{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const r=this.gl;t?r.enable(r.CULL_FACE):r.disable(r.CULL_FACE),this.current=t,this.dirty=!1}}class mu extends Vi{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Wl extends Vi{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}let _u=class extends Vi{getDefault(){return null}set(u){(u!==this.current||this.dirty)&&(this.gl.useProgram(u),this.current=u,this.dirty=!1)}};class gu extends Vi{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class Xl extends Vi{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const r=this.current;(t[0]!==r[0]||t[1]!==r[1]||t[2]!==r[2]||t[3]!==r[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class ld extends Vi{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const r=this.gl;r.bindFramebuffer(r.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class cd extends Vi{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const r=this.gl;r.bindRenderbuffer(r.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Xo extends Vi{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const r=this.gl;r.bindTexture(r.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class lf extends Vi{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const r=this.gl;r.bindBuffer(r.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class cf extends Vi{getDefault(){return null}set(t){const r=this.gl;r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class uf extends Vi{getDefault(){return null}set(t){this.gl&&(t!==this.current||this.dirty)&&(this.gl.bindVertexArray(t),this.current=t,this.dirty=!1)}}class hf extends Vi{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const r=this.gl;r.pixelStorei(r.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class df extends Vi{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const r=this.gl;r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class pf extends Vi{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const r=this.gl;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class Xa extends Vi{constructor(t,r){super(t),this.context=t,this.parent=r}getDefault(){return null}}class yu extends Xa{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const r=this.gl;r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class vu extends Xa{attachment(){return this.gl.DEPTH_ATTACHMENT}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const r=this.gl;r.framebufferRenderbuffer(r.FRAMEBUFFER,this.attachment(),r.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Yo extends Xa{attachment(){return this.gl.DEPTH_ATTACHMENT}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const r=this.gl;r.framebufferTexture2D(r.FRAMEBUFFER,this.attachment(),r.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class ud extends vu{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const hd=(u,t,r)=>({u_matrix:u,u_image0:0,u_skirt_height:t,u_ground_shadow_factor:r}),xu=(u,t,r,c,d,f,_,T,E,M,I,P,R,O,N,F)=>({u_proj_matrix:Float32Array.from(u),u_globe_matrix:t,u_normalize_matrix:Float32Array.from(c),u_merc_matrix:r,u_zoom_transition:d,u_merc_center:f,u_image0:0,u_frustum_tl:_,u_frustum_tr:T,u_frustum_br:E,u_frustum_bl:M,u_globe_pos:I,u_globe_radius:P,u_viewport:R,u_grid_matrix:F?Float32Array.from(F):new Float32Array(9),u_skirt_height:O,u_far_z_cutoff:N});function Yl(u,t){return u!=null&&t!=null&&!(!u.hasData()||!t.hasData())&&u.demTexture!=null&&t.demTexture!=null&&u.tileID.key!==t.tileID.key}const Mn=new class{constructor(){this.operations={}}newMorphing(u,t,r,c,d){if(u in this.operations){const f=this.operations[u];f.to.tileID.key!==r.tileID.key&&(f.queued=r)}else this.operations[u]={startTime:c,phase:0,duration:d,from:t,to:r,queued:null}}getMorphValuesForProxy(u){if(!(u in this.operations))return null;const t=this.operations[u];return{from:t.from,to:t.to,phase:t.phase}}update(u){for(const t in this.operations){const r=this.operations[t];for(r.phase=(u-r.startTime)/r.duration;r.phase>
2466=1||!this._validOp(r);)if(!this._nextOp(r,u)){delete this.operations[t];break}}}_nextOp(u,t){return!!u.queued&&(u.from=u.to,u.to=u.queued,u.queued=null,u.phase=0,u.startTime=t,!0)}_validOp(u){return u.from.hasData()&&u.to.hasData()}},bu={0:null,1:"TERRAIN_VERTEX_MORPHING"};function gs(u,t,r){if(t===0)return 0;const c=t<1&&r===514?.25/t:1;return 6*Math.pow(1.5,22-u)*Math.max(t,1)*c}function wu(u,t){const r=1<<u.z;return!t&&(u.x===0||u.x===r-1)||u.y===0||u.y===r-1}const Ko=u=>({u_matrix:u});function Kl(u,t,r,c,d){if(d>0){const f=o.q.now(),_=(f-u.timeAdded)/d,T=t?(f-t.timeAdded)/d:-1,E=r.getSource(),M=c.coveringZoomLevel({tileSize:E.tileSize,roundZoom:E.roundZoom}),I=!t||Math.abs(t.tileID.overscaledZ-M)>Math.abs(u.tileID.overscaledZ-M),P=I&&u.refreshedUponExpiration?1:o.ay(I?_:1-T,0,1);return u.refreshedUponExpiration&&_>=1&&(u.refreshedUponExpiration=!1),t?{opacity:1,mix:1-P}:{opacity:P,mix:0}}return{opacity:1,mix:0}}class dd extends Sn{constructor(t){const r={type:"raster-dem",maxzoom:t.transform.maxZoom},c=new o.D(o.cj(),null),d=Rl("mock-dem",r,c,t.style);super("mock-dem",d,!1),d.setEventedParent(this),this._sourceLoaded=!0}_loadTile(t,r){t.state="loaded",r(null)}}class Tu extends Sn{constructor(t){const r=Rl("proxy",{type:"geojson",maxzoom:t.transform.maxZoom},new o.D(o.cj(),null),t.style);super("proxy",r,!1),r.setEventedParent(this),this.map=this.getSource().map=t,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(t,r,c){if(t.freezeTileCoverage)return;this.transform=t;const d=t.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((f,_)=>{if(f[_.key]="",!this._tiles[_.key]){const T=new kn(_,this._source.tileSize*_.overscaleFactor(),t.tileZoom);T.state="loaded",this._tiles[_.key]=T}return f},{});for(const f in this._tiles)f in d||(this.freeFBO(f),this._tiles[f].unloadVectorData(),delete this._tiles[f])}freeFBO(t){const r=this.proxyCachedFBO[t];if(r!==void 0){const c=Object.values(r);this.renderCachePool.push(...c),delete this.proxyCachedFBO[t]}}deallocRenderCache(){this.renderCache.forEach(t=>t.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class Jl extends o.aH{constructor(t,r,c){super(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y),this.proxyTileKey=r,this.projMatrix=c}}class pd extends o.cK{constructor(t,r){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},t.tp.registerParameter(this._debugParams,["Terrain"],"sortTilesHiZFirst",{},()=>{this._style.map.triggerRepaint()}),t.tp.registerParameter(this._debugParams,["Terrain"],"disableRenderCache",{},()=>{this._style.map.triggerRepaint()}),t.tp.registerButton(["Terrain"],"Invalidate Render Cache",()=>{this.invalidateRenderCache=!0,this._style.map.triggerRepaint()}),this.painter=t,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[c,d,f]=function(E){const M=new o.b5,I=new o.aV,P=131;M.reserve(17161),I.reserve(33800);const R=o.ai/128,O=o.ai+R/2,N=O+R;for(let U=-R;U<N;U+=R)for(let q=-R;q<N;q+=R){const Z=q<0||q>O||U<0||U>O?24575:0,J=o.ay(Math.round(q),0,o.ai),K=o.ay(Math.round(U),0,o.ai);M.emplaceBack(J+Z,K)}const F=(U,q)=>{const Z=q*P+U;I.emplaceBack(Z+1,Z,Z+P),I.emplaceBack(Z+P,Z+P+1,Z+1)};for(let U=1;U<129;U++)for(let q=1;q<129;q++)F(q,U);return[0,129].forEach(U=>{for(let q=0;q<130;q++)F(q,U),F(U,q)}),[M,I,32768]}(),_=t.context;this.gridBuffer=_.createVertexBuffer(c,o.b7.members),this.gridIndexBuffer=_.createIndexBuffer(d),this.gridSegments=o.b8.simpleSegment(0,0,c.length,d.length),this.gridNoSkirtSegments=o.b8.simpleSegment(0,0,c.length,f),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new Tu(r.map),this.orthoMatrix=o.ad.mat4.create(),o.ad.mat4.ortho(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,o.ai,0,o.ai,0,1);const T=_.gl;this._overlapStencilMode=new $t({func:T.GEQUAL,mask:255},0,255,T.KEEP,T.KEEP,T.REPLACE),this._previousZoom=t.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=r,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new dd(r.map),this._pendingGroundEffectLayers=[]}set style(t){t.on("data",this._onStyleDataEvent.bind(this)),this._style=t,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(t,r,c){if(t&&t.terrain){this._style!==t&&(this.style=t,this._evaluationZoom=void 0);const d=t.terrain.properties,f=t.terrain.drapeRenderMode===0,_=t.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=o.q.now();const T=t.terrain&&t.terrain.scope,E=d.get("source"),M=f?this._mockSourceCache:t.getSourceCache(E,T);if(!M)return void o.w(`Couldn't find terrain source "${E}".`);if(this.sourceCache=M,this._attenuationRange=t.terrain.getAttenuationRange(),this._exaggeration=_?this.calculateExaggeration(r):d.get("exaggeration"),!r.projection.requiresDraping&&_&&this._exaggeration===0)return void this._disable();this.enabled=!0;const I=()=>{this.sourceCache.used&&o.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. 2467This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const P=this.getScaledDemTileSize();this.sourceCache.update(r,P,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,I(),this._initializing=!0),I(),r.updateElevation(!0,c),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(r),this._emptyDEMTextureDirty=!0,this._previousZoom=r.zoom}else this._disable()}calculateExaggeration(t){if(this._attenuationRange&&t.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(t.zoom);const r=this._previousCameraAltitude,c=t.getFreeCameraOptions().position.z/t.pixelsPerMeter*t.worldSize;this._previousCameraAltitude=c;const d=r!=null?c-r:Number.MAX_VALUE;if(Math.abs(d)<2)return this._exaggeration;const f=t.zoom,_=this._style.terrain;if(!this._previousUpdateTimestamp)return _.getExaggeration(f);let T=f-this._previousZoom;const E=this._previousUpdateTimestamp;let M=f;this._evaluationZoom!=null&&(M=this._evaluationZoom,Math.abs(f-M)>.5&&(T=.5*(f-M+T)),T*d<0&&(M+=T)),this._evaluationZoom=M;const I=_.getExaggeration(M),P=I===_.getExaggeration(Math.max(0,M-.1));if(P&&Math.abs(I-this._exaggeration)<.01)return I;let R=Math.min(.1,.00375*(this._updateTimestamp-E));return(P||I<.1||Math.abs(T)<1e-4)&&(R=Math.min(.2,4*R)),o.ah(this._exaggeration,I,R)}resetTileLookupCache(t){this._findCoveringTileCache[t]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(t){t.coord&&t.dataType==="source"?this._clearRenderCacheForTile(t.sourceCacheId,t.coord):t.dataType==="style"&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._emptyDEMTextureDirty=!0,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const t in this._style._mergedSourceCaches)this._style._mergedSourceCaches[t].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(t=>t.fb.destroy()),this.pool=[],this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this.enabled?this._exaggeration:0}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const t=2*this.proxySourceCache.getSource().tileSize;return[t,t]}set useVertexMorphing(t){this._useVertexMorphing=t}updateTileBinding(t){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const r=this.proxySourceCache,c=this.painter.transform;this._initializing&&(this._initializing=c._centerAltitude===0&&this.getAtPointOrZero(o.ac.fromLngLat(c.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const d=this.proxyCoords=r.getIds().map(E=>{const M=r.getTileByID(E).tileID;return M.projMatrix=c.calculateProjMatrix(M.toUnwrapped()),M});(function(E,M){const I=M.transform.pointCoordinate(M.transform.getCameraPoint()),P=new o.P(I.x,I.y);E.sort((R,O)=>
vendor: 16,224 bytes, line 2467
2467{if(O.overscaledZ-R.overscaledZ)return O.overscaledZ-R.overscaledZ;const N=new o.P(R.canonical.x+(1<<R.canonical.z)*R.wrap,R.canonical.y),F=new o.P(O.canonical.x+(1<<O.canonical.z)*O.wrap,O.canonical.y),U=P.mult(1<<R.canonical.z);return U.x-=.5,U.y-=.5,U.distSqr(N)-U.distSqr(F)})})(d,this.painter);const f=this.proxyToSource||{};this.proxyToSource={},d.forEach(E=>{this.proxyToSource[E.key]={}}),this.terrainTileForTile={};const _=this._style._mergedSourceCaches;for(const E in _){const M=_[E];if(!M.used||(M!==this.sourceCache&&this.resetTileLookupCache(M.id),this._setupProxiedCoordsForOrtho(M,t[E],f),M.usedForTerrain))continue;const I=t[E];M.getSource().reparseOverscaled&&this._assignTerrainTiles(I)}this.proxiedCoords[r.id]=d.map(E=>new Jl(E,E.key,this.orthoMatrix)),this._assignTerrainTiles(d),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(f),this.renderingToTexture=!1;const T={};this._visibleDemTiles=[];for(const E of this.proxyCoords){const M=this.terrainTileForTile[E.key];if(!M)continue;const I=M.tileID.key;I in T||(this._visibleDemTiles.push(M),T[I]=I)}}_assignTerrainTiles(t){this._initializing||t.forEach(r=>{if(this.terrainTileForTile[r.key])return;const c=this._findTileCoveringTileID(r,this.sourceCache);c&&(this.terrainTileForTile[r.key]=c)})}_prepareDEMTextures(){const t=this.painter.context,r=t.gl;for(const c in this.terrainTileForTile){const d=this.terrainTileForTile[c],f=d.dem;!f||d.demTexture&&!d.needsDEMTextureUpload||(t.activeTexture.set(r.TEXTURE1),au(this.painter,d,f))}}_prepareDemTileUniforms(t,r,c,d){if(!r||r.demTexture==null)return!1;const f=t.tileID.canonical,_=Math.pow(2,r.tileID.canonical.z-f.z),T=d||"";return c[`u_dem_tl${T}`]=[f.x*_%1,f.y*_%1],c[`u_dem_scale${T}`]=_,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let t=0;const r=this._visibleDemTiles.reduce((c,d)=>{if(!d.dem)return c;const f=d.dem.tree.minimums[0];return f>0&&t++,c+f},0);return t?r/t:0}_updateEmptyDEMTexture(){const t=this.painter.context,r=t.gl;t.activeTexture.set(r.TEXTURE2);const c=this._getLoadedAreaMinimum(),d=new o.cL({width:1,height:1},new Float32Array([c]));this._emptyDEMTextureDirty=!1;let f=this._emptyDEMTexture;return f?f.update(d,{premultiply:!1}):f=this._emptyDEMTexture=new o.T(t,d,r.R32F,{premultiply:!1}),f}setupElevationDraw(t,r,c){const d=this.painter.context,f=d.gl,_={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0};_.u_exaggeration=this.exaggeration();let T=null,E=null,M=1;if(c&&c.morphing&&this._useVertexMorphing){const O=c.morphing.srcDemTile,N=c.morphing.dstDemTile;M=c.morphing.phase,O&&N&&(this._prepareDemTileUniforms(t,O,_,"_prev")&&(E=O),this._prepareDemTileUniforms(t,N,_)&&(T=N))}const I=O=>O&&O.demTexture&&this.painter.linearFloatFilteringSupported()?f.LINEAR:f.NEAREST;let P=null;var R;if(this.enabled?E&&T?(P=T.demTexture,d.activeTexture.set(f.TEXTURE4),E.demTexture.bind(I(E),f.CLAMP_TO_EDGE),_.u_dem_lerp=M):(T=this.terrainTileForTile[t.tileID.key],P=this._prepareDemTileUniforms(t,T,_)?T.demTexture:this.emptyDEMTexture):P=this.emptyDEMTexture,d.activeTexture.set(f.TEXTURE2),P&&(_.u_dem_size=(R=P).size[0]===1?1:R.size[0]-2,P.bind(I(T),f.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(c&&c.useDepthForOcclusion,r,_),c&&c.useMeterToDem&&T){const O=(1<<T.tileID.canonical.z)*o.bH(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;_.u_meter_to_dem=O}if(c&&c.labelPlaneMatrixInv&&(_.u_label_plane_matrix_inv=c.labelPlaneMatrixInv),r.setTerrainUniformValues(d,_),this.painter.transform.projection.name==="globe"){const O=this.globeUniformValues(this.painter.transform,t.tileID.canonical,c&&c.useDenormalizedUpVectorScale);r.setGlobeUniformValues(d,O)}}globeUniformValues(t,r,c){const d=t.projection;return{u_tile_tl_up:d.upVector(r,0,0),u_tile_tr_up:d.upVector(r,o.ai,0),u_tile_br_up:d.upVector(r,o.ai,o.ai),u_tile_bl_up:d.upVector(r,0,o.ai),u_tile_up_scale:c?o.cM(1):d.upVectorScale(r,t.center.lat,t.worldSize).metersToTile}}renderToBackBuffer(t){const r=this.painter,c=this.painter.context;t.length!==0&&(c.bindFramebuffer.set(null),c.viewport.set([0,0,r.width,r.height]),r.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(d,f,_,T,E){if(d.transform.projection.name==="globe")(function(M,I,P,R,O){const N=M.context,F=N.gl;let U,q;const Z=M.transform,J=o.cD(M,N,Z),K=(Ze,We)=>{if(q===We)return;const ot=[bu[We],"PROJECTION_GLOBE_VIEW"];J&&ot.push("CUSTOM_ANTIALIASING");const Se=M.isTileAffectedByFog(Ze);U=M.getOrCreateProgram("globeRaster",{defines:ot,overrideFog:Se}),q=We},oe=M.colorModeForRenderPass(),te=new Pt(F.LEQUAL,Pt.ReadWrite,M.depthRangeFor3D);Mn.update(O);const ie=o.cE(Z),re=[o.av(Z.center.lng),o.aC(Z.center.lat)],ue=M.globeSharedBuffers,me=[Z.width*o.q.devicePixelRatio,Z.height*o.q.devicePixelRatio],Le=Float32Array.from(Z.globeMatrix),Ee={useDenormalizedUpVectorScale:!0};{const Ze=M.transform,We=gs(Ze.zoom,I.exaggeration(),I.sourceCache._source.tileSize);q=-1;const ot=F.TRIANGLES;for(const Se of R){const He=P.getTile(Se),we=$t.disabled,$e=I.prevTerrainTileForTile[Se.key],Ve=I.terrainTileForTile[Se.key];Yl($e,Ve)&&Mn.newMorphing(Se.key,$e,Ve,O,250),N.activeTexture.set(F.TEXTURE0),He.texture&&He.texture.bind(F.LINEAR,F.CLAMP_TO_EDGE);const Ke=Mn.getMorphValuesForProxy(Se.key),De=Ke?1:0;Ke&&o.L(Ee,{morphing:{srcDemTile:Ke.from,dstDemTile:Ke.to,phase:o.cC(Ke.phase)}});const Qe=o.cF(Se.canonical),pt=o.cG(Qe.getCenter().lat),ft=o.cH(Se.canonical,Qe,pt,Ze.worldSize/Ze._pixelsPerMercatorPixel),mt=o.bc(o.cI(Se.canonical)),Et=xu(Ze.expandedFarZProjMatrix,Le,ie,mt,o.ag(Ze.zoom),re,Ze.frustumCorners.TL,Ze.frustumCorners.TR,Ze.frustumCorners.BR,Ze.frustumCorners.BL,Ze.globeCenterInViewSpace,Ze.globeRadius,me,We,Ze._farZ,ft);if(K(Se,De),U&&(I.setupElevationDraw(He,U,Ee),M.uploadCommonUniforms(N,U,Se.toUnwrapped()),ue)){const[qt,Lt,Vt]=ue.getGridBuffers(pt,We!==0);U.draw(M,ot,te,we,oe,jt.backCCW,Et,"globe_raster",qt,Lt,Vt)}}}if(ue&&(M.renderDefaultNorthPole||M.renderDefaultSouthPole)){const Ze=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];J&&Ze.push("CUSTOM_ANTIALIASING"),U=M.getOrCreateProgram("globeRaster",{defines:Ze});for(const We of R){const{x:ot,y:Se,z:He}=We.canonical,we=Se===0,$e=Se===(1<<He)-1,[Ve,Ke,De,Qe]=ue.getPoleBuffers(He,!1);if(Qe&&(we||$e)){const pt=P.getTile(We);N.activeTexture.set(F.TEXTURE0),pt.texture&&pt.texture.bind(F.LINEAR,F.CLAMP_TO_EDGE);let ft=o.cJ(He,ot,Z);const mt=o.bc(o.cI(We.canonical)),Et=(qt,Lt)=>qt.draw(M,F.TRIANGLES,te,$t.disabled,oe,jt.disabled,xu(Z.expandedFarZProjMatrix,ft,ft,mt,0,re,Z.frustumCorners.TL,Z.frustumCorners.TR,Z.frustumCorners.BR,Z.frustumCorners.BL,Z.globeCenterInViewSpace,Z.globeRadius,me,0,Z._farZ),"globe_pole_raster",Lt,De,Qe);I.setupElevationDraw(pt,U,Ee),M.uploadCommonUniforms(N,U,We.toUnwrapped()),we&&M.renderDefaultNorthPole&&Et(U,Ve),$e&&M.renderDefaultSouthPole&&(ft=o.ad.mat4.scale(o.ad.mat4.create(),ft,[1,-1,1]),Et(U,Ke))}}}})(d,f,_,T,E);else{const M=d.context,I=M.gl;let P,R;const O=d.shadowRenderer,N=fs(d,d.longestCutoffRange),F=oe=>{if(R===oe)return;const te=[];te.push(bu[oe]),N.shouldRenderCutoff&&te.push("RENDER_CUTOFF"),O&&(te.push("RENDER_SHADOWS","DEPTH_TEXTURE"),O.useNormalOffset&&te.push("NORMAL_OFFSET")),P=d.getOrCreateProgram("terrainRaster",{defines:te}),R=oe},U=d.colorModeForRenderPass(),q=new Pt(I.LEQUAL,Pt.ReadWrite,d.depthRangeFor3D);Mn.update(E);const Z=d.transform,J=gs(Z.zoom,f.exaggeration(),f.sourceCache._source.tileSize);let K=[0,0,0];if(O){const oe=d.style.directionalLight,te=d.style.ambientLight;oe&&te&&(K=Go(d.style,oe,te))}{R=-1;const oe=I.TRIANGLES,[te,ie]=[f.gridIndexBuffer,f.gridSegments];for(const re of T){const ue=_.getTile(re),me=$t.disabled,Le=f.prevTerrainTileForTile[re.key],Ee=f.terrainTileForTile[re.key];Yl(Le,Ee)&&Mn.newMorphing(re.key,Le,Ee,E,250),M.activeTexture.set(I.TEXTURE0),ue.texture&&ue.texture.bind(I.LINEAR,I.CLAMP_TO_EDGE);const Ze=Mn.getMorphValuesForProxy(re.key),We=Ze?1:0;let ot;Ze&&(ot={morphing:{srcDemTile:Ze.from,dstDemTile:Ze.to,phase:o.cC(Ze.phase)}});const Se=hd(re.projMatrix,wu(re.canonical,Z.renderWorldCopies)?J/10:J,K);if(F(We),!P)continue;f.setupElevationDraw(ue,P,ot);const He=re.toUnwrapped();O&&O.setupShadows(He,P),d.uploadCommonUniforms(M,P,He,null,N),P.draw(d,oe,q,me,U,jt.backCCW,Se,"terrain_raster",f.gridBuffer,te,ie)}}}}(r,this,this.proxySourceCache,t,this._updateTimestamp),this.renderingToTexture=!0,r.gpuTimingDeferredRenderEnd(),t.splice(0,t.length))}renderBatch(t){if(this._drapedRenderBatches.length===0)return t+1;this.renderingToTexture=!0;const r=this.painter,c=this.painter.context,d=this.proxySourceCache,f=this.proxiedCoords[d.id],_=this._drapedRenderBatches.shift(),T=r.style.order,E=[];let M=0;for(const I of f){const P=d.getTileByID(I.proxyTileKey),R=d.proxyCachedFBO[I.key]?d.proxyCachedFBO[I.key][t]:void 0,O=R!==void 0?d.renderCache[R]:this.pool[M++],N=R!==void 0;if(P.texture=O.tex,N&&!O.dirty){E.push(P.tileID);continue}let F;c.bindFramebuffer.set(O.fb.framebuffer),this.renderedToTile=!1,O.dirty&&(c.clear({color:o.al.transparent,stencil:0}),O.dirty=!1);for(let U=_.start;U<=_.end;++U){const q=r.style._mergedLayers[T[U]];if(q.isHidden(r.transform.zoom))continue;const Z=r.style.getLayerSourceCache(q),J=Z?this.proxyToSource[I.key][Z.id]:[I];if(!J)continue;const K=J;c.viewport.set([0,0,O.fb.width,O.fb.height]),F!==(Z?Z.id:null)&&(this._setupStencil(O,J,q,Z),F=Z?Z.id:null),r.renderLayer(r,Z,q,K)}if(this._drapedRenderBatches.length===0)for(const U of this._pendingGroundEffectLayers){const q=r.style._mergedLayers[T[U]];if(q.isHidden(r.transform.zoom))continue;const Z=r.style.getLayerSourceCache(q),J=Z?this.proxyToSource[I.key][Z.id]:[I];if(!J)continue;const K=J;c.viewport.set([0,0,O.fb.width,O.fb.height]),F!==(Z?Z.id:null)&&(this._setupStencil(O,J,q,Z),F=Z?Z.id:null),r.renderLayer(r,Z,q,K)}this.renderedToTile?(O.dirty=!0,E.push(P.tileID)):N||--M,M===5&&(M=0,this.renderToBackBuffer(E))}return this.renderToBackBuffer(E),this.renderingToTexture=!1,c.bindFramebuffer.set(null),c.viewport.set([0,0,r.width,r.height]),_.end+1}postRender(){}isLayerOrderingCorrect(t){const r=t.order.length;let c=-1,d=r;for(let f=0;f<r;++f)this._style.isLayerDraped(t._mergedLayers[t.order[f]])?c=Math.max(c,f):d=Math.min(d,f);return d>c}getMinElevationBelowMSL(){let t=0;return this._visibleDemTiles.filter(r=>r.dem).forEach(r=>{t=Math.min(t,r.dem.tree.minimums[0])}),t===0?t:(t-30)*this._exaggeration}raycast(t,r,c){if(!this._visibleDemTiles)return null;const d=this._visibleDemTiles.filter(f=>f.dem).map(f=>{const _=f.tileID,T=1<<_.overscaledZ,{x:E,y:M}=_.canonical,I=E/T,P=(E+1)/T,R=M/T,O=(M+1)/T;return{minx:I,miny:R,maxx:P,maxy:O,t:f.dem.tree.raycastRoot(I,R,P,O,t,r,c),tile:f}});d.sort((f,_)=>(f.t!==null?f.t:Number.MAX_VALUE)-(_.t!==null?_.t:Number.MAX_VALUE));for(const f of d){if(f.t==null)return null;const _=f.tile.dem.tree.raycast(f.minx,f.miny,f.maxx,f.maxy,t,r,c);if(_!=null)return _}return null}_createFBO(){const t=this.painter.context,r=t.gl,c=this.drapeBufferSize;t.activeTexture.set(r.TEXTURE0);const d=new o.T(t,{width:c[0],height:c[1],data:null},r.RGBA8);d.bind(r.LINEAR,r.CLAMP_TO_EDGE);const f=t.createFramebuffer(c[0],c[1],!0,null);return f.colorAttachment.set(d.texture),f.depthAttachment=new ud(t,f.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=t.createRenderbuffer(t.gl.DEPTH_STENCIL,c[0],c[1]),this._stencilRef=0,f.depthAttachment.set(this._sharedDepthStencil),t.clear({stencil:0})):f.depthAttachment.set(this._sharedDepthStencil),t.extTextureFilterAnisotropic&&r.texParameterf(r.TEXTURE_2D,t.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,t.extTextureFilterAnisotropicMax),{fb:f,tex:d,dirty:!1}}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._debugParams.disableRenderCache||this._style.hasLightTransitions())return!0;for(const t in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[t].hasTransition())return!0;return this._style.order.some(t=>{const r=this._style._mergedLayers[t],c=r.isHidden(this.painter.transform.zoom);return r.type==="hillshade"||r.type==="custom"?!c&&r.shouldRedrape():!c&&r.hasTransition()})}_clearLineLayersFromRenderCache(){let t=!1;for(const c of this._style.getSources())if(c instanceof Ro){t=!0;break}if(!t)return;const r={};for(let c=0;c<this._style.order.length;++c){const d=this._style._mergedLayers[this._style.order[c]],f=this._style.getLayerSourceCache(d);if(f&&!r[f.id]&&!d.isHidden(this.painter.transform.zoom)&&d.type==="line"&&d.widthExpression()instanceof o.ab){r[f.id]=!0;for(const _ of this.proxyCoords){const T=this.proxyToSource[_.key][f.id];if(T)for(const E of T)this._clearRenderCacheForTile(f.id,E)}}}}_clearRasterLayersFromRenderCache(){let t=!1;for(const c in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[c]._source instanceof Tn){t=!0;break}if(!t)return;const r={};for(let c=0;c<this._style.order.length;++c){const d=this._style._mergedLayers[this._style.order[c]],f=this._style.getLayerSourceCache(d);if(!f||r[f.id]||d.isHidden(this.painter.transform.zoom)||d.type!=="raster")continue;const _=d.paint.get("raster-fade-duration");for(const T of this.proxyCoords){const E=this.proxyToSource[T.key][f.id];if(E)for(const M of E){const I=Kl(f.getTile(M),f.findLoadedParent(M,0),f,this.painter.transform,_);(I.opacity!==1||I.mix!==0)&&this._clearRenderCacheForTile(f.id,M)}}}}_setupDrapedRenderBatches(){this._style.updateDrapeFirstLayers();const t=this._style.order,r=t.length;if(r===0)return;const c=[];this._pendingGroundEffectLayers=[];let d,f=0,_=this._style._mergedLayers[t[f]];for(;!this._style.isLayerDraped(_)&&_.isHidden(this.painter.transform.zoom)&&++f<r;)_=this._style._mergedLayers[t[f]];for(;f<r;++f){const T=this._style._mergedLayers[t[f]];T.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(T)?d===void 0&&(d=f):(T.type==="fill-extrusion"&&this._pendingGroundEffectLayers.push(f),d!==void 0&&(c.push({start:d,end:f-1}),d=void 0)))}if(d!==void 0&&c.push({start:d,end:f-1}),c.length!==0){const T=c[c.length-1];this._pendingGroundEffectLayers.every(E=>E>T.end)||o.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=c}_setupRenderCache(t){const r=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,r.renderCache.length>r.renderCachePool.length){const _=Object.values(r.proxyCachedFBO);r.proxyCachedFBO={};for(let T=0;T<_.length;++T){const E=Object.values(_[T]);r.renderCachePool.push(...E)}}return}this._clearRasterLayersFromRenderCache();const c=this.proxyCoords,d=this._tilesDirty;for(let _=c.length-1;_>=0;_--){const T=c[_];if(r.getTileByID(T.key),r.proxyCachedFBO[T.key]!==void 0){const E=t[T.key],M=this.proxyToSource[T.key];let I=0;for(const P in M){const R=M[P],O=E[P];if(!O||O.length!==R.length||R.some((N,F)=>N!==O[F]||d[P]&&d[P].hasOwnProperty(N.key))){I=-1;break}++I}for(const P in r.proxyCachedFBO[T.key])r.renderCache[r.proxyCachedFBO[T.key][P]].dirty=I<0||I!==Object.values(E).length}}const f=[...this._drapedRenderBatches];f.sort((_,T)=>T.end-T.start-(_.end-_.start));for(const _ of f)for(const T of c){if(r.proxyCachedFBO[T.key])continue;let E=r.renderCachePool.pop();E===void 0&&r.renderCache.length<50&&(E=r.renderCache.length,r.renderCache.push(this._createFBO())),E!==void 0&&(r.proxyCachedFBO[T.key]={},r.proxyCachedFBO[T.key][_.start]=E,r.renderCache[E].dirty=!0)}this._tilesDirty={}}_setupStencil(t,r,c,d){if(!d||!this._sourceTilesOverlap[d.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const f=this.painter.context,_=f.gl;if(r.length<=1)return void(this._overlapStencilType=!1);let T;if(c.isTileClipped())T=r.length,this._overlapStencilMode.test={func:_.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(r[0].overscaledZ>
2467r[r.length-1].overscaledZ))return void(this._overlapStencilType=!1);T=1,this._overlapStencilMode.test={func:_.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+T>255&&(f.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=T,this._overlapStencilMode.ref=this._stencilRef,c.isTileClipped()&&this._renderTileClippingMasks(r,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(t){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[t.key]),this._overlapStencilMode):$t.disabled}_renderTileClippingMasks(t,r){const c=this.painter,d=this.painter.context,f=d.gl;c._tileClippingMaskIDs={},d.setColorMode(ii.disabled),d.setDepthMode(Pt.disabled);const _=c.getOrCreateProgram("clippingMask");for(const T of t){const E=c._tileClippingMaskIDs[T.key]=--r;_.draw(c,f.TRIANGLES,Pt.disabled,new $t({func:f.ALWAYS,mask:0},E,255,f.KEEP,f.KEEP,f.REPLACE),ii.disabled,jt.disabled,Ko(T.projMatrix),"$clipping",c.tileExtentBuffer,c.quadTriangleIndexBuffer,c.tileExtentSegments)}}pointCoordinate(t){const r=this.painter.transform;if(t.x<0||t.x>r.width||t.y<0||t.y>r.height)return null;const c=[t.x,t.y,1,1];o.ad.vec4.transformMat4(c,c,r.pixelMatrixInverse),o.ad.vec4.scale(c,c,1/c[3]),c[0]/=r.worldSize,c[1]/=r.worldSize;const d=r._camera.position,f=o.bH(1,r.center.lat),_=[d[0],d[1],d[2]/f,0],T=o.ad.vec3.subtract([],c.slice(0,3),_);o.ad.vec3.normalize(T,T);const E=this.raycast(_,T,this._exaggeration);return E!==null&&E?(o.ad.vec3.scaleAndAdd(_,_,T,E),_[3]=_[2],_[2]*=f,_):null}_setupProxiedCoordsForOrtho(t,r,c){if(t.getSource()instanceof o.aK)return this._setupProxiedCoordsForImageSource(t,r,c);this._findCoveringTileCache[t.id]=this._findCoveringTileCache[t.id]||{};const d=this.proxiedCoords[t.id]=[],f=this.proxyCoords;for(let E=0;E<f.length;E++){const M=f[E],I=this._findTileCoveringTileID(M,t);if(I){const P=this._createProxiedId(M,I,c[M.key]&&c[M.key][t.id]);d.push(P),this.proxyToSource[M.key][t.id]=[P]}}let _=!1;const T=new Set;for(let E=0;E<r.length;E++){const M=t.getTile(r[E]);if(!M||!M.hasData())continue;const I=this._findTileCoveringTileID(M.tileID,this.proxySourceCache);if(I&&I.tileID.canonical.z!==M.tileID.canonical.z){const P=this.proxyToSource[I.tileID.key][t.id],R=this._createProxiedId(I.tileID,M,c[I.tileID.key]&&c[I.tileID.key][t.id]);P?P.splice(P.length-1,0,R):this.proxyToSource[I.tileID.key][t.id]=[R];const O=this.proxyToSource[I.tileID.key][t.id];T.has(O)||T.add(O),d.push(R),_=!0}}if(this._sourceTilesOverlap[t.id]=_,_&&this._debugParams.sortTilesHiZFirst)for(const E of T)E.sort((M,I)=>I.overscaledZ-M.overscaledZ)}_setupProxiedCoordsForImageSource(t,r,c){if(!t.getSource().loaded())return;const d=this.proxiedCoords[t.id]=[],f=this.proxyCoords,_=t.getSource(),T=_.tileID;if(!T)return;const E=new o.P(T.x,T.y)._div(1<<T.z),M=_.coordinates.map(o.ac.fromLngLat).reduce((P,R)=>(P.min.x=Math.min(P.min.x,R.x-E.x),P.min.y=Math.min(P.min.y,R.y-E.y),P.max.x=Math.max(P.max.x,R.x-E.x),P.max.y=Math.max(P.max.y,R.y-E.y),P),{min:new o.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new o.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),I=(P,R)=>{const O=P.wrap+P.canonical.x/(1<<P.canonical.z),N=P.canonical.y/(1<<P.canonical.z),F=o.ai/(1<<P.canonical.z),U=R.wrap+R.canonical.x/(1<<R.canonical.z),q=R.canonical.y/(1<<R.canonical.z);return O+F<U+M.min.x||O>U+M.max.x||N+F<q+M.min.y||N>q+M.max.y};for(let P=0;P<f.length;P++){const R=f[P];for(let O=0;O<r.length;O++){const N=t.getTile(r[O]);if(!N||!N.hasData()||I(R,N.tileID))continue;const F=this._createProxiedId(R,N,c[R.key]&&c[R.key][t.id]),U=this.proxyToSource[R.key][t.id];U?U.push(F):this.proxyToSource[R.key][t.id]=[F],d.push(F)}}}_createProxiedId(t,r,c){let d=this.orthoMatrix;if(c){const f=c.find(_=>_.key===r.tileID.key);if(f)return f}if(r.tileID.key!==t.key){const f=t.canonical.z-r.tileID.canonical.z;let _,T,E;d=o.ad.mat4.create();const M=r.tileID.wrap-t.wrap<<t.overscaledZ;f>0?(_=o.ai>>f,T=_*((r.tileID.canonical.x<<f)-t.canonical.x+M),E=_*((r.tileID.canonical.y<<f)-t.canonical.y)):(_=o.ai<<-f,T=o.ai*(r.tileID.canonical.x-(t.canonical.x+M<<-f)),E=o.ai*(r.tileID.canonical.y-(t.canonical.y<<-f))),o.ad.mat4.ortho(d,0,_,0,_,0,1),o.ad.mat4.translate(d,d,[T,E,0])}return new Jl(r.tileID,t.key,d)}_findTileCoveringTileID(t,r){let c=r.getTile(t);if(c&&c.hasData())return c;const d=this._findCoveringTileCache[r.id],f=d[t.key];if(c=f?r.getTileByID(f):null,c&&c.hasData()||f===null)return c;let _=c?c.tileID:t,T=_.overscaledZ;const E=r.getSource().minzoom,M=[];if(!f){const P=r.getSource().maxzoom;if(t.canonical.z>=P){const R=t.canonical.z-P;r.getSource().reparseOverscaled?(T=Math.max(t.canonical.z+2,r.transform.tileZoom),_=new o.aH(T,t.wrap,P,t.canonical.x>>R,t.canonical.y>>R)):R!==0&&(T=P,_=new o.aH(T,t.wrap,P,t.canonical.x>>R,t.canonical.y>>R))}_.key!==t.key&&(M.push(_.key),c=r.getTile(_))}const I=P=>{M.forEach(R=>{d[R]=P}),M.length=0};for(T-=1;T>=E&&(!c||!c.hasData());T--){c&&I(c.tileID.key);const P=_.calculateScaledKey(T);if(c=r.getTileByID(P),c&&c.hasData())break;const R=d[P];if(R===null)break;R===void 0?M.push(P):c=r.getTileByID(R)}return I(c?c.tileID.key:null),c&&c.hasData()?c:null}findDEMTileFor(t){return this.enabled?this._findTileCoveringTileID(t,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(t,r){let c=this._tilesDirty[t];c||(c=this._tilesDirty[t]={}),c[r.key]=!0}}function fd(u,t,r){const c=function(T,E,M){const I=o.ad.vec3.dot(E,T),P=o.ad.vec3.dot(M,[.2126,.7152,.0722]),R=(N,F,U)=>(1-U)*N+U*F,O=R(1-.3*Math.min(P,1),1,Math.min(I+1,1));return R(.92,1,Math.asin(o.ay(E[2],-1,1))/Math.PI+.5)*O}(u,[0,0,1],t),d=[0,0,0];o.ad.vec3.scale(d,r.slice(0,3),c);const f=[0,0,0];o.ad.vec3.scale(f,t.slice(0,3),u[2]);const _=[0,0,0];return o.ad.vec3.add(_,d,f),o.cg(_)}const Ya=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],ff=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","elevatedStructures","model","symbol"];class md{static cacheKey(t,r,c,d){let f=`${r}${d?d.cacheKey:""}`;for(const _ of c)t.usedDefines.includes(_)&&(f+=`/${_}`);return f}constructor(t,r,c,d,f,_){const T=t.gl;this.program=T.createProgram(),this.configuration=d,this.name=r,this.fixedDefines=[..._];const E=d?d.getBinderAttributes():[],M=(c.staticAttributes||[]).concat(E);let I=d?d.defines():[];I=I.concat(_.map(U=>`#define ${U}`));const P=`#version 300 es 2468`;let R=P+I.concat("precision mediump float;",$l,ou.fragmentSource).join(` 2469`);for(const U of c.fragmentIncludes)R+=` 2470${_o[U]}`;R+=` 2471${c.fragmentSource}`;let O=P+I.concat("precision highp float;",$l,ou.vertexSource).join(` 2472`);for(const U of c.vertexIncludes)O+=` 2473${_o[U]}`;this.forceManualRenderingForInstanceIDShaders=t.forceManualRenderingForInstanceIDShaders&&c.vertexSource.indexOf("gl_InstanceID")!==-1,this.forceManualRenderingForInstanceIDShaders&&(O+=` 2474uniform int u_instanceID; 2475`),O+=` 2476${c.vertexSource}`,this.forceManualRenderingForInstanceIDShaders&&(O=O.replaceAll("gl_InstanceID","u_instanceID"));const N=T.createShader(T.FRAGMENT_SHADER);if(T.isContextLost())return void(this.failedToCreate=!0);T.shaderSource(N,R),T.compileShader(N),T.attachShader(this.program,N);const F=T.createShader(T.VERTEX_SHADER);if(T.isContextLost())this.failedToCreate=!0;else{T.shaderSource(F,O),T.compileShader(F),T.attachShader(this.program,F),this.attributes={},this.numAttributes=M.length;for(let U=0;U<this.numAttributes;U++)if(M[U]){const q=M[U].startsWith("a_")?M[U]:`a_${M[U]}`;T.bindAttribLocation(this.program,U,q),this.attributes[q]=U}T.linkProgram(this.program),T.deleteShader(F),T.deleteShader(N),this.fixedUniforms=f(t),this.binderUniforms=d?d.getUniforms(t):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(U=>({u_instanceID:new o.bN(U)}))(t)),(_.includes("TERRAIN")||r.indexOf("symbol")!==-1||r.indexOf("circle")!==-1)&&(this.terrainUniforms=(U=>({u_dem:new o.bN(U),u_dem_prev:new o.bN(U),u_dem_tl:new o.bK(U),u_dem_scale:new o.bM(U),u_dem_tl_prev:new o.bK(U),u_dem_scale_prev:new o.bM(U),u_dem_size:new o.bM(U),u_dem_lerp:new o.bM(U),u_exaggeration:new o.bM(U),u_depth:new o.bN(U),u_depth_size_inv:new o.bK(U),u_depth_range_unpack:new o.bK(U),u_occluder_half_size:new o.bM(U),u_occlusion_depth_offset:new o.bM(U),u_meter_to_dem:new o.bM(U),u_label_plane_matrix_inv:new o.bJ(U)}))(t)),_.includes("GLOBE")&&(this.globeUniforms=(U=>({u_tile_tl_up:new o.bL(U),u_tile_tr_up:new o.bL(U),u_tile_br_up:new o.bL(U),u_tile_bl_up:new o.bL(U),u_tile_up_scale:new o.bM(U)}))(t)),_.includes("FOG")&&(this.fogUniforms=(U=>({u_fog_matrix:new o.bJ(U),u_fog_range:new o.bK(U),u_fog_color:new o.cb(U),u_fog_horizon_blend:new o.bM(U),u_fog_vertical_limit:new o.bK(U),u_fog_temporal_offset:new o.bM(U),u_frustum_tl:new o.bL(U),u_frustum_tr:new o.bL(U),u_frustum_br:new o.bL(U),u_frustum_bl:new o.bL(U),u_globe_pos:new o.bL(U),u_globe_radius:new o.bM(U),u_globe_transition:new o.bM(U),u_is_globe:new o.bN(U),u_viewport:new o.bK(U)}))(t)),_.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(U=>({u_cutoff_params:new o.cb(U)}))(t)),_.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(U=>({u_lighting_ambient_color:new o.bL(U),u_lighting_directional_dir:new o.bL(U),u_lighting_directional_color:new o.bL(U),u_ground_radiance:new o.bL(U)}))(t)),_.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(U=>({u_light_matrix_0:new o.bJ(U),u_light_matrix_1:new o.bJ(U),u_fade_range:new o.bK(U),u_shadow_normal_offset:new o.bL(U),u_shadow_intensity:new o.bM(U),u_shadow_texel_size:new o.bM(U),u_shadow_map_resolution:new o.bM(U),u_shadow_direction:new o.bL(U),u_shadow_bias:new o.bL(U),u_shadowmap_0:new o.bN(U),u_shadowmap_1:new o.bN(U)}))(t))}}setTerrainUniformValues(t,r){if(!this.terrainUniforms)return;const c=this.terrainUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in r)c[d]&&c[d].set(this.program,d,r[d])}}setGlobeUniformValues(t,r){if(!this.globeUniforms)return;const c=this.globeUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in r)c[d]&&c[d].set(this.program,d,r[d])}}setFogUniformValues(t,r){if(!this.fogUniforms)return;const c=this.fogUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in r)c[d].set(this.program,d,r[d])}}setCutoffUniformValues(t,r){if(!this.cutoffUniforms)return;const c=this.cutoffUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in r)c[d].set(this.program,d,r[d])}}setLightsUniformValues(t,r){if(!this.lightsUniforms)return;const c=this.lightsUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in r)c[d].set(this.program,d,r[d])}}setShadowUniformValues(t,r){if(this.failedToCreate||!this.shadowUniforms)return;const c=this.shadowUniforms;t.program.set(this.program);for(const d in r)c[d].set(this.program,d,r[d])}_drawDebugWireframe(t,r,c,d,f,_,T,E,M,I){const P=t.options.wireframe;if(P.terrain===!1&&P.layers2D===!1&&P.layers3D===!1)return;const R=t.context;if(!(!(!P.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!P.layers2D||t._terrain&&t._terrain.renderingToTexture||!Ya.includes(this.name))||!(!P.layers3D||!ff.includes(this.name))))return;const O=R.gl,N=t.wireframeDebugCache.getLinesFromTrianglesBuffer(t.frameCounter,f,R);if(!N)return;const F=[...this.fixedDefines];
2476F.push("DEBUG_WIREFRAME");const U=t.getOrCreateProgram(this.name,{config:this.configuration,defines:F});R.program.set(U.program);const q=(K,oe,te)=>{if(oe[K]&&te[K])for(const ie in oe[K])te[K][ie]&&te[K][ie].set(te.program,ie,oe[K][ie].current)};M&&M.setUniforms(U.program,R,U.binderUniforms,T,{zoom:E}),q("fixedUniforms",this,U),q("terrainUniforms",this,U),q("globeUniforms",this,U),q("fogUniforms",this,U),q("lightsUniforms",this,U),q("shadowUniforms",this,U),N.bind(),R.setColorMode(new ii([O.ONE,O.ONE_MINUS_SRC_ALPHA,O.ZERO,O.ONE],o.al.transparent,[!0,!0,!0,!1])),R.setDepthMode(new Pt(r.func===O.LESS?O.LEQUAL:r.func,Pt.ReadOnly,r.range)),R.setStencilMode($t.disabled);const Z=3*_.primitiveLength*2,J=3*_.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const K=I||1;for(let oe=0;oe<K;++oe)U.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",oe),O.drawElements(O.LINES,Z,O.UNSIGNED_SHORT,J)}else I&&I>1?O.drawElementsInstanced(O.LINES,Z,O.UNSIGNED_SHORT,J,I):O.drawElements(O.LINES,Z,O.UNSIGNED_SHORT,J);f.bind(),R.program.set(this.program),R.setDepthMode(r),R.setStencilMode(c),R.setColorMode(d)}checkUniforms(t,r,c){if(this.fixedDefines.includes(r)){for(const d of Object.keys(c))if(!c[d].initialized)throw new Error(`Program '${this.name}', from draw '${t}': uniform ${d} not set but required by ${r} being defined`)}}draw(t,r,c,d,f,_,T,E,M,I,P,R,O,N,F,U){const q=t.context,Z=q.gl;if(this.failedToCreate)return;q.program.set(this.program),q.setDepthMode(c),q.setStencilMode(d),q.setColorMode(f),q.setCullFace(_);for(const oe of Object.keys(this.fixedUniforms))this.fixedUniforms[oe].set(this.program,oe,T[oe]);N&&N.setUniforms(this.program,q,this.binderUniforms,R,{zoom:O});const J={[Z.POINTS]:1,[Z.LINES]:2,[Z.TRIANGLES]:3,[Z.LINE_STRIP]:1}[r];this.checkUniforms(E,"RENDER_SHADOWS",this.shadowUniforms);const K=U&&U>0?1:void 0;for(const oe of P.get()){const te=oe.vaos||(oe.vaos={});if((te[E]||(te[E]=new rd)).bind(q,this,M,N?N.getPaintVertexBuffers():[],I,oe.vertexOffset,F||[],K),this.forceManualRenderingForInstanceIDShaders){const ie=U||1;for(let re=0;re<ie;++re)this.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",re),I?Z.drawElements(r,oe.primitiveLength*J,Z.UNSIGNED_SHORT,oe.primitiveOffset*J*2):Z.drawArrays(r,oe.vertexOffset,oe.vertexLength)}else U&&U>1?Z.drawElementsInstanced(r,oe.primitiveLength*J,Z.UNSIGNED_SHORT,oe.primitiveOffset*J*2,U):I?Z.drawElements(r,oe.primitiveLength*J,Z.UNSIGNED_SHORT,oe.primitiveOffset*J*2):Z.drawArrays(r,oe.vertexOffset,oe.vertexLength);r===Z.TRIANGLES&&I&&this._drawDebugWireframe(t,c,d,f,I,oe,R,O,N,U)}}}function Su(u,t){const r=Math.pow(2,t.tileID.overscaledZ),c=t.tileSize*Math.pow(2,u.transform.tileZoom)/r,d=c*(t.tileID.canonical.x+t.tileID.wrap*r),f=c*t.tileID.canonical.y;return{u_image:0,u_texsize:t.imageAtlasTexture?t.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/o.at(t,1,u.transform.tileZoom),u_pixel_coord_upper:[d>>16,f>>16],u_pixel_coord_lower:[65535&d,65535&f]}}const Ql={terrain:0,flat:1},Eu=o.ad.mat4.create(),ec=(u,t,r,c,d,f,_,T,E,M,I,P,R,O,N,F,U,q)=>{const Z=t.style.light,J=Z.properties.get("position"),K=[J.x,J.y,J.z],oe=o.ad.mat3.create();Z.properties.get("anchor")==="viewport"&&(o.ad.mat3.fromRotation(oe,-t.transform.angle),o.ad.vec3.transformMat3(K,K,oe));const te=Z.properties.get("color"),ie=t.transform,re={u_matrix:u,u_lightpos:K,u_lightintensity:Z.properties.get("intensity"),u_lightcolor:[te.r,te.g,te.b],u_vertical_gradient:+r,u_opacity:c,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Eu,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:Ql[M],u_base_type:Ql[I],u_ao:d,u_edge_radius:f,u_width_scale:_,u_flood_light_color:N,u_vertical_scale:F,u_flood_light_intensity:U,u_ground_shadow_factor:q};return ie.projection.name==="globe"&&(re.u_tile_id=[T.canonical.x,T.canonical.y,1<<T.canonical.z],re.u_zoom_transition=P,re.u_inv_rot_matrix=O,re.u_merc_center=R,re.u_up_dir=ie.projection.upVector(new o.bT(0,0,0),R[0]*o.ai,R[1]*o.ai),re.u_height_lift=E),re},Jo=(u,t,r,c,d,f)=>({u_matrix:u,u_edge_radius:t,u_width_scale:r,u_vertical_scale:c,u_height_type:Ql[d],u_base_type:Ql[f]}),Mu=(u,t,r,c,d,f,_,T,E,M,I,P,R,O,N,F,U)=>{const q=ec(u,t,r,c,d,f,_,T,M,I,P,R,O,N,F,U,1,[0,0,0]),Z={u_height_factor:-Math.pow(2,T.overscaledZ
2476)/E.tileSize/8};return o.l(q,Su(t,E),Z)},Qo=(u,t)=>({u_matrix:u,u_emissive_strength:t}),Iu=(u,t,r,c)=>o.l(Qo(u,t),Su(r,c)),tc=(u,t,r)=>({u_matrix:u,u_world:r,u_emissive_strength:t}),ic=(u,t,r,c,d)=>o.l(Iu(u,t,r,c),{u_world:d}),Ka=(u,t,r,c,d)=>({u_matrix:u,u_camera_pos:[t[0],t[1],t[2]],u_depth_bias:r,u_height_scale:c,u_reset_depth:d}),_d=(u,t,r,c)=>{const d=o.ai/r.tileSize;return{u_matrix:u,u_camera_to_center_distance:t.getCameraToCenterDistance(c),u_extrude_scale:[t.pixelsToGLUnits[0]/d,t.pixelsToGLUnits[1]/d]}},gd=(u,t,r=1)=>({u_matrix:u,u_color:t.toRenderColor(null),u_overlay:0,u_overlay_scale:r}),ea=o.ad.mat4.create(),rc=(u,t,r,c,d,f,_)=>{const T=u.transform,E=T.projection.name==="globe",M=E?o.cO(T.zoom,t.canonical)*T._pixelsPerMercatorPixel:o.at(r,1,f),I={u_matrix:t.projMatrix,u_extrude_scale:M,u_intensity:_,u_inv_rot_matrix:ea,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(E){I.u_inv_rot_matrix=c,I.u_merc_center=d,I.u_tile_id=[t.canonical.x,t.canonical.y,1<<t.canonical.z],I.u_zoom_transition=o.ag(T.zoom);const P=d[0]*o.ai,R=d[1]*o.ai;I.u_up_dir=T.projection.upVector(new o.bT(0,0,0),P,R)}return I};function vt(u,[t,r,c,d],[f,_]){if(f===_)return[0,0,0,0];const T=255*(u-1)/(u*(_-f));return[t*T,r*T,c*T,d*T]}function Au(u,t,[r,c]){return r===c?0:.5/u+(t-r)*(u-1)/(u*(c-r))}const Cu=(u,t,r,c,d,f,_,T,E,M,I,P,R,O,N,F,U,q,Z,J,K)=>({u_matrix:u,u_normalize_matrix:t,u_globe_matrix:r,u_merc_matrix:c,u_grid_matrix:d,u_tl_parent:f,u_scale_parent:M,u_fade_t:I.mix,u_opacity:I.opacity*P.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:P.paint.get("raster-brightness-min"),u_brightness_high:P.paint.get("raster-brightness-max"),u_saturation_factor:o.cP(P.paint.get("raster-saturation")),u_contrast_factor:o.cQ(P.paint.get("raster-contrast")),u_spin_weights:js(P.paint.get("raster-hue-rotate")),u_perspective_transform:R,u_raster_elevation:O,u_zoom_transition:_,u_merc_center:T,u_cutoff_params:E,u_colorization_mix:vt(o.cR,F,q),u_colorization_offset:Au(o.cR,U,q),u_color_ramp:N,u_texture_offset:[J/(Z+2*J),Z/(Z+2*J)],u_texture_res:[Z+2*J,Z+2*J],u_emissive_strength:K});function js(u){u*=Math.PI/180;const t=Math.sin(u),r=Math.cos(u);return[(2*r+1)/3,(-Math.sqrt(3)*t-r+1)/3,(Math.sqrt(3)*t-r+1)/3]}const mn=.05,Rt=(u,t,r,c,d,f,_,T,E,M,I,P)=>({u_matrix:u,u_normalize_matrix:t,u_globe_matrix:r,u_merc_matrix:c,u_grid_matrix:d,u_tl_parent:f,u_scale_parent:M,u_fade_t:I.mix,u_opacity:I.opacity,u_image0:0,u_image1:1,u_raster_elevation:P,u_zoom_transition:_,u_merc_center:T,u_cutoff_params:E}),Pu=(u,t,r,c,d,f,_,T,E,M)=>({u_particle_texture:u,u_particle_texture_side_len:t,u_tile_offset:r,u_velocity:c,u_color_ramp:f,u_velocity_res:d,u_max_speed:_,u_uv_offset:T,u_data_scale:[255*E[0],255*E[1]],u_data_offset:M,u_particle_pos_scale:1.1,u_particle_pos_offset:[mn,mn]}),mf=(u,t,r,c,d,f,_,T,E,M)=>({u_particle_texture:u,u_particle_texture_side_len:t,u_velocity:r,u_velocity_res:c,u_max_speed:d,u_speed_factor:f,u_reset_rate:_,u_rand_seed:Math.random(),u_uv_offset:T,u_data_scale:[255*E[0],255*E[1]],u_data_offset:M,u_particle_pos_scale:1.1,u_particle_pos_offset:[mn,mn]}),yd=o.ad.mat4.create(),nc=(u,t,r,c,d,f,_,T,E,M,I,P,R,O,N,F,U,q,Z,J,K,oe)=>{const te=d.transform,ie={u_is_size_zoom_constant:+(u==="constant"||u==="source"),u_is_size_feature_constant:+(u==="constant"||u==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:te.getCameraToCenterDistance(Z),u_rotate_symbol:+r,u_aspect_ratio:te.width/te.height,u_fade_change:d.options.fadeDuration?d.symbolFadeChange:1,u_matrix:f,u_label_plane_matrix:_,u_coord_matrix:T,u_is_text:+M,u_elevation_from_sea:E?1:0,u_pitch_with_map:+c,u_texsize:I,u_texsize_icon:P,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:yd,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:yd,u_up_vector:[0,-1,0],u_color_adj_mat:J,u_icon_transition:K||0,u_gamma_scale:c?d.transform.getCameraToCenterDistance(Z)*Math.cos(d.terrain?0:d.transform._pitch):1,u_device_pixel_ratio:o.q.devicePixelRatio,u_is_halo:1,u_scale_factor:oe||1};return Z.name==="globe"&&(ie.u_tile_id=[O.canonical.x,O.canonical.y,1<<O.canonical.z],ie.u_zoom_transition=N,ie.u_inv_rot_matrix=U,ie.u_merc_center=F,ie.u_camera_forward=te._camera.forward(),ie.u_ecef_origin=o.cS(te.globeMatrix,O.toUnwrapped()),ie.u_tile_matrix=Float32Array.from(te.globeMatrix),ie.u_up_vector=q),ie},Ru=(u,t,r,c)=>({u_matrix:u,u_emissive_strength:t,u_opacity:r,u_color:c}),vd=(u,t,r,c,d,f,_,T,E)=>o.l(function(M,I,P,R,O,N){const{width:F,height:U}=R.imageManager.getPixelSize(I),q=Math.pow(2,N.tileID.overscaledZ
2476),Z=N.tileSize*Math.pow(2,R.transform.tileZoom)/q,J=Z*(N.tileID.canonical.x+N.tileID.wrap*q),K=Z*N.tileID.canonical.y;return{u_image:0,u_pattern_tl:P.tl,u_pattern_br:P.br,u_texsize:[F,U],u_pattern_size:P.displaySize,u_pattern_units_to_pixels:O?[R.transform.width,-1*R.transform.height]:[1/o.at(N,1,R.transform.tileZoom),1/o.at(N,1,R.transform.tileZoom)],u_pixel_coord_upper:[J>>16,K>>16],u_pixel_coord_lower:[65535&J,65535&K]}}(0,f,_,c,T,E),{u_matrix:u,u_emissive_strength:t,u_opacity:r}),sc=new Float32Array(o.ad.mat4.identity([])),zu=(u,t,r,c,d,f,_,T,E,M,I,P,R,O=[0,0,0],N)=>{const F=d.style.light,U=F.properties.get("position"),q=[-U.x,-U.y,U.z],Z=o.ad.mat3.create();F.properties.get("anchor")==="viewport"&&(o.ad.mat3.fromRotation(Z,-d.transform.angle),o.ad.vec3.transformMat3(q,q,Z));const J=I.alphaMode==="MASK",K=F.properties.get("color").toRenderColor(null),oe=R.paint.get("model-ambient-occlusion-intensity"),te=R.paint.get("model-color").constantOr(o.al.white).toRenderColor(null),ie=R.paint.get("model-color-mix-intensity").constantOr(0);return{u_matrix:u,u_lighting_matrix:t,u_normal_matrix:r,u_node_matrix:c||sc,u_lightpos:q,u_lightintensity:F.properties.get("intensity"),u_lightcolor:[K.r,K.g,K.b],u_camera_pos:O,u_opacity:f,u_baseTextureIsAlpha:0,u_alphaMask:+J,u_alphaCutoff:I.alphaCutoff,u_baseColorFactor:[_.r,_.g,_.b,_.a],u_emissiveFactor:[T[0],T[1],T[2],1],u_metallicFactor:E,u_roughnessFactor:M,u_baseColorTexture:Ji.BaseColor,u_metallicRoughnessTexture:Ji.MetallicRoughness,u_normalTexture:Ji.Normal,u_occlusionTexture:Ji.Occlusion,u_emissionTexture:Ji.Emission,u_lutTexture:Ji.LUT,u_color_mix:[te.r,te.g,te.b,ie],u_aoIntensity:oe,u_emissive_strength:P,u_occlusionTextureTransform:N||[0,0,0,0]}},xd=(u,t=sc,r=sc)=>({u_matrix:u,u_instance:t,u_node_matrix:r}),Lu={fillExtrusion:u=>({u_matrix:new o.bJ(u),u_lightpos:new o.bL(u),u_lightintensity:new o.bM(u),u_lightcolor:new o.bL(u),u_vertical_gradient:new o.bM(u),u_opacity:new o.bM(u),u_edge_radius:new o.bM(u),u_width_scale:new o.bM(u),u_ao:new o.bK(u),u_height_type:new o.bN(u),u_base_type:new o.bN(u),u_tile_id:new o.bL(u),u_zoom_transition:new o.bM(u),u_inv_rot_matrix:new o.bJ(u),u_merc_center:new o.bK(u),u_up_dir:new o.bL(u),u_height_lift:new o.bM(u),u_flood_light_color:new o.bL(u),u_vertical_scale:new o.bM(u),u_flood_light_intensity:new o.bM(u),u_ground_shadow_factor:new o.bL(u)}),fillExtrusionDepth:u=>({u_matrix:new o.bJ(u),u_edge_radius:new o.bM(u),u_width_scale:new o.bM(u),u_vertical_scale:new o.bM(u),u_height_type:new o.bN(u),u_base_type:new o.bN(u)}),fillExtrusionPattern:u=>({u_matrix:new o.bJ(u),u_lightpos:new o.bL(u),u_lightintensity:new o.bM(u),u_lightcolor:new o.bL(u),u_vertical_gradient:new o.bM(u),u_height_factor:new o.bM(u),u_edge_radius:new o.bM(u),u_width_scale:new o.bM(u),u_ao:new o.bK(u),u_height_type:new o.bN(u),u_base_type:new o.bN(u),u_tile_id:new o.bL(u),u_zoom_transition:new o.bM(u),u_inv_rot_matrix:new o.bJ(u),u_merc_center:new o.bK(u),u_up_dir:new o.bL(u),u_height_lift:new o.bM(u),u_image:new o.bN(u),u_texsize:new o.bK(u),u_pixel_coord_upper:new o.bK(u),u_pixel_coord_lower:new o.bK(u),u_tile_units_to_pixels:new o.bM(u),u_opacity:new o.bM(u)}),fillExtrusionGroundEffect:u=>({u_matrix:new o.bJ(u),u_opacity:new o.bM(u),u_ao_pass:new o.bM(u),u_meter_to_tile:new o.bM(u),u_ao:new o.bK(u),u_flood_light_intensity:new o.bM(u),u_flood_light_color:new o.bL(u),u_attenuation:new o.bM(u),u_edge_radius:new o.bM(u),u_fb:new o.bN(u),u_fb_size:new o.bM(u),u_dynamic_offset:new o.bM(u)}),fill:u=>({u_matrix:new o.bJ(u),u_emissive_strength:new o.bM(u)}),fillPattern:u=>({u_matrix:new o.bJ(u),u_emissive_strength:new o.bM(u),u_image:new o.bN(u),u_texsize:new o.bK(u),u_pixel_coord_upper:new o.bK(u),u_pixel_coord_lower:new o.bK(u),u_tile_units_to_pixels:new o.bM(u)}),fillOutline:u=>({u_matrix:new o.bJ(u),u_emissive_strength:new o.bM(u),u_world:new o.bK(u)}),fillOutlinePattern:u=>({u_matrix:new o.bJ(u),u_emissive_strength:new o.bM(u),u_world:new o.bK(u),u_image:new o.bN(u),u_texsize:new o.bK(u),u_pixel_coord_upper:new o.bK(u),u_pixel_coord_lower:new o.bK(u),u_tile_units_to_pixels:new o.bM(u)}),elevatedStructures:u=>({u_matrix:new o.bJ(u)}),elevatedStructuresDepthReconstruct:u=>({u_matrix:new o.bJ(u),u_camera_pos:new o.bL(u),u_depth_bias:new o.bM(u),u_height_scale:new o.bM(u),u_reset_depth:new o.bM(u)}),circle:o.cT,collisionBox:u=>({u_matrix:new o.bJ(u),u_camera_to_center_distance:new o.bM(u),u_extrude_scale:new o.bK(u)}),collisionCircle:u=>({u_matrix:new o.bJ(u),u_inv_matrix:new o.bJ(u),u_camera_to_center_distance:new o.bM(u),u_viewport_size:new o.bK(u)}),debug:u=>({u_color:new o.cA(u),u_matrix:new o.bJ(u),u_overlay:new o.bN(u),u_overlay_scale:new o.bM(u)}),clippingMask:u=>({u_matrix:new o.bJ(u)}),heatmap:u=>({u_extrude_scale:new o.bM(u),u_intensity:new o.bM(u),u_matrix:new o.bJ(u),u_inv_rot_matrix:new o.bJ(u),u_merc_center:new o.bK(u),u_tile_id:new o.bL(u),u_zoom_transition:new o.bM(u),u_up_dir:new o.bL(u)}),heatmapTexture:u=>({u_image:new o.bN(u),u_color_ramp:new o.bN(u),u_opacity:new o.bM(u)}),hillshade:u=>({u_matrix:new o.bJ(u),u_image:new o.bN(u),u_latrange:new o.bK(u),u_light:new o.bK(u),u_shadow:new o.cA(u),u_highlight:new o.cA(u),u_emissive_strength:new o.bM(u),u_accent:new o.cA(u)}),hillshadePrepare:u=>({u_matrix:new o.bJ(u),u_image:new o.bN(u),u_dimension:new o.bK(u),u_zoom:new o.bM(u)}),line:o.cU,linePattern:o.cV,raster:u=>({u_matrix:new o.bJ(u),u_normalize_matrix:new o.bJ(u),u_globe_matrix:new o.bJ(u),u_merc_matrix:new o.bJ(u),u_grid_matrix:new o.cB(u),u_tl_parent:new o.bK(u),u_scale_parent:new o.bM(u),u_fade_t:new o.bM(u),u_opacity:new o.bM(u),u_image0:new o.bN(u),u_image1:new o.bN(u),u_brightness_low:new o.bM(u),u_brightness_high:new o.bM(u),u_saturation_factor:new o.bM(u),u_contrast_factor:new o.bM(u),u_spin_weights:new o.bL(u),u_perspective_transform:new o.bK(u),u_raster_elevation:new o.bM(u),u_zoom_transition:new o.bM(u),u_merc_center:new o.bK(u),u_cutoff_params:new o.cb(u),u_colorization_mix:new o.cb(u),u_colorization_offset:new o.bM(u),u_color_ramp:new o.bN(u),u_texture_offset:new o.bK(u),u_texture_res:new o.bK(u),u_emissive_strength:new o.bM(u)}),rasterParticle:u=>({u_matrix:new o.bJ(u),u_normalize_matrix:new o.bJ(u),u_globe_matrix:new o.bJ(u),u_merc_matrix:new o.bJ(u),u_grid_matrix:new o.cB(u),u_tl_parent:new o.bK(u),u_scale_parent:new o.bM(u),u_fade_t:new o.bM(u),u_opacity:new o.bM(u),u_image0:new o.bN(u),u_image1:new o.bN(u),u_raster_elevation:new o.bM(u),u_zoom_transition:new o.bM(u),u_merc_center:new o.bK(u),u_cutoff_params:new o.cb(u)}),rasterParticleTexture:u=>({u_texture:new o.bN(u),u_opacity:new o.bM(u)}),rasterParticleDraw:u=>({u_particle_texture:new o.bN(u),u_particle_texture_side_len:new o.bM(u),u_tile_offset:new o.bK(u),u_velocity:new o.bN(u),u_color_ramp:new o.bN(u),u_velocity_res:new o.bK(u),u_max_speed:new o.bM(u),u_uv_offset:new o.bK(u),u_data_scale:new o.bK(u),u_data_offset:new o.bM(u),u_particle_pos_scale:new o.bM(u),u_particle_pos_offset:new o.bK(u)}),rasterParticleUpdate:u=>({u_particle_texture:new o.bN(u),u_particle_texture_side_len:new o.bM(u),u_velocity:new o.bN(u),u_velocity_res:new o.bK(u),u_max_speed:new o.bM(u),u_speed_factor:new o.bM(u),u_reset_rate:new o.bM(u),u_rand_seed:new o.bM(u),u_uv_offset:new o.bK(u),u_data_scale:new o.bK(u),u_data_offset:new o.bM(u),u_particle_pos_scale:new o.bM(u),u_particle_pos_offset:new o.bK(u)}),symbol:u=>({u_is_size_zoom_constant:new o.bN(u),u_is_size_feature_constant:new o.bN(u),u_size_t:new o.bM(u),u_size:new o.bM(u),u_camera_to_center_distance:new o.bM(u),u_rotate_symbol:new o.bN(u),u_aspect_ratio:new o.bM(u),u_fade_change:new o.bM(u),u_matrix:new o.bJ(u),u_label_plane_matrix:new o.bJ(u),u_coord_matrix:new o.bJ(u),u_is_text:new o.bN(u),u_elevation_from_sea:new o.bN(u),u_pitch_with_map:new o.bN(u),u_texsize:new o.bK(u),u_texsize_icon:new o.bK(u),u_texture:new o.bN(u),u_texture_icon:new o.bN(u),u_gamma_scale:new o.bM(u),u_device_pixel_ratio:new o.bM(u),u_tile_id:new o.bL(u),u_zoom_transition:new o.bM(u),u_inv_rot_matrix:new o.bJ(u),u_merc_center:new o.bK(u),u_camera_forward:new o.bL(u),u_tile_matrix:new o.bJ(u),u_up_vector:new o.bL(u),u_ecef_origin:new o.bL(u),u_is_halo:new o.bN(u),u_icon_transition:new o.bM(u),u_color_adj_mat:new o.bJ(u),u_scale_factor:new o.bM(u)}),background:u=>({u_matrix:new o.bJ(u),u_emissive_strength:new o.bM(u),u_opacity:new o.bM(u),u_color:new o.cA(u)}),backgroundPattern:u=>({u_matrix:new o.bJ(u),u_emissive_strength:new o.bM(u),u_opacity:new o.bM(u),u_image:new o.bN(u),u_pattern_tl:new o.bK(u),u_pattern_br:new o.bK(u),u_texsize:new o.bK(u),u_pattern_size:new o.bK(u),u_pixel_coord_upper:new o.bK(u),u_pixel_coord_lower:new o.bK(u),u_pattern_units_to_pixels:new o.bK(u)}),terrainRaster:u=>({u_matrix:new o.bJ(u),u_image0:new o.bN(u),u_skirt_height:new o.bM(u),u_ground_shadow_factor:new o.bL(u)}),skybox:u=>({u_matrix:new o.bJ(u),u_sun_direction:new o.bL(u),u_cubemap:new o.bN(u),u_opacity:new o.bM(u),u_temporal_offset:new o.bM(u)}),skyboxGradient:u=>({u_matrix:new o.bJ(u),u_color_ramp:new o.bN(u),u_center_direction:new o.bL(u),u_radius:new o.bM(u),u_opacity:new o.bM(u),u_temporal_offset:new o.bM(u)}),skyboxCapture:u=>({u_matrix_3f:new o.cB(u),u_sun_direction:new o.bL(u),u_sun_intensity:new o.bM(u),u_color_tint_r:new o.cb(u),u_color_tint_m:new o.cb(u),u_luminance:new o.bM(u)}),globeRaster:u=>({u_proj_matrix:new o.bJ(u),u_globe_matrix:new o.bJ(u),u_normalize_matrix:new o.bJ(u),u_merc_matrix:new o.bJ(u),u_zoom_transition:new o.bM(u),u_merc_center:new o.bK(u),u_image0:new o.bN(u),u_grid_matrix:new o.cB(u),u_skirt_height:new o.bM(u),u_far_z_cutoff:new o.bM(u),u_frustum_tl:new o.bL(u),u_frustum_tr:new o.bL(u),u_frustum_br:new o.bL(u),u_frustum_bl:new o.bL(u),u_globe_pos:new o.bL(u),u_globe_radius:new o.bM(u),u_viewport:new o.bK(u)}),globeAtmosphere:u=>({u_frustum_tl:new o.bL(u),u_frustum_tr:new o.bL(u),u_frustum_br:new o.bL(u),u_frustum_bl:new o.bL(u),u_horizon:new o.bM(u),u_transition:new o.bM(u),u_fadeout_range:new o.bM(u),u_color:new o.cb(u),u_high_color:new o.cb(u),u_space_color:new o.cb(u),u_temporal_offset:new o.bM(u),u_horizon_angle:new o.bM(u)}),model:u=>({u_matrix:new o.bJ(u),u_lighting_matrix:new o.bJ(u),u_normal_matrix:new o.bJ(u),u_node_matrix:new o.bJ(u),u_lightpos:new o.bL(u),u_lightintensity:new o.bM(u),u_lightcolor:new o.bL(u),u_camera_pos:new o.bL(u),u_opacity:new o.bM(u),u_baseColorFactor:new o.cb(u),u_emissiveFactor:new o.cb(u),u_metallicFactor:new o.bM(u),u_roughnessFactor:new o.bM(u),u_baseTextureIsAlpha:new o.bN(u),u_alphaMask:new o.bN(u),u_alphaCutoff:new o.bM(u),u_baseColorTexture:new o.bN(u),u_metallicRoughnessTexture:new o.bN(u),u_normalTexture:new o.bN(u),u_occlusionTexture:new o.bN(u),u_emissionTexture:new o.bN(u),u_lutTexture:new o.bN(u),u_color_mix:new o.cb(u),u_aoIntensity:new o.bM(u),u_emissive_strength:new o.bM(u),u_occlusionTextureTransform:new o.cb(u)}),modelDepth:u=>({u_matrix:new o.bJ(u),u_instance:new o.bJ(u),u_node_matrix:new o.bJ(u)}),groundShadow:u=>({u_matrix:new o.bJ(u),u_ground_shadow_factor:new o.bL(u)}),stars:u=>({u_matrix:new o.bJ(u),u_up:new o.bL(u),u_right:new o.bL(u),u_intensity_multiplier:new o.bM(u)}),snowParticle:u=>({u_modelview:new o.bJ(u),u_projection:new o.bJ(u),u_time:new o.bM(u),u_cam_pos:new o.bL(u),u_velocityConeAperture:new o.bM(u),u_velocity:new o.bM(u),u_horizontalOscillationRadius:new o.bM(u),u_horizontalOscillationRate:new o.bM(u),u_boxSize:new o.bM(u),u_billboardSize:new o.bM(u),u_simpleShapeParameters:new o.bK(u),u_screenSize:new o.bK(u),u_thinningCenterPos:new o.bK(u),u_thinningShape:new o.bL(u),u_thinningAffectedRatio:new o.bM(u),u_thinningParticleOffset:new o.bM(u),u_particleColor:new o.cb(u),u_direction:new o.bL(u)}),rainParticle:u=>({u_modelview:new o.bJ(u),u_projection:new o.bJ(u),u_time:new o.bM(u),u_cam_pos:new o.bL(u),u_texScreen:new o.bN(u),u_velocityConeAperture:new o.bM(u),u_velocity:new o.bM(u),u_boxSize:new o.bM(u),u_rainDropletSize:new o.bK(u),u_distortionStrength:new o.bM(u),u_rainDirection:new o.bL(u),u_color:new o.cb(u),u_screenSize:new o.bK(u),u_thinningCenterPos:new o.bK(u),u_thinningShape:new o.bL(u),u_thinningAffectedRatio:new o.bM(u),u_thinningParticleOffset:new o.bM(u),u_shapeDirectionalPower:new o.bM(u),u_shapeNormalPower:new o.bM(u),u_mode:new o.bM(u)}),vignette:u=>({u_vignetteShape:new o.bL(u),u_vignetteColor:new o.cb(u)}),occlusion:u=>({u_matrix:new o.bJ(u),u_anchorPos:new o.bL(u),u_screenSizePx:new o.bK(u),u_occluderSizePx:new o.bK(u),u_color:new o.cb(u)})};class Jn{constructor(t,r,c,d){this.id=Jn.uniqueIdxCounter,Jn.uniqueIdxCounter++,this.context=t;const f=t.gl;this.buffer=f.createBuffer(),this.dynamicDraw=!!c,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),f.bufferData(f.ELEMENT_ARRAY_BUFFER,r.arrayBuffer,this.dynamicDraw?f.DYNAMIC_DRAW:f.STATIC_DRAW),this.dynamicDraw||d||r.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){this.id=Jn.uniqueIdxCounter,Jn.uniqueIdxCounter++;const r=this.context.gl;this.context.unbindVAO(),this.bind(),r.bufferSubData(r.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}Jn.uniqueIdxCounter=0;const Du={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Ou{constructor(t,r,c,d,f,_){this.length=r.length,this.attributes=c,this.itemSize=r.bytesPerElement,this.dynamicDraw=d,this.instanceCount=_,this.context=t;const T=t.gl;this.buffer=T.createBuffer(),t.bindVertexBuffer.set(this.buffer),T.bufferData(T.ARRAY_BUFFER,r.arrayBuffer,this.dynamicDraw?T.DYNAMIC_DRAW:T.STATIC_DRAW),this.dynamicDraw||f||r.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){const r=this.context.gl;this.bind(),r.bufferSubData(r.ARRAY_BUFFER,0,t.arrayBuffer)}
2476enableAttributes(t,r){for(let c=0;c<this.attributes.length;c++){const d=r.attributes[this.attributes[c].name];d!==void 0&&t.enableVertexAttribArray(d)}}setVertexAttribPointers(t,r,c){for(let d=0;d<this.attributes.length;d++){const f=this.attributes[d],_=r.attributes[f.name];_!==void 0&&t.vertexAttribPointer(_,f.components,t[Du[f.type]],!1,this.itemSize,f.offset+this.itemSize*(c||0))}}setVertexAttribDivisor(t,r,c){for(let d=0;d<this.attributes.length;d++){const f=r.attributes[this.attributes[d].name];f!==void 0&&this.instanceCount&&this.instanceCount>0&&t.vertexAttribDivisor(f,c)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Yr{constructor(t,r,c,d,f){this.context=t,this.width=r,this.height=c;const _=this.framebuffer=t.gl.createFramebuffer();d&&(this.colorAttachment=new yu(t,_)),f&&(this.depthAttachmentType=f,this.depthAttachment=f==="renderbuffer"?new vu(t,_):new Yo(t,_))}destroy(){const t=this.context.gl;if(this.colorAttachment){const r=this.colorAttachment.get();r&&t.deleteTexture(r)}if(this.depthAttachment&&this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const r=this.depthAttachment.get();r&&t.deleteRenderbuffer(r)}else{const r=this.depthAttachment.get();r&&t.deleteTexture(r)}t.deleteFramebuffer(this.framebuffer)}}class qs{constructor(t,r){this.gl=t,this.clearColor=new of(this),this.clearDepth=new lu(this),this.clearStencil=new cu(this),this.colorMask=new uu(this),this.depthMask=new hu(this),this.stencilMask=new sd(this),this.stencilFunc=new od(this),this.stencilOp=new af(this),this.stencilTest=new Za(this),this.depthRange=new Wa(this),this.depthTest=new ad(this),this.depthFunc=new fn(this),this.blend=new du(this),this.blendFunc=new Hl(this),this.blendColor=new Zl(this),this.blendEquation=new pu(this),this.cullFace=new fu(this),this.cullFaceSide=new mu(this),this.frontFace=new Wl(this),this.program=new _u(this),this.activeTexture=new gu(this),this.viewport=new Xl(this),this.bindFramebuffer=new ld(this),this.bindRenderbuffer=new cd(this),this.bindTexture=new Xo(this),this.bindVertexBuffer=new lf(this),this.bindElementBuffer=new cf(this),this.bindVertexArrayOES=new uf(this),this.pixelStoreUnpack=new hf(this),this.pixelStoreUnpackPremultiplyAlpha=new df(this),this.pixelStoreUnpackFlipY=new pf(this),this.options=r?Object.assign({},r):{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=t.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=t.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=t.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.forceManualRenderingForInstanceIDShaders=r&&!!r.forceManualRenderingForInstanceIDShaders||this.renderer&&this.renderer.indexOf("PowerVR")!==-1,this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=t.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),this.maxPointSize=t.getParameter(t.ALIASED_POINT_SIZE_RANGE)[1]}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,r,c){return new Jn(this,t,r,c)}createVertexBuffer(t,r,c,d,f){return new Ou(this,t,r,c,d,f)}createRenderbuffer(t,r,c){const d=this.gl,f=d.createRenderbuffer();return this.bindRenderbuffer.set(f),d.renderbufferStorage(d.RENDERBUFFER,t,r,c),this.bindRenderbuffer.set(null),f}createFramebuffer(t,r,c,d){return new Yr(this,t,r,c,d)}clear({color:t,depth:r,stencil:c,colorMask:d}){const f=this.gl;let _=0;t&&(_|=f.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set(d||[!0,!0,!0,!0])),r!==void 0&&(_|=f.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(r),this.depthMask.set(!0)),c!==void 0&&(_|=f.STENCIL_BUFFER_BIT,this.clearStencil.set(c),this.stencilMask.set(255)),f.clear(_)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){o.bn(t.blendFunction,ii.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor),t.blendEquation?this.blendEquation.set(t.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(t.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}let Ja;function oc(u,t,r,c,d,f,_){const T=u.context,E=T.gl,M=u.transform,I=u.getOrCreateProgram("collisionBox"),P=[];let R=0,O=0;for(let K=0;K<c.length;K++){const oe=c[K],te=t.getTile(oe),ie=te.getBucket(r);
2476if(!ie)continue;const re=Qc(oe,ie,M);let ue=re;d[0]===0&&d[1]===0||(ue=u.translatePosMatrix(re,te,d,f));const me=_?ie.textCollisionBox:ie.iconCollisionBox,Le=ie.collisionCircleArray;if(Le.length>0){const Ee=o.ad.mat4.create(),Ze=ue;o.ad.mat4.mul(Ee,ie.placementInvProjMatrix,M.glCoordMatrix),o.ad.mat4.mul(Ee,Ee,ie.placementViewportMatrix),P.push({circleArray:Le,circleOffset:O,transform:Ze,invTransform:Ee,projection:ie.getProjection()}),R+=Le.length/4,O=R}me&&(u.terrain&&u.terrain.setupElevationDraw(te,I),I.draw(u,E.LINES,Pt.disabled,$t.disabled,u.colorModeForRenderPass(),jt.disabled,_d(ue,M,te,ie.getProjection()),r.id,me.layoutVertexBuffer,me.indexBuffer,me.segments,null,M.zoom,null,[me.collisionVertexBuffer,me.collisionVertexBufferExt]))}if(!_||!P.length)return;const N=u.getOrCreateProgram("collisionCircle"),F=new o.cW;F.resize(4*R),F._trim();let U=0;for(const K of P)for(let oe=0;oe<K.circleArray.length/4;oe++){const te=4*oe,ie=K.circleArray[te+0],re=K.circleArray[te+1],ue=K.circleArray[te+2],me=K.circleArray[te+3];F.emplace(U++,ie,re,ue,me,0),F.emplace(U++,ie,re,ue,me,1),F.emplace(U++,ie,re,ue,me,2),F.emplace(U++,ie,re,ue,me,3)}(!Ja||Ja.length<2*R)&&(Ja=function(K){const oe=2*K,te=new o.aV;te.resize(oe),te._trim();for(let ie=0;ie<oe;ie++){const re=6*ie;te.uint16[re+0]=4*ie+0,te.uint16[re+1]=4*ie+1,te.uint16[re+2]=4*ie+2,te.uint16[re+3]=4*ie+2,te.uint16[re+4]=4*ie+3,te.uint16[re+5]=4*ie+0}return te}(R));const q=T.createIndexBuffer(Ja,!0),Z=T.createVertexBuffer(F,o.cX.members,!0);for(const K of P){const oe={u_matrix:K.transform,u_inv_matrix:K.invTransform,u_camera_to_center_distance:(J=M).getCameraToCenterDistance(K.projection),u_viewport_size:[J.width,J.height]};N.draw(u,E.TRIANGLES,Pt.disabled,$t.disabled,u.colorModeForRenderPass(),jt.disabled,oe,r.id,Z,q,o.b8.simpleSegment(0,2*K.circleOffset,K.circleArray.length,K.circleArray.length/2),null,M.zoom)}var J;Z.destroy(),q.destroy()}const ta=o.ad.mat4.create();function ac(u){const t=u._camera.getWorldToCamera(u.worldSize,1),r=o.ad.mat4.multiply([],t,u.globeMatrix);o.ad.mat4.invert(r,r);const c=[0,0,0],d=[0,1,0,0];return o.ad.vec4.transformMat4(d,d,r),c[0]=d[0],c[1]=d[1],c[2]=d[2],o.ad.vec3.normalize(c,c),c}function bd({width:u,height:t,anchor:r,textOffset:c,textScale:d},f){const{horizontalAlign:_,verticalAlign:T}=o.bD(r),E=-(_-.5)*u,M=-(T-.5)*t,I=o.bC(r,c);return new o.P((E/d+I[0])*f,(M/d+I[1])*f)}function In(u,t,r,c,d,f,_,T,E,M,I){const P=u.text.placedSymbolArray,R=u.text.dynamicLayoutVertexArray,O=u.icon.dynamicLayoutVertexArray,N={},F=u.getProjection(),U=pn(T,F,f),q=f.elevation,Z=F.upVectorScale(T.canonical,f.center.lat,f.worldSize).metersToTile;R.clear();for(let J=0;J<P.length;J++){const K=P.get(J),{tileAnchorX:oe,tileAnchorY:te,numGlyphs:ie}=K,re=K.hidden||!K.crossTileID||u.allowVerticalPlacement&&!K.placedOrientation?null:c[K.crossTileID];if(re){let ue=0,me=0,Le=0;if(q){const Ve=q?q.getAtTileOffset(T,oe,te):0,[Ke,De,Qe]=F.upVector(T.canonical,oe,te);ue=Ve*Ke*Z,me=Ve*De*Z,Le=Ve*Qe*Z}let[Ee,Ze,We,ot]=Fn(K.projectedAnchorX+ue,K.projectedAnchorY+me,K.projectedAnchorZ+Le,r?U:_);const Se=Fo(f.getCameraToCenterDistance(F),ot);let He=d.evaluateSizeForFeature(u.textSizeData,M,K)*Se/o.bw;r&&(He*=u.tilePixelRatio/E);const we=bd(re,He);r?({x:Ee,y:Ze,z:We}=F.projectTilePoint(oe+we.x,te+we.y,T.canonical),[Ee,Ze,We]=Fn(Ee+ue,Ze+me,We+Le,_)):(t&&we._rotate(-f.angle),Ee+=we.x,Ze+=we.y,We=0);const $e=u.allowVerticalPlacement&&K.placedOrientation===o.bq.vertical?Math.PI/2:0;for(let Ve=0;Ve<ie;Ve++)o.bt(R,Ee,Ze,We,$e);I&&K.associatedIconIndex>=0&&(N[K.associatedIconIndex]={x:Ee,y:Ze,z:We,angle:$e})}else Bn(ie,R)}if(I){O.clear();const J=u.icon.placedSymbolArray;for(let K=0;K<J.length;K++){const oe=J.get(K),{numGlyphs:te}=oe,ie=N[K];if(oe.hidden||!ie)Bn(te,O);else{const{x:re,y:ue,z:me,angle:Le}=ie;for(let Ee=0;Ee<te;Ee++)o.bt(O,re,ue,me,Le)}}u.icon.dynamicLayoutVertexBuffer.updateData(O)}u.text.dynamicLayoutVertexBuffer.updateData(R)}function zi(u,t,r,c,d,f,_={}){const T=r.paint.get("icon-translate"),E=r.paint.get("text-translate"),M=r.paint.get("icon-translate-anchor"),I=r.paint.get("text-translate-anchor"),P=r.layout.get("icon-rotation-alignment"),R=r.layout.get("text-rotation-alignment"),O=r.layout.get("icon-pitch-alignment"),N=r.layout.get("text-pitch-alignment"),F=r.layout.get("icon-keep-upright"),U=r.layout.get("text-keep-upright"),q=r.paint.get("icon-color-saturation"),Z=r.paint.get("icon-color-contrast"),J=r.paint.get("icon-color-brightness-min"),K=r.paint.get("icon-color-brightness-max"),oe=r.layout.get("symbol-elevation-reference")==="sea",te=u.context,ie=te.gl,re=u.transform,ue=P==="map",me=R==="map",Le=O==="map",Ee=N==="map",Ze=r.layout.get("symbol-sort-key").constantOr(1)!==void 0;let We=!1;const ot=u.depthModeForSublayer(0,Pt.ReadOnly),Se=[o.av(re.center.lng),o.aC(re.center.lat)],He=r.layout.get("text-variable-anchor"),we=re.projection.name==="globe",$e=[],Ve=[0,-1,0];for(const Ke of c){const De=t.getTile(Ke),Qe=De.getBucket(r);
2476if(!Qe||Qe.projection.name==="mercator"&&we||Qe.fullyClipped)continue;const pt=Qe.projection.name==="globe",ft=pt?o.ag(re.zoom):0,mt=pn(Ke,Qe.getProjection(),re),Et=re.calculatePixelsToTileUnitsMatrix(De),qt=He&&Qe.hasTextData(),Lt=Qe.hasIconTextFit()&&qt&&Qe.hasIconData(),Vt=Qe.getProjection().createInversionMatrix(re,Ke.canonical),kt=Ii=>{re.depthOcclusionForSymbolsAndCircles&&(r.hasInitialOcclusionOpacityProperties||u.terrain)&&(Ii.push("DEPTH_D24"),Ii.push("DEPTH_OCCLUSION"))},ai=()=>{const Ii=ue&&r.layout.get("symbol-placement")!=="point",fi=[];kt(fi);const Yi=Ii||Lt,nr=r.paint.get("icon-image-cross-fade").constantOr(0);u.terrainRenderModeElevated()&&Le&&fi.push("PITCH_WITH_MAP_TERRAIN"),pt&&(fi.push("PROJECTION_GLOBE_VIEW"),Yi&&fi.push("PROJECTED_POS_ON_VIEWPORT")),nr>0&&fi.push("ICON_TRANSITION"),Qe.icon.zOffsetVertexBuffer&&fi.push("Z_OFFSET"),q===0&&Z===0&&J===0&&K===1||fi.push("COLOR_ADJUSTMENT"),Qe.sdfIcons&&fi.push("RENDER_SDF");const cr=Qe.icon.programConfigurations.get(r.id),hr=u.getOrCreateProgram("symbol",{config:cr,defines:fi}),yn=De.imageAtlasTexture?De.imageAtlasTexture.size:[0,0],kr=Qe.iconSizeData,di=o.bp(kr,re.zoom),qi=Le||re.pitch!==0,bi=cs(mt,De.tileID.canonical,Le,ue,re,Qe.getProjection(),Et),Pi=er(mt,De.tileID.canonical,Le,ue,re,Qe.getProjection(),Et),Er=u.translatePosMatrix(Pi,De,T,M,!0),Fi=u.translatePosMatrix(mt,De,T,M),ur=Yi?ta:bi,ts=ue&&!Le&&!Ii;let an=Ve;!we&&!re.mercatorFromTransition||ue||(an=ac(re));const Pn=pt?an:Ve,Kr=r.getColorAdjustmentMatrix(q,Z,J,K),Rn=nc(kr.kind,di,ts,Le,u,Fi,ur,Er,oe,!1,yn,[0,0],!0,Ke,ft,Se,Vt,Pn,Qe.getProjection(),Kr,nr),ln=De.imageAtlasTexture?De.imageAtlasTexture:null,ws=r.layout.get("icon-size").constantOr(0)!==1||Qe.iconsNeedLinear,is=Qe.sdfIcons||u.options.rotating||u.options.zooming||ws||qi?ie.LINEAR:ie.NEAREST,Ts=Qe.sdfIcons&&r.paint.get("icon-halo-width").constantOr(1)!==0,ah=u.terrain&&Le&&Ii?o.ad.mat4.invert(o.ad.mat4.create(),bi):ta;if(Ii&&Qe.icon){const ma=re.elevation,Ec=ma?ma.getAtTileOffsetFunc(Ke,re.center.lat,re.worldSize,Qe.getProjection()):null,lh=Ir(mt,De.tileID.canonical,Le,ue,re,Qe.getProjection(),Et);Bo(Qe,mt,u,!1,lh,Pi,Le,F,Ec,Ke)}return{program:hr,buffers:Qe.icon,uniformValues:Rn,atlasTexture:ln,atlasTextureIcon:null,atlasInterpolation:is,atlasInterpolationIcon:null,isSDF:Qe.sdfIcons,hasHalo:Ts,tile:De,labelPlaneMatrixInv:ah}},xi=()=>{const Ii=me&&r.layout.get("symbol-placement")!=="point",fi=[],Yi=Ii||He||Lt;u.terrainRenderModeElevated()&&Ee&&fi.push("PITCH_WITH_MAP_TERRAIN"),pt&&(fi.push("PROJECTION_GLOBE_VIEW"),Yi&&fi.push("PROJECTED_POS_ON_VIEWPORT")),Qe.text.zOffsetVertexBuffer&&fi.push("Z_OFFSET"),Qe.iconsInText&&fi.push("RENDER_TEXT_AND_SYMBOL"),fi.push("RENDER_SDF"),kt(fi);const nr=Qe.text.programConfigurations.get(r.id),cr=u.getOrCreateProgram("symbol",{config:nr,defines:fi});let hr,yn=[0,0],kr=null;const di=Qe.textSizeData;Qe.iconsInText&&(yn=De.imageAtlasTexture?De.imageAtlasTexture.size:[0,0],kr=De.imageAtlasTexture?De.imageAtlasTexture:null,hr=Ee||re.pitch!==0||u.options.rotating||u.options.zooming||di.kind==="composite"||di.kind==="camera"?ie.LINEAR:ie.NEAREST);const qi=De.glyphAtlasTexture?De.glyphAtlasTexture.size:[0,0],bi=r.layout.get("text-size-scale-range"),Pi=o.ay(u.scaleFactor,bi[0],bi[1]),Er=o.bp(di,re.zoom,Pi),Fi=cs(mt,De.tileID.canonical,Ee,me,re,Qe.getProjection(),Et),ur=er(mt,De.tileID.canonical,Ee,me,re,Qe.getProjection(),Et),ts=u.translatePosMatrix(ur,De,E,I,!0),an=u.translatePosMatrix(mt,De,E,I),Pn=Yi?ta:Fi,Kr=me&&!Ee&&!Ii;let Rn=Ve;!we&&!re.mercatorFromTransition||me||(Rn=ac(re));const ln=nc(di.kind,Er,Kr,Ee,u,an,Pn,ts,oe,!0,qi,yn,!0,Ke,ft,Se,Vt,pt?Rn:Ve,Qe.getProjection(),null,null,Pi),ws=De.glyphAtlasTexture?De.glyphAtlasTexture:null,is=ie.LINEAR,Ts=r.paint.get("text-halo-width").constantOr(1)!==0,ah=u.terrain&&Ee&&Ii?o.ad.mat4.invert(o.ad.mat4.create(),Fi):ta;if(Ii&&Qe.text){const ma=re.elevation,Ec=ma?ma.getAtTileOffsetFunc(Ke,re.center.lat,re.worldSize,Qe.getProjection()):null,lh=Ir(mt,De.tileID.canonical,Ee,me,re,Qe.getProjection(),Et);Bo(Qe,mt,u,!0,lh,ur,Ee,U,Ec,Ke)}return{program:cr,buffers:Qe.text,uniformValues:ln,atlasTexture:ws,atlasTextureIcon:kr,atlasInterpolation:is,atlasInterpolationIcon:hr,isSDF:!0,hasHalo:Ts,tile:
2476De,labelPlaneMatrixInv:ah}},Di=Qe.icon.segments.get().length,ei=Qe.text.segments.get().length,ji=Di&&!_.onlyText?ai():null,Ht=ei&&!_.onlyIcons?xi():null,Mt=r.paint.get("icon-opacity").constantOr(1),ci=r.paint.get("text-opacity").constantOr(1);if(Ze&&Qe.canOverlap){We=!0;const Ii=Mt&&!_.onlyText?Qe.icon.segments.get():[],fi=ci&&!_.onlyIcons?Qe.text.segments.get():[];for(const Yi of Ii)$e.push({segments:new o.b8([Yi]),sortKey:Yi.sortKey,state:ji});for(const Yi of fi)$e.push({segments:new o.b8([Yi]),sortKey:Yi.sortKey,state:Ht})}else _.onlyText||$e.push({segments:Mt?Qe.icon.segments:new o.b8([]),sortKey:0,state:ji}),_.onlyIcons||$e.push({segments:ci?Qe.text.segments:new o.b8([]),sortKey:0,state:Ht})}We&&$e.sort((Ke,De)=>Ke.sortKey-De.sortKey);for(const Ke of $e){const De=Ke.state;if(De)if(u.terrain?u.terrain.setupElevationDraw(De.tile,De.program,{useDepthForOcclusion:re.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:De.labelPlaneMatrixInv}):u.setupDepthForOcclusion(re.depthOcclusionForSymbolsAndCircles,De.program),te.activeTexture.set(ie.TEXTURE0),De.atlasTexture&&De.atlasTexture.bind(De.atlasInterpolation,ie.CLAMP_TO_EDGE,!0),De.atlasTextureIcon&&(te.activeTexture.set(ie.TEXTURE1),De.atlasTextureIcon&&De.atlasTextureIcon.bind(De.atlasInterpolationIcon,ie.CLAMP_TO_EDGE,!0)),u.uploadCommonLightUniforms(u.context,De.program),De.hasHalo){const Qe=De.uniformValues;Qe.u_is_halo=1,ia(De.buffers,Ke.segments,r,u,De.program,ot,d,f,Qe,2),Qe.u_is_halo=0}else{if(De.isSDF){const Qe=De.uniformValues;De.hasHalo&&(Qe.u_is_halo=1,ia(De.buffers,Ke.segments,r,u,De.program,ot,d,f,Qe,1)),Qe.u_is_halo=0}ia(De.buffers,Ke.segments,r,u,De.program,ot,d,f,De.uniformValues,1)}}}function ia(u,t,r,c,d,f,_,T,E,M){const I=[u.dynamicLayoutVertexBuffer,u.opacityVertexBuffer,u.iconTransitioningVertexBuffer,u.globeExtVertexBuffer,u.zOffsetVertexBuffer];d.draw(c,c.context.gl.TRIANGLES,f,_,T,jt.disabled,E,r.id,u.layoutVertexBuffer,u.indexBuffer,t,r.paint,c.transform.zoom,u.programConfigurations.get(r.id),I,M)}function ku(u,t){const r=1<<u.canonical.z,c=(t.x*r-u.canonical.x-u.wrap*r)*o.ai,d=(t.y*r-u.canonical.y)*o.ai,f=o.d5(t.z,t.y);return o.ad.vec3.fromValues(c,d,f)}function Fu(u,t,r,c,d){if(!r.layout||r.layout.get("fill-elevation-reference")==="none")return;const f=u.context.gl,_=new Pt(u.context.gl.LEQUAL,Pt.ReadWrite,u.depthRangeFor3D),T=new Pt(u.context.gl.GREATER,Pt.ReadWrite,u.depthRangeFor3D),E=function(O){const N=o.c4(O.pitch);let F=.01;return O.isOrthographic&&(F=o.ah(1e-4,F,o.c9(N>=ht?1:N/ht))),2*F}(u.transform),M=u.transform.getFreeCameraOptions().position,I="elevatedStructuresDepthReconstruct",P=u.getOrCreateProgram(I,{defines:["DEPTH_RECONSTRUCTION"]}),R=u.getOrCreateProgram(I);for(const O of c){const N=t.getTile(O),F=N.getBucket(r);if(!F)continue;const U=F.elevatedStructures;if(!U)continue;const q=F.elevationBufferData.heightRange,Z=ku(O.toUnwrapped(),M),J=u.translatePosMatrix(O.projMatrix,N,r.paint.get("fill-translate"),r.paint.get("fill-translate-anchor"));let K,oe,te,ie;if(d==="initialize"){if(!q||q.min>=1||U.depthSegments.segments[0].primitiveLength===0)continue;K=Ka(J,Z,E,1,0),oe=_,te=U.depthSegments,ie=P}else if(d==="reset"){if(!q||q.min>=0||U.maskSegments.segments[0].primitiveLength===0)continue;K=Ka(J,Z,0,0,1),oe=T,te=U.maskSegments,ie=P}else if(d==="geometry"){if(U.depthSegments.segments[0].primitiveLength===0)continue;K=Ka(J,Z,E,1,0),oe=_,te=U.depthSegments,ie=R}ie.draw(u,f.TRIANGLES,oe,$t.disabled,ii.disabled,jt.disabled,K,r.id,U.vertexBuffer,U.indexBuffer,te,r.paint,u.transform.zoom)}}function lc(u,t,r){const{painter:c,sourceCache:d,layer:f,coords:_,colorMode:T,elevationType:E,terrainEnabled:M,pass:I}=u,P=c.context.gl,R=f.paint.get("fill-pattern");let O=E;E!=="road"||t&&!M||(O="none");const N=O==="road",F=new Pt(c.context.gl.LEQUAL,Pt.ReadWrite,c.depthRangeFor3D),U=R&&R.constantOr(1),q=(Z,J)=>{let K,oe,te,ie,re;J?(oe=U&&!f.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",K=P.LINES):(oe=U?"fillPattern":"fill",K=P.TRIANGLES);for(const ue of _){const me=d.getTile(ue);if(U&&!me.patternsLoaded())continue;const Le=me.getBucket(f);if(!Le)continue;const Ee=t?Le.elevationBufferData:Le.bufferData;if(Ee.isEmpty())continue;c.prepareDrawTile();const Ze=Ee.programConfigurations.get(f.id),We=c.isTileAffectedByFog(ue),ot=[],Se=[];N&&(ot.push("ELEVATED_ROADS"),Se.push(Ee.elevatedLayoutVertexBuffer));const He=c.getOrCreateProgram(oe,{config:Ze,overrideFog:We,defines:ot});
2476U&&(c.context.activeTexture.set(P.TEXTURE0),me.imageAtlasTexture&&me.imageAtlasTexture.bind(P.LINEAR,P.CLAMP_TO_EDGE),Ze.updatePaintBuffers());const we=R.constantOr(null);if(we&&me.imageAtlas){const Ke=me.imageAtlas,De=o.d0.from(we).getPrimary().scaleSelf(o.q.devicePixelRatio).toString(),Qe=Ke.patternPositions.get(De);Qe&&Ze.setConstantPatternPositions(Qe)}const $e=c.translatePosMatrix(ue.projMatrix,me,f.paint.get("fill-translate"),f.paint.get("fill-translate-anchor")),Ve=f.paint.get("fill-emissive-strength");if(J){ie=Ee.lineIndexBuffer,re=Ee.lineSegments;const Ke=c.terrain&&c.terrain.renderingToTexture?c.terrain.drapeBufferSize:[P.drawingBufferWidth,P.drawingBufferHeight];te=oe==="fillOutlinePattern"&&U?ic($e,Ve,c,me,Ke):tc($e,Ve,Ke)}else ie=Ee.indexBuffer,re=Ee.triangleSegments,te=U?Iu($e,Ve,c,me):Qo($e,Ve);c.uploadCommonUniforms(c.context,He,ue.toUnwrapped()),He.draw(c,K,O!=="none"?F:Z,r||c.stencilModeForClipping(ue),T,jt.disabled,te,f.id,Ee.layoutVertexBuffer,ie,re,f.paint,c.transform.zoom,Ze,Se)}};c.renderPass===I&&q(c.depthModeForSublayer(1,c.renderPass==="opaque"?Pt.ReadWrite:Pt.ReadOnly),!1),O==="none"&&c.renderPass==="translucent"&&f.paint.get("fill-antialias")&&q(c.depthModeForSublayer(f.getPaintProperty("fill-outline-color")?2:0,Pt.ReadOnly),!0)}function Qa(u,t,r,c,d,f,_,T){r.resetLayerRenderingStats(u);const E=u.context,M=E.gl,I=u.transform,P=r.paint.get("fill-extrusion-pattern"),R=P.constantOr(1),O=r.paint.get("fill-extrusion-opacity"),N=u.style.enable3dLights(),F=r.paint.get(N&&!R?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),U=[r.paint.get("fill-extrusion-ambient-occlusion-intensity"),F],q=r.layout.get("fill-extrusion-edge-radius"),Z=q>0&&!r.paint.get("fill-extrusion-rounded-roof"),J=Z?0:q,K=I.projection.name==="globe"?o.d6():0,oe=I.projection.name==="globe",te=oe?o.ag(I.zoom):0,ie=[o.av(I.center.lng),o.aC(I.center.lat)],re=r.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",ue=r.paint.get("fill-extrusion-flood-light-color").toRenderColor(re?null:r.lut).toArray01().slice(0,3),me=r.paint.get("fill-extrusion-flood-light-intensity"),Le=r.paint.get("fill-extrusion-vertical-scale"),Ee=r.paint.get("fill-extrusion-line-width").constantOr(1)!==0,Ze=r.paint.get("fill-extrusion-height-alignment"),We=r.paint.get("fill-extrusion-base-alignment"),ot=fs(u,r.paint.get("fill-extrusion-cutoff-fade-range")),Se=[];let He;oe&&Se.push("PROJECTION_GLOBE_VIEW"),U[0]>0&&Se.push("FAUX_AO"),Z&&Se.push("ZERO_ROOF_RADIUS"),T&&Se.push("HAS_CENTROID"),me>0&&Se.push("FLOOD_LIGHT"),ot.shouldRenderCutoff&&Se.push("RENDER_CUTOFF"),Ee&&Se.push("RENDER_WALL_MODE");const we=u.renderPass==="shadow",$e=u.shadowRenderer,Ve=we&&!!$e;u.shadowRenderer&&(u.shadowRenderer.useNormalOffset=!0);let Ke=[0,0,0];if($e){const pt=u.style.directionalLight,ft=u.style.ambientLight;pt&&ft&&(Ke=Go(u.style,pt,ft)),we||(Se.push("RENDER_SHADOWS","DEPTH_TEXTURE"),$e.useNormalOffset&&Se.push("NORMAL_OFFSET")),He=Se.concat(["SHADOWS_SINGLE_CASCADE"])}const De=Ve?"fillExtrusionDepth":R?"fillExtrusionPattern":"fillExtrusion",Qe=r.getLayerRenderingStats();for(const pt of c){const ft=t.getTile(pt),mt=ft.getBucket(r);if(!mt||mt.projection.name!==I.projection.name)continue;let Et=!1;$e&&(Et=$e.getMaxCascadeForTile(pt.toUnwrapped())===0);const qt=u.isTileAffectedByFog(pt),Lt=mt.programConfigurations.get(r.id),Vt=u.getOrCreateProgram(De,{config:Lt,defines:Et?He:Se,overrideFog:qt});if(u.terrain&&u.terrain.setupElevationDraw(ft,Vt,{useMeterToDem:!0}),!mt.centroidVertexBuffer){const Ht=Vt.attributes.a_centroid_pos;Ht!==void 0&&M.vertexAttrib2f(Ht,0,0)}!we&&$e&&$e.setupShadows(ft.tileID.toUnwrapped(),Vt,"vector-tile",ft.tileID.overscaledZ),R&&(u.context.activeTexture.set(M.TEXTURE0),ft.imageAtlasTexture&&ft.imageAtlasTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),Lt.updatePaintBuffers());const kt=P.constantOr(null);if(kt&&ft.imageAtlas){const Ht=ft.imageAtlas,Mt=o.d0.from(kt).getPrimary().scaleSelf(o.q.devicePixelRatio),ci=Ht.patternPositions.get(Mt.toString());ci&&Lt.setConstantPatternPositions(ci)}const ai=r.paint.get("fill-extrusion-vertical-gradient"),xi=1/mt.tileToMeter;let Di;if(we&&$e){if(oa(ft.tileID,mt,u))continue;const Ht=$e.calculateShadowPassMatrixFromTile(ft.tileID.toUnwrapped());Di=Jo(Ht,J,xi,Le,Ze,We)}else{const Ht=u.translatePosMatrix(pt.expandedProjMatrix,ft,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),Mt=I.projection.createInversionMatrix(I,pt.canonical);Di=R?Mu(Ht,u,ai,O,U,J,xi,pt,ft,K,Ze,We,te,ie,Mt,ue,Le):ec(Ht,u,ai,O,U,J,xi,pt,K,Ze,We,te,ie,Mt,ue,Le,me,Ke)}u.uploadCommonUniforms(E,Vt,pt.toUnwrapped(),null,ot);let ei=mt.segments;if(I.projection.name==="mercator"&&!we&&(ei=mt.getVisibleSegments(ft.tileID,u.terrain,u.transform.getFrustum(0)),!ei.get().length))continue;if(Qe)if(we)for(const Ht of ei.get())Qe.numRenderedVerticesInShadowPass+=Ht.primitiveLength;else for(const Ht of ei.get())Qe.numRenderedVerticesInTransparentPass+=Ht.primitiveLength;const ji=[];(u.terrain||T)&&ji.push(mt.centroidVertexBuffer),oe&&ji.push(mt.layoutVertexExtBuffer),Ee&&ji.push(mt.wallVertexBuffer),Vt.draw(u,E.gl.TRIANGLES,d,f,_,jt.backCCW,Di,r.id,mt.layoutVertexBuffer,mt.indexBuffer,ei,r.paint,u.transform.zoom,Lt,ji)}u.shadowRenderer&&(u.shadowRenderer.useNormalOffset=!1)}function ra(u,t,r,c,d,f,_,T,E,M,I,P,R,O,N,F,U,q,Z){const J=u.context,K=J.gl,oe=u.transform,te=u.transform.zoom,ie=[],re=fs(u,r.paint.get("fill-extrusion-cutoff-fade-range"));M==="clear"?(ie.push("CLEAR_SUBPASS"),Z&&(ie.push("CLEAR_FROM_TEXTURE"),J.activeTexture.set(K.TEXTURE0),Z.bind(K.LINEAR,K.CLAMP_TO_EDGE))):M==="sdf"&&ie.push("SDF_SUBPASS"),U&&ie.push("HAS_CENTROID"),re.shouldRenderCutoff&&ie.push("RENDER_CUTOFF");const ue=r.layout.get("fill-extrusion-edge-radius"),me=(Le,Ee,Ze,We,ot)=>{const Se=Ee.programConfigurations.get(r.id),He=u.isTileAffectedByFog(Le),we=u.getOrCreateProgram("fillExtrusionGroundEffect",{config:Se,defines:ie,overrideFog:He}),$e=((Ke,De,Qe,pt,ft,mt,Et,qt,Lt,Vt,kt)=>({u_matrix:De,u_opacity:Qe,u_ao_pass:pt?1:0,u_meter_to_tile:ft,u_ao:mt,u_flood_light_intensity:Et,u_flood_light_color:qt,u_attenuation:Lt,u_edge_radius:Vt,u_fb:0,u_fb_size:kt,u_dynamic_offset:1}))(0,We,I,E,ot,[P,R*ot],O,N,F,te>=17?0:ue*ot,Z?Z.size[0]:0),Ve=[];U&&Ve.push(Ee.hiddenByLandmarkVertexBuffer),u.uploadCommonUniforms(J,we,Le.toUnwrapped(),null,re),we.draw(u,J.gl.TRIANGLES,d,f,_,T,$e,r.id,Ee.vertexBuffer,Ee.indexBuffer,Ze,r.paint,te,Se,Ve)};for(const Le of c){const Ee=t.getTile(Le),Ze=Ee.getBucket(r);
2476if(!Ze||Ze.projection.name!==oe.projection.name||!Ze.groundEffect||Ze.groundEffect&&!Ze.groundEffect.hasData())continue;const We=Ze.groundEffect,ot=1/Ze.tileToMeter;{const Se=u.translatePosMatrix(Le.projMatrix,Ee,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),He=We.getDefaultSegment();me(Le,We,He,Se,ot)}if(q)for(let Se=0;Se<4;Se++){const He=o.d7[Se](Le),we=t.getTile(He);if(!we)continue;const $e=we.getBucket(r);if(!$e||$e.projection.name!==oe.projection.name||!$e.groundEffect||$e.groundEffect&&!$e.groundEffect.hasData())continue;const Ve=$e.groundEffect;let Ke,De;Se===0?(Ke=[-o.ai,0,0],De=1):Se===1?(Ke=[o.ai,0,0],De=0):Se===2?(Ke=[0,-o.ai,0],De=3):(Ke=[0,o.ai,0],De=2);const Qe=Ve.regionSegments[De];if(!Qe)continue;const pt=new Float32Array(16);o.ad.mat4.translate(pt,Le.projMatrix,Ke),me(Le,Ve,Qe,u.translatePosMatrix(pt,Ee,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),ot)}}}function na(u,t,r,c,d,f,_){c.centroidVertexArray.length===0&&c.createCentroidsBuffer();const T=f?f.findDEMTileFor(r):null;if(!(T&&T.dem||_))return;f&&T&&T.dem&&c.selfDEMTileTimestamp!==T.dem._timestamp&&(c.borderDoneWithNeighborZ=[-1,-1,-1,-1],c.selfDEMTileTimestamp=T.dem._timestamp);const E=q=>new o.P(Math.ceil((q+o.da)*o.db),0),M=q=>{const Z=t.getSource().minzoom,J=oe=>{const te=t.getTileByID(oe);if(te&&te.hasData())return te.getBucket(d)},K=[0,-1,1];for(const oe of K){if(q.overscaledZ+oe<Z)continue;const te=J(q.calculateScaledKey(q.overscaledZ+oe));if(te)return te}},I=[0,0,0],P=(q,Z)=>(I[0]=Math.min(q.min.y,Z.min.y),I[1]=Math.max(q.max.y,Z.max.y),I[2]=o.ai-Z.min.x>q.max.x?Z.min.x-o.ai:q.max.x,I),R=(q,Z)=>(I[0]=Math.min(q.min.x,Z.min.x),I[1]=Math.max(q.max.x,Z.max.x),I[2]=o.ai-Z.min.y>q.max.y?Z.min.y-o.ai:q.max.y,I),O=[(q,Z)=>P(q,Z),(q,Z)=>P(Z,q),(q,Z)=>R(q,Z),(q,Z)=>R(Z,q)],N=(q,Z,J,K,oe,te,ie)=>{if(!f)return 0;const re=[[te?J:q,te?q:J,0],[te?J:Z,te?Z:J,0]],ue=ie<0?o.ai+ie:ie,me=[te?ue:(q+Z)/2,te?(q+Z)/2:ue,0];return J===0&&ie<0||J!==0&&ie>0?f.getForTilePoints(oe,[me],!0,K):re.push(me),f.getForTilePoints(r,re,!0,T),Math.max(re[0][2],re[1][2],me[2])/f.exaggeration()};for(let q=0;q<4;q++){const Z=c.borderFeatureIndices[q];if(Z.length===0)continue;const J=o.d7[q](r),K=M(J);if(!(K&&K instanceof o.d8))continue;const oe=f?f.findDEMTileFor(J):null;if(!(oe&&oe.dem||_)||(f&&oe&&oe.dem&&c.borderDEMTileTimestamp[q]!==oe.dem._timestamp&&(c.borderDoneWithNeighborZ[q]=-1,c.borderDEMTileTimestamp[q]=oe.dem._timestamp),c.borderDoneWithNeighborZ[q]===K.canonical.z))continue;K.centroidVertexArray.length===0&&K.createCentroidsBuffer();const te=(q<2?1:5)-q,ie=K.borderDoneWithNeighborZ[te]!==c.canonical.z,re=K.borderFeatureIndices[te];let ue=0;if(c.canonical.z!==K.canonical.z){for(const me of Z)c.showCentroid(c.featuresOnBorder[me]);if(ie)for(const me of re)K.showCentroid(K.featuresOnBorder[me]);c.borderDoneWithNeighborZ[q]=K.canonical.z,K.borderDoneWithNeighborZ[te]=c.canonical.z}for(const me of Z){const Le=c.featuresOnBorder[me],Ee=c.centroidData[Le.centroidDataIndex],Ze=Le.borders[q];let We;for(;ue<re.length;){We=K.featuresOnBorder[re[ue]];const ot=We.borders[te];if(ot[1]>Ze[0]+3||ot[0]>Ze[0]-3)break;K.showCentroid(We),ue++}if(We&&ue<re.length){const ot=ue;let Se=0;for(;!(We.borders[te][0]>Ze[1]-3)&&(Se++,++ue!==re.length);)We=K.featuresOnBorder[re[ue]];We=K.featuresOnBorder[re[ot]];let He=!1;if(Se>=1){const Ve=We.borders[te];Math.abs(Ze[0]-Ve[0])<3&&Math.abs(Ze[1]-Ve[1])<3&&(Se=1,He=!0,ue=ot+1)}else if(Se===0){c.showCentroid(Le);continue}const we=K.centroidData[We.centroidDataIndex];_&&He&&(((F=Ee).flags|(U=we).flags)&o.d9?(F.flags|=o.d9,U.flags|=o.d9):(F.flags&=~o.d9,U.flags&=~o.d9));const $e=Le.intersectsCount()>1||We.intersectsCount()>1;if(Se>1)ue=ot,Ee.centroidXY=we.centroidXY=new o.P(0,0);else if(oe&&oe.dem&&!$e){const Ve=O[q](Ee,we),Ke=q%2?o.ai-1:0,De=N(Ve[0],Math.min(o.ai-1,Ve[1]),Ke,oe,J,q<2,Ve[2]);Ee.centroidXY=we.centroidXY=E(De)}else $e?Ee.centroidXY=we.centroidXY=new o.P(0,0):(Ee.centroidXY=c.encodeBorderCentroid(Le),we.centroidXY=K.encodeBorderCentroid(We));c.writeCentroidToBuffer(Ee),K.writeCentroidToBuffer(we)}else c.showCentroid(Le)}c.borderDoneWithNeighborZ[q]=K.canonical.z,K.borderDoneWithNeighborZ[te]=c.canonical.z}var F,U;(c.needsCentroidUpdate||!c.centroidVertexBuffer&&c.centroidVertexArray.length!==0)&&c.uploadCentroid(u)}const sa=[1,0,0],lt=[0,1,0],yt=[0,0,1];
vendor: 8,892 bytes, line 2476
2476function oa(u,t,r){const c=r.transform,d=r.shadowRenderer;if(!d)return!0;const f=u.toUnwrapped(),_=c.tileSize*d._cascades[r.currentShadowCascade].scale;let T=t.maxHeight;if(c.elevation){const F=c.elevation.getMinMaxForTile(u);F&&(T+=F.max)}const E=[...d.shadowDirection];E[2]=-E[2];const M=d.computeSimplifiedTileShadowVolume(f,T,_,E);if(!M)return!1;const I=[sa,lt,yt,E,[E[0],0,E[2]],[0,E[1],E[2]]],P=c.projection.name==="globe",R=c.scaleZoom(_),O=o.bR.fromInvProjectionMatrix(c.invProjMatrix,c.worldSize,R,!P),N=d.getCurrentCascadeFrustum();return O.intersectsPrecise(M.vertices,M.planes,I)===0||N.intersectsPrecise(M.vertices,M.planes,I)===0}function Zi(u){return[u[0]*o.dc,u[1]*o.dc,u[2]*o.dc,0]}function Pe(u,t,r,c,d,f,_,T,E){const M=c.getSource(),I=r.globeSharedBuffers;if(!I)return;let P,R,O;if(t&&(P=c.getTile(t)),M instanceof o.aK?(R=M.texture,O=o.cJ(0,0,r.transform)):P&&t&&(R=P.texture,O=o.cJ(t.canonical.z,t.canonical.x,r.transform)),!R||!O)return;u||(O=o.ad.mat4.scale(o.ad.mat4.create(),O,[1,-1,1]));const N=r.context,F=N.gl,U=d.paint.get("raster-resampling")==="nearest"?F.NEAREST:F.LINEAR,q=r.colorModeForDrapableLayerRenderPass(f),Z=_.defines;Z.push("GLOBE_POLES");const J=new Pt(F.LEQUAL,Pt.ReadWrite,r.depthRangeFor3D),K=Float32Array.from(r.transform.expandedFarZProjMatrix),oe=Float32Array.from(o.bc(o.cI(new o.bT(0,0,0))));r.terrain&&r.terrain.prepareDrawTile(),N.activeTexture.set(F.TEXTURE0),R.bind(U,F.CLAMP_TO_EDGE),N.activeTexture.set(F.TEXTURE1),R.bind(U,F.CLAMP_TO_EDGE),"useMipmap"in R&&N.extTextureFilterAnisotropic&&r.transform.pitch>20&&F.texParameterf(F.TEXTURE_2D,N.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,N.extTextureFilterAnisotropicMax);const[te,ie,re,ue]=t?I.getPoleBuffers(t.canonical.z,!1):I.getPoleBuffers(0,!0),me=d.paint.get("raster-elevation");let Le;u?(Le=te,r.renderDefaultNorthPole=me!==0):(Le=ie,r.renderDefaultSouthPole=me!==0);const Ee=Zi(_.mix),Ze=((ot,Se,He,we,$e,Ve,Ke,De,Qe,pt,ft,mt,Et)=>Cu(ot,Se,He,new Float32Array(16),new Float32Array(9),[0,0],we,[0,0],[0,0,0,0],1,{opacity:1,mix:0},Ve,[0,0],De,2,pt,ft,mt,1,0,Et))(K,oe,O,o.ag(r.transform.zoom),0,d,0,me,0,Ee,_.offset,_.range,f),We=r.getOrCreateProgram("raster",{defines:Z});r.uploadCommonUniforms(N,We,null),We.draw(r,F.TRIANGLES,J,E,q,T,Ze,d.id,Le,re,ue)}function wd(u){const t=u._nearZ,r=u.projection.farthestPixelDistance(u),c=r-t,d=.2*u.height,f=t+d;return[t,r,(f-d-t)/c,(f-t)/c]}function cc(u,t,r,c){if(u)return t instanceof as&&u instanceof Xr?t.getTextureDescriptor(u,r,!0):{texture:u.texture,mix:Zi(c.mix),offset:c.offset,buffer:0,tileSize:1}}var Bu=o.dd([{name:"a_index",type:"Int16",components:1}]);class Nu{constructor(t,r,c,d){const f={width:c[0],height:c[1],data:null},_=t.gl;this.targetColorTexture=new o.T(t,f,_.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new o.T(t,f,_.RGBA8,{useMipmap:!1}),this.context=t,this.updateParticleTexture(r,d),this.lastInvalidatedAt=0}updateParticleTexture(t,r){if(this.particleTextureDimension===r.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const c=this.context.gl,d=r.width*r.height;this.particleTexture0=new o.T(this.context,r,c.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new o.T(this.context,r,c.RGBA8,{premultiply:!1,useMipmap:!1});const f=new o.de;f.reserve(d);for(let _=0;_<d;_++)f.emplaceBack(_);this.particleIndexBuffer=this.context.createVertexBuffer(f,Bu.members,!0),this.particleSegment=o.b8.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=r.width}update(t){return!(this.lastInvalidatedAt<t&&(this.lastInvalidatedAt=o.q.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}function Td(u,t,r){if(!u)return null;const c=t.getTextureDescriptor(u,r,!0);if(!c)return null;let{texture:d,mix:f,offset:_,tileSize:T,buffer:E,format:M}=c;if(!d||!M)return null;let I=!1;return M==="uint32"&&(I=!0,f[3]=0,f=vt(o.df,f,[0,r.paint.get("raster-particle-max-speed")]),_=Au(o.df,_,[0,r.paint.get("raster-particle-max-speed")])),{texture:d,textureOffset:[E/(T+2*E),T/(T+2*E)],tileSize:T,scalarData:I,scale:f,offset:_,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[M]]}}function Sd(u){const t=u._nearZ,r=u.projection.farthestPixelDistance(u),c=r-t,d=.2*u.height,f=t+d;return[t,r,(f-d-t)/c,(f-t)/c]}const aa=new o.al(1,0,0,1),_f=new o.al(0,1,0,1),gf=new o.al(0,0,1,1),Ed=new o.al(1,0,1,1),uc=new o.al(0,1,1,1);function Gs(u,t,r,c,d,f,_){const T=u.context,E=u.transform,M=T.gl,I=E.projection.name==="globe",P=I?["PROJECTION_GLOBE_VIEW"]:[];let R=o.ad.mat4.clone(r.projMatrix);if(I&&o.ag(E.zoom)>0){const Ee=o.bb(r.canonical,E),Ze=o.dg(Ee);R=o.ad.mat4.multiply(new Float32Array(16),E.globeMatrix,Ze),o.ad.mat4.multiply(R,E.projMatrix,R)}const O=o.ad.mat4.create();O[12]+=2*d/(o.q.devicePixelRatio*E.width),O[13]+=2*f/(o.q.devicePixelRatio*E.height),o.ad.mat4.multiply(R,O,R);const N=u.getOrCreateProgram("debug",{defines:P}),F=t.getTileByID(r.key);u.terrain&&u.terrain.setupElevationDraw(F,N);const U=Pt.disabled,q=$t.disabled,Z=u.colorModeForRenderPass(),J="$debug";T.activeTexture.set(M.TEXTURE0),u.emptyTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),I?F._makeGlobeTileDebugBuffers(u.context,E):F._makeDebugTileBoundsBuffers(u.context,E.projection);const K=F._tileDebugBuffer||u.debugBuffer,oe=F._tileDebugIndexBuffer||u.debugIndexBuffer,te=F._tileDebugSegments||u.debugSegments;if(N.draw(u,M.LINE_STRIP,U,q,Z,jt.disabled,gd(R,c),J,K,oe,te,null,null,null,[F._globeTileDebugBorderBuffer]),_){const Ee=F.latestRawTileData,Ze=Math.floor((Ee&&Ee.byteLength||0)/1024);let We=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(We+=` => ${r.overscaledZ}`),We+=` ${F.state}`,We+=` ${Ze}kb`,function(ot,Se){ot.initDebugOverlayCanvas();const He=ot.debugOverlayCanvas,we=ot.context.gl,$e=ot.debugOverlayCanvas.getContext("2d");$e.clearRect(0,0,He.width,He.height),$e.shadowColor="white",$e.shadowBlur=2,$e.lineWidth=1.5,$e.strokeStyle="white",$e.textBaseline="top",$e.font="bold 36px Open Sans, sans-serif",$e.fillText(Se,5,5),$e.strokeText(Se,5,5),ot.debugOverlayTexture.update(He),ot.debugOverlayTexture.bind(we.LINEAR,we.CLAMP_TO_EDGE)}(u,We)}const ie=t.getTile(r).tileSize,re=512/Math.min(ie,512)*(r.overscaledZ/E.zoom)*.5,ue=F._tileDebugTextBuffer||u.debugBuffer,me=F._tileDebugTextIndexBuffer||u.quadTriangleIndexBuffer,Le=F._tileDebugTextSegments||u.debugSegments;N.draw(u,M.TRIANGLES,U,q,ii.alphaBlended,jt.disabled,gd(R,o.al.transparent,re),J,ue,me,Le,null,null,null,[F._globeTileDebugTextBuffer])}function Vu(u,t,r,c){go(u,0,t+r/2,u.transform.width,r,c)}function Uu(u,t,r,c){go(u,t-r/2,0,r,u.transform.height,c)}function go(u,t,r,c,d,f){const _=u.context,T=_.gl;T.enable(T.SCISSOR_TEST),T.scissor(t*o.q.devicePixelRatio,r*o.q.devicePixelRatio,c*o.q.devicePixelRatio,d*o.q.devicePixelRatio),_.clear({color:f}),T.disable(T.SCISSOR_TEST)}const hc=o.dd([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:la}=hc;function ys(u,t,r,c){u.emplaceBack(t,r,c)}class Md{constructor(t){this.vertexArray=new o.dh,this.indices=new o.aV,ys(this.vertexArray,-1,-1,1),ys(this.vertexArray,1,-1,1),ys(this.vertexArray,-1,1,1),ys(this.vertexArray,1,1,1),ys(this.vertexArray,-1,-1,-1),ys(this.vertexArray,1,-1,-1),ys(this.vertexArray,-1,1,-1),ys(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=t.createVertexBuffer(this.vertexArray,la),this.indexBuffer=t.createIndexBuffer(this.indices),this.segment=o.b8.simpleSegment(0,0,36,12)}}function br(u,t,r,c,d,f){const _=u.context.gl,T=t.paint.get("sky-atmosphere-color"),E=t.paint.get("sky-atmosphere-halo-color"),M=t.paint.get("sky-atmosphere-sun-intensity"),I=((P,R,O,N,F)=>({u_matrix_3f:P,u_sun_direction:R,u_sun_intensity:O,u_color_tint_r:[N.r,N.g,N.b,N.a],u_color_tint_m:[F.r,F.g,F.b,F.a],u_luminance:5e-5}))(o.ad.mat3.fromMat4(o.ad.mat3.create(),c),d,M,T,E);_.framebufferTexture2D(_.FRAMEBUFFER,_.COLOR_ATTACHMENT0,_.TEXTURE_CUBE_MAP_POSITIVE_X+f,t.skyboxTexture,0),r.draw(u,_.TRIANGLES,Pt.disabled,$t.disabled,ii.unblended,jt.frontCW,I,"skyboxCapture",t.skyboxGeometry.vertexBuffer,t.skyboxGeometry.indexBuffer,t.skyboxGeometry.segment)}const yf=o.dd([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);
2476class el{constructor(t){const r=new o.di;r.emplaceBack(-1,1,1,0,0),r.emplaceBack(1,1,1,1,0),r.emplaceBack(1,-1,1,1,1),r.emplaceBack(-1,-1,1,0,1);const c=new o.aV;c.emplaceBack(0,1,2),c.emplaceBack(2,3,0),this.vertexBuffer=t.createVertexBuffer(r,yf.members),this.indexBuffer=t.createIndexBuffer(c),this.segments=o.b8.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const ki=o.dd([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_size_scale",components:1},{type:"Float32",name:"a_fade_opacity",components:1}]);class yi{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class Id{constructor(t){this.colorModeAlphaBlendedWriteRGB=new ii([1,Ns,1,Ns],o.al.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new ii([1,0,1,0],o.al.transparent,[!1,!1,!1,!0]),this.params=new yi,this.updateNeeded=!0,t.tp.registerParameter(this.params,["Stars"],"starsCount",{min:100,max:16e3,step:1},()=>{this.updateNeeded=!0}),t.tp.registerParameter(this.params,["Stars"],"sizeMultiplier",{min:.01,max:2,step:.01}),t.tp.registerParameter(this.params,["Stars"],"sizeRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0}),t.tp.registerParameter(this.params,["Stars"],"intensityRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0})}update(t){const r=t.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new el(r);const c=this.params.sizeRange,d=this.params.intensityRange,f=function(I){const P=o.dl(30),R=[];for(let O=0;O<I;++O){const N=2*Math.PI*P(),F=Math.acos(1-2*P())-.5*Math.PI;R.push(o.ad.vec3.fromValues(Math.cos(F)*Math.cos(N),Math.cos(F)*Math.sin(N),Math.sin(F)))}return R}(this.params.starsCount),_=o.dl(300),T=new o.dj,E=new o.aV;let M=0;for(let I=0;I<f.length;++I){const P=o.ad.vec3.scale([],f[I],200),R=Math.max(0,1+.01*c*(1*_()-.5)),O=Math.max(0,1+.01*d*(1*_()-.5));T.emplaceBack(P[0],P[1],P[2],-1,-1,R,O),T.emplaceBack(P[0],P[1],P[2],1,-1,R,O),T.emplaceBack(P[0],P[1],P[2],1,1,R,O),T.emplaceBack(P[0],P[1],P[2],-1,1,R,O),E.emplaceBack(M+0,M+1,M+2),E.emplaceBack(M+0,M+2,M+3),M+=4}this.starsVx=r.createVertexBuffer(T,ki.members),this.starsIdx=r.createIndexBuffer(E),this.starsSegments=o.b8.simpleSegment(0,0,T.length,E.length)}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy()}drawAtmosphereGlow(t,r){const c=t.context,d=c.gl,f=t.transform,_=new Pt(d.LEQUAL,Pt.ReadOnly,[0,1]),T=o.ag(f.zoom),E=t.style.getLut(r.scope),M=r.properties.get("color-use-theme")==="none",I=r.properties.get("color").toRenderColor(M?null:E).toArray01(),P=r.properties.get("high-color-use-theme")==="none",R=r.properties.get("high-color").toRenderColor(P?null:E).toArray01(),O=r.properties.get("space-color-use-theme")==="none",N=r.properties.get("space-color").toRenderColor(O?null:E).toArray01PremultipliedAlpha(),F=5e-4,U=o.dk(r.properties.get("horizon-blend"),0,1,F,.25),q=o.cD(t,c,f)&&U===F?f.worldSize/(2*Math.PI*1.025)-1:f.globeRadius,Z=t.frameCounter/1e3%1,J=o.ad.vec3.length(f.globeCenterInViewSpace),K=Math.sqrt(Math.pow(J,2)-Math.pow(q,2)),oe=Math.acos(K/J),te=ie=>{const re=f.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];ie&&re.push("ALPHA_PASS");const ue=t.getOrCreateProgram("globeAtmosphere",{defines:re}),me=((Ee,Ze,We,ot,Se,He,we,$e,Ve,Ke,De,Qe)=>({u_frustum_tl:Ee,u_frustum_tr:Ze,u_frustum_br:We,u_frustum_bl:ot,u_horizon:Se,u_transition:He,u_fadeout_range:we,u_color:$e,u_high_color:Ve,u_space_color:Ke,u_temporal_offset:De,u_horizon_angle:Qe}))(f.frustumCorners.TL,f.frustumCorners.TR,f.frustumCorners.BR,f.frustumCorners.BL,f.frustumCorners.horizon,T,U,I,R,N,Z,oe);t.uploadCommonUniforms(c,ue);const Le=this.atmosphereBuffer;Le&&ue.draw(t,d.TRIANGLES,_,$t.disabled,ie?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,jt.backCW,me,ie?"atmosphere_glow_alpha":"atmosphere_glow",Le.vertexBuffer,Le.indexBuffer,Le.segments)};te(!1),te(!0)}drawStars(t,r){const c=o.ay(r.properties.get("star-intensity"),0,1);if(c===0)return;
2476const d=t.context,f=d.gl,_=t.transform,T=t.getOrCreateProgram("stars"),E=o.ad.quat.identity([]);o.ad.quat.rotateX(E,E,-_._pitch),o.ad.quat.rotateZ(E,E,-_.angle),o.ad.quat.rotateX(E,E,o.ak(_._center.lat)),o.ad.quat.rotateY(E,E,-o.ak(_._center.lng));const M=o.ad.mat4.fromQuat(new Float32Array(16),E),I=o.ad.mat4.multiply([],_.starsProjMatrix,M),P=o.ad.mat3.fromMat4([],M),R=o.ad.mat3.invert([],P),O=[0,1,0];o.ad.vec3.transformMat3(O,O,R),o.ad.vec3.scale(O,O,this.params.sizeMultiplier);const N=[1,0,0];o.ad.vec3.transformMat3(N,N,R),o.ad.vec3.scale(N,N,this.params.sizeMultiplier);const F=(U=O,q=N,Z=c,{u_matrix:Float32Array.from(I),u_up:U,u_right:q,u_intensity_multiplier:Z});var U,q,Z;t.uploadCommonUniforms(d,T),this.starsVx&&this.starsIdx&&T.draw(t,f.TRIANGLES,Pt.disabled,$t.disabled,this.colorModeAlphaBlendedWriteRGB,jt.disabled,F,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}function vs(u,t){const r=[...u],c=t.cameraWorldSizeForFog/t.worldSize,d=o.ad.mat4.identity([]);return o.ad.mat4.scale(d,d,[c,c,1]),o.ad.mat4.multiply(r,d,r),o.ad.mat4.multiply(r,t.worldToFogMatrix,r),r}function ca(u,t,r,c,d){const f=r.material,_=c.context,{baseColorTexture:T,metallicRoughnessTexture:E}=f.pbrMetallicRoughness,{normalTexture:M,occlusionTexture:I,emissionTexture:P}=f;function R(N,F,U){if(N&&(u.push(F),_.activeTexture.set(_.gl.TEXTURE0+U),N.gfxTexture)){const{minFilter:q,magFilter:Z,wrapS:J,wrapT:K}=N.sampler;N.gfxTexture.bindExtraParam(q,Z,J,K)}}R(T,"HAS_TEXTURE_u_baseColorTexture",Ji.BaseColor),R(E,"HAS_TEXTURE_u_metallicRoughnessTexture",Ji.MetallicRoughness),R(M,"HAS_TEXTURE_u_normalTexture",Ji.Normal),R(I,"HAS_TEXTURE_u_occlusionTexture",Ji.Occlusion),R(P,"HAS_TEXTURE_u_emissionTexture",Ji.Emission),d&&(d.texture||(d.texture=new o.dn(c.context,d.image,[d.image.height,d.image.height,d.image.height],_.gl.RGBA8)),_.activeTexture.set(_.gl.TEXTURE0+Ji.LUT),d.texture&&d.texture.bind(_.gl.LINEAR,_.gl.CLAMP_TO_EDGE),u.push("APPLY_LUT_ON_GPU")),r.texcoordBuffer&&(u.push("HAS_ATTRIBUTE_a_uv_2f"),t.push(r.texcoordBuffer)),r.colorBuffer&&(u.push(r.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),t.push(r.colorBuffer)),r.normalBuffer&&(u.push("HAS_ATTRIBUTE_a_normal_3f"),t.push(r.normalBuffer)),r.pbrBuffer&&(u.push("HAS_ATTRIBUTE_a_pbr"),u.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),t.push(r.pbrBuffer)),f.alphaMode!=="OPAQUE"&&f.alphaMode!=="MASK"||u.push("UNPREMULT_TEXTURE_IN_SHADER"),f.defined||u.push("DIFFUSE_SHADED");const O=c.shadowRenderer;O&&(u.push("RENDER_SHADOWS","DEPTH_TEXTURE"),O.useNormalOffset&&u.push("NORMAL_OFFSET"))}function xs(u,t,r,c,d,f){const _=r.paint.get("model-opacity").constantOr(1),T=t.context,E=new Pt(t.context.gl.LEQUAL,Pt.ReadWrite,t.depthRangeFor3D),M=t.transform,I=u.mesh,P=I.material,R=P.pbrMetallicRoughness,O=t.style.fog;let N;N=t.transform.projection.zAxisUnit==="pixels"?[...u.nodeModelMatrix]:o.ad.mat4.multiply([],c.zScaleMatrix,u.nodeModelMatrix),o.ad.mat4.multiply(N,c.negCameraPosMatrix,N);const F=o.ad.mat4.invert([],N);o.ad.mat4.transpose(F,F);const U=r.paint.get("model-color-use-theme").constantOr("default")==="none",q=r.paint.get("model-emissive-strength").constantOr(0),Z=zu(new Float32Array(u.worldViewProjection),new Float32Array(N),new Float32Array(F),null,t,_,R.baseColorFactor.toRenderColor(null),P.emissiveFactor,R.metallicFactor,R.roughnessFactor,P,q,r),J={defines:[]},K=[],oe=t.shadowRenderer;oe&&(oe.useNormalOffset=!1),ca(J.defines,K,I,t,U?null:r.lut);let te=null;if(O){const ue=vs(u.nodeModelMatrix,t.transform);if(te=new Float32Array(ue),M.projection.name!=="globe"){const me=I.aabb.min,Le=I.aabb.max,[Ee,Ze]=O.getOpacityForBounds(ue,me[0],me[1],Le[0],Le[1]);J.overrideFog=Ee>=gt||Ze>=gt}}const ie=fs(t,r.paint.get("model-cutoff-fade-range"));ie.shouldRenderCutoff&&J.defines.push("RENDER_CUTOFF");const re=t.getOrCreateProgram("model",J);t.uploadCommonUniforms(T,re,null,te,ie),t.renderPass!=="shadow"&&oe&&oe.setupShadowsFromMatrix(u.nodeModelMatrix,re),re.draw(t,T.gl.TRIANGLES,E,d,f,I.material.doubleSided?jt.disabled:jt.backCCW,Z,r.id,I.vertexBuffer,I.indexBuffer,I.segments,r.paint,t.transform.zoom,void 0,K)}function yo(u,t,r,c,d,f,_){let T;T=u.projection.name==="globe"?o.dp(r,u):[...r],o.ad.mat4.multiply(T,T,t.matrix);const E=o.ad.mat4.multiply([],c,T);if(t.meshes)for(const M of t.meshes){if(M.material.alphaMode!=="BLEND"){_.push({mesh:M,depth:0,modelIndex:d,worldViewProjection:E,nodeModelMatrix:T});continue}const I=o.ad.vec3.transformMat4([],M.centroid,E);!u.isOrthographic&&I[2]<=0||f.push({mesh:M,depth:I[2],modelIndex:d,worldViewProjection:E,nodeModelMatrix:T})}if(t.children)for(const M of t.children)yo(u,M,r,c,d,f,_)}function tl(u,t,r,c){const d=r.shadowRenderer;if(!d)return;const f=d.getShadowPassDepthMode(),_=d.getShadowPassColorMode(),T=d.calculateShadowPassMatrixFromMatr
2476ix(t),E=xd(T);r.getOrCreateProgram("modelDepth",{defines:r._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(r,r.context.gl.TRIANGLES,f,$t.disabled,_,jt.backCCW,E,c.id,u.vertexBuffer,u.indexBuffer,u.segments,c.paint,r.transform.zoom,void 0,void 0)}function ju(u,t,r){const c=t.updateZoomBasedPaintProperties(),d=function(f,_,T){let E,M,I,P=f.terrain?f.terrain.exaggeration():0;if(f.terrain&&P>0){const R=f.terrain,O=R.findDEMTileFor(T);O&&O.dem?E=o.dr.create(R,T,O):P=0}if(P===0&&(_.terrainElevationMin=0,_.terrainElevationMax=0),P===_.validForExaggeration&&(P===0||E&&E._demTile&&E._demTile.tileID===_.validForDEMTile.id&&E._dem._timestamp===_.validForDEMTile.timestamp))return!1;for(const R in _.instancesPerModel){const O=_.instancesPerModel[R];for(let N=0;N<O.instancedDataArray.length;++N){const F=(E?P*E.getElevationAt(0|O.instancedDataArray.float32[16*N],0|O.instancedDataArray.float32[16*N+1],!0,!0):0)+O.instancesEvaluatedElevation[N];O.instancedDataArray.float32[16*N+6]=F,M=M?Math.min(_.terrainElevationMin,F):F,I=I?Math.max(_.terrainElevationMax,F):F}}return _.terrainElevationMin=M||0,_.terrainElevationMax=I||0,_.validForExaggeration=P,_.validForDEMTile=E&&E._demTile?{id:E._demTile.tileID,timestamp:E._dem._timestamp}:{id:void 0,timestamp:0},!0}(u,t,r);(c||d)&&(t.uploaded=!1,t.upload(u.context))}const An={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new o.ce([0,0,0],[o.ai,o.ai,0])};function qu(u,t){const r=1<<u.canonical.z,c=t.getFreeCameraOptions().position,d=t.elevation,f=u.canonical.x/r,_=(u.canonical.x+1)/r,T=u.canonical.y/r,E=(u.canonical.y+1)/r;let M=t._centerAltitude;if(d){const O=d.getMinMaxForTile(u);O&&O.max>M&&(M=O.max)}const I=o.ay(c.x,f,_)-c.x,P=o.ay(c.y,T,E)-c.y,R=o.bH(M,t.center.lat)-c.z;return t._zoomFromMercatorZ(Math.sqrt(I*I+P*P+R*R))}function Vn(u,t,r,c,d,f,_){const T=u.context,E=u.renderPass==="shadow",M=u.shadowRenderer,I=E&&M?M.getShadowPassDepthMode():new Pt(T.gl.LEQUAL,Pt.ReadWrite,u.depthRangeFor3D),P=u.isTileAffectedByFog(f);if(r.meshes)for(const R of r.meshes){const O=["MODEL_POSITION_ON_GPU"],N=[];let F,U,q;c.instancedDataArray.length>20&&O.push("INSTANCED_ARRAYS");const Z=fs(u,t.paint.get("model-cutoff-fade-range"));if(Z.shouldRenderCutoff&&O.push("RENDER_CUTOFF"),E&&M)F=u.getOrCreateProgram("modelDepth",{defines:O}),U=xd(_.shadowTileMatrix,_.shadowTileMatrix,Float32Array.from(r.matrix)),q=M.getShadowPassColorMode();else{ca(O,N,R,u,t.paint.get("model-color-use-theme").constantOr("default")==="none"?null:t.lut),F=u.getOrCreateProgram("model",{defines:O,overrideFog:P});const K=R.material,oe=K.pbrMetallicRoughness,te=t.paint.get("model-opacity").constantOr(1),ie=t.paint.get("model-emissive-strength").constantOr(0);U=zu(f.expandedProjMatrix,Float32Array.from(r.matrix),new Float32Array(16),null,u,te,oe.baseColorFactor.toRenderColor(null),K.emissiveFactor,oe.metallicFactor,oe.roughnessFactor,K,ie,t,d),M&&(_.shadowUniformsInitialized?F.setShadowUniformValues(T,M.getShadowUniformValues()):(M.setupShadows(f.toUnwrapped(),F,"model-tile",f.overscaledZ),_.shadowUniformsInitialized=!0)),q=Z.shouldRenderCutoff||te<1||K.alphaMode!=="OPAQUE"?ii.alphaBlended:ii.unblended}u.uploadCommonUniforms(T,F,f.toUnwrapped(),null,Z);const J=R.material.doubleSided?jt.disabled:jt.backCCW;if(c.instancedDataArray.length>20)N.push(c.instancedDataBuffer),F.draw(u,T.gl.TRIANGLES,I,$t.disabled,q,J,U,t.id,R.vertexBuffer,R.indexBuffer,R.segments,t.paint,u.transform.zoom,void 0,N,c.instancedDataArray.length);else{const K=E?"u_instance":"u_normal_matrix";for(let oe=0;oe<c.instancedDataArray.length;++oe)U[K]=new Float32Array(c.instancedDataArray.arrayBuffer,64*oe,16),F.draw(u,T.gl.TRIANGLES,I,$t.disabled,q,J,U,t.id,R.vertexBuffer,R.indexBuffer,R.segments,t.paint,u.transform.zoom,void 0,N)}}if(r.children)for(const R of r.children)Vn(u,t,R,c,d,f,_)}const $s=[1,-1,1];function dc(u,t,r,c){if(!r.modelManager)return!0;const d=r.modelManager;if(!r.shadowRenderer)return!0;const f=r.shadowRenderer,_=t.aabb;let T=!0,E=u.maxHeight;if(E===0){let I=0;for(const P in u.instancesPerModel){const R=d.getModel(P,c);R?I=Math.max(I,Math.max(Math.max(R.aabb.max[0],R.aabb.max[1]),R.aabb.max[2])):T=!1}E=u.maxScale*I*1.41+u.maxVerticalOffset,T&&(u.maxHeight=E)}_.max[2]=E,_.min[2]+=u.terrainElevationMin,_.max[2]+=u.terrainElevationMax,o.ad.vec3.transformMat4(_.min,_.min,t.tileMatrix),o.ad.vec3.transformMat4(_.max,_.max,t.tileMatrix);const M=_.intersects(f.getCurrentCascadeFrustum());return r.currentShadowCascade===0&&(u.isInsideFirstShadowMapFrustum=M===2),M===0}function pc(u,t){const r=u.uniformValues.u_cutoff_params[0],c=u.uniformValues.u_cutoff_params[1],d=u.uniformValues.u_cutoff_params[2],f=u.uniformValues.u_cutoff_params[3];return c===r||f===d?1:o.ay(((t-r)/(c-r)-d)/(f-d),0,1)}function Gu(u,t,r,c){if(t.pitch<20)return 1;const d=t.getWorldToCameraMatrix();o.ad.mat4.multiply(d,d,u);const f=o.ad.vec4.fromValues(r.min[0],r.min[1],r.min[2],1);let _=o.ad.vec4.transformMat4(o.ad.vec4.create(),f,d),T=_,E=_;f[1]=r.max[1],_=o.ad.vec4.transformMat4(o.ad.vec4.create(),f,d),T=_[1]<T[1]?_:T,E=_[1]>E[1]?_:E,f[0]=r.max[0],_=o.ad.vec4.transformMat4(o.ad.vec4.create(),f,d),T=_[1]<T[1]?_:T,E=_[1]>E[1]?_:E,f[1]=r.min[1],_=o.ad.vec4.transformMat4(o.ad.vec4.create(),f,d),T=_[1]<T[1]?_:T,E=_[1]>E[1]?_:E;const M=o.ay(c[0],0,1),I=100*t.pixelsPerMeter*o.ay(c[1],0,1),P=o.ay(c[2],0,1),R=o.ad.vec4.lerp(o.ad.vec4.create(),T,E,M),O=Math.tan(.5*t.fovX),N=-R[2]*O;if(I===0)return R[1]<-Math.abs(N)?P:1;const F=(-Math.abs(N)-R[1])/I,U=(Z,J,K)=>(1-K)*Z+K*J,q=o.ay(U(1,P,F),P,1);
2476return U(1,q,o.ay((t.pitch-20)/20,0,1))}class $u{}class vo{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(t,r,c){{const P=this._storage.get(r.id);if(P)return P.lastUsedFrameIdx=t,P.buf}const d=c.gl,f=d.getBufferParameter(d.ELEMENT_ARRAY_BUFFER,d.BUFFER_SIZE),_=new ArrayBuffer(f),T=new Int16Array(_);d.getBufferSubData(d.ELEMENT_ARRAY_BUFFER,0,new Int16Array(_));const E=new o.dt;for(let P=0;P<f/2;P+=3){const R=T[P],O=T[P+1],N=T[P+2];E.emplaceBack(R,O),E.emplaceBack(O,N),E.emplaceBack(N,R)}const M=c.bindVertexArrayOES.current,I=new $u;return I.buf=new Jn(c,E),I.lastUsedFrameIdx=t,this._storage.set(r.id,I),c.bindVertexArrayOES.set(M),I.buf}update(t){for(const[r,c]of this._storage)t-c.lastUsedFrameIdx>30&&(c.buf.destroy(),this._storage.delete(r))}destroy(){for(const[t,r]of this._storage)r.buf.destroy(),this._storage.delete(t)}}class Hu{constructor(t){this.occluderSize=30,this.depthOffset=-1e-4,t.registerParameter(this,["Occlusion"],"occluderSize",{min:1,max:100,step:1}),t.registerParameter(this,["Occlusion"],"depthOffset",{min:-.05,max:0,step:1e-5})}}const Hs=o.dd([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]);class Zu{registerParameter(){}registerButton(){}registerBinding(){}refreshUI(){}}class il{constructor(t,r){this.revealStart=11,this.revealRange=2,t.registerParameter(this,[...r,"Reveal"],"revealStart",{min:0,max:17,step:.05}
2476),t.registerParameter(this,[...r,"Reveal"],"revealRange",{min:.1,max:5.1,step:.05})}}const Wu=o.dd([{type:"Float32",name:"a_pos_2f",components:2}]);class Xu{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(t,r){const c=t.getOrCreateProgram("vignette");if(!this.vignetteVx||!this.vignetteIdx){const _=new o.du,T=new o.aV;_.emplaceBack(-1,-1),_.emplaceBack(1,-1),_.emplaceBack(1,1),_.emplaceBack(-1,1),T.emplaceBack(0,1,2),T.emplaceBack(0,2,3),this.vignetteVx=t.context.createVertexBuffer(_,Wu.members),this.vignetteIdx=t.context.createIndexBuffer(T)}const d=o.b8.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){t.uploadCommonUniforms(t.context,c);const _={u_vignetteShape:(f={vignetteShape:[r.start,r.range,Math.pow(10,r.fadePower)],vignetteColor:[r.color.r,r.color.g,r.color.b,r.color.a*r.strength]}).vignetteShape,u_vignetteColor:f.vignetteColor};c.draw(t,t.context.gl.TRIANGLES,Pt.disabled,$t.disabled,ii.alphaBlended,jt.disabled,_,"vignette",this.vignetteVx,this.vignetteIdx,d)}var f}}class Tr{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(t,r){const c=t.getFreeCameraOptions().position,d=c.toAltitude(),f=c.toLngLat(),_=o.ak(f.lng),T=o.ak(f.lat),E=t.pixelsPerMeter/r,M=_*o.dv,I=o.dv*Math.log(Math.tan(Math.PI/4+T/2));if(this._offsetXPrev===void 0)this._offsetXPrev=0,this._offsetYPrev=0,this._elevationPrev=0,this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0;else{const P=-this._offsetYPrev+I,R=-this._elevationPrev+d;this._accumulatedOffsetX+=(-this._offsetXPrev+M)*E,this._accumulatedOffsetY+=P*E,this._accumulatedElevation+=R*E,this._offsetXPrev=M,this._offsetYPrev=I,this._elevationPrev=d}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function fc(u,t){return[-(u[0]-Math.floor(u[0]/t)*t),-(u[1]-Math.floor(u[1]/t)*t),-(u[2]-Math.floor(u[2]/t)*t)]}function mc(u){const t=o.dl(1323123451230),r=[];for(let c=0;c<u;++c){const d=2*t()-1,f=2*t()-1,_=2*t()-1;r.push(o.ad.vec3.fromValues(d,f,_))}return r}function rn(u,t,r,c,d){const f=o.ay((d-r)/(c-r),0,1);return(1-f)*u+f*t}class _c{constructor(t){this._movement=new Tr,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new Xu,this._ppmScaleFactor=t}destroy(){this.particlesVx&&this.particlesVx.destroy(),this.particlesIdx&&this.particlesIdx.destroy(),this._vignette&&this._vignette.destroy()}updateOnRender(t,r){const c=t.transform;this._movement.update(c,this._ppmScaleFactor);const d=c.starsProjMatrix,f=o.ad.quat.identity([]);o.ad.quat.rotateX(f,f,o.ak(90)-c._pitch),o.ad.quat.rotateZ(f,f,-c.angle);const _=o.ad.mat4.fromQuat(new Float32Array(16),f),T=o.ad.mat4.fromValues(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1),E=o.ad.mat4.transpose([],T),M=o.ad.mat4.multiply([],E,_),I=Date.now()/1e3;return this._accumulatedTimeFromStart+=(I-this._prevTime)*r,this._prevTime=I,{projectionMatrix:d,modelviewMatrix:M}}}class Yu extends _c{constructor(t){super(4.25),this._params={overrideStyleParameters:!1,intensity:.5,timeFactor:1,velocityConeAperture:0,velocity:300,boxSize:2500,dropletSizeX:1,dropletSizeYScale:10,distortionStrength:70,screenThinning:{intensity:.57,start:.46,range:1.17,fadePower:.17,affectedRatio:1,particleOffset:-.2},color:{r:.66,g:.68,b:.74,a:.7},direction:{x:-50,y:-35},shapeDirPower:2,shapeNormalPower:1},this._revealParams=new il(t.tp,["Precipitation","Rain"]),this._vignetteParams={strength:1,start:.7,range:1,fadePower:.4,color:{r:.27,g:.27,b:.27,a:1}},this.particlesCount=16e3}update(t){const r=t.context;if(!this.particlesVx){const c=mc(this.particlesCount),d=new o.dw,f=new o.aV;let _=0;const T=o.dl(1323123451230);for(let E=0;E<c.length;++E){const M=c[E],I=[2*T()-1,T(),T(),T()];d.emplaceBack(M[0],M[1],M[2],-1,-1,...I),d.emplaceBack(M[0],M[1],M[2],1,-1,...I),d.emplaceBack(M[0],M[1],M[2],1,1,...I),d.emplaceBack(M[0],M[1],M[2],-1,1,...I),f.emplaceBack(_+0,_+1,_+2),f.emplaceBack(_+0,_+2,_+3),_+=4}this.particlesVx=r.createVertexBuffer(d,Hs.members),this.particlesIdx=r.createIndexBuffer(f)}}draw(t){if(!this._params.overrideStyleParameters&&!t.style.rain)return;const r=this._params.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},c=t.transform.zoom;if(r.revealStart>c)return;const d=rn(0,1,r.revealStart,r.revealStart+r.revealRange,c);if(!this.particlesVx||!this.particlesIdx)return;const f=structuredClone(this._params);let _=[-f.direction.x,f.direction.y,-100];o.ad.vec3.normalize(_,_);
2476const T=structuredClone(this._vignetteParams);T.strength*=d,f.overrideStyleParameters||(f.intensity=t.style.rain.state.density,f.timeFactor=t.style.rain.state.intensity,f.color=structuredClone(t.style.rain.state.color),_=structuredClone(t.style.rain.state.direction),f.screenThinning.intensity=t.style.rain.state.centerThinning,f.dropletSizeX=t.style.rain.state.dropletSize[0],f.dropletSizeYScale=t.style.rain.state.dropletSize[1]/t.style.rain.state.dropletSize[0],f.distortionStrength=100*t.style.rain.state.distortionStrength,T.strength=1,T.color=structuredClone(t.style.rain.state.vignetteColor));const E=this.updateOnRender(t,f.timeFactor),M=t.context,I=M.gl,P=t.transform;this.screenTexture&&this.screenTexture.size[0]===t.width&&this.screenTexture.size[1]===t.height||(this.screenTexture=new o.T(M,{width:t.width,height:t.height,data:null},I.RGBA8)),f.distortionStrength>0&&(M.activeTexture.set(I.TEXTURE0),this.screenTexture.bind(I.LINEAR,I.CLAMP_TO_EDGE),I.copyTexSubImage2D(I.TEXTURE_2D,0,0,0,0,0,t.width,t.height));const R=t.getOrCreateProgram("rainParticle");t.uploadCommonUniforms(M,R),M.activeTexture.set(I.TEXTURE0),this.screenTexture.bind(I.LINEAR,I.CLAMP_TO_EDGE);const O=[f.color.r,f.color.g,f.color.b,f.color.a],N=(F,U)=>{const q=fc(this._movement.getPosition(),F),Z=f.dropletSizeX,J=f.dropletSizeX*f.dropletSizeYScale,K=t.width/2,oe=t.height/2,te=rn(0,f.screenThinning.start,0,1,f.screenThinning.intensity),ie=rn(.001,f.screenThinning.range,0,1,f.screenThinning.intensity),re=rn(0,f.screenThinning.particleOffset,0,1,f.screenThinning.intensity),ue=(me={modelview:E.modelviewMatrix,projection:E.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:q,velocityConeAperture:f.velocityConeAperture,velocity:f.velocity,boxSize:F,rainDropletSize:[Z,J],distortionStrength:f.distortionStrength,rainDirection:_,color:O,screenSize:[P.width,P.height],thinningCenterPos:[K,oe],thinningShape:[te,ie,Math.pow(10,f.screenThinning.fadePower)],thinningAffectedRatio:f.screenThinning.affectedRatio,thinningParticleOffset:re,shapeDirectionalPower:f.shapeDirPower,shapeNormalPower:f.shapeNormalPower,mode:U?0:1},{u_modelview:Float32Array.from(me.modelview),u_projection:Float32Array.from(me.projection),u_time:me.time,u_cam_pos:me.camPos,u_texScreen:0,u_velocityConeAperture:me.velocityConeAperture,u_velocity:me.velocity,u_boxSize:me.boxSize,u_rainDropletSize:me.rainDropletSize,u_distortionStrength:me.distortionStrength,u_rainDirection:me.rainDirection,u_color:me.color,u_screenSize:me.screenSize,u_thinningCenterPos:me.thinningCenterPos,u_thinningShape:me.thinningShape,u_thinningAffectedRatio:me.thinningAffectedRatio,u_thinningParticleOffset:me.thinningParticleOffset,u_shapeDirectionalPower:me.shapeDirectionalPower,u_shapeNormalPower:me.shapeNormalPower,u_mode:me.mode});var me;const Le=Math.round(f.intensity*this.particlesCount),Ee=o.b8.simpleSegment(0,0,4*Le,2*Le);R.draw(t,I.TRIANGLES,Pt.disabled,$t.disabled,ii.alphaBlended,jt.disabled,ue,"rain_particles",this.particlesVx,this.particlesIdx,Ee)};f.distortionStrength>0&&N(f.boxSize,!0),N(f.boxSize,!1),this._vignette.draw(t,T)}}const Ku=o.dd([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_snowParticleData",components:4},{type:"Float32",name:"a_snowParticleDataHorizontalOscillation",components:2}]);class ua extends _c{constructor(t){super(2.25),this._params={overrideStyleParameters:!1,intensity:.85,timeFactor:.75,velocityConeAperture:70,velocity:40,horizontalOscillationRadius:4,horizontalOscillationRate:1.5,boxSize:2e3,billboardSize:2,shapeFadeStart:.27,shapeFadePower:.21,screenThinning:{intensity:.4,start:.15,range:1.4,fadePower:.24,affectedRatio:1,particleOffset:-.2},color:{r:1,g:1,b:1,a:1},direction:{x:-50,y:-35}},this._revealParams=new il(t.tp,["Precipitation","Snow"]),this._vignetteParams={strength:.3,start:.78,range:.46,fadePower:.2,color:{r:1,g:1,b:1,a:1}},this.particlesCount=16e3}update(t){const r=t.context;if(!this.particlesVx){const c=mc(this.particlesCount),d=new o.dx,f=new o.aV;let _=0;const T=o.dl(1323123451230);for(let E=0;E<c.length;++E){const M=c[E],I=T(),P=T(),R=T(),O=[E/c.length,I,P,R],N=[T(),T()];d.emplaceBack(M[0],M[1],M[2],-1,-1,...O,...N),d.emplaceBack(M[0],M[1],M[2],1,-1,...O,...N),d.emplaceBack(M[0],M[1],M[2],1,1,...O,...N),d.emplaceBack(M[0],M[1],M[2],-1,1,...O,...N),f.emplaceBack(_+0,_+1,_+2),f.emplaceBack(_+0,_+2,_+3),_+=4}this.particlesVx=r.createVertexBuffer(d,Ku.members),this.particlesIdx=r.createIndexBuffer(f)}}draw(t){if(!this._params.overrideStyleParameters&&!t.style.snow)return;const r=structuredClone(this._params);let c=[-r.direction.x,r.direction.y,-100];o.ad.vec3.normalize(c,c);
2476const d=structuredClone(this._vignetteParams),f=r.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},_=t.transform.zoom;if(f.revealStart>_)return;const T=rn(0,1,f.revealStart,f.revealStart+f.revealRange,_);d.strength*=T,r.overrideStyleParameters||(r.intensity=t.style.snow.state.density,r.timeFactor=t.style.snow.state.intensity,r.color=structuredClone(t.style.snow.state.color),c=structuredClone(t.style.snow.state.direction),r.screenThinning.intensity=t.style.snow.state.centerThinning,r.billboardSize=2.79*t.style.snow.state.flakeSize,d.strength=1,d.color=structuredClone(t.style.snow.state.vignetteColor));const E=this.updateOnRender(t,r.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const M=t.context,I=M.gl,P=t.transform,R=t.getOrCreateProgram("snowParticle");t.uploadCommonUniforms(M,R),((O,N,F)=>{const U=fc(this._movement.getPosition(),O),q=P.width/2,Z=P.height/2,J=rn(0,F.screenThinning.start,0,1,F.screenThinning.intensity),K=rn(.001,F.screenThinning.range,0,1,F.screenThinning.intensity),oe=rn(0,F.screenThinning.particleOffset,0,1,F.screenThinning.intensity),te=(ie={modelview:E.modelviewMatrix,projection:E.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:U,velocityConeAperture:F.velocityConeAperture,velocity:F.velocity,horizontalOscillationRadius:F.horizontalOscillationRadius,horizontalOscillationRate:F.horizontalOscillationRate,boxSize:O,billboardSize:1*F.billboardSize,simpleShapeParameters:[F.shapeFadeStart,F.shapeFadePower],screenSize:[P.width,P.height],thinningCenterPos:[q,Z],thinningShape:[J,K,Math.pow(10,F.screenThinning.fadePower)],thinningAffectedRatio:F.screenThinning.affectedRatio,thinningParticleOffset:oe,color:[F.color.r,F.color.g,F.color.b,F.color.a],direction:c},{u_modelview:Float32Array.from(ie.modelview),u_projection:Float32Array.from(ie.projection),u_time:ie.time,u_cam_pos:ie.camPos,u_velocityConeAperture:ie.velocityConeAperture,u_velocity:ie.velocity,u_horizontalOscillationRadius:ie.horizontalOscillationRadius,u_horizontalOscillationRate:ie.horizontalOscillationRate,u_boxSize:ie.boxSize,u_billboardSize:ie.billboardSize,u_simpleShapeParameters:ie.simpleShapeParameters,u_screenSize:ie.screenSize,u_thinningCenterPos:ie.thinningCenterPos,u_thinningShape:ie.thinningShape,u_thinningAffectedRatio:ie.thinningAffectedRatio,u_thinningParticleOffset:ie.thinningParticleOffset,u_particleColor:ie.color,u_direction:ie.direction});var ie;const re=Math.round(F.intensity*this.particlesCount),ue=o.b8.simpleSegment(0,0,4*re,2*re);this.particlesVx&&this.particlesIdx&&R.draw(t,I.TRIANGLES,Pt.disabled,$t.disabled,ii.alphaBlended,jt.disabled,te,"snow_particles",this.particlesVx,this.particlesIdx,ue)})(r.boxSize,0,r),this._vignette.draw(t,d)}}const rl={symbol:function(u,t,r,c,d){if(u.renderPass!=="translucent")return;const f=$t.disabled,_=u.colorModeForRenderPass(),T=r.layout.get("text-variable-anchor"),E=r.layout.get("text-size-scale-range"),M=o.ay(u.scaleFactor,E[0],E[1]);T&&function(R,O,N,F,U,q,Z,J){const K=O.transform,oe=U==="map",te=q==="map";for(const ie of R){const re=F.getTile(ie),ue=re.getBucket(N);if(!ue||!ue.text||!ue.text.segments.get().length)continue;const me=o.bp(ue.textSizeData,K.zoom,J),Le=pn(ie,ue.getProjection(),K),Ee=K.calculatePixelsToTileUnitsMatrix(re),Ze=cs(Le,re.tileID.canonical,te,oe,K,ue.getProjection(),Ee),We=ue.hasIconTextFit()&&ue.hasIconData();if(me){const ot=Math.pow(2,K.zoom-re.tileID.overscaledZ);In(ue,oe,te,Z,o.cY,K,Ze,ie,ot,me,We)}}}(c,u,r,t,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),d,M);const I=r.paint.get("icon-opacity").constantOr(1)!==0,P=r.paint.get("text-opacity").constantOr(1)!==0;r.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(I||P)?zi(u,t,r,c,f,_):(I&&zi(u,t,r,c,f,_,{onlyIcons:!0}),P&&zi(u,t,r,c,f,_,{onlyText:!0})),t.map.showCollisionBoxes&&(oc(u,t,r,c,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),!0),oc(u,t,r,c,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),!1))},circle:function(u,t,r,c){if(u.renderPass!=="translucent")return;const d=r.paint.get("circle-opacity"),f=r.paint.get("circle-stroke-width"),_=r.paint.get("circle-stroke-opacity"),T=r.layout.get("
2476circle-sort-key").constantOr(1)!==void 0,E=r.paint.get("circle-emissive-strength");if(d.constantOr(1)===0&&(f.constantOr(1)===0||_.constantOr(1)===0))return;const M=u.context,I=M.gl,P=u.transform,R=u.depthModeForSublayer(0,Pt.ReadOnly),O=$t.disabled,N=u.colorModeForDrapableLayerRenderPass(E),F=P.projection.name==="globe",U=[o.av(P.center.lng),o.aC(P.center.lat)],q=[];for(let J=0;J<c.length;J++){const K=c[J],oe=t.getTile(K),te=oe.getBucket(r);if(!te||te.projection.name!==P.projection.name)continue;const ie=te.programConfigurations.get(r.id),re=o.cZ(r),ue=u.isTileAffectedByFog(K);F&&re.push("PROJECTION_GLOBE_VIEW"),re.push("DEPTH_D24"),u.terrain&&P.depthOcclusionForSymbolsAndCircles&&re.push("DEPTH_OCCLUSION");const me=u.getOrCreateProgram("circle",{config:ie,defines:re,overrideFog:ue}),Le=te.layoutVertexBuffer,Ee=te.globeExtVertexBuffer,Ze=te.indexBuffer,We=P.projection.createInversionMatrix(P,K.canonical),ot={programConfiguration:ie,program:me,layoutVertexBuffer:Le,globeExtVertexBuffer:Ee,indexBuffer:Ze,uniformValues:o.c_(u,K,oe,We,U,r),tile:oe};if(T){const Se=te.segments.get();for(const He of Se)q.push({segments:new o.b8([He]),sortKey:He.sortKey,state:ot})}else q.push({segments:te.segments,sortKey:0,state:ot})}T&&q.sort((J,K)=>J.sortKey-K.sortKey);const Z={useDepthForOcclusion:P.depthOcclusionForSymbolsAndCircles};for(const J of q){const{programConfiguration:K,program:oe,layoutVertexBuffer:te,globeExtVertexBuffer:ie,indexBuffer:re,uniformValues:ue,tile:me}=J.state,Le=J.segments;u.terrain&&u.terrain.setupElevationDraw(me,oe,Z),u.uploadCommonUniforms(M,oe,me.tileID.toUnwrapped()),oe.draw(u,I.TRIANGLES,R,O,N,jt.disabled,ue,r.id,te,re,Le,r.paint,P.zoom,K,[ie])}},heatmap:function(u,t,r,c){if(r.paint.get("heatmap-opacity")!==0)if(u.renderPass==="offscreen"){const d=u.context,f=d.gl,_=$t.disabled,T=new ii([f.ONE,f.ONE,f.ONE,f.ONE],o.al.transparent,[!0,!0,!0,!0]);(function(O,N,F,U){const q=O.gl,Z=N.width*U,J=N.height*U;O.activeTexture.set(q.TEXTURE1),O.viewport.set([0,0,Z,J]);let K=F.heatmapFbo;if(!K||K&&(K.width!==Z||K.height!==J)){K&&K.destroy();const oe=q.createTexture();q.bindTexture(q.TEXTURE_2D,oe),q.texParameteri(q.TEXTURE_2D,q.TEXTURE_WRAP_S,q.CLAMP_TO_EDGE),q.texParameteri(q.TEXTURE_2D,q.TEXTURE_WRAP_T,q.CLAMP_TO_EDGE),q.texParameteri(q.TEXTURE_2D,q.TEXTURE_MIN_FILTER,q.LINEAR),q.texParameteri(q.TEXTURE_2D,q.TEXTURE_MAG_FILTER,q.LINEAR),K=F.heatmapFbo=O.createFramebuffer(Z,J,!0,null),function(te,ie,re,ue,me,Le){const Ee=te.gl;Ee.texImage2D(Ee.TEXTURE_2D,0,te.extRenderToTextureHalfFloat?Ee.RGBA16F:Ee.RGBA,me,Le,0,Ee.RGBA,te.extRenderToTextureHalfFloat?Ee.HALF_FLOAT:Ee.UNSIGNED_BYTE,null),ue.colorAttachment.set(re)}(O,0,oe,K,Z,J)}else q.bindTexture(q.TEXTURE_2D,K.colorAttachment.get()),O.bindFramebuffer.set(K.framebuffer)})(d,u,r,u.transform.projection.name==="globe"?.5:.25),d.clear({color:o.al.transparent});const E=u.transform,M=E.projection.name==="globe",I=M?["PROJECTION_GLOBE_VIEW"]:[],P=M?jt.frontCCW:jt.disabled,R=[o.av(E.center.lng),o.aC(E.center.lat)];for(let O=0;O<c.length;O++){const N=c[O];if(t.hasRenderableParent(N))continue;const F=t.getTile(N),U=F.getBucket(r);if(!U||U.projection.name!==E.projection.name)continue;const q=u.isTileAffectedByFog(N),Z=U.programConfigurations.get(r.id),J=u.getOrCreateProgram("heatmap",{config:Z,defines:I,overrideFog:q}),{zoom:K}=u.transform;u.terrain&&u.terrain.setupElevationDraw(F,J),u.uploadCommonUniforms(d,J,N.toUnwrapped());const oe=E.projection.createInversionMatrix(E,N.canonical);J.draw(u,f.TRIANGLES,Pt.disabled,_,T,P,rc(u,N,F,oe,R,K,r.paint.get("heatmap-intensity")),r.id,U.layoutVertexBuffer,U.indexBuffer,U.segments,r.paint,u.transform.zoom,Z,M?[U.globeExtVertexBuffer]:null)}d.viewport.set([0,0,u.width,u.height])}else u.renderPass==="translucent"&&(u.context.setColorMode(u.colorModeForRenderPass()),function(d,f){const _=d.context,T=_.gl,E=f.heatmapFbo;if(!E)return;_.activeTexture.set(T.TEXTURE0),T.bindTexture(T.TEXTURE_2D,E.colorAttachment.get()),_.activeTexture.set(T.TEXTURE1);let M=f.colorRampTexture;M||(M=f.colorRampTexture=new o.T(_,f.colorRamp,T.RGBA8)),M.bind(T.LINEAR,T.CLAMP_TO_EDGE),d.getOrCreateProgram("heatmapTexture").draw(d,T.TRIANGLES,Pt.disabled,$t.disabled,d.colorModeForRenderPass(),jt.disabled,((I,P,R,O)=>({u_image:0,u_color_ramp:1,u_opacity:P.paint.get("heatmap-opacity")}))(0,f),f.id,d.viewportBuffer,d.quadTriangleIndexBuffer,d.viewportSegments,f.paint,d.transform.zoom)}(u,r))},line:function(u,t,r,c){if(u.renderPass!=="translucent")return;const d=r.paint.get("line-opacity"),f=r.paint.get("line-width");if(d.constantOr(1)===0||f.constantOr(1)===0)return;const _=r.paint.get("line-emissive-strength"),T=r.paint.get("line-occlusion-opacity"),E=r.layout.get("line-elevation-reference"),M=r.layout.get("line-width-unit")==="meters",I=E==="sea",P=u.context,R=P.gl;if(r.hasElevatedBuckets&&u.transform.projection.name==="globe")return;const O=r.layout.get("line-cross-slope"),N=O!==void 0,F=O<1,U=u.colorModeForDrapableLayerRenderPass(_),q=u.terrain&&u.terrain.renderingToTexture,Z=q?1:o.q.devicePixelRatio,J=r.paint.get("line-dasharray"),K=J.constantOr(1),oe=r.layout.get("line-cap"),te=J.constantOr(null),ie=oe.constantOr(null),re=r.paint.get("line-pattern"),ue=re.constantOr(1),me=re.constantOr(null),Le=r.paint.get("line-opacity").constantOr(1);let Ee=!ue&&Le!==1||u.depthOcclusion&&T>0&&T<1;const Ze=r.paint.get("line-gradient"),We=ue?"linePattern":"line",ot=o.c$(r);let Se;if(q&&u.terrain&&u.terrain.clipOrMaskOverlapStencilType()&&(Ee=!1),T!==0&&u.depthOcclusion){const we=r.paint._values["line-opacity"];we&&we.value&&we.value.kind==="constant"?Se=we.value:o.w(`Occlusion opacity for layer ${r.id} is supported only when line-opacity isn't data-driven.`)}f.value.kind!=="constant"&&f.value.isLineProgressConstant===!1&&ot.push("VARIABLE_LINE_WIDTH");const He=(we,$e,Ve,Ke,De,Qe)=>
2476{for(const pt of we){const ft=t.getTile(pt);if(ue&&!ft.patternsLoaded())continue;const mt=ft.getBucket(r);if(!mt||mt.hasZOffset&&!De||!mt.hasZOffset&&De)continue;u.prepareDrawTile();const Et=mt.programConfigurations.get(r.id),qt=u.isTileAffectedByFog(pt),Lt=u.getOrCreateProgram(We,{config:Et,defines:$e,overrideFog:qt,overrideRtt:!De&&void 0});if(me&&ft.imageAtlas){const Ht=o.d0.from(me).getPrimary().scaleSelf(Z).toString(),Mt=ft.imageAtlas.patternPositions.get(Ht);Mt&&Et.setConstantPatternPositions(Mt)}if(!ue&&te&&ie&&ft.lineAtlas){const Ht=ft.lineAtlas.getDash(te,ie);Ht&&Et.setConstantPatternPositions(Ht)}let[Vt,kt]=r.paint.get("line-trim-offset");(ie==="round"||ie==="square")&&Vt!==kt&&(Vt===0&&(Vt-=1),kt===1&&(kt+=1));const ai=q?pt.projMatrix:null,xi=M?1/mt.tileToMeter/o.at(ft,1,u.transform.zoom):1,Di=M?1/mt.tileToMeter/o.at(ft,1,Math.floor(u.transform.zoom)):1,ei=ue?o.d1(u,ft,r,ai,Z,xi,Di,[Vt,kt]):o.d2(u,ft,r,ai,mt.lineClipsArray.length,Z,xi,Di,[Vt,kt]);if(Ze){const Ht=mt.gradients[r.id];let Mt=Ht.texture;if(r.gradientVersion!==Ht.version){let ci=256;if(r.stepInterpolant){const Ii=t.getSource().maxzoom,fi=pt.canonical.z===Ii?Math.ceil(1<<u.transform.maxZoom-pt.canonical.z):1;ci=o.ay(o.d3(mt.maxLineLength/o.ai*1024*fi),256,P.maxTextureSize)}Ht.gradient=o.d4({expression:r.gradientExpression(),evaluationKey:"lineProgress",resolution:ci,image:Ht.gradient||void 0,clips:mt.lineClipsArray}),Ht.texture?Ht.texture.update(Ht.gradient):Ht.texture=new o.T(P,Ht.gradient,R.RGBA8),Ht.version=r.gradientVersion,Mt=Ht.texture}P.activeTexture.set(R.TEXTURE1),Mt.bind(r.stepInterpolant?R.NEAREST:R.LINEAR,R.CLAMP_TO_EDGE)}K&&(P.activeTexture.set(R.TEXTURE0),ft.lineAtlasTexture&&ft.lineAtlasTexture.bind(R.LINEAR,R.REPEAT),Et.updatePaintBuffers()),ue&&(P.activeTexture.set(R.TEXTURE0),ft.imageAtlasTexture&&ft.imageAtlasTexture.bind(R.LINEAR,R.CLAMP_TO_EDGE),Et.updatePaintBuffers()),De&&!I&&u.terrain.setupElevationDraw(ft,Lt),u.uploadCommonUniforms(P,Lt,pt.toUnwrapped());const ji=Ht=>{Se!=null&&(Se.value=Le*T),Lt.draw(u,R.TRIANGLES,Ve,Ht,U,jt.disabled,ei,r.id,mt.layoutVertexBuffer,mt.indexBuffer,mt.segments,r.paint,u.transform.zoom,Et,[mt.layoutVertexBuffer2,mt.patternVertexBuffer,mt.zOffsetVertexBuffer]),Se!=null&&(Se.value=Le)};if(Ee&&!De){const Ht=u.stencilModeForClipping(pt).ref;Ht===0&&q&&P.clear({stencil:0});const Mt={func:R.EQUAL,mask:255};ei.u_alpha_discard_threshold=.8,ji(new $t(Mt,Ht,255,R.KEEP,R.KEEP,R.INVERT)),ei.u_alpha_discard_threshold=0,ji(new $t(Mt,Ht,255,R.KEEP,R.KEEP,R.KEEP))}else ei.u_alpha_discard_threshold=Ee&&De&&Qe?.8:0,ji(De?Ke:u.stencilModeForClipping(pt))}};if(r.hasNonElevatedBuckets){const we=!q&&u.terrain;T!==0&&we?o.w(`Occlusion opacity for layer ${r.id} is supported on terrain only if the layer has line-z-offset enabled.`):we?o.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${r.id}.`):He(c,ot,u.depthModeForSublayer(0,Pt.ReadOnly),$t.disabled,!1,!0)}if(r.hasElevatedBuckets){ot.push("ELEVATED"),N&&ot.push(F?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),I&&ot.push("ELEVATION_REFERENCE_SEA");const we=Ee?u.stencilModeFor3D():$t.disabled,$e=new Pt(u.depthOcclusion?R.GREATER:R.LEQUAL,Pt.ReadOnly,u.depthRangeFor3D);u.forceTerrainMode=!0,He(c,ot,$e,we,!0,!0),Ee&&He(c,ot,$e,we,!0,!1),u.forceTerrainMode=!1}Ee&&(u.resetStencilClippingMasks(),q&&P.clear({stencil:0})),T===0||u.depthOcclusion||q||u.layersWithOcclusionOpacity.push(u.currentLayer)},fill:function(u,t,r,c){const d=r.paint.get("fill-color"),f=r.paint.get("fill-opacity");if(f.constantOr(1)===0)return;const _=r.paint.get("fill-emissive-strength"),T=u.colorModeForDrapableLayerRenderPass(_),E=r.paint.get("fill-pattern"),M=u.opaquePassEnabledForLayer()&&!E.constantOr(1)&&d.constantOr(o.al.transparent).a===1&&f.constantOr(0)===1?"opaque":"translucent";let I="none";r.layout.get("fill-elevation-reference")!=="none"?I="road":r.paint.get("fill-z-offset").constantOr(1)!==0&&(I="offset");const P=!(!u.terrain||!u.terrain.enabled),R={painter:u,sourceCache:t,layer:r,coords:c,colorMode:T,elevationType:I,terrainEnabled:P,pass:M};if(I!=="offset"){if(lc(R,!1),I==="road"){const O=!P&&u.renderPass==="translucent";O&&Fu(u,t,r,c,"geometry"),lc(R,!0,$t.disabled),O&&function(N){const{painter:F,sourceCache:U,layer:q,co
2476ords:Z,colorMode:J}=N,K=F.context.gl,oe=new Pt(F.context.gl.LEQUAL,Pt.ReadOnly,F.depthRangeFor3D);for(const te of Z){const ie=U.getTile(te),re=ie.getBucket(q);if(!re)continue;const ue=re.elevatedStructures;if(!ue||!ue.renderableSegments||ue.renderableSegments.segments[0].primitiveLength===0)continue;F.prepareDrawTile();const me=re.bufferData.programConfigurations.get(q.id),Le=F.isTileAffectedByFog(te),Ee=F.getOrCreateProgram("elevatedStructures",{config:me,overrideFog:Le,defines:["NORMAL_OFFSET"]}),Ze={u_matrix:F.translatePosMatrix(te.projMatrix,ie,q.paint.get("fill-translate"),q.paint.get("fill-translate-anchor"))};F.uploadCommonUniforms(F.context,Ee,te.toUnwrapped()),Ee.draw(F,K.TRIANGLES,oe,$t.disabled,J,jt.backCCW,Ze,q.id,ue.vertexBuffer,ue.indexBuffer,ue.renderableSegments,q.paint,F.transform.zoom,me,[ue.vertexBufferNormal])}}(R)}}else lc(R,!1,u.stencilModeFor3D())},"fill-extrusion":function(u,t,r,c){const d=r.paint.get("fill-extrusion-opacity"),f=u.context,_=f.gl,T=u.terrain,E=T&&T.renderingToTexture;if(d===0)return;const M=u.conflationActive&&u.style.isLayerClipped(r,t.getSource()),I=u.style.order.indexOf(r.fqid);if(M&&function(P,R,O,N,F){for(const U of N){const q=R.getTile(U).getBucket(O);q&&(q.updateReplacement(U,P.replacementSource,F),q.uploadCentroid(P.context))}}(u,t,r,c,I),T||M)for(const P of c){const R=t.getTile(P).getBucket(r);R&&na(u.context,t,P,R,r,T,M)}if(u.renderPass==="shadow"&&u.shadowRenderer){const P=u.shadowRenderer;if(T&&d<.65&&r._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof o.ab)return;const R=P.getShadowPassDepthMode(),O=P.getShadowPassColorMode();Qa(u,t,r,c,R,$t.disabled,O,M)}else if(u.renderPass==="translucent"){const P=!r.paint.get("fill-extrusion-pattern").constantOr(1),R=r.paint.get("fill-extrusion-color").constantOr(o.al.white);if(!E&&R.a!==0){const O=new Pt(u.context.gl.LEQUAL,Pt.ReadWrite,u.depthRangeFor3D);d===1&&P?Qa(u,t,r,c,O,$t.disabled,ii.unblended,M):(Qa(u,t,r,c,O,$t.disabled,ii.disabled,M),Qa(u,t,r,c,O,u.stencilModeFor3D(),u.colorModeForRenderPass(),M),u.resetStencilClippingMasks())}if(u.style.enable3dLights()&&P&&(!T&&u.transform.projection.name!=="globe"||E)){const O=r.paint.get("fill-extrusion-opacity"),N=r.paint.get("fill-extrusion-ambient-occlusion-intensity"),F=r.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),U=r.paint.get("fill-extrusion-flood-light-intensity"),q=r.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",Z=r.paint.get("fill-extrusion-flood-light-color").toRenderColor(q?null:r.lut).toArray01().slice(0,3),J=N>0&&F>0,K=U>0,oe=(ie,re,ue)=>(1-ue)*ie+ue*re,te=ie=>{const re=u.depthModeForSublayer(1,Pt.ReadOnly,_.LEQUAL,!0),ue=r.paint.get(ie?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),me=oe(.1,3,ue),Le=u._showOverdrawInspector;if(!Le){const Ee=new $t({func:_.ALWAYS,mask:255},255,255,_.KEEP,_.KEEP,_.REPLACE),Ze=new ii([_.ONE,_.ONE,_.ONE,_.ONE],o.al.transparent,[!1,!1,!1,!0],_.MIN);ra(u,t,r,c,re,Ee,Ze,jt.disabled,ie,"sdf",O,N,F,U,Z,me,M,!1)}{const Ee=Le?$t.disabled:new $t({func:_.EQUAL,mask:255},255,255,_.KEEP,_.DECR,_.DECR),Ze=Le?u.colorModeForRenderPass():new ii([_.ONE_MINUS_DST_ALPHA,_.DST_ALPHA,_.ONE,_.ONE],o.al.transparent,[!0,!0,!0,!0]);ra(u,t,r,c,re,Ee,Ze,jt.disabled,ie,"color",O,N,F,U,Z,me,M,!1)}};if(E){const ie=(re,ue,me)=>{const Le=u.depthModeForSublayer(1,Pt.ReadOnly,_.LEQUAL,!1),Ee=r.paint.get(re?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),Ze=oe(.1,3,Ee);{const We=new ii([_.ONE,_.ONE,_.ONE,_.ONE],o.al.transparent,[!1,!1,!1,!0]);ra(u,t,r,c,Le,$t.disabled,We,jt.disabled,re,"clear",O,N,F,U,Z,Ze,M,ue)}{const We=new $t({func:_.ALWAYS,mask:255},255,255,_.KEEP,_.KEEP,_.REPLACE),ot=new ii([_.ONE,_.ONE,_.ONE,_.ONE],o.al.transparent,[!1,!1,!1,!0],_.MIN);ra(u,t,r,c,Le,We,ot,jt.disabled,re,"sdf",O,N,F,U,Z,Ze,M,ue)}{const We=re?_.ZERO:_.ONE_MINUS_DST_ALPHA,ot=new $t({func:_.EQUAL,mask:255},255,255,_.KEEP,_.DECR,_.DECR),Se=new ii([We,_.DST_ALPHA,_.ONE_MINUS_DST_ALPHA,_.ZERO],o.al.transparent,[!0,!0,!0,!0]);ra(u,t,r,c,Le,ot,Se,jt.disabled,re,"color",O,N,F,U,Z,Ze,M,ue)}{const We=new ii([_.ONE,_.ONE,_.ONE,re?_.ZERO:_.ONE],o.al.transparent,[!1,!1,!1,!0],re?_.FUNC_ADD:_.MAX);ra(u,t,r,c,Le,$t.disabled,We,jt.disabled,re,"clear",O,N,F,U,Z,Ze,M,ue,me)}};if(J||K){let re;if(u.prepareDrawTile(),T){const ue=T.drapeBufferSize[0],me=T.drapeBufferSize[1];re=T.framebufferCopyTexture,re&&(!re||re.size[0]===ue&&re.size[1]===me)||(re&&re.destroy(),re=T.framebufferCopyTexture=new o.T(f,new o.r({width:ue,height:me}),_.RGBA8)),re.bind(_.LINEAR,_.CLAMP_TO_EDGE),_.copyTexSubImage2D(_.TEXTURE_2D,0,0,0,0,0,ue,me)}J&&ie(!0,!1,re),K&&ie(!1,!0,re)}}else J&&te(!0),K&&te(!1),(J||K)&&u.resetStencilClippingMasks()}}},hillshade:function(u,t,r,c){if(u.renderPass!=="offscreen"&&u.renderPass!=="translucent"||u.style.disableElevatedTerrain)return;
2476const d=u.context,f=u.terrain&&u.terrain.renderingToTexture,[_,T]=u.renderPass!=="translucent"||f?[{},c]:u.stencilConfigForOverlap(c);for(const E of T){const M=t.getTile(E);if(M.needsHillshadePrepare&&u.renderPass==="offscreen")sf(u,M,r);else if(u.renderPass==="translucent"){const I=u.depthModeForSublayer(0,Pt.ReadOnly),P=r.paint.get("hillshade-emissive-strength"),R=u.colorModeForDrapableLayerRenderPass(P),O=f&&u.terrain?u.terrain.stencilModeForRTTOverlap(E):_[E.overscaledZ];Wo(u,E,M,r,I,O,R)}}d.viewport.set([0,0,u.width,u.height]),u.resetStencilClippingMasks()},raster:function(u,t,r,c,d,f){if(u.renderPass!=="translucent"||r.paint.get("raster-opacity")===0)return;const _=u.transform.projection.name==="globe",T=r.paint.get("raster-elevation")!==0,E=T&&_;if(u.renderElevatedRasterBackface&&!E)return;const M=u.context,I=M.gl,P=t.getSource(),R=function(te,ie,re,ue){const me=ie.paint.get("raster-color"),Le=te.type==="raster-array",Ee=[],Ze=ie.paint.get("raster-resampling"),We=ie.paint.get("raster-color-mix");let ot=ie.paint.get("raster-color-range");const Se=[We[0],We[1],We[2],0],He=We[3];let we=Ze==="nearest"?ue.NEAREST:ue.LINEAR;if(Le&&(Ee.push("RASTER_ARRAY"),me||Ee.push("RASTER_COLOR"),Ze==="linear"&&Ee.push("RASTER_ARRAY_LINEAR"),we=ue.NEAREST,!ot&&te.rasterLayers)){const $e=te.rasterLayers.find(({id:Ve})=>Ve===ie.sourceLayer);$e&&$e.fields&&$e.fields.range&&(ot=$e.fields.range)}if(ot=ot||[0,1],me){Ee.push("RASTER_COLOR"),re.activeTexture.set(ue.TEXTURE2),ie.updateColorRamp(ot);let $e=ie.colorRampTexture;$e||($e=ie.colorRampTexture=new o.T(re,ie.colorRamp,ue.RGBA8)),$e.bind(ue.LINEAR,ue.CLAMP_TO_EDGE)}return{mix:Se,range:ot,offset:He,defines:Ee,resampling:we}}(P,r,M,I);if(P instanceof o.aK&&!c.length&&!_)return;const O=r.paint.get("raster-emissive-strength"),N=u.colorModeForDrapableLayerRenderPass(O),F=u.terrain&&u.terrain.renderingToTexture,U=!u.options.moving,q=r.paint.get("raster-resampling")==="nearest"?I.NEAREST:I.LINEAR;if(P instanceof o.aK&&!c.length&&(P.onNorthPole||P.onSouthPole)){const te=T?u.stencilModeFor3D():$t.disabled;return void Pe(!!P.onNorthPole,null,u,t,r,O,R,jt.disabled,te)}if(!c.length)return;const[Z,J]=P instanceof o.aK||F?[{},c]:u.stencilConfigForOverlap(c),K=J[J.length-1].overscaledZ;E&&R.defines.push("PROJECTION_GLOBE_VIEW"),T&&R.defines.push("RENDER_CUTOFF");const oe=(te,ie,re)=>{for(const ue of te){const me=ue.toUnwrapped(),Le=t.getTile(ue);if(F&&(!Le||!Le.hasData()))continue;M.activeTexture.set(I.TEXTURE0);const Ee=cc(Le,P,r,R);if(!Ee||!Ee.texture)continue;const{texture:Ze,mix:We,offset:ot,tileSize:Se,buffer:He}=Ee;let we,$e;F?(we=Pt.disabled,$e=ue.projMatrix):T?(we=new Pt(I.LEQUAL,Pt.ReadWrite,u.depthRangeFor3D),$e=_?Float32Array.from(u.transform.expandedFarZProjMatrix):u.transform.calculateProjMatrix(me,U)):(we=u.depthModeForSublayer(ue.overscaledZ-K,r.paint.get("raster-opacity")===1?Pt.ReadWrite:Pt.ReadOnly,I.LESS),$e=u.transform.calculateProjMatrix(me,U));const Ve=u.terrain&&F?u.terrain.stencilModeForRTTOverlap(ue):Z[ue.overscaledZ],Ke=f?0:r.paint.get("raster-fade-duration");Le.registerFadeDuration(Ke);const De=t.findLoadedParent(ue,0),Qe=Kl(Le,De,t,u.transform,Ke);let pt,ft;u.terrain&&u.terrain.prepareDrawTile(),M.activeTexture.set(I.TEXTURE0),Ze.bind(q,I.CLAMP_TO_EDGE),M.activeTexture.set(I.TEXTURE1),De?(De.texture&&De.texture.bind(q,I.CLAMP_TO_EDGE),pt=Math.pow(2,De.tileID.overscaledZ-Le.tileID.overscaledZ),ft=[Le.tileID.canonical.x*pt%1,Le.tileID.canonical.y*pt%1]):Ze.bind(q,I.CLAMP_TO_EDGE),"useMipmap"in Ze&&M.extTextureFilterAnisotropic&&u.transform.pitch>20&&I.texParameterf(I.TEXTURE_2D,M.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,M.extTextureFilterAnisotropicMax);const mt=u.transform;let Et;const qt=T?wd(mt):[0,0,0,0];let Lt,Vt,kt,ai,xi,Di=0;if(E&&P instanceof o.aK&&P.coordinates.length>3)Lt=Float32Array.from(o.bc(o.cI(new o.bT(0,0,0)))),Vt=Float32Array.from(mt.globeMatrix),kt=Float32Array.from(o.cE(mt)),ai=[o.av(mt.center.lng),o.aC(mt.center.lat)],Et=P.elevatedGlobePerspectiveTransform,xi=P.elevatedGlobeGridMatrix||new Float32Array(9);else if(E){const Mt=o.cF(ue.canonical);Di=o.cG(Mt.getCenter().lat),Lt=Float32Array.from(o.bc(o.cI(ue.canonical))),Vt=Float32Array.from(mt.globeMatrix),kt=Float32Array.from(o.cE(mt)),ai=[o.av(mt.center.lng),o.aC(mt.center.lat)],Et=[0,0],xi=Float32Array.from(o.cH(ue.canonical,Mt,Di,mt.worldSize/mt._pixelsPerMercatorPixel))}else Et=P instanceof o.aK?P.perspectiveTransform:[0,0],Lt=new Float32Array(16),Vt=new Float32Array(9),kt=new Float32Array(16),ai=[0,0],xi=new Float32Array(9);const ei=Cu($e,Lt,Vt,kt,xi,ft||[0,0],o.ag(u.transform.zoom),ai,qt,pt||1,Qe,r,Et,T?r.paint.get("raster-elevation"):0,2,We,ot,R.range,Se,He,O),ji=u.isTileAffectedByFog(ue),Ht=u.getOrCreateProgram("raster",{defines:R.defines,overrideFog:ji});if(u.uploadCommonUniforms(M,Ht,me),P instanceof o.aK){const Mt=P.elevatedGlobeVertexBuffer,ci=P.elevatedGlobeIndexBuffer;
2476if(F||!_)P.boundsBuffer&&P.boundsSegments&&Ht.draw(u,I.TRIANGLES,we,$t.disabled,N,jt.disabled,ei,r.id,P.boundsBuffer,u.quadTriangleIndexBuffer,P.boundsSegments);else if(Mt&&ci){const Ii=mt.zoom<=o.c6?P.elevatedGlobeSegments:P.getSegmentsForLongitude(mt.center.lng);Ii&&Ht.draw(u,I.TRIANGLES,we,$t.disabled,N,ie,ei,r.id,Mt,ci,Ii)}}else if(E){we=new Pt(I.LEQUAL,Pt.ReadOnly,u.depthRangeFor3D);const Mt=u.globeSharedBuffers;if(Mt){const[ci,Ii,fi]=Mt.getGridBuffers(Di,!1);Ht.draw(u,I.TRIANGLES,we,re||Ve,u.colorModeForRenderPass(),ie,ei,r.id,ci,Ii,fi)}}else{const{tileBoundsBuffer:Mt,tileBoundsIndexBuffer:ci,tileBoundsSegments:Ii}=u.getTileBoundsBuffers(Le);Ht.draw(u,I.TRIANGLES,we,Ve,N,jt.disabled,ei,r.id,Mt,ci,Ii)}}if(!(P instanceof o.aK)&&E)for(const ue of te){const me=ue.canonical.y===(1<<ue.canonical.z)-1;ue.canonical.y===0&&Pe(!0,ue,u,t,r,O,R,ie,re||$t.disabled),me&&Pe(!1,ue,u,t,r,O,R,ie===jt.frontCW?jt.backCW:jt.frontCW,re||$t.disabled)}};E?oe(J,u.renderElevatedRasterBackface?jt.backCW:jt.frontCW,u.stencilModeFor3D()):oe(J,jt.disabled,void 0),u.resetStencilClippingMasks()},"raster-particle":function(u,t,r,c,d,f){u.renderPass==="offscreen"&&function(_,T,E,M){if(!M.length)return;const I=_.context,P=I.gl,R=T.getSource();if(!(R instanceof as))return;const O=Math.ceil(Math.sqrt(E.paint.get("raster-particle-count")));let N=E.particlePositionRGBAImage;if(!N||N.width!==O){const J=function(K){const oe=K*K,te=new Uint8Array(4*oe),ie=function(ue){return ue|=0,ue=Math.imul(2747636419^ue,2654435769),ue=Math.imul(ue^ue>>>16,2654435769),((ue=Math.imul(ue^ue>>>16,2654435769))>>>0)/4294967296},re=1/1.1;for(let ue=0;ue<oe;ue++){const me=re*(ie(2*ue+0)+mn),Le=re*(ie(2*ue+1)+mn),Ee=255*me%1,Ze=255*Le%1,We=Ee,ot=Le-Ze/255,Se=Ze;te[4*ue+0]=255*(me-Ee/255),te[4*ue+1]=255*We,te[4*ue+2]=255*ot,te[4*ue+3]=255*Se}return te}(O);N=E.particlePositionRGBAImage=new o.r({width:O,height:O},J)}let F=E.particleFramebuffer;F?F.width!==O&&(F.destroy(),F=E.particleFramebuffer=I.createFramebuffer(O,O,!0,null)):F=E.particleFramebuffer=I.createFramebuffer(O,O,!0,null);const U=[];for(const J of M){const K=T.getTile(J);if(!(K instanceof Xr))continue;const oe=Td(K,R,E);if(!oe)continue;const te=[K.tileSize,K.tileSize];let ie=E.tileFramebuffer;ie||(ie=E.tileFramebuffer=I.createFramebuffer(te[0],te[1],!0,null));let re=K.rasterParticleState;re||(re=K.rasterParticleState=new Nu(I,J,te,N));const ue=re.update(E.lastInvalidatedAt);re.particleTextureDimension!==O&&re.updateParticleTexture(J,N);const me=re.targetColorTexture;re.targetColorTexture=re.backgroundColorTexture,re.backgroundColorTexture=me;const Le=re.particleTexture0;re.particleTexture0=re.particleTexture1,re.particleTexture1=Le,U.push([J,oe,re,ue])}if(U.length===0)return;const q=o.q.now(),Z=E.previousDrawTimestamp?.001*(q-E.previousDrawTimestamp):.0167;if(E.previousDrawTimestamp=q,E.hasColorMap()){I.activeTexture.set(P.TEXTURE0+2);let J=E.colorRampTexture;J||(J=E.colorRampTexture=new o.T(I,E.colorRamp,P.RGBA8)),J.bind(P.LINEAR,P.CLAMP_TO_EDGE)}I.bindFramebuffer.set(E.tileFramebuffer.framebuffer),function(J,K,oe){const te=J.context,ie=te.gl,re=K.tileFramebuffer;te.activeTexture.set(ie.TEXTURE0);const ue={u_texture:0,u_opacity:1.05*(Le=K.paint.get("raster-particle-fade-opacity-factor"))/(Le+.05)},me=J.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});var Le;for(const Ee of oe){const[,,Ze,We]=Ee;re.colorAttachment.set(Ze.targetColorTexture.texture),te.viewport.set([0,0,re.width,re.height]),te.clear({color:o.al.transparent}),We&&(Ze.backgroundColorTexture.bind(ie.NEAREST,ie.CLAMP_TO_EDGE),me.draw(J,ie.TRIANGLES,Pt.disabled,$t.disabled,ii.alphaBlended,jt.disabled,ue,K.id,J.viewportBuffer,J.quadTriangleIndexBuffer,J.viewportSegments))}}(_,E,U),function(J,K,oe,te){const ie=J.context,re=ie.gl,ue=oe.tileFramebuffer,me=J.transform.projection.name==="globe",Le=oe.paint.get("raster-particle-max-speed");for(const Ee of te){const[Ze,We,ot]=Ee;ie.activeTexture.set(re.TEXTURE0+0),We.texture.bind(re.LINEAR,re.CLAMP_TO_EDGE),ue.colorAttachment.set(ot.targetColorTexture.texture);const Se=J.getOrCreateProgram("rasterParticleDraw",{defines:We.defines,overrideFog:!1});ie.activeTexture.set(re.TEXTURE0+1);const He=We.scalarData?[]:[0,1,2,3].map(Ve=>o.d7[Ve](Ze));He.push(Ze);const we=Ze.canonical.x,$e=Ze.canonical.y;for(const Ve of He){const Ke=K.getTile(me?Ve.wrapped():Ve);if(!Ke)continue;const De=Ke.rasterParticleState;if(!De)continue;const Qe=Ve.canonical.x+(1<<Ve.canonical.z)*(Ve.wrap-Ze.wrap),pt=Ve.canonical.y;De.particleTexture0.bind(re.NEAREST,re.CLAMP_TO_EDGE);
2476const ft=Pu(1,De.particleTexture0.size[0],[Qe-we,pt-$e],0,We.texture.size,2,Le,We.textureOffset,We.scale,We.offset);Se.draw(J,re.POINTS,Pt.disabled,$t.disabled,ii.alphaBlended,jt.disabled,ft,oe.id,De.particleIndexBuffer,void 0,De.particleSegment)}}}(_,T,E,U),I.bindFramebuffer.set(E.particleFramebuffer.framebuffer),function(J,K,oe,te){const ie=J.context,re=ie.gl,ue=K.paint.get("raster-particle-max-speed"),me=te*K.paint.get("raster-particle-speed-factor")*.15,Le=function(Ze){return Math.pow(Ze,6)}(.01+1*K.paint.get("raster-particle-reset-rate-factor")),Ee=K.particleFramebuffer;ie.viewport.set([0,0,Ee.width,Ee.height]);for(const Ze of oe){const[,We,ot]=Ze;ie.activeTexture.set(re.TEXTURE0+0),We.texture.bind(re.LINEAR,re.CLAMP_TO_EDGE),ie.activeTexture.set(re.TEXTURE0+1);const Se=ot.particleTexture0;Se.bind(re.NEAREST,re.CLAMP_TO_EDGE);const He=mf(1,Se.size[0],0,We.texture.size,ue,me,Le,We.textureOffset,We.scale,We.offset);Ee.colorAttachment.set(ot.particleTexture1.texture),ie.clear({color:o.al.transparent}),J.getOrCreateProgram("rasterParticleUpdate",{defines:We.defines}).draw(J,re.TRIANGLES,Pt.disabled,$t.disabled,ii.unblended,jt.disabled,He,K.id,J.viewportBuffer,J.quadTriangleIndexBuffer,J.viewportSegments)}}(_,E,U,Z)}(u,t,r,c),u.renderPass==="translucent"&&(function(_,T,E,M,I){const P=_.context,R=P.gl,O=T.getSource().tileSize,N=5*(1-o.ae(o.bY,o.bY+1,_.transform.zoom))*O+E.paint.get("raster-particle-elevation"),F=!_.options.moving,U=_.transform.projection.name==="globe";if(!M.length)return;const[q,Z]=_.stencilConfigForOverlap(M),J=[];U&&J.push("PROJECTION_GLOBE_VIEW");const K=_.stencilModeFor3D();for(const oe of Z){const te=oe.toUnwrapped(),ie=T.getTile(oe);if(!ie.rasterParticleState)continue;const re=ie.rasterParticleState,ue=100;ie.registerFadeDuration(ue);const me=T.findLoadedParent(oe,0),Le=Kl(ie,me,T,_.transform,ue);let Ee,Ze;_.terrain&&_.terrain.prepareDrawTile(),P.activeTexture.set(R.TEXTURE0),re.targetColorTexture.bind(R.LINEAR,R.CLAMP_TO_EDGE),P.activeTexture.set(R.TEXTURE1),me&&me.rasterParticleState?(me.rasterParticleState.targetColorTexture.bind(R.LINEAR,R.CLAMP_TO_EDGE),Ee=Math.pow(2,me.tileID.overscaledZ-ie.tileID.overscaledZ),Ze=[ie.tileID.canonical.x*Ee%1,ie.tileID.canonical.y*Ee%1]):re.targetColorTexture.bind(R.LINEAR,R.CLAMP_TO_EDGE);const We=U?Float32Array.from(_.transform.expandedFarZProjMatrix):_.transform.calculateProjMatrix(te,F),ot=_.transform,Se=Sd(ot),He=o.cF(oe.canonical),we=o.cG(He.getCenter().lat);let $e,Ve,Ke,De,Qe;U?($e=Float32Array.from(o.bc(o.cI(oe.canonical))),Ve=Float32Array.from(ot.globeMatrix),Ke=Float32Array.from(o.cE(ot)),De=[o.av(ot.center.lng),o.aC(ot.center.lat)],Qe=Float32Array.from(o.cH(oe.canonical,He,we,ot.worldSize/ot._pixelsPerMercatorPixel))):($e=new Float32Array(16),Ve=new Float32Array(9),Ke=new Float32Array(16),De=[0,0],Qe=new Float32Array(9));const pt=Rt(We,$e,Ve,Ke,Qe,Ze||[0,0],o.ag(_.transform.zoom),De,Se,Ee||1,Le,N),ft=_.isTileAffectedByFog(oe),mt=_.getOrCreateProgram("rasterParticle",{defines:J,overrideFog:ft});if(_.uploadCommonUniforms(P,mt,te),U){const Et=new Pt(R.LEQUAL,Pt.ReadOnly,_.depthRangeFor3D),qt=0,Lt=_.globeSharedBuffers;if(Lt){const[Vt,kt,ai]=Lt.getGridBuffers(we,qt!==0);mt.draw(_,R.TRIANGLES,Et,K,ii.alphaBlended,_.renderElevatedRasterBackface?jt.frontCCW:jt.backCCW,pt,E.id,Vt,kt,ai)}}else{const Et=_.depthModeForSublayer(0,Pt.ReadOnly),qt=q[oe.overscaledZ],{tileBoundsBuffer:Lt,tileBoundsIndexBuffer:Vt,tileBoundsSegments:kt}=_.getTileBoundsBuffers(ie);mt.draw(_,R.TRIANGLES,Et,qt,ii.alphaBlended,jt.disabled,pt,E.id,Lt,Vt,kt)}}_.resetStencilClippingMasks()}(u,t,r,c),u.style.map.triggerRepaint())},background:function(u,t,r,c){const d=r.paint.get("background-color"),f=r.paint.get("background-color-use-theme").constantOr("default")==="none",_=r.paint.get("background-opacity"),T=r.paint.get("background-emissive-strength"),E=r.paint.get("background-pitch-alignment")==="viewport";if(_===0)return;const M=u.context,I=M.gl,P=u.transform,R=P.tileSize,O=r.paint.get("background-pattern");let N;if(O!==void 0&&(O===null||(N=u.imageManager.getPattern(o.I.from(O.toString()),r.scope,u.style.getLut(r.scope)),!N)))return;
2476const F=!O&&d.a===1&&_===1&&u.opaquePassEnabledForLayer()?"opaque":"translucent";if(u.renderPass!==F)return;const U=$t.disabled,q=u.depthModeForSublayer(0,F==="opaque"?Pt.ReadWrite:Pt.ReadOnly),Z=u.colorModeForDrapableLayerRenderPass(T),J=O?"backgroundPattern":"background";let K,oe=c;if(oe||(K=u.getBackgroundTiles(),oe=Object.values(K).map(te=>te.tileID)),O&&(M.activeTexture.set(I.TEXTURE0),u.imageManager.bind(u.context,r.scope)),E){const te=u.getOrCreateProgram(J,{overrideFog:!1,overrideRtt:!0}),ie=new Float32Array(o.ad.mat4.identity([])),re=new o.aH(0,0,0,0,0),ue=O?vd(ie,T,_,u,0,r.scope,N,E,{tileID:re,tileSize:R}):Ru(ie,T,_,d.toRenderColor(f?null:r.lut));te.draw(u,I.TRIANGLES,q,U,Z,jt.disabled,ue,r.id,u.viewportBuffer,u.quadTriangleIndexBuffer,u.viewportSegments)}else for(const te of oe){const ie=u.isTileAffectedByFog(te),re=u.getOrCreateProgram(J,{overrideFog:ie}),ue=te.toUnwrapped(),me=c?te.projMatrix:u.transform.calculateProjMatrix(ue);u.prepareDrawTile();const Le=t?t.getTile(te):K?K[te.key]:new kn(te,R,P.zoom,u),Ee=O?vd(me,T,_,u,0,r.scope,N,E,{tileID:te,tileSize:R}):Ru(me,T,_,d.toRenderColor(f?null:r.lut));u.uploadCommonUniforms(M,re,ue);const{tileBoundsBuffer:Ze,tileBoundsIndexBuffer:We,tileBoundsSegments:ot}=u.getTileBoundsBuffers(Le);re.draw(u,I.TRIANGLES,q,U,Z,jt.disabled,Ee,r.id,Ze,We,ot)}},sky:function(u,t,r){const c=u._atmosphere?o.ag(u.transform.zoom):1,d=r.paint.get("sky-opacity")*c;if(d===0)return;const f=u.context,_=r.paint.get("sky-type"),T=new Pt(f.gl.LEQUAL,Pt.ReadOnly,[0,1]),E=u.frameCounter/1e3%1;_==="atmosphere"?u.renderPass==="offscreen"?r.needsSkyboxCapture(u)&&(function(M,I,P,R){const O=M.context,N=O.gl;let F=I.skyboxFbo;if(!F){F=I.skyboxFbo=O.createFramebuffer(32,32,!0,null),I.skyboxGeometry=new Md(O),I.skyboxTexture=O.gl.createTexture(),N.bindTexture(N.TEXTURE_CUBE_MAP,I.skyboxTexture),N.texParameteri(N.TEXTURE_CUBE_MAP,N.TEXTURE_WRAP_S,N.CLAMP_TO_EDGE),N.texParameteri(N.TEXTURE_CUBE_MAP,N.TEXTURE_WRAP_T,N.CLAMP_TO_EDGE),N.texParameteri(N.TEXTURE_CUBE_MAP,N.TEXTURE_MIN_FILTER,N.LINEAR),N.texParameteri(N.TEXTURE_CUBE_MAP,N.TEXTURE_MAG_FILTER,N.LINEAR);for(let J=0;J<6;++J)N.texImage2D(N.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,N.RGBA,32,32,0,N.RGBA,N.UNSIGNED_BYTE,null)}O.bindFramebuffer.set(F.framebuffer),O.viewport.set([0,0,32,32]);const U=I.getCenter(M,!0),q=M.getOrCreateProgram("skyboxCapture"),Z=new Float64Array(16);o.ad.mat4.identity(Z),o.ad.mat4.rotateY(Z,Z,.5*-Math.PI),br(M,I,q,Z,U,0),o.ad.mat4.identity(Z),o.ad.mat4.rotateY(Z,Z,.5*Math.PI),br(M,I,q,Z,U,1),o.ad.mat4.identity(Z),o.ad.mat4.rotateX(Z,Z,.5*-Math.PI),br(M,I,q,Z,U,2),o.ad.mat4.identity(Z),o.ad.mat4.rotateX(Z,Z,.5*Math.PI),br(M,I,q,Z,U,3),o.ad.mat4.identity(Z),br(M,I,q,Z,U,4),o.ad.mat4.identity(Z),o.ad.mat4.rotateY(Z,Z,Math.PI),br(M,I,q,Z,U,5),O.viewport.set([0,0,M.width,M.height])}(u,r),r.markSkyboxValid(u)):u.renderPass==="sky"&&function(M,I,P,R,O){const N=M.context,F=N.gl,U=M.transform,q=M.getOrCreateProgram("skybox");N.activeTexture.set(F.TEXTURE0),F.bindTexture(F.TEXTURE_CUBE_MAP,I.skyboxTexture);const Z=((J,K,oe,te,ie)=>({u_matrix:J,u_sun_direction:K,u_cubemap:0,u_opacity:te,u_temporal_offset:ie}))(U.skyboxMatrix,I.getCenter(M,!1),0,R,O);M.uploadCommonUniforms(N,q),q.draw(M,F.TRIANGLES,P,$t.disabled,M.colorModeForRenderPass(),jt.backCW,Z,"skybox",I.skyboxGeometry.vertexBuffer,I.skyboxGeometry.indexBuffer,I.skyboxGeometry.segment)}(u,r,T,d,E):_==="gradient"&&u.renderPass==="sky"&&function(M,I,P,R,O){const N=M.context,F=N.gl,U=M.transform,q=M.getOrCreateProgram("skyboxGradient");I.skyboxGeometry||(I.skyboxGeometry=new Md(N)),N.activeTexture.set(F.TEXTURE0);let Z=I.colorRampTexture;Z||(Z=I.colorRampTexture=new o.T(N,I.colorRamp,F.RGBA8)),Z.bind(F.LINEAR,F.CLAMP_TO_EDGE);const J=((K,oe,te,ie,re)=>({u_matrix:K,u_color_ramp:0,u_center_direction:oe,u_radius:o.ak(te),u_opacity:ie,u_temporal_offset:re}))(U.skyboxMatrix,I.getCenter(M,!1),I.paint.get("sky-gradient-radius"),R,O);M.uploadCommonUniforms(N,q),q.draw(M,F.TRIANGLES,P,$t.disabled,M.colorModeForRenderPass(),jt.backCW,J,"skyboxGradient",I.skyboxGeometry.vertexBuffer,I.skyboxGeometry.indexBuffer,I.skyboxGeometry.segment)}(u,r,T,d,E)},debug:function(u,t,r,c,d,f){for(let _=0;_<r.length;_++)if(d){const M=new o.al(c.r*.8,c.g*.8,c.b*.8,1);Gs(u,t,r[_],c,-1,-1,f),Gs(u,t,r[_],c,-1,1,f),Gs(u,t,r[_],c,1,1,f),Gs(u,t,r[_],c,1,-1,f),Gs(u,t,r[_],M,0,0,f)}else Gs(u,t,r[_],c,0,0,f)}
2476,custom:function(u,t,r,c){const d=u.context,f=r.implementation;if(!u.transform.projection.unsupportedLayers||!u.transform.projection.unsupportedLayers.includes("custom")||u.terrain&&(u.terrain.renderingToTexture||u.renderPass==="offscreen")&&r.isDraped(t)){if(u.renderPass==="offscreen"){const _=f.prerender;if(_){if(u.setCustomLayerDefaults(),d.setColorMode(u.colorModeForRenderPass()),u.transform.projection.name==="globe"){const T=u.transform.pointMerc;_.call(f,d.gl,u.transform.customLayerMatrix(),u.transform.getProjection(),u.transform.globeToMercatorMatrix(),o.ag(u.transform.zoom),[T.x,T.y],u.transform.pixelsPerMeterRatio)}else _.call(f,d.gl,u.transform.customLayerMatrix());d.setDirty(),u.setBaseState()}}else if(u.renderPass==="translucent"){if(u.terrain&&u.terrain.renderingToTexture){const T=f.renderToTile;if(T){const E=c[0].canonical,M=new o.ac(E.x+c[0].wrap*(1<<E.z),E.y,E.z);d.setDepthMode(Pt.disabled),d.setStencilMode($t.disabled),d.setColorMode(u.colorModeForRenderPass()),u.setCustomLayerDefaults(),T.call(f,d.gl,M),d.setDirty(),u.setBaseState()}return}u.setCustomLayerDefaults(),d.setColorMode(u.colorModeForRenderPass()),d.setStencilMode($t.disabled);const _=f.renderingMode==="3d"?new Pt(u.context.gl.LEQUAL,Pt.ReadWrite,u.depthRangeFor3D):u.depthModeForSublayer(0,Pt.ReadOnly);if(d.setDepthMode(_),u.transform.projection.name==="globe"){const T=u.transform.pointMerc;f.render(d.gl,u.transform.customLayerMatrix(),u.transform.getProjection(),u.transform.globeToMercatorMatrix(),o.ag(u.transform.zoom),[T.x,T.y],u.transform.pixelsPerMeterRatio)}else f.render(d.gl,u.transform.customLayerMatrix());d.setDirty(),u.setBaseState(),d.bindFramebuffer.set(null)}}else o.w("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")},model:function(u,t,r,c){if(u.renderPass==="opaque")return;const d=r.paint.get("model-opacity").constantOr(1);if(d===0)return;const f=r.paint.get("model-cast-shadows");if(u.renderPass==="shadow"&&(!f||u.terrain&&d<.65&&r._transitionablePaint._values["model-opacity"].value.expression instanceof o.ab))return;const _=u.shadowRenderer,T=r.paint.get("model-receive-shadows");_&&(_.useNormalOffset=!0,T||(_.enabled=!1));const E=()=>{_&&(_.useNormalOffset=!0,T||(_.enabled=!0))},M=t.getSource();if(u.renderPass==="light-beam"&&M.type!=="batched-model")return;if(M.type==="vector"||M.type==="geojson")return function(q,Z,J,K,oe){const te=q.transform;if(te.projection.name!=="mercator")return void o.w(`Drawing 3D models for ${te.projection.name} projection is not yet implemented`);const ie=te.getFreeCameraOptions().position;if(!q.modelManager)return;const re=q.modelManager;J.modelManager=re;const ue=q.shadowRenderer;if(!J._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const me=J._unevaluatedLayout._values["model-id"],Le=Object.assign({},J.layout.get("model-id").parameters),Ee=q.style.order.indexOf(J.fqid);for(const Ze of K){const We=Z.getTile(Ze).getBucket(J);if(!We||We.projection.name!==te.projection.name)continue;const ot=We.getModelUris();ot&&!We.modelsRequested&&(re.addModelsFromBucket(ot,oe),We.modelsRequested=!0);const Se=qu(Ze,te);Le.zoom=Se;const He=me.possiblyEvaluate(Le);if(ju(q,We,Ze),An.shadowUniformsInitialized=!1,An.useSingleShadowCascade=!!ue&&ue.getMaxCascadeForTile(Ze.toUnwrapped())===0,q.renderPass==="shadow"&&ue){if(q.currentShadowCascade===1&&We.isInsideFirstShadowMapFrustum)continue;const Ve=te.calculatePosMatrix(Ze.toUnwrapped(),te.worldSize);if(An.tileMatrix.set(Ve),An.shadowTileMatrix=Float32Array.from(ue.calculateShadowPassMatrixFromMatrix(Ve)),An.aabb.min.fill(0),An.aabb.max[0]=An.aabb.max[1]=o.ai,An.aabb.max[2]=0,dc(We,An,q,J.scope))continue}const we=1<<Ze.canonical.z,$e=[((ie.x-Ze.wrap)*we-Ze.canonical.x)*o.ai,(ie.y*we-Ze.canonical.y)*o.ai,ie.z*we*o.ai];q.conflationActive&&Object.keys(We.instancesPerModel).length>0&&q.style.isLayerClipped(J,Z.getSource())&&We.updateReplacement(Ze,q.replacementSource,Ee,oe)&&(We.uploaded=!1,We.upload(q.context));for(let Ve in We.instancesPerModel){const Ke=We.instancesPerModel[Ve];Ke.features.length>0&&(Ve=He.evaluate(Ke.features[0].feature,{}));const De=re.getModel(Ve,oe);if(De&&De.uploaded)for(const Qe of De.nodes)Vn(q,J,Qe,Ke,$e,Ze,An)}}}(u,t,r,c,M.type==="vector"?r.scope:""),void E();if(!M.loaded())return;if(M.type==="batched-model")return function(q,Z,J,K){J.resetLayerRenderingStats(q);const oe=q.context,te=q.transform,ie=q.style.fog,re=q.shadowRenderer;if(te.projection.name!=="mercator")return void o.w(`Drawing 3D landmark models for ${te.projection.name} projection is not yet implemented`);const ue=q.transform.getFreeCameraOptions().position,me=o.ad.vec3.scale([],[ue.x,ue.y,ue.z],q.transform.worldSize),Le=o.ad.vec3.negate([],me),Ee=o.ad.mat4.identity([]),Ze=o.dm(te.center.lat,te.zoom),We=o.ad.mat4.fromScaling([],[1,1,1/Ze]);o.ad.mat4.translate(Ee,Ee,Le);const ot=J.paint.get("model-opacity").constantOr(1),Se=new Pt(oe.gl.LEQUAL,Pt.ReadWrite,q.depthRangeFor3D),He=new Pt(oe.gl.LEQUAL,Pt.ReadOnly,q.depthRangeFor3D),we=new o.ce([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),$e=q.renderPass==="shadow",Ve=$e&&re?re.getCurrentCascadeFrustum():te.getFrustum(te.scaleZoom(te.worldSize)),Ke=J.paint.get("model-front-cutoff"),De=Ke[2]<1,Qe=fs(q,J.paint.get("model-cutoff-fade-range")),pt=J.getLayerRenderingStats();(function(ft,mt,Et,qt){const Lt=ft.terrain?ft.terrain.exaggeration():0,Vt=ft.transform.zoom;for(const kt of qt){const ai=mt.getTile(kt).getBucket(Et);ai&&(ai.setFilter(Et.filter),ft.conflationActive&&ai.updateReplacement(kt,ft.replacementSource),ai.evaluateScale(ft,Et),ft.terrain&&Lt>0&&ai.elevationUpdate(ft.terrain,Lt,kt,Et.source),ai.needsReEvaluation(ft,Vt,Et)&&ai.evaluate(Et))}})(q,Z,J,K),function(){let ft,mt,Et;De?(ft=K.length-1,mt=-1,Et=-1):(ft=0,mt=K.length,Et=1);const qt=new Float64Array(16),Lt=o.ad.vec3.create(),Vt=new o.P(0,0);for(let kt=ft;kt!==mt;kt+=Et){const ai=K[kt],xi=Z.getTile(ai).getBucket(J);if(!xi||!xi.uploaded)continue;let Di=!1;re&&(Di=re.getMaxCascadeForTile(ai.toUnwrapped())===0);const ei=te.calculatePosMatrix(ai.toUnwrapped(),te.worldSize),ji=xi.modelTraits;!$e&&De&&(o.ad.mat4.invert(qt,ei),o.ad.vec3.transformMat4(Lt,me,qt),Vt.x=Lt[0],Vt.y=Lt[1]);const Ht=[];xi.setFilter(J.filter);
2476for(const Mt of xi.getNodesInfo()){if(Mt.hiddenByReplacement||!Mt.node.meshes)continue;const ci=Mt.node;let Ii=0;q.terrain&&ci.elevation&&(Ii=ci.elevation*q.terrain.exaggeration());const fi=(()=>{const Pi=Mt.aabb;return we.min=[...Pi.min],we.max=[...Pi.max],we.min[2]+=Ii,we.max[2]+=Ii,o.ad.vec3.transformMat4(we.min,we.min,ei),o.ad.vec3.transformMat4(we.max,we.max,ei),we})(),Yi=Mt.evaluatedScale;if(Yi[0]<=1&&Yi[1]<=1&&Yi[2]<=1&&fi.intersects(Ve)===0)continue;if(!$e&&De){const Pi=.16666666666666666;Mt.cameraCollisionOpacity=me[0]>fi.min[0]&&me[0]<fi.max[0]&&me[1]>fi.min[1]&&me[1]<fi.max[1]&&me[2]*Ze<fi.max[2]&&ci.footprint&&o.bA(Vt,ci.footprint)?Math.max(Mt.cameraCollisionOpacity-Pi,0):Math.min(1,Mt.cameraCollisionOpacity+Pi)}const nr=[...ei],cr=ci.anchor?ci.anchor[0]:0,hr=ci.anchor?ci.anchor[1]:0;o.ad.mat4.translate(nr,nr,[cr*(Yi[0]-1),hr*(Yi[1]-1),Ii]),o.ad.vec3.exactEquals(Yi,o.dq)||o.ad.mat4.scale(nr,nr,Yi);const yn=o.ad.mat4.multiply([],nr,ci.matrix),kr=o.ad.mat4.multiply([],te.expandedFarZProjMatrix,yn),di=o.ad.mat4.multiply([],te.expandedFarZProjMatrix,nr),qi=o.ad.vec4.transformMat4([],[cr,hr,Ii,1],kr)[2];ci.hidden=!1;let bi=ot;$e||(De&&(bi*=Mt.cameraCollisionOpacity,bi*=Gu(nr,te,Mt.aabb,Ke)),bi*=pc(Qe,qi)),bi!==0?Ht.push({nodeInfo:Mt,depth:qi,opacity:bi,wvpForNode:kr,wvpForTile:di,nodeModelMatrix:yn,tileModelMatrix:nr}):ci.hidden=!0}$e||Ht.sort((Mt,ci)=>!De||Mt.opacity===1&&ci.opacity===1?Mt.depth<ci.depth?-1:1:Mt.opacity===1?-1:ci.opacity===1?1:Mt.depth>ci.depth?-1:1);for(const Mt of Ht){const ci=Mt.nodeInfo,Ii=ci.node;let fi=o.ad.mat4.multiply([],We,Mt.tileModelMatrix);o.ad.mat4.multiply(fi,Ee,fi);const Yi=o.ad.mat4.invert([],fi);o.ad.mat4.transpose(Yi,Yi),o.ad.mat4.scale(Yi,Yi,$s),fi=o.ad.mat4.multiply(fi,fi,Ii.matrix);const nr=q.renderPass==="light-beam",cr=J.paint.get("model-color-use-theme").constantOr("default")==="none",hr=ji&o.ds.HasMapboxMeshFeatures,yn=hr?0:ci.evaluatedRMEA[0][2];for(let kr=0;kr<Ii.meshes.length;++kr){const di=Ii.meshes[kr],qi=kr===Ii.lightMeshIndex;let bi=Mt.wvpForNode;if(qi){if(!nr&&!q.terrain&&q.shadowRenderer){q.currentLayer<q.firstLightBeamLayer&&(q.firstLightBeamLayer=q.currentLayer);continue}bi=Mt.wvpForTile}else if(nr)continue;const Pi={defines:[]},Er=[];if(!$e&&re&&(re.useNormalOffset=!!di.normalBuffer),ca(Pi.defines,Er,di,q,cr?null:J.lut),hr||Pi.defines.push("DIFFUSE_SHADED"),Di&&Pi.defines.push("SHADOWS_SINGLE_CASCADE"),pt&&($e?pt.numRenderedVerticesInShadowPass+=di.vertexArray.length:pt.numRenderedVerticesInTransparentPass+=di.vertexArray.length),$e){tl(di,Mt.nodeModelMatrix,q,J);continue}let Fi=null;if(ie){const Rn=vs(Mt.nodeModelMatrix,q.transform);if(Fi=new Float32Array(Rn),te.projection.name!=="globe"){const ln=di.aabb.min,ws=di.aabb.max,[is,Ts]=ie.getOpacityForBounds(Rn,ln[0],ln[1],ws[0],ws[1]);Pi.overrideFog=is>=gt||Ts>=gt}}const ur=di.material;let ts;ur.occlusionTexture&&ur.occlusionTexture.offsetScale&&(ts=ur.occlusionTexture.offsetScale,Pi.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));const an=q.getOrCreateProgram("model",Pi);!$e&&re&&re.setupShadowsFromMatrix(Mt.tileModelMatrix,an,re.useNormalOffset),q.uploadCommonUniforms(oe,an,null,Fi);const Pn=ur.pbrMetallicRoughness;Pn.metallicFactor=.9,Pn.roughnessFactor=.5;const Kr=zu(new Float32Array(bi),new Float32Array(fi),new Float32Array(Yi),new Float32Array(Ii.matrix),q,Mt.opacity,Pn.baseColorFactor.toRenderColor(null),ur.emissiveFactor,Pn.metallicFactor,Pn.roughnessFactor,ur,yn,J,[0,0,0],ts);!qi&&(ci.hasTranslucentParts||Mt.opacity<1)&&an.draw(q,oe.gl.TRIANGLES,Se,$t.disabled,ii.disabled,jt.backCCW,Kr,J.id,di.vertexBuffer,di.indexBuffer,di.segments,J.paint,q.transform.zoom,void 0,Er),an.draw(q,oe.gl.TRIANGLES,qi?He:Se,$t.disabled,qi||Mt.opacity<1||ci.hasTranslucentParts?ii.alphaBlended:ii.unblended,jt.backCCW,Kr,J.id,di.vertexBuffer,di.indexBuffer,di.segments,J.paint,q.transform.zoom,void 0,Er)}}}}()}(u,t,r,c),void E();if(M.type!=="model")return;const I=M.getModels(),P=[],R=u.transform.getFreeCameraOptions().position,O=o.ad.vec3.scale([],[R.x,R.y,R.z],u.transform.worldSize);o.ad.vec3.negate(O,O);const N=[],F=[];let U=0;for(const q of I){const Z=r.paint.get("model-rotation").constantOr(null),J=r.paint.get("model-scale").constantOr(null),K=r.paint.get("model-translation").constantOr(null);q.computeModelMatrix(u,Z,J,K,!0,!0,!1);const oe=o.ad.mat4.identity([]),te=o.dm(q.position.lat,u.transform.zoom),ie=o.ad.mat4.fromScaling([],[1,1,1/te]);o.ad.mat4.translate(oe,oe,O),P.push({zScaleMatrix:ie,negCameraPosMatrix:oe});for(const re of q.nodes)yo(u.transform,re,q.matrix,u.transform.expandedFarZProjMatrix,U,N,F);U++}if(N.sort((q,Z)=>Z.depth-q.depth),u.renderPass!=="shadow"){if(d===1)for(const q of F)xs(q,u,r,P[q.modelIndex],$t.disabled,u.colorModeForRenderPass());else{for(const q of F)xs(q,u,r,P[q.modelIndex],$t.disabled,ii.disabled);for(const q of F)xs(q,u,r,P[q.modelIndex],u.stencilModeFor3D(),u.colorModeForRenderPass());u.resetStencilClippingMasks()}for(const q of N)xs(q,u,r,P[q.modelIndex],$t.disabled,u.colorModeForRenderPass());E()}else{for(const q of F)tl(q.mesh,q.nodeModelMatrix,u,r);for(const q of N)tl(q.mesh,q.nodeModelMatrix,u,r);E()}}},gc={line:function(u,t,r){if(u.hasElevatedBuckets=!1,u.hasNonElevatedBuckets=!1,u._unevaluatedLayout.getValue("line-elevation-reference")!==void 0||u._unevaluatedLayout.getValue("line-z-offset")!==void 0){if(t){const c=t.getVisibleCoordinates();for(const d of c){const f=t.getTile(d).getBucket(u);
2476if(f&&(f.hasZOffset?u.hasElevatedBuckets=!0:u.hasNonElevatedBuckets=!0,u.hasElevatedBuckets&&u.hasNonElevatedBuckets))break}}}else u.hasNonElevatedBuckets=!0},model:function(u,t,r){const c=t.getSource();if(!c.loaded())return;if(c.type==="vector"||c.type==="geojson")return void(r.modelManager&&r.modelManager.upload(r,c.type==="vector"?u.scope:""));if(c.type==="batched-model"||c.type!=="model")return;const d=c.getModels();for(const f of d)f.upload(r.context)},raster:function(u,t,r){const c=t.getSource();if(!(c instanceof as&&c.loaded()))return;const d=u.sourceLayer||c.rasterLayerIds&&c.rasterLayerIds[0];if(!d)return;const f=u.paint.get("raster-array-band")||c.getInitialBand(d);if(f==null)return;const _=t.getIds().map(T=>t.getTileByID(T));for(const T of _)T.updateNeeded(d,f)&&c.prepareTile(T,d,f)},"raster-particle":function(u,t,r){const c=t.getSource();if(!(c instanceof as&&c.loaded()))return;const d=u.sourceLayer||c.rasterLayerIds&&c.rasterLayerIds[0];if(!d)return;const f=u.paint.get("raster-particle-array-band")||c.getInitialBand(d);if(f==null)return;const _=t.getIds().map(T=>t.getTileByID(T));for(const T of _)T.updateNeeded(d,f)&&c.prepareTile(T,d,f)}},yc={fill:Fu};class vc{constructor(t,r,c,d,f){this.context=new qs(t,r),this.transform=c,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.tp=f,this._timeStamp=o.q.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={forceEnablePrecipitation:!1,showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const _=["fill","line","symbol","circle","heatmap","fill-extrusion","raster","raster-particle","hillshade","model","background","sky"];for(const E of _)this._debugParams.enabledLayers[E]=!0;f.registerParameter(this._debugParams,["Terrain"],"showTerrainProxyTiles",{},()=>{this.style.map.triggerRepaint()}),f.registerParameter(this._debugParams,["Precipitation"],"forceEnablePrecipitation"),f.registerParameter(this._debugParams,["FPS"],"fpsWindow",{min:1,max:100,step:1}),f.registerBinding(this._debugParams,["FPS"],"continousRedraw",{readonly:!0,label:"continuous redraw"}),f.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"value"}),f.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"graph",view:"graph",min:0,max:200});for(const E of _)f.registerParameter(this._debugParams.enabledLayers,["Debug","Layers"],E);this.occlusionParams=new Hu(f),this.setup(),this.numSublayers=Sn.maxUnderzooming+Sn.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new o.dy,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new ms(this),this._wireframeDebugCache=new vo,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const T=new o.r({width:1,height:1},Uint8Array.of(0,0,0,0));this.emptyDepthTexture=new o.T(this.context,T,t.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=d}updateTerrain(t,r){const c=!!t&&!!t.terrain&&this.transform.projection.supportsTerrain;if(!(c||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new pd(this,t));const d=this._terrain;this.transform.elevation=c?d:null,d.update(t,this.transform,r),this.transform.elevation&&!d.enabled&&(this.transform.elevation=null)}_updateFog(t){const r=t.fog;if(!r||this.transform.projection.name==="globe"||r.getOpacity(this.transform.pitch)<1||r.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[c,d]=r.getFovAdjustedRange(this.transform._fov);if(c>d)return void(this.transform.fogCullDistSq=null);const f=c+.78*(d-c);this.transform.fogCullDistSq=f*f}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(t){t&&!this._terrain&&(this._terrain=new pd(this,this.style)),this._forceTerrainMode=t}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(t,r){if(this.width=t*o.q.devicePixelRatio,this.height=r*o.q.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const c of this.style.order)this.style._mergedLayers[c].resize()}setup(){const t=this.context,r=new o.b5;r.emplaceBack(0,0),r.emplaceBack(o.ai,0),r.emplaceBack(0,o.ai),r.emplaceBack(o.ai,o.ai),this.tileExtentBuffer=t.createVertexBuffer(r,o.b7.members),this.tileExtentSegments=o.b8.simpleSegment(0,0,4,2);const c=new o.b5;c.emplaceBack(0,0),c.emplaceBack(o.ai,0),c.emplaceBack(0,o.ai),c.emplaceBack(o.ai,o.ai),this.debugBuffer=t.createVertexBuffer(c,o.b7.members),this.debugSegments=o.b8.simpleSegment(0,0,4,5);const d=new o.b5;d.emplaceBack(-1,-1),d.emplaceBack(1,-1),d.emplaceBack(-1,1),d.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(d,o.b7.members),this.viewportSegments=o.b8.simpleSegment(0,0,4,2);const f=new o.aU;f.emplaceBack(0,0,0,0),f.emplaceBack(o.ai,0,o.ai,0),f.emplaceBack(0,o.ai,0,o.ai),f.emplaceBack(o.ai,o.ai,o.ai,o.ai),this.mercatorBoundsBuffer=t.createVertexBuffer(f,o.ba.members),this.mercatorBoundsSegments=o.b8.simpleSegment(0,0,4,2);const _=new o.aV;_.emplaceBack(0,1,2),_.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(_);const T=new o.b6;for(const M of[0,1,3,2,0])T.emplaceBack(M);this.debugIndexBuffer=t.createIndexBuffer(T),this.emptyTexture=new o.T(t,new o.r({width:1,height:1},Uint8Array.of(0,0,0,0)),t.gl.RGBA8),this.identityMat=o.ad.mat4.create();const E=this.context.gl;this.stencilClearMode=new $t({func:E.ALWAYS,mask:0},0,255,E.ZERO,E.ZERO,E.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(t){return t._makeTileBoundsBuffers(this.context,this.transform.projection),t._tileBoundsBuffer?{tileBoundsBuffer:t._tileBoundsBuffer,tileBoundsIndexBuffer:t._tileBoundsIndexBuffer,tileBoundsSegments:t._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const t=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,t.TRIANGLES,Pt.disabled,this.stencilClearMode,ii.disabled,jt.disabled,Ko(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(t,r,c){if(!r||this.currentStencilSource===r.id||!t.isTileClipped()||!c||c.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let T=!1;for(const E of c)if(this._tileClippingMaskIDs[E.key]===void 0){T=!0;break}if(!T)return}this.currentStencilSource=r.id;
2476const d=this.context,f=d.gl;this.nextStencilID+c.length>256&&this.clearStencil(),d.setColorMode(ii.disabled),d.setDepthMode(Pt.disabled);const _=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const T of c){const E=r.getTile(T),M=this._tileClippingMaskIDs[T.key]=this.nextStencilID++,{tileBoundsBuffer:I,tileBoundsIndexBuffer:P,tileBoundsSegments:R}=this.getTileBoundsBuffers(E);_.draw(this,f.TRIANGLES,Pt.disabled,new $t({func:f.ALWAYS,mask:0},M,255,f.KEEP,f.KEEP,f.REPLACE),ii.disabled,jt.disabled,Ko(T.projMatrix),"$clipping",I,P,R)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,r=this.context.gl;return new $t({func:r.NOTEQUAL,mask:255},t,255,r.KEEP,r.KEEP,r.REPLACE)}stencilModeForClipping(t){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(t);const r=this.context.gl;return new $t({func:r.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,r.KEEP,r.KEEP,r.REPLACE)}stencilConfigForOverlap(t){const r=this.context.gl,c=t.sort((_,T)=>T.overscaledZ-_.overscaledZ),d=c[c.length-1].overscaledZ,f=c[0].overscaledZ-d+1;if(f>1){this.currentStencilSource=void 0,this.nextStencilID+f>256&&this.clearStencil();const _={};for(let T=0;T<f;T++)_[T+d]=new $t({func:r.GEQUAL,mask:255},T+this.nextStencilID,255,r.KEEP,r.KEEP,r.REPLACE);return this.nextStencilID+=f,[_,c]}return[{[d]:$t.disabled},c]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new ii([t.CONSTANT_COLOR,t.ONE,t.CONSTANT_COLOR,t.ONE],new o.al(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?ii.unblended:ii.alphaBlended}colorModeForDrapableLayerRenderPass(t){const r=this.context.gl;return this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture&&this.renderPass==="translucent"?new ii([r.ONE,r.ONE_MINUS_SRC_ALPHA,r.CONSTANT_ALPHA,r.ONE_MINUS_SRC_ALPHA],new o.al(0,0,0,t===void 0?0:t),[!0,!0,!0,!0]):this.colorModeForRenderPass()}depthModeForSublayer(t,r,c,d=!1){if(this.depthOcclusion)return new Pt(this.context.gl.GREATER,Pt.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!d)return Pt.disabled;const f=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new Pt(c||this.context.gl.LEQUAL,r,[f,f])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}blitDepth(){const t=this.context.gl,r=Math.ceil(this.width),c=Math.ceil(this.height),d=this.context.bindFramebuffer.get(),f=t.getParameter(t.TEXTURE_BINDING_2D);this.depthFBO&&this.depthFBO.width===r&&this.depthFBO.height===c||(this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),r!==0&&c!==0&&(this.depthFBO=new Yr(this.context,r,c,!1,"texture"),this.depthTexture=new o.T(this.context,{width:r,height:c,data:null},t.DEPTH24_STENCIL8),this.depthFBO.depthAttachment.set(this.depthTexture.texture))),this.context.bindFramebuffer.set(d),t.bindTexture(t.TEXTURE_2D,f),this.depthFBO&&(t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,this.depthFBO.framebuffer),t.blitFramebuffer(0,0,r,c,0,0,r,c,t.DEPTH_BUFFER_BIT,t.NEAREST),t.bindFramebuffer(t.FRAMEBUFFER,this.context.bindFramebuffer.current))}updateAverageFPS(){this._fpsHistory.push(this._dt===0?0:1e3/this._dt),this._fpsHistory.length>this._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce((t,r)=>t+r/this._fpsHistory.length,0))}render(t,r){const c=o.q.now();this._dt=c-this._timeStamp,this._timeStamp=c,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=t.map.repaint,this.style=t,this.options=r;const d=this.style._mergedLayers,f=!(!this.terrain||!this.terrain.enabled),_=()=>this.style._getOrder(f).filter(Se=>{const He=d[Se];return!(He.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[He.type]});let T=_(),E=!1,M=!1;for(const Se of T){const He=d[Se];He.type==="circle"&&(E=!0),He.type==="symbol"&&(He.hasInitialOcclusionOpacityProperties?M=!0:E=!0)}let I=T.map(Se=>d[Se]);const P=this.style._mergedSourceCaches;this.imageManager=t.imageManager,this.modelManager=t.modelManager,this.symbolFadeChange=t.placement.symbolFadeChange(o.q.now()),this.imageManager.beginFrame();let R=0,O=!1;for(const Se in P){const He=P[Se];He.used&&(He.prepare(this.context),He.getSource().usedInConflation&&++R)}let N=!1;for(const Se of I)Se.isHidden(this.transform.zoom)||(Se.type==="clip"&&(N=!0),this.prepareLayer(Se));const F={},U={},q={},Z={},J={};for(const Se in P){const He=P[Se];F[Se]=He.getVisibleCoordinates(),U[Se]=F[Se].slice().reverse(),q[Se]=He.getVisibleCoordinates(!0).reverse(),Z[Se]=He.getShadowCasterCoordinates(),J[Se]=He.sortCoordinatesByDistance(F[Se])}const K=Se=>{const He=this.style.getLayerSourceCache(Se);return He&&He.used?He.getSource():null};if(R||N||this._clippingActiveLastFrame){const Se=[],He=[];let we=0;for(const $e of I)this.isSourceForClippingOrConflation($e,K($e))&&(Se.push($e),He.push(we)),we++;if(Se&&(N||Se.length>1)||this._clippingActiveLastFrame){N=!1;const $e=[];for(let Ve=0;Ve<Se.length;Ve++){const Ke=Se[Ve],De=He[Ve],Qe=this.style.getLayerSourceCache(Ke);if(!Qe||!Qe.used||!Qe.getSource().usedInConflation&&Ke.type!=="clip")continue;let pt=o.dA,ft=o.by.None;const mt=[];let Et=!0;if(Ke.type==="clip"){pt=De;
2476for(const qt of Ke.layout.get("clip-layer-types"))ft|=qt==="model"?o.by.Model:qt==="symbol"?o.by.Symbol:o.by.FillExtrusion;for(const qt of Ke.layout.get("clip-layer-scope"))mt.push(qt);Ke.isHidden(this.transform.zoom)?Et=!1:N=!0}Et&&$e.push({layer:Ke.fqid,cache:Qe,order:pt,clipMask:ft,clipScope:mt})}this.replacementSource.setSources($e),O=!0}}this._clippingActiveLastFrame=N,O||this.replacementSource.clear(),this.conflationActive=O,this.minCutoffZoom=0,this.longestCutoffRange=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let Se=0;Se<I.length;Se++){const He=I[Se],we=He.cutoffRange();if(this.longestCutoffRange=Math.max(we,this.longestCutoffRange),we>0){const $e=K(He);$e&&(this.minCutoffZoom=Math.max($e.minzoom,this.minCutoffZoom)),He.minzoom&&(this.minCutoffZoom=Math.max(He.minzoom,this.minCutoffZoom))}He.is3D(f)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=Se),this._lastOcclusionLayer=Se)}const oe=this.style&&this.style.fog;oe?(this._fogVisible=oe.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=oe.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(q),this.opaquePassCutoff=0,T=_(),I=T.map(Se=>d[Se]));const te=this._shadowRenderer;if(te){te.updateShadowParameters(this.transform,this.style.directionalLight);for(const Se in P)for(const He of F[Se]){let we={min:0,max:0};this.terrain&&(we=this.terrain.getMinMaxForTile(He)||we),te.addShadowReceiver(He.toUnwrapped(),we.min,we.max)}}this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new o.dz(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new Id(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);const ie=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),re=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(ie&&!this._snow&&(this._snow=new ua(this)),!ie&&this._snow&&(this._snow.destroy(),delete this._snow),re&&!this._rain&&(this._rain=new Yu(this)),!re&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),!ro.has(this.context.gl))return;this.renderPass="offscreen";for(const Se of I){const He=t.getLayerSourceCache(Se);if(!Se.hasOffscreenPass()||Se.isHidden(this.transform.zoom))continue;const we=He?U[He.id]:void 0;(Se.type==="custom"||Se.type==="raster"||Se.type==="raster-particle"||Se.isSky()||we&&we.length)&&this.renderLayer(this,He,Se,we)}this.depthRangeFor3D=[0,1-(I.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,Z)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const ue=this.transform.projection.name==="globe"||this.transform.isHorizonVisible(),me=(()=>{if(r.showOverdrawInspector)return o.al.black;const Se=this.style.fog;if(Se&&this.transform.projection.supportsFog){const He=this.style.getLut(Se.scope);if(!ue){const we=Se.properties.get("color-use-theme")==="none",$e=Se.properties.get("color").toRenderColor(we?null:He).toArray01();return new o.al(...$e)}if(ue){const we=Se.properties.get("space-color-use-theme")==="none",$e=Se.properties.get("space-color").toRenderColor(we?null:He).toArray01();return new o.al(...$e)}}return o.al.transparent})();if(this.context.clear({color:me,depth:1}),this.clearStencil(),this._showOverdrawInspector=r.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&ue&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=T.length-1;this.currentLayer>=0;this.currentLayer--){const Se=I[this.currentLayer],He=t.getLayerSourceCache(Se);if(Se.isSky())continue;const we=He?(Se.is3D(f)?J:U)[He.id]:void 0;this._renderTileClippingMasks(Se,He,we),this.renderLayer(this,He,Se,we)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&ue&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||o.ag(this.transform.zoom)>0)&&(this.transform.projection.name==="globe"||this.transform.isH
2476orizonVisible()))for(this.currentLayer=0;this.currentLayer<T.length;this.currentLayer++){const Se=I[this.currentLayer],He=t.getLayerSourceCache(Se);Se.isSky()&&this.renderLayer(this,He,Se,He?U[He.id]:void 0)}function Le(Se,He){let we;return He&&(we=(Se.type==="symbol"?q:Se.is3D(f)?J:U)[He.id]),we}if(this.renderPass="translucent",this.transform.projection.name==="globe"){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<T.length;){const Se=I[this.currentLayer];if(Se.type==="raster"||Se.type==="raster-particle"){const He=t.getLayerSourceCache(Se);this.renderLayer(this,He,Se,Le(Se,He))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;let Ee=0;te&&(Ee=te.getShadowCastingLayerCount());let Ze=!1,We=-1;for(let Se=0;Se<T.length;++Se){const He=I[Se];He.isHidden(this.transform.zoom)||He.is3D(f)&&(We=Se)}M&&We===-1&&(E=!0);let ot=!1;for(;this.currentLayer<T.length;){const Se=I[this.currentLayer],He=t.getLayerSourceCache(Se);if(Se.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(Se)){if(Se.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer),this._lastOcclusionLayer=Math.max(this.currentLayer,this._lastOcclusionLayer)}else{if(!ot&&Se.is3D(f)&&!f){const we=this.currentLayer,$e=Ve=>{for(this.currentLayer=0;this.currentLayer<I.length;this.currentLayer++){const Ke=I[this.currentLayer];if(yc[Ke.type]){const De=this.style.getLayerSourceCache(Ke);yc[Ke.type](this,De,Ke,Le(Ke,De),Ve)}}};$e("initialize"),$e("reset"),this.currentLayer=we,ot=!0}if(E&&!Ze&&this.terrain&&!this.transform.isOrthographic&&(Ze=!0,this.blitDepth()),M&&We!==-1&&this.currentLayer===We+1&&!this.transform.isOrthographic&&this.blitDepth(),this.terrain||this._renderTileClippingMasks(Se,He,He?F[He.id]:void 0),this.renderLayer(this,He,Se,Le(Se,He)),!this.terrain&&te&&Ee>0&&Se.hasShadowPass()&&--Ee==0&&(te.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer)){const we=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=we;this.currentLayer++){const $e=I[this.currentLayer];if(!$e.hasLightBeamPass())continue;const Ve=t.getLayerSourceCache($e);this.renderLayer(this,Ve,$e,Ve?U[Ve.id]:void 0)}this.currentLayer=we,this.renderPass="translucent"}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const we=this.currentLayer;this.depthOcclusion=!0;for(const $e of this.layersWithOcclusionOpacity){this.currentLayer=$e;const Ve=I[this.currentLayer],Ke=t.getLayerSourceCache(Ve),De=Ke?U[Ke.id]:void 0;this.terrain||this._renderTileClippingMasks(Ve,Ke,Ke?F[Ke.id]:void 0),this.renderLayer(this,Ke,Ve,De)}this.depthOcclusion=!1,this.currentLayer=we,this.renderPass="translucent",this.layersWithOcclusionOpacity=[]}++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this._snow&&this._snow.draw(this),this._rain&&this._rain.draw(this),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let Se=null;I.forEach(He=>{const we=t.getLayerSourceCache(He);we&&!He.isHidden(this.transform.zoom)&&we.getVisibleCoordinates().length&&(!Se||Se.getSource().maxzoom<we.getSource().maxzoom)&&(Se=we)}),Se&&this.options.showTileBoundaries&&rl.debug(this,Se,Se.getVisibleCoordinates(),o.al.red,!1,this.options.showParseStatus)}this.terrain&&this._debugParams.showTerrainProxyTiles&&rl.debug(this,this.terrain.proxySourceCache,this.terrain.proxyCoords,new o.al(1,.8,.1,1),!0,this.options.showParseStatus),this.options.showPadding&&function(Se){const He=Se.transform.padding;Vu(Se,Se.transform.height-(He.top||0),3,aa),Vu(Se,He.bottom||0,3,_f),Uu(Se,He.left||0,3,gf),Uu(Se,Se.transform.width-(He.right||0),3,Ed);const we=Se.transform.centerPoint;(function($e,Ve,Ke,De){go($e,Ve-1,Ke-10,2,20,De),go($e,Ve-10,Ke-1,20,2,De)})(Se,we.x,Se.transform.height-we.y,uc)}(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveC
2476anvasCopy()),O||(this.conflationActive=!1)}prepareLayer(t){this.gpuTimingStart(t);const{unsupportedLayers:r}=this.transform.projection,c=!r||!r.includes(t.type);if(gc[t.type]&&(c||this.terrain&&t.type==="custom")){const d=this.style.getLayerSourceCache(t);gc[t.type](t,d,this)}this.gpuTimingEnd()}renderLayer(t,r,c,d){c.isHidden(this.transform.zoom)||(c.type==="background"||c.type==="sky"||c.type==="custom"||c.type==="model"||c.type==="raster"||c.type==="raster-particle"||d&&d.length)&&(this.id=c.id,this.gpuTimingStart(c),t.transform.projection.unsupportedLayers&&t.transform.projection.unsupportedLayers.includes(c.type)&&(!t.terrain||c.type!=="custom")||c.type==="clip"||rl[c.type](t,r,c,d,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(t){if(!this.options.gpuTiming)return;const r=this.context.extTimerQuery,c=this.context.gl;let d=this.gpuTimers[t.id];d||(d=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:c.createQuery()}),d.calls++,c.beginQuery(r.TIME_ELAPSED_EXT,d.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const t=this.context.extTimerQuery,r=this.context.gl,c=r.createQuery();this.deferredRenderGpuTimeQueries.push(c),r.beginQuery(t.TIME_ELAPSED_EXT,c)}}gpuTimingDeferredRenderEnd(){this.options.gpuTimingDeferredRender&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}gpuTimingEnd(){this.options.gpuTiming&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}collectGpuTimers(){const t=this.gpuTimers;return this.gpuTimers={},t}collectDeferredRenderGpuQueries(){const t=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],t}queryGpuTimers(t){const r={};for(const c in t){const d=t[c],f=this.context.extTimerQuery,_=f.getQueryParameter(d.query,this.context.gl.QUERY_RESULT)/1e6;
2476f.deleteQueryEXT(d.query),r[c]=_}return r}queryGpuTimeDeferredRender(t){if(!this.options.gpuTimingDeferredRender)return 0;const r=this.context.gl;let c=0;for(const d of t)c+=r.getQueryParameter(d,r.QUERY_RESULT)/1e6,r.deleteQuery(d);return c}translatePosMatrix(t,r,c,d,f){if(!c[0]&&!c[1])return t;const _=f?d==="map"?this.transform.angle:0:d==="viewport"?-this.transform.angle:0;if(_){const M=Math.sin(_),I=Math.cos(_);c=[c[0]*I-c[1]*M,c[0]*M+c[1]*I]}const T=[f?c[0]:o.at(r,c[0],this.transform.zoom),f?c[1]:o.at(r,c[1],this.transform.zoom),0],E=new Float32Array(16);return o.ad.mat4.translate(E,t,T),E}saveTileTexture(t){const r=t.size[0],c=this._tileTextures[r];c?c.push(t):this._tileTextures[r]=[t]}getTileTexture(t){const r=this._tileTextures[t];return r&&r.length>0?r.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(t,r,c){const d=c===void 0?this.terrain&&this.terrain.renderingToTexture:c,f=[];return this.style&&this.style.enable3dLights()&&(t==="globeRaster"||t==="terrainRaster"?(f.push("LIGHTING_3D_MODE"),f.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):d||f.push("LIGHTING_3D_MODE")),this.renderPass==="shadow"&&(this._shadowMapDebug||f.push("DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(f.push("TERRAIN"),this.linearFloatFilteringSupported()&&f.push("TERRAIN_DEM_FLOAT_FORMAT")),this.transform.projection.name==="globe"&&f.push("GLOBE"),!this._fogVisible||d||r!==void 0&&!r||f.push("FOG","FOG_DITHERING"),d&&f.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&f.push("OVERDRAW_INSPECTOR"),f}getOrCreateProgram(t,r){this.cache=this.cache||{};const c=r&&r.defines||[],d=r&&r.config,f=this.currentGlobalDefines(t,r&&r.overrideFog,r&&r.overrideRtt).concat(c),_=md.cacheKey(Ha[t],t,f,d);return this.cache[_]||(this.cache[_]=new md(this.context,t,Ha[t],d,Lu[t],f)),this.cache[_]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new o.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(t,r){if(this.style.enable3dLights()){const c=this.style.directionalLight,d=this.style.ambientLight;if(c&&d){const f=((_,T,E)=>{const M=_.properties.get("direction"),I=_.properties.get("color-use-theme")==="none",P=_.properties.get("color").toRenderColor(I?null:E.getLut(_.scope)).toArray01(),R=_.properties.get("intensity"),O=T.properties.get("color-use-theme")==="none",N=T.properties.get("color").toRenderColor(O?null:E.getLut(T.scope)).toArray01(),F=T.properties.get("intensity"),U=[M.x,M.y,M.z],q=o.cN(N,F),Z=o.cN(P,R);return{u_lighting_ambient_color:q,u_lighting_directional_dir:U,u_lighting_directional_color:Z,u_ground_radiance:fd(U,Z,q)}})(c,d,this.style);r.setLightsUniformValues(t,f)}}}uploadCommonUniforms(t,r,c,d,f){if(this.uploadCommonLightUniforms(t,r),this.terrain&&this.terrain.renderingToTexture)return;const _=this.style.fog;if(_){const T=_.getOpacity(this.transform.pitch),E=((M,I,P,R,O,N,F,U,q,Z,J,K)=>{const oe=M.transform,te=I.properties.get("color-use-theme")==="none",ie=I.properties.get("color").toRenderColor(te?null:M.style.getLut(I.scope)).toArray01();ie[3]=R;const re=M.frameCounter/1e3%1,[ue,me]=I.properties.get("vertical-range");return{u_fog_matrix:P?oe.calculateFogTileMatrix(P):K||M.identityMat,u_fog_range:I.getFovAdjustedRange(oe._fov),u_fog_color:ie,u_fog_horizon_blend:I.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(ue,me),me],u_fog_temporal_offset:re,u_frustum_tl:O,u_frustum_tr:N,u_frustum_br:F,u_frustum_bl:U,u_globe_pos:q,u_globe_radius:Z,u_viewport:J,u_globe_transition:o.ag(oe.zoom),u_is_globe:+(oe.projection.name==="globe")}})(this,_,c,T,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*o.q.devicePixelRatio,this.transform.height*o.q.devicePixelRatio],d);r.setFogUniformValues(t,E)}f&&r.setCutoffUniformValues(t,f.uniformValues)}setTileLoadedFlag(t){this.tileLoaded=t}saveCanvasCopy(){const t=this.canvasCopy();t&&(this.frameCopies.push(t),this.tileLoaded=!1)}canvasCopy(){const t=this.context.gl,r=t.createTexture();return t.bindTexture(t.TEXTURE_2D,r),t.copyTexImage2D(t.TEXTURE_2D,0,t.RGBA,0,0,t.drawingBufferWidth,t.drawingBufferHeight,0),r}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const t=this.style&&this.style.fog;return!!t&&t.getOpacity(this.transform.pitch)!==0}
vendor: 28,764 bytes, line 2476
2476getBackgroundTiles(){const t=this._backgroundTiles,r=this._backgroundTiles={},c=this.transform.coveringTiles({tileSize:512});for(const d of c)r[d.key]=t[d.key]||new kn(d,512,this.transform.tileZoom,this);return r}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(t,r){return!(!t.is3D(!(!this.terrain||!this.terrain.enabled))||t.type!=="clip"&&(t.minzoom&&t.minzoom>this.transform.zoom||(this.style._clipLayerPresent||t.sourceLayer!=="building")&&(!r||r.type!=="batched-model")))}isTileAffectedByFog(t){if(!this.style||!this.style.fog)return!1;if(this.transform.projection.name==="globe")return!0;let r=this._cachedTileFogOpacities[t.key];return r||(this._cachedTileFogOpacities[t.key]=r=this.style.fog.getOpacityForTile(t)),r[0]>=gt||r[1]>=gt}setupDepthForOcclusion(t,r,c){const d=this.context,f=d.gl,_=!!c;var T;c||(c={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),d.activeTexture.set(f.TEXTURE3),t&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(f.NEAREST,f.CLAMP_TO_EDGE),c.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],c.u_depth_range_unpack=[2/((T=this.depthRangeFor3D)[1]-T[0]),-1-2*T[0]/(T[1]-T[0])],c.u_occluder_half_size=.5*this.occlusionParams.occluderSize,c.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(f.NEAREST,f.CLAMP_TO_EDGE),d.activeTexture.set(f.TEXTURE0),_||r.setTerrainUniformValues(d,c)}}function xc(u,t){let r=!1,c=null;const d=()=>{c=null,r&&(u(),c=setTimeout(d,t),r=!1)};return()=>(r=!0,c||d(),c)}class Ju{constructor(t){this._hashName=t&&encodeURIComponent(t),o.aQ(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=xc(this._updateHashUnthrottled.bind(this),300)}addTo(t){return this._map=t,window.addEventListener("hashchange",this._onHashChange,!1),t.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const t=this._map;if(!t)return"";const r=Qu(t);if(this._hashName){const c=this._hashName;let d=!1;const f=location.hash.slice(1).split("&").map(_=>{const T=_.split("=")[0];return T===c?(d=!0,`${T}=${r}`):_}).filter(_=>_);return d||f.push(`${c}=${r}`),`#${f.join("&")}`}return`#${r}`}_getCurrentHash(){const t=location.hash.replace("#","");if(this._hashName){let r;return t.split("&").map(c=>c.split("=")).forEach(c=>{c[0]===this._hashName&&(r=c)}),(r&&r[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._map;if(!t)return!1;const r=this._getCurrentHash();if(r.length>=3&&!r.some(c=>isNaN(c))){const c=t.dragRotate.isEnabled()&&t.touchZoomRotate.isEnabled()?+(r[3]||0):t.getBearing();return t.jumpTo({center:[+r[2],+r[1]],zoom:+r[0],bearing:c,pitch:+(r[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function Qu(u,t){const r=u.getCenter(),c=Math.round(100*u.getZoom())/100,d=Math.ceil((c*Math.LN2+Math.log(512/360/.5))/Math.LN10),f=Math.pow(10,d),_=Math.round(r.lng*f)/f,T=Math.round(r.lat*f)/f,E=u.getBearing(),M=u.getPitch();let I=t?`/${_}/${T}/${c}`:`${c}/${T}/${_}`;return(E||M)&&(I+="/"+Math.round(10*E)/10),M&&(I+=`/${Math.round(M)}`),I}const nl={linearity:.3,easing:o.dB(0,0,.3,1)},Ad=o.l({deceleration:2500,maxSpeed:1400},nl),Cd=o.l({deceleration:20,maxSpeed:1400},nl),Pd=o.l({deceleration:1e3,maxSpeed:360},nl),Rd=o.l({deceleration:1e3,maxSpeed:90},nl);class zd{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:o.q.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,r=o.q.now();for(;t.length>0&&r-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const r={zoom:0,bearing:0,pitch:0,pan:new o.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:f}of this._inertiaBuffer)r.zoom+=f.zoomDelta||0,r.bearing+=f.bearingDelta||0,r.pitch+=f.pitchDelta||0,f.panDelta&&r.pan._add(f.panDelta),f.around&&(r.around=f.around),f.pinchAround&&(r.pinchAround=f.pinchAround);const c=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,d={};if(r.pan.mag()){const f=ol(r.pan.mag(),c,o.l({},Ad,t||{}));d.offset=r.pan.mult(f.amount/r.pan.mag()),d.center=this._map.transform.center,sl(d,f)}if(r.zoom){const f=ol(r.zoom,c,Cd);d.zoom=this._map.transform.zoom+f.amount,sl(d,f)}if(r.bearing){const f=ol(r.bearing,c,Pd);d.bearing=this._map.transform.bearing+o.ay(f.amount,-179,179),sl(d,f)}if(r.pitch){const f=ol(r.pitch,c,Rd);d.pitch=this._map.transform.pitch+f.amount,sl(d,f)}if(d.zoom||d.bearing){const f=r.pinchAround===void 0?r.around:r.pinchAround;d.around=f?this._map.unproject(f):this._map.getCenter()}return this.clear(),d.noMoveStart=!0,d}}function sl(u,t){(!u.duration||u.duration<t.duration)&&(u.duration=t.duration,u.easing=t.easing)}function ol(u,t,r){const{maxSpeed:c,linearity:d,deceleration:f}=r,_=o.ay(u*d/(t/1e3),-c,c),T=Math.abs(_)/(f*d);return{easing:r.easing,duration:1e3*T,amount:_*(T/2)}}class nn extends o.A{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,r,c,d={}){const f=Bt(r.getCanvasContainer(),c),_=r.unproject(f);super(t,o.l({point:f,lngLat:_,originalEvent:c},d)),this._defaultPrevented=!1,this.target=r}}class al extends o.A{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,r,c){const d=t==="touchend"?c.changedTouches:c.touches,f=wi(r.getCanvasContainer(),d),_=f.map(E=>r.unproject(E)),T=f.reduce((E,M,I,P)=>E.add(M.div(P.length)),new o.P(0,0));super(t,{points:f,point:T,lngLats:_,lngLat:r.unproject(T),originalEvent:c}),this._defaultPrevented=!1}}class Ld extends o.A{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,r){super("wheel",{originalEvent:r}),this._defaultPrevented=!1}}class Dd{constructor(t,r){this._map=t,this._clickTolerance=r.clickTolerance}reset(){this._mousedownPos=void 0}wheel(t){return this._firePreventable(new Ld(this._map,t))}mousedown(t,r){return this._mousedownPos=r,this._firePreventable(new nn(t.type,this._map,t))}mouseup(t){this._map.fire(new nn(t.type,this._map,t))}preclick(t){const r=o.l({},t);r.type="preclick",this._map.fire(new nn(r.type,this._map,r))}click(t,r){this._mousedownPos&&this._mousedownPos.dist(r)>=this._clickTolerance||(this.preclick(t),this._map.fire(new nn(t.type,this._map,t)))}dblclick(t){return this._firePreventable(new nn(t.type,this._map,t))}mouseover(t){this._map.fire(new nn(t.type,this._map,t))}mouseout(t){this._map.fire(new nn(t.type,this._map,t))}touchstart(t){return this._firePreventable(new al(t.type,this._map,t))}touchmove(t){this._map.fire(new al(t.type,this._map,t))}touchend(t){this._map.fire(new al(t.type,this._map,t))}touchcancel(t){this._map.fire(new al(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class vf{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(t){this._map.fire(new nn(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new nn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new nn(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class xf{constructor(t,r){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=r.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,r){this.isEnabled()&&t.shiftKey&&t.button===0&&(Xe(),this._startPos=this._lastPos=r,this._active=!0)}mousemoveWindow(t,r){if(!this._active)return;const c=r,d=this._startPos,f=this._lastPos;if(!d||!f||f.equals(c)||!this._box&&c.dist(d)<this._clickTolerance)return;this._lastPos=c,this._box||(this._box=ne("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));const _=Math.min(d.x,c.x),T=Math.max(d.x,c.x),E=Math.min(d.y,c.y),M=Math.max(d.y,c.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${_}px,${E}px)`,this._box.style.width=T-_+"px",this._box.style.height=M-E+"px")})}mouseupWindow(t,r){if(!this._active)return;const c=this._startPos,d=r;if(c&&t.button===0){if(this.reset(),Ye(),c.x!==d.x||c.y!==d.y)return this._map.fire(new o.A("boxzoomend",{originalEvent:t})),{cameraAnimation:f=>f.fitScreenCoordinates(c,d,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",t)}}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),tt(),delete this._startPos,delete this._lastPos}_fireEvent(t,r){return this._map.fire(new o.A(t,{originalEvent:r}))}}function Ui(u,t){const r={};for(let c=0;c<u.length;c++)r[u[c].identifier]=t[c];return r}class Od{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(t,r,c){(this.centroid||c.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=t.timeStamp),c.length===this.numTouches&&(this.centroid=function(d){const f=new o.P(0,0);for(const _ of d)f._add(_);return f.div(d.length)}(r),this.touches=Ui(c,r)))}touchmove(t,r,c){if(this.aborted||!this.centroid)return;const d=Ui(c,r);for(const f in this.touches){const _=d[f];(!_||_.dist(this.touches[f])>30)&&(this.aborted=!0)}}touchend(t,r,c){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),c.length===0){const d=!this.aborted&&this.centroid;if(this.reset(),d)return d}}}class eh{constructor(t){this.singleTap=new Od(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(t,r,c){this.singleTap.touchstart(t,r,c)}touchmove(t,r,c){this.singleTap.touchmove(t,r,c)}touchend(t,r,c){const d=this.singleTap.touchend(t,r,c);if(d){const f=t.timeStamp-this.lastTime<500,_=!this.lastTap||this.lastTap.dist(d)<30;if(f&&_||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=d,this.count===this.numTaps)return this.reset(),d}}}class bf{constructor(){this._zoomIn=new eh({numTouches:1,numTaps:2}),this._zoomOut=new eh({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,r,c){this._zoomIn.touchstart(t,r,c),this._zoomOut.touchstart(t,r,c)}touchmove(t,r,c){this._zoomIn.touchmove(t,r,c),this._zoomOut.touchmove(t,r,c)}touchend(t,r,c){const d=this._zoomIn.touchend(t,r,c),f=this._zoomOut.touchend(t,r,c);return d?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:_.getZoom()+1,around:_.unproject(d)},{originalEvent:t})}):f?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:_.getZoom()-1,around:_.unproject(f)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const ll={0:1,2:2},th={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class cl{constructor(t){this.reset(),this._clickTolerance=t.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(t,r){return!1}_move(t,r){return{}}mousedown(t,r){if(this._lastPoint)return;const c=wt(t);this._correctButton(t,c)&&(this._lastPoint=r,this._eventButton=c)}mousemoveWindow(t,r){const c=this._lastPoint;if(c){if(t.preventDefault(),this._eventButton!=null&&function(d,f){const _=ll[f];return d.buttons===void 0||(d.buttons&_)!==_}(t,this._eventButton))this.reset();else if(this._moved||!(r.dist(c)<this._clickTolerance))return this._moved=!0,this._lastPoint=r,this._move(c,r)}}mouseupWindow(t){this._lastPoint&&wt(t)===this._eventButton&&(this._moved&&Ye(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class bc extends cl{mousedown(t,r){super.mousedown(t,r),this._lastPoint&&(this._active=!0)}_correctButton(t,r){return r===0&&!t.ctrlKey}_move(t,r){return{around:r,panDelta:r.sub(t)}}}class Qn extends cl{constructor(t){super(t),this._pitchRotateKey=t.pitchRotateKey?th[t.pitchRotateKey]:void 0}_correctButton(t,r){return this._pitchRotateKey?r===0&&t[this._pitchRotateKey]:r===0&&t.ctrlKey||r===2}_move(t,r){const c=.8*(r.x-t.x);if(c)return this._active=!0,{bearingDelta:c}}contextmenu(t){this._pitchRotateKey||t.preventDefault()}}class ul extends cl{constructor(t){super(t),this._pitchRotateKey=t.pitchRotateKey?th[t.pitchRotateKey]:void 0}_correctButton(t,r){return this._pitchRotateKey?r===0&&t[this._pitchRotateKey]:r===0&&t.ctrlKey||r===2}_move(t,r){const c=-.5*(r.y-t.y);if(c)return this._active=!0,{pitchDelta:c}}contextmenu(t){this._pitchRotateKey||t.preventDefault()}}class rr{constructor(t,r){this._map=t,this._el=t.getCanvasContainer(),this._minTouches=1,this._clickTolerance=r.clickTolerance||1,this.reset(),o.aQ(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new o.P(0,0)}touchstart(t,r,c){return this._calculateTransform(t,r,c)}touchmove(t,r,c){if(this._active&&!(c.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(c.length===1&&!o.dC())return void this._showTouchPanBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return t.cancelable&&t.preventDefault(),this._calculateTransform(t,r,c)}}touchend(t,r,c){this._calculateTransform(t,r,c),this._active&&c.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,r,c){c.length>0&&(this._active=!0);const d=Ui(c,r),f=new o.P(0,0),_=new o.P(0,0);let T=0;for(const M in d){const I=d[M],P=this._touches[M];P&&(f._add(I),_._add(I.sub(P)),T++,d[M]=I)}if(this._touches=d,T<this._minTouches||!_.mag())return;const E=_.div(T);return this._sum._add(E),this._sum.mag()<this._clickTolerance?void 0:{around:f.div(T),panDelta:E}}enable(){this._enabled=!0,this._map._cooperativeGestures&&(this._addTouchPanBlocker(),this._el.classList.add("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page"))}disable(){this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove(),this._el.classList.remove("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page")),this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}_addTouchPanBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=ne("div","mapboxgl-touch-pan-blocker",this._map._container),this._alertContainer.textContent=this._map._getUIString("TouchPanBlocker.Message"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showTouchPanBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")},500)}}class Cn{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(t){}_move(t,r,c){return{}}touchstart(t,r,c){this._firstTwoTouches||c.length<2||(this._firstTwoTouches=[c[0].identifier,c[1].identifier],this._start([r[0],r[1]]))}touchmove(t,r,c){const d=this._firstTwoTouches;if(!d)return;t.preventDefault();const[f,_]=d,T=ha(c,r,f),E=ha(c,r,_);if(!T||!E)return;const M=this._aroundCenter?null:T.add(E).div(2);return this._move([T,E],M,t)}touchend(t,r,c){if(!this._firstTwoTouches)return;const[d,f]=this._firstTwoTouches,_=ha(c,r,d),T=ha(c,r,f);_&&T||(this._active&&Ye(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function ha(u,t,r){for(let c=0;c<u.length;c++)if(u[c].identifier===r)return t[c]}function hl(u,t){return Math.log(u/t)/Math.LN2}class kd extends Cn{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,r){const c=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(hl(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:hl(this._distance,c),pinchAround:r}}}function Fd(u,t){return 180*u.angleWith(t)/Math.PI}class dl extends Cn{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,r){const c=this._vector;if(this._vector=t[0].sub(t[1]),c&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:Fd(this._vector,c),pinchAround:r}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const r=25/(Math.PI*this._minDiameter)*360,c=this._startVector;if(!c)return!1;const d=Fd(t,c);return Math.abs(d)<r}}function ih(u){return Math.abs(u.y)>Math.abs(u.x)}class wf extends Cn{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(t){this._lastPoints=t,ih(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,r,c){const d=this._lastPoints;if(!d)return;const f=t[0].sub(d[0]),_=t[1].sub(d[1]);return this._map._cooperativeGestures&&!o.dC()&&c.touches.length<3||(this._valid=this.gestureBeginsVertically(f,_,c.timeStamp),!this._valid)?void 0:(this._lastPoints=t,this._active=!0,{pitchDelta:(f.y+_.y)/2*-.5})}gestureBeginsVertically(t,r,c){if(this._valid!==void 0)return this._valid;const d=t.mag()>=2,f=r.mag()>=2;if(!d&&!f)return;if(!d||!f)return this._firstMove==null&&(this._firstMove=c),c-this._firstMove<100&&void 0;const _=t.y>0==r.y>0;return ih(t)&&ih(r)&&_}}const rh={panStep:100,bearingStep:15,pitchStep:10};class nh{constructor(){const t=rh;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let r=0,c=0,d=0,f=0,_=0;switch(t.keyCode){case 61:case 107:case 171:case 187:r=1;break;case 189:case 109:case 173:r=-1;break;case 37:t.shiftKey?c=-1:(t.preventDefault(),f=-1);break;case 39:t.shiftKey?c=1:(t.preventDefault(),f=1);break;case 38:t.shiftKey?d=1:(t.preventDefault(),_=-1);break;case 40:t.shiftKey?d=-1:(t.preventDefault(),_=1);break;default:return}return this._rotationDisabled&&(c=0,d=0),{cameraAnimation:T=>{const E=T.getZoom();T.easeTo({duration:300,easeId:"keyboardHandler",easing:pl,zoom:r?Math.round(E)+r*(t.shiftKey?2:1):E,bearing:T.getBearing()+c*this._bearingStep,pitch:T.getPitch()+d*this._pitchStep,offset:[-f*this._panStep,-_*this._panStep],center:T.getCenter()},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function pl(u){return u*(2-u)}const xo=4.000244140625,bs=1/450;class Un{constructor(t,r){this._map=t,this._el=t.getCanvasContainer(),this._handler=r,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=bs,o.aQ(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(t.ctrlKey||t.metaKey||this.isZooming()||o.dC()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let r=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const c=o.q.now(),d=c-(this._lastWheelEventTime||0);this._lastWheelEventTime=c,r!==0&&r%xo==0?this._type="wheel":r!==0&&Math.abs(r)<4?this._type="trackpad":d>400?(this._type=null,this._lastValue=r,this._timeout=window.setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(d*r)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,r+=this._lastValue)),t.shiftKey&&r&&(r/=4),this._type&&(this._lastWheelEvent=t,this._delta-=r,this._active||this._start(t)),t.preventDefault()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const r=Bt(this._el,t);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:r,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._map.transform;this._type==="wheel"&&t.projection.wrap&&(t._center.lng>=180||t._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const r=()=>t._terrainEnabled()&&this._aroundCoord?t.computeZoomRelativeTo(this._aroundCoord):t.zoom;if(this._delta!==0){const M=this._type==="wheel"&&Math.abs(this._delta)>xo?this._wheelZoomRate:this._defaultZoomRate;let I=2/(1+Math.exp(-Math.abs(this._delta*M)));this._delta<0&&I!==0&&(I=1/I);const P=r(),R=Math.pow(2,P),O=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):R;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(O*I))),this._type==="wheel"&&(this._startZoom=P,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const c=typeof this._targetZoom=="number"?this._targetZoom:r(),d=this._startZoom,f=this._easing;let _,T=!1;if(this._type==="wheel"&&d&&f){const M=Math.min((o.q.now()-this._lastWheelEventTime)/200,1),I=f(M);_=o.ah(d,c,I),M<1?this._frameId||(this._frameId=!0):T=!0}else _=c,T=!0;this._active=!0,T&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let E=_-r();return E*this._lastDelta<0&&(E=0),{noInertia:!0,needsRenderFrame:!T,zoomDelta:E,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let r=o.dD;if(this._prevEase){const c=this._prevEase,d=(o.q.now()-c.start)/c.duration,f=c.easing(d+.01)-c.easing(d),_=.27/Math.sqrt(f*f+1e-4)*.01,T=Math.sqrt(.0729-_*_);r=o.dB(_,T,.25,1)}return this._prevEase={start:o.q.now(),duration:t,easing:r},r}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=ne("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.removeAttribute("role")},200)}}class Zs{constructor(t,r){this._clickZoom=t,this._tapZoom=r}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class bo{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(t,r){return t.preventDefault(),{cameraAnimation:c=>{c.easeTo({duration:300,zoom:c.getZoom()+(t.shiftKey?-1:1),around:c.unproject(r)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ws{constructor(){this._tap=new eh({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(t,r,c){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?c.length>0&&(this._swipePoint=r[0],this._swipeTouch=c[0].identifier):this._tap.touchstart(t,r,c))}touchmove(t,r,c){if(this._tapTime){if(this._swipePoint){if(c[0].identifier!==this._swipeTouch)return;const d=r[0],f=d.y-this._swipePoint.y;return this._swipePoint=d,t.preventDefault(),this._active=!0,{zoomDelta:f/128}}}else this._tap.touchmove(t,r,c)}touchend(t,r,c){this._tapTime?this._swipePoint&&c.length===0&&this.reset():this._tap.touchend(t,r,c)&&(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Tf{constructor(t,r,c){this._el=t,this._mousePan=r,this._touchPan=c}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Sf{constructor(t,r,c){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=r,this._mousePitch=c}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Ef{constructor(t,r,c,d){this._el=t,this._touchZoom=r,this._touchRotate=c,this._tapDragZoom=d,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const wc=u=>u.zoom||u.drag||u.pitch||u.rotate;class Bd extends o.A{}class jr{constructor(){this.constants=[1,1,.01],this.radius=0}setup(t,r){const c=o.ad.vec3.sub([],r,t);this.radius=o.ad.vec3.length(c[2]<0?o.ad.vec3.div([],c,this.constants):[c[0],c[
24761],0])}projectRay(t){o.ad.vec3.div(t,t,this.constants),o.ad.vec3.normalize(t,t),o.ad.vec3.mul(t,t,this.constants);const r=o.ad.vec3.scale([],t,this.radius);if(r[2]>0){const c=o.ad.vec3.scale([],[0,0,1],o.ad.vec3.dot(r,[0,0,1])),d=o.ad.vec3.scale([],o.ad.vec3.normalize([],[r[0],r[1],0]),this.radius),f=o.ad.vec3.add([],r,o.ad.vec3.scale([],o.ad.vec3.sub([],o.ad.vec3.add([],d,c),r),2));r[0]=f[0],r[1]=f[1]}return r}}function da(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta}class Nd{constructor(t,r){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new zd(t),this._bearingSnap=r.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new jr,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(r),o.aQ(["handleEvent","handleWindowEvent"],this);const c=this._el;this._listeners=[[c,"touchstart",{passive:!0}],[c,"touchmove",{passive:!1}],[c,"touchend",void 0],[c,"touchcancel",void 0],[c,"mousedown",void 0],[c,"mousemove",void 0],[c,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[c,"mouseover",void 0],[c,"mouseout",void 0],[c,"dblclick",void 0],[c,"click",void 0],[c,"keydown",{capture:!1}],[c,"keyup",void 0],[c,"wheel",{passive:!1}],[c,"contextmenu",void 0],[window,"blur",void 0]];for(const[d,f,_]of this._listeners){const T=d===document?this.handleWindowEvent:this.handleEvent;d.addEventListener(f,T,_)}}destroy(){for(const[t,r,c]of this._listeners){const d=t===document?this.handleWindowEvent:this.handleEvent;t.removeEventListener(r,d,c)}}_addDefaultHandlers(t){const r=this._map,c=r.getCanvasContainer();this._add("mapEvent",new Dd(r,t));const d=r.boxZoom=new xf(r,t);this._add("boxZoom",d);const f=new bf,_=new bo;r.doubleClickZoom=new Zs(_,f),this._add("tapZoom",f),this._add("clickZoom",_);const T=new Ws;this._add("tapDragZoom",T);const E=r.touchPitch=new wf(r);this._add("touchPitch",E);const M=new Qn(t),I=new ul(t);r.dragRotate=new Sf(t,M,I),this._add("mouseRotate",M,["mousePitch"]),this._add("mousePitch",I,["mouseRotate"]);const P=new bc(t),R=new rr(r,t);r.dragPan=new Tf(c,P,R),this._add("mousePan",P),this._add("touchPan",R,["touchZoom","touchRotate"]);const O=new dl,N=new kd;r.touchZoomRotate=new Ef(c,N,O,T),this._add("touchRotate",O,["touchPan","touchZoom"]),this._add("touchZoom",N,["touchPan","touchRotate"]),this._add("blockableMapEvent",new vf(r));const F=r.scrollZoom=new Un(r,this);this._add("scrollZoom",F,["mousePan"]);const U=r.keyboard=new nh;this._add("keyboard",U);for(const q of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[q]&&r[q].enable(t[q])}_add(t,r,c){this._handlers.push({handlerName:t,handler:r,allowed:c}),this._handlersById[t]=r}stop(t){if(!this._updatingCamera){for(const{handler:r}of this._handlers)r.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!wc(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(t,r,c){for(const d in t)if(d!==c&&(!r||r.indexOf(d)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const r=[];for(const c of t)this._el.contains(c.target)&&r.push(c);return r}handleEvent(t,r){this._updatingCamera=!0;const c=t.type==="renderFrame",d=c?void 0:t,f={needsRenderFrame:!1},_={},T={},E=t.touches?this._getMapTouches(t.touches):void 0,M=E?wi(this._el,E):c?void 0:Bt(this._el,t);for(const{handlerName:R,handler:O,allowed:N}of this._handlers){if(!O.isEnabled())continue;let F;this._blockedByActive(T,N,R)?O.reset():O[r||t.type]&&(F=O[r||t.type](t,M,E),this.mergeHandlerResult(f,_,F,R,d),F&&F.needsRenderFrame&&this._triggerRenderFrame()),(F||O.isActive())&&(T[R]=O)}const I={};for(const R in this._previousActiveHandlers)T[R]||(I[R]=d);this._previousActiveHandlers=T,(Object.keys(I).length||da(f))&&(this._changes.push([f,_,I]),this._triggerRe
vendor: 4,384 bytes, line 2476
2476nderFrame()),(Object.keys(T).length||da(f))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:P}=f;P&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],P(this._map))}mergeHandlerResult(t,r,c,d,f){if(!c)return;o.l(t,c);const _={handlerName:d,originalEvent:c.originalEvent||f};c.zoomDelta!==void 0&&(r.zoom=_),c.panDelta!==void 0&&(r.drag=_),c.pitchDelta!==void 0&&(r.pitch=_),c.bearingDelta!==void 0&&(r.rotate=_)}_applyChanges(){const t={},r={},c={};for(const[d,f,_]of this._changes)d.panDelta&&(t.panDelta=(t.panDelta||new o.P(0,0))._add(d.panDelta)),d.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+d.zoomDelta),d.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+d.bearingDelta),d.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+d.pitchDelta),d.around!==void 0&&(t.around=d.around),d.aroundCoord!==void 0&&(t.aroundCoord=d.aroundCoord),d.pinchAround!==void 0&&(t.pinchAround=d.pinchAround),d.noInertia&&(t.noInertia=d.noInertia),o.l(r,f),o.l(c,_);this._updateMapTransform(t,r,c),this._changes=[]}_updateMapTransform(t,r,c){const d=this._map,f=d.transform,_=Z=>[Z.x,Z.y,Z.z];if((Z=>{const J=this._eventsInProgress.drag;return J&&!this._handlersById[J.handlerName].isActive()})()&&!da(t)){const Z=f.zoom;f.cameraElevationReference="sea",this._originalZoom!=null&&f._orthographicProjectionAtLowPitch&&f.projection.name!=="globe"&&f.pitch===0?(f.cameraElevationReference="ground",f.zoom=this._originalZoom):(f.recenterOnTerrain(),f.cameraElevationReference="ground"),Z!==f.zoom&&this._map._update(!0)}if(f._isCameraConstrained&&d._stop(!0),!da(t))return void this._fireEvents(r,c,!0);let{panDelta:T,zoomDelta:E,bearingDelta:M,pitchDelta:I,around:P,aroundCoord:R,pinchAround:O}=t;f._isCameraConstrained&&(E>0&&(E=0),f._isCameraConstrained=!1),O!==void 0&&(P=O),(E||(Z=>r[Z]&&!this._eventsInProgress[Z])("drag"))&&P&&(this._dragOrigin=_(f.pointCoordinate3D(P)),this._originalZoom=f.zoom,this._trackingEllipsoid.setup(f._camera.position,this._dragOrigin)),f.cameraElevationReference="sea",d._stop(!0),P=P||d.transform.centerPoint,M&&(f.bearing+=M),I&&(f.pitch+=I),f._updateCameraState();const N=[0,0,0];if(T)if(f.projection.name==="mercator"){const Z=this._trackingEllipsoid.projectRay(f.screenPointToMercatorRay(P).dir),J=this._trackingEllipsoid.projectRay(f.screenPointToMercatorRay(P.sub(T)).dir);N[0]=J[0]-Z[0],N[1]=J[1]-Z[1]}else{const Z=f.pointCoordinate(P);if(f.projection.name==="globe"){T=T.rotate(-f.angle);const J=f._pixelsPerMercatorPixel/f.worldSize;N[0]=-T.x*o.dE(o.aT(Z.y))*J,N[1]=-T.y*o.dE(f.center.lat)*J}else{const J=f.pointCoordinate(P.sub(T));Z&&J&&(N[0]=J.x-Z.x,N[1]=J.y-Z.y)}}const F=f.zoom,U=[0,0,0];if(E){const Z=_(R||f.pointCoordinate3D(P)),J={dir:o.ad.vec3.normalize([],o.ad.vec3.sub([],Z,f._camera.position))};if(J.dir[2]<0){const K=f.zoomDeltaToMovement(Z,E);o.ad.vec3.scale(U,J.dir,K)}}const q=o.ad.vec3.add(N,N,U);f._translateCameraConstrained(q),E&&Math.abs(f.zoom-F)>1e-4&&f.recenterOnTerrain(),f.cameraElevationReference="ground",this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(r,c,!0)}_fireEvents(t,r,c){const d=wc(this._eventsInProgress),f=wc(t),_={};for(const I in t){const{originalEvent:P}=t[I];this._eventsInProgress[I]||(_[`${I}start`]=P),this._eventsInProgress[I]=t[I]}!d&&f&&this._fireEvent("movestart",f.originalEvent);for(const I in _)this._fireEvent(I,_[I]);f&&this._fireEvent("move",f.originalEvent);for(const I in t){const{originalEvent:P}=t[I];this._fireEvent(I,P)}const T={};let E;for(const I in this._eventsInProgress){const{handlerName:P,originalEvent:R}=this._eventsInProgress[I];this._handlersById[P].isActive()||(delete this._eventsInProgress[I],E=r[P]||R,T[`${I}end`]=E)}for(const I in T)this._fireEvent(I,T[I]);const M=wc(this._eventsInProgress);if(c&&(d||f)&&!M){this._updatingCamera=!0;const I=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),P=R=>R!==0&&-this._bearingSnap<R&&R<this._bearingSnap;I?(P(I.bearing||this._map.getBearing())&&(I.bearing=0),this._map.easeTo(I,{originalEvent:E})):(this._map.fire(new o.A("moveend",{originalEvent:E})),P(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,r){this._map.fire(new o.A(t,r?{originalEvent:r}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{this._frameId=void 0,this.handleEvent(new Bd("renderFrame",{timeStamp:t})),this._applyChanges()})}
2476_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const Vd="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class pa extends o.E{constructor(t,r){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=r.bearingSnap,this._respectPrefersReducedMotion=r.respectPrefersReducedMotion!==!1,o.aQ(["_renderFrameCallback"],this)}getCenter(){return new o.bO(this.transform.center.lng,this.transform.center.lat)}setCenter(t,r){return this.jumpTo({center:t},r)}panBy(t,r,c){return t=o.P.convert(t).mult(-1),this.panTo(this.transform.center,o.l({offset:t},r),c)}panTo(t,r,c){return this.easeTo(o.l({center:t},r),c)}getZoom(){return this.transform.zoom}setZoom(t,r){return this.jumpTo({zoom:t},r),this}zoomTo(t,r,c){return this.easeTo(o.l({zoom:t},r),c)}zoomIn(t,r){return this.zoomTo(this.getZoom()+1,t,r),this}zoomOut(t,r){return this.zoomTo(this.getZoom()-1,t,r),this}getBearing(){return this.transform.bearing}setBearing(t,r){return this.jumpTo({bearing:t},r),this}getPadding(){return this.transform.padding}setPadding(t,r){return this.jumpTo({padding:t},r),this}rotateTo(t,r,c){return this.easeTo(o.l({bearing:t},r),c)}resetNorth(t,r){return this.rotateTo(0,o.l({duration:1e3},t),r),this}resetNorthPitch(t,r){return this.easeTo(o.l({bearing:0,pitch:0,duration:1e3},t),r),this}snapToNorth(t,r){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,r):this}getPitch(){return this.transform.pitch}setPitch(t,r){return this.jumpTo({pitch:t},r),this}cameraForBounds(t,r){t=o.aB.convert(t);const c=r&&r.bearing||0,d=r&&r.pitch||0,f=t.getNorthWest(),_=t.getSouthEast();return this._cameraForBounds(this.transform,f,_,c,d,r)}_extendPadding(t){const r={top:0,right:0,bottom:0,left:0};return t==null?o.l({},r,this.transform.padding):typeof t=="number"?{top:t,bottom:t,right:t,left:t}:o.l({},r,t)}_extendCameraOptions(t){return(t=o.l({offset:[0,0],maxZoom:this.transform.maxZoom},t)).padding=this._extendPadding(t.padding),t}_minimumAABBFrustumDistance(t,r){const c=r.max[0]-r.min[0],d=r.max[1]-r.min[1];return c/d>t.aspect?c/(2*Math.tan(.5*t.fovX)*t.aspect):d/(2*Math.tan(.5*t.fovY)*t.aspect)}_cameraForBoundsOnGlobe(t,r,c,d,f,_){const T=t.clone(),E=this._extendCameraOptions(_);T.bearing=d,T.pitch=f;const M=o.bO.convert(r),I=o.bO.convert(c),P=.5*(M.lat+I.lat),R=.5*(M.lng+I.lng),O=o.dF(P,R),N=o.ad.vec3.normalize([],O),F=o.ad.vec3.normalize([],o.ad.vec3.cross([],N,[0,1,0])),U=o.ad.vec3.cross([],F,N),q=[F[0],F[1],F[2],0,U[0],U[1],U[2],0,N[0],N[1],N[2],0,0,0,0,1],Z=[O,o.dF(M.lat,M.lng),o.dF(I.lat,M.lng),o.dF(I.lat,I.lng),o.dF(M.lat,I.lng),o.dF(P,M.lng),o.dF(P,I.lng),o.dF(M.lat,R),o.dF(I.lat,R)];let J=o.ce.fromPoints(Z.map(Ve=>[o.ad.vec3.dot(F,Ve),o.ad.vec3.dot(U,Ve),o.ad.vec3.dot(N,Ve)]));const K=o.ad.vec3.transformMat4([],J.center,q);o.ad.vec3.squaredLength(K)===0&&o.ad.vec3.set(K,0,0,1),o.ad.vec3.normalize(K,K),o.ad.vec3.scale(K,K,o.az),T.center=o.dG(K);const oe=T.getWorldToCameraMatrix(),te=o.ad.mat4.invert(new Float64Array(16),oe);J=o.ce.applyTransform(J,o.ad.mat4.multiply([],oe,q));const ie=this._extendAABB(J,T,E,d);if(!ie)return void o.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");J=ie,o.ad.vec3.transformMat4(K,K,oe);const re=.5*(J.max[2]-J.min[2]),ue=this._minimumAABBFrustumDistance(T,J),me=o.ad.vec3.scale([],[0,0,1],re),Le=o.ad.vec3.add(me,K,me),Ee=ue+(T.pitch===0?0:o.ad.vec3.distance(K,Le)),Ze=T.globeCenterInViewSpace,We=o.ad.vec3.sub([],K,[Ze[0],Ze[1],Ze[2]]);o.ad.vec3.normalize(We,We),o.ad.vec3.scale(We,We,Ee);const ot=o.ad.vec3.add([],K,We);o.ad.vec3.transformMat4(ot,ot,te);const Se=o.dv/o.az,He=o.ad.vec3.length(ot),we=o.bH(Math.max(He*Se-o.dv,Number.EPSILON),0),$e=Math.min(T.zoomFromMercatorZAdjusted(we),E.maxZoom);return $e>.5*(o.c6+o.bY)?(T.setProjection({name:"mercator"}),T.zoom=$e,this._cameraForBounds(T,r,c,d,f,_)):{center:T.center,zoom:$e,bearing:d,pitch:f}}_extendAABB(t,r,c,d){const f=.5*((c.padding.left||0)+(c.padding.right||0)),_=.5*((c.padding.top||0)+(c.padding.bottom||0)),T=_,E=f,M=f,I=_,P=r.width-(E+M),R=r.height-(T+I),O=o.ad.vec3.sub([],t.max,t.min),N=Math.min(P/O[0],R/O[1]),F=Math.min(r.scaleZoom(r.scale*N),c.maxZoom);if(isNaN(F))return null;const U=r.scale/r.zoomScale(F),q=new o.ce([t.min[0]-E*U,t.min[1]-I*U,t.min[2]],[t.max[0]+M*U,t.max[1]+T*U,t.max[2]]),Z=(typeof c.offset.x=="number"&&typeof c.offset.y=="number"?new o.P(c.offset.x,c.offset.y):o.P.convert(c.offset)).rotate(-o.ak(d));return q.center[0]-=Z.x*U,q.center[1]+=Z.y*U,q}queryTerrainElevation(t,r){const c=this.transform.elevation;return c?(r=o.l({},{exaggerated:!0},r),c.getAtPoint(o.ac.fromLngLat(t),null,r.exaggerated)):null}_cameraForBounds(t,r,c,d,f,_){if(t.projection.name==="globe")return this._cameraForBoundsOnGlobe(t,r,c,d,f,_);const T=t.clone(),E=this._extendCameraOptions(_);T.bearing=d,T.pitch=f;const M=o.bO.convert(r),I=o.bO.convert(c),P=new o.bO(M.lng,I.lat),R=new o.bO(I.lng,M.lat),O=T.project(M),N=T.project(I),F=this.queryTerrainElevation(M),U=this.queryTerrainElevation(I),q=this.queryTerrainElevation(P),Z=this.queryTerrainElevation(R),J=[[O.x,O.y,Math.min(F||0,U||0,q||0,Z||0)],[N.x,N.y,Math.max(F||0,U||0,q||0,Z||0)]];let K=o.ce.fromPoints(J);const oe=T.getWorldToCameraMatrix(),te=o.ad.mat4.invert(new Float64Array(16),oe);K=o.ce.applyTransform(K,oe);const ie=this._extendAABB(K,T,E,d);if(!ie)return void o.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");K=ie;const re=.5*o.ad.vec3.sub([],K.max,K.min)[2],ue=this._minimumAABBFrustumDistance(T,K),me=[0,0,1,0];o.ad.vec4.transformMat4(me,me,oe),o.ad.vec4.normalize(me,me);const Le=o.ad.vec3.scale([],me,ue+re),Ee=o.ad.vec3.add([],K.center,Le);o.ad.vec3.transformMat4(K.center,K.center,te),o.ad.vec3.transformMat4(Ee,Ee,te);const Ze=T.unproject(new o.P(K.center[0],K.center[1])),We=o.dH(T.projection,Ze),ot=Math.pow(2,We),Se=Math.min(T._zoomFromMercatorZ(Ee[2]*T.pixelsPerMeter*ot/T.worldSize),E.maxZoom);return T.mercatorFromTransition&&Se<.5*(o.c6+o.bY)?(T.setProjection({name:"globe"}),T.zoom=Se,this._cameraForBounds(T,r,c,d,f,_)):{center:Ze,zoom:Se,bearing:d,pitch:f}}fitBounds(t,r,c){const d=this.cameraForBounds(t,r);return this._fitInternal(d,r,c)}fitScreenCoordinates(t,r,c,d,f){const _=o.P.convert(t),T=o.P.convert(r),E=new o.P(Math.min(_.x,T.x),Math.min(_.y,T.y)),M=new o.P(Math.max(_.x,T.x),Math.max(_.y,T.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(_,T))return this;const I=this.transform.pointLocation3D(E),P=this.transform.pointLocation3D(M),R=this.transform.pointLocation3D(new o.P(E.x,M.y)),O=this.transform.pointLocation3D(new o.P(M.x,E.y)),N=[Math.min(I.lng,P.lng,R.lng,O.lng),Math.min(I.lat,P.lat,R.lat,O.lat)],F=[Math.max(I.lng,P.lng,R.lng,O.lng),Math.max(I.lat,P.lat,R.lat,O.lat)],U=d&&d.pitch?d.pitch:this.getPitch(),q=this._cameraForBounds(this.transform,N,F,c,U,d);return this._fitInternal(q,d,f)}_fitInternal(t,r,c){return t?(r=o.l(t,r)).linear?this.easeTo(r,c):this.flyTo(r,c):this}jumpTo(t,r){this.stop();const c=t.preloadOnly?this.transform.clone():this.transform;let d=!1,f=!1,_=!1;"zoom"in t&&c.zoom!==+t.zoom&&(d=!0,c.zoom=+t.zoom),t.center!==void 0&&(c.center=o.bO.convert(t.center)),"bearing"in t&&c.bearing!==+t.bearing&&(f=!0,
vendor: 9,839 bytes, line 2476
2476c.bearing=+t.bearing),"pitch"in t&&c.pitch!==+t.pitch&&(_=!0,c.pitch=+t.pitch);const T=typeof t.padding=="number"?this._extendPadding(t.padding):t.padding;if(t.padding!=null&&!c.isPaddingEqual(T))if(t.retainPadding===!1){const E=c.clone();E.padding=T,c.setLocationAtPoint(c.center,E.centerPoint)}else c.padding=T;return t.preloadOnly?(this._preloadTiles(c),this):(this.fire(new o.A("movestart",r)).fire(new o.A("move",r)),d&&this.fire(new o.A("zoomstart",r)).fire(new o.A("zoom",r)).fire(new o.A("zoomend",r)),f&&this.fire(new o.A("rotatestart",r)).fire(new o.A("rotate",r)).fire(new o.A("rotateend",r)),_&&this.fire(new o.A("pitchstart",r)).fire(new o.A("pitch",r)).fire(new o.A("pitchend",r)),this.fire(new o.A("moveend",r)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||o.w(Vd),this.transform.getFreeCameraOptions()}setFreeCameraOptions(t,r){const c=this.transform;if(!c.projection.supportsFreeCamera)return o.w(Vd),this;this.stop();const d=c.zoom,f=c.pitch,_=c.bearing;c.setFreeCameraOptions(t);const T=d!==c.zoom,E=f!==c.pitch,M=_!==c.bearing;return this.fire(new o.A("movestart",r)).fire(new o.A("move",r)),T&&this.fire(new o.A("zoomstart",r)).fire(new o.A("zoom",r)).fire(new o.A("zoomend",r)),M&&this.fire(new o.A("rotatestart",r)).fire(new o.A("rotate",r)).fire(new o.A("rotateend",r)),E&&this.fire(new o.A("pitchstart",r)).fire(new o.A("pitch",r)).fire(new o.A("pitchend",r)),this.fire(new o.A("moveend",r)),this}easeTo(t,r){this._stop(!1,t.easeId),((t=o.l({offset:[0,0],duration:500,easing:o.dD},t)).animate===!1||this._prefersReducedMotion(t))&&(t.duration=0);const c=this.transform,d=this.getZoom(),f=this.getBearing(),_=this.getPitch(),T=this.getPadding(),E="zoom"in t?+t.zoom:d,M="bearing"in t?this._normalizeBearing(t.bearing,f):f,I="pitch"in t?+t.pitch:_,P=this._extendPadding(t.padding),R=o.P.convert(t.offset);let O,N,F;if(c.projection.name==="globe"){const me=o.ac.fromLngLat(c.center),Le=R.rotate(-c.angle);me.x+=Le.x/c.worldSize,me.y+=Le.y/c.worldSize;const Ee=me.toLngLat(),Ze=o.bO.convert(t.center||Ee);this._normalizeCenter(Ze),O=c.centerPoint.add(Le),N=new o.P(me.x,me.y).mult(c.worldSize),F=new o.P(o.av(Ze.lng),o.aC(Ze.lat)).mult(c.worldSize).sub(N)}else{O=c.centerPoint.add(R);const me=c.pointLocation(O),Le=o.bO.convert(t.center||me);this._normalizeCenter(Le),N=c.project(me),F=c.project(Le).sub(N)}const U=c.zoomScale(E-d);let q,Z;t.around&&(q=o.bO.convert(t.around),Z=c.locationPoint(q));const J=this._zooming||E!==d,K=this._rotating||f!==M,oe=this._pitching||I!==_,te=!c.isPaddingEqual(P),ie=t.retainPadding===!1?c.clone():c,re=me=>Le=>{if(J&&(me.zoom=o.ah(d,E,Le)),K&&(me.bearing=o.ah(f,M,Le)),oe&&(me.pitch=o.ah(_,I,Le)),te&&(ie.interpolatePadding(T,P,Le),O=ie.centerPoint.add(R)),q)me.setLocationAtPoint(q,Z);else{const Ee=me.zoomScale(me.zoom-d),Ze=E>d?Math.min(2,U):Math.max(.5,U),We=Math.pow(Ze,1-Le),ot=me.unproject(N.add(F.mult(Le*We)).mult(Ee));me.setLocationAtPoint(me.renderWorldCopies?ot.wrap():ot,O)}return t.preloadOnly||this._fireMoveEvents(r),me};if(t.preloadOnly){const me=this._emulate(re,t.duration,c);return this._preloadTiles(me),this}const ue={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=J,this._rotating=K,this._pitching=oe,this._padding=te,this._easeId=t.easeId,this._prepareEase(r,t.noMoveStart,ue),this._ease(re(c),me=>{c.cameraElevationReference==="sea"&&c.recenterOnTerrain(),this._afterEase(r,me)},t),this}_prepareEase(t,r,c={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),r||c.moving||this.fire(new o.A("movestart",t)),this._zooming&&!c.zooming&&this.fire(new o.A("zoomstart",t)),this._rotating&&!c.rotating&&this.fire(new o.A("rotatestart",t)),this._pitching&&!c.pitching&&this.fire(new o.A("pitchstart",t))}_fireMoveEvents(t){this.fire(new o.A("move",t)),this._zooming&&this.fire(new o.A("zoom",t)),this._rotating&&this.fire(new o.A("rotate",t)),this._pitching&&this.fire(new o.A("pitch",t))}_afterEase(t,r){if(this._easeId&&r&&this._easeId===r)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const c=this._zooming,d=this._rotating,f=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,c&&this.fire(new o.A("zoomend",t)),d&&this.fire(new o.A("rotateend",t)),f&&this.fire(new o.A("pitchend",t)),this.fire(new o.A("moveend",t))}flyTo(t,r){if(this._prefersReducedMotion(t)){const Ve=o.aA(t,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(Ve,r)}this.stop(),t=o.l({offset:[0,0],speed:1.2,curve:1.42,easing:o.dD},t);const c=this.transform,d=this.getZoom(),f=this.getBearing(),_=this.getPitch(),T=this.getPadding(),E="zoom"in t?o.ay(+t.zoom,c.minZoom,c.maxZoom):d,M="bearing"in t?this._normalizeBearing(t.bearing,f):f,I="pitch"in t?+t.pitch:_,P=this._extendPadding(t.padding),R=c.zoomScale(E-d),O=o.P.convert(t.offset);let N=c.centerPoint.add(O);const F=c.pointLocation(N),U=o.bO.convert(t.center||F);this._normalizeCenter(U);const q=c.project(F),Z=c.project(U).sub(q);let J=t.curve;const K=Math.max(c.width,c.height),oe=K/R,te=Z.mag();if("minZoom"in t){const Ve=o.ay(Math.min(t.minZoom,d,E),c.minZoom,c.maxZoom),Ke=K/c.zoomScale(Ve-d);J=Math.sqrt(Ke/te*2)}const ie=J*J;function re(Ve){const Ke=(oe*oe-K*K+(Ve?-1:1)*ie*ie*te*te)/(2*(Ve?oe:K)*ie*te);return Math.log(Math.sqrt(Ke*Ke+1)-Ke)}function ue(Ve){return(Math.exp(Ve)-Math.exp(-Ve))/2}function me(Ve){return(Math.exp(Ve)+Math.exp(-Ve))/2}const Le=re(0);let Ee=function(Ve){return me(Le)/me(Le+J*Ve)},Ze=function(Ve){return K*((me(Le)*(ue(Ke=Le+J*Ve)/me(Ke))-ue(Le))/ie)/te;var Ke},We=(re(1)-Le)/J;if(Math.abs(te)<1e-6||!isFinite(We)){if(Math.abs(K-oe)<1e-6)return this.easeTo(t,r);const Ve=oe<K?-1:1;We=Math.abs(Math.log(oe/K))/J,Ze=function(){return 0},Ee=function(Ke){return Math.exp(Ve*J*Ke)}}t.duration="duration"in t?+t.duration:1e3*We/("screenSpeed"in t?+t.screenSpeed/J:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0);const ot=f!==M,Se=I!==_,He=!c.isPaddingEqual(P),we=t.retainPadding===!1?c.clone():c,$e=Ve=>Ke=>{const De=Ke*We,Qe=1/Ee(De);Ve.zoom=Ke===1?E:d+Ve.scaleZoom(Qe),ot&&(Ve.bearing=o.ah(f,M,Ke)),Se&&(Ve.pitch=o.ah(_,I,Ke)),He&&(we.interpolatePadding(T,P,Ke),N=we.centerPoint.add(O));const pt=Ke===1?U:Ve.unproject(q.add(Z.mult(Ze(De))).mult(Qe));return Ve.setLocationAtPoint(Ve.renderWorldCopies?pt.wrap():pt,N),Ve._updateCameraOnTerrain(),t.preloadOnly||this._fireMoveEvents(r),Ve};if(t.preloadOnly){const Ve=this._emulate($e,t.duration,c);return this._preloadTiles(Ve),this}return this._zooming=!0,this._rotating=ot,this._pitching=Se,this._padding=He,this._prepareEase(r,!1),this._ease($e(c),()=>this._afterEase(r),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(t){}_cancelRenderFrame(t){}_stop(t,r){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const c=this._onEaseEnd;this._onEaseEnd=void 0,c.call(this,r)}if(!t){const c=this.handlers;c&&c.stop(!1)}return this}_ease(t,r,c){c.animate===!1||c.duration===0?(t(1),r()):(this._easeStart=o.q.now(),this._easeOptions=c,this._onEaseFrame=t,this._onEaseEnd=r,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((o.q.now()-this._easeStart)/this._easeOptions.duration,1),r=this._onEaseFrame;r&&r(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,r){t=o.bF(t,-180,180);const c=Math.abs(t-r);return Math.abs(t-360-r)<c&&(t-=360),Math.abs(t+360-r)<c&&(t+=360),t}_normalizeCenter(t){const r=this.transform;if(r.maxBounds||r.projection.name!=="globe"&&!r.renderWorldCopies)return;const c=t.lng-r.center.lng;t.lng+=c>180?-360:c<-180?360:0}_prefersReducedMotion(t){return this._respectPrefersReducedMotion&&o.q.prefersReducedMotion&&!(t&&t.essential)}_emulate(t,r,c){const d=Math.ceil(15*r/1e3),f=[],_=t(c.clone());for(let T=0;T<=d;T++){const E=_(T/d);f.push(E.clone())}return f}_preloadTiles(t,r){}}class Tc{constructor(t={}){this.options=t,o.aQ(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){const r=this.options&&this.options.compact,c=t._getUIString("AttributionControl.ToggleAttribution");this._map=t,this._container=ne("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=ne("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",c);const d=ne("span","mapboxgl-ctrl-icon",this._compactButton);return d.setAttribute("aria-hidden","true"),d.setAttribute("title",c),this._innerContainer=ne("div","mapboxgl-ctrl-attrib-inner",this._container),r&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),r===void 0&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","fal
2476se")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let t=this._editLink;t||(t=this._editLink=this._container.querySelector(".mapbox-improve-map"));const r=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||o.e.ACCESS_TOKEN}];if(t){const c=r.reduce((d,f,_)=>(f.value&&(d+=`${f.key}=${f.value}${_<r.length-1?"&":""}`),d),"?");t.href=`${o.e.FEEDBACK_URL}/${c}#${Qu(this._map,!0)}`,t.rel="noopener nofollow"}}_updateData(t){!t||t.sourceDataType!=="metadata"&&t.sourceDataType!=="visibility"&&t.dataType!=="style"||(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let t=[];if(this._map.style.stylesheet){const d=this._map.style.stylesheet;this.styleOwner=d.owner,this.styleId=d.id}const r=this._map.style._mergedSourceCaches;for(const d in r){const f=r[d];if(f.used){const _=f.getSource();_.attribution&&t.indexOf(_.attribution)<0&&t.push(_.attribution)}}t.sort((d,f)=>d.length-f.length),t=t.filter((d,f)=>{for(let _=f+1;_<t.length;_++)if(t[_].indexOf(d)>=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=[...this.options.customAttribution,...t]:t.unshift(this.options.customAttribution));const c=t.join(" | ");c!==this._attribHTML&&(this._attribHTML=c,t.length?(this._innerContainer.innerHTML=c,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class _n{constructor(){o.aQ(["_updateLogo","_updateCompact"],this)}onAdd(t){this._map=t,this._container=ne("div","mapboxgl-ctrl");const r=ne("a","mapboxgl-ctrl-logo");return r.target="_blank",r.rel="noopener nofollow",r.href="https://www.mapbox.com/",r.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),r.setAttribute("rel","noopener nofollow"),this._container.appendChild(r),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(t){t&&t.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const t=this._map.style._sourceCaches;if(Object.entries(t).length===0)return!0;for(const r in t){const c=t[r].getSource();if(c.hasOwnProperty("mapbox_logo")&&!c.mapbox_logo)return!1}return!0}_updateCompact(){const t=this._container.children;if(t.length){const r=t[0];this._map.getCanvasContainer().offsetWidth<250?r.classList.add("mapboxgl-compact"):r.classList.remove("mapboxgl-compact")}}}class gn{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const r=++this._id;return this._queue.push({callback:t,id:r,cancelled:!1}),r}remove(t){const r=this._currentlyRunning,c=r?this._queue.concat(r):this._queue;for(const d of c)if(d.id===t)return void(d.cancelled=!0)}run(t=0){const r=this._currentlyRunning=this._queue;this._queue=[];for(const c of r)if(!c.cancelled&&(c.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}class fa{constructor(t){this.jumpTo(t)}getValue(t){if(t<=this._startTime)return this._start;if(t>=this._endTime)return this._end;const r=o.cC((t-this._startTime)/(this._endTime-this._startTime));return this._start*(1-r)+this._end*r}isEasing(t){return t>=this._startTime&&t<=this._endTime}jumpTo(t){this._startTime=-1/0,this._endTime=-1/0,this._start=t,this._end=t}easeTo(t,r,c){this._start=this.getValue(r),this._end=t,this._startTime=r,this._endTime=r+c}}const wo={"AttributionControl.ToggleAttribution":"Toggle attribution","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox homepage","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use â + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"};class To extends o.A{constructor(t,r,c,d){const{point:f,lngLat:_,originalEvent:T,target:E}=t;super(t.type,{point:f,lngLat:_,originalEvent:T,target:E}),this.preventDefault=()=>{t.preventDefault()},this.id=r,this.interaction=c,this.feature=d}}class sh{constructor(t){this.map=t,this.interactionsByType=new Map,this.delegatedInteractions=new Map,this.typeById=new Map,this.filters=new Map,this.handleType=this.handleType.bind(this),this.handleMove=this.handleMove.bind(this),this.handleOut=this.handleOut.bind(this),this.hoveredFeatures=new Map,this.prevHoveredFeatures=new Map}
vendor: 6,479 bytes, line 2476
2476add(t,r){if(this.typeById.has(t))throw new Error(`Interaction id "${t}" already exists.`);const c=r.filter;let d=r.type;c&&this.filters.set(t,o.a_(c)),d==="mouseover"&&(d="mouseenter"),d==="mouseout"&&(d="mouseleave");const f=this.interactionsByType.get(d)||new Map;d==="mouseenter"||d==="mouseleave"?(this.delegatedInteractions.size===0&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(t,r)):f.size===0&&this.map.on(d,this.handleType),f.size===0&&this.interactionsByType.set(d,f),f.set(t,r),this.typeById.set(t,d)}get(t){const r=this.typeById.get(t);if(!r)return;const c=this.interactionsByType.get(r);return c?c.get(t):void 0}remove(t){const r=this.typeById.get(t);if(!r)return;this.typeById.delete(t),this.filters.delete(t);const c=this.interactionsByType.get(r);c&&(c.delete(t),r==="mouseenter"||r==="mouseleave"?(this.delegatedInteractions.delete(t),this.delegatedInteractions.size===0&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):c.size===0&&this.map.off(r,this.handleType))}queryTargets(t,r){const c=[];for(const[d,f]of r)f.target&&c.push({targetId:d,target:f.target,filter:this.filters.get(d)});return this.map.style.queryRenderedTargets(t,c,this.map.transform)}handleMove(t){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;const r=this.queryTargets(t.point,Array.from(this.delegatedInteractions).reverse());r.length&&(t.type="mouseenter",this.handleType(t,r));const c=new Map;for(const[d,{feature:f}]of this.prevHoveredFeatures)this.hoveredFeatures.has(d)||c.set(f.id,f);c.size&&(t.type="mouseleave",this.handleType(t,Array.from(c.values())))}handleOut(t){const r=Array.from(this.hoveredFeatures.values()).map(({feature:c})=>c);r.length&&(t.type="mouseleave",this.handleType(t,r)),this.hoveredFeatures.clear()}handleType(t,r){const c=Array.from(this.interactionsByType.get(t.type)).reverse(),d=!!r;r=r||this.queryTargets(t.point,c);const f=t.type==="mouseenter";let _=!1;const T=new Set;for(const E of r){for(const[M,I]of c){if(!I.target)continue;const P=E.variants?E.variants[M]:null;if(P){for(const R of P){if(zo(R,E,T,M))continue;const O=new o.cx(E,R),N=La(R,E,M);d&&(O.state=this.map.getFeatureState(O));const F=f?this.prevHoveredFeatures.get(N):null,U=new To(t,M,I,O),q=F?F.stop:I.handler(U);if(f&&this.hoveredFeatures.set(N,{feature:E,stop:q}),q!==!1){_=!0;break}}if(_)break}}if(_)break}if(!_)for(const[E,M]of c){const{handler:I,target:P}=M;if(!P&&I(new To(t,E,M,null))!==!1)break}}}function vi(u,t){if(Array.isArray(u)&&Array.isArray(t)){const r=new Set(u),c=new Set(t);return r.size===c.size&&u.every(d=>c.has(d))}return o.bn(u,t)}const Xs={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0,scaleFactor:1,spriteFormat:"auto"},Mf={showCompass:!0,showZoom:!0,visualizePitch:!1};class If{constructor(t,r,c=!1){this._clickTolerance=10,this.element=r,this.mouseRotate=new Qn({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,c&&(this.mousePitch=new ul({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),o.aQ(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),r.addEventListener("mousedown",this.mousedown),r.addEventListener("touchstart",this.touchstart,{passive:!1}),r.addEventListener("touchmove",this.touchmove),r.addEventListener("touchend",this.touchend),r.addEventListener("touchcancel",this.reset)}down(t,r){this.mouseRotate.mousedown(t,r),this.mousePitch&&this.mousePitch.mousedown(t,r),Xe()}move(t,r){const c=this.map,d=this.mouseRotate.mousemoveWindow(t,r),f=d&&d.bearingDelta;if(f&&c.setBearing(c.getBearing()+f),this.mousePitch){const _=this.mousePitch.mousemoveWindow(t,r),T=_&&_.pitchDelta;T&&c.setPitch(c.getPitch()+T)}}off(){const t=this.element;t.removeEventListener("mousedown",this.mousedown),t.removeEventListener("touchstart",this.touchstart,{passive:!1}),t.removeEventListener("touchmove",this.touchmove),t.removeEventListener("touchend",this.touchend),t.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){tt(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(t){this.down(o.l({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),Bt(this.element,t)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(t){this.move(t,Bt(this.element,t))}mouseup(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()}touchstart(t){t.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=wi(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>t.preventDefault()},this._startPos))}touchmove(t){t.targetTouches.length!==1?this.reset():(this._lastPos=wi(this.element,t.targetTouches)[0],this.move({preventDefault:()=>t.preventDefault()},this._lastPos))}touchend(t){t.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function Sc(u,t,r){if(u=new o.bO(u.lng,u.lat),t){const c=new o.bO(u.lng-360,u.lat),d=new o.bO(u.lng+360,u.lat),f=360*Math.ceil(Math.abs(u.lng-r.center.lng)/360),_=r.locationPoint3D(u).distSqr(t),T=t.x<0||t.y<0||t.x>r.width||t.y>r.height;r.locationPoint3D(c).distSqr(t)<_&&(T||Math.abs(c.lng-r.center.lng)<f)?u=c:r.locationPoint3D(d).distSqr(t)<_&&(T||Math.abs(d.lng-r.center.lng)<f)&&(u=d)}for(;Math.abs(u.lng-r.center.lng)>180;){const c=r.locationPoint3D(u);if(c.x>=0&&c.y>=0&&c.x<=r.width&&c.y<=r.height)break;u.lng>r.center.lng?u.lng-=360:u.lng+=360}return u}
2476const es={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"},sn={anchor:"center",color:"#3FB1CE",scale:1,draggable:!1,clickTolerance:0,rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class Cr extends o.E{constructor(t,r){super(),(t instanceof HTMLElement||r)&&(t=o.l({element:t},r)),o.aQ(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this),t=o.l({},sn,t),this._anchor=t.anchor,this._color=t.color,this._scale=t.scale,this._draggable=t.draggable,this._clickTolerance=t.clickTolerance,this._rotation=t.rotation,this._rotationAlignment=t.rotationAlignment,this._pitchAlignment=t.pitchAlignment,this._occludedOpacity=t.occludedOpacity,this._altitude=t.altitude,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),t&&t.element?(this._element=t.element,this._offset=o.P.convert(t&&t.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=o.P.convert(t&&t.offset||[0,-14])),this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",f=>{f.preventDefault()}),this._element.addEventListener("mousedown",f=>{f.preventDefault()});const c=this._element.classList;for(const f in es)c.remove(`mapboxgl-marker-anchor-${f}`);c.add(`mapboxgl-marker-anchor-${this._anchor}`);const d=t&&t.className?t.className.trim().split(/\s+/):[];c.add(...d),this._popup=null}_createDefaultMarker(){const t=ne("div"),r=Ue("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},t);if(this._altitude===0){const c=Ue("radialGradient",{id:"shadowGradient"},Ue("defs",{},r));Ue("stop",{offset:"10%","stop-opacity":.4},c),Ue("stop",{offset:"100%","stop-opacity":.05},c),Ue("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},r)}return Ue("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},r),Ue("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},r),Ue("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},r),t}addTo(t){return t===this._map||(this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._updateMoving),t.on("moveend",this._update),t.on("remove",this._clearFadeTimer),t._addMarker(this),this.setDraggable(this._draggable),this._update(),t.on("click",this._onMapClick)),this}remove(){const t=this._map;return t&&(t.off("click",this._onMapClick),t.off("move",this._updateMoving),t.off("moveend",this._update),t.off("mousedown",this._addDragHandler),t.off("touchstart",this._addDragHandler),t.off("mouseup",this._onUp),t.off("touchend",this._onUp),t.off("mousemove",this._onMove),t.off("touchmove",this._onMove),t.off("remove",this._clearFadeTimer),t._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=o.bO.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(t){return t===this._altitude||(this._defaultMarker&&(this._altitude===0&&t!==0||this._altitude!==0&&t===0)&&(this._element=this._createDefaultMarker()),this._altitude=t||sn.altitude,this._update()),this}getAltitude(){return this._altitude}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const d=Math.sqrt(Math.pow(13.5,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
vendor: 7,438 bytes, lines 2476-2481
24760,-38.1],"bottom-left":[d,-1*(38.1-13.5+d)],"bottom-right":[-d,-1*(38.1-13.5+d)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,t._marker=this,t._altitude=this._altitude,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(t){const r=t.code,c=t.charCode||t.keyCode;r!=="Space"&&r!=="Enter"&&c!==32&&c!==13||this.togglePopup()}_onMapClick(t){const r=t.originalEvent.target,c=this._element;this._popup&&(r===c||c.contains(r))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?(t.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(t.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const t=this._map,r=this._pos;if(!t||!r)return!1;const c=t.unproject(r,this._altitude),d=t.getFreeCameraOptions();if(!d.position)return!1;const f=d.position.toLngLat();return f.distanceTo(c)<.9*f.distanceTo(this._lngLat)}_evaluateOpacity(){const t=this._map;if(!t)return;const r=this._pos;if(!r||r.x<0||r.x>t.transform.width||r.y<0||r.y>t.transform.height)return void this._clearFadeTimer();const c=t.unproject(r,this._altitude);let d;t._showingGlobe()&&o.dK(t.transform,this._lngLat)?d=0:(d=1-t._queryFogOpacity(c),t.transform._terrainEnabled()&&t.getTerrain()&&this._behindTerrain()&&(d*=this._occludedOpacity)),this._element.style.opacity=`${d}`,this._element.style.pointerEvents=d>0?"auto":"none",this._popup&&this._popup._setOpacity(d),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const t=this._pos;if(!t||!this._map)return;const r=this._offset.mult(this._scale);this._element.style.transform=` 2477 translate(${t.x}px,${t.y}px) 2478 ${es[this._anchor]} 2479 ${this._calculateXYTransform()} ${this._calculateZTransform()} 2480 translate(${r.x}px,${r.y}px) 2481 `}_calculateXYTransform(){const t=this._pos,r=this._map,c=this.getPitchAlignment();if(!r||!t||c!=="map")return"";if(!r._showingGlobe()){const E=r.getPitch();return E?`rotateX(${E}deg)`:""}const d=o.c4(o.dL(r.transform,this._lngLat)),f=t.sub(o.dM(r.transform)),_=Math.abs(f.x)+Math.abs(f.y);if(_===0)return"";const T=d/_;return`rotateX(${-f.y*T}deg) rotateY(${f.x*T}deg)`}_calculateZTransform(){const t=this._pos,r=this._map;if(!r||!t)return"";let c=0;const d=this.getRotationAlignment();if(d==="map")if(r._showingGlobe()){const f=r.project(new o.bO(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),_=r.project(new o.bO(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(f);c=o.c4(Math.atan2(_.y,_.x))-90}else c=-r.getBearing();else if(d==="horizon"){const f=o.ae(4,6,r.getZoom()),_=o.dM(r.transform);_.y+=f*r.transform.height;const T=t.sub(_),E=o.c4(Math.atan2(T.y,T.x));c=(E>90?E-270:E+90)*(1-f)}return c+=this._rotation,c?`rotateZ(${c}deg)`:""}_update(t){cancelAnimationFrame(this._updateFrameId);const r=this._map;r&&(r.transform.renderWorldCopies&&(this._lngLat=Sc(this._lngLat,this._pos,r.transform)),this._pos=r.project(this._lngLat,this._altitude),t===!0?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),r._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(r._showingGlobe()||r.getTerrain()||r.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(t){return this._offset=o.P.convert(t),this._update(),this}addClassName(t){return this._element.classList.add(t),this}removeClassName(t){return this._element.classList.remove(t),this}toggleClassName(t){return this._element.classList.toggle(t)}_onMove(t){const r=this._map;if(!r)return;const c=this._pointerdownPos,d=this._positionDelta;if(c&&d){if(!this._isDragging){const f=this._clickTolerance||r._clickTolerance;if(t.point.dist(c)<f)return;this._isDragging=!0}this._pos=t.point.sub(d),this._lngLat=r.unproject(this._pos,this._altitude),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new o.A("dragstart"))),this.fire(new o.A("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;const t=this._map;t&&(t.off("mousemove",this._onMove),t.off("touchmove",this._onMove)),this._state==="active"&&this.fire(new o.A("dragend")),this._state="inactive"}_addDragHandler(t){const r=this._map,c=this._pos;r&&c&&this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(c),this._pointerdownPos=t.point,this._state="pending",r.on("mousemove",this._onMove),r.on("touchmove",this._onMove),r.once("mouseup",this._onUp),r.once("touchend",this._onUp))}setDraggable(t){this._draggable=!!t;const r=this._map;return r&&(t?(r.on("mousedown",this._addDragHandler),r.on("touchstart",this._addDragHandler)):(r.off("mousedown",this._addDragHandler),r.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||sn.rotation,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||sn.rotationAlignment,this._update(),this}getRotationAlignment(){return this._rotationAlignment==="auto"||this._rotationAlignment==="horizon"&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t||sn.pitchAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment==="auto"?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(t){return this._occludedOpacity=t||sn.occludedOpacity,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}const on={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},Sr={maxWidth:100,unit:"metric"},oh={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},tr={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",altitude:0},Ud=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Ys(u=new o.P(0,0),t="bottom"){if(typeof u=="number"){const r=Math.round(Math.sqrt(.5*Math.pow(u,2)));switch(t){case"top":return new o.P(0,u);case"top-left":return new o.P(r,r);case"top-right":return new o.P(-r,r);case"bottom":return new o.P(0,-u);case"bottom-left":return new o.P(r,-r);case"bottom-right":return new o.P(-r,-r);case"left":return new o.P(u,0);case"right":return new o.P(-u,0)}return new o.P(0,0)}return u instanceof o.P||Array.isArray(u)?o.P.convert(u):o.P.convert(u[t]||[0,0])}return{version:Ce,supported:Fe.supported,setRTLTextPlugin:o.dN,getRTLTextPluginStatus:o.dO,Map:class extends pa{constructor(u){Ge.mark(Oe.create);const t=u;if((u=o.l({}
2481,Xs,u)).minZoom!=null&&u.maxZoom!=null&&u.minZoom>u.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(u.minPitch!=null&&u.maxPitch!=null&&u.minPitch>u.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(u.minPitch!=null&&u.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(u.maxPitch!=null&&u.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(u.antialias&&o.dI(window)&&(u.antialias=!1,o.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new Bl(u.minZoom,u.maxZoom,u.minPitch,u.maxPitch,u.renderWorldCopies,null,null),u),this._repaint=!!u.repaint,this._interactive=u.interactive,this._minTileCacheSize=u.minTileCacheSize,this._maxTileCacheSize=u.maxTileCacheSize,this._failIfMajorPerformanceCaveat=u.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=u.preserveDrawingBuffer,this._antialias=u.antialias,this._trackResize=u.trackResize,this._bearingSnap=u.bearingSnap,this._refreshExpiredTiles=u.refreshExpiredTiles,this._fadeDuration=u.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=u.crossSourceCollisions,this._collectResourceTiming=u.collectResourceTiming,this._language=this._parseLanguage(u.language),this._worldview=u.worldview,this._renderTaskQueue=new gn,this._domRenderTaskQueue=new gn,this._controls=[],this._markers=[],this._popups=[],this._mapId=o.aW(),this._locale=o.l({},wo,u.locale),this._clickTolerance=u.clickTolerance,this._cooperativeGestures=u.cooperativeGestures,this._performanceMetricsCollection=u.performanceMetricsCollection,this._tessellationStep=u.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=u.precompilePrograms,this._scaleFactorChanged=!1,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new fa(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=u.scaleFactor,this._requestManager=new Qr(u.transformRequest,u.accessToken,u.testMode),this._silenceAuthErrors=!!u.testMode,this._contextCreateOptions=u.contextCreateOptions?Object.assign({},u.contextCreateOptions):{},typeof u.container=="string"){const r=document.getElementById(u.container);if(!r)throw new Error(`Container '${u.container.toString()}' not found.`);this._container=r}else{if(!(u.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=u.container}if(this._container.childNodes.length>0&&o.w("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),u.maxBounds&&this.setMaxBounds(u.maxBounds),this._spriteFormat=u.spriteFormat,o.aQ(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._tp||(this._tp=new Zu),this._tp.registerParameter(this,["Debug"],"showOverdrawInspector"),this._tp.registerParameter(this,["Debug"],"showTileBoundaries"),this._tp.registerParameter(this,["Debug"],"showParseStatus"),this._tp.registerParameter(this,["Debug"],"repaint"),this._tp.registerParameter(this,["Debug"],"showTileAABBs"),this._tp.registerParameter(this,["Debug"],"showPadding"),this._tp.registerParameter(this,["Debug"],"showCollisionBoxes",{noSave:!0}),this._tp.registerParameter(this.transform,["Debug"],"freezeTileCoverage",{noSave:!0},()=>{this._update()}),this._tp.registerParameter(this,["Debug","Wireframe"],"showTerrainWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers2DWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers3DWireframe"),this._tp.registerParameter(this,["Scaling"],"_scaleFactor",{min:.1,max:10,step:.1},()=>{this.setScaleFactor(this._scaleFactor)}),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");if(this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new Nd(this,u),this._localFontFamily=u.localFontFamily,this._localIdeographFontFamily=u.localIdeographFontFamily,(u.style||!u.testMode)&&this.setStyle(u.style||o.e.DEFAULT_STYLE,{config:u.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),u.projection&&this.setProjection(u.projection),this.indoor=new ed(this),u.hash&&(this._hash=new Ju(typeof u.hash=="string"&&u.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){t.center==null&&t.zoom==null||(this.transform._unmodified=!1),this.jumpTo({center:u.center,zoom:u.zoom,bearing:u.bearing,pitch:u.pitch});const r=u.bounds;r&&(this.resize(),this.fitBounds(r,o.l({},u.fitBoundsOptions,{duration:0})))}this.resize(),u.attributionControl&&this.addControl(new Tc({customAttribution:u.customAttribution}
vendor: 9,029 bytes, line 2481
2481)),this._logoControl=new _n,this.addControl(this._logoControl,u.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent()}),this.on("data",r=>{this._update(r.dataType==="style"),this.fire(new o.A(`${r.dataType}data`,r))}),this.on("dataloading",r=>{this.fire(new o.A(`${r.dataType}dataloading`,r))}),this._interactions=new sh(this)}_getMapId(){return this._mapId}addControl(u,t){if(t===void 0&&(t=u.getDefaultPosition?u.getDefaultPosition():"top-right"),!u||!u.onAdd)return this.fire(new o.z(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const r=u.onAdd(this);this._controls.push(u);const c=this._controlPositions[t];return t.indexOf("bottom")!==-1?c.insertBefore(r,c.firstChild):c.appendChild(r),this}removeControl(u){if(!u||!u.onRemove)return this.fire(new o.z(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(u);return t>-1&&this._controls.splice(t,1),u.onRemove(this),this}hasControl(u){return this._controls.indexOf(u)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(u){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const t=!this._moving;return t&&this.fire(new o.A("movestart",u)).fire(new o.A("move",u)),this.fire(new o.A("resize",u)),t&&this.fire(new o.A("moveend",u)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(u){return this.transform.setMaxBounds(o.aB.convert(u)),this._update()}setMinZoom(u){if((u=u??-2)>=-2&&u<=this.transform.maxZoom)return this.transform.minZoom=u,this._update(),this.getZoom()<u?this.setZoom(u):this.fire(new o.A("zoomstart")).fire(new o.A("zoom")).fire(new o.A("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(u){if((u=u??22)>=this.transform.minZoom)return this.transform.maxZoom=u,this._update(),this.getZoom()>u?this.setZoom(u):this.fire(new o.A("zoomstart")).fire(new o.A("zoom")).fire(new o.A("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(u){if((u=u??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(u>=0&&u<=this.transform.maxPitch)return this.transform.minPitch=u,this._update(),this.getPitch()<u?this.setPitch(u):this.fire(new o.A("pitchstart")).fire(new o.A("pitch")).fire(new o.A("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(u){if((u=u??85)>85)throw new Error("maxPitch must be less than or equal to 85");if(u>=this.transform.minPitch)return this.transform.maxPitch=u,this._update(),this.getPitch()>u?this.setPitch(u):this.fire(new o.A("pitchstart")).fire(new o.A("pitch")).fire(new o.A("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(u){return this._scaleFactor=u,this.painter.scaleFactor=u,this._tp.refreshUI(),this._scaleFactorChanged=!0,this.style._updateFilteredLayers(t=>t.type==="symbol"),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(u){return this.transform.renderWorldCopies=u,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(u){return u==="auto"?navigator.language:Array.isArray(u)?u.length===0?void 0:u.map(t=>t==="auto"?navigator.language:t):u}setLanguage(u){const t=this._parseLanguage(u);if(!this.style||t===this._language)return this;this._language=t,this.style.reloadSources();for(const r of this._controls)r._setLanguage&&r._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(u){return this.style&&u!==this._worldview?(this._worldview=u,this.style.reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return this.transform.projection.name==="globe"}setProjection(u){return this._lazyInitEmptyStyle(),u?typeof u=="string"&&(u={name:u}):u=null,this._useExplicitProjection=!!u,this._prioritizeAndUpdateProjection(u,this.style.projection)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const u=this.transform,t=u.projection.name;let r;t==="globe"&&u.zoom>=o.bY?(u.setMercatorFromTransition(),r=!0):t==="mercator"&&u.zoom<o.bY&&(u.setProjection({name:"globe"}),r=!0),r&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayerUpdate())}_prioritizeAndUpdateProjection(u,t){return this._updateProjection(u||t||{name:"mercator"})}_updateProjection(u){let t;return t=u.name==="globe"&&this.transform.zoom>=o.bY?this.transform.setMercatorFromTransition():this.transform.setProjection(u),this.style.applyProjectionUpdate(),t&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(u,t){return this.transform.locationPoint3D(o.bO.convert(u),t)}unproject(u,t){return this.transform.pointLocation3D(o.P.convert(u),t)}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(u,t,r){const c=d=>{let f=[];if(Array.isArray(t)){const _=t.filter(T=>this.getLayer(T));f=_.length?this.queryRenderedFeatures(d,{layers:_}):[]}else f=this.queryRenderedFeatures(d,{target:t});return f};if(u==="mouseenter"||u==="mouseover"){let d=!1;return{listener:r,targets:t,delegates:{mousemove:_=>{const T=c(_.point);T.length?d||(d=!0,r.call(this,new nn(u,this,_.originalEvent,{features:T}))):d=!1},mouseout:()=>{d=!1}}}}if(u==="mouseleave"||u==="mouseout"){let d=!1;return{listener:r,targets:t,delegates:{mousemove:T=>{c(T.point).length?d=!0:d&&(d=!1,r.call(this,new nn(u,this,T.originalEvent)))},mouseout:T=>{d&&(d=!1,r.call(this,new nn(u,this,T.originalEvent)))}}}}{const d=f=>{const _=c(f.point);_.length&&(f.features=_,r.call(this,f),delete f.features)};return{listener:r,targets:t,delegates:{[u]:d}}}}on(u,t,r){if(typeof t=="function"||r===void 0)return super.on(u,t);if(typeof t=="string"&&(t=[t]),!this._areTargetsValid(t))return this;const c=this._createDelegatedListener(u,t,r);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[u]=this._delegatedListeners[u]||[],this._delegatedListeners[u].push(c);for(const d in c.delegates)this.on(d,c.delegates[d]);return this}once(u,t,r){if(typeof t=="function"||r===void 0)return super.once(u,t);if(typeof t=="string"&&(t=[t]),!this._areTargetsValid(t))return this;const c=this._createDelegatedListener(u,t,r);for(const d in c.delegates)this.once(d,c.delegates[d]);return this}off(u,t,r){if(typeof t=="function"||r===void 0)return super.off(u,t);if(typeof t=="string"&&(t=[t]),!this._areTargetsValid(t))return this;const c=this._delegatedListeners?this._delegatedListeners[u]:void 0;return c&&(d=>{for(let f=0;f<d.length;f++){const _=d[f];if(_.listener===r&&vi(_.targets,t)){for(const T in _.delegates)this.off(T,_.delegates[T]);return d.splice(f,1),this}}})(c),this}queryRenderedFeatures(u,t){if(!this.style)return[];if(u===void 0||u instanceof o.P||Array.isArray(u)||t!==void 0||(t=u,u=void 0),u=u||[[0,0],[this.transform.width,this.transform.height]],!t){const f=this.style.queryRenderedFeatures(u,void 0,this.transform),_=this.style.queryRenderedFeatureset(u,void 0,this.transform);return f.concat(_)}let r=!0;if(t.target&&(r=this._isTargetValid(t.target),r&&!t.layers))return this.style.queryRenderedFeatureset(u,t,this.transform);let c=!0;if(t.layers&&Array.isArray(t.layers)){for(const f of t.layers)if(!this._isValidId(f)){c=!1;break}if(c&&!t.target)return this.style.queryRenderedFeatures(u,t,this.transform)}let d=[];return c&&(d=d.concat(this.style.queryRenderedFeatures(u,t,this.transform))),r&&(d=d.concat(this.style.queryRenderedFeatureset(u,t,this.transform))),d}querySourceFeatures(u,t){return!u||typeof u=="string"&&!this._isValidId(u)?[]:this.style.querySourceFeatures(u,t)}isPointOnSurface(u){const{name:t}=this.transform.projection;return t!=="globe"&&t!=="mercator"&&o.w(`${t} projection does not support isPointOnSurface, this API may behave unex
2481pectedly.`),this.transform.isPointOnSurface(o.P.convert(u))}addInteraction(u,t){return this._interactions.add(u,t),this}removeInteraction(u){return this._interactions.remove(u),this}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(u){return this._cooperativeGestures=u,this}setStyle(u,t){return t=o.l({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},t),this.style&&u&&t.diff!==!1&&t.localFontFamily===this._localFontFamily&&t.localIdeographFontFamily===this._localIdeographFontFamily&&!t.config?(this.style._diffStyle(u,(r,c)=>{r?(o.w(`Unable to perform style diff: ${String(r.message||r.error||r)}. Rebuilding the style from scratch.`),this._updateStyle(u,t)):c&&this._update(!0)},()=>{this._postStyleLoadEvent()}),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._localFontFamily=t.localFontFamily,this._updateStyle(u,t))}_getUIString(u){const t=this._locale[u];if(t==null)throw new Error(`Missing UI string '${u}'`);return t}_updateStyle(u,t){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),u){const r=o.l({},t);t&&t.config&&(r.initialConfig=t.config,delete r.config),this.style=new Nn(this,r).load(u),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new Nn(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(o.w("There is no style added to the map."),!1)}_isValidId(u){return u==null?(this.fire(new o.z(new Error("IDs can't be empty."))),!1):!o.cs(u)||(this.fire(new o.z(new Error(`IDs can't contain special symbols: "${u}".`))),!1)}_isTargetValid(u){return"featuresetId"in u?this._isValidId("importId"in u?u.importId:u.featuresetId):"layerId"in u&&this._isValidId(u.layerId)}_areTargetsValid(u){if(Array.isArray(u)){for(const t of u)if(!this._isValidId(t))return!1;return!0}return this._isTargetValid(u)}addSource(u,t){return this._isValidId(u)?(this._lazyInitEmptyStyle(),this.style.addSource(u,t),this._update(!0)):this}isSourceLoaded(u){return!!this._isValidId(u)&&!!this.style&&this.style._isSourceCacheLoaded(u)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(u,t,r){this._lazyInitEmptyStyle(),this.style.addSourceType(u,t,r)}removeSource(u){return this._isValidId(u)?(this.style.removeSource(u),this._updateTerrain(),this._update(!0)):this}getSource(u){return this._isValidId(u)?this.style.getOwnSource(u):null}addImage(u,t,{pixelRatio:r=1,sdf:c=!1,stretchX:d,stretchY:f,content:_}={}){this._lazyInitEmptyStyle();const T=o.I.from(u);if(t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap){const{width:E,height:M,data:I}=o.q.getImageData(t);this.style.addImage(T,{data:new o.r({width:E,height:M},I),pixelRatio:r,stretchX:d,stretchY:f,content:_,sdf:c,version:0,usvg:!1})}else if(t.width===void 0||t.height===void 0)this.fire(new o.z(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:E,height:M}=t,I=t;this.style.addImage(T,{data:new o.r({width:E,height:M},new Uint8Array(I.data)),pixelRatio:r,stretchX:d,stretchY:f,content:_,sdf:c,usvg:!1,version:0,userImage:I}),I.onAdd&&I.onAdd(this,u)}}updateImage(u,t){this._lazyInitEmptyStyle();const r=o.I.from(u),c=this.style.getImage(r);if(!c)return void this.fire(new o.z(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const d=t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap?o.q.getImageData(t):t,{width:f,height:_,data:T}=d;if(f===void 0||_===void 0)return void this.fire(new o.z(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(f!==(c.usvg?c.icon.usvg_tree.width:c.data.width)||_!==(c.usvg?c.icon.usvg_tree.height:c.data.height))return void this.fire(new o.z(ne
vendor: 9,941 bytes, lines 2481-2483
2481w Error(`The width and height of the updated image (${f}, ${_}) 2482 must be that same as the previous version of the image 2483 (${c.data.width}, ${c.data.height})`)));const E=!(t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap);let M=!1;c.usvg?(c.data=new o.r({width:f,height:_},new Uint8Array(T)),c.usvg=!1,c.icon=void 0,M=!0):c.data.replace(T,E),this.style.updateImage(r,c,M)}hasImage(u){return u?!!this.style&&!!this.style.getImage(o.I.from(u)):(this.fire(new o.z(new Error("Missing required image id"))),!1)}removeImage(u){this.style.removeImage(o.I.from(u))}loadImage(u,t){o.o(this._requestManager.transformRequest(u,o.R.Image),(r,c)=>{t(r,c instanceof HTMLImageElement?o.q.getImageData(c):c)})}listImages(){return this.style.listImages().map(u=>u.name)}addModel(u,t){this._lazyInitEmptyStyle(),this.style.addModel(u,t)}hasModel(u){return u?this.style.hasModel(u):(this.fire(new o.z(new Error("Missing required model id"))),!1)}removeModel(u){this.style.removeModel(u)}listModels(){return this.style.listModels()}addLayer(u,t){return this._isValidId(u.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(u,t),this._update(!0)):this}getSlot(u){const t=this.getLayer(u);return t&&t.slot||null}setSlot(u,t){return this.style.setSlot(u,t),this.style.mergeLayers(),this._update(!0)}addImport(u,t){return this.style.addImport(u,t),this}updateImport(u,t){return typeof t!="string"&&t.id!==u?(this.removeImport(u),this.addImport(t)):(this.style.updateImport(u,t),this._update(!0))}removeImport(u){return this.style.removeImport(u),this}moveImport(u,t){return this.style.moveImport(u,t),this._update(!0)}moveLayer(u,t){return this._isValidId(u)?(this.style.moveLayer(u,t),this._update(!0)):this}removeLayer(u){return this._isValidId(u)?(this.style.removeLayer(u),this._update(!0)):this}getLayer(u){if(!this._isValidId(u))return null;const t=this.style.getOwnLayer(u);return t?t.type==="custom"?t.implementation:t.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(u,t,r){return this._isValidId(u)?(this.style.setLayerZoomRange(u,t,r),this._update(!0)):this}setFilter(u,t,r={}){return this._isValidId(u)?(this.style.setFilter(u,t,r),this._update(!0)):this}getFilter(u){return this._isValidId(u)?this.style.getFilter(u):null}setPaintProperty(u,t,r,c={}){return this._isValidId(u)?(this.style.setPaintProperty(u,t,r,c),this._update(!0)):this}getPaintProperty(u,t){return this._isValidId(u)?this.style.getPaintProperty(u,t):null}setLayoutProperty(u,t,r,c={}){return this._isValidId(u)?(this.style.setLayoutProperty(u,t,r,c),this._update(!0)):this}getLayoutProperty(u,t){return this._isValidId(u)?this.style.getLayoutProperty(u,t):null}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(u){return this.style.setGlyphsUrl(u),this._update(!0)}getSchema(u){return this.style.getSchema(u)}setSchema(u,t){return this.style.setSchema(u,t),this._update(!0)}getConfig(u){return this.style.getConfig(u)}setConfig(u,t){return this.style.setConfig(u,t),this._update(!0)}getConfigProperty(u,t){return this.style.getConfigProperty(u,t)}setConfigProperty(u,t,r){return this.style.setConfigProperty(u,t,r),this._update(!0)}getFeaturesetDescriptors(u){return this.style.getFeaturesetDescriptors(u)}setLights(u){if(this._lazyInitEmptyStyle(),u&&u.length===1&&u[0].type==="flat"){const t=u[0];t.properties?this.style.setFlatLight(t.properties,t.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(u),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const u=this.style.getLights()||[];return u.length===0&&u.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),u}setLight(u,t={}){return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."),this.setLights([{id:"flat",type:"flat",properties:u}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(u){return this._lazyInitEmptyStyle(),!u&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(u),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(u){return this._lazyInitEmptyStyle(),this.style.setFog(u),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(u){return this._lazyInitEmptyStyle(),this.style.setSnow(u),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(u){return this._lazyInitEmptyStyle(),this.style.setRain(u),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(u){return this._lazyInitEmptyStyle(),this.style.setColorTheme(u),this._update(!0)}setImportColorTheme(u,t){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(u,t),this._update(!0)}setCamera(u){return this.style.setCamera(u),this._triggerCameraUpdate(u)}_triggerCameraUpdate(u){return this._update(this.transform.setOrthographicProjectionAtLowPitch(u["camera-projection"]==="orthographic"))}getCamera(){return this.style.camera}_queryFogOpacity(u){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(o.bO.convert(u),this.transform):0}setFeatureState(u,t){return u.source&&!this._isValidId(u.source)?this:(this.style.setFeatureState(u,t),this._update())}removeFeatureState(u,t){return u.source&&!this._isValidId(u.source)?this:(this.style.removeFeatureState(u,t),this._update())}getFeatureState(u){return u.source&&!this._isValidId(u.source)?null:this.style.getFeatureState(u)}_updateContainerDimensions(){if(!this._container)return;const u=this._container.getBoundingClientRect().width||400,t=this._container.getBoundingClientRect().height||300;let r,c,d,f=this._container;for(;f&&(!c||!d);){const _=window.getComputedStyle(f).transform;_&&_!=="none"&&(r=_.match(/matrix.*\((.+)\)/)[1].split(", "),r[0]&&r[0]!=="0"&&r[0]!=="1"&&(c=r[0]),r[3]&&r[3]!=="0"&&r[3]!=="1"&&(d=r[3])),f=f.parentElement}this._containerWidth=c?Math.abs(u/c):u,this._containerHeight=d?Math.abs(t/d):t}_detectMissingCSS(){window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&o.w("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const u=this._container;u.classList.add("mapboxgl-map"),(this._missingCSSCanary=ne("div","mapboxgl-canary",u)).style.visibility="hidden",this._detectMissingCSS();const t=this._canvasContainer=ne("div","mapboxgl-canvas-container",u);this._canvas=ne("canvas","mapboxgl-canvas",t),this._interactive&&(t.classList.add("mapboxgl-interactive"),this._canvas.setAttribute("tabindex","0")),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const r=this._controlContainer=ne("div","mapboxgl-control-container",u),c=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(d=>{c[d]=ne("div",`mapboxgl-ctrl-${d}`,r)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(u,t){const r=o.q.devicePixelRatio||1;this._canvas.width=r*Math.ceil(u),this._canvas.height=r*Math.ceil(t),this._canvas.style.width=`${u}px`,this._canvas.style.height=`${t}px`}_addMarker(u){this._markers.push(u)}_removeMarker(u){const t=this._markers.indexOf(u);t!==-1&&this._markers.splice(t,1)}_addPopup(u){this._popups.push(u)}_removePopup(u){const t=this._popups.indexOf(u);t!==-1&&this._popups.splice(t,1)}_setupPainter(){const u=o.l({},Fe.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),t=this._canvas.getContext("webgl2",u);t?(Ls(t,!0),this.painter=new vc(t,this._contextCreateOptions,this.transform,this._scaleFactor,this._tp),this.on("data",r=>{r.dataType==="source"&&this.painter.setTileLoadedFlag(!0)}),o.m.testSupport(t)):this.fire(new o.z(new Error("Failed to initialize WebGL")))}_contextLost(u){u.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new o.A("webglcontextlost",{originalEvent:u}))}_contextRestored(u){this._setupPainter(),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight)),this._updateTerrain(),this.style.reloadModels(),this.style.clearSources(),this._update(),this.fire(new o.A("webglcontextrestored",{originalEvent:u}))}_onMapScroll(u){if(u.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}idle(){return!this.isMoving()&&this.loaded()}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}frameReady(){return this.loaded()&&!this._placementDirty}_update(u){return this.style?(this._styleDirty=this._styleDirty||u,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(u){return this._update(),this._renderTaskQueue.add(u)}_cancelRenderFrame(u){this._renderTaskQueue.remove(u)}_requestDomTask(u){!this.loaded()||this.loaded()&&!this.isMoving()?u():this._domRenderTaskQueue.add(u)}_render(u){let t;this.fire(new o.A("renderstart")),++this._frameId;const r=this.painter.context.extTimerQuery,c=o.q.now(),d=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(t=d.createQuery(),d.beginQuery(r.TIME_ELAPSED_EXT,t)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&
2483(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(u),this._domRenderTaskQueue.run(u),this._removed)return;this._updateProjectionTransition();const f=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const M=this.transform.zoom,I=this.transform.pitch,P=o.q.now(),R=new o.aa(M,{now:P,fadeDuration:f,pitch:I,transition:this.style.transition});this.style.update(R)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let _=!1;this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),_=this._updateAverageElevation(c),this.style.updateSources(this.transform),this.isMoving()||this._forceMarkerAndPopupUpdate()):_=this._updateAverageElevation(c);const T=this.style&&this.style._updatePlacement(this.painter,this.painter.transform,this.showCollisionBoxes,f,this._crossSourceCollisions,this.painter.replacementSource,this._scaleFactorChanged);if(this._scaleFactorChanged&&(this._scaleFactorChanged=!1),T&&(this._placementDirty=T.needsRerender),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:f,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new o.A("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,Ge.mark(Oe.load),this.fire(new o.A("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&(this.style.snow||this.style.rain)&&(this._styleDirty=!0),this.style&&this.style.imageManager.hasPatternsInFlight()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),t){const M=o.q.now()-c;d.endQuery(r.TIME_ELAPSED_EXT),setTimeout(()=>{const I=d.getQueryParameter(t,d.QUERY_RESULT)/1e6;d.deleteQuery(t),this.fire(new o.A("gpu-timing-frame",{cpuTime:M,gpuTime:I}))},50)}if(this.listens("gpu-timing-layer")){const M=this.painter.collectGpuTimers();setTimeout(()=>{const I=this.painter.queryGpuTimers(M);this.fire(new o.A("gpu-timing-layer",{layerTimes:I}))},50)}if(this.listens("gpu-timing-deferred-render")){const M=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const I=this.painter.queryGpuTimeDeferredRender(M);this.fire(new o.A("gpu-timing-deferred-render",{gpuTime:I}))},50)}const E=this._sourcesDirty||this._styleDirty||this._placementDirty||_;if(E||this._repaint)this.triggerRepaint();else{const M=this.idle();if(M&&(_=this._updateAverageElevation(c,!0)),_)this.triggerRepaint();else if(this._triggerFrame(!1),M&&(this.fire(new o.A("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const I=this._calculateSpeedIndex();this.fire(new o.A("speedindexcompleted",{speedIndex:I})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||E||(this._fullyLoaded=!0,Ge.mark(Oe.fullLoad),this._performanceMetricsCollection&&$r(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(u){for(const t of this._markers)u&&!this.getRenderWorldCopies()&&(t._lngLat=t._lngLat.wrap()),t._update();for(const t of this._popups)!u||this.getRenderWorldCopies()||t._trackPointer||(t._lngLat=t._lngLat.wrap()),t._update()}_updateAverageElevation(u,t=!1){const r=d=>(this.transform.averageElevation=d,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&r(0);const c=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(c||(t||u-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(u)){const d=this.transform.averageElevation;let f=this.transform.sampleAverageElevation();this.transform.elevation!=null&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(f)?f=0:this._averageElevationLastSampledAt=u;const _=Math.abs(d-f);if(_>1){if(this._isInitialLoad||c)return this._averageElevation.jumpTo(f),r(f);this._averageElevation.easeTo(f,u,300)}else if(_>1e-4)return this._averageElevation.jumpTo(f),r(f)}return!!this._averageElevation.isEasing(u)&&r(this._averageElevation.getValue(u))}_authenticate(){X(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,u=>{if(u&&(u.message===mr||u.status===401)){const t=this.painter.context.gl;Ls(t,!1),this._logoControl instanceof _n&&this._logoControl._updateLogo(),t&&t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT|t.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new o.z(ne
2483w Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),Mo(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&Br(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_updateTerrain(){const u=this._isDragging();this.painter.updateTerrain(this.style,u)}_calculateSpeedIndex(){const u=this.painter.canvasCopy(),t=this.painter.getCanvasCopiesAndTimestamps();t.timeStamps.push(performance.now());const r=this.painter.context.gl,c=r.createFramebuffer();function d(f){r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,f,0);const _=new Uint8Array(r.drawingBufferWidth*r.drawingBufferHeight*4);return r.readPixels(0,0,r.drawingBufferWidth,r.drawingBufferHeight,r.RGBA,r.UNSIGNED_BYTE,_),_}return r.bindFramebuffer(r.FRAMEBUFFER,c),this._canvasPixelComparison(d(u),t.canvasCopies.map(d),t.timeStamps)}_canvasPixelComparison(u,t,r){let c=r[1]-r[0];const d=u.length/4;for(let f=0;f<t.length;f++){const _=t[f];let T=0;for(let E=0;E<_.length;E+=4)_[E]===u[E]&&_[E+1]===u[E+1]&&_[E+2]===u[E+2]&&_[E+3]===u[E+3]&&(T+=1);c+=(r[f+2]-r[f+1])*(1-T/d)}return c}remove(){this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.style&&this.style.destroy(),this.indoor.destroy(),this.painter.destroy(),this.handlers&&this.handlers.destroy(),this.handlers=void 0,this.setStyle(null),window.removeEventListener("resize",this._onWindowResize,!1),window.removeEventListener("orientationchange",this._onWindowResize,!1),window.removeEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.removeEventListener("online",this._onWindowOnline,!1),window.removeEventListener("visibilitychange",this._onVisibilityChange,!1);const u=this.painter.context.gl.getExtension("WEBGL_lose_context");u&&u.loseContext(),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._missingCSSCanary.remove(),this._canvas=void 0,this._canvasContainer=void 0,this._controlContainer=void 0,this._missingCSSCanary=void 0,this._container.classList.remove("mapboxgl-map"),this._container.removeEventListener("scroll",this._onMapScroll,!1),ro.delete(this.painter.context.gl),bn.remove(),Zt.remove(),this._removed=!0,this.fire(new o.A("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(u){this._renderNextFrame=this._renderNextFrame||u,this.style&&!this._frame&&(this._frame=o.q.frame(t=>{const r=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,r&&this._render(t)}))}_preloadTiles(u){const t=this.style?this.style.getSourceCaches():[];return o.bl(t,(r,c)=>r._preloadTiles(u,c),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(u){this._trackResize&&this.resize({originalEvent:u})._update()}_onVisibilityChange(){document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(u){this._showTileBoundaries!==u&&(this._showTileBoundaries=u,this._tp.refreshUI(),this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(u){this._showParseStatus!==u&&(this._showParseStatus=u,this._tp.refreshUI(),this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(u){this._showTerrainWireframe!==u&&(this._showTerrainWireframe=u,this._tp.refreshUI(),this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(u){this._showLayers2DWireframe!==u&&(this._showLayers2DWireframe=u,this._tp.refreshUI(),this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(u){this._showLayers3DWireframe!==u&&(this._showLayers3DWireframe=u,this._tp.refreshUI(),this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(u){this._speedIndexTiming!==u&&(this._speedIndexTiming=u,this._update())}get showPadding(){return!!this._showPadding}set showPadding(u){this._showPadding!==u&&(this._showPadding=u,this._tp.refreshUI(),this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(u){this._showCollisionBoxes!==u&&(this._showCollisionBoxes=u,this._tp.refreshUI(),u?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(u){this._showOverdrawInspector!==u&&(this._showOverdrawInspector=u,this._tp.refreshUI(),this._update())}get repaint(){return!!this._repaint}set repaint(u){this._repaint!==u&&(this._repaint=u,this._tp.refreshUI(),this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(u){this._vertices=u,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(u){this._showTileAABBs!==u&&(this._showTileAABBs=u,this._tp.refreshUI(),u&&this._update())}_setCacheLimits(u,t){o.dJ(u,t)}get version(){return Ce}},NavigationControl:class{constructor(u={}){this.options=o.l({},Mf,u),this._container=ne("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(o.aQ(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",t=>{this._map&&this._map.zoomIn({},{originalEvent:t})}),ne("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",t=>{this._map&&this._map.zoomOut({},{originalEvent:t})}),ne("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(o.aQ(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",t=>{const r=this._map;r&&(this.options.visualizePitch?r.resetNorthPitch({},{originalEvent:t}):r.resetNorth({},{originalEvent:t}))}),this._compassIcon=ne("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const u=this._map;if(!u)return;
vendor: 4,341 bytes, line 2483
2483const t=u.getZoom(),r=t===u.getMaxZoom(),c=t===u.getMinZoom();this._zoomInButton.disabled=r,this._zoomOutButton.disabled=c,this._zoomInButton.setAttribute("aria-disabled",r.toString()),this._zoomOutButton.setAttribute("aria-disabled",c.toString())}_rotateCompassArrow(){const u=this._map;if(!u)return;const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(u.transform.pitch*(Math.PI/180)),.5)}) rotateX(${u.transform.pitch}deg) rotateZ(${u.transform.angle*(180/Math.PI)}deg)`:`rotate(${u.transform.angle*(180/Math.PI)}deg)`;u._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=t)})}onAdd(u){return this._map=u,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),u.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&u.on("pitch",this._rotateCompassArrow),u.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new If(u,this._compass,this.options.visualizePitch)),this._container}onRemove(){const u=this._map;u&&(this._container.remove(),this.options.showZoom&&u.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&u.off("pitch",this._rotateCompassArrow),u.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(u,t){const r=ne("button",u,this._container);return r.type="button",r.addEventListener("click",t),r}_setButtonTitle(u,t){if(!this._map)return;const r=this._map._getUIString(`NavigationControl.${t}`);u.setAttribute("aria-label",r),u.firstElementChild&&u.firstElementChild.setAttribute("title",r)}},GeolocateControl:class extends o.E{constructor(u={}){super();const t=navigator.geolocation;this.options=o.l({geolocation:t},on,u),o.aQ(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=xc(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(u){return this._map=u,this._container=ne("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){this._geolocationWatchID!==void 0&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(u){const t=(r=!!this.options.geolocation)=>{this._supportsGeolocation=r,u(r)};this._supportsGeolocation!==void 0?u(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then(r=>t(r.state!=="denied")).catch(()=>t()):t()}_isOutOfMapMaxBounds(u){const t=this._map.getMaxBounds(),r=u.coords;return!!t&&(r.longitude<t.getWest()||r.longitude>t.getEast()||r.latitude<t.getSouth()||r.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(u){if(this._map){if(this._isOutOfMapMaxBounds(u))return this._setErrorState(),this.fire(new o.A("outofmaxbounds",u)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=u,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_E
2483RROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(u),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(u),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new o.A("geolocate",u)),this._finish()}}_updateCamera(u){const t=new o.bO(u.coords.longitude,u.coords.latitude),r=u.coords.accuracy,c=this._map.getBearing(),d=o.l({bearing:c},this.options.fitBoundsOptions);this._map.fitBounds(t.toBounds(r),d,{geolocateSource:!0})}_updateMarker(u){if(u){const t=new o.bO(u.coords.longitude,u.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=u.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const u=this._map.transform,t=o.bH(1,u._center.lat)*u.worldSize,r=Math.ceil(2*this._accuracy*t);this._circleElement.style.width=`${r}px`,this._circleElement.style.height=`${r}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&typeof this._heading=="number"?(this._userLocationDotMarker.setRotation(this._heading),this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")):(this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(u){if(this._map){if(this.options.trackUserLocation)if(u.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(u.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new o.A("error",u)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(u){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=ne("button","mapboxgl-ctrl-geolocate",this._container),ne("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",u===!1){o.w("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
2483se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=ne("div","mapboxgl-user-location"),this._dotElement.appendChild(ne("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(ne("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new Cr({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=ne("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Cr({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",t=>{t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||t.originalEvent&&t.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new o.A("trackuserlocationend")))})}}_onDeviceOrientation(u){this._userLocationDotMarker&&(u.webkitCompassHeading?this._heading=u.webkitCompassHeading:u.absolute===!0&&(this._heading=-1*u.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return o.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new o.A("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new o.A("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new o.A("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let u;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(u={maximumAge:6e5,timeout:0},this._noTimeout=!0):(u=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,u),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=window.setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const u=()=>{"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",this._onDeviceOrientation):window.addEventListener("deviceorientation",this._onDeviceOrientation)};typeof DeviceMotionEvent<"u"&&typeof DeviceMotionEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(t=>{t==="granted"&&u()}).catch(console.error):u()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","fal
2483se"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:Tc,ScaleControl:class{constructor(u={}){this.options=o.l({},Sr,u),this._isNumberFormatSupported=function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"short",unit:"meter"}),!0}catch{return!1}}(),o.aQ(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const u=this.options.maxWidth||100,t=this._map,r=t._containerHeight/2,c=t._containerWidth/2-u/2,d=t.unproject([c,r]),f=t.unproject([c+u,r]),_=d.distanceTo(f);if(this.options.unit==="imperial"){const T=3.2808*_;T>5280?this._setScale(u,T/5280,"mile"):this._setScale(u,T,"foot")}else this.options.unit==="nautical"?this._setScale(u,_/1852,"nautical-mile"):_>=1e3?this._setScale(u,_/1e3,"kilometer"):this._setScale(u,_,"meter")}_setScale(u,t,r){this._map._requestDomTask(()=>{const c=function(f){const _=Math.pow(10,`${Math.floor(f)}`.length-1);let T=f/_;return T=T>=10?10:T>=5?5:T>=3?3:T>=2?2:T>=1?1:function(E){const M=Math.pow(10,Math.ceil(-Math.log(E)/Math.LN10));return Math.round(E*M)/M}(T),_*T}(t),d=c/t;this._container.innerHTML=this._isNumberFormatSupported&&r!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:r}).format(c):`${c} ${oh[r]}`,this._container.style.width=u*d+"px"})}onAdd(u){return this._map=u,this._language=u.getLanguage(),this._container=ne("div","mapboxgl-ctrl mapboxgl-ctrl-scale",u.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(u){this._language=u,this._update()}setUnit(u){this.options.unit=u,this._update()}},FullscreenControl:class{constructor(u={}){this._fullscreen=!1,u&&u.container&&(u.container instanceof HTMLElement?this._container=u.container:o.w("Full screen control 'container' must be a DOM element.")),o.aQ(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(u){return this._map=u,this._container||(this._container=this._map.getContainer()),this._controlContainer=ne("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",o.w("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){const u=this._fullscreenButton=ne("button","mapboxgl-ctrl-fullscreen",this._controlContainer);ne("span","mapboxgl-ctrl-icon",u).setAttribute("aria-hidden","true"),u.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const u=this._getTitle();this._fullscreenButton.setAttribute("aria-label",u),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",u)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends o.E{constructor(u){super(),this.options=o.l(Object.create(tr),u),this._altitude=this.options.altitude,o.aQ(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(u&&u.className?u.className.trim().split(/\s+/):[])}addTo(u){return this._map&&this.remove(),this._map=u,this.options.closeOnClick&&u.on("preclick",this._onClose),this.options.closeOnMove&&u.on("move",this._onClose),u.on("remove",this.remove),this._update(),u._addPopup(this),this._focusFirstElement(),this._trackPointer?(u.on("mousemove",this._onMouseEvent),u.on("mouseup",this._onMouseEvent),u._canvasContainer.classList.add("mapboxgl-track-pointer")):u.on("move",this._update),this.fire(new o.A("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const u=this._map;return u&&(u.off("move",this._update),u.off("move",this._onClose),u.off("preclick",this._onClose),u.off("click",this._onClose),u.off("remove",this.remove),u.off("mousemove",this._onMouseEvent),u.off("mouseup",this._onMouseEvent),u.off("drag",this._onMouseEvent),u._canvasContainer&&u._canvasContainer.classList.remove("mapboxgl-track-pointer"),u._removePopup(this),this._map=void 0),this.fire(new o.A("close")),this}getLngLat(){return this._lngLat}setLngLat(u){this._lngLat=o.bO.convert(u),this._pos=null,this._trackPointer=!1,this._update();const t=this._map;return t&&(t.on("move",this._update),t.off("mousemove",this._onMouseEvent),t._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}getAltitude(){return this._altitude}setAltitude(u){return this._altitude=u,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const u=this._map;return u&&(u.off("move",this._update),u.on("mousemove",this._onMouseEvent),u.on("drag",this._onMouseEvent),u._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(u){return this.setDOMContent(document.createTextNode(u))}setHTML(u){const t=document.createDocumentFragment(),r=document.createElement("body");let c;for(r.innerHTML=u;c=r.firstChild,c;
2483)t.appendChild(c);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(u){return this.options.maxWidth=u,this._update(),this}setDOMContent(u){let t=this._content;if(t)for(;t.hasChildNodes();)t.firstChild&&t.removeChild(t.firstChild);else t=this._content=ne("div","mapboxgl-popup-content",this._container||void 0);if(t.appendChild(u),this.options.closeButton){const r=this._closeButton=ne("button","mapboxgl-popup-close-button",t);r.type="button",r.setAttribute("aria-label","Close popup"),r.innerHTML='<span aria-hidden="true">×</span>',r.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(u){return this._classList.add(u),this._updateClassList(),this}removeClassName(u){return this._classList.delete(u),this._updateClassList(),this}setOffset(u){return this.options.offset=u,this._update(),this}toggleClassName(u){let t;return this._classList.delete(u)?t=!1:(this._classList.add(u),t=!0),this._updateClassList(),t}_onMouseEvent(u){this._update(u.point)}_getAnchor(u){if(this.options.anchor)return this.options.anchor;const t=this._map,r=this._container,c=this._pos;if(!t||!r||!c)return"bottom";const d=r.offsetWidth,f=r.offsetHeight,_=c.x<d/2,T=c.x>t.transform.width-d/2;if(c.y+u<f)return _?"top-left":T?"top-right":"top";if(c.y>t.transform.height-f){if(_)return"bottom-left";if(T)return"bottom-right"}return _?"left":T?"right":"bottom"}_updateClassList(){const u=this._container;if(!u)return;const t=[...this._classList];t.push("mapboxgl-popup"),this._anchor&&t.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&t.push("mapboxgl-popup-track-pointer"),u.className=t.join(" ")}_update(u){const t=this._map,r=this._content;if(!t||!this._lngLat&&!this._trackPointer||!r)return;let c=this._container;if(c||(c=this._container=ne("div","mapboxgl-popup",t.getContainer()),this._tip=ne("div","mapboxgl-popup-tip",c),c.appendChild(r)),this.options.maxWidth&&c.style.maxWidth!==this.options.maxWidth&&(c.style.maxWidth=this.options.maxWidth),t.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Sc(this._lngLat,this._pos,t.transform)),!this._trackPointer||u){const d=this._pos=this._trackPointer&&u instanceof o.P?u:t.project(this._lngLat,this._altitude),f=Ys(this.options.offset),_=this._anchor=this._getAnchor(f.y),T=Ys(this.options.offset,_),E=d.add(T).round();t._requestDomTask(()=>{this._container&&_&&(this._container.style.transform=`${es[_]} translate(${E.x}px,${E.y}px)`)})}if(!this._marker&&t._showingGlobe()){const d=o.dK(t.transform,this._lngLat)?0:1;this._setOpacity(d)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const u=this._container.querySelector(Ud);u&&u.focus()}_onClose(){this.remove()}_setOpacity(u){this._container&&(this._container.style.opacity=`${u}`),this._content&&(this._content.style.pointerEvents=u?"auto":"none")}},Marker:Cr,Style:Nn,LngLat:o.bO,LngLatBounds:o.aB,Point:o.P,MercatorCoordinate:o.ac,FreeCameraOptions:iu,Evented:o.E,config:o.e,prewarm:o.dP,clearPrewarmedResources:o.dQ,get accessToken(){return o.e.ACCESS_TOKEN},set accessToken(u){o.e.ACCESS_TOKEN=u},get baseApiUrl(){return o.e.API_URL},set baseApiUrl(u){o.e.API_URL=u},get workerCount(){return o.dR.workerCount},set workerCount(u){o.dR.workerCount=u},get maxParallelImageRequests(){return o.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(u){o.e.MAX_PARALLEL_IMAGE_REQUESTS=u},clearStorage(u){o.dS(u)},get workerUrl(){return o.dT.workerUrl},set workerUrl(u){o.dT.workerUrl=u},get workerClass(){return o.dT.workerClass},set workerClass(u){o.dT.workerClass=u},get workerParams(){return o.dT.workerParams},set workerParams(u){o.dT.workerParams=u},get dracoUrl(){return o.dU()},set dracoUrl(u){o.dV(u)},get meshoptUrl(){return o.dW()},set meshoptUrl(u){o.dX(u)},setNow:o.q.setNow,restoreNow:o.q.restoreNow}});var Ie=Q;return Ie})}(Dp)),Dp.exports}var t2=e2();const io=d0(t2);var Gm,Sx;function $c(){if(Sx)return Gm;Sx=1,Gm=fe;var Re=Object.prototype.hasOwnProperty;function fe(){for(var se={},he=0;he<arguments.length;he++){var Q=arguments[he];for(var ve in Q)Re.call(Q,ve)&&(se[ve]=Q[ve])}return se}return Gm}var $m={exports:{}},Ex;function i2(){return Ex||(Ex=1,function(Re,fe){(function(){var se={};Re.exports=se,se.simpleFilter=function(he,Q){return Q.filter(function(ve){return se.test(he,ve)})},se.test=function(he,Q){return se.match(he,Q)!==null},se.match=function(he,Q,ve){ve=ve||{};var Ie=0,o=[],Ce=Q.length,Oe=0,Ge=0,qe=ve.pre||"",ut=ve.post||"",It=ve.caseSensitive&&Q||Q.toLowerCase(),Fe;he=ve.caseSensitive&&he||he.toLowerCase();for(var ne=0;ne<Ce;
2483ne++)Fe=Q[ne],It[ne]===he[Ie]?(Fe=qe+Fe+ut,Ie+=1,Ge+=1+Ge):Ge=0,Oe+=Ge,o[o.length]=Fe;return Ie===he.length?(Oe=It===he?1/0:Oe,{rendered:o.join(""),score:Oe}):null},se.filter=function(he,Q,ve){return!Q||Q.length===0?[]:typeof he!="string"?Q:(ve=ve||{},Q.reduce(function(Ie,o,Ce,Oe){var Ge=o;ve.extract&&(Ge=ve.extract(o));var qe=se.match(he,Ge,ve);return qe!=null&&(Ie[Ie.length]={string:qe.rendered,score:qe.score,index:Ce,original:o}),Ie},[]).sort(function(Ie,o){var Ce=o.score-Ie.score;return Ce||Ie.index-o.index}))}})()}($m)),$m.exports}var Hm,Mx;function r2(){if(Mx)return Hm;Mx=1;var Re=function(fe){return this.component=fe,this.items=[],this.active=0,this.wrapper=document.createElement("div"),this.wrapper.className="suggestions-wrapper",this.element=document.createElement("ul"),this.element.className="suggestions",this.wrapper.appendChild(this.element),this.selectingListItem=!1,fe.el.parentNode.insertBefore(this.wrapper,fe.el.nextSibling),this};return Re.prototype.show=function(){this.element.style.display="block"},Re.prototype.hide=function(){this.element.style.display="none"},Re.prototype.add=function(fe){this.items.push(fe)},Re.prototype.clear=function(){this.items=[],this.active=0},Re.prototype.isEmpty=function(){return!this.items.length},Re.prototype.isVisible=function(){return this.element.style.display==="block"},Re.prototype.draw=function(){if(this.element.innerHTML="",this.items.length===0){this.hide();return}for(var fe=0;fe<this.items.length;fe++)this.drawItem(this.items[fe],this.active===fe);this.show()},Re.prototype.drawItem=function(fe,se){var he=document.createElement("li"),Q=document.createElement("a");se&&(he.className+=" active"),Q.innerHTML=fe.string,he.appendChild(Q),this.element.appendChild(he),he.addEventListener("mousedown",(function(){this.selectingListItem=!0}).bind(this)),he.addEventListener("mouseup",(function(){this.handleMouseUp.call(this,fe)}).bind(this))},Re.prototype.handleMouseUp=function(fe){this.selectingListItem=!1,this.component.value(fe.original),this.clear(),this.draw()},Re.prototype.move=function(fe){this.active=fe,this.draw()},Re.prototype.previous=function(){this.move(this.active===0?this.items.length-1:this.active-1)},Re.prototype.next=function(){this.move(this.active===this.items.length-1?0:this.active+1)},Re.prototype.drawError=function(fe){var se=document.createElement("li");se.innerHTML=fe,this.element.appendChild(se),this.show()},Hm=Re,Hm}var Zm,Ix;function n2(){if(Ix)return Zm;Ix=1;var Re=$c(),fe=i2(),se=r2(),he=function(Q,ve,Ie){return Ie=Ie||{},this.options=Re({minLength:2,limit:5,filter:!0,hideOnBlur:!0},Ie),this.el=Q,this.data=ve||[],this.list=new se(this),this.query="",this.selected=null,this.list.draw(),this.el.addEventListener("keyup",(function(o){this.handleKeyUp(o.keyCode)}).bind(this),!1),this.el.addEventListener("keydown",(function(o){this.handleKeyDown(o)}).bind(this)),this.el.addEventListener("focus",(function(){this.handleFocus()}).bind(this)),this.el.addEventListener("blur",(function(){this.handleBlur()}).bind(this)),this.el.addEventListener("paste",(function(o){this.handlePaste(o)}).bind(this)),this.render=this.options.render?this.options.render.bind(this):this.render.bind(this),this.getItemValue=this.options.getItemValue?this.options.getItemValue.bind(this):this.getItemValue.bind(this),this};return he.prototype.handleKeyUp=function(Q){Q===40||Q===38||Q===27||Q===13||Q===9||this.handleInputChange(this.el.value)},he.prototype.handleKeyDown=function(Q){switch(Q.keyCode){case 13:case 9:this.list.isEmpty()||(this.list.isVisible()&&Q.preventDefault(),this.value(this.list.items[this.list.active].original),this.list.hide());break;case 27:this.list.isEmpty()||this.list.hide();break;case 38:this.list.previous();break;case 40:this.list.next();break}},he.prototype.handleBlur=function(){!this.list.selectingListItem&&this.options.hideOnBlur&&this.list.hide()},he.prototype.handlePaste=function(Q){if(Q.clipboardData)this.handleInputChange(Q.clipboardData.getData("Text"));else{var ve=this;setTimeout(function(){ve.handleInputChange(Q.target.value)},100)}},he.prototype.handleInputChange=function(Q){if(this.query=this.normalize(Q),this.list.clear(),this.query.length<this.options.minLength){this.list.draw();return}this.getCandidates((function(ve){for(var Ie=0;Ie<ve.length&&(this.list.add(ve[Ie]),Ie!==this.options.limit-1);Ie++);this.list.draw()}).bind(this))},he.prototype.handleFocus=function(){this.list.isEmpty()||this.list.show(),this.list.selectingListItem=!1},he.prototype.update=function(Q){this.data=Q,this.handleKeyUp()},he.prototype.clear=function(){this.data=[],this.list.clear()},he.prototype.normalize=function(Q){return Q=Q.toLowerCase(),Q},he.prototype.match=function(Q,ve){return Q.indexOf(ve)>-1},he.prototype.value=function(Q){if(this.selected=Q,this.el.value=this.getItemV
2483alue(Q),document.createEvent){var ve=document.createEvent("HTMLEvents");ve.initEvent("change",!0,!1),this.el.dispatchEvent(ve)}else this.el.fireEvent("onchange")},he.prototype.getCandidates=function(Q){var ve={pre:"<strong>",post:"</strong>",extract:(function(o){return this.getItemValue(o)}).bind(this)},Ie;this.options.filter?(Ie=fe.filter(this.query,this.data,ve),Ie=Ie.map((function(o){return{original:o.original,string:this.render(o.original,o.string)}}).bind(this))):Ie=this.data.map((function(o){var Ce=this.render(o);return{original:o,string:Ce}}).bind(this)),Q(Ie)},he.prototype.getItemValue=function(Q){return Q},he.prototype.render=function(Q,ve){if(ve)return ve;for(var Ie=Q.original?this.getItemValue(Q.original):this.getItemValue(Q),o=this.normalize(Ie),Ce=o.lastIndexOf(this.query);Ce>-1;){var Oe=Ce+this.query.length;Ie=Ie.slice(0,Ce)+"<strong>"+Ie.slice(Ce,Oe)+"</strong>"+Ie.slice(Oe),Ce=o.slice(0,Ce).lastIndexOf(this.query)}return Ie},he.prototype.renderError=function(Q){this.list.drawError(Q)},Zm=he,Zm}var Wm,Ax;function s2(){if(Ax)return Wm;Ax=1;var Re=n2();return Wm=Re,typeof window<"u"&&(window.Suggestions=Re),Wm}var Xm,Cx;function o2(){if(Cx)return Xm;Cx=1;var Re="Expected a function",fe=NaN,se="[object Symbol]",he=/^\s+|\s+$/g,Q=/^[-+]0x[0-9a-f]+$/i,ve=/^0b[01]+$/i,Ie=/^0o[0-7]+$/i,o=parseInt,Ce=typeof jc=="object"&&jc&&jc.Object===Object&&jc,Oe=typeof self=="object"&&self&&self.Object===Object&&self,Ge=Ce||Oe||Function("return this")(),qe=Object.prototype,ut=qe.toString,It=Math.max,Fe=Math.min,ne=function(){return Ge.Date.now()};function Ue(tt,nt,Ye){var Bt,wi,wt,Dt,Xi,mr,Qr=0,ti=!1,_r=!1,Gr=!0;if(typeof tt!="function")throw new TypeError(Re);nt=Xe(nt)||0,rt(Ye)&&(ti=!!Ye.leading,_r="maxWait"in Ye,wt=_r?It(Xe(Ye.maxWait)||0,nt):wt,Gr="trailing"in Ye?!!Ye.trailing:Gr);function Hn(Ni){var $r=Bt,bn=wi;return Bt=wi=void 0,Qr=Ni,Dt=tt.apply(bn,$r),Dt}function ni(Ni){return Qr=Ni,Xi=setTimeout(Ln,nt),ti?Hn(Ni):Dt}function en(Ni){var $r=Ni-mr,bn=Ni-Qr,X=nt-$r;return _r?Fe(X,wt-bn):X}function Rs(Ni){var $r=Ni-mr,bn=Ni-Qr;return mr===void 0||$r>=nt||$r<0||_r&&bn>=wt}function Ln(){var Ni=ne();if(Rs(Ni))return Zt(Ni);Xi=setTimeout(Ln,en(Ni))}function Zt(Ni){return Xi=void 0,Gr&&Bt?Hn(Ni):(Bt=wi=void 0,Dt)}function Mo(){Xi!==void 0&&clearTimeout(Xi),Qr=0,Bt=mr=wi=Xi=void 0}function zs(){return Xi===void 0?Dt:Zt(ne())}function Br(){var Ni=ne(),$r=Rs(Ni);if(Bt=arguments,wi=this,mr=Ni,$r){if(Xi===void 0)return ni(mr);if(_r)return Xi=setTimeout(Ln,nt),Hn(mr)}return Xi===void 0&&(Xi=setTimeout(Ln,nt)),Dt}return Br.cancel=Mo,Br.flush=zs,Br}function rt(tt){var nt=typeof tt;return!!tt&&(nt=="object"||nt=="function")}function Ct(tt){return!!tt&&typeof tt=="object"}function Tt(tt){return typeof tt=="symbol"||Ct(tt)&&ut.call(tt)==se}function Xe(tt){if(typeof tt=="number")return tt;if(Tt(tt))return fe;if(rt(tt)){var nt=typeof tt.valueOf=="function"?tt.valueOf():tt;tt=rt(nt)?nt+"":nt}if(typeof tt!="string")return tt===0?tt:+tt;tt=tt.replace(he,"");var Ye=ve.test(tt);return Ye||Ie.test(tt)?o(tt.slice(2),Ye?2:8):Q.test(tt)?fe:+tt}return Xm=Ue,Xm}var Lp={exports:{}},Px;function a2(){if(Px)return Lp.exports;Px=1;var Re=typeof Reflect=="object"?Reflect:null,fe=Re&&typeof Re.apply=="function"?Re.apply:function(tt,nt,Ye){return Function.prototype.apply.call(tt,nt,Ye)},se;Re&&typeof Re.ownKeys=="function"?se=Re.ownKeys:Object.getOwnPropertySymbols?se=function(tt){return Object.getOwnPropertyNames(tt).concat(Object.getOwnPropertySymbols(tt))}:se=function(tt){return Object.getOwnPropertyNames(tt)};function he(Xe){console&&console.warn&&console.warn(Xe)}var Q=Number.isNaN||function(tt){return tt!==tt};function ve(){ve.init.call(this)}Lp.exports=ve,Lp.exports.once=rt,ve.EventEmitter=ve,ve.prototype._events=void 0,ve.prototype._eventsCount=0,ve.prototype._maxListeners=void 0;var Ie=10;function o(Xe){if(typeof Xe!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof Xe)}Object.defineProperty(ve,"defaultMaxListeners",{enumerable:!0,get:function(){return Ie},set:function(Xe){if(typeof Xe!="number"||Xe<0||Q(Xe))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+Xe+".");Ie=Xe}}),ve.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},ve.prototype.setMaxListeners=function(tt){if(typeof tt!="number"||tt<0||Q(tt))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+tt+".");return this._maxListeners=tt,this};function Ce(Xe){return Xe._maxListeners===void 0?ve.defaultMaxListeners:Xe._maxListeners}ve.prototype.getMaxListeners=function(){return Ce(this)},ve.prototype.emit=function(tt){for(var nt=[],Ye=1;Ye<arguments.length;Ye++)nt.push(arguments[Ye]);var Bt=tt==="error",wi=this._events;if(wi!==void 0)Bt=Bt&&wi.error===void 0;else if(!Bt)return!1;if(Bt){var wt;if(nt.length>0&&(wt=nt[0]),wt instanceof Error)throw wt;var Dt=new Error("Unhandled error."+(wt?" ("+wt.message+")":""));throw Dt.context=wt,Dt}var Xi=wi[tt];if(Xi===void 0)return!1;if(typeof Xi=="function")fe(Xi,this,nt);else for(var mr=Xi.length,Qr=Fe(Xi,mr),Ye=0;Ye<mr;++Ye)fe(Qr[Ye],this,nt);return!0};function Oe(Xe,tt,nt,Ye){var Bt,wi,wt;if(o(nt),wi=Xe._events,wi===void 0?(wi=Xe._events=Object.create(null),Xe._eventsCount=0):(wi.newListener!==void 0&&(Xe.emit("newListener",tt,nt.listener?nt.listener:nt),wi=Xe._events),wt=wi[tt]),wt===void 0)wt=wi[tt]=nt,++Xe._eventsCount;else if(typeof wt=="function"?wt=wi[tt]=Ye?[nt,wt]:[wt,nt]:Ye?wt.unshift(nt):wt.push(nt),Bt=Ce(Xe),Bt>0&&wt.length>
2483Bt&&!wt.warned){wt.warned=!0;var Dt=new Error("Possible EventEmitter memory leak detected. "+wt.length+" "+String(tt)+" listeners added. Use emitter.setMaxListeners() to increase limit");Dt.name="MaxListenersExceededWarning",Dt.emitter=Xe,Dt.type=tt,Dt.count=wt.length,he(Dt)}return Xe}ve.prototype.addListener=function(tt,nt){return Oe(this,tt,nt,!1)},ve.prototype.on=ve.prototype.addListener,ve.prototype.prependListener=function(tt,nt){return Oe(this,tt,nt,!0)};function Ge(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function qe(Xe,tt,nt){var Ye={fired:!1,wrapFn:void 0,target:Xe,type:tt,listener:nt},Bt=Ge.bind(Ye);return Bt.listener=nt,Ye.wrapFn=Bt,Bt}ve.prototype.once=function(tt,nt){return o(nt),this.on(tt,qe(this,tt,nt)),this},ve.prototype.prependOnceListener=function(tt,nt){return o(nt),this.prependListener(tt,qe(this,tt,nt)),this},ve.prototype.removeListener=function(tt,nt){var Ye,Bt,wi,wt,Dt;if(o(nt),Bt=this._events,Bt===void 0)return this;if(Ye=Bt[tt],Ye===void 0)return this;if(Ye===nt||Ye.listener===nt)--this._eventsCount===0?this._events=Object.create(null):(delete Bt[tt],Bt.removeListener&&this.emit("removeListener",tt,Ye.listener||nt));else if(typeof Ye!="function"){for(wi=-1,wt=Ye.length-1;wt>=0;wt--)if(Ye[wt]===nt||Ye[wt].listener===nt){Dt=Ye[wt].listener,wi=wt;break}if(wi<0)return this;wi===0?Ye.shift():ne(Ye,wi),Ye.length===1&&(Bt[tt]=Ye[0]),Bt.removeListener!==void 0&&this.emit("removeListener",tt,Dt||nt)}return this},ve.prototype.off=ve.prototype.removeListener,ve.prototype.removeAllListeners=function(tt){var nt,Ye,Bt;if(Ye=this._events,Ye===void 0)return this;if(Ye.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):Ye[tt]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete Ye[tt]),this;if(arguments.length===0){var wi=Object.keys(Ye),wt;for(Bt=0;Bt<wi.length;++Bt)wt=wi[Bt],wt!=="removeListener"&&this.removeAllListeners(wt);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(nt=Ye[tt],typeof nt=="function")this.removeListener(tt,nt);else if(nt!==void 0)for(Bt=nt.length-1;Bt>=0;Bt--)this.removeListener(tt,nt[Bt]);return this};function ut(Xe,tt,nt){var Ye=Xe._events;if(Ye===void 0)return[];var Bt=Ye[tt];return Bt===void 0?[]:typeof Bt=="function"?nt?[Bt.listener||Bt]:[Bt]:nt?Ue(Bt):Fe(Bt,Bt.length)}ve.prototype.listeners=function(tt){return ut(this,tt,!0)},ve.prototype.rawListeners=function(tt){return ut(this,tt,!1)},ve.listenerCount=function(Xe,tt){return typeof Xe.listenerCount=="function"?Xe.listenerCount(tt):It.call(Xe,tt)},ve.prototype.listenerCount=It;function It(Xe){var tt=this._events;if(tt!==void 0){var nt=tt[Xe];if(typeof nt=="function")return 1;if(nt!==void 0)return nt.length}return 0}ve.prototype.eventNames=function(){return this._eventsCount>0?se(this._events):[]};function Fe(Xe,tt){for(var nt=new Array(tt),Ye=0;Ye<tt;++Ye)nt[Ye]=Xe[Ye];return nt}function ne(Xe,tt){for(;tt+1<Xe.length;tt++)Xe[tt]=Xe[tt+1];Xe.pop()}function Ue(Xe){for(var tt=new Array(Xe.length),nt=0;nt<tt.length;++nt)tt[nt]=Xe[nt].listener||Xe[nt];return tt}function rt(Xe,tt){return new Promise(function(nt,Ye){function Bt(wt){Xe.removeListener(tt,wi),Ye(wt)}function wi(){typeof Xe.removeListener=="function"&&Xe.removeListener("error",Bt),nt([].slice.call(arguments))}Tt(Xe,tt,wi,{once:!0}),tt!=="error"&&Ct(Xe,Bt,{once:!0})})}function Ct(Xe,tt,nt){typeof Xe.on=="function"&&Tt(Xe,"error",tt,nt)}function Tt(Xe,tt,nt,Ye){if(typeof Xe.on=="function")Ye.once?Xe.once(tt,nt):Xe.on(tt,nt);else if(typeof Xe.addEventListener=="function")Xe.addEventListener(tt,function Bt(wi){Ye.once&&Xe.removeEventListener(tt,Bt),nt(wi)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof Xe)}return Lp.exports}var Ym,Rx;function l2(){return Rx||(Rx=1,Ym={fr:{name:"France",bbox:[[-4.59235,41.380007],[9.560016,51.148506]]},us:{name:"United States",bbox:[[-171.791111,18.91619],[-66.96466,71.357764]]},ru:{name:"Russia",bbox:[[19.66064,41.151416],[190.10042,81.2504]]},ca:{name:"Canada",bbox:[[-140.99778,41.675105],[-52.648099,83.23324]]}}),Ym}var Km,zx;function c2(){if(zx)return Km;zx=1;function Re(he){var Q=he.match(/\s*(.+)\s*=\s*"?([^"]+)"?/);return Q?{key:Q[1],value:Q[2]}:null}function fe(he){var Q=he.match(/<?([^>]*)>(.*)/);if(!Q)return null;var ve=Q[1],Ie=Q[2].split(";"),o=null,Ce=Ie.reduce(function(Oe,Ge){var qe=Re(Ge);return qe?qe.key==="rel"?(o||(o=qe.value),Oe):(Oe[qe.key]=qe.value,Oe):Oe},{});return o?{url:ve,rel:o,params:Ce}:null}function se(he){return he?he.split(/,\s*</).reduce(function(Q,ve){var Ie=fe(ve);if(!Ie)return Q;var o=Ie.rel.split(/\s+/);return o.forEach(function(Ce){Q[Ce]||(Q[Ce]={url:Ie.url,params:Ie.params})}),Q},{}):{}}return Km=se,Km}var Jm,Lx;
2483function u2(){if(Lx)return Jm;Lx=1;var Re=c2();function fe(se,he){this.request=se,this.headers=he.headers,this.rawBody=he.body,this.statusCode=he.statusCode;try{this.body=JSON.parse(he.body||"{}")}catch{this.body=he.body}this.links=Re(this.headers.link)}return fe.prototype.hasNextPage=function(){return!!this.links.next},fe.prototype.nextPage=function(){return this.hasNextPage()?this.request._extend({path:this.links.next.url}):null},Jm=fe,Jm}var Qm,Dx;function qp(){return Dx||(Dx=1,Qm={API_ORIGIN:"https://api.mapbox.com",EVENT_PROGRESS_DOWNLOAD:"downloadProgress",EVENT_PROGRESS_UPLOAD:"uploadProgress",EVENT_ERROR:"error",EVENT_RESPONSE:"response",ERROR_HTTP:"HttpError",ERROR_REQUEST_ABORTED:"RequestAbortedError"}),Qm}var e_,Ox;function h2(){if(Ox)return e_;Ox=1;var Re=qp();function fe(se){var he=se.type||Re.ERROR_HTTP,Q;if(se.body)try{Q=JSON.parse(se.body)}catch{Q=se.body}else Q=null;var ve=se.message||null;ve||(typeof Q=="string"?ve=Q:Q&&typeof Q.message=="string"?ve=Q.message:he===Re.ERROR_REQUEST_ABORTED&&(ve="Request aborted")),this.message=ve,this.type=he,this.statusCode=se.statusCode||null,this.request=se.request,this.body=Q}return e_=fe,e_}var t_,kx;function d2(){if(kx)return t_;kx=1;function Re(se){var he=se.indexOf(":"),Q=se.substring(0,he).trim().toLowerCase(),ve=se.substring(he+1).trim();return{name:Q,value:ve}}function fe(se){var he={};return se&&se.trim().split(/[\r|\n]+/).forEach(function(Q){var ve=Re(Q);he[ve.name]=ve.value}),he}return t_=fe,t_}var i_,Fx;function p2(){if(Fx)return i_;Fx=1;var Re=u2(),fe=h2(),se=qp(),he=d2(),Q={};function ve(qe){var ut=Q[qe.id];ut&&(ut.abort(),delete Q[qe.id])}function Ie(qe,ut){return new Re(qe,{body:ut.response,headers:he(ut.getAllResponseHeaders()),statusCode:ut.status})}function o(qe){var ut=qe.total,It=qe.loaded,Fe=100*It/ut;return{total:ut,transferred:It,percent:Fe}}function Ce(qe,ut){return new Promise(function(It,Fe){ut.onprogress=function(rt){qe.emitter.emit(se.EVENT_PROGRESS_DOWNLOAD,o(rt))};var ne=qe.file;ne&&(ut.upload.onprogress=function(rt){qe.emitter.emit(se.EVENT_PROGRESS_UPLOAD,o(rt))}),ut.onerror=function(rt){Fe(rt)},ut.onabort=function(){var rt=new fe({request:qe,type:se.ERROR_REQUEST_ABORTED});Fe(rt)},ut.onload=function(){if(delete Q[qe.id],ut.status<200||ut.status>=400){var rt=new fe({request:qe,body:ut.response,statusCode:ut.status});Fe(rt);return}It(ut)};var Ue=qe.body;typeof Ue=="string"?ut.send(Ue):Ue?ut.send(JSON.stringify(Ue)):ne?ut.send(ne):ut.send(),Q[qe.id]=ut}).then(function(It){return Ie(qe,It)})}function Oe(qe,ut){var It=qe.url(ut),Fe=new window.XMLHttpRequest;return Fe.open(qe.method,It),Object.keys(qe.headers).forEach(function(ne){Fe.setRequestHeader(ne,qe.headers[ne])}),Fe}function Ge(qe){return Promise.resolve().then(function(){var ut=Oe(qe,qe.client.accessToken);return Ce(qe,ut)})}return i_={browserAbort:ve,sendRequestXhr:Ce,browserSend:Ge,createRequestXhr:Oe},i_}var jh={exports:{}};/*! http://mths.be/base64 v0.1.0 by @mathias | MIT license */var f2=jh.exports,Bx;function m2(){return Bx||(Bx=1,function(Re,fe){(function(se){var he=fe,Q=Re&&Re.exports==he&&Re,ve=typeof jc=="object"&&jc;(ve.global===ve||ve.window===ve)&&(se=ve);var Ie=function(Fe){this.message=Fe};Ie.prototype=new Error,Ie.prototype.name="InvalidCharacterError";var o=function(Fe){throw new Ie(Fe)},Ce="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Oe=/[\t\n\f\r ]/g,Ge=function(Fe){Fe=String(Fe).replace(Oe,"");var ne=Fe.length;ne%4==0&&(Fe=Fe.replace(/==?$/,""),ne=Fe.length),(ne%4==1||/[^+a-zA-Z0-9/]/.test(Fe))&&o("Invalid character: the string to be decoded is not correctly encoded.");for(var Ue=0,rt,Ct,Tt="",Xe=-1;++Xe<ne;)Ct=Ce.indexOf(Fe.charAt(Xe)),rt=Ue%4?rt*64+Ct:Ct,Ue++%4&&(Tt+=String.fromCharCode(255&rt>>(-2*Ue&6)));return Tt},qe=function(Fe){Fe=String(Fe),/[^\0-\xFF]/.test(Fe)&&o("The string to be encoded contains characters outside of the Latin1 range.");for(var ne=Fe.length%3,Ue="",rt=-1,Ct,Tt,Xe,tt,nt=Fe.length-ne;++rt<nt;)Ct=Fe.charCodeAt(rt)<<16,Tt=Fe.charCodeAt(++rt)<<8,Xe=Fe.charCodeAt(++rt),tt=Ct+Tt+Xe,Ue+=Ce.charAt(tt>>18&63)+Ce.charAt(tt>>12&63)+Ce.charAt(tt>>6&63)+Ce.charAt(tt&63);return ne==2?(Ct=Fe.charCodeAt(rt)<<8,Tt=Fe.charCodeAt(++rt),tt=Ct+Tt,Ue+=Ce.charAt(tt>>10)+Ce.charAt(tt>>4&63)+Ce.charAt(tt<<2&63)+"="):ne==1&&(tt=Fe.charCodeAt(rt),Ue+=Ce.charAt(tt>>2)+Ce.charAt(tt<<4&63)+"=="),Ue},ut={encode:qe,decode:Ge,version:"0.1.0"};if(he&&!he.nodeType)if(Q)Q.exports=ut;else for(var It in ut)ut.hasOwnProperty(It)&&(he[It]=ut[It]);else se.base64=ut})(f2)}
2483(jh,jh.exports)),jh.exports}var r_,Nx;function v0(){if(Nx)return r_;Nx=1;var Re=m2(),fe={};function se(ve){if(fe[ve])return fe[ve];var Ie=ve.split("."),o=Ie[0],Ce=Ie[1];if(!Ce)throw new Error("Invalid token");var Oe=he(Ce),Ge={usage:o,user:Oe.u};return Q(Oe,"a")&&(Ge.authorization=Oe.a),Q(Oe,"exp")&&(Ge.expires=Oe.exp*1e3),Q(Oe,"iat")&&(Ge.created=Oe.iat*1e3),Q(Oe,"scopes")&&(Ge.scopes=Oe.scopes),Q(Oe,"client")&&(Ge.client=Oe.client),Q(Oe,"ll")&&(Ge.lastLogin=Oe.ll),Q(Oe,"iu")&&(Ge.impersonator=Oe.iu),fe[ve]=Ge,Ge}function he(ve){try{return JSON.parse(Re.decode(ve))}catch{throw new Error("Invalid token")}}function Q(ve,Ie){return Object.prototype.hasOwnProperty.call(ve,Ie)}return r_=se,r_}var n_={exports:{}},Vx;function _2(){return Vx||(Vx=1,function(Re){var fe=Object.prototype.hasOwnProperty,se="~";function he(){}Object.create&&(he.prototype=Object.create(null),new he().__proto__||(se=!1));function Q(Ce,Oe,Ge){this.fn=Ce,this.context=Oe,this.once=Ge||!1}function ve(Ce,Oe,Ge,qe,ut){if(typeof Ge!="function")throw new TypeError("The listener must be a function");var It=new Q(Ge,qe||Ce,ut),Fe=se?se+Oe:Oe;return Ce._events[Fe]?Ce._events[Fe].fn?Ce._events[Fe]=[Ce._events[Fe],It]:Ce._events[Fe].push(It):(Ce._events[Fe]=It,Ce._eventsCount++),Ce}function Ie(Ce,Oe){--Ce._eventsCount===0?Ce._events=new he:delete Ce._events[Oe]}function o(){this._events=new he,this._eventsCount=0}o.prototype.eventNames=function(){var Oe=[],Ge,qe;if(this._eventsCount===0)return Oe;for(qe in Ge=this._events)fe.call(Ge,qe)&&Oe.push(se?qe.slice(1):qe);return Object.getOwnPropertySymbols?Oe.concat(Object.getOwnPropertySymbols(Ge)):Oe},o.prototype.listeners=function(Oe){var Ge=se?se+Oe:Oe,qe=this._events[Ge];if(!qe)return[];if(qe.fn)return[qe.fn];for(var ut=0,It=qe.length,Fe=new Array(It);ut<It;ut++)Fe[ut]=qe[ut].fn;return Fe},o.prototype.listenerCount=function(Oe){var Ge=se?se+Oe:Oe,qe=this._events[Ge];return qe?qe.fn?1:qe.length:0},o.prototype.emit=function(Oe,Ge,qe,ut,It,Fe){var ne=se?se+Oe:Oe;if(!this._events[ne])return!1;var Ue=this._events[ne],rt=arguments.length,Ct,Tt;if(Ue.fn){switch(Ue.once&&this.removeListener(Oe,Ue.fn,void 0,!0),rt){case 1:return Ue.fn.call(Ue.context),!0;case 2:return Ue.fn.call(Ue.context,Ge),!0;case 3:return Ue.fn.call(Ue.context,Ge,qe),!0;case 4:return Ue.fn.call(Ue.context,Ge,qe,ut),!0;case 5:return Ue.fn.call(Ue.context,Ge,qe,ut,It),!0;case 6:return Ue.fn.call(Ue.context,Ge,qe,ut,It,Fe),!0}for(Tt=1,Ct=new Array(rt-1);Tt<rt;Tt++)Ct[Tt-1]=arguments[Tt];Ue.fn.apply(Ue.context,Ct)}else{var Xe=Ue.length,tt;for(Tt=0;Tt<Xe;Tt++)switch(Ue[Tt].once&&this.removeListener(Oe,Ue[Tt].fn,void 0,!0),rt){case 1:Ue[Tt].fn.call(Ue[Tt].context);break;case 2:Ue[Tt].fn.call(Ue[Tt].context,Ge);break;case 3:Ue[Tt].fn.call(Ue[Tt].context,Ge,qe);break;case 4:Ue[Tt].fn.call(Ue[Tt].context,Ge,qe,ut);break;default:if(!Ct)for(tt=1,Ct=new Array(rt-1);tt<rt;tt++)Ct[tt-1]=arguments[tt];Ue[Tt].fn.apply(Ue[Tt].context,Ct)}}return!0},o.prototype.on=function(Oe,Ge,qe){return ve(this,Oe,Ge,qe,!1)},o.prototype.once=function(Oe,Ge,qe){return ve(this,Oe,Ge,qe,!0)},o.prototype.removeListener=function(Oe,Ge,qe,ut){var It=se?se+Oe:Oe;if(!this._events[It])return this;if(!Ge)return Ie(this,It),this;var Fe=this._events[It];if(Fe.fn)Fe.fn===Ge&&(!ut||Fe.once)&&(!qe||Fe.context===qe)&&Ie(this,It);else{for(var ne=0,Ue=[],rt=Fe.length;ne<rt;ne++)(Fe[ne].fn!==Ge||ut&&!Fe[ne].once||qe&&Fe[ne].context!==qe)&&Ue.push(Fe[ne]);Ue.length?this._events[It]=Ue.length===1?Ue[0]:Ue:Ie(this,It)}return this},o.prototype.removeAllListeners=function(Oe){var Ge;return Oe?(Ge=se?se+Oe:Oe,this._events[Ge]&&Ie(this,Ge)):(this._events=new he,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=se,o.EventEmitter=o,Re.exports=o}(n_)),n_.exports}var s_,Ux;function g2(){if(Ux)return s_;Ux=1;function Re(Ie){return Ie.map(encodeURIComponent).join(",")}function fe(Ie){return Array.isArray(Ie)?Re(Ie):encodeURIComponent(String(Ie))}function se(Ie,o,Ce){if(Ce===!1||Ce===null)return Ie;var Oe=/\?/.test(Ie)?"&":"?",Ge=encodeURIComponent(o);return Ce!==void 0&&Ce!==""&&Ce!==!0&&(Ge+="="+fe(Ce)),""+Ie+Oe+Ge}function he(Ie,o){if(!o)return Ie;var Ce=Ie;
2483return Object.keys(o).forEach(function(Oe){var Ge=o[Oe];Ge!==void 0&&(Array.isArray(Ge)&&(Ge=Ge.filter(function(qe){return qe!=null}).join(",")),Ce=se(Ce,Oe,Ge))}),Ce}function Q(Ie,o){if(!o||Ie.slice(0,4)==="http")return Ie;var Ce=Ie[0]==="/"?"":"/";return""+o.replace(/\/$/,"")+Ce+Ie}function ve(Ie,o){return o?Ie.replace(/\/:([a-zA-Z0-9]+)/g,function(Ce,Oe){var Ge=o[Oe];if(Ge===void 0)throw new Error("Unspecified route parameter "+Oe);var qe=fe(Ge);return"/"+qe}):Ie}return s_={appendQueryObject:he,appendQueryParam:se,prependOrigin:Q,interpolateRouteParams:ve},s_}var o_,jx;function y2(){if(jx)return o_;jx=1;var Re=v0(),fe=$c(),se=_2(),he=g2(),Q=qp(),ve=1;function Ie(o,Ce){if(!o)throw new Error("MapiRequest requires a client");if(!Ce||!Ce.path||!Ce.method)throw new Error("MapiRequest requires an options object with path and method properties");var Oe={};Ce.body&&(Oe["content-type"]="application/json");var Ge=fe(Oe,Ce.headers),qe=Object.keys(Ge).reduce(function(ut,It){return ut[It.toLowerCase()]=Ge[It],ut},{});this.id=ve++,this._options=Ce,this.emitter=new se,this.client=o,this.response=null,this.error=null,this.sent=!1,this.aborted=!1,this.path=Ce.path,this.method=Ce.method,this.origin=Ce.origin||o.origin,this.query=Ce.query||{},this.params=Ce.params||{},this.body=Ce.body||null,this.file=Ce.file||null,this.encoding=Ce.encoding||"utf8",this.sendFileAs=Ce.sendFileAs||null,this.headers=qe}return Ie.prototype.url=function(Ce){var Oe=he.prependOrigin(this.path,this.origin);Oe=he.appendQueryObject(Oe,this.query);var Ge=this.params,qe=Ce??this.client.accessToken;if(qe){Oe=he.appendQueryParam(Oe,"access_token",qe);var ut=Re(qe).user;Ge=fe({ownerId:ut},Ge)}return Oe=he.interpolateRouteParams(Oe,Ge),Oe},Ie.prototype.send=function(){var Ce=this;if(Ce.sent)throw new Error("This request has already been sent. Check the response and error properties. Create a new request with clone().");return Ce.sent=!0,Ce.client.sendRequest(Ce).then(function(Oe){return Ce.response=Oe,Ce.emitter.emit(Q.EVENT_RESPONSE,Oe),Oe},function(Oe){throw Ce.error=Oe,Ce.emitter.emit(Q.EVENT_ERROR,Oe),Oe})},Ie.prototype.abort=function(){this._nextPageRequest&&(this._nextPageRequest.abort(),delete this._nextPageRequest),!(this.response||this.error||this.aborted)&&(this.aborted=!0,this.client.abortRequest(this))},Ie.prototype.eachPage=function(Ce){var Oe=this;function Ge(It){function Fe(){delete Oe._nextPageRequest;var ne=It.nextPage();ne&&(Oe._nextPageRequest=ne,ut(ne))}Ce(null,It,Fe)}function qe(It){Ce(It,null,function(){})}function ut(It){It.send().then(Ge,qe)}ut(this)},Ie.prototype.clone=function(){return this._extend()},Ie.prototype._extend=function(Ce){var Oe=fe(this._options,Ce);return new Ie(this.client,Oe)},o_=Ie,o_}var a_,qx;function x0(){if(qx)return a_;qx=1;var Re=v0(),fe=y2(),se=qp();
2483function he(Q){if(!Q||!Q.accessToken)throw new Error("Cannot create a client without an access token");Re(Q.accessToken),this.accessToken=Q.accessToken,this.origin=Q.origin||se.API_ORIGIN}return he.prototype.createRequest=function(ve){return new fe(this,ve)},a_=he,a_}var l_,Gx;function b0(){if(Gx)return l_;Gx=1;var Re=p2(),fe=x0();function se(Q){fe.call(this,Q)}se.prototype=Object.create(fe.prototype),se.prototype.constructor=se,se.prototype.sendRequest=Re.browserSend,se.prototype.abortRequest=Re.browserAbort;function he(Q){return new se(Q)}return l_=he,l_}var c_,$x;function v2(){if($x)return c_;$x=1;var Re=b0();return c_=Re,c_}var u_,Hx;function x2(){if(Hx)return u_;Hx=1;var Re=Object.prototype.toString;return u_=function(fe){var se;return Re.call(fe)==="[object Object]"&&(se=Object.getPrototypeOf(fe),se===null||se===Object.getPrototypeOf({}))},u_}var h_,Zx;function b2(){if(Zx)return h_;Zx=1;var Re=x2(),fe=$c(),se="value",he=` 2484 `,Q={};Q.assert=function(Fe,ne){return ne=ne||{},function(Ue){var rt=Ie(Fe,Ue);if(rt){var Ct=o(rt,ne);throw ne.apiName&&(Ct=ne.apiName+": "+Ct),new Error(Ct)}}},Q.shape=function(ne){var Ue=It(ne);return function(Ct){var Tt=Ie(Q.plainObject,Ct);if(Tt)return Tt;for(var Xe,tt,nt=[],Ye=0;Ye<Ue.length;Ye++)Xe=Ue[Ye].key,tt=Ue[Ye].value,Tt=Ie(tt,Ct[Xe]),Tt&&nt.push([Xe].concat(Tt));return nt.length<2?nt[0]:function(Bt){nt=nt.map(function(Dt){var Xi=Dt[0],mr=o(Dt,Bt).split(` 2485`).join(he);return"- "+Xi+": "+mr});var wi=Bt.path.join("."),wt=wi===se?"":" of "+wi;return"The following properties"+wt+" have invalid values:"+he+nt.join(he)}}},Q.strictShape=function(ne){var Ue=Q.shape(ne);return function(Ct){var Tt=Ue(Ct);if(Tt)return Tt;var Xe=Object.keys(Ct).reduce(function(tt,nt){return ne[nt]===void 0&&tt.push(nt),tt},[]);if(Xe.length!==0)return function(){return"The following keys are invalid: "+Xe.join(", ")}}},Q.arrayOf=function(ne){return ve(ne)},Q.tuple=function(){var ne=Array.isArray(arguments[0])?arguments[0]:Array.prototype.slice.call(arguments);return ve(ne)};function ve(Fe){var ne=Array.isArray(Fe),Ue=function(rt){return ne?Fe[rt]:Fe};return function(Ct){var Tt=Ie(Q.plainArray,Ct);if(Tt)return Tt;if(ne&&Ct.length!==Fe.length)return"an array with "+Fe.length+" items";for(var Xe=0;Xe<Ct.length;Xe++)if(Tt=Ie(Ue(Xe),Ct[Xe]),Tt)return[Xe].concat(Tt)}}Q.required=function(ne){function Ue(rt){return rt==null?function(Ct){return qe(Ct,ut(Ct.path)?"cannot be undefined/null.":"is required.")}:ne.apply(this,arguments)}return Ue.__required=!0,Ue},Q.oneOfType=function(){var ne=Array.isArray(arguments[0])?arguments[0]:Array.prototype.slice.call(arguments);return function(rt){var Ct=ne.map(function(Tt){return Ie(Tt,rt)}).filter(Boolean);if(Ct.length===ne.length)return Ct.every(function(Tt){return Tt.length===1&&typeof Tt[0]=="string"})?Ce(Ct.map(function(Tt){return Tt[0]})):Ct.reduce(function(Tt,Xe){return Xe.length>Tt.length?Xe:Tt})}},Q.equal=function(ne){return function(rt){if(rt!==ne)return JSON.stringify(ne)}},Q.oneOf=function(){var ne=Array.isArray(arguments[0])?arguments[0]:Array.prototype.slice.call(arguments),Ue=ne.map(function(rt){return Q.equal(rt)});return Q.oneOfType.apply(this,Ue)},Q.range=function(ne){var Ue=ne[0],rt=ne[1];return function(Tt){var Xe=Ie(Q.number,Tt);if(Xe||Tt<Ue||Tt>rt)return"number between "+Ue+" & "+rt+" (inclusive)"}},Q.any=function(){},Q.boolean=function(ne){if(typeof ne!="boolean")return"boolean"},Q.number=function(ne){if(typeof ne!="number")return"number"},Q.plainArray=function(ne){if(!Array.isArray(ne))return"array"},Q.plainObject=function(ne){if(!Re(ne))return"object"},Q.string=function(ne){if(typeof ne!="string")return"string"},Q.func=function(ne){if(typeof ne!="function")return"function"};function Ie(Fe,ne){if(!(ne==null&&!Fe.hasOwnProperty("__required"))){var Ue=Fe(ne);if(Ue)return Array.isArray(Ue)?Ue:[Ue]}}function o(Fe,ne){var Ue=Fe.length,rt=Fe[Ue-1],Ct=Fe.slice(0,Ue-1);return Ct.length===0&&(Ct=[se]),ne=fe(ne,{path:Ct}),typeof rt=="function"?rt(ne):qe(ne,Oe(rt))}function Ce(Fe){return Fe.length<2?Fe[0]:Fe.length===2?Fe.join(" or "):Fe.slice(0,-1).join(", ")+", or "+Fe.slice(-1)}function Oe(Fe){return"must be "+Ge(Fe)+"."}function Ge(Fe){return/^an? /.test(Fe)?Fe:/^[aeiou]/i.test(Fe)?"an "+Fe:/^[a-z]/i.test(Fe)?"a "+Fe:Fe}function qe(Fe,ne){var Ue=ut(Fe.path),rt=Fe.path.join(".")+" "+ne,Ct=Ue?"Item at position ":"";return Ct+rt}function ut(Fe){return typeof Fe[Fe.length-1]=="number"||typeof Fe[0]=="number"}function It(Fe){return Object.keys(Fe||{}).map(function(ne){return{key:ne,value:Fe[ne]}})}return Q.validate=Ie,Q.processMessage=o,h_=Q,h_}var d_,Wx;function w2(){if(Wx)return d_;Wx=1;var Re=$c(),fe=b2();function se(Ie){if(typeof window<"u")return Ie instanceof globalThis.Blob||Ie instanceof globalThis.ArrayBuffer?void 0:"Blob or ArrayBuffer";if(!(typeof Ie=="string"||Ie.pipe!==void 0))return"Filename or Readable stream"}function he(Ie,o){return fe.assert(fe.strictShape(Ie),o)}function Q(Ie){var o="date";if(typeof Ie=="boolean")return o;try{var Ce=new Date(Ie);if(Ce.getTime&&isNaN(Ce.getTime()))return o}catch{return o}}function ve(Ie){return fe.tuple(fe.number,fe.number)(Ie)}return d_=Re(fe,{file:se,date:Q,coordinates:ve,assertShape:he}),d_}var p_,Xx;
2485function T2(){if(Xx)return p_;Xx=1;function Re(fe,se){var he=function(Q,ve){return se.indexOf(Q)!==-1&&ve!==void 0};return typeof se=="function"&&(he=se),Object.keys(fe).filter(function(Q){return he(Q,fe[Q])}).reduce(function(Q,ve){return Q[ve]=fe[ve],Q},{})}return p_=Re,p_}var f_,Yx;function S2(){if(Yx)return f_;Yx=1;function Re(fe,se){return Object.keys(fe).reduce(function(he,Q){return he[Q]=se(Q,fe[Q]),he},{})}return f_=Re,f_}var m_,Kx;function E2(){if(Kx)return m_;Kx=1;var Re=S2();function fe(se){return Re(se,function(he,Q){return typeof Q=="boolean"?JSON.stringify(Q):Q})}return m_=fe,m_}var __,Jx;function M2(){if(Jx)return __;Jx=1;var Re=x0(),fe=b0();function se(he){return function(Q){var ve;Re.prototype.isPrototypeOf(Q)?ve=Q:ve=fe(Q);var Ie=Object.create(he);return Ie.client=ve,Ie}}return __=se,__}var g_,Qx;function I2(){if(Qx)return g_;Qx=1;var Re=$c(),fe=w2(),se=T2(),he=E2(),Q=M2(),ve={},Ie=["country","region","postcode","district","place","locality","neighborhood","address","poi","poi.landmark"];return ve.forwardGeocode=function(o){fe.assertShape({query:fe.required(fe.string),mode:fe.oneOf("mapbox.places","mapbox.places-permanent"),countries:fe.arrayOf(fe.string),proximity:fe.oneOf(fe.coordinates,"ip"),types:fe.arrayOf(fe.oneOf(Ie)),autocomplete:fe.boolean,bbox:fe.arrayOf(fe.number),limit:fe.number,language:fe.arrayOf(fe.string),routing:fe.boolean,fuzzyMatch:fe.boolean,worldview:fe.string,session_token:fe.string})(o),o.mode=o.mode||"mapbox.places";var Ce=he(Re({country:o.countries},se(o,["proximity","types","autocomplete","bbox","limit","language","routing","fuzzyMatch","worldview","session_token"])));return this.client.createRequest({method:"GET",path:"/geocoding/v5/:mode/:query.json",params:se(o,["mode","query"]),query:Ce})},ve.reverseGeocode=function(o){fe.assertShape({query:fe.required(fe.coordinates),mode:fe.oneOf("mapbox.places","mapbox.places-permanent"),countries:fe.arrayOf(fe.string),types:fe.arrayOf(fe.oneOf(Ie)),bbox:fe.arrayOf(fe.number),limit:fe.number,language:fe.arrayOf(fe.string),reverseMode:fe.oneOf("distance","score"),routing:fe.boolean,worldview:fe.string,session_token:fe.string})(o),o.mode=o.mode||"mapbox.places";var Ce=he(Re({country:o.countries},se(o,["country","types","bbox","limit","language","reverseMode","routing","worldview","session_token"])));return this.client.createRequest({method:"GET",path:"/geocoding/v5/:mode/:query.json",params:se(o,["mode","query"]),query:Ce})},g_=Q(ve),g_}let A2="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",w0=Re=>crypto.getRandomValues(new Uint8Array(Re)),T0=(Re,fe,se)=>{let he=(2<<Math.log(Re.length-1)/Math.LN2)-1,Q=-~(1.6*he*fe/Re.length);return(ve=fe)=>{let Ie="";for(;;){let o=se(Q),Ce=Q|0;for(;Ce--;)if(Ie+=Re[o[Ce]&he]||"",Ie.length===ve)return Ie}}},C2=(Re,fe=21)=>T0(Re,fe,w0),P2=(Re=21)=>crypto.getRandomValues(new Uint8Array(Re)).reduce((fe,se)=>(se&=63,se<36?fe+=se.toString(36):se<62?fe+=(se-26).toString(36).toUpperCase():se>62?fe+="-":fe+="_",fe),"");const R2=Object.freeze(Object.defineProperty({__proto__:null,customAlphabet:C2,customRandom:T0,nanoid:P2,random:w0,urlAlphabet:A2},Symbol.toStringTag,{value:"Module"})),z2=Cw(R2);var y_,e0;function L2(){if(e0)return y_;e0=1;var Re=z2.nanoid;function fe(se){this.origin=se.origin||"https://api.mapbox.com",this.endpoint="events/v2",this.access_token=se.accessToken,this.version="0.3.0",this.pluginSessionID=this.generateSessionID(),this.sessionIncrementer=0,this.userAgent=this.getUserAgent(),this.options=se,this.send=this.send.bind(this),this.countries=se.countries?se.countries.split(","):null,this.types=se.types?se.types.split(","):null,this.bbox=se.bbox?se.bbox:null,this.language=se.language?se.language.split(","):null,this.limit=se.limit?+se.limit:null,this.locale=navigator.language||null,this.enableEventLogging=this.shouldEnableLogging(se),this.eventQueue=new Array,this.flushInterval=se.flushInterval||1e3,this.maxQueueSize=se.maxQueueSize||100,this.timer=this.flushInterval?setTimeout(this.flush.bind(this),this.flushInterval):null,this.lastSentInput="",this.lastSentIndex=0}return fe.prototype={select:function(se,he){var Q=this.getEventPayload("search.select",he,{selectedFeature:se});if(Q&&!(Q.resultIndex===this.lastSentIndex&&Q.queryString===this.lastSentInput||Q.resultIndex==-1))return this.lastSentIndex=Q.resultIndex,this.lastSentInput=Q.queryString,this.push(Q)},start:function(se){var he=this.getEventPayload("search.start",se);if(he)return this.push(he)},keyevent:function(se,he){if(se.key&&!(se.metaKey||[9,27,37,39,13,38,40].indexOf(se.keyCode)!==-1)){var Q=this.getEventPayload("search.keystroke",he,{key:se.key});if(Q)return this.push(Q)}},send:function(se,he){if(!this.enableEventLogging)return he?he():void 0;var Q=this.getRequestOptions(se);this.request(Q,(function(ve){if(ve)return this.handleError(ve,he);if(he)return he()}).bind(this))},getRequestOptions:function(se){Array.isArray(se)||(se=[se]);var he={method:"POST",host:this.origin,path:this.endpoint+"?access_token="+this.access_token,headers:{"Content-Type":"application/json"},body:JSON.stringify(se)};return he},getEventPayload:function(se,he,Q={}){if(se==="search.select"&&!Q.selectedFeature||se==="search.keystroke"&&!Q.key)return null;var ve;if(!he.options.proximity)ve=null;else if(typeof he.options.proximity=="object")ve=[he.options.proximity.longitude,he.options.proximity.latitude];else if(he.options.proximity==="ip"){var Ie=he._headers?he._headers["ip-proximity"]:null;Ie&&typeof Ie=="string"?ve=Ie.split(",").map(parseFloat):ve=[999,999]}else ve=he.options.proximity;var o=he._map?he._map.getZoom():void 0,Ce={event:se,version:this.getEventSchemaVersion(se),created:+new Date,sessionIdentifier:this.getSessionId(),country:this.countries,userAgent:this.userAgent,language:this.language,bbox:this.bbox,types:this.types,endpoint:"mapbox.places",autocomplete:he.options.autocomplete,fuzzyMatch:he.options.fuzzyMatch,proximity:ve,limit:he.options.limit,routing:he.options.routing,worldview:he.options.worldview,mapZoom:o,keyboardLocale:this.locale};if(se==="search.select"?Ce.queryString=he.inputString:se!="search.select"&&he._inputEl?Ce.queryString=he._inputEl.value:Ce.queryString=he.inputString,["search.keystroke","search.select"].includes(se)&&(Ce.path="geocoding/v5/mapbox.places"),se==="search.keystroke"&&Q.key)Ce.lastAction=Q.key;else if(se==="search.select"&&Q.selectedFeature){var Oe=Q.selectedFeature,Ge=this.getSelectedIndex(Oe,he);
2485if(Ce.resultIndex=Ge,Ce.resultPlaceName=Oe.place_name,Ce.resultId=Oe.id,Oe.properties&&(Ce.resultMapboxId=Oe.properties.mapbox_id),he._typeahead){var qe=he._typeahead.data;qe&&qe.length>0&&(Ce.suggestionIds=this.getSuggestionIds(qe),Ce.suggestionNames=this.getSuggestionNames(qe),Ce.suggestionTypes=this.getSuggestionTypes(qe),Ce.suggestionSources=this.getSuggestionSources(qe))}}return this.validatePayload(Ce)?Ce:null},request:function(se,he){var Q=new XMLHttpRequest;Q.onreadystatechange=function(){if(this.readyState==4)return this.status==204?he(null):he(this.statusText)},Q.open(se.method,se.host+"/"+se.path,!0);for(var ve in se.headers){var Ie=se.headers[ve];Q.setRequestHeader(ve,Ie)}Q.send(se.body)},handleError:function(se,he){if(he)return he(se)},generateSessionID:function(){return Re()},getSessionId:function(){return this.pluginSessionID+"."+this.sessionIncrementer},getUserAgent:function(){return"mapbox-gl-geocoder."+this.version+"."+navigator.userAgent},getSelectedIndex:function(se,he){if(he._typeahead){var Q=he._typeahead.data,ve=se.id,Ie=Q.map(function(Ce){return Ce.id}),o=Ie.indexOf(ve);return o}},getSuggestionIds:function(se){return se.map(function(he){return he.properties?he.properties.mapbox_id||"":he.id||""})},getSuggestionNames:function(se){return se.map(function(he){return he.place_name||""})},getSuggestionTypes:function(se){return se.map(function(he){return he.place_type&&Array.isArray(he.place_type)&&he.place_type[0]||""})},getSuggestionSources:function(se){return se.map(function(he){return he._source||""})},getEventSchemaVersion:function(se){return["search.keystroke","search.select"].includes(se)?"2.2":"2.0"},validatePayload:function(se){if(!se||!se.event)return!1;var he=["event","created","sessionIdentifier","queryString"],Q=["event","created","sessionIdentifier","queryString","lastAction"],ve=["event","created","sessionIdentifier","queryString","resultIndex","path","suggestionIds"],Ie=se.event;return Ie==="search.start"?this.objectHasRequiredProps(se,he):Ie==="search.keystroke"?this.objectHasRequiredProps(se,Q):Ie==="search.select"?this.objectHasRequiredProps(se,ve):!0},objectHasRequiredProps:function(se,he){return he.every(function(Q){return Q==="queryString"?typeof se[Q]=="string"&&se[Q].length>0:se[Q]!==void 0})},shouldEnableLogging:function(se){return!(se.enableEventLogging===!1||se.origin&&se.origin!=="https://api.mapbox.com")},flush:function(){this.eventQueue.length>0&&(this.send(this.eventQueue),this.eventQueue=new Array),this.timer&&clearTimeout(this.timer),this.flushInterval&&(this.timer=setTimeout(this.flush.bind(this),this.flushInterval))},push:function(se,he){this.eventQueue.push(se),(this.eventQueue.length>=this.maxQueueSize||he)&&this.flush()},remove:function(){this.flush()}},y_=fe,y_}var v_,t0;function D2(){if(t0)return v_;t0=1;var Re={de:"Suche",it:"Ricerca",en:"Search",nl:"Zoeken",fr:"Chercher",ca:"Cerca",he:"××פש",ja:"ãµã¼ã",lv:"MeklÄt",pt:"Procurar",sr:"ÐÑеÑÑага",zh:"æç´¢",cs:"VyhledávánÃ",hu:"Keresés",ka:"á«áááá",nb:"Søke",sk:"Vyhľadávanie",th:"à¸à¹à¸à¸«à¸²",fi:"Hae",is:"Leita",ko:"ìì",pl:"Szukaj",sl:"Iskanje",fa:"جستجÙ",ru:"ÐоиÑк"};return v_={placeholder:Re},v_}var Op={exports:{}},O2=Op.exports,i0;function k2(){return i0||(i0=1,function(Re){(function(fe,se,he){Re.exports?Re.exports=he():fe[se]=he()})(O2,"subtag",function(){var fe="",se=/^([a-zA-Z]{2,3})(?:[_-]+([a-zA-Z]{3})(?=$|[_-]+))?(?:[_-]+([a-zA-Z]{4})(?=$|[_-]+))?(?:[_-]+([a-zA-Z]{2}|[0-9]{3})(?=$|[_-]+))?/;function he(Ce){return Ce.match(se)||[]}function Q(Ce){return he(Ce).filter(function(Oe,Ge){return Oe&&Ge})}function ve(Ce){return Ce=he(Ce),{language:Ce[1]||fe,extlang:Ce[2]||fe,script:Ce[3]||fe,region:Ce[4]||fe}}function Ie(Ce,Oe,Ge){Object.defineProperty(Ce,Oe,{value:Ge,enumerable:!0})}function o(Ce,Oe,Ge){function qe(ut){return he(ut)[Ce]||fe}Ie(qe,"pattern",Oe),Ie(ve,Ge,qe)}return o(1,/^[a-zA-Z]{2,3}$/,"language"),o(2,/^[a-zA-Z]{3}$/,"extlang"),o(3,/^[a-zA-Z]{4}$/,"script"),o(4,/^[a-zA-Z]{2}$|^[0-9]{3}$/,"region"),Ie(ve,"split",Q),ve})}(Op)),Op.exports}var x_,r0;function F2(){if(r0)return x_;r0=1;function Re(){}return Re.prototype={isSupport:function(){return!!window.navigator.geolocation},getCurrentPosition:function(){const fe={enableHighAccuracy:!0};return new Promise(function(se,he){window.navigator.geolocation.getCurrentPosition(se,he,fe)})}},x_=Re,x_}var b_,n0;function B2(){if(n0)return b_;n0=1;function Re(he,Q){const ve=fe(he),Ie=["address","street","place","country"];var o;if(typeof Q=="function")return Q(ve);const Ce=Ie.indexOf(Q);return Ce===-1?o=Ie:o=Ie.slice(Ce),o.reduce(function(Oe,Ge){return ve[Ge]?(Oe!==""&&(Oe=Oe+", "),Oe+ve[Ge]):Oe},"")}function fe(he){const Q=he.address||"",ve=he.text||"",Ie=he.place_name||"",Ce={address:Ie.split(",")[0],houseNumber:Q,street:ve,placeName:Ie};return he.context.forEach(function(Oe){const Ge=Oe.id.split(".")[0];Ce[Ge]=Oe.text}),Ce}return b_={transformFeatureToGeolocationText:Re,getAddressInfo:fe,REVERSE_GEOCODE_COORD_RGX:/^[ ]*(-?\d{1,3}(\.\d{0,256})?)[, ]+(-?\d{1,3}(\.\d{0,256})?)[ ]*$/},b_}var w_,s0;function N2(){if(s0)return w_;s0=1;var Re=s2(),fe=o2(),se=$c(),he=a2().EventEmitter,Q=l2(),ve=v2(),Ie=I2(),o=L2(),Ce=D2(),Oe=k2(),Ge=F2(),qe=B2();const ut={FORWARD:0,LOCAL:1,REVERSE:2};function It(){var ne=document.createElement("div");return ne.className="mapboxgl-ctrl-geocoder--powered-by",ne.innerHTML='<a href="https://www.mapbox.com/search-service" target="_blank">Powered by Mapbox</a>',ne}function Fe(ne){this._eventEmitter=new he,this.options=se({},this.options,ne),this.inputString="",this.fresh=!0,this.lastSelected=null,this.geolocation=new Ge}return Fe.prototype={options:{zoom:16,flyTo:!0,trackProximity:!0,minLength:2,reverseGeocode:!1,flipCoordinates:!1,limit:5,origin:"https://api.mapbox.com",enableEventLogging:!0,marker:!0,mapboxgl:null,collapsed:!1,clearAndBlurOnEsc:!1,clearOnBlur:!1,enableGeolocation:!1,addressAccuracy:"street",getItemV
2485alue:function(ne){return ne.place_name},render:function(ne){var Ue=ne.place_name.split(",");return'<div class="mapboxgl-ctrl-geocoder--suggestion"><div class="mapboxgl-ctrl-geocoder--suggestion-title">'+Ue[0]+'</div><div class="mapboxgl-ctrl-geocoder--suggestion-address">'+Ue.splice(1,Ue.length).join(",")+"</div></div>"}},_headers:{},addTo:function(ne){function Ue(rt,Ct){if(!document.body.contains(Ct))throw new Error("Element provided to #addTo() exists, but is not in the DOM");const Tt=rt.onAdd();Ct.appendChild(Tt)}if(ne._controlContainer)ne.addControl(this);else if(ne instanceof HTMLElement)Ue(this,ne);else if(typeof ne=="string"){const rt=document.querySelectorAll(ne);if(rt.length===0)throw new Error("Element ",ne,"not found.");if(rt.length>1)throw new Error("Geocoder can only be added to a single html element");Ue(this,rt[0])}else throw new Error("Error: addTo must be a mapbox-gl-js map, an html element, or a CSS selector query for a single html element")},onAdd:function(ne){if(ne&&typeof ne!="string"&&(this._map=ne),this.setLanguage(),this.options.localGeocoderOnly||(this.geocoderService=Ie(ve({accessToken:this.options.accessToken,origin:this.options.origin}))),this.options.localGeocoderOnly&&!this.options.localGeocoder)throw new Error("A localGeocoder function must be specified to use localGeocoderOnly mode");this.eventManager=new o(this.options),this._onChange=this._onChange.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onPaste=this._onPaste.bind(this),this._onBlur=this._onBlur.bind(this),this._showButton=this._showButton.bind(this),this._hideButton=this._hideButton.bind(this),this._onQueryResult=this._onQueryResult.bind(this),this.clear=this.clear.bind(this),this._updateProximity=this._updateProximity.bind(this),this._collapse=this._collapse.bind(this),this._unCollapse=this._unCollapse.bind(this),this._clear=this._clear.bind(this),this._clearOnBlur=this._clearOnBlur.bind(this),this._geolocateUser=this._geolocateUser.bind(this);var Ue=this.container=document.createElement("div");Ue.className="mapboxgl-ctrl-geocoder mapboxgl-ctrl";var rt=this.createIcon("search",'<path d="M7.4 2.5c-2.7 0-4.9 2.2-4.9 4.9s2.2 4.9 4.9 4.9c1 0 1.8-.2 2.5-.8l3.7 3.7c.2.2.4.3.8.3.7 0 1.1-.4 1.1-1.1 0-.3-.1-.5-.3-.8L11.4 10c.4-.8.8-1.6.8-2.5.1-2.8-2.1-5-4.8-5zm0 1.6c1.8 0 3.2 1.4 3.2 3.2s-1.4 3.2-3.2 3.2-3.3-1.3-3.3-3.1 1.4-3.3 3.3-3.3z"/>');this._inputEl=document.createElement("input"),this._inputEl.type="text",this._inputEl.className="mapboxgl-ctrl-geocoder--input",this.setPlaceholder(),this.options.collapsed&&(this._collapse(),this.container.addEventListener("mouseenter",this._unCollapse),this.container.addEventListener("mouseleave",this._collapse),this._inputEl.addEventListener("focus",this._unCollapse)),(this.options.collapsed||this.options.clearOnBlur)&&this._inputEl.addEventListener("blur",this._onBlur),this._inputEl.addEventListener("keydown",fe(this._onKeyDown,200)),this._inputEl.addEventListener("paste",this._onPaste),this._inputEl.addEventListener("change",this._onChange),this.container.addEventListener("mouseenter",this._showButton),this.container.addEventListener("mouseleave",this._hideButton),this._inputEl.addEventListener("keyup",(function(Bt){this.eventManager.keyevent(Bt,this)}).bind(this));var Ct=document.createElement("div");Ct.classList.add("mapboxgl-ctrl-geocoder--pin-right"),this._clearEl=document.createElement("button"),this._clearEl.setAttribute("aria-label","Clear"),this._clearEl.addEventListener("click",this.clear),this._clearEl.className="mapboxgl-ctrl-geocoder--button";var Tt=this.createIcon("close",'<path d="M3.8 2.5c-.6 0-1.3.7-1.3 1.3 0 .3.2.7.5.8L7.2 9 3 13.2c-.3.3-.5.7-.5 1 0 .6.7 1.3 1.3 1.3.3 0 .7-.2 1-.5L9 10.8l4.2 4.2c.2.3.7.3 1 .3.6 0 1.3-.7 1.3-1.3 0-.3-.2-.7-.3-1l-4.4-4L15 4.6c.3-.2.5-.5.5-.8 0-.7-.7-1.3-1.3-1.3-.3 0-.7.2-1 .3L9 7.1 4.8 2.8c-.3-.1-.7-.3-1-.3z"/>');if(this._clearEl.appendChild(Tt),this._loadingEl=this.createIcon("loading",'<path fill="#333" d="M4.4 4.4l.8.8c2.1-2.1 5.5-2.1 7.6 0l.8-.8c-2.5-2.5-6.7-2.5-9.2 0z"/><path opacity=".1" d="M12.8 12.9c-2.1 2.1-5.5 2.1-7.6 0-2.1-2.1-2.1-5.5 0-7.7l-.8-.8c-2.5 2.5-2.5 6.7 0 9.2s6.6 2.5 9.2 0 2.5-6.
24856 0-9.2l-.8.8c2.2 2.1 2.2 5.6 0 7.7z"/>'),Ct.appendChild(this._clearEl),Ct.appendChild(this._loadingEl),Ue.appendChild(rt),Ue.appendChild(this._inputEl),Ue.appendChild(Ct),this.options.enableGeolocation&&this.geolocation.isSupport()){this._geolocateEl=document.createElement("button"),this._geolocateEl.setAttribute("aria-label","Geolocate"),this._geolocateEl.addEventListener("click",this._geolocateUser),this._geolocateEl.className="mapboxgl-ctrl-geocoder--button";var Xe=this.createIcon("geolocate",'<path d="M12.999 3.677L2.042 8.269c-.962.403-.747 1.823.29 1.912l5.032.431.431 5.033c.089 1.037 1.509 1.252 1.912.29l4.592-10.957c.345-.822-.477-1.644-1.299-1.299z" fill="#4264fb"/>');this._geolocateEl.appendChild(Xe),Ct.appendChild(this._geolocateEl),this._showGeolocateButton()}var tt=this._typeahead=new Re(this._inputEl,[],{filter:!1,minLength:this.options.minLength,limit:this.options.limit});this.setRenderFunction(this.options.render),tt.getItemValue=this.options.getItemValue;var nt=tt.list.draw,Ye=this._footerNode=It();return tt.list.draw=function(){nt.call(this),Ye.addEventListener("mousedown",(function(){this.selectingListItem=!0}).bind(this)),Ye.addEventListener("mouseup",(function(){this.selectingListItem=!1}).bind(this)),this.element.appendChild(Ye)},this.mapMarker=null,this._handleMarker=this._handleMarker.bind(this),this._map&&(this.options.trackProximity&&(this._updateProximity(),this._map.on("moveend",this._updateProximity)),this._mapboxgl=this.options.mapboxgl,!this._mapboxgl&&this.options.marker&&(console.error("No mapboxgl detected in options. Map markers are disabled. Please set options.mapboxgl."),this.options.marker=!1)),Ue},_geolocateUser:function(){this._hideGeolocateButton(),this._showLoadingIcon(),this.geolocation.getCurrentPosition().then((function(ne){this._hideLoadingIcon();const Ue={geometry:{type:"Point",coordinates:[ne.coords.longitude,ne.coords.latitude]}};this._handleMarker(Ue),this._fly(Ue),this._typeahead.clear(),this._typeahead.selected=!0,this.lastSelected=JSON.stringify(Ue),this._showClearButton(),this.fresh=!1;const rt={limit:1,language:[this.options.language],query:Ue.geometry.coordinates,types:["address"]};if(this.options.localGeocoderOnly){const Ct=Ue.geometry.coordinates[0]+","+Ue.geometry.coordinates[1];this._setInputValue(Ct),this._eventEmitter.emit("result",{result:Ue})}else this.geocoderService.reverseGeocode(rt).send().then((function(Ct){const Tt=Ct.body.features[0];if(Tt){const Xe=qe.transformFeatureToGeolocationText(Tt,this.options.addressAccuracy);this._setInputValue(Xe),Tt.user_coordinates=Ue.geometry.coordinates,this._eventEmitter.emit("result",{result:Tt})}else this._eventEmitter.emit("result",{result:{user_coordinates:Ue.geometry.coordinates}})}).bind(this))}).bind(this)).catch((function(ne){ne.code===1?this._renderUserDeniedGeolocationError():this._renderLocationError(),this._hideLoadingIcon(),this._showGeolocateButton(),this._hideAttribution()}).bind(this))},createIcon:function(ne,Ue){var rt=document.createElementNS("http://www.w3.org/2000/svg","svg");return rt.setAttribute("class","mapboxgl-ctrl-geocoder--icon mapboxgl-ctrl-geocoder--icon-"+ne),rt.setAttribute("viewBox","0 0 18 18"),rt.setAttribute("xml:space","preserve"),rt.setAttribute("width",18),rt.setAttribute("height",18),rt.innerHTML=Ue,rt},onRemove:function(){return this.container.parentNode.removeChild(this.container),this.options.trackProximity&&this._map&&this._map.off("moveend",this._updateProximity),this._removeMarker(),this._map=null,this},_setInputValue:function(ne){this._inputEl.value=ne,setTimeout((function(){this._inputEl.focus(),this._inputEl.scrollLeft=0,this._inputEl.setSelectionRange(0,0)}).bind(this),1)},_onPaste:function(ne){var Ue=(ne.clipboardData||window.clipboardData).getData("text");Ue.length>=this.options.minLength&&this._geocode(Ue)},_onKeyDown:function(ne){var Ue=27,rt=9;if(ne.keyCode===Ue&&this.options.clearAndBlurOnEsc)return this._clear(ne),this._inputEl.blur();var Ct=ne.target&&ne.target.shadowRoot?ne.target.shadowRoot.activeElement:ne.target,Tt=Ct?Ct.value:"";if(!Tt)return this.fresh=!0,ne.keyCode!==rt&&this.clear(ne),this._showGeolocateButton(),this._hideClearButton();this._hideGeolocateButton(),!(ne.metaKey||[rt,Ue,37,39,13,38,40].indexOf(ne.keyCode)!==-1)&&Ct.value.length>=this.options.minLength&&this._geocode(Ct.value)},_showButton:function(){this._typeahead.selected&&this._showClearButton()},_hideButton:function(){this._typeahead.selected&&this._hideClearButton()},_showClearButton:function(){this._clearEl.style.display="block"},_hideClearButton:function(){this._clearEl.style.display="none"},_showGeolocateButton:function(){this._geolocateEl&&this.geolocation.isSupport()&&(this._geolocateEl.style.display="block")},_hideGeolocateButton:function(){this._geolocateEl&&(this._geolocateEl.style.display="none")},_showLoadingIcon:function(){this._loadingEl.style.display="block"},_hideLoadingIcon:function(){this._loadingEl.style.display="none"},_showAttribution:function(){this._footerNode.style.display="block"},_hideAttribution:function(){this._footerNode.style.display="none"},_onBlur:function(ne){this.options.clearOnBlur&&this._clearOnBlur(ne),this.options.collapsed&&this._collapse()},_onChange:function(){var ne=this._typeahead.selected;ne&&JSON.stringify(ne)!==this.lastSelected&&(this._hideClearButton(),this.options.flyTo&&this._fly(ne),this.options.marker&&this._mapboxgl&&this._handleMarker(ne),this._inputEl.focus(),this._inputEl.scrollLeft=0,this._inputEl.setSelectionRange(0,0),this.lastSelected=JSON.stringify(ne),this._eventEmitter.emit("result",{result:ne}),this.eventManager.select(ne,this))},_fly:function(ne){var Ue;if(ne.properties&&Q[ne.properties.short_code])Ue=se({},this.options.flyTo),this._map&&this._map.fitBounds(Q[ne.properties.short_code].bbox,Ue);else if(ne.bbox){var rt=ne.bbox;Ue=se({},this.options.flyTo),this._map&&this._map.fitBounds([[rt[0],rt[1]],[rt[2],rt[3]]],Ue)}else{var Ct={zoom:this.options.zoom};Ue=se({},Ct,this.options.flyTo),ne.center?Ue.center=ne.center:ne.geometry&&ne.geometry.type&&ne.geometry.type==="Point"&&ne.geometry.coordinates&&(Ue.center=ne.geometry.coordinates),this._map&&this._map.flyTo(Ue)}},_requestType:function(ne,Ue){var rt;return ne.localGeocoderOnly?rt=ut.LOCAL:ne.reverseGeocode&&qe.REVERSE_GEOCODE_COORD_RGX.test(Ue)?rt=ut.REVERSE:rt=ut.FORWARD,rt},_setupConfig:function(ne,Ue){const rt=["bbox","limit","proximity","countries","types","language","reverseMode","mode","autocomplete","fuzzyMatch","routing","worldview"],Ct=/[\s,]+/;var Tt=this,Xe=rt.reduce(function(nt,Ye){if(Tt.options[Ye]===void 0||Tt.options[Ye]===null)return nt;["countries","types","language"].indexOf(Ye)>-1?nt[Ye]=Tt.options[Ye].split(Ct):nt[Ye]=Tt.options[Ye];const Bt=typeof Tt.options[Ye].longitude=="number"&&typeof Tt.options[Ye].latitude=="number";if(Ye==="proximity"&&Bt){const wi=Tt.options[Ye].longitude,wt=Tt.options[Ye].latitude;nt[Ye]=[wi,wt]}return nt},{});switch(ne){case ut.REVERSE:{var tt=Ue.split(Ct).map(function(nt){return parseFloat(nt,10)});Tt.options.flipCoordinates||tt.reverse(),Xe.types&&Xe.types[0],Xe=se(Xe,{query:tt,limit:1}),["proximity","autocomplete","fuzzyMatch","bbox"].forEach(function(nt){nt in Xe&&delete Xe[nt]})}break;case ut.FORWARD:{const nt=Ue.trim();/^(-?\d{1,3}(\.\d{0,256})?)[, ]+(-?\d{1,3}(\.\d{0,256})?)?$/.test(nt)&&(Ue=Ue.replace(/,/g," ")),Xe=se(Xe,{query:Ue})}break}return Xe.session_token=this.eventManager.getSessionId(),Xe},_geocode:function(ne){this.inputString=ne,this._showLoadingIcon(),this._eventEmitter.emit("loading",{query:ne});const Ue=this._requestType(this.options,ne),rt=this._setupConfig(Ue,ne);var Ct;switch(Ue){case ut.LOCAL:Ct=Promise.resolve();break;case ut.FORWARD:Ct=this.geocoderService.forwardGeocode(rt).send();break;case ut.REVERSE:Ct=this.geocoderService.reverseGeocode(rt).send();break}var Tt=this.options.localGeocoder?this.options.localGeocoder(ne)||[]:[],Xe=[],tt=null;return Ct.catch((function(nt){tt=nt}).bind(this)).then((function(nt){this._hideLoadingIcon();var Ye={};return nt?nt.statusCode=="200"&&(Ye=nt.body,Ye.request=nt.request,Ye.headers=nt.headers,this._headers=nt.headers):Ye={type:"FeatureCollection",features:[]},Ye.config=rt,this.fresh&&(this.eventManager.start(this),this.fresh=!1),Ye.features&&Ye.features.length&&Ye.features.map(function(Bt){Bt._source="mapbox"}),Ye.features=Ye.features?Tt.concat(Ye.features):Tt,this.options.externalGeocoder?(Xe=this.options.externalGeocoder(ne,Ye.features)||Promise.resolve([]),Xe.then(function(Bt){return Ye.features=Ye.features?Bt.concat(Ye.features):Bt,Ye},function(){return Ye})):Ye}).bind(this)).then((function(nt){if(tt)throw tt;this.options.filter&&nt.features.length&&(nt.features=nt.features.filter(this.options.filter)),nt.features.length?(this._showClearButton(),this._hideGeolocateButton(),this._showAttribution(),this._eventEmitter.emit("results",nt),this._typeahead.update(nt.features)):(this._hideClearButton(),this._hideAttribution(),this._typeahead.selected=null,this._renderNoResults(),this._eventEmitter.emit("results",nt))}).bind(this)).catch((function(nt){this._hideLoadingIcon(),this._hideAttribution(),Tt.length&&this.options.localGeocoder||Xe.length&&this.options.externalGeocoder?(this._showClearButton(),this._hideGeolocateButton(),this._typeahead.update(Tt)):(this._hideClearButton(),this._typeahead.selected=null,this._renderError()),this._eventEmitter.emit("results",{features:Tt}),this._eventEmitter.emit("error",{error:nt})}).bind(this)),Ct},_clear:function(ne){ne&&ne.preventDefault(),this._inputEl.value="",this._typeahead.selected=null,this._typeahead.clear(),this.eventManager.sessionIncrementer++,this._onChange(),this._hideClearButton(),this._showGeolocateButton(),this._removeMarker(),this.lastSelected=null,this._eventEmitter.emit("clear"),this.fresh=!0},clear:function(ne){this._clear(ne),this._inputEl.focus()},_clearOnBlur:function(ne){var Ue=this;
2485ne.relatedTarget&&Ue._clear(ne)},_onQueryResult:function(ne){var Ue=ne.body;if(Ue.features.length){var rt=Ue.features[0];this._typeahead.selected=rt,this._inputEl.value=rt.place_name,this._onChange()}},_updateProximity:function(){if(!(!this._map||!this.options.trackProximity))if(this._map.getZoom()>9){var ne=this._map.getCenter().wrap();this.setProximity({longitude:ne.lng,latitude:ne.lat},!1)}else this.setProximity(null,!1)},_collapse:function(){!this._inputEl.value&&this._inputEl!==document.activeElement&&this.container.classList.add("mapboxgl-ctrl-geocoder--collapsed")},_unCollapse:function(){this.container.classList.remove("mapboxgl-ctrl-geocoder--collapsed")},query:function(ne){return this._geocode(ne).then(this._onQueryResult),this},_renderError:function(){var ne="<div class='mapbox-gl-geocoder--error'>There was an error reaching the server</div>";this._renderMessage(ne)},_renderLocationError:function(){var ne="<div class='mapbox-gl-geocoder--error'>A location error has occurred</div>";this._renderMessage(ne)},_renderNoResults:function(){var ne="<div class='mapbox-gl-geocoder--error mapbox-gl-geocoder--no-results'>No results found</div>";this._renderMessage(ne)},_renderUserDeniedGeolocationError:function(){var ne="<div class='mapbox-gl-geocoder--error'>Geolocation permission denied</div>";this._renderMessage(ne)},_renderMessage:function(ne){this._typeahead.update([]),this._typeahead.selected=null,this._typeahead.clear(),this._typeahead.renderError(ne)},_getPlaceholderText:function(){if(this.options.placeholder)return this.options.placeholder;if(this.options.language){var ne=this.options.language.split(",")[0],Ue=Oe.language(ne),rt=Ce.placeholder[Ue];if(rt)return rt}return"Search"},setInput:function(ne,Ue){return Ue===void 0&&(Ue=!1),this._inputEl.value=ne,this._typeahead.selected=null,this._typeahead.clear(),ne.length>=this.options.minLength&&(Ue?this._geocode(ne):this._onChange()),this},setProximity:function(ne,Ue=!0){return this.options.proximity=ne,Ue&&(this.options.trackProximity=!1),this},getProximity:function(){return this.options.proximity},setRenderFunction:function(ne){return ne&&typeof ne=="function"&&(this._typeahead.render=ne),this},getRenderFunction:function(){return this._typeahead.render},setLanguage:function(ne){var Ue=navigator.language||navigator.userLanguage||navigator.browserLanguage;return this.options.language=ne||this.options.language||Ue,this},getLanguage:function(){return this.options.language},getZoom:function(){return this.options.zoom},setZoom:function(ne){return this.options.zoom=ne,this},getFlyTo:function(){return this.options.flyTo},setFlyTo:function(ne){return this.options.flyTo=ne,this},getPlaceholder:function(){return this.options.placeholder},setPlaceholder:function(ne){return this.options.placeholder=ne||this._getPlaceholderText(),this._inputEl.placeholder=this.options.placeholder,this._inputEl.setAttribute("aria-label",this.options.placeholder),this},getBbox:function(){return this.options.bbox},setBbox:function(ne){return this.options.bbox=ne,this},getCountries:function(){return this.options.countries},setCountries:function(ne){return this.options.countries=ne,this},getTypes:function(){return this.options.types},setTypes:function(ne){return this.options.types=ne,this},getMinLength:function(){return this.options.minLength},setMinLength:function(ne){return this.options.minLength=ne,this._typeahead&&(this._typeahead.options.minLength=ne),this},getLimit:function(){return this.options.limit},setLimit:function(ne){return this.options.limit=ne,this._typeahead&&(this._typeahead.options.limit=ne),this},getFilter:function(){return this.options.filter},setFilter:function(ne){return this.options.filter=ne,this},setOrigin:function(ne){return this.options.origin=ne,this.geocoderService=Ie(ve({accessToken:this.options.accessToken,origin:this.options.origin})),this},getOrigin:function(){return this.options.origin},setAccessToken:function(ne){return this.options.accessToken=ne,this.geocoderService=Ie(ve({accessToken:this.options.accessToken,origin:this.options.origin})),this},setAutocomplete:function(ne){return this.options.autocomplete=ne,this},getAutocomplete:function(){return this.options.autocomplete},setFuzzyMatch:function(ne){return this.options.fuzzyMatch=ne,this},getFuzzyMatch:function(){return this.options.fuzzyMatch},setRouting:function(ne){return this.options.routing=ne,this},getRouting:function(){return this.options.routing},setWorldview:function(ne){return this.options.worldview=ne,this},getWorldview:function(){return this.options.worldview},_handleMarker:function(ne){if(this._map){this._removeMarker();var Ue={color:"#4668F2"},rt=se({},Ue,this.options.marker);return this.mapMarker=new this._mapboxgl.Marker(rt),ne.center?this.mapMarker.setLngLat(ne.center).addTo(this._map):ne.geometry&&ne.geometry.type&&ne.geometry.type==="Point"&&ne.geometry.coordinates&&this.mapMarker.setLngLat(ne.geometry.coordinates).addTo(this._map),this}},_removeMarker:function(){this.mapMarker&&(this.mapMarker.remove(),this.mapMarker=null)},on:function(ne,Ue){return this._eventEmitter.on(ne,Ue),this},off:function(ne,Ue){return this._eventEmitter.removeListener(ne,Ue),this.eventManager.remove(),this}},w_=Fe,w_}var V2=N2();const U2=d0(V2);function S0(){return{map:Qs("mapbox-map",null)}}const T_=new Map,j2=/onMb([A-Z])(.+)/;function q2(Re){return T_.has(Re)||T_.set(Re,Re.replace(j2,(fe,se,he)=>se.toLowerCase()+he)),T_.get(Re)}function D_(Re,fe,se=[],he=null){const Q=zw(),ve=cn(()=>Object.entries(Q).filter(([Oe,Ge])=>Oe.startsWith("on")&&typeof Ge=="function").map(([Oe])=>Oe)),Ie=new Map;function o(Oe){Array.isArray(Oe)&&Oe.forEach(Ge=>{const qe=Ie.get(Ge);typeof qe=="function"&&qe()})}function Ce(Oe){Array.isArray(Oe)&&Oe.forEach(Ge=>{const qe=q2(Ge);if(!se.includes(qe))return;const ut=(...It)=>{Re(`mb-${qe}`,...It)};he?(qr(fe).on(qe,he,ut),Ie.set(Ge,()=>{qr(fe).off(qe,he,ut)})):(qr(fe).on(qe,ut),Ie.set(Ge,()=>{qr(fe).off(qe,ut)}))})}eo(ve,(Oe,Ge)=>{const qe=Array.isArray(Oe)?(Ge??[]).filter(It=>!Oe.includes(It)):Ge??[],ut=Array.isArray(Ge)?(Oe??[]).filter(It=>!Ge.includes(It)):Oe??[];if(qr(fe))o(qe),Ce(ut);else{const It=eo(fe,Fe=>
2485{Fe&&(o(qe),Ce(ut),It())})}},{immediate:!0})}function G2(Re){return Re.charAt(0).toUpperCase()+Re.slice(1)}function O_(Re,fe,se){function he(Q){Object.keys(Re).filter(ve=>Re[ve]!==void 0&&Re[ve]!==null).forEach(ve=>{var Ie;const o=ve==="mapStyle"?"setStyle":`set${G2(ve)}`,Ce=typeof Q[o]=="function",Oe=typeof se[ve]>"u"||"bind"in se[ve]?((Ie=se[ve])==null?void 0:Ie.bind)??!1:!0;if(!Ce||!Oe)return;const{type:Ge}=se[ve],qe={deep:Ge===Object||Array.isArray(Ge)&&Ge.includes(Object)};eo(()=>Re[ve],ut=>{Q[o](ut)},qe)})}if(qr(fe))he(qr(fe));else{const Q=eo(fe,ve=>{ve&&(he(ve),Q())})}}if(!io)throw new Error("mapboxgl is not installed.");if(!U2)throw new Error("MapboxGeocoder is not installed.");const $2={key:0},H2={key:1};if(!io)throw new Error("mapboxgl is not installed.");const{LngLatBounds:o0,LngLat:Z2}=io,a0={accessToken:{type:String,default:"no-token"},container:{type:[typeof HTMLElement<"u"&&HTMLElement,String],default:void 0},minZoom:{type:Number,default:0},maxZoom:{type:Number,default:22},minPitch:{type:Number,default:0},maxPitch:{type:Number,default:60},mapStyle:{type:[Object,String],required:!0},hash:{type:Boolean,default:!1},interactive:{type:Boolean,default:!0},bearingSnap:{type:Number,default:7},pitchWithRotate:{type:Boolean,default:!0},clickTolerance:{type:Number,default:3},attributionControl:{type:Boolean,default:!0},customAttribution:{type:[String,Array],default:null},logoPosition:{type:String,default:"bottom-left"},failIfMajorPerformanceCaveat:{type:Boolean,default:!1},preserveDrawingBuffer:{type:Boolean,default:!1},antialias:{type:Boolean,default:!1},refreshExpiredTiles:{type:Boolean,default:!0},maxBounds:{type:[o0,Array],default:void 0},scrollZoom:{type:[Boolean,Object],default:!0},boxZoom:{type:Boolean,default:!0},dragRotate:{type:Boolean,default:!0},dragPan:{type:[Boolean,Object],default:!0},keyboard:{type:Boolean,default:!0},doubleClickZoom:{type:Boolean,default:!0},touchZoomRotate:{type:[Boolean,Object],default:!0},trackResize:{type:Boolean,default:!0},center:{type:[Z2,Array,Object],default:()=>[0,0]},zoom:{type:Number,default:0},bearing:{type:Number,default:0},pitch:{type:Number,default:0},bounds:{type:[o0,Array],default:void 0},fitBoundsOptions:{type:Object,default:null},renderWorldCopies:{type:Boolean,default:!0},maxTileCacheSize:{type:Number,default:null},localIdeographFontFamily:{type:String,default:"sans-serif"},transformRequest:{type:Function,default:null},collectResourceTiming:{type:Boolean,default:!1},fadeDuration:{type:Number,default:300},crossSourceCollisions:{type:Boolean,default:!0},cooperativeGestures:{type:Boolean},language:{type:[String,Array],default:null},locale:{type:Object,default:null},localFontFamily:{type:[Boolean,String],default:!1},minTileCacheSize:{type:Number,default:null},optimizeForTerrain:{type:Boolean,default:!0},performanceMetricsCollection:{type:Boolean,default:!0},projection:{type:[String,Object],default:"mercator"},testMode:{type:Boolean,default:!1},touchPitch:{type:[Boolean,Object],default:!0},useWebGL2:{type:Boolean,default:!1},worldview:{type:String,default:null}},W2=["boxzoomcancel","boxzoomend","boxzoomstart","click","contextmenu","data","dataloading","dblclick","drag","dragend","dragstart","error","idle","load","mousedown","mouseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","move","moveend","movestart","pitch","pitchend","pitchstart","remove","render","resize","rotate","rotateend","rotatestart","sourcedata","sourcedataloading","styledata","styledataloading","styleimagemissing","touchcancel","touchend","touchmove","touchstart","webglcontextlost","webglcontextrestored","wheel","zoom","zoomend","zoomstart"],X2={inheritAttrs:!1},l0=$n({...X2,__name:"MapboxMap",props:a0,setup(Re,{expose:fe,emit:se}){const he=Re,Q=se,ve=C_(null);Gc("mapbox-map",ve);const Ie=fr(),o=fr(!1),Ce=cn(()=>{const{accessToken:Oe,mapStyle:Ge,...qe}=he;return!qe.container&&Ie.value&&(qe.container=Ie.value),{style:Ge,...qe}});return D_(Q,ve,W2),O_(he,ve,a0),Gh(()=>{io.accessToken=he.accessToken,ve.value=new io.Map(Ce.value),ve.value.on("load",()=>{o.value=!0}),Q("mb-created",ve.value);const Oe=new ResizeObserver(()=>{ve.value.resize()});Oe.observe(Ce.value.container),P_(()=>{Oe.disconnect(),ve.value.remove()})}),fe({map:ve}),(Oe,Ge)=>(zn(),Ml(Pw,null,[Np("div",Il({ref_key:"root",ref:Ie},Oe.$attrs),null,16),o.value?(zn(),Ml("div",$2,[to(Oe.$slots,"default")])):(zn(),Ml("div",H2,[to(Oe.$slots,"loader")]))],64))}});if(!io)throw new Error("mapboxgl is not installed.");const{GeolocateControl:hT}=io,{Popup:Y2,Point:K2,LngLat:J2}=io,c0={lngLat:{type:[J2,Array,Object],required:!0},closeButton:{type:Boolean,default:!0},closeOnClick:{type:Boolean,default:!0},closeOnMove:{type:Boolean,default:!1},anchor:{type:String,default:null},offset:{type:[Number,K2,Array,Object],default:0},className:{type:String,default:null},maxWidth:{type:String,default:"240px"},renderless:{type:Boolean,default:!1,bind:!1}},Q2=["open","close"],eT=$n({__name:"MapboxPopup",props:c0,setup(Re,{expose:fe,emit:se}){const he=Re,Q=se,ve=C_(),Ie=fr(),o=cn(()=>{const{lngLat:Ce,...Oe}
2485=he;return Oe});return O_(he,ve,c0),D_(Q,ve,Q2),Gh(()=>{const{map:Ce}=S0();ve.value=new Y2(o.value).setLngLat(he.lngLat).setDOMContent(Ie.value),he.renderless||ve.value.addTo(Ce.value),Q("mb-open",ve.value)}),P_(()=>{ve.value&&ve.value.remove()}),fe({popup:ve}),(Ce,Oe)=>(zn(),Ml("div",{ref_key:"root",ref:Ie},[to(Ce.$slots,"default")],512))}}),{Marker:tT,Point:iT}=io,u0={lngLat:{type:Array,required:!0},popup:{type:[Object,Boolean],default:!1,bind:!1},element:{type:typeof HTMLElement<"u"?HTMLElement:Object,default:null},offset:{type:[iT,Array],default:null},anchor:{type:String,default:"center"},color:{type:String,default:null},scale:{type:Number,default:1},draggable:{type:Boolean,default:!1},rotation:{type:Number,default:0},pitchAlignment:{type:String,default:"auto"},rotationAlignment:{type:String,default:"auto"},renderless:{type:Boolean,default:!1,bind:!1}},rT=["dragstart","drag","dragend"],h0=$n({__name:"MapboxMarker",props:u0,setup(Re,{expose:fe,emit:se}){const he=Re,Q=se,ve=Rw(),Ie=C_(),o=fr(),Ce=fr(),Oe=cn(()=>typeof ve.popup<"u"),Ge=cn(()=>Oe.value?Ce.value.popup:null),qe=cn(()=>({lngLat:he.lngLat,...he.popup?he.popup:{},renderless:!0})),ut=cn(()=>{const{lngLat:It,popup:Fe,...ne}=he;return ve.default&&(ne.element=o.value),ne});return O_(he,Ie,u0),D_(Q,Ie,rT),Gh(()=>{const{map:It}=S0();Ie.value=new tT(ut.value).setLngLat(he.lngLat),he.renderless||Ie.value.addTo(It.value),Oe.value&&Ie.value.setPopup(Ge.value)}),P_(()=>{Ie.value&&Ie.value.remove()}),fe({marker:Ie,popup:Ge}),(It,Fe)=>(zn(),Ml("div",null,[Np("div",{ref_key:"contentRef",ref:o},[to(It.$slots,"default")],512),Oe.value?(zn(),Al(eT,Il({key:0,ref_key:"popupRef",ref:Ce},qe.value),{default:Vp(()=>[to(It.$slots,"popup")]),_:3},16)):M_("",!0)]))}});if(!io)throw new Error("mapboxgl is not installed.");const nT=$n({components:{Marker:Xw,AdvancedMarker:Zw},__name:"Marker",props:{options:{default:()=>({position:{lat:0,lng:0}})}},setup(Re){const fe=R_().map.google,se=cn(()=>fe.useAdvancedMarker?S_("AdvancedMarker"):S_("Marker"));return(he,Q)=>(zn(),Al(z_(qr(se)),Il(he.$attrs,{options:he.options}),null,16,["options"]))}}),sT=$n({components:{MapboxMarker:h0},__name:"Marker",props:{options:{default:()=>({position:{lat:0,lng:0}})}},setup(Re){const fe=Re,se=cn(()=>{const he=fe.options.position;return[he.lng,he.lat]});return(he,Q)=>(zn(),Al(qr(h0),Il(he.$attrs,{"lng-lat":qr(se)}),null,16,["lng-lat"]))}}),dT=$n({__name:"Marker",setup(Re){const fe=R_().map,se=cn(()=>fe.provider==="google"?nT:sT);return(he,Q)=>(zn(),Al(z_(qr(se)),I_(A_(he.$attrs)),null,16))}}),oT=$n({components:{GoogleMap:Gw},__name:"Map",props:{zoom:{default:8},language:{default:"nl"},mapTypeId:{default:"terrain"},mapId:{default:void 0},center:{default:()=>({lat:0,lng:0})}},setup(Re){const fe=Re,{public:{googleMapKey:se}}=p0(),he=cn(()=>{var Q;return`${fe.mapId??((Q=Lw())==null?void 0:Q.uid)}`});return(Q,ve)=>{const Ie=S_("GoogleMap");return zn(),Al(Ie,Il({"api-key":qr(se)},Q.$attrs,{zoom:Q.zoom,language:Q.language,"map-type-id":Q.mapTypeId,"map-id":qr(he),center:Q.center,class:"h-full w-full bg-gray-50"}),{default:Vp(()=>[to(Q.$slots,"default")]),_:3},16,["api-key","zoom","language","map-type-id","map-id","center"])}}}),aT=$n({components:{MapboxMap:l0},__name:"Map",props:{zoom:{default:8},language:{default:"nl"},mapStyle:{default:"mapbox://styles/mapbox/streets-v11"},center:{default:()=>({lat:0,lng:0})}},setup(Re){const fe=Re,{public:{mapboxKey:se}}=p0(),he=cn(()=>{var Q,ve;return[((Q=fe.center)==null?void 0:Q.lng)??0,((ve=fe.center)==null?void 0:ve.lat)??0]});return(Q,ve)=>qr(se)?(zn(),Al(qr(l0),Il({key:0,"access-token":qr(se)},Q.$attrs,{zoom:Q.zoom,language:Q.language,"map-style":Q.mapStyle,center:qr(he),class:"h-full w-full bg-gray-50"}),{default:Vp(()=>[to(Q.$slots,"default")]),_:3},16,["access-token","zoom","language","map-style","center"])):M_("",!0)}}),pT=$n({__name:"index",setup(Re){const fe=R_().map,se=cn(()=>fe.provider==="google"?oT:aT);return(he,Q)=>(zn(),Al(z_(qr(se)),I_(A_(he.$attrs)),{default:Vp(()=>[to(he.$slots,"default")]),_:3},16))}});export{uT as $,eT as _,pT as a,dT as b,cT as u};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.