PageSourceSearch

https://www.airgradient.com/_nuxt/C7qWptLf.js

js airgradient.com collected 2026-09-24 09:06:10 UTC 903,531 bytes, 597 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./BUBwSmBz.js","./CwphVnsR.js","./Oc8CMiej.js","./hpNDvw06.js","./entry.CPrLFF_E.css","./BNRiLFGh.js","./x_rD_Ya3.js","./Bf9wae6a.js","./BYrMGjzP.js","./Dt-MQsI-.js","./C8_up2AI.js","./DenpUUh4.js","./WebsiteDialog.CmxNHua5.css","./MapLegendPopup.H-McGViF.css","./DCS5rCQu.js","./LocationDetailPanel.CRScBlYQ.css","./leaflet.9UJSYqx2.css","./geosearch.BgKcmlZ-.css","./leaflet-velocity.DWTueIcv.css","./maplibre-gl.PhPnDjd-.css","./main.Cvg7XRXX.css"])))=>i.map(i=>d[i]);
2import{K as us,br as nu,e as ct,b as qr,a2 as mg,i as Ht,E as Tr,v as gg,S as qp,o as Jt,d as _i,af as Zp,c as Ir,h as ln,bs as _g,bt as Gp,r as Wt,a7 as Dh,g as Ds,G as Lh,I as uu,F as ac,m as su,an as Hp,t as Ho,R as cc,au as uc,J as dr,bu as Rh,p as io,aU as el,w as Fi,bo as yg,aA as Ko,av as Wp,bh as vg,bv as xg,bw as Wo,bx as Xo,by as bg,b9 as Bh,b4 as Xp,aW as wg,aw as Sg,aS as Fh,bz as Yp,at as Tg,bA as Ig,M as xa,ay as ba,a5 as Ag,z as Kp,f as Eg,bB as Ep,a as Pp,bC as Pg,aq as Cg,a9 as Mg,H as Qc}from"./hpNDvw06.js";import{r as kg,t as Oh,l as Cn,L as hr}from"./CwphVnsR.js";import{s as Nh}from"./x_rD_Ya3.js";import{u as zg}from"./Bf9wae6a.js";import{r as Jp}from"./BYrMGjzP.js";var au=(x=>(x.sensor="sensor",x.cluster="cluster",x))(au||{}),mt=(x=>(x.GREEN="green",x.YELLOW="yellow",x.ORANGE="orange",x.RED="red",x.PURPLE="purple",x.BROWN="brown",x.BLUE="blue",x.GRAY="gray",x.LIGHTGRAY="lightgray",x.DEFAULT="default",x))(mt||{}),nt=(x=>(x.PM25="pm25",x.PM_AQI="pm_aqi",x.RCO2="rco2",x))(nt||{}),En=(x=>(x.MONTH="month",x.DAY="day",x.HOUR="hour",x.MINUTE="minute",x.WEEK="week",x))(En||{}),Ya=(x=>(x.MINUTES_5="5m",x.MINUTES_15="15m",x.HOUR="1h",x.HOUR_8="8h",x.DAY="1d",x.WEEK="1w",x.MONTH="1m",x))(Ya||{}),Ka=(x=>(x.DAY="day",x.WEEK="week",x.MONTH="month",x.MONTHS_3="3_months",x.MONTHS_6="6_months",x.YEAR="year",x))(Ka||{}),hu=(x=>(x.LOCAL="local",x.USER="user",x))(hu||{}),qt=(x=>(x.GOOD="good",x.MODERATE="moderate",x.UNHEALTHY_SENSITIVE_GROUPS="unhealthy_sensitive_groups",x.UNHEALTHY="unhealthy",x.VERY_UNHEALTHY="very_unhealthy",x.HAZARDOUS="hazardous",x.INCORRECT="incorrect",x))(qt||{});const Dg=["src","alt"],Lg=us({__name:"IconButton",props:{size:{type:String,default:nu.NORMAL},disabled:{type:Boolean,default:!1},ripple:{type:Boolean,default:!1},icon:{type:String,default:""},customIcon:{type:String,default:""},iconAlt:{type:String,default:"Icon"},style:{type:String,default:"light"},active:{type:Boolean,default:!1}},emits:["click"],setup(x,{emit:L}){const D=x,O=L,Y=ct(()=>D.customIcon?`/images/icons/${D.customIcon.includes("/")?D.customIcon:`ui/${D.customIcon}`}`:""),Q=A=>{D.disabled||O("click",A)};return(A,d)=>{const xe=qp("v-btn");return x.icon&&!x.customIcon?(Jt(),qr(xe,{key:0,ripple:x.ripple,disabled:x.disabled,icon:x.icon,variant:"plain",class:Tr(["custom-icon-button",x.style,{active:x.active}]),size:x.size===Ht(nu).NORMAL?"default":"small",onClick:Q},null,8,["ripple","disabled","icon","class","size"])):x.customIcon?(Jt(),qr(xe,{key:1,ripple:x.ripple,disabled:x.disabled,variant:"plain",class:Tr(["custom-icon-button",x.style,{active:x.active}]),size:x.size===Ht(nu).NORMAL?"default":"small",onClick:Q},{default:gg(()=>[_i("img",{width:"18",height:"18",src:Y.value,alt:x.iconAlt,class:"custom-icon"},null,8,Dg)]),_:1},8,["ripple","disabled","class","size"])):mg(A.$slots,"default",{key:2},void 0,!0)}}}),Qp=Zp(Lg,[["__scopeId","data-v-0052d550"]]),Rg={style:{height:"4px"}},Bg=us({__name:"ProgressBar",props:{show:{type:Boolean,required:!0}},setup(x){return(L,D)=>{const O=qp("v-progress-linear");return Jt(),Ir("div",Rg,[x.show?(Jt(),qr(O,{key:0,color:"#d1d5db","bg-color":"#f3f4f6",indeterminate:""})):ln("",!0)])}}}),Fg={class:"ag-dropdown-wrapper"},Og=["disabled"],Ng=["innerHTML"],Vg={key:0,class:"ag-dropdown-menu",role:"listbox"},Ug=["disabled","onClick"],jg=["innerHTML"],$g=us({inheritAttrs:!1,__name:"DropdownControl",props:{options:{type:Array,required:!0},selectedValue:{type:[String,Number],default:""},size:{type:String,default:_g.SMALL},disabled:{type:Boolean,default:!1},placeholder:{type:String,default:"select_option"},translate:{type:Boolean,default:!0},width:{type:String,default:"100%"},variant:{type:String,default:"default"}},emits:["update:modelValue","change"],setup(x,{emit:L}){const D=x,O=L,Y=Gp(),Q=Wt(!1),A=Wt(null),{t:d}=Dh("map"),xe=ct(()=>D.options),Se=ct(()=>{const We=xe.value.find(st=>st.value===D.selectedValue);return We!=null&&We.label?D.translate?d(We.label,We.label):We.label:null}),ke=ct(()=>D.translate?d(D.placeholder,D.placeholder):D.placeholder),de=We=>We!=null&&We.label?D.translate?d(We.label,We.label):We.label:"",K=We=>{const st=xe.value.find(we=>we.value===We);if(st!=null&&st.disabled){Q.value=!1;return}const xt=We&&typeof We=="object"&&"value"in We?We.value:We;O("update:modelValue",xt),O("change",xt),Q.value=!1},Ze=()=>{D.disabled||(Q.value=!Q.value)},vt=We=>{var xt;const st=We.target;st instanceof Node&&((xt=A.value)!=null&&xt.contains(st)||(Q.value=!1))},Rt=We=>{We.key==="Escape"&&(Q.value=!1)};return Ds(()=>{document.addEventListener("click",vt),document.addEventListener("keydown",Rt)}),Lh(()=>{document.removeEventListener("click",vt),document.removeEventListener("keydown",Rt)}),(We,st)=>(Jt(),Ir("div",Hp({ref_key:"rootRef",ref:A,class:"ag-dropdown-host"},Ht(Y)),[_i("div",Fg,[_i("button",{type:"button",class:Tr(["ag-dropdown-control__trigger",{"ag-dropdown-control__trigger--disabled":x.disabled,"ag-dropdown-control__trigger--open":Q.value,"ag-dropdown-control__trigger--small":x.size==="small","ag-dropdown-control__trigger--map":x.variant==="mapOverlay"}]),disabled:x.disabled,onClick:Ze},[_i("span",{style:uu({maxWidth:x.width}),innerHTML:Se.value||ke.value},null,12,Ng),(Jt(),Ir("svg",{width:"20",height:"20",viewBox:"0 0 24 24",class:Tr({rotate:Q.value})},[...st[0]||(st[0]=[_i("path",{d:"M8 5V19L19 12L8 5Z",fill:"currentColor"},null,-1)])],2))],10,Og),Q.value?(Jt(),Ir("div",Vg,[(Jt(!0),Ir(ac,null,su(xe.value,xt=>(Jt(),Ir("button",{key:String(xt.value),type:"button",class:Tr(["ag-dropdown-menu__item",[xt.className,{"ag-dropdown-menu__item--active":xt.value===x.selectedValue,"ag-dropdown-menu__item--disabled":!!xt.disabled}]]),disabled:!!xt.disabled,onClick:we=>K(xt.value)},[_i("span",{innerHTML:de(xt)},null,8,jg)],10,Ug))),128))])):ln("",!0)])],16))}}),qg={class:"ag-multiselect-wrapper"},Zg=["disabled","aria-expanded"],Gg={class:"ag-multiselect-menu__section-title"},Hg=["disabled","aria-selected","onClick"],Wg={class:"ag-multiselect-menu__label"},Xg=["disabled","aria-selected","title","onClick"],Yg={class:"ag-multiselect-menu__label"},Kg=["aria-selected"],Jg={class:"ag-multiselect-menu__label"},Qg=["disabled","aria-selected","onClick"],e_={class:"ag-multiselect-menu__label"},t_=us({inheritAttrs:!1,__name:"MultiSelectControl",props:{options:{type:Array,default:()=>[]},sections:{type:Array,default:()=>[]},selectedValues:{type:Array,default:()=>[]},displayValue:{type:String,default:""},disabled:{type:Boolean,default:!1},placeholder:{type:String,default:"Select options"},allLabel:{type:String,default:"All"},emptyLabel:{type:String,default:"None"},multipleLabel:{type:String,default:"sources"},width:{type:String,default:"100%"},variant:{type:String,default:"default"}},emits:["update:selectedValues","change","section-change"],setup(x,{emit:L}){const D=x,O=L,Y=Gp(),Q=Wt(!1),A=Wt(null),d=Ye=>{const at=new Set;return Ye.map(Te=>String(Te||"").trim()).filter(Te=>!Te||at.has(Te)?!1:(at.add(Te),!0))},xe=ct(()=>D.sections.length>0),Se=ct(()=>d(D.selectedValues)),ke=ct(()=>D.options.filter(Ye=>!Ye.disabled).map(Ye=>Ye.value)),de=ct(()=>new Set(Se.value)),K=ct(()=>{const Ye=ke.value;return!Ye.length||Se.value.length!==Ye.length?!1:Ye.every(at=>de.value.has(at))}),Ze=ct(()=>{var Ye;if(D.displayValue)return D.displayValue;if(xe.value)return D.placeholder;if(K.value)return D.allLabel||D.placeholder;if(!Se.value.length)return D.emptyLabel||D.placeholder;if(Se.value.length===1){const at=Se.value[0];return((Ye=D.options.find(Te=>Te.value===at))==null?void 0:Ye.label)??at}return`${Se.value.length} ${D.multipleLabel}`}),vt=Ye=>de.value.has(Ye),Rt=Ye=>d(Ye.selectedValues),We=Ye=>Ye.options.filter(at=>!at.disabled).map(at=>at.value),st=(Ye,at)=>Rt(Ye).includes(at),xt=Ye=>{const at=We(Ye),Te=Rt(Ye);if(!at.length||Te.length!==at.length)return!1;const pt=new Set(Te);return at.every(Xt=>pt.has(Xt))},we=Ye=>{O("update:selectedValues",Ye),O("change",Ye)},Vi=()=>
2{if(K.value){we([]);return}we(ke.value)},Ot=Ye=>{const at=D.options.find(Te=>Te.value===Ye);if(!(at!=null&&at.disabled)){if(vt(Ye)){we(Se.value.filter(Te=>Te!==Ye));return}we([...Se.value,Ye])}},Ge=(Ye,at)=>{O("section-change",{key:Ye.key,selectedValues:at})},ot=Ye=>{const at=xt(Ye)?[]:We(Ye);Ge(Ye,at)},ge=(Ye,at)=>{const Te=Ye.options.find(Ii=>Ii.value===at);if(Te!=null&&Te.disabled)return;const pt=Rt(Ye);if(pt.includes(at)){Ge(Ye,pt.filter(Ii=>Ii!==at));return}const Xt=new Set([...pt,at]);Ge(Ye,We(Ye).filter(Ii=>Xt.has(Ii)))},Ve=()=>{D.disabled||(Q.value=!Q.value)},qe=Ye=>{var Te;const at=Ye.target;at instanceof Node&&((Te=A.value)!=null&&Te.contains(at)||(Q.value=!1))},dt=Ye=>{Ye.key==="Escape"&&(Q.value=!1)};return Ds(()=>{document.addEventListener("click",qe),document.addEventListener("keydown",dt)}),Lh(()=>{document.removeEventListener("click",qe),document.removeEventListener("keydown",dt)}),(Ye,at)=>(Jt(),Ir("div",Hp({ref_key:"rootRef",ref:A,class:"ag-multiselect-host"},Ht(Y)),[_i("div",qg,[_i("button",{type:"button",class:Tr(["ag-multiselect-control__trigger",{"ag-multiselect-control__trigger--disabled":x.disabled,"ag-multiselect-control__trigger--open":Q.value,"ag-multiselect-control__trigger--map":x.variant==="mapOverlay"}]),disabled:x.disabled,"aria-expanded":String(Q.value),"aria-haspopup":"listbox",onClick:Ve},[_i("span",{style:uu({maxWidth:x.width})},Ho(Ze.value),5),(Jt(),Ir("svg",{width:"20",height:"20",viewBox:"0 0 24 24",class:Tr({rotate:Q.value})},[...at[0]||(at[0]=[_i("path",{d:"M8 5V19L19 12L8 5Z",fill:"currentColor"},null,-1)])],2))],10,Zg),Q.value?(Jt(),Ir("div",{key:0,class:Tr(["ag-multiselect-menu",{"ag-multiselect-menu--map":x.variant==="mapOverlay"}]),role:"listbox","aria-multiselectable":"true"},[xe.value?(Jt(!0),Ir(ac,{key:0},su(x.sections,Te=>(Jt(),Ir("section",{key:Te.key,class:"ag-multiselect-menu__section"},[_i("div",Gg,Ho(Te.label),1),_i("button",{type:"button",class:Tr(["ag-multiselect-menu__item",{"ag-multiselect-menu__item--active":xt(Te)}]),disabled:!We(Te).length,"aria-selected":String(xt(Te)),onClick:pt=>ot(Te)},[_i("span",{class:Tr(["ag-multiselect-menu__checkbox",{"ag-multiselect-menu__checkbox--selected":xt(Te)}]),"aria-hidden":"true"},null,2),_i("span",Wg,Ho(Te.allLabel),1)],10,Hg),(Jt(!0),Ir(ac,null,su(Te.options,pt=>(Jt(),Ir("button",{key:`${Te.key}-${pt.value}`,type:"button",class:Tr(["ag-multiselect-menu__item ag-multiselect-menu__item--nested",{"ag-multiselect-menu__item--active":st(Te,pt.value),"ag-multiselect-menu__item--disabled":!!pt.disabled}]),disabled:!!pt.disabled,"aria-selected":String(st(Te,pt.value)),title:pt.description,onClick:Xt=>ge(Te,pt.value)},[_i("span",{class:Tr(["ag-multiselect-menu__checkbox",{"ag-multiselect-menu__checkbox--selected":st(Te,pt.value)}]),"aria-hidden":"true"},null,2),_i("span",Yg,Ho(pt.label),1)],10,Xg))),128))]))),128)):(Jt(),Ir(ac,{key:1},[_i("button",{type:"button",class:Tr(["ag-multiselect-menu__item",{"ag-multiselect-menu__item--active":K.value}]),"aria-selected":String(K.value),onClick:Vi},[_i("span",{class:Tr(["ag-multiselect-menu__checkbox",{"ag-multiselect-menu__checkbox--selected":K.value}]),"aria-hidden":"true"},null,2),_i("span",Jg,Ho(x.allLabel),1)],10,Kg),(Jt(!0),Ir(ac,null,su(x.options,Te=>(Jt(),Ir("button",{key:Te.value,type:"button",class:Tr(["ag-multiselect-menu__item",{"ag-multiselect-menu__item--active":vt(Te.value),"ag-multiselect-menu__item--disabled":!!Te.disabled}]),disabled:!!Te.disabled,"aria-selected":String(vt(Te.value)),onClick:pt=>Ot(Te.value)},[_i("span",{class:Tr(["ag-multiselect-menu__checkbox",{"ag-multiselect-menu__checkbox--selected":vt(Te.value)}]),"aria-hidden":"true"},null,2),_i("span",e_,Ho(Te.label),1)],10,Qg))),128))],64))],2)):ln("",!0)])],16))}});var ou={exports:{}},lu={exports:{}};/**
3 * MapLibre GL JS
4 * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.7.1/LICENSE.txt
5 */var i_=lu.exports,Cp;function r_(){return Cp||(Cp=1,(function(x,L){(function(D,O){x.exports=O()})(i_,(function(){var D={},O={};function Y(A,d,xe){if(O[A]=xe,A==="index"){var Se="var sharedModule = {}; ("+O.shared+")(sharedModule); ("+O.worker+")(sharedModule);",ke={};return O.shared(ke),O.index(D,ke),typeof window<"u"&&D.setWorkerUrl(window.URL.createObjectURL(new Blob([Se],{type:"text/javascript"}))),D}}Y("shared",["exports"],(function(A){function d(i,t,r,s){return new(r||(r=Promise))((function(l,h){function p(v){try{g(s.next(v))}catch(b){h(b)}}function f(v){try{g(s.throw(v))}catch(b){h(b)}}function g(v){var b;v.done?l(v.value):(b=v.value,b instanceof r?b:new r((function(S){S(b)}))).then(p,f)}g((s=s.apply(i,t||[])).next())}))}function xe(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}typeof SuppressedError=="function"&&SuppressedError;var Se=ke;function ke(i,t){this.x=i,this.y=t}ke.prototype={clone:function(){return new ke(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)}
5,rotateAround:function(i,t){return this.clone()._rotateAround(i,t)},matMult:function(i){return this.clone()._matMult(i)},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(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var t=i.x-this.x,r=i.y-this.y;return t*t+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,t){return Math.atan2(this.x*t-this.y*i,this.x*i+this.y*t)},_matMult:function(i){var t=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=t,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var t=Math.cos(i),r=Math.sin(i),s=r*this.x+t*this.y;return this.x=t*this.x-r*this.y,this.y=s,this},_rotateAround:function(i,t){var r=Math.cos(i),s=Math.sin(i),l=t.y+s*(this.x-t.x)+r*(this.y-t.y);return this.x=t.x+r*(this.x-t.x)-s*(this.y-t.y),this.y=l,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},ke.convert=function(i){return i instanceof ke?i:Array.isArray(i)?new ke(i[0],i[1]):i};var de=xe(Se),K=Ze;function Ze(i,t,r,s){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(s-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=t,this.p2x=r,this.p2y=s}Ze.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,t){if(t===void 0&&(t=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,s=0;s<8;s++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)<t)return r;var h=this.sampleCurveDerivativeX(r);if(Math.abs(h)<1e-6)break;r-=l/h}var p=0,f=1;for(r=i,s=0;s<20&&(l=this.sampleCurveX(r),!(Math.abs(l-i)<t));s++)i>l?p=r:f=r,r=.5*(f-p)+p;return r},solve:function(i,t){return this.sampleCurveY(this.solveCurveX(i,t))}};var vt=xe(K);let Rt,We;function st(){return Rt==null&&(Rt=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Rt}function xt(){if(We==null&&(We=!1,st())){const t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let s=0;s<25;s++){const l=4*s;t.fillStyle=`rgb(${l},${l+1},${l+2})`,t.fillRect(s%5,Math.floor(s/5),1,1)}const r=t.getImageData(0,0,5,5).data;for(let s=0;s<100;s++)if(s%4!=3&&r[s]!==s){We=!0;break}}}return We||!1}function we(i,t,r,s){const l=new vt(i,t,r,s);return h=>l.solve(h)}const Vi=we(.25,.1,.25,1);function Ot(i,t,r){return Math.min(r,Math.max(t,i))}function Ge(i,t,r){const s=r-t,l=((i-t)%s+s)%s+t;return l===t?r:l}function ot(i,...t){for(const r of t)for(const s in r)i[s]=r[s];return i}let ge=1;function Ve(i,t,r){const s={};for(const l in i)s[l]=t.call(this,i[l],l,i);return s}function qe(i,t,r){const s={};for(const l in i)t.call(this,i[l],l,i)&&(s[l]=i[l]);return s}function dt(i){return Array.isArray(i)?i.map(dt):typeof i=="object"&&i?Ve(i,dt):i}const Ye={};function at(i){Ye[i]||(typeof console<"u"&&console.warn(i),Ye[i]=!0)}function Te(i,t,r){return(r.y-i.y)*(t.x-i.x)>(t.y-i.y)*(r.x-i.x)}function pt(i){return typeof WorkerGlobalScope<"u"&&i!==void 0&&i instanceof WorkerGlobalScope}let Xt=null;function Ii(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}const hs="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Nn(i,t,r,s,l){return d(this,void 0,void 0,(function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const h=new VideoFrame(i,{timestamp:0});try{const p=h==null?void 0:h.format;if(!p||!p.startsWith("BGR")&&!p.startsWith("RGB"))throw new Error(`Unrecognized format ${p}`);const f=p.startsWith("BGR"),g=new Uint8ClampedArray(s*l*4);if(yield h.copyTo(g,(function(v,b,S,E,M){const z=4*Math.max(-b,0),B=(Math.max(0,S)-S)*E*4+z,$=4*E,G=Math.max(0,b),le=Math.max(0,S);return{rect:{x:G,y:le,width:Math.min(v.width,b+E)-G,height:Math.min(v.height,S+M)-le},layout:[{offset:B,stride:$}]}})(i,t,r,s,l)),f)for(let v=0;v<g.length;v+=4){const b=g[v];g[v]=g[v+2],g[v+2]=b}return g}finally{h.close()}}))}let cn,Ai;const pr="AbortError";function qi(){return new Error(pr)}const ki={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Ei(i){return ki.REGISTERED_PROTOCOLS[i.substring(0,i.indexOf("://"))]}
5const Yn="global-dispatcher";class Zi extends Error{constructor(t,r,s,l){super(`AJAXError: ${r} (${t}): ${s}`),this.status=t,this.statusText=r,this.url=s,this.body=l}}const zi=()=>pt(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Zr=function(i,t){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){const s=Ei(i.url);if(s)return s(i,t);if(pt(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,targetMapId:Yn},t)}if(!(/^file:/.test(r=i.url)||/^file:/.test(zi())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return(function(s,l){return d(this,void 0,void 0,(function*(){const h=new Request(s.url,{method:s.method||"GET",body:s.body,credentials:s.credentials,headers:s.headers,cache:s.cache,referrer:zi(),signal:l.signal});s.type!=="json"||h.headers.has("Accept")||h.headers.set("Accept","application/json");const p=yield fetch(h);if(!p.ok){const v=yield p.blob();throw new Zi(p.status,p.statusText,s.url,v)}let f;f=s.type==="arrayBuffer"||s.type==="image"?p.arrayBuffer():s.type==="json"?p.json():p.text();const g=yield f;if(l.signal.aborted)throw qi();return{data:g,cacheControl:p.headers.get("Cache-Control"),expires:p.headers.get("Expires")}}))})(i,t);if(pt(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,mustQueue:!0,targetMapId:Yn},t)}var r;return(function(s,l){return new Promise(((h,p)=>{var f;const g=new XMLHttpRequest;g.open(s.method||"GET",s.url,!0),s.type!=="arrayBuffer"&&s.type!=="image"||(g.responseType="arraybuffer");for(const v in s.headers)g.setRequestHeader(v,s.headers[v]);s.type==="json"&&(g.responseType="text",!((f=s.headers)===null||f===void 0)&&f.Accept||g.setRequestHeader("Accept","application/json")),g.withCredentials=s.credentials==="include",g.onerror=()=>{p(new Error(g.statusText))},g.onload=()=>{if(!l.signal.aborted)if((g.status>=200&&g.status<300||g.status===0)&&g.response!==null){let v=g.response;if(s.type==="json")try{v=JSON.parse(g.response)}catch(b){return void p(b)}h({data:v,cacheControl:g.getResponseHeader("Cache-Control"),expires:g.getResponseHeader("Expires")})}else{const v=new Blob([g.response],{type:g.getResponseHeader("Content-Type")});p(new Zi(g.status,g.statusText,s.url,v))}},l.signal.addEventListener("abort",(()=>{g.abort(),p(qi())})),g.send(s.body)}))})(i,t)};function Vt(i){if(!i||i.indexOf("://")<=0||i.indexOf("data:image/")===0||i.indexOf("blob:")===0)return!0;const t=new URL(i),r=window.location;return t.protocol===r.protocol&&t.host===r.host}function Pi(i,t,r){r[i]&&r[i].indexOf(t)!==-1||(r[i]=r[i]||[],r[i].push(t))}function Ci(i,t,r){if(r&&r[i]){const s=r[i].indexOf(t);s!==-1&&r[i].splice(s,1)}}class Ar{constructor(t,r={}){ot(this,r),this.type=t}}class un extends Ar{constructor(t,r={}){super("error",ot({error:t},r))}}class Vn{on(t,r){return this._listeners=this._listeners||{},Pi(t,r,this._listeners),this}off(t,r){return Ci(t,r,this._listeners),Ci(t,r,this._oneTimeListeners),this}once(t,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},Pi(t,r,this._oneTimeListeners),this):new Promise((s=>this.once(t,s)))}fire(t,r){typeof t=="string"&&(t=new Ar(t,r||{}));const s=t.type;if(this.listens(s)){t.target=this;const l=this._listeners&&this._listeners[s]?this._listeners[s].slice():[];for(const f of l)f.call(this,t);const h=this._oneTimeListeners&&this._oneTimeListeners[s]?this._oneTimeListeners[s].slice():[];for(const f of h)Ci(s,f,this._oneTimeListeners),f.call(this,t);const p=this._eventedParent;p&&(ot(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),p.fire(t))}else t instanceof un&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,r){return this._eventedParent=t,this._eventedParentData=r,this}}var he
vendor: 30,949 bytes, line 5
5={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"enum",default:"mercator",values:{mercator:{},globe:{}}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const 
5hn=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function dn(i,t){const r={};for(const s in i)s!=="ref"&&(r[s]=i[s]);return hn.forEach((s=>{s in t&&(r[s]=t[s])})),r}function Ct(i,t){if(Array.isArray(i)){if(!Array.isArray(t)||i.length!==t.length)return!1;for(let r=0;r<i.length;r++)if(!Ct(i[r],t[r]))return!1;return!0}if(typeof i=="object"&&i!==null&&t!==null){if(typeof t!="object"||Object.keys(i).length!==Object.keys(t).length)return!1;for(const r in i)if(!Ct(i[r],t[r]))return!1;return!0}return i===t}function kt(i,t){i.push(t)}function ds(i,t,r){kt(r,{command:"addSource",args:[i,t[i]]})}function pn(i,t,r){kt(t,{command:"removeSource",args:[i]}),r[i]=!0}function di(i,t,r,s){pn(i,r,s),ds(i,t,r)}function Kn(i,t,r){let s;for(s in i[r])if(Object.prototype.hasOwnProperty.call(i[r],s)&&s!=="data"&&!Ct(i[r][s],t[r][s]))return!1;for(s in t[r])if(Object.prototype.hasOwnProperty.call(t[r],s)&&s!=="data"&&!Ct(i[r][s],t[r][s]))return!1;return!0}function fr(i,t,r,s,l,h){i=i||{},t=t||{};for(const p in i)Object.prototype.hasOwnProperty.call(i,p)&&(Ct(i[p],t[p])||r.push({command:h,args:[s,p,t[p],l]}));for(const p in t)Object.prototype.hasOwnProperty.call(t,p)&&!Object.prototype.hasOwnProperty.call(i,p)&&(Ct(i[p],t[p])||r.push({command:h,args:[s,p,t[p],l]}))}function ps(i){return i.id}function fs(i,t){return i[t.id]=t,i}class Ae{constructor(t,r,s,l){this.message=(t?`${t}: `:"")+s,l&&(this.identifier=l),r!=null&&r.__line__&&(this.line=r.__line__)}}function Gr(i,...t){for(const r of t)for(const s in r)i[s]=r[s];return i}
5class Gi extends Error{constructor(t,r){super(r),this.message=r,this.key=t}}class mr{constructor(t,r=[]){this.parent=t,this.bindings={};for(const[s,l]of r)this.bindings[s]=l}concat(t){return new mr(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const Rr={kind:"null"},Ce={kind:"number"},Tt={kind:"string"},it={kind:"boolean"},Ki={kind:"color"},Br={kind:"object"},ht={kind:"value"},gr={kind:"collator"},Fr={kind:"formatted"},Er={kind:"padding"},_r={kind:"resolvedImage"},Z={kind:"variableAnchorOffsetCollection"};function C(i,t){return{kind:"array",itemType:i,N:t}}function P(i){if(i.kind==="array"){const t=P(i.itemType);return typeof i.N=="number"?`array<${t}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${t}>`}return i.kind}const R=[Rr,Ce,Tt,it,Ki,Fr,Br,C(ht),Er,_r,Z];function U(i,t){if(t.kind==="error")return null;if(i.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!U(i.itemType,t.itemType))&&(typeof i.N!="number"||i.N===t.N))return null}else{if(i.kind===t.kind)return null;if(i.kind==="value"){for(const r of R)if(!U(r,t))return null}}return`Expected ${P(i)} but found ${P(t)} instead.`}function ee(i,t){return t.some((r=>r.kind===i.kind))}function re(i,t){return t.some((r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i))}function oe(i,t){return i.kind==="array"&&t.kind==="array"?i.itemType.kind===t.itemType.kind&&typeof i.N=="number":i.kind===t.kind}const X=.96422,fe=.82521,ve=4/29,ue=6/29,Ee=3*ue*ue,Xe=ue*ue*ue,rt=Math.PI/180,Bt=180/Math.PI;function wt(i){return(i%=360)<0&&(i+=360),i}function Ft([i,t,r,s]){let l,h;const p=yi((.2225045*(i=Et(i))+.7168786*(t=Et(t))+.0606169*(r=Et(r)))/1);i===t&&t===r?l=h=p:(l=yi((.4360747*i+.3850649*t+.1430804*r)/X),h=yi((.0139322*i+.0971045*t+.7141733*r)/fe));const f=116*p-16;return[f<0?0:f,500*(l-p),200*(p-h),s]}function Et(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function yi(i){return i>Xe?Math.pow(i,1/3):i/Ee+ve}function ai([i,t,r,s]){let l=(i+16)/116,h=isNaN(t)?l:l+t/500,p=isNaN(r)?l:l-r/200;return l=1*Zt(l),h=X*Zt(h),p=fe*Zt(p),[It(3.1338561*h-1.6168667*l-.4906146*p),It(-.9787684*h+1.9161415*l+.033454*p),It(.0719453*h-.2289914*l+1.4052427*p),s]}function It(i){return(i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055)<0?0:i>1?1:i}function Zt(i){return i>ue?i*i*i:Ee*(i-ve)}function Yt(i){return parseInt(i.padEnd(2,i),16)/255}function pi(i,t){return Di(t?i/100:i,0,1)}function Di(i,t,r){return Math.min(Math.max(t,i),r)}function vi(i){return!i.some(Number.isNaN)}const Hr={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],ol
5ive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class Gt{constructor(t,r,s,l=1,h=!0){this.r=t,this.g=r,this.b=s,this.a=l,h||(this.r*=l,this.g*=l,this.b*=l,l||this.overwriteGetter("rgb",[t,r,s,l]))}static parse(t){if(t instanceof Gt)return t;if(typeof t!="string")return;const r=(function(s){if((s=s.toLowerCase().trim())==="transparent")return[0,0,0,0];const l=Hr[s];if(l){const[p,f,g]=l;return[p/255,f/255,g/255,1]}if(s.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(s)){const p=s.length<6?1:2;let f=1;return[Yt(s.slice(f,f+=p)),Yt(s.slice(f,f+=p)),Yt(s.slice(f,f+=p)),Yt(s.slice(f,f+p)||"ff")]}if(s.startsWith("rgb")){const p=s.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(p){const[f,g,v,b,S,E,M,z,B,$,G,le]=p,te=[b||" ",M||" ",$].join("");if(te==="  "||te==="  /"||te===",,"||te===",,,"){const ae=[v,E,B].join(""),pe=ae==="%%%"?100:ae===""?255:0;if(pe){const be=[Di(+g/pe,0,1),Di(+S/pe,0,1),Di(+z/pe,0,1),G?pi(+G,le):1];if(vi(be))return be}}return}}const h=s.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(h){const[p,f,g,v,b,S,E,M,z]=h,B=[g||" ",b||" ",E].join("");if(B==="  "||B==="  /"||B===",,"||B===",,,"){const $=[+f,Di(+v,0,100),Di(+S,0,100),M?pi(+M,z):1];if(vi($))return(function([G,le,te,ae]){function pe(be){const Ne=(be+G/30)%12,lt=le*Math.min(te,1-te);return te-lt*Math.max(-1,Math.min(Ne-3,9-Ne,1))}return G=wt(G),le/=100,te/=100,[pe(0),pe(8),pe(4),ae]})($)}}})(t);return r?new Gt(...r,!1):void 0}get rgb(){const{r:t,g:r,b:s,a:l}=this,h=l||1/0;return this.overwriteGetter("rgb",[t/h,r/h,s/h,l])}get hcl(){return this.overwriteGetter("hcl",(function(t){const[r,s,l,h]=Ft(t),p=Math.sqrt(s*s+l*l);return[Math.round(1e4*p)?wt(Math.atan2(l,s)*Bt):NaN,p,r,h]})(this.rgb))}get lab(){return this.overwriteGetter("lab",Ft(this.rgb))}overwriteGetter(t,r){return Object.defineProperty(this,t,{value:r}),r}toString(){const[t,r,s,l]=this.rgb;return`rgba(${[t,r,s].map((h=>Math.round(255*h))).join(",")},${l})`}}Gt.black=new Gt(0,0,0,1),Gt.white=new Gt(1,1,1,1),Gt.transparent=new Gt(0,0,0,0),Gt.red=new Gt(1,0,0,1);class Ls{constructor(t,r,s){this.sensitivity=t?r?"variant":"case":r?"accent":"base",this.locale=s,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,r){return this.collator.compare(t,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Rs{constructor(t,r,s,l,h){this.text=t,this.image=r,this.scale=s,this.fontStack=l,this.textColor=h}}class Ji{constructor(t){this.sections=t}static fromString(t){return new Ji([new Rs(t,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some((t=>t.text.length!==0||t.image&&t.image.name.length!==0))}static factory(t){return t instanceof Ji?t:Ji.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map((t=>t.text)).join("")}}class yr{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof yr)return t;if(typeof t=="number")return new yr([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const r of t)if(typeof r!="number")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new yr(t)}}toString(){return JSON.stringify(this.values)}}const rl=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Pr{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Pr)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let r=0;r<t.length;r+=2){const s=t[r],l=t[r+1];
5if(typeof s!="string"||!rl.has(s)||!Array.isArray(l)||l.length!==2||typeof l[0]!="number"||typeof l[1]!="number")return}return new Pr(t)}}toString(){return JSON.stringify(this.values)}}class mi{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new mi({name:t,available:!1}):null}}function Hi(i,t,r,s){return typeof i=="number"&&i>=0&&i<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof r=="number"&&r>=0&&r<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[i,t,r,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[i,t,r,s]:[i,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function fn(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof Gt||i instanceof Ls||i instanceof Ji||i instanceof yr||i instanceof Pr||i instanceof mi)return!0;if(Array.isArray(i)){for(const t of i)if(!fn(t))return!1;return!0}if(typeof i=="object"){for(const t in i)if(!fn(i[t]))return!1;return!0}return!1}function zt(i){if(i===null)return Rr;if(typeof i=="string")return Tt;if(typeof i=="boolean")return it;if(typeof i=="number")return Ce;if(i instanceof Gt)return Ki;if(i instanceof Ls)return gr;if(i instanceof Ji)return Fr;if(i instanceof yr)return Er;if(i instanceof Pr)return Z;if(i instanceof mi)return _r;if(Array.isArray(i)){const t=i.length;let r;for(const s of i){const l=zt(s);if(r){if(r===l)continue;r=ht;break}r=l}return C(r||ht,t)}return Br}function Kt(i){const t=typeof i;return i===null?"":t==="string"||t==="number"||t==="boolean"?String(i):i instanceof Gt||i instanceof Ji||i instanceof yr||i instanceof Pr||i instanceof mi?i.toString():JSON.stringify(i)}class xi{constructor(t,r){this.type=t,this.value=r}static parse(t,r){if(t.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!fn(t[1]))return r.error("invalid value");const s=t[1];let l=zt(s);const h=r.expectedType;return l.kind!=="array"||l.N!==0||!h||h.kind!=="array"||typeof h.N=="number"&&h.N!==0||(l=h),new xi(l,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class ri{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const Un={string:Tt,number:Ce,boolean:it,object:Br};class Qi{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let s,l=1;const h=t[0];if(h==="array"){let f,g;if(t.length>2){const v=t[1];if(typeof v!="string"||!(v in Un)||v==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);f=Un[v],l++}else f=ht;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return r.error('The length argument to "array" must be a positive integer literal',2);g=t[2],l++}s=C(f,g)}else{if(!Un[h])throw new Error(`Types doesn't contain name = ${h}`);s=Un[h]}const p=[];for(;l<t.length;l++){const f=r.parse(t[l],l,ht);if(!f)return null;p.push(f)}return new Qi(s,p)}evaluate(t){for(let r=0;r<this.args.length;r++){const s=this.args[r].evaluate(t);if(!U(this.type,zt(s)))return s;if(r===this.args.length-1)throw new ri(`Expected value to be of type ${P(this.type)}, but found ${P(zt(s))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const ms={"to-boolean":it,"to-color":Ki,"to-number":Ce,"to-string":Tt};class bi{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");const s=t[0];if(!ms[s])throw new Error(`Can't parse ${s} as it is not part of the known types`);if((s==="to-boolean"||s==="to-string")&&t.length!==2)return r.error("Expected one argument.");const l=ms[s],h=[];for(let p=1;p<t.length;p++){const f=r.parse(t[p],p,ht);if(!f)return null;h.push(f)}return new bi(l,h)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let r,s;for(const l of this.args){if(r=l.evaluate(t),s=null,r instanceof Gt)return r;if(typeof r=="string"){const h=t.parseColor(r);if(h)return h}else if(Array.isArray(r)&&(s=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:Hi(r[0],r[1],r[2],r[3]),!s))return new Gt(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new ri(s||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(const s of this.args){r=s.evaluate(t);const l=yr.parse(r);if(l)return l}throw new ri(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(const s of this.args){r=s.evaluate(t);const l=Pr.parse(r);if(l)return l}throw new ri(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(const s of this.args){if(r=s.evaluate(t),r===null)return 0;const l=Number(r);
5if(!isNaN(l))return l}throw new ri(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return Ji.fromString(Kt(this.args[0].evaluate(t)));case"resolvedImage":return mi.fromString(Kt(this.args[0].evaluate(t)));default:return Kt(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const Wr=["Unknown","Point","LineString","Polygon"];class Xr{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Wr[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let r=this._parseColorCache[t];return r||(r=this._parseColorCache[t]=Gt.parse(t)),r}}class mn{constructor(t,r,s=[],l,h=new mr,p=[]){this.registry=t,this.path=s,this.key=s.map((f=>`[${f}]`)).join(""),this.scope=h,this.errors=p,this.expectedType=l,this._isConstant=r}parse(t,r,s,l,h={}){return r?this.concat(r,s,l)._parse(t,h):this._parse(t,h)}_parse(t,r){function s(l,h,p){return p==="assert"?new Qi(h,[l]):p==="coerce"?new bi(h,[l]):l}if(t!==null&&typeof t!="string"&&typeof t!="boolean"&&typeof t!="number"||(t=["literal",t]),Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const l=t[0];if(typeof l!="string")return this.error(`Expression name must be a string, but found ${typeof l} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const h=this.registry[l];if(h){let p=h.parse(t,this);if(!p)return null;if(this.expectedType){const f=this.expectedType,g=p.type;if(f.kind!=="string"&&f.kind!=="number"&&f.kind!=="boolean"&&f.kind!=="object"&&f.kind!=="array"||g.kind!=="value")if(f.kind!=="color"&&f.kind!=="formatted"&&f.kind!=="resolvedImage"||g.kind!=="value"&&g.kind!=="string")if(f.kind!=="padding"||g.kind!=="value"&&g.kind!=="number"&&g.kind!=="array")if(f.kind!=="variableAnchorOffsetCollection"||g.kind!=="value"&&g.kind!=="array"){if(this.checkSubtype(f,g))return null}else p=s(p,f,r.typeAnnotation||"coerce");else p=s(p,f,r.typeAnnotation||"coerce");else p=s(p,f,r.typeAnnotation||"coerce");else p=s(p,f,r.typeAnnotation||"assert")}if(!(p instanceof xi)&&p.type.kind!=="resolvedImage"&&this._isConstant(p)){const f=new Xr;try{p=new xi(p.type,p.evaluate(f))}catch(g){return this.error(g.message),null}}return p}return this.error(`Unknown expression "${l}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(t===void 0?"'undefined' value invalid. Use null instead.":typeof t=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,r,s){const l=typeof t=="number"?this.path.concat(t):this.path,h=s?this.scope.concat(s):this.scope;return new mn(this.registry,this._isConstant,l,r||null,h,this.errors)}error(t,...r){const s=`${this.key}${r.map((l=>`[${l}]`)).join("")}`;this.errors.push(new Gi(s,t))}checkSubtype(t,r){const s=U(t,r);return s&&this.error(s),s}}class Mn{constructor(t,r){this.type=r.type,this.bindings=[].concat(t),this.result=r}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const r of this.bindings)t(r[1]);t(this.result)}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const s=[];for(let h=1;h<t.length-1;h+=2){const p=t[h];if(typeof p!="string")return r.error(`Expected string, but found ${typeof p} instead.`,h);if(/[^a-zA-Z0-9_]/.test(p))return r.error("Variable names must contain only alphanumeric characters or '_'.",h);const f=r.parse(t[h+1],h+1);if(!f)return null;s.push([p,f])}const l=r.parse(t[t.length-1],t.length-1,r.expectedType,s);return l?new Mn(s,l):null}outputDefined(){return this.result.outputDefined()}}class Nt{constructor(t,r){this.type=r.type,this.name=t,this.boundExpression=r}
5static parse(t,r){if(t.length!==2||typeof t[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");const s=t[1];return r.scope.has(s)?new Nt(s,r.scope.get(s)):r.error(`Unknown variable "${s}". Make sure "${s}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class Bs{constructor(t,r,s){this.type=t,this.index=r,this.input=s}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const s=r.parse(t[1],1,Ce),l=r.parse(t[2],2,C(r.expectedType||ht));return s&&l?new Bs(l.type.itemType,s,l):null}evaluate(t){const r=this.index.evaluate(t),s=this.input.evaluate(t);if(r<0)throw new ri(`Array index out of bounds: ${r} < 0.`);if(r>=s.length)throw new ri(`Array index out of bounds: ${r} > ${s.length-1}.`);if(r!==Math.floor(r))throw new ri(`Array index must be an integer, but found ${r} instead.`);return s[r]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class wa{constructor(t,r){this.type=it,this.needle=t,this.haystack=r}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const s=r.parse(t[1],1,ht),l=r.parse(t[2],2,ht);return s&&l?ee(s.type,[it,Tt,Ce,Rr,ht])?new wa(s,l):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${P(s.type)} instead`):null}evaluate(t){const r=this.needle.evaluate(t),s=this.haystack.evaluate(t);if(!s)return!1;if(!re(r,["boolean","string","number","null"]))throw new ri(`Expected first argument to be of type boolean, string, number or null, but found ${P(zt(r))} instead.`);if(!re(s,["string","array"]))throw new ri(`Expected second argument to be of type array or string, but found ${P(zt(s))} instead.`);return s.indexOf(r)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class Jn{constructor(t,r,s){this.type=Ce,this.needle=t,this.haystack=r,this.fromIndex=s}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const s=r.parse(t[1],1,ht),l=r.parse(t[2],2,ht);if(!s||!l)return null;if(!ee(s.type,[it,Tt,Ce,Rr,ht]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${P(s.type)} instead`);if(t.length===4){const h=r.parse(t[3],3,Ce);return h?new Jn(s,l,h):null}return new Jn(s,l)}evaluate(t){const r=this.needle.evaluate(t),s=this.haystack.evaluate(t);if(!re(r,["boolean","string","number","null"]))throw new ri(`Expected first argument to be of type boolean, string, number or null, but found ${P(zt(r))} instead.`);let l;if(this.fromIndex&&(l=this.fromIndex.evaluate(t)),re(s,["string"])){const h=s.indexOf(r,l);return h===-1?-1:[...s.slice(0,h)].length}if(re(s,["array"]))return s.indexOf(r,l);throw new ri(`Expected second argument to be of type array or string, but found ${P(zt(s))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class Sa{constructor(t,r,s,l,h,p){this.inputType=t,this.type=r,this.input=s,this.cases=l,this.outputs=h,this.otherwise=p}static parse(t,r){if(t.length<5)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return r.error("Expected an even number of arguments.");let s,l;r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);const h={},p=[];for(let v=2;v<t.length-1;v+=2){let b=t[v];const S=t[v+1];Array.isArray(b)||(b=[b]);const E=r.concat(v);if(b.length===0)return E.error("Expected at least one branch label.");for(const z of b){if(typeof z!="number"&&typeof z!="string")return E.error("Branch labels must be numbers or strings.");if(typeof z=="number"&&Math.abs(z)>Number.MAX_SAFE_INTEGER)return E.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof z=="number"&&Math.floor(z)!==z)return E.error("Numeric branch labels must be integer values.");if(s){if(E.checkSubtype(s,zt(z)))return null}else s=zt(z);if(h[String(z)]!==void 0)return E.error("Branch labels must be unique.");h[String(z)]=p.length}const M=r.parse(S,v,l);if(!M)return null;l=l||M.type,p.push(M)}const f=r.parse(t[1],1,ht);if(!f)return null;const g=r.parse(t[t.length-1],t.length-1,l);return g?f.type.kind!=="value"&&r.concat(1).checkSubtype(s,f.type)?null:new Sa(s,l,f,h,p,g):null}evaluate(t){const r=this.input.evaluate(t);return(zt(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(t)}
5eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}}class Fs{constructor(t,r,s){this.type=t,this.branches=r,this.otherwise=s}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return r.error("Expected an odd number of arguments.");let s;r.expectedType&&r.expectedType.kind!=="value"&&(s=r.expectedType);const l=[];for(let p=1;p<t.length-1;p+=2){const f=r.parse(t[p],p,it);if(!f)return null;const g=r.parse(t[p+1],p+1,s);if(!g)return null;l.push([f,g]),s=s||g.type}const h=r.parse(t[t.length-1],t.length-1,s);if(!h)return null;if(!s)throw new Error("Can't infer output type");return new Fs(s,l,h)}evaluate(t){for(const[r,s]of this.branches)if(r.evaluate(t))return s.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[r,s]of this.branches)t(r),t(s);t(this.otherwise)}outputDefined(){return this.branches.every((([t,r])=>r.outputDefined()))&&this.otherwise.outputDefined()}}class Qn{constructor(t,r,s,l){this.type=t,this.input=r,this.beginIndex=s,this.endIndex=l}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const s=r.parse(t[1],1,ht),l=r.parse(t[2],2,Ce);if(!s||!l)return null;if(!ee(s.type,[C(ht),Tt,ht]))return r.error(`Expected first argument to be of type array or string, but found ${P(s.type)} instead`);if(t.length===4){const h=r.parse(t[3],3,Ce);return h?new Qn(s.type,s,l,h):null}return new Qn(s.type,s,l)}evaluate(t){const r=this.input.evaluate(t),s=this.beginIndex.evaluate(t);let l;if(this.endIndex&&(l=this.endIndex.evaluate(t)),re(r,["string"]))return[...r].slice(s,l).join("");if(re(r,["array"]))return r.slice(s,l);throw new ri(`Expected first argument to be of type array or string, but found ${P(zt(r))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function Os(i,t){const r=i.length-1;let s,l,h=0,p=r,f=0;for(;h<=p;)if(f=Math.floor((h+p)/2),s=i[f],l=i[f+1],s<=t){if(f===r||t<l)return f;h=f+1}else{if(!(s>t))throw new ri("Input is not a number.");p=f-1}return 0}class jn{constructor(t,r,s){this.type=t,this.input=r,this.labels=[],this.outputs=[];for(const[l,h]of s)this.labels.push(l),this.outputs.push(h)}static parse(t,r){if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");const s=r.parse(t[1],1,Ce);if(!s)return null;const l=[];let h=null;r.expectedType&&r.expectedType.kind!=="value"&&(h=r.expectedType);for(let p=1;p<t.length;p+=2){const f=p===1?-1/0:t[p],g=t[p+1],v=p,b=p+1;if(typeof f!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',v);if(l.length&&l[l.length-1][0]>=f)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',v);const S=r.parse(g,b,h);if(!S)return null;h=h||S.type,l.push([f,S])}return new jn(h,s,l)}evaluate(t){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(t);const l=this.input.evaluate(t);if(l<=r[0])return s[0].evaluate(t);const h=r.length;return l>=r[h-1]?s[h-1].evaluate(t):s[Os(r,l)].evaluate(t)}eachChild(t){t(this.input);for(const r of this.outputs)t(r)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function ro(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var nl=no;function no(i,t,r,s){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(s-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=t,this.p2x=r,this.p2y=s}no.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,t){if(t===void 0&&(t=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,s=0;s<8;s++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)<t)return r;var h=this.sampleCurveDerivativeX(r);if(Math.abs(h)<1e-6)break;r-=l/h}var p=0,f=1;for(r=i,s=0;s<20&&(l=this.sampleCurveX(r),!(Math.abs(l-i)<t));s++)i>l?p=r:f=r,r=.5*(f-p)+p;return r}
5,solve:function(i,t){return this.sampleCurveY(this.solveCurveX(i,t))}};var sl=ro(nl);function $n(i,t,r){return i+r*(t-i)}function es(i,t,r){return i.map(((s,l)=>$n(s,t[l],r)))}const er={number:$n,color:function(i,t,r,s="rgb"){switch(s){case"rgb":{const[l,h,p,f]=es(i.rgb,t.rgb,r);return new Gt(l,h,p,f,!1)}case"hcl":{const[l,h,p,f]=i.hcl,[g,v,b,S]=t.hcl;let E,M;if(isNaN(l)||isNaN(g))isNaN(l)?isNaN(g)?E=NaN:(E=g,p!==1&&p!==0||(M=v)):(E=l,b!==1&&b!==0||(M=h));else{let le=g-l;g>l&&le>180?le-=360:g<l&&l-g>180&&(le+=360),E=l+r*le}const[z,B,$,G]=(function([le,te,ae,pe]){return le=isNaN(le)?0:le*rt,ai([ae,Math.cos(le)*te,Math.sin(le)*te,pe])})([E,M??$n(h,v,r),$n(p,b,r),$n(f,S,r)]);return new Gt(z,B,$,G,!1)}case"lab":{const[l,h,p,f]=ai(es(i.lab,t.lab,r));return new Gt(l,h,p,f,!1)}}},array:es,padding:function(i,t,r){return new yr(es(i.values,t.values,r))},variableAnchorOffsetCollection:function(i,t,r){const s=i.values,l=t.values;if(s.length!==l.length)throw new ri(`Cannot interpolate values of different length. from: ${i.toString()}, to: ${t.toString()}`);const h=[];for(let p=0;p<s.length;p+=2){if(s[p]!==l[p])throw new ri(`Cannot interpolate values containing mismatched anchors. from[${p}]: ${s[p]}, to[${p}]: ${l[p]}`);h.push(s[p]);const[f,g]=s[p+1],[v,b]=l[p+1];h.push([$n(f,v,r),$n(g,b,r)])}return new Pr(h)}};class tr{constructor(t,r,s,l,h){this.type=t,this.operator=r,this.interpolation=s,this.input=l,this.labels=[],this.outputs=[];for(const[p,f]of h)this.labels.push(p),this.outputs.push(f)}static interpolationFactor(t,r,s,l){let h=0;if(t.name==="exponential")h=Ns(r,t.base,s,l);else if(t.name==="linear")h=Ns(r,1,s,l);else if(t.name==="cubic-bezier"){const p=t.controlPoints;h=new sl(p[0],p[1],p[2],p[3]).solve(Ns(r,1,s,l))}return h}static parse(t,r){let[s,l,h,...p]=t;if(!Array.isArray(l)||l.length===0)return r.error("Expected an interpolation type expression.",1);if(l[0]==="linear")l={name:"linear"};else if(l[0]==="exponential"){const v=l[1];if(typeof v!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);l={name:"exponential",base:v}}else{if(l[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(l[0])}`,1,0);{const v=l.slice(1);if(v.length!==4||v.some((b=>typeof b!="number"||b<0||b>1)))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);l={name:"cubic-bezier",controlPoints:v}}}if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(h=r.parse(h,2,Ce),!h)return null;const f=[];let g=null;s==="interpolate-hcl"||s==="interpolate-lab"?g=Ki:r.expectedType&&r.expectedType.kind!=="value"&&(g=r.expectedType);for(let v=0;v<p.length;v+=2){const b=p[v],S=p[v+1],E=v+3,M=v+4;if(typeof b!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',E);if(f.length&&f[f.length-1][0]>=b)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',E);const z=r.parse(S,M,g);if(!z)return null;g=g||z.type,f.push([b,z])}return oe(g,Ce)||oe(g,Ki)||oe(g,Er)||oe(g,Z)||oe(g,C(Ce))?new tr(g,s,l,h,f):r.error(`Type ${P(g)} is not interpolatable.`)}evaluate(t){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(t);const l=this.input.evaluate(t);if(l<=r[0])return s[0].evaluate(t);const h=r.length;if(l>=r[h-1])return s[h-1].evaluate(t);const p=Os(r,l),f=tr.interpolationFactor(this.interpolation,l,r[p],r[p+1]),g=s[p].evaluate(t),v=s[p+1].evaluate(t);switch(this.operator){case"interpolate":return er[this.type.kind](g,v,f);case"interpolate-hcl":return er.color(g,v,f,"hcl");case"interpolate-lab":return er.color(g,v,f,"lab")}}eachChild(t){t(this.input);for(const r of this.outputs)t(r)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function Ns(i,t,r,s){const l=s-r,h=i-r;return l===0?0:t===1?h/l:(Math.pow(t,h)-1)/(Math.pow(t,l)-1)}class Vs{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expectected at least one argument.");let s=null;const l=r.expectedType;l&&l.kind!=="value"&&(s=l);const h=[];for(const f of t.slice(1)){const g=r.parse(f,1+h.length,s,void 0,{typeAnnotation:"omit"});if(!g)return null;s=s||g.type,h.push(g)}if(!s)throw new Error("No output type");const p=l&&h.some((f=>U(l,f.type)));return new Vs(p?ht:s,h)}evaluate(t){let r,s=null,l=0;for(const h of this.args)if(l++,s=h.evaluate(t),s&&s instanceof mi&&!s.available&&(r||(r=s.name),s=null,l===this.args.length&&(s=r)),s!==null)break;return s}
5eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}function gs(i,t){return i==="=="||i==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function Ta(i,t,r,s){return s.compare(t,r)===0}function qn(i,t,r){const s=i!=="=="&&i!=="!=";return class ef{constructor(h,p,f){this.type=it,this.lhs=h,this.rhs=p,this.collator=f,this.hasUntypedArgument=h.type.kind==="value"||p.type.kind==="value"}static parse(h,p){if(h.length!==3&&h.length!==4)return p.error("Expected two or three arguments.");const f=h[0];let g=p.parse(h[1],1,ht);if(!g)return null;if(!gs(f,g.type))return p.concat(1).error(`"${f}" comparisons are not supported for type '${P(g.type)}'.`);let v=p.parse(h[2],2,ht);if(!v)return null;if(!gs(f,v.type))return p.concat(2).error(`"${f}" comparisons are not supported for type '${P(v.type)}'.`);if(g.type.kind!==v.type.kind&&g.type.kind!=="value"&&v.type.kind!=="value")return p.error(`Cannot compare types '${P(g.type)}' and '${P(v.type)}'.`);s&&(g.type.kind==="value"&&v.type.kind!=="value"?g=new Qi(v.type,[g]):g.type.kind!=="value"&&v.type.kind==="value"&&(v=new Qi(g.type,[v])));let b=null;if(h.length===4){if(g.type.kind!=="string"&&v.type.kind!=="string"&&g.type.kind!=="value"&&v.type.kind!=="value")return p.error("Cannot use collator to compare non-string types.");if(b=p.parse(h[3],3,gr),!b)return null}return new ef(g,v,b)}evaluate(h){const p=this.lhs.evaluate(h),f=this.rhs.evaluate(h);if(s&&this.hasUntypedArgument){const g=zt(p),v=zt(f);if(g.kind!==v.kind||g.kind!=="string"&&g.kind!=="number")throw new ri(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${g.kind}, ${v.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const g=zt(p),v=zt(f);if(g.kind!=="string"||v.kind!=="string")return t(h,p,f)}return this.collator?r(h,p,f,this.collator.evaluate(h)):t(h,p,f)}eachChild(h){h(this.lhs),h(this.rhs),this.collator&&h(this.collator)}outputDefined(){return!0}}}const al=qn("==",(function(i,t,r){return t===r}),Ta),so=qn("!=",(function(i,t,r){return t!==r}),(function(i,t,r,s){return!Ta(0,t,r,s)})),ao=qn("<",(function(i,t,r){return t<r}),(function(i,t,r,s){return s.compare(t,r)<0})),ts=qn(">",(function(i,t,r){return t>r}),(function(i,t,r,s){return s.compare(t,r)>0})),Or=qn("<=",(function(i,t,r){return t<=r}),(function(i,t,r,s){return s.compare(t,r)<=0})),oo=qn(">=",(function(i,t,r){return t>=r}),(function(i,t,r,s){return s.compare(t,r)>=0}));class _s{constructor(t,r,s){this.type=gr,this.locale=s,this.caseSensitive=t,this.diacriticSensitive=r}static parse(t,r){if(t.length!==2)return r.error("Expected one argument.");const s=t[1];if(typeof s!="object"||Array.isArray(s))return r.error("Collator options argument must be an object.");const l=r.parse(s["case-sensitive"]!==void 0&&s["case-sensitive"],1,it);if(!l)return null;const h=r.parse(s["diacritic-sensitive"]!==void 0&&s["diacritic-sensitive"],1,it);if(!h)return null;let p=null;return s.locale&&(p=r.parse(s.locale,1,Tt),!p)?null:new _s(l,h,p)}evaluate(t){return new Ls(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}class Ia{constructor(t,r,s,l,h){this.type=Tt,this.number=t,this.locale=r,this.currency=s,this.minFractionDigits=l,this.maxFractionDigits=h}static parse(t,r){if(t.length!==3)return r.error("Expected two arguments.");const s=r.parse(t[1],1,Ce);if(!s)return null;const l=t[2];if(typeof l!="object"||Array.isArray(l))return r.error("NumberFormat options argument must be an object.");let h=null;if(l.locale&&(h=r.parse(l.locale,1,Tt),!h))return null;let p=null;if(l.currency&&(p=r.parse(l.currency,1,Tt),!p))return null;let f=null;if(l["min-fraction-digits"]&&(f=r.parse(l["min-fraction-digits"],1,Ce),!f))return null;let g=null;return l["max-fraction-digits"]&&(g=r.parse(l["max-fraction-digits"],1,Ce),!g)?null:new Ia(s,h,p,f,g)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class Us{constructor(t){this.type=Fr,this.sections=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");const s=t[1];if(!Array.isArray(s)&&typeof s=="object")return r.error("First argument must be an image or text section.");const l=[];let h=!1;for(let p=1;p<=t.length-1;++p){const f=t[p];if(h&&typeof f=="object"&&!Array.isArray(f)){h=!1;let g=null;if(f["font-scale"]&&(g=r.parse(f["font-scale"],1,Ce),!g))return null;let v=null;if(f["text-font"]&&(v=r.parse(f["text-font"],1,C(Tt)),!v))return null;let b=null;if(f["text-color"]&&(b=r.parse(f["text-color"],1,Ki),!b))return null;const S=l[l.length-1];S.scale=g,S.font=v,S.textColor=b}else{const g=r.parse(t[p],1,ht);if(!g)return null;const v=g.type.kind;if(v!=="string"&&v!=="value"&&v!=="null"&&v!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");h=!0,l.push({content:g,scale:null,font:null,textColor:null})}}return new Us(l)}evaluate(t){return new Ji(this.sections.map((r=>{const s=r.content.evaluate(t);return zt(s)===_r?new Rs("",s,null,null,null):new Rs(Kt(s),null,r.scale?r.scale.evaluate(t):null,r.font?r.font.evaluate(t).join(","):null,r.textColor?r.textColor.evaluate(t):null)})))}eachChild(t){for(const r of this.sections)t(r.content),r.scale&&t(r.scale),r.font&&t(r.font),r.textColor&&t(r.textColor)}outputDefined(){return!1}}class js{constructor(t){this.type=_r,this.input=t}static parse(t,r){if(t.length!==2)return r.error("Expected two arguments.");const s=r.parse(t[1],1,Tt);return s?new js(s):r.error("No image name provided.")}evaluate(t){const r=this.input.evaluate(t),s=mi.fromString(r);return s&&t.availableImages&&(s.available=t.availableImages.indexOf(r)>-1),s}eachChild(t){t(this.input)}outputDefined(){return!1}}class $s{constructor(t){this.type=Ce,this.input=t}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);const s=r.parse(t[1],1);return s?s.type.kind!=="array"&&s.type.kind!=="string"&&s.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${P(s.type)} instead.`):new $s(s):null}evaluate(t){const r=this.input.evaluate(t);if(typeof r=="string")return[...r].length;if(Array.isArray(r))return r.length;throw new ri(`Expected value to be of type string or array, but found ${P(zt(r))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const Yr=8192;function Aa(i,t){const r=(180+i[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,l=Math.pow(2,t.z);return[Math.round(r*l*Yr),Math.round(s*l*Yr)]}function qs(i,t){const r=Math.pow(2,t.z);
5return[(l=(i[0]/Yr+t.x)/r,360*l-180),(s=(i[1]/Yr+t.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90)];var s,l}function kn(i,t){i[0]=Math.min(i[0],t[0]),i[1]=Math.min(i[1],t[1]),i[2]=Math.max(i[2],t[0]),i[3]=Math.max(i[3],t[1])}function zn(i,t){return!(i[0]<=t[0]||i[2]>=t[2]||i[1]<=t[1]||i[3]>=t[3])}function Ut(i,t,r){const s=i[0]-t[0],l=i[1]-t[1],h=i[0]-r[0],p=i[1]-r[1];return s*p-h*l==0&&s*h<=0&&l*p<=0}function Zs(i,t,r,s){return(l=[s[0]-r[0],s[1]-r[1]])[0]*(h=[t[0]-i[0],t[1]-i[1]])[1]-l[1]*h[0]!=0&&!(!St(i,t,r,s)||!St(r,s,i,t));var l,h}function N(i,t,r){for(const s of r)for(let l=0;l<s.length-1;++l)if(Zs(i,t,s[l],s[l+1]))return!0;return!1}function ie(i,t,r=!1){let s=!1;for(const f of t)for(let g=0;g<f.length-1;g++){if(Ut(i,f[g],f[g+1]))return r;(h=f[g])[1]>(l=i)[1]!=(p=f[g+1])[1]>l[1]&&l[0]<(p[0]-h[0])*(l[1]-h[1])/(p[1]-h[1])+h[0]&&(s=!s)}var l,h,p;return s}function me(i,t){for(const r of t)if(ie(i,r))return!0;return!1}function Pe(i,t){for(const r of i)if(!ie(r,t))return!1;for(let r=0;r<i.length-1;++r)if(N(i[r],i[r+1],t))return!1;return!0}function Be(i,t){for(const r of t)if(Pe(i,r))return!0;return!1}function St(i,t,r,s){const l=s[0]-r[0],h=s[1]-r[1],p=(i[0]-r[0])*h-l*(i[1]-r[1]),f=(t[0]-r[0])*h-l*(t[1]-r[1]);return p>0&&f<0||p<0&&f>0}function bt(i,t,r){const s=[];for(let l=0;l<i.length;l++){const h=[];for(let p=0;p<i[l].length;p++){const f=Aa(i[l][p],r);kn(t,f),h.push(f)}s.push(h)}return s}function ft(i,t,r){const s=[];for(let l=0;l<i.length;l++){const h=bt(i[l],t,r);s.push(h)}return s}function ir(i,t,r,s){if(i[0]<r[0]||i[0]>r[2]){const l=.5*s;let h=i[0]-r[0]>l?-s:r[0]-i[0]>l?s:0;h===0&&(h=i[0]-r[2]>l?-s:r[2]-i[0]>l?s:0),i[0]+=h}kn(t,i)}function Li(i,t,r,s){const l=Math.pow(2,s.z)*Yr,h=[s.x*Yr,s.y*Yr],p=[];for(const f of i)for(const g of f){const v=[g.x+h[0],g.y+h[1]];ir(v,t,r,l),p.push(v)}return p}function Kr(i,t,r,s){const l=Math.pow(2,s.z)*Yr,h=[s.x*Yr,s.y*Yr],p=[];for(const g of i){const v=[];for(const b of g){const S=[b.x+h[0],b.y+h[1]];kn(t,S),v.push(S)}p.push(v)}if(t[2]-t[0]<=l/2){(f=t)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const g of p)for(const v of g)ir(v,t,r,l)}var f;return p}class Jr{constructor(t,r){this.type=it,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(fn(t[1])){const s=t[1];if(s.type==="FeatureCollection"){const l=[];for(const h of s.features){const{type:p,coordinates:f}=h.geometry;p==="Polygon"&&l.push(f),p==="MultiPolygon"&&l.push(...f)}if(l.length)return new Jr(s,{type:"MultiPolygon",coordinates:l})}else if(s.type==="Feature"){const l=s.geometry.type;if(l==="Polygon"||l==="MultiPolygon")return new Jr(s,s.geometry)}else if(s.type==="Polygon"||s.type==="MultiPolygon")return new Jr(s,s)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return(function(r,s){const l=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(s.type==="Polygon"){const f=bt(s.coordinates,h,p),g=Li(r.geometry(),l,h,p);if(!zn(l,h))return!1;for(const v of g)if(!ie(v,f))return!1}if(s.type==="MultiPolygon"){const f=ft(s.coordinates,h,p),g=Li(r.geometry(),l,h,p);if(!zn(l,h))return!1;for(const v of g)if(!me(v,f))return!1}return!0})(t,this.geometries);if(t.geometryType()==="LineString")return(function(r,s){const l=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(s.type==="Polygon"){const f=bt(s.coordinates,h,p),g=Kr(r.geometry(),l,h,p);if(!zn(l,h))return!1;for(const v of g)if(!Pe(v,f))return!1}if(s.type==="MultiPolygon"){const f=ft(s.coordinates,h,p),g=Kr(r.geometry(),l,h,p);if(!zn(l,h))return!1;for(const v of g)if(!Be(v,f))return!1}return!0})(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Gs=class{constructor(i=[],t=((r,s)=>r<s?-1:r>s?1:0)){if(this.data=i,this.length=this.data.length,this.compare=t,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(i){this.data.push(i),this._up(this.length++)}pop(){if(this.length===0)return;const i=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),i}peek(){return this.data[0]}_up(i){const{data:t,compare:r}=this,s=t[i];for(;i>0;){const l=i-1>>1,h=t[l];if(r(s,h)>=0)break;t[i]=h,i=l}t[i]=s}_down(i){const{data:t,compare:r}=this,s=this.length>>1,l=t[i];for(;i<s;){let h=1+(i<<1);const p=h+1;if(p<this.length&&r(t[p],t[h])<0&&(h=p),r(t[h],l)>=0)break;t[i]=t[h],i=h}t[i]=l}};function ys(i,t,r,s,l){vr(i,t,r,s||i.length-1,l||is)}function vr(i,t,r,s,l){for(;s>r;){if(s-r>600){var h=s-r+1,p=t-r+1,f=Math.log(h),g=.5*Math.exp(2*f/3),v=.5*Math.sqrt(f*g*(h-g)/h)*(p-h/2<0?-1:1);vr(i,t,Math.max(r,Math.floor(t-p*g/h+v)),Math.min(s,Math.floor(t+(h-p)*g/h+v)),l)}var b=i[t],S=r,E=s;for(Oi(i,r,t),l(i[s],b)>0&&Oi(i,r,s);S<E;){for(Oi(i,S,E),S++,E--;l(i[S],b)<0;)S++;for(;l(i[E],b)>0;)E--}l(i[r],b)===0?Oi(i,r,E):Oi(i,++E,s),E<=t&&(r=E+1),t<=E&&(s=E-1)}}function Oi(i,t,r){var s=i[t];i[t]=i[r],i[r]=s}function is(i,t){return i<t?-1:i>t?1:0}function Ri(i,t){if(i.length<=1)return[i];const r=[];let s,l;for(const h of i){const p=vs(h);p!==0&&(h.area=Math.abs(p),l===void 0&&(l=p<0),l===p<0?(s&&r.push(s),s=[h]):s.push(h))}if(s&&r.push(s),t>1)for(let h=0;h<r.length;h++)r[h].length<=t||(ys(r[h],t,1,r[h].length-1,Qr),r[h]=r[h].slice(0,t));return r}function Qr(i,t){return t.area-i.area}function vs(i){let t=0;for(let r,s,l=0,h=i.length,p=h-1;l<h;p=l++)r=i[l],s=i[p],t+=(s.x-r.x)*(r.y+s.y);return t}const Ea=1/298.257223563,Dn=Ea*(2-Ea),pc=Math.PI/180;class ol{constructor(t){const r=6378.137*pc*1e3,s=Math.cos(t*pc),l=1/(1-Dn*(1-s*s)),h=Math.sqrt(l);this.kx=r*h*s,this.ky=r*h*l*(1-Dn)}distance(t,r){const s=this.wrap(t[0]-r[0])*this.kx,l=(t[1]-r[1])*this.ky;return Math.sqrt(s*s+l*l)}pointOnLine(t,r){let s,l,h,p,f=1/0;for(let g=0;g<t.length-1;g++){let v=t[g][0],b=t[g][1],S=this.wrap(t[g+1][0]-v)*this.kx,E=(t[g+1][1]-b)*this.ky,M=0;S===0&&E===0||(M=(this.wrap(r[0]-v)*this.kx*S+(r[1]-b)*this.ky*E)/(S*S+E*E),M>1?(v=t[g+1][0],b=t[g+1][1]):M>0&&(v+=S/this.kx*M,b+=E/this.ky*M)),S=this.wrap(r[0]-v)*this.kx,E=(r[1]-b)*this.ky;const z=S*S+E*E;z<f&&(f=z,s=v,l=b,h=g,p=M)}return{point:[s,l],index:h,t:Math.max(0,Math.min(1,p))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}function fc(i,t){return t[0]-i[0]}function lo(i){return i[1]-i[0]+1}function Zn(i,t){return i[1]>=i[0]&&i[1]<t}function ll(i,t){if(i[0]>
5i[1])return[null,null];const r=lo(i);if(t){if(r===2)return[i,null];const l=Math.floor(r/2);return[[i[0],i[0]+l],[i[0]+l,i[1]]]}if(r===1)return[i,null];const s=Math.floor(r/2)-1;return[[i[0],i[0]+s],[i[0]+s+1,i[1]]]}function cl(i,t){if(!Zn(t,i.length))return[1/0,1/0,-1/0,-1/0];const r=[1/0,1/0,-1/0,-1/0];for(let s=t[0];s<=t[1];++s)kn(r,i[s]);return r}function ul(i){const t=[1/0,1/0,-1/0,-1/0];for(const r of i)for(const s of r)kn(t,s);return t}function co(i){return i[0]!==-1/0&&i[1]!==-1/0&&i[2]!==1/0&&i[3]!==1/0}function hl(i,t,r){if(!co(i)||!co(t))return NaN;let s=0,l=0;return i[2]<t[0]&&(s=t[0]-i[2]),i[0]>t[2]&&(s=i[0]-t[2]),i[1]>t[3]&&(l=i[1]-t[3]),i[3]<t[1]&&(l=t[1]-i[3]),r.distance([0,0],[s,l])}function xs(i,t,r){const s=r.pointOnLine(t,i);return r.distance(i,s.point)}function dl(i,t,r,s,l){const h=Math.min(xs(i,[r,s],l),xs(t,[r,s],l)),p=Math.min(xs(r,[i,t],l),xs(s,[i,t],l));return Math.min(h,p)}function yu(i,t,r,s,l){if(!Zn(t,i.length)||!Zn(s,r.length))return 1/0;let h=1/0;for(let p=t[0];p<t[1];++p){const f=i[p],g=i[p+1];for(let v=s[0];v<s[1];++v){const b=r[v],S=r[v+1];if(Zs(f,g,b,S))return 0;h=Math.min(h,dl(f,g,b,S,l))}}return h}function wi(i,t,r,s,l){if(!Zn(t,i.length)||!Zn(s,r.length))return NaN;let h=1/0;for(let p=t[0];p<=t[1];++p)for(let f=s[0];f<=s[1];++f)if(h=Math.min(h,l.distance(i[p],r[f])),h===0)return h;return h}function vu(i,t,r){if(ie(i,t,!0))return 0;let s=1/0;for(const l of t){const h=l[0],p=l[l.length-1];if(h!==p&&(s=Math.min(s,xs(i,[p,h],r)),s===0))return s;const f=r.pointOnLine(l,i);if(s=Math.min(s,r.distance(i,f.point)),s===0)return s}return s}function Pt(i,t,r,s){if(!Zn(t,i.length))return NaN;for(let h=t[0];h<=t[1];++h)if(ie(i[h],r,!0))return 0;let l=1/0;for(let h=t[0];h<t[1];++h){const p=i[h],f=i[h+1];for(const g of r)for(let v=0,b=g.length,S=b-1;v<b;S=v++){const E=g[S],M=g[v];if(Zs(p,f,E,M))return 0;l=Math.min(l,dl(p,f,E,M,s))}}return l}function uo(i,t){for(const r of i)for(const s of r)if(ie(s,t,!0))return!0;return!1}function ni(i,t,r,s=1/0){const l=ul(i),h=ul(t);if(s!==1/0&&hl(l,h,r)>=s)return s;if(zn(l,h)){if(uo(i,t))return 0}else if(uo(t,i))return 0;let p=1/0;for(const f of i)for(let g=0,v=f.length,b=v-1;g<v;b=g++){const S=f[b],E=f[g];for(const M of t)for(let z=0,B=M.length,$=B-1;z<B;$=z++){const G=M[$],le=M[z];if(Zs(S,E,G,le))return 0;p=Math.min(p,dl(S,E,G,le,r))}}return p}function Qt(i,t,r,s,l,h){if(!h)return;const p=hl(cl(s,h),l,r);p<t&&i.push([p,h,[0,0]])}function bs(i,t,r,s,l,h,p){if(!h||!p)return;const f=hl(cl(s,h),cl(l,p),r);f<t&&i.push([f,h,p])}function Pa(i,t,r,s,l=1/0){let h=Math.min(s.distance(i[0],r[0][0]),l);if(h===0)return h;const p=new Gs([[0,[0,i.length-1],[0,0]]],fc),f=ul(r);for(;p.length>0;){const g=p.pop();if(g[0]>=h)continue;const v=g[1],b=t?50:100;if(lo(v)<=b){if(!Zn(v,i.length))return NaN;if(t){const S=Pt(i,v,r,s);if(isNaN(S)||S===0)return S;h=Math.min(h,S)}else for(let S=v[0];S<=v[1];++S){const E=vu(i[S],r,s);if(h=Math.min(h,E),h===0)return 0}}else{const S=ll(v,t);Qt(p,h,s,i,f,S[0]),Qt(p,h,s,i,f,S[1])}}return h}function Ca(i,t,r,s,l,h=1/0){let p=Math.min(h,l.distance(i[0],r[0]));if(p===0)return p;const f=new Gs([[0,[0,i.length-1],[0,r.length-1]]],fc);for(;f.length>0;){const g=f.pop();if(g[0]>=p)continue;const v=g[1],b=g[2],S=t?50:100,E=s?50:100;if(lo(v)<=S&&lo(b)<=E){if(!Zn(v,i.length)&&Zn(b,r.length))return NaN;let M;if(t&&s)M=yu(i,v,r,b,l),p=Math.min(p,M);else if(t&&!s){const z=i.slice(v[0],v[1]+1);for(let B=b[0];B<=b[1];++B)if(M=xs(r[B],z,l),p=Math.min(p,M),p===0)return p}else if(!t&&s){const z=r.slice(b[0],b[1]+1);for(let B=v[0];B<=v[1];++B)if(M=xs(i[B],z,l),p=Math.min(p,M),p===0)return p}else M=wi(i,v,r,b,l),p=Math.min(p,M)}else{const M=ll(v,t),z=ll(b,s);bs(f,p,l,i,r,M[0],z[0]),bs(f,p,l,i,r,M[0],z[1]),bs(f,p,l,i,r,M[1],z[0]),bs(f,p,l,i,r,M[1],z[1])}}return p}function pl(i){return i.type==="MultiPolygon"?i.coordinates.map((t=>({type:"Polygon",coordinates:t}))):i.type==="MultiLineString"?i.coordinates.map((t=>({type:"LineString",coordinates:t}))):i.type==="MultiPoint"?i.coordinates.map((t=>({type:"Point",coordinates:t}))):[i]}class ws{constructor(t,r){this.type=Ce,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(fn(t[1])){const s=t[1];if(s.type==="FeatureCollection")return new ws(s,s.features.map((l=>pl(l.geometry))).flat());if(s.type==="Feature")return new ws(s,pl(s.geometry));if("type"in s&&"coordinates"in s)return new ws(s,pl(s))}return r.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return(function(r,s){const l=r.geometry(),h=l.flat().map((g=>qs([g.x,g.y],r.canonical)));if(l.length===0)return NaN;const p=new ol(h[0][1]);let f=1/0;for(const g of s){switch(g.type){case"Point":f=Math.min(f,Ca(h,!1,[g.coordinates],!1,p,f));break;case"LineString":f=Math.min(f,Ca(h,!1,g.coordinates,!0,p,f));break;case"Polygon":f=Math.min(f,Pa(h,!1,g.coordinates,p,f))}if(f===0)return f}return f})(t,this.geometries);if(t.geometryType()==="LineString")return(function(r,s){const l=r.geometry(),h=l.flat().map((g=>qs([g.x,g.y],r.canonical)));if(l.length===0)return NaN;const p=new ol(h[0][1]);let f=1/0;for(const g of s){switch(g.type){case"Point":f=Math.min(f,Ca(h,!0,[g.coordinates],!1,p,f));break;case"LineString":f=Math.min(f,Ca(h,!0,g.coordinates,!0,p,f));break;case"Polygon":f=Math.min(f,Pa(h,!0,g.coordinates,p,f))}if(f===0)return f}return f})(t,this.geometries);if(t.geometryType()==="Polygon")return(function(r,s){const l=r.geometry();if(l.length===0||l[0].length===0)return NaN;const h=Ri(l,0).map((g=>g.map((v=>v.map((b=>qs([b.x,b.y],r.canonical))))))),p=new ol(h[0][0][0][1]);let f=1/0;for(const g of s)for(const v of h){switch(g.type){case"Point":f=Math.min(f,Pa([g.coordinates],!1,v,p,f));break;case"LineString":f=Math.min(f,Pa(g.coordinates,!0,v,p,f));break;case"Polygon":f=Math.min(f,ni(v,g.coordinates,p,f))}if(f===0)return f}return f})(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const Hs={"==":al,"!=":so,">":ts,"<":ao,">=":oo,"<=":Or,array:Qi,at:Bs,boolean:Qi,case:Fs,coalesce:Vs,collator:_s,format:Us,image:js,in:wa,"index-of":Jn,interpolate:tr,"interpolate-hcl":tr,"interpolate-lab":tr,length:$s,let:Mn,literal:xi,match:Sa,number:Qi,"number-format":Ia,object:Qi,slice:Qn,step:jn,string:Qi,"to-boolean":bi,"to-color":bi,"to-number":bi,"to-string":bi,var:Nt,within:Jr,distance:ws};class en{constructor(t,r,s,l){this.name=t,this.type=r,this._evaluate=s,this.args=l}evaluate(t){return this._evaluate(t,this.args)}
5eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,r){const s=t[0],l=en.definitions[s];if(!l)return r.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0);const h=Array.isArray(l)?l[0]:l.type,p=Array.isArray(l)?[[l[1],l[2]]]:l.overloads,f=p.filter((([v])=>!Array.isArray(v)||v.length===t.length-1));let g=null;for(const[v,b]of f){g=new mn(r.registry,Ma,r.path,null,r.scope);const S=[];let E=!1;for(let M=1;M<t.length;M++){const z=t[M],B=Array.isArray(v)?v[M-1]:v.type,$=g.parse(z,1+S.length,B);if(!$){E=!0;break}S.push($)}if(!E)if(Array.isArray(v)&&v.length!==S.length)g.error(`Expected ${v.length} arguments, but found ${S.length} instead.`);else{for(let M=0;M<S.length;M++){const z=Array.isArray(v)?v[M]:v.type,B=S[M];g.concat(M+1).checkSubtype(z,B.type)}if(g.errors.length===0)return new en(s,h,b,S)}}if(f.length===1)r.errors.push(...g.errors);else{const v=(f.length?f:p).map((([S])=>{return E=S,Array.isArray(E)?`(${E.map(P).join(", ")})`:`(${P(E.type)}...)`;var E})).join(" | "),b=[];for(let S=1;S<t.length;S++){const E=r.parse(t[S],1+b.length);if(!E)return null;b.push(P(E.type))}r.error(`Expected arguments of type ${v}, but found (${b.join(", ")}) instead.`)}return null}static register(t,r){en.definitions=r;for(const s in r)t[s]=en}}function fl(i,[t,r,s,l]){t=t.evaluate(i),r=r.evaluate(i),s=s.evaluate(i);const h=l?l.evaluate(i):1,p=Hi(t,r,s,h);if(p)throw new ri(p);return new Gt(t/255,r/255,s/255,h,!1)}function ml(i,t){return i in t}function gl(i,t){const r=t[i];return r===void 0?null:r}function Ss(i){return{type:i}}function Ma(i){if(i instanceof Nt)return Ma(i.boundExpression);if(i instanceof en&&i.name==="error"||i instanceof _s||i instanceof Jr||i instanceof ws)return!1;const t=i instanceof bi||i instanceof Qi;let r=!0;return i.eachChild((s=>{r=t?r&&Ma(s):r&&s instanceof xi})),!!r&&ka(i)&&za(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function ka(i){if(i instanceof en&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||/^filter-/.test(i.name))||i instanceof Jr||i instanceof ws)return!1;let t=!0;return i.eachChild((r=>{t&&!ka(r)&&(t=!1)})),t}function Ws(i){if(i instanceof en&&i.name==="feature-state")return!1;let t=!0;return i.eachChild((r=>{t&&!Ws(r)&&(t=!1)})),t}function za(i,t){if(i instanceof en&&t.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild((s=>{r&&!za(s,t)&&(r=!1)})),r}function ho(i){return{result:"success",value:i}}function Xs(i){return{result:"error",value:i}}function Ys(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function mc(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function _l(i){return!!i.expression&&i.expression.interpolated}function jt(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function po(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function xu(i){return i}function gc(i,t){const r=t.type==="color",s=i.stops&&typeof i.stops[0][0]=="object",l=s||!(s||i.property!==void 0),h=i.type||(_l(t)?"exponential":"interval");if(r||t.type==="padding"){const b=r?Gt.parse:yr.parse;(i=Gr({},i)).stops&&(i.stops=i.stops.map((S=>[S[0],b(S[1])]))),i.default=b(i.default?i.default:t.default)}if(i.colorSpace&&(p=i.colorSpace)!=="rgb"&&p!=="hcl"&&p!=="lab")throw new Error(`Unknown color space: "${i.colorSpace}"`);var p;let f,g,v;if(h==="exponential")f=yc;else if(h==="interval")f=fo;else if(h==="categorical"){f=_c,g=Object.create(null);for(const b of i.stops)g[b[0]]=b[1];v=typeof i.stops[0][0]}else{if(h!=="identity")throw new Error(`Unknown function type "${h}"`);f=vc}if(s){const b={},S=[];for(let z=0;z<i.stops.length;z++){const B=i.stops[z],$=B[0].zoom;b[$]===void 0&&(b[$]={zoom:$,type:i.type,property:i.property,default:i.default,stops:[]},S.push($)),b[$].stops.push([B[0].value,B[1]])}const E=[];for(const z of S)E.push([b[z].zoom,gc(b[z],t)]);const M={name:"linear"};return{kind:"composite",interpolationType:M,interpolationFactor:tr.interpolationFactor.bind(void 0,M),zoomStops:E.map((z=>
5z[0])),evaluate:({zoom:z},B)=>yc({stops:E,base:i.base},t,z).evaluate(z,B)}}if(l){const b=h==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:b,interpolationFactor:tr.interpolationFactor.bind(void 0,b),zoomStops:i.stops.map((S=>S[0])),evaluate:({zoom:S})=>f(i,t,S,g,v)}}return{kind:"source",evaluate(b,S){const E=S&&S.properties?S.properties[i.property]:void 0;return E===void 0?Ks(i.default,t.default):f(i,t,E,g,v)}}}function Ks(i,t,r){return i!==void 0?i:t!==void 0?t:r!==void 0?r:void 0}function _c(i,t,r,s,l){return Ks(typeof r===l?s[r]:void 0,i.default,t.default)}function fo(i,t,r){if(jt(r)!=="number")return Ks(i.default,t.default);const s=i.stops.length;if(s===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[s-1][0])return i.stops[s-1][1];const l=Os(i.stops.map((h=>h[0])),r);return i.stops[l][1]}function yc(i,t,r){const s=i.base!==void 0?i.base:1;if(jt(r)!=="number")return Ks(i.default,t.default);const l=i.stops.length;if(l===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[l-1][0])return i.stops[l-1][1];const h=Os(i.stops.map((b=>b[0])),r),p=(function(b,S,E,M){const z=M-E,B=b-E;return z===0?0:S===1?B/z:(Math.pow(S,B)-1)/(Math.pow(S,z)-1)})(r,s,i.stops[h][0],i.stops[h+1][0]),f=i.stops[h][1],g=i.stops[h+1][1],v=er[t.type]||xu;return typeof f.evaluate=="function"?{evaluate(...b){const S=f.evaluate.apply(void 0,b),E=g.evaluate.apply(void 0,b);if(S!==void 0&&E!==void 0)return v(S,E,p,i.colorSpace)}}:v(f,g,p,i.colorSpace)}function vc(i,t,r){switch(t.type){case"color":r=Gt.parse(r);break;case"formatted":r=Ji.fromString(r.toString());break;case"resolvedImage":r=mi.fromString(r.toString());break;case"padding":r=yr.parse(r);break;default:jt(r)===t.type||t.type==="enum"&&t.values[r]||(r=void 0)}return Ks(r,i.default,t.default)}en.register(Hs,{error:[{kind:"error"},[Tt],(i,[t])=>{throw new ri(t.evaluate(i))}],typeof:[Tt,[ht],(i,[t])=>P(zt(t.evaluate(i)))],"to-rgba":[C(Ce,4),[Ki],(i,[t])=>{const[r,s,l,h]=t.evaluate(i).rgb;return[255*r,255*s,255*l,h]}],rgb:[Ki,[Ce,Ce,Ce],fl],rgba:[Ki,[Ce,Ce,Ce,Ce],fl],has:{type:it,overloads:[[[Tt],(i,[t])=>ml(t.evaluate(i),i.properties())],[[Tt,Br],(i,[t,r])=>ml(t.evaluate(i),r.evaluate(i))]]},get:{type:ht,overloads:[[[Tt],(i,[t])=>gl(t.evaluate(i),i.properties())],[[Tt,Br],(i,[t,r])=>gl(t.evaluate(i),r.evaluate(i))]]},"feature-state":[ht,[Tt],(i,[t])=>gl(t.evaluate(i),i.featureState||{})],properties:[Br,[],i=>i.properties()],"geometry-type":[Tt,[],i=>i.geometryType()],id:[ht,[],i=>i.id()],zoom:[Ce,[],i=>i.globals.zoom],"heatmap-density":[Ce,[],i=>i.globals.heatmapDensity||0],"line-progress":[Ce,[],i=>i.globals.lineProgress||0],accumulated:[ht,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Ce,Ss(Ce),(i,t)=>{let r=0;for(const s of t)r+=s.evaluate(i);return r}],"*":[Ce,Ss(Ce),(i,t)=>{let r=1;for(const s of t)r*=s.evaluate(i);return r}],"-":{type:Ce,overloads:[[[Ce,Ce],(i,[t,r])=>t.evaluate(i)-r.evaluate(i)],[[Ce],(i,[t])=>-t.evaluate(i)]]},"/":[Ce,[Ce,Ce],(i,[t,r])=>t.evaluate(i)/r.evaluate(i)],"%":[Ce,[Ce,Ce],(i,[t,r])=>t.evaluate(i)%r.evaluate(i)],ln2:[Ce,[],()=>Math.LN2],pi:[Ce,[],()=>Math.PI],e:[Ce,[],()=>Math.E],"^":[Ce,[Ce,Ce],(i,[t,r])=>Math.pow(t.evaluate(i),r.evaluate(i))],sqrt:[Ce,[Ce],(i,[t])=>Math.sqrt(t.evaluate(i))],log10:[Ce,[Ce],(i,[t])=>Math.log(t.evaluate(i))/Math.LN10],ln:[Ce,[Ce],(i,[t])=>Math.log(t.evaluate(i))],log2:[Ce,[Ce],(i,[t])=>Math.log(t.evaluate(i))/Math.LN2],sin:[Ce,[Ce],(i,[t])=>Math.sin(t.evaluate(i))],cos:[Ce,[Ce],(i,[t])=>Math.cos(t.evaluate(i))],tan:[Ce,[Ce],(i,[t])=>Math.tan(t.evaluate(i))],asin:[Ce,[Ce],(i,[t])=>Math.asin(t.evaluate(i))],acos:[Ce,[Ce],(i,[t])=>Math.acos(t.evaluate(i))],atan:[Ce,[Ce],(i,[t])=>Math.atan(t.evaluate(i))],min:[Ce,Ss(Ce),(i,t)=>Math.min(...t.map((r=>r.evaluate(i))))],max:[Ce,Ss(Ce),(i,t)=>Math.max(...t.map((r=>r.evaluate(i))))],abs:[Ce,[Ce],(i,[t])=>Math.abs(t.evaluate(i))],round:[Ce,[Ce],(i,[t])=>{const r=t.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[Ce,[Ce],(i,[t])=>Math.floor(t.evaluate(i))],ceil:[Ce,[Ce],(i,[t])=>Math.ceil(t.evaluate(i))],"filter-==":[it,[Tt,ht],(i,[t,r])=>i.properties()[t.value]===r.value],"filter-id-==":[it,[ht],(i,[t])=>i.id()===t.value],"filter-type-==":[it,[Tt],(i,[t])=>i.geometryType()===t.value],"filter-<":[it,[Tt,ht],(i,[t,r])=>{const s=i.properties()[t.value],l=r.value;return typeof s==typeof l&&s<l}],"filter-id-<":[it,[ht],(i,[t])=>{const r=i.id(),s=t.value;return typeof r==typeof s&&r<s}],"filter->":[it,[Tt,ht],(i,[t,r])=>{const s=i.properties()[t.value],l=r.value;return typeof s==typeof l&&s>l}],"filter-id->":[it,[ht],(i,[t])=>{const r=i.id(),s=t.value;return typeof r==typeof s&&r>s}],"filter-<=":[it,[Tt,ht],(i,[t,r])=>{const s=i.properties()[t.value],l=r.value;return typeof s==typeof l&&s<=l}],"filter-id-<=":[it,[ht],(i,[t])=>{const r=i.id(),s=t.value;return typeof r==typeof s&&r<=s}],"filter->=":[it,[Tt,ht],(i,[t,r])=>{const s=i.properties()[t.value],l=r.value;return typeof s==typeof l&&s>=l}],"filter-id->=":[it,[ht],(i,[t])=>{const r=i.id(),s=t.value;return typeof r==typeof s&&r>=s}],"filter-has":[it,[ht],(i,[t])=>t.value in i.properties()],"filter-has-id":[it,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[it,[C(Tt)],(i,[t])=>t.value.indexOf(i.geometryType())>=0],"filter-id-in":[it,[C(ht)],(i,[t])=>t.value.indexOf(i.id())>=0],"filter-in-small":[it,[Tt,C(ht)],(i,[t,r])=>r.value.indexOf(i.properties()[t.value])>=0],"filter-in-large":[it,[Tt,C(ht)],(i,[t,r])=>(function(s,l,h,p){for(;h<=p;){const f=h+p>>1;if(l[f]===s)return!0;l[f]>s?p=f-1:h=f+1}return!1})(i.properties()[t.value],r.value,0,r.value.length-1)],all:{type:it,overloads:[[[it,it],(i,[t,r])=>t.evaluate(i)&&r.evaluate(i)],[Ss(it),(i,t)=>{for(const r of t)if(!r.evaluate(i))return!1;return!0}]]},any:{type:it,overloads:[[[it,it],(i,[t,r])=>t.evaluate(i)||r.evaluate(i)],[Ss(it),(i,t)=>{for(const r of t)if(r.evaluate(i))return!0;return!1}]]},"!":[it,[it],(i,[t])=>!t.evaluate(i)],"is-supported-script":[it,[Tt],(i,[t])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(t.evaluate(i))}],upcase:[Tt,[Tt],(i,[t])=>t.evaluate(i).toUpperCase()],downcase:[Tt,[Tt],(i,[t])=>t.evaluate(i).toLowerCase()],concat:[Tt,Ss(ht),(i,t)=>t.map((r=>Kt(r.evaluate(i)))).join("")],"resolved-locale":[Tt,[gr],(i,[t])=>t.evaluate(i).resolvedLocale()]});class mo{constructor(t,r){var s;this.expression=t,this._warningHistory={},this._evaluator=new Xr,this._defaultValue=r?(s=r).type==="color"&&po(s.default)?new Gt(0,0,0,0):s.type==="color"?Gt.parse(s.default)||null:s.type==="padding"?yr.parse(s.default)||null:s.type==="variableAnchorOffsetCollection"?Pr.parse(s.default)||null:s.default===void 0?null:s.default:null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(t,r,s,l,h,p){return this._evaluator.globals=t,this._evaluator.feature=r,this._evaluator.featureState=s,this._evaluator.canonical=l,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=p,this.expression.evaluate(this._evaluator)}evaluate(t,r,s,l,h,p){this._evaluator.globals=t,this._evaluator.feature=r||null,this._evaluator.featureState=s||null,this._evaluator.canonical=l,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=p||null;try{const f=this.expression.evaluate(this._evaluator);if(f==null||typeof f=="number"&&f!=f)return this._defaultValue;if(this._enumValues&&!(f in this._enumValues))throw new ri(`Expected value to be one of ${Object.keys(this._enumValues).map((g=>JSON.stringify(g))).join(", ")}, but found ${JSON.stringify(f)} instead.`);return f}catch(f){return this._warningHistory[f.message]||(this._warningHistory[f.message]=!0,typeof console<"u"&&console.warn(f.message)),this._defaultValue}}}function go(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in Hs}function Js(i,t){const r=new mn(Hs,Ma,[],t?(function(l){const h={color:Ki,string:Tt,number:Ce,enum:Tt,boolean:it,formatted:Fr,padding:Er,resolvedImage:_r,variableAnchorOffsetCollection:Z};return l.type==="array"?C(h[l.value]||ht,l.length):h[l.type]})(t):void 0),s=r.parse(i,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?ho(new mo(s,t)):Xs(r.errors)}class Qs{constructor(t,r){this.kind=t,this._styleExpression=r,this.isStateDependent=t!=="constant"&&!Ws(r.expression)}evaluateWithoutErrorHandling(t,r,s,l,h,p){return this._styleExpression.evaluateWithoutErrorHandling(t,r,s,l,h,p)}evaluate(t,r,s,l,h,p){return this._styleExpression.evaluate(t,r,s,l,h,p)}}class ea{constructor(t,r,s,l){this.kind=t,this.zoomStops=s,this._styleExpression=r,this.isStateDependent=t!=="camera"&&!Ws(r.expression),this.interpolationType=l}evaluateWithoutErrorHandling(t,r,s,l,h,p){return this._styleExpression.evaluateWithoutErrorHandling(t,r,s,l,h,p)}evaluate(t,r,s,l,h,p){return this._styleExpression.evaluate(t,r,s,l,h,p)}interpolationFactor(t,r,s){return this.interpolationType?tr.interpolationFactor(this.interpolationType,t,r,s):0}}function yl(i,t){const r=Js(i,t);if(r.result==="error")return r;const s=r.value.expression,l=ka(s);if(!l&&!Ys(t))return Xs([new Gi("","data expressions not supported")]);const h=za(s,["zoom"]);if(!h&&!mc(t))return Xs([new Gi("","zoom expressions not supported")]);const p=Da(s);return p||h?p instanceof Gi?Xs([p]):p instanceof tr&&!_l(t)?Xs([new Gi("",'"interpolate" expressions cannot be used with this property')]):ho(p?new ea(l?"camera":"composite",r.value,p.labels,p instanceof tr?p.interpolation:void 0):new Qs(l?"constant":"source",r.value)):Xs([new Gi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class ta{constructor(t,r){this._parameters=t,this._specification=r,Gr(this,gc(this._parameters,this._specification))}static deserialize(t){return new ta(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Da(i){let t=null;if(i instanceof Mn)t=Da(i.result);else if(i instanceof Vs){for(const r of i.args)if(t=Da(r),t)break}else(i instanceof jn||i instanceof tr)&&i.input instanceof en&&i.input.name==="zoom"&&(t=i);return t instanceof Gi||i.eachChild((r=>{const s=Da(r);s instanceof Gi?t=s:!t&&s?t=new Gi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&s&&t!==s&&(t=new Gi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),t}function _o(i){if(i===!0||i===!1)return!0;
5if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const t of i.slice(1))if(!_o(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}const yo={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function vl(i){if(i==null)return{filter:()=>!0,needGeometry:!1};_o(i)||(i=vo(i));const t=Js(i,yo);if(t.result==="error")throw new Error(t.value.map((r=>`${r.key}: ${r.message}`)).join(", "));return{filter:(r,s,l)=>t.value.evaluate(r,s,{},l),needGeometry:xc(i)}}function bu(i,t){return i<t?-1:i>t?1:0}function xc(i){if(!Array.isArray(i))return!1;if(i[0]==="within"||i[0]==="distance")return!0;for(let t=1;t<i.length;t++)if(xc(i[t]))return!0;return!1}function vo(i){if(!i)return!0;const t=i[0];return i.length<=1?t!=="any":t==="=="?xl(i[1],i[2],"=="):t==="!="?rr(xl(i[1],i[2],"==")):t==="<"||t===">"||t==="<="||t===">="?xl(i[1],i[2],t):t==="any"?(r=i.slice(1),["any"].concat(r.map(vo))):t==="all"?["all"].concat(i.slice(1).map(vo)):t==="none"?["all"].concat(i.slice(1).map(vo).map(rr)):t==="in"?La(i[1],i.slice(2)):t==="!in"?rr(La(i[1],i.slice(2))):t==="has"?Ra(i[1]):t!=="!has"||rr(Ra(i[1]));var r}function xl(i,t,r){switch(i){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,i,t]}}function La(i,t){if(t.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some((r=>typeof r!=typeof t[0]))?["filter-in-large",i,["literal",t.sort(bu)]]:["filter-in-small",i,["literal",t]]}}function Ra(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function rr(i){return["!",i]}function Ts(i){const t=typeof i;if(t==="number"||t==="boolean"||t==="string"||i==null)return JSON.stringify(i);if(Array.isArray(i)){let l="[";for(const h of i)l+=`${Ts(h)},`;return`${l}]`}const r=Object.keys(i).sort();let s="{";for(let l=0;l<r.length;l++)s+=`${JSON.stringify(r[l])}:${Ts(i[r[l]])},`;return`${s}}`}function bc(i){let t="";for(const r of hn)t+=`/${Ts(i[r])}`;return t}function wc(i){const t=i.value;return t?[new Ae(i.key,t,"constants have been deprecated as of v8")]:[]}function Si(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function gn(i){if(Array.isArray(i))return i.map(gn);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const t={};for(const r in i)t[r]=gn(i[r]);return t}return Si(i)}function Nr(i){const t=i.key,r=i.value,s=i.valueSpec||{},l=i.objectElementValidators||{},h=i.style,p=i.styleSpec,f=i.validateSpec;let g=[];const v=jt(r);if(v!=="object")return[new Ae(t,r,`object expected, ${v} found`)];for(const b in r){const S=b.split(".")[0],E=s[S]||s["*"];let M;if(l[S])M=l[S];else if(s[S])M=f;else if(l["*"])M=l["*"];else{if(!s["*"]){g.push(new Ae(t,r[b],`unknown property "${b}"`));continue}M=f}g=g.concat(M({key:(t&&`${t}.`)+b,value:r[b],valueSpec:E,style:h,styleSpec:p,object:r,objectKey:b,validateSpec:f},r))}for(const b in s)l[b]||s[b].required&&s[b].default===void 0&&r[b]===void 0&&g.push(new Ae(t,r,`missing required property "${b}"`));return g}function Ba(i){const t=i.value,r=i.valueSpec,s=i.style,l=i.styleSpec,h=i.key,p=i.arrayElementValidator||i.validateSpec;if(jt(t)!=="array")return[new Ae(h,t,`array expected, ${jt(t)} found`)];if(r.length&&t.length!==r.length)return[new Ae(h,t,`array length ${r.length} expected, length ${t.length} found`)];if(r["min-length"]&&t.length<r["min-length"])return[new Ae(h,t,`array length at least ${r["min-length"]} expected, length ${t.length} found`)];let f={type:r.value,values:r.values};l.$version<7&&(f.function=r.function),jt(r.value)==="object"&&(f=r.value);let g=[];for(let v=0;v<t.length;v++)g=g.concat(p({array:t,arrayIndex:v,value:t[v],valueSpec:f,validateSpec:i.validateSpec,style:s,styleSpec:l,key:`${h}[${v}]`}));return g}function bl(i){const t=i.key,r=i.value,s=i.valueSpec;let l=jt(r);return l==="number"&&r!=r&&(l="NaN"),l!=="number"?[new Ae(t,r,`number expected, ${l}
5 found`)]:"minimum"in s&&r<s.minimum?[new Ae(t,r,`${r} is less than the minimum value ${s.minimum}`)]:"maximum"in s&&r>s.maximum?[new Ae(t,r,`${r} is greater than the maximum value ${s.maximum}`)]:[]}function xo(i){const t=i.valueSpec,r=Si(i.value.type);let s,l,h,p={};const f=r!=="categorical"&&i.value.property===void 0,g=!f,v=jt(i.value.stops)==="array"&&jt(i.value.stops[0])==="array"&&jt(i.value.stops[0][0])==="object",b=Nr({key:i.key,value:i.value,valueSpec:i.styleSpec.function,validateSpec:i.validateSpec,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(M){if(r==="identity")return[new Ae(M.key,M.value,'identity function may not have a "stops" property')];let z=[];const B=M.value;return z=z.concat(Ba({key:M.key,value:B,valueSpec:M.valueSpec,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec,arrayElementValidator:S})),jt(B)==="array"&&B.length===0&&z.push(new Ae(M.key,B,"array must have at least one stop")),z},default:function(M){return M.validateSpec({key:M.key,value:M.value,valueSpec:t,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec})}}});return r==="identity"&&f&&b.push(new Ae(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||b.push(new Ae(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!_l(i.valueSpec)&&b.push(new Ae(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(g&&!Ys(i.valueSpec)?b.push(new Ae(i.key,i.value,"property functions not supported")):f&&!mc(i.valueSpec)&&b.push(new Ae(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!v||i.value.property!==void 0||b.push(new Ae(i.key,i.value,'"property" property is required')),b;function S(M){let z=[];const B=M.value,$=M.key;if(jt(B)!=="array")return[new Ae($,B,`array expected, ${jt(B)} found`)];if(B.length!==2)return[new Ae($,B,`array length 2 expected, length ${B.length} found`)];if(v){if(jt(B[0])!=="object")return[new Ae($,B,`object expected, ${jt(B[0])} found`)];if(B[0].zoom===void 0)return[new Ae($,B,"object stop key must have zoom")];if(B[0].value===void 0)return[new Ae($,B,"object stop key must have value")];if(h&&h>Si(B[0].zoom))return[new Ae($,B[0].zoom,"stop zoom values must appear in ascending order")];Si(B[0].zoom)!==h&&(h=Si(B[0].zoom),l=void 0,p={}),z=z.concat(Nr({key:`${$}[0]`,value:B[0],valueSpec:{zoom:{}},validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec,objectElementValidators:{zoom:bl,value:E}}))}else z=z.concat(E({key:`${$}[0]`,value:B[0],validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec},B));return go(gn(B[1]))?z.concat([new Ae(`${$}[1]`,B[1],"expressions are not allowed in function stops.")]):z.concat(M.validateSpec({key:`${$}[1]`,value:B[1],valueSpec:t,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec}))}function E(M,z){const B=jt(M.value),$=Si(M.value),G=M.value!==null?M.value:z;if(s){if(B!==s)return[new Ae(M.key,G,`${B} stop domain type must match previous stop domain type ${s}`)]}else s=B;if(B!=="number"&&B!=="string"&&B!=="boolean")return[new Ae(M.key,G,"stop domain value must be a number, string, or boolean")];if(B!=="number"&&r!=="categorical"){let le=`number expected, ${B} found`;return Ys(t)&&r===void 0&&(le+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ae(M.key,G,le)]}return r!=="categorical"||B!=="number"||isFinite($)&&Math.floor($)===$?r!=="categorical"&&B==="number"&&l!==void 0&&$<l?[new Ae(M.key,G,"stop domain values must appear in ascending order")]:(l=$,r==="categorical"&&$ in p?[new Ae(M.key,G,"stop domain values must be unique")]:(p[$]=!0,[])):[new Ae(M.key,G,`integer expected, found ${$}`)]}}function ia(i){const t=(i.expressionContext==="property"?yl:Js)(gn(i.value),i.valueSpec);if(t.result==="error")return t.value.map((s=>new Ae(`${i.key}${s.key}`,i.value,s.message)));const r=t.value.expression||t.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new Ae(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!Ws(r))return[new Ae(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!Ws(r))return[new Ae(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!za(r,["zoom","feature-state"]))return[new Ae(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!ka(r))return[new Ae(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Gn(i){const t=i.key,r=i.value,s=i.valueSpec,l=[];return Array.isArray(s.values)?s.values.indexOf(Si(r))===-1&&l.push(new Ae(t,r,`expected one of [${s.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(s.values).indexOf(Si(r))===-1&&l.push(new Ae(t,r,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(r)} found`)),l}function wl(i){return _o(gn(i.value))?ia(Gr({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):bo(i)}function bo(i){const t=i.value,r=i.key;if(jt(t)!=="array")return[new Ae(r,t,`array expected, ${jt(t)} found`)];const s=i.styleSpec;let l,h=[];if(t.length<1)return[new Ae(r,t,"filter array must have at least 1 element")];switch(h=h.concat(Gn({key:`${r}[0]`,value:t[0],valueSpec:s.filter_operator,style:i.style,styleSpec:i.styleSpec})),Si(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&Si(t[1])==="$type"&&h.push(new Ae(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&h.push(new Ae(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(l=jt(t[1]),l!=="string"&&h.push(new Ae(`${r}[1]`,t[1],`string expected, ${l}
5 found`)));for(let p=2;p<t.length;p++)l=jt(t[p]),Si(t[1])==="$type"?h=h.concat(Gn({key:`${r}[${p}]`,value:t[p],valueSpec:s.geometry_type,style:i.style,styleSpec:i.styleSpec})):l!=="string"&&l!=="number"&&l!=="boolean"&&h.push(new Ae(`${r}[${p}]`,t[p],`string, number, or boolean expected, ${l} found`));break;case"any":case"all":case"none":for(let p=1;p<t.length;p++)h=h.concat(bo({key:`${r}[${p}]`,value:t[p],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":l=jt(t[1]),t.length!==2?h.push(new Ae(r,t,`filter array for "${t[0]}" operator must have 2 elements`)):l!=="string"&&h.push(new Ae(`${r}[1]`,t[1],`string expected, ${l} found`))}return h}function Sl(i,t){const r=i.key,s=i.validateSpec,l=i.style,h=i.styleSpec,p=i.value,f=i.objectKey,g=h[`${t}_${i.layerType}`];if(!g)return[];const v=f.match(/^(.*)-transition$/);if(t==="paint"&&v&&g[v[1]]&&g[v[1]].transition)return s({key:r,value:p,valueSpec:h.transition,style:l,styleSpec:h});const b=i.valueSpec||g[f];if(!b)return[new Ae(r,p,`unknown property "${f}"`)];let S;if(jt(p)==="string"&&Ys(b)&&!b.tokens&&(S=/^{([^}]+)}$/.exec(p)))return[new Ae(r,p,`"${f}" does not support interpolation syntax
6Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(S[1])} }\`.`)];const E=[];return i.layerType==="symbol"&&(f==="text-field"&&l&&!l.glyphs&&E.push(new Ae(r,p,'use of "text-field" requires a style "glyphs" property')),f==="text-font"&&po(gn(p))&&Si(p.type)==="identity"&&E.push(new Ae(r,p,'"text-font" does not support identity functions'))),E.concat(s({key:i.key,value:p,valueSpec:b,style:l,styleSpec:h,expressionContext:"property",propertyType:t,propertyKey:f}))}function wo(i){return Sl(i,"paint")}function Tl(i){return Sl(i,"layout")}function Il(i){let t=[];const r=i.value,s=i.key,l=i.style,h=i.styleSpec;r.type||r.ref||t.push(new Ae(s,r,'either "type" or "ref" is required'));let p=Si(r.type);const f=Si(r.ref);if(r.id){const g=Si(r.id);for(let v=0;v<i.arrayIndex;v++){const b=l.layers[v];Si(b.id)===g&&t.push(new Ae(s,r.id,`duplicate layer id "${r.id}", previously used at line ${b.id.__line__}`))}}if("ref"in r){let g;["type","source","source-layer","filter","layout"].forEach((v=>{v in r&&t.push(new Ae(s,r[v],`"${v}" is prohibited for ref layers`))})),l.layers.forEach((v=>{Si(v.id)===f&&(g=v)})),g?g.ref?t.push(new Ae(s,r.ref,"ref cannot reference another ref layer")):p=Si(g.type):t.push(new Ae(s,r.ref,`ref layer "${f}" not found`))}else if(p!=="background")if(r.source){const g=l.sources&&l.sources[r.source],v=g&&Si(g.type);g?v==="vector"&&p==="raster"?t.push(new Ae(s,r.source,`layer "${r.id}" requires a raster source`)):v!=="raster-dem"&&p==="hillshade"?t.push(new Ae(s,r.source,`layer "${r.id}" requires a raster-dem source`)):v==="raster"&&p!=="raster"?t.push(new Ae(s,r.source,`layer "${r.id}" requires a vector source`)):v!=="vector"||r["source-layer"]?v==="raster-dem"&&p!=="hillshade"?t.push(new Ae(s,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):p!=="line"||!r.paint||!r.paint["line-gradient"]||v==="geojson"&&g.lineMetrics||t.push(new Ae(s,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new Ae(s,r,`layer "${r.id}" must specify a "source-layer"`)):t.push(new Ae(s,r.source,`source "${r.source}" not found`))}else t.push(new Ae(s,r,'missing required property "source"'));return t=t.concat(Nr({key:s,value:r,valueSpec:h.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${s}.type`,value:r.type,valueSpec:h.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:r,objectKey:"type"}),filter:wl,layout:g=>Nr({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":v=>Tl(Gr({layerType:p},v))}}),paint:g=>Nr({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":v=>wo(Gr({layerType:p},v))}})}})),t}function Is(i){const t=i.value,r=i.key,s=jt(t);return s!=="string"?[new Ae(r,t,`string expected, ${s} found`)]:[]}const So={promoteId:function({key:i,value:t}
6){if(jt(t)==="string")return Is({key:i,value:t});{const r=[];for(const s in t)r.push(...Is({key:`${i}.${s}`,value:t[s]}));return r}}};function Fa(i){const t=i.value,r=i.key,s=i.styleSpec,l=i.style,h=i.validateSpec;if(!t.type)return[new Ae(r,t,'"type" is required')];const p=Si(t.type);let f;switch(p){case"vector":case"raster":return f=Nr({key:r,value:t,valueSpec:s[`source_${p.replace("-","_")}`],style:i.style,styleSpec:s,objectElementValidators:So,validateSpec:h}),f;case"raster-dem":return f=(function(g){var v;const b=(v=g.sourceName)!==null&&v!==void 0?v:"",S=g.value,E=g.styleSpec,M=E.source_raster_dem,z=g.style;let B=[];const $=jt(S);if(S===void 0)return B;if($!=="object")return B.push(new Ae("source_raster_dem",S,`object expected, ${$} found`)),B;const G=Si(S.encoding)==="custom",le=["redFactor","greenFactor","blueFactor","baseShift"],te=g.value.encoding?`"${g.value.encoding}"`:"Default";for(const ae in S)!G&&le.includes(ae)?B.push(new Ae(ae,S[ae],`In "${b}": "${ae}" is only valid when "encoding" is set to "custom". ${te} encoding found`)):M[ae]?B=B.concat(g.validateSpec({key:ae,value:S[ae],valueSpec:M[ae],validateSpec:g.validateSpec,style:z,styleSpec:E})):B.push(new Ae(ae,S[ae],`unknown property "${ae}"`));return B})({sourceName:r,value:t,style:i.style,styleSpec:s,validateSpec:h}),f;case"geojson":if(f=Nr({key:r,value:t,valueSpec:s.source_geojson,style:l,styleSpec:s,validateSpec:h,objectElementValidators:So}),t.cluster)for(const g in t.clusterProperties){const[v,b]=t.clusterProperties[g],S=typeof v=="string"?[v,["accumulated"],["get",g]]:v;f.push(...ia({key:`${r}.${g}.map`,value:b,expressionContext:"cluster-map"})),f.push(...ia({key:`${r}.${g}.reduce`,value:S,expressionContext:"cluster-reduce"}))}return f;case"video":return Nr({key:r,value:t,valueSpec:s.source_video,style:l,validateSpec:h,styleSpec:s});case"image":return Nr({key:r,value:t,valueSpec:s.source_image,style:l,validateSpec:h,styleSpec:s});case"canvas":return[new Ae(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Gn({key:`${r}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Al(i){const t=i.value,r=i.styleSpec,s=r.light,l=i.style;let h=[];const p=jt(t);if(t===void 0)return h;if(p!=="object")return h=h.concat([new Ae("light",t,`object expected, ${p} found`)]),h;for(const f in t){const g=f.match(/^(.*)-transition$/);h=h.concat(g&&s[g[1]]&&s[g[1]].transition?i.validateSpec({key:f,value:t[f],valueSpec:r.transition,validateSpec:i.validateSpec,style:l,styleSpec:r}):s[f]?i.validateSpec({key:f,value:t[f],valueSpec:s[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new Ae(f,t[f],`unknown property "${f}"`)])}return h}function El(i){const t=i.value,r=i.styleSpec,s=r.sky,l=i.style,h=jt(t);if(t===void 0)return[];if(h!=="object")return[new Ae("sky",t,`object expected, ${h} found`)];let p=[];for(const f in t)p=p.concat(s[f]?i.validateSpec({key:f,value:t[f],valueSpec:s[f],style:l,styleSpec:r}):[new Ae(f,t[f],`unknown property "${f}"`)]);return p}function Pl(i){const t=i.value,r=i.styleSpec,s=r.terrain,l=i.style;let h=[];const p=jt(t);if(t===void 0)return h;if(p!=="object")return h=h.concat([new Ae("terrain",t,`object expected, ${p} found`)]),h;for(const f in t)h=h.concat(s[f]?i.validateSpec({key:f,value:t[f],valueSpec:s[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new Ae(f,t[f],`unknown property "${f}"`)]);return h}function Cl(i){let t=[];const r=i.value,s=i.key;if(Array.isArray(r)){const l=[],h=[];for(const p in r)r[p].id&&l.includes(r[p].id)&&t.push(new Ae(s,r,`all the sprites' ids must be unique, but ${r[p].id} is duplicated`)),l.push(r[p].id),r[p].url&&h.includes(r[p].url)&&t.push(new Ae(s,r,`all the sprites' URLs must be unique, but ${r[p].url} is duplicated`)),h.push(r[p].url),t=t.concat(Nr({key:`${s}[${p}]`,value:r[p],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return t}return Is({key:s,value:r})}const To={"*":()=>[],array:Ba,boolean:function(i){const t=i.value,r=i.key,s=jt(t);return s!=="boolean"?[new Ae(r,t,`boolean expected, ${s} found`)]:[]},number:bl,color:function(i){const t=i.key,r=i.value,s=jt(r);return s!=="string"?[new Ae(t,r,`color expected, ${s} found`)]:Gt.parse(String(r))?[]:[new Ae(t,r,`color expected, "${r}" found`)]},constants:wc,enum:Gn,filter:wl,function:xo,layer:Il,object:Nr,source:Fa,light:Al,sky:El,terrain:Pl,projection:function(i){const t=i.value,r=i.styleSpec,s=r.projection,l=i.style,h=jt(t);if(t===void 0)return[];if(h!=="object")return[new Ae("projection",t,`object expected, ${h} found`)];let p=[];for(const f in t)p=p.concat(s[f]?i.validateSpec({key:f,value:t[f],valueSpec:s[f],style:l,styleSpec:r}):[new Ae(f,t[f],`unknown property "${f}
6"`)]);return p},string:Is,formatted:function(i){return Is(i).length===0?[]:ia(i)},resolvedImage:function(i){return Is(i).length===0?[]:ia(i)},padding:function(i){const t=i.key,r=i.value;if(jt(r)==="array"){if(r.length<1||r.length>4)return[new Ae(t,r,`padding requires 1 to 4 values; ${r.length} values found`)];const s={type:"number"};let l=[];for(let h=0;h<r.length;h++)l=l.concat(i.validateSpec({key:`${t}[${h}]`,value:r[h],validateSpec:i.validateSpec,valueSpec:s}));return l}return bl({key:t,value:r,valueSpec:{}})},variableAnchorOffsetCollection:function(i){const t=i.key,r=i.value,s=jt(r),l=i.styleSpec;if(s!=="array"||r.length<1||r.length%2!=0)return[new Ae(t,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let h=[];for(let p=0;p<r.length;p+=2)h=h.concat(Gn({key:`${t}[${p}]`,value:r[p],valueSpec:l.layout_symbol["text-anchor"]})),h=h.concat(Ba({key:`${t}[${p+1}]`,value:r[p+1],valueSpec:{length:2,value:"number"},validateSpec:i.validateSpec,style:i.style,styleSpec:l}));return h},sprite:Cl};function Oa(i){const t=i.value,r=i.valueSpec,s=i.styleSpec;return i.validateSpec=Oa,r.expression&&po(Si(t))?xo(i):r.expression&&go(gn(t))?ia(i):r.type&&To[r.type]?To[r.type](i):Nr(Gr({},i,{valueSpec:r.type?s[r.type]:r}))}function Sc(i){const t=i.value,r=i.key,s=Is(i);return s.length||(t.indexOf("{fontstack}")===-1&&s.push(new Ae(r,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&s.push(new Ae(r,t,'"glyphs" url must include a "{range}" token'))),s}function tn(i,t=he){let r=[];return r=r.concat(Oa({key:"",value:i,valueSpec:t.$root,styleSpec:t,style:i,validateSpec:Oa,objectElementValidators:{glyphs:Sc,"*":()=>[]}})),i.constants&&(r=r.concat(wc({key:"constants",value:i.constants}))),Ml(r)}function Ln(i){return function(t){return i({...t,validateSpec:Oa})}}function Ml(i){return[].concat(i).sort(((t,r)=>t.line-r.line))}function _n(i){return function(...t){return Ml(i.apply(this,t))}}tn.source=_n(Ln(Fa)),tn.sprite=_n(Ln(Cl)),tn.glyphs=_n(Ln(Sc)),tn.light=_n(Ln(Al)),tn.sky=_n(Ln(El)),tn.terrain=_n(Ln(Pl)),tn.layer=_n(Ln(Il)),tn.filter=_n(Ln(wl)),tn.paintProperty=_n(Ln(wo)),tn.layoutProperty=_n(Ln(Tl));const As=tn,wu=As.light,Su=As.sky,Tc=As.paintProperty,Ic=As.layoutProperty;function kl(i,t){let r=!1;if(t&&t.length)for(const s of t)i.fire(new un(new Error(s.message))),r=!0;return r}class ra{constructor(t,r,s){const l=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const p=new Int32Array(this.arrayBuffer);t=p[0],this.d=(r=p[1])+2*(s=p[2]);for(let g=0;g<this.d*this.d;g++){const v=p[3+g],b=p[3+g+1];l.push(v===b?null:p.subarray(v,b))}const f=p[3+l.length+1];this.keys=p.subarray(p[3+l.length],f),this.bboxes=p.subarray(f),this.insert=this._insertReadonly}else{this.d=r+2*s;for(let p=0;p<this.d*this.d;p++)l.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=t,this.padding=s,this.scale=r/t,this.uid=0;const h=s/r*t;this.min=-h,this.max=t+h}insert(t,r,s,l,h){this._forEachCell(r,s,l,h,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(r),this.bboxes.push(s),this.bboxes.push(l),this.bboxes.push(h)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,r,s,l,h,p){this.cells[h].push(p)}query(t,r,s,l,h){const p=this.min,f=this.max;if(t<=p&&r<=p&&f<=s&&f<=l&&!h)return Array.prototype.slice.call(this.keys);{const g=[];return this._forEachCell(t,r,s,l,this._queryCell,g,{},h),g}}_queryCell(t,r,s,l,h,p,f,g){const v=this.cells[h];if(v!==null){const b=this.keys,S=this.bboxes;for(let E=0;E<v.length;E++){const M=v[E];if(f[M]===void 0){const z=4*M;(g?g(S[z+0],S[z+1],S[z+2],S[z+3]):t<=S[z+2]&&r<=S[z+3]&&s>=S[z+0]&&l>=S[z+1])?(f[M]=!0,p.push(b[M])):f[M]=!1}}}}_forEachCell(t,r,s,l,h,p,f,g){const v=this._convertToCellCoord(t),b=this._convertToCellCoord(r),S=this._convertToCellCoord(s),E=this._convertToCellCoord(l);for(let M=v;M<=S;M++)for(let z=b;z<=E;z++){const B=this.d*z+M;if((!g||g(this._convertFromCellCoord(M),this._convertFromCellCoord(z),this._convertFromCellCoord(M+1),this._convertFromCellCoord(z+1)))&&h.call(this,t,r,s,l,B,p,f,g))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,r=3+this.cells.length+1+1;let s=0;for(let p=0;p<this.cells.length;p++)s+=this.cells[p].length;const l=new Int32Array(r+s+this.keys.length+this.bboxes.length);l[0]=this.extent,l[1]=this.n,l[2]=this.padding;let h=r;for(let p=0;p<t.length;p++){const f=t[p];l[3+p]=h,l.set(f,h),h+=f.length}return l[3+t.length]=h,l.set(this.keys,h),h+=this.keys.length,l[3+t.length+1]=h,l.set(this.bboxes,h),h+=this.bboxes.length,l.buffer}static serialize(t,r){const s=t.toArrayBuffer();return r&&r.push(s),{buffer:s}}static deserialize(t){return new ra(t.buffer)}}const rn={};function $e(i,t,r={}){if(rn[i])throw new Error(`${i} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:i,writeable:!1}
6),rn[i]={klass:t,omit:r.omit||[],shallow:r.shallow||[]}}$e("Object",Object),$e("TransferableGridIndex",ra),$e("Color",Gt),$e("Error",Error),$e("AJAXError",Zi),$e("ResolvedImage",mi),$e("StylePropertyFunction",ta),$e("StyleExpression",mo,{omit:["_evaluator"]}),$e("ZoomDependentExpression",ea),$e("ZoomConstantExpression",Qs),$e("CompoundExpression",en,{omit:["_evaluate"]});for(const i in Hs)Hs[i]._classRegistryKey||$e(`Expression_${i}`,Hs[i]);function Io(i){return i&&typeof ArrayBuffer<"u"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function zl(i){return i.$name||i.constructor._classRegistryKey}function Ac(i){return!(function(t){if(t===null||typeof t!="object")return!1;const r=zl(t);return!(!r||r==="Object")})(i)&&(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||i instanceof Error||Io(i)||Ii(i)||ArrayBuffer.isView(i)||i instanceof ImageData)}function na(i,t){if(Ac(i))return(Io(i)||Ii(i))&&t&&t.push(i),ArrayBuffer.isView(i)&&t&&t.push(i.buffer),i instanceof ImageData&&t&&t.push(i.data.buffer),i;if(Array.isArray(i)){const h=[];for(const p of i)h.push(na(p,t));return h}if(typeof i!="object")throw new Error("can't serialize object of type "+typeof i);const r=zl(i);if(!r)throw new Error(`can't serialize object of unregistered class ${i.constructor.name}`);if(!rn[r])throw new Error(`${r} is not registered.`);const{klass:s}=rn[r],l=s.serialize?s.serialize(i,t):{};if(s.serialize){if(t&&l===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const h in i){if(!i.hasOwnProperty(h)||rn[r].omit.indexOf(h)>=0)continue;const p=i[h];l[h]=rn[r].shallow.indexOf(h)>=0?p:na(p,t)}i instanceof Error&&(l.message=i.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(l.$name=r),l}function sa(i){if(Ac(i))return i;if(Array.isArray(i))return i.map(sa);if(typeof i!="object")throw new Error("can't deserialize object of type "+typeof i);const t=zl(i)||"Object";if(!rn[t])throw new Error(`can't deserialize unregistered class ${t}`);const{klass:r}=rn[t];if(!r)throw new Error(`can't deserialize unregistered class ${t}`);if(r.deserialize)return r.deserialize(i);const s=Object.create(r.prototype);for(const l of Object.keys(i)){if(l==="$name")continue;const h=i[l];s[l]=rn[t].shallow.indexOf(l)>=0?h:sa(h)}return s}class Dl{constructor(){this.first=!0}update(t,r){const s=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=s,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=s,!0):(this.lastFloorZoom>s?(this.lastIntegerZoom=s+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<s&&(this.lastIntegerZoom=s,this.lastIntegerZoomTime=r),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=s,!0))}}const Dt={"Latin-1 Supplement":i=>i>=128&&i<=255,"Hangul Jamo":i=>i>=4352&&i<=4607,Khmer:i=>i>=6016&&i<=6143,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Katakana:i=>i>=12448&&i<=12543,Kanbun:i=>i>=12688&&i<=12703,"CJK Strokes":i=>i>=12736&&i<=12783,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"Private Use Area":i=>i>=57344&&i<=63743,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function Ll(i){for(const t of i)if(Bl(t.charCodeAt(0)))return!0;return!1}function Tu(i){for(const t of i)if(!aa(t.charCodeAt(0)))return!1;return!0}function Rl(i){const t=i.map((r=>{try{return new RegExp(`\\p{sc=${r}}`,"u").source}catch{return null}})).filter((r=>r));return new RegExp(t.join("|"),"u")}const Iu=Rl(["Arab","Dupl","Mong","Ougr","Syrc"]);function aa(i){return!Iu.test(String.fromCodePoint(i))}const Ec=Rl(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function Bl(i){return!(i!==746&&i!==747&&(i<4352||!(Dt["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||Dt["CJK Compatibility"](i)||Dt["CJK Strokes"](i)||!(!Dt["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||Dt["Enclosed CJK Letters and Months"](i)||Dt["Ideographic Description Characters"](i)||Dt.Kanbun(i)||Dt.Katakana(i)&&i!==12540||!(!Dt["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!Dt["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||Dt["Vertical Forms"](i)||Dt["Yijing Hexagram Symbols"](i)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(i))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(i))||Ec.test(String.fromCodePoint(i)))))}function Pc(i){return!(Bl(i)||(function(t){return!!(Dt["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||Dt["General Punctuation"](t)&&(t===8214||t===8224||t===8225||t===8240||t===8241||t===8251||t===8252||t===8258||t===8263||t===8264||t===8265||t===8273)||Dt["Letterlike Symbols"](t)||Dt["Number Forms"](t)||Dt["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||t===9003||t>=9085&&t<=9114||t>=9150&&t<=9165||t===9167||t>=9169&&t<=9179||t>=9186&&t<=9215)||Dt["Control Pictures"](t)&&t!==9251||Dt["Optical Character Recognition"](t)||Dt["Enclosed Alphanumerics"](t)||Dt["Geometric Shapes"](t)||Dt["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Dt["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Dt["CJK Symbols and Punctuation"](t)||Dt.Katakana(t)||Dt["Private Use Area"](t)||Dt["CJK Compatibility Forms"](t)||Dt["Small Form Variants"](t)||Dt["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)})(i))}
6const Au=Rl(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function Fl(i){return Au.test(String.fromCodePoint(i))}function Eu(i,t){return!(!t&&Fl(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||Dt.Khmer(i))}function Pu(i){for(const t of i)if(Fl(t.charCodeAt(0)))return!0;return!1}const Vr=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(i){this.pluginStatus=i.pluginStatus,this.pluginURL=i.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(i){this.applyArabicShaping=i.applyArabicShaping,this.processBidirectionalText=i.processBidirectionalText,this.processStyledBidirectionalText=i.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class oi{constructor(t,r){this.zoom=t,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Dl,this.transition={})}isSupportedScript(t){return(function(r,s){for(const l of r)if(!Eu(l.charCodeAt(0),s))return!1;return!0})(t,Vr.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,r=t-Math.floor(t),s=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*s}:{fromScale:.5,toScale:1,t:1-(1-s)*r}}}class oa{constructor(t,r){this.property=t,this.value=r,this.expression=(function(s,l){if(po(s))return new ta(s,l);if(go(s)){const h=yl(s,l);if(h.result==="error")throw new Error(h.value.map((p=>`${p.key}: ${p.message}`)).join(", "));return h.value}{let h=s;return l.type==="color"&&typeof s=="string"?h=Gt.parse(s):l.type!=="padding"||typeof s!="number"&&!Array.isArray(s)?l.type==="variableAnchorOffsetCollection"&&Array.isArray(s)&&(h=Pr.parse(s)):h=yr.parse(s),{kind:"constant",evaluate:()=>h}}})(r===void 0?t.specification.default:r,t.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(t,r,s){return this.property.possiblyEvaluate(this,t,r,s)}}class Ao{constructor(t){this.property=t,this.value=new oa(t,void 0)}transitioned(t,r){return new Cc(this.property,this.value,r,ot({},t.transition,this.transition),t.now)}untransitioned(){return new Cc(this.property,this.value,null,{},0)}}class Eo{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return dt(this._values[t].value.value)}setValue(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Ao(this._values[t].property)),this._values[t].value=new oa(this._values[t].property,r===null?void 0:dt(r))}getTransition(t){return dt(this._values[t].transition)}setTransition(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Ao(this._values[t].property)),this._values[t].transition=dt(r)||void 0}serialize(){const t={};for(const r of Object.keys(this._values)){const s=this.getValue(r);s!==void 0&&(t[r]=s);const l=this.getTransition(r);l!==void 0&&(t[`${r}-transition`]=l)}return t}transitioned(t,r){const s=new Na(this._properties);for(const l of Object.keys(this._values))s._values[l]=this._values[l].transitioned(t,r._values[l]);return s}untransitioned(){const t=new Na(this._properties);for(const r of Object.keys(this._values))t._values[r]=this._values[r].untransitioned();return t}}class Cc{constructor(t,r,s,l,h){this.property=t,this.value=r,this.begin=h+l.delay||0,this.end=this.begin+l.duration||0,t.specification.transition&&(l.delay||l.duration)&&(this.prior=s)}possiblyEvaluate(t,r,s){const l=t.now||0,h=this.value.possiblyEvaluate(t,r,s),p=this.prior;if(p){if(l>this.end)return this.prior=null,h;if(this.value.isDataDriven())return this.prior=null,h;if(l<this.begin)return p.possiblyEvaluate(t,r,s);{const f=(l-this.begin)/(this.end-this.begin);return this.property.interpolate(p.possiblyEvaluate(t,r,s),h,(function(g){if(g<=0)return 0;if(g>=1)return 1;const v=g*g,b=v*g;return 4*(g<.5?b:3*(g-v)+b-.75)})(f))}}return h}}class Na{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,r,s){const l=new Ua(this._properties);for(const h of Object.keys(this._values))l._values[h]=this._values[h].possiblyEvaluate(t,r,s);return l}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class Va{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return this._values[t].value!==void 0}getValue(t){return dt(this._values[t].value)}setValue(t,r){this._values[t]=new oa(this._values[t].property,r===null?void 0:dt(r))}serialize(){const t={};for(const r of Object.keys(this._values)){const s=this.getValue(r);s!==void 0&&(t[r]=s)}return t}possiblyEvaluate(t,r,s){const l=new Ua(this._properties);for(const h of Object.keys(this._values))l._values[h]=this._values[h].possiblyEvaluate(t,r,s);return l}}class Rn{constructor(t,r,s){this.property=t,this.value=r,this.parameters=s}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,r,s,l){return this.property.evaluate(this.value,this.parameters,t,r,s,l)}}class Ua{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class Ke{constructor(t){this.specification=t}possiblyEvaluate(t,r){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(r)}interpolate(t,r,s){const l=er[this.specification.type];return l?l(t,r,s):t}}class ut{constructor(t,r){this.specification=t,this.overrides=r}possiblyEvaluate(t,r,s,l){return new Rn(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(r,null,{},s,l)}:t.expression,r)}interpolate(t,r,s){if(t.value.kind!=="constant"||r.value.kind!=="constant")return t;if(t.value.value===void 0||r.value.value===void 0)return new Rn(this,{kind:"constant",value:void 0},t.parameters);const l=er[this.specification.type];if(l){const h=l(t.value.value,r.value.value,s);return new Rn(this,{kind:"constant",value:h},t.parameters)}return t}evaluate(t,r,s,l,h,p){return t.kind==="constant"?t.value:t.evaluate(r,s,l,h,p)}}class Po extends ut{possiblyEvaluate(t,r,s,l){if(t.value===void 0)return new Rn(this,{kind:"constant",value:void 0},r);if(t.expression.kind==="constant"){const h=t.expression.evaluate(r,null,{},s,l),p=t.property.specification.type==="resolvedImage"&&typeof h!="string"?h.name:h,f=this._calculate(p,p,p,r);return new Rn(this,{kind:"constant",value:f},r)}if(t.expression.kind==="camera"){const h=this._calculate(t.expression.evaluate({zoom:r.zoom-1}),t.expression.evaluate({zoom:r.zoom}),t.expression.evaluate({zoom:r.zoom+1}),r);return new Rn(this,{kind:"constant",value:h},r)}return new Rn(this,t.expression,r)}evaluate(t,r,s,l,h,p){if(t.kind==="source"){const f=t.evaluate(r,s,l,h,p);return this._calculate(f,f,f,r)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(r.zoom)-1},s,l),t.evaluate({zoom:Math.floor(r.zoom)},s,l),t.evaluate({zoom:Math.floor(r.zoom)+1},s,l),r):t.value}_calculate(t,r,s,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:s,to:r}}interpolate(t){return t}}class Co{constructor(t){this.specification=t}possiblyEvaluate(t,r,s,l){if(t.value!==void 0){if(t.expression.kind==="constant"){const h=t.expression.evaluate(r,null,{},s,l);return this._calculate(h,h,h,r)}return this._calculate(t.expression.evaluate(new oi(Math.floor(r.zoom-1),r)),t.expression.evaluate(new oi(Math.floor(r.zoom),r)),t.expression.evaluate(new oi(Math.floor(r.zoom+1),r)),r)}}_calculate(t,r,s,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:s,to:r}}interpolate(t){return t}}class Ol{constructor(t){this.specification=t}possiblyEvaluate(t,r,s,l){return!!t.expression.evaluate(r,null,{},s,l)}interpolate(){return!1}}class u{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in t){const s=t[r];s.specification.overridable&&this.overridableProperties.push(r);const l=this.defaultPropertyValues[r]=new oa(s,void 0),h=this.defaultTransitionablePropertyValues[r]=new Ao(s);this.defaultTransitioningPropertyValues[r]=h.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=l.possiblyEvaluate({})}}}$e("DataDrivenProperty",ut),$e("DataConstantProperty",Ke),$e("CrossFadedDataDrivenProperty",Po),$e("CrossFadedProperty",Co),$e("ColorRampProperty",Ol);const e="-transition";class n extends Vn{constructor(t,r){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},t.type!=="custom"&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!=="background"&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),r.layout&&(this._unevaluatedLayout=new Va(r.layout)),r.paint)){this._transitionablePaint=new Eo(r.paint);for(const s in t.paint)this.setPaintProperty(s,t.paint[s],{validate:!1});for(const s in t.layout)this.setLayoutProperty(s,t.layout[s],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Ua(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return t==="visibility"?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,r,s={}
6){r!=null&&this._validate(Ic,`layers.${this.id}.layout.${t}`,t,r,s)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,r):this.visibility=r)}getPaintProperty(t){return t.endsWith(e)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,r,s={}){if(r!=null&&this._validate(Tc,`layers.${this.id}.paint.${t}`,t,r,s))return!1;if(t.endsWith(e))return this._transitionablePaint.setTransition(t.slice(0,-11),r||void 0),!1;{const l=this._transitionablePaint._values[t],h=l.property.specification["property-type"]==="cross-faded-data-driven",p=l.value.isDataDriven(),f=l.value;this._transitionablePaint.setValue(t,r),this._handleSpecialPaintPropertyUpdate(t);const g=this._transitionablePaint._values[t].value;return g.isDataDriven()||p||h||this._handleOverridablePaintPropertyUpdate(t,f,g)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,r,s){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||this.visibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,r){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,r)}
6serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),qe(t,((r,s)=>!(r===void 0||s==="layout"&&!Object.keys(r).length||s==="paint"&&!Object.keys(r).length)))}_validate(t,r,s,l,h={}){return(!h||h.validate!==!1)&&kl(this,t.call(As,{key:r,layerType:this.type,objectKey:s,value:l,styleSpec:he,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const r=this.paint.get(t);if(r instanceof Rn&&Ys(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const a={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class o{constructor(t,r){this._structArray=t,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class c{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,r){return t._trim(),r&&(t.isTransferred=!0,r.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const r=Object.create(this.prototype);return r.arrayBuffer=t.arrayBuffer,r.length=t.length,r.capacity=t.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function m(i,t=1){let r=0,s=0;return{members:i.map((l=>{const h=a[l.type].BYTES_PER_ELEMENT,p=r=_(r,Math.max(t,h)),f=l.components||1;return s=Math.max(s,h),r+=h*f,{name:l.name,type:l.type,components:f,offset:p}})),size:_(r,Math.max(s,t)),alignment:t}}function _(i,t){return Math.ceil(i/t)*t}class y extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r){const s=this.length;return this.resize(s+1),this.emplace(s,t,r)}emplace(t,r,s){const l=2*t;return this.int16[l+0]=r,this.int16[l+1]=s,t}}y.prototype.bytesPerElement=4,$e("StructArrayLayout2i4",y);class w extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,t,r,s)}emplace(t,r,s,l){const h=3*t;return this.int16[h+0]=r,this.int16[h+1]=s,this.int16[h+2]=l,t}}w.prototype.bytesPerElement=6,$e("StructArrayLayout3i6",w);class T extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,l){const h=this.length;return this.resize(h+1),this.emplace(h,t,r,s,l)}emplace(t,r,s,l,h){const p=4*t;return this.int16[p+0]=r,this.int16[p+1]=s,this.int16[p+2]=l,this.int16[p+3]=h,t}}T.prototype.bytesPerElement=8,$e("StructArrayLayout4i8",T);class I extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,h,p){const f=this.length;return this.resize(f+1),this.emplace(f,t,r,s,l,h,p)}emplace(t,r,s,l,h,p,f){const g=6*t;return this.int16[g+0]=r,this.int16[g+1]=s,this.int16[g+2]=l,this.int16[g+3]=h,this.int16[g+4]=p,this.int16[g+5]=f,t}}I.prototype.bytesPerElement=12,$e("StructArrayLayout2i4i12",I);class k extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,h,p){const f=this.length;return this.resize(f+1),this.emplace(f,t,r,s,l,h,p)}emplace(t,r,s,l,h,p,f){const g=4*t,v=8*t;return this.int16[g+0]=r,this.int16[g+1]=s,this.uint8[v+4]=l,this.uint8[v+5]=h,this.uint8[v+6]=p,this.uint8[v+7]=f,t}}k.prototype.bytesPerElement=8,$e("StructArrayLayout2i4ub8",k);class F extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r){const s=this.length;return this.resize(s+1),this.emplace(s,t,r)}emplace(t,r,s){const l=2*t;return this.float32[l+0]=r,this.float32[l+1]=s,t}}F.prototype.bytesPerElement=8,$e("StructArrayLayout2f8",F);class V extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,h,p,f,g,v,b){const S=this.length;return this.resize(S+1),this.emplace(S,t,r,s,l,h,p,f,g,v,b)}emplace(t,r,s,l,h,p,f,g,v,b,S){const E=10*t;return this.uint16[E+0]=r,this.uint16[E+1]=s,this.uint16[E+2]=l,this.uint16[E+3]=h,this.uint16[E+4]=p,this.uint16[E+5]=f,this.uint16[E+6]=g,this.uint16[E+7]=v,this.uint16[E+8]=b,this.uint16[E+9]=S,t}}V.prototype.bytesPerElement=20,$e("StructArrayLayout10ui20",V);class q extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,h,p,f,g,v,b,S,E){const M=this.length;return this.resize(M+1),this.emplace(M,t,r,s,l,h,p,f,g,v,b,S,E)}emplace(t,r,s,l,h,p,f,g,v,b,S,E,M){const z=12*t;return this.int16[z+0]=r,this.int16[z+1]=s,this.int16[z+2]=l,this.int16[z+3]=h,this.uint16[z+4]=
vendor: 4,772 bytes, line 6
6p,this.uint16[z+5]=f,this.uint16[z+6]=g,this.uint16[z+7]=v,this.int16[z+8]=b,this.int16[z+9]=S,this.int16[z+10]=E,this.int16[z+11]=M,t}}q.prototype.bytesPerElement=24,$e("StructArrayLayout4i4ui4i24",q);class H extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,t,r,s)}emplace(t,r,s,l){const h=3*t;return this.float32[h+0]=r,this.float32[h+1]=s,this.float32[h+2]=l,t}}H.prototype.bytesPerElement=12,$e("StructArrayLayout3f12",H);class W extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint32[1*t+0]=r,t}}W.prototype.bytesPerElement=4,$e("StructArrayLayout1ul4",W);class J extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,h,p,f,g,v){const b=this.length;return this.resize(b+1),this.emplace(b,t,r,s,l,h,p,f,g,v)}emplace(t,r,s,l,h,p,f,g,v,b){const S=10*t,E=5*t;return this.int16[S+0]=r,this.int16[S+1]=s,this.int16[S+2]=l,this.int16[S+3]=h,this.int16[S+4]=p,this.int16[S+5]=f,this.uint32[E+3]=g,this.uint16[S+8]=v,this.uint16[S+9]=b,t}}J.prototype.bytesPerElement=20,$e("StructArrayLayout6i1ul2ui20",J);class j extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,h,p){const f=this.length;return this.resize(f+1),this.emplace(f,t,r,s,l,h,p)}emplace(t,r,s,l,h,p,f){const g=6*t;return this.int16[g+0]=r,this.int16[g+1]=s,this.int16[g+2]=l,this.int16[g+3]=h,this.int16[g+4]=p,this.int16[g+5]=f,t}}j.prototype.bytesPerElement=12,$e("StructArrayLayout2i2i2i12",j);class ne extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,h){const p=this.length;return this.resize(p+1),this.emplace(p,t,r,s,l,h)}emplace(t,r,s,l,h,p){const f=4*t,g=8*t;return this.float32[f+0]=r,this.float32[f+1]=s,this.float32[f+2]=l,this.int16[g+6]=h,this.int16[g+7]=p,t}}ne.prototype.bytesPerElement=16,$e("StructArrayLayout2f1f2i16",ne);class se extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,h,p){const f=this.length;return this.resize(f+1),this.emplace(f,t,r,s,l,h,p)}emplace(t,r,s,l,h,p,f){const g=16*t,v=4*t,b=8*t;return this.uint8[g+0]=r,this.uint8[g+1]=s,this.float32[v+1]=l,this.float32[v+2]=h,this.int16[b+6]=p,this.int16[b+7]=f,t}}se.prototype.bytesPerElement=16,$e("StructArrayLayout2ub2f2i16",se);class ce extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,t,r,s)}emplace(t,r,s,l){const h=3*t;return this.uint16[h+0]=r,this.uint16[h+1]=s,this.uint16[h+2]=l,t}}ce.prototype.bytesPerElement=6,$e("StructArrayLayout3ui6",ce);class ye extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,s,l,h,p,f,g,v,b,S,E,M,z,B,$,G){const le=this.length;return this.resize(le+1),this.emplace(le,t,r,s,l,h,p,f,g,v,b,S,E,M,z,B,$,G)}emplace(t,r,s,l,h,p,f,g,v,b,S,E,M,z,B,$,G,le){const te=24*t,ae=12*t,pe=48*t;return this.int16[te+0]=r,this.int16[te+1]=s,this.uint16[te+2]=l,this.uint16[te+3]=h,this.uint32[ae+2]=p,this.uint32[ae+3]=f,this.uint32[ae+4]=g,this.uint16[te+10]=v,this.uint16[te+11]=b,this.uint16[te+12]=S,this.float32[ae+7]=E,this.float32[ae+8]=M,this.uint8[pe+36]=z,this.uint8[pe+37]=B,this.uint8[pe+38]=$,this.uint32[ae+10]=G,this.int16[te+22]=le,t}}ye.prototype.bytesPerElement=48,$e("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",ye);class Ie extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,s,l,h,p,f,g,v,b,S,E,M,z,B,$,G,le,te,ae,pe,be,Ne,lt,Fe,Le,et,He){const je=this.length;return this.resize(je+1),this.emplace(je,t,r,s,l,h,p,f,g,v,b,S,E,M,z,B,$,G,le,te,ae,pe,be,Ne,lt,Fe,Le,et,He)}emplace(t,r,s,l,h,p,f,g,v,b,S,E,M,z,B,$,G,le,te,ae,pe,be,Ne,lt,Fe,Le,et,He,je){const _e=32*t,tt=16*t;
6return this.int16[_e+0]=r,this.int16[_e+1]=s,this.int16[_e+2]=l,this.int16[_e+3]=h,this.int16[_e+4]=p,this.int16[_e+5]=f,this.int16[_e+6]=g,this.int16[_e+7]=v,this.uint16[_e+8]=b,this.uint16[_e+9]=S,this.uint16[_e+10]=E,this.uint16[_e+11]=M,this.uint16[_e+12]=z,this.uint16[_e+13]=B,this.uint16[_e+14]=$,this.uint16[_e+15]=G,this.uint16[_e+16]=le,this.uint16[_e+17]=te,this.uint16[_e+18]=ae,this.uint16[_e+19]=pe,this.uint16[_e+20]=be,this.uint16[_e+21]=Ne,this.uint16[_e+22]=lt,this.uint32[tt+12]=Fe,this.float32[tt+13]=Le,this.float32[tt+14]=et,this.uint16[_e+30]=He,this.uint16[_e+31]=je,t}}Ie.prototype.bytesPerElement=64,$e("StructArrayLayout8i15ui1ul2f2ui64",Ie);class Re extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.float32[1*t+0]=r,t}}Re.prototype.bytesPerElement=4,$e("StructArrayLayout1f4",Re);class Ue extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,t,r,s)}emplace(t,r,s,l){const h=3*t;return this.uint16[6*t+0]=r,this.float32[h+1]=s,this.float32[h+2]=l,t}}Ue.prototype.bytesPerElement=12,$e("StructArrayLayout1ui2f12",Ue);class ze extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,t,r,s)}emplace(t,r,s,l){const h=4*t;return this.uint32[2*t+0]=r,this.uint16[h+2]=s,this.uint16[h+3]=l,t}}ze.prototype.bytesPerElement=8,$e("StructArrayLayout1ul2ui8",ze);class Me extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r){const s=this.length;return this.resize(s+1),this.emplace(s,t,r)}emplace(t,r,s){const l=2*t;return this.uint16[l+0]=r,this.uint16[l+1]=s,t}}Me.prototype.bytesPerElement=4,$e("StructArrayLayout2ui4",Me);class Je extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint16[1*t+0]=r,t}}Je.prototype.bytesPerElement=2,$e("StructArrayLayout1ui2",Je);class yt extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,s,l){const h=this.length;return this.resize(h+1),this.emplace(h,t,r,s,l)}emplace(t,r,s,l,h){const p=4*t;return this.float32[p+0]=r,this.float32[p+1]=s,this.float32[p+2]=l,this.float32[p+3]=h,t}}yt.prototype.bytesPerElement=16,$e("StructArrayLayout4f16",yt);class De extends o{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new de(this.anchorPointX,this.anchorPointY)}}De.prototype.size=20;class Oe extends J{get(t){return new De(this,t)}}$e("CollisionBoxArray",Oe);class gt extends o{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}gt.prototype.size=48;class li extends ye{get(t){return new gt(this,t)}}$e("PlacedSymbolArray",li);class At extends o{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}
6get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}At.prototype.size=64;class Mt extends Ie{get(t){return new At(this,t)}}$e("SymbolInstanceArray",Mt);class ci extends Re{getoffsetX(t){return this.float32[1*t+0]}}$e("GlyphOffsetArray",ci);class nr extends w{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}$e("SymbolLineVertexArray",nr);class yn extends o{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}yn.prototype.size=12;class ui extends Ue{get(t){return new yn(this,t)}}$e("TextAnchorOffsetArray",ui);class Cr extends o{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]}}Cr.prototype.size=8;class xr extends ze{get(t){return new Cr(this,t)}}$e("FeatureIndexArray",xr);class sr extends y{}class br extends y{}class Bn extends y{}class la extends I{}class Mo extends k{}class ca extends F{}class nn extends V{}class ko extends q{}class Nl extends H{}class sn extends W{}class an extends j{}class rs extends se{}class vn extends ce{}class Wi extends Me{}const ar=m([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ur}=ar;class Lt{constructor(t=[]){this.segments=t}prepareSegment(t,r,s,l){let h=this.segments[this.segments.length-1];return t>Lt.MAX_VERTEX_ARRAY_LENGTH&&at(`Max vertices per segment is ${Lt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!h||h.vertexLength+t>Lt.MAX_VERTEX_ARRAY_LENGTH||h.sortKey!==l)&&(h={vertexOffset:r.length,primitiveOffset:s.length,vertexLength:0,primitiveLength:0},l!==void 0&&(h.sortKey=l),this.segments.push(h)),h}get(){return this.segments}destroy(){for(const t of this.segments)for(const r in t.vaos)t.vaos[r].destroy()}static simpleSegment(t,r,s,l){return new Lt([{vertexOffset:t,primitiveOffset:r,vertexLength:s,primitiveLength:l,vaos:{},sortKey:0}])}}function Es(i,t){return 256*(i=Ot(Math.floor(i),0,255))+Ot(Math.floor(t),0,255)}Lt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,$e("SegmentVector",Lt);const ua=m([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var ha={exports:{}},Mc={exports:{}};Mc.exports=function(i,t){var r,s,l,h,p,f,g,v;for(s=i.length-(r=3&i.length),l=t,p=3432918353,f=461845907,v=0;v<s;)g=255&i.charCodeAt(v)|(255&i.charCodeAt(++v))<<8|(255&i.charCodeAt(++v))<<16|(255&i.charCodeAt(++v))<<24,++v,l=27492+(65535&(h=5*(65535&(l=(l^=g=(65535&(g=(g=(65535&g)*p+(((g>>>16)*p&65535)<<16)&4294967295)<<15|g>>>17))*f+(((g>>>16)*f&65535)<<16)&4294967295)<<13|l>>>19))+((5*(l>>>16)&65535)<<16)&4294967295))+((58964+(h>>>16)&65535)<<16);
6switch(g=0,r){case 3:g^=(255&i.charCodeAt(v+2))<<16;case 2:g^=(255&i.charCodeAt(v+1))<<8;case 1:l^=g=(65535&(g=(g=(65535&(g^=255&i.charCodeAt(v)))*p+(((g>>>16)*p&65535)<<16)&4294967295)<<15|g>>>17))*f+(((g>>>16)*f&65535)<<16)&4294967295}return l^=i.length,l=2246822507*(65535&(l^=l>>>16))+((2246822507*(l>>>16)&65535)<<16)&4294967295,l=3266489909*(65535&(l^=l>>>13))+((3266489909*(l>>>16)&65535)<<16)&4294967295,(l^=l>>>16)>>>0};var Cu=Mc.exports,kc={exports:{}};kc.exports=function(i,t){for(var r,s=i.length,l=t^s,h=0;s>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(h)|(255&i.charCodeAt(++h))<<8|(255&i.charCodeAt(++h))<<16|(255&i.charCodeAt(++h))<<24))+((1540483477*(r>>>16)&65535)<<16),l=1540483477*(65535&l)+((1540483477*(l>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),s-=4,++h;switch(s){case 3:l^=(255&i.charCodeAt(h+2))<<16;case 2:l^=(255&i.charCodeAt(h+1))<<8;case 1:l=1540483477*(65535&(l^=255&i.charCodeAt(h)))+((1540483477*(l>>>16)&65535)<<16)}return l=1540483477*(65535&(l^=l>>>13))+((1540483477*(l>>>16)&65535)<<16),(l^=l>>>15)>>>0};var ns=Cu,zc=kc.exports;ha.exports=ns,ha.exports.murmur3=ns,ha.exports.murmur2=zc;var zo=xe(ha.exports);class ja{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,r,s,l){this.ids.push(Do(t)),this.positions.push(r,s,l)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=Do(t);let s=0,l=this.ids.length-1;for(;s<l;){const p=s+l>>1;this.ids[p]>=r?l=p:s=p+1}const h=[];for(;this.ids[s]===r;)h.push({index:this.positions[3*s],start:this.positions[3*s+1],end:this.positions[3*s+2]}),s++;return h}static serialize(t,r){const s=new Float64Array(t.ids),l=new Uint32Array(t.positions);return Lo(s,l,0,s.length-1),r&&r.push(s.buffer,l.buffer),{ids:s,positions:l}}static deserialize(t){const r=new ja;return r.ids=t.ids,r.positions=t.positions,r.indexed=!0,r}}function Do(i){const t=+i;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:zo(String(i))}function Lo(i,t,r,s){for(;r<s;){const l=i[r+s>>1];let h=r-1,p=s+1;for(;;){do h++;while(i[h]<l);do p--;while(i[p]>l);if(h>=p)break;da(i,h,p),da(t,3*h,3*p),da(t,3*h+1,3*p+1),da(t,3*h+2,3*p+2)}p-r<s-p?(Lo(i,t,r,p),r=p+1):(Lo(i,t,p+1,s),s=p)}}function da(i,t,r){const s=i[t];i[t]=i[r],i[r]=s}$e("FeaturePositionMap",ja);class $a{constructor(t,r){this.gl=t.gl,this.location=r}}class Dc extends $a{constructor(t,r){super(t,r),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class qh extends $a{constructor(t,r){super(t,r),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class Zh extends $a{constructor(t,r){super(t,r),this.current=Gt.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}const Sf=new Float32Array(16);function Mu(i){return[Es(255*i.r,255*i.g),Es(255*i.b,255*i.a)]}class Vl{constructor(t,r,s){this.value=t,this.uniformNames=r.map((l=>`u_${l}`)),this.type=s}setUniform(t,r,s){t.set(s.constantOr(this.value))}getBinding(t,r,s){return this.type==="color"?new Zh(t,r):new Dc(t,r)}}class Ro{constructor(t,r){this.uniformNames=r.map((s=>`u_${s}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=t.tlbr}setUniform(t,r,s,l){const h=l==="u_pattern_to"?this.patternTo:l==="u_pattern_from"?this.patternFrom:l==="u_pixel_ratio_to"?this.pixelRatioTo:l==="u_pixel_ratio_from"?this.pixelRatioFrom:null;h&&t.set(h)}getBinding(t,r,s){return s.substr(0,9)==="u_pattern"?new qh(t,r):new Dc(t,r)}}class Ps{constructor(t,r,s,l){this.expression=t,this.type=s,this.maxValue=0,this.paintVertexAttributes=r.map((h=>({name:`a_${h}`,type:"Float32",components:s==="color"?2:1,offset:0}))),this.paintVertexArray=new l}populatePaintArray(t,r,s,l,h){const p=this.paintVertexArray.length,f=this.expression.evaluate(new oi(0),r,{},l,[],h);this.paintVertexArray.resize(t),this._setPaintValue(p,t,f)}updatePaintArray(t,r,s,l){const h=this.expression.evaluate({zoom:0},s,l);this._setPaintValue(t,r,h)}
6_setPaintValue(t,r,s){if(this.type==="color"){const l=Mu(s);for(let h=t;h<r;h++)this.paintVertexArray.emplace(h,l[0],l[1])}else{for(let l=t;l<r;l++)this.paintVertexArray.emplace(l,s);this.maxValue=Math.max(this.maxValue,Math.abs(s))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Hn{constructor(t,r,s,l,h,p){this.expression=t,this.uniformNames=r.map((f=>`u_${f}_t`)),this.type=s,this.useIntegerZoom=l,this.zoom=h,this.maxValue=0,this.paintVertexAttributes=r.map((f=>({name:`a_${f}`,type:"Float32",components:s==="color"?4:2,offset:0}))),this.paintVertexArray=new p}populatePaintArray(t,r,s,l,h){const p=this.expression.evaluate(new oi(this.zoom),r,{},l,[],h),f=this.expression.evaluate(new oi(this.zoom+1),r,{},l,[],h),g=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(g,t,p,f)}updatePaintArray(t,r,s,l){const h=this.expression.evaluate({zoom:this.zoom},s,l),p=this.expression.evaluate({zoom:this.zoom+1},s,l);this._setPaintValue(t,r,h,p)}_setPaintValue(t,r,s,l){if(this.type==="color"){const h=Mu(s),p=Mu(l);for(let f=t;f<r;f++)this.paintVertexArray.emplace(f,h[0],h[1],p[0],p[1])}else{for(let h=t;h<r;h++)this.paintVertexArray.emplace(h,s,l);this.maxValue=Math.max(this.maxValue,Math.abs(s),Math.abs(l))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,r){const s=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,l=Ot(this.expression.interpolationFactor(s,this.zoom,this.zoom+1),0,1);t.set(l)}getBinding(t,r,s){return new Dc(t,r)}}class pa{constructor(t,r,s,l,h,p){this.expression=t,this.type=r,this.useIntegerZoom=s,this.zoom=l,this.layerId=p,this.zoomInPaintVertexArray=new h,this.zoomOutPaintVertexArray=new h}populatePaintArray(t,r,s){const l=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(l,t,r.patterns&&r.patterns[this.layerId],s)}updatePaintArray(t,r,s,l,h){this._setPaintValues(t,r,s.patterns&&s.patterns[this.layerId],h)}_setPaintValues(t,r,s,l){if(!l||!s)return;const{min:h,mid:p,max:f}=s,g=l[h],v=l[p],b=l[f];if(g&&v&&b)for(let S=t;S<r;S++)this.zoomInPaintVertexArray.emplace(S,v.tl[0],v.tl[1],v.br[0],v.br[1],g.tl[0],g.tl[1],g.br[0],g.br[1],v.pixelRatio,g.pixelRatio),this.zoomOutPaintVertexArray.emplace(S,v.tl[0],v.tl[1],v.br[0],v.br[1],b.tl[0],b.tl[1],b.br[0],b.br[1],v.pixelRatio,b.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,ua.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,ua.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Gh{constructor(t,r,s){this.binders={},this._buffers=[];const l=[];for(const h in t.paint._values){if(!s(h))continue;const p=t.paint.get(h);if(!(p instanceof Rn&&Ys(p.property.specification)))continue;const f=Tf(h,t.type),g=p.value,v=p.property.specification.type,b=p.property.useIntegerZoom,S=p.property.specification["property-type"],E=S==="cross-faded"||S==="cross-faded-data-driven";if(g.kind==="constant")this.binders[h]=E?new Ro(g.value,f):new Vl(g.value,f,v),l.push(`/u_${h}`);else if(g.kind==="source"||E){const M=Hh(h,v,"source");this.binders[h]=E?new pa(g,v,b,r,M,t.id):new Ps(g,f,v,M),l.push(`/a_${h}`)}else{const M=Hh(h,v,"composite");this.binders[h]=new Hn(g,f,v,b,r,M),l.push(`/z_${h}`)}}this.cacheKey=l.sort().join("")}getMaxValue(t){const r=this.binders[t];return r instanceof Ps||r instanceof Hn?r.maxValue:0}populatePaintArrays(t,r,s,l,h){for(const p in this.binders){const f=this.binders[p];(f instanceof Ps||f instanceof Hn||f instanceof pa)&&f.populatePaintArray(t,r,s,l,h)}}setConstantPatternPositions(t,r){for(const s in this.binders){const l=this.binders[s];l instanceof Ro&&l.setConstantPatternPositions(t,r)}}updatePaintArrays(t,r,s,l,h){let p=!1;for(const f in t){const g=r.getPositions(f);for(const v of g){const b=s.feature(v.index);for(const S in this.binders){const E=this.binders[S];if((E instanceof Ps||E instanceof Hn||E instanceof pa)&&E.expression.isStateDependent===!0){const M=l.paint.get(S);E.expression=M.value,E.updatePaintArray(v.start,v.end,b,t[f],h),p=!0}}}}return p}defines(){const t=[];for(const r in this.binders){const s=this.binders[r];
6(s instanceof Vl||s instanceof Ro)&&t.push(...s.uniformNames.map((l=>`#define HAS_UNIFORM_${l}`)))}return t}getBinderAttributes(){const t=[];for(const r in this.binders){const s=this.binders[r];if(s instanceof Ps||s instanceof Hn)for(let l=0;l<s.paintVertexAttributes.length;l++)t.push(s.paintVertexAttributes[l].name);else if(s instanceof pa)for(let l=0;l<ua.members.length;l++)t.push(ua.members[l].name)}return t}getBinderUniforms(){const t=[];for(const r in this.binders){const s=this.binders[r];if(s instanceof Vl||s instanceof Ro||s instanceof Hn)for(const l of s.uniformNames)t.push(l)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,r){const s=[];for(const l in this.binders){const h=this.binders[l];if(h instanceof Vl||h instanceof Ro||h instanceof Hn){for(const p of h.uniformNames)if(r[p]){const f=h.getBinding(t,r[p],p);s.push({name:p,property:l,binding:f})}}}return s}setUniforms(t,r,s,l){for(const{name:h,property:p,binding:f}of r)this.binders[p].setUniform(f,l,s.get(p),h)}updatePaintBuffers(t){this._buffers=[];for(const r in this.binders){const s=this.binders[r];if(t&&s instanceof pa){const l=t.fromScale===2?s.zoomInPaintVertexBuffer:s.zoomOutPaintVertexBuffer;l&&this._buffers.push(l)}else(s instanceof Ps||s instanceof Hn)&&s.paintVertexBuffer&&this._buffers.push(s.paintVertexBuffer)}}upload(t){for(const r in this.binders){const s=this.binders[r];(s instanceof Ps||s instanceof Hn||s instanceof pa)&&s.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const r=this.binders[t];(r instanceof Ps||r instanceof Hn||r instanceof pa)&&r.destroy()}}}class qa{constructor(t,r,s=(()=>!0)){this.programConfigurations={};for(const l of t)this.programConfigurations[l.id]=new Gh(l,r,s);this.needsUpload=!1,this._featureMap=new ja,this._bufferOffset=0}populatePaintArrays(t,r,s,l,h,p){for(const f in this.programConfigurations)this.programConfigurations[f].populatePaintArrays(t,r,l,h,p);r.id!==void 0&&this._featureMap.add(r.id,s,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,r,s,l){for(const h of s)this.needsUpload=this.programConfigurations[h.id].updatePaintArrays(t,this._featureMap,r,h,l)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function Tf(i,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[i]||[i.replace(`${t}-`,"").replace(/-/g,"_")]}function Hh(i,t,r){const s={color:{source:F,composite:yt},number:{source:Re,composite:F}},l=(function(h){return{"line-pattern":{source:nn,composite:nn},"fill-pattern":{source:nn,composite:nn},"fill-extrusion-pattern":{source:nn,composite:nn}}[h]})(i);return l&&l[r]||s[t][r]}$e("ConstantBinder",Vl),$e("CrossFadedConstantBinder",Ro),$e("SourceExpressionBinder",Ps),$e("CrossFadedCompositeBinder",pa),$e("CompositeExpressionBinder",Hn),$e("ProgramConfiguration",Gh,{omit:["_buffers"]}),$e("ProgramConfigurationSet",qa);const Bi=8192,ku=Math.pow(2,14)-1,Wh=-ku-1;function Za(i){const t=Bi/i.extent,r=i.loadGeometry();for(let s=0;s<r.length;s++){const l=r[s];for(let h=0;h<l.length;h++){const p=l[h],f=Math.round(p.x*t),g=Math.round(p.y*t);p.x=Ot(f,Wh,ku),p.y=Ot(g,Wh,ku),(f<p.x||f>p.x+1||g<p.y||g>p.y+1)&&at("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function Ga(i,t){return{type:i.type,id:i.id,properties:i.properties,geometry:t?Za(i):[]}}function Lc(i,t,r,s,l){i.emplaceBack(2*t+(s+1)/2,2*r+(l+1)/2)}class zu{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((r=>
6r.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new br,this.indexArray=new vn,this.segments=new Lt,this.programConfigurations=new qa(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((r=>r.isStateDependent())).map((r=>r.id))}populate(t,r,s){const l=this.layers[0],h=[];let p=null,f=!1;l.type==="circle"&&(p=l.layout.get("circle-sort-key"),f=!p.isConstant());for(const{feature:g,id:v,index:b,sourceLayerIndex:S}of t){const E=this.layers[0]._featureFilter.needGeometry,M=Ga(g,E);if(!this.layers[0]._featureFilter.filter(new oi(this.zoom),M,s))continue;const z=f?p.evaluate(M,{},s):void 0,B={id:v,properties:g.properties,type:g.type,sourceLayerIndex:S,index:b,geometry:E?M.geometry:Za(g),patterns:{},sortKey:z};h.push(B)}f&&h.sort(((g,v)=>g.sortKey-v.sortKey));for(const g of h){const{geometry:v,index:b,sourceLayerIndex:S}=g,E=t[b].feature;this.addFeature(g,v,b,s),r.featureIndex.insert(E,v,b,S,this.index)}}update(t,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ur),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,r,s,l){for(const h of r)for(const p of h){const f=p.x,g=p.y;if(f<0||f>=Bi||g<0||g>=Bi)continue;const v=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),b=v.vertexLength;Lc(this.layoutVertexArray,f,g,-1,-1),Lc(this.layoutVertexArray,f,g,1,-1),Lc(this.layoutVertexArray,f,g,1,1),Lc(this.layoutVertexArray,f,g,-1,1),this.indexArray.emplaceBack(b,b+1,b+2),this.indexArray.emplaceBack(b,b+3,b+2),v.vertexLength+=4,v.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,s,{},l)}}function Xh(i,t){for(let r=0;r<i.length;r++)if(Bo(t,i[r]))return!0;for(let r=0;r<t.length;r++)if(Bo(i,t[r]))return!0;return!!Du(i,t)}function If(i,t,r){return!!Bo(i,t)||!!Lu(t,i,r)}function Yh(i,t){if(i.length===1)return Jh(t,i[0]);for(let r=0;r<t.length;r++){const s=t[r];for(let l=0;l<s.length;l++)if(Bo(i,s[l]))return!0}for(let r=0;r<i.length;r++)if(Jh(t,i[r]))return!0;for(let r=0;r<t.length;r++)if(Du(i,t[r]))return!0;return!1}function Af(i,t,r){if(i.length>1){if(Du(i,t))return!0;for(let s=0;s<t.length;s++)if(Lu(t[s],i,r))return!0}for(let s=0;s<i.length;s++)if(Lu(i[s],t,r))return!0;return!1}function Du(i,t){if(i.length===0||t.length===0)return!1;for(let r=0;r<i.length-1;r++){const s=i[r],l=i[r+1];for(let h=0;h<t.length-1;h++)if(Ef(s,l,t[h],t[h+1]))return!0}return!1}function Ef(i,t,r,s){return Te(i,r,s)!==Te(t,r,s)&&Te(i,t,r)!==Te(i,t,s)}function Lu(i,t,r){const s=r*r;if(t.length===1)return i.distSqr(t[0])<s;for(let l=1;l<t.length;l++)if(Kh(i,t[l-1],t[l])<s)return!0;return!1}function Kh(i,t,r){const s=t.distSqr(r);if(s===0)return i.distSqr(t);const l=((i.x-t.x)*(r.x-t.x)+(i.y-t.y)*(r.y-t.y))/s;return i.distSqr(l<0?t:l>1?r:r.sub(t)._mult(l)._add(t))}function Jh(i,t){let r,s,l,h=!1;for(let p=0;p<i.length;p++){r=i[p];for(let f=0,g=r.length-1;f<r.length;g=f++)s=r[f],l=r[g],s.y>t.y!=l.y>t.y&&t.x<(l.x-s.x)*(t.y-s.y)/(l.y-s.y)+s.x&&(h=!h)}return h}function Bo(i,t){let r=!1;for(let s=0,l=i.length-1;s<i.length;l=s++){const h=i[s],p=i[l];h.y>t.y!=p.y>t.y&&t.x<(p.x-h.x)*(t.y-h.y)/(p.y-h.y)+h.x&&(r=!r)}return r}function Pf(i,t,r){const s=r[0],l=r[2];if(i.x<s.x&&t.x<s.x||i.x>l.x&&t.x>l.x||i.y<s.y&&t.y<s.y||i.y>l.y&&t.y>l.y)return!1;const h=Te(i,t,r[0]);return h!==Te(i,t,r[1])||h!==Te(i,t,r[2])||h!==Te(i,t,r[3])}function Ul(i,t,r){const s=t.paint.get(i).value;return s.kind==="constant"?s.value:r.programConfigurations.get(t.id).getMaxValue(i)}function Rc(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function Bc(i,t,r,s,l){if(!t[0]&&!t[1])return i;const h=de.convert(t)._mult(l);r==="viewport"&&h._rotate(-s);const p=[];for(let f=0;f<i.length;f++)p.push(i[f].sub(h));return p}let Qh,ed;$e("CircleBucket",zu,{omit:["layers"]});var Cf={get paint(){return ed=ed||new u({"circle-radius":new ut(he.paint_circle["circle-radius"]),"circle-color":new ut(he.paint_circle["circle-color"]),"circle-blur":new ut(he.paint_circle["circle-blur"]),"circle-opacity":new ut(he.paint_circle["circle-opacity"]),"circle-translate":new Ke(he.paint_circle["circle-translate"]),"circle-translate-anchor":new Ke(he.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ke(he.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ke(he.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new ut(he.paint_circle["circle-stroke-width"]),"circle-stroke-color":new ut(he.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new ut(he.paint_circle["circle-stroke-opacity"])})},get layout(){return Qh=Qh||new u({"circle-sort-key":new ut(he.layout_circle["circle-sort-key"])})}},Mr=1e-6,Fo=typeof Float32Array<"u"?Float32Array:Array;function Ru(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function td(i,t,r){var s=t[0],l=t[1],h=t[2],p=t[3],f=t[4],g=t[5],v=t[6],b=t[7],S=t[8],E=t[9],M=t[10],z=t[11],B=t[12],$=t[13],G=t[14],le=t[15],te=r[0],ae=r[1],pe=r[2],be=r[3];return i[0]=te*s+ae*f+pe*S+be*B,i[1]=te*l+ae*g+pe*E+be*$,i[2]=te*h+ae*v+pe*M+be*G,i[3]=te*p+ae*b+pe*z+be*le,i[4]=(te=r[4])*s+(ae=r[5])*f+(pe=r[6])*S+(be=r[7]
6)*B,i[5]=te*l+ae*g+pe*E+be*$,i[6]=te*h+ae*v+pe*M+be*G,i[7]=te*p+ae*b+pe*z+be*le,i[8]=(te=r[8])*s+(ae=r[9])*f+(pe=r[10])*S+(be=r[11])*B,i[9]=te*l+ae*g+pe*E+be*$,i[10]=te*h+ae*v+pe*M+be*G,i[11]=te*p+ae*b+pe*z+be*le,i[12]=(te=r[12])*s+(ae=r[13])*f+(pe=r[14])*S+(be=r[15])*B,i[13]=te*l+ae*g+pe*E+be*$,i[14]=te*h+ae*v+pe*M+be*G,i[15]=te*p+ae*b+pe*z+be*le,i}Math.hypot||(Math.hypot=function(){for(var i=0,t=arguments.length;t--;)i+=arguments[t]*arguments[t];return Math.sqrt(i)});var jl,Mf=td;function Fc(i,t,r){var s=t[0],l=t[1],h=t[2],p=t[3];return i[0]=r[0]*s+r[4]*l+r[8]*h+r[12]*p,i[1]=r[1]*s+r[5]*l+r[9]*h+r[13]*p,i[2]=r[2]*s+r[6]*l+r[10]*h+r[14]*p,i[3]=r[3]*s+r[7]*l+r[11]*h+r[15]*p,i}jl=new Fo(4),Fo!=Float32Array&&(jl[0]=0,jl[1]=0,jl[2]=0,jl[3]=0);class kf extends n{constructor(t){super(t,Cf)}createBucket(t){return new zu(t)}queryRadius(t){const r=t;return Ul("circle-radius",this,r)+Ul("circle-stroke-width",this,r)+Rc(this.paint.get("circle-translate"))}queryIntersectsFeature(t,r,s,l,h,p,f,g){const v=Bc(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),p.angle,f),b=this.paint.get("circle-radius").evaluate(r,s)+this.paint.get("circle-stroke-width").evaluate(r,s),S=this.paint.get("circle-pitch-alignment")==="map",E=S?v:(function(z,B){return z.map(($=>id($,B)))})(v,g),M=S?b*f:b;for(const z of l)for(const B of z){const $=S?B:id(B,g);let G=M;const le=Fc([],[B.x,B.y,0,1],g);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?G*=le[3]/p.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(G*=p.cameraToCenterDistance/le[3]),If(E,$,G))return!0}return!1}}function id(i,t){const r=Fc([],[i.x,i.y,0,1],t);return new de(r[0]/r[3],r[1]/r[3])}class rd extends zu{}let nd;$e("HeatmapBucket",rd,{omit:["layers"]});var zf={get paint(){return nd=nd||new u({"heatmap-radius":new ut(he.paint_heatmap["heatmap-radius"]),"heatmap-weight":new ut(he.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ke(he.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Ol(he.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ke(he.paint_heatmap["heatmap-opacity"])})}};function Bu(i,{width:t,height:r},s,l){if(l){if(l instanceof Uint8ClampedArray)l=new Uint8Array(l.buffer);else if(l.length!==t*r*s)throw new RangeError(`mismatched image size. expected: ${l.length} but got: ${t*r*s}`)}else l=new Uint8Array(t*r*s);return i.width=t,i.height=r,i.data=l,i}function sd(i,{width:t,height:r},s){if(t===i.width&&r===i.height)return;const l=Bu({},{width:t,height:r},s);Fu(i,l,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,t),height:Math.min(i.height,r)},s),i.width=t,i.height=r,i.data=l.data}function Fu(i,t,r,s,l,h){if(l.width===0||l.height===0)return t;if(l.width>i.width||l.height>i.height||r.x>i.width-l.width||r.y>i.height-l.height)throw new RangeError("out of range source coordinates for image copy");if(l.width>t.width||l.height>t.height||s.x>t.width-l.width||s.y>t.height-l.height)throw new RangeError("out of range destination coordinates for image copy");const p=i.data,f=t.data;if(p===f)throw new Error("srcData equals dstData, so image is already copied");for(let g=0;g<l.height;g++){const v=((r.y+g)*i.width+r.x)*h,b=((s.y+g)*t.width+s.x)*h;for(let S=0;S<l.width*h;S++)f[b+S]=p[v+S]}return t}class $l{constructor(t,r){Bu(this,t,1,r)}resize(t){sd(this,t,1)}clone(){return new $l({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,s,l,h){Fu(t,r,s,l,h,1)}}class xn{constructor(t,r){Bu(this,t,4,r)}resize(t){sd(this,t,4)}replace(t,r){r?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new xn({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,s,l,h){Fu(t,r,s,l,h,4)}}function ad(i){const t={},r=i.resolution||256,s=i.clips?i.clips.length:1,l=i.image||new xn({width:r,height:s});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const h=(p,f,g)=>{t[i.evaluationKey]=g;const v=i.expression.evaluate(t);l.data[p+f+0]=Math.floor(255*v.r/v.a),l.data[p+f+1]=Math.floor(255*v.g/v.a),l.data[p+f+2]=Math.floor(255*v.b/v.a),l.data[p+f+3]=Math.floor(255*v.a)};if(i.clips)for(let p=0,f=0;p<s;++p,f+=4*r)for(let g=0,v=0;g<r;g++,v+=4){const b=g/(r-1),{start:S,end:E}=i.clips[p];h(f,v,S*(1-b)+E*b)}else for(let p=0,f=0;p<r;p++,f+=4)h(0,f,p/(r-1));return l}$e("AlphaImage",$l),$e("RGBAImage",xn);const Ou="big-fb";class Df extends n{createBucket(t){return new rd(t)}constructor(t){super(t,zf),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=ad({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Ou)&&this.heatmapFbos.delete(Ou)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let od;var Lf={get paint(){return od=od||new u({"hillshade-illumination-direction":new Ke(he.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ke(he.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ke(he.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ke(he.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ke(he.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ke(he.paint_hillshade["hillshade-accent-color"])})}};class Rf extends n{constructor(t){super(t,Lf)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const Bf=m([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ff}=Bf;function ld(i,t,r=2){const s=t&&t.length,l=s?t[0]*r:i.length;let h=cd(i,0,l,r,!0);const p=[];if(!h||h.next===h.prev)return p;let f,g,v;if(s&&(h=(function(b,S,E,M){const z=[];for(let B=0,$=S.length;B<$;B++){const G=cd(b,S[B]*M,B<$-1?S[B+1]*M:b.length,M,!1);G===G.next&&(G.steiner=!0),z.push(Zf(G))}z.sort(jf);for(let B=0;B<z.length;B++)E=$f(z[B],E);return E})(i,t,h,r)),i.length>80*r){f=1/0,g=1/0;let b=-1/0,S=-1/0;for(let E=r;E<l;E+=r){const M=i[E],z=i[E+1];M<f&&(f=M),z<g&&(g=z),M>b&&(b=M),z>S&&(S=z)}v=Math.max(b-f,S-g),v=v!==0?32767/v:0}return ql(h,p,r,f,g,v,0),p}function cd(i,t,r,s,l){let h;if(l===(function(p,f,g,v){let b=0;for(let S=f,E=g-v;S<g;S+=v)b+=(p[E]-p[S])*(p[S+1]+p[E+1]),E=S;return b})(i,t,r,s)>0)for(let p=t;p<r;p+=s)h=dd(p/s|0,i[p],i[p+1],h);else for(let p=r-s;p>=t;p-=s)h=dd(p/s|0,i[p],i[p+1],h);return h&&Oc(h,h.next)&&(Gl(h),h=h.next),h}function Ha(i,t){if(!i)return i;t||(t=i);let r,s=i;do if(r=!1,s.steiner||!Oc(s,s.next)&&Mi(s.prev,s,s.next)!==0)s=s.next;else{if(Gl(s),s=t=s.prev,s===s.next)break;r=!0}while(r||s!==t);return t}function ql(i,t,r,s,l,h,p){if(!i)return;!p&&h&&(function(g,v,b,S){let E=g;do E.z===0&&(E.z=Nu(E.x,E.y,v,b,S)),E.prevZ=E.prev,E.nextZ=E.next,E=E.next;while(E!==g);E.prevZ.nextZ=null,E.prevZ=null,(function(M){let z,B=1;do{let $,G=M;M=null;let le=null;for(z=0;G;){z++;let te=G,ae=0;for(let be=0;be<B&&(ae++,te=te.nextZ,te);be++);let pe=B;for(;ae>0||pe>0&&te;)ae!==0&&(pe===0||!te||G.z<=te.z)?($=G,G=G.nextZ,ae--):($=te,te=te.nextZ,pe--),le?le.nextZ=$:M=$,$.prevZ=le,le=$;G=te}le.nextZ=null,B*=2}while(z>1)})(E)})(i,s,l,h);let f=i;for(;i.prev!==i.next;){const g=i.prev,v=i.next;if(h?Nf(i,s,l,h):Of(i))t.push(g.i,i.i,v.i),Gl(i),i=v.next,f=v.next;else if((i=v)===f){p?p===1?ql(i=Vf(Ha(i),t),t,r,s,l,h,2):p===2&&Uf(i,t,r,s,l,h):ql(Ha(i),t,r,s,l,h,1);break}}}function Of(i){const t=i.prev,r=i,s=i.next;if(Mi(t,r,s)>=0)return!1;const l=t.x,h=r.x,p=s.x,f=t.y,g=r.y,v=s.y,b=l<h?l<p?l:p:h<p?h:p,S=f<g?f<v?f:v:g<v?g:v,E=l>h?l>p?l:p:h>p?h:p,M=f>g?f>v?f:v:g>v?g:v;let z=s.next;for(;z!==t;){if(z.x>=b&&z.x<=E&&z.y>=S&&z.y<=M&&Oo(l,f,h,g,p,v,z.x,z.y)&&Mi(z.prev,z,z.next)>=0)return!1;
6z=z.next}return!0}function Nf(i,t,r,s){const l=i.prev,h=i,p=i.next;if(Mi(l,h,p)>=0)return!1;const f=l.x,g=h.x,v=p.x,b=l.y,S=h.y,E=p.y,M=f<g?f<v?f:v:g<v?g:v,z=b<S?b<E?b:E:S<E?S:E,B=f>g?f>v?f:v:g>v?g:v,$=b>S?b>E?b:E:S>E?S:E,G=Nu(M,z,t,r,s),le=Nu(B,$,t,r,s);let te=i.prevZ,ae=i.nextZ;for(;te&&te.z>=G&&ae&&ae.z<=le;){if(te.x>=M&&te.x<=B&&te.y>=z&&te.y<=$&&te!==l&&te!==p&&Oo(f,b,g,S,v,E,te.x,te.y)&&Mi(te.prev,te,te.next)>=0||(te=te.prevZ,ae.x>=M&&ae.x<=B&&ae.y>=z&&ae.y<=$&&ae!==l&&ae!==p&&Oo(f,b,g,S,v,E,ae.x,ae.y)&&Mi(ae.prev,ae,ae.next)>=0))return!1;ae=ae.nextZ}for(;te&&te.z>=G;){if(te.x>=M&&te.x<=B&&te.y>=z&&te.y<=$&&te!==l&&te!==p&&Oo(f,b,g,S,v,E,te.x,te.y)&&Mi(te.prev,te,te.next)>=0)return!1;te=te.prevZ}for(;ae&&ae.z<=le;){if(ae.x>=M&&ae.x<=B&&ae.y>=z&&ae.y<=$&&ae!==l&&ae!==p&&Oo(f,b,g,S,v,E,ae.x,ae.y)&&Mi(ae.prev,ae,ae.next)>=0)return!1;ae=ae.nextZ}return!0}function Vf(i,t){let r=i;do{const s=r.prev,l=r.next.next;!Oc(s,l)&&ud(s,r,r.next,l)&&Zl(s,l)&&Zl(l,s)&&(t.push(s.i,r.i,l.i),Gl(r),Gl(r.next),r=i=l),r=r.next}while(r!==i);return Ha(r)}function Uf(i,t,r,s,l,h){let p=i;do{let f=p.next.next;for(;f!==p.prev;){if(p.i!==f.i&&Gf(p,f)){let g=hd(p,f);return p=Ha(p,p.next),g=Ha(g,g.next),ql(p,t,r,s,l,h,0),void ql(g,t,r,s,l,h,0)}f=f.next}p=p.next}while(p!==i)}function jf(i,t){return i.x-t.x}function $f(i,t){const r=(function(l,h){let p=h;const f=l.x,g=l.y;let v,b=-1/0;do{if(g<=p.y&&g>=p.next.y&&p.next.y!==p.y){const B=p.x+(g-p.y)*(p.next.x-p.x)/(p.next.y-p.y);if(B<=f&&B>b&&(b=B,v=p.x<p.next.x?p:p.next,B===f))return v}p=p.next}while(p!==h);if(!v)return null;const S=v,E=v.x,M=v.y;let z=1/0;p=v;do{if(f>=p.x&&p.x>=E&&f!==p.x&&Oo(g<M?f:b,g,E,M,g<M?b:f,g,p.x,p.y)){const B=Math.abs(g-p.y)/(f-p.x);Zl(p,l)&&(B<z||B===z&&(p.x>v.x||p.x===v.x&&qf(v,p)))&&(v=p,z=B)}p=p.next}while(p!==S);return v})(i,t);if(!r)return t;const s=hd(r,i);return Ha(s,s.next),Ha(r,r.next)}function qf(i,t){return Mi(i.prev,i,t.prev)<0&&Mi(t.next,i,i.next)<0}function Nu(i,t,r,s,l){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*l|0)|i<<8))|i<<4))|i<<2))|i<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-s)*l|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Zf(i){let t=i,r=i;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==i);return r}function Oo(i,t,r,s,l,h,p,f){return(l-p)*(t-f)>=(i-p)*(h-f)&&(i-p)*(s-f)>=(r-p)*(t-f)&&(r-p)*(h-f)>=(l-p)*(s-f)}function Gf(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!(function(r,s){let l=r;do{if(l.i!==r.i&&l.next.i!==r.i&&l.i!==s.i&&l.next.i!==s.i&&ud(l,l.next,r,s))return!0;l=l.next}while(l!==r);return!1})(i,t)&&(Zl(i,t)&&Zl(t,i)&&(function(r,s){let l=r,h=!1;const p=(r.x+s.x)/2,f=(r.y+s.y)/2;do l.y>f!=l.next.y>f&&l.next.y!==l.y&&p<(l.next.x-l.x)*(f-l.y)/(l.next.y-l.y)+l.x&&(h=!h),l=l.next;while(l!==r);return h})(i,t)&&(Mi(i.prev,i,t.prev)||Mi(i,t.prev,t))||Oc(i,t)&&Mi(i.prev,i,i.next)>0&&Mi(t.prev,t,t.next)>0)}function Mi(i,t,r){return(t.y-i.y)*(r.x-t.x)-(t.x-i.x)*(r.y-t.y)}function Oc(i,t){return i.x===t.x&&i.y===t.y}function ud(i,t,r,s){const l=Vc(Mi(i,t,r)),h=Vc(Mi(i,t,s)),p=Vc(Mi(r,s,i)),f=Vc(Mi(r,s,t));return l!==h&&p!==f||!(l!==0||!Nc(i,r,t))||!(h!==0||!Nc(i,s,t))||!(p!==0||!Nc(r,i,s))||!(f!==0||!Nc(r,t,s))}function Nc(i,t,r){return t.x<=Math.max(i.x,r.x)&&t.x>=Math.min(i.x,r.x)&&t.y<=Math.max(i.y,r.y)&&t.y>=Math.min(i.y,r.y)}function Vc(i){return i>0?1:i<0?-1:0}function Zl(i,t){return Mi(i.prev,i,i.next)<0?Mi(i,t,i.next)>=0&&Mi(i,i.prev,t)>=0:Mi(i,t,i.prev)<0||Mi(i,i.next,t)<0}function hd(i,t){const r=Vu(i.i,i.x,i.y),s=Vu(t.i,t.x,t.y),l=i.next,h=t.prev;return i.next=t,t.prev=i,r.next=l,l.prev=r,s.next=r,r.prev=s,h.next=s,s.prev=h,s}function dd(i,t,r,s){const l=Vu(i,t,r);return s?(l.next=s.next,l.prev=s,s.next.prev=l,s.next=l):(l.prev=l,l.next=l),l}function Gl(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Vu(i,t,r){return{i,x:t,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Uu(i,t,r){const s=r.patternDependencies;let l=!1;for(const h of t){const p=h.paint.get(`${i}-pattern`);p.isConstant()||(l=!0);const f=p.constantOr(null);f&&(l=!0,s[f.to]=!0,s[f.from]=!0)}return l}function ju(i,t,r,s,l){const h=l.patternDependencies;for(const p of t){const f=p.paint.get(`${i}-pattern`).value;if(f.kind!=="constant"){let g=f.evaluate({zoom:s-1},r,{},l.availableImages),v=f.evaluate({zoom:s},r,{},l.availableImages),b=f.evaluate({zoom:s+1},r,{},l.availableImages);
6g=g&&g.name?g.name:g,v=v&&v.name?v.name:v,b=b&&b.name?b.name:b,h[g]=!0,h[v]=!0,h[b]=!0,r.patterns[p.id]={min:g,mid:v,max:b}}}return r}class $u{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((r=>r.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Bn,this.indexArray=new vn,this.indexArray2=new Wi,this.programConfigurations=new qa(t.layers,t.zoom),this.segments=new Lt,this.segments2=new Lt,this.stateDependentLayerIds=this.layers.filter((r=>r.isStateDependent())).map((r=>r.id))}populate(t,r,s){this.hasPattern=Uu("fill",this.layers,r);const l=this.layers[0].layout.get("fill-sort-key"),h=!l.isConstant(),p=[];for(const{feature:f,id:g,index:v,sourceLayerIndex:b}of t){const S=this.layers[0]._featureFilter.needGeometry,E=Ga(f,S);if(!this.layers[0]._featureFilter.filter(new oi(this.zoom),E,s))continue;const M=h?l.evaluate(E,{},s,r.availableImages):void 0,z={id:g,properties:f.properties,type:f.type,sourceLayerIndex:b,index:v,geometry:S?E.geometry:Za(f),patterns:{},sortKey:M};p.push(z)}h&&p.sort(((f,g)=>f.sortKey-g.sortKey));for(const f of p){const{geometry:g,index:v,sourceLayerIndex:b}=f;if(this.hasPattern){const S=ju("fill",this.layers,f,this.zoom,r);this.patternFeatures.push(S)}else this.addFeature(f,g,v,s,{});r.featureIndex.insert(t[v].feature,g,v,b,this.index)}}update(t,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,s)}addFeatures(t,r,s){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ff),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,r,s,l,h){for(const p of Ri(r,500)){let f=0;for(const M of p)f+=M.length;const g=this.segments.prepareSegment(f,this.layoutVertexArray,this.indexArray),v=g.vertexLength,b=[],S=[];for(const M of p){if(M.length===0)continue;M!==p[0]&&S.push(b.length/2);const z=this.segments2.prepareSegment(M.length,this.layoutVertexArray,this.indexArray2),B=z.vertexLength;this.layoutVertexArray.emplaceBack(M[0].x,M[0].y),this.indexArray2.emplaceBack(B+M.length-1,B),b.push(M[0].x),b.push(M[0].y);for(let $=1;$<M.length;$++)this.layoutVertexArray.emplaceBack(M[$].x,M[$].y),this.indexArray2.emplaceBack(B+$-1,B+$),b.push(M[$].x),b.push(M[$].y);z.vertexLength+=M.length,z.primitiveLength+=M.length}const E=ld(b,S);for(let M=0;M<E.length;M+=3)this.indexArray.emplaceBack(v+E[M],v+E[M+1],v+E[M+2]);g.vertexLength+=f,g.primitiveLength+=E.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,s,h,l)}}let pd,fd;$e("FillBucket",$u,{omit:["layers","patternFeatures"]});var Hf={get paint(){return fd=fd||new u({"fill-antialias":new Ke(he.paint_fill["fill-antialias"]),"fill-opacity":new ut(he.paint_fill["fill-opacity"]),"fill-color":new ut(he.paint_fill["fill-color"]),"fill-outline-color":new ut(he.paint_fill["fill-outline-color"]),"fill-translate":new Ke(he.paint_fill["fill-translate"]),"fill-translate-anchor":new Ke(he.paint_fill["fill-translate-anchor"]),"fill-pattern":new Po(he.paint_fill["fill-pattern"])})},get layout(){return pd=pd||new u({"fill-sort-key":new ut(he.layout_fill["fill-sort-key"])})}};class Wf extends n{constructor(t){super(t,Hf)}recalculate(t,r){super.recalculate(t,r);const s=this.paint._values["fill-outline-color"];s.value.kind==="constant"&&s.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new $u(t)}queryRadius(){return Rc(this.paint.get("fill-translate"))}queryIntersectsFeature(t,r,s,l,h,p,f){return Yh(Bc(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),p.angle,f),l)}isTileClipped(){return!0}}const Xf=m([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Yf=m([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Kf}=Xf;var fa={},Jf=Se,md=No;function No(i,t,r,s,l){this.properties={},this.extent=r,this.type=0,this._pbf=i,this._geometry=-1,this._keys=s,this._values=l,i.readFields(Qf,this,t)}function Qf(i,t,r){i==1?t.id=r.readVarint():i==2?(function(s,l){for(var h=s.readVarint()+s.pos;s.pos<h;){var p=l._keys[s.readVarint()],f=l._values[s.readVarint()];l.properties[p]=f}})(r,t):i==3?t.type=r.readVarint():i==4&&(t._geometry=r.pos)}function em(i){for(var t,r,s=0,l=0,h=i.length,p=h-1;l<h;p=l++)s+=((r=i[p]).x-(t=i[l]).x)*(t.y+r.y);return s}No.types=["Unknown","Point","LineString","Polygon"],No.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var t,r=i.readVarint()+i.pos,s=1,l=0,h=0,p=0,f=[];i.pos<r;){if(l<=0){var g=i.readVarint();s=7&g,l=g>>3}if(l--,s===1||s===2)h+=i.readSVarint(),p+=i.readSVarint(),s===1&&(t&&f.push(t),t=[]),t.push(new Jf(h,p));else{if(s!==7)throw new Error("unknown command "+s);t&&t.push(t[0].clone())}}return t&&f.push(t),f},No.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var t=i.readVarint()+i.pos,r=1,s=0,l=0,h=0,p=1/0,f=-1/0,g=1/0,v=-1/0;i.pos<t;){if(s<=0){var b=i.readVarint();r=7&b,s=b>>3}if(s--,r===1||r===2)(l+=i.readSVarint())<p&&(p=l),l>f&&(f=l),(h+=i.readSVarint())<g&&(g=h),h>v&&(v=h);else if(r!==7)throw new Error("unknown command "+r)}return[p,g,f,v]},No.prototype.toGeoJSON=function(i,t,r){var s,l,h=this.extent*Math.pow(2,r),p=this.extent*i,f=this.extent*t,g=this.loadGeometry(),v=No.types[this.type];function b(M){for(var z=0;z<M.length;z++){var B=M[z];M[z]=[360*(B.x+p)/h-180,360/Math.PI*Math.atan(Math.exp((180-360*(B.y+f)/h)*Math.PI/180)
6)-90]}}switch(this.type){case 1:var S=[];for(s=0;s<g.length;s++)S[s]=g[s][0];b(g=S);break;case 2:for(s=0;s<g.length;s++)b(g[s]);break;case 3:for(g=(function(M){var z=M.length;if(z<=1)return[M];for(var B,$,G=[],le=0;le<z;le++){var te=em(M[le]);te!==0&&($===void 0&&($=te<0),$===te<0?(B&&G.push(B),B=[M[le]]):B.push(M[le]))}return B&&G.push(B),G})(g),s=0;s<g.length;s++)for(l=0;l<g[s].length;l++)b(g[s][l])}g.length===1?g=g[0]:v="Multi"+v;var E={type:"Feature",geometry:{type:v,coordinates:g},properties:this.properties};return"id"in this&&(E.id=this.id),E};var tm=md,gd=_d;function _d(i,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],i.readFields(im,this,t),this.length=this._features.length}function im(i,t,r){i===15?t.version=r.readVarint():i===1?t.name=r.readString():i===5?t.extent=r.readVarint():i===2?t._features.push(r.pos):i===3?t._keys.push(r.readString()):i===4&&t._values.push((function(s){for(var l=null,h=s.readVarint()+s.pos;s.pos<h;){var p=s.readVarint()>>3;l=p===1?s.readString():p===2?s.readFloat():p===3?s.readDouble():p===4?s.readVarint64():p===5?s.readVarint():p===6?s.readSVarint():p===7?s.readBoolean():null}return l})(r))}_d.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var t=this._pbf.readVarint()+this._pbf.pos;return new tm(this._pbf,t,this.extent,this._keys,this._values)};var rm=gd;function nm(i,t,r){if(i===3){var s=new rm(r,r.readVarint()+r.pos);s.length&&(t[s.name]=s)}}fa.VectorTile=function(i,t){this.layers=i.readFields(nm,{},t)},fa.VectorTileFeature=md,fa.VectorTileLayer=gd;const sm=fa.VectorTileFeature.types,qu=Math.pow(2,13);function Hl(i,t,r,s,l,h,p,f){i.emplaceBack(t,r,2*Math.floor(s*qu)+p,l*qu*2,h*qu*2,Math.round(f))}class Zu{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((r=>r.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new la,this.centroidVertexArray=new sr,this.indexArray=new vn,this.programConfigurations=new qa(t.layers,t.zoom),this.segments=new Lt,this.stateDependentLayerIds=this.layers.filter((r=>r.isStateDependent())).map((r=>r.id))}populate(t,r,s){this.features=[],this.hasPattern=Uu("fill-extrusion",this.layers,r);for(const{feature:l,id:h,index:p,sourceLayerIndex:f}of t){const g=this.layers[0]._featureFilter.needGeometry,v=Ga(l,g);if(!this.layers[0]._featureFilter.filter(new oi(this.zoom),v,s))continue;const b={id:h,sourceLayerIndex:f,index:p,geometry:g?v.geometry:Za(l),properties:l.properties,type:l.type,patterns:{}};this.hasPattern?this.features.push(ju("fill-extrusion",this.layers,b,this.zoom,r)):this.addFeature(b,b.geometry,p,s,{}),r.featureIndex.insert(l,b.geometry,p,f,this.index,!0)}}addFeatures(t,r,s){for(const l of this.features){const{geometry:h}=l;this.addFeature(l,h,l.index,r,s)}}update(t,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Kf),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Yf.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,r,s,l,h){for(const p of Ri(r,500)){const f={x:0,y:0,vertexCount:0};let g=0;for(const z of p)g+=z.length;let v=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const z of p){if(z.length===0||om(z))continue;let B=0;for(let $=0;$<z.length;$++){const G=z[$];if($>=1){const le=z[$-1];if(!am(G,le)){v.vertexLength+4>Lt.MAX_VERTEX_ARRAY_LENGTH&&(v=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));
6const te=G.sub(le)._perp()._unit(),ae=le.dist(G);B+ae>32768&&(B=0),Hl(this.layoutVertexArray,G.x,G.y,te.x,te.y,0,0,B),Hl(this.layoutVertexArray,G.x,G.y,te.x,te.y,0,1,B),f.x+=2*G.x,f.y+=2*G.y,f.vertexCount+=2,B+=ae,Hl(this.layoutVertexArray,le.x,le.y,te.x,te.y,0,0,B),Hl(this.layoutVertexArray,le.x,le.y,te.x,te.y,0,1,B),f.x+=2*le.x,f.y+=2*le.y,f.vertexCount+=2;const pe=v.vertexLength;this.indexArray.emplaceBack(pe,pe+2,pe+1),this.indexArray.emplaceBack(pe+1,pe+2,pe+3),v.vertexLength+=4,v.primitiveLength+=2}}}}if(v.vertexLength+g>Lt.MAX_VERTEX_ARRAY_LENGTH&&(v=this.segments.prepareSegment(g,this.layoutVertexArray,this.indexArray)),sm[t.type]!=="Polygon")continue;const b=[],S=[],E=v.vertexLength;for(const z of p)if(z.length!==0){z!==p[0]&&S.push(b.length/2);for(let B=0;B<z.length;B++){const $=z[B];Hl(this.layoutVertexArray,$.x,$.y,0,0,1,1,0),f.x+=$.x,f.y+=$.y,f.vertexCount+=1,b.push($.x),b.push($.y)}}const M=ld(b,S);for(let z=0;z<M.length;z+=3)this.indexArray.emplaceBack(E+M[z],E+M[z+2],E+M[z+1]);v.primitiveLength+=M.length/3,v.vertexLength+=g;for(let z=0;z<f.vertexCount;z++){const B=Math.floor(f.x/f.vertexCount),$=Math.floor(f.y/f.vertexCount);this.centroidVertexArray.emplaceBack(B,$)}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,s,h,l)}}function am(i,t){return i.x===t.x&&(i.x<0||i.x>Bi)||i.y===t.y&&(i.y<0||i.y>Bi)}function om(i){return i.every((t=>t.x<0))||i.every((t=>t.x>Bi))||i.every((t=>t.y<0))||i.every((t=>t.y>Bi))}let yd;$e("FillExtrusionBucket",Zu,{omit:["layers","features"]});var lm={get paint(){return yd=yd||new u({"fill-extrusion-opacity":new Ke(he["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new ut(he["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ke(he["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ke(he["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Po(he["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new ut(he["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ut(he["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ke(he["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class cm extends n{constructor(t){super(t,lm)}createBucket(t){return new Zu(t)}queryRadius(){return Rc(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(t,r,s,l,h,p,f,g){const v=Bc(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),p.angle,f),b=this.paint.get("fill-extrusion-height").evaluate(r,s),S=this.paint.get("fill-extrusion-base").evaluate(r,s),E=(function(z,B,$,G){const le=[];for(const te of z){const ae=[te.x,te.y,0,1];Fc(ae,ae,B),le.push(new de(ae[0]/ae[3],ae[1]/ae[3]))}return le})(v,g),M=(function(z,B,$,G){const le=[],te=[],ae=G[8]*B,pe=G[9]*B,be=G[10]*B,Ne=G[11]*B,lt=G[8]*$,Fe=G[9]*$,Le=G[10]*$,et=G[11]*$;for(const He of z){const je=[],_e=[];for(const tt of He){const Qe=tt.x,_t=tt.y,ii=G[0]*Qe+G[4]*_t+G[12],ti=G[1]*Qe+G[5]*_t+G[13],Ui=G[2]*Qe+G[6]*_t+G[14],Fn=G[3]*Qe+G[7]*_t+G[15],lr=Ui+be,ji=Fn+Ne,kr=ii+lt,zr=ti+Fe,Dr=Ui+Le,Ti=Fn+et,$i=new de((ii+ae)/ji,(ti+pe)/ji);$i.z=lr/ji,je.push($i);const wr=new de(kr/Ti,zr/Ti);wr.z=Dr/Ti,_e.push(wr)}le.push(je),te.push(_e)}return[le,te]})(l,S,b,g);return(function(z,B,$){let G=1/0;Yh($,B)&&(G=vd($,B[0]));for(let le=0;le<B.length;le++){const te=B[le],ae=z[le];for(let pe=0;pe<te.length-1;pe++){const be=te[pe],Ne=[be,te[pe+1],ae[pe+1],ae[pe],be];Xh($,Ne)&&(G=Math.min(G,vd($,Ne)))}}return G!==1/0&&G})(M[0],M[1],E)}}function Wl(i,t){return i.x*t.x+i.y*t.y}function vd(i,t){if(i.length===1){let r=0;const s=t[r++];let l;for(;!l||s.equals(l);)if(l=t[r++],!l)return 1/0;for(;r<t.length;r++){const h=t[r],p=i[0],f=l.sub(s),g=h.sub(s),v=p.sub(s),b=Wl(f,f),S=Wl(f,g),E=Wl(g,g),M=Wl(v,f),z=Wl(v,g),B=b*E-S*S,$=(E*M-S*z)/B,G=(b*z-S*M)/B,le=s.z*(1-$-G)+l.z*$+h.z*G;if(isFinite(le))return le}return 1/0}{let r=1/0;for(const s of t)r=Math.min(r,s.z);return r}}const um=m([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:hm}=um,dm=m([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:pm}=dm,fm=fa.VectorTileFeature.types,mm=Math.cos(Math.PI/180*37.5),xd=Math.pow(2,14)/.5;class Gu{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((r=>
6r.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((r=>{this.gradients[r.id]={}})),this.layoutVertexArray=new Mo,this.layoutVertexArray2=new ca,this.indexArray=new vn,this.programConfigurations=new qa(t.layers,t.zoom),this.segments=new Lt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((r=>r.isStateDependent())).map((r=>r.id))}populate(t,r,s){this.hasPattern=Uu("line",this.layers,r);const l=this.layers[0].layout.get("line-sort-key"),h=!l.isConstant(),p=[];for(const{feature:f,id:g,index:v,sourceLayerIndex:b}of t){const S=this.layers[0]._featureFilter.needGeometry,E=Ga(f,S);if(!this.layers[0]._featureFilter.filter(new oi(this.zoom),E,s))continue;const M=h?l.evaluate(E,{},s):void 0,z={id:g,properties:f.properties,type:f.type,sourceLayerIndex:b,index:v,geometry:S?E.geometry:Za(f),patterns:{},sortKey:M};p.push(z)}h&&p.sort(((f,g)=>f.sortKey-g.sortKey));for(const f of p){const{geometry:g,index:v,sourceLayerIndex:b}=f;if(this.hasPattern){const S=ju("line",this.layers,f,this.zoom,r);this.patternFeatures.push(S)}else this.addFeature(f,g,v,s,{});r.featureIndex.insert(t[v].feature,g,v,b,this.index)}}update(t,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,s)}addFeatures(t,r,s){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,pm)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,hm),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,r,s,l,h){const p=this.layers[0].layout,f=p.get("line-join").evaluate(t,{}),g=p.get("line-cap"),v=p.get("line-miter-limit"),b=p.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const S of r)this.addLine(S,t,f,g,v,b);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,s,h,l)}addLine(t,r,s,l,h,p){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let G=0;G<t.length-1;G++)this.totalDistance+=t[G].dist(t[G+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const f=fm[r.type]==="Polygon";let g=t.length;for(;g>=2&&t[g-1].equals(t[g-2]);)g--;let v=0;for(;v<g-1&&t[v].equals(t[v+1]);)v++;if(g<(f?3:2))return;s==="bevel"&&(h=1.05);const b=this.overscaling<=16?15*Bi/(512*this.overscaling):0,S=this.segments.prepareSegment(10*g,this.layoutVertexArray,this.indexArray);let E,M,z,B,$;this.e1=this.e2=-1,f&&(E=t[g-2],$=t[v].sub(E)._unit()._perp());for(let G=v;G<g;G++){if(z=G===g-1?f?t[v+1]:void 0:t[G+1],z&&t[G].equals(z))continue;$&&(B=$),E&&(M=E),E=t[G],$=z?z.sub(E)._unit()._perp():B,B=B||$;let le=B.add($);le.x===0&&le.y===0||le._unit();const te=B.x*$.x+B.y*$.y,ae=le.x*$.x+le.y*$.y,pe=ae!==0?1/ae:1/0,be=2*Math.sqrt(2-2*ae),Ne=ae<mm&&M&&z,lt=B.x*$.y-B.y*$.x>0;if(Ne&&G>v){const et=E.dist(M);if(et>2*b){const He=E.sub(E.sub(M)._mult(b/et)._round());this.updateDistance(M,He),this.addCurrentVertex(He,B,0,0,S),M=He}}const Fe=M&&z;let Le=Fe?s:f?"butt":l;if(Fe&&Le==="round"&&(pe<p?Le="miter":pe<=2&&(Le="fakeround")),Le==="miter"&&pe>h&&(Le="bevel"),Le==="bevel"&&(pe>2&&(Le="flipbevel"),pe<h&&(Le="miter")),M&&this.updateDistance(M,E),Le==="miter")le._mult(pe),this.addCurrentVertex(E,le,0,0,S);else if(Le==="flipbevel"){if(pe>100)le=$.mult(-1);else{const et=pe*B.add($).mag()/B.sub($).mag();le._perp()._mult(et*(lt?-1:1))}this.addCurrentVertex(E,le,0,0,S),this.addCurrentVertex(E,le.mult(-1),0,0,S)}else if(Le==="bevel"||Le==="fakeround"){const et=-Math.sqrt(pe*pe-1),He=lt?et:0,je=lt?0:et;if(M&&this.addCurrentVertex(E,B,He,je,S),Le==="fakeround"){const _e=Math.round(180*be/Math.PI/20);for(let tt=1;tt<_e;tt++){let Qe=tt/_e;
6if(Qe!==.5){const ii=Qe-.5;Qe+=Qe*ii*(Qe-1)*((1.0904+te*(te*(3.55645-1.43519*te)-3.2452))*ii*ii+(.848013+te*(.215638*te-1.06021)))}const _t=$.sub(B)._mult(Qe)._add(B)._unit()._mult(lt?-1:1);this.addHalfVertex(E,_t.x,_t.y,!1,lt,0,S)}}z&&this.addCurrentVertex(E,$,-He,-je,S)}else if(Le==="butt")this.addCurrentVertex(E,le,0,0,S);else if(Le==="square"){const et=M?1:-1;this.addCurrentVertex(E,le,et,et,S)}else Le==="round"&&(M&&(this.addCurrentVertex(E,B,0,0,S),this.addCurrentVertex(E,B,1,1,S,!0)),z&&(this.addCurrentVertex(E,$,-1,-1,S,!0),this.addCurrentVertex(E,$,0,0,S)));if(Ne&&G<g-1){const et=E.dist(z);if(et>2*b){const He=E.add(z.sub(E)._mult(b/et)._round());this.updateDistance(E,He),this.addCurrentVertex(He,$,0,0,S),E=He}}}}addCurrentVertex(t,r,s,l,h,p=!1){const f=r.y*l-r.x,g=-r.y-r.x*l;this.addHalfVertex(t,r.x+r.y*s,r.y-r.x*s,p,!1,s,h),this.addHalfVertex(t,f,g,p,!0,-l,h),this.distance>xd/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,r,s,l,h,p))}addHalfVertex({x:t,y:r},s,l,h,p,f,g){const v=.5*(this.lineClips?this.scaledDistance*(xd-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(h?1:0),(r<<1)+(p?1:0),Math.round(63*s)+128,Math.round(63*l)+128,1+(f===0?0:f<0?-1:1)|(63&v)<<2,v>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const b=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,b),g.primitiveLength++),p?this.e2=b:this.e1=b}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,r){this.distance+=t.dist(r),this.updateScaledDistance()}}let bd,wd;$e("LineBucket",Gu,{omit:["layers","patternFeatures"]});var Sd={get paint(){return wd=wd||new u({"line-opacity":new ut(he.paint_line["line-opacity"]),"line-color":new ut(he.paint_line["line-color"]),"line-translate":new Ke(he.paint_line["line-translate"]),"line-translate-anchor":new Ke(he.paint_line["line-translate-anchor"]),"line-width":new ut(he.paint_line["line-width"]),"line-gap-width":new ut(he.paint_line["line-gap-width"]),"line-offset":new ut(he.paint_line["line-offset"]),"line-blur":new ut(he.paint_line["line-blur"]),"line-dasharray":new Co(he.paint_line["line-dasharray"]),"line-pattern":new Po(he.paint_line["line-pattern"]),"line-gradient":new Ol(he.paint_line["line-gradient"])})},get layout(){return bd=bd||new u({"line-cap":new Ke(he.layout_line["line-cap"]),"line-join":new ut(he.layout_line["line-join"]),"line-miter-limit":new Ke(he.layout_line["line-miter-limit"]),"line-round-limit":new Ke(he.layout_line["line-round-limit"]),"line-sort-key":new ut(he.layout_line["line-sort-key"])})}};class gm extends ut{possiblyEvaluate(t,r){return r=new oi(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(t,r)}evaluate(t,r,s,l){return r=ot({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(t,r,s,l)}}let Uc;class _m extends n{constructor(t){super(t,Sd),this.gradientVersion=0,Uc||(Uc=new gm(Sd.paint.properties["line-width"].specification),Uc.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){const r=this.gradientExpression();this.stepInterpolant=!!(function(s){return s._styleExpression!==void 0})(r)&&r._styleExpression.expression instanceof jn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,r){super.recalculate(t,r),this.paint._values["line-floorwidth"]=Uc.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Gu(t)}queryRadius(t){const r=t,s=Td(Ul("line-width",this,r),Ul("line-gap-width",this,r)),l=Ul("line-offset",this,r);return s/2+Math.abs(l)+Rc(this.paint.get("line-translate"))}queryIntersectsFeature(t,r,s,l,h,p,f){const g=Bc(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),p.angle,f),v=f/2*Td(this.paint.get("line-width").evaluate(r,s),this.paint.get("line-gap-width").evaluate(r,s)),b=this.paint.get("line-offset").evaluate(r,s);return b&&(l=(function(S,E){const M=[];for(let z=0;z<S.length;z++){const B=S[z],$=[];for(let G=0;G<B.length;G++){const le=B[G-1],te=B[G],ae=B[G+1],pe=G===0?new de(0,0):te.sub(le)._unit()._perp(),be=G===B.length-1?new de(0,0):ae.sub(te)._unit()._perp(),Ne=pe._add(be)._unit(),lt=Ne.x*be.x+Ne.y*be.y;lt!==0&&Ne._mult(1/lt),$.push(Ne._mult(E)._add(te))}M.push($)}return M})(l,b*f)),(function(S,E,M){for(let z=0;z<E.length;z++){const B=E[z];if(S.length>=3){for(let $=0;$<B.length;$++)if(Bo(S,B[$]))return!0}if(Af(S,B,M))return!0}return!1})(g,l,v)}isTileClipped(){return!0}}function Td(i,t){return t>0?t+2*i:i}const ym=m([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),vm=m([{name:"a_projected_pos",components:3,type:"Float32"}],4);m([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const xm=m([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);m([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Id=m([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),bm=m([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function wm(i,t,r){return i.sections.forEach((s=>{s.text=(function(l,h,p){const f=h.layout.get("text-transform").evaluate(p,{});return f==="uppercase"?l=l.toLocaleUpperCase():f==="lowercase"&&(l=l.toLocaleLowerCase()),Vr.applyArabicShaping&&(l=Vr.applyArabicShaping(l)),l})(s.text,t,r)})),i}m([{name:"triangle",components:3,type:"Uint16"}]),m([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),m([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),m([{type:"Float32",name:"offsetX"}]),m([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),m([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Xl={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Ni=24,Ad=ei,Ed=function(i,t,r,s,l){var h,p,f=8*l-s-1,g=(1<<f)-1,v=g>>1,b=-7,S=l-1,E=-1,M=i[t+S];for(S+=E,h=M&(1<<-b)-1,M>>=-b,b+=f;b>0;h=256*h+i[t+S],S+=E,b-=8);for(p=h&(1<<-b)-1,h>>=-b,b+=s;b>0;p=256*p+i[t+S],S+=E,b-=8);if(h===0)h=1-v;else{if(h===g)return p?NaN:1/0*(M?-1:1);p+=Math.pow(2,s),h-=v}return(M?-1:1)*p*Math.pow(2,h-s)},Pd=function(i,t,r,s,l,h){var p,f,g,v=8*h-l-1,b=(1<<v)-1,S=b>>1,E=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=0,z=1,B=t<0||t===0&&1
6/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(f=isNaN(t)?1:0,p=b):(p=Math.floor(Math.log(t)/Math.LN2),t*(g=Math.pow(2,-p))<1&&(p--,g*=2),(t+=p+S>=1?E/g:E*Math.pow(2,1-S))*g>=2&&(p++,g/=2),p+S>=b?(f=0,p=b):p+S>=1?(f=(t*g-1)*Math.pow(2,l),p+=S):(f=t*Math.pow(2,S-1)*Math.pow(2,l),p=0));l>=8;i[r+M]=255&f,M+=z,f/=256,l-=8);for(p=p<<l|f,v+=l;v>0;i[r+M]=255&p,M+=z,p/=256,v-=8);i[r+M-z]|=128*B};function ei(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}ei.Varint=0,ei.Fixed64=1,ei.Bytes=2,ei.Fixed32=5;var Hu=4294967296,Cd=1/Hu,Md=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function Cs(i){return i.type===ei.Bytes?i.readVarint()+i.pos:i.pos+1}function Vo(i,t,r){return r?4294967296*t+(i>>>0):4294967296*(t>>>0)+(i>>>0)}function kd(i,t,r){var s=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));r.realloc(s);for(var l=r.pos-1;l>=i;l--)r.buf[l+s]=r.buf[l]}function Sm(i,t){for(var r=0;r<i.length;r++)t.writeVarint(i[r])}function Tm(i,t){for(var r=0;r<i.length;r++)t.writeSVarint(i[r])}function Im(i,t){for(var r=0;r<i.length;r++)t.writeFloat(i[r])}function Am(i,t){for(var r=0;r<i.length;r++)t.writeDouble(i[r])}function Em(i,t){for(var r=0;r<i.length;r++)t.writeBoolean(i[r])}function Pm(i,t){for(var r=0;r<i.length;r++)t.writeFixed32(i[r])}function Cm(i,t){for(var r=0;r<i.length;r++)t.writeSFixed32(i[r])}function Mm(i,t){for(var r=0;r<i.length;r++)t.writeFixed64(i[r])}function km(i,t){for(var r=0;r<i.length;r++)t.writeSFixed64(i[r])}function jc(i,t){return(i[t]|i[t+1]<<8|i[t+2]<<16)+16777216*i[t+3]}function Uo(i,t,r){i[r]=t,i[r+1]=t>>>8,i[r+2]=t>>>16,i[r+3]=t>>>24}function zd(i,t){return(i[t]|i[t+1]<<8|i[t+2]<<16)+(i[t+3]<<24)}ei.prototype={destroy:function(){this.buf=null},readFields:function(i,t,r){for(r=r||this.length;this.pos<r;){var s=this.readVarint(),l=s>>3,h=this.pos;this.type=7&s,i(l,t,this),this.pos===h&&this.skip(s)}return t},readMessage:function(i,t){return this.readFields(i,t,this.readVarint()+this.pos)},readFixed32:function(){var i=jc(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=zd(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=jc(this.buf,this.pos)+jc(this.buf,this.pos+4)*Hu;return this.pos+=8,i},readSFixed64:function(){var i=jc(this.buf,this.pos)+zd(this.buf,this.pos+4)*Hu;return this.pos+=8,i},readFloat:function(){var i=Ed(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Ed(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var t,r,s=this.buf;return t=127&(r=s[this.pos++]),r<128?t:(t|=(127&(r=s[this.pos++]))<<7,r<128?t:(t|=(127&(r=s[this.pos++]))<<14,r<128?t:(t|=(127&(r=s[this.pos++]))<<21,r<128?t:(function(l,h,p){var f,g,v=p.buf;if(f=(112&(g=v[p.pos++]))>>4,g<128||(f|=(127&(g=v[p.pos++]))<<3,g<128)||(f|=(127&(g=v[p.pos++]))<<10,g<128)||(f|=(127&(g=v[p.pos++]))<<17,g<128)||(f|=(127&(g=v[p.pos++]))<<24,g<128)||(f|=(1&(g=v[p.pos++]))<<31,g<128))return Vo(l,f,h);throw new Error("Expected varint not more than 10 bytes")})(t|=(15&(r=s[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var i=this.readVarint()+this.pos,t=this.pos;return this.pos=i,i-t>=12&&Md?(function(r,s,l){return Md.decode(r.subarray(s,l))})(this.buf,t,i):(function(r,s,l){for(var h="",p=s;p<l;){var f,g,v,b=r[p],S=null,E=b>239?4:b>223?3:b>191?2:1;if(p+E>l)break;E===1?b<128&&(S=b):E===2?(192&(f=r[p+1]))==128&&(S=(31&b)<<6|63&f)<=127&&(S=null):E===3?(g=r[p+2],(192&(f=r[p+1]))==128&&(192&g)==128&&((S=(15&b)<<12|(63&f)<<6|63&g)<=2047||S>=55296&&S<=57343)&&(S=null)):E===4&&(g=r[p+2],v=r[p+3],(192&(f=r[p+1]))==128&&(192&g)==128&&(192&v)==128&&((S=(15&b)<<18|(63&f)<<12|(63&g)<<6|63&v)<=65535||S>=1114112)&&(S=null)),S===null?(S=65533,E=1):S>65535&&(S-=65536,h+=String.fromCharCode(S>>>10&1023|55296),S=56320|1023&S),h+=String.fromCharCode(S),p+=E}return h})(this.buf,t,i)},readBytes:function(){var i=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,i);return this.pos=i,t}
vendor: 5,635 bytes, line 6
6,readPackedVarint:function(i,t){if(this.type!==ei.Bytes)return i.push(this.readVarint(t));var r=Cs(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(t));return i},readPackedSVarint:function(i){if(this.type!==ei.Bytes)return i.push(this.readSVarint());var t=Cs(this);for(i=i||[];this.pos<t;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==ei.Bytes)return i.push(this.readBoolean());var t=Cs(this);for(i=i||[];this.pos<t;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==ei.Bytes)return i.push(this.readFloat());var t=Cs(this);for(i=i||[];this.pos<t;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==ei.Bytes)return i.push(this.readDouble());var t=Cs(this);for(i=i||[];this.pos<t;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==ei.Bytes)return i.push(this.readFixed32());var t=Cs(this);for(i=i||[];this.pos<t;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==ei.Bytes)return i.push(this.readSFixed32());var t=Cs(this);for(i=i||[];this.pos<t;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==ei.Bytes)return i.push(this.readFixed64());var t=Cs(this);for(i=i||[];this.pos<t;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==ei.Bytes)return i.push(this.readSFixed64());var t=Cs(this);for(i=i||[];this.pos<t;)i.push(this.readSFixed64());return i},skip:function(i){var t=7&i;if(t===ei.Varint)for(;this.buf[this.pos++]>127;);else if(t===ei.Bytes)this.pos=this.readVarint()+this.pos;else if(t===ei.Fixed32)this.pos+=4;else{if(t!==ei.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(i,t){this.writeVarint(i<<3|t)},realloc:function(i){for(var t=this.length||16;t<this.pos+i;)t*=2;if(t!==this.length){var r=new Uint8Array(t);r.set(this.buf),this.buf=r,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(i){this.realloc(4),Uo(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),Uo(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),Uo(this.buf,-1&i,this.pos),Uo(this.buf,Math.floor(i*Cd),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),Uo(this.buf,-1&i,this.pos),Uo(this.buf,Math.floor(i*Cd),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||i<0?(function(t,r){var s,l;if(t>=0?(s=t%4294967296|0,l=t/4294967296|0):(l=~(-t/4294967296),4294967295^(s=~(-t%4294967296))?s=s+1|0:(s=0,l=l+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),(function(h,p,f){f.buf[f.pos++]=127&h|128,h>>>=7,f.buf[f.pos++]=127&h|128,h>>>=7,f.buf[f.pos++]=127&h|128,h>>>=7,f.buf[f.pos++]=127&h|128,f.buf[f.pos]=127&(h>>>=7)})(s,0,r),(function(h,p){var f=(7&h)<<4;p.buf[p.pos++]|=f|((h>>>=3)?128:0),h&&(p.buf[p.pos++]=127&h|((h>>>=7)?128:0),h&&(p.buf[p.pos++]=127&h|((h>>>=7)?128:0),h&&(p.buf[p.pos++]=127&h|((h>>>=7)?128:0),h&&(p.buf[p.pos++]=127&h|((h>>>=7)?128:0),h&&(p.buf[p.pos++]=127&h)))))})(l,r)})(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(!!i)},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var t=this.pos;this.pos=(function(s,l,h){for(var p,f,g=0;g<l.length;g++){if((p=l.charCodeAt(g))>55295&&p<57344){if(!f){p>56319||g+1===l.length?(s[h++]=239,s[h++]=191,s[h++]=189):f=p;continue}if(p<56320){s[h++]=239,s[h++]=191,s[h++]=189,f=p;continue}p=f-55296<<10|p-56320|65536,f=null}else f&&(s[h++]=239,s[h++]=191,s[h++]=189,f=null);p<128?s[h++]=p:(p<2048?s[h++]=p>>6|192:(p<65536?s[h++]=p>>12|224:(s[h++]=p>>18|240,s[h++]=p>>12&63|128),s[h++]=p>>6&63|128),s[h++]=63&p|128)}return h})(this.buf,i,this.pos);var r=this.pos-t;r>=128&&kd(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Pd(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Pd(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var t=i.length;this.writeVarint(t),this.realloc(t);for(var r=0;r<t;r++)this.buf[this.pos++]=i[r]},writeRawMessage:function(i,t){this.pos++;var r=this.pos;i(t,this);var s=this.pos-r;s>=128&&kd(r,s,this),this.pos=r-1,this.writeVarint(s),this.pos+=s},writeMessage:function(i,t,r){this.writeTag(i,ei.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(i,t){t.length&&this.writeMessage(i,Sm,t)},writePackedSVarint:function(i,t){t.length&&this.writeMessage(i,Tm,t)},writePackedBoolean:function(i,t){t.length&&this.writeMessage(i,Em,t)},writePackedFloat:function(i,t){t.length&&this.writeMessage(i,Im,t)},writePackedDouble:function(i,t){t.length&&this.writeMessage(i,Am,t)},writePackedFixed32:function(i,t){t.length&&this.writeMessage(i,Pm,t)},writePackedSFixed32:function(i,t){t.length&&this.writeMessage(i,Cm,t)},writePackedFixed64:function(i,t){t.length&&this.writeMessage(i,Mm,t)},writePackedSFixed64:function(i,t){t.length&&this.writeMessage(i,km,t)},writeBytesField:function(i,t){this.writeTag(i,ei.Bytes),this.writeBytes(t)},writeFixed32Field:function(i,t){this.writeTag(i,ei.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(i,t){this.writeTag(i,ei.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(i,t){this.writeTag(i,ei.Fixed64),this.writeFixed64
6(t)},writeSFixed64Field:function(i,t){this.writeTag(i,ei.Fixed64),this.writeSFixed64(t)},writeVarintField:function(i,t){this.writeTag(i,ei.Varint),this.writeVarint(t)},writeSVarintField:function(i,t){this.writeTag(i,ei.Varint),this.writeSVarint(t)},writeStringField:function(i,t){this.writeTag(i,ei.Bytes),this.writeString(t)},writeFloatField:function(i,t){this.writeTag(i,ei.Fixed32),this.writeFloat(t)},writeDoubleField:function(i,t){this.writeTag(i,ei.Fixed64),this.writeDouble(t)},writeBooleanField:function(i,t){this.writeVarintField(i,!!t)}};var Wu=xe(Ad);const Xu=3;function zm(i,t,r){i===1&&r.readMessage(Dm,t)}function Dm(i,t,r){if(i===3){const{id:s,bitmap:l,width:h,height:p,left:f,top:g,advance:v}=r.readMessage(Lm,{});t.push({id:s,bitmap:new $l({width:h+2*Xu,height:p+2*Xu},l),metrics:{width:h,height:p,left:f,top:g,advance:v}})}}function Lm(i,t,r){i===1?t.id=r.readVarint():i===2?t.bitmap=r.readBytes():i===3?t.width=r.readVarint():i===4?t.height=r.readVarint():i===5?t.left=r.readSVarint():i===6?t.top=r.readSVarint():i===7&&(t.advance=r.readVarint())}const Dd=Xu;function Ld(i){let t=0,r=0;for(const p of i)t+=p.w*p.h,r=Math.max(r,p.w);i.sort(((p,f)=>f.h-p.h));const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}];let l=0,h=0;for(const p of i)for(let f=s.length-1;f>=0;f--){const g=s[f];if(!(p.w>g.w||p.h>g.h)){if(p.x=g.x,p.y=g.y,h=Math.max(h,p.y+p.h),l=Math.max(l,p.x+p.w),p.w===g.w&&p.h===g.h){const v=s.pop();f<s.length&&(s[f]=v)}else p.h===g.h?(g.x+=p.w,g.w-=p.w):p.w===g.w?(g.y+=p.h,g.h-=p.h):(s.push({x:g.x+p.w,y:g.y,w:g.w-p.w,h:p.h}),g.y+=p.h,g.h-=p.h);break}}return{w:l,h,fill:t/(l*h)||0}}const jr=1;class Yu{constructor(t,{pixelRatio:r,version:s,stretchX:l,stretchY:h,content:p,textFitWidth:f,textFitHeight:g}){this.paddedRect=t,this.pixelRatio=r,this.stretchX=l,this.stretchY=h,this.content=p,this.version=s,this.textFitWidth=f,this.textFitHeight=g}get tl(){return[this.paddedRect.x+jr,this.paddedRect.y+jr]}get br(){return[this.paddedRect.x+this.paddedRect.w-jr,this.paddedRect.y+this.paddedRect.h-jr]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*jr)/this.pixelRatio,(this.paddedRect.h-2*jr)/this.pixelRatio]}}class Rd{constructor(t,r){const s={},l={};this.haveRenderCallbacks=[];const h=[];this.addImages(t,s,h),this.addImages(r,l,h);const{w:p,h:f}=Ld(h),g=new xn({width:p||1,height:f||1});for(const v in t){const b=t[v],S=s[v].paddedRect;xn.copy(b.data,g,{x:0,y:0},{x:S.x+jr,y:S.y+jr},b.data)}for(const v in r){const b=r[v],S=l[v].paddedRect,E=S.x+jr,M=S.y+jr,z=b.data.width,B=b.data.height;xn.copy(b.data,g,{x:0,y:0},{x:E,y:M},b.data),xn.copy(b.data,g,{x:0,y:B-1},{x:E,y:M-1},{width:z,height:1}),xn.copy(b.data,g,{x:0,y:0},{x:E,y:M+B},{width:z,height:1}),xn.copy(b.data,g,{x:z-1,y:0},{x:E-1,y:M},{width:1,height:B}),xn.copy(b.data,g,{x:0,y:0},{x:E+z,y:M},{width:1,height:B})}this.image=g,this.iconPositions=s,this.patternPositions=l}addImages(t,r,s){for(const l in t){const h=t[l],p={x:0,y:0,w:h.data.width+2*jr,h:h.data.height+2*jr};s.push(p),r[l]=new Yu(p,h),h.hasRenderCallback&&this.haveRenderCallbacks.push(l)}}patchUpdatedImages(t,r){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const s in t.updatedImages)this.patchUpdatedImage(this.iconPositions[s],t.getImage(s),r),this.patchUpdatedImage(this.patternPositions[s],t.getImage(s),r)}patchUpdatedImage(t,r,s){if(!t||!r||t.version===r.version)return;t.version=r.version;const[l,h]=t.tl;s.update(r.data,void 0,{x:l,y:h})}}var ma;$e("ImagePosition",Yu),$e("ImageAtlas",Rd),A.ah=void 0,(ma=A.ah||(A.ah={}))[ma.none=0]="none",ma[ma.horizontal=1]="horizontal",ma[ma.vertical=2]="vertical",ma[ma.horizontalOnly=3]="horizontalOnly";const Yl=-17;class Kl{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,r){const s=new Kl;return s.scale=t||1,s.fontStack=r,s}static forImage(t){const r=new Kl;return r.imageName=t,r}}class jo{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,r){const s=new jo;for(let l=0;l<t.sections.length;l++){const h=t.sections[l];h.image?s.addImageSection(h):s.addTextSection(h,r)}return s}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=(function(t){let r="";for(let s=0;s<t.length;s++){const l=t.charCodeAt(s+1)||null,h=t.charCodeAt(s-1)||null;r+=l&&Pc(l)&&!Xl[t[s+1]]||h&&Pc(h)&&!Xl[t[s-1]]||!Xl[t[s]]?t[s]:Xl[t[s]]}return r})(this.text)}trim(){let t=0;for(let s=0;s<this.text.length&&qc[this.text.charCodeAt(s)];s++)t++;let r=this.text.length;for(let s=this.text.length-1;s>=0&&s>=t&&qc[this.text.charCodeAt(s)];s--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)}substring(t,r){const s=new jo;return s.text=this.text.substring(t,r),s.sectionIndex=this.sectionIndex.slice(t,r),s.sections=this.sections,s}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((t,r)=>Math.max(t,this.sections[r].scale)),0)}addTextSection(t,r){this.text+=t.text,this.sections.push(Kl.forText(t.scale,t.fontStack||r));const s=this.sections.length-1;for(let l=0;l<t.text.length;++l)this.sectionIndex.push(s)}addImageSection(t){const r=t.image?t.image.name:"";if(r.length===0)return void at("Can't add FormattedSection with an empty image.");const s=this.getNextImageSectionCharCode();s?(this.text+=String.fromCharCode(s),this.sections.push(Kl.forImage(r)),this.sectionIndex.push(this.sections.length-1)):at("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function $c(i,t,r,s,l,h,p,f,g,v,b,S,E,M,z){const B=jo.fromFeature(i,l);let $;S===A.ah.vertical&&B.verticalizePunctuation();const{processBidirectionalText:G,processStyledBidirectionalText:le}=Vr;if(G&&B.sections.length===1){$=[];const pe=G(B.toString(),Ku(B,v,h,t,s,M));for(const be of pe){const Ne=new jo;Ne.text=be,Ne.sections=B.sections;for(let lt=0;lt<be.length;lt++)Ne.sectionIndex.push(0);$.push(Ne)}}else if(le){$=[];const pe=le(B.text,B.sectionIndex,Ku(B,v,h,t,s,M));for(const be of pe){const Ne=new jo;
6Ne.text=be[0],Ne.sectionIndex=be[1],Ne.sections=B.sections,$.push(Ne)}}else $=(function(pe,be){const Ne=[],lt=pe.text;let Fe=0;for(const Le of be)Ne.push(pe.substring(Fe,Le)),Fe=Le;return Fe<lt.length&&Ne.push(pe.substring(Fe,lt.length)),Ne})(B,Ku(B,v,h,t,s,M));const te=[],ae={positionedLines:te,text:B.toString(),top:b[1],bottom:b[1],left:b[0],right:b[0],writingMode:S,iconsInText:!1,verticalizable:!1};return(function(pe,be,Ne,lt,Fe,Le,et,He,je,_e,tt,Qe){let _t=0,ii=Yl,ti=0,Ui=0;const Fn=He==="right"?1:He==="left"?0:.5;let lr=0;for(const Ti of Fe){Ti.trim();const $i=Ti.getMaxScale(),wr=($i-1)*Ni,cr={positionedGlyphs:[],lineOffset:0};pe.positionedLines[lr]=cr;const Lr=cr.positionedGlyphs;let ur=0;if(!Ti.length()){ii+=Le,++lr;continue}for(let $r=0;$r<Ti.length();$r++){const $t=Ti.getSection($r),si=Ti.getSectionIndex($r),hi=Ti.getCharCode($r);let on=0,gi=null,Go=null,as=null,os=Ni;const On=!(je===A.ah.horizontal||!tt&&!Bl(hi)||tt&&(qc[hi]||(ji=hi,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(ji)))));if($t.imageName){const Sn=lt[$t.imageName];if(!Sn)continue;as=$t.imageName,pe.iconsInText=pe.iconsInText||!0,Go=Sn.paddedRect;const Xi=Sn.displaySize;$t.scale=$t.scale*Ni/Qe,gi={width:Xi[0],height:Xi[1],left:jr,top:-Dd,advance:On?Xi[1]:Xi[0]},on=wr+(Ni-Xi[1]*$t.scale),os=gi.advance;const Ms=On?Xi[0]*$t.scale-Ni*$i:Xi[1]*$t.scale-Ni*$i;Ms>0&&Ms>ur&&(ur=Ms)}else{const Sn=Ne[$t.fontStack],Xi=Sn&&Sn[hi];if(Xi&&Xi.rect)Go=Xi.rect,gi=Xi.metrics;else{const Ms=be[$t.fontStack],rc=Ms&&Ms[hi];if(!rc)continue;gi=rc.metrics}on=($i-$t.scale)*Ni}On?(pe.verticalizable=!0,Lr.push({glyph:hi,imageName:as,x:_t,y:ii+on,vertical:On,scale:$t.scale,fontStack:$t.fontStack,sectionIndex:si,metrics:gi,rect:Go}),_t+=os*$t.scale+_e):(Lr.push({glyph:hi,imageName:as,x:_t,y:ii+on,vertical:On,scale:$t.scale,fontStack:$t.fontStack,sectionIndex:si,metrics:gi,rect:Go}),_t+=gi.advance*$t.scale+_e)}Lr.length!==0&&(ti=Math.max(_t-_e,ti),Om(Lr,0,Lr.length-1,Fn,ur)),_t=0;const wn=Le*$i+ur;cr.lineOffset=Math.max(ur,wr),ii+=wn,Ui=Math.max(wn,Ui),++lr}var ji;const kr=ii-Yl,{horizontalAlign:zr,verticalAlign:Dr}=Ju(et);(function(Ti,$i,wr,cr,Lr,ur,wn,$r,$t){const si=($i-wr)*Lr;let hi=0;hi=ur!==wn?-$r*cr-Yl:(-cr*$t+.5)*wn;for(const on of Ti)for(const gi of on.positionedGlyphs)gi.x+=si,gi.y+=hi})(pe.positionedLines,Fn,zr,Dr,ti,Ui,Le,kr,Fe.length),pe.top+=-Dr*kr,pe.bottom=pe.top+kr,pe.left+=-zr*ti,pe.right=pe.left+ti})(ae,t,r,s,$,p,f,g,S,v,E,z),!(function(pe){for(const be of pe)if(be.positionedGlyphs.length!==0)return!1;return!0})(te)&&ae}const qc={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Rm={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},Bm={40:!0};function Bd(i,t,r,s,l,h){if(t.imageName){const p=s[t.imageName];return p?p.displaySize[0]*t.scale*Ni/h+l:0}{const p=r[t.fontStack],f=p&&p[i];return f?f.metrics.advance*t.scale+l:0}}function Fd(i,t,r,s){const l=Math.pow(i-t,2);return s?i<t?l/2:2*l:l+Math.abs(r)*r}function Fm(i,t,r){let s=0;return i===10&&(s-=1e4),r&&(s+=150),i!==40&&i!==65288||(s+=50),t!==41&&t!==65289||(s+=50),s}function Od(i,t,r,s,l,h){let p=null,f=Fd(t,r,l,h);for(const g of s){const v=Fd(t-g.x,r,l,h)+g.badness;v<=f&&(p=g,f=v)}return{index:i,x:t,priorBreak:p,badness:f}}function Nd(i){return i?Nd(i.priorBreak).concat(i.index):[]}function Ku(i,t,r,s,l,h){if(!i)return[];const p=[],f=(function(S,E,M,z,B,$){let G=0;for(let le=0;le<S.length();le++){const te=S.getSection(le);G+=Bd(S.getCharCode(le),te,z,B,E,$)}return G/Math.max(1,Math.ceil(G/M))})(i,t,r,s,l,h),g=i.text.indexOf("​")>=0;let v=0;for(let S=0;S<i.length();S++){const E=i.getSection(S),M=i.getCharCode(S);if(qc[M]||(v+=Bd(M,E,s,l,t,h)),S<i.length()-1){const z=!((b=M)<11904)&&(!!Dt["CJK Compatibility Forms"](b)||!!Dt["CJK Compatibility"](b)||!!Dt["CJK Strokes"](b)||!!Dt["CJK Symbols and Punctuation"](b)||!!Dt["Enclosed CJK Letters and Months"](b)||!!Dt["Halfwidth and Fullwidth Forms"](b)||!!Dt["Ideographic Description Characters"](b)||!!Dt["Vertical Forms"](b)||Ec.test(String.fromCodePoint(b)));(Rm[M]||z||E.imageName||S!==i.length()-2&&Bm[i.getCharCode(S+1)])&&p.push(Od(S+1,v,f,p,Fm(M,i.getCharCode(S+1),z&&g),!1))}}var b;return Nd(Od(i.length(),v,f,p,0,!0))}function Ju(i){let t=.5,r=.5;switch(i){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(i){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:t,verticalAlign:r}}
6function Om(i,t,r,s,l){if(!s&&!l)return;const h=i[r],p=(i[r].x+h.metrics.advance*h.scale)*s;for(let f=t;f<=r;f++)i[f].x-=p,i[f].y+=l}function Nm(i,t,r){const{horizontalAlign:s,verticalAlign:l}=Ju(r),h=t[0]-i.displaySize[0]*s,p=t[1]-i.displaySize[1]*l;return{image:i,top:p,bottom:p+i.displaySize[1],left:h,right:h+i.displaySize[0]}}function Vd(i){var t,r;let s=i.left,l=i.top,h=i.right-s,p=i.bottom-l;const f=(t=i.image.textFitWidth)!==null&&t!==void 0?t:"stretchOrShrink",g=(r=i.image.textFitHeight)!==null&&r!==void 0?r:"stretchOrShrink",v=(i.image.content[2]-i.image.content[0])/(i.image.content[3]-i.image.content[1]);if(g==="proportional"){if(f==="stretchOnly"&&h/p<v||f==="proportional"){const b=Math.ceil(p*v);s*=b/h,h=b}}else if(f==="proportional"&&g==="stretchOnly"&&v!==0&&h/p>v){const b=Math.ceil(h/v);l*=b/p,p=b}return{x1:s,y1:l,x2:s+h,y2:l+p}}function Ud(i,t,r,s,l,h){const p=i.image;let f;if(p.content){const $=p.content,G=p.pixelRatio||1;f=[$[0]/G,$[1]/G,p.displaySize[0]-$[2]/G,p.displaySize[1]-$[3]/G]}const g=t.left*h,v=t.right*h;let b,S,E,M;r==="width"||r==="both"?(M=l[0]+g-s[3],S=l[0]+v+s[1]):(M=l[0]+(g+v-p.displaySize[0])/2,S=M+p.displaySize[0]);const z=t.top*h,B=t.bottom*h;return r==="height"||r==="both"?(b=l[1]+z-s[0],E=l[1]+B+s[2]):(b=l[1]+(z+B-p.displaySize[1])/2,E=b+p.displaySize[1]),{image:p,top:b,right:S,bottom:E,left:M,collisionPadding:f}}const Jl=255,ss=128,ga=Jl*ss;function jd(i,t){const{expression:r}=t;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new oi(i+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:s,interpolationType:l}=r;let h=0;for(;h<s.length&&s[h]<=i;)h++;h=Math.max(0,h-1);let p=h;for(;p<s.length&&s[p]<i+1;)p++;p=Math.min(s.length-1,p);const f=s[h],g=s[p];return r.kind==="composite"?{kind:"composite",minZoom:f,maxZoom:g,interpolationType:l}:{kind:"camera",minZoom:f,maxZoom:g,minSize:r.evaluate(new oi(f)),maxSize:r.evaluate(new oi(g)),interpolationType:l}}}function Qu(i,t,r){let s="never";const l=i.get(t);return l?s=l:i.get(r)&&(s="always"),s}const Vm=fa.VectorTileFeature.types,Um=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Zc(i,t,r,s,l,h,p,f,g,v,b,S,E){const M=f?Math.min(ga,Math.round(f[0])):0,z=f?Math.min(ga,Math.round(f[1])):0;i.emplaceBack(t,r,Math.round(32*s),Math.round(32*l),h,p,(M<<1)+(g?1:0),z,16*v,16*b,256*S,256*E)}function eh(i,t,r){i.emplaceBack(t.x,t.y,r),i.emplaceBack(t.x,t.y,r),i.emplaceBack(t.x,t.y,r),i.emplaceBack(t.x,t.y,r)}function jm(i){for(const t of i.sections)if(Pu(t.text))return!0;return!1}class th{constructor(t){this.layoutVertexArray=new ko,this.indexArray=new vn,this.programConfigurations=t,this.segments=new Lt,this.dynamicLayoutVertexArray=new Nl,this.opacityVertexArray=new sn,this.hasVisibleVertices=!1,this.placedSymbolArray=new li}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,r,s,l){this.isEmpty()||(s&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ym.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,vm.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Um,!0),this.opacityVertexBuffer.itemSize=1),(s||l)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}$e("SymbolBuffers",th);class ih{constructor(t,r,s){this.layoutVertexArray=new t,this.layoutAttributes=r,this.indexArray=new s,this.segments=new Lt,this.collisionVertexArray=new rs}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,xm.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}$e("CollisionBuffers",ih);class $o{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((p=>p.id)),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Ru([]),this.placementViewportMatrix=Ru([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=jd(this.zoom,r["text-size"]),this.iconSizeData=jd(this.zoom,r["icon-size"]);const s=this.layers[0].layout,l=s.get("symbol-sort-key"),h=s.get("symbol-z-order");this.canOverlap=Qu(s,"text-overlap","text-allow-overlap")!=="never"||Qu(s,"icon-overlap","icon-allow-overlap")!=="never"||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=h!=="viewport-y"&&!l.isConstant(),this.sortFeaturesByY=(h==="viewport-y"||h==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,s.get("symbol-placement")==="point"&&(this.writingModes=s.get("text-writing-mode").map((p=>
6A.ah[p]))),this.stateDependentLayerIds=this.layers.filter((p=>p.isStateDependent())).map((p=>p.id)),this.sourceID=t.sourceID}createArrays(){this.text=new th(new qa(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new th(new qa(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new ci,this.lineVertexArray=new nr,this.symbolInstances=new Mt,this.textAnchorOffsets=new ui}calculateGlyphDependencies(t,r,s,l,h){for(let p=0;p<t.length;p++)if(r[t.charCodeAt(p)]=!0,(s||l)&&h){const f=Xl[t.charAt(p)];f&&(r[f.charCodeAt(0)]=!0)}}populate(t,r,s){const l=this.layers[0],h=l.layout,p=h.get("text-font"),f=h.get("text-field"),g=h.get("icon-image"),v=(f.value.kind!=="constant"||f.value.value instanceof Ji&&!f.value.value.isEmpty()||f.value.value.toString().length>0)&&(p.value.kind!=="constant"||p.value.value.length>0),b=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,S=h.get("symbol-sort-key");if(this.features=[],!v&&!b)return;const E=r.iconDependencies,M=r.glyphDependencies,z=r.availableImages,B=new oi(this.zoom);for(const{feature:$,id:G,index:le,sourceLayerIndex:te}of t){const ae=l._featureFilter.needGeometry,pe=Ga($,ae);if(!l._featureFilter.filter(B,pe,s))continue;let be,Ne;if(ae||(pe.geometry=Za($)),v){const Fe=l.getValueAndResolveTokens("text-field",pe,s,z),Le=Ji.factory(Fe),et=this.hasRTLText=this.hasRTLText||jm(Le);(!et||Vr.getRTLTextPluginStatus()==="unavailable"||et&&Vr.isParsed())&&(be=wm(Le,l,pe))}if(b){const Fe=l.getValueAndResolveTokens("icon-image",pe,s,z);Ne=Fe instanceof mi?Fe:mi.fromString(Fe)}if(!be&&!Ne)continue;const lt=this.sortFeaturesByKey?S.evaluate(pe,{},s):void 0;if(this.features.push({id:G,text:be,icon:Ne,index:le,sourceLayerIndex:te,geometry:pe.geometry,properties:$.properties,type:Vm[$.type],sortKey:lt}),Ne&&(E[Ne.name]=!0),be){const Fe=p.evaluate(pe,{},s).join(","),Le=h.get("text-rotation-alignment")!=="viewport"&&h.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(A.ah.vertical)>=0;for(const et of be.sections)if(et.image)E[et.image.name]=!0;else{const He=Ll(be.toString()),je=et.fontStack||Fe,_e=M[je]=M[je]||{};this.calculateGlyphDependencies(et.text,_e,Le,this.allowVerticalPlacement,He)}}}h.get("symbol-placement")==="line"&&(this.features=(function($){const G={},le={},te=[];let ae=0;function pe(Fe){te.push($[Fe]),ae++}function be(Fe,Le,et){const He=le[Fe];return delete le[Fe],le[Le]=He,te[He].geometry[0].pop(),te[He].geometry[0]=te[He].geometry[0].concat(et[0]),He}function Ne(Fe,Le,et){const He=G[Le];return delete G[Le],G[Fe]=He,te[He].geometry[0].shift(),te[He].geometry[0]=et[0].concat(te[He].geometry[0]),He}function lt(Fe,Le,et){const He=et?Le[0][Le[0].length-1]:Le[0][0];return`${Fe}:${He.x}:${He.y}`}for(let Fe=0;Fe<$.length;Fe++){const Le=$[Fe],et=Le.geometry,He=Le.text?Le.text.toString():null;if(!He){pe(Fe);continue}const je=lt(He,et),_e=lt(He,et,!0);if(je in le&&_e in G&&le[je]!==G[_e]){const tt=Ne(je,_e,et),Qe=be(je,_e,te[tt].geometry);delete G[je],delete le[_e],le[lt(He,te[Qe].geometry,!0)]=Qe,te[tt].geometry=null}else je in le?be(je,_e,et):_e in G?Ne(je,_e,et):(pe(Fe),G[je]=ae-1,le[_e]=ae-1)}return te.filter((Fe=>Fe.geometry))})(this.features)),this.sortFeaturesByKey&&this.features.sort((($,G)=>$.sortKey-G.sortKey))}update(t,r,s){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,r,this.layers,s),this.icon.programConfigurations.updatePaintArrays(t,r,this.layers,s))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,r){const s=this.lineVertexArray.length;if(t.segment!==void 0){let l=t.dist(r[t.segment+1]),h=t.dist(r[t.segment]);const p={};for(let f=t.segment+1;f<r.length;f++)p[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:l},f<r.length-1&&(l+=r[f+1].dist(r[f]));for(let f=t.segment||0;f>=0;f--)p[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:h},f>0&&(h+=r[f-1].dist(r[f]));for(let f=0;f<r.length;f++){const g=p[f];this.lineVertexArray.emplaceBack(g.x,g.y,g.tileUnitDistanceFromAnchor)}}return{lineStartIndex:s,lineLength:this.lineVertexArray.length-s}}addSymbols(t,r,s,l,h,p,f,g,v,b,S,E){const M=t.indexArray,z=t.layoutVertexArray,B=t.segments.prepareSegment(4*r.length,z,M,this.canOverlap?p.sortKey:void 0),$=this.glyphOffsetArray.length,G=B.vertexLength,le=this.allowVerticalPlacement&&f===A.ah.vertical?Math.PI/2:0,te=p.text&&p.text.sections;for(let ae=0;ae<r.length;ae++){const{tl:pe,tr:be,bl:Ne,br:lt,tex:Fe,pixelOffsetTL:Le,pixelOffsetBR:et,minFontScaleX:He,minFontScaleY:je,glyphOffset:_e,isSDF:tt,sectionIndex:Qe}=r[ae],_t=B.vertexLength,ii=_e[1];Zc(z,g.x,g.y,pe.x,ii+pe.y,Fe.x,Fe.y,s,tt,Le.x,Le.y,He,je),Zc(z,g.x,g.y,be.x,ii+be.y,Fe.x+Fe.w,Fe.y,s,tt,et.x,Le.y,He,je),Zc(z,g.x,g.y,Ne.x,ii+Ne.y,Fe.x,Fe.y+Fe.h,s,tt,Le.x,et.y,He,je),Zc(z,g.x,g.y,lt.x,ii+lt.y,Fe.x+Fe.w,Fe.y+Fe.h,s,tt,et.x,et.y,He,je),eh(t.dynamicLayoutVertexArray,g,le),M.emplaceBack(_t,_t+1,_t+2),M.emplaceBack(_t+1,_t+2,_t+3),B.vertexLength+=4,B.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(_e[0]),ae!==r.length-1&&Qe===r[ae+1].sectionIndex||t.programConfigurations.populatePaintArrays(z.length,p,p.index,{},E,te&&te[Qe])}t.placedSymbolArray.emplaceBack(g.x,g.y,$,this.glyphOffsetArray.length-$,G,v,b,g.segment,s?s[0]:0,s?s[1]:0,l[0],l[1],f,0,!1,0,S)}_addCollisionDebugVertex(t,r,s,l,h,p){return r.emplaceBack(0,0),t.emplaceBack(s.x,s.y,l,h,Math.round(p.x),Math.round(p.y))}addCollisionDebugVertices(t,r,s,l,h,p,f){const g=h.segments.prepareSegment(4,h.layoutVertexArray,h.indexArray),v=g.vertexLength,b=h.layoutVertexArray,S=h.collisionVertexArray,E=f.anchorX,M=f.anchorY;this._addCollisionDebugVertex(b,S,p,E,M,new de(t,r)),this._addCollisionDebugVertex(b,S,p,E,M,new de(s,r)),this._addCollisionDebugVertex(b,S,p,E,M,new de(s,l)),this._addCollisionDebugVertex(b,S,p,E,M,new de(t,l)),g.vertexLength+=4;const z=h.indexArray;z.emplaceBack(v,v+1),z.emplaceBack(v+1,v+2),z.emplaceBack(v+2,v+3),z.emplaceBack(v+3,v),g.primitiveLength+=4}addDebugCollisionBoxes(t,r,s,l){for(let h=t;h<r;h++){const p=this.collisionBoxArray.get(h);this.addCollisionDebugVertices(p.x1,p.y1,p.x2,p.y2,l?this.textCollisionBox:this.iconCollisionBox,p.anchorPoint,s)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new ih(an,Id.members,Wi),this.iconCollisionBox=new ih(an,Id.members,Wi);for(let t=0;t<this.symbolInstances.length;t++){const r=this.symbolInstances.get(t);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(t,r,s,l,h,p,f,g,v){const b={};for(let S=r;S<s;S++){const E=t.get(S);b.textBox={x1:E.x1,y1:E.y1,x2:E.x2,y2:E.y2,anchorPointX:E.anchorPointX,anchorPointY:E.anch
6orPointY},b.textFeatureIndex=E.featureIndex;break}for(let S=l;S<h;S++){const E=t.get(S);b.verticalTextBox={x1:E.x1,y1:E.y1,x2:E.x2,y2:E.y2,anchorPointX:E.anchorPointX,anchorPointY:E.anchorPointY},b.verticalTextFeatureIndex=E.featureIndex;break}for(let S=p;S<f;S++){const E=t.get(S);b.iconBox={x1:E.x1,y1:E.y1,x2:E.x2,y2:E.y2,anchorPointX:E.anchorPointX,anchorPointY:E.anchorPointY},b.iconFeatureIndex=E.featureIndex;break}for(let S=g;S<v;S++){const E=t.get(S);b.verticalIconBox={x1:E.x1,y1:E.y1,x2:E.x2,y2:E.y2,anchorPointX:E.anchorPointX,anchorPointY:E.anchorPointY},b.verticalIconFeatureIndex=E.featureIndex;break}return b}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){const s=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,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}addIndicesForPlacedSymbol(t,r){const s=t.placedSymbolArray.get(r),l=s.vertexStartIndex+4*s.numGlyphs;for(let h=s.vertexStartIndex;h<l;h+=4)t.indexArray.emplaceBack(h,h+1,h+2),t.indexArray.emplaceBack(h+1,h+2,h+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(t),s=Math.cos(t),l=[],h=[],p=[];for(let f=0;f<this.symbolInstances.length;++f){p.push(f);const g=this.symbolInstances.get(f);l.push(0|Math.round(r*g.anchorX+s*g.anchorY)),h.push(g.featureIndex)}return p.sort(((f,g)=>l[f]-l[g]||h[g]-h[f])),p}addToSortKeyRanges(t,r){const s=this.sortKeyRanges[this.sortKeyRanges.length-1];s&&s.sortKey===r?s.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const r of this.symbolInstanceIndexes){const s=this.symbolInstances.get(r);this.featureSortOrder.push(s.featureIndex),[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex].forEach(((l,h,p)=>{l>=0&&p.indexOf(l)===h&&this.addIndicesForPlacedSymbol(this.text,l)})),s.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,s.verticalPlacedTextSymbolIndex),s.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.placedIconSymbolIndex),s.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let $d,qd;$e("SymbolBucket",$o,{omit:["layers","collisionBoxArray","features","compareText"]}),$o.MAX_GLYPHS=65535,$o.addDynamicAttributes=eh;var rh={get paint(){return qd=qd||new u({"icon-opacity":new ut(he.paint_symbol["icon-opacity"]),"icon-color":new ut(he.paint_symbol["icon-color"]),"icon-halo-color":new ut(he.paint_symbol["icon-halo-color"]),"icon-halo-width":new ut(he.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ut(he.paint_symbol["icon-halo-blur"]),"icon-translate":new Ke(he.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ke(he.paint_symbol["icon-translate-anchor"]),"text-opacity":new ut(he.paint_symbol["text-opacity"]),"text-color":new ut(he.paint_symbol["text-color"],{runtimeType:Ki,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new ut(he.paint_symbol["text-halo-color"]),"text-halo-width":new ut(he.paint_symbol["text-halo-width"]),"text-halo-blur":new ut(he.paint_symbol["text-halo-blur"]),"text-translate":new Ke(he.paint_symbol["text-translate"]),"text-translate-anchor":new Ke(he.paint_symbol["text-translate-anchor"])})},get layout(){return $d=$d||new u({"symbol-placement":new Ke(he.layout_symbol["symbol-placement"]),"symbol-spacing":new Ke(he.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ke(he.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ut(he.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ke(he.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ke(he.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ke(he.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ke(he.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ke(he.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ke(he.layout_symbol["icon-rotation-alignment"]),"icon-size":new ut(he.layout_symbol["icon-size"]),"icon-text-fit":new Ke(he.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ke(he.layout_symbol["icon-text-fit-padding"]),"icon-image":new ut(he.layout_symbol["icon-image"]),"icon-rotate":new ut(he.layout_symbol["icon-rotate"]),"icon-padding":new ut(he.layout_symbol["icon-padding"]),"icon-keep-upright":new Ke(he.layout_symbol["icon-keep-upright"]),"icon-offset":new ut(he.layout_symbol["icon-offset"]),"icon-anchor":new ut(he.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ke(he.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ke(he.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ke(he.layout_symbol["text-rotation-alignment"]),"text-field":new ut(he.layout_symbol["text-field"]),"text-font":new ut(he.layout_symbol["text-font"]),"text-size":new ut(he.layout_symbol["text-size"]),"text-max-width":new ut(he.layout_symbol["text-max-width"]),"text-line-height":new Ke(he.layout_symbol["text-line-height"]),"text-letter-spacing":new ut(he.layout_symbol["text-letter-spacing"]),"text-justify":new ut(he.layout_symbol["text-justify"]),"text-radial-offset":new ut(he.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ke(he.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new ut(he.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new ut(he.layout_symbol["text-anchor"]),"text-max-angle":new Ke(he.layout_symbol["text-max-angle"]),"text-writing-mode":new Ke(he.layout_symbol["text-writing-mode"]),"text-rotate":new ut(he.layout_symbol["text-rotate"]),"text-padding":new Ke(he.layout_symbol["text-padding"]),"text-keep-upright":new Ke(he.layout_symbol["text-keep-upright"]),"text-transform":new ut(he.layout_symbol["text-transform"]),"text-offset":new ut(he.layout_symbol["text-offset"]),"text-allow-overlap":new Ke(he.layout_symbol["text-allow-overlap"]),"text-overlap":new Ke(he.layout_symbol["text-overlap"]),"text-ignore-placement":new Ke(he.layout_symbol["text-ignore-placement"]),"text-optional":new Ke(he.layout_symbol["text-optional"])})}};class Zd{constructor(t){if(t.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:Rr,this.defaultValue=t}evaluate(t){if(t.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(t.formattedSection))return r.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}$e("FormatSectionOverride",Zd,{omit:["defaultValue"]});class Gc extends n{constructor(t){super(t,rh)}recalculate(t,r){if(super.recalculate(t,r),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")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const s=this.layout.get("text-writing-mode");if(s){const l=[];for(const h of s)l.indexOf(h)<0&&l.push(h);this.layout._values["text-writing-mode"]=l}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,r,s,l){const h=this.layout.get(t).evaluate(r,{},s,l),p=this._unevaluatedLayout._values[t];return p.isDataDriven()||go(p.value)||!h?h:(function(f,g){return g.replace(/{([^{}]+)}/g,((v,b)=>f&&b in f?String(f[b]):""))})(r.properties,h)}createBucket(t){return new $o(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of rh.paint.overridableProperties){if(!Gc.hasPaintOverride(this.layout,t))continue;const r=this.paint.get(t),s=new Zd(r),l=new mo(s,r.property.specification);let h=null;h=r.value.kind==="constant"||r.value.kind==="source"?new Qs("source",l):new ea("composite",l,r.value.zoomStops),this.paint._values[t]=new Rn(r.property,h,r.parameters)}}_handleOverridablePaintPropertyUpdate(t,r,s){return!(!this.layout||r.isDataDriven()||s.isDataDriven())&&Gc.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,r){const s=t.get("text-field"),l=rh.paint.properties[r];let h=!1;const p=f=>{for(const g of f)if(l.overrides&&l.overrides.hasOverride(g))return void(h=!0)};if(s.value.kind==="constant"&&s.value.value instanceof Ji)p(s.value.value.sections);else if(s.value.kind==="source"){const f=v=>{h||(v instanceof xi&&zt(v.value)===Fr?p(v.value.sections):v instanceof Us?p(v.sections):v.eachChild(f))},g=s.value;g._styleExpression&&f(g._styleExpression.expression)}return h}}let Gd;var $m={get paint(){return Gd=Gd||new u({"background-color":new Ke(he.paint_background["background-color"]),"background-pattern":new Co(he.paint_background["background-pattern"]),"background-opacity":new Ke(he.paint_background["background-opacity"])})}};class qm extends n{constructor(t){super(t,$m)}}let Hd;var Zm={get paint(){return Hd=Hd||new u({"raster-opacity":new Ke(he.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ke(he.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ke(he.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ke(he.paint_raster["raster-brightness-max"]),"raster-saturation":new Ke(he.paint_raster["raster-saturation"]),"raster-contrast":new Ke(he.paint_raster["raster-contrast"]),"raster-resampling":new Ke(he.paint_raster["raster-resampling"]),"raster-fade-duration":new Ke(he.paint_raster["raster-fade-duration"])})}};class Gm extends n{constructor(t){super(t,Zm)}}class Hm extends n{constructor(t){super(t,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=t}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class Wm{constructor(t){this._methodToThrottle=t,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._methodToThrottle()}),0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const nh=63710088e-1;class _a{constructor(t,r){if(isNaN(t)||isNaN(r))throw new Error(`Invalid LngLat object: (${t}, ${r})`);if(this.lng=+t,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new _a(Ge(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const r=Math.PI/180,s=this.lat*r,l=t.lat*r,h=Math.sin(s)*Math.sin(l)+Math.cos(s)*Math.cos(l)*Math.cos((t.lng-this.lng)*r);return nh*Math.acos(Math.min(h,1))}static convert(t){if(t instanceof _a)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new _a(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new _a(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const Wd=2*Math.PI*nh;function Xd(i){return Wd*Math.cos(i*Math.PI/180)}function Yd(i){return(180+i)/360}function Kd(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function Jd(i,t){return i/Xd(t)}function sh(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180)
6)-90}class Ql{constructor(t,r,s=0){this.x=+t,this.y=+r,this.z=+s}static fromLngLat(t,r=0){const s=_a.convert(t);return new Ql(Yd(s.lng),Kd(s.lat),Jd(r,s.lat))}toLngLat(){return new _a(360*this.x-180,sh(this.y))}toAltitude(){return this.z*Xd(sh(this.y))}meterInMercatorCoordinateUnits(){return 1/Wd*(t=sh(this.y),1/Math.cos(t*Math.PI/180));var t}}function Qd(i,t,r){var s=2*Math.PI*6378137/256/Math.pow(2,r);return[i*s-2*Math.PI*6378137/2,t*s-2*Math.PI*6378137/2]}class ah{constructor(t,r,s){if(!(function(l,h,p){return!(l<0||l>25||p<0||p>=Math.pow(2,l)||h<0||h>=Math.pow(2,l))})(t,r,s))throw new Error(`x=${r}, y=${s}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=r,this.y=s,this.key=ec(0,t,t,r,s)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,r,s){const l=(p=this.y,f=this.z,g=Qd(256*(h=this.x),256*(p=Math.pow(2,f)-p-1),f),v=Qd(256*(h+1),256*(p+1),f),g[0]+","+g[1]+","+v[0]+","+v[1]);var h,p,f,g,v;const b=(function(S,E,M){let z,B="";for(let $=S;$>0;$--)z=1<<$-1,B+=(E&z?1:0)+(M&z?2:0);return B})(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(s==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,b).replace(/{bbox-epsg-3857}/g,l)}isChildOf(t){const r=this.z-t.z;return r>0&&t.x===this.x>>r&&t.y===this.y>>r}getTilePoint(t){const r=Math.pow(2,this.z);return new de((t.x*r-this.x)*Bi,(t.y*r-this.y)*Bi)}toString(){return`${this.z}/${this.x}/${this.y}`}}class ep{constructor(t,r){this.wrap=t,this.canonical=r,this.key=ec(t,r.z,r.z,r.x,r.y)}}class bn{constructor(t,r,s,l,h){if(t<s)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${s}`);this.overscaledZ=t,this.wrap=r,this.canonical=new ah(s,+l,+h),this.key=ec(r,t,s,l,h)}clone(){return new bn(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-t;return t>this.canonical.z?new bn(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new bn(t,this.wrap,t,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(t,r){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const s=this.canonical.z-t;return t>this.canonical.z?ec(this.wrap*+r,t,this.canonical.z,this.canonical.x,this.canonical.y):ec(this.wrap*+r,t,t,this.canonical.x>>s,this.canonical.y>>s)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const r=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>r&&t.canonical.y===this.canonical.y>>r}children(t){if(this.overscaledZ>=t)return[new bn(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,s=2*this.canonical.x,l=2*this.canonical.y;return[new bn(r,this.wrap,r,s,l),new bn(r,this.wrap,r,s+1,l),new bn(r,this.wrap,r,s,l+1),new bn(r,this.wrap,r,s+1,l+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new bn(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new bn(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new ep(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new Ql(t.x-this.wrap,t.y))}}function ec(i,t,r,s,l){(i*=2)<0&&(i=-1*i-1);const h=1<<r;return(h*h*i+h*l+s).toString(36)+r.toString(36)+t.toString(36)}$e("CanonicalTileID",ah),$e("OverscaledTileID",bn,{omit:["posMatrix"]});class tp{constructor(t,r,s,l=1,h=1,p=1,f=0){if(this.uid=t,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(s&&!["mapbox","terrarium","custom"].includes(s))return void at(`"${s}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=r.height;const g=this.dim=r.height-2;switch(this.data=new Uint32Array(r.data.buffer),s){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;
6case"custom":this.redFactor=l,this.greenFactor=h,this.blueFactor=p,this.baseShift=f;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let v=0;v<g;v++)this.data[this._idx(-1,v)]=this.data[this._idx(0,v)],this.data[this._idx(g,v)]=this.data[this._idx(g-1,v)],this.data[this._idx(v,-1)]=this.data[this._idx(v,0)],this.data[this._idx(v,g)]=this.data[this._idx(v,g-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(g,-1)]=this.data[this._idx(g-1,0)],this.data[this._idx(-1,g)]=this.data[this._idx(0,g-1)],this.data[this._idx(g,g)]=this.data[this._idx(g-1,g-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let v=0;v<g;v++)for(let b=0;b<g;b++){const S=this.get(v,b);S>this.max&&(this.max=S),S<this.min&&(this.min=S)}}get(t,r){const s=new Uint8Array(this.data.buffer),l=4*this._idx(t,r);return this.unpack(s[l],s[l+1],s[l+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,r){if(t<-1||t>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(t+1)}unpack(t,r,s){return t*this.redFactor+r*this.greenFactor+s*this.blueFactor-this.baseShift}getPixels(){return new xn({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,r,s){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let l=r*this.dim,h=r*this.dim+this.dim,p=s*this.dim,f=s*this.dim+this.dim;switch(r){case-1:l=h-1;break;case 1:h=l+1}switch(s){case-1:p=f-1;break;case 1:f=p+1}const g=-r*this.dim,v=-s*this.dim;for(let b=p;b<f;b++)for(let S=l;S<h;S++)this.data[this._idx(S,b)]=t.data[this._idx(S+g,b+v)]}}$e("DEMData",tp);class ip{constructor(t){this._stringToNumber={},this._numberToString=[];for(let r=0;r<t.length;r++){const s=t[r];this._stringToNumber[s]=r,this._numberToString[r]=s}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class rp{constructor(t,r,s,l,h){this.type="Feature",this._vectorTileFeature=t,t._z=r,t._x=s,t._y=l,this.properties=t.properties,this.id=h}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(t[r]=this[r]);return t}}class np{constructor(t,r){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new ra(Bi,16,0),this.grid3D=new ra(Bi,16,0),this.featureIndexArray=new xr,this.promoteId=r}insert(t,r,s,l,h,p){const f=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,l,h);const g=p?this.grid3D:this.grid;for(let v=0;v<r.length;v++){const b=r[v],S=[1/0,1/0,-1/0,-1/0];for(let E=0;E<b.length;E++){const M=b[E];S[0]=Math.min(S[0],M.x),S[1]=Math.min(S[1],M.y),S[2]=Math.max(S[2],M.x),S[3]=Math.max(S[3],M.y)}S[0]<Bi&&S[1]<Bi&&S[2]>=0&&S[3]>=0&&g.insert(f,S[0],S[1],S[2],S[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new fa.VectorTile(new Wu(this.rawTileData)).layers,this.sourceLayerCoder=new ip(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,r,s,l){this.loadVTLayers();const h=t.params||{},p=Bi/t.tileSize/t.scale,f=vl(h.filter),g=t.queryGeometry,v=t.queryPadding*p,b=ap(g),S=this.grid.query(b.minX-v,b.minY-v,b.maxX+v,b.maxY+v),E=ap(t.cameraQueryGeometry),M=this.grid3D.query(E.minX-v,E.minY-v,E.maxX+v,E.maxY+v,(($,G,le,te)=>(function(ae,pe,be,Ne,lt){for(const Le of ae)if(pe<=Le.x&&be<=Le.y&&Ne>=Le.x&&lt>=Le.y)return!0;const Fe=[new de(pe,be),new de(pe,lt),new de(Ne,lt),new de(Ne,be)];if(ae.length>2){for(const Le of Fe)if(Bo(ae,Le))return!0}for(let Le=0;Le<ae.length-1;Le++)if(Pf(ae[Le],ae[Le+1],Fe))return!0;return!1})(t.cameraQueryGeometry,$-v,G-v,le+v,te+v)));for(const $ of M)S.push($);S.sort(Xm);const z={};let B;for(let $=0;$<S.length;$++){const G=S[$];if(G===B)continue;B=G;const le=this.featureIndexArray.get(G);let te=null;
6this.loadMatchingFeature(z,le.bucketIndex,le.sourceLayerIndex,le.featureIndex,f,h.layers,h.availableImages,r,s,l,((ae,pe,be)=>(te||(te=Za(ae)),pe.queryIntersectsFeature(g,ae,be,te,this.z,t.transform,p,t.pixelPosMatrix))))}return z}loadMatchingFeature(t,r,s,l,h,p,f,g,v,b,S){const E=this.bucketLayerIDs[r];if(p&&!(function($,G){for(let le=0;le<$.length;le++)if(G.indexOf($[le])>=0)return!0;return!1})(p,E))return;const M=this.sourceLayerCoder.decode(s),z=this.vtLayers[M].feature(l);if(h.needGeometry){const $=Ga(z,!0);if(!h.filter(new oi(this.tileID.overscaledZ),$,this.tileID.canonical))return}else if(!h.filter(new oi(this.tileID.overscaledZ),z))return;const B=this.getId(z,M);for(let $=0;$<E.length;$++){const G=E[$];if(p&&p.indexOf(G)<0)continue;const le=g[G];if(!le)continue;let te={};B&&b&&(te=b.getState(le.sourceLayer||"_geojsonTileLayer",B));const ae=ot({},v[G]);ae.paint=sp(ae.paint,le.paint,z,te,f),ae.layout=sp(ae.layout,le.layout,z,te,f);const pe=!S||S(z,le,te);if(!pe)continue;const be=new rp(z,this.z,this.x,this.y,B);be.layer=ae;let Ne=t[G];Ne===void 0&&(Ne=t[G]=[]),Ne.push({featureIndex:l,feature:be,intersectionZ:pe})}}lookupSymbolFeatures(t,r,s,l,h,p,f,g){const v={};this.loadVTLayers();const b=vl(h);for(const S of t)this.loadMatchingFeature(v,s,l,S,b,p,f,g,r);return v}hasLayer(t){for(const r of this.bucketLayerIDs)for(const s of r)if(t===s)return!0;return!1}getId(t,r){let s=t.id;return this.promoteId&&(s=t.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof s=="boolean"&&(s=Number(s))),s}}function sp(i,t,r,s,l){return Ve(i,((h,p)=>{const f=t instanceof Ua?t.get(p):null;return f&&f.evaluate?f.evaluate(r,s,l):f}))}function ap(i){let t=1/0,r=1/0,s=-1/0,l=-1/0;for(const h of i)t=Math.min(t,h.x),r=Math.min(r,h.y),s=Math.max(s,h.x),l=Math.max(l,h.y);return{minX:t,minY:r,maxX:s,maxY:l}}function Xm(i,t){return t-i}function op(i,t,r,s,l){const h=[];for(let p=0;p<i.length;p++){const f=i[p];let g;for(let v=0;v<f.length-1;v++){let b=f[v],S=f[v+1];b.x<t&&S.x<t||(b.x<t?b=new de(t,b.y+(t-b.x)/(S.x-b.x)*(S.y-b.y))._round():S.x<t&&(S=new de(t,b.y+(t-b.x)/(S.x-b.x)*(S.y-b.y))._round()),b.y<r&&S.y<r||(b.y<r?b=new de(b.x+(r-b.y)/(S.y-b.y)*(S.x-b.x),r)._round():S.y<r&&(S=new de(b.x+(r-b.y)/(S.y-b.y)*(S.x-b.x),r)._round()),b.x>=s&&S.x>=s||(b.x>=s?b=new de(s,b.y+(s-b.x)/(S.x-b.x)*(S.y-b.y))._round():S.x>=s&&(S=new de(s,b.y+(s-b.x)/(S.x-b.x)*(S.y-b.y))._round()),b.y>=l&&S.y>=l||(b.y>=l?b=new de(b.x+(l-b.y)/(S.y-b.y)*(S.x-b.x),l)._round():S.y>=l&&(S=new de(b.x+(l-b.y)/(S.y-b.y)*(S.x-b.x),l)._round()),g&&b.equals(g[g.length-1])||(g=[b],h.push(g)),g.push(S)))))}}return h}$e("FeatureIndex",np,{omit:["rawTileData","sourceLayerCoder"]});class ya extends de{constructor(t,r,s,l){super(t,r),this.angle=s,l!==void 0&&(this.segment=l)}clone(){return new ya(this.x,this.y,this.angle,this.segment)}}function lp(i,t,r,s,l){if(t.segment===void 0||r===0)return!0;let h=t,p=t.segment+1,f=0;for(;f>-r/2;){if(p--,p<0)return!1;f-=i[p].dist(h),h=i[p]}f+=i[p].dist(i[p+1]),p++;const g=[];let v=0;for(;f<r/2;){const b=i[p],S=i[p+1];if(!S)return!1;let E=i[p-1].angleTo(b)-b.angleTo(S);for(E=Math.abs((E+3*Math.PI)%(2*Math.PI)-Math.PI),g.push({distance:f,angleDelta:E}),v+=E;f-g[0].distance>s;)v-=g.shift().angleDelta;if(v>l)return!1;p++,f+=b.dist(S)}return!0}function cp(i){let t=0;for(let r=0;r<i.length-1;r++)t+=i[r].dist(i[r+1]);return t}function up(i,t,r){return i?.6*t*r:0}function hp(i,t){return Math.max(i?i.right-i.left:0,t?t.right-t.left:0)}function Ym(i,t,r,s,l,h){const p=up(r,l,h),f=hp(r,s)*h;let g=0;const v=cp(i)/2;for(let b=0;b<i.length-1;b++){const S=i[b],E=i[b+1],M=S.dist(E);if(g+M>v){const z=(v-g)/M,B=er.number(S.x,E.x,z),$=er.number(S.y,E.y,z),G=new ya(B,$,E.angleTo(S),b);return G._round(),!p||lp(i,G,f,p,t)?G:void 0}g+=M}}function Km(i,t,r,s,l,h,p,f,g){const v=up(s,h,p),b=hp(s,l),S=b*p,E=i[0].x===0||i[0].x===g||i[0].y===0||i[0].y===g;return t-S<t/4&&(t=S+t/4),dp(i,E?t/2*f%t:(b/2+2*h)*p*f%t,t,v,r,S,E,!1,g)}function dp(i,t,r,s,l,h,p,f,g){const v=h/2,b=cp(i);let S=0,E=t-r,M=[];for(let z=0;z<i.length-1;z++){const B=i[z],$=i[z+1],G=B.dist($),le=$.angleTo(B);for(;E+r<S+G;){E+=r;
6const te=(E-S)/G,ae=er.number(B.x,$.x,te),pe=er.number(B.y,$.y,te);if(ae>=0&&ae<g&&pe>=0&&pe<g&&E-v>=0&&E+v<=b){const be=new ya(ae,pe,le,z);be._round(),s&&!lp(i,be,h,s,l)||M.push(be)}}S+=G}return f||M.length||p||(M=dp(i,S/2,r,s,l,h,p,!0,g)),M}$e("Anchor",ya);const qo=jr;function pp(i,t,r,s){const l=[],h=i.image,p=h.pixelRatio,f=h.paddedRect.w-2*qo,g=h.paddedRect.h-2*qo;let v={x1:i.left,y1:i.top,x2:i.right,y2:i.bottom};const b=h.stretchX||[[0,f]],S=h.stretchY||[[0,g]],E=(_e,tt)=>_e+tt[1]-tt[0],M=b.reduce(E,0),z=S.reduce(E,0),B=f-M,$=g-z;let G=0,le=M,te=0,ae=z,pe=0,be=B,Ne=0,lt=$;if(h.content&&s){const _e=h.content,tt=_e[2]-_e[0],Qe=_e[3]-_e[1];(h.textFitWidth||h.textFitHeight)&&(v=Vd(i)),G=Hc(b,0,_e[0]),te=Hc(S,0,_e[1]),le=Hc(b,_e[0],_e[2]),ae=Hc(S,_e[1],_e[3]),pe=_e[0]-G,Ne=_e[1]-te,be=tt-le,lt=Qe-ae}const Fe=v.x1,Le=v.y1,et=v.x2-Fe,He=v.y2-Le,je=(_e,tt,Qe,_t)=>{const ii=Wc(_e.stretch-G,le,et,Fe),ti=Xc(_e.fixed-pe,be,_e.stretch,M),Ui=Wc(tt.stretch-te,ae,He,Le),Fn=Xc(tt.fixed-Ne,lt,tt.stretch,z),lr=Wc(Qe.stretch-G,le,et,Fe),ji=Xc(Qe.fixed-pe,be,Qe.stretch,M),kr=Wc(_t.stretch-te,ae,He,Le),zr=Xc(_t.fixed-Ne,lt,_t.stretch,z),Dr=new de(ii,Ui),Ti=new de(lr,Ui),$i=new de(lr,kr),wr=new de(ii,kr),cr=new de(ti/p,Fn/p),Lr=new de(ji/p,zr/p),ur=t*Math.PI/180;if(ur){const $t=Math.sin(ur),si=Math.cos(ur),hi=[si,-$t,$t,si];Dr._matMult(hi),Ti._matMult(hi),wr._matMult(hi),$i._matMult(hi)}const wn=_e.stretch+_e.fixed,$r=tt.stretch+tt.fixed;return{tl:Dr,tr:Ti,bl:wr,br:$i,tex:{x:h.paddedRect.x+qo+wn,y:h.paddedRect.y+qo+$r,w:Qe.stretch+Qe.fixed-wn,h:_t.stretch+_t.fixed-$r},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:cr,pixelOffsetBR:Lr,minFontScaleX:be/p/et,minFontScaleY:lt/p/He,isSDF:r}};if(s&&(h.stretchX||h.stretchY)){const _e=fp(b,B,M),tt=fp(S,$,z);for(let Qe=0;Qe<_e.length-1;Qe++){const _t=_e[Qe],ii=_e[Qe+1];for(let ti=0;ti<tt.length-1;ti++)l.push(je(_t,tt[ti],ii,tt[ti+1]))}}else l.push(je({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:f+1},{fixed:0,stretch:g+1}));return l}function Hc(i,t,r){let s=0;for(const l of i)s+=Math.max(t,Math.min(r,l[1]))-Math.max(t,Math.min(r,l[0]));return s}function fp(i,t,r){const s=[{fixed:-qo,stretch:0}];for(const[l,h]of i){const p=s[s.length-1];s.push({fixed:l-p.stretch,stretch:p.stretch}),s.push({fixed:l-p.stretch,stretch:p.stretch+(h-l)})}return s.push({fixed:t+qo,stretch:r}),s}function Wc(i,t,r,s){return i/t*r+s}function Xc(i,t,r,s){return i-t*r/s}class Yc{constructor(t,r,s,l,h,p,f,g,v,b){var S;if(this.boxStartIndex=t.length,v){let E=p.top,M=p.bottom;const z=p.collisionPadding;z&&(E-=z[1],M+=z[3]);let B=M-E;B>0&&(B=Math.max(10,B),this.circleDiameter=B)}else{const E=!((S=p.image)===null||S===void 0)&&S.content&&(p.image.textFitWidth||p.image.textFitHeight)?Vd(p):{x1:p.left,y1:p.top,x2:p.right,y2:p.bottom};E.y1=E.y1*f-g[0],E.y2=E.y2*f+g[2],E.x1=E.x1*f-g[3],E.x2=E.x2*f+g[1];const M=p.collisionPadding;if(M&&(E.x1-=M[0]*f,E.y1-=M[1]*f,E.x2+=M[2]*f,E.y2+=M[3]*f),b){const z=new de(E.x1,E.y1),B=new de(E.x2,E.y1),$=new de(E.x1,E.y2),G=new de(E.x2,E.y2),le=b*Math.PI/180;z._rotate(le),B._rotate(le),$._rotate(le),G._rotate(le),E.x1=Math.min(z.x,B.x,$.x,G.x),E.x2=Math.max(z.x,B.x,$.x,G.x),E.y1=Math.min(z.y,B.y,$.y,G.y),E.y2=Math.max(z.y,B.y,$.y,G.y)}t.emplaceBack(r.x,r.y,E.x1,E.y1,E.x2,E.y2,s,l,h)}this.boxEndIndex=t.length}}class Jm{constructor(t=[],r=((s,l)=>s<l?-1:s>l?1:0)){if(this.data=t,this.length=this.data.length,this.compare=r,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;const t=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:r,compare:s}=this,l=r[t];for(;t>0;){const h=t-1>>1,p=r[h];if(s(l,p)>=0)break;r[t]=p,t=h}r[t]=l}_down(t){const{data:r,compare:s}=this,l=this.length>>1,h=r[t];for(;t<l;){let p=1+(t<<1);const f=p+1;if(f<this.length&&s(r[f],r[p])<0&&(p=f),s(r[p],h)>=0)break;r[t]=r[p],t=p}r[t]=h}}function Qm(i,t=1,r=!1){let s=1/0,l=1/0,h=-1/0,p=-1/0;const f=i[0];for(let M=0;M<f.length;M++){const z=f[M];(!M||z.x<s)&&(s=z.x),(!M||z.y<l)&&(l=z.y),(!M||z.x>h)&&(h=z.x),(!M||z.y>p)&&(p=z.y)}const g=Math.min(h-s,p-l);let v=g/2;const b=new Jm([],eg);if(g===0)return new de(s,l);for(let M=s;M<h;M+=g)for(let z=l;z<p;z+=g)b.push(new Zo(M+v,z+v,v,i));let S=(function(M){let z=0,B=0,$=0;const G=M[0];for(let le=0,te=G.length,ae=te-1;le<te;ae=le++){const pe=G[le],be=G[ae],Ne=pe.x*be.y-be.x*pe.y;B+=(pe.x+be.x)*Ne,$+=(pe.y+be.y)*Ne,z+=3*Ne}return new Zo(B/z,$/z,0,M)})(i),E=b.length;for(;b.length;){const M=b.pop();(M.d>S.d||!S.d)&&(S=M,r&&console.log("found best %d after %d probes",Math.round(1e4*M.d)/1e4,E)),M.max-S.d<=t||(v=M.h/2,b.push(new Zo(M.p.x-v,M.p.y-v,v,i)),b.pu
6sh(new Zo(M.p.x+v,M.p.y-v,v,i)),b.push(new Zo(M.p.x-v,M.p.y+v,v,i)),b.push(new Zo(M.p.x+v,M.p.y+v,v,i)),E+=4)}return r&&(console.log(`num probes: ${E}`),console.log(`best distance: ${S.d}`)),S.p}function eg(i,t){return t.max-i.max}function Zo(i,t,r,s){this.p=new de(i,t),this.h=r,this.d=(function(l,h){let p=!1,f=1/0;for(let g=0;g<h.length;g++){const v=h[g];for(let b=0,S=v.length,E=S-1;b<S;E=b++){const M=v[b],z=v[E];M.y>l.y!=z.y>l.y&&l.x<(z.x-M.x)*(l.y-M.y)/(z.y-M.y)+M.x&&(p=!p),f=Math.min(f,Kh(l,M,z))}}return(p?1:-1)*Math.sqrt(f)})(this.p,s),this.max=this.d+this.h*Math.SQRT2}var or;A.aq=void 0,(or=A.aq||(A.aq={}))[or.center=1]="center",or[or.left=2]="left",or[or.right=3]="right",or[or.top=4]="top",or[or.bottom=5]="bottom",or[or["top-left"]=6]="top-left",or[or["top-right"]=7]="top-right",or[or["bottom-left"]=8]="bottom-left",or[or["bottom-right"]=9]="bottom-right";const va=7,oh=Number.POSITIVE_INFINITY;function mp(i,t){return t[1]!==oh?(function(r,s,l){let h=0,p=0;switch(s=Math.abs(s),l=Math.abs(l),r){case"top-right":case"top-left":case"top":p=l-va;break;case"bottom-right":case"bottom-left":case"bottom":p=-l+va}switch(r){case"top-right":case"bottom-right":case"right":h=-s;break;case"top-left":case"bottom-left":case"left":h=s}return[h,p]})(i,t[0],t[1]):(function(r,s){let l=0,h=0;s<0&&(s=0);const p=s/Math.SQRT2;switch(r){case"top-right":case"top-left":h=p-va;break;case"bottom-right":case"bottom-left":h=-p+va;break;case"bottom":h=-s+va;break;case"top":h=s-va}switch(r){case"top-right":case"bottom-right":l=-p;break;case"top-left":case"bottom-left":l=p;break;case"left":l=s;break;case"right":l=-s}return[l,h]})(i,t[0])}function gp(i,t,r){var s;const l=i.layout,h=(s=l.get("text-variable-anchor-offset"))===null||s===void 0?void 0:s.evaluate(t,{},r);if(h){const f=h.values,g=[];for(let v=0;v<f.length;v+=2){const b=g[v]=f[v],S=f[v+1].map((E=>E*Ni));b.startsWith("top")?S[1]-=va:b.startsWith("bottom")&&(S[1]+=va),g[v+1]=S}return new Pr(g)}const p=l.get("text-variable-anchor");if(p){let f;f=i._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[l.get("text-radial-offset").evaluate(t,{},r)*Ni,oh]:l.get("text-offset").evaluate(t,{},r).map((v=>v*Ni));const g=[];for(const v of p)g.push(v,mp(v,f));return new Pr(g)}return null}function lh(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function tg(i,t,r,s,l,h,p,f,g,v,b){let S=h.textMaxSize.evaluate(t,{});S===void 0&&(S=p);const E=i.layers[0].layout,M=E.get("icon-offset").evaluate(t,{},b),z=yp(r.horizontal),B=p/24,$=i.tilePixelRatio*B,G=i.tilePixelRatio*S/24,le=i.tilePixelRatio*f,te=i.tilePixelRatio*E.get("symbol-spacing"),ae=E.get("text-padding")*i.tilePixelRatio,pe=(function(_e,tt,Qe,_t=1){const ii=_e.get("icon-padding").evaluate(tt,{},Qe),ti=ii&&ii.values;return[ti[0]*_t,ti[1]*_t,ti[2]*_t,ti[3]*_t]})(E,t,b,i.tilePixelRatio),be=E.get("text-max-angle")/180*Math.PI,Ne=E.get("text-rotation-alignment")!=="viewport"&&E.get("symbol-placement")!=="point",lt=E.get("icon-rotation-alignment")==="map"&&E.get("symbol-placement")!=="point",Fe=E.get("symbol-placement"),Le=te/2,et=E.get("icon-text-fit");let He;s&&et!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(He=Ud(s,r.vertical,et,E.get("icon-text-fit-padding"),M,B)),z&&(s=Ud(s,z,et,E.get("icon-text-fit-padding"),M,B)));const je=(_e,tt)=>{tt.x<0||tt.x>=Bi||tt.y<0||tt.y>=Bi||(function(Qe,_t,ii,ti,Ui,Fn,lr,ji,kr,zr,Dr,Ti,$i,wr,cr,Lr,ur,wn,$r,$t,si,hi,on,gi,Go){const as=Qe.addToLineVertexArray(_t,ii);let os,On,Sn,Xi,Ms=0,rc=0,wp=0,Sp=0,gh=-1,_h=-1;const ks={};let Tp=zo("");if(Qe.allowVerticalPlacement&&ti.vertical){const Sr=ji.layout.get("text-rotate").evaluate(si,{},gi)+90;Sn=new Yc(kr,_t,zr,Dr,Ti,ti.vertical,$i,wr,cr,Sr),lr&&(Xi=new Yc(kr,_t,zr,Dr,Ti,lr,ur,wn,cr,Sr))}if(Ui){const Sr=ji.layout.get("icon-rotate").evaluate(si,{}),Tn=ji.layout.get("icon-text-fit")!=="none",Wa=pp(Ui,Sr,on,Tn),Xn=lr?pp(lr,Sr,on,Tn):void 0;On=new Yc(kr,_t,zr,Dr,Ti,Ui,ur,wn,!1,Sr),Ms=4*Wa.length;const Xa=Qe.iconSizeData;let ls=null;Xa.kind==="source"?(ls=[ss*ji.layout.get("icon-size").evaluate(si,{})],ls[0]>ga&&at(`${Qe.layerIds[0]}: Value for "icon-size" is >= ${Jl}. Reduce your "icon-size".`)):Xa.kind==="composite"&&(ls=[ss*hi.compositeIconSizes[0].evaluate(si,{},gi),ss*hi.compositeIconSizes[1].evaluate(si,{},gi)],(ls[0]>ga||ls[1]>ga)&&at(`${Qe.layerIds[0]}: Value for "icon-size" is >= ${Jl}. Reduce your "icon-size".`)),Qe.addSymbols(Qe.icon,Wa,ls,$t,$r,si,A.ah.none,_t,as.lineStartIndex,as.lineLength,-1,gi),gh=Qe.icon.placedSymbolArray.length-1,Xn&&(rc=4*Xn.length,Qe.addSymbols(Qe.icon,Xn,ls,$t,$r,si,A.ah.vertical,_t,as.lineStartIndex,as.lineLength,-1,gi),_h=Qe.icon.placedSymbolArray.length-1)}const Ip=Object.keys(ti.horizontal);for(const Sr of Ip){const Tn=ti.horizontal[Sr];if(!os){Tp=zo(Tn.text);const Xn=ji.layout.get("text-rotate").evaluate(si,{},gi);os=new Yc(kr,_t,zr,Dr,Ti,Tn,$i,wr,cr,Xn)}const Wa=Tn.positionedLines.length===1;if(wp+=_p(Qe,_t,Tn,Fn,ji,cr,si,Lr,as,ti.vertical?A.ah.horizontal:A.ah.horizontalOnly,Wa?Ip:[Sr],ks,gh,hi,gi),Wa)break}ti.vertical&&(Sp+=_p(Qe,_t,ti.vertical,Fn,ji,cr,si,Lr,as,A.ah.vertical,["vertical"],ks,_h,hi,gi));const ng=os?os.boxStartIndex:Qe.collisionBoxArray.length,sg=os?os.boxEndIndex:Qe.collisionBoxArray.length,ag=Sn?Sn.boxStartIndex:Qe.collisionBoxArray.length,og=Sn?Sn.boxEndIndex:Qe.collisionBoxArray.length,lg=On?On.boxStartIndex:Qe.collisionBoxArray.length,cg=On?On.boxEndIndex:Qe.collisionBoxArray.length,ug=Xi?Xi.boxStartIndex:Qe.collisionBoxArray.length,hg=Xi?Xi.boxEndIndex:Qe.collisionBoxArray.length;let Wn=-1;const Jc=(Sr,Tn)=>Sr&&Sr.circleDiameter?Math.max(Sr.circleDiameter,Tn):Tn;Wn=Jc(os,Wn),Wn=Jc(Sn,Wn),Wn=Jc(On,Wn),Wn=Jc(Xi,Wn);const Ap=Wn>-1?1:0;Ap&&(Wn*=Go/Ni),Qe.glyphOffsetArray.length>=$o.MAX_GLYPHS&&at("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),si.sortKey!==void 0&&Qe.addToSortKey
6Ranges(Qe.symbolInstances.length,si.sortKey);const dg=gp(ji,si,gi),[pg,fg]=(function(Sr,Tn){const Wa=Sr.length,Xn=Tn==null?void 0:Tn.values;if((Xn==null?void 0:Xn.length)>0)for(let Xa=0;Xa<Xn.length;Xa+=2){const ls=Xn[Xa+1];Sr.emplaceBack(A.aq[Xn[Xa]],ls[0],ls[1])}return[Wa,Sr.length]})(Qe.textAnchorOffsets,dg);Qe.symbolInstances.emplaceBack(_t.x,_t.y,ks.right>=0?ks.right:-1,ks.center>=0?ks.center:-1,ks.left>=0?ks.left:-1,ks.vertical||-1,gh,_h,Tp,ng,sg,ag,og,lg,cg,ug,hg,zr,wp,Sp,Ms,rc,Ap,0,$i,Wn,pg,fg)})(i,tt,_e,r,s,l,He,i.layers[0],i.collisionBoxArray,t.index,t.sourceLayerIndex,i.index,$,[ae,ae,ae,ae],Ne,g,le,pe,lt,M,t,h,v,b,p)};if(Fe==="line")for(const _e of op(t.geometry,0,0,Bi,Bi)){const tt=Km(_e,te,be,r.vertical||z,s,24,G,i.overscaling,Bi);for(const Qe of tt)z&&ig(i,z.text,Le,Qe)||je(_e,Qe)}else if(Fe==="line-center"){for(const _e of t.geometry)if(_e.length>1){const tt=Ym(_e,be,r.vertical||z,s,24,G);tt&&je(_e,tt)}}else if(t.type==="Polygon")for(const _e of Ri(t.geometry,0)){const tt=Qm(_e,16);je(_e[0],new ya(tt.x,tt.y,0))}else if(t.type==="LineString")for(const _e of t.geometry)je(_e,new ya(_e[0].x,_e[0].y,0));else if(t.type==="Point")for(const _e of t.geometry)for(const tt of _e)je([tt],new ya(tt.x,tt.y,0))}function _p(i,t,r,s,l,h,p,f,g,v,b,S,E,M,z){const B=(function(le,te,ae,pe,be,Ne,lt,Fe){const Le=pe.layout.get("text-rotate").evaluate(Ne,{})*Math.PI/180,et=[];for(const He of te.positionedLines)for(const je of He.positionedGlyphs){if(!je.rect)continue;const _e=je.rect||{};let tt=Dd+1,Qe=!0,_t=1,ii=0;const ti=(be||Fe)&&je.vertical,Ui=je.metrics.advance*je.scale/2;if(Fe&&te.verticalizable&&(ii=He.lineOffset/2-(je.imageName?-(Ni-je.metrics.width*je.scale)/2:(je.scale-1)*Ni)),je.imageName){const $t=lt[je.imageName];Qe=$t.sdf,_t=$t.pixelRatio,tt=jr/_t}const Fn=be?[je.x+Ui,je.y]:[0,0];let lr=be?[0,0]:[je.x+Ui+ae[0],je.y+ae[1]-ii],ji=[0,0];ti&&(ji=lr,lr=[0,0]);const kr=je.metrics.isDoubleResolution?2:1,zr=(je.metrics.left-tt)*je.scale-Ui+lr[0],Dr=(-je.metrics.top-tt)*je.scale+lr[1],Ti=zr+_e.w/kr*je.scale/_t,$i=Dr+_e.h/kr*je.scale/_t,wr=new de(zr,Dr),cr=new de(Ti,Dr),Lr=new de(zr,$i),ur=new de(Ti,$i);if(ti){const $t=new de(-Ui,Ui-Yl),si=-Math.PI/2,hi=Ni/2-Ui,on=new de(5-Yl-hi,-(je.imageName?hi:0)),gi=new de(...ji);wr._rotateAround(si,$t)._add(on)._add(gi),cr._rotateAround(si,$t)._add(on)._add(gi),Lr._rotateAround(si,$t)._add(on)._add(gi),ur._rotateAround(si,$t)._add(on)._add(gi)}if(Le){const $t=Math.sin(Le),si=Math.cos(Le),hi=[si,-$t,$t,si];wr._matMult(hi),cr._matMult(hi),Lr._matMult(hi),ur._matMult(hi)}const wn=new de(0,0),$r=new de(0,0);et.push({tl:wr,tr:cr,bl:Lr,br:ur,tex:_e,writingMode:te.writingMode,glyphOffset:Fn,sectionIndex:je.sectionIndex,isSDF:Qe,pixelOffsetTL:wn,pixelOffsetBR:$r,minFontScaleX:0,minFontScaleY:0})}return et})(0,r,f,l,h,p,s,i.allowVerticalPlacement),$=i.textSizeData;let G=null;$.kind==="source"?(G=[ss*l.layout.get("text-size").evaluate(p,{})],G[0]>ga&&at(`${i.layerIds[0]}: Value for "text-size" is >= ${Jl}. Reduce your "text-size".`)):$.kind==="composite"&&(G=[ss*M.compositeTextSizes[0].evaluate(p,{},z),ss*M.compositeTextSizes[1].evaluate(p,{},z)],(G[0]>ga||G[1]>ga)&&at(`${i.layerIds[0]}: Value for "text-size" is >= ${Jl}. Reduce your "text-size".`)),i.addSymbols(i.text,B,G,f,h,p,v,t,g.lineStartIndex,g.lineLength,E,z);for(const le of b)S[le]=i.text.placedSymbolArray.length-1;return 4*B.length}function yp(i){for(const t in i)return i[t];return null}function ig(i,t,r,s){const l=i.compareText;if(t in l){const h=l[t];for(let p=h.length-1;p>=0;p--)if(s.dist(h[p])<r)return!0}else l[t]=[];return l[t].push(s),!1}const vp=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class ch{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[r,s]=new Uint8Array(t,0,2);if(r!==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 h=vp[15&s];if(!h)throw new Error("Unrecognized array type.");const[p]=new Uint16Array(t,2,1),[f]=new Uint32Array(t,4,1);return new ch(f,p,h,t)}constructor(t,r=64,s=Float64Array,l){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=s,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const h=vp.indexOf(this.ArrayType),p=2*t*this.ArrayType.BYTES_PER_ELEMENT,f=t*this.IndexArrayType.BYTES_PER_ELEMENT,g=(8-f%8)%8;if(h<0)throw new Error(`Unexpected typed array class: ${s}.`);l&&l instanceof ArrayBuffer?(this.data=l,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+f+g,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+p+f
6+g),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+f+g,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+h]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=t)}add(t,r){const s=this._pos>>1;return this.ids[s]=s,this.coords[this._pos++]=t,this.coords[this._pos++]=r,s}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return uh(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,r,s,l){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:h,coords:p,nodeSize:f}=this,g=[0,h.length-1,0],v=[];for(;g.length;){const b=g.pop()||0,S=g.pop()||0,E=g.pop()||0;if(S-E<=f){for(let $=E;$<=S;$++){const G=p[2*$],le=p[2*$+1];G>=t&&G<=s&&le>=r&&le<=l&&v.push(h[$])}continue}const M=E+S>>1,z=p[2*M],B=p[2*M+1];z>=t&&z<=s&&B>=r&&B<=l&&v.push(h[M]),(b===0?t<=z:r<=B)&&(g.push(E),g.push(M-1),g.push(1-b)),(b===0?s>=z:l>=B)&&(g.push(M+1),g.push(S),g.push(1-b))}return v}within(t,r,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:h,nodeSize:p}=this,f=[0,l.length-1,0],g=[],v=s*s;for(;f.length;){const b=f.pop()||0,S=f.pop()||0,E=f.pop()||0;if(S-E<=p){for(let $=E;$<=S;$++)bp(h[2*$],h[2*$+1],t,r)<=v&&g.push(l[$]);continue}const M=E+S>>1,z=h[2*M],B=h[2*M+1];bp(z,B,t,r)<=v&&g.push(l[M]),(b===0?t-s<=z:r-s<=B)&&(f.push(E),f.push(M-1),f.push(1-b)),(b===0?t+s>=z:r+s>=B)&&(f.push(M+1),f.push(S),f.push(1-b))}return g}}function uh(i,t,r,s,l,h){if(l-s<=r)return;const p=s+l>>1;xp(i,t,p,s,l,h),uh(i,t,r,s,p-1,1-h),uh(i,t,r,p+1,l,1-h)}function xp(i,t,r,s,l,h){for(;l>s;){if(l-s>600){const v=l-s+1,b=r-s+1,S=Math.log(v),E=.5*Math.exp(2*S/3),M=.5*Math.sqrt(S*E*(v-E)/v)*(b-v/2<0?-1:1);xp(i,t,r,Math.max(s,Math.floor(r-b*E/v+M)),Math.min(l,Math.floor(r+(v-b)*E/v+M)),h)}const p=t[2*r+h];let f=s,g=l;for(tc(i,t,s,r),t[2*l+h]>p&&tc(i,t,s,l);f<g;){for(tc(i,t,f,g),f++,g--;t[2*f+h]<p;)f++;for(;t[2*g+h]>p;)g--}t[2*s+h]===p?tc(i,t,s,g):(g++,tc(i,t,g,l)),g<=r&&(s=g+1),r<=g&&(l=g-1)}}function tc(i,t,r,s){hh(i,r,s),hh(t,2*r,2*s),hh(t,2*r+1,2*s+1)}function hh(i,t,r){const s=i[t];i[t]=i[r],i[r]=s}function bp(i,t,r,s){const l=i-r,h=t-s;return l*l+h*h}var dh;A.bg=void 0,(dh=A.bg||(A.bg={})).create="create",dh.load="load",dh.fullLoad="fullLoad";let Kc=null,ic=[];const ph=1e3/60,fh="loadTime",mh="fullLoadTime",rg={mark(i){performance.mark(i)},frame(i){const t=i;Kc!=null&&ic.push(t-Kc),Kc=t},clearMetrics(){Kc=null,ic=[],performance.clearMeasures(fh),performance.clearMeasures(mh);for(const i in A.bg)performance.clearMarks(A.bg[i])},getPerformanceMetrics(){performance.measure(fh,A.bg.create,A.bg.load),performance.measure(mh,A.bg.create,A.bg.fullLoad);const i=performance.getEntriesByName(fh)[0].duration,t=performance.getEntriesByName(mh)[0].duration,r=ic.length,s=1/(ic.reduce(((h,p)=>h+p),0)/r/1e3),l=ic.filter((h=>h>ph)).reduce(((h,p)=>h+(p-ph)/ph),0);return{loadTime:i,fullLoadTime:t,fps:s,percentDroppedFrames:l/(r+l)*100,totalFrames:r}}};A.$=class extends T{},A.A=Fo,A.B=Su,A.C=function(i){if(Xt==null){const t=i.navigator?i.navigator.userAgent:null;Xt=!!i.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Xt},A.D=Ke,A.E=Vn,A.F=class{constructor(i,t){this.target=i,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Wm((()=>this.process())),this.subscription=(function(r,s,l,h){return r.addEventListener(s,l,!1),{unsubscribe:()=>{r.removeEventListener(s,l,!1)}}})(this.target,"message",(r=>this.receive(r))),this.globalScope=pt(self)?i:window}registerMessageHandler(i,t){this.messageHandlers[i]=t}sendAsync(i,t){return new Promise(((r,s)=>{const l=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[l]={resolve:r,reject:s},t&&t.signal.addEventListener("abort",(()=>{delete this.resolveRejects[l];const f={id:l,type:"<cancel>",origin:location.origin,targetMapId:i.targetMapId,sourceMapId:this.mapId};this.target.postMessage(f)}),{once:!0});const h=[],p=Object.assign(Object.assign({},i),{id:l,sourceMapId:this.mapId,origin:location.origin,data:na(i.data,h)});this.target.postMessage(p,{transfer:h})}))}receive(i){const t=i.data,r=t.id;if(!(t.origin!=="file://"&&location.origin!=="file://"&&t.origin!=="resource://android"&&location.origin!=="resource://android"&&t.origin!==location.origin||t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type==="<cancel>"){delete this.tasks[r];const s=this.abortControllers[r];return delete this.abortControllers[r],void(s&&s.abort())}if(pt(self)||t.mustQueue)return this.tasks[r]=t,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,t)}}process(){if(this.taskQueue.length===0)return;const i=this.taskQueue.shift(),t=this.tasks[i];delete this.tasks[i],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(i,t)}processTask(i,t){return d(this,void 0,void 0,(function*(){if(t.type==="<response>"){const l=this.resolveRejects[i];return delete this.resolveRejects[i],l?void(t.error?l.reject(sa(t.error)):l.resolve(sa(t.data))):void 0}if(!this.messageHandlers[t.type])return void this.completeTask(i,new Error(`Could not find a registered handler for ${t.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const r=sa(t.data),s=new AbortController;this.abortControllers[i]=s;try{const l=yield this.messageHandlers[t.type](t.sourceMapId,r,s);this.completeTask(i,null,l)}catch(l){this.completeTask(i,l)}}))}completeTask(i,t,r){const s=[];delete this.abortControllers[i];const l={id:i,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?na(t):null,data:na(r,s)};this.target.postMessage(l,{transfer:s})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},A.G=Yn,A.H=function(){var i=new Fo(16);return Fo!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},A.I=Yu,A.J=function(i,t,r){var s,l,h,p,f,g,v,b,S,E,M,z,B=r[0],$=r[1],G=r[2];return t===i?(i[12]=t[0]*B+t[4]*$+t[8]*G+t[12],i[13]=t[1]*B+t[5]*$+t[9]*G+t[13],i[14]=t[2]*B+t[6]*$+t[10]*G+t[14],i[15]=t[3]*B+t[7]*$+t[11]*G+t[15]):(l=t[1],h=t[2],p=t[3],f=t[4],g=t[5],v=t[6],b=t[7],S=t[8],E=t[9],M=t[10],z=t[11],i[0]=s=t[0],i[1]=l,i[2]=h,i[3]=
6p,i[4]=f,i[5]=g,i[6]=v,i[7]=b,i[8]=S,i[9]=E,i[10]=M,i[11]=z,i[12]=s*B+f*$+S*G+t[12],i[13]=l*B+g*$+E*G+t[13],i[14]=h*B+v*$+M*G+t[14],i[15]=p*B+b*$+z*G+t[15]),i},A.K=function(i,t,r){var s=r[0],l=r[1],h=r[2];return i[0]=t[0]*s,i[1]=t[1]*s,i[2]=t[2]*s,i[3]=t[3]*s,i[4]=t[4]*l,i[5]=t[5]*l,i[6]=t[6]*l,i[7]=t[7]*l,i[8]=t[8]*h,i[9]=t[9]*h,i[10]=t[10]*h,i[11]=t[11]*h,i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15],i},A.L=td,A.M=function(i,t){const r={};for(let s=0;s<t.length;s++){const l=t[s];l in i&&(r[l]=i[l])}return r},A.N=_a,A.O=Yd,A.P=de,A.Q=Kd,A.R=xn,A.S=bn,A.T=Eo,A.U=st,A.V=xt,A.W=Nn,A.X=Bi,A.Y=m,A.Z=Ql,A._=d,A.a=ki,A.a$=function(i,t){var r=i[0],s=i[1],l=i[2],h=i[3],p=i[4],f=i[5],g=i[6],v=i[7],b=i[8],S=i[9],E=i[10],M=i[11],z=i[12],B=i[13],$=i[14],G=i[15],le=t[0],te=t[1],ae=t[2],pe=t[3],be=t[4],Ne=t[5],lt=t[6],Fe=t[7],Le=t[8],et=t[9],He=t[10],je=t[11],_e=t[12],tt=t[13],Qe=t[14],_t=t[15];return Math.abs(r-le)<=Mr*Math.max(1,Math.abs(r),Math.abs(le))&&Math.abs(s-te)<=Mr*Math.max(1,Math.abs(s),Math.abs(te))&&Math.abs(l-ae)<=Mr*Math.max(1,Math.abs(l),Math.abs(ae))&&Math.abs(h-pe)<=Mr*Math.max(1,Math.abs(h),Math.abs(pe))&&Math.abs(p-be)<=Mr*Math.max(1,Math.abs(p),Math.abs(be))&&Math.abs(f-Ne)<=Mr*Math.max(1,Math.abs(f),Math.abs(Ne))&&Math.abs(g-lt)<=Mr*Math.max(1,Math.abs(g),Math.abs(lt))&&Math.abs(v-Fe)<=Mr*Math.max(1,Math.abs(v),Math.abs(Fe))&&Math.abs(b-Le)<=Mr*Math.max(1,Math.abs(b),Math.abs(Le))&&Math.abs(S-et)<=Mr*Math.max(1,Math.abs(S),Math.abs(et))&&Math.abs(E-He)<=Mr*Math.max(1,Math.abs(E),Math.abs(He))&&Math.abs(M-je)<=Mr*Math.max(1,Math.abs(M),Math.abs(je))&&Math.abs(z-_e)<=Mr*Math.max(1,Math.abs(z),Math.abs(_e))&&Math.abs(B-tt)<=Mr*Math.max(1,Math.abs(B),Math.abs(tt))&&Math.abs($-Qe)<=Mr*Math.max(1,Math.abs($),Math.abs(Qe))&&Math.abs(G-_t)<=Mr*Math.max(1,Math.abs(G),Math.abs(_t))},A.a0=Lt,A.a1=ah,A.a2=Ae,A.a3=i=>{const t=window.document.createElement("video");return t.muted=!0,new Promise((r=>{t.onloadstart=()=>{r(t)};for(const s of i){const l=window.document.createElement("source");Vt(s)||(t.crossOrigin="Anonymous"),l.src=s,t.appendChild(l)}}))},A.a4=function(){return ge++},A.a5=Oe,A.a6=$o,A.a7=vl,A.a8=Ga,A.a9=rp,A.aA=function(i){if(i.type==="custom")return new Hm(i);switch(i.type){case"background":return new qm(i);case"circle":return new kf(i);case"fill":return new Wf(i);case"fill-extrusion":return new cm(i);case"heatmap":return new Df(i);case"hillshade":return new Rf(i);case"line":return new _m(i);case"raster":return new Gm(i);case"symbol":return new Gc(i)}},A.aB=dt,A.aC=function(i,t){if(!i)return[{command:"setStyle",args:[t]}];let r=[];try{if(!Ct(i.version,t.version))return[{command:"setStyle",args:[t]}];Ct(i.center,t.center)||r.push({command:"setCenter",args:[t.center]}),Ct(i.zoom,t.zoom)||r.push({command:"setZoom",args:[t.zoom]}),Ct(i.bearing,t.bearing)||r.push({command:"setBearing",args:[t.bearing]}),Ct(i.pitch,t.pitch)||r.push({command:"setPitch",args:[t.pitch]}),Ct(i.sprite,t.sprite)||r.push({command:"setSprite",args:[t.sprite]}),Ct(i.glyphs,t.glyphs)||r.push({command:"setGlyphs",args:[t.glyphs]}),Ct(i.transition,t.transition)||r.push({command:"setTransition",args:[t.transition]}),Ct(i.light,t.light)||r.push({command:"setLight",args:[t.light]}),Ct(i.terrain,t.terrain)||r.push({command:"setTerrain",args:[t.terrain]}),Ct(i.sky,t.sky)||r.push({command:"setSky",args:[t.sky]}),Ct(i.projection,t.projection)||r.push({command:"setProjection",args:[t.projection]});const s={},l=[];(function(p,f,g,v){let b;for(b in f=f||{},p=p||{})Object.prototype.hasOwnProperty.call(p,b)&&(Object.prototype.hasOwnProperty.call(f,b)||pn(b,g,v));for(b in f)Object.prototype.hasOwnProperty.call(f,b)&&(Object.prototype.hasOwnProperty.call(p,b)?Ct(p[b],f[b])||(p[b].type==="geojson"&&f[b].type==="geojson"&&Kn(p,f,b)?kt(g,{command:"setGeoJSONSourceData",args:[b,f[b].data]}):di(b,f,g,v)):ds(b,f,g))})(i.sources,t.sources,l,s);const h=[];i.layers&&i.layers.forEach((p=>{"source"in p&&s[p.source]?r.push({command:"removeLayer",args:[p.id]}):h.push(p)})),r=r.concat(l),(function(p,f,g){f=f||[];const v=(p=p||[]).map(ps),b=f.map(ps),S=p.reduce(fs,{}),E=f.reduce(fs,{}),M=v.slice(),z=Object.create(null);let B,$,G,le,te;for(let ae=0,pe=0;ae<v.length;ae++)B=v[ae],Object.prototype.hasOwnProperty.call(E,B)?pe++:(kt(g,{command:"removeLayer",args:[B]}),M.splice(M.indexOf(B,pe),1));for(let ae=0,pe=0;ae<b.length;ae++)B=b[b.length-1-ae],M[M.length-1-ae]!==B&&(Object.prototype.hasOwnProperty.call(S,B)?(kt(g,{command:"removeLayer",args:[B]}),M.splice(M.lastIndexOf(B,M.length-pe),1)):pe++,le=M[M.length-ae],kt(g,{command:"addLayer",args:[E[B],le]}),M.splice(M.length-ae,0,B),z[B]=!0);for(let ae=0;ae<b.length;ae++)if(B=b[ae],$=S[B],G=E[B],!z[B]&&!Ct($,G))if(Ct($.source,G.source)&&Ct($["source-layer"],G["source-layer"])&&Ct($.type,G.type)){for(te in fr($.layout,G.layout,g,B,null,"setLayoutProperty"),fr($.paint,G.paint,g,B,null,"setPaintProperty"),Ct($.filter,G.filter)||kt(g,{command:"setFilter",args:[B,G.filter]}),Ct($.minzoom,G.minzoom)&&Ct($.maxzoom,G.maxzoom)||kt(g,{command:"setLayerZoomRange",args:[B,G.minzoom,G.maxzoom]}),$)Object.prototype.hasOwnProperty.call($,te)&&te!=="layout"&&te!=="paint"&&te!=="filter"&&te!=="metadata"&&te!=="minzoom"&&te!=="maxzoom"&&(te.indexOf("paint.")===0?fr($[te],G[te],g,B,te.slice(6),"setPaintProperty"):Ct($[te],G[te])||kt(g,{command:"setLayerProperty",args:[B,te,G[te]]}));for(te in G)Object.prototype.hasOwnProperty.call(G,te)&&!Object.prototype.hasOwnProperty.call($,te)&&te!=="layout"&&te!=="paint"&&te!=="filter"&&te!=="metadata"&&te!=="minzoom"&&te!=="maxzoom"&&(te.indexOf("paint.")===0?fr($[te],G[te],g,B,te.slice(6),"setPaintProperty"):Ct($[te],G[te])||kt(g,{command:"setLayerProperty",args:[B,te,G[te]]}))}else kt(g,{command:"removeLayer",args:[B]}),le=M[M.lastIndexOf(B)+1],kt(g,{command:"addLayer",args:[G,le]})})(h,t.layers,r)}catch(s){console.warn("Unable to compute style diff:",s),r=[{command:"setStyle",args:[t]}]}return r},A.aD=function(i){const t=[],r=i.id;return r===void 0&&t.push({message:`layers.${r}: missing required property "id"`}),i.render===void 0&&t.push({message:`layers.${r}: missing required method "render"`}),i.renderingMode&&i.renderingMode!=="2d"&&i.renderingMode!=="3d"&&t.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),t},A.aE=function i(t,r){if(Array.isArray(t)){if(!Array.isArray(r)||t.length!==r.length)return!1;for(let s=0;s<t.length;s++)if(!i(t[s],r[s]))return!1;return!0}if(typeof t=="object"&&t!==null&&r!==null){if(typeof r!="object"||Object.keys(t).length!==Object.keys(r).length)return!1;for(const s in t)if(!i(t[s],r[s]))return!1;return!0}return t===r},A.aF=Ve,A.aG=qe,A.aH=class extends $a{constructor(i,t){super(i,t),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},A.aI=Dc,A.aJ=class extends $a{constructor(i,t){super(i,t),this.current=Sf}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let t=1;t<16;t++)if(i[t]!==this.current[t]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},A.aK=qh,A.aL=Zh,A.aM=Gt,A.aN=class extends $a{constructor(i,t){super(i,t),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},A.aO=class extends $a{constructor(i,t){super(i,t),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},A.aP=function(i,t,r,s,l,h,p){var f=1/(t-r),g=1/(s-l),v=1/(h-p);return i[0]=-2*f,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*g,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*v,i[11]=0,i[12]=(t+r)*f,i[13]=(l+s)*g,i[14]=(p+h)*v,i[15]=1,i},A.aQ=Mf,A.aR=class extends ne{},A.aS=bm,A.aT=class extends ce{},A.aU=Ou,A.aV=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},A.aW=ad,A.aX=sr,A.aY=vn,A.aZ=class extends Je{}
6,A.a_=function(i,t){return i[0]===t[0]&&i[1]===t[1]&&i[2]===t[2]&&i[3]===t[3]&&i[4]===t[4]&&i[5]===t[5]&&i[6]===t[6]&&i[7]===t[7]&&i[8]===t[8]&&i[9]===t[9]&&i[10]===t[10]&&i[11]===t[11]&&i[12]===t[12]&&i[13]===t[13]&&i[14]===t[14]&&i[15]===t[15]},A.aa=function(i){const t={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((r,s,l,h)=>{const p=l||h;return t[s]=!p||p.toLowerCase(),""})),t["max-age"]){const r=parseInt(t["max-age"],10);isNaN(r)?delete t["max-age"]:t["max-age"]=r}return t},A.ab=function(i,t){const r=[];for(const s in i)s in t||r.push(s);return r},A.ac=Ot,A.ad=function(i,t,r){var s=Math.sin(r),l=Math.cos(r),h=t[0],p=t[1],f=t[2],g=t[3],v=t[4],b=t[5],S=t[6],E=t[7];return t!==i&&(i[8]=t[8],i[9]=t[9],i[10]=t[10],i[11]=t[11],i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15]),i[0]=h*l+v*s,i[1]=p*l+b*s,i[2]=f*l+S*s,i[3]=g*l+E*s,i[4]=v*l-h*s,i[5]=b*l-p*s,i[6]=S*l-f*s,i[7]=E*l-g*s,i},A.ae=function(i){var t=new Fo(16);return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],t},A.af=Fc,A.ag=function(i,t){let r=0,s=0;if(i.kind==="constant")s=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:l,minZoom:h,maxZoom:p}=i,f=l?Ot(tr.interpolationFactor(l,t,h,p),0,1):0;i.kind==="camera"?s=er.number(i.minSize,i.maxSize,f):r=f}return{uSizeT:r,uSize:s}},A.ai=function(i,{uSize:t,uSizeT:r},{lowerSize:s,upperSize:l}){return i.kind==="source"?s/ss:i.kind==="composite"?er.number(s/ss,l/ss,r):t},A.aj=eh,A.ak=function(i,t,r,s){const l=t.y-i.y,h=t.x-i.x,p=s.y-r.y,f=s.x-r.x,g=p*h-f*l;if(g===0)return null;const v=(f*(i.y-r.y)-p*(i.x-r.x))/g;return new de(i.x+v*h,i.y+v*l)},A.al=op,A.am=Xh,A.an=Ru,A.ao=function(i){let t=1/0,r=1/0,s=-1/0,l=-1/0;for(const h of i)t=Math.min(t,h.x),r=Math.min(r,h.y),s=Math.max(s,h.x),l=Math.max(l,h.y);return[t,r,s,l]},A.ap=Ni,A.ar=Qu,A.as=function(i,t){var r=t[0],s=t[1],l=t[2],h=t[3],p=t[4],f=t[5],g=t[6],v=t[7],b=t[8],S=t[9],E=t[10],M=t[11],z=t[12],B=t[13],$=t[14],G=t[15],le=r*f-s*p,te=r*g-l*p,ae=r*v-h*p,pe=s*g-l*f,be=s*v-h*f,Ne=l*v-h*g,lt=b*B-S*z,Fe=b*$-E*z,Le=b*G-M*z,et=S*$-E*B,He=S*G-M*B,je=E*G-M*$,_e=le*je-te*He+ae*et+pe*Le-be*Fe+Ne*lt;return _e?(i[0]=(f*je-g*He+v*et)*(_e=1/_e),i[1]=(l*He-s*je-h*et)*_e,i[2]=(B*Ne-$*be+G*pe)*_e,i[3]=(E*be-S*Ne-M*pe)*_e,i[4]=(g*Le-p*je-v*Fe)*_e,i[5]=(r*je-l*Le+h*Fe)*_e,i[6]=($*ae-z*Ne-G*te)*_e,i[7]=(b*Ne-E*ae+M*te)*_e,i[8]=(p*He-f*Le+v*lt)*_e,i[9]=(s*Le-r*He-h*lt)*_e,i[10]=(z*be-B*ae+G*le)*_e,i[11]=(S*ae-b*be-M*le)*_e,i[12]=(f*Fe-p*et-g*lt)*_e,i[13]=(r*et-s*Fe+l*lt)*_e,i[14]=(B*te-z*pe-$*le)*_e,i[15]=(b*pe-S*te+E*le)*_e,i):null},A.at=lh,A.au=Ju,A.av=ch,A.aw=function(){const i={},t=he.$version;for(const r in he.$root){const s=he.$root[r];if(s.required){let l=null;l=r==="version"?t:s.type==="array"?[]:{},l!=null&&(i[r]=l)}}return i},A.ax=Dl,A.ay=zi,A.az=function(i){i=i.slice();const t=Object.create(null);for(let r=0;r<i.length;r++)t[i[r].id]=i[r];for(let r=0;r<i.length;r++)"ref"in i[r]&&(i[r]=dn(i[r],t[i[r].ref]));return i},A.b=Ii,A.b0=function(i,t){return i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i[4]=t[4],i[5]=t[5],i[6]=t[6],i[7]=t[7],i[8]=t[8],i[9]=t[9],i[10]=t[10],i[11]=t[11],i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15],i},A.b1=function(i,t,r){return i[0]=t[0]*r[0],i[1]=t[1]*r[1],i[2]=t[2]*r[2],i[3]=t[3]*r[3],i},A.b2=function(i,t){return i[0]*t[0]+i[1]*t[1]+i[2]*t[2]+i[3]*t[3]},A.b3=Ge,A.b4=ep,A.b5=Jd,A.b6=function(i,t,r,s,l){var h,p=1/Math.tan(t/2);return i[0]=p/r,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=p,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,l!=null&&l!==1/0?(i[10]=(l+s)*(h=1/(s-l)),i[14]=2*l*s*h):(i[10]=-1,i[14]=-2*s),i},A.b7=function(i,t,r){var s=Math.sin(r),l=Math.cos(r),h=t[4],p=t[5],f=t[6],g=t[7],v=t[8],b=t[9],S=t[10],E=t[11];return t!==i&&(i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15]),i[4]=h*l+v*s,i[5]=p*l+b*s,i[6]=f*l+S*s,i[7]=g*l+E*s,i[8]=v*l-h*s,i[9]=b*l-p*s,i[10]=S*l-f*s,i[11]=E*l-g*s,i},A.b8=we,A.b9=Vi,A.bA=Ad,A.bB=function(i){return i.message===pr},A.bC=Js,A.bD=Vr,A.ba=function(i){return i*Math.PI/180},A.bb=function(i,t){const{x:r,y:s}=Ql.fromLngLat(t);return!(i<0||i>25||s<0||s>=1||r<0||r>=1)},A.bc=function(i,t){return i[0]=t[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=t[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=t[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},A.bd=class extends w{},A.be=nh,A.bf=rg,A.bh=Zi,A.bi=function(i,t){ki.REGISTERED_PROTOCOLS[i]=t},A.bj=function(i){delete ki.REGISTERED_PROTOCOLS[i]},A.bk=function(i,t){const r={};for(let l=0;l<i.length;l++){const h=t&&t[i[l].id]||bc(i[l]);t&&(t[i[l].id]=h);let p=r[h];p||(p=r[h]=[]),p.push(i[l])}const s=[];for(const l in r)s.push(r[l]);return s},A.bl=$e,A.bm=ip,A.bn=np,A.bo=Rd,A.bp=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=Bi/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;const t=i.bucket.layers[0],r=t.layout,s=t._unevaluatedLayout._values,l={layoutIconSize:s["icon-size"].possiblyEvaluate(new oi(i.bucket.zoom+1),i.canonical),layoutTextSize:s["text-size"].possiblyEvaluate(new oi(i.bucket.zoom+1),i.canonical),textMaxSize:s["text-size"].possiblyEvaluate(new oi(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:v,maxZoom:b}=i.bucket.textSizeData;l.compositeTextSizes=[s["text-size"].possiblyEvaluate(new oi(v),i.canonical),s["text-size"].possiblyEvaluate(new oi(b),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:v,maxZoom:b}=i.bucket.iconSizeData;l.compositeIconSizes=[s["icon-size"].possiblyEvaluate(new oi(v),i.canonical),s["icon-size"].possiblyEvaluate(new oi(b),i.canonical)]}const h=r.get("text-line-height")*Ni,p=r.get("text-rotation-alignment")!=="viewport"&&r.get("symbol-placement")!=="point",f=r.get("text-keep-upright"),g=r.get("text-size");for(const v of i.bucket.features){const b=r.get("text-font").evaluate(v,{},i.canonical).join(","),S=g.evaluate(v,{},i.canonical),E=l.layoutTextSize.evaluate(v,{},i.canonical),M=l.layoutIconSize.evaluate(v,{},i.canonical),z={horizontal:{},vertical:void 0},B=v.text;let $,G=[0,0];if(B){const ae=B.toString(),pe=r.get("text-letter-spacing").evaluate(v,{},i.canonical)*Ni,be=Tu(ae)?pe:0,Ne=r.get("text-anchor").evaluate(v,{},i.canonical),lt=gp(t,v,i.canonical);if(!lt){const He=r.get("text-radial-offset").evaluate(v,{},i.canonical);G=He?mp(Ne,[He*Ni,oh]):r.get("text-offset").evaluate(v,{},i.canonical).map((je=>je*Ni))}
6let Fe=p?"center":r.get("text-justify").evaluate(v,{},i.canonical);const Le=r.get("symbol-placement")==="point"?r.get("text-max-width").evaluate(v,{},i.canonical)*Ni:1/0,et=()=>{i.bucket.allowVerticalPlacement&&Ll(ae)&&(z.vertical=$c(B,i.glyphMap,i.glyphPositions,i.imagePositions,b,Le,h,Ne,"left",be,G,A.ah.vertical,!0,E,S))};if(!p&&lt){const He=new Set;if(Fe==="auto")for(let _e=0;_e<lt.values.length;_e+=2)He.add(lh(lt.values[_e]));else He.add(Fe);let je=!1;for(const _e of He)if(!z.horizontal[_e])if(je)z.horizontal[_e]=z.horizontal[0];else{const tt=$c(B,i.glyphMap,i.glyphPositions,i.imagePositions,b,Le,h,"center",_e,be,G,A.ah.horizontal,!1,E,S);tt&&(z.horizontal[_e]=tt,je=tt.positionedLines.length===1)}et()}else{Fe==="auto"&&(Fe=lh(Ne));const He=$c(B,i.glyphMap,i.glyphPositions,i.imagePositions,b,Le,h,Ne,Fe,be,G,A.ah.horizontal,!1,E,S);He&&(z.horizontal[Fe]=He),et(),Ll(ae)&&p&&f&&(z.vertical=$c(B,i.glyphMap,i.glyphPositions,i.imagePositions,b,Le,h,Ne,Fe,be,G,A.ah.vertical,!1,E,S))}}let le=!1;if(v.icon&&v.icon.name){const ae=i.imageMap[v.icon.name];ae&&($=Nm(i.imagePositions[v.icon.name],r.get("icon-offset").evaluate(v,{},i.canonical),r.get("icon-anchor").evaluate(v,{},i.canonical)),le=!!ae.sdf,i.bucket.sdfIcons===void 0?i.bucket.sdfIcons=le:i.bucket.sdfIcons!==le&&at("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(ae.pixelRatio!==i.bucket.pixelRatio||r.get("icon-rotate").constantOr(1)!==0)&&(i.bucket.iconsNeedLinear=!0))}const te=yp(z.horizontal)||z.vertical;i.bucket.iconsInText=!!te&&te.iconsInText,(te||$)&&tg(i.bucket,v,z,$,i.imageMap,l,E,M,G,le,i.canonical)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},A.bq=Gu,A.br=$u,A.bs=Zu,A.bt=fa,A.bu=Wu,A.bv=class{constructor(i){this._marks={start:[i.url,"start"].join("#"),end:[i.url,"end"].join("#"),measure:i.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let i=performance.getEntriesByName(this._marks.measure);return i.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),i=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),i}},A.bw=function(i,t,r,s,l){return d(this,void 0,void 0,(function*(){if(xt())try{return yield Nn(i,t,r,s,l)}catch{}return(function(h,p,f,g,v){const b=h.width,S=h.height;cn&&Ai||(cn=new OffscreenCanvas(b,S),Ai=cn.getContext("2d",{willReadFrequently:!0})),cn.width=b,cn.height=S,Ai.drawImage(h,0,0,b,S);const E=Ai.getImageData(p,f,g,v);return Ai.clearRect(0,0,b,S),E.data})(i,t,r,s,l)}))},A.bx=tp,A.by=xe,A.bz=Se,A.c=qi,A.d=i=>d(void 0,void 0,void 0,(function*(){if(i.byteLength===0)return createImageBitmap(new ImageData(1,1));const t=new Blob([new Uint8Array(i)],{type:"image/png"});try{return createImageBitmap(t)}catch(r){throw new Error(`Could not load image because of ${r.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})),A.e=ot,A.f=i=>new Promise(((t,r)=>{const s=new Image;s.onload=()=>{t(s),URL.revokeObjectURL(s.src),s.onload=null,window.requestAnimationFrame((()=>{s.src=hs}))},s.onerror=()=>r(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 l=new Blob([new Uint8Array(i)],{type:"image/png"});s.src=i.byteLength?URL.createObjectURL(l):hs})),A.g=Ei,A.h=(i,t)=>Zr(ot(i,{type:"json"}),t),A.i=pt,A.j=un,A.k=Ar,A.l=(i,t)=>Zr(ot(i,{type:"arrayBuffer"}),t),A.m=Zr,A.n=function(i){return new Wu(i).readFields(zm,[])},A.o=$l,A.p=Ld,A.q=u,A.r=wu,A.s=Vt,A.t=kl,A.u=As,A.v=he,A.w=at,A.x=function([i,t,r]){return t+=90,t*=Math.PI/180,r*=Math.PI/180,{x:i*Math.cos(t)*Math.sin(r),y:i*Math.sin(t)*Math.sin(r),z:i*Math.cos(r)}},A.y=er,A.z=oi})),Y("worker",["./shared"],(function(A){class d{constructor(C){this.keyCache={},C&&this.replace(C)}replace(C){this._layerConfigs={},this._layers={},this.update(C,[])}update(C,P){for(const U of C){this._layerConfigs[U.id]=U;const ee=this._layers[U.id]=A.aA(U);ee._featureFilter=A.a7(ee.filter),this.keyCache[U.id]&&delete this.keyCache[U.id]}for(const U of P)delete this.keyCache[U],delete this._layerConfigs[U],delete this._layers[U];this.familiesBySource={};const R=A.bk(Object.values(this._layerConfigs),this.keyCache);for(const U of R){const ee=U.map((ue=>this._layers[ue.id])),re=ee[0];if(re.visibility==="none")continue;const oe=re.source||"";let X=this.familiesBySource[oe];X||(X=this.familiesBySource[oe]={});const fe=re.sourceLayer||"_geojsonTileLayer";let ve=X[fe];ve||(ve=X[fe]=[]),ve.push(ee)}}}class xe{constructor(C){const P={},R=[];for(const oe in C){const X=C[oe],fe=P[oe]={};for(const ve in X){const ue=X[+ve];if(!ue||ue.bitmap.width===0||ue.bitmap.height===0)continue;const Ee={x:0,y:0,w:ue.bitmap.width+2,h:ue.bitmap.height+2};R.push(Ee),fe[ve]={rect:Ee,metrics:ue.metrics}}}const{w:U,h:ee}=A.p(R),re=new A.o({width:U||1,height:ee||1});for(const oe in C){const X=C[oe];for(const fe in X){const ve=X[+fe];if(!ve||ve.bitmap.width===0||ve.bitmap.height===0)continue;const ue=P[oe][fe].rect;A.o.copy(ve.bitmap,re,{x:0,y:0},{x:ue.x+1,y:ue.y+1},ve.bitmap)}}this.image=re,this.positions=P}}A.bl("GlyphAtlas",xe);class Se{constructor(C){this.tileID=new A.S(C.tileID.overscaledZ,C.tileID.wrap,C.tileID.canonical.z,C.tileID.canonical.x,C.tileID.canonical.y),this.uid=C.uid,this.zoom=C.zoom,this.pixelRatio=C.pixelRatio,this.tileSize=C.tileSize,this.source=C.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=C.showCollisionBoxes,this.collectResourceTiming=!!C.collectResourceTiming,this.returnDependencies=!!C.returnDependencies,this.promoteId=C.promoteId,this.inFlightDependencies=[]}parse(C,P,R,U){return A._(this,void 0,void 0,(function*(){this.status="parsing",this.data=C,this.collisionBoxArray=new A.a5;const ee=new A.bm(Object.keys(C.layers).sort()),re=new A.bn(this.tileID,this.promoteId);
6re.bucketLayerIDs=[];const oe={},X={featureIndex:re,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:R},fe=P.familiesBySource[this.source];for(const It in fe){const Zt=C.layers[It];if(!Zt)continue;Zt.version===1&&A.w(`Vector tile source "${this.source}" layer "${It}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Yt=ee.encode(It),pi=[];for(let Di=0;Di<Zt.length;Di++){const vi=Zt.feature(Di),Hr=re.getId(vi,It);pi.push({feature:vi,id:Hr,index:Di,sourceLayerIndex:Yt})}for(const Di of fe[It]){const vi=Di[0];vi.source!==this.source&&A.w(`layer.source = ${vi.source} does not equal this.source = ${this.source}`),vi.minzoom&&this.zoom<Math.floor(vi.minzoom)||vi.maxzoom&&this.zoom>=vi.maxzoom||vi.visibility!=="none"&&(ke(Di,this.zoom,R),(oe[vi.id]=vi.createBucket({index:re.bucketLayerIDs.length,layers:Di,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Yt,sourceID:this.source})).populate(pi,X,this.tileID.canonical),re.bucketLayerIDs.push(Di.map((Hr=>Hr.id))))}}const ve=A.aF(X.glyphDependencies,(It=>Object.keys(It).map(Number)));this.inFlightDependencies.forEach((It=>It==null?void 0:It.abort())),this.inFlightDependencies=[];let ue=Promise.resolve({});if(Object.keys(ve).length){const It=new AbortController;this.inFlightDependencies.push(It),ue=U.sendAsync({type:"GG",data:{stacks:ve,source:this.source,tileID:this.tileID,type:"glyphs"}},It)}const Ee=Object.keys(X.iconDependencies);let Xe=Promise.resolve({});if(Ee.length){const It=new AbortController;this.inFlightDependencies.push(It),Xe=U.sendAsync({type:"GI",data:{icons:Ee,source:this.source,tileID:this.tileID,type:"icons"}},It)}const rt=Object.keys(X.patternDependencies);let Bt=Promise.resolve({});if(rt.length){const It=new AbortController;this.inFlightDependencies.push(It),Bt=U.sendAsync({type:"GI",data:{icons:rt,source:this.source,tileID:this.tileID,type:"patterns"}},It)}const[wt,Ft,Et]=yield Promise.all([ue,Xe,Bt]),yi=new xe(wt),ai=new A.bo(Ft,Et);for(const It in oe){const Zt=oe[It];Zt instanceof A.a6?(ke(Zt.layers,this.zoom,R),A.bp({bucket:Zt,glyphMap:wt,glyphPositions:yi.positions,imageMap:Ft,imagePositions:ai.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Zt.hasPattern&&(Zt instanceof A.bq||Zt instanceof A.br||Zt instanceof A.bs)&&(ke(Zt.layers,this.zoom,R),Zt.addFeatures(X,this.tileID.canonical,ai.patternPositions))}return this.status="done",{buckets:Object.values(oe).filter((It=>!It.isEmpty())),featureIndex:re,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:yi.image,imageAtlas:ai,glyphMap:this.returnDependencies?wt:null,iconMap:this.returnDependencies?Ft:null,glyphPositions:this.returnDependencies?yi.positions:null}}))}}function ke(Z,C,P){const R=new A.z(C);for(const U of Z)U.recalculate(R,P)}class de{constructor(C,P,R){this.actor=C,this.layerIndex=P,this.availableImages=R,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(C,P){return A._(this,void 0,void 0,(function*(){const R=yield A.l(C.request,P);try{return{vectorTile:new A.bt.VectorTile(new A.bu(R.data)),rawData:R.data,cacheControl:R.cacheControl,expires:R.expires}}catch(U){const ee=new Uint8Array(R.data);let re=`Unable to parse the tile at ${C.request.url}, `;throw re+=ee[0]===31&&ee[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${U.message}`,new Error(re)}}))}loadTile(C){return A._(this,void 0,void 0,(function*(){const P=C.uid,R=!!(C&&C.request&&C.request.collectResourceTiming)&&new A.bv(C.request),U=new Se(C);this.loading[P]=U;const ee=new AbortController;U.abort=ee;try{const re=yield this.loadVectorTile(C,ee);if(delete this.loading[P],!re)return null;const oe=re.rawData,X={};re.expires&&(X.expires=re.expires),re.cacheControl&&(X.cacheControl=re.cacheControl);const fe={};if(R){const ue=R.finish();ue&&(fe.resourceTiming=JSON.parse(JSON.stringify(ue)))}U.vectorTile=re.vectorTile;const ve=U.parse(re.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[P]=U,this.fetching[P]={rawTileData:oe,cacheControl:X,resourceTiming:fe};try{const ue=yield ve;return A.e({rawTileData:oe.slice(0)},ue,X,fe)}finally{delete this.fetching[P]}}catch(re){throw delete this.loading[P],U.status="done",this.loaded[P]=U,re}}))}reloadTile(C){return A._(this,void 0,void 0,(function*(){const P=C.uid;if(!this.loaded||!this.loaded[P])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const R=this.loaded[P];if(R.showCollisionBoxes=C.showCollisionBoxes,R.status==="parsing"){const U=yield R.parse(R.vectorTile,this.layerIndex,this.availableImages,this.actor);let ee;if(this.fetching[P]){const{rawTileData:re,cacheControl:oe,resourceTiming:X}=this.fetching[P];delete this.fetching[P],ee=A.e({rawTileData:re.slice(0)},U,oe,X)}else ee=U;return ee}if(R.status==="done"&&R.vectorTile)return R.parse(R.vectorTile,this.layerIndex,this.availableImages,this.actor)}))}abortTile(C){return A._(this,void 0,void 0,(function*(){const P=this.loading,R=C.uid;P&&P[R]&&P[R].abort&&(P[R].abort.abort(),delete P[R])}))}removeTile(C){return A._(this,void 0,void 0,(function*(){this.loaded&&this.loaded[C.uid]&&delete this.loaded[C.uid]}))}}class K{constructor(){this.loaded={}}loadTile(C){return A._(this,void 0,void 0,(function*(){const{uid:P,encoding:R,rawImageData:U,redFactor:ee,greenFactor:re,blueFactor:oe,baseShift:X}=C,fe=U.width+2,ve=U.height+2,ue=A.b(U)?new A.R({width:fe,height:ve},yield A.bw(U,-1,-1,fe,ve)):U,Ee=new A.bx(P,ue,R,ee,re,oe,X);return this.loaded=this.loaded||{},this.loaded[P]=Ee,Ee}))}removeTile(C){const P=this.loaded,R=C.uid;P&&P[R]&&delete P[R]}}function Ze(Z,C){if(Z.length!==0){vt(Z[0],C);for(var P=1;P<Z.length;P++)vt(Z[P],!C)}}function vt(Z,C){for(var P=0,R=0,U=0,ee=Z.length,re=ee-1;U<ee;re=U++){var oe=(Z[U][0]-Z[re][0])*(Z[re][1]+Z[U][1]),X=P+oe;R+=Math.abs(P)>=Math.abs(oe)?P-X+oe:oe-X+P,P=X}P+R>=0!=!!C&&Z.reverse()}var Rt=A.by((function Z(C,P){var R,U=C&&C.type;if(U==="FeatureCollection")for(R=0;R<C.features.length;R++)Z(C.features[R],P);else if(U==="GeometryCollection")for(R=0;R<C.geometries.length;R++)Z(C.geometries[R],P);else if(U==="Feature")Z(C.geometry,P);else if(U==="Polygon")Ze(C.coordinates,P);else if(U==="MultiPolygon")for(R=0;R<C.coordinates.length;R++)Ze(C.coordinates[R],P);return C}));const We=A.bt.VectorTileFeature.prototype.toGeoJSON;var st={exports:{}},xt=A.bz,we=A.bt.VectorTileFeature,Vi=Ot;function Ot(Z,C){this.options=C||{},this.features=Z,this.length=Z.length}function Ge(Z,C){this.id=typeof Z.id=="number"?Z.id:void 0,this.type=Z.type,this.rawGeometry=Z.type===1?[Z.geometry]:Z.geometry,this.properties=Z.tags,this.extent=C||4096}Ot.prototype.feature=function(Z){return new Ge(this.features[Z],this.options.extent)},Ge.prototype.loadGeometry=function(){var Z=this.rawGeometry;this.geometry=[];for(var C=0;C<Z.length;C++){for(var P=Z[C],R=[],U=0;U<P.length;U++)R.push(new xt(P[U][0],P[U][1]));this.geometry.push(R)}return this.geometry},Ge.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var Z=this.geometry,C=1/0,P=-1/0,R=1/0,U=-1/0,ee=0;ee<Z.length;ee++)for(var re=Z[ee],oe=0;oe<re.length;oe++){var X=re[oe];C=Math.min(C,X.x),P=Math.max(P,X.x),R=Math.min(R,X.y),U=Math.max(U,X.y)}return[C,R,P,U]},Ge.prototype.toGeoJSON=we.prototype.toGeoJSON;var ot=A.bA,ge=Vi;function Ve(Z){var C=new ot;
6return(function(P,R){for(var U in P.layers)R.writeMessage(3,qe,P.layers[U])})(Z,C),C.finish()}function qe(Z,C){var P;C.writeVarintField(15,Z.version||1),C.writeStringField(1,Z.name||""),C.writeVarintField(5,Z.extent||4096);var R={keys:[],values:[],keycache:{},valuecache:{}};for(P=0;P<Z.length;P++)R.feature=Z.feature(P),C.writeMessage(2,dt,R);var U=R.keys;for(P=0;P<U.length;P++)C.writeStringField(3,U[P]);var ee=R.values;for(P=0;P<ee.length;P++)C.writeMessage(4,Xt,ee[P])}function dt(Z,C){var P=Z.feature;P.id!==void 0&&C.writeVarintField(1,P.id),C.writeMessage(2,Ye,Z),C.writeVarintField(3,P.type),C.writeMessage(4,pt,P)}function Ye(Z,C){var P=Z.feature,R=Z.keys,U=Z.values,ee=Z.keycache,re=Z.valuecache;for(var oe in P.properties){var X=P.properties[oe],fe=ee[oe];if(X!==null){fe===void 0&&(R.push(oe),ee[oe]=fe=R.length-1),C.writeVarint(fe);var ve=typeof X;ve!=="string"&&ve!=="boolean"&&ve!=="number"&&(X=JSON.stringify(X));var ue=ve+":"+X,Ee=re[ue];Ee===void 0&&(U.push(X),re[ue]=Ee=U.length-1),C.writeVarint(Ee)}}}function at(Z,C){return(C<<3)+(7&Z)}function Te(Z){return Z<<1^Z>>31}function pt(Z,C){for(var P=Z.loadGeometry(),R=Z.type,U=0,ee=0,re=P.length,oe=0;oe<re;oe++){var X=P[oe],fe=1;R===1&&(fe=X.length),C.writeVarint(at(1,fe));for(var ve=R===3?X.length-1:X.length,ue=0;ue<ve;ue++){ue===1&&R!==1&&C.writeVarint(at(2,ve-1));var Ee=X[ue].x-U,Xe=X[ue].y-ee;C.writeVarint(Te(Ee)),C.writeVarint(Te(Xe)),U+=Ee,ee+=Xe}R===3&&C.writeVarint(at(7,1))}}function Xt(Z,C){var P=typeof Z;P==="string"?C.writeStringField(1,Z):P==="boolean"?C.writeBooleanField(7,Z):P==="number"&&(Z%1!=0?C.writeDoubleField(3,Z):Z<0?C.writeSVarintField(6,Z):C.writeVarintField(5,Z))}st.exports=Ve,st.exports.fromVectorTileJs=Ve,st.exports.fromGeojsonVt=function(Z,C){C=C||{};var P={};for(var R in Z)P[R]=new ge(Z[R].features,C),P[R].name=R,P[R].version=C.version,P[R].extent=C.extent;return Ve({layers:P})},st.exports.GeoJSONWrapper=ge;var Ii=A.by(st.exports);const hs={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:Z=>Z},Nn=Math.fround||(cn=new Float32Array(1),Z=>(cn[0]=+Z,cn[0]));var cn;const Ai=3,pr=5,qi=6;class ki{constructor(C){this.options=Object.assign(Object.create(hs),C),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(C){const{log:P,minZoom:R,maxZoom:U}=this.options;P&&console.time("total time");const ee=`prepare ${C.length} points`;P&&console.time(ee),this.points=C;const re=[];for(let X=0;X<C.length;X++){const fe=C[X];if(!fe.geometry)continue;const[ve,ue]=fe.geometry.coordinates,Ee=Nn(Zi(ve)),Xe=Nn(zi(ue));re.push(Ee,Xe,1/0,X,-1,1),this.options.reduce&&re.push(0)}let oe=this.trees[U+1]=this._createTree(re);P&&console.timeEnd(ee);for(let X=U;X>=R;X--){const fe=+Date.now();oe=this.trees[X]=this._createTree(this._cluster(oe,X)),P&&console.log("z%d: %d clusters in %dms",X,oe.numItems,+Date.now()-fe)}return P&&console.timeEnd("total time"),this}getClusters(C,P){let R=((C[0]+180)%360+360)%360-180;const U=Math.max(-90,Math.min(90,C[1]));let ee=C[2]===180?180:((C[2]+180)%360+360)%360-180;const re=Math.max(-90,Math.min(90,C[3]));if(C[2]-C[0]>=360)R=-180,ee=180;else if(R>ee){const ue=this.getClusters([R,U,180,re],P),Ee=this.getClusters([-180,U,ee,re],P);return ue.concat(Ee)}const oe=this.trees[this._limitZoom(P)],X=oe.range(Zi(R),zi(re),Zi(ee),zi(U)),fe=oe.data,ve=[];for(const ue of X){const Ee=this.stride*ue;ve.push(fe[Ee+pr]>1?Ei(fe,Ee,this.clusterProps):this.points[fe[Ee+Ai]])}return ve}getChildren(C){const P=this._getOriginId(C),R=this._getOriginZoom(C),U="No cluster with the specified id.",ee=this.trees[R];if(!ee)throw new Error(U);const re=ee.data;if(P*this.stride>=re.length)throw new Error(U);const oe=this.options.radius/(this.options.extent*Math.pow(2,R-1)),X=ee.within(re[P*this.stride],re[P*this.stride+1],oe),fe=[];for(const ve of X){const ue=ve*this.stride;re[ue+4]===C&&fe.push(re[ue+pr]>1?Ei(re,ue,this.clusterProps):this.points[re[ue+Ai]])}if(fe.length===0)throw new Error(U);return fe}getLeaves(C,P,R){const U=[];return this._appendLeaves(U,C,P=P||10,R=R||0,0),U}getTile(C,P,R){const U=this.trees[this._limitZoom(C)],ee=Math.pow(2,C),{extent:re,radius:oe}=this.options,X=oe/re,fe=(R-X)/ee,ve=(R+1+X)/ee,ue={features:[]};return this._addTileFeatures(U.range((P-X)/ee,fe,(P+1+X)/ee,ve),U.data,P,R,ee,ue),P===0&&this._addTileFeatures(U.range(1-X/ee,fe,1,ve),U.data,ee,R,ee,ue),P===ee-1&&this._addTileFeatures(U.range(0,fe,X/ee,ve),U.data,-1,R,ee,ue),ue.features.length?ue:null}getClusterExpansionZoom(C){let P=this._getOriginZoom(C)-1;for(;P<=this.options.maxZoom;){const R=this.getChildren(C);if(P++,R.length!==1)break;C=R[0].properties.cluster_id}return P}_appendLeaves(C,P,R,U,ee){const re=this.getChildren(P);for(const oe of re){const X=oe.properties;if(X&&X.cluster?ee+X.point_count<=U?ee+=X.point_count:ee=this._appendLeaves(C,X.cluster_id,R,U,ee):ee<U?ee++:C.push(oe),C.length===R)break}return ee}_createTree(C){const P=new A.av(C.length/this.stride|0,this.options.nodeSize,Float32Array);for(let R=0;R<C.length;R+=this.stride)P.add(C[R],C[R+1]);return P.finish(),P.data=C,P}_addTileFeatures(C,P,R,U,ee,re){for(const oe of C){const X=oe*this.stride,fe=P[X+pr]>1;let ve,ue,Ee;if(fe)ve=Yn(P,X,this.clusterProps),ue=P[X],Ee=P[X+1];else{const Bt=this.points[P[X+Ai]];ve=Bt.properties;const[wt,Ft]=Bt.geometry.coordinates;ue=Zi(wt),Ee=zi(Ft)}const Xe={type:1,geometry:[[Math.round(this.options.extent*(ue*ee-R)),Math.round(this.options.extent*(Ee*ee-U))]],tags:ve};let rt;rt=fe||this.options.generateId?P[X+Ai]:this.points[P[X+Ai]].id,rt!==void 0&&(Xe.id=rt),re.features.push(Xe)}}_limitZoom(C){return Math.max(this.options.minZoom,Math.min(Math.floor(+C),this.options.maxZoom+1))}_cluster(C,P){const{radius:R,extent:U,reduce:ee,minPoints:re}=this.options,oe=R/(U*Math.pow(2,P)),X=C.data,fe=[],ve=this.stride;for(let ue=0;ue<X.length;ue+=ve){if(X[ue+2]<=P)continue;X[ue+2]=P;const Ee=X[ue],Xe=X[ue+1],rt=C.within(X[ue],X[ue+1],oe),Bt=X[ue+pr];let wt=Bt;for(const Ft of rt){const Et=Ft*ve;X[Et+2]>P&&(wt+=X[Et+pr])}if(wt>Bt&&wt>=re){let Ft,Et=Ee*Bt,yi=Xe*Bt,ai=-1;const It=((ue/ve|0)<<5)+(P+1)+this.points.length;for(const Zt of rt){const Yt=Zt*ve;if(X[Yt+2]<=P)continue;X[Yt+2]=P;const pi=X[Yt+pr];Et+=X[Yt]*pi,yi+=X[Yt+1]*pi,X[Yt+4]=It,ee&&(Ft||(Ft=this._map(X,ue,!0),ai=this.clusterProps.length,this.clusterProps.push(Ft)),ee(Ft,this._map(X,Yt)))}X[ue+4]=It,fe.push(Et/wt,yi/wt,1/0,It,-1,wt),ee&&fe.push(ai)}else{for(let Ft=0;Ft<ve;Ft++)fe.push(X[ue+Ft]);if(wt>1)for(const Ft of rt){const Et=Ft*ve;if(!(X[Et+2]<=P)){X[Et+2]=P;for(let yi=0;yi<ve;yi++)fe.push(X[Et+yi])}}}}return fe}_getOriginId(C){return C-this.points.length>>5}_getOriginZoom(C){return(C-this.points.length)%32}_map(C,P,R){if(C[P+pr]>
61){const re=this.clusterProps[C[P+qi]];return R?Object.assign({},re):re}const U=this.points[C[P+Ai]].properties,ee=this.options.map(U);return R&&ee===U?Object.assign({},ee):ee}}function Ei(Z,C,P){return{type:"Feature",id:Z[C+Ai],properties:Yn(Z,C,P),geometry:{type:"Point",coordinates:[(R=Z[C],360*(R-.5)),Zr(Z[C+1])]}};var R}function Yn(Z,C,P){const R=Z[C+pr],U=R>=1e4?`${Math.round(R/1e3)}k`:R>=1e3?Math.round(R/100)/10+"k":R,ee=Z[C+qi],re=ee===-1?{}:Object.assign({},P[ee]);return Object.assign(re,{cluster:!0,cluster_id:Z[C+Ai],point_count:R,point_count_abbreviated:U})}function Zi(Z){return Z/360+.5}function zi(Z){const C=Math.sin(Z*Math.PI/180),P=.5-.25*Math.log((1+C)/(1-C))/Math.PI;return P<0?0:P>1?1:P}function Zr(Z){const C=(180-360*Z)*Math.PI/180;return 360*Math.atan(Math.exp(C))/Math.PI-90}function Vt(Z,C,P,R){let U=R;const ee=C+(P-C>>1);let re,oe=P-C;const X=Z[C],fe=Z[C+1],ve=Z[P],ue=Z[P+1];for(let Ee=C+3;Ee<P;Ee+=3){const Xe=Pi(Z[Ee],Z[Ee+1],X,fe,ve,ue);if(Xe>U)re=Ee,U=Xe;else if(Xe===U){const rt=Math.abs(Ee-ee);rt<oe&&(re=Ee,oe=rt)}}U>R&&(re-C>3&&Vt(Z,C,re,R),Z[re+2]=U,P-re>3&&Vt(Z,re,P,R))}function Pi(Z,C,P,R,U,ee){let re=U-P,oe=ee-R;if(re!==0||oe!==0){const X=((Z-P)*re+(C-R)*oe)/(re*re+oe*oe);X>1?(P=U,R=ee):X>0&&(P+=re*X,R+=oe*X)}return re=Z-P,oe=C-R,re*re+oe*oe}function Ci(Z,C,P,R){const U={id:Z??null,type:C,geometry:P,tags:R,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(C==="Point"||C==="MultiPoint"||C==="LineString")Ar(U,P);else if(C==="Polygon")Ar(U,P[0]);else if(C==="MultiLineString")for(const ee of P)Ar(U,ee);else if(C==="MultiPolygon")for(const ee of P)Ar(U,ee[0]);return U}function Ar(Z,C){for(let P=0;P<C.length;P+=3)Z.minX=Math.min(Z.minX,C[P]),Z.minY=Math.min(Z.minY,C[P+1]),Z.maxX=Math.max(Z.maxX,C[P]),Z.maxY=Math.max(Z.maxY,C[P+1])}function un(Z,C,P,R){if(!C.geometry)return;const U=C.geometry.coordinates;if(U&&U.length===0)return;const ee=C.geometry.type,re=Math.pow(P.tolerance/((1<<P.maxZoom)*P.extent),2);let oe=[],X=C.id;if(P.promoteId?X=C.properties[P.promoteId]:P.generateId&&(X=R||0),ee==="Point")Vn(U,oe);else if(ee==="MultiPoint")for(const fe of U)Vn(fe,oe);else if(ee==="LineString")he(U,oe,re,!1);else if(ee==="MultiLineString"){if(P.lineMetrics){for(const fe of U)oe=[],he(fe,oe,re,!1),Z.push(Ci(X,"LineString",oe,C.properties));return}hn(U,oe,re,!1)}else if(ee==="Polygon")hn(U,oe,re,!0);else{if(ee!=="MultiPolygon"){if(ee==="GeometryCollection"){for(const fe of C.geometry.geometries)un(Z,{id:X,geometry:fe,properties:C.properties},P,R);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const fe of U){const ve=[];hn(fe,ve,re,!0),oe.push(ve)}}Z.push(Ci(X,ee,oe,C.properties))}function Vn(Z,C){C.push(dn(Z[0]),Ct(Z[1]),0)}function he(Z,C,P,R){let U,ee,re=0;for(let X=0;X<Z.length;X++){const fe=dn(Z[X][0]),ve=Ct(Z[X][1]);C.push(fe,ve,0),X>0&&(re+=R?(U*ve-fe*ee)/2:Math.sqrt(Math.pow(fe-U,2)+Math.pow(ve-ee,2))),U=fe,ee=ve}const oe=C.length-3;C[2]=1,Vt(C,0,oe,P),C[oe+2]=1,C.size=Math.abs(re),C.start=0,C.end=C.size}function hn(Z,C,P,R){for(let U=0;U<Z.length;U++){const ee=[];he(Z[U],ee,P,R),C.push(ee)}}function dn(Z){return Z/360+.5}function Ct(Z){const C=Math.sin(Z*Math.PI/180),P=.5-.25*Math.log((1+C)/(1-C))/Math.PI;return P<0?0:P>1?1:P}function kt(Z,C,P,R,U,ee,re,oe){if(R/=C,ee>=(P/=C)&&re<R)return Z;if(re<P||ee>=R)return null;const X=[];for(const fe of Z){const ve=fe.geometry;let ue=fe.type;const Ee=U===0?fe.minX:fe.minY,Xe=U===0?fe.maxX:fe.maxY;if(Ee>=P&&Xe<R){X.push(fe);continue}if(Xe<P||Ee>=R)continue;let rt=[];if(ue==="Point"||ue==="MultiPoint")ds(ve,rt,P,R,U);else if(ue==="LineString")pn(ve,rt,P,R,U,!1,oe.lineMetrics);else if(ue==="MultiLineString")Kn(ve,rt,P,R,U,!1);else if(ue==="Polygon")Kn(ve,rt,P,R,U,!0);else if(ue==="MultiPolygon")for(const Bt of ve){const wt=[];Kn(Bt,wt,P,R,U,!0),wt.length&&rt.push(wt)}if(rt.length){if(oe.lineMetrics&&ue==="LineString"){for(const Bt of rt)X.push(Ci(fe.id,ue,Bt,fe.tags));continue}ue!=="LineString"&&ue!=="MultiLineString"||(rt.length===1?(ue="LineString",rt=rt[0]):ue="MultiLineString"),ue!=="Point"&&ue!=="MultiPoint"||(ue=rt.length===3?"Point":"MultiPoint"),X.push(Ci(fe.id,ue,rt,fe.tags))}}return X.length?X:null}function ds(Z,C,P,R,U){for(let ee=0;ee<Z.length;ee+=3){const re=Z[ee+U];re>=P&&re<=R&&fr(C,Z[ee],Z[ee+1],Z[ee+2])}}function pn(Z,C,P,R,U,ee,re){let oe=di(Z);const X=U===0?ps:fs;let fe,ve,ue=Z.start;for(let wt=0;wt<Z.length-3;wt+=3){const Ft=Z[wt],Et=Z[wt+1],yi=Z[wt+2],ai=Z[wt+3],It=Z[wt+4],Zt=U===0?Ft:Et,Yt=U===0?ai:It;let pi=!1;re&&(fe=Math.sqrt(Math.pow(Ft-ai,2)+Math.pow(Et-It,2))),Zt<P?Yt>P&&(ve=X(oe,Ft,Et,ai,It,P),re&&(oe.start=ue+fe*ve)):Zt>R?Yt<R&&(ve=X(oe,Ft,Et,ai,It,R),re&&(oe.start=ue+fe*ve)):fr(oe,Ft,Et,yi),Yt<P&&Zt>=P&&(ve=X(oe,Ft,Et,ai,It,P),pi=!0),Yt>R&&Zt<=R&&(ve=X(oe,Ft,Et,ai,It,R),pi=!0),!ee&&pi&&(re&&(oe.end=ue+fe*ve),C.push(oe),oe=di(Z)),re&&(ue+=fe)}let Ee=Z.length-3;const Xe=Z[Ee],rt=Z[Ee+1],Bt=U===0?Xe:rt;Bt>
6=P&&Bt<=R&&fr(oe,Xe,rt,Z[Ee+2]),Ee=oe.length-3,ee&&Ee>=3&&(oe[Ee]!==oe[0]||oe[Ee+1]!==oe[1])&&fr(oe,oe[0],oe[1],oe[2]),oe.length&&C.push(oe)}function di(Z){const C=[];return C.size=Z.size,C.start=Z.start,C.end=Z.end,C}function Kn(Z,C,P,R,U,ee){for(const re of Z)pn(re,C,P,R,U,ee,!1)}function fr(Z,C,P,R){Z.push(C,P,R)}function ps(Z,C,P,R,U,ee){const re=(ee-C)/(R-C);return fr(Z,ee,P+(U-P)*re,1),re}function fs(Z,C,P,R,U,ee){const re=(ee-P)/(U-P);return fr(Z,C+(R-C)*re,ee,1),re}function Ae(Z,C){const P=[];for(let R=0;R<Z.length;R++){const U=Z[R],ee=U.type;let re;if(ee==="Point"||ee==="MultiPoint"||ee==="LineString")re=Gr(U.geometry,C);else if(ee==="MultiLineString"||ee==="Polygon"){re=[];for(const oe of U.geometry)re.push(Gr(oe,C))}else if(ee==="MultiPolygon"){re=[];for(const oe of U.geometry){const X=[];for(const fe of oe)X.push(Gr(fe,C));re.push(X)}}P.push(Ci(U.id,ee,re,U.tags))}return P}function Gr(Z,C){const P=[];P.size=Z.size,Z.start!==void 0&&(P.start=Z.start,P.end=Z.end);for(let R=0;R<Z.length;R+=3)P.push(Z[R]+C,Z[R+1],Z[R+2]);return P}function Gi(Z,C){if(Z.transformed)return Z;const P=1<<Z.z,R=Z.x,U=Z.y;for(const ee of Z.features){const re=ee.geometry,oe=ee.type;if(ee.geometry=[],oe===1)for(let X=0;X<re.length;X+=2)ee.geometry.push(mr(re[X],re[X+1],C,P,R,U));else for(let X=0;X<re.length;X++){const fe=[];for(let ve=0;ve<re[X].length;ve+=2)fe.push(mr(re[X][ve],re[X][ve+1],C,P,R,U));ee.geometry.push(fe)}}return Z.transformed=!0,Z}function mr(Z,C,P,R,U,ee){return[Math.round(P*(Z*R-U)),Math.round(P*(C*R-ee))]}function Rr(Z,C,P,R,U){const ee=C===U.maxZoom?0:U.tolerance/((1<<C)*U.extent),re={features:[],numPoints:0,numSimplified:0,numFeatures:Z.length,source:null,x:P,y:R,z:C,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const oe of Z)Ce(re,oe,ee,U);return re}function Ce(Z,C,P,R){const U=C.geometry,ee=C.type,re=[];if(Z.minX=Math.min(Z.minX,C.minX),Z.minY=Math.min(Z.minY,C.minY),Z.maxX=Math.max(Z.maxX,C.maxX),Z.maxY=Math.max(Z.maxY,C.maxY),ee==="Point"||ee==="MultiPoint")for(let oe=0;oe<U.length;oe+=3)re.push(U[oe],U[oe+1]),Z.numPoints++,Z.numSimplified++;else if(ee==="LineString")Tt(re,U,Z,P,!1,!1);else if(ee==="MultiLineString"||ee==="Polygon")for(let oe=0;oe<U.length;oe++)Tt(re,U[oe],Z,P,ee==="Polygon",oe===0);else if(ee==="MultiPolygon")for(let oe=0;oe<U.length;oe++){const X=U[oe];for(let fe=0;fe<X.length;fe++)Tt(re,X[fe],Z,P,!0,fe===0)}if(re.length){let oe=C.tags||null;if(ee==="LineString"&&R.lineMetrics){oe={};for(const fe in C.tags)oe[fe]=C.tags[fe];oe.mapbox_clip_start=U.start/U.size,oe.mapbox_clip_end=U.end/U.size}const X={geometry:re,type:ee==="Polygon"||ee==="MultiPolygon"?3:ee==="LineString"||ee==="MultiLineString"?2:1,tags:oe};C.id!==null&&(X.id=C.id),Z.features.push(X)}}function Tt(Z,C,P,R,U,ee){const re=R*R;if(R>0&&C.size<(U?re:R))return void(P.numPoints+=C.length/3);const oe=[];for(let X=0;X<C.length;X+=3)(R===0||C[X+2]>re)&&(P.numSimplified++,oe.push(C[X],C[X+1])),P.numPoints++;U&&(function(X,fe){let ve=0;for(let ue=0,Ee=X.length,Xe=Ee-2;ue<Ee;Xe=ue,ue+=2)ve+=(X[ue]-X[Xe])*(X[ue+1]+X[Xe+1]);if(ve>0===fe)for(let ue=0,Ee=X.length;ue<Ee/2;ue+=2){const Xe=X[ue],rt=X[ue+1];X[ue]=X[Ee-2-ue],X[ue+1]=X[Ee-1-ue],X[Ee-2-ue]=Xe,X[Ee-1-ue]=rt}})(oe,ee),Z.push(oe)}const it={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Ki{constructor(C,P){const R=(P=this.options=(function(ee,re){for(const oe in re)ee[oe]=re[oe];return ee})(Object.create(it),P)).debug;if(R&&console.time("preprocess data"),P.maxZoom<0||P.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(P.promoteId&&P.generateId)throw new Error("promoteId and generateId cannot be used together.");let U=(function(ee,re){const oe=[];if(ee.type==="FeatureCollection")for(let X=0;X<ee.features.length;X++)un(oe,ee.features[X],re,X);else un(oe,ee.type==="Feature"?ee:{geometry:ee},re);return oe})(C,P);this.tiles={},this.tileCoords=[],R&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",P.indexMaxZoom,P.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),U=(function(ee,re){const oe=re.buffer/re.extent;let X=ee;
6const fe=kt(ee,1,-1-oe,oe,0,-1,2,re),ve=kt(ee,1,1-oe,2+oe,0,-1,2,re);return(fe||ve)&&(X=kt(ee,1,-oe,1+oe,0,-1,2,re)||[],fe&&(X=Ae(fe,1).concat(X)),ve&&(X=X.concat(Ae(ve,-1)))),X})(U,P),U.length&&this.splitTile(U,0,0,0),R&&(U.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(C,P,R,U,ee,re,oe){const X=[C,P,R,U],fe=this.options,ve=fe.debug;for(;X.length;){U=X.pop(),R=X.pop(),P=X.pop(),C=X.pop();const ue=1<<P,Ee=Br(P,R,U);let Xe=this.tiles[Ee];if(!Xe&&(ve>1&&console.time("creation"),Xe=this.tiles[Ee]=Rr(C,P,R,U,fe),this.tileCoords.push({z:P,x:R,y:U}),ve)){ve>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",P,R,U,Xe.numFeatures,Xe.numPoints,Xe.numSimplified),console.timeEnd("creation"));const pi=`z${P}`;this.stats[pi]=(this.stats[pi]||0)+1,this.total++}if(Xe.source=C,ee==null){if(P===fe.indexMaxZoom||Xe.numPoints<=fe.indexMaxPoints)continue}else{if(P===fe.maxZoom||P===ee)continue;if(ee!=null){const pi=ee-P;if(R!==re>>pi||U!==oe>>pi)continue}}if(Xe.source=null,C.length===0)continue;ve>1&&console.time("clipping");const rt=.5*fe.buffer/fe.extent,Bt=.5-rt,wt=.5+rt,Ft=1+rt;let Et=null,yi=null,ai=null,It=null,Zt=kt(C,ue,R-rt,R+wt,0,Xe.minX,Xe.maxX,fe),Yt=kt(C,ue,R+Bt,R+Ft,0,Xe.minX,Xe.maxX,fe);C=null,Zt&&(Et=kt(Zt,ue,U-rt,U+wt,1,Xe.minY,Xe.maxY,fe),yi=kt(Zt,ue,U+Bt,U+Ft,1,Xe.minY,Xe.maxY,fe),Zt=null),Yt&&(ai=kt(Yt,ue,U-rt,U+wt,1,Xe.minY,Xe.maxY,fe),It=kt(Yt,ue,U+Bt,U+Ft,1,Xe.minY,Xe.maxY,fe),Yt=null),ve>1&&console.timeEnd("clipping"),X.push(Et||[],P+1,2*R,2*U),X.push(yi||[],P+1,2*R,2*U+1),X.push(ai||[],P+1,2*R+1,2*U),X.push(It||[],P+1,2*R+1,2*U+1)}}getTile(C,P,R){C=+C,P=+P,R=+R;const U=this.options,{extent:ee,debug:re}=U;if(C<0||C>24)return null;const oe=1<<C,X=Br(C,P=P+oe&oe-1,R);if(this.tiles[X])return Gi(this.tiles[X],ee);re>1&&console.log("drilling down to z%d-%d-%d",C,P,R);let fe,ve=C,ue=P,Ee=R;for(;!fe&&ve>0;)ve--,ue>>=1,Ee>>=1,fe=this.tiles[Br(ve,ue,Ee)];return fe&&fe.source?(re>1&&(console.log("found parent tile z%d-%d-%d",ve,ue,Ee),console.time("drilling down")),this.splitTile(fe.source,ve,ue,Ee,C,P,R),re>1&&console.timeEnd("drilling down"),this.tiles[X]?Gi(this.tiles[X],ee):null):null}}function Br(Z,C,P){return 32*((1<<Z)*P+C)+Z}function ht(Z,C){return C?Z.properties[C]:Z.id}function gr(Z,C){if(Z==null)return!0;if(Z.type==="Feature")return ht(Z,C)!=null;if(Z.type==="FeatureCollection"){const P=new Set;for(const R of Z.features){const U=ht(R,C);if(U==null||P.has(U))return!1;P.add(U)}return!0}return!1}function Fr(Z,C){const P=new Map;if(Z!=null)if(Z.type==="Feature")P.set(ht(Z,C),Z);else for(const R of Z.features)P.set(ht(R,C),R);return P}class Er extends de{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(C,P){return A._(this,void 0,void 0,(function*(){const R=C.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const U=this._geoJSONIndex.getTile(R.z,R.x,R.y);if(!U)return null;const ee=new class{constructor(oe){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=A.X,this.length=oe.length,this._features=oe}feature(oe){return new class{constructor(X){this._feature=X,this.extent=A.X,this.type=X.t
6ype,this.properties=X.tags,"id"in X&&!isNaN(X.id)&&(this.id=parseInt(X.id,10))}loadGeometry(){if(this._feature.type===1){const X=[];for(const fe of this._feature.geometry)X.push([new A.P(fe[0],fe[1])]);return X}{const X=[];for(const fe of this._feature.geometry){const ve=[];for(const ue of fe)ve.push(new A.P(ue[0],ue[1]));X.push(ve)}return X}}toGeoJSON(X,fe,ve){return We.call(this,X,fe,ve)}}(this._features[oe])}}(U.features);let re=Ii(ee);return re.byteOffset===0&&re.byteLength===re.buffer.byteLength||(re=new Uint8Array(re)),{vectorTile:ee,rawData:re.buffer}}))}loadData(C){return A._(this,void 0,void 0,(function*(){var P;(P=this._pendingRequest)===null||P===void 0||P.abort();const R=!!(C&&C.request&&C.request.collectResourceTiming)&&new A.bv(C.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(C,this._pendingRequest),this._geoJSONIndex=C.cluster?new ki((function({superclusterOptions:re,clusterProperties:oe}){if(!oe||!re)return re;const X={},fe={},ve={accumulated:null,zoom:0},ue={properties:null},Ee=Object.keys(oe);for(const Xe of Ee){const[rt,Bt]=oe[Xe],wt=A.bC(Bt),Ft=A.bC(typeof rt=="string"?[rt,["accumulated"],["get",Xe]]:rt);X[Xe]=wt.value,fe[Xe]=Ft.value}return re.map=Xe=>{ue.properties=Xe;const rt={};for(const Bt of Ee)rt[Bt]=X[Bt].evaluate(ve,ue);return rt},re.reduce=(Xe,rt)=>{ue.properties=rt;for(const Bt of Ee)ve.accumulated=Xe[Bt],Xe[Bt]=fe[Bt].evaluate(ve,ue)},re})(C)).load((yield this._pendingData).features):(U=yield this._pendingData,new Ki(U,C.geojsonVtOptions)),this.loaded={};const ee={};if(R){const re=R.finish();re&&(ee.resourceTiming={},ee.resourceTiming[C.source]=JSON.parse(JSON.stringify(re)))}return ee}catch(ee){if(delete this._pendingRequest,A.bB(ee))return{abandoned:!0};throw ee}var U}))}getData(){return A._(this,void 0,void 0,(function*(){return this._pendingData}))}reloadTile(C){const P=this.loaded;return P&&P[C.uid]?super.reloadTile(C):this.loadTile(C)}loadAndProcessGeoJSON(C,P){return A._(this,void 0,void 0,(function*(){let R=yield this.loadGeoJSON(C,P);if(delete this._pendingRequest,typeof R!="object")throw new Error(`Input data given to '${C.source}' is not a valid GeoJSON object.`);if(Rt(R,!0),C.filter){const U=A.bC(C.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(U.result==="error")throw new Error(U.value.map((re=>`${re.key}: ${re.message}`)).join(", "));R={type:"FeatureCollection",features:R.features.filter((re=>U.value.evaluate({zoom:0},re)))}}return R}))}loadGeoJSON(C,P){return A._(this,void 0,void 0,(function*(){const{promoteId:R}=C;if(C.request){const U=yield A.h(C.request,P);return this._dataUpdateable=gr(U.data,R)?Fr(U.data,R):void 0,U.data}
6if(typeof C.data=="string")try{const U=JSON.parse(C.data);return this._dataUpdateable=gr(U,R)?Fr(U,R):void 0,U}catch{throw new Error(`Input data given to '${C.source}' is not a valid GeoJSON object.`)}if(!C.dataDiff)throw new Error(`Input data given to '${C.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${C.source}`);return(function(U,ee,re){var oe,X,fe,ve;if(ee.removeAll&&U.clear(),ee.remove)for(const ue of ee.remove)U.delete(ue);if(ee.add)for(const ue of ee.add){const Ee=ht(ue,re);Ee!=null&&U.set(Ee,ue)}if(ee.update)for(const ue of ee.update){let Ee=U.get(ue.id);if(Ee==null)continue;const Xe=!ue.removeAllProperties&&(((oe=ue.removeProperties)===null||oe===void 0?void 0:oe.length)>0||((X=ue.addOrUpdateProperties)===null||X===void 0?void 0:X.length)>0);if((ue.newGeometry||ue.removeAllProperties||Xe)&&(Ee=Object.assign({},Ee),U.set(ue.id,Ee),Xe&&(Ee.properties=Object.assign({},Ee.properties))),ue.newGeometry&&(Ee.geometry=ue.newGeometry),ue.removeAllProperties)Ee.properties={};else if(((fe=ue.removeProperties)===null||fe===void 0?void 0:fe.length)>0)for(const rt of ue.removeProperties)Object.prototype.hasOwnProperty.call(Ee.properties,rt)&&delete Ee.properties[rt];if(((ve=ue.addOrUpdateProperties)===null||ve===void 0?void 0:ve.length)>0)for(const{key:rt,value:Bt}of ue.addOrUpdateProperties)Ee.properties[rt]=Bt}})(this._dataUpdateable,C.dataDiff,R),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}}))}removeSource(C){return A._(this,void 0,void 0,(function*(){this._pendingRequest&&this._pendingRequest.abort()}))}getClusterExpansionZoom(C){return this._geoJSONIndex.getClusterExpansionZoom(C.clusterId)}getClusterChildren(C){return this._geoJSONIndex.getChildren(C.clusterId)}getClusterLeaves(C){return this._geoJSONIndex.getLeaves(C.clusterId,C.limit,C.offset)}}class _r{constructor(C){this.self=C,this.actor=new A.F(C),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(P,R)=>{if(this.externalWorkerSourceTypes[P])throw new Error(`Worker source with name "${P}" already registered.`);this.externalWorkerSourceTypes[P]=R},this.self.addProtocol=A.bi,this.self.removeProtocol=A.bj,this.self.registerRTLTextPlugin=P=>{if(A.bD.isParsed())throw new Error("RTL text plugin already registered.");A.bD.setMethods(P)},this.actor.registerMessageHandler("LDT",((P,R)=>this._getDEMWorkerSource(P,R.source).loadTile(R))),this.actor.registerMessageHandler("RDT",((P,R)=>A._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(P,R.source).removeTile(R)})))),this.actor.registerMessageHandler("GCEZ",((P,R)=>A._(this,void 0,void 0,(function*(){return this._getWorkerSource(P,R.type,R.source).getClusterExpansionZoom(R)})))),this.actor.registerMessageHandler("GCC",((P,R)=>A._(this,void 0,void 0,(function*(){return this._getWorkerSource(P,R.type,R.source).getClusterChildren(R)})))),this.actor.registerMessageHandler("GCL",((P,R)=>A._(this,void 0,void 0,(function*(){return this._getWorkerSource(P,R.type,R.source).getClusterLeaves(R)})))),this.actor.registerMessageHandler("LD",((P,R)=>this._getWorkerSource(P,R.type,R.source).loadData(R))),this.actor.registerMessageHandler("GD",((P,R)=>this._getWorkerSource(P,R.type,R.source).getData())),this.actor.registerMessageHandler("LT",((P,R)=>this._getWorkerSource(P,R.type,R.source).loadTile(R))),this.actor.registerMessageHandler("RT",((P,R)=>this._getWorkerSource(P,R.type,R.source).reloadTile(R))),this.actor.registerMessageHandler("AT",((P,R)=>this._getWorkerSource(P,R.type,R.source).abortTile(R))),this.actor.registerMessageHandler("RMT",((P,R)=>this._getWorkerSource(P,R.type,R.source).removeTile(R))),this.actor.registerMessageHandler("RS",((P,R)=>A._(this,void 0,void 0,(function*(){if(!this.workerSources[P]||!this.workerSources[P][R.type]||!this.workerSources[P][R.type][R.source])return;const U=this.workerSources[P][R.type][R.source];delete this.workerSources[P][R.type][R.source],U.removeSource!==void 0&&U.removeSource(R)})))),this.actor.registerMessageHandler("RM",(P=>A._(this,void 0,void 0,(function*(){delete this.layerIndexes[P],delete this.availableImages[P],delete this.workerSources[P],delete this.demWorkerSources[P]})))),this.actor.registerMessageHandler("SR",((P,R)=>A._(this,void 0,void 0,(function*(){this.referrer=R})))),this.actor.registerMessageHandler("SRPS",((P,R)=>this._syncRTLPluginState(P,R))),this.actor.registerMessageHandler("IS",((P,R)=>A._(this,void 0,void 0,(function*(){this.self.importScripts(R)})))),this.actor.registerMessageHandler("SI",((P,R)=>this._setImages(P,R))),this.actor.registerMessageHandler("UL",((P,R)=>A._(this,void 0,void 0,(function*(){this._getLayerIndex(P).update(R.layers,R.removedIds)})))),this.actor.registerMessageHandler("SL",((P,R)=>A._(this,void 0,void 0,(function*(){this._getLayerIndex(P).replace(R)}))))}_setImages(C,P){return A._(this,void 0,void 0,(function*(){this.availableImages[C]=P;
6for(const R in this.workerSources[C]){const U=this.workerSources[C][R];for(const ee in U)U[ee].availableImages=P}}))}_syncRTLPluginState(C,P){return A._(this,void 0,void 0,(function*(){if(A.bD.isParsed())return A.bD.getState();if(P.pluginStatus!=="loading")return A.bD.setState(P),P;const R=P.pluginURL;if(this.self.importScripts(R),A.bD.isParsed()){const U={pluginStatus:"loaded",pluginURL:R};return A.bD.setState(U),U}throw A.bD.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${R}`)}))}_getAvailableImages(C){let P=this.availableImages[C];return P||(P=[]),P}_getLayerIndex(C){let P=this.layerIndexes[C];return P||(P=this.layerIndexes[C]=new d),P}_getWorkerSource(C,P,R){if(this.workerSources[C]||(this.workerSources[C]={}),this.workerSources[C][P]||(this.workerSources[C][P]={}),!this.workerSources[C][P][R]){const U={sendAsync:(ee,re)=>(ee.targetMapId=C,this.actor.sendAsync(ee,re))};switch(P){case"vector":this.workerSources[C][P][R]=new de(U,this._getLayerIndex(C),this._getAvailableImages(C));break;case"geojson":this.workerSources[C][P][R]=new Er(U,this._getLayerIndex(C),this._getAvailableImages(C));break;default:this.workerSources[C][P][R]=new this.externalWorkerSourceTypes[P](U,this._getLayerIndex(C),this._getAvailableImages(C))}}return this.workerSources[C][P][R]}_getDEMWorkerSource(C,P){return this.demWorkerSources[C]||(this.demWorkerSources[C]={}),this.demWorkerSources[C][P]||(this.demWorkerSources[C][P]=new K),this.demWorkerSources[C][P]}}return A.i(self)&&(self.worker=new _r(self)),_r})),Y("index",["exports","./shared"],(function(A,d){var xe="4.7.1";let Se,ke;const de={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:u=>new Promise(((e,n)=>{const a=requestAnimationFrame(e);u.signal.addEventListener("abort",(()=>{cancelAnimationFrame(a),n(d.c())}))})),getImageData(u,e=0){return this.getImageCanvasContext(u).getImageData(-e,-e,u.width+2*e,u.height+2*e)},getImageCanvasContext(u){const e=window.document.createElement("canvas"),n=e.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("failed to create canvas 2d context");return e.width=u.width,e.height=u.height,n.drawImage(u,0,0,u.width,u.height),n},resolveURL:u=>(Se||(Se=document.createElement("a")),Se.href=u,Se.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(ke==null&&(ke=matchMedia("(prefers-reduced-motion: reduce)")),ke.matches)}};class K{static testProp(e){if(!K.docStyle)return e[0];for(let n=0;n<e.length;n++)if(e[n]in K.docStyle)return e[n];return e[0]}static create(e,n,a){const o=window.document.createElement(e);return n!==void 0&&(o.className=n),a&&a.appendChild(o),o}static createNS(e,n){return window.document.createElementNS(e,n)}static disableDrag(){K.docStyle&&K.selectProp&&(K.userSelect=K.docStyle[K.selectProp],K.docStyle[K.selectProp]="none")}static enableDrag(){K.docStyle&&K.selectProp&&(K.docStyle[K.selectProp]=K.userSelect)}static setTransform(e,n){e.style[K.transformProp]=n}static addEventListener(e,n,a,o={}){e.addEventListener(n,a,"passive"in o?o:o.capture)}static removeEventListener(e,n,a,o={}){e.removeEventListener(n,a,"passive"in o?o:o.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",K.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",K.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener("click",K.suppressClickInternal,!0)}),0)}static getScale(e){const n=e.getBoundingClientRect();return{x:n.width/e.offsetWidth||1,y:n.height/e.offsetHeight||1,boundingClientRect:n}}static getPoint(e,n,a){const o=n.boundingClientRect;return new d.P((a.clientX-o.left)/n.x-e.clientLeft,(a.clientY-o.top)/n.y-e.clientTop)}static mousePos(e,n){const a=K.getScale(e);return K.getPoint(e,a,n)}static touchPos(e,n){const a=[],o=K.getScale(e);for(let c=0;c<n.length;c++)a.push(K.getPoint(e,o,n[c]));return a}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}}K.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,K.selectProp=K.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),K.transformProp=K.testProp(["transform","WebkitTransform"]);const Ze={supported:!1,testSupport:function(u){!We&&Rt&&(st?xt(u):vt=u)}};let vt,Rt,We=!1,st=!1;function xt(u){const e=u.createTexture();u.bindTexture(u.TEXTURE_2D,e);try{if(u.texImage2D(u.TEXTURE_2D,0,u.RGBA,u.RGBA,u.UNSIGNED_BYTE,Rt),u.isContextLost())return;Ze.supported=!0}
6catch{}u.deleteTexture(e),We=!0}var we;typeof document<"u"&&(Rt=document.createElement("img"),Rt.onload=()=>{vt&&xt(vt),vt=null,st=!0},Rt.onerror=()=>{We=!0,vt=null},Rt.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),(function(u){let e,n,a,o;u.resetRequestQueue=()=>{e=[],n=0,a=0,o={}},u.addThrottleControl=y=>{const w=a++;return o[w]=y,w},u.removeThrottleControl=y=>{delete o[y],m()},u.getImage=(y,w,T=!0)=>new Promise(((I,k)=>{Ze.supported&&(y.headers||(y.headers={}),y.headers.accept="image/webp,*/*"),d.e(y,{type:"image"}),e.push({abortController:w,requestParameters:y,supportImageRefresh:T,state:"queued",onError:F=>{k(F)},onSuccess:F=>{I(F)}}),m()}));const c=y=>d._(this,void 0,void 0,(function*(){y.state="running";const{requestParameters:w,supportImageRefresh:T,onError:I,onSuccess:k,abortController:F}=y,V=T===!1&&!d.i(self)&&!d.g(w.url)&&(!w.headers||Object.keys(w.headers).reduce(((W,J)=>W&&J==="accept"),!0));n++;const q=V?_(w,F):d.m(w,F);try{const W=yield q;delete y.abortController,y.state="completed",W.data instanceof HTMLImageElement||d.b(W.data)?k(W):W.data&&k({data:yield(H=W.data,typeof createImageBitmap=="function"?d.d(H):d.f(H)),cacheControl:W.cacheControl,expires:W.expires})}catch(W){delete y.abortController,I(W)}finally{n--,m()}var H})),m=()=>{const y=(()=>{for(const w of Object.keys(o))if(o[w]())return!0;return!1})()?d.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:d.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let w=n;w<y&&e.length>0;w++){const T=e.shift();T.abortController.signal.aborted?w--:c(T)}},_=(y,w)=>new Promise(((T,I)=>{const k=new Image,F=y.url,V=y.credentials;V&&V==="include"?k.crossOrigin="use-credentials":(V&&V==="same-origin"||!d.s(F))&&(k.crossOrigin="anonymous"),w.signal.addEventListener("abort",(()=>{k.src="",I(d.c())})),k.fetchPriority="high",k.onload=()=>{k.onerror=k.onload=null,T({data:k})},k.onerror=()=>{k.onerror=k.onload=null,w.signal.aborted||I(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."))},k.src=F}))})(we||(we={})),we.resetRequestQueue();class Vi{constructor(e){this._transformRequestFn=e}transformRequest(e,n){return this._transformRequestFn&&this._transformRequestFn(e,n)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function Ot(u){var e=new d.A(3);return e[0]=u[0],e[1]=u[1],e[2]=u[2],e}var Ge,ot=function(u,e,n){return u[0]=e[0]-n[0],u[1]=e[1]-n[1],u[2]=e[2]-n[2],u};Ge=new d.A(3),d.A!=Float32Array&&(Ge[0]=0,Ge[1]=0,Ge[2]=0);var ge=function(u){var e=u[0],n=u[1];return e*e+n*n};function Ve(u){const e=[];if(typeof u=="string")e.push({id:"default",url:u});else if(u&&u.length>0){const n=[];for(const{id:a,url:o}of u){const c=`${a}${o}`;n.indexOf(c)===-1&&(n.push(c),e.push({id:a,url:o}))}}return e}function qe(u,e,n){const a=u.split("?");return a[0]+=`${e}${n}`,a.join("?")}(function(){var u=new d.A(2);d.A!=Float32Array&&(u[0]=0,u[1]=0)})();class dt{constructor(e,n,a,o){this.context=e,this.format=a,this.texture=e.gl.createTexture(),this.update(n,o)}update(e,n,a){const{width:o,height:c}=e,m=!(this.size&&this.size[0]===o&&this.size[1]===c||a),{context:_}=this,{gl:y}=_;if(this.useMipmap=!!(n&&n.useMipmap),y.bindTexture(y.TEXTURE_2D,this.texture),_.pixelStoreUnpackFlipY.set(!1),_.pixelStoreUnpack.set(1),_.pixelStoreUnpackPremultiplyAlpha.set(this.format===y.RGBA&&(!n||n.premultiply!==!1)),m)this.size=[o,c],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||d.b(e)?y.texImage2D(y.TEXTURE_2D,0,this.format,this.format,y.UNSIGNED_BYTE,e):y.texImage2D(y.TEXTURE_2D,0,this.format,o,c,0,this.format,y.UNSIGNED_BYTE,e.data);else{const{x:w,y:T}=a||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||d.b(e)?y.texSubImage2D(y.TEXTURE_2D,0,w,T,y.RGBA,y.UNSIGNED_BYTE,e):y.texSubImage2D(y.TEXTURE_2D,0,w,T,o,c,y.RGBA,y.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&y.generateMipmap(y.TEXTURE_2D)}bind(e,n,a){const{context:o}=this,{gl:c}=o;c.bindTexture(c.TEXTURE_2D,this.texture),a!==c.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(a=c.LINEAR),e!==this.filter&&(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,e),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,a||e),this.filter=e),n!==this.wrap&&(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,n),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,n),this.wrap=n)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}function Ye(u){const{userImage:e}=u;return!!(e&&e.render&&e.render())&&(u.data.replace(new Uint8Array(e.data.buffer)),!0)}class at extends d.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new d.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(const{ids:n,promiseResolve:a}of this.requestors)a(this._getImagesForIds(n));this.requestors=[]}}getImage(e){const n=this.images[e];if(n&&!n.data&&n.spriteData){const a=n.spriteData;n.data=new d.R({width:a.width,height:a.height},a.context.getImageData(a.x,a.y,a.width,a.height).data),n.spriteData=null}return n}addImage(e,n){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);
6this._validate(e,n)&&(this.images[e]=n)}_validate(e,n){let a=!0;const o=n.data||n.spriteData;return this._validateStretch(n.stretchX,o&&o.width)||(this.fire(new d.j(new Error(`Image "${e}" has invalid "stretchX" value`))),a=!1),this._validateStretch(n.stretchY,o&&o.height)||(this.fire(new d.j(new Error(`Image "${e}" has invalid "stretchY" value`))),a=!1),this._validateContent(n.content,n)||(this.fire(new d.j(new Error(`Image "${e}" has invalid "content" value`))),a=!1),a}_validateStretch(e,n){if(!e)return!0;let a=0;for(const o of e){if(o[0]<a||o[1]<o[0]||n<o[1])return!1;a=o[1]}return!0}_validateContent(e,n){if(!e)return!0;if(e.length!==4)return!1;const a=n.spriteData,o=a&&a.width||n.data.width,c=a&&a.height||n.data.height;return!(e[0]<0||o<e[0]||e[1]<0||c<e[1]||e[2]<0||o<e[2]||e[3]<0||c<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,n,a=!0){const o=this.getImage(e);if(a&&(o.data.width!==n.data.width||o.data.height!==n.data.height))throw new Error(`size mismatch between old image (${o.data.width}x${o.data.height}) and new image (${n.data.width}x${n.data.height}).`);n.version=o.version+1,this.images[e]=n,this.updatedImages[e]=!0}removeImage(e){const n=this.images[e];delete this.images[e],delete this.patterns[e],n.userImage&&n.userImage.onRemove&&n.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise(((n,a)=>{let o=!0;if(!this.isLoaded())for(const c of e)this.images[c]||(o=!1);this.isLoaded()||o?n(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:n})}
6))}_getImagesForIds(e){const n={};for(const a of e){let o=this.getImage(a);o||(this.fire(new d.k("styleimagemissing",{id:a})),o=this.getImage(a)),o?n[a]={data:o.data.clone(),pixelRatio:o.pixelRatio,sdf:o.sdf,version:o.version,stretchX:o.stretchX,stretchY:o.stretchY,content:o.content,textFitWidth:o.textFitWidth,textFitHeight:o.textFitHeight,hasRenderCallback:!!(o.userImage&&o.userImage.render)}:d.w(`Image "${a}" 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.`)}return n}getPixelSize(){const{width:e,height:n}=this.atlasImage;return{width:e,height:n}}getPattern(e){const n=this.patterns[e],a=this.getImage(e);if(!a)return null;if(n&&n.position.version===a.version)return n.position;if(n)n.position.version=a.version;else{const o={w:a.data.width+2,h:a.data.height+2,x:0,y:0},c=new d.I(o,a);this.patterns[e]={bin:o,position:c}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){const n=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new dt(e,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const c in this.patterns)e.push(this.patterns[c].bin);const{w:n,h:a}=d.p(e),o=this.atlasImage;o.resize({width:n||1,height:a||1});for(const c in this.patterns){const{bin:m}=this.patterns[c],_=m.x+1,y=m.y+1,w=this.getImage(c).data,T=w.width,I=w.height;d.R.copy(w,o,{x:0,y:0},{x:_,y},{width:T,height:I}),d.R.copy(w,o,{x:0,y:I-1},{x:_,y:y-1},{width:T,height:1}),d.R.copy(w,o,{x:0,y:0},{x:_,y:y+I},{width:T,height:1}),d.R.copy(w,o,{x:T-1,y:0},{x:_-1,y},{width:1,height:I}),d.R.copy(w,o,{x:0,y:0},{x:_+T,y},{width:1,height:I})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(const n of e){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const a=this.getImage(n);a||d.w(`Image with ID: "${n}" was not found`),Ye(a)&&this.updateImage(n,a)}}}const Te=1e20;function pt(u,e,n,a,o,c,m,_,y){for(let w=e;w<e+a;w++)Xt(u,n*c+w,c,o,m,_,y);for(let w=n;w<n+o;w++)Xt(u,w*c+e,1,a,m,_,y)}function Xt(u,e,n,a,o,c,m){c[0]=0,m[0]=-Te,m[1]=Te,o[0]=u[e];for(let _=1,y=0,w=0;_<a;_++){o[_]=u[e+_*n];const T=_*_;do{const I=c[y];w=(o[_]-o[I]+T-I*I)/(_-I)/2}while(w<=m[y]&&--y>-1);y++,c[y]=_,m[y]=w,m[y+1]=Te}for(let _=0,y=0;_<a;_++){for(;m[y+1]<_;)y++;const w=c[y],T=_-w;u[e+_*n]=o[w]+T*T}}class Ii{constructor(e,n){this.requestManager=e,this.localIdeographFontFamily=n,this.entries={}}setURL(e){this.url=e}getGlyphs(e){return d._(this,void 0,void 0,(function*(){const n=[];for(const c in e)for(const m of e[c])n.push(this._getAndCacheGlyphsPromise(c,m));const a=yield Promise.all(n),o={};for(const{stack:c,id:m,glyph:_}of a)o[c]||(o[c]={}),o[c][m]=_&&{id:_.id,bitmap:_.bitmap.clone(),metrics:_.metrics};return o}))}_getAndCacheGlyphsPromise(e,n){return d._(this,void 0,void 0,(function*(){let a=this.entries[e];a||(a=this.entries[e]={glyphs:{},requests:{},ranges:{}});let o=a.glyphs[n];if(o!==void 0)return{stack:e,id:n,glyph:o};if(o=this._tinySDF(a,e,n),o)return a.glyphs[n]=o,{stack:e,id:n,glyph:o};const c=Math.floor(n/256);if(256*c>65535)throw new Error("glyphs > 65535 not supported");if(a.ranges[c])return{stack:e,id:n,glyph:o};if(!this.url)throw new Error("glyphsUrl is not set");if(!a.requests[c]){const _=Ii.loadGlyphRange(e,c,this.url,this.requestManager);a.requests[c]=_}const m=yield a.requests[c];for(const _ in m)this._doesCharSupportLocalGlyph(+_)||(a.glyphs[+_]=m[+_]);return a.ranges[c]=!0,{stack:e,id:n,glyph:m[n]||null}}))}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(e))}_tinySDF(e,n,a){const o=this.localIdeographFontFamily;if(!o||!this._doesCharSupportLocalGlyph(a))return;let c=e.tinySDF;if(!c){let _="400";/bold/i.test(n)?_="900":/medium/i.test(n)?_="500":/light/i.test(n)&&(_="200"),c=e.tinySDF=new Ii.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:o,fontWeight:_})}const m=c.draw(String.fromCharCode(a));return{id:a,bitmap:new d.o({width:m.width||60,height:m.height||60},m.data),metrics:{width:m.glyphWidth/2||24,height:m.glyphHeight/2||24,left:m.glyphLeft/2+.5||0,top:m.glyphTop/2-27.5||-8,advance:m.glyphAdvance/2||24,isDoubleResolution:!0}}}}Ii.loadGlyphRange=function(u,e,n,a){return d._(this,void 0,void 0,(function*(){const o=256*e,c=o+255,m=a.transformRequest(n.replace("{fontstack}",u).replace("{range}",`${o}-${c}`),"Glyphs"),_=yield d.l(m,new AbortController);if(!_||!_.data)throw new Error(`Could not load glyph range. range: ${e}, ${o}-${c}`);const y={};for(const w of d.n(_.data))y[w.id]=w;return y}
6))},Ii.TinySDF=class{constructor({fontSize:u=24,buffer:e=3,radius:n=8,cutoff:a=.25,fontFamily:o="sans-serif",fontWeight:c="normal",fontStyle:m="normal"}={}){this.buffer=e,this.cutoff=a,this.radius=n;const _=this.size=u+4*e,y=this._createCanvas(_),w=this.ctx=y.getContext("2d",{willReadFrequently:!0});w.font=`${m} ${c} ${u}px ${o}`,w.textBaseline="alphabetic",w.textAlign="left",w.fillStyle="black",this.gridOuter=new Float64Array(_*_),this.gridInner=new Float64Array(_*_),this.f=new Float64Array(_),this.z=new Float64Array(_+1),this.v=new Uint16Array(_)}_createCanvas(u){const e=document.createElement("canvas");return e.width=e.height=u,e}draw(u){const{width:e,actualBoundingBoxAscent:n,actualBoundingBoxDescent:a,actualBoundingBoxLeft:o,actualBoundingBoxRight:c}=this.ctx.measureText(u),m=Math.ceil(n),_=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(c-o))),y=Math.min(this.size-this.buffer,m+Math.ceil(a)),w=_+2*this.buffer,T=y+2*this.buffer,I=Math.max(w*T,0),k=new Uint8ClampedArray(I),F={data:k,width:w,height:T,glyphWidth:_,glyphHeight:y,glyphTop:m,glyphLeft:0,glyphAdvance:e};if(_===0||y===0)return F;const{ctx:V,buffer:q,gridInner:H,gridOuter:W}=this;V.clearRect(q,q,_,y),V.fillText(u,q,q+m);const J=V.getImageData(q,q,_,y);W.fill(Te,0,I),H.fill(0,0,I);for(let j=0;j<y;j++)for(let ne=0;ne<_;ne++){const se=J.data[4*(j*_+ne)+3]/255;if(se===0)continue;const ce=(j+q)*w+ne+q;if(se===1)W[ce]=0,H[ce]=Te;else{const ye=.5-se;W[ce]=ye>0?ye*ye:0,H[ce]=ye<0?ye*ye:0}}pt(W,0,0,w,T,w,this.f,this.v,this.z),pt(H,q,q,_,y,w,this.f,this.v,this.z);for(let j=0;j<I;j++){const ne=Math.sqrt(W[j])-Math.sqrt(H[j]);k[j]=Math.round(255-255*(ne/this.radius+this.cutoff))}return F}};class hs{constructor(){this.specification=d.v.light.position}possiblyEvaluate(e,n){return d.x(e.expression.evaluate(n))}interpolate(e,n,a){return{x:d.y.number(e.x,n.x,a),y:d.y.number(e.y,n.y,a),z:d.y.number(e.z,n.z,a)}}}let Nn;class cn extends d.E{constructor(e){super(),Nn=Nn||new d.q({anchor:new d.D(d.v.light.anchor),position:new hs,color:new d.D(d.v.light.color),intensity:new d.D(d.v.light.intensity)}),this._transitionable=new d.T(Nn),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,n={}){if(!this._validate(d.r,e,n))for(const a in e){const o=e[a];a.endsWith("-transition")?this._transitionable.setTransition(a.slice(0,-11),o):this._transitionable.setValue(a,o)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,n,a){return(!a||a.validate!==!1)&&d.t(this,e.call(d.u,{value:n,style:{glyphs:!0,sprite:!0},styleSpec:d.v}))}}const Ai=new d.q({"sky-color":new d.D(d.v.sky["sky-color"]),"horizon-color":new d.D(d.v.sky["horizon-color"]),"fog-color":new d.D(d.v.sky["fog-color"]),"fog-ground-blend":new d.D(d.v.sky["fog-ground-blend"]),"horizon-fog-blend":new d.D(d.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new d.D(d.v.sky["sky-horizon-blend"]),"atmosphere-blend":new d.D(d.v.sky["atmosphere-blend"])});class pr extends d.E{constructor(e){super(),this._transitionable=new d.T(Ai),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new d.z(0))}setSky(e,n={}){if(!this._validate(d.B,e,n)){e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const a in e){const o=e[a];a.endsWith("-transition")?this._transitionable.setTransition(a.slice(0,-11),o):this._transitionable.setValue(a,o)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,n,a={}){return(a==null?void 0:a.validate)!==!1&&d.t(this,e.call(d.u,d.e({value:n,style:{glyphs:!0,sprite:!0},styleSpec:d.v})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class qi{constructor(e,n){this.width=e,this.height=n,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,n){const a=e.join(",")+String(n);
6return this.dashEntry[a]||(this.dashEntry[a]=this.addDash(e,n)),this.dashEntry[a]}getDashRanges(e,n,a){const o=[];let c=e.length%2==1?-e[e.length-1]*a:0,m=e[0]*a,_=!0;o.push({left:c,right:m,isDash:_,zeroLength:e[0]===0});let y=e[0];for(let w=1;w<e.length;w++){_=!_;const T=e[w];c=y*a,y+=T,m=y*a,o.push({left:c,right:m,isDash:_,zeroLength:T===0})}return o}addRoundDash(e,n,a){const o=n/2;for(let c=-a;c<=a;c++){const m=this.width*(this.nextRow+a+c);let _=0,y=e[_];for(let w=0;w<this.width;w++){w/y.right>1&&(y=e[++_]);const T=Math.abs(w-y.left),I=Math.abs(w-y.right),k=Math.min(T,I);let F;const V=c/a*(o+1);if(y.isDash){const q=o-Math.abs(V);F=Math.sqrt(k*k+q*q)}else F=o-Math.sqrt(k*k+V*V);this.data[m+w]=Math.max(0,Math.min(255,F+128))}}}addRegularDash(e){for(let _=e.length-1;_>=0;--_){const y=e[_],w=e[_+1];y.zeroLength?e.splice(_,1):w&&w.isDash===y.isDash&&(w.left=y.left,e.splice(_,1))}const n=e[0],a=e[e.length-1];n.isDash===a.isDash&&(n.left=a.left-this.width,a.right=n.right+this.width);const o=this.width*this.nextRow;let c=0,m=e[c];for(let _=0;_<this.width;_++){_/m.right>1&&(m=e[++c]);const y=Math.abs(_-m.left),w=Math.abs(_-m.right),T=Math.min(y,w);this.data[o+_]=Math.max(0,Math.min(255,(m.isDash?T:-T)+128))}}addDash(e,n){const a=n?7:0,o=2*a+1;if(this.nextRow+o>this.height)return d.w("LineAtlas out of space"),null;let c=0;for(let _=0;_<e.length;_++)c+=e[_];if(c!==0){const _=this.width/c,y=this.getDashRanges(e,this.width,_);n?this.addRoundDash(y,_,a):this.addRegularDash(y)}const m={y:(this.nextRow+a+.5)/this.height,height:2*a/this.height,width:c};return this.nextRow+=o,this.dirty=!0,m}bind(e){const n=e.gl;this.texture?(n.bindTexture(n.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,n.texSubImage2D(n.TEXTURE_2D,0,0,0,this.width,this.height,n.ALPHA,n.UNSIGNED_BYTE,this.data))):(this.texture=n.createTexture(),n.bindTexture(n.TEXTURE_2D,this.texture),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.L
6INEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texImage2D(n.TEXTURE_2D,0,n.ALPHA,this.width,this.height,0,n.ALPHA,n.UNSIGNED_BYTE,this.data))}}const ki="maplibre_preloaded_worker_pool";class Ei{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<Ei.workerCount;)this.workers.push(new Worker(d.a.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.numActive()===0&&(this.workers.forEach((n=>{n.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[ki]}numActive(){return Object.keys(this.active).length}}const Yn=Math.floor(de.hardwareConcurrency/2);let Zi,zi;function Zr(){return Zi||(Zi=new Ei),Zi}Ei.workerCount=d.C(globalThis)?Math.max(Math.min(Yn,3),1):1;class Vt{constructor(e,n){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=n;const a=this.workerPool.acquire(n);for(let o=0;o<a.length;o++){const c=new d.F(a[o],n);c.name=`Worker ${o}`,this.actors.push(c)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,n){const a=[];for(const o of this.actors)a.push(o.sendAsync({type:e,data:n}));return Promise.all(a)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach((n=>{n.remove()})),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,n){for(const a of this.actors)a.registerMessageHandler(e,n)}}function Pi(){return zi||(zi=new Vt(Zr(),d.G),zi.registerMessageHandler("GR",((u,e,n)=>d.m(e,n)))),zi}function Ci(u,e){const n=d.H();return d.J(n,n,[1,1,0]),d.K(n,n,[.5*u.width,.5*u.height,1]),d.L(n,n,u.calculatePosMatrix(e.toUnwrapped()))}function Ar(u,e,n,a,o,c){const m=(function(I,k,F){if(I)for(const V of I){const q=k[V];if(q&&q.source===F&&q.type==="fill-extrusion")return!0}else for(const V in k){const q=k[V];if(q.source===F&&q.type==="fill-extrusion")return!0}return!1})(o&&o.layers,e,u.id),_=c.maxPitchScaleFactor(),y=u.tilesIn(a,_,m);y.sort(un);const w=[];for(const I of y)w.push({wrappedTileID:I.tileID.wrapped().key,queryResults:I.tile.queryRenderedFeatures(e,n,u._state,I.queryGeometry,I.cameraQueryGeometry,I.scale,o,c,_,Ci(u.transform,I.tileID))});const T=(function(I){const k={},F={};for(const V of I){const q=V.queryResults,H=V.wrappedTileID,W=F[H]=F[H]||{};for(const J in q){const j=q[J],ne=W[J]=W[J]||{},se=k[J]=k[J]||[];for(const ce of j)ne[ce.featureIndex]||(ne[ce.featureIndex]=!0,se.push(ce))}}return k})(w);for(const I in T)T[I].forEach((k=>{const F=k.feature,V=u.getFeatureState(F.layer["source-layer"],F.id);F.source=F.layer.source,F.layer["source-layer"]&&(F.sourceLayer=F.layer["source-layer"]),F.state=V}));return T}function un(u,e){const n=u.tileID,a=e.tileID;return n.overscaledZ-a.overscaledZ||n.canonical.y-a.canonical.y||n.wrap-a.wrap||n.canonical.x-a.canonical.x}function Vn(u,e,n){return d._(this,void 0,void 0,(function*(){let a=u;if(u.url?a=(yield d.h(e.transformRequest(u.url,"Source"),n)).data:yield de.frameAsync(n),!a)return null;const o=d.M(d.e(a,u),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in a&&a.vector_layers&&(o.vectorLayerIds=a.vector_layers.map((c=>c.id))),o}))}class he{constructor(e,n){e&&(n?this.setSouthWest(e).setNorthEast(n):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof d.N?new d.N(e.lng,e.lat):d.N.convert(e),this}setSouthWest(e){return this._sw=e instanceof d.N?new d.N(e.lng,e.lat):d.N.convert(e),this}extend(e){const n=this._sw,a=this._ne;let o,c;if(e instanceof d.N)o=e,c=e;else{if(!(e instanceof he))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(he.convert(e)):this.extend(d.N.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(d.N.convert(e)):this;if(o=e._sw,c=e._ne,!o||!c)return this}return n||a?(n.lng=Math.min(o.lng,n.lng),n.lat=Math.min(o.lat,n.lat),a.lng=Math.max(c.lng,a.lng),a.lat=Math.max(c.lat,a.lat)):(this._sw=new d.N(o.lng,o.lat),this._ne=new d.N(c.lng,c.lat)),this}getCenter(){return new d.N((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}
6getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new d.N(this.getWest(),this.getNorth())}getSouthEast(){return new d.N(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:n,lat:a}=d.N.convert(e);let o=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=a&&a<=this._ne.lat&&o}static convert(e){return e instanceof he?e:e&&new he(e)}static fromLngLat(e,n=0){const a=360*n/40075017,o=a/Math.cos(Math.PI/180*e.lat);return new he(new d.N(e.lng-o,e.lat-a),new d.N(e.lng+o,e.lat+a))}adjustAntiMeridian(){const e=new d.N(this._sw.lng,this._sw.lat),n=new d.N(this._ne.lng,this._ne.lat);return new he(e,e.lng>n.lng?new d.N(n.lng+360,n.lat):n)}}class hn{constructor(e,n,a){this.bounds=he.convert(this.validateBounds(e)),this.minzoom=n||0,this.maxzoom=a||24}
6validateBounds(e){return Array.isArray(e)&&e.length===4?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){const n=Math.pow(2,e.z),a=Math.floor(d.O(this.bounds.getWest())*n),o=Math.floor(d.Q(this.bounds.getNorth())*n),c=Math.ceil(d.O(this.bounds.getEast())*n),m=Math.ceil(d.Q(this.bounds.getSouth())*n);return e.x>=a&&e.x<c&&e.y>=o&&e.y<m}}class dn extends d.E{constructor(e,n,a,o){if(super(),this.id=e,this.dispatcher=a,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,d.e(this,d.M(n,["url","scheme","tileSize","promoteId"])),this._options=d.e({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(o)}load(){return d._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new d.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const e=yield Vn(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(d.e(this,e),e.bounds&&(this.tileBounds=new hn(e.bounds,this.minzoom,this.maxzoom)),this.fire(new d.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new d.k("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new d.j(e))}}))}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load()}setTiles(e){return this.setSourceProperty((()=>{this._options.tiles=e})),this}setUrl(e){return this.setSourceProperty((()=>{this.url=e,this._options.url=e})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return d.e({},this._options)}loadTile(e){return d._(this,void 0,void 0,(function*(){const n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),a={request:this.map._requestManager.transformRequest(n,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.t
6ype,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};a.request.collectResourceTiming=this._collectResourceTiming;let o="RT";if(e.actor&&e.state!=="expired"){if(e.state==="loading")return new Promise(((c,m)=>{e.reloadPromise={resolve:c,reject:m}}))}else e.actor=this.dispatcher.getActor(),o="LT";e.abortController=new AbortController;try{const c=yield e.actor.sendAsync({type:o,data:a},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,c)}catch(c){if(delete e.abortController,e.aborted)return;if(c&&c.status!==404)throw c;this._afterTileLoadWorkerResponse(e,null)}}))}_afterTileLoadWorkerResponse(e,n){if(n&&n.resourceTiming&&(e.resourceTiming=n.resourceTiming),n&&this.map._refreshExpiredTiles&&e.setExpiryData(n),e.loadVectorData(n,this.map.painter),e.reloadPromise){const a=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(a.resolve).catch(a.reject)}}abortTile(e){return d._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.t
6ype,source:this.id}}))}))}unloadTile(e){return d._(this,void 0,void 0,(function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}}))}))}hasTransition(){return!1}}class Ct extends d.E{constructor(e,n,a,o){super(),this.id=e,this.dispatcher=a,this.setEventedParent(o),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=d.e({type:"raster"},n),d.e(this,d.M(n,["url","scheme","tileSize"]))}load(){return d._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new d.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const e=yield Vn(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,e&&(d.e(this,e),e.bounds&&(this.tileBounds=new hn(e.bounds,this.minzoom,this.maxzoom)),this.fire(new d.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new d.k("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new d.j(e))}}))}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load()}setTiles(e){return this.setSourceProperty((()=>{this._options.tiles=e})),this}setUrl(e){return this.setSourceProperty((()=>{this.url=e,this._options.url=e})),this}serialize(){return d.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return d._(this,void 0,void 0,(function*(){const n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{const a=yield we.getImage(this.map._requestManager.transformRequest(n,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(a&&a.data){this.map._refreshExpiredTiles&&a.cacheControl&&a.expires&&e.setExpiryData({cacheControl:a.cacheControl,expires:a.expires});const o=this.map.painter.context,c=o.gl,m=a.data;e.texture=this.map.painter.getTileTexture(m.width),e.texture?e.texture.update(m,{useMipmap:!0}):(e.texture=new dt(o,m,c.RGBA,{useMipmap:!0}),e.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE,c.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(a){if(delete e.abortController,e.aborted)e.state="unloaded";else if(a)throw e.state="errored",a}}))}abortTile(e){return d._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)}))}unloadTile(e){return d._(this,void 0,void 0,(function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)}))}hasTransition(){return!1}}class kt extends Ct{constructor(e,n,a,o){super(e,n,a,o),this.type="raster-dem",this.maxzoom=22,this._options=d.e({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox",this.redFactor=n.redFactor,this.greenFactor=n.greenFactor,this.blueFactor=n.blueFactor,this.baseShift=n.baseShift}loadTile(e){return d._(this,void 0,void 0,(function*(){const n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),a=this.map._requestManager.transformRequest(n,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{const o=yield we.getImage(a,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(o&&o.data){const c=o.data;this.map._refreshExpiredTiles&&o.cacheControl&&o.expires&&e.setExpiryData({cacheControl:o.cacheControl,expires:o.expires});const m=d.b(c)&&d.U()?c:yield this.readImageNow(c),_={type:this.type,uid:e.uid,source:this.id,rawImageData:m,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||e.state==="expired"){e.actor=this.dispatcher.getActor();const y=yield e.actor.sendAsync({type:"LDT",data:_});e.dem=y,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(o){if(delete e.abortController,e.aborted)e.state="unloaded";else if(o)throw e.state="errored",o}}))}readImageNow(e){return d._(this,void 0,void 0,(function*(){if(typeof VideoFrame<"u"&&d.V()){const n=e.width+2,a=e.height+2;try{return new d.R({width:n,height:a},yield d.W(e,-1,-1,n,a))}catch{}}return de.getImageData(e,1)}))}_getNeighboringTiles(e){const n=e.canonical,a=Math.pow(2,n.z),o=(n.x-1+a)%a,c=n.x===0?e.wrap-1:e.wrap,m=(n.x+1+a)%a,_=n.x+1===a?e.wrap+1:e.wrap,y={};return y[new d.S(e.overscaledZ,c,n.z,o,n.y).key]={backfilled:!1},y[new d.S(e.overscaledZ,_,n.z,m,n.y).key]={backfilled:!1},n.y>0&&(y[new d.S(e.overscaledZ,c,n.z,o,n.y-1).key]={backfilled:!1},y[new d.S(e.overscaledZ,e.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},y[new d.S(e.overscaledZ,_,n.z,m,n.y-1).key]={backfilled:!1}),n.y+1<a&&(y[new d.S(e.overscaledZ,c,n.z,o,n.y+1).key]={backfilled:!1},y[new d.S(e.overscaledZ,e.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},y[new d.S(e.overscaledZ,_,n.z,m,n.y+1).key]={backfilled:!1}),y}unloadTile(e){return d._(this,void 0,void 0,(function*(){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&(yield e.actor.sendAsync({type:"RDT",data:{type:this.t
6ype,uid:e.uid,source:this.id}}))}))}}class ds extends d.E{constructor(e,n,a,o){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=a.getActor(),this.setEventedParent(o),this._data=n.data,this._options=d.e({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId;const c=d.X/this.tileSize;n.clusterMaxZoom!==void 0&&this.maxzoom<=n.clusterMaxZoom&&d.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${n.clusterMaxZoom}".`),this.workerOptions=d.e({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(n.buffer!==void 0?n.buffer:128)*c,tolerance:(n.tolerance!==void 0?n.tolerance:.375)*c,extent:d.X,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:n.clusterMaxZoom!==void 0?n.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:d.X,radius:(n.clusterRadius||50)*c,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}load(){return d._(this,void 0,void 0,(function*(){yield this._updateWorkerData()}))}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(e){return this._updateWorkerData(e),this}getData(){return d._(this,void 0,void 0,(function*(){const e=d.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:e})}))}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=e.clusterRadius),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=e.clusterMa
6xZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,n,a){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:n,offset:a}})}_updateWorkerData(e){return d._(this,void 0,void 0,(function*(){const n=d.e({type:this.type},this.workerOptions);e?n.dataDiff=e:typeof this._data=="string"?(n.request=this.map._requestManager.transformRequest(de.resolveURL(this._data),"Source"),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new d.k("dataloading",{dataType:"source"}));try{const a=yield this.actor.sendAsync({type:"LD",data:n});if(this._pendingLoads--,this._removed||a.abandoned)return void this.fire(new d.k("dataabort",{dataType:"source"}));let o=null;a.resourceTiming&&a.resourceTiming[this.id]&&(o=a.resourceTiming[this.id].slice(0));const c={dataType:"source"};this._collectResourceTiming&&o&&o.length>0&&d.e(c,{resourceTiming:o}),this.fire(new d.k("data",Object.assign(Object.assign({},c),{sourceDataType:"metadata"}))),this.fire(new d.k("data",Object.assign(Object.assign({},c),{sourceDataType:"content"})))}catch(a){if(this._pendingLoads--,this._removed)return void this.fire(new d.k("dataabort",{dataType:"source"}));this.fire(new d.j(a))}}))}loaded(){return this._pendingLoads===0}loadTile(e){return d._(this,void 0,void 0,(function*(){const n=e.actor?"RT":"LT";e.actor=this.actor;const a={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};e.abortController=new AbortController;const o=yield this.actor.sendAsync({type:n,data:a},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(o,this.map.painter,n==="RT")}))}abortTile(e){return d._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0}))}unloadTile(e){return d._(this,void 0,void 0,(function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.t
6ype,source:this.id}})}))}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return d.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var pn=d.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class di extends d.E{constructor(e,n,a,o){super(),this.id=e,this.dispatcher=a,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(o),this.options=n}load(e){return d._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new d.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const n=yield we.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,n&&n.data&&(this.image=n.data,e&&(this.coordinates=e),this._finishLoading())}catch(n){this._request=null,this._loaded=!0,this.fire(new d.j(n))}}))}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally((()=>{this.texture=null})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new d.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;const n=e.map(d.Z.fromLngLat);this.tileID=(function(o){let c=1/0,m=1/0,_=-1/0,y=-1/0;for(const k of o)c=Math.min(c,k.x),m=Math.min(m,k.y),_=Math.max(_,k.x),y=Math.max(y,k.y);const w=Math.max(_-c,y-m),T=Math.max(0,Math.floor(-Math.log(w)/Math.LN2)),I=Math.pow(2,T);return new d.a1(T,Math.floor((c+_)/2*I),Math.floor((m+y)/2*I))})(n),this.minzoom=this.maxzoom=this.tileID.z;const a=n.map((o=>this.tileID.getTilePoint(o)._round()));return this._boundsArray=new d.$,this._boundsArray.emplaceBack(a[0].x,a[0].y,0,0),this._boundsArray.emplaceBack(a[1].x,a[1].y,d.X,0),this._boundsArray.emplaceBack(a[3].x,a[3].y,0,d.X),this._boundsArray.emplaceBack(a[2].x,a[2].y,d.X,d.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new d.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const e=this.map.painter.context,n=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,pn.members)),this.boundsSegments||(this.boundsSegments=d.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new dt(e,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let a=!1;for(const o in this.tiles){const c=this.tiles[o];c.state!=="loaded"&&(c.state="loaded",c.texture=this.texture,a=!0)}a&&this.fire(new d.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return d._(this,void 0,void 0,(function*(){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"}))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Kn extends di{constructor(e,n,a,o){super(e,n,a,o),this.roundZoom=!0,this.type="video",this.options=n}load(){return d._(this,void 0,void 0,(function*(){this._loaded=!1;const e=this.options;this.urls=[];for(const n of e.urls)this.urls.push(this.map._requestManager.transformRequest(n,"Source").url);try{const n=yield d.a3(this.urls);if(this._loaded=!0,!n)return;this.video=n,this.video.loop=!0,this.video.addEventListener("playing",(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading()}catch(n){this.fire(new d.j(n))}}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){const n=this.video.seekable;e<n.start(0)||e>n.end(0)?this.fire(new d.j(new d.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}
6onAdd(e){this.map||(this.map=e,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 e=this.map.painter.context,n=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,pn.members)),this.boundsSegments||(this.boundsSegments=d.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new dt(e,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let a=!1;for(const o in this.tiles){const c=this.tiles[o];c.state!=="loaded"&&(c.state="loaded",c.texture=this.texture,a=!0)}a&&this.fire(new d.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class fr extends di{constructor(e,n,a,o){super(e,n,a,o),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some((c=>!Array.isArray(c)||c.length!==2||c.some((m=>typeof m!="number"))))||this.fire(new d.j(new d.a2(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new d.j(new d.a2(`sources.${e}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new d.j(new d.a2(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new d.j(new d.a2(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new d.j(new d.a2(`sources.${e}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){return d._(this,void 0,void 0,(function*(){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 d.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}))}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const n=this.map.painter.context,a=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,pn.members)),this.boundsSegments||(this.boundsSegments=d.a0.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new dt(n,this.canvas,a.RGBA,{premultiply:!0});let o=!1;for(const c in this.tiles){const m=this.tiles[c];m.state!=="loaded"&&(m.state="loaded",m.texture=this.texture,o=!0)}o&&this.fire(new d.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}const ps={},fs=u=>{switch(u){case"geojson":return ds;case"image":return di;case"raster":return Ct;case"raster-dem":return kt;case"vector":return dn;case"video":return Kn;case"canvas":return fr}return ps[u]},Ae="RTLPluginLoaded";class Gr extends d.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Pi()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch((n=>{throw this.status="error",n}))}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return d._(this,arguments,void 0,(function*(n,a=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=de.resolveURL(n),!this.url)throw new Error(`requested url ${n}
6 is invalid`);if(this.status==="unavailable"){if(!a)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()}))}_requestImport(){return d._(this,void 0,void 0,(function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new d.k(Ae))}))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Gi=null;function mr(){return Gi||(Gi=new Gr),Gi}class Rr{constructor(e,n){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=d.a4(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){const n=e+this.timeAdded;n<this.fadeEndTime||(this.fadeEndTime=n)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,n,a){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=(function(o,c){const m={};if(!c)return m;for(const _ of o){const y=_.layerIds.map((w=>c.getLayer(w))).filter(Boolean);if(y.length!==0){_.layers=y,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map((w=>y.filter((T=>T.id===w))[0])));for(const w of y)m[w.id]=_}}return m})(e.buckets,n.style),this.hasSymbolBuckets=!1;for(const o in this.buckets){const c=this.buckets[o];if(c instanceof d.a6){if(this.hasSymbolBuckets=!0,!a)break;c.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const o in this.buckets){const c=this.buckets[o];if(c instanceof d.a6&&c.hasRTLText){this.hasRTLText=!0,mr().lazyLoad();break}}this.queryPadding=0;for(const o in this.buckets){const c=this.buckets[o];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(o).queryRadius(c))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new d.a5}unloadVectorData(){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(const a in this.buckets){const o=this.buckets[a];o.uploadPending()&&o.upload(e)}const n=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new dt(e,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new dt(e,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,n,a,o,c,m,_,y,w,T){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:o,cameraQueryGeometry:c,scale:m,tileSize:this.tileSize,pixelPosMatrix:T,transform:y,params:_,queryPadding:this.queryPadding*w},e,n,a):{}}querySourceFeatures(e,n){const a=this.latestFeatureIndex;if(!a||!a.rawTileData)return;const o=a.loadVTLayers(),c=n&&n.sourceLayer?n.sourceLayer:"",m=o._geojsonTileLayer||o[c];if(!m)return;const _=d.a7(n&&n.filter),{z:y,x:w,y:T}=this.tileID.canonical,I={z:y,x:w,y:T};for(let k=0;k<m.length;k++){const F=m.feature(k);if(_.needGeometry){const H=d.a8(F,!0);if(!_.filter(new d.z(this.tileID.overscaledZ),H,this.tileID.canonical))continue}else if(!_.filter(new d.z(this.tileID.overscaledZ),F))continue;const V=a.getId(F,c),q=new d.a9(F,y,w,T,V);q.tile=I,e.push(q)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){const n=this.expirationTime;
6if(e.cacheControl){const a=d.aa(e.cacheControl);a["max-age"]&&(this.expirationTime=Date.now()+1e3*a["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const a=Date.now();let o=!1;if(this.expirationTime>a)o=!1;else if(n)if(this.expirationTime<n)o=!0;else{const c=this.expirationTime-n;c?this.expirationTime=a+Math.max(c,3e4):o=!0}else o=!0;o?(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)}setFeatureState(e,n){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;const a=this.latestFeatureIndex.loadVTLayers();for(const o in this.buckets){if(!n.style.hasLayer(o))continue;const c=this.buckets[o],m=c.layers[0].sourceLayer||"_geojsonTileLayer",_=a[m],y=e[m];if(!_||!y||Object.keys(y).length===0)continue;c.update(y,_,this.imageAtlas&&this.imageAtlas.patternPositions||{});const w=n&&n.style&&n.style.getLayer(o);w&&(this.queryPadding=Math.max(this.queryPadding,w.queryRadius(c)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<de.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=de.now()+e}setDependencies(e,n){const a={};for(const o of n)a[o]=!0;this.dependencies[e]=a}hasDependency(e,n){for(const a of e){const o=this.dependencies[a];if(o){for(const c of n)if(o[c])return!0}}return!1}}class Ce{constructor(e,n){this.max=e,this.onRemove=n,this.reset()}reset(){for(const e in this.data)for(const n of this.data[e])n.timeout&&clearTimeout(n.timeout),this.onRemove(n.value);return this.data={},this.order=[],this}add(e,n,a){const o=e.wrapped().key;this.data[o]===void 0&&(this.data[o]=[]);const c={value:n,timeout:void 0};if(a!==void 0&&(c.timeout=setTimeout((()=>{this.remove(e,c)}),a)),this.data[o].push(c),this.order.push(o),this.order.length>this.max){const m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const n=this.data[e].shift();return n.timeout&&clearTimeout(n.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),n.value}getByKey(e){const n=this.data[e];return n?n[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,n){if(!this.has(e))return this;const a=e.wrapped().key,o=n===void 0?0:this.data[a].indexOf(n),c=this.data[a][o];return this.data[a].splice(o,1),c.timeout&&clearTimeout(c.timeout),this.data[a].length===0&&delete this.data[a],this.onRemove(c.value),this.order.splice(this.order.indexOf(a),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(e){const n=[];for(const a in this.data)for(const o of this.data[a])e(o.value)||n.push(o);for(const a of n)this.remove(a.value.tileID,a)}}class Tt{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,n,a){const o=String(n);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][o]=this.stateChanges[e][o]||{},d.e(this.stateChanges[e][o],a),this.deletedStates[e]===null){this.deletedStates[e]={};for(const c in this.state[e])c!==o&&(this.deletedStates[e][c]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][o]===null){this.deletedStates[e][o]={};for(const c in this.state[e][o])a[c]||(this.deletedStates[e][o][c]=null)}else for(const c in a)this.deletedStates[e]&&this.deletedStates[e][o]&&this.deletedStates[e][o][c]===null&&delete this.deletedStates[e][o][c]}removeFeatureState(e,n,a){if(this.deletedStates[e]===null)return;const o=String(n);if(this.deletedStates[e]=this.deletedStates[e]||{},a&&n!==void 0)this.deletedStates[e][o]!==null&&(this.deletedStates[e][o]=this.deletedStates[e][o]||{},this.deletedStates[e][o][a]=null);else if(n!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][o])for(a in this.deletedStates[e][o]={},this.stateChanges[e][o])this.deletedStates[e][o][a]=null;else this.deletedStates[e][o]=null;else this.deletedStates[e]=null}getState(e,n){const a=String(n),o=d.e({},(this.state[e]||{})[a],(this.stateChanges[e]||{})[a]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){const c=this.deletedStates[e][n];if(c===null)return{};for(const m in c)delete o[m]}return o}initializeTileState(e,n){e.setFeatureState(this.state,n)}coalesceChanges(e,n){const a={};for(const o in this.stateChanges){this.state[o]=this.state[o]||{};const c={};for(const m in this.stateChanges[o])this.state[o][m]||(this.state[o][m]={}),d.e(this.state[o][m],this.stateChanges[o][m]),c[m]=this.state[o][m];a[o]=c}for(const o in this.deletedStates){this.state[o]=this.state[o]||{};const c={};if(this.deletedStates[o]===null)for(const m in this.state[o])c[m]={},this.state[o][m]={};else for(const m in this.deletedStates[o]){if(this.deletedStates[o][m]===null)this.state[o][m]={};else for(const _ of Object.keys(this.deletedStates[o][m]))delete this.state[o][m][_];c[m]=this.state[o][m]}a[o]=a[o]||{},d.e(a[o],c)}if(this.stateChanges={},this.deletedStates={},Object.keys(a).length!==0)for(const o in e)e[o].setFeatureState(a,n)}}class it extends d.E{constructor(e,n,a){super(),this.id=e,this.dispatcher=a,this.on("data",(o=>this._dataHandler(o))),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=((o,c,m,_)=>{const y=new(fs(c.type))(o,c,m,_);if(y.id!==o)throw new Error(`Expected Source id to be ${o} instead of ${y.id}`);return y})(e,n,a,this),this._tiles={},this._cache=new Ce(0,(o=>this._unloadTile(o))),this._timers={},this._cacheTimers={}
6,this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Tt,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const e in this._tiles){const n=this._tiles[e];if(n.state!=="loaded"&&n.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,n,a){return d._(this,void 0,void 0,(function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,n,a)}catch(o){e.state="errored",o.status!==404?this._source.fire(new d.j(o,{tile:e})):this.update(this.transform,this.terrain)}}))}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new d.k("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const n in this._tiles){const a=this._tiles[n];a.upload(e),a.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map((e=>e.tileID)).sort(Ki).map((e=>e.key))}getRenderableIds(e){const n=[];for(const a in this._tiles)this._isIdRenderable(a,e)&&n.push(this._tiles[a]);return e?n.sort(((a,o)=>{const c=a.tileID,m=o.tileID,_=new d.P(c.canonical.x,c.canonical.y)._rotate(this.transform.angle),y=new d.P(m.canonical.x,m.canonical.y)._rotate(this.transform.angle);return c.overscaledZ-m.overscaledZ||y.y-_.y||y.x-_.x})).map((a=>a.tileID.key)):n.map((a=>a.tileID)).sort(Ki).map((a=>a.key))}hasRenderableParent(e){const n=this.findLoadedParent(e,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(e,n){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(n||!this._tiles[e].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const e in this._tiles)this._tiles[e].state!=="errored"&&this._reloadTile(e,"reloading")}}_reloadTile(e,n){return d._(this,void 0,void 0,(function*(){const a=this._tiles[e];a&&(a.state!=="loading"&&(a.state=n),yield this._loadTile(a,e,n))}
6))}_tileLoaded(e,n,a){e.timeAdded=de.now(),a==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(n,e),this.getSource().type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new d.k("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){const n=this.getRenderableIds();for(let o=0;o<n.length;o++){const c=n[o];if(e.neighboringTiles&&e.neighboringTiles[c]){const m=this.getTileByID(c);a(e,m),a(m,e)}}function a(o,c){o.needsHillshadePrepare=!0,o.needsTerrainPrepare=!0;let m=c.tileID.canonical.x-o.tileID.canonical.x;const _=c.tileID.canonical.y-o.tileID.canonical.y,y=Math.pow(2,o.tileID.canonical.z),w=c.tileID.key;m===0&&_===0||Math.abs(_)>1||(Math.abs(m)>1&&(Math.abs(m+y)===1?m+=y:Math.abs(m-y)===1&&(m-=y)),c.dem&&o.dem&&(o.dem.backfillBorder(c.dem,m,_),o.neighboringTiles&&o.neighboringTiles[w]&&(o.neighboringTiles[w].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,n,a,o){for(const c in this._tiles){let m=this._tiles[c];if(o[c]||!m.hasData()||m.tileID.overscaledZ<=n||m.tileID.overscaledZ>a)continue;let _=m.tileID;for(;m&&m.tileID.overscaledZ>n+1;){const w=m.tileID.scaledTo(m.tileID.overscaledZ-1);m=this._tiles[w.key],m&&m.hasData()&&(_=w)}let y=_;for(;y.overscaledZ>n;)if(y=y.scaledTo(y.overscaledZ-1),e[y.key]){o[_.key]=_;break}}}findLoadedParent(e,n){if(e.key in this._loadedParentTiles){const a=this._loadedParentTiles[e.key];return a&&a.tileID.overscaledZ>=n?a:null}for(let a=e.overscaledZ-1;a>=n;a--){const o=e.scaledTo(a),c=this._getLoadedTile(o);if(c)return c}}findLoadedSibling(e){return this._getLoadedTile(e)}_getLoadedTile(e){const n=this._tiles[e.key];return n&&n.hasData()?n:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){const n=Math.ceil(e.width/this._source.tileSize)+1,a=Math.ceil(e.height/this._source.tileSize)+1,o=Math.floor(n*a*(this._maxTileCacheZoomLevels===null?d.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),c=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,o):o;this._cache.setMaxSize(c)}handleWrapJump(e){const n=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,n){const a={};for(const o in this._tiles){const c=this._tiles[o];c.tileID=c.tileID.unwrapTo(c.tileID.wrap+n),a[c.tileID.key]=c}this._tiles=a;for(const o in this._timers)clearTimeout(this._timers[o]),delete this._timers[o];for(const o in this._tiles)this._setTileReloadTimer(o,this._tiles[o])}}_updateCoveredAndRetainedTiles(e,n,a,o,c,m){const _={},y={},w=Object.keys(e),T=de.now();for(const I of w){const k=e[I],F=this._tiles[I];if(!F||F.fadeEndTime!==0&&F.fadeEndTime<=T)continue;const V=this.findLoadedParent(k,n),q=this.findLoadedSibling(k),H=V||q||null;H&&(this._addTile(H.tileID),_[H.tileID.key]=H.tileID),y[I]=k}this._retainLoadedChildren(y,o,a,e);for(const I in _)e[I]||(this._coveredTiles[I]=!0,e[I]=_[I]);if(m){const I={},k={};for(const F of c)this._tiles[F.key].hasData()?I[F.key]=F:k[F.key]=F;for(const F in k){const V=k[F].children(this._source.maxzoom);this._tiles[V[0].key]&&this._tiles[V[1].key]&&this._tiles[V[2].key]&&this._tiles[V[3].key]&&(I[V[0].key]=e[V[0].key]=V[0],I[V[1].key]=e[V[1].key]=V[1],I[V[2].key]=e[V[2].key]=V[2],I[V[3].key]=e[V[3].key]=V[3],delete k[F])}for(const F in k){const V=k[F],q=this.findLoadedParent(V,this._source.minzoom),H=this.findLoadedSibling(V),W=q||H||null;if(W){I[W.tileID.key]=e[W.tileID.key]=W.tileID;for(const J in I)I[J].isChildOf(W.tileID)&&delete I[J]}}for(const F in this._tiles)I[F]||(this._coveredTiles[F]=!0)}}update(e,n){if(!this._sourceLoaded||this._paused)return;let a;this.transform=e,this.terrain=n,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?a=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((T=>new d.S(T.canonical.z,T.wrap,T.canonical.z,T.canonical.x,T.canonical.y))):(a=e.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n}),this._source.hasTile&&(a=a.filter((T=>this._source.hasTile(T))))):a=[];const o=e.coveringZoomLevel(this._source),c=Math.max(o-it.maxOverzooming,this._source.minzoom),m=Math.max(o+it.maxUnderzooming,this._source.minzoom);
6if(this.usedForTerrain){const T={};for(const I of a)if(I.canonical.z>this._source.minzoom){const k=I.scaledTo(I.canonical.z-1);T[k.key]=k;const F=I.scaledTo(Math.max(this._source.minzoom,Math.min(I.canonical.z,5)));T[F.key]=F}a=a.concat(Object.values(T))}const _=a.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,_&&this.fire(new d.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const y=this._updateRetainedTiles(a,o);Br(this._source.type)&&this._updateCoveredAndRetainedTiles(y,c,m,o,a,n);for(const T in y)this._tiles[T].clearFadeHold();const w=d.ab(this._tiles,y);for(const T of w){const I=this._tiles[T];I.hasSymbolBuckets&&!I.holdingForFade()?I.setHoldDuration(this.map._fadeDuration):I.hasSymbolBuckets&&!I.symbolFadeFinished()||this._removeTile(T)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,n){var a;const o={},c={},m=Math.max(n-it.maxOverzooming,this._source.minzoom),_=Math.max(n+it.maxUnderzooming,this._source.minzoom),y={};for(const w of e){const T=this._addTile(w);o[w.key]=w,T.hasData()||n<this._source.maxzoom&&(y[w.key]=w)}this._retainLoadedChildren(y,n,_,o);for(const w of e){let T=this._tiles[w.key];if(T.hasData())continue;if(n+1>this._source.maxzoom){const k=w.children(this._source.maxzoom)[0],F=this.getTile(k);if(F&&F.hasData()){o[k.key]=k;continue}}else{const k=w.children(this._source.maxzoom);if(o[k[0].key]&&o[k[1].key]&&o[k[2].key]&&o[k[3].key])continue}let I=T.wasRequested();for(let k=w.overscaledZ-1;k>=m;--k){const F=w.scaledTo(k);if(c[F.key])break;if(c[F.key]=!0,T=this.getTile(F),!T&&I&&(T=this._addTile(F)),T){const V=T.hasData();if((V||!(!((a=this.map)===null||a===void 0)&&a.cancelPendingTileRequestsWhileZooming)||I)&&(o[F.key]=F),I=T.wasRequested(),V)break}}}return o}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const n=[];let a,o=this._tiles[e].tileID;for(;o.overscaledZ>0;){if(o.key in this._loadedParentTiles){a=this._loadedParentTiles[o.key];break}n.push(o.key);const c=o.scaledTo(o.overscaledZ-1);if(a=this._getLoadedTile(c),a)break;o=c}for(const c of n)this._loadedParentTiles[c]=a}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const e in this._tiles){const n=this._tiles[e].tileID,a=this._getLoadedTile(n);this._loadedSiblingTiles[n.key]=a}}_addTile(e){let n=this._tiles[e.key];if(n)return n;n=this._cache.getAndRemove(e),n&&(this._setTileReloadTimer(e.key,n),n.tileID=e,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,n)));const a=n;return n||(n=new Rr(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(n,e.key,n.state)),n.uses++,this._tiles[e.key]=n,a||this._source.fire(new d.k("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(e,n){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const a=n.getExpiryTimeout();a&&(this._timers[e]=setTimeout((()=>{this._reloadTile(e,"expired"),delete this._timers[e]}),a))}_removeTile(e){const n=this._tiles[e];n&&(n.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}_dataHandler(e){const n=e.sourceDataType;e.dataType==="source"&&n==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType==="source"&&n==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,n,a){const o=[],c=this.transform;if(!c)return o;const m=a?c.getCameraQueryGeometry(e):e,_=e.map((V=>c.pointCoordinate(V,this.terrain))),y=m.map((V=>c.pointCoordinate(V,this.terrain))),w=this.getIds();let T=1/0,I=1/0,k=-1/0,F=-1/0;for(const V of y)T=Math.min(T,V.x),I=Math.min(I,V.y),k=Math.max(k,V.x),F=Math.max(F,V.y);for(let V=0;V<w.length;V++){const q=this._tiles[w[V]];if(q.holdingForFade())continue;
6const H=q.tileID,W=Math.pow(2,c.zoom-q.tileID.overscaledZ),J=n*q.queryPadding*d.X/q.tileSize/W,j=[H.getTilePoint(new d.Z(T,I)),H.getTilePoint(new d.Z(k,F))];if(j[0].x-J<d.X&&j[0].y-J<d.X&&j[1].x+J>=0&&j[1].y+J>=0){const ne=_.map((ce=>H.getTilePoint(ce))),se=y.map((ce=>H.getTilePoint(ce)));o.push({tile:q,tileID:H,queryGeometry:ne,cameraQueryGeometry:se,scale:W})}}return o}getVisibleCoordinates(e){const n=this.getRenderableIds(e).map((a=>this._tiles[a].tileID));for(const a of n)a.posMatrix=this.transform.calculatePosMatrix(a.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if(Br(this._source.type)){const e=de.now();for(const n in this._tiles)if(this._tiles[n].fadeEndTime>=e)return!0}return!1}setFeatureState(e,n,a){this._state.updateState(e=e||"_geojsonTileLayer",n,a)}removeFeatureState(e,n,a){this._state.removeFeatureState(e=e||"_geojsonTileLayer",n,a)}getFeatureState(e,n){return this._state.getState(e=e||"_geojsonTileLayer",n)}setDependencies(e,n,a){const o=this._tiles[e];o&&o.setDependencies(n,a)}reloadTilesForDependencies(e,n){for(const a in this._tiles)this._tiles[a].hasDependency(e,n)&&this._reloadTile(a,"reloading");this._cache.filter((a=>!a.hasDependency(e,n)))}}function Ki(u,e){const n=Math.abs(2*u.wrap)-+(u.wrap<0),a=Math.abs(2*e.wrap)-+(e.wrap<0);return u.overscaledZ-e.overscaledZ||a-n||e.canonical.y-u.canonical.y||e.canonical.x-u.canonical.x}function Br(u){return u==="raster"||u==="image"||u==="video"}it.maxOverzooming=10,it.maxUnderzooming=3;class ht{constructor(e,n){this.reset(e,n)}reset(e,n){this.points=e||[],this._distances=[0];for(let a=1;a<this.points.length;a++)this._distances[a]=this._distances[a-1]+this.points[a].dist(this.points[a-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(n||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(this.points.length===1)return this.points[0];e=d.ac(e,0,1);let n=1,a=this._distances[n];const o=e*this.paddedLength+this.padding;for(;a<o&&n<this._distances.length;)a=this._distances[++n];const c=n-1,m=this._distances[c],_=a-m,y=_>0?(o-m)/_:0;return this.points[c].mult(1-y).add(this.points[n].mult(y))}}function gr(u,e){let n=!0;return u==="always"||u!=="never"&&e!=="never"||(n=!1),n}class Fr{constructor(e,n,a){const o=this.boxCells=[],c=this.circleCells=[];this.xCellCount=Math.ceil(e/a),this.yCellCount=Math.ceil(n/a);for(let m=0;m<this.xCellCount*this.yCellCount;m++)o.push([]),c.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=n,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,n,a,o,c){this._forEachCell(n,a,o,c,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(n),this.bboxes.push(a),this.bboxes.push(o),this.bboxes.push(c)}insertCircle(e,n,a,o){this._forEachCell(n-o,a-o,n+o,a+o,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(n),this.circles.push(a),this.circles.push(o)}_insertBoxCell(e,n,a,o,c,m){this.boxCells[c].push(m)}_insertCircleCell(e,n,a,o,c,m){this.circleCells[c].push(m)}_query(e,n,a,o,c,m,_){if(a<0||e>this.width||o<0||n>this.height)return[];const y=[];
6if(e<=0&&n<=0&&this.width<=a&&this.height<=o){if(c)return[{key:null,x1:e,y1:n,x2:a,y2:o}];for(let w=0;w<this.boxKeys.length;w++)y.push({key:this.boxKeys[w],x1:this.bboxes[4*w],y1:this.bboxes[4*w+1],x2:this.bboxes[4*w+2],y2:this.bboxes[4*w+3]});for(let w=0;w<this.circleKeys.length;w++){const T=this.circles[3*w],I=this.circles[3*w+1],k=this.circles[3*w+2];y.push({key:this.circleKeys[w],x1:T-k,y1:I-k,x2:T+k,y2:I+k})}}else this._forEachCell(e,n,a,o,this._queryCell,y,{hitTest:c,overlapMode:m,seenUids:{box:{},circle:{}}},_);return y}query(e,n,a,o){return this._query(e,n,a,o,!1,null)}hitTest(e,n,a,o,c,m){return this._query(e,n,a,o,!0,c,m).length>0}hitTestCircle(e,n,a,o,c){const m=e-a,_=e+a,y=n-a,w=n+a;if(_<0||m>this.width||w<0||y>this.height)return!1;const T=[];return this._forEachCell(m,y,_,w,this._queryCellCircle,T,{hitTest:!0,overlapMode:o,circle:{x:e,y:n,radius:a},seenUids:{box:{},circle:{}}},c),T.length>0}_queryCell(e,n,a,o,c,m,_,y){const{seenUids:w,hitTest:T,overlapMode:I}=_,k=this.boxCells[c];if(k!==null){const V=this.bboxes;for(const q of k)if(!w.box[q]){w.box[q]=!0;const H=4*q,W=this.boxKeys[q];if(e<=V[H+2]&&n<=V[H+3]&&a>=V[H+0]&&o>=V[H+1]&&(!y||y(W))&&(!T||!gr(I,W.overlapMode))&&(m.push({key:W,x1:V[H],y1:V[H+1],x2:V[H+2],y2:V[H+3]}),T))return!0}}const F=this.circleCells[c];if(F!==null){const V=this.circles;for(const q of F)if(!w.circle[q]){w.circle[q]=!0;const H=3*q,W=this.circleKeys[q];if(this._circleAndRectCollide(V[H],V[H+1],V[H+2],e,n,a,o)&&(!y||y(W))&&(!T||!gr(I,W.overlapMode))){const J=V[H],j=V[H+1],ne=V[H+2];if(m.push({key:W,x1:J-ne,y1:j-ne,x2:J+ne,y2:j+ne}),T)return!0}}}return!1}_queryCellCircle(e,n,a,o,c,m,_,y){const{circle:w,seenUids:T,overlapMode:I}=_,k=this.boxCells[c];if(k!==null){const V=this.bboxes;for(const q of k)if(!T.box[q]){T.box[q]=!0;const H=4*q,W=this.boxKeys[q];if(this._circleAndRectCollide(w.x,w.y,w.radius,V[H+0],V[H+1],V[H+2],V[H+3])&&(!y||y(W))&&!gr(I,W.overlapMode))return m.push(!0),!0}}const F=this.circleCells[c];if(F!==null){const V=this.circles;for(const q of F)if(!T.circle[q]){T.circle[q]=!0;const H=3*q,W=this.circleKeys[q];if(this._circlesCollide(V[H],V[H+1],V[H+2],w.x,w.y,w.radius)&&(!y||y(W))&&!gr(I,W.overlapMode))return m.push(!0),!0}}}_forEachCell(e,n,a,o,c,m,_,y){const w=this._convertToXCellCoord(e),T=this._convertToYCellCoord(n),I=this._convertToXCellCoord(a),k=this._convertToYCellCoord(o);for(let F=w;F<=I;F++)for(let V=T;V<=k;V++)if(c.call(this,e,n,a,o,this.xCellCount*V+F,m,_,y))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,n,a,o,c,m){const _=o-e,y=c-n,w=a+m;return w*w>_*_+y*y}_circleAndRectCollide(e,n,a,o,c,m,_){const y=(m-o)/2,w=Math.abs(e-(o+y));if(w>y+a)return!1;const T=(_-c)/2,I=Math.abs(n-(c+T));if(I>T+a)return!1;if(w<=y||I<=T)return!0;const k=w-y,F=I-T;return k*k+F*F<=a*a}}function Er(u,e,n,a,o){const c=d.H();return e?(d.K(c,c,[1/o,1/o,1]),n||d.ad(c,c,a.angle)):d.L(c,a.labelPlaneMatrix,u),c}function _r(u,e,n,a,o){if(e){const c=d.ae(u);return d.K(c,c,[o,o,1]),n||d.ad(c,c,-a.angle),c}return a.glCoordMatrix}function Z(u,e,n,a){let o;a?(o=[u,e,a(u,e),1],d.af(o,o,n)):(o=[u,e,0,1],Bt(o,o,n));const c=o[3];return{point:new d.P(o[0]/c,o[1]/c),signedDistanceFromCamera:c,isOccluded:!1}}function C(u,e){return .5+u/e*.5}function P(u,e){return u.x>=-e[0]&&u.x<=e[0]&&u.y>=-e[1]&&u.y<=e[1]}function R(u,e,n,a,o,c,m,_,y,w,T,I,k,F,V){const q=a?u.textSizeData:u.iconSizeData,H=d.ag(q,n.transform.zoom),W=[256/n.width*2+1,256/n.height*2+1],J=a?u.text.dynamicLayoutVertexArray:u.icon.dynamicLayoutVertexArray;J.clear();const j=u.lineVertexArray,ne=a?u.text.placedSymbolArray:u.icon.placedSymbolArray,se=n.transform.width/n.transform.height;let ce=!1;for(let ye=0;ye<ne.length;ye++){const Ie=ne.get(ye);if(Ie.hidden||Ie.writingMode===d.ah.vertical&&!ce){rt(Ie.numGlyphs,J);continue}ce=!1;const Re=Z(Ie.anchorX,Ie.anchorY,e,V);if(!P(Re.point,W)){rt(Ie.numGlyphs,J);continue}const Ue=C(n.transform.cameraToCenterDistance,Re.signedDistanceFromCamera),ze=d.ai(q,H,Ie),Me=m?ze/Ue:ze*Ue,Je={getElevation:V,labelPlaneMatr
6ix:o,lineVertexArray:j,pitchWithMap:m,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:w,tileAnchorPoint:new d.P(Ie.anchorX,Ie.anchorY),unwrappedTileID:T,width:I,height:k,translation:F},yt=re(Je,Ie,Me,!1,_,e,c,u.glyphOffsetArray,J,se,y);ce=yt.useVertical,(yt.notEnoughRoom||ce||yt.needsFlipping&&re(Je,Ie,Me,!0,_,e,c,u.glyphOffsetArray,J,se,y).notEnoughRoom)&&rt(Ie.numGlyphs,J)}a?u.text.dynamicLayoutVertexBuffer.updateData(J):u.icon.dynamicLayoutVertexBuffer.updateData(J)}function U(u,e,n,a,o,c,m,_){const y=c.glyphStartIndex+c.numGlyphs,w=c.lineStartIndex,T=c.lineStartIndex+c.lineLength,I=e.getoffsetX(c.glyphStartIndex),k=e.getoffsetX(y-1),F=Ee(u*I,n,a,o,c.segment,w,T,_,m);if(!F)return null;const V=Ee(u*k,n,a,o,c.segment,w,T,_,m);return V?_.projectionCache.anyProjectionOccluded?null:{first:F,last:V}:null}function ee(u,e,n,a){return u===d.ah.horizontal&&Math.abs(n.y-e.y)>Math.abs(n.x-e.x)*a?{useVertical:!0}:(u===d.ah.vertical?e.y<n.y:e.x>n.x)?{needsFlipping:!0}:null}function re(u,e,n,a,o,c,m,_,y,w,T){const I=n/24,k=e.lineOffsetX*I,F=e.lineOffsetY*I;let V;if(e.numGlyphs>1){const q=e.glyphStartIndex+e.numGlyphs,H=e.lineStartIndex,W=e.lineStartIndex+e.lineLength,J=U(I,_,k,F,a,e,T,u);if(!J)return{notEnoughRoom:!0};const j=Z(J.first.point.x,J.first.point.y,m,u.getElevation).point,ne=Z(J.last.point.x,J.last.point.y,m,u.getElevation).point;if(o&&!a){const se=ee(e.writingMode,j,ne,w);if(se)return se}V=[J.first];for(let se=e.glyphStartIndex+1;se<q-1;se++)V.push(Ee(I*_.getoffsetX(se),k,F,a,e.segment,H,W,u,T));V.push(J.last)}else{if(o&&!a){const H=Z(u.tileAnchorPoint.x,u.tileAnchorPoint.y,c,u.getElevation).point,W=e.lineStartIndex+e.segment+1,J=new d.P(u.lineVertexArray.getx(W),u.lineVertexArray.gety(W)),j=Z(J.x,J.y,c,u.getElevation),ne=j.signedDistanceFromCamera>0?j.point:(function(ce,ye,Ie,Re,Ue,ze){return oe(ce,ye,Ie,1,Ue,ze)})(u.tileAnchorPoint,J,H,0,c,u),se=ee(e.writingMode,H,ne,w);if(se)return se}const q=Ee(I*_.getoffsetX(e.glyphStartIndex),k,F,a,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,u,T);if(!q||u.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};V=[q]}for(const q of V)d.aj(y,q.point,q.angle);return{}}function oe(u,e,n,a,o,c){const m=u.add(u.sub(e)._unit()),_=o!==void 0?Z(m.x,m.y,o,c.getElevation).point:fe(m.x,m.y,c).point,y=n.sub(_);return n.add(y._mult(a/y.mag()))}function X(u,e,n){const a=e.projectionCache;if(a.projections[u])return a.projections[u];const o=new d.P(e.lineVertexArray.getx(u),e.lineVertexArray.gety(u)),c=fe(o.x,o.y,e);if(c.signedDistanceFromCamera>0)return a.projections[u]=c.point,a.anyProjectionOccluded=a.anyProjectionOccluded||c.isOccluded,c.point;const m=u-n.direction;return(function(_,y,w,T,I){return oe(_,y,w,T,void 0,I)})(n.distanceFromAnchor===0?e.tileAnchorPoint:new d.P(e.lineVertexArray.getx(m),e.lineVertexArray.gety(m)),o,n.previousVertex,n.absOffsetX-n.distanceFromAnchor+1,e)}function fe(u,e,n){const a=u+n.translation[0],o=e+n.translation[1];let c;return!n.pitchWithMap&&n.projection.useSpecialProjectionForSymbols?(c=n.projection.projectTileCoordinates(a,o,n.unwrappedTileID,n.getElevation),c.point.x=(.5*c.point.x+.5)*n.width,c.point.y=(.5*-c.point.y+.5)*n.height):(c=Z(a,o,n.labelPlaneMatrix,n.getElevation),c.isOccluded=!1),c}function ve(u,e,n){return u._unit()._perp()._mult(e*n)}function ue(u,e,n,a,o,c,m,_,y){if(_.projectionCache.offsets[u])return _.projectionCache.offsets[u];const w=n.add(e);if(u+y.direction<a||u+y.direction>=o)return _.projectionCache.offsets[u]=w,w;const T=X(u+y.direction,_,y),I=ve(T.sub(n),m,y.direction),k=n.add(I),F=T.add(I);return _.projectionCache.offsets[u]=d.ak(c,w,k,F)||w,_.projectionCache.offsets[u]}function Ee(u,e,n,a,o,c,m,_,y){const w=a?u-e:u+e;let T=w>0?1:-1,I=0;a&&(T*=-1,I=Math.PI),T<0&&(I+=Math.PI);let k,F=T>0?c+o:c+o+1;_.projectionCache.cachedAnchorPoint?k=_.projectionCache.cachedAnchorPoint:(k=fe(_.tileAnchorPoint.x,_.tileAnchorPoint.y,_).point,_.projectionCache.cachedAnchorPoint=k);let V,q,H=k,W=k,J=0,j=0;const ne=Math.abs(w),se=[];let ce;for(;J+j<=ne;){if(F+=T,F<c||F>=m)return null;J+=j,W=H,q=V;const Re={absOffsetX:ne,direction:T,distanceFromAnchor:J,previousVertex:W};if(H=X(F,_,Re),n===0)se.push(W),ce=H.sub(W);else{let Ue;const ze=H.sub(W);Ue=ze.mag()===0?ve(X(F+T,_,Re).sub(H),n,T):ve(ze,n,T),q||(q=W.add(Ue)),V=ue(F,Ue,H,c,m,q,n,_,Re),se.pu
6sh(q),ce=V.sub(q)}j=ce.mag()}const ye=ce._mult((ne-J)/j)._add(q||W),Ie=I+Math.atan2(H.y-W.y,H.x-W.x);return se.push(ye),{point:ye,angle:y?Ie:0,path:se}}const Xe=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function rt(u,e){for(let n=0;n<u;n++){const a=e.length;e.resize(a+4),e.float32.set(Xe,3*a)}}function Bt(u,e,n){const a=e[0],o=e[1];return u[0]=n[0]*a+n[4]*o+n[12],u[1]=n[1]*a+n[5]*o+n[13],u[3]=n[3]*a+n[7]*o+n[15],u}const wt=100;class Ft{constructor(e,n,a=new Fr(e.width+200,e.height+200,25),o=new Fr(e.width+200,e.height+200,25)){this.transform=e,this.mapProjection=n,this.grid=a,this.ignoredGrid=o,this.pitchFactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+wt,this.screenBottomBoundary=e.height+wt,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,n,a,o,c,m,_,y,w,T,I){const k=e.anchorPointX+y[0],F=e.anchorPointY+y[1],V=this.projectAndGetPerspectiveRatio(o,k,F,c,T),q=a*V.perspectiveRatio;let H;if(m||_)H=this._projectCollisionBox(e,q,o,c,m,_,y,V,T,I);else{const se=V.point.x+(I?I.x*q:0),ce=V.point.y+(I?I.y*q:0);H={allPointsOccluded:!1,box:[se+e.x1*q,ce+e.y1*q,se+e.x2*q,ce+e.y2*q]}}const[W,J,j,ne]=H.box;return this.mapProjection.useSpecialProjectionForSymbols&&(m?H.allPointsOccluded:this.mapProjection.isOccluded(k,F,c))||V.perspectiveRatio<this.perspectiveRatioCutoff||!this.isInsideGrid(W,J,j,ne)||n!=="always"&&this.grid.hitTest(W,J,j,ne,n,w)?{box:[W,J,j,ne],placeable:!1,offscreen:!1}:{box:[W,J,j,ne],placeable:!0,offscreen:this.isOffscreen(W,J,j,ne)}}placeCollisionCircles(e,n,a,o,c,m,_,y,w,T,I,k,F,V,q,H){const W=[],J=new d.P(n.anchorX,n.anchorY),j=this.getPerspectiveRatio(m,J.x,J.y,_,H),ne=(I?c/j:c*j)/d.ap,se={getElevation:H,labelPlaneMatrix:y,lineVertexArray:a,pitchWithMap:I,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:this.mapProjection,tileAnchorPoint:J,unwrappedTileID:_,width:this.transform.width,height:this.transform.height,translation:q},ce=U(ne,o,n.lineOffsetX*ne,n.lineOffsetY*ne,!1,n,!1,se);let ye=!1,Ie=!1,Re=!0;if(ce){const Ue=.5*F*j+V,ze=new d.P(-100,-100),Me=new d.P(this.screenRightBoundary,this.screenBottomBoundary),Je=new ht,yt=ce.first,De=ce.last;let Oe=[];for(let At=yt.path.length-1;At>=1;At--)Oe.push(yt.path[At]);for(let At=1;At<De.path.length;At++)Oe.push(De.path[At]);const gt=2.5*Ue;if(w){const At=this.projectPathToScreenSpace(Oe,se,w);Oe=At.some((Mt=>Mt.signedDistanceFromCamera<=0))?[]:At.map((Mt=>Mt.point))}let li=[];if(Oe.length>0){const At=Oe[0].clone(),Mt=Oe[0].clone();for(let ci=1;ci<Oe.length;ci++)At.x=Math.min(At.x,Oe[ci].x),At.y=Math.min(At.y,Oe[ci].y),Mt.x=Math.max(Mt.x,Oe[ci].x),Mt.y=Math.max(Mt.y,Oe[ci].y);li=At.x>=ze.x&&Mt.x<=Me.x&&At.y>=ze.y&&Mt.y<=Me.y?[Oe]:Mt.x<ze.x||At.x>Me.x||Mt.y<ze.y||At.y>Me.y?[]:d.al([Oe],ze.x,ze.y,Me.x,Me.y)}for(const At of li){Je.reset(At,.25*Ue);let Mt=0;Mt=Je.length<=.5*Ue?1:Math.ceil(Je.paddedLength/gt)+1;for(let ci=0;ci<Mt;ci++){const nr=ci/Math.max(Mt-1,1),yn=Je.lerp(nr),ui=yn.x+wt,Cr=yn.y+wt;W.push(ui,Cr,Ue,0);const xr=ui-Ue,sr=Cr-Ue,br=ui+Ue,Bn=Cr+Ue;if(Re=Re&&this.isOffscreen(xr,sr,br,Bn),Ie=Ie||this.isInsideGrid(xr,sr,br,Bn),e!=="always"&&this.grid.hitTestCircle(ui,Cr,Ue,e,k)&&(ye=!0,!T))return{circles:[],offscreen:!1,collisionDetected:ye}}}}return{circles:!T&&ye||!Ie||j<this.perspectiveRatioCutoff?[]:W,offscreen:Re,collisionDetected:ye}}projectPathToScreenSpace(e,n,a){return e.map((o=>Z(o.x,o.y,a,n.getElevation)))}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[];let a=1/0,o=1/0,c=-1/0,m=-1/0;for(const T of e){const I=new d.P(T.x+wt,T.y+wt);a=Math.min(a,I.x),o=Math.min(o,I.y),c=Math.max(c,I.x),m=Math.max(m,I.y),n.push(I)}const _=this.grid.query(a,o,c,m).concat(this.ignoredGrid.query(a,o,c,m)),y={},w={};for(const T of _){const I=T.key;if(y[I.bucketInstanceId]===void 0&&(y[I.bucketInstanceId]={}),y[I.bucketInstanceId][I.featureIndex])continue;const k=[new d.P(T.x1,T.y1),new d.P(T.x2,T.y1),new d.P(T.x2,T.y2),new d.P(T.x1,T.y2)];d.am(n,k)&&(y[I.bucketInstanceId][I.featureIndex]=!0,w[I.bucketInstanceId]===void 0&&(w[I.bucketInstanceId]=[]),w[I.bucketInstanceId].push(I.featureIndex))}return w}insertCollisionBox(e,n,a,o,c,m){(a?this.ignoredGrid:this.grid).insert({bucketInstanceId:o,featureIndex:c,collisionGroupID:m,overlapMode:n},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,n,a,o,c,m){const _=a?this.ignoredGrid:this.grid,y={bucketInstanceId:o,featureIndex:c,collisionGroupID:m,overlapMode:n};for(let w=0;w<e.length;
6w+=4)_.insertCircle(y,e[w],e[w+1],e[w+2])}projectAndGetPerspectiveRatio(e,n,a,o,c){let m;c?(m=[n,a,c(n,a),1],d.af(m,m,e)):(m=[n,a,0,1],Bt(m,m,e));const _=m[3];return{point:new d.P((m[0]/_+1)/2*this.transform.width+wt,(-m[1]/_+1)/2*this.transform.height+wt),perspectiveRatio:.5+this.transform.cameraToCenterDistance/_*.5,isOccluded:!1,signedDistanceFromCamera:_}}getPerspectiveRatio(e,n,a,o,c){const m=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(n,a,o,c):Z(n,a,e,c);return .5+this.transform.cameraToCenterDistance/m.signedDistanceFromCamera*.5}isOffscreen(e,n,a,o){return a<wt||e>=this.screenRightBoundary||o<wt||n>this.screenBottomBoundary}isInsideGrid(e,n,a,o){return a>=0&&e<this.gridRightBoundary&&o>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const e=d.an([]);return d.J(e,e,[-100,-100,0]),e}_projectCollisionBox(e,n,a,o,c,m,_,y,w,T){let I=new d.P(1,0),k=new d.P(0,1);const F=new d.P(e.anchorPointX+_[0],e.anchorPointY+_[1]);if(m&&!c){const Re=this.projectAndGetPerspectiveRatio(a,F.x+1,F.y,o,w).point.sub(y.point).unit(),Ue=Math.atan(Re.y/Re.x)+(Re.x<0?Math.PI:0),ze=Math.sin(Ue),Me=Math.cos(Ue);I=new d.P(Me,ze),k=new d.P(-ze,Me)}else if(!m&&c){const Re=-this.transform.angle,Ue=Math.sin(Re),ze=Math.cos(Re);I=new d.P(ze,Ue),k=new d.P(-Ue,ze)}let V=y.point,q=n;if(c){V=F;const Re=this.transform.zoom-Math.floor(this.transform.zoom);q=Math.pow(2,-Re),q*=this.mapProjection.getPitchedTextCorrection(this.transform,F,o),T||(q*=d.ac(.5+y.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))}T&&(V=V.add(I.mult(T.x*q)).add(k.mult(T.y*q)));const H=e.x1*q,W=e.x2*q,J=(H+W)/2,j=e.y1*q,ne=e.y2*q,se=(j+ne)/2,ce=[{offsetX:H,offsetY:j},{offsetX:J,offsetY:j},{offsetX:W,offsetY:j},{offsetX:W,offsetY:se},{offsetX:W,offsetY:ne},{offsetX:J,offsetY:ne},{offsetX:H,offsetY:ne},{offsetX:H,offsetY:se}];let ye=[];for(const{offsetX:Re,offsetY:Ue}of ce)ye.push(new d.P(V.x+I.x*Re+k.x*Ue,V.y+I.y*Re+k.y*Ue));let Ie=!1;if(c){const Re=ye.map((Ue=>this.projectAndGetPerspectiveRatio(a,Ue.x,Ue.y,o,w)));Ie=Re.some((Ue=>!Ue.isOccluded)),ye=Re.map((Ue=>Ue.point))}else Ie=!0;return{box:d.ao(ye),allPointsOccluded:!Ie}}}function Et(u,e,n){return e*(d.X/(u.tileSize*Math.pow(2,n-u.tileID.overscaledZ)))}class yi{constructor(e,n,a,o){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?n:-n))):o&&a?1:0,this.placed=a}isHidden(){return this.opacity===0&&!this.placed}}class ai{constructor(e,n,a,o,c){this.text=new yi(e?e.text:null,n,a,c),this.icon=new yi(e?e.icon:null,n,o,c)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class It{constructor(e,n,a){this.text=e,this.icon=n,this.skipFade=a}}class Zt{constructor(){this.invProjMatrix=d.H(),this.viewportMatrix=d.H(),this.circles=[]}}class Yt{constructor(e,n,a,o,c){this.bucketInstanceId=e,this.featureIndex=n,this.sourceLayerIndex=a,this.bucketIndex=o,this.tileID=c}}class pi{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){const n=++this.maxGroupID;this.collisionGroups[e]={ID:n,predicate:a=>a.collisionGroupID===n}}return this.collisionGroups[e]}}function Di(u,e,n,a,o){const{horizontalAlign:c,verticalAlign:m}=d.au(u);return new d.P(-(c-.5)*e+a[0]*o,-(m-.5)*n+a[1]*o)}class vi{constructor(e,n,a,o,c,m){this.transform=e.clone(),this.terrain=a,this.collisionIndex=new Ft(this.transform,n),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=o,this.retainedQueryData={},this.collisionGroups=new pi(c),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=m,m&&(m.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){const n=this.terrain;return n?(a,o)=>n.getElevation(e,a,o):null}getBucketParts(e,n,a,o){const c=a.getBucket(n),m=a.latestFeatureIndex;if(!c||!m||n.id!==c.layerIds[0])return;const _=a.collisionBoxArray,y=c.layers[0].layout,w=c.layers[0].paint,T=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ),I=a.tileSize/d.X,k=a.tileID.toUnwrapped(),F=this.transform.calculatePosMatrix(k),V=y.get("text-pitch-alignment")==="map",q=y.get("text-rotation-alignment")==="map",H=Et(a,1,this.transform.zoom),W=this.collisionIndex.mapProjection.translatePosition(this.transform,a,w.get("text-translate"),w.get("text-translate-anchor")),J=this.collisionIndex.mapProjection.translatePosition(this.transform,a,w.get("icon-translate"),w.get("icon-translate-anchor")),j=Er(F,V,q,this.transform,H);let ne=null;if(V){const ce=_r(F,V,q,this.transform,H);
6ne=d.L([],this.transform.labelPlaneMatrix,ce)}this.retainedQueryData[c.bucketInstanceId]=new Yt(c.bucketInstanceId,m,c.sourceLayerIndex,c.index,a.tileID);const se={bucket:c,layout:y,translationText:W,translationIcon:J,posMatrix:F,unwrappedTileID:k,textLabelPlaneMatrix:j,labelToScreenMatrix:ne,scale:T,textPixelRatio:I,holdingForFade:a.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:d.ag(c.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(c.sourceID)};if(o)for(const ce of c.sortKeyRanges){const{sortKey:ye,symbolInstanceStart:Ie,symbolInstanceEnd:Re}=ce;e.push({sortKey:ye,symbolInstanceStart:Ie,symbolInstanceEnd:Re,parameters:se})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:c.symbolInstances.length,parameters:se})}attemptAnchorPlacement(e,n,a,o,c,m,_,y,w,T,I,k,F,V,q,H,W,J,j){const ne=d.aq[e.textAnchor],se=[e.textOffset0,e.textOffset1],ce=Di(ne,a,o,se,c),ye=this.collisionIndex.placeCollisionBox(n,k,y,w,T,_,m,H,I.predicate,j,ce);if((!J||this.collisionIndex.placeCollisionBox(J,k,y,w,T,_,m,W,I.predicate,j,ce).placeable)&&ye.placeable){let Ie;if(this.prevPlacement&&this.prevPlacement.variableOffsets[F.crossTileID]&&this.prevPlacement.placements[F.crossTileID]&&this.prevPlacement.placements[F.crossTileID].text&&(Ie=this.prevPlacement.variableOffsets[F.crossTileID].anchor),F.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[F.crossTileID]={textOffset:se,width:a,height:o,anchor:ne,textBoxScale:c,prevAnchor:Ie},this.markUsedJustification(V,ne,F,q),V.allowVerticalPlacement&&(this.markUsedOrientation(V,q,F),this.placedOrientations[F.crossTileID]=q),{shift:ce,placedGlyphBoxes:ye}}}placeLayerBucketPart(e,n,a){const{bucket:o,layout:c,translationText:m,translationIcon:_,posMatrix:y,unwrappedTileID:w,textLabelPlaneMatrix:T,labelToScreenMatrix:I,textPixelRatio:k,holdingForFade:F,collisionBoxArray:V,partiallyEvaluatedTextSize:q,collisionGroup:H}=e.parameters,W=c.get("text-optional"),J=c.get("icon-optional"),j=d.ar(c,"text-overlap","text-allow-overlap"),ne=j==="always",se=d.ar(c,"icon-overlap","icon-allow-overlap"),ce=se==="always",ye=c.get("text-rotation-alignment")==="map",Ie=c.get("text-pitch-alignment")==="map",Re=c.get("icon-text-fit")!=="none",Ue=c.get("symbol-z-order")==="viewport-y",ze=ne&&(ce||!o.hasIconData()||J),Me=ce&&(ne||!o.hasTextData()||W);!o.collisionArrays&&V&&o.deserializeCollisionBoxes(V);const Je=this._getTerrainElevationFunc(this.retainedQueryData[o.bucketInstanceId].tileID),yt=(De,Oe,gt)=>{var li,At;if(n[De.crossTileID])return;if(F)return void(this.placements[De.crossTileID]=new It(!1,!1,!1));let Mt=!1,ci=!1,nr=!0,yn=null,ui={box:null,placeable:!1,offscreen:null},Cr={placeable:!1},xr=null,sr=null,br=null,Bn=0,la=0,Mo=0;Oe.textFeatureIndex?Bn=Oe.textFeatureIndex:De.useRuntimeCollisionCircles&&(Bn=De.featureIndex),Oe.verticalTextFeatureIndex&&(la=Oe.verticalTextFeatureIndex);const ca=Oe.textBox;if(ca){const sn=Wi=>{let ar=d.ah.horizontal;if(o.allowVerticalPlacement&&!Wi&&this.prevPlacement){const Ur=this.prevPlacement.placedOrientations[De.crossTileID];Ur&&(this.placedOrientations[De.crossTileID]=Ur,ar=Ur,this.markUsedOrientation(o,ar,De))}return ar},an=(Wi,ar)=>{if(o.allowVerticalPlacement&&De.numVerticalGlyphVertices>0&&Oe.verticalTextBox){for(const Ur of o.writingModes)if(Ur===d.ah.vertical?(ui=ar(),Cr=ui):ui=Wi(),ui&&ui.placeable)break}else ui=Wi()},rs=De.textAnchorOffsetStartIndex,vn=De.textAnchorOffsetEndIndex;if(vn===rs){const Wi=(ar,Ur)=>{const Lt=this.collisionIndex.placeCollisionBox(ar,j,k,y,w,Ie,ye,m,H.predicate,Je);return Lt&&Lt.placeable&&(this.markUsedOrientation(o,Ur,De),this.placedOrientations[De.crossTileID]=Ur),Lt};an((()=>Wi(ca,d.ah.horizontal)),(()=>{const ar=Oe.verticalTextBox;return o.allowVerticalPlacement&&De.numVerticalGlyphVertices>0&&ar?Wi(ar,d.ah.vertical):{box:null,offscreen:null}})),sn(ui&&ui.placeable)}else{let Wi=d.aq[(At=(li=this.prevPlacement)===null||li===void 0?void 0:li.variableOffsets[De.crossTileID])===null||At===void 0?void 0:At.anchor];const ar=(Lt,Es,ua)=>{const ha=Lt.x2-Lt.x1,Mc=Lt.y2-Lt.y1,Cu=De.textBoxScale,kc=Re&&se==="never"?Es:null;let ns=null,zc=j==="never"?1:2,zo="never";Wi&&zc++;for(let ja=0;ja<zc;ja++){for(let Do=rs;Do<vn;Do++){const Lo=o.textAnchorOffsets.get(Do);if(Wi&&Lo.textAnchor!==Wi)continue;const da=this.attemptAnchorPlacement(Lo,Lt,ha,Mc,Cu,ye,Ie,k,y,w,H,zo,De,o,ua,m,_,kc,Je);if(da&&(ns=da.placedGlyphBoxes,ns&&ns.placeable))return Mt=!0,yn=da.shift,ns}Wi?Wi=null:zo=j}return a&&!ns&&(ns={box:this.collisionIndex.placeCollisionBox(ca,"always",k,y,w,Ie,ye,m,H.predicate,Je,new d.P(0,0)).box,offscreen:!1,placeable:!1}),ns};an((()=>ar(ca,Oe.iconBox,d.ah.horizontal)),(()=>{const Lt=Oe.verticalTextBox;return o.allowVerticalPlacement&&(!ui||!ui.placeable)&&De.numVerticalGlyphVertices>0&&Lt?ar(Lt,Oe.verticalIconBox,d.ah.vertical):{box:null,occluded:!0,offscreen:null}})),ui&&(Mt=ui.placeable,nr=ui.offscreen);const Ur=sn(ui&&ui.placeable);if(!Mt&&this.prevPlacement){const Lt=this.prevPlacement.variableOffsets[De.crossTileID];Lt&&(this.variableOffsets[De.crossTileID]=Lt,this.markUsedJustification(o,Lt.anchor,De,Ur))}}}if(xr=ui,Mt=xr&&xr.placeable,nr=xr&&xr.offscreen,De.useRuntimeCollisionCircles){const sn=o.text.placedSymbolArray.get(De.centerJustifiedTextSymbolIndex),an=d.ai(o.textSizeData,q,sn),rs=c.get("text-padding");sr=this.collisionIndex.placeCollisionCircles(j,sn,o.lineVertexArray,o.glyphOffsetArray,an,y,w,T,I,a,Ie,H.predicate,De.collisionCircleDiameter,rs,m,Je),sr.circles.length&&sr.collisionDetected&&!a&&d.w("Collisions detected, but collision boxes are not shown"),Mt=ne||sr.circles.length>0&&!sr.collisionDetected,nr=nr&&sr.offscreen}if(Oe.iconFeatureIndex&&(Mo=Oe.iconFeatureIndex),Oe.iconBox){const sn=an=>this.collisionIndex.placeCollisionBox(an,se,k,y,w,Ie,ye,_,H.predicate,Je,Re&&yn?yn:void 0);Cr&&Cr.placeable&&Oe.verticalIconBox?(br=sn(Oe.verticalIconBox),ci=br.placeable):(br=sn(Oe.iconBox),ci=br.placeable),nr=nr&&br.offscreen}const nn=W||De.numHorizontalGlyphVertices===0&&De.numVerticalGlyphVertices===0,ko=J||De.numIconVertices===0;
6nn||ko?ko?nn||(ci=ci&&Mt):Mt=ci&&Mt:ci=Mt=ci&&Mt;const Nl=ci&&br.placeable;if(Mt&&xr.placeable&&this.collisionIndex.insertCollisionBox(xr.box,j,c.get("text-ignore-placement"),o.bucketInstanceId,Cr&&Cr.placeable&&la?la:Bn,H.ID),Nl&&this.collisionIndex.insertCollisionBox(br.box,se,c.get("icon-ignore-placement"),o.bucketInstanceId,Mo,H.ID),sr&&Mt&&this.collisionIndex.insertCollisionCircles(sr.circles,j,c.get("text-ignore-placement"),o.bucketInstanceId,Bn,H.ID),a&&this.storeCollisionData(o.bucketInstanceId,gt,Oe,xr,br,sr),De.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(o.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[De.crossTileID]=new It(Mt||ze,ci||Me,nr||o.justReloaded),n[De.crossTileID]=!0};if(Ue){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const De=o.getSortedSymbolIndexes(this.transform.angle);for(let Oe=De.length-1;Oe>=0;--Oe){const gt=De[Oe];yt(o.symbolInstances.get(gt),o.collisionArrays[gt],gt)}}else for(let De=e.symbolInstanceStart;De<e.symbolInstanceEnd;De++)yt(o.symbolInstances.get(De),o.collisionArrays[De],De);if(a&&o.bucketInstanceId in this.collisionCircleArrays){const De=this.collisionCircleArrays[o.bucketInstanceId];d.as(De.invProjMatrix,y),De.viewportMatrix=this.collisionIndex.getViewportMatrix()}o.justReloaded=!1}storeCollisionData(e,n,a,o,c,m){if(a.textBox||a.iconBox){let _,y;this.collisionBoxArrays.has(e)?_=this.collisionBoxArrays.get(e):(_=new Map,this.collisionBoxArrays.set(e,_)),_.has(n)?y=_.get(n):(y={text:null,icon:null},_.set(n,y)),a.textBox&&(y.text=o.box),a.iconBox&&(y.icon=c.box)}if(m){let _=this.collisionCircleArrays[e];_===void 0&&(_=this.collisionCircleArrays[e]=new Zt);for(let y=0;y<m.circles.length;y+=4)_.circles.push(m.circles[y+0]),_.circles.push(m.circles[y+1]),_.circles.push(m.circles[y+2]),_.circles.push(m.collisionDetected?1:0)}}markUsedJustification(e,n,a,o){let c;c=o===d.ah.vertical?a.verticalPlacedTextSymbolIndex:{left:a.leftJustifiedTextSymbolIndex,center:a.centerJustifiedTextSymbolIndex,right:a.rightJustifiedTextSymbolIndex}[d.at(n)];const m=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex,a.verticalPlacedTextSymbolIndex];for(const _ of m)_>=0&&(e.text.placedSymbolArray.get(_).crossTileID=c>=0&&_!==c?0:a.crossTileID)}markUsedOrientation(e,n,a){const o=n===d.ah.horizontal||n===d.ah.horizontalOnly?n:0,c=n===d.ah.vertical?n:0,m=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex];for(const _ of m)e.text.placedSymbolArray.get(_).placedOrientation=o;a.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).placedOrientation=c)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let a=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const o=n?n.symbolFadeChange(e):1,c=n?n.opacities:{},m=n?n.variableOffsets:{},_=n?n.placedOrientations:{};for(const y in this.placements){const w=this.placements[y],T=c[y];T?(this.opacities[y]=new ai(T,o,w.text,w.icon),a=a||w.text!==T.text.placed||w.icon!==T.icon.placed):(this.opacities[y]=new ai(null,o,w.text,w.icon,w.skipFade),a=a||w.text||w.icon)}for(const y in c){const w=c[y];if(!this.opacities[y]){const T=new ai(w,o,!1,!1);T.isHidden()||(this.opacities[y]=T,a=a||w.text.placed||w.icon.placed)}}for(const y in m)this.variableOffsets[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.variableOffsets[y]=m[y]);for(const y in _)this.placedOrientations[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.placedOrientations[y]=_[y]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");a?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:e)}updateLayerOpacities(e,n){const a={};for(const o of n){const c=o.getBucket(e);c&&o.latestFeatureIndex&&e.id===c.layerIds[0]&&this.updateBucketOpacities(c,o.tileID,a,o.collisionBoxArray)}}updateBucketOpacities(e,n,a,o){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();
6const c=e.layers[0],m=c.layout,_=new ai(null,0,!1,!1,!0),y=m.get("text-allow-overlap"),w=m.get("icon-allow-overlap"),T=c._unevaluatedLayout.hasValue("text-variable-anchor")||c._unevaluatedLayout.hasValue("text-variable-anchor-offset"),I=m.get("text-rotation-alignment")==="map",k=m.get("text-pitch-alignment")==="map",F=m.get("icon-text-fit")!=="none",V=new ai(null,0,y&&(w||!e.hasIconData()||m.get("icon-optional")),w&&(y||!e.hasTextData()||m.get("text-optional")),!0);!e.collisionArrays&&o&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(o);const q=(W,J,j)=>{for(let ne=0;ne<J/4;ne++)W.opacityVertexArray.emplaceBack(j);W.hasVisibleVertices=W.hasVisibleVertices||j!==Hi},H=this.collisionBoxArrays.get(e.bucketInstanceId);for(let W=0;W<e.symbolInstances.length;W++){const J=e.symbolInstances.get(W),{numHorizontalGlyphVertices:j,numVerticalGlyphVertices:ne,crossTileID:se}=J;let ce=this.opacities[se];a[se]?ce=_:ce||(ce=V,this.opacities[se]=ce),a[se]=!0;const ye=J.numIconVertices>0,Ie=this.placedOrientations[J.crossTileID],Re=Ie===d.ah.vertical,Ue=Ie===d.ah.horizontal||Ie===d.ah.horizontalOnly;if(j>0||ne>0){const Me=mi(ce.text);q(e.text,j,Re?Hi:Me),q(e.text,ne,Ue?Hi:Me);const Je=ce.text.isHidden();[J.rightJustifiedTextSymbolIndex,J.centerJustifiedTextSymbolIndex,J.leftJustifiedTextSymbolIndex].forEach((Oe=>{Oe>=0&&(e.text.placedSymbolArray.get(Oe).hidden=Je||Re?1:0)})),J.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(J.verticalPlacedTextSymbolIndex).hidden=Je||Ue?1:0);const yt=this.variableOffsets[J.crossTileID];yt&&this.markUsedJustification(e,yt.anchor,J,Ie);const De=this.placedOrientations[J.crossTileID];De&&(this.markUsedJustification(e,"left",J,De),this.markUsedOrientation(e,De,J))}if(ye){const Me=mi(ce.icon),Je=!(F&&J.verticalPlacedIconSymbolIndex&&Re);J.placedIconSymbolIndex>=0&&(q(e.icon,J.numIconVertices,Je?Me:Hi),e.icon.placedSymbolArray.get(J.placedIconSymbolIndex).hidden=ce.icon.isHidden()),J.verticalPlacedIconSymbolIndex>=0&&(q(e.icon,J.numVerticalIconVertices,Je?Hi:Me),e.icon.placedSymbolArray.get(J.verticalPlacedIconSymbolIndex).hidden=ce.icon.isHidden())}const ze=H&&H.has(W)?H.get(W):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const Me=e.collisionArrays[W];if(Me){let Je=new d.P(0,0);if(Me.textBox||Me.verticalTextBox){let yt=!0;if(T){const De=this.variableOffsets[se];De?(Je=Di(De.anchor,De.width,De.height,De.textOffset,De.textBoxScale),I&&Je._rotate(k?this.transform.angle:-this.transform.angle)):yt=!1}if(Me.textBox||Me.verticalTextBox){let De;Me.textBox&&(De=Re),Me.verticalTextBox&&(De=Ue),Hr(e.textCollisionBox.collisionVertexArray,ce.text.placed,!yt||De,ze.text,Je.x,Je.y)}}if(Me.iconBox||Me.verticalIconBox){const yt=!!(!Ue&&Me.verticalIconBox);let De;Me.iconBox&&(De=yt),Me.verticalIconBox&&(De=!yt),Hr(e.iconCollisionBox.collisionVertexArray,ce.icon.placed,De,ze.icon,F?Je.x:0,F?Je.y:0)}}}}if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);if(e.bucketInstanceId in this.collisionCircleArrays){const W=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=W.invProjMatrix,e.placementViewportMatrix=W.viewportMatrix,e.collisionCircleArray=W.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,n){const a=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*a>e}setStale(){this.stale=!0}}function Hr(u,e,n,a,o,c){a&&a.length!==0||(a=[0,0,0,0]);const m=a[0]-wt,_=a[1]-wt,y=a[2]-wt,w=a[3]-wt;u.emplaceBack(e?1:0,n?1:0,o||0,c||0,m,_),u.emplaceBack(e?1:0,n?1:0,o||0,c||0,y,_),u.emplaceBack(e?1:0,n?1:0,o||0,c||0,y,w),u.emplaceBack(e?1:0,n?1:0,o||0,c||0,m,w)}const Gt=Math.pow(2,25),Ls=Math.pow(2,24),Rs=Math.pow(2,17),Ji=Math.pow(2,16),yr=Math.pow(2,9),rl=Math.pow(2,8),Pr=Math.pow(2,1);function mi(u){if(u.opacity===0&&!u.placed)return 0;if(u.opacity===1&&u.placed)return 4294967295;const e=u.placed?1:0,n=Math.floor(127*u.opacity);return n*Gt+e*Ls+n*Rs+e*Ji+n*yr+e*rl+n*Pr+e}const Hi=0;function fn(){return{isOccluded:(u,e,n)=>!1,getPitchedTextCorrection:(u,e,n)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(u,e,n,a){throw new Error("Not implemented.")},translatePosition:(u,e,n,a)=>(function(o,c,m,_,y=!1){if(!m[0]&&!m[1])return[0,0];const w=y?_==="map"?o.angle:0:_==="viewport"?-o.angle:0;if(w){const T=Math.sin(w),I=Math.cos(w);m=[m[0]*I-m[1]*T,m[0]*T+m[1]*I]}return[y?m[0]:Et(c,m[0],o.zoom),y?m[1]:Et(c,m[1],o.zoom)]})(u,e,n,a),getCircleRadiusCorrection:u=>1}}class zt{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,n,a,o,c){const m=this._bucketParts;for(;this._currentTileIndex<e.length;)if(n.getBucketParts(m,o,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,c())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,m.sort(((_,y)=>
6_.sortKey-y.sortKey)));this._currentPartIndex<m.length;)if(n.placeLayerBucketPart(m[this._currentPartIndex],this._seenCrossTileIDs,a),this._currentPartIndex++,c())return!0;return!1}}class Kt{constructor(e,n,a,o,c,m,_,y){this.placement=new vi(e,fn(),n,m,_,y),this._currentPlacementIndex=a.length-1,this._forceFullPlacement=o,this._showCollisionBoxes=c,this._done=!1}isDone(){return this._done}continuePlacement(e,n,a){const o=de.now(),c=()=>!this._forceFullPlacement&&de.now()-o>2;for(;this._currentPlacementIndex>=0;){const m=n[e[this._currentPlacementIndex]],_=this.placement.collisionIndex.transform.zoom;if(m.type==="symbol"&&(!m.minzoom||m.minzoom<=_)&&(!m.maxzoom||m.maxzoom>_)){if(this._inProgressLayer||(this._inProgressLayer=new zt(m)),this._inProgressLayer.continuePlacement(a[m.source],this.placement,this._showCollisionBoxes,m,c))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const xi=512/d.X/2;class ri{constructor(e,n,a){this.tileID=e,this.bucketInstanceId=a,this._symbolsByKey={};const o=new Map;for(let c=0;c<n.length;c++){const m=n.get(c),_=m.key,y=o.get(_);y?y.push(m):o.set(_,[m])}for(const[c,m]of o){const _={positions:m.map((y=>({x:Math.floor(y.anchorX*xi),y:Math.floor(y.anchorY*xi)}))),crossTileIDs:m.map((y=>y.crossTileID))};if(_.positions.length>128){const y=new d.av(_.positions.length,16,Uint16Array);for(const{x:w,y:T}of _.positions)y.add(w,T);y.finish(),delete _.positions,_.index=y}this._symbolsByKey[c]=_}}getScaledCoordinates(e,n){const{x:a,y:o,z:c}=this.tileID.canonical,{x:m,y:_,z:y}=n.canonical,w=xi/Math.pow(2,y-c),T=(_*d.X+e.anchorY)*w,I=o*d.X*xi;return{x:Math.floor((m*d.X+e.anchorX)*w-a*d.X*xi),y:Math.floor(T-I)}}findMatches(e,n,a){const o=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z);for(let c=0;c<e.length;c++){const m=e.get(c);if(m.crossTileID)continue;const _=this._symbolsByKey[m.key];if(!_)continue;const y=this.getScaledCoordinates(m,n);if(_.index){const w=_.index.range(y.x-o,y.y-o,y.x+o,y.y+o).sort();for(const T of w){const I=_.crossTileIDs[T];if(!a[I]){a[I]=!0,m.crossTileID=I;break}}}else if(_.positions)for(let w=0;w<_.positions.length;w++){const T=_.positions[w],I=_.crossTileIDs[w];if(Math.abs(T.x-y.x)<=o&&Math.abs(T.y-y.y)<=o&&!a[I]){a[I]=!0,m.crossTileID=I;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:e})=>e))}}class Un{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Qi{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const n=Math.round((e-this.lng)/360);if(n!==0)for(const a in this.indexes){const o=this.indexes[a],c={};for(const m in o){const _=o[m];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+n),c[_.tileID.key]=_}this.indexes[a]=c}this.lng=e}addBucket(e,n,a){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let c=0;c<n.symbolInstances.length;c++)n.symbolInstances.get(c).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});const o=this.usedCrossTileIDs[e.overscaledZ];for(const c in this.indexes){const m=this.indexes[c];if(Number(c)>e.overscaledZ)for(const _ in m){const y=m[_];y.tileID.isChildOf(e)&&y.findMatches(n.symbolInstances,e,o)}else{const _=m[e.scaledTo(Number(c)).key];_&&_.findMatches(n.symbolInstances,e,o)}}for(let c=0;c<n.symbolInstances.length;c++){const m=n.symbolInstances.get(c);m.crossTileID||(m.crossTileID=a.generate(),o[m.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new ri(e,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(e,n){for(const a of n.getCrossTileIDsLists())for(const o of a)delete this.usedCrossTileIDs[e][o]}removeStaleBuckets(e){let n=!1;for(const a in this.indexes){const o=this.indexes[a];for(const c in o)e[o[c].bucketInstanceId]||(this.removeBucketCrossTileIDs(a,o[c]),delete o[c],n=!0)}return n}}class ms{constructor(){this.layerIndexes={},this.crossTileIDs=new Un,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,n,a){let o=this.layerIndexes[e.id];o===void 0&&(o=this.layerIndexes[e.id]=new Qi);let c=!1;const m={};o.handleWrapJump(a);for(const _ of n){const y=_.getBucket(e);y&&e.id===y.layerIds[0]&&(y.bucketInstanceId||(y.bucketInstanceId=++this.maxBucketInstanceId),o.addBucket(_.tileID,y,this.crossTileIDs)&&(c=!0),m[y.bucketInstanceId]=!0)}return o.removeStaleBuckets(m)&&(c=!0),c}pruneUnusedLayers(e){const n={};e.forEach((a=>{n[a]=!0}));for(const a in this.layerIndexes)n[a]||delete this.layerIndexes[a]}}const bi=(u,e)=>d.t(u,e&&e.filter((n=>n.identifier!=="source.canvas"))),Wr=d.aw();class Xr extends d.E{constructor(e,n={}){super(),this._rtlPluginLoaded=()=>{for(const a in this.sourceCaches){const o=this.sourceCaches[a].getSource().type;o!=="vector"&&o!=="geojson"||this.sourceCaches[a].reload()}},this.map=e,this.dispatcher=new Vt(Zr(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",((a,o)=>this.getGlyphs(a,o))),this.dispatcher.registerMessageHandler("GI",((a,o)=>this.getImages(a,o))),this.imageManager=new at,this.imageManager.setEventedParent(this),this.glyphManager=new Ii(e._requestManager,n.localIdeographFontFamily),this.lineAtlas=new qi(256,512),this.crossTileSymbolIndex=new ms,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new d.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",d.ay()),mr().on(Ae,this._rtlPluginLoaded),this.on("data",(a=>{if(a.dataType!=="source"||a.sourceDataType!=="metadata")return;const o=this.sourceCaches[a.sourceId];if(!o)return;const c=o.getSource();if(c&&c.vectorLayerIds)for(const m in this._layers){const _=this._layers[m];
6_.source===c.id&&this._validateLayer(_)}}))}loadURL(e,n={},a){this.fire(new d.k("dataloading",{dataType:"style"})),n.validate=typeof n.validate!="boolean"||n.validate;const o=this.map._requestManager.transformRequest(e,"Style");this._loadStyleRequest=new AbortController;const c=this._loadStyleRequest;d.h(o,this._loadStyleRequest).then((m=>{this._loadStyleRequest=null,this._load(m.data,n,a)})).catch((m=>{this._loadStyleRequest=null,m&&!c.signal.aborted&&this.fire(new d.j(m))}))}loadJSON(e,n={},a){this.fire(new d.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,de.frameAsync(this._frameRequest).then((()=>{this._frameRequest=null,n.validate=n.validate!==!1,this._load(e,n,a)})).catch((()=>{}))}loadEmpty(){this.fire(new d.k("dataloading",{dataType:"style"})),this._load(Wr,{validate:!1})}_load(e,n,a){var o;const c=n.transformStyle?n.transformStyle(a,e):e;if(!n.validate||!bi(this,d.u(c))){this._loaded=!0,this.stylesheet=c;for(const m in c.sources)this.addSource(m,c.sources[m],{validate:!1});c.sprite?this._loadSprite(c.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(c.glyphs),this._createLayers(),this.light=new cn(this.stylesheet.light),this.sky=new pr(this.stylesheet.sky),this.map.setTerrain((o=this.stylesheet.terrain)!==null&&o!==void 0?o:null),this.fire(new d.k("data",{dataType:"style"})),this.fire(new d.k("style.load"))}}_createLayers(){const e=d.az(this.stylesheet.layers);this.dispatcher.broadcast("SL",e),this._order=e.map((n=>n.id)),this._layers={},this._serializedLayers=null;for(const n of e){const a=d.aA(n);a.setEventedParent(this,{layer:{id:n.id}}),this._layers[n.id]=a}}_loadSprite(e,n=!1,a=void 0){let o;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,(function(c,m,_,y){return d._(this,void 0,void 0,(function*(){const w=Ve(c),T=_>1?"@2x":"",I={},k={};for(const{id:F,url:V}of w){const q=m.transformRequest(qe(V,T,".json"),"SpriteJSON");I[F]=d.h(q,y);const H=m.transformRequest(qe(V,T,".png"),"SpriteImage");k[F]=we.getImage(H,y)}return yield Promise.all([...Object.values(I),...Object.values(k)]),(function(F,V){return d._(this,void 0,void 0,(function*(){const q={};for(const H in F){q[H]={};const W=de.getImageCanvasContext((yield V[H]).data),J=(yield F[H]).data;for(const j in J){const{width:ne,height:se,x:ce,y:ye,sdf:Ie,pixelRatio:Re,stretchX:Ue,stretchY:ze,content:Me,textFitWidth:Je,textFitHeight:yt}=J[j];q[H][j]={data:null,pixelRatio:Re,sdf:Ie,stretchX:Ue,stretchY:ze,content:Me,textFitWidth:Je,textFitHeight:yt,spriteData:{width:ne,height:se,x:ce,y:ye,context:W}}}}return q}))})(I,k)}))})(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then((c=>{if(this._spriteRequest=null,c)for(const m in c){this._spritesImagesIds[m]=[];const _=this._spritesImagesIds[m]?this._spritesImagesIds[m].filter((y=>!(y in c))):[];for(const y of _)this.imageManager.removeImage(y),this._changedImages[y]=!0;for(const y in c[m]){const w=m==="default"?y:`${m}:${y}`;this._spritesImagesIds[m].push(w),w in this.imageManager.images?this.imageManager.updateImage(w,c[m][y],!1):this.imageManager.addImage(w,c[m][y]),n&&(this._changedImages[w]=!0)}}})).catch((c=>{this._spriteRequest=null,o=c,this.fire(new d.j(o))})).finally((()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new d.k("data",{dataType:"style"})),a&&a(o)}))}_unloadSprite(){for(const e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new d.k("data",{dataType:"style"}))}_validateLayer(e){const n=this.sourceCaches[e.source];if(!n)return;const a=e.sourceLayer;if(!a)return;const o=n.getSource();(o.type==="geojson"||o.vectorLayerIds&&o.vectorLayerIds.indexOf(a)===-1)&&this.fire(new d.j(new Error(`Source layer "${a}" does not exist on source "${o.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e,n=!1){const a=this._serializedAllLayers();if(!e||e.length===0)return Object.values(n?d.aB(a):a);const o=[];for(const c of e)if(a[c]){const m=n?d.aB(a[c]):a[c];o.push(m)}return o}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};const n=Object.keys(this._layers);for(const a of n){const o=this._layers[a];o.type!=="custom"&&(e[a]=o.serialize())}return e}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(const e in this.sourceCaches)if(this.sourceCaches[e].hasTransition())return!0;for(const e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;const n=this._changed;if(n){const o=Object.keys(this._updatedLayers),c=Object.keys(this._removedLayers);(o.length||c.length)&&this._updateWorkerLayers(o,c);for(const m in this._updatedSources){const _=this._updatedSources[m];if(_==="reload")this._reloadSource(m);else{if(_!=="clear")throw new Error(`Invalid action ${_}`);this._clearSource(m)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const m in this._updatedPaintProps)this._layers[m].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}const a={};for(const o in this.sourceCaches){const c=this.sourceCaches[o];a[o]=c.used,c.used=!1}for(const o of this._order){const c=this._layers[o];c.recalculate(e,this._availableImages),!c.isHidden(e.zoom)&&c.source&&(this.sourceCaches[c.source].used=!0)}for(const o in a){const c=this.sourceCaches[o];!!a[o]!=!!c.used&&c.fire(new d.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:o}))}this.light.recalculate(e),this.sky.recalculate(e),this.z=e.zoom,n&&this.fire(new d.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const e=Object.keys(this._changedImages);if(e.length){for(const n in this.sourceCaches)this.sourceCaches[n].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,n){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,n={}){var a;this._checkLoaded();const o=this.serialize();if(e=n.transformStyle?n.transformStyle(o,e):e,((a=n.validate)===null||a===void 0||a)&&bi(this,d.u(e)))return!1;
6(e=d.aB(e)).layers=d.az(e.layers);const c=d.aC(o,e),m=this._getOperationsToPerform(c);if(m.unimplemented.length>0)throw new Error(`Unimplemented: ${m.unimplemented.join(", ")}.`);if(m.operations.length===0)return!1;for(const _ of m.operations)_();return this.stylesheet=e,this._serializedLayers=null,!0}_getOperationsToPerform(e){const n=[],a=[];for(const o of e)switch(o.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":n.push((()=>this.addLayer.apply(this,o.args)));break;case"removeLayer":n.push((()=>this.removeLayer.apply(this,o.args)));break;case"setPaintProperty":n.push((()=>this.setPaintProperty.apply(this,o.args)));break;case"setLayoutProperty":n.push((()=>this.setLayoutProperty.apply(this,o.args)));break;case"setFilter":n.push((()=>this.setFilter.apply(this,o.args)));break;case"addSource":n.push((()=>this.addSource.apply(this,o.args)));break;case"removeSource":n.push((()=>this.removeSource.apply(this,o.args)));break;case"setLayerZoomRange":n.push((()=>this.setLayerZoomRange.apply(this,o.args)));break;case"setLight":n.push((()=>this.setLight.apply(this,o.args)));break;case"setGeoJSONSourceData":n.push((()=>this.setGeoJSONSourceData.apply(this,o.args)));break;case"setGlyphs":n.push((()=>this.setGlyphs.apply(this,o.args)));break;case"setSprite":n.push((()=>this.setSprite.apply(this,o.args)));break;case"setSky":n.push((()=>this.setSky.apply(this,o.args)));break;case"setTerrain":n.push((()=>this.map.setTerrain.apply(this,o.args)));break;case"setTransition":n.push((()=>{}));break;default:a.push(o.command)}return{operations:n,unimplemented:a}}addImage(e,n){if(this.getImage(e))return this.fire(new d.j(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,n),this._afterImageUpdated(e)}updateImage(e,n){this.imageManager.updateImage(e,n)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new d.j(new Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new d.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,n,a={}){if(this._checkLoaded(),this.sourceCaches[e]!==void 0)throw new Error(`Source "${e}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(d.u.source,`sources.${e}`,n,null,a))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const o=this.sourceCaches[e]=new it(e,n,this.dispatcher);o.style=this,o.setEventedParent(this,(()=>({isSourceLoaded:o.loaded(),source:o.serialize(),sourceId:e}))),o.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error("There is no source with this ID");for(const a in this._layers)if(this._layers[a].source===e)return this.fire(new d.j(new Error(`Source "${e}" cannot be removed while layer "${a}" is using it.`)));const n=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],n.fire(new d.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,n){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error(`There is no source with this ID=${e}`);const a=this.sourceCaches[e].getSource();if(a.type!=="geojson")throw new Error(`geojsonSource.type is ${a.type}, which is !== 'geojson`);a.setData(n),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,n,a={}){this._checkLoaded();const o=e.id;if(this.getLayer(o))return void this.fire(new d.j(new Error(`Layer "${o}" already exists on this map.`)));let c;if(e.type==="custom"){if(bi(this,d.aD(e)))return;c=d.aA(e)}else{if("source"in e&&typeof e.source=="object"&&(this.addSource(o,e.source),e=d.aB(e),e=d.e(e,{source:o}
6)),this._validate(d.u.layer,`layers.${o}`,e,{arrayIndex:-1},a))return;c=d.aA(e),this._validateLayer(c),c.setEventedParent(this,{layer:{id:o}})}const m=n?this._order.indexOf(n):this._order.length;if(n&&m===-1)this.fire(new d.j(new Error(`Cannot add layer "${o}" before non-existing layer "${n}".`)));else{if(this._order.splice(m,0,o),this._layerOrderChanged=!0,this._layers[o]=c,this._removedLayers[o]&&c.source&&c.type!=="custom"){const _=this._removedLayers[o];delete this._removedLayers[o],_.type!==c.type?this._updatedSources[c.source]="clear":(this._updatedSources[c.source]="reload",this.sourceCaches[c.source].pause())}this._updateLayer(c),c.onAdd&&c.onAdd(this.map)}}moveLayer(e,n){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new d.j(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===n)return;const a=this._order.indexOf(e);this._order.splice(a,1);const o=n?this._order.indexOf(n):this._order.length;n&&o===-1?this.fire(new d.j(new Error(`Cannot move layer "${e}" before non-existing layer "${n}".`))):(this._order.splice(o,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();const n=this._layers[e];if(!n)return void this.fire(new d.j(new Error(`Cannot remove non-existing layer "${e}".`)));n.setEventedParent(null);const a=this._order.indexOf(e);this._order.splice(a,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=n,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],n.onRemove&&n.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,n,a){this._checkLoaded();const o=this.getLayer(e);o?o.minzoom===n&&o.maxzoom===a||(n!=null&&(o.minzoom=n),a!=null&&(o.maxzoom=a),this._updateLayer(o)):this.fire(new d.j(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,n,a={}){this._checkLoaded();const o=this.getLayer(e);if(o){if(!d.aE(o.filter,n))return n==null?(o.filter=void 0,void this._updateLayer(o)):void(this._validate(d.u.filter,`layers.${o.id}.filter`,n,null,a)||(o.filter=d.aB(n),this._updateLayer(o)))}else this.fire(new d.j(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return d.aB(this.getLayer(e).filter)}setLayoutProperty(e,n,a,o={}){this._checkLoaded();const c=this.getLayer(e);c?d.aE(c.getLayoutProperty(n),a)||(c.setLayoutProperty(n,a,o),this._updateLayer(c)):this.fire(new d.j(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,n){const a=this.getLayer(e);if(a)return a.getLayoutProperty(n);this.fire(new d.j(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,n,a,o={}){this._checkLoaded();const c=this.getLayer(e);c?d.aE(c.getPaintProperty(n),a)||(c.setPaintProperty(n,a,o)&&this._updateLayer(c),this._changed=!0,this._updatedPaintProps[e]=!0,this._serializedLayers=null):this.fire(new d.j(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(e,n){return this.getLayer(e).getPaintProperty(n)}setFeatureState(e,n){this._checkLoaded();const a=e.source,o=e.sourceLayer,c=this.sourceCaches[a];if(c===void 0)return void this.fire(new d.j(new Error(`The source '${a}' does not exist in the map's style.`)));const m=c.getSource().type;m==="geojson"&&o?this.fire(new d.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):m!=="vector"||o?(e.id===void 0&&this.fire(new d.j(new Error("The feature id parameter must be provided."))),c.setFeatureState(o,e.id,n)):this.fire(new d.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,n){this._checkLoaded();const a=e.source,o=this.sourceCaches[a];if(o===void 0)return void this.fire(new d.j(new Error(`The source '${a}' does not exist in the map's style.`)));const c=o.getSource().type,m=c==="vector"?e.sourceLayer:void 0;c!=="vector"||m?n&&typeof e.id!="string"&&typeof e.id!="number"?this.fire(new d.j(new Error("A feature id is required to remove its specific state property."))):o.removeFeatureState(m,e.id,n):this.fire(new d.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();const n=e.source,a=e.sourceLayer,o=this.sourceCaches[n];if(o!==void 0)return o.getSource().type!=="vector"||a?(e.id===void 0&&this.fire(new d.j(new Error("The feature id parameter must be provided."))),o.getFeatureState(a,e.id)):void this.fire(new d.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new d.j(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return d.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const e=d.aF(this.sourceCaches,(c=>c.serialize())),n=this._serializeByIds(this._order,!0),a=this.map.getTerrain()||void 0,o=this.stylesheet;return d.aG({version:o.version,name:o.name,metadata:o.metadata,light:o.light,sky:o.sky,center:o.center,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch,sprite:o.sprite,glyphs:o.glyphs,transition:o.transition,sources:e,layers:n,terrain:a},(c=>c!==void 0))}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.sourceCaches[e.source].getSource().type!=="raster"&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){const n=m=>this._layers[m].type==="fill-extrusion",a={},o=[];for(let m=this._order.length-1;m>=0;m--){const _=this._order[m];if(n(_)){a[_]=m;for(const y of e){const w=y[_];if(w)for(const T of w)o.push(T)}}}o.sort(((m,_)=>_.intersectionZ-m.intersectionZ));const c=[];for(let m=this._order.length-1;m>=0;m--){const _=this._order[m];if(n(_))for(let y=o.length-1;y>=0;y--){const w=o[y].feature;if(a[w.layer.id]<m)break;c.push(w),o.pop()}else for(const y of e){const w=y[_];if(w)for(const T of w)c.push(T.feature)}}return c}
6queryRenderedFeatures(e,n,a){n&&n.filter&&this._validate(d.u.filter,"queryRenderedFeatures.filter",n.filter,null,n);const o={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new d.j(new Error("parameters.layers must be an Array."))),[];for(const _ of n.layers){const y=this._layers[_];if(!y)return this.fire(new d.j(new Error(`The layer '${_}' does not exist in the map's style and cannot be queried for features.`))),[];o[y.source]=!0}}const c=[];n.availableImages=this._availableImages;const m=this._serializedAllLayers();for(const _ in this.sourceCaches)n.layers&&!o[_]||c.push(Ar(this.sourceCaches[_],this._layers,m,e,n,a));return this.placement&&c.push((function(_,y,w,T,I,k,F){const V={},q=k.queryRenderedSymbols(T),H=[];for(const W of Object.keys(q).map(Number))H.push(F[W]);H.sort(un);for(const W of H){const J=W.featureIndex.lookupSymbolFeatures(q[W.bucketInstanceId],y,W.bucketIndex,W.sourceLayerIndex,I.filter,I.layers,I.availableImages,_);for(const j in J){const ne=V[j]=V[j]||[],se=J[j];se.sort(((ce,ye)=>{const Ie=W.featureSortOrder;if(Ie){const Re=Ie.indexOf(ce.featureIndex);return Ie.indexOf(ye.featureIndex)-Re}return ye.featureIndex-ce.featureIndex}));for(const ce of se)ne.push(ce)}}for(const W in V)V[W].forEach((J=>{const j=J.feature,ne=w[_[W].source].getFeatureState(j.layer["source-layer"],j.id);j.source=j.layer.source,j.layer["source-layer"]&&(j.sourceLayer=j.layer["source-layer"]),j.state=ne}));return V})(this._layers,m,this.sourceCaches,e,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(c)}querySourceFeatures(e,n){n&&n.filter&&this._validate(d.u.filter,"querySourceFeatures.filter",n.filter,null,n);const a=this.sourceCaches[e];return a?(function(o,c){const m=o.getRenderableIds().map((w=>o.getTileByID(w))),_=[],y={};for(let w=0;w<m.length;w++){const T=m[w],I=T.tileID.canonical.key;y[I]||(y[I]=!0,T.querySourceFeatures(_,c))}return _})(a,n):[]}getLight(){return this.light.getLight()}setLight(e,n={}){this._checkLoaded();const a=this.light.getLight();let o=!1;for(const m in e)if(!d.aE(e[m],a[m])){o=!0;break}if(!o)return;const c={now:de.now(),transition:d.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,n),this.light.updateTransitions(c)}getSky(){var e;return(e=this.stylesheet)===null||e===void 0?void 0:e.sky}setSky(e,n={}){const a=this.getSky();let o=!1;if(!e&&!a)return;if(e&&!a)o=!0;else if(!e&&a)o=!0;else for(const m in e)if(!d.aE(e[m],a[m])){o=!0;break}if(!o)return;const c={now:de.now(),transition:d.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,n),this.sky.updateTransitions(c)}_validate(e,n,a,o,c={}){return(!c||c.validate!==!1)&&bi(this,e.call(d.u,d.e({key:n,style:this.serialize(),value:a,styleSpec:d.v},o)))}_remove(e=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),mr().off(Ae,this._rtlPluginLoaded);for(const n in this._layers)this._layers[n].setEventedParent(null);for(const n in this.sourceCaches){const a=this.sourceCaches[n];a.setEventedParent(null),a.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(e)}_clearSource(e){this.sourceCaches[e].clearTiles()}_reloadSource(e){this.sourceCaches[e].resume(),this.sourceCaches[e].reload()}_updateSources(e){for(const n in this.sourceCaches)this.sourceCaches[n].update(e,this.map.terrain)}_generateCollisionBoxes(){for(const e in this.sourceCaches)this._reloadSource(e)}_updatePlacement(e,n,a,o,c=!1){let m=!1,_=!1;const y={};for(const w of this._order){const T=this._layers[w];if(T.type!=="symbol")continue;if(!y[T.source]){const k=this.sourceCaches[T.source];y[T.source]=k.getRenderableIds(!0).map((F=>k.getTileByID(F))).sort(((F,V)=>V.tileID.overscaledZ-F.tileID.overscaledZ||(F.tileID.isLessThan(V.tileID)?-1:1)))}const I=this.crossTileSymbolIndex.addLayer(T,y[T.source],e.center.lng);m=m||I}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((c=c||this._layerOrderChanged||a===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(de.now(),e.zoom))&&(this.pauseablePlacement=new Kt(e,this.map.terrain,this._order,c,n,a,o,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,y),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(de.now()),_=!0),m&&this.pauseablePlacement.placement.setStale()),_||m)for(const w of this._order){const T=this._layers[w];T.type==="symbol"&&this.placement.updateLayerOpacities(T,y[T.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(de.now())}_releaseSymbolFadeTiles(){for(const e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,n){return d._(this,void 0,void 0,(function*(){const a=yield this.imageManager.getImages(n.icons);this._updateTilesForChangedImages();const o=this.sourceCaches[n.source];return o&&o.setDependencies(n.tileID.key,n.type,n.icons),a}))}getGlyphs(e,n){return d._(this,void 0,void 0,(function*(){const a=yield this.glyphManager.getGlyphs(n.stacks),o=this.sourceCaches[n.source];return o&&o.setDependencies(n.tileID.key,n.type,[""]),a}))}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,n={}
6){this._checkLoaded(),e&&this._validate(d.u.glyphs,"glyphs",e,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,n,a={},o){this._checkLoaded();const c=[{id:e,url:n}],m=[...Ve(this.stylesheet.sprite),...c];this._validate(d.u.sprite,"sprite",m,null,a)||(this.stylesheet.sprite=m,this._loadSprite(c,!0,o))}removeSprite(e){this._checkLoaded();const n=Ve(this.stylesheet.sprite);if(n.find((a=>a.id===e))){if(this._spritesImagesIds[e])for(const a of this._spritesImagesIds[e])this.imageManager.removeImage(a),this._changedImages[a]=!0;n.splice(n.findIndex((a=>a.id===e)),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new d.k("data",{dataType:"style"}))}else this.fire(new d.j(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return Ve(this.stylesheet.sprite)}setSprite(e,n={},a){this._checkLoaded(),e&&this._validate(d.u.sprite,"sprite",e,null,n)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,a):(this._unloadSprite(),a&&a(null)))}}var mn=d.Y([{name:"a_pos",type:"Int16",components:2}]);const Mn={prelude:Nt(`#ifdef GL_ES
7precision mediump float;
8#else
9#if !defined(lowp)
10#define lowp
11#endif
12#if !defined(mediump)
13#define mediump
14#endif
15#if !defined(highp)
16#define highp
17#endif
18#endif
19`,`#ifdef GL_ES
20precision highp float;
21#else
22#if !defined(lowp)
23#define lowp
24#endif
25#if !defined(mediump)
26#define mediump
27#endif
28#if !defined(highp)
29#define highp
30#endif
31#endif
32vec2 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(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
33);}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 float tile_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 (tile_units_to_pixels*pos+offset)/pattern_size;}
34#ifdef TERRAIN3D
35uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;
36#endif
37const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {
38#ifdef TERRAIN3D
39highp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));
40#else
41return 1.0;
42#endif
43}float calculate_visibility(vec4 pos) {
44#ifdef TERRAIN3D
45vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;
46#else
47return 1.0;
48#endif
49}float ele(vec2 pos) {
50#ifdef TERRAIN3D
51vec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
52#else
53return 0.0;
54#endif
55}float get_elevation(vec2 pos) {
56#ifdef TERRAIN3D
57vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;
58#else
59return 0.0;
60#endif
61}`),background:Nt(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
62#ifdef OVERDRAW_INSPECTOR
63gl_FragColor=vec4(1.0);
64#endif
65}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:Nt(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;
65uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;
66#ifdef OVERDRAW_INSPECTOR
67gl_FragColor=vec4(1.0);
68#endif
69}`,"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:Nt(`varying vec3 v_data;varying float v_visibility;
70#pragma mapbox: define highp vec4 color
71#pragma mapbox: define mediump float radius
72#pragma mapbox: define lowp float blur
73#pragma mapbox: define lowp float opacity
74#pragma mapbox: define highp vec4 stroke_color
75#pragma mapbox: define mediump float stroke_width
76#pragma mapbox: define lowp float stroke_opacity
77void main() {
78#pragma mapbox: initialize highp vec4 color
79#pragma mapbox: initialize mediump float radius
80#pragma mapbox: initialize lowp float blur
81#pragma mapbox: initialize lowp float opacity
82#pragma mapbox: initialize highp vec4 stroke_color
83#pragma mapbox: initialize mediump float stroke_width
84#pragma mapbox: initialize lowp float stroke_opacity
85vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);
86#ifdef OVERDRAW_INSPECTOR
87gl_FragColor=vec4(1.0);
88#endif
89}`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;
90#pragma mapbox: define highp vec4 color
91#pragma mapbox: define mediump float radius
92#pragma mapbox: define lowp float blur
93#pragma mapbox: define lowp float opacity
94#pragma mapbox: define highp vec4 stroke_color
95#pragma mapbox: define mediump float stroke_width
96#pragma mapbox: define lowp float stroke_opacity
97void main(void) {
98#pragma mapbox: initialize highp vec4 color
99#pragma mapbox: initialize mediump float radius
100#pragma mapbox: initialize lowp float blur
101#pragma mapbox: initialize lowp float opacity
102#pragma mapbox: initialize highp vec4 stroke_color
103#pragma mapbox: initialize mediump float stroke_width
104#pragma mapbox: initialize lowp float stroke_opacity
105vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:Nt("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:Nt(`uniform highp float u_intensity;varying vec2 v_extrude;
106#pragma mapbox: define highp float weight
107#define GAUSS_COEF 0.3989422804014327
108void main() {
109#pragma mapbox: initialize highp float weight
110float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);
111#ifdef OVERDRAW_INSPECTOR
112gl_FragColor=vec4(1.0);
113#endif
114}`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;
115#pragma mapbox: define highp float weight
116#pragma mapbox: define mediump float radius
117const highp float ZERO=1.0/255.0/16.0;
118#define GAUSS_COEF 0.3989422804014327
119void main(void) {
120#pragma mapbox: initialize highp float weight
121#pragma mapbox: initialize mediump float radius
122vec2 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;vec4 pos=vec4(floor(a_pos*0.5)+extrude,get_elevation(floor(a_pos*0.5)),1);gl_Position=u_matrix*pos;}`),heatmapTexture:Nt(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;
123#ifdef OVERDRAW_INSPECTOR
124gl_FragColor=vec4(0.0);
125#endif
126}`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:Nt("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_anchor_pos;attribute vec2 a_placed;attribute vec2 a_box_real;uniform mat4 u_matrix;uniform vec2 u_pixel_extrude_scale;varying float v_placed;varying float v_notUsed;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:Nt("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying 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);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying 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;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-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(0.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:Nt("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:Nt(`#pragma mapbox: define highp vec4 color
127#pragma mapbox: define lowp float opacity
128void main() {
129#pragma mapbox: initialize highp vec4 color
130#pragma mapbox: initialize lowp float opacity
131gl_FragColor=color*opacity;
132#ifdef OVERDRAW_INSPECTOR
133gl_FragColor=vec4(1.0);
134#endif
135}`,`attribute vec2 a_pos;uniform mat4 u_matrix;
136#pragma mapbox: define highp vec4 color
137#pragma mapbox: define lowp float opacity
138void main() {
139#pragma mapbox: initialize highp vec4 color
140#pragma mapbox: initialize lowp float opacity
141gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:Nt(`varying vec2 v_pos;
142#pragma mapbox: define highp vec4 outline_color
143#pragma mapbox: define lowp float opacity
144void main() {
145#pragma mapbox: initialize highp vec4 outline_color
146#pragma mapbox: initialize lowp float opacity
147float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);
148#ifdef OVERDRAW_INSPECTOR
149gl_FragColor=vec4(1.0);
150#endif
151}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
152#pragma mapbox: define highp vec4 outline_color
153#pragma mapbox: define lowp float opacity
154void main() {
155#pragma mapbox: initialize highp vec4 outline_color
156#pragma mapbox: initialize lowp float opacity
157gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:Nt(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
158#pragma mapbox: define lowp float opacity
159#pragma mapbox: define lowp vec4 pattern_from
160#pragma mapbox: define lowp vec4 pattern_to
161void main() {
162#pragma mapbox: initialize lowp float opacity
163#pragma mapbox: initialize mediump vec4 pattern_from
164#pragma mapbox: initialize mediump vec4 pattern_to
165vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;
166#ifdef OVERDRAW_INSPECTOR
167gl_FragColor=vec4(1.0);
168#endif
169}`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
170#pragma mapbox: define lowp float opacity
171#pragma mapbox: define lowp vec4 pattern_from
172#pragma mapbox: define lowp vec4 pattern_to
173#pragma mapbox: define lowp float pixel_ratio_from
174#pragma mapbox: define lowp float pixel_ratio_to
175void main() {
176#pragma mapbox: initialize lowp float opacity
177#pragma mapbox: initialize mediump vec4 pattern_from
178#pragma mapbox: initialize mediump vec4 pattern_to
179#pragma mapbox: initialize lowp float pixel_ratio_from
180#pragma mapbox: initialize lowp float pixel_ratio_to
181vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillPattern:Nt(`#ifdef GL_ES
182precision highp float;
183#endif
184uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
185#pragma mapbox: define lowp float opacity
186#pragma mapbox: define lowp vec4 pattern_from
187#pragma mapbox: define lowp vec4 pattern_to
188void main() {
189#pragma mapbox: initialize lowp float opacity
190#pragma mapbox: initialize mediump vec4 pattern_from
191#pragma mapbox: initialize mediump vec4 pattern_to
192vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;
193#ifdef OVERDRAW_INSPECTOR
194gl_FragColor=vec4(1.0);
195#endif
196}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;
197#pragma mapbox: define lowp float opacity
198#pragma mapbox: define lowp vec4 pattern_from
199#pragma mapbox: define lowp vec4 pattern_to
200#pragma mapbox: define lowp float pixel_ratio_from
201#pragma mapbox: define lowp float pixel_ratio_to
202void main() {
203#pragma mapbox: initialize lowp float opacity
204#pragma mapbox: initialize mediump vec4 pattern_from
205#pragma mapbox: initialize mediump vec4 pattern_to
206#pragma mapbox: initialize lowp float pixel_ratio_from
207#pragma mapbox: initialize lowp float pixel_ratio_to
208vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:Nt(`varying vec4 v_color;void main() {gl_FragColor=v_color;
209#ifdef OVERDRAW_INSPECTOR
210gl_FragColor=vec4(1.0);
211#endif
212}`,`uniform 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;attribute vec2 a_pos;attribute vec4 a_normal_ed;
213#ifdef TERRAIN3D
214attribute vec2 a_centroid;
215#endif
216varying vec4 v_color;
217#pragma mapbox: define highp float base
218#pragma mapbox: define highp float height
219#pragma mapbox: define highp vec4 color
220void main() {
221#pragma mapbox: initialize highp float base
222#pragma mapbox: initialize highp float height
223#pragma mapbox: initialize highp vec4 color
224vec3 normal=a_normal_ed.xyz;
225#ifdef TERRAIN3D
226float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
227#else
228float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
229#endif
230base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/
23016384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:Nt(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
231#pragma mapbox: define lowp float base
232#pragma mapbox: define lowp float height
233#pragma mapbox: define lowp vec4 pattern_from
234#pragma mapbox: define lowp vec4 pattern_to
235#pragma mapbox: define lowp float pixel_ratio_from
236#pragma mapbox: define lowp float pixel_ratio_to
237void main() {
238#pragma mapbox: initialize lowp float base
239#pragma mapbox: initialize lowp float height
240#pragma mapbox: initialize mediump vec4 pattern_from
241#pragma mapbox: initialize mediump vec4 pattern_to
242#pragma mapbox: initialize lowp float pixel_ratio_from
243#pragma mapbox: initialize lowp float pixel_ratio_to
244vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;
245#ifdef OVERDRAW_INSPECTOR
246gl_FragColor=vec4(1.0);
247#endif
248}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;
249#ifdef TERRAIN3D
250attribute vec2 a_centroid;
251#endif
252varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
253#pragma mapbox: define lowp float base
254#pragma mapbox: define lowp float height
255#pragma mapbox: define lowp vec4 pattern_from
256#pragma mapbox: define lowp vec4 pattern_to
257#pragma mapbox: define lowp float pixel_ratio_from
258#pragma mapbox: define lowp float pixel_ratio_to
259void main() {
260#pragma mapbox: initialize lowp float base
261#pragma mapbox: initialize lowp float height
262#pragma mapbox: initialize mediump vec4 pattern_from
263#pragma mapbox: initialize mediump vec4 pattern_to
264#pragma mapbox: initialize lowp float pixel_ratio_from
265#pragma mapbox: initialize lowp float pixel_ratio_to
266vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;
267#ifdef TERRAIN3D
268float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
269#else
270float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
271#endif
272base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
273? a_pos
274: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:Nt(`#ifdef GL_ES
275precision highp float;
276#endif
277uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);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((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);
278#ifdef OVERDRAW_INSPECTOR
279gl_FragColor=vec4(1.0);
280#endif
281}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying 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:Nt(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;
282#define PI 3.141592653589793
283void main() {vec4 pixel=texture2D(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;
283float 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);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;
284#ifdef OVERDRAW_INSPECTOR
285gl_FragColor=vec4(1.0);
286#endif
287}`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:Nt(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
288#pragma mapbox: define highp vec4 color
289#pragma mapbox: define lowp float blur
290#pragma mapbox: define lowp float opacity
291void main() {
292#pragma mapbox: initialize highp vec4 color
293#pragma mapbox: initialize lowp float blur
294#pragma mapbox: initialize lowp float opacity
295float dist=length(v_normal)*v_width2.s;float blur2=(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);gl_FragColor=color*(alpha*opacity);
296#ifdef OVERDRAW_INSPECTOR
297gl_FragColor=vec4(1.0);
298#endif
299}`,`
300#define scale 0.015873016
301attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;
302#pragma mapbox: define highp vec4 color
303#pragma mapbox: define lowp float blur
304#pragma mapbox: define lowp float opacity
305#pragma mapbox: define mediump float gapwidth
306#pragma mapbox: define lowp float offset
307#pragma mapbox: define mediump float width
308void main() {
309#pragma mapbox: initialize highp vec4 color
310#pragma mapbox: initialize lowp float blur
311#pragma mapbox: initialize lowp float opacity
312#pragma mapbox: initialize mediump float gapwidth
313#pragma mapbox: initialize lowp float offset
314#pragma mapbox: initialize mediump float width
315float 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;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.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=width/2.0;offset=-1.0*offset;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*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
316#ifdef TERRAIN3D
317v_gamma_scale=1.0;
318#else
319float 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=extrude_length_without_perspective/extrude_length_with_perspective;
320#endif
321v_width2=vec2(outset,inset);}`),lineGradient:Nt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;
322#pragma mapbox: define lowp float blur
323#pragma mapbox: define lowp float opacity
324void main() {
325#pragma mapbox: initialize lowp float blur
326#pragma mapbox: initialize lowp float opacity
327float dist=length(v_normal)*v_width2.s;float blur2=(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);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);
328#ifdef OVERDRAW_INSPECTOR
329gl_FragColor=vec4(1.0);
330#endif
331}`,`
332#define scale 0.015873016
333attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;
334#pragma mapbox: define lowp float blur
335#pragma mapbox: define lowp float opacity
336#pragma mapbox: define mediump float gapwidth
337#pragma mapbox: define lowp float offset
338#pragma mapbox: define mediump float width
339void main() {
340#pragma mapbox: initialize lowp float blur
341#pragma mapbox: initialize lowp float opacity
342#pragma mapbox: initialize mediump float gapwidth
343#pragma mapbox: initialize lowp float offset
344#pragma mapbox: initialize mediump float width
345float 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;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);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=width/2.0;offset=-1.0*offset;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*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
346#ifdef TERRAIN3D
347v_gamma_scale=1.0;
348#else
349float 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=extrude_length_without_perspective/extrude_length_with_perspective;
350#endif
351v_width2=vec2(outset,inset);}`),linePattern:Nt(`#ifdef GL_ES
352precision highp float;
353#endif
354uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
355#pragma mapbox: define lowp vec4 pattern_from
356#pragma mapbox: define lowp vec4 pattern_to
357#pragma mapbox: define lowp float pixel_ratio_from
358#pragma mapbox: define lowp float pixel_ratio_to
359#pragma mapbox: define lowp float blur
360#pragma mapbox: define lowp float opacity
361void main() {
362#pragma mapbox: initialize mediump vec4 pattern_from
363#pragma mapbox: initialize mediump vec4 pattern_to
364#pragma mapbox: initialize lowp float pixel_ratio_from
365#pragma mapbox: initialize lowp float pixel_ratio_to
366#pragma mapbox: initialize lowp float blur
367#pragma mapbox: initialize lowp float opacity
368vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(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);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;
369#ifdef OVERDRAW_INSPECTOR
370gl_FragColor=vec4(1.0);
371#endif
372}`,`
373#define scale 0.015873016
374#define LINE_DISTANCE_SCALE 2.0
375attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
376#pragma mapbox: define lowp float blur
377#pragma mapbox: define lowp float opacity
378#pragma mapbox: define lowp float offset
379#pragma mapbox: define mediump float gapwidth
380#pragma mapbox: define mediump float width
381#pragma mapbox: define lowp float floorwidth
382#pragma mapbox: define lowp vec4 pattern_from
383#pragma mapbox: define lowp vec4 pattern_to
384#pragma mapbox: define lowp float pixel_ratio_from
385#pragma mapbox: define lowp float pixel_ratio_to
386void main() {
387#pragma mapbox: initialize lowp float blur
388#pragma mapbox: initialize lowp float opacity
389#pragma mapbox: initialize lowp float offset
390#pragma mapbox: initialize mediump float gapwidth
391#pragma mapbox: initialize mediump float width
392#pragma mapbox: initialize lowp float floorwidth
393#pragma mapbox: initialize mediump vec4 pattern_from
394#pragma mapbox: initialize mediump vec4 pattern_to
395#pragma mapbox: initialize lowp float pixel_ratio_from
396#pragma mapbox: initialize lowp float pixel_ratio_to
397float 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;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;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=width/2.0;offset=-1.0*offset;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*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
398#ifdef TERRAIN3D
399v_gamma_scale=1.0;
400#else
401float 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=extrude_length_without_perspective/extrude_length_with_perspective;
402#endif
403v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:Nt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;
403uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
404#pragma mapbox: define highp vec4 color
405#pragma mapbox: define lowp float blur
406#pragma mapbox: define lowp float opacity
407#pragma mapbox: define mediump float width
408#pragma mapbox: define lowp float floorwidth
409void main() {
410#pragma mapbox: initialize highp vec4 color
411#pragma mapbox: initialize lowp float blur
412#pragma mapbox: initialize lowp float opacity
413#pragma mapbox: initialize mediump float width
414#pragma mapbox: initialize lowp float floorwidth
415float dist=length(v_normal)*v_width2.s;float blur2=(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);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);
416#ifdef OVERDRAW_INSPECTOR
417gl_FragColor=vec4(1.0);
418#endif
419}`,`
420#define scale 0.015873016
421#define LINE_DISTANCE_SCALE 2.0
422attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
423#pragma mapbox: define highp vec4 color
424#pragma mapbox: define lowp float blur
425#pragma mapbox: define lowp float opacity
426#pragma mapbox: define mediump float gapwidth
427#pragma mapbox: define lowp float offset
428#pragma mapbox: define mediump float width
429#pragma mapbox: define lowp float floorwidth
430void main() {
431#pragma mapbox: initialize highp vec4 color
432#pragma mapbox: initialize lowp float blur
433#pragma mapbox: initialize lowp float opacity
434#pragma mapbox: initialize mediump float gapwidth
435#pragma mapbox: initialize lowp float offset
436#pragma mapbox: initialize mediump float width
437#pragma mapbox: initialize lowp float floorwidth
438float 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;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;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=width/2.0;offset=-1.0*offset;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*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
439#ifdef TERRAIN3D
440v_gamma_scale=1.0;
441#else
442float 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=extrude_length_without_perspective/extrude_length_with_perspective;
443#endif
444v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:Nt(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(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);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
445#ifdef OVERDRAW_INSPECTOR
446gl_FragColor=vec4(1.0);
447#endif
448}`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:Nt(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
449#pragma mapbox: define lowp float opacity
450void main() {
451#pragma mapbox: initialize lowp float opacity
452lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;
453#ifdef OVERDRAW_INSPECTOR
454gl_FragColor=vec4(1.0);
455#endif
456}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform 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 highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_tex;varying float v_fade_opacity;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}
457#pragma mapbox: define lowp float opacity
458void main() {
459#pragma mapbox: initialize lowp float opacity
460vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];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 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
461camera_to_anchor_distance/u_camera_to_center_distance :
462u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp 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);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:Nt(`#define SDF_PX 8.0
463uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;
464#pragma mapbox: define highp vec4 fill_color
465#pragma mapbox: define highp vec4 halo_color
466#pragma mapbox: define lowp float opacity
467#pragma mapbox: define lowp float halo_width
468#pragma mapbox: define lowp float halo_blur
469void main() {
470#pragma mapbox: initialize highp vec4 fill_color
471#pragma mapbox: initialize highp vec4 halo_color
472#pragma mapbox: initialize lowp float opacity
473#pragma mapbox: initialize lowp float halo_width
474#pragma mapbox: initialize lowp float halo_blur
475float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity);
476#ifdef OVERDRAW_INSPECTOR
477gl_FragColor=vec4(1.0);
478#endif
479}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform 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_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;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 vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_data0;varying vec3 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}
480#pragma mapbox: define highp vec4 fill_color
481#pragma mapbox: define highp vec4 halo_color
482#pragma mapbox: define lowp float opacity
483#pragma mapbox: define lowp float halo_width
484#pragma mapbox: define lowp float halo_blur
485void main() {
486#pragma mapbox: initialize highp vec4 fill_color
487#pragma mapbox: initialize highp vec4 halo_color
488#pragma mapbox: initialize lowp float opacity
489#pragma mapbox: initialize lowp float halo_width
490#pragma mapbox: initialize lowp float halo_blur
491vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];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 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
492camera_to_anchor_distance/u_camera_to_center_distance :
493u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp 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);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:Nt(`#define SDF_PX 8.0
494#define SDF 1.0
495#define ICON 0.0
496uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;
497#pragma mapbox: define highp vec4 fill_color
498#pragma mapbox: define highp vec4 halo_color
499#pragma mapbox: define lowp float opacity
500#pragma mapbox: define lowp float halo_width
501#pragma mapbox: define lowp float halo_blur
502void main() {
503#pragma mapbox: initialize highp vec4 fill_color
504#pragma mapbox: initialize highp vec4 halo_color
505#pragma mapbox: initialize lowp float opacity
506#pragma mapbox: initialize lowp float halo_width
507#pragma mapbox: initialize lowp float halo_blur
508float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;
508gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;
509#ifdef OVERDRAW_INSPECTOR
510gl_FragColor=vec4(1.0);
511#endif
512return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
513#ifdef OVERDRAW_INSPECTOR
514gl_FragColor=vec4(1.0);
515#endif
516}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform 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_pitch_with_map;uniform highp float u_pitch;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 vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec4 v_data0;varying vec4 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}
517#pragma mapbox: define highp vec4 fill_color
518#pragma mapbox: define highp vec4 halo_color
519#pragma mapbox: define lowp float opacity
520#pragma mapbox: define lowp float halo_width
521#pragma mapbox: define lowp float halo_blur
522void main() {
523#pragma mapbox: initialize highp vec4 fill_color
524#pragma mapbox: initialize highp vec4 halo_color
525#pragma mapbox: initialize lowp float opacity
526#pragma mapbox: initialize lowp float halo_width
527#pragma mapbox: initialize lowp float halo_blur
528vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];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 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
529camera_to_anchor_distance/u_camera_to_center_distance :
530u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp 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);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:Nt("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;varying vec2 v_texture_pos;varying float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture2D(u_texture,v_texture_pos);if (v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);
530float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);gl_FragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {gl_FragColor=surface_color;}}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform mat4 u_fog_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:Nt("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:Nt("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);}"),sky:Nt("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform float u_horizon;uniform float u_sky_horizon_blend;void main() {float y=gl_FragCoord.y;if (y > u_horizon) {float blend=y-u_horizon;if (blend < u_sky_horizon_blend) {gl_FragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {gl_FragColor=u_sky_color;}}}","attribute vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function Nt(u,e){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,a=e.match(/attribute ([\w]+) ([\w]+)/g),o=u.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),c=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),m=c?c.concat(o):o,_={};return{fragmentSource:u=u.replace(n,((y,w,T,I,k)=>(_[k]=!0,w==="define"?`
531#ifndef HAS_UNIFORM_u_${k}
532varying ${T} ${I} ${k};
533#else
534uniform ${T} ${I} u_${k};
535#endif
536`:`
537#ifdef HAS_UNIFORM_u_${k}
538    ${T} ${I} ${k} = u_${k};
539#endif
540`))),vertexSource:e=e.replace(n,((y,w,T,I,k)=>{const F=I==="float"?"vec2":"vec4",V=k.match(/color/)?"color":F;return _[k]?w==="define"?`
541#ifndef HAS_UNIFORM_u_${k}
542uniform lowp float u_${k}_t;
543attribute ${T} ${F} a_${k};
544varying ${T} ${I} ${k};
545#else
546uniform ${T} ${I} u_${k};
547#endif
548`:V==="vec4"?`
549#ifndef HAS_UNIFORM_u_${k}
550    ${k} = a_${k};
551#else
552    ${T} ${I} ${k} = u_${k};
553#endif
554`:`
555#ifndef HAS_UNIFORM_u_${k}
556    ${k} = unpack_mix_${V}(a_${k}, u_${k}_t);
557#else
558    ${T} ${I} ${k} = u_${k};
559#endif
560`:w==="define"?`
561#ifndef HAS_UNIFORM_u_${k}
562uniform lowp float u_${k}_t;
563attribute ${T} ${F} a_${k};
564#else
565uniform ${T} ${I} u_${k};
566#endif
567`:V==="vec4"?`
568#ifndef HAS_UNIFORM_u_${k}
569    ${T} ${I} ${k} = a_${k};
570#else
571    ${T} ${I} ${k} = u_${k};
572#endif
573`:`
574#ifndef HAS_UNIFORM_u_${k}
575    ${T} ${I} ${k} = unpack_mix_${V}(a_${k}, u_${k}_t);
576#else
577    ${T} ${I} ${k} = u_${k};
578#endif
579`})),staticAttributes:a,staticUniforms:m}}class Bs{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,n,a,o,c,m,_,y,w){this.context=e;let T=this.boundPaintVertexBuffers.length!==o.length;for(let I=0;!T&&I<o.length;I++)this.boundPaintVertexBuffers[I]!==o[I]&&(T=!0);!this.vao||this.boundProgram!==n||this.boundLayoutVertexBuffer!==a||T||this.boundIndexBuffer!==c||this.boundVertexOffset!==m||this.boundDynamicVertexBuffer!==_||this.boundDynamicVertexBuffer2!==y||this.boundDynamicVertexBuffer3!==w?this.freshBind(n,a,o,c,m,_,y,w):(e.bindVertexArray.set(this.vao),_&&_.bind(),c&&c.dynamicDraw&&c.bind(),y&&y.bind(),w&&w.bind())}freshBind(e,n,a,o,c,m,_,y){const w=e.numAttributes,T=this.context,I=T.gl;this.vao&&this.destroy(),this.vao=T.createVertexArray(),T.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=a,this.boundIndexBuffer=o,this.boundVertexOffset=c,this.boundDynamicVertexBuffer=m,this.boundDynamicVertexBuffer2=_,this.boundDynamicVertexBuffer3=y,n.enableAttributes(I,e);for(const k of a)k.enableAttributes(I,e);m&&m.enableAttributes(I,e),_&&_.enableAttributes(I,e),y&&y.enableAttributes(I,e),n.bind(),n.setVertexAttribPointers(I,e,c);for(const k of a)k.bind(),k.setVertexAttribPointers(I,e,c);m&&(m.bind(),m.setVertexAttribPointers(I,e,c)),o&&o.bind(),_&&(_.bind(),_.setVertexAttribPointers(I,e,c)),y&&(y.bind(),y.setVertexAttribPointers(I,e,c)),T.currentNumAttributes=w}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const wa=(u,e,n,a,o)=>({u_matrix:u,u_texture:0,u_ele_delta:e,u_fog_matrix:n,u_fog_color:a?a.properties.get("fog-color"):d.aM.white,u_fog_ground_blend:a?a.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:a?a.calculateFogBlendOpacity(o):0,u_horizon_color:a?a.properties.get("horizon-color"):d.aM.white,u_horizon_fog_blend:a?a.properties.get("horizon-fog-blend"):1});function Jn(u){const e=[];for(let n=0;n<u.length;n++){if(u[n]===null)continue;const a=u[n].split(" ");e.push(a.pop())}return e}class Sa{constructor(e,n,a,o,c,m){const _=e.gl;this.program=_.createProgram();const y=Jn(n.staticAttributes),w=a?a.getBinderAttributes():[],T=y.concat(w),I=Mn.prelude.staticUniforms?Jn(Mn.prelude.staticUniforms):[],k=n.staticUniforms?Jn(n.staticUniforms):[],F=a?a.getBinderUniforms():[],V=I.concat(k).concat(F),q=[];for(const ce of V)q.indexOf(ce)<0&&q.push(ce);const H=a?a.defines():[];c&&H.push("#define OVERDRAW_INSPECTOR;"),m&&H.push("#define TERRAIN3D;");const W=H.concat(Mn.prelude.fragmentSource,n.fragmentSource).join(`
580`),J=H.concat(Mn.prelude.vertexSource,n.vertexSource).join(`
581`),j=_.createShader(_.FRAGMENT_SHADER);if(_.isContextLost())return void(this.failedToCreate=!0);if(_.shaderSource(j,W),_.compileShader(j),!_.getShaderParameter(j,_.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${_.getShaderInfoLog(j)}`);_.attachShader(this.program,j);const ne=_.createShader(_.VERTEX_SHADER);if(_.isContextLost())return void(this.failedToCreate=!0);if(_.shaderSource(ne,J),_.compileShader(ne),!_.getShaderParameter(ne,_.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${_.getShaderInfoLog(ne)}`);_.attachShader(this.program,ne),this.attributes={};const se={};this.numAttributes=T.length;for(let ce=0;ce<this.numAttributes;ce++)T[ce]&&(_.bindAttribLocation(this.program,ce,T[ce]),this.attributes[T[ce]]=ce);if(_.linkProgram(this.program),!_.getProgramParameter(this.program,_.LINK_STATUS))throw new Error(`Program failed to link: ${_.getProgramInfoLog(this.program)}`);_.deleteShader(ne),_.deleteShader(j);for(let ce=0;ce<q.length;ce++){const ye=q[ce];if(ye&&!se[ye]){const Ie=_.getUniformLocation(this.program,ye);Ie&&(se[ye]=Ie)}}this.fixedUniforms=o(e,se),this.terrainUniforms=((ce,ye)=>({u_depth:new d.aH(ce,ye.u_depth),u_terrain:new d.aH(ce,ye.u_terrain),u_terrain_dim:new d.aI(ce,ye.u_terrain_dim),u_terrain_matrix:new d.aJ(ce,ye.u_terrain_matrix),u_terrain_unpack:new d.aK(ce,ye.u_terrain_unpack),u_terrain_exaggeration:new d.aI(ce,ye.u_terrain_exaggeration)}))(e,se),this.binderUniforms=a?a.getUniforms(e,se):[]}draw(e,n,a,o,c,m,_,y,w,T,I,k,F,V,q,H,W,J){const j=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(a),e.setStencilMode(o),e.setColorMode(c),e.setCullFace(m),y){e.activeTexture.set(j.TEXTURE2),j.bindTexture(j.TEXTURE_2D,y.depthTexture),e.activeTexture.set(j.TEXTURE3),j.bindTexture(j.TEXTURE_2D,y.texture);for(const se in this.terrainUniforms)this.terrainUniforms[se].set(y[se])}for(const se in this.fixedUniforms)this.fixedUniforms[se].set(_[se]);q&&q.setUniforms(e,this.binderUniforms,F,{zoom:V});let ne=0;switch(n){case j.LINES:ne=2;break;case j.TRIANGLES:ne=3;break;case j.LINE_STRIP:ne=1}for(const se of k.get()){const ce=se.vaos||(se.vaos={});(ce[w]||(ce[w]=new Bs)).bind(e,this,T,q?q.getPaintVertexBuffers():[],I,se.vertexOffset,H,W,J),j.drawElements(n,se.primitiveLength*ne,j.UNSIGNED_SHORT,se.primitiveOffset*ne*2)}}}function Fs(u,e,n){const a=1/Et(n,1,e.transform.tileZoom),o=Math.pow(2,n.tileID.overscaledZ
581),c=n.tileSize*Math.pow(2,e.transform.tileZoom)/o,m=c*(n.tileID.canonical.x+n.tileID.wrap*o),_=c*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[a,u.fromScale,u.toScale],u_fade:u.t,u_pixel_coord_upper:[m>>16,_>>16],u_pixel_coord_lower:[65535&m,65535&_]}}const Qn=(u,e,n,a)=>{const o=e.style.light,c=o.properties.get("position"),m=[c.x,c.y,c.z],_=(function(){var w=new d.A(9);return d.A!=Float32Array&&(w[1]=0,w[2]=0,w[3]=0,w[5]=0,w[6]=0,w[7]=0),w[0]=1,w[4]=1,w[8]=1,w})();o.properties.get("anchor")==="viewport"&&(function(w,T){var I=Math.sin(T),k=Math.cos(T);w[0]=k,w[1]=I,w[2]=0,w[3]=-I,w[4]=k,w[5]=0,w[6]=0,w[7]=0,w[8]=1})(_,-e.transform.angle),(function(w,T,I){var k=T[0],F=T[1],V=T[2];w[0]=k*I[0]+F*I[3]+V*I[6],w[1]=k*I[1]+F*I[4]+V*I[7],w[2]=k*I[2]+F*I[5]+V*I[8]})(m,m,_);const y=o.properties.get("color");return{u_matrix:u,u_lightpos:m,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[y.r,y.g,y.b],u_vertical_gradient:+n,u_opacity:a}},Os=(u,e,n,a,o,c,m)=>d.e(Qn(u,e,n,a),Fs(c,e,m),{u_height_factor:-Math.pow(2,o.overscaledZ)/m.tileSize/8}),jn=u=>({u_matrix:u}),ro=(u,e,n,a)=>d.e(jn(u),Fs(n,e,a)),nl=(u,e)=>({u_matrix:u,u_world:e}),no=(u,e,n,a,o)=>d.e(ro(u,e,n,a),{u_world:o}),sl=(u,e,n,a)=>{const o=u.transform;let c,m;if(a.paint.get("circle-pitch-alignment")==="map"){const _=Et(n,1,o.zoom);c=!0,m=[_,_]}else c=!1,m=o.pixelsToGLUnits;return{u_camera_to_center_distance:o.cameraToCenterDistance,u_scale_with_map:+(a.paint.get("circle-pitch-scale")==="map"),u_matrix:u.translatePosMatrix(e.posMatrix,n,a.paint.get("circle-translate"),a.paint.get("circle-translate-anchor")),u_pitch_with_map:+c,u_device_pixel_ratio:u.pixelRatio,u_extrude_scale:m}},$n=(u,e,n)=>({u_matrix:u,u_inv_matrix:e,u_camera_to_center_distance:n.cameraToCenterDistance,u_viewport_size:[n.width,n.height]}),es=(u,e,n=1)=>({u_matrix:u,u_color:e,u_overlay:0,u_overlay_scale:n}),er=u=>({u_matrix:u}),tr=(u,e,n,a)=>({u_matrix:u,u_extrude_scale:Et(e,1,n),u_intensity:a}),Ns=(u,e,n,a)=>{const o=d.H();d.aP(o,0,u.width,u.height,0,0,1);const c=u.context.gl;return{u_matrix:o,u_world:[c.drawingBufferWidth,c.drawingBufferHeight],u_image:n,u_color_ramp:a,u_opacity:e.paint.get("heatmap-opacity")}};function Vs(u,e){const n=Math.pow(2,e.canonical.z),a=e.canonical.y;return[new d.Z(0,a/n).toLngLat().lat,new d.Z(0,(a+1)/n).toLngLat().lat]}const gs=(u,e,n,a)=>{const o=u.transform;return{u_matrix:ao(u,e,n,a),u_ratio:1/Et(e,1,o.zoom),u_device_pixel_ratio:u.pixelRatio,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},Ta=(u,e,n,a,o)=>d.e(gs(u,e,n,o),{u_image:0,u_image_height:a}),qn=(u,e,n,a,o)=>{const c=u.transform,m=so(e,c);return{u_matrix:ao(u,e,n,o),u_texsize:e.imageAtlasTexture.size,u_ratio:1/Et(e,1,c.zoom),u_device_pixel_ratio:u.pixelRatio,u_image:0,u_scale:[m,a.fromScale,a.toScale],u_fade:a.t,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]]}},al=(u,e,n,a,o,c)=>{const m=u.lineAtlas,_=so(e,u.transform),y=n.layout.get("line-cap")==="round",w=m.getDash(a.from,y),T=m.getDash(a.to,y),I=w.width*o.fromScale,k=T.width*o.toScale;return d.e(gs(u,e,n,c),{u_patternscale_a:[_/I,-w.height/2],u_patternscale_b:[_/k,-T.height/2],u_sdfgamma:m.width/(256*Math.min(I,k)*u.pixelRatio)/2,u_image:0,u_tex_y_a:w.y,u_tex_y_b:T.y,u_mix:o.t})};function so(u,e){return 1/Et(u,1,e.tileZoom)}function ao(u,e,n,a){return u.translatePosMatrix(a?a.posMatrix:e.tileID.posMatrix,e,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const ts=(u,e,n,a,o)=>{return{u_matrix:u,u_tl_parent:e,u_scale_parent:n,u_buffer_scale:1,u_fade_t:a.mix,u_opacity:a.opacity*o.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:o.paint.get("raster-brightness-min"),u_brightness_high:o.paint.get("raster-brightness-max"),u_saturation_factor:(m=o.paint.get("raster-saturation"),m>0?1-1/(1.001-m):-m),u_contrast_factor:(c=o.paint.get("raster-contrast"),c>0?1/(1-c):1+c),u_spin_weights:Or(o.paint.get("raster-hue-rotate"))};var c,m};function Or(u){u*=Math.PI/180;const e=Math.sin(u),n=Math.cos(u);return[(2*n+1)/3,(-Math.sqrt(3)*e-n+1)/3,(Math.sqrt(3)*e-n+1)/3]}const oo=(u,e,n,a,o,c,m,_,y,w,T,I,k,F)=>{const V=m.transform;return{u_is_size_zoom_constant:+(u==="constant"||u==="source"),u_is_size_feature_constant:+(u==="constant"||u==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:V.cameraToCenterDistance,u_pitch:V.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:V.width/V.height,u_fade_change:m.options.fadeDuration?m.symbolFadeChange:1,u_matrix:_,u_label_plane_matrix:y,u_coord_matrix:w,u_is_text:+I,u_pitch_with_map:+a,u_is_along_line:o,u_is_variable_anchor:c,u_texsize:k,u_texture:0,u_translation:T,u_pitched_scale:F}},_s=(u,e,n,a,o,c,m,_,y,w,T,I,k,F,V)=>{const q=m.transform;return d.e(oo(u,e,n,a,o,c,m,_,y,w,T,I,k,V),{u_gamma_scale:a?Math.cos(q._pitch)*q.cameraToCenterDistance:1,u_device_pixel_ratio:m.pixelRatio,u_is_halo:1})},Ia=(u,e,n,a,o,c,m,_,y,w,T,I,k,F)=>d.e(_s(u,e,n,a,o,c,m,_,y,w,T,!0,I,!0,F),{u_texsize_icon:k,u_texture_icon:1}),Us=(u,e,n)=>({u_matrix:u,u_opacity:e,u_color:n}),js=(u,e,n,a,o,c)=>d.e((function(m,_,y,w){const T=y.imageManager.getPattern(m.from.toString()),I=y.imageManager.getPattern(m.to.toString()),{width:k,height:F}=y.imageManager.getPixelSize(),V=Math.pow(2,w.tileID.overscaledZ
vendor: 5,988 bytes, line 581
581),q=w.tileSize*Math.pow(2,y.transform.tileZoom)/V,H=q*(w.tileID.canonical.x+w.tileID.wrap*V),W=q*w.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:T.tl,u_pattern_br_a:T.br,u_pattern_tl_b:I.tl,u_pattern_br_b:I.br,u_texsize:[k,F],u_mix:_.t,u_pattern_size_a:T.displaySize,u_pattern_size_b:I.displaySize,u_scale_a:_.fromScale,u_scale_b:_.toScale,u_tile_units_to_pixels:1/Et(w,1,y.transform.tileZoom),u_pixel_coord_upper:[H>>16,W>>16],u_pixel_coord_lower:[65535&H,65535&W]}})(a,c,n,o),{u_matrix:u,u_opacity:e}),$s={fillExtrusion:(u,e)=>({u_matrix:new d.aJ(u,e.u_matrix),u_lightpos:new d.aN(u,e.u_lightpos),u_lightintensity:new d.aI(u,e.u_lightintensity),u_lightcolor:new d.aN(u,e.u_lightcolor),u_vertical_gradient:new d.aI(u,e.u_vertical_gradient),u_opacity:new d.aI(u,e.u_opacity)}),fillExtrusionPattern:(u,e)=>({u_matrix:new d.aJ(u,e.u_matrix),u_lightpos:new d.aN(u,e.u_lightpos),u_lightintensity:new d.aI(u,e.u_lightintensity),u_lightcolor:new d.aN(u,e.u_lightcolor),u_vertical_gradient:new d.aI(u,e.u_vertical_gradient),u_height_factor:new d.aI(u,e.u_height_factor),u_image:new d.aH(u,e.u_image),u_texsize:new d.aO(u,e.u_texsize),u_pixel_coord_upper:new d.aO(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new d.aO(u,e.u_pixel_coord_lower),u_scale:new d.aN(u,e.u_scale),u_fade:new d.aI(u,e.u_fade),u_opacity:new d.aI(u,e.u_opacity)}),fill:(u,e)=>({u_matrix:new d.aJ(u,e.u_matrix)}),fillPattern:(u,e)=>({u_matrix:new d.aJ(u,e.u_matrix),u_image:new d.aH(u,e.u_image),u_texsize:new d.aO(u,e.u_texsize),u_pixel_coord_upper:new d.aO(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new d.aO(u,e.u_pixel_coord_lower),u_scale:new d.aN(u,e.u_scale),u_fade:new d.aI(u,e.u_fade)}),fillOutline:(u,e)=>({u_matrix:new d.aJ(u,e.u_matrix),u_world:new d.aO(u,e.u_world)}),fillOutlinePattern:(u,e)=>({u_matrix:new d.aJ(u,e.u_matrix),u_world:new d.aO(u,e.u_world),u_image:new d.aH(u,e.u_image),u_texsize:new d.aO(u,e.u_texsize),u_pixel_coord_upper:new d.aO(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new d.aO(u,e.u_pixel_coord_lower),u_scale:new d.aN(u,e.u_scale),u_fade:new d.aI(u,e.u_fade)}),circle:(u,e)=>({u_camera_to_center_distance:new d.aI(u,e.u_camera_to_center_distance),u_scale_with_map:new d.aH(u,e.u_scale_with_map),u_pitch_with_map:new d.aH(u,e.u_pitch_with_map),u_extrude_scale:new d.aO(u,e.u_extrude_scale),u_device_pixel_ratio:new d.aI(u,e.u_device_pixel_ratio),u_matrix:new d.aJ(u,e.u_matrix)}),collisionBox:(u,e)=>({u_matrix:new d.aJ(u,e.u_matrix),u_pixel_extrude_scale:new d.aO(u,e.u_pixel_extrude_scale)}),collisionCircle:(u,e)=>({u_matrix:new d.aJ(u,e.u_matrix),u_inv_matrix:new d.aJ(u,e.u_inv_matrix),u_camera_to_center_distance:new d.aI(u,e.u_camera_to_center_distance),u_viewport_size:new d.aO(u,e.u_viewport_size)}),debug:(u,e)=>({u_color:new d.aL(u,e.u_color),u_matrix:new d.aJ(u,e.u_matrix),u_overlay:new d.aH(u,e.u_overlay),u_overlay_scale:new d.aI(u,e.u_overlay_scale)}),clippingMask:(u,e)=>({u_matrix:new d.aJ(u,e.u_matrix)}),heatmap:(u,e)=>({u_extrude_scale:new d.aI(u,e.u_extrude_scale),u_intensity:new d.aI(u,e.u_intensity),u_matrix:new d.aJ(u,e.u_matrix)}),heatmapTexture:(u,e)=>({u_matrix:new d.aJ(u,e.u_matrix),u_world:new d.aO(u,e.u_world),u_image:new d.aH(u,e.u_image),u_color_ramp:new d.aH(u,e.u_color_ramp),u_opacity:new d.aI(u,e.u_opacity)}),hillshade:(u,e)=>({u_matrix:new d.aJ(u,e.u_matrix),u_image:new d.aH(u,e.u_image),u_latrange:new d.aO(u,e.u_latrange),u_light:new d.aO(u,e.u_light),u_shadow:new d.aL(u,e.u_shadow),u_highlight:new d.aL(u,e.u_highlight),u_accent:new d.aL(u,e.u_accent)}),hillshadePrepare:(u,e)=>({u_matrix:new d.aJ(u,e.u_matrix),u_image:new d.aH(u,e.u_image),u_dimension:new d.aO(u,e.u_dimension),u_zoom:new d.aI(u,e.u_zoom),u_unpack:new d.aK(u,e.u_unpack)}),line:(u,e)=>({u_matrix:new d.aJ(u,e.u_matrix),u_ratio:new d.aI(u,e.u_ratio),u_device_pixel_ratio:new d.aI(u,e.u_device_pixel_ratio),u_units_to_pixels:new d.aO(u,e.u_units_to_pixels)}),lineGradient:(u,e)=>({u_matrix:new d.aJ(u,e.u_matrix),u_ratio:new d.aI(u,e.u_ratio),u_device_pixel_ratio:new d.aI(u,e.u_device_pixel_ratio),u_units_to_pixels:new d.aO(u,e.u_units_to_pixels),u_image:new d.aH(u,e.u_image),u_image_height:new d.aI(u,e.u_image_height)}),linePattern:(u,e)=>({u_matrix:new d.aJ(u,e.u_matrix),u_texsize:new d.aO(u,e.u_texsize),u_ratio:new d.aI(u,e.u_ratio),u_device_pixel_ratio:new d.aI(u,e.u_device_pixel_ratio),u_image:new d.aH(u,e.u_image),u_units_to_pixels:new d.aO(u,e.u_units_to_pixels),u_scale:new d.aN(u,e.u_scale),u_fade:new d.aI(u,e.u_fade)}),lineSDF:(u,e)=>({u_matrix:new d.aJ(u,e.u_matrix),u_ratio:new d.aI(u,e.u_ratio),u_device_pixel_ratio:new d.aI(u,e.u_device_pixel_ratio),u_units_to_pixels:new d.aO(u,e.u_units_to_pixels),u_patternscale_a:new d.aO(u,e.u_patternscale_a),u_patternscale_b:new d.aO(u,e.u_patternscale_b),u_sdfgamma:new d.aI(u,e.u_sdfgamma),u_image:new d.aH(u,e.u_image),u_tex_y_a:new d.aI(u,e.u_tex_y_a),u_tex_y_b:new d.aI(u,e.u_tex_y_b),u_mix:new d.aI(u,e.u_mix)}),raster:(u,e)=>({u_matrix:new d.aJ(u,e.u_matrix),u_tl_parent:new d.aO(u,e.u_tl_parent),u_scale_parent:new d.aI(u,e.u_scale_parent),u_buffer_scale:new d.aI(u,e.u_buffer_scale),u_fade_t:new d.aI(u,e.u_fade_t),u_opacity:new d.aI(u,e.u_opacity),u_image0:new d.aH(u,e.u_image0),u_image1:new d.aH(u,e.u_image1),u_brightness_low:new d.aI(u,e.u_brightness_low),u_brightness_high:new d.aI(u,e.u_brightness_high),u_saturation_factor:new d.aI(u,e.u_saturation_factor),u_contrast_factor:new d.aI(u,e.u_contrast_factor),u_spin_weights:new d.aN(u,e.u_spin_weights)}),symbolIcon:(u,e)=>({u_is_size_zoom_constant:new d.aH(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new d.aH(u,e.u_is_size_feature_constant),u_size_t:new d.aI(u,e.u_size_t),u_size:new d.aI(u,e.u_size),u_camera_to_center_distance:new d.aI(u,e.u_camera_to_center_distance),u_pitch:new d.aI(u,e.u_pitch),u_rotate_symbol:new d.aH(u,e.u_rotate_symbol),u_aspect_ratio:new d.aI(u,e.u_aspect_ratio),u_fade_change:new d.aI(u,e.u_fade_change),u_matrix:new d.aJ(u,e.u_matrix),u_label_plane_matrix:new d.aJ(u,e.u_label_plane_matrix
581),u_coord_matrix:new d.aJ(u,e.u_coord_matrix),u_is_text:new d.aH(u,e.u_is_text),u_pitch_with_map:new d.aH(u,e.u_pitch_with_map),u_is_along_line:new d.aH(u,e.u_is_along_line),u_is_variable_anchor:new d.aH(u,e.u_is_variable_anchor),u_texsize:new d.aO(u,e.u_texsize),u_texture:new d.aH(u,e.u_texture),u_translation:new d.aO(u,e.u_translation),u_pitched_scale:new d.aI(u,e.u_pitched_scale)}),symbolSDF:(u,e)=>({u_is_size_zoom_constant:new d.aH(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new d.aH(u,e.u_is_size_feature_constant),u_size_t:new d.aI(u,e.u_size_t),u_size:new d.aI(u,e.u_size),u_camera_to_center_distance:new d.aI(u,e.u_camera_to_center_distance),u_pitch:new d.aI(u,e.u_pitch),u_rotate_symbol:new d.aH(u,e.u_rotate_symbol),u_aspect_ratio:new d.aI(u,e.u_aspect_ratio),u_fade_change:new d.aI(u,e.u_fade_change),u_matrix:new d.aJ(u,e.u_matrix),u_label_plane_matrix:new d.aJ(u,e.u_label_plane_matrix),u_coord_matrix:new d.aJ(u,e.u_coord_matrix),u_is_text:new d.aH(u,e.u_is_text),u_pitch_with_map:new d.aH(u,e.u_pitch_with_map),u_is_along_line:new d.aH(u,e.u_is_along_line),u_is_variable_anchor:new d.aH(u,e.u_is_variable_anchor),u_texsize:new d.aO(u,e.u_texsize),u_texture:new d.aH(u,e.u_texture),u_gamma_scale:new d.aI(u,e.u_gamma_scale),u_device_pixel_ratio:new d.aI(u,e.u_device_pixel_ratio),u_is_halo:new d.aH(u,e.u_is_halo),u_translation:new d.aO(u,e.u_translation),u_pitched_scale:new d.aI(u,e.u_pitched_scale)}),symbolTextAndIcon:(u,e)=>({u_is_size_zoom_constant:new d.aH(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new d.aH(u,e.u_is_size_feature_constant),u_size_t:new d.aI(u,e.u_size_t),u_size:new d.aI(u,e.u_size),u_camera_to_center_distance:new d.aI(u,e.u_camera_to_center_distance),u_pitch:new d.aI(u,e.u_pitch),u_rotate_symbol:new d.aH(u,e.u_rotate_symbol),u_aspect_ratio:new d.aI(u,e.u_aspect_ratio),u_fade_change:new d.aI(u,e.u_fade_change),u_matrix:new d.aJ(u,e.u_matrix),u_label_plane_matrix:new d.aJ(u,e.u_label_plane_matrix),u_coord_matrix:new d.aJ(u,e.u_coord_matrix),u_is_text:new d.aH(u,e.u_is_text),u_pitch_with_map:new d.aH(u,e.u_pitch_with_map),u_is_along_line:new d.aH(u,e.u_is_along_line),u_is_variable_anchor:new d.aH(u,e.u_is_variable_anchor),u_texsize:new d.aO(u,e.u_texsize),u_texsize_icon:new d.aO(u,e.u_texsize_icon),u_texture:new d.aH(u,e.u_texture),u_texture_icon:new d.aH(u,e.u_texture_icon),u_gamma_scale:new d.aI(u,e.u_gamma_scale),u_device_pixel_ratio:new d.aI(u,e.u_device_pixel_ratio),u_is_halo:new d.aH(u,e.u_is_halo),u_translation:new d.aO(u,e.u_translation),u_pitched_scale:new d.aI(u,e.u_pitched_scale)}),background:(u,e)=>({u_matrix:new d.aJ(u,e.u_matrix),u_opacity:new d.aI(u,e.u_opacity),u_color:new d.aL(u,e.u_color)}),backgroundPattern:(u,e)=>({u_matrix:new d.aJ(u,e.u_matrix),u_opacity:new d.aI(u,e.u_opacity),u_image:new d.aH(u,e.u_image),u_pattern_tl_a:new d.aO(u,e.u_pattern_tl_a),u_pattern_br_a:new d.aO(u,e.u_pattern_br_a),u_pattern_tl_b:new d.aO(u,e.u_pattern_tl_b),u_pattern_br_b:new d.aO(u,e.u_pattern_br_b),u_texsize:new d.aO(u,e.u_texsize),u_mix:new d.aI(u,e.u_mix),u_pattern_size_a:new d.aO(u,e.u_pattern_size_a),u_pattern_size_b:new d.aO(u,e.u_pattern_size_b),u_scale_a:new d.aI(u,e.u_scale_a),u_scale_b:new d.aI(u,e.u_scale_b),u_pixel_coord_upper:new d.aO(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new d.aO(u,e.u_pixel_coord_lower),u_tile_units_to_pixels:new d.aI(u,e.u_tile_units_to_pixels)}),terrain:(u,e)=>({u_matrix:new d.aJ(u,e.u_matrix),u_texture:new d.aH(u,e.u_texture),u_ele_delta:new d.aI(u,e.u_ele_delta),u_fog_matrix:new d.aJ(u,e.u_fog_matrix),u_fog_color:new d.aL(u,e.u_fog_color),u_fog_ground_blend:new d.aI(u,e.u_fog_ground_blend),u_fog_ground_blend_opacity:new d.aI(u,e.u_fog_ground_blend_opacity),u_horizon_color:new d.aL(u,e.u_horizon_color),u_horizon_fog_blend:new d.aI(u,e.u_horizon_fog_blend)}),terrainDepth:(u,e)=>({u_matrix:new d.aJ(u,e.u_matrix),u_ele_delta:new d.aI(u,e.u_ele_delta)}),terrainCoords:(u,e)=>({u_matrix:new d.aJ(u,e.u_matrix),u_texture:new d.aH(u,e.u_texture),u_terrain_coords_id:new d.aI(u,e.u_terrain_coords_id),u_ele_delta:new d.aI(u,e.u_ele_delta)}),sky:(u,e)=>({u_sky_color:new d.aL(u,e.u_sky_color),u_horizon_color:new d.aL(u,e.u_horizon_color),u_horizon:new d.aI(u,e.u_horizon),u_sky_horizon_blend:new d.aI(u,e.u_sky_horizon_blend)})};class Yr{constructor(e,n,a){this.context=e;const o=e.gl;this.buffer=o.createBuffer(),this.dynamicDraw=!!a,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){const n=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Aa={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class qs{constructor(e,n,a,o){this.length=n.length,this.attributes=a,this.itemSize=n.bytesPerElement,this.dynamicDraw=o,this.context=e;const c=e.gl;this.buffer=c.createBuffer(),e.bindVertexBuffer.set(this.buffer),c.bufferData(c.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?c.DYNAMIC_DRAW:c.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);const n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,e.arrayBuffer)}
581enableAttributes(e,n){for(let a=0;a<this.attributes.length;a++){const o=n.attributes[this.attributes[a].name];o!==void 0&&e.enableVertexAttribArray(o)}}setVertexAttribPointers(e,n,a){for(let o=0;o<this.attributes.length;o++){const c=this.attributes[o],m=n.attributes[c.name];m!==void 0&&e.vertexAttribPointer(m,c.components,e[Aa[c.type]],!1,this.itemSize,c.offset+this.itemSize*(a||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const kn=new WeakMap;function zn(u){var e;if(kn.has(u))return kn.get(u);{const n=(e=u.getParameter(u.VERSION))===null||e===void 0?void 0:e.startsWith("WebGL 2.0");return kn.set(u,n),n}}class Ut{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Zs extends Ut{getDefault(){return d.aM.transparent}set(e){const n=this.current;(e.r!==n.r||e.g!==n.g||e.b!==n.b||e.a!==n.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class N extends Ut{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class ie extends Ut{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class me extends Ut{getDefault(){return[!0,!0,!0,!0]}set(e){const n=this.current;(e[0]!==n[0]||e[1]!==n[1]||e[2]!==n[2]||e[3]!==n[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Pe extends Ut{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class Be extends Ut{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class St extends Ut{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){const n=this.current;(e.func!==n.func||e.ref!==n.ref||e.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class bt extends Ut{getDefault(){const e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){const n=this.current;(e[0]!==n[0]||e[1]!==n[1]||e[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class ft extends Ut{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;e?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=e,this.dirty=!1}}class ir extends Ut{getDefault(){return[0,1]}set(e){const n=this.current;(e[0]!==n[0]||e[1]!==n[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class Li extends Ut{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;e?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=e,this.dirty=!1}}class Kr extends Ut{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class Jr extends Ut{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;e?n.enable(n.BLEND):n.disable(n.BLEND),this.current=e,this.dirty=!1}}class Gs extends Ut{getDefault(){const e=this.gl;return[e.ONE,e.ZERO]}set(e){const n=this.current;(e[0]!==n[0]||e[1]!==n[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}}class ys extends Ut{getDefault(){return d.aM.transparent}set(e){const n=this.current;(e.r!==n.r||e.g!==n.g||e.b!==n.b||e.a!==n.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class vr extends Ut{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class Oi extends Ut{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;e?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=e,this.dirty=!1}}class is extends Ut{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class Ri extends Ut{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class Qr extends Ut{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class vs extends Ut{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class Ea extends Ut{getDefault(){const e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){const n=this.current;(e[0]!==n[0]||e[1]!==n[1]||e[2]!==n[2]||e[3]!==n[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Dn extends Ut{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class pc extends Ut{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class ol extends Ut{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;n.bindTexture(n.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class fc extends Ut{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class lo extends Ut{getDefault(){return null}set(e){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Zn extends Ut{getDefault(){return null}set(e){var n;if(e===this.current&&!this.dirty)return;const a=this.gl;zn(a)?a.bindVertexArray(e):(n=a.getExtension("OES_vertex_array_object"))===null||n===void 0||n.bindVertexArrayOES(e),this.current=e,this.dirty=!1}}class ll extends Ut{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class cl extends Ut{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class ul extends Ut{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class co extends Ut{constructor(e,n){super(e),this.context=e,this.parent=n}getDefault(){return null}}class hl extends co{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class xs extends co{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class dl extends co{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class yu{constructor(e,n,a,o,c){this.context=e,this.width=n,this.height=a;const m=e.gl,_=this.framebuffer=m.createFramebuffer();
581if(this.colorAttachment=new hl(e,_),o)this.depthAttachment=c?new dl(e,_):new xs(e,_);else if(c)throw new Error("Stencil cannot be set without depth");if(m.checkFramebufferStatus(m.FRAMEBUFFER)!==m.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const e=this.context.gl,n=this.colorAttachment.get();if(n&&e.deleteTexture(n),this.depthAttachment){const a=this.depthAttachment.get();a&&e.deleteRenderbuffer(a)}e.deleteFramebuffer(this.framebuffer)}}class wi{constructor(e,n,a){this.blendFunction=e,this.blendColor=n,this.mask=a}}wi.Replace=[1,0],wi.disabled=new wi(wi.Replace,d.aM.transparent,[!1,!1,!1,!1]),wi.unblended=new wi(wi.Replace,d.aM.transparent,[!0,!0,!0,!0]),wi.alphaBlended=new wi([1,771],d.aM.transparent,[!0,!0,!0,!0]);class vu{constructor(e){var n,a;if(this.gl=e,this.clearColor=new Zs(this),this.clearDepth=new N(this),this.clearStencil=new ie(this),this.colorMask=new me(this),this.depthMask=new Pe(this),this.stencilMask=new Be(this),this.stencilFunc=new St(this),this.stencilOp=new bt(this),this.stencilTest=new ft(this),this.depthRange=new ir(this),this.depthTest=new Li(this),this.depthFunc=new Kr(this),this.blend=new Jr(this),this.blendFunc=new Gs(this),this.blendColor=new ys(this),this.blendEquation=new vr(this),this.cullFace=new Oi(this),this.cullFaceSide=new is(this),this.frontFace=new Ri(this),this.program=new Qr(this),this.activeTexture=new vs(this),this.viewport=new Ea(this),this.bindFramebuffer=new Dn(this),this.bindRenderbuffer=new pc(this),this.bindTexture=new ol(this),this.bindVertexBuffer=new fc(this),this.bindElementBuffer=new lo(this),this.bindVertexArray=new Zn(this),this.pixelStoreUnpack=new ll(this),this.pixelStoreUnpackPremultiplyAlpha=new cl(this),this.pixelStoreUnpackFlipY=new ul(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),zn(e)){this.HALF_FLOAT=e.HALF_FLOAT;const o=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(n=e.RGBA16F)!==null&&n!==void 0?n:o==null?void 0:o.RGBA16F_EXT,this.RGB16F=(a=e.RGB16F)!==null&&a!==void 0?a:o==null?void 0:o.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");const o=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=o==null?void 0:o.HALF_FLOAT_OES}}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.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,n){return new Yr(this,e,n)}createVertexBuffer(e,n,a){return new qs(this,e,n,a)}createRenderbuffer(e,n,a){const o=this.gl,c=o.createRenderbuffer();return this.bindRenderbuffer.set(c),o.renderbufferStorage(o.RENDERBUFFER,e,n,a),this.bindRenderbuffer.set(null),c}createFramebuffer(e,n,a,o){return new yu(this,e,n,a,o)}clear({color:e,depth:n,stencil:a}){const o=this.gl;let c=0;e&&(c|=o.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(c|=o.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),a!==void 0&&(c|=o.STENCIL_BUFFER_BIT,this.clearStencil.set(a),this.stencilMask.set(255)),o.clear(c)}setCullFace(e){e.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){d.aE(e.blendFunction,wi.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var e;return zn(this.gl)?this.gl.createVertexArray():(e=this.gl.getExtension("OES_vertex_array_object"))===null||e===void 0?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var n;return zn(this.gl)?this.gl.deleteVertexArray(e):(n=this.gl.getExtension("OES_vertex_array_object"))===null||n===void 0?void 0:n.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}}class Pt{constructor(e,n,a){this.func=e,this.mask=n,this.range=a}}Pt.ReadOnly=!1,Pt.ReadWrite=!0,Pt.disabled=new Pt(519,Pt.ReadOnly,[0,1]);const uo=7680;
581class ni{constructor(e,n,a,o,c,m){this.test=e,this.ref=n,this.mask=a,this.fail=o,this.depthFail=c,this.pass=m}}ni.disabled=new ni({func:519,mask:0},0,0,uo,uo,uo);class Qt{constructor(e,n,a){this.enable=e,this.mode=n,this.frontFace=a}}let bs;function Pa(u,e,n,a,o){const c=u.context,m=c.gl,_=u.useProgram("collisionBox"),y=[];let w=0,T=0;for(let W=0;W<a.length;W++){const J=a[W],j=e.getTile(J).getBucket(n);if(!j)continue;const ne=o?j.textCollisionBox:j.iconCollisionBox,se=j.collisionCircleArray;if(se.length>0){const ce=d.H();d.aQ(ce,j.placementInvProjMatrix,u.transform.glCoordMatrix),d.aQ(ce,ce,j.placementViewportMatrix),y.push({circleArray:se,circleOffset:T,transform:J.posMatrix,invTransform:ce,coord:J}),w+=se.length/4,T=w}ne&&_.draw(c,m.LINES,Pt.disabled,ni.disabled,u.colorModeForRenderPass(),Qt.disabled,{u_matrix:J.posMatrix,u_pixel_extrude_scale:[1/(I=u.transform).width,1/I.height]},u.style.map.terrain&&u.style.map.terrain.getTerrainData(J),n.id,ne.layoutVertexBuffer,ne.indexBuffer,ne.segments,null,u.transform.zoom,null,null,ne.collisionVertexBuffer)}var I;if(!o||!y.length)return;const k=u.useProgram("collisionCircle"),F=new d.aR;F.resize(4*w),F._trim();let V=0;for(const W of y)for(let J=0;J<W.circleArray.length/4;J++){const j=4*J,ne=W.circleArray[j+0],se=W.circleArray[j+1],ce=W.circleArray[j+2],ye=W.circleArray[j+3];F.emplace(V++,ne,se,ce,ye,0),F.emplace(V++,ne,se,ce,ye,1),F.emplace(V++,ne,se,ce,ye,2),F.emplace(V++,ne,se,ce,ye,3)}(!bs||bs.length<2*w)&&(bs=(function(W){const J=2*W,j=new d.aT;j.resize(J),j._trim();for(let ne=0;ne<J;ne++){const se=6*ne;j.uint16[se+0]=4*ne+0,j.uint16[se+1]=4*ne+1,j.uint16[se+2]=4*ne+2,j.uint16[se+3]=4*ne+2,j.uint16[se+4]=4*ne+3,j.uint16[se+5]=4*ne+0}return j})(w));const q=c.createIndexBuffer(bs,!0),H=c.createVertexBuffer(F,d.aS.members,!0);for(const W of y){const J=$n(W.transform,W.invTransform,u.transform);k.draw(c,m.TRIANGLES,Pt.disabled,ni.disabled,u.colorModeForRenderPass(),Qt.disabled,J,u.style.map.terrain&&u.style.map.terrain.getTerrainData(W.coord),n.id,H,q,d.a0.simpleSegment(0,2*W.circleOffset,W.circleArray.length,W.circleArray.length/2),null,u.transform.zoom,null,null,null)}H.destroy(),q.destroy()}Qt.disabled=new Qt(!1,1029,2305),Qt.backCCW=new Qt(!0,1029,2305);const Ca=d.an(new Float32Array(16));function pl(u,e,n,a,o,c){const{horizontalAlign:m,verticalAlign:_}=d.au(u);return new d.P((-(m-.5)*e/o+a[0])*c,(-(_-.5)*n/o+a[1])*c)}function ws(u,e,n,a,o,c){const m=e.tileAnchorPoint.add(new d.P(e.translation[0],e.translation[1]));if(e.pitchWithMap){let _=a.mult(c);n||(_=_.rotate(-o));const y=m.add(_);return Z(y.x,y.y,e.labelPlaneMatrix,e.getElevation).point}if(n){const _=fe(e.tileAnchorPoint.x+1,e.tileAnchorPoint.y,e).point.sub(u),y=Math.atan(_.y/_.x)+(_.x<0?Math.PI:0);return u.add(a.rotate(y))}return u.add(a)}function Hs(u,e,n,a,o,c,m,_,y,w,T,I,k,F){const V=u.text.placedSymbolArray,q=u.text.dynamicLayoutVertexArray,H=u.icon.dynamicLayoutVertexArray,W={};q.clear();for(let J=0;J<V.length;J++){const j=V.get(J),ne=j.hidden||!j.crossTileID||u.allowVerticalPlacement&&!j.placedOrientation?null:a[j.crossTileID];if(ne){const se=new d.P(j.anchorX,j.anchorY),ce={getElevation:F,width:o.width,height:o.height,labelPlaneMatrix:c,pitchWithMap:n,projection:T,tileAnchorPoint:se,translation:I,unwrappedTileID:k},ye=n?Z(se.x,se.y,m,F):fe(se.x,se.y,ce),Ie=C(o.cameraToCenterDistance,ye.signedDistanceFromCamera);let Re=d.ai(u.textSizeData,y,j)*Ie/d.ap;n&&(Re*=u.tilePixelRatio/_);const{width:Ue,height:ze,anchor:Me,textOffset:Je,textBoxScale:yt}=ne,De=pl(Me,Ue,ze,Je,yt,Re),Oe=T.getPitchedTextCorrection(o,se.add(new d.P(I[0],I[1])),k),gt=ws(ye.point,ce,e,De,o.angle,Oe),li=u.allowVerticalPlacement&&j.placedOrientation===d.ah.vertical?Math.PI/2:0;for(let At=0;At<j.numGlyphs;At++)d.aj(q,gt,li);w&&j.associatedIconIndex>=0&&(W[j.associatedIconIndex]={shiftedAnchor:gt,angle:li})}else rt(j.numGlyphs,q)}if(w){H.clear();const J=u.icon.placedSymbolArray;for(let j=0;j<J.length;j++){const ne=J.get(j);if(ne.hidden)rt(ne.numGlyphs,H);else{const se=W[j];if(se)for(let ce=0;ce<ne.numGlyphs;ce++)d.aj(H,se.shiftedAnchor,se.angle);else rt(ne.numGlyphs,H)}}u.icon.dynamicLayoutVertexBuffer.updateData(H)}u.text.dynamicLayoutVertexBuffer.updateData(q)}function en(u,e,n){return n.iconsInText&&e?"symbolTextAndIcon":u?"symbolSDF":"symbolIcon"}function fl(u,e,n,a,o,c,m,_,y,w,T,I){const k=u.context,F=k.gl,V=u.transform,q=fn(),H=_
581==="map",W=y==="map",J=_!=="viewport"&&n.layout.get("symbol-placement")!=="point",j=H&&!W&&!J,ne=!W&&J,se=!n.layout.get("symbol-sort-key").isConstant();let ce=!1;const ye=u.depthModeForSublayer(0,Pt.ReadOnly),Ie=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),Re=[],Ue=q.getCircleRadiusCorrection(V);for(const ze of a){const Me=e.getTile(ze),Je=Me.getBucket(n);if(!Je)continue;const yt=o?Je.text:Je.icon;if(!yt||!yt.segments.get().length||!yt.hasVisibleVertices)continue;const De=yt.programConfigurations.get(n.id),Oe=o||Je.sdfIcons,gt=o?Je.textSizeData:Je.iconSizeData,li=W||V.pitch!==0,At=u.useProgram(en(Oe,o,Je),De),Mt=d.ag(gt,V.zoom),ci=u.style.map.terrain&&u.style.map.terrain.getTerrainData(ze);let nr,yn,ui,Cr,xr=[0,0],sr=null;if(o)yn=Me.glyphAtlasTexture,ui=F.LINEAR,nr=Me.glyphAtlasTexture.size,Je.iconsInText&&(xr=Me.imageAtlasTexture.size,sr=Me.imageAtlasTexture,Cr=li||u.options.rotating||u.options.zooming||gt.kind==="composite"||gt.kind==="camera"?F.LINEAR:F.NEAREST);else{const Lt=n.layout.get("icon-size").constantOr(0)!==1||Je.iconsNeedLinear;yn=Me.imageAtlasTexture,ui=Oe||u.options.rotating||u.options.zooming||Lt||li?F.LINEAR:F.NEAREST,nr=Me.imageAtlasTexture.size}const br=Et(Me,1,u.transform.zoom),Bn=ne?ze.posMatrix:Ca,la=Er(Bn,W,H,u.transform,br),Mo=_r(Bn,W,H,u.transform,br),ca=_r(ze.posMatrix,W,H,u.transform,br),nn=q.translatePosition(u.transform,Me,c,m),ko=Ie&&Je.hasTextData(),Nl=n.layout.get("icon-text-fit")!=="none"&&ko&&Je.hasIconData();if(J){const Lt=u.style.map.terrain?(ua,ha)=>u.style.map.terrain.getElevation(ze,ua,ha):null,Es=n.layout.get("text-rotation-alignment")==="map";R(Je,ze.posMatrix,u,o,la,ca,W,w,Es,q,ze.toUnwrapped(),V.width,V.height,nn,Lt)}const sn=ze.posMatrix,an=o&&Ie||Nl,rs=J||an?Ca:la,vn=Mo,Wi=Oe&&n.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let ar;ar=Oe?Je.iconsInText?Ia(gt.kind,Mt,j,W,J,an,u,sn,rs,vn,nn,nr,xr,Ue):_s(gt.kind,Mt,j,W,J,an,u,sn,rs,vn,nn,o,nr,!0,Ue):oo(gt.kind,Mt,j,W,J,an,u,sn,rs,vn,nn,o,nr,Ue);const Ur={program:At,buffers:yt,uniformValues:ar,atlasTexture:yn,atlasTextureIcon:sr,atlasInterpolation:ui,atlasInterpolationIcon:Cr,isSDF:Oe,hasHalo:Wi};if(se&&Je.canOverlap){ce=!0;const Lt=yt.segments.get();
581for(const Es of Lt)Re.push({segments:new d.a0([Es]),sortKey:Es.sortKey,state:Ur,terrainData:ci})}else Re.push({segments:yt.segments,sortKey:0,state:Ur,terrainData:ci})}ce&&Re.sort(((ze,Me)=>ze.sortKey-Me.sortKey));for(const ze of Re){const Me=ze.state;if(k.activeTexture.set(F.TEXTURE0),Me.atlasTexture.bind(Me.atlasInterpolation,F.CLAMP_TO_EDGE),Me.atlasTextureIcon&&(k.activeTexture.set(F.TEXTURE1),Me.atlasTextureIcon&&Me.atlasTextureIcon.bind(Me.atlasInterpolationIcon,F.CLAMP_TO_EDGE)),Me.isSDF){const Je=Me.uniformValues;Me.hasHalo&&(Je.u_is_halo=1,ml(Me.buffers,ze.segments,n,u,Me.program,ye,T,I,Je,ze.terrainData)),Je.u_is_halo=0}ml(Me.buffers,ze.segments,n,u,Me.program,ye,T,I,Me.uniformValues,ze.terrainData)}}function ml(u,e,n,a,o,c,m,_,y,w){const T=a.context;o.draw(T,T.gl.TRIANGLES,c,m,_,Qt.disabled,y,w,n.id,u.layoutVertexBuffer,u.indexBuffer,e,n.paint,a.transform.zoom,u.programConfigurations.get(n.id),u.dynamicLayoutVertexBuffer,u.opacityVertexBuffer)}function gl(u,e,n,a){const o=u.context,c=o.gl,m=ni.disabled,_=new wi([c.ONE,c.ONE],d.aM.transparent,[!0,!0,!0,!0]),y=e.getBucket(n);if(!y)return;const w=a.key;let T=n.heatmapFbos.get(w);T||(T=Ma(o,e.tileSize,e.tileSize),n.heatmapFbos.set(w,T)),o.bindFramebuffer.set(T.framebuffer),o.viewport.set([0,0,e.tileSize,e.tileSize]),o.clear({color:d.aM.transparent});const I=y.programConfigurations.get(n.id),k=u.useProgram("heatmap",I),F=u.style.map.terrain.getTerrainData(a);k.draw(o,c.TRIANGLES,Pt.disabled,m,_,Qt.disabled,tr(a.posMatrix,e,u.transform.zoom,n.paint.get("heatmap-intensity")),F,n.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,n.paint,u.transform.zoom,I)}function Ss(u,e,n){const a=u.context,o=a.gl;a.setColorMode(u.colorModeForRenderPass());const c=ka(a,e),m=n.key,_=e.heatmapFbos.get(m);_&&(a.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,_.colorAttachment.get()),a.activeTexture.set(o.TEXTURE1),c.bind(o.LINEAR,o.CLAMP_TO_EDGE),u.useProgram("heatmapTexture").draw(a,o.TRIANGLES,Pt.disabled,ni.disabled,u.colorModeForRenderPass(),Qt.disabled,Ns(u,e,0,1),null,e.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments,e.paint,u.transform.zoom),_.destroy(),e.heatmapFbos.delete(m))}function Ma(u,e,n){var a,o;const c=u.gl,m=c.createTexture();c.bindTexture(c.TEXTURE_2D,m),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.LINEAR),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.LINEAR);const _=(a=u.HALF_FLOAT)!==null&&a!==void 0?a:c.UNSIGNED_BYTE,y=(o=u.RGBA16F)!==null&&o!==void 0?o:c.RGBA;c.texImage2D(c.TEXTURE_2D,0,y,e,n,0,c.RGBA,_,null);const w=u.createFramebuffer(e,n,!1,!1);return w.colorAttachment.set(m),w}function ka(u,e){return e.colorRampTexture||(e.colorRampTexture=new dt(u,e.colorRamp,u.gl.RGBA)),e.colorRampTexture}function Ws(u,e,n,a,o){if(!n||!a||!a.imageAtlas)return;const c=a.imageAtlas.patternPositions;let m=c[n.to.toString()],_=c[n.from.toString()];if(!m&&_&&(m=_),!_&&m&&(_=m),!m||!_){const y=o.getPaintProperty(e);m=c[y],_=c[y]}m&&_&&u.setConstantPatternPositions(m,_)}function za(u,e,n,a,o,c,m){const _=u.context.gl,y="fill-pattern",w=n.paint.get(y),T=w&&w.constantOr(1),I=n.getCrossfadeParameters();let k,F,V,q,H;m?(F=T&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",k=_.LINES):(F=T?"fillPattern":"fill",k=_.TRIANGLES);const W=w.constantOr(null);for(const J of a){const j=e.getTile(J);if(T&&!j.patternsLoaded())continue;const ne=j.getBucket(n);if(!ne)continue;const se=ne.programConfigurations.get(n.id),ce=u.useProgram(F,se),ye=u.style.map.terrain&&u.style.map.terrain.getTerrainData(J);T&&(u.context.activeTexture.set(_.TEXTURE0),j.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),se.updatePaintBuffers(I)),Ws(se,y,W,j,n);const Ie=ye?J:null,Re=u.translatePosMatrix(Ie?Ie.posMatrix:J.posMatrix,j,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(m){q=ne.indexBuffer2,H=ne.segments2;const Ue=[_.drawingBufferWidth,_.drawingBufferHeight];V=F==="fillOutlinePattern"&&T?no(Re,u,I,j,Ue):nl(Re,Ue)}else q=ne.indexBuffer,H=ne.segments,V=T?ro(Re,u,I,j):jn(Re);ce.draw(u.context,k,o,u.stencilModeForClipping(J),c,Qt.disabled,V,ye,n.id,ne.layoutVertexBuffer,q,H,n.paint,u.transform.zoom,se)}}
581function ho(u,e,n,a,o,c,m){const _=u.context,y=_.gl,w="fill-extrusion-pattern",T=n.paint.get(w),I=T.constantOr(1),k=n.getCrossfadeParameters(),F=n.paint.get("fill-extrusion-opacity"),V=T.constantOr(null);for(const q of a){const H=e.getTile(q),W=H.getBucket(n);if(!W)continue;const J=u.style.map.terrain&&u.style.map.terrain.getTerrainData(q),j=W.programConfigurations.get(n.id),ne=u.useProgram(I?"fillExtrusionPattern":"fillExtrusion",j);I&&(u.context.activeTexture.set(y.TEXTURE0),H.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),j.updatePaintBuffers(k)),Ws(j,w,V,H,n);const se=u.translatePosMatrix(q.posMatrix,H,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),ce=n.paint.get("fill-extrusion-vertical-gradient"),ye=I?Os(se,u,ce,F,q,k,H):Qn(se,u,ce,F);ne.draw(_,_.gl.TRIANGLES,o,c,m,Qt.backCCW,ye,J,n.id,W.layoutVertexBuffer,W.indexBuffer,W.segments,n.paint,u.transform.zoom,j,u.style.map.terrain&&W.centroidVertexBuffer)}}function Xs(u,e,n,a,o,c,m){const _=u.context,y=_.gl,w=n.fbo;if(!w)return;const T=u.useProgram("hillshade"),I=u.style.map.terrain&&u.style.map.terrain.getTerrainData(e);_.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,w.colorAttachment.get()),T.draw(_,y.TRIANGLES,o,c,m,Qt.disabled,((k,F,V,q)=>{const H=V.paint.get("hillshade-shadow-color"),W=V.paint.get("hillshade-highlight-color"),J=V.paint.get("hillshade-accent-color");let j=V.paint.get("hillshade-illumination-direction")*(Math.PI/180);V.paint.get("hillshade-illumination-anchor")==="viewport"&&(j-=k.transform.angle);const ne=!k.options.moving;return{u_matrix:q?q.posMatrix:k.transform.calculatePosMatrix(F.tileID.toUnwrapped(),ne),u_image:0,u_latrange:Vs(0,F.tileID),u_light:[V.paint.get("hillshade-exaggeration"),j],u_shadow:H,u_highlight:W,u_accent:J}})(u,n,a,I?e:null),I,a.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments)}function Ys(u,e,n,a,o,c){const m=u.context,_=m.gl,y=e.dem;if(y&&y.data){const w=y.dim,T=y.stride,I=y.getPixels();if(m.activeTexture.set(_.TEXTURE1),m.pixelStoreUnpackPremultiplyAlpha.set(!1),e.demTexture=e.demTexture||u.getTileTexture(T),e.demTexture){const F=e.demTexture;F.update(I,{premultiply:!1}),F.bind(_.NEAREST,_.CLAMP_TO_EDGE)}else e.demTexture=new dt(m,I,_.RGBA,{premultiply:!1}),e.demTexture.bind(_.NEAREST,_.CLAMP_TO_EDGE);m.activeTexture.set(_.TEXTURE0);let k=e.fbo;if(!k){const F=new dt(m,{width:w,height:w,data:null},_.RGBA);F.bind(_.LINEAR,_.CLAMP_TO_EDGE),k=e.fbo=m.createFramebuffer(w,w,!0,!1),k.colorAttachment.set(F.texture)}m.bindFramebuffer.set(k.framebuffer),m.viewport.set([0,0,w,w]),u.useProgram("hillshadePrepare").draw(m,_.TRIANGLES,a,o,c,Qt.disabled,((F,V)=>{const q=V.stride,H=d.H();return d.aP(H,0,d.X,-d.X,0,0,1),d.J(H,H,[0,-d.X,0]),{u_matrix:H,u_image:1,u_dimension:[q,q],u_zoom:F.overscaledZ,u_unpack:V.getUnpackVector()}})(e.tileID,y),null,n.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments),e.needsHillshadePrepare=!1}}function mc(u,e,n,a,o,c){const m=a.paint.get("raster-fade-duration");if(!c&&m>0){const _=de.now(),y=(_-u.timeAdded)/m,w=e?(_-e.timeAdded)/m:-1,T=n.getSource(),I=o.coveringZoomLevel({tileSize:T.tileSize,roundZoom:T.roundZoom}),k=!e||Math.abs(e.tileID.overscaledZ-I)>Math.abs(u.tileID.overscaledZ-I),F=k&&u.refreshedUponExpiration?1:d.ac(k?y:1-w,0,1);return u.refreshedUponExpiration&&y>=1&&(u.refreshedUponExpiration=!1),e?{opacity:1,mix:1-F}:{opacity:F,mix:0}}return{opacity:1,mix:0}}const _l=new d.aM(1,0,0,1),jt=new d.aM(0,1,0,1),po=new d.aM(0,0,1,1),xu=new d.aM(1,0,1,1),gc=new d.aM(0,1,1,1);function Ks(u,e,n,a){fo(u,0,e+n/2,u.transform.width,n,a)}function _c(u,e,n,a){fo(u,e-n/2,0,n,u.transform.height,a)}function fo(u,e,n,a,o,c){const m=u.context,_=m.gl;_.enable(_.SCISSOR_TEST),_.scissor(e*u.pixelRatio,n*u.pixelRatio,a*u.pixelRatio,o*u.pixelRatio),m.clear({color:c}),_.disable(_.SCISSOR_TEST)}function yc(u,e,n){const a=u.context,o=a.gl,c=n.posMatrix,m=u.useProgram("debug"),_=Pt.disabled,y=ni.disabled,w=u.colorModeForRenderPass(),T="$debug",I=u.style.map.terrain&&u.style.map.terrain.getTerrainData(n);a.activeTexture.set(o.TEXTURE0);const k=e.getTileByID(n.key).latestRawTileData,F=Math.floor((k&&k.b
581yteLength||0)/1024),V=e.getTile(n).tileSize,q=512/Math.min(V,512)*(n.overscaledZ/u.transform.zoom)*.5;let H=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(H+=` => ${n.overscaledZ}`),(function(W,J){W.initDebugOverlayCanvas();const j=W.debugOverlayCanvas,ne=W.context.gl,se=W.debugOverlayCanvas.getContext("2d");se.clearRect(0,0,j.width,j.height),se.shadowColor="white",se.shadowBlur=2,se.lineWidth=1.5,se.strokeStyle="white",se.textBaseline="top",se.font="bold 36px Open Sans, sans-serif",se.fillText(J,5,5),se.strokeText(J,5,5),W.debugOverlayTexture.update(j),W.debugOverlayTexture.bind(ne.LINEAR,ne.CLAMP_TO_EDGE)})(u,`${H} ${F}kB`),m.draw(a,o.TRIANGLES,_,y,wi.alphaBlended,Qt.disabled,es(c,d.aM.transparent,q),null,T,u.debugBuffer,u.quadTriangleIndexBuffer,u.debugSegments),m.draw(a,o.LINE_STRIP,_,y,w,Qt.disabled,es(c,d.aM.red),I,T,u.debugBuffer,u.tileBorderIndexBuffer,u.debugSegments)}function vc(u,e,n){const a=u.context,o=a.gl,c=u.colorModeForRenderPass(),m=new Pt(o.LEQUAL,Pt.ReadWrite,u.depthRangeFor3D),_=u.useProgram("terrain"),y=e.getTerrainMesh();a.bindFramebuffer.set(null),a.viewport.set([0,0,u.width,u.height]);for(const w of n){const T=u.renderToTexture.getTexture(w),I=e.getTerrainData(w.tileID);a.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,T.texture);const k=u.transform.calculatePosMatrix(w.tileID.toUnwrapped()),F=e.getMeshFrameDelta(u.transform.zoom),V=u.transform.calculateFogMatrix(w.tileID.toUnwrapped()),q=wa(k,F,V,u.style.sky,u.transform.pitch);_.draw(a,o.TRIANGLES,m,ni.disabled,c,Qt.backCCW,q,I,"terrain",y.vertexBuffer,y.indexBuffer,y.segments)}}class mo{constructor(e,n,a){this.vertexBuffer=e,this.indexBuffer=n,this.segments=a}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class go{constructor(e,n){this.context=new vu(e),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:d.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=it.maxUnderzooming+it.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new ms}resize(e,n,a){if(this.width=Math.floor(e*a),this.height=Math.floor(n*a),this.pixelRatio=a,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const o of this.style._order)this.style._layers[o].resize()}setup(){const e=this.context,n=new d.aX;n.emplaceBack(0,0),n.emplaceBack(d.X,0),n.emplaceBack(0,d.X),n.emplaceBack(d.X,d.X),this.tileExtentBuffer=e.createVertexBuffer(n,mn.members),this.tileExtentSegments=d.a0.simpleSegment(0,0,4,2);const a=new d.aX;a.emplaceBack(0,0),a.emplaceBack(d.X,0),a.emplaceBack(0,d.X),a.emplaceBack(d.X,d.X),this.debugBuffer=e.createVertexBuffer(a,mn.members),this.debugSegments=d.a0.simpleSegment(0,0,4,5);const o=new d.$;o.emplaceBack(0,0,0,0),o.emplaceBack(d.X,0,d.X,0),o.emplaceBack(0,d.X,0,d.X),o.emplaceBack(d.X,d.X,d.X,d.X),this.rasterBoundsBuffer=e.createVertexBuffer(o,pn.members),this.rasterBoundsSegments=d.a0.simpleSegment(0,0,4,2);const c=new d.aX;c.emplaceBack(0,0),c.emplaceBack(1,0),c.emplaceBack(0,1),c.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(c,mn.members),this.viewportSegments=d.a0.simpleSegment(0,0,4,2);const m=new d.aZ;m.emplaceBack(0),m.emplaceBack(1),m.emplaceBack(3),m.emplaceBack(2),m.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(m);const _=new d.aY;_.emplaceBack(0,1,2),_.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(_);const y=this.context.gl;this.stencilClearMode=new ni({func:y.ALWAYS,mask:0},0,255,y.ZERO,y.ZERO,y.ZERO)}clearStencil(){const e=this.context,n=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const a=d.H();d.aP(a,0,this.width,this.height,0,0,1),d.K(a,a,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,n.TRIANGLES,Pt.disabled,this.stencilClearMode,wi.disabled,Qt.disabled,er(a),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,n){if(this.currentStencilSource===e.source||!e.isTileClipped()||!n||!n.length)return;this.currentStencilSource=e.source;const a=this.context,o=a.gl;this.nextStencilID+n.length>256&&this.clearStencil(),a.setColorMode(wi.disabled),a.setDepthMode(Pt.disabled);const c=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const m of n){const _=this._tileClippingMaskIDs[m.key]=this.nextStencilID++,y=this.style.map.terrain&&this.style.map.terrain.getTerrainData(m);c.draw(a,o.TRIANGLES,Pt.disabled,new ni({func:o.ALWAYS,mask:0},_,255,o.KEEP,o.KEEP,o.REPLACE),wi.disabled,Qt.disabled,er(m.posMatrix),y,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,n=this.context.gl;return new ni({func:n.NOTEQUAL,mask:255},e,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(e){const n=this.context.gl;return new ni({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,n.KEEP,n.KEEP,n.REPLACE)}
581stencilConfigForOverlap(e){const n=this.context.gl,a=e.sort(((m,_)=>_.overscaledZ-m.overscaledZ)),o=a[a.length-1].overscaledZ,c=a[0].overscaledZ-o+1;if(c>1){this.currentStencilSource=void 0,this.nextStencilID+c>256&&this.clearStencil();const m={};for(let _=0;_<c;_++)m[_+o]=new ni({func:n.GEQUAL,mask:255},_+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=c,[m,a]}return[{[o]:ni.disabled},a]}colorModeForRenderPass(){const e=this.context.gl;return this._showOverdrawInspector?new wi([e.CONSTANT_COLOR,e.ONE],new d.aM(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?wi.unblended:wi.alphaBlended}depthModeForSublayer(e,n,a){if(!this.opaquePassEnabledForLayer())return Pt.disabled;const o=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new Pt(a||this.context.gl.LEQUAL,n,[o,o])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,n){this.style=e,this.options=n,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(de.now()),this.imageManager.beginFrame();const a=this.style._order,o=this.style.sourceCaches,c={},m={},_={};for(const y in o){const w=o[y];w.used&&w.prepare(this.context),c[y]=w.getVisibleCoordinates(),m[y]=c[y].slice().reverse(),_[y]=w.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let y=0;y<a.length;y++)if(this.style._layers[a[y]].is3D()){this.opaquePassCutoff=y;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const y of a){const w=this.style._layers[y];if(!w.hasOffscreenPass()||w.isHidden(this.transform.zoom))continue;const T=m[w.source];(w.type==="custom"||T.length)&&this.renderLayer(this,o[w.source],w,T)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?d.aM.black:d.aM.transparent,depth:1}),this.clearStencil(),this.style.sky&&(function(y,w){const T=y.context,I=T.gl,k=((W,J,j)=>({u_sky_color:W.properties.get("sky-color"),u_horizon_color:W.properties.get("horizon-color"),u_horizon:(J.height/2+J.getHorizon())*j,u_sky_horizon_blend:W.properties.get("sky-horizon-blend")*J.height/2*j}))(w,y.style.map.transform,y.pixelRatio),F=new Pt(I.LEQUAL,Pt.ReadWrite,[0,1]),V=ni.disabled,q=y.colorModeForRenderPass(),H=y.useProgram("sky");if(!w.mesh){const W=new d.aX;W.emplaceBack(-1,-1),W.emplaceBack(1,-1),W.emplaceBack(1,1),W.emplaceBack(-1,1);const J=new d.aY;J.emplaceBack(0,1,2),J.emplaceBack(0,2,3),w.mesh=new mo(T.createVertexBuffer(W,mn.members),T.createIndexBuffer(J),d.a0.simpleSegment(0,0,W.length,J.length))}H.draw(T,I.TRIANGLES,F,V,q,Qt.disabled,k,void 0,"sky",w.mesh.vertexBuffer,w.mesh.indexBuffer,w.mesh.segments)})(this,this.style.sky),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=a.length-1;this.currentLayer>=0;this.currentLayer--){const y=this.style._layers[a[this.currentLayer]],w=o[y.source],T=c[y.source];this._renderTileClippingMasks(y,T),this.renderLayer(this,w,y,T)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<a.length;this.currentLayer++){const y=this.style._layers[a[this.currentLayer]],w=o[y.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(y))continue;const T=(y.type==="symbol"?_:m)[y.source];this._renderTileClippingMasks(y,c[y.source]),this.renderLayer(this,w,y,T)}if(this.options.showTileBoundaries){const y=(function(w,T){let I=null;const k=Object.values(w._layers).flatMap((H=>H.source&&!H.isHidden(T)?[w.sourceCaches[H.source]]:[])),F=k.filter((H=>H.getSource().type==="vector")),V=k.filter((H=>H.getSource().type!=="vector")),q=H=>{(!I||I.getSource().maxzoom<H.getSource().maxzoom)&&(I=H)};return F.forEach((H=>q(H))),I||V.forEach((H=>q(H))),I})(this.style,this.transform.zoom);y&&(function(w,T,I){for(let k=0;k<I.length;k++)yc(w,T,I[k])})(this,y,y.getVisibleCoordinates())}this.options.showPadding&&(function(y){const w=y.transform.padding;Ks(y,y.transform.height-(w.top||0),3,_l),Ks(y,w.bottom||0,3,jt),_c(y,w.left||0,3,po),_c(y,y.transform.width-(w.right||0),3,xu);const T=y.transform.centerPoint;(function(I,k,F,V){fo(I,k-1,F-10,2,20,V),fo(I,k-10,F-1,20,2,V)})(y,T.x,y.transform.height-T.y,gc)})(this),this.context.setDefault()}maybeDrawDepthAndCoords(e){if(!this.style||!this.style.map||!this.style.map.terrain)return;const n=this.terrainFacilitator.matrix,a=this.transform.modelViewProjectionMatrix;let o=this.terrainFacilitator.dirty;o||(o=e?!d.a_(n,a):!d.a$(n,a)),o||(o=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),o&&(d.b0(n,a),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,(function(c,m){const _=c.context,y=_.gl,
581w=wi.unblended,T=new Pt(y.LEQUAL,Pt.ReadWrite,[0,1]),I=m.getTerrainMesh(),k=m.sourceCache.getRenderableTiles(),F=c.useProgram("terrainDepth");_.bindFramebuffer.set(m.getFramebuffer("depth").framebuffer),_.viewport.set([0,0,c.width/devicePixelRatio,c.height/devicePixelRatio]),_.clear({color:d.aM.transparent,depth:1});for(const V of k){const q=m.getTerrainData(V.tileID),H={u_matrix:c.transform.calculatePosMatrix(V.tileID.toUnwrapped()),u_ele_delta:m.getMeshFrameDelta(c.transform.zoom)};F.draw(_,y.TRIANGLES,T,ni.disabled,w,Qt.backCCW,H,q,"terrain",I.vertexBuffer,I.indexBuffer,I.segments)}_.bindFramebuffer.set(null),_.viewport.set([0,0,c.width,c.height])})(this,this.style.map.terrain),(function(c,m){const _=c.context,y=_.gl,w=wi.unblended,T=new Pt(y.LEQUAL,Pt.ReadWrite,[0,1]),I=m.getTerrainMesh(),k=m.getCoordsTexture(),F=m.sourceCache.getRenderableTiles(),V=c.useProgram("terrainCoords");_.bindFramebuffer.set(m.getFramebuffer("coords").framebuffer),_.viewport.set([0,0,c.width/devicePixelRatio,c.height/devicePixelRatio]),_.clear({color:d.aM.transparent,depth:1}),m.coordsIndex=[];for(const q of F){const H=m.getTerrainData(q.tileID);_.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,k.texture);const W={u_matrix:c.transform.calculatePosMatrix(q.tileID.toUnwrapped()),u_terrain_coords_id:(255-m.coordsIndex.length)/255,u_texture:0,u_ele_delta:m.getMeshFrameDelta(c.transform.zoom)};V.draw(_,y.TRIANGLES,T,ni.disabled,w,Qt.backCCW,W,H,"terrain",I.vertexBuffer,I.indexBuffer,I.segments),m.coordsIndex.push(q.tileID.key)}_.bindFramebuffer.set(null),_.viewport.set([0,0,c.width,c.height])})(this,this.style.map.terrain))}renderLayer(e,n,a,o){if(!a.isHidden(this.transform.zoom)&&(a.type==="background"||a.type==="custom"||(o||[]).length))switch(this.id=a.id,a.type){case"symbol":(function(c,m,_,y,w){if(c.renderPass!=="translucent")return;const T=ni.disabled,I=c.colorModeForRenderPass();(_._unevaluatedLayout.hasValue("text-variable-anchor")||_._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&(function(k,F,V,q,H,W,J,j,ne){const se=F.transform,ce=fn(),ye=H==="map",Ie=W==="map";for(const Re of k){const Ue=q.getTile(Re),ze=Ue.getBucket(V);if(!ze||!ze.text||!ze.text.segments.get().length)continue;const Me=d.ag(ze.textSizeData,se.zoom),Je=Et(Ue,1,F.transform.zoom),yt=Er(Re.posMatrix,Ie,ye,F.transform,Je),De=V.layout.get("icon-text-fit")!=="none"&&ze.hasIconData();if(Me){const Oe=Math.pow(2,se.zoom-Ue.tileID.overscaledZ),gt=F.style.map.terrain?(At,Mt)=>F.style.map.terrain.getElevation(Re,At,Mt):null,li=ce.translatePosition(se,Ue,J,j);Hs(ze,ye,Ie,ne,se,yt,Re.posMatrix,Oe,Me,De,ce,li,Re.toUnwrapped(),gt)}}})(y,c,_,m,_.layout.get("text-rotation-alignment"),_.layout.get("text-pitch-alignment"),_.paint.get("text-translate"),_.paint.get("text-translate-anchor"),w),_.paint.get("icon-opacity").constantOr(1)!==0&&fl(c,m,_,y,!1,_.paint.get("icon-translate"),_.paint.get("icon-translate-anchor"),_.layout.get("icon-rotation-alignment"),_.layout.get("icon-pitch-alignment"),_.layout.get("icon-keep-upright"),T,I),_.paint.get("text-opacity").constantOr(1)!==0&&fl(c,m,_,y,!0,_.paint.get("text-translate"),_.paint.get("text-translate-anchor"),_.layout.get("text-rotation-alignment"),_.layout.get("text-pitch-alignment"),_.layout.get("text-keep-upright"),T,I),m.map.showCollisionBoxes&&(Pa(c,m,_,y,!0),Pa(c,m,_,y,!1))})(e,n,a,o,this.style.placement.variableOffsets);break;case"circle":(function(c,m,_,y){if(c.renderPass!=="translucent")return;const w=_.paint.get("circle-opacity"),T=_.paint.get("circle-stroke-width"),I=_.paint.get("circle-stroke-opacity"),k=!_.layout.get("circle-sort-key").isConstant();if(w.constantOr(1)===0&&(T.constantOr(1)===0||I.constantOr(1)===0))return;const F=c.context,V=F.gl,q=c.depthModeForSublayer(0,Pt.ReadOnly),H=ni.disabled,W=c.colorModeForRenderPass(),J=[];for(let j=0;j<y.length;j++){const ne=y[j],se=m.getTile(ne),ce=se.getBucket(_);if(!ce)continue;const ye=ce.programConfigurations.get(_.id),Ie=c.useProgram("circle",ye),Re=ce.layoutVertexBuffer,Ue=ce.indexBuffer,ze=c.style.map.terrain&&c.style.map.terrain.getTerrainData(ne),Me={programConfiguration:ye,program:Ie,layoutVertexBuffer:Re,indexBuffer:Ue,uniformValues:sl(c,ne,se,_),terrainData:ze};
581if(k){const Je=ce.segments.get();for(const yt of Je)J.push({segments:new d.a0([yt]),sortKey:yt.sortKey,state:Me})}else J.push({segments:ce.segments,sortKey:0,state:Me})}k&&J.sort(((j,ne)=>j.sortKey-ne.sortKey));for(const j of J){const{programConfiguration:ne,program:se,layoutVertexBuffer:ce,indexBuffer:ye,uniformValues:Ie,terrainData:Re}=j.state;se.draw(F,V.TRIANGLES,q,H,W,Qt.disabled,Ie,Re,_.id,ce,ye,j.segments,_.paint,c.transform.zoom,ne)}})(e,n,a,o);break;case"heatmap":(function(c,m,_,y){if(_.paint.get("heatmap-opacity")===0)return;const w=c.context;if(c.style.map.terrain){for(const T of y){const I=m.getTile(T);m.hasRenderableParent(T)||(c.renderPass==="offscreen"?gl(c,I,_,T):c.renderPass==="translucent"&&Ss(c,_,T))}w.viewport.set([0,0,c.width,c.height])}else c.renderPass==="offscreen"?(function(T,I,k,F){const V=T.context,q=V.gl,H=ni.disabled,W=new wi([q.ONE,q.ONE],d.aM.transparent,[!0,!0,!0,!0]);(function(J,j,ne){const se=J.gl;J.activeTexture.set(se.TEXTURE1),J.viewport.set([0,0,j.width/4,j.height/4]);let ce=ne.heatmapFbos.get(d.aU);ce?(se.bindTexture(se.TEXTURE_2D,ce.colorAttachment.get()),J.bindFramebuffer.set(ce.framebuffer)):(ce=Ma(J,j.width/4,j.height/4),ne.heatmapFbos.set(d.aU,ce))})(V,T,k),V.clear({color:d.aM.transparent});for(let J=0;J<F.length;J++){const j=F[J];if(I.hasRenderableParent(j))continue;const ne=I.getTile(j),se=ne.getBucket(k);if(!se)continue;const ce=se.programConfigurations.get(k.id),ye=T.useProgram("heatmap",ce),{zoom:Ie}=T.transform;ye.draw(V,q.TRIANGLES,Pt.disabled,H,W,Qt.disabled,tr(j.posMatrix,ne,Ie,k.paint.get("heatmap-intensity")),null,k.id,se.layoutVertexBuffer,se.indexBuffer,se.segments,k.paint,T.transform.zoom,ce)}V.viewport.set([0,0,T.width,T.height])})(c,m,_,y):c.renderPass==="translucent"&&(function(T,I){const k=T.context,F=k.gl;k.setColorMode(T.colorModeForRenderPass());const V=I.heatmapFbos.get(d.aU);V&&(k.activeTexture.set(F.TEXTURE0),F.bindTexture(F.TEXTURE_2D,V.colorAttachment.get()),k.activeTexture.set(F.TEXTURE1),ka(k,I).bind(F.LINEAR,F.CLAMP_TO_EDGE),T.useProgram("heatmapTexture").draw(k,F.TRIANGLES,Pt.disabled,ni.disabled,T.colorModeForRenderPass(),Qt.disabled,Ns(T,I,0,1),null,I.id,T.viewportBuffer,T.quadTriangleIndexBuffer,T.viewportSegments,I.paint,T.transform.zoom))})(c,_)})(e,n,a,o);break;case"line":(function(c,m,_,y){if(c.renderPass!=="translucent")return;const w=_.paint.get("line-opacity"),T=_.paint.get("line-width");if(w.constantOr(1)===0||T.constantOr(1)===0)return;const I=c.depthModeForSublayer(0,Pt.ReadOnly),k=c.colorModeForRenderPass(),F=_.paint.get("line-dasharray"),V=_.paint.get("line-pattern"),q=V.constantOr(1),H=_.paint.get("line-gradient"),W=_.getCrossfadeParameters(),J=q?"linePattern":F?"lineSDF":H?"lineGradient":"line",j=c.context,ne=j.gl;let se=!0;for(const ce of y){const ye=m.getTile(ce);if(q&&!ye.patternsLoaded())continue;const Ie=ye.getBucket(_);if(!Ie)continue;const Re=Ie.programConfigurations.get(_.id),Ue=c.context.program.get(),ze=c.useProgram(J,Re),Me=se||ze.program!==Ue,Je=c.style.map.terrain&&c.style.map.terrain.getTerrainData(ce),yt=V.constantOr(null);if(yt&&ye.imageAtlas){const gt=ye.imageAtlas,li=gt.patternPositions[yt.to.toString()],At=gt.patternPositions[yt.from.toString()];li&&At&&Re.setConstantPatternPositions(li,At)}const De=Je?ce:null,Oe=q?qn(c,ye,_,W,De):F?al(c,ye,_,F,W,De):H?Ta(c,ye,_,Ie.lineClipsArray.length,De):gs(c,ye,_,De);if(q)j.activeTexture.set(ne.TEXTURE0),ye.imageAtlasTexture.bind(ne.LINEAR,ne.CLAMP_TO_EDGE),Re.updatePaintBuffers(W);else if(F&&(Me||c.lineAtlas.dirty))j.activeTexture.set(ne.TEXTURE0),c.lineAtlas.bind(j);else if(H){const gt=Ie.gradients[_.id];let li=gt.texture;if(_.gradientVersion!==gt.version){let At=256;if(_.stepInterpolant){const Mt=m.getSource().maxzoom,ci=ce.canonical.z===Mt?Math.ceil(1<<c.transform.maxZoom-ce.canonical.z):1;At=d.ac(d.aV(Ie.maxLineLength/d.X*1024*ci),256,j.maxTextureSize)}gt.gradient=d.aW({expression:_.gradientExpression(),evaluationKey:"lineProgress",resolution:At,image:gt.gradient||void 0,clips:Ie.lineClipsArray}),gt.texture?gt.texture.update(gt.gradient):gt.texture=new dt(j,gt.gradient,ne.RGBA),gt.version=_.gradientVersion,li=gt.texture}
581j.activeTexture.set(ne.TEXTURE0),li.bind(_.stepInterpolant?ne.NEAREST:ne.LINEAR,ne.CLAMP_TO_EDGE)}ze.draw(j,ne.TRIANGLES,I,c.stencilModeForClipping(ce),k,Qt.disabled,Oe,Je,_.id,Ie.layoutVertexBuffer,Ie.indexBuffer,Ie.segments,_.paint,c.transform.zoom,Re,Ie.layoutVertexBuffer2),se=!1}})(e,n,a,o);break;case"fill":(function(c,m,_,y){const w=_.paint.get("fill-color"),T=_.paint.get("fill-opacity");if(T.constantOr(1)===0)return;const I=c.colorModeForRenderPass(),k=_.paint.get("fill-pattern"),F=c.opaquePassEnabledForLayer()&&!k.constantOr(1)&&w.constantOr(d.aM.transparent).a===1&&T.constantOr(0)===1?"opaque":"translucent";if(c.renderPass===F){const V=c.depthModeForSublayer(1,c.renderPass==="opaque"?Pt.ReadWrite:Pt.ReadOnly);za(c,m,_,y,V,I,!1)}if(c.renderPass==="translucent"&&_.paint.get("fill-antialias")){const V=c.depthModeForSublayer(_.getPaintProperty("fill-outline-color")?2:0,Pt.ReadOnly);za(c,m,_,y,V,I,!0)}})(e,n,a,o);break;case"fill-extrusion":(function(c,m,_,y){const w=_.paint.get("fill-extrusion-opacity");if(w!==0&&c.renderPass==="translucent"){const T=new Pt(c.context.gl.LEQUAL,Pt.ReadWrite,c.depthRangeFor3D);if(w!==1||_.paint.get("fill-extrusion-pattern").constantOr(1))ho(c,m,_,y,T,ni.disabled,wi.disabled),ho(c,m,_,y,T,c.stencilModeFor3D(),c.colorModeForRenderPass());else{const I=c.colorModeForRenderPass();ho(c,m,_,y,T,ni.disabled,I)}}})(e,n,a,o);break;case"hillshade":(function(c,m,_,y){if(c.renderPass!=="offscreen"&&c.renderPass!=="translucent")return;const w=c.context,T=c.depthModeForSublayer(0,Pt.ReadOnly),I=c.colorModeForRenderPass(),[k,F]=c.renderPass==="translucent"?c.stencilConfigForOverlap(y):[{},y];for(const V of F){const q=m.getTile(V);q.needsHillshadePrepare!==void 0&&q.needsHillshadePrepare&&c.renderPass==="offscreen"?Ys(c,q,_,T,ni.disabled,I):c.renderPass==="translucent"&&Xs(c,V,q,_,T,k[V.overscaledZ],I)}w.viewport.set([0,0,c.width,c.height])})(e,n,a,o);break;case"raster":(function(c,m,_,y){if(c.renderPass!=="translucent"||_.paint.get("raster-opacity")===0||!y.length)return;const w=c.context,T=w.gl,I=m.getSource(),k=c.useProgram("raster"),F=c.colorModeForRenderPass(),[V,q]=I instanceof di?[{},y]:c.stencilConfigForOverlap(y),H=q[q.length-1].overscaledZ,W=!c.options.moving;for(const J of q){const j=c.depthModeForSublayer(J.overscaledZ-H,_.paint.get("raster-opacity")===1?Pt.ReadWrite:Pt.ReadOnly,T.LESS),ne=m.getTile(J);ne.registerFadeDuration(_.paint.get("raster-fade-duration"));const se=m.findLoadedParent(J,0),ce=m.findLoadedSibling(J),ye=mc(ne,se||ce||null,m,_,c.transform,c.style.map.terrain);let Ie,Re;const Ue=_.paint.get("raster-resampling")==="nearest"?T.NEAREST:T.LINEAR;w.activeTexture.set(T.TEXTURE0),ne.texture.bind(Ue,T.CLAMP_TO_EDGE,T.LINEAR_MIPMAP_NEAREST),w.activeTexture.set(T.TEXTURE1),se?(se.texture.bind(Ue,T.CLAMP_TO_EDGE,T.LINEAR_MIPMAP_NEAREST),Ie=Math.pow(2,se.tileID.overscaledZ-ne.tileID.overscaledZ),Re=[ne.tileID.canonical.x*Ie%1,ne.tileID.canonical.y*Ie%1]):ne.texture.bind(Ue,T.CLAMP_TO_EDGE,T.LINEAR_MIPMAP_NEAREST),ne.texture.useMipmap&&w.extTextureFilterAnisotropic&&c.transform.pitch>20&&T.texParameterf(T.TEXTURE_2D,w.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,w.extTextureFilterAnisotropicMax);const ze=c.style.map.terrain&&c.style.map.terrain.getTerrainData(J),Me=ze?J:null,Je=Me?Me.posMatrix:c.transform.calculatePosMatrix(J.toUnwrapped(),W),yt=ts(Je,Re||[0,0],Ie||1,ye,_);I instanceof di?k.draw(w,T.TRIANGLES,j,ni.disabled,F,Qt.disabled,yt,ze,_.id,I.boundsBuffer,c.quadTriangleIndexBuffer,I.boundsSegments):k.draw(w,T.TRIANGLES,j,V[J.overscaledZ],F,Qt.disabled,yt,ze,_.id,c.rasterBoundsBuffer,c.quadTriangleIndexBuffer,c.rasterBoundsSegments)}})(e,n,a,o);break;case"background":(function(c,m,_,y){const w=_.paint.get("background-color"),T=_.paint.get("background-opacity");if(T===0)return;const I=c.context,k=I.gl,F=c.transform,V=F.tileSize,q=_.paint.get("background-pattern");if(c.isPatternMissing(q))return;const H=!q&&w.a===1&&T===1&&c.opaquePassEnabledForLayer()?"opaque":"translucent";if(c.renderPass!==H)return;const W=ni.disabled,J=c.depthModeForSublayer(0,H==="opaque"?Pt.ReadWrite:Pt.ReadOnly),j=c.colorModeForRenderPass(),ne=c.useProgram(q?"backgroundPattern":"background"),se=y||F.coveringTiles({tileSize:V,terrain:c.style.map.terrain});q&&(I.activeTexture.set(k.TEXTURE0),c.imageManager.bind(c.context));const ce=_.getCrossfadeParameters();for(const ye of se){const Ie=y?ye.posMatrix:c.transform.calculatePosMatrix(ye.toUnwrapped()),Re=q?js(Ie,T,c,q,{tileID:ye,tileSize:V},ce):Us(Ie,T,w),Ue=c.style.map.terrain&&c.style.map.terrain.getTerrainData(ye);ne.draw(I,k.TRIANGLES,J,W,j,Qt.disabled,Re,Ue,_.id,c.tileExtentBuffer,c.quadTriangleIndexBuffer,c.tileExtentSegments)}})(e,0,a,o);break;
581case"custom":(function(c,m,_){const y=c.context,w=_.implementation;if(c.renderPass==="offscreen"){const T=w.prerender;T&&(c.setCustomLayerDefaults(),y.setColorMode(c.colorModeForRenderPass()),T.call(w,y.gl,c.transform.customLayerMatrix()),y.setDirty(),c.setBaseState())}else if(c.renderPass==="translucent"){c.setCustomLayerDefaults(),y.setColorMode(c.colorModeForRenderPass()),y.setStencilMode(ni.disabled);const T=w.renderingMode==="3d"?new Pt(c.context.gl.LEQUAL,Pt.ReadWrite,c.depthRangeFor3D):c.depthModeForSublayer(0,Pt.ReadOnly);y.setDepthMode(T),w.render(y.gl,c.transform.customLayerMatrix(),{farZ:c.transform.farZ,nearZ:c.transform.nearZ,fov:c.transform._fov,modelViewProjectionMatrix:c.transform.modelViewProjectionMatrix,projectionMatrix:c.transform.projectionMatrix}),y.setDirty(),c.setBaseState(),y.bindFramebuffer.set(null)}})(e,0,a)}}translatePosMatrix(e,n,a,o,c){if(!a[0]&&!a[1])return e;const m=c?o==="map"?this.transform.angle:0:o==="viewport"?-this.transform.angle:0;if(m){const w=Math.sin(m),T=Math.cos(m);a=[a[0]*T-a[1]*w,a[0]*w+a[1]*T]}const _=[c?a[0]:Et(n,a[0],this.transform.zoom),c?a[1]:Et(n,a[1],this.transform.zoom),0],y=new Float32Array(16);return d.J(y,e,_),y}saveTileTexture(e){const n=this._tileTextures[e.size[0]];n?n.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){const n=this._tileTextures[e];return n&&n.length>0?n.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const n=this.imageManager.getPattern(e.from.toString()),a=this.imageManager.getPattern(e.to.toString());return!n||!a}useProgram(e,n){this.cache=this.cache||{};const a=e+(n?n.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[a]||(this.cache[a]=new Sa(this.context,Mn[e],n,$s[e],this._showOverdrawInspector,this.style.map.terrain)),this.cache[a]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new dt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:e,drawingBufferHeight:n}=this.context.gl;return this.width!==e||this.height!==n}}class Js{constructor(e,n){this.points=e,this.planes=n}static fromInvProjectionMatrix(e,n,a){const o=Math.pow(2,a),c=[[-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((_=>{const y=1/(_=d.af([],_,e))[3]/n*o;return d.b1(_,_,[y,y,1/_[3],y])})),m=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((_=>{const y=(function(k,F){var V=F[0],q=F[1],H=F[2],W=V*V+q*q+H*H;return W>0&&(W=1/Math.sqrt(W)),k[0]=F[0]*W,k[1]=F[1]*W,k[2]=F[2]*W,k})([],(function(k,F,V){var q=F[0],H=F[1],W=F[2],J=V[0],j=V[1],ne=V[2];return k[0]=H*ne-W*j,k[1]=W*J-q*ne,k[2]=q*j-H*J,k})([],ot([],c[_[0]],c[_[1]]),ot([],c[_[2]],c[_[1]]))),w=-((T=y)[0]*(I=c[_[1]])[0]+T[1]*I[1]+T[2]*I[2]);var T,I;return y.concat(w)}));return new Js(c,m)}}class Qs{constructor(e,n){this.min=e,this.max=n,this.center=(function(a,o,c){return a[0]=.5*o[0],a[1]=.5*o[1],a[2]=.5*o[2],a})([],(function(a,o,c){return a[0]=o[0]+c[0],a[1]=o[1]+c[1],a[2]=o[2]+c[2],a})([],this.min,this.max))}quadrant(e){const n=[e%2==0,e<2],a=Ot(this.min),o=Ot(this.max);for(let c=0;c<n.length;c++)a[c]=n[c]?this.min[c]:this.center[c],o[c]=n[c]?this.center[c]:this.max[c];return o[2]=this.max[2],new Qs(a,o)}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]}intersects(e){const n=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],
5811],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let a=!0;for(let o=0;o<e.planes.length;o++){const c=e.planes[o];let m=0;for(let _=0;_<n.length;_++)d.b2(c,n[_])>=0&&m++;if(m===0)return 0;m!==n.length&&(a=!1)}if(a)return 2;for(let o=0;o<3;o++){let c=Number.MAX_VALUE,m=-Number.MAX_VALUE;for(let _=0;_<e.points.length;_++){const y=e.points[_][o]-this.min[o];c=Math.min(c,y),m=Math.max(m,y)}if(m<0||c>this.max[o]-this.min[o])return 0}return 1}}class ea{constructor(e=0,n=0,a=0,o=0){if(isNaN(e)||e<0||isNaN(n)||n<0||isNaN(a)||a<0||isNaN(o)||o<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=n,this.left=a,this.right=o}interpolate(e,n,a){return n.top!=null&&e.top!=null&&(this.top=d.y.number(e.top,n.top,a)),n.bottom!=null&&e.bottom!=null&&(this.bottom=d.y.number(e.bottom,n.bottom,a)),n.left!=null&&e.left!=null&&(this.left=d.y.number(e.left,n.left,a)),n.right!=null&&e.right!=null&&(this.right=d.y.number(e.right,n.right,a)),this}getCenter(e,n){const a=d.ac((this.left+e-this.right)/2,0,e),o=d.ac((this.top+n-this.bottom)/2,0,n);return new d.P(a,o)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new ea(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const yl=85.051129;class ta{constructor(e,n,a,o,c){this.tileSize=512,this._renderWorldCopies=c===void 0||!!c,this._minZoom=e||0,this._maxZoom=n||22,this._minPitch=a??0,this._maxPitch=o??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new d.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new ea,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const e=new ta(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return e.apply(this),e}apply(e){this.tileSize=e.tileSize,this.latRange=e.latRange,this.lngRange=e.lngRange,this.width=e.width,this.height=e.height,this._center=e._center,this._elevation=e._elevation,this.minElevationForCurrentTile=e.minElevationForCurrentTile,this.zoom=e.zoom,this.angle=e.angle,this._fov=e._fov,this._pitch=e._pitch,this._unmodified=e._unmodified,this._edgeInsets=e._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new d.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(e){const n=-d.b3(e,-180,180)*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=(function(){var a=new d.A(4);return d.A!=Float32Array&&(a[1]=0,a[2]=0),a[0]=1,a[3]=1,a})(),(function(a,o,c){var m=o[0],_=o[1],y=o[2],w=o[3],T=Math.sin(c),I=Math.cos(c);a[0]=m*I+y*T,a[1]=_*I+w*T,a[2]=m*-T+y*I,a[3]=_*-T+w*I})(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(e){const n=d.ac(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(e){e=Math.max(.01,Math.min(60,e)),this._fov!==e&&(this._unmodified=!1,this._fov=e/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(e){const n=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this.tileZoom=Math.max(0,Math.floor(n)),this.scale=this.zoomScale(n),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,n,a){this._unmodified=!1,this._edgeInsets.interpolate(e,n,a),this._constrain(),this._calcMatrices()}coveringZoomLevel(e){const n=(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(e){const n=[new d.b4(0,e)];if(this._renderWorldCopies){const a=this.pointCoordinate(new d.P(0,0)),o=this.pointCoordinate(new d.P(this.width,0)),c=this.pointCoordinate(new d.P(this.width,this.height)),m=this.pointCoordinate(new d.P(0,this.height)),_=Math.floor(Math.min(a.x,o.x,c.x,m.x)),y=Math.floor(Math.max(a.x,o.x,c.x,m.x)),w=1;for(let T=_-w;T<=y+w;T++)T!==0&&n.push(new d.b4(T,e))}return n}coveringTiles(e){var n,a;let o=this.coveringZoomLevel(e);const c=o;if(e.minzoom!==void 0&&o<e.minzoom)return[];e.maxzoom!==void 0&&o>e.maxzoom&&(o=e.maxzoom);const m=this.pointCoordinate(this.getCameraPoint()),_=d.Z.fromLngLat(this.center),y=Math.pow(2,o),w=[y*m.x,y*m.y,0],T=[y*_.x,y*_.y,0],I=Js.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,o);let k=e.minzoom||0;!e.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(k=o);const F=e.terrain?2/Math.min(this.tileSize,e.tileSize)*this.tileSize:3,V=j=>({aabb:new Qs([j*y,0,0],[(j+1)*y,y,0]),zoom:0,x:0,y:0,wrap:j,fullyVisible:!1}),q=[],H=[],W=o,J=e.reparseOverscaled?c:o;if(this._renderWorldCopies)for(let j=1;j<=3;j++)q.push(V(-j)),q.push(V(j));for(q.push(V(0));q.length>0;){const j=q.pop(),ne=j.x,se=j.y;let ce=j.fullyVisible;if(!ce){const ze=j.aabb.intersects(I);if(ze===0)continue;ce=ze===2}const ye=e.terrain?w:T,Ie=j.aabb.distanceX(ye),Re=j.aabb.distanceY(ye),Ue=Math.max(Math.abs(Ie),Math.abs(Re));if(j.zoom===W||Ue>F+(1<<W-j.zoom)-2&&j.zoom>=k){const ze=W-j.zoom,Me=w[0]-.5-(ne<<ze),Je=w[1]-.5-(se<<ze);H.push({tileID:new d.S(j.zoom===W?J:j.zoom,j.wrap,j.zoom,ne,se),distanceSq:ge([T[0]-.5-ne,T[1]-.5-se]),tileDistanceToCamera:Math.sqrt(Me*Me+Je*Je)})}else for(let ze=0;ze<4;ze++){const Me=(ne<<1)+ze%2,Je=(se<<1)+(ze>>1),yt=j.zoom+1;let De=j.aabb.quadrant(ze);if(e.terrain){const Oe=new d.S(yt,j.wrap,yt,Me,Je),gt=e.terrain.getMinMaxElevation(Oe),li=(n=gt.minElevation)!==null&&n!==void 0?n:this.elevation,At=(a=gt.maxElevation)!==null&&a!==void 0?a:this.elevation;De=new Qs([De.min[0],De.min[1],li],[De.max[0],De.max[1],At])}q.push({aabb:De,zoom:yt,x:Me,y:Je,wrap:j.wrap,fullyVisible:ce})}}return H.sort(((j,ne)=>j.distanceSq-ne.distanceSq)).map((j=>j.tileID))}resize(e,n){this.width=e,this.height=n,this.pixelsToGLUnits=[2/e,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(e){const n=d.ac(e.lat,-85.051129,yl);return new d.P(d.O(e.lng)*this.worldSize,d.Q(n)*this.worldSize)}unproject(e){return new d.Z(e.x/this.worldSize,e.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),alt
581itude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(e){const n=this.elevation,a=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,o=this.pointLocation(this.centerPoint,e),c=e.getElevationForLngLatZoom(o,this.tileZoom);if(!(this.elevation-c))return;const m=a+n-c,_=Math.cos(this._pitch)*this.cameraToCenterDistance/m/d.b5(1,o.lat),y=this.scaleZoom(_/this.tileSize);this._elevation=c,this._center=o,this.zoom=y}setLocationAtPoint(e,n){const a=this.pointCoordinate(n),o=this.pointCoordinate(this.centerPoint),c=this.locationCoordinate(e),m=new d.Z(c.x-(a.x-o.x),c.y-(a.y-o.y));this.center=this.coordinateLocation(m),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(e,n){return n?this.coordinatePoint(this.locationCoordinate(e),n.getElevationForLngLatZoom(e,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(e))}pointLocation(e,n){return this.coordinateLocation(this.pointCoordinate(e,n))}locationCoordinate(e){return d.Z.fromLngLat(e)}coordinateLocation(e){return e&&e.toLngLat()}pointCoordinate(e,n){if(n){const k=n.pointCoordinate(e);if(k!=null)return k}const a=[e.x,e.y,0,1],o=[e.x,e.y,1,1];d.af(a,a,this.pixelMatrixInverse),d.af(o,o,this.pixelMatrixInverse);const c=a[3],m=o[3],_=a[1]/c,y=o[1]/m,w=a[2]/c,T=o[2]/m,I=w===T?0:(0-w)/(T-w);return new d.Z(d.y.number(a[0]/c,o[0]/m,I)/this.worldSize,d.y.number(_,y,I)/this.worldSize)}coordinatePoint(e,n=0,a=this.pixelMatrix){const o=[e.x*this.worldSize,e.y*this.worldSize,n,1];return d.af(o,o,a),new d.P(o[0]/o[3],o[1]/o[3])}getBounds(){const e=Math.max(0,this.height/2-this.getHorizon());return new he().extend(this.pointLocation(new d.P(0,e))).extend(this.pointLocation(new d.P(this.width,e))).extend(this.pointLocation(new d.P(this.width,this.height))).extend(this.pointLocation(new d.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new he([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(e){e?(this.lngRange=[e.getWest(),e.getEast()],this.latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,yl])}calculateTileMatrix(e){const n=e.canonical,a=this.worldSize/this.zoomScale(n.z),o=n.x+Math.pow(2,n.z)*e.wrap,c=d.an(new Float64Array(16));return d.J(c,c,[o*a,n.y*a,0]),d.K(c,c,[a/d.X,a/d.X,1]),c}calculatePosMatrix(e,n=!1){const a=e.key,o=n?this._alignedPosMatrixCache:this._posMatrixCache;if(o[a])return o[a];const c=this.calculateTileMatrix(e);return d.L(c,n?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,c),o[a]=new Float32Array(c),o[a]}calculateFogMatrix(e){const n=e.key,a=this._fogMatrixCache;if(a[n])return a[n];const o=this.calculateTileMatrix(e);return d.L(o,this.fogMatrix,o),a[n]=new Float32Array(o),a[n]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(e,n){n=d.ac(+n,this.minZoom,this.maxZoom);const a={center:new d.N(e.lng,e.lat),zoom:n};let o=this.lngRange;if(!this._renderWorldCopies&&o===null){const j=179.9999999999;o=[-j,j]}const c=this.tileSize*this.zoomScale(a.zoom);let m=0,_=c,y=0,w=c,T=0,I=0;const{x:k,y:F}=this.size;if(this.latRange){const j=this.latRange;m=d.Q(j[1])*c,_=d.Q(j[0])*c,_-m<F&&(T=F/(_-m))}o&&(y=d.b3(d.O(o[0])*c,0,c),w=d.b3(d.O(o[1])*c,0,c),w<y&&(w+=c),w-y<k&&(I=k/(w-y)));const{x:V,y:q}=this.project.call({worldSize:c},e);let H,W;const J=Math.max(I||0,T||0);if(J){const j=new d.P(I?(w+y)/2:V,T?(_+m)/2:q);return a.center=this.unproject.call({worldSize:c},j).wrap(),a.zoom+=this.scaleZoom(J),a}if(this.latRange){const j=F/2;q-j<m&&(W=m+j),q+j>_&&(W=_-j)}if(o){const j=(y+w)/2;let ne=V;
581this._renderWorldCopies&&(ne=d.b3(V,j-c/2,j+c/2));const se=k/2;ne-se<y&&(H=y+se),ne+se>w&&(H=w-se)}if(H!==void 0||W!==void 0){const j=new d.P(H??V,W??q);a.center=this.unproject.call({worldSize:c},j).wrap()}return a}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const e=this._unmodified,{center:n,zoom:a}=this.getConstrained(this.center,this.zoom);this.center=n,this.zoom=a,this._unmodified=e,this._constraining=!1}_calcMatrices(){if(!this.height)return;const e=this.centerOffset,n=this.point.x,a=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=d.b5(1,this.center.lat)*this.worldSize;let o=d.an(new Float64Array(16));d.K(o,o,[this.width/2,-this.height/2,1]),d.J(o,o,[1,-1,0]),this.labelPlaneMatrix=o,o=d.an(new Float64Array(16)),d.K(o,o,[1,-1,1]),d.J(o,o,[-1,-1,0]),d.K(o,o,[2/this.width,2/this.height,1]),this.glCoordMatrix=o;const c=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),m=Math.min(this.elevation,this.minElevationForCurrentTile),_=c-m*this._pixelPerMeter/Math.cos(this._pitch),y=m<0?_:c,w=Math.PI/2+this._pitch,T=this._fov*(.5+e.y/this.height),I=Math.sin(T)*y/Math.sin(d.ac(Math.PI-w-T,.01,Math.PI-.01)),k=this.getHorizon(),F=2*Math.atan(k/this.cameraToCenterDistance)*(.5+e.y/(2*k)),V=Math.sin(F)*y/Math.sin(d.ac(Math.PI-w-F,.01,Math.PI-.01)),q=Math.min(I,V);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*q+y),this.nearZ=this.height/50,o=new Float64Array(16),d.b6(o,this._fov,this.width/this.height,this.nearZ,this.farZ),o[8]=2*-e.x/this.width,o[9]=2*e.y/this.height,this.projectionMatrix=d.ae(o),d.K(o,o,[1,-1,1]),d.J(o,o,[0,0,-this.cameraToCenterDistance]),d.b7(o,o,this._pitch),d.ad(o,o,this.angle),d.J(o,o,[-n,-a,0]),this.mercatorMatrix=d.K([],o,[this.worldSize,this.worldSize,this.worldSize]),d.K(o,o,[1,1,this._pixelPerMeter]),this.pixelMatrix=d.L(new Float64Array(16),this.labelPlaneMatrix,o),d.J(o,o,[0,0,-this.elevation]),this.modelViewProjectionMatrix=o,this.invModelViewProjectionMatrix=d.as([],o),this.fogMatrix=new Float64Array(16),d.b6(this.fogMatrix,this._fov,this.width/this.height,c,this.farZ),this.fogMatrix[8]=2*-e.x/this.width,this.fogMatrix[9]=2*e.y/this.height,d.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),d.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),d.b7(this.fogMatrix,this.fogMatrix,this._pitch),d.ad(this.fogMatrix,this.fogMatrix,this.angle),d.J(this.fogMatrix,this.fogMatrix,[-n,-a,0]),d.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),d.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=d.L(new Float64Array(16),this.labelPlaneMatrix,o);const H=this.width%2/2,W=this.height%2/2,J=Math.cos(this.angle),j=Math.sin(this.angle),ne=n-Math.round(n)+J*H+j*W,se=a-Math.round(a)+J*W+j*H,ce=new Float64Array(o);if(d.J(ce,ce,[ne>.5?ne-1:ne,se>.5?se-1:se,0]),this.alignedModelViewProjectionMatrix=ce,o=d.as(new Float64Array(16),this.pixelMatrix),!o)throw new Error("failed to invert matrix");this.pixelMatrixInverse=o,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const e=this.pointCoordinate(new d.P(0,0)),n=[e.x*this.worldSize,e.y*this.worldSize,0,1];return d.af(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new d.P(0,e))}getCameraQueryGeometry(e){const n=this.getCameraPoint();if(e.length===1)return[e[0],n];{let a=n.x,o=n.y,c=n.x,m=n.y;for(const _ of e)a=Math.min(a,_.x),o=Math.min(o,_.y),c=Math.max(c,_.x),m=Math.max(m,_.y
581);return[new d.P(a,o),new d.P(c,o),new d.P(c,m),new d.P(a,m),new d.P(a,o)]}}lngLatToCameraDepth(e,n){const a=this.locationCoordinate(e),o=[a.x*this.worldSize,a.y*this.worldSize,n,1];return d.af(o,o,this.modelViewProjectionMatrix),o[2]/o[3]}}function Da(u,e){let n,a=!1,o=null,c=null;const m=()=>{o=null,a&&(u.apply(c,n),o=setTimeout(m,e),a=!1)};return(..._)=>(a=!0,c=this,n=_,o||m(),o)}class _o{constructor(e){this._getCurrentHash=()=>{const n=window.location.hash.replace("#","");if(this._hashName){let a;return n.split("&").map((o=>o.split("="))).forEach((o=>{o[0]===this._hashName&&(a=o)})),(a&&a[1]||"").split("/")}return n.split("/")},this._onHashChange=()=>{const n=this._getCurrentHash();if(n.length>=3&&!n.some((a=>isNaN(a)))){const a=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(n[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+n[2],+n[1]],zoom:+n[0],bearing:a,pitch:+(n[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const n=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,n)},this._removeHash=()=>{const n=this._getCurrentHash();if(n.length===0)return;const a=n.join("/");let o=a;o.split("&").length>0&&(o=o.split("&")[0]),this._hashName&&(o=`${this._hashName}=${a}`);let c=window.location.hash.replace(o,"");c.startsWith("#&")?c=c.slice(0,1)+c.slice(2):c==="#"&&(c="");let m=window.location.href.replace(/(#.+)?$/,c);m=m.replace("&&","&"),window.history.replaceState(window.history.state,null,m)},this._updateHash=Da(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){const n=this._map.getCenter(),a=Math.round(100*this._map.getZoom())/100,o=Math.ceil((a*Math.LN2+Math.log(512/360/.5))/Math.LN10),c=Math.pow(10,o),m=Math.round(n.lng*c)/c,_=Math.round(n.lat*c)/c,y=this._map.getBearing(),w=this._map.getPitch();let T="";if(T+=e?`/${m}/${_}/${a}`:`${a}/${_}/${m}`,(y||w)&&(T+="/"+Math.round(10*y)/10),w&&(T+=`/${Math.round(w)}`),this._hashName){const I=this._hashName;let k=!1;const F=window.location.hash.slice(1).split("&").map((V=>{const q=V.split("=")[0];return q===I?(k=!0,`${q}=${T}`):V})).filter((V=>V));return k||F.push(`${I}=${T}`),`#${F.join("&")}`}return`#${T}`}}const yo={linearity:.3,easing:d.b8(0,0,.3,1)},vl=d.e({deceleration:2500,maxSpeed:1400},yo),bu=d.e({deceleration:20,maxSpeed:1400},yo),xc=d.e({deceleration:1e3,maxSpeed:360},yo),vo=d.e({deceleration:1e3,maxSpeed:90},yo);class xl{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:de.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,n=de.now();for(;e.length>0&&n-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new d.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:c}of this._inertiaBuffer)n.zoom+=c.zoomDelta||0,n.bearing+=c.bearingDelta||0,n.pitch+=c.pitchDelta||0,c.panDelta&&n.pan._add(c.panDelta),c.around&&(n.around=c.around),c.pinchAround&&(n.pinchAround=c.pinchAround);const a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,o={};if(n.pan.mag()){const c=Ra(n.pan.mag(),a,d.e({},vl,e||{}));o.offset=n.pan.mult(c.amount/n.pan.mag()),o.center=this._map.transform.center,La(o,c)}if(n.zoom){const c=Ra(n.zoom,a,bu);o.zoom=this._map.transform.zoom+c.amount,La(o,c)}if(n.bearing){const c=Ra(n.bearing,a,xc);o.bearing=this._map.transform.bearing+d.ac(c.amount,-179,179),La(o,c)}if(n.pitch){const c=Ra(n.pitch,a,vo);o.pitch=this._map.transform.pitch+c.amount,La(o,c)}if(o.zoom||o.bearing){const c=n.pinchAround===void 0?n.around:n.pinchAround;o.around=c?this._map.unproject(c):this._map.getCenter()}return this.clear(),d.e(o,{noMoveStart:!0})}}function La(u,e){(!u.duration||u.duration<e.duration)&&(u.duration=e.duration,u.easing=e.easing)}function Ra(u,e,n){const{maxSpeed:a,linearity:o,deceleration:c}=n,m=d.ac(u*o/(e/1e3),-a,a),_=Math.abs(m)/(c*o);return{easing:n.easing,duration:1e3*_,amount:m*(_/2)}}class rr extends d.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,n,a,o={}){const c=K.mousePos(n.getCanvas(),a),m=n.unproject(c);super(e,d.e({point:c,lngLat:m,originalEvent:a},o)),this._defaultPrevented=!1,this.target=n}}class Ts extends d.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,n,a){const o=e==="touchend"?a.changedTouches:a.touches,c=K.touchPos(n.getCanvasContainer(),o),m=c.map((y=>n.unproject(y))),_=c.reduce(((y,w,T,I)=>y.add(w.div(I.length))),new d.P(0,0));super(e,{points:c,point:_,lngLats:m,lngLat:n.unproject(_),originalEvent:a}),this._defaultPrevented=!1}}class bc extends d.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,n,a){super(e,{originalEvent:a}),this._defaultPrevented=!1}}class wc{constructor(e,n){this._map=e,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new bc(e.type,this._map,e))}mousedown(e,n){return this._mousedownPos=n,this._firePreventable(new rr(e.type,this._map,e))}mouseup(e){this._map.fire(new rr(e.type,this._map,e))}click(e,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new rr(e.type,this._map,e))}dblclick(e){return this._firePreventable(new rr(e.type,this._map,e))}mouseover(e){this._map.fire(new rr(e.type,this._map,e))}mouseout(e){this._map.fire(new rr(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Ts(e.type,this._map,e))}touchmove(e){this._map.fire(new Ts(e.type,this._map,e))}touchend(e){this._map.fire(new Ts(e.type,this._map,e))}touchcancel(e){this._map.fire(new Ts(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Si{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new rr(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new rr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new rr(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class gn{constructor(e){this._map=e}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.pointLocation(d.P.convert(e),this._map.terrain)}}class Nr{constructor(e,n){this._map=e,this._tr=new gn(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=n.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,n){this.isEnabled()&&e.shiftKey&&e.button===0&&(K.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(e,n){if(!this._active)return;const a=n;if(this._lastPos.equals(a)||!this._box&&a.dist(this._startPos)<this._clickTolerance)return;const o=this._startPos;this._lastPos=a,this._box||(this._box=K.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));const c=Math.min(o.x,a.x),m=Math.max(o.x,a.x),_=Math.min(o.y,a.y),y=Math.max(o.y,a.y);K.setTransform(this._box,`translate(${c}px,${_}px)`),this._box.style.width=m-c+"px",this._box.style.height=y-_+"px"}mouseupWindow(e,n){if(!this._active||e.button!==0)return;const a=this._startPos,o=n;if(this.reset(),K.suppressClick(),a.x!==o.x||a.y!==o.y)return this._map.fire(new d.k("boxzoomend",{originalEvent:e})),{cameraAnimation:c=>c.fitScreenCoordinates(a,o,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(K.remove(this._box),this._box=null),K.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,n){return this._map.fire(new d.k(e,{originalEvent:n}))}}function Ba(u,e){if(u.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${u.length}, points ${e.length}`);const n={};for(let a=0;a<u.length;a++)n[u[a].identifier]=e[a];return n}class bl{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,n,a){(this.centroid||a.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),a.length===this.numTouches&&(this.centroid=(function(o){const c=new d.P(0,0);for(const m of o)c._add(m);return c.div(o.length)})(n),this.touches=Ba(a,n)))}touchmove(e,n,a){if(this.aborted||!this.centroid)return;const o=Ba(a,n);for(const c in this.touches){const m=o[c];(!m||m.dist(this.touches[c])>30)&&(this.aborted=!0)}}touchend(e,n,a){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),a.length===0){const o=!this.aborted&&this.centroid;if(this.reset(),o)return o}}}class xo{constructor(e){this.singleTap=new bl(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,n,a){this.singleTap.touchstart(e,n,a)}touchmove(e,n,a){this.singleTap.touchmove(e,n,a)}touchend(e,n,a){const o=this.singleTap.touchend(e,n,a);if(o){const c=e.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(o)<30;if(c&&m||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=o,this.count===this.numTaps)return this.reset(),o}}}class ia{constructor(e){this._tr=new gn(e),this._zoomIn=new xo({numTouches:1,numTaps:2}),this._zoomOut=new xo({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,n,a){this._zoomIn.touchstart(e,n,a),this._zoomOut.touchstart(e,n,a)}touchmove(e,n,a){this._zoomIn.touchmove(e,n,a),this._zoomOut.touchmove(e,n,a)}touchend(e,n,a){const o=this._zoomIn.touchend(e,n,a),c=this._zoomOut.touchend(e,n,a),m=this._tr;return o?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:m.zoom+1,around:m.unproject(o)},{originalEvent:e})}):c?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:m.zoom-1,around:m.unproject(c)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Gn{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){const n=this._moveFunction(...e);if(n.bearingDelta||n.pitchDelta||n.around||n.panDelta)return this._active=!0,n}dragStart(e,n){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=n.length?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,n){if(!this.isEnabled())return;const a=this._lastPoint;if(!a)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);const o=n.length?n[0]:n;return!this._moved&&o.dist(a)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=o,this._move(a,o))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&K.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const wl={0:1,2:2};class bo{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const n=K.mouseButton(e);this._eventButton=n}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!(function(n,a){const o=wl[a];return n.buttons===void 0||(n.buttons&o)!==o})(e,this._eventButton)}isValidEndEvent(e){return K.mouseButton(e)===this._eventButton}}class Sl{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return e.targetTouches.length===1}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}}const wo=u=>{u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=e=>{e.preventDefault()}},Tl=({enable:u,clickTolerance:e,bearingDegreesPerPixelMoved:n=.8})=>{const a=new bo({checkCorrectEvent:o=>K.mouseButton(o)===0&&o.ctrlKey||K.mouseButton(o)===2});return new Gn({clickTolerance:e,move:(o,c)=>({bearingDelta:(c.x-o.x)*n}),moveStateManager:a,enable:u,assignEvents:wo})},Il=({enable:u,clickTolerance:e,pitchDegreesPerPixelMoved:n=-.5})=>{const a=new bo({checkCorrectEvent:o=>K.mouseButton(o)===0&&o.ctrlKey||K.mouseButton(o)===2});return new Gn({clickTolerance:e,move:(o,c)=>({pitchDelta:(c.y-o.y)*n}),moveStateManager:a,enable:u,assignEvents:wo})};class Is{constructor(e,n){this._clickTolerance=e.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new d.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,n,a){return this._calculateTransform(e,n,a)}touchmove(e,n,a){if(this._active){if(!this._shouldBePrevented(a.length))return e.preventDefault(),this._calculateTransform(e,n,a);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,n,a){this._calculateTransform(e,n,a),this._active&&this._shouldBePrevented(a.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,n,a){a.length>0&&(this._active=!0);const o=Ba(a,n),c=new d.P(0,0),m=new d.P(0,0);let _=0;for(const w in o){const T=o[w],I=this._touches[w];I&&(c._add(T),m._add(T.sub(I)),_++,o[w]=T)}if(this._touches=o,this._shouldBePrevented(_)||!m.mag())return;const y=m.div(_);return this._sum._add(y),this._sum.mag()<this._clickTolerance?void 0:{around:c.div(_),panDelta:y}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class So{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,n,a){this._firstTwoTouches||a.length<2||(this._firstTwoTouches=[a[0].identifier,a[1].identifier],this._start([n[0],n[1]]))}touchmove(e,n,a){if(!this._firstTwoTouches)return;e.preventDefault();const[o,c]=this._firstTwoTouches,m=Fa(a,n,o),_=Fa(a,n,c);if(!m||!_)return;const y=this._aroundCenter?null:m.add(_).div(2);return this._move([m,_],y,e)}touchend(e,n,a){if(!this._firstTwoTouches)return;const[o,c]=this._firstTwoTouches,m=Fa(a,n,o),_=Fa(a,n,c);m&&_||(this._active&&K.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}fu
581nction Fa(u,e,n){for(let a=0;a<u.length;a++)if(u[a].identifier===n)return e[a]}function Al(u,e){return Math.log(u/e)/Math.LN2}class El extends So{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,n){const a=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(Al(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Al(this._distance,a),pinchAround:n}}}function Pl(u,e){return 180*u.angleWith(e)/Math.PI}class Cl extends So{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,n,a){const o=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Pl(this._vector,o),pinchAround:n}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const n=25/(Math.PI*this._minDiameter)*360,a=Pl(e,this._startVector);return Math.abs(a)<n}}function To(u){return Math.abs(u.y)>Math.abs(u.x)}class Oa extends So{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,n,a){super.touchstart(e,n,a),this._currentTouchCount=a.length}_start(e){this._lastPoints=e,To(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,n,a){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const o=e[0].sub(this._lastPoints[0]),c=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(o,c,a.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(o.y+c.y)/2*-.5}):void 0}gestureBeginsVertically(e,n,a){if(this._valid!==void 0)return this._valid;const o=e.mag()>=2,c=n.mag()>=2;if(!o&&!c)return;if(!o||!c)return this._firstMove===void 0&&(this._firstMove=a),a-this._firstMove<100&&void 0;const m=e.y>0==n.y>0;return To(e)&&To(n)&&m}}const Sc={panStep:100,bearingStep:15,pitchStep:10};class tn{constructor(e){this._tr=new gn(e);const n=Sc;this._panStep=n.panStep,this._bearingStep=n.bearingStep,this._pitchStep=n.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let n=0,a=0,o=0,c=0,m=0;switch(e.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:e.shiftKey?a=-1:(e.preventDefault(),c=-1);break;case 39:e.shiftKey?a=1:(e.preventDefault(),c=1);break;case 38:e.shiftKey?o=1:(e.preventDefault(),m=-1);break;case 40:e.shiftKey?o=-1:(e.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(a=0,o=0),{cameraAnimation:_=>{const y=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:Ln,zoom:n?Math.round(y.zoom)+n*(e.shiftKey?2:1):y.zoom,bearing:y.bearing+a*this._bearingStep,pitch:y.pitch+o*this._pitchStep,offset:[-c*this._panStep,-m*this._panStep],center:y.center},{originalEvent:e})}}}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 Ln(u){return u*(2-u)}const Ml=4.000244140625;class _n{constructor(e,n){this._onTimeout=a=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(a)},this._map=e,this._tr=new gn(e),this._triggerRenderFrame=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let n=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;
581const a=de.now(),o=a-(this._lastWheelEventTime||0);this._lastWheelEventTime=a,n!==0&&n%Ml==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":o>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(o*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),e.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=e,this._delta-=n,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=K.mousePos(this._map.getCanvas(),e),a=this._tr;this._around=n.y>a.transform.height/2-a.transform.getHorizon()?d.N.convert(this._aroundCenter?a.center:a.unproject(n)):d.N.convert(a.center),this._aroundPoint=a.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const e=this._tr.transform;if(this._delta!==0){const y=this._type==="wheel"&&Math.abs(this._delta)>Ml?this._wheelZoomRate:this._defaultZoomRate;let w=2/(1+Math.exp(-Math.abs(this._delta*y)));this._delta<0&&w!==0&&(w=1/w);const T=typeof this._targetZoom=="number"?e.zoomScale(this._targetZoom):e.scale;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(T*w))),this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom=="number"?this._targetZoom:e.zoom,a=this._startZoom,o=this._easing;let c,m=!1;const _=de.now()-this._lastWheelEventTime;if(this._type==="wheel"&&a&&o&&_){const y=Math.min(_/200,1),w=o(y);c=d.y.number(a,n,w),y<1?this._frameId||(this._frameId=!0):m=!0}else c=n,m=!0;return this._active=!0,m&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!m,zoomDelta:c-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let n=d.b9;if(this._prevEase){const a=this._prevEase,o=(de.now()-a.start)/a.duration,c=a.easing(o+.01)-a.easing(o),m=.27/Math.sqrt(c*c+1e-4)*.01,_=Math.sqrt(.0729-m*m);n=d.b8(m,_,.25,1)}return this._prevEase={start:de.now(),duration:e,easing:n},n}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class As{constructor(e,n){this._clickZoom=e,this._tapZoom=n}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 wu{constructor(e){this._tr=new gn(e),this.reset()}reset(){this._active=!1}dblclick(e,n){return e.preventDefault(),{cameraAnimation:a=>{a.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(n)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Su{constructor(){this._tap=new xo({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,n,a){if(!this._swipePoint)if(this._tapTime){const o=n[0],c=e.timeStamp-this._tapTime<500,m=this._tapPoint.dist(o)<30;c&&m?a.length>0&&(this._swipePoint=o,this._swipeTouch=a[0].identifier):this.reset()}else this._tap.touchstart(e,n,a)}touchmove(e,n,a){if(this._tapTime){if(this._swipePoint){if(a[0].identifier!==this._swipeTouch)return;const o=n[0],c=o.y-this._swipePoint.y;return this._swipePoint=o,e.preventDefault(),this._active=!0,{zoomDelta:c/128}}}else this._tap.touchmove(e,n,a)}touchend(e,n,a){if(this._tapTime)this._swipePoint&&a.length===0&&this.reset();else{const o=this._tap.touchend(e,n,a);o&&(this._tapTime=e.timeStamp,this._tapPoint=o)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Tc{constructor(e,n,a){this._el=e,this._mousePan=n,this._touchPan=a}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Ic{constructor(e,n,a){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=n,this._mousePitch=a}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 kl{constructor(e,n,a,o){this._el=e,this._touchZoom=n,this._touchRotate=a,this._tapDragZoom=o,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-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()}}class ra{constructor(e,n){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=e,this._options=n,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=K.create("div","maplibregl-cooperative-gesture-screen",e);let n=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(n=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const a=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),o=document.createElement("div");o.className="maplibregl-desktop-message",o.textContent=n,this._container.appendChild(o);const c=document.createElement("div");c.className="maplibregl-mobile-message",c.textContent=a,this._container.appendChild(c),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(K.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,n){this._enabled&&(this._map.fire(new d.k("cooperativegestureprevented",{gestureType:e,originalEvent:n})),this._container.classList.add("maplibregl-show"),setTimeout((()=>{this._container.classList.remove("maplibregl-show")}),100))}}const rn=u=>u.zoom||u.drag||u.pitch||u.rotate;class $e extends d.k{}function Io(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta}class zl{constructor(e,n){this.handleWindowEvent=o=>{this.handleEvent(o,`${o.type}Window`)},this.handleEvent=(o,c)=>{if(o.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const m=o.type==="renderFrame"?void 0:o,_={needsRenderFrame:!1},y={},w={},T=o.touches,I=T?this._getMapTouches(T):void 0,k=I?K.touchPos(this._map.getCanvas(),I):K.mousePos(this._map.getCanvas(),o);for(const{handlerName:q,handler:H,allowed:W}of this._handlers){if(!H.isEnabled())continue;let J;this._blockedByActive(w,W,q)?H.reset():H[c||o.type]&&(J=H[c||o.type](o,k,I),this.mergeHandlerResult(_,y,J,q,m),J&&J.needsRenderFrame&&this._triggerRe
581nderFrame()),(J||H.isActive())&&(w[q]=H)}const F={};for(const q in this._previousActiveHandlers)w[q]||(F[q]=m);this._previousActiveHandlers=w,(Object.keys(F).length||Io(_))&&(this._changes.push([_,y,F]),this._triggerRenderFrame()),(Object.keys(w).length||Io(_))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:V}=_;V&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],V(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new xl(e),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n);const a=this._el;this._listeners=[[a,"touchstart",{passive:!0}],[a,"touchmove",{passive:!1}],[a,"touchend",void 0],[a,"touchcancel",void 0],[a,"mousedown",void 0],[a,"mousemove",void 0],[a,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[a,"mouseover",void 0],[a,"mouseout",void 0],[a,"dblclick",void 0],[a,"click",void 0],[a,"keydown",{capture:!1}],[a,"keyup",void 0],[a,"wheel",{passive:!1}],[a,"contextmenu",void 0],[window,"blur",void 0]];for(const[o,c,m]of this._listeners)K.addEventListener(o,c,o===document?this.handleWindowEvent:this.handleEvent,m)}destroy(){for(const[e,n,a]of this._listeners)K.removeEventListener(e,n,e===document?this.handleWindowEvent:this.handleEvent,a)}_addDefaultHandlers(e){const n=this._map,a=n.getCanvasContainer();this._add("mapEvent",new wc(n,e));const o=n.boxZoom=new Nr(n,e);this._add("boxZoom",o),e.interactive&&e.boxZoom&&o.enable();const c=n.cooperativeGestures=new ra(n,e.cooperativeGestures);this._add("cooperativeGestures",c),e.cooperativeGestures&&c.enable();const m=new ia(n),_=new wu(n);n.doubleClickZoom=new As(_,m),this._add("tapZoom",m),this._add("clickZoom",_),e.interactive&&e.doubleClickZoom&&n.doubleClickZoom.enable();const y=new Su;this._add("tapDragZoom",y);const w=n.touchPitch=new Oa(n);this._add("touchPitch",w),e.interactive&&e.touchPitch&&n.touchPitch.enable(e.touchPitch);const T=Tl(e),I=Il(e);n.dragRotate=new Ic(e,T,I),this._add("mouseRotate",T,["mousePitch"]),this._add("mousePitch",I,["mouseRotate"]),e.interactive&&e.dragRotate&&n.dragRotate.enable();const k=(({enable:J,clickTolerance:j})=>{const ne=new bo({checkCorrectEvent:se=>K.mouseButton(se)===0&&!se.ctrlKey});return new Gn({clickTolerance:j,move:(se,ce)=>({around:ce,panDelta:ce.sub(se)}),activateOnStart:!0,moveStateManager:ne,enable:J,assignEvents:wo})})(e),F=new Is(e,n);n.dragPan=new Tc(a,k,F),this._add("mousePan",k),this._add("touchPan",F,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&n.dragPan.enable(e.dragPan);const V=new Cl,q=new El;n.touchZoomRotate=new kl(a,q,V,y),this._add("touchRotate",V,["touchPan","touchZoom"]),this._add("touchZoom",q,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&n.touchZoomRotate.enable(e.touchZoomRotate);const H=n.scrollZoom=new _n(n,(()=>this._triggerRenderFrame()));this._add("scrollZoom",H,["mousePan"]),e.interactive&&e.scrollZoom&&n.scrollZoom.enable(e.scrollZoom);const W=n.keyboard=new tn(n);this._add("keyboard",W),e.interactive&&e.keyboard&&n.keyboard.enable(),this._add("blockableMapEvent",new Si(n))}_add(e,n,a){this._handlers.push({handlerName:e,handler:n,allowed:a}),this._handlersById[e]=n}stop(e){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!rn(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,n,a){for(const o in e)if(o!==a&&(!n||n.indexOf(o)<0))return!0;return!1}_getMapTouches(e){const n=[];for(const a of e)this._el.contains(a.target)&&n.push(a);return n}mergeHandlerResult(e,n,a,o,c){if(!a)return;d.e(e,a);const m={handlerName:o,originalEvent:a.originalEvent||c};a.zoomDelta!==void 0&&(n.zoom=m),a.panDelta!==void 0&&(n.drag=m),a.pitchDelta!==void 0&&(n.pitch=m),a.bearingDelta!==void 0&&(n.rotate=m)}_applyChanges(){const e={},n={},a={};for(const[o,c,m]of this._changes)o.panDelta&&(e.panDelta=(e.panDelta||new d.P(0,0))._add(o.panDelta)),o.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+o.zoomDelta),o.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+o.bearingDelta),o.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+o.pitchDelta),o.around!==void 0&&(e.around=o.around),o.pinchAround!==void 0&&(e.pinchAround=o.pinchAround),o.noInertia&&(e.noInertia=o.noInertia),d.e(n,c),d.e(a,m);this._updateMapTransform(e,n,a),this._changes=[]}_updateMapTransform(e,n,a){const o=this._map,c=o._getTransformForUpdate(),m=o.terrain;if(!(Io(e)||m&&this._terrainMovement))return this._fireEvents(n,a,!0);let{panDelta:_,zoomDelta:y,bearingDelta:w,pitchDelta:T,around:I,pinchAround:k}=e;k!==void 0&&(I=k),o._stop(!0),I=I||o.transform.centerPoint;const F=c.pointLocation(_?I.sub(_):I);w&&(c.bearing+=w),T&&(c.pitch+=T),y&&(c.zoom+=y),m?this._terrainMovement||!n.drag&&!n.zoom?n.drag&&this._terrainMovement?c.center=c.pointLocation(c.centerPoint.sub(_)):c.setLocationAtPoint(F,I):(this._terrainMovement=!0,this._map._elevationFreeze=!0,c.setLocationAtPoint(F,I)):c.setLocationAtPoint(F,I),o._applyUpdatedTransform(c),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(n,a,!0)}_fireEvents(e,n,a){const o=rn(this._eventsInProgress),c=rn(e),m={};for(const I in e){const{originalEvent:k}=e[I];
581this._eventsInProgress[I]||(m[`${I}start`]=k),this._eventsInProgress[I]=e[I]}!o&&c&&this._fireEvent("movestart",c.originalEvent);for(const I in m)this._fireEvent(I,m[I]);c&&this._fireEvent("move",c.originalEvent);for(const I in e){const{originalEvent:k}=e[I];this._fireEvent(I,k)}const _={};let y;for(const I in this._eventsInProgress){const{handlerName:k,originalEvent:F}=this._eventsInProgress[I];this._handlersById[k].isActive()||(delete this._eventsInProgress[I],y=n[k]||F,_[`${I}end`]=y)}for(const I in _)this._fireEvent(I,_[I]);const w=rn(this._eventsInProgress),T=(o||c)&&!w;if(T&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const I=this._map._getTransformForUpdate();I.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(I)}if(a&&T){this._updatingCamera=!0;const I=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),k=F=>F!==0&&-this._bearingSnap<F&&F<this._bearingSnap;!I||!I.essential&&de.prefersReducedMotion?(this._map.fire(new d.k("moveend",{originalEvent:y})),k(this._map.getBearing())&&this._map.resetNorth()):(k(I.bearing||this._map.getBearing())&&(I.bearing=0),I.freezeElevation=!0,this._map.easeTo(I,{originalEvent:y})),this._updatingCamera=!1}}_fireEvent(e,n){this._map.fire(new d.k(e,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((e=>{delete this._frameId,this.handleEvent(new $e("renderFrame",{timeStamp:e})),this._applyChanges()}))}
581_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Ac extends d.E{constructor(e,n){super(),this._renderFrameCallback=()=>{const a=Math.min((de.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(a)),a<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=n.bearingSnap,this.on("moveend",(()=>{delete this._requestedCameraState}))}getCenter(){return new d.N(this.transform.center.lng,this.transform.center.lat)}setCenter(e,n){return this.jumpTo({center:e},n)}panBy(e,n,a){return e=d.P.convert(e).mult(-1),this.panTo(this.transform.center,d.e({offset:e},n),a)}panTo(e,n,a){return this.easeTo(d.e({center:e},n),a)}getZoom(){return this.transform.zoom}setZoom(e,n){return this.jumpTo({zoom:e},n),this}zoomTo(e,n,a){return this.easeTo(d.e({zoom:e},n),a)}zoomIn(e,n){return this.zoomTo(this.getZoom()+1,e,n),this}zoomOut(e,n){return this.zoomTo(this.getZoom()-1,e,n),this}getBearing(){return this.transform.bearing}setBearing(e,n){return this.jumpTo({bearing:e},n),this}getPadding(){return this.transform.padding}setPadding(e,n){return this.jumpTo({padding:e},n),this}rotateTo(e,n,a){return this.easeTo(d.e({bearing:e},n),a)}resetNorth(e,n){return this.rotateTo(0,d.e({duration:1e3},e),n),this}resetNorthPitch(e,n){return this.easeTo(d.e({bearing:0,pitch:0,duration:1e3},e),n),this}snapToNorth(e,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,n):this}getPitch(){return this.transform.pitch}setPitch(e,n){return this.jumpTo({pitch:e},n),this}cameraForBounds(e,n){e=he.convert(e).adjustAntiMeridian();const a=n&&n.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),a,n)}_cameraForBoxAndBearing(e,n,a,o){const c={top:0,bottom:0,right:0,left:0};if(typeof(o=d.e({padding:c,offset:[0,0],maxZoom:this.transform.maxZoom},o)).padding=="number"){const ze=o.padding;o.padding={top:ze,bottom:ze,right:ze,left:ze}}o.padding=d.e(c,o.padding);const m=this.transform,_=m.padding,y=new he(e,n),w=m.project(y.getNorthWest()),T=m.project(y.getNorthEast()),I=m.project(y.getSouthEast()),k=m.project(y.getSouthWest
581()),F=d.ba(-a),V=w.rotate(F),q=T.rotate(F),H=I.rotate(F),W=k.rotate(F),J=new d.P(Math.max(V.x,q.x,W.x,H.x),Math.max(V.y,q.y,W.y,H.y)),j=new d.P(Math.min(V.x,q.x,W.x,H.x),Math.min(V.y,q.y,W.y,H.y)),ne=J.sub(j),se=(m.width-(_.left+_.right+o.padding.left+o.padding.right))/ne.x,ce=(m.height-(_.top+_.bottom+o.padding.top+o.padding.bottom))/ne.y;if(ce<0||se<0)return void d.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const ye=Math.min(m.scaleZoom(m.scale*Math.min(se,ce)),o.maxZoom),Ie=d.P.convert(o.offset),Re=new d.P((o.padding.left-o.padding.right)/2,(o.padding.top-o.padding.bottom)/2).rotate(d.ba(a)),Ue=Ie.add(Re).mult(m.scale/m.zoomScale(ye));return{center:m.unproject(w.add(I).div(2).sub(Ue)),zoom:ye,bearing:a}}fitBounds(e,n,a){return this._fitInternal(this.cameraForBounds(e,n),n,a)}fitScreenCoordinates(e,n,a,o,c){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(d.P.convert(e)),this.transform.pointLocation(d.P.convert(n)),a,o),o,c)}_fitInternal(e,n,a){return e?(delete(n=d.e(e,n)).padding,n.linear?this.easeTo(n,a):this.flyTo(n,a)):this}jumpTo(e,n){this.stop();const a=this._getTransformForUpdate();let o=!1,c=!1,m=!1;return"zoom"in e&&a.zoom!==+e.zoom&&(o=!0,a.zoom=+e.zoom),e.center!==void 0&&(a.center=d.N.convert(e.center)),"bearing"in e&&a.bearing!==+e.bearing&&(c=!0,a.bearing=+e.bearing),"pitch"in e&&a.pitch!==+e.pitch&&(m=!0,a.pitch=+e.pitch),e.padding==null||a.isPaddingEqual(e.padding)||(a.padding=e.padding),this._applyUpdatedTransform(a),this.fire(new d.k("movestart",n)).fire(new d.k("move",n)),o&&this.fire(new d.k("zoomstart",n)).fire(new d.k("zoom",n)).fire(new d.k("zoomend",n)),c&&this.fire(new d.k("rotatestart",n)).fire(new d.k("rotate",n)).fire(new d.k("rotateend",n)),m&&this.fire(new d.k("pitchstart",n)).fire(new d.k("pitch",n)).fire(new d.k("pitchend",n)),this.fire(new d.k("moveend",n))}calculateCameraOptionsFromTo(e,n,a,o=0){const c=d.Z.fromLngLat(e,n),m=d.Z.fromLngLat(a,o),_=m.x-c.x,y=m.y-c.y,w=m.z-c.z,T=Math.hypot(_,y,w);if(T===0)throw new Error("Can't calculate camera options with same From and To");const I=Math.hypot(_,y),k=this.transform.scaleZoom(this.transform.cameraToCenterDistance/T/this.transform.tileSize),F=180*Math.atan2(_,-y)/Math.PI;let V=180*Math.acos(I/T)/Math.PI;return V=w<0?90-V:90+V,{center:m.toLngLat(),zoom:k,pitch:V,bearing:F}}easeTo(e,n){var a;this._stop(!1,e.easeId),((e=d.e({offset:[0,0],duration:500,easing:d.b9},e)).animate===!1||!e.essential&&de.prefersReducedMotion)&&(e.duration=0);const o=this._getTransformForUpdate(),c=o.zoom,m=o.bearing,_=o.pitch,y=o.padding,w="bearing"in e?this._normalizeBearing(e.bearing,m):m,T="pitch"in e?+e.pitch:_,I="padding"in e?e.padding:o.padding,k=d.P.convert(e.offset);let F=o.centerPoint.add(k);const V=o.pointLocation(F),{center:q,zoom:H}=o.getConstrained(d.N.convert(e.center||V),(a=e.zoom)!==null&&a!==void 0?a:c);this._normalizeCenter(q,o);const W=o.project(V),J=o.project(q).sub(W),j=o.zoomScale(H-c);let ne,se;e.around&&(ne=d.N.convert(e.around),se=o.locationPoint(ne));const ce={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||H!==c,this._rotating=this._rotating||m!==w,this._pitching=this._pitching||T!==_,this._padding=!o.isPaddingEqual(I),this._easeId=e.easeId,this._prepareEase(n,e.noMoveStart,ce),this.terrain&&this._prepareElevation(q),this._ease((ye=>{if(this._zooming&&(o.zoom=d.y.number(c,H,ye)),this._rotating&&(o.bearing=d.y.number(m,w,ye)),this._pitching&&(o.pitch=d.y.number(_,T,ye)),this._padding&&(o.interpolatePadding(y,I,ye),F=o.centerPoint.add(k)),this.terrain&&!e.freezeElevation&&this._updateElevation(ye),ne)o.setLocationAtPoint(ne,se);else{const Ie=o.zoomScale(o.zoom-c),Re=H>c?Math.min(2,j):Math.max(.5,j),Ue=Math.pow(Re,1-ye),ze=o.unproject(W.add(J.mult(ye*Ue)).mult(Ie));o.setLocationAtPoint(o.renderWorldCopies?ze.wrap():ze,F)}this._applyUpdatedTransform(o),this._fireMoveEvents(n)}),(ye=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(n,ye)}),e),this}_prepareEase(e,n,a={}){this._moving=!0,n||a.moving||this.fire(new d.k("movestart",e)),this._zooming&&!a.zooming&&this.fire(new d.k("zoomstart",e)),this._rotating&&!a.rotating&&this.fire(new d.k("rotatestart",e)),this._pitching&&!a.pitching&&this.fire(new d.k("pitchstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const n=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&n!==this._elevationTarget){const a=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(a-(n-(a*e+this._elevationStart))/(1-e)),this._elevationTarget=n}this.transform.elevation=d.y.number(this._elevationStart,this._elevationTarget,e)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){const n=e.getCameraPosition(),a=this.terrain.getElevationForLngLatZoom(n.lngLat,e.zoom);if(n.altitude<a){const o=this.calculateCameraOptionsFromTo(n.lngLat,a,e.center,e.elevation);return{pitch:o.pitch,zoom:o.zoom}}return{}}_applyUpdatedTransform(e){const n=[];if(this.terrain&&n.push((o=>this._elevateCameraIfInsideTerrain(o))),this.transformCameraUpdate&&n.push((o=>this.transformCameraUpdate(o))),!n.length)return;const a=e.clone();for(const o of n){const c=a.clone(),{center:m,zoom:_,pitch:y,bearing:w,elevation:T}=o(c);m&&(c.center=m),_!==void 0&&(c.zoom=_),y!==void 0&&(c.pitch=y),w!==void 0&&(c.bearing=w),T!==void 0&&(c.elevation=T),a.apply(c)}this.transform.apply(a)}_fireMoveEvents(e){this.fire(new d.k("move",e)),this._zooming&&this.fire(new d.k("zoom",e)),this._rotating&&this.fire(new d.k("rotate",e)),this._pitching&&this.fire(new d.k("pitch",e))}_afterEase(e,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const a=this._zooming,o=this._rotating,c=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,a&&this.fire(new d.k("zoomend",e)),o&&this.fire(new d.k("rotateend",e)),c&&this.fire(new d.k("pitchend",e)),this.fire(new d.k("moveend",e))}flyTo(e,n){var a;if(!e.essential&&de.prefersReducedMotion){const Oe=d.M(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Oe,n)}this.stop(),e=d.e({offset:[0,0],speed:1.2,curve:1.42,easing:d.b9},e);const o=this._getTransformForUpdate(),c=o.zoom,m=o.bearing,_=o.pitch,y=o.padding,w="bearing"in e?this._normalizeBearing(e.bearing,m):m,T="pitch"in e?+e.pitch:_,I="padding"in e?e.padding:o.padding,k=d.P.convert(e.offset);let F=o.centerPoint.add(k);const V=o.pointLocation(F),{center:q,zoom:H}=o.getConstrained(d.N.convert(e.center||V),(a=e.zoom)!==null&&a!==void 0?a:c);this._normalizeCenter(q,o);const W=o.zoomScale(H-c),J=o.project(V),j=o.project(q).sub(J);let ne=e.curve;const se=Math.max(o.width,o.height),ce=se/W,ye=j.mag();if("minZoom"in e){const Oe=d.ac(Math.min(e.minZoom,c,H),o.minZoom,o.maxZoom),gt=se/o.zoomScale(Oe-c);ne=Math.sqrt(gt/ye*2)}const Ie=ne*ne;function Re(Oe){const gt=(ce*ce-se*se+(Oe?-1:1)*Ie*Ie*ye*ye)/(2*(Oe?ce:se)*Ie*ye);return Math.log(Math.sqrt(gt*gt+1)-gt)}function Ue(Oe){return(Math.exp(Oe)-Math.exp(-Oe))/2}function ze(Oe){return(Math.exp(Oe)+Math.exp(-Oe))/2}const Me=Re(!1);let Je=function(Oe){return ze(Me)/ze(Me+ne*Oe)},yt=function(Oe){return se*((ze(Me)*(Ue(gt=Me+ne*Oe)/ze(gt))-Ue(Me))/Ie)/ye;var gt},De=(Re(!0)-Me)/ne;if(Math.abs(ye)<1e-6||!isFinite(De)){if(Math.abs(se-ce)<1e-6)return this.easeTo(e,n);const Oe=ce<se?-1:1;De=Math.abs(Math.log(ce/se))/ne,yt=()=>0,Je=gt=>Math.exp(Oe*ne*gt)}return e.duration="duration"in e?+e.duration:1e3*De/("screenSpeed"in e?+e.screenSpeed/ne:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=m!==w,this._pitching=T!==_,this._padding=!o.isPaddingEqual(I),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(q),this._ease((Oe=>{const gt=Oe*De,li=1/Je(gt);o.zoom=Oe===1?H:c+o.scaleZoom(li),this._rotating&&(o.bearing=d.y.number(m,w,Oe)),this._pitching&&(o.pitch=d.y.number(_,T,Oe)),this._padding&&(o.interpolatePadding(y,I,Oe),F=o.centerPoint.add(k)),this.terrain&&!e.freezeElevation&&this._updateElevation(Oe);
581const At=Oe===1?q:o.unproject(J.add(j.mult(yt(gt))).mult(li));o.setLocationAtPoint(o.renderWorldCopies?At.wrap():At,F),this._applyUpdatedTransform(o),this._fireMoveEvents(n)}),(()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(n)}),e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,n){var a;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const o=this._onEaseEnd;delete this._onEaseEnd,o.call(this,n)}return e||(a=this.handlers)===null||a===void 0||a.stop(!1),this}_ease(e,n,a){a.animate===!1||a.duration===0?(e(1),n()):(this._easeStart=de.now(),this._easeOptions=a,this._onEaseFrame=e,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,n){e=d.b3(e,-180,180);const a=Math.abs(e-n);return Math.abs(e-360-n)<a&&(e-=360),Math.abs(e+360-n)<a&&(e+=360),e}_normalizeCenter(e,n){if(!n.renderWorldCopies||n.lngRange)return;const a=e.lng-n.center.lng;e.lng+=a>180?-360:a<-180?360:0}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(d.N.convert(e),this.transform.tileZoom)-this.transform.elevation:null}}const na={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class sa{constructor(e=na){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=n=>{!n||n.sourceDataType!=="metadata"&&n.sourceDataType!=="visibility"&&n.dataType!=="style"&&n.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=K.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=K.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=K.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){K.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,n){const a=this._map._getUIString(`AttributionControl.${n}`);e.title=a,e.setAttribute("aria-label",a)}_updateAttributions(){if(!this._map.style)return;let e=[];
581if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map((o=>typeof o!="string"?"":o))):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){const o=this._map.style.stylesheet;this.styleOwner=o.owner,this.styleId=o.id}const n=this._map.style.sourceCaches;for(const o in n){const c=n[o];if(c.used||c.usedForTerrain){const m=c.getSource();m.attribution&&e.indexOf(m.attribution)<0&&e.push(m.attribution)}}e=e.filter((o=>String(o).trim())),e.sort(((o,c)=>o.length-c.length)),e=e.filter(((o,c)=>{for(let m=c+1;m<e.length;m++)if(e[m].indexOf(o)>=0)return!1;return!0}));const a=e.join(" | ");a!==this._attribHTML&&(this._attribHTML=a,e.length?(this._innerContainer.innerHTML=a,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Dl{constructor(e={}){this._updateCompact=()=>{const n=this._container.children;if(n.length){const a=n[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&a.classList.add("maplibregl-compact"):a.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=K.create("div","maplibregl-ctrl");const n=K.create("a","maplibregl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){K.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Dt{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const n=++this._id;return this._queue.push({callback:e,id:n,cancelled:!1}),n}remove(e){const n=this._currentlyRunning,a=n?this._queue.concat(n):this._queue;for(const o of a)if(o.id===e)return void(o.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const n=this._currentlyRunning=this._queue;this._queue=[];for(const a of n)if(!a.cancelled&&(a.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Ll=d.Y([{name:"a_pos3d",type:"Int16",components:3}]);class Tu extends d.E{constructor(e){super(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,e.usedForTerrain=!0,e.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,n){this.sourceCache.update(e,n),this._renderableTilesKeys=[];const a={};for(const o of e.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))a[o.key]=!0,this._renderableTilesKeys.push(o.key),this._tiles[o.key]||(o.posMatrix=new Float64Array(16),d.aP(o.posMatrix,0,d.X,0,d.X,0,1),this._tiles[o.key]=new Rr(o,this.tileSize));for(const o in this._tiles)a[o]||delete this._tiles[o]}freeRtt(e){for(const n in this._tiles){const a=this._tiles[n];(!e||a.tileID.equals(e)||a.tileID.isChildOf(e)||e.isChildOf(a.tileID))&&(a.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((e=>this.getTileByID(e)))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e){const n={};for(const a of this._renderableTilesKeys){const o=this._tiles[a].tileID;if(o.canonical.equals(e.canonical)){const c=e.clone();c.posMatrix=new Float64Array(16),d.aP(c.posMatrix,0,d.X,0,d.X,0,1),n[a]=c}else if(o.canonical.isChildOf(e.canonical)){const c=e.clone();c.posMatrix=new Float64Array(16);const m=o.canonical.z-e.canonical.z,_=o.canonical.x-(o.canonical.x>>m<<m),y=o.canonical.y-(o.canonical.y>>m<<m),w=d.X>>m;d.aP(c.posMatrix,0,w,0,w,0,1),d.J(c.posMatrix,c.posMatrix,[-_*w,-y*w,0]),n[a]=c}else if(e.canonical.isChildOf(o.canonical)){const c=e.clone();c.posMatrix=new Float64Array(16);const m=e.canonical.z-o.canonical.z,_=e.canonical.x-(e.canonical.x>>m<<m),y=e.canonical.y-(e.canonical.y>>m<<m),w=d.X>>m;d.aP(c.posMatrix,0,d.X,0,d.X,0,1),d.J(c.posMatrix,c.posMatrix,[_*w,y*w,0]),d.K(c.posMatrix,c.posMatrix,[1/2**m,1/2**m,0]),n[a]=c}}return n}getSourceTile(e,n){const a=this.sourceCache._source;let o=e.overscaledZ-this.deltaZoom;if(o>a.maxzoom&&(o=a.maxzoom),o<a.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(o).key);let c=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if((!c||!c.dem)&&n)for(;o>=a.minzoom&&(!c||!c.dem);)c=this.sourceCache.getTileByID(e.scaledTo(o--).key);return c}tilesAfterTime(e=Date.now()){return Object.values(this._tiles).filter((n=>n.timeAdded>=e))}}class Rl{constructor(e,n,a){this.painter=e,this.sourceCache=new Tu(n),this.options=a,this.exaggeration=typeof a.exaggeration=="number"?a.exaggeration:1,this.qual
581ityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,n,a,o=d.X){var c;if(!(n>=0&&n<o&&a>=0&&a<o))return 0;const m=this.getTerrainData(e),_=(c=m.tile)===null||c===void 0?void 0:c.dem;if(!_)return 0;const y=(function(V,q,H){var W=q[0],J=q[1];return V[0]=H[0]*W+H[4]*J+H[12],V[1]=H[1]*W+H[5]*J+H[13],V})([],[n/o*d.X,a/o*d.X],m.u_terrain_matrix),w=[y[0]*_.dim,y[1]*_.dim],T=Math.floor(w[0]),I=Math.floor(w[1]),k=w[0]-T,F=w[1]-I;return _.get(T,I)*(1-k)*(1-F)+_.get(T+1,I)*k*(1-F)+_.get(T,I+1)*(1-k)*F+_.get(T+1,I+1)*k*F}getElevationForLngLatZoom(e,n){if(!d.bb(n,e.wrap()))return 0;const{tileID:a,mercatorX:o,mercatorY:c}=this._getOverscaledTileIDFromLngLatZoom(e,n);return this.getElevation(a,o%d.X,c%d.X,d.X)}getElevation(e,n,a,o=d.X){return this.getDEMElevation(e,n,a,o)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){const o=this.painter.context,c=new d.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new dt(o,c,o.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new dt(o,new d.R({width:1,height:1}),o.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(o.gl.NEAREST,o.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=d.an([])}const n=this.sourceCache.getSourceTile(e,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){const o=this.painter.context;n.demTexture=this.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new dt(o,n.dem.getPixels(),o.gl.RGBA,{premultiply:!1}),n.demTexture.bind(o.gl.NEAREST,o.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const a=n&&n+n.tileID.key+e.key;if(a&&!this._demMatrixCache[a]){const o=this.sourceCache.sourceCache._source.maxzoom;let c=e.canonical.z-n.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=o?c=e.canonical.z-o:d.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const m=e.canonical.x-(e.canonical.x>>c<<c),_=e.canonical.y-(e.canonical.y>>c<<c),y=d.bc(new Float64Array(16),[1/(d.X<<c),1/(d.X<<c),0]);d.J(y,y,[m*d.X,_*d.X,0]),this._demMatrixCache[e.key]={matrix:y,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:a?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:n&&n.dem&&n.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(n&&n.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:n}}getFramebuffer(e){const n=this.painter,a=n.width/devicePixelRatio,o=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===a&&this._fbo.height===o||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new dt(n.context,{width:a,height:o,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new dt(n.context,{width:a,height:o,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=n.context.createFramebuffer(a,o,!0,!1),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,a,o))),this._fbo.colorAttachment.set(e==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let c=0,m=0;c<this._coordsTextureSize;c++)for(let _=0;_<this._coordsTextureSize;_++,m+=4)n[m+0]=255&_,n[m+1]=255&c,n[m+2]=_>>8<<4|c>>8,n[m+3]=0;const a=new d.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),o=new dt(e,a,e.gl.RGBA,{premultiply:!1});return o.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=o,o}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);const n=new Uint8Array(4),a=this.painter.context,o=a.gl,c=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),m=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),_=Math.round(this.painter.height/devicePixelRatio);a.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),o.readPixels(c,_-m-1,1,1,o.RGBA,o.UNSIGNED_BYTE,n),a.bindFramebuffer.set(null);const y=n[0]+(n[2]>>4<<8),w=n[1]+((15&n[2])<<8),T=this.coordsIndex[255-n[3]],I=T&&this.sourceCache.getTileByID(T);if(!I)return null;
581const k=this._coordsTextureSize,F=(1<<I.tileID.canonical.z)*k;return new d.Z((I.tileID.canonical.x*k+y)/F+I.tileID.wrap,(I.tileID.canonical.y*k+w)/F,this.getElevation(I.tileID,y,w,k))}depthAtPoint(e){const n=new Uint8Array(4),a=this.painter.context,o=a.gl;return a.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),o.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,o.RGBA,o.UNSIGNED_BYTE,n),a.bindFramebuffer.set(null),(n[0]/16777216+n[1]/65536+n[2]/256+n[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;const e=this.painter.context,n=new d.bd,a=new d.aY,o=this.meshSize,c=d.X/o,m=o*o;for(let I=0;I<=o;I++)for(let k=0;k<=o;k++)n.emplaceBack(k*c,I*c,0);for(let I=0;I<m;I+=o+1)for(let k=0;k<o;k++)a.emplaceBack(k+I,o+k+I+1,o+k+I+2),a.emplaceBack(k+I,o+k+I+2,k+I+1);const _=n.length,y=_+2*(o+1);for(const I of[0,1])for(let k=0;k<=o;k++)for(const F of[0,1])n.emplaceBack(k*c,I*d.X,F);for(let I=0;I<2*o;I+=2)a.emplaceBack(y+I,y+I+1,y+I+3),a.emplaceBack(y+I,y+I+3,y+I+2),a.emplaceBack(_+I,_+I+3,_+I+1),a.emplaceBack(_+I,_+I+2,_+I+3);const w=n.length,T=w+2*(o+1);for(const I of[0,1])for(let k=0;k<=o;k++)for(const F of[0,1])n.emplaceBack(I*d.X,k*c,F);for(let I=0;I<2*o;I+=2)a.emplaceBack(w+I,w+I+1,w+I+3),a.emplaceBack(w+I,w+I+3,w+I+2),a.emplaceBack(T+I,T+I+3,T+I+1),a.emplaceBack(T+I,T+I+2,T+I+3);return this._mesh=new mo(e.createVertexBuffer(n,Ll.members),e.createIndexBuffer(a),d.a0.simpleSegment(0,0,n.length,a.length)),this._mesh}getMeshFrameDelta(e){return 2*Math.PI*d.be/Math.pow(2,e)/5}getMinTileElevationForLngLatZoom(e,n){var a;const{tileID:o}=this._getOverscaledTileIDFromLngLatZoom(e,n);return(a=this.getMinMaxElevation(o).minElevation)!==null&&a!==void 0?a:0}getMinMaxElevation(e){const n=this.getTerrainData(e).tile,a={minElevation:null,maxElevation:null};return n&&n.dem&&(a.minElevation=n.dem.min*this.exaggeration,a.maxElevation=n.dem.max*this.exaggeration),a}_getOverscaledTileIDFromLngLatZoom(e,n){const a=d.Z.fromLngLat(e.wrap()),o=(1<<n)*d.X,c=a.x*o,m=a.y*o,_=Math.floor(c/d.X),y=Math.floor(m/d.X);
581return{tileID:new d.S(n,0,n,_,y),mercatorX:c,mercatorY:m}}}class Iu{constructor(e,n,a){this._context=e,this._size=n,this._tileSize=a,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){const n=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),a=new dt(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return a.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),n.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),n.colorAttachment.set(a.texture),{id:e,fbo:n,texture:a,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((n=>e.id!==n)),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(const n of this._recentlyUsed)if(!this._objects[n].inUse)return this._objects[n];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(const e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length<this._size)&&this._objects.some((e=>!e.inUse))===!1}}const aa={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Ec{constructor(e,n){this.painter=e,this.terrain=n,this.pool=new Iu(e.context,30,n.sourceCache.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,n){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter((a=>!e._layers[a].isHidden(n))),this._coordsDescendingInv={};for(const a in e.sourceCaches){this._coordsDescendingInv[a]={};const o=e.sourceCaches[a].getVisibleCoordinates();for(const c of o){const m=this.terrain.sourceCache.getTerrainCoords(c);for(const _ in m)this._coordsDescendingInv[a][_]||(this._coordsDescendingInv[a][_]=[]),this._coordsDescendingInv[a][_].push(m[_])}}this._coordsDescendingInvStr={};for(const a of e._order){const o=e._layers[a],c=o.source;if(aa[o.type]&&!this._coordsDescendingInvStr[c]){this._coordsDescendingInvStr[c]={};for(const m in this._coordsDescendingInv[c])this._coordsDescendingInvStr[c][m]=this._coordsDescendingInv[c][m].map((_=>_.key)).sort().join()}}for(const a of this._renderableTiles)for(const o in this._coordsDescendingInvStr){const c=this._coordsDescendingInvStr[o][a.tileID.key];c&&c!==a.rttCoords[o]&&(a.rtt=[])}}renderLayer(e){if(e.isHidden(this.painter.transform.zoom))return!1;const n=e.type,a=this.painter,o=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(aa[n]&&(this._prevType&&aa[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(e.id),!o))return!0;if(aa[this._prevType]||aa[n]&&o){this._prevType=n;const c=this._stacks.length-1,m=this._stacks[c]||[];for(const _ of this._renderableTiles){if(this.pool.isFull()&&(vc(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(_),_.rtt[c]){const w=this.pool.getObjectForId(_.rtt[c].id);if(w.stamp===_.rtt[c].stamp){this.pool.useObject(w);continue}}const y=this.pool.getOrCreateFreeObject();this.pool.useObject(y),this.pool.stampObject(y),_.rtt[c]={id:y.id,stamp:y.stamp},a.context.bindFramebuffer.set(y.fbo.framebuffer),a.context.clear({color:d.aM.transparent,stencil:0}),a.currentStencilSource=void 0;for(let w=0;w<m.length;w++){const T=a.style._layers[m[w]],I=T.source?this._coordsDescendingInv[T.source][_.tileID.key]:[_.tileID];a.context.viewport.set([0,0,y.fbo.width,y.fbo.height]),a._renderTileClippingMasks(T,I),a.renderLayer(a,a.style.sourceCaches[T.source],T,I),T.source&&(_.rttCoords[T.source]=this._coordsDescendingInvStr[T.source][_.tileID.key])}}return vc(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),aa[n]}return!1}}const Bl={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},Pc=xe,Au={hash:!1,interactive:!0,bearingSnap:7,attributionControl:na,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,refreshExpiredTiles:!0,scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],zoom:0,bearing:0,pitch:0,renderWorldCopies:!0,maxTileC
581acheSize:null,maxTileCacheZoomLevels:d.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0},Fl=u=>{u.touchstart=u.dragStart,u.touchmoveWindow=u.dragMove,u.touchend=u.dragEnd},Eu={showCompass:!0,showZoom:!0,visualizePitch:!1};class Pu{constructor(e,n,a=!1){this.mousedown=m=>{this.startMouse(d.e({},m,{ctrlKey:!0,preventDefault:()=>m.preventDefault()}),K.mousePos(this.element,m)),K.addEventListener(window,"mousemove",this.mousemove),K.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=m=>{this.moveMouse(m,K.mousePos(this.element,m))},this.mouseup=m=>{this.mouseRotate.dragEnd(m),this.mousePitch&&this.mousePitch.dragEnd(m),this.offTemp()},this.touchstart=m=>{m.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=K.touchPos(this.element,m.targetTouches)[0],this.startTouch(m,this._startPos),K.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),K.addEventListener(window,"touchend",this.touchend))},this.touchmove=m=>{m.targetTouches.length!==1?this.reset():(this._lastPos=K.touchPos(this.element,m.targetTouches)[0],this.moveTouch(m,this._lastPos))},this.touchend=m=>{m.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const o=e.dragRotate._mouseRotate.getClickTolerance(),c=e.dragRotate._mousePitch.getClickTolerance();this.element=n,this.mouseRotate=Tl({clickTolerance:o,enable:!0}),this.touchRotate=(({enable:m,clickTolerance:_,bearingDegreesPerPixelMoved:y=.8})=>{const w=new Sl;return new Gn({clickTolerance:_,move:(T,I)=>({bearingDelta:(I.x-T.x)*y}),moveStateManager:w,enable:m,assignEvents:Fl})})({clickTolerance:o,enable:!0}),this.map=e,a&&(this.mousePitch=Il({clickTolerance:c,enable:!0}),this.touchPitch=(({enable:m,clickTolerance:_,pitchDegreesPerPixelMoved:y=-.5})=>{const w=new Sl;return new Gn({clickTolerance:_,move:(T,I)=>({pitchDelta:(I.y-T.y)*y}),moveStateManager:w,enable:m,assignEvents:Fl})})({clickTolerance:c,enable:!0})),K.addEventListener(n,"mousedown",this.mousedown),K.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),K.addEventListener(n,"touchcancel",this.reset)}startMouse(e,n){this.mouseRotate.dragStart(e,n),this.mousePitch&&this.mousePitch.dragStart(e,n),K.disableDrag()}startTouch(e,n){this.touchRotate.dragStart(e,n),this.touchPitch&&this.touchPitch.dragStart(e,n),K.disableDrag()}moveMouse(e,n){const a=this.map,{bearingDelta:o}=this.mouseRotate.dragMove(e,n)||{};if(o&&a.setBearing(a.getBearing()+o),this.mousePitch){const{pitchDelta:c}=this.mousePitch.dragMove(e,n)||{};c&&a.setPitch(a.getPitch()+c)}}moveTouch(e,n){const a=this.map,{bearingDelta:o}=this.touchRotate.dragMove(e,n)||{};if(o&&a.setBearing(a.getBearing()+o),this.touchPitch){const{pitchDelta:c}=this.touchPitch.dragMove(e,n)||{};c&&a.setPitch(a.getPitch()+c)}}off(){const e=this.element;K.removeEventListener(e,"mousedown",this.mousedown),K.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),K.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),K.removeEventListener(window,"touchend",this.touchend),K.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){K.enableDrag(),K.removeEventListener(window,"mousemove",this.mousemove),K.removeEventListener(window,"mouseup",this.mouseup),K.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),K.removeEventListener(window,"touchend",this.touchend)}}let Vr;function oi(u,e,n){const a=new d.N(u.lng,u.lat);if(u=new d.N(u.lng,u.lat),e){const o=new d.N(u.lng-360,u.lat),c=new d.N(u.lng+360,u.lat),m=n.locationPoint(u).distSqr(e);n.locationPoint(o).distSqr(e)<m?u=o:n.locationPoint(c).distSqr(e)<m&&(u=c)}for(;Math.abs(u.lng-n.center.lng)>180;){const o=n.locationPoint(u);if(o.x>=0&&o.y>=0&&o.x<=n.width&&o.y<=n.height)break;u.lng>n.center.lng?u.lng-=360:u.lng+=360}return u.lng!==a.lng&&n.locationPoint(u).y>n.height/2-n.getHorizon()?u:a}
581const oa={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%)"};function Ao(u,e,n){const a=u.classList;for(const o in oa)a.remove(`maplibregl-${n}-anchor-${o}`);a.add(`maplibregl-${n}-anchor-${e}`)}class Eo extends d.E{constructor(e){if(super(),this._onKeyPress=n=>{const a=n.code,o=n.charCode||n.keyCode;a!=="Space"&&a!=="Enter"&&o!==32&&o!==13||this.togglePopup()},this._onMapClick=n=>{const a=n.originalEvent.target,o=this._element;this._popup&&(a===o||o.contains(a))&&this.togglePopup()},this._update=n=>{var a;if(!this._map)return;const o=this._map.loaded()&&!this._map.isMoving();((n==null?void 0:n.type)==="terrain"||(n==null?void 0:n.type)==="render"&&!o)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?oi(this._lngLat,this._flatPos,this._map.transform):(a=this._lngLat)===null||a===void 0?void 0:a.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let c="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?c=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(c=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let m="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?m="rotateX(0deg)":this._pitchAlignment==="map"&&(m=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||n&&n.type!=="moveend"||(this._pos=this._pos.round()),K.setTransform(this._element,`${oa[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${m} ${c}`),de.frameAsync(new AbortController).then((()=>{this._updateOpacity(n&&n.type==="moveend")})).catch((()=>{}))},this._onMove=n=>{if(!this._isDragging){const a=this._clickTolerance||this._map._clickTolerance;this._isDragging=n.point.dist(this._pointerdownPos)>=a}this._isDragging&&(this._pos=n.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new d.k("dragstart"))),this.fire(new d.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new d.k("dragend")),this._state="inactive"},this._addDragHandler=n=>{this._element.contains(n.originalEvent.target)&&(n.preventDefault(),this._positionDelta=n.point.sub(this._pos).add(this._offset),this._pointerdownPos=n.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._subpixelPositioning=e&&e.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(e==null?void 0:e.opacity,e==null?void 0:e.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=d.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=K.create("div");const n=K.createNS("http://www.w3.org/2000/svg","svg"),a=41,o=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${a}px`),n.setAttributeNS(null,"width",`${o}px`),n.setAttributeNS(null,"viewBox",`0 0 ${o} ${a}`);const c=K.createNS("http://www.w3.org/2000/svg","g");c.setAttributeNS(null,"stroke","none"),c.setAttributeNS(null,"stroke-width","1"),c.setAttributeNS(null,"fill","none"),c.setAttributeNS(null,"fill-rule","evenodd");const m=K.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"fill-rule","nonzero");const _=K.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const y=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const W of y){const J=K.createNS("http://www.w3.org/2000/svg","ellipse");J.setAttributeNS(null,"opacity","0.04"),J.setAttributeNS(null,"cx","10.5"),J.setAttributeNS(null,"cy","5.80029008"),J.setAttributeNS(null,"rx",W.rx),J.setAttributeNS(null,"ry",W.ry),_.appendChild(J)}const w=K.createNS("http://www.w3.org/2000/svg","g");w.setAttributeNS(null,"fill",this._color);const T=K.createNS("http://www.w3.org/2000/svg","path");T.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),w.appendChild(T);const I=K.createNS("http://www.w3.org/2000/svg","g");I.setAttributeNS(null,"opacity","0.25"),I.setAttributeNS(null,"fill","#000000");const k=K.createNS("http://www.w3.org/2000/svg","path");k.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),I.appendChild(k);const F=K.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"transform","translate(6.0, 7.0)"),F.setAttributeNS(null,"fill","#FFFFFF");const V=K.createNS("http://www.w3.org/2000/svg","g");V.setAttributeNS(null,"transform","translate(8.0, 8.0)");const q=K.createNS("http://www.w3.org/2000/svg","circle");q.setAttributeNS(null,"fill","#000000"),q.setAttributeNS(null,"opacity","0.25"),q.setAttributeNS(null,"cx","5.5"),q.setAttributeNS(null,"cy","5.5"),q.setAttributeNS(null,"r","5.4999962");const H=K.createNS("http://www.w3.org/2000/svg","circle");H.setAttributeNS(null,"fill","#FFFFFF"),H.setAttributeNS(null,"cx","5.5"),H.setAttributeNS(null,"cy","5.5"),H.setAttributeNS(null,"r","5.4999962"),V.appendChild(q),
581V.appendChild(H),m.appendChild(_),m.appendChild(w),m.appendChild(I),m.appendChild(F),m.appendChild(V),n.appendChild(m),n.setAttributeNS(null,"height",a*this._scale+"px"),n.setAttributeNS(null,"width",o*this._scale+"px"),this._element.appendChild(n),this._offset=d.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(n=>{n.preventDefault()})),this._element.addEventListener("mousedown",(n=>{n.preventDefault()})),Ao(this._element,this._anchor,"marker"),e&&e.className)for(const n of e.className.split(" "))this._element.classList.add(n);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),K.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=d.N.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const o=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[o,-1*(38.1-13.5+o)],"bottom-right":[-o,-1*(38.1-13.5+o)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){const e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var n,a;if(!(!((n=this._map)===null||n===void 0)&&n.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout((()=>{this._opacityTimeout=null}),100)}const o=this._map,c=o.terrain.depthAtPoint(this._pos),m=o.terrain.getElevationForLngLatZoom(this._lngLat,o.transform.tileZoom);if(o.transform.lngLatToCameraDepth(this._lngLat,m)-c<.006)return void(this._element.style.opacity=this._opacity);const _=-this._offset.y/o.transform._pixelPerMeter,y=Math.sin(o.getPitch()*Math.PI/180)*_,w=o.terrain.depthAtPoint(new d.P(this._pos.x,this._pos.y-this._offset.y)),T=o.transform.lngLatToCameraDepth(this._lngLat,m+y)-w>.006;!((a=this._popup)===null||a===void 0)&&a.isOpen()&&T&&this._popup.remove(),this._element.style.opacity=T?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=d.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,n){return e===void 0&&n===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=e),n!==void 0&&(this._opacityWhenCovered=n),this._map&&this._updateOpacity(!0),this}}const Cc={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0}
581;let Na=0,Va=!1;const Rn={maxWidth:100,unit:"metric"};function Ua(u,e,n){const a=n&&n.maxWidth||100,o=u._container.clientHeight/2,c=u.unproject([0,o]),m=u.unproject([a,o]),_=c.distanceTo(m);if(n&&n.unit==="imperial"){const y=3.2808*_;y>5280?Ke(e,a,y/5280,u._getUIString("ScaleControl.Miles")):Ke(e,a,y,u._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?Ke(e,a,_/1852,u._getUIString("ScaleControl.NauticalMiles")):_>=1e3?Ke(e,a,_/1e3,u._getUIString("ScaleControl.Kilometers")):Ke(e,a,_,u._getUIString("ScaleControl.Meters"))}function Ke(u,e,n,a){const o=(function(c){const m=Math.pow(10,`${Math.floor(c)}`.length-1);let _=c/m;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:(function(y){const w=Math.pow(10,Math.ceil(-Math.log(y)/Math.LN10));return Math.round(y*w)/w})(_),m*_})(n);u.style.width=e*(o/n)+"px",u.innerHTML=`${o}&nbsp;${a}`}const ut={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Po=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Co(u){if(u){if(typeof u=="number"){const e=Math.round(Math.abs(u)/Math.SQRT2);return{center:new d.P(0,0),top:new d.P(0,u),"top-left":new d.P(e,e),"top-right":new d.P(-e,e),bottom:new d.P(0,-u),"bottom-left":new d.P(e,-e),"bottom-right":new d.P(-e,-e),left:new d.P(u,0),right:new d.P(-u,0)}}if(u instanceof d.P||Array.isArray(u)){const e=d.P.convert(u);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:d.P.convert(u.center||[0,0]),top:d.P.convert(u.top||[0,0]),"top-left":d.P.convert(u["top-left"]||[0,0]),"top-right":d.P.convert(u["top-right"]||[0,0]),bottom:d.P.convert(u.bottom||[0,0]),"bottom-left":d.P.convert(u["bottom-left"]||[0,0]),"bottom-right":d.P.convert(u["bottom-right"]||[0,0]),left:d.P.convert(u.left||[0,0]),right:d.P.convert(u.right||[0,0])}}return Co(new d.P(0,0))}const Ol=xe;A.AJAXError=d.bh,A.Evented=d.E,A.LngLat=d.N,A.MercatorCoordinate=d.Z,A.Point=d.P,A.addProtocol=d.bi,A.config=d.a,A.removeProtocol=d.bj,A.AttributionControl=sa,A.BoxZoomHandler=Nr,A.CanvasSource=fr,A.CooperativeGesturesHandler=ra,A.DoubleClickZoomHandler=As,A.DragPanHandler=Tc,A.DragRotateHandler=Ic,A.EdgeInsets=ea,A.FullscreenControl=class extends d.E{constructor(u={}){super(),this._onFullscreenChange=()=>{var e;let n=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((e=n==null?void 0:n.shadowRoot)===null||e===void 0)&&e.fullscreenElement;)n=n.shadowRoot.fullscreenElement;n===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,u&&u.container&&(u.container instanceof HTMLElement?this._container=u.container:d.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(u){return this._map=u,this._container||(this._container=this._map.getContainer()),this._controlContainer=K.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){K.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const u=this._fullscreenButton=K.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);K.create("span","maplibregl-ctrl-icon",u).setAttribute("aria-hidden","true"),u.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const u=this._getTitle();this._fullscreenButton.setAttribute("aria-label",u),this._fullscreenButton.title=u}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new d.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new d.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},A.GeoJSONSource=ds,A.GeolocateControl=class extends d.E{constructor(u){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new d.k("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_E
581RROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(e),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new d.k("geolocate",e)),this._finish()}},this._updateCamera=e=>{const n=new d.N(e.coords.longitude,e.coords.latitude),a=e.coords.accuracy,o=this._map.getBearing(),c=d.e({bearing:o},this.options.fitBoundsOptions),m=he.fromLngLat(n,a);this._map.fitBounds(m,c,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const n=new d.N(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=e=>{if(this._map){if(this.options.trackUserLocation)if(e.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&Va)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new d.k("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this._geolocateButton=K.create("button","maplibregl-ctrl-geolocate",this._container),K.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(e===!1){d.w("Geolocation support is not available so the GeolocateControl will be disabled.");const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}else{const n=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=K.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Eo({element:this._dotElement}),this._circleElement=K.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Eo({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",(()=>this.trigger())),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(n=>{n.geolocateSource||this._watchState!=="ACTIVE_LOCK"||n.originalEvent&&n.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new d.k("trackuserlocationend")),this.fire(new d.k("userlocationlostfocus")))}))}},this.options=d.e({},Cc,u)}onAdd(u){return this._map=u,this._container=K.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),(function(){return d._(this,arguments,void 0,(function*(e=!1){if(Vr!==void 0&&!e)return Vr;if(window.navigator.permissions===void 0)return Vr=!!window.navigator.geolocation,Vr;try{Vr=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Vr=!!window.navigator.geolocation}return Vr}))})().then((e=>this._finishSetupUI(e))),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),K.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Na=0,Va=!1}_isOutOfMapMaxBounds(u){const e=this._map.getMaxBounds(),n=u.coords;return e&&(n.longitude<e.getWest()||n.longitude>e.getEast()||n.latitude<e.getSouth()||n.latitude>e.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_E
581RROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const u=this._map.getBounds(),e=u.getSouthEast(),n=u.getNorthEast(),a=e.distanceTo(n),o=Math.ceil(this._accuracy/(a/this._map._container.clientHeight)*2);this._circleElement.style.width=`${o}px`,this._circleElement.style.height=`${o}px`}trigger(){if(!this._setup)return d.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 d.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Na--,Va=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new d.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new d.k("trackuserlocationstart")),this.fire(new d.k("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let u;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Na++,Na>1?(u={maximumAge:6e5,timeout:0},Va=!0):(u=this.options.positionOptions,Va=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,u)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},A.Hash=_o,A.ImageSource=di,A.KeyboardHandler=tn,A.LngLatBounds=he,A.LogoControl=Dl,A.Map=class extends Ac{constructor(u){d.bf.mark(d.bg.create);const e=Object.assign(Object.assign({},Au),u);if(e.minZoom!=null&&e.maxZoom!=null&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(e.minPitch!=null&&e.maxPitch!=null&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(e.minPitch!=null&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(e.maxPitch!=null&&e.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new ta(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies),{bearingSnap:e.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Dt,this._controls=[],this._mapId=d.a4(),this._contextLost=n=>{n.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new d.k("webglcontextlost",{originalEvent:n}))},this._contextRestored=n=>{this._setupPainter(),this.resize(),this._update(),this.fire(new d.k("webglcontextrestored",{originalEvent:n}))},this._onMapScroll=n=>{if(n.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()}
581,this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._maxTileCacheZoomLevels=e.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=e.preserveDrawingBuffer===!0,this._antialias=e.antialias===!0,this._trackResize=e.trackResize===!0,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles===!0,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions===!0,this._collectResourceTiming=e.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Bl),e.locale),this._clickTolerance=e.clickTolerance,this._overridePixelRatio=e.pixelRatio,this._maxCanvasSize=e.maxCanvasSize,this.transformCameraUpdate=e.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=e.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=we.addThrottleControl((()=>this.isMoving())),this._requestManager=new Vi(e.transformRequest),typeof e.container=="string"){if(this._container=document.getElementById(e.container),!this._container)throw new Error(`Container '${e.container}' not found.`)}else{if(!(e.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",(()=>this._update(!1))).on("moveend",(()=>this._update(!1))).on("zoom",(()=>this._update(!0))).on("terrain",(()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)})).once("idle",(()=>{this._idleTriggered=!0})),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let n=!1;const a=Da((o=>{this._trackResize&&!this._removed&&(this.resize(o),this.redraw())}),50);this._resizeObserver=new ResizeObserver((o=>{n?a(o):n=!0})),this._resizeObserver.observe(this._container)}this.handlers=new zl(this,e),this._hash=e.hash&&new _o(typeof e.hash=="string"&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,d.e({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,this._validateStyle=e.validateStyle,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new sa(typeof e.attributionControl=="boolean"?void 0:e.attributionControl)),e.maplibreLogo&&this.addControl(new Dl,e.logoPosition),this.on("style.load",(()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)})),this.on("data",(n=>{this._update(n.dataType==="style"),this.fire(new d.k(`${n.dataType}data`,n))})),this.on("dataloading",(n=>{this.fire(new d.k(`${n.dataType}dataloading`,n))})),this.on("dataabort",(n=>{this.fire(new d.k("sourcedataabort",n))}))}_getMapId(){return this._mapId}addControl(u,e){if(e===void 0&&(e=u.getDefaultPosition?u.getDefaultPosition():"top-right"),!u||!u.onAdd)return this.fire(new d.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=u.onAdd(this);this._controls.push(u);const a=this._controlPositions[e];return e.indexOf("bottom")!==-1?a.insertBefore(n,a.firstChild):a.appendChild(n),this}removeControl(u){if(!u||!u.onRemove)return this.fire(new d.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const e=this._controls.indexOf(u);return e>-1&&this._controls.splice(e,1),u.onRemove(this),this}hasControl(u){return this._controls.indexOf(u)>-1}calculateCameraOptionsFromTo(u,e,n,a){return a==null&&this.terrain&&(a=this.terrain.getElevationForLngLatZoom(n,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(u,e,n,a)}resize(u){var e;const n=this._containerDimensions(),a=n[0],o=n[1],c=this._getClampedPixelRatio(a,o);if(this._resizeCanvas(a,o,c),this.painter.resize(a,o,c),this.painter.overLimit()){const _=this.painter.context.gl;this._maxCanvasSize=[_.drawingBufferWidth,_.drawingBufferHeight];const y=this._getClampedPixelRatio(a,o);this._resizeCanvas(a,o,y),this.painter.resize(a,o,y)}this.transform.resize(a,o),(e=this._requestedCameraState)===null||e===void 0||e.resize(a,o);const m=!this._moving;return m&&(this.stop(),this.fire(new d.k("movestart",u)).fire(new d.k("move",u))),this.fire(new d.k("resize",u)),m&&this.fire(new d.k("moveend",u)),this}_getClampedPixelRatio(u,e){const{0:n,1:a}=this._maxCanvasSize,o=this.getPixelRatio(),c=u*o,m=e*o;return Math.min(c>n?n/c:1,m>a?a/m:1)*o}getPixelRatio(){var u;return(u=this._overridePixelRatio)!==null&&u!==void 0?u:devicePixelRatio}setPixelRatio(u){this._overridePixelRatio=u,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(u){return this.transform.setMaxBounds(he.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;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;
581throw 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;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(u){if((u=u??60)>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;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(u){return this.transform.renderWorldCopies=u,this._update()}project(u){return this.transform.locationPoint(d.N.convert(u),this.style&&this.terrain)}unproject(u){return this.transform.pointLocation(d.P.convert(u),this.terrain)}isMoving(){var u;return this._moving||((u=this.handlers)===null||u===void 0?void 0:u.isMoving())}isZooming(){var u;return this._zooming||((u=this.handlers)===null||u===void 0?void 0:u.isZooming())}isRotating(){var u;return this._rotating||((u=this.handlers)===null||u===void 0?void 0:u.isRotating())}_createDelegatedListener(u,e,n){if(u==="mouseenter"||u==="mouseover"){let a=!1;return{layers:e,listener:n,delegates:{mousemove:c=>{const m=e.filter((y=>this.getLayer(y))),_=m.length!==0?this.queryRenderedFeatures(c.point,{layers:m}):[];_.length?a||(a=!0,n.call(this,new rr(u,this,c.originalEvent,{features:_}))):a=!1},mouseout:()=>{a=!1}}}}if(u==="mouseleave"||u==="mouseout"){let a=!1;return{layers:e,listener:n,delegates:{mousemove:m=>{const _=e.filter((y=>this.getLayer(y)));(_.length!==0?this.queryRenderedFeatures(m.point,{layers:_}):[]).length?a=!0:a&&(a=!1,n.call(this,new rr(u,this,m.originalEvent)))},mouseout:m=>{a&&(a=!1,n.call(this,new rr(u,this,m.originalEvent)))}}}}{const a=o=>{const c=e.filter((_=>this.getLayer(_))),m=c.length!==0?this.queryRenderedFeatures(o.point,{layers:c}):[];m.length&&(o.features=m,n.call(this,o),delete o.features)};return{layers:e,listener:n,delegates:{[u]:a}}}}_saveDelegatedListener(u,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[u]=this._delegatedListeners[u]||[],this._delegatedListeners[u].push(e)}_removeDelegatedListener(u,e,n){if(!this._delegatedListeners||!this._delegatedListeners[u])return;const a=this._delegatedListeners[u];for(let o=0;o<a.length;o++){const c=a[o];if(c.listener===n&&c.layers.length===e.length&&c.layers.every((m=>e.includes(m)))){for(const m in c.delegates)this.off(m,c.delegates[m]);return void a.splice(o,1)}}}on(u,e,n){if(n===void 0)return super.on(u,e);const a=this._createDelegatedListener(u,typeof e=="string"?[e]:e,n);this._saveDelegatedListener(u,a);for(const o in a.delegates)this.on(o,a.delegates[o]);return this}once(u,e,n){if(n===void 0)return super.once(u,e);const a=typeof e=="string"?[e]:e,o=this._createDelegatedListener(u,a,n);for(const c in o.delegates){const m=o.delegates[c];o.delegates[c]=(..._)=>{this._removeDelegatedListener(u,a,n),m(..._)}}this._saveDelegatedListener(u,o);for(const c in o.delegates)this.once(c,o.delegates[c]);return this}off(u,e,n){return n===void 0?super.off(u,e):(this._removeDelegatedListener(u,typeof e=="string"?[e]:e,n),this)}queryRenderedFeatures(u,e){if(!this.style)return[];let n;const a=u instanceof d.P||Array.isArray(u),o=a?u:[[0,0],[this.transform.width,this.transform.height]];if(e=e||(a?{}:u)||{},o instanceof d.P||typeof o[0]=="number")n=[d.P.convert(o)];else{const c=d.P.convert(o[0]),m=d.P.convert(o[1]);n=[c,new d.P(m.x,c.y),m,new d.P(c.x,m.y),c]}return this.style.queryRenderedFeatures(n,e,this.transform)}querySourceFeatures(u,e){return this.style.querySourceFeatures(u,e)}setStyle(u,e){return(e=d.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._val
581idateStyle},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&u?(this._diffStyle(u,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(u,e))}setTransformRequest(u){return this._requestManager.setTransformRequest(u),this}_getUIString(u){const e=this._locale[u];if(e==null)throw new Error(`Missing UI string '${u}'`);return e}_updateStyle(u,e){if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(u,e)));const n=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!u)),u?(this.style=new Xr(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof u=="string"?this.style.loadURL(u,e,n):this.style.loadJSON(u,e,n),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Xr(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(u,e){if(typeof u=="string"){const n=this._requestManager.transformRequest(u,"Style");d.h(n,new AbortController).then((a=>{this._updateDiff(a.data,e)})).catch((a=>{a&&this.fire(new d.j(a))}))}else typeof u=="object"&&this._updateDiff(u,e)}_updateDiff(u,e){try{this.style.setState(u,e)&&this._update(!0)}catch(n){d.w(`Unable to perform style diff: ${n.message||n.error||n}.  Rebuilding the style from scratch.`),this._updateStyle(u,e)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():d.w("There is no style added to the map.")}addSource(u,e){return this._lazyInitEmptyStyle(),this.style.addSource(u,e),this._update(!0)}isSourceLoaded(u){const e=this.style&&this.style.sourceCaches[u];if(e!==void 0)return e.loaded();this.fire(new d.j(new Error(`There is no source with ID '${u}'`)))}setTerrain(u){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),u){const e=this.style.sourceCaches[u.source];if(!e)throw new Error(`cannot load terrain, because there exists no source with ID: ${u.source}`);this.terrain===null&&e.reload();for(const n in this.style._layers){const a=this.style._layers[n];a.type==="hillshade"&&a.source===u.source&&d.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Rl(this.painter,e,u),this.painter.renderToTexture=new Ec(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=n=>{n.dataType==="style"?this.terrain.sourceCache.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId!==u.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(n.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new d.k("terrain",{terrain:u})),this}getTerrain(){var u,e;return(e=(u=this.terrain)===null||u===void 0?void 0:u.options)!==null&&e!==void 0?e:null}areTilesLoaded(){const u=this.style&&this.style.sourceCaches;for(const e in u){const n=u[e]._tiles;for(const a in n){const o=n[a];if(o.state!=="loaded"&&o.state!=="errored")return!1}}return!0}removeSource(u){return this.style.removeSource(u),this._update(!0)}getSource(u){return this.style.getSource(u)}addImage(u,e,n={}){const{pixelRatio:a=1,sdf:o=!1,stretchX:c,stretchY:m,content:_,textFitWidth:y,textFitHeight:w}=n;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||d.b(e))){if(e.width===void 0||e.height===void 0)return this.fire(new d.j(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`")));{const{width:T,height:I,data:k}=e,F=e;return this.style.addImage(u,{data:new d.R({width:T,height:I},new Uint8Array(k)),pixelRatio:a,stretchX:c,stretchY:m,content:_,textFitWidth:y,textFitHeight:w,sdf:o,version:0,userImage:F}),F.onAdd&&F.onAdd(this,u),this}}{const{width:T,height:I,data:k}=de.getImageData(e);this.style.addImage(u,{data:new d.R({width:T,height:I},k),pixelRatio:a,stretchX:c,stretchY:m,content:_,textFitWidth:y,textFitHeight:w,sdf:o,version:0})}}updateImage(u,e){const n=this.style.getImage(u);if(!n)return this.fire(new d.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const a=e instanceof HTMLImageElement||d.b(e)?de.getImageData(e):e,{width:o,height:c,data:m}=a;if(o===void 0||c===void 0)return this.fire(new d.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(o!==n.data.width||c!==n.data.height)return this.fire(new d.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const _=!(e instanceof HTMLImageElement||d.b(e));return n.data.replace(m,_),this.style.updateImage(u,n),this}getImage(u){return this.style.getImage(u)}hasImage(u){return u?!!this.style.getImage(u):(this.fire(new d.j(new Error("Missing required image id"))),!1)}removeImage(u){this.style.removeImage(u)}loadImage(u){return we.getImage(this._requestManager.transformRequest(u,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(u,e){return this._lazyInitEmptyStyle(),this.style.addLayer(u,e),this._update(!0)}moveLayer(u,e){return this.style.moveLayer(u,e),this._update(!0)}removeLayer(u){return this.style.removeLayer(u),this._update(!0)}getLayer(u){return this.style.getLayer(u)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(u,e,n){return this.style.setLayerZoomRange(u,e,n),this._update(!0)}setFilter(u,e,n={}){return this.style.setFilter(u,e,n),this._update(!0)}getFilter(u){return this.style.getFilter(u)}setPaintProperty(u,e,n,a={}){return this.style.setPaintProperty(u,e,n,a),this._update(!0)}getPaintProperty(u,e){return this.style.getPaintProperty(u,e)}setLayoutProperty(u,e,n,a={}){return this.style.setLayoutProperty(u,e,n,a),this._update(!0)}getLayoutProperty(u,e){return this.style.getLayoutProperty(u,e)}setGlyphs(u,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(u,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(u,e,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(u,e,n,(a=>{a||this._update(!0)})),this}removeSprite(u){return this._lazyInitEmptyStyle(),this.style.removeSprite(u),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(u,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(u,e,(n=>{n||this._update(!0)})),this}setLight(u,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(u,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(u){return this._lazyInitEmptyStyle(),this.style.setSky(u),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(u,e){return this.style.setFeatureState(u,e),this._update()}removeFeatureState(u,e){return this.style.removeFeatureState(u,e),this._update()}getFeatureState(u){return this.style.getFeatureState(u)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let u=0,e=0;return this._container&&(u=this._container.clientWidth||400,e=this._container.clientHeight||300),[u,e]}_setupContainer(){const u=this._container;u.classList.add("maplibregl-map");const e=this._canvasContainer=K.create("div","maplibregl-canvas-container",u);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=K.create("canvas","maplibregl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","regi
581on");const n=this._containerDimensions(),a=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],a);const o=this._controlContainer=K.create("div","maplibregl-control-container",u),c=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((m=>{c[m]=K.create("div",`maplibregl-ctrl-${m} `,o)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(u,e,n){this._canvas.width=Math.floor(n*u),this._canvas.height=Math.floor(n*e),this._canvas.style.width=`${u}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const u={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let e=null;this._canvas.addEventListener("webglcontextcreationerror",(a=>{e={requestedAttributes:u},a&&(e.statusMessage=a.statusMessage,e.type=a.type)}),{once:!0});const n=this._canvas.getContext("webgl2",u)||this._canvas.getContext("webgl",u);if(!n){const a="Failed to initialize WebGL";throw e?(e.message=a,new Error(JSON.stringify(e))):new Error(a)}this.painter=new go(n,this.transform),Ze.testSupport(n)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(u){return this.style&&this.style._loaded?(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)}_render(u){const e=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(u),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const o=this.transform.zoom,c=de.now();this.style.zoomHistory.update(o,c);const m=new d.z(o,{now:c,fadeDuration:e,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),_=m.crossFadingFactor();_===1&&_===this._crossFadingFactor||(n=!0,this._crossFadingFactor=_),this.style.update(m)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,e,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:e,showPadding:this.showPadding}),this.fire(new d.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,d.bf.mark(d.bg.load),this.fire(new d.k("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const a=this._sourcesDirty||this._styleDirty||this._placementDirty;return a||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new d.k("idle")),!this._loaded||this._fullyLoaded||a||(this._fullyLoaded=!0,d.bf.mark(d.bg.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var u;this._hash&&this._hash.remove();for(const n of this._controls)n.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),we.removeThrottleControl(this._imageQueueHandle),(u=this._resizeObserver)===null||u===void 0||u.disconnect();const e=this.painter.context.gl.getExtension("WEBGL_lose_context");e!=null&&e.loseContext&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),K.remove(this._canvasContainer),K.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),d.bf.clearMetrics(),this._removed=!0,this.fire(new d.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,de.frameAsync(this._frameRequest).then((u=>{d.bf.frame(u),this._frameRequest=null,this._render(u)})).catch((()=>{})))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(u){this._showTileBoundaries!==u&&(this._showTileBoundaries=u,this._update())}get showPadding(){return!!this._showPadding}set showPadding(u){this._showPadding!==u&&(this._showPadding=u,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(u){this._showCollisionBoxes!==u&&(this._showCollisionBoxes=u,u?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(u){this._showOverdrawInspector!==u&&(this._showOverdrawInspector=u,this._update())}get repaint(){return!!this._repaint}set repaint(u){this._repaint!==u&&(this._repaint=u,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(u){this._vertices=u,this._update()}get version(){return Pc}getCameraTargetElevation(){return this.transform.elevation}},A.MapMouseEvent=rr,A.MapTouchEvent=Ts,A.MapWheelEvent=bc,A.Marker=Eo,A.NavigationControl
581=class{constructor(u){this._updateZoomButtons=()=>{const e=this._map.getZoom(),n=e===this._map.getMaxZoom(),a=e===this._map.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=a,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",a.toString())},this._rotateCompassArrow=()=>{const e=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=e},this._setButtonTitle=(e,n)=>{const a=this._map._getUIString(`NavigationControl.${n}`);e.title=a,e.setAttribute("aria-label",a)},this.options=d.e({},Eu,u),this._container=K.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(e=>this._map.zoomIn({},{originalEvent:e}))),K.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(e=>this._map.zoomOut({},{originalEvent:e}))),K.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",(e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})})),this._compassIcon=K.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(u){return this._map=u,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Pu(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){K.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(u,e){const n=K.create("button",u,this._container);return n.type="button",n.addEventListener("click",e),n}},A.Popup=class extends d.E{constructor(u){super(),this.remove=()=>(this._content&&K.remove(this._content),this._container&&(K.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new d.k("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{var n;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=K.create("div","maplibregl-popup",this._map.getContainer()),this._tip=K.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const _ of this.options.className.split(" "))this._container.classList.add(_);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?oi(this._lngLat,this._flatPos,this._map.transform):(n=this._lngLat)===null||n===void 0?void 0:n.wrap(),this._trackPointer&&!e)return;const a=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationPoint(this._lngLat));let o=this.options.anchor;const c=Co(this.options.offset);if(!o){const _=this._container.offsetWidth,y=this._container.offsetHeight;let w;w=a.y+c.bottom.y<y?["top"]:a.y>this._map.transform.height-y?["bottom"]:[],a.x<_/2?w.push("left"):a.x>this._map.transform.width-_/2&&w.push("right"),o=w.length===0?"bottom":w.join("-")}let m=a.add(c[o]);this.options.subpixelPositioning||(m=m.round()),K.setTransform(this._container,`${oa[o]} translate(${m.x}px,${m.y}px)`),Ao(this._container,o,"popup")},this._onClose=()=>{this.remove()},this.options=d.e(Object.create(ut),u)}addTo(u){return this._map&&this.remove(),this._map=u,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new d.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(u){return this._lngLat=d.N.convert(u),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(u){return this.setDOMContent(document.createTextNode(u))}setHTML(u){const e=document.createDocumentFragment(),n=document.createElement("body");let a;for(n.innerHTML=u;a=n.firstChild,a;)e.appendChild(a);return this.setDOMContent(e)}getMaxWidth(){var u;return(u=this._container)===null||u===void 0?void 0:u.style.maxWidth}setMaxWidth(u){return this.options.maxWidth=u,this._update(),this}setDOMContent(u){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=K.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(u),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(u){return this._container&&this._container.classList.add(u),this}removeClassName(u){return this._container&&this._container.classList.remove(u),this}setOffset(u){return this.options.offset=u,this._update(),this}toggleClassName(u){if(this._container)return this._container.classList.toggle(u)}setSubpixelPositioning(u){this.options.subpixelPositioning=u}_createCloseButton(){this.options.closeButton&&(this._closeButton=K.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const u=this._container.querySelector(Po);u&&u.focus()}},A.RasterDEMTileSource=kt,A.RasterTileSource=Ct,A.ScaleControl=class{constructor(u){this._onMove=()=>{Ua(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,Ua(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Rn),u)}getDefaultPosition(){return"bottom-left"}onAdd(u){return this._map=u,this._container=K.create("div","maplibregl-ctrl maplibregl-ctrl-scale",u.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){K.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}}
581,A.ScrollZoomHandler=_n,A.Style=Xr,A.TerrainControl=class{constructor(u){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=u}onAdd(u){return this._map=u,this._container=K.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=K.create("button","maplibregl-ctrl-terrain",this._container),K.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){K.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},A.TwoFingersTouchPitchHandler=Oa,A.TwoFingersTouchRotateHandler=Cl,A.TwoFingersTouchZoomHandler=El,A.TwoFingersTouchZoomRotateHandler=kl,A.VectorTileSource=dn,A.VideoSource=Kn,A.addSourceType=(u,e)=>d._(void 0,void 0,void 0,(function*(){if(fs(u))throw new Error(`A source type called "${u}" already exists.`);((n,a)=>{ps[n]=a})(u,e)})),A.clearPrewarmedResources=function(){const u=Zi;u&&(u.isPreloaded()&&u.numActive()===1?(u.release(ki),Zi=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()"))},A.getMaxParallelImageRequests=function(){return d.a.MAX_PARALLEL_IMAGE_REQUESTS},A.getRTLTextPluginStatus=function(){return mr().getRTLTextPluginStatus()},A.getVersion=function(){return Ol},A.getWorkerCount=function(){return Ei.workerCount},A.getWorkerUrl=function(){return d.a.WORKER_URL},A.importScriptInWorkers=function(u){return Pi().broadcast("IS",u)},A.prewarm=function(){Zr().acquire(ki)},A.setMaxParallelImageRequests=function(u){d.a.MAX_PARALLEL_IMAGE_REQUESTS=u},A.setRTLTextPlugin=function(u,e){return mr().setRTLTextPlugin(u,e)},A.setWorkerCount=function(u){Ei.workerCount=u},A.setWorkerUrl=function(u){d.a.WORKER_URL=u}}));var Q=D;return Q}))})(lu)),lu.exports}var n_=ou.exports,Mp;function s_(){return Mp||(Mp=1,(function(x,L){(function(D,O){x.exports=O(kg(),r_())})(typeof globalThis<"u"?globalThis:n_||self,function(D,O){D.MaplibreGL=D.Layer.extend({options:{updateInterval:32,padding:.1,interactive:!1,pane:"tilePane"},initialize:function(Y){D.setOptions(this,Y),this._throttledUpdate=D.Util.throttle(this._update,this.options.updateInterval,this)},onAdd:function(Y){this._container||this._initContainer();var Q=this.getPaneName();Y.getPane(Q).appendChild(this._container),this._initGL(),this._offset=this._map.containerPointToLayerPoint([0,0]),Y.options.zoomAnimation&&D.DomEvent.on(Y._proxy,D.DomUtil.TRANSITION_END,this._transitionEnd,this)},onRemove:function(Y){this._map._proxy&&this._map.options.zoomAnimation&&D.DomEvent.off(this._map._proxy,D.DomUtil.TRANSITION_END,this._transitionEnd,this);var Q=this.getPaneName();Y.getPane(Q).removeChild(this._container),this._glMap.remove(),this._glMap=null},getEvents:function(){return{move:this._throttledUpdate,zoomanim:this._animateZoom,zoom:this._pinchZoom,zoomstart:this._zoomStart,zoomend:this._zoomEnd,resize:this._resize}},getAttribution:function(){if(this.options.attributionControl)return this.options.attributionControl.customAttribution;var Y=this._glMap;if(Y&&this.options.attributionControl!==!1){var Q=Y.getStyle();if(Q&&Q.sources)return Object.keys(Q.sources).map(function(A){var d=Y.getSource(A);return d&&typeof d.attribution=="string"?d.attribution.trim():null}).filter(Boolean).join(", ")}return""},getMaplibreMap:function(){return this._glMap},getCanvas:function(){return this._glMap.getCanvas()},getSize:function(){return this._map.getSize().multiplyBy(1+this.options.padding*2)},getBounds:function(){var Y=this.getSize().multiplyBy(.5),Q=this._map.latLngToContainerPoint(this._map.getCenter());return D.latLngBounds(this._map.containerPointToLatLng(Q.subtract(Y)),this._map.containerPointToLatLng(Q.add(Y)))},getContainer:function(){return this._container},getPaneName:function(){return this._map.getPane(this.options.pane)?this.options.pane:"tilePane"},_roundPoint:function(Y){return{x:Math.round(Y.x),y:Math.round(Y.y)}},_initContainer:function(){var Y=this._container=D.DomUtil.create("div","leaflet-gl-layer");this._resizeContainer();var Q=this._map.getSize().multiplyBy(this.options.padding),A=this._map.containerPointToLayerPoint([0,0]).subtract(Q);D.DomUtil.setPosition(Y,this._roundPoint(A))},_resizeContainer:function(){var Y=this.getSize();this._container.style.width=Y.x+"px",this._container.style.height=Y.y+"px"},_initGL:function(){var Y=this._map.getCenter(),Q=D.extend({},this.options,{container:this._container,center:[Y.lng,Y.lat],zoom:this._map.getZoom()-1,attributionControl:!1});this._glMap=new O.Map(Q);var A=this._map,d=this.getAttribution(),xe=this.getAttribution.bind(this);this._glMap.on("load",function(){A&&A.attributionControl&&(A.attributionControl.removeAttribution(d),A.attributionControl.addAttribution(xe()))});var Se=Object.getPrototypeOf(this._glMap.transform),ke=Object.getOwnPropertyDescriptor(Se,"latRange");(!ke||ke.set||ke.writable)&&(this._glMap.transform.latRange=null);var de=Object.getOwnPropertyDescriptor(Se,"maxValidLatitude");(!de||de.set||de.writable)&&(this._glMap.transform.maxValidLatitude=1/0),this._glMap.transform._helper&&this._glMap.transform._helper._latRange&&(this._glMap.transform._helper._latRange=[-1/0,1/0]),this._transformGL(this._glMap),this._glMap._canvas.canvas?this._glMap._actualCanvas=this._glMap._canvas.canvas:this._glMap._actualCanvas=this._glMap._canvas;var K=this._glMap._actualCanvas;D.DomUtil.addClass(K,"leaflet-image-layer"),D.DomUtil.addClass(K,"leaflet-zoom-animated"),this.options.interactive&&D.DomUtil.addClass(K,"leaflet-interactive"),this.options.className&&D.DomUtil.addClass(K,this.options.className)},_update:function(Y){if(this._map&&(this._offset=this._map.containerPointToLayerPoint([0,0]),!this._zooming)){var Q=this._container,A=this._glMap,d=this._map.getSize().multiplyBy(this.options.padding),xe=this._map.containerPointToLayerPoint([0,0]).subtract(d);D.DomUtil.setPosition(Q,this._roundPoint(xe)),this._transformGL(A)}},_transformGL:function(Y){var Q=this._map.getCenter(),A=Y._getTransformForUpdate();A.setCenter?(A.setCenter(O.LngLat.convert([Q.lng,Q.lat])),A.setZoom(this._map.getZoom()-1),Y.transform.apply(A)):(A=Y.transform,A.center=O.LngLat.convert([Q.lng,Q.lat]),A.zoom=this._map.getZoom()-1),Y._fireMoveEvents()},_pinchZoom:function(Y){this._glMap.jumpTo({zoom:this._map.getZoom()-1,center:this._map.getCenter()})},_animateZoom:function(Y){var Q=this._map.getZoomScale(Y.zoom),A=this._map.getSize().multiplyBy(this.options.padding*Q),d=this.getSize()._divideBy(2),xe=this._map.project(Y.center,Y.zoom)._subtract(d)._add(this._map._getMapPanePos().add(A))._round(),Se=this._map.project(this._map.getBounds().getNorthWest(),Y.zoom)._subtract(xe);D.DomUtil.setTransform(this._glMap._actualCanvas,Se.subtract(this._offset),Q)},_zoomStart:function(Y){this._zooming=!0},_zoomEnd:function(){var Y=this._map.getZoomScale(this._map.getZoom());D.DomUtil.setTransform(this._glMap._actualCanvas,null,Y),this._zooming=!1,this._update()}
581,_transitionEnd:function(Y){D.Util.requestAnimFrame(function(){var Q=this._map.getZoom(),A=this._map.getCenter(),d=this._map.latLngToContainerPoint(this._map.getBounds().getNorthWest());this._resizeContainer(),D.DomUtil.setTransform(this._glMap._actualCanvas,d,1),this._glMap.once("moveend",D.Util.bind(function(){this._zoomEnd()},this)),this._glMap.jumpTo({center:A,zoom:Q-1})},this)},_resize:function(Y){this._transitionEnd(Y)}}),D.maplibreGL=function(Y){return new D.MaplibreGL(Y)}})})(ou)),ou.exports}s_();const kp=(x,L)=>{for(const D of Object.keys(L))x.on(D,L[D])},a_=x=>{for(const L of Object.keys(x)){const D=x[L];D&&Ja(D.cancel)&&D.cancel()}},o_=x=>!x||typeof x.charAt!="function"?x:x.charAt(0).toUpperCase()+x.slice(1),Ja=x=>typeof x=="function",mu=(x,L,D)=>{for(const O in D){const Y="set"+o_(O);x[Y]?Fi(()=>D[O],(Q,A)=>{x[Y](Q,A)}):L[Y]&&Fi(()=>D[O],Q=>{L[Y](Q)})}},hc=(x,L,D={})=>{const O={...D};for(const Y in x){const Q=L[Y],A=x[Y];Q&&(Q&&Q.custom===!0||A!==void 0&&(O[Y]=A))}return O},Vh=x=>{const L={},D={};for(const O in x)if(O.startsWith("on")&&!O.startsWith("onUpdate")&&O!=="onReady"){const Y=O.slice(2).toLocaleLowerCase();L[Y]=x[O]}else D[O]=x[O];return{listeners:L,attrs:D}},l_=async x=>{const L=await Promise.all([dr(()=>import("./D4k_ikNW.js"),[],import.meta.url),dr(()=>import("./C2eJqgqv.js"),[],import.meta.url),dr(()=>import("./DU6CIJ0p.js"),[],import.meta.url)]);delete x.Default.prototype._getIconUrl,x.Default.mergeOptions({iconRetinaUrl:L[0].default,iconUrl:L[1].default,shadowUrl:L[2].default})},eu=x=>{const L=Wt((...O)=>console.warn(`Method ${x} has been invoked without being replaced`)),D=(...O)=>L.value(...O);return D.wrapped=L,Ko(x,D),D},tu=(x,L)=>x.wrapped.value=L,Jo=typeof self=="object"&&self.self===self&&self||typeof global=="object"&&global.global===global&&global||globalThis,to=x=>{const L=uc(x);if(L===void 0)throw new Error(`Attempt to inject ${x.description} before it was provided.`);return L},gu=Symbol("useGlobalLeaflet"),Uh=Symbol("addLayer"),tf=Symbol("removeLayer"),rf=Symbol("registerControl"),c_=Symbol("registerLayerControl"),u_=Symbol("canSetParentHtml"),h_=Symbol("setParentHtml"),d_=Symbol("setIcon"),p_=Symbol("bindPopup"),f_=Symbol("bindTooltip"),m_=Symbol("unbindPopup"),g_=Symbol("unbindTooltip"),dc={options:{type:Object,default:()=>({}),custom:!0}},_u=x=>({options:x.options,methods:{}}),tl={...dc,pane:{type:String},attribution:{type:String},name:{type:String,custom:!0},layerType:{type:String,custom:!0},visible:{type:Boolean,custom:!0,default:!0}},__=(x,L,D)=>{const O=to(Uh),Y=to(tf),{options:Q,methods:A}=_u(x),d=hc(x,tl,Q),xe=()=>O({leafletObject:L.value}),Se=()=>Y({leafletObject:L.value}),ke={...A,setAttribution(de){Se(),L.value.options.attribution=de,x.visible&&xe()},setName(){Se(),x.visible&&xe()},setLayerType(){Se(),x.visible&&xe()},setVisible(de){L.value&&(de?xe():Se())},bindPopup(de){if(!L.value||!Ja(L.value.bindPopup)){console.warn("Attempt to bind popup before bindPopup method available on layer.");return}L.value.bindPopup(de)},bindTooltip(de){if(!L.value||!Ja(L.value.bindTooltip)){console.warn("Attempt to bind tooltip before bindTooltip method available on layer.");return}L.value.bindTooltip(de)},unbindTooltip(){L.value&&(Ja(L.value.closeTooltip)&&L.value.closeTooltip(),Ja(L.value.unbindTooltip)&&L.value.unbindTooltip())},unbindPopup(){L.value&&(Ja(L.value.closePopup)&&L.value.closePopup(),Ja(L.value.unbindPopup)&&L.value.unbindPopup())},updateVisibleProp(de){D.emit("update:visible",de)}};return Ko(p_,ke.bindPopup),Ko(f_,ke.bindTooltip),Ko(m_,ke.unbindPopup),Ko(g_,ke.unbindTooltip),el(()=>{ke.unbindPopup(),ke.unbindTooltip(),Se()}),{options:d,methods:ke}},y_={...tl,interactive:{type:Boolean,default:void 0},bubblingMouseEvents:{type:Boolean,default:void 0}},nf={...y_,stroke:{type:Boolean,default:void 0},color:{type:String},weight:{type:Number},opacity:{type:Number},lineCap:{type:String},lineJoin:{type:String},dashArray:{type:String},dashOffset:{type:String},fill:{type:Boolean,default:void 0},fillColor:{type:String},fillOpacity:{type:Number},fillRule:{type:String},className:{type:String}},v_={...nf,radius:{type:Number},latLng:{type:[Object,Array],required:!0,custom:!0}};({...v_});const il={...dc,position:{type:String}},x_=(x,L)=>{const{options:D,methods:O}=_u(x),Y=hc(x,il,D),Q={...O,setPosition(A){L.value&&L.value.setPosition(A)}};return el(()=>{L.value&&L.value.remove()}),{options:Y,methods:Q}},b_=x=>x.default?cc("div",{ref:"root"},x.default()):null;us({name:"LControl",props:{...il,disableClickPropagation:{type:Boolean,custom:!0,default:!0},disableScrollPropagation:{type:Boolean,custom:!0,default:!1}},setup(x,L){const D=Wt(),O=Wt(),Y=uc(gu),Q=to(rf),{options:A,methods:d}=x_(x,D);return Ds(async()=>{const{Control:xe,DomEvent:Se}=Y?Jo.L:await dr(()=>import("./C6uo2YWw.js"),[],import.meta.url),ke=xe.extend({onAdd(){return O.value}});D.value=Rh(new ke(A)),mu(d,D.value,x),Q({leafletObject:D.value}),x.disableClickPropagation&&O.value&&Se.disableClickPropagation(O.value),x.disableScrollPropagation&&O.value&&Se.disableScrollPropagation(O.value),io(()=>L.emit("ready",D.value))}),{root:O,leafletObject:D}},render(){return b_(this.$slots)}});({...il});({...il});({...il});({...il});const sf={...tl};({...sf});({...sf});const jh={...tl,opacity:{type:Number},zIndex:{type:Number},tileSize:{type:[Number,Array,Object]},noWrap:{type:Boolean,default:void 0},minZoom:{type:Number},maxZoom:{type:Number},className:{type:String}},w_=(x,L,D)=>{const{options:O,methods:Y}=__(x,L,D),Q=hc(x,jh,O),A={...Y,setTileComponent(){var d;(d=L.value)==null||d.redraw()}};return el(()=>{L.value.off()}),{options:Q,methods:A}},S_=(x,L,D,O)=>x.extend({initialize(Y){this.tileComponents={},this.on("tileunload",this._unloadTile),D.setOptions(this,Y)},createTile(Y){const Q=this._tileCoordsToKey(Y);this.tileComponents[Q]=L.create("div");const A=cc({setup:O,props:["coords"]}
581,{coords:Y});return yg(A,this.tileComponents[Q]),this.tileComponents[Q]},_unloadTile(Y){const Q=this._tileCoordsToKey(Y.coords);this.tileComponents[Q]&&(this.tileComponents[Q].innerHTML="",this.tileComponents[Q]=void 0)}});us({props:{...jh,childRender:{type:Function,required:!0}},setup(x,L){const D=Wt(),O=Wt(null),Y=Wt(!1),Q=uc(gu),A=to(Uh),{options:d,methods:xe}=w_(x,D,L);return Ds(async()=>{const{GridLayer:Se,DomUtil:ke,Util:de}=Q?Jo.L:await dr(()=>import("./C6uo2YWw.js"),[],import.meta.url),K=S_(Se,ke,de,x.childRender);D.value=Rh(new K(d));const{listeners:Ze}=Vh(L.attrs);D.value.on(Ze),mu(xe,D.value,x),A({...x,...xe,leafletObject:D.value}),Y.value=!0,io(()=>L.emit("ready",D.value))}),{root:O,ready:Y,leafletObject:D}},render(){return this.ready?cc("div",{style:{display:"none"},ref:"root"}):null}});const zp={iconUrl:{type:String},iconRetinaUrl:{type:String},iconSize:{type:[Object,Array]},iconAnchor:{type:[Object,Array]},popupAnchor:{type:[Object,Array]},tooltipAnchor:{type:[Object,Array]},shadowUrl:{type:String},shadowRetinaUrl:{type:String},shadowSize:{type:[Object,Array]},shadowAnchor:{type:[Object,Array]},bgPos:{type:[Object,Array]},className:{type:String}};us({name:"LIcon",props:{...zp,...dc},setup(x,L){const D=Wt(),O=uc(gu),Y=to(u_),Q=to(h_),A=to(d_);let d,xe,Se,ke,de;const K=(We,st,xt)=>{const we=We&&We.innerHTML;if(!st){xt&&de&&Y()&&Q(we);return}const{listeners:Vi}=Vh(L.attrs);de&&xe(de,Vi);const{options:Ot}=_u(x),Ge=hc(x,zp,Ot);we&&(Ge.html=we),de=Ge.html?Se(Ge):ke(Ge),d(de,Vi),A(de)},Ze=()=>{io(()=>K(D.value,!0,!1))},vt=()=>{io(()=>K(D.value,!1,!0))},Rt={setIconUrl:Ze,setIconRetinaUrl:Ze,setIconSize:Ze,setIconAnchor:Ze,setPopupAnchor:Ze,setTooltipAnchor:Ze,setShadowUrl:Ze,setShadowRetinaUrl:Ze,setShadowAnchor:Ze,setBgPos:Ze,setClassName:Ze,setHtml:Ze};return Ds(async()=>{const{DomEvent:We,divIcon:st,icon:xt}=O?Jo.L:await dr(()=>import("./C6uo2YWw.js"),[],import.meta.url);d=We.on,xe=We.off,Se=st,ke=xt,mu(Rt,{},x),new MutationObserver(vt).observe(D.value,{attributes:!0,childList:!0,characterData:!0,subtree:!0}),Ze()}),{root:D}},render(){const x=this.$slots.default?this.$slots.default():void 0;return cc("div",{ref:"root"},x)}});({...tl});function T_(x,L,D){var O,Y,Q;L===void 0&&(L=50),D===void 0&&(D={});var A=(O=D.isImmediate)!=null&&O,d=(Y=D.callback)!=null&&Y,xe=D.maxWait,Se=Date.now(),ke=[];function de(){if(xe!==void 0){var Ze=Date.now()-Se;if(Ze+L>=xe)return xe-Ze}return L}var K=function(){var Ze=[].slice.call(arguments),vt=this;return new Promise(function(Rt,We){var st=A&&Q===void 0;if(Q!==void 0&&clearTimeout(Q),Q=setTimeout(function(){if(Q=void 0,Se=Date.now(),!A){var we=x.apply(vt,Ze);d&&d(we),ke.forEach(function(Vi){return(0,Vi.resolve)(we)}),ke=[]}},de()),st){var xt=x.apply(vt,Ze);return d&&d(xt),Rt(xt)}ke.push({resolve:Rt,reject:We})})};return K.cancel=function(Ze){Q!==void 0&&clearTimeout(Q),ke.forEach(function(vt){return(0,vt.reject)(Ze)}),ke=[]},K}const Dp={...dc,center:{type:[Object,Array]},bounds:{type:[Array,Object]},maxBounds:{type:[Array,Object]},zoom:{type:Number},minZoom:{type:Number},maxZoom:{type:Number},paddingBottomRight:{type:[Object,Array]},paddingTopLeft:{type:Object},padding:{type:Object},worldCopyJump:{type:Boolean,default:void 0},crs:{type:[String,Object]},maxBoundsViscosity:{type:Number},inertia:{type:Boolean,default:void 0},inertiaDeceleration:{type:Number},inertiaMaxSpeed:{type:Number},easeLinearity:{type:Number},zoomAnimation:{type:Boolean,default:void 0},zoomAnimationThreshold:{type:Number},fadeAnimation:{type:Boolean,default:void 0},markerZoomAnimation:{type:Boolean,default:void 0},noBlockingAnimations:{type:Boolean,default:void 0},useGlobalLeaflet:{type:Boolean,default:!0,custom:!0}},I_=us({inheritAttrs:!1,emits:["ready","update:zoom","update:center","update:bounds"],props:Dp,setup(x,L){const D=Wt(),O=Wp({ready:!1,layersToAdd:[],layersInControl:[]}),{options:Y}=_u(x),Q=hc(x,Dp,Y),{listeners:A,attrs:d}=Vh(L.attrs),xe=eu(Uh),Se=eu(tf),ke=eu(rf),de=eu(c_);Ko(gu,x.useGlobalLeaflet);const K=ct(()=>{const st={};return x.noBlockingAnimations&&(st.animate=!1),st}),Ze=ct(()=>{const st=K.value;return x.padding&&(st.padding=x.padding),x.paddingTopLeft&&(st.paddingTopLeft=x.paddingTopLeft),x.paddingBottomRight&&(st.paddingBottomRight=x.paddingBottomRight),st}),vt={moveend:T_(st=>{O.leafletRef&&(L.emit("update:zoom",O.leafletRef.getZoom()),L.emit("update:center",O.leafletRef.getCenter()),L.emit("update:bounds",O.leafletRef.getBounds()))}),overlayadd(st){const xt=O.layersInControl.find(we=>we.name===st.name);xt&&xt.updateVisibleProp(!0)},overlayremove(st){const xt=O.layersInControl.find(we=>we.name===st.name);xt&&xt.updateVisibleProp(!1)}};Ds(async()=>{x.useGlobalLeaflet&&(Jo.L=Jo.L||await dr(()=>import("./CwphVnsR.js").then(Ve=>Ve.t),[],import.meta.url));const{map:st,CRS:xt,Icon:we,latLngBounds:Vi,latLng:Ot,stamp:Ge}=x.useGlobalLeaflet?Jo.L:await dr(()=>import("./C6uo2YWw.js"),[],import.meta.url);try{Q.beforeMapMount&&await Q.beforeMapMount()}catch(Ve){console.error(`The following error occurred running the provided beforeMapMount hook ${Ve.message}`)}await l_(we);const ot=typeof Q.crs=="string"?xt[Q.crs]:Q.crs;Q.crs=ot||xt.EPSG3857;const ge={addLayer(Ve){Ve.layerType!==void 0&&(O.layerControl===void 0?O.layersToAdd.push(Ve):O.layersInControl.find(qe=>Ge(qe.leafletObject)===Ge(Ve.leafletObject))||(O.layerControl.addLayer(Ve),O.layersInControl.push(Ve))),Ve.visible!==!1&&O.leafletRef.addLayer(Ve.leafletObject)},removeLayer(Ve){Ve.layerType!==void 0&&(O.layerControl===void 0?O.layersToAdd=O.layersToAdd.filter(qe=>qe.name!==Ve.name):(O.layerControl.removeLayer(Ve.leafletObject),O.layersInControl
581=O.layersInControl.filter(qe=>Ge(qe.leafletObject)!==Ge(Ve.leafletObject)))),O.leafletRef.removeLayer(Ve.leafletObject)},registerLayerControl(Ve){O.layerControl=Ve,O.layersToAdd.forEach(qe=>{O.layerControl.addLayer(qe)}),O.layersToAdd=[],ke(Ve)},registerControl(Ve){O.leafletRef.addControl(Ve.leafletObject)},setZoom(Ve){const qe=O.leafletRef.getZoom();Ve!==qe&&O.leafletRef.setZoom(Ve,K.value)},setCrs(Ve){const qe=O.leafletRef.getBounds();O.leafletRef.options.crs=Ve,O.leafletRef.fitBounds(qe,{animate:!1,padding:[0,0]})},fitBounds(Ve){O.leafletRef.fitBounds(Ve,Ze.value)},setBounds(Ve){if(!Ve)return;const qe=Vi(Ve);qe.isValid()&&!(O.lastSetBounds||O.leafletRef.getBounds()).equals(qe,0)&&(O.lastSetBounds=qe,O.leafletRef.fitBounds(qe))},setCenter(Ve){if(Ve==null)return;const qe=Ot(Ve),dt=O.lastSetCenter||O.leafletRef.getCenter();(dt.lat!==qe.lat||dt.lng!==qe.lng)&&(O.lastSetCenter=qe,O.leafletRef.panTo(qe,K.value))}};tu(xe,ge.addLayer),tu(Se,ge.removeLayer),tu(ke,ge.registerControl),tu(de,ge.registerLayerControl),O.leafletRef=Rh(st(D.value,Q)),mu(ge,O.leafletRef,x),kp(O.leafletRef,vt),kp(O.leafletRef,A),O.ready=!0,io(()=>L.emit("ready",O.leafletRef))}),Lh(()=>{a_(vt),O.leafletRef&&(O.leafletRef.off(),O.leafletRef.remove())});const Rt=ct(()=>O.leafletRef),We=ct(()=>O.ready);return{root:D,ready:We,leafletObject:Rt,attrs:d}},render({attrs:x}){return x.style||(x.style={}),x.style.width||(x.style.width="100%"),x.style.height||(x.style.height="100%"),cc("div",{...x,ref:"root"},this.ready&&this.$slots.default?this.$slots.default():{})}});({...tl});const A_={...nf,smoothFactor:{type:Number},noClip:{type:Boolean,default:void 0},latLngs:{type:Array,required:!0,custom:!0}},Lp={...A_},af={...dc,content:{type:String,default:null}};({...af});({...Lp,latLngs:{...Lp.latLngs}});const E_={...jh,tms:{type:Boolean,default:void 0},subdomains:{type:[String,Array],validator:x=>typeof x=="string"?!0:Array.isArray(x)?x.every(L=>typeof L=="string"):!1},detectRetina:{type:Boolean,default:void 0},url:{type:String,required:!0,custom:!0}};({...af});({...E_});function Qa(){return Qa=Object.assign?Object.assign.bind():function(x){for(var L=1;L<arguments.length;L++){var D=arguments[L];for(var O in D)Object.prototype.hasOwnProperty.call(D,O)&&(x[O]=D[O])}return x},Qa.apply(this,arguments)}function P_(x,L){x.prototype=Object.create(L.prototype),x.prototype.constructor=x,du(x,L)}function du(x,L){return du=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(D,O){return D.__proto__=O,D},du(x,L)}function C_(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Eh(x,L,D){return Eh=C_()?Reflect.construct.bind():function(O,Y,Q){var A=[null];A.push.apply(A,Y);var d=new(Function.bind.apply(O,A));return Q&&du(d,Q.prototype),d},Eh.apply(null,arguments)}function zs(x,L,D,O){L===void 0&&(L=""),O===void 0&&(O={});var Y=document.createElement(x);return L&&(Y.className=L),Object.keys(O).forEach(function(Q){if(typeof O[Q]=="function"){var A=Q.indexOf("on")===0?Q.substr(2).toLowerCase():Q;Y.addEventListener(A,O[Q])}else Q==="html"?Y.innerHTML=O[Q]:Q==="text"?Y.innerText=O[Q]:Y.setAttribute(Q,O[Q])}),D&&D.appendChild(Y),Y}function nc(x){x.preventDefault(),x.stopPropagation()}var cu=function(){return[].slice.call(arguments).filter(Boolean).join(" ").trim()};function eo(x,L){x&&x.classList&&(Array.isArray(L)?L:[L]).forEach(function(D){x.classList.contains(D)||x.classList.add(D)})}function cs(x,L){x&&x.classList&&(Array.isArray(L)?L:[L]).forEach(function(D){x.classList.contains(D)&&x.classList.remove(D)})}var pu,fu=13,Ph=40,of=38,M_=[fu,27,Ph,of,37,39],k_=(function(){function x(D){var O=this,Y=D.handleSubmit,Q=D.searchLabel,A=D.classNames,d=A===void 0?{}:A;this.container=void 0,this.form=void 0,this.input=void 0,this.handleSubmit=void 0,this.hasError=!1,this.container=zs("div",cu("geosearch",d.container)),this.form=zs("form",["",d.form].join(" "),this.container,{autocomplete:"none",onClick:nc,onDblClick:nc,touchStart:nc,touchEnd:nc}),this.input=zs("input",["glass",d.input].join(" "),this.form,{type:"text",placeholder:Q||"search",onInput:this.onInput,onKeyUp:function(xe){return O.onKeyUp(xe)},onKeyPress:function(xe){return O.onKeyPress(xe)},onFocus:this.onFocus,onBlur:this.onBlur,onClick:function(){O.input.focus(),O.input.dispatchEvent(new Event("focus"))}}),this.handleSubmit=Y}var L=x.prototype;return L.onFocus=function(){eo(this.form,"active")},L.onBlur=function(){cs(this.form,"active")},L.onSubmit=function(D){try{var O=this;return nc(D),cs(Y=O.container,"error"),eo(Y,"pending"),Promise.resolve(O.handleSubmit({query:O.input.value})).then(function(){cs(O.container,"pending")})}catch(Q){return Promise.reject(Q)}var Y},L.onInput=function(){this.hasError&&(cs(this.container,"error"),this.hasError=!1)},L.onKeyUp=function(D){D.keyCode===27&&(cs(this.container,["pending","active"]),this.input.value="",document.body.focus(),document.body.blur()
581)},L.onKeyPress=function(D){D.keyCode===fu&&this.onSubmit(D)},L.setQuery=function(D){this.input.value=D},x})(),z_=(function(){function x(D){var O=this,Y=D.handleClick,Q=D.classNames,A=Q===void 0?{}:Q,d=D.notFoundMessage;this.handleClick=void 0,this.selected=-1,this.results=[],this.container=void 0,this.resultItem=void 0,this.notFoundMessage=void 0,this.onClick=function(xe){if(typeof O.handleClick=="function"){var Se=xe.target;if(Se&&O.container.contains(Se)&&Se.hasAttribute("data-key")){var ke=Number(Se.getAttribute("data-key"));O.handleClick({result:O.results[ke]})}}},this.handleClick=Y,this.notFoundMessage=d?zs("div",cu(A.notfound),void 0,{html:d}):void 0,this.container=zs("div",cu("results",A.resultlist)),this.container.addEventListener("click",this.onClick,!0),this.resultItem=zs("div",cu(A.item))}var L=x.prototype;return L.render=function(D,O){var Y=this;D===void 0&&(D=[]),this.clear(),D.forEach(function(Q,A){var d=Y.resultItem.cloneNode(!0);d.setAttribute("data-key",""+A),d.innerHTML=O({result:Q}),Y.container.appendChild(d)}),D.length>0?(eo(this.container.parentElement,"open"),eo(this.container,"active")):this.notFoundMessage&&(this.container.appendChild(this.notFoundMessage),eo(this.container.parentElement,"open")),this.results=D},L.select=function(D){return Array.from(this.container.children).forEach(function(O,Y){return Y===D?eo(O,"active"):cs(O,"active")}),this.selected=D,this.results[D]},L.count=function(){return this.results?this.results.length:0},L.clear=function(){for(this.selected=-1;this.container.lastChild;)this.container.removeChild(this.container.lastChild);cs(this.container.parentElement,"open"),cs(this.container,"active")},x})(),yh={position:"topleft",style:"button",showMarker:!0,showPopup:!1,popupFormat:function(x){return""+x.result.label},resultFormat:function(x){return""+x.result.label},marker:{icon:Oh&&Cn.Icon?new Cn.Icon.Default:void 0,draggable:!1},maxMarkers:1,maxSuggestions:5,retainZoomLevel:!1,animateZoom:!0,searchLabel:"Enter address",clearSearchLabel:"Clear search",notFoundMessage:"",messageHideDelay:3e3,zoomLevel:18,classNames:{container:"leaflet-bar leaflet-control leaflet-control-geosearch",button:"leaflet-bar-part leaflet-bar-part-single",resetButton:"reset",msgbox:"leaflet-bar message",form:"",input:"",resultlist:"",item:"",notfound:"leaflet-bar-notfound"},autoComplete:!0,autoCompleteDelay:250,autoClose:!1,keepResult:!1,updateMap:!0,resetButton:"×"},lf="Leaflet must be loaded before instantiating the GeoSearch control",D_={options:Qa({},yh),classNames:Qa({},yh.classNames),initialize:function(x){var L,D,O,Y,Q=this;if(!Oh)throw new Error(lf);if(!x.provider)throw new Error("Provider is missing from options");this.options=Qa({},yh,x),this.classNames=Qa({},this.classNames,x.classNames),this.markers=new Cn.FeatureGroup,this.classNames.container+=" leaflet-geosearch-"+this.options.style,this.searchElement=new k_({searchLabel:this.options.searchLabel,classNames:{container:this.classNames.container,form:this.classNames.form,input:this.classNames.input},handleSubmit:function(A){return Q.onSubmit(A)}}),this.button=zs("a",this.classNames.button,this.searchElement.container,{title:this.options.searchLabel,href:"#",onClick:function(A){return Q.onClick(A)}}),Cn.DomEvent.disableClickPropagation(this.button),this.resetButton=zs("button",this.classNames.resetButton,this.searchElement.form,{text:this.options.resetButton,"aria-label":this.options.clearSearchLabel,onClick:function(){Q.searchElement.input.value===""?Q.close():Q.clearResults(null,!0)}}),Cn.DomEvent.disableClickPropagation(this.resetButton),this.options.autoComplete&&(this.resultList=new z_({handleClick:function(A){var d=A.result;Q.searchElement.input.value=d.label,Q.onSubmit({query:d.label,data:d})},classNames:{resultlist:this.classNames.resultlist,item:this.classNames.item,notfound:this.classNames.notfound},notFoundMessage:this.options.notFoundMessage}),this.searchElement.form.appendChild(this.resultList.container),this.searchElement.input.addEventListener("keyup",(L=function(A){return Q.autoSearch(A)},(D=this.options.autoCompleteDelay)===void 0&&(D=250),O===void 0&&(O=!1),function(){var A=[].slice.call(arguments);Y&&clearTimeout(Y),Y=setTimeout(function(){Y=null,O||L.apply(void 0,A)},D),O&&!Y&&L.apply(void 0,A)}),!0),this.searchElement.input.addEventListener("keydown",function(A){return Q.selectResult(A)},!0),this.searchElement.input.addEventListener("keydown",function(A){return Q.clearResults(A,!0)},!0)),this.searchElement.form.addEventListener("click",function(A){A.preventDefault()},!1)},onAdd:function(x){var L=this.options,D=L.showMarker,O=L.style;if(this.map=x,D&&this.markers.addTo(x),O==="bar"){var Y=x.getContainer().querySelector(".leaflet-control-container");this.container=zs("div","leaflet-control-geosearch leaflet-geosearch-bar"),this.container.appendChild(this.searchElement.form),Y.appendChild(this.container)}return Cn.DomEvent.disableClickPropagation(this.searchElement.form),this.searchElement.container},onRemove:function(){var x;return(x=this.container)==null||x.remove(),this},open:function(){var x=this.searchElement,L=x.input;eo(x.container,"active"),L.focus()},close:function(){cs(this.searchElement.container,"active"),this.clearResults()},onClick:function(x){x.preventDefault(),x.stopPropagation(),this.searchElement.container.classList.contains("active")?this.close():this.open()},selectResult:function(x){if([fu,Ph,of].indexOf(x.keyCode)!==-1)if(x.preventDefault(),x.keyCode!==fu){var L=this.resultList.count()-1;if(!(L<0)){var D=this.resultList.selected,O=x.keyCode===Ph?D+1:D-1,Y=this.resultList.select(O<0?L:O>L?0:O);this.searchElement.input.value=Y.label}}else{var Q=this.resultList.select(this.resultList.selected);this.onSubmit({query:this.searchElement.input.value,data:Q})}},clearResults:function(x,L){if(L===void 0&&(L=!1),!x||x.keyCode===27){var D=this.options,O=D.autoComplete;!L&&D.keepResult||(this.searchElement.input.value="",this.markers.clearLayers()),O&&this.resultList.clear()}},autoSearch:function(x){try{var L=this;if(M_.indexOf(x.keyCode)>-1)return Promise.resolve();var D=x.target.value,O=L.options.provider,Y=(function(){if(D.length)return Promise.resolve(O.search({query:D})).then(function(Q){Q=Q.slice(0,L.options.maxSuggestions),L.resultList.render(Q,L.options.resultFormat)});L.resultList.clear()})();return Promise.resolve(Y&&Y.then?Y.then(function(){}):void 0)}catch(Q){return Promise.reject(Q)}},onSubmit:function(x){try{var L=this;return L.resultList.clear(),Promise.resolve(L.options.provider.search(x)).then(function(D){D&&D.length>0&&L.showResult(D[0],x)})}catch(D){return Promise.reject(D)}},showResult:function(x,L){var D=this.options,O=D.autoClose,Y=D.updateMap,Q=this.markers.getLayers();Q.length>=this.options.maxMarkers&&this.markers.removeLayer(Q[0]);var A=this.addMarker(x,L);Y&&this.centerMap(x),this.map.fireEvent("geosearch/showlocation",{location:x,marker:A}),O&&this.closeResults()},closeResults:function(){var x=this.searchElement.container;x.classList.contains("active")&&cs(x,"active"),this.clearResults()},addMarker:function(x,L){var D=this,O=this.options,Y=O.marker,Q=O.showPopup,A=O.popupFormat,d=new Cn.Marker([x.y,x.x],Y),xe=x.label;return typeof A=="function"&&(xe=A({query:L,result:x})),d.bindPopup(xe),this.markers.addLayer(d),Q&&d.openPopup(),Y.draggable&&d.on("dragend",function(Se){D.map.fireEvent("geosearch/marker/dragend",{location:d.getLatLng(),event:Se})}),d},centerMap:function(x){var L=this.options,D=L.retainZoomLevel,O=L.animateZoom,Y=x.bounds?new Cn.LatLngBounds(x.bounds):new Cn.LatLng(x.y,x.x).toBounds(10),Q=Y.isValid()?Y:this.markers.getBounds();
581!D&&Y.isValid()&&!x.bounds||D||!Y.isValid()?this.map.setView(Q.getCenter(),this.getZoom(),{animate:O}):this.map.fitBounds(Q,{animate:O})},getZoom:function(){var x=this.options,L=x.zoomLevel;return x.retainZoomLevel?this.map.getZoom():L}};function L_(){if(!Oh)throw new Error(lf);var x=Cn.Control.extend(D_);return Eh(x,[].slice.call(arguments))}(function(x){x[x.SEARCH=0]="SEARCH",x[x.REVERSE=1]="REVERSE"})(pu||(pu={}));var R_=(function(){function x(D){D===void 0&&(D={}),this.options=void 0,this.options=D}var L=x.prototype;return L.getParamString=function(D){D===void 0&&(D={});var O=Qa({},this.options.params,D);return Object.keys(O).map(function(Y){return encodeURIComponent(Y)+"="+encodeURIComponent(O[Y])}).join("&")},L.getUrl=function(D,O){return D+"?"+this.getParamString(O)},L.search=function(D){try{var O=this,Y=O.endpoint({query:D.query,type:pu.SEARCH});return Promise.resolve(fetch(Y)).then(function(Q){return Promise.resolve(Q.json()).then(function(A){return O.parse({data:A})})})}catch(Q){return Promise.reject(Q)}},x})();var Rp;(function(x){x[x.INITIALIZED=0]="INITIALIZED",x[x.LOADING=1]="LOADING",x[x.SUCCESS=2]="SUCCESS",x[x.FAILURE=3]="FAILURE"})(Rp||(Rp={}));var B_=(function(x){function L(O){var Y;O===void 0&&(O={}),(Y=x.call(this,O)||this).searchUrl=void 0,Y.reverseUrl=void 0;var Q="https://nominatim.openstreetmap.org";return Y.searchUrl=O.searchUrl||Q+"/search",Y.reverseUrl=O.reverseUrl||Q+"/reverse",Y}P_(L,x);var D=L.prototype;return D.endpoint=function(O){var Y=O.query,Q=O.type,A=typeof Y=="string"?{q:Y}:Y;return A.format="json",this.getUrl(Q===pu.REVERSE?this.reverseUrl:this.searchUrl,A)},D.parse=function(O){return(Array.isArray(O.data)?O.data:[O.data]).map(function(Y){return{x:Number(Y.lon),y:Number(Y.lat),label:Y.display_name,bounds:[[parseFloat(Y.boundingbox[0]),parseFloat(Y.boundingbox[2])],[parseFloat(Y.boundingbox[1]),parseFloat(Y.boundingbox[3])]],raw:Y}})},L})(R_);function F_(x){return{type:"FeatureCollection",features:x.map(L=>({type:"Feature",properties:{type:L.type,sensorsCount:"sensorsCount"in L?L.sensorsCount:null,value:L.value,locationId:"locationId"in L?L.locationId:null,locationName:"locationName"in L?L.locationName:null,sensorType:"sensorType"in L?L.sensorType:null,dataSource:"dataSource"in L?L.dataSource:null},geometry:{type:"Point",coordinates:[L.longitude,L.latitude]}}))}}const Bp={[mt.GREEN]:"#005108",[mt.YELLOW]:"#D19500",[mt.ORANGE]:"#B74A00",[mt.RED]:"#770E22",[mt.PURPLE]:"#401172",[mt.BROWN]:"#5B1B14",[mt.BLUE]:"#003351",[mt.GRAY]:"#595959",[mt.LIGHTGRAY]:"#868686",[mt.DEFAULT]:"#868686"},O_={[mt.GREEN]:"#58D32F",[mt.YELLOW]:"#FFDA3E",[mt.ORANGE]:"#FF9300",[mt.RED]:"#E1243B",[mt.PURPLE]:"#7C2DC1",[mt.BROWN]:"#822B22",[mt.BLUE]:"#1b75bc",[mt.GRAY]:"#a3a1a1",[mt.LIGHTGRAY]:"#d9d9d9",[mt.DEFAULT]:"#d9d9d9"};mt.GREEN+"",mt.YELLOW+"",mt.ORANGE+"",mt.RED+"",mt.PURPLE+"",mt.BROWN+"",mt.BLUE+"",mt.GRAY+"",mt.LIGHTGRAY+"",mt.DEFAULT+"";const N_={[mt.GREEN]:"#d2f7d3",[mt.YELLOW]:"#FFF7D4",[mt.ORANGE]:"#FFE5D7",[mt.RED]:"#FFD9E1",[mt.PURPLE]:"#EAD7FF",[mt.BROWN]:"#FFE4E3",[mt.BLUE]:"#d3e9f9",[mt.GRAY]:"#d9d9d9",[mt.LIGHTGRAY]:"#F8F2EB",[mt.DEFAULT]:"#F8F2EB"};function cf(x,L){switch(x){case nt.PM25:return V_(L);case nt.RCO2:return U_(L);default:return j_(L)}}function V_(x){return x<=9?qt.GOOD:x<=35.4?qt.MODERATE:x<=55.4?qt.UNHEALTHY_SENSITIVE_GROUPS:x<=125.4?qt.UNHEALTHY:x<=225.4?qt.VERY_UNHEALTHY:x<=1e4?qt.HAZARDOUS:qt.GOOD}function U_(x){return x<=450?qt.GOOD:x<=500?qt.MODERATE:x<=800?qt.UNHEALTHY_SENSITIVE_GROUPS:x<=1e4?qt.INCORRECT:qt.GOOD}function j_(x){return x<=50?qt.GOOD:x<=100?qt.MODERATE:x<=150?qt.UNHEALTHY_SENSITIVE_GROUPS:x<=200?qt.UNHEALTHY:x<=300?qt.VERY_UNHEALTHY:qt.HAZARDOUS}function vh(x,L=500){let D=mt.DEFAULT;const O=cf(nt.PM25,x);return O===qt.GOOD?D=mt.GREEN:O===qt.MODERATE?D=mt.YELLOW:O===qt.UNHEALTHY_SENSITIVE_GROUPS?D=mt.ORANGE:O===qt.UNHEALTHY?D=mt.RED:O===qt.VERY_UNHEALTHY?D=mt.PURPLE:(qt.HAZARDOUS,D=mt.BROWN),{bgColor:uf(D,L),textColorClass:hf(D)}}function uf(x,L=500){switch(L){case 700:return Bp[x];case 300:return Bp[x];case 100:return N_[x];default:return O_[x]}}function hf(x){return x===mt.YELLOW?"text-yellow-dark":"text-light"}function $_(x,L=500){let D=mt.DEFAULT;const O=cf(nt.RCO2,x);return O===qt.GOOD?D=mt.GREEN:O===qt.MODERATE?D=mt.YELLOW:O===qt.UNHEALTHY_SENSITIVE_GROUPS?D=mt.ORANGE:O===qt.INCORRECT&&(D=mt.GRAY),{bgColor:uf(D,L),textColorClass:hf(D)}}const fi={zoom:3,maxZoom:18,minZoom:2,center:[47.21322,-1.559482],maxBoundsViscosity:1,maxBounds:new Cn.LatLngBounds(new Cn.LatLng(-88,-180),new Cn.LatLng(88,179)),wind_layer:!1,fires_layer:!1,map_theme:"light",light_map_style_url:"https://tiles.openfreemap.org/styles/bright",dark_map_style_url:"https://tiles.openfreemap.org/styles/dark",embedded:!1},Qo={meas:nt.PM25,org:"ag"},q_=["good","moderate","unhealthy_sensitive_groups","unhealthy","very_unhealthy","hazardous"];nt.PM25+"",nt.PM_AQI+"",nt.RCO2+"";const rv={[nt.PM25]:"PM2.5 (μg/m³)",[nt.PM_AQI]:"US AQI (PM2.5)",[nt.RCO2]:"CO2 (ppm)"},Z_={[nt.PM25]:"PM<sub>2.5</sub>",[nt.PM_AQI]:"US AQI (PM<sub>2.5</sub>)",[nt.RCO2]:"CO<sub>2</sub>"},xh={[nt.PM25]:"PM<sub>2.5</sub> (μg/m³)",[nt.PM_AQI]:"US AQI (PM<sub>2.5</sub>)",[nt.RCO2]:"CO<sub>2</sub> (ppm)"},nv={[nt.PM25]:"μg/m³",[nt.PM_AQI]:"US AQI",[nt.RCO2]:"ppm"},G_=[{unit:En.HOUR,count:24,label:"last_24_hours",defaultBucketSize:Ya.MINUTES_15,value:Ka.DAY,chartUnit:En.HOUR},{unit:En.DAY,count:30,label:"last_30_days",defaultBucketSize:Ya.HOUR,value:Ka.MONTH,chartUnit:En.DAY},{unit:En.DAY,count:180,label:"last_180_days",defaultBucketSize:Ya.DAY,value:Ka.MONTHS_6,chartUnit:En.WEEK},{unit:En.DAY,count:7,label:"last_week",defaultBucketSize:Ya.HOUR,value:Ka.WEEK,chartUnit:En.HOUR},{unit:En.MONTH,count:1,label:"last_month",defaultBucketSize:Ya.HOUR_8,value:Ka.MONTH,chartUnit:En.DAY},{unit:En.MONTH,count:3,label:"last_3_months",defaultBucketSize:Ya.DAY,value:Ka.MONTHS_3,chartUnit:En.DAY}];hu.LOCAL,hu.USER;qt.GOOD+"",qt.MODERATE+"",qt.UNHEALTHY_SENSITIVE_GROUPS+"",qt.UNHEALTHY+"",qt.VERY_UNHEALTHY+"",qt.HAZARDOUS+"",qt.INCORRECT+"";const Yi="ug_m3",Pn="us_epa",H_="aqiStandardsEtag",df="aqiStandardSelectedId",Ch="airgradient-map-url-config",pf=["zoom","lat","long","meas","wind_layer","fires_layer","map_theme","org"],ff=()=>typeof window<"u",W_=x=>!!x&&typeof x=="object"&&!Array.isArray(x),mf=(x,L)=>Object.prototype.hasOwnProperty.call(x,L),gf=x=>Array.isArray(x)?x[0]:x,Mh=x=>
581{if(x!==void 0)return x===null?null:typeof x=="string"||typeof x=="number"?x:String(x)},Yo=x=>{const L=gf(x);return L==null?"":String(L)},X_=x=>Number(Yo(x)),bh=(x,L,D=1e-6)=>{const O=X_(x);return Number.isFinite(O)&&Math.abs(O-L)<=D},_f=x=>{const L={};for(const D of pf){if(!mf(x,D))continue;const O=Mh(gf(x[D]));O==null||O===""||(L[D]=O)}return L},Y_=x=>pf.some(L=>mf(x,L)&&x[L]!==void 0),K_=()=>{if(!ff())return null;try{const x=window.localStorage.getItem(Ch);if(!x)return null;const L=JSON.parse(x);if(!W_(L))return null;const D=_f(L);return Object.keys(D).length?D:null}catch{return null}},J_=x=>{if(ff())try{const L=_f(x);if(!Object.keys(L).length){window.localStorage.removeItem(Ch);return}window.localStorage.setItem(Ch,JSON.stringify(L))}catch{}},Q_=x=>{const L={};for(const[D,O]of Object.entries(x)){if(Array.isArray(O)){L[D]=O.map(Y=>Mh(Y)).filter(Y=>Y!==void 0);continue}L[D]=Mh(O)}return L},ey=x=>{const L=Yo(x.meas),D=new Set([String(Qo.meas),Yi]);return bh(x.zoom,fi.zoom)&&bh(x.lat,Number(fi.center[0]),.2)&&bh(x.long,Number(fi.center[1]),.2)&&Yo(x.wind_layer)===String(fi.wind_layer)&&Yo(x.fires_layer)===String(fi.fires_layer??!1)&&Yo(x.map_theme)===String(fi.map_theme)&&Yo(x.org)===String(Qo.org)&&D.has(L)},ty=x=>{const L=vg(),D=xg(),O=(x==null?void 0:x.sync)!==!1,Y=L.query.map_theme,Q=Array.isArray(Y)?Y[0]:Y,A=L.query.no_border,d=Array.isArray(A)?A[0]:A,xe=Y_(L.query),Se=O&&!xe?K_():null;let ke=!!Se;const de=Wp({zoom:fi.zoom,long:fi.center[1],lat:fi.center[0],meas:Qo.meas,wind_layer:String(fi.wind_layer),fires_layer:String(fi.fires_layer??!1),map_theme:Q??fi.map_theme,org:Qo.org,embedded:String(fi.embedded),sidebar:L.query.sidebar,loc:L.query.loc,...Se,...L.query,no_border:d});return O&&Se&&D.replace({query:{...L.query,...Se}}).catch(Ze=>{Wo(Ze,Xo.cancelled)||Wo(Ze,Xo.aborted)||Wo(Ze,Xo.duplicated)||console.error("Failed to sync persisted URL state:",Ze)}),O&&Fi(de,Ze=>{const vt=Ze;(ke||!ey(vt))&&(ke=!0,J_(vt)),D.replace({query:{...L.query,...Q_(vt)}}).catch(We=>{Wo(We,Xo.cancelled)||Wo(We,Xo.aborted)||Wo(We,Xo.duplicated)||console.error("Failed to sync URL state:",We)})},{deep:!0}),Fi(()=>L.query,Ze=>{Object.assign(de,Ze)},{deep:!0}),{urlState:de,setUrlState:Ze=>{Object.assign(de,Ze)}}};function kh(x){let L=null;return[void 0,null].includes(x)?L=null:x<=9?L=50/9*(x-0)+0:x<=35.4?L=49/(35.4-9.1)*(x-9.1)+51:x<=55.4?L=49/(55.4-35.5)*(x-35.5)+101:x<=125.4?L=49/(125.4-55.5)*(x-55.5)+151:x<=225.4?L=99/(225.4-125.5)*(x-125.5)+201:L=199/(325.4-225.5)*(x-225.5)+301,L<0&&(L=0),L&&Number(L.toFixed(1))}function sv(x){let L=null;return x.map(D=>{const O=D.max===null?null:kh(D.max),Y=L===null?kh(D.min):L+1;return L=O,{min:Y,max:O}})}function av(x){if(x.length<2)return x.slice();const L=x[x.length-1],D=x[x.length-2];if(L.color!==D.color||L.mascot!==D.mascot)return x.slice();const O=x.slice(0,-1);return O[O.length-1]={...D,max:null},O}const iy=()=>{if(typeof window>"u")return Yi;try{return window.localStorage.getItem(df)||Yi}catch{return Yi}},yf=bg("generalConfig",{state:()=>({selectedMeasure:nt.PM25,selectedAqiStandardId:iy(),selectedDataSources:[],selectedSensorTypes:[],selectedHistoryPeriod:G_[0],selectedHistoricalDataTimeZoneConfig:hu.LOCAL,headless:!1,embedded:!1,excludeOutliers:!0}),actions:{setSelectedMeasure(x){this.selectedMeasure=x},setSelectedAqiStandardId(x){if(this.selectedAqiStandardId=x,typeof window<"u")try{window.localStorage.setItem(df,x)}catch{}},setSelectedDataSources(x){this.selectedDataSources=Array.from(new Set(x))},setSelectedSensorTypes(x){this.selectedSensorTypes=Array.from(new Set(x))},setSelectedHistoryPeriod(x){this.selectedHistoryPeriod=x},setSelectedHistoricalDataTimeZoneConfig(x){this.selectedHistoricalDataTimeZoneConfig=x},setHeadless(x){this.headless=x},setEmbedded(x){this.embedded=x},setExcludeOutliers(x){this.excludeOutliers=x}}});function ry(x,L,D){const{showError:O}=Xp(),Y=Wt(!1),Q=Wt(null),A=async()=>{var ke;if(!(!Y.value||D!=null&&D.skipOnVisibilityHidden&&document.visibilityState!=="visible"))try{x(),(ke=D==null?void 0:D.onSuccess)==null||ke.call(D)}catch(de){const K=de;D!=null&&D.onError?D.onError(K):O("Failed to refresh data")}},d=ke=>{Se(),L=ke,xe()},xe=()=>{Y.value||(Y.value=!0,D!=null&&D.skipFirstRefresh||A(),Q.value=Nh(A,L))},Se=()=>{Y.value=!1,Q.value&&(clearInterval(Q.value),Q.value=null)};return el(()=>Se()),{isRefreshIntervalActive:Bh(Y),startRefreshInterval:xe,stopRefreshInterval:Se,refresh:A,resetIntervalDuration:d}}const ny=3e4,sy=()=>{const x=Wt(!1),L=Wt(null),D=async()=>{x.value=!0,L.value=null;const Y=[{name:"ipinfo.io",url:"https://ipinfo.io/json",parser:Q=>({lat:parseFloat(Q.loc.split(",")[0]),lng:parseFloat(Q.loc.split(",")[1]),city:Q.city,country:Q.country})},{name:"ip-api.com",url:"http://ip-api.com/json/",parser:Q=>({lat:Q.lat,lng:Q.lon,city:Q.city,country:Q.country})}];for(const Q of Y)try{const A=await fetch(Q.url,{method:"GET",mode:"cors",headers:{Accept:"application/json"}});if(!A.ok)throw new Error(`HTTP ${A.status}`);const d=await A.json(),xe=await Q.parser(d);if(xe.lat&&xe.lng)return xe}catch{continue}throw new Error("All geolocation services failed")};return{isLoading:x,error:L,getCurrentLocation:async()=>{try{return x.value=!0,L.value=null,await D()}catch(Y){const Q=Y instanceof Error?Y.message:"Failed to get location";return L.value=Q,null}finally{x.value=!1}}}},ay=us({__name:"GeolocationButton",emits:["locationFound","error"],setup(x,{emit:L}){const D=L,{isLoading:O,error:Y,getCurrentLocation:Q}=sy(),A=async()=>{const d=await Q();d?D("locationFound",d.lat,d.lng):Y.value&&D("error",Y.value)};return(d,xe)=>{const Se=Qp;return Jt(),qr(Se,{ripple:!1,size:Ht(nu).NORMAL,disabled:Ht(O),customIcon:"navigation.svg",iconAlt:"Navigation",style:"light",class:"rotated-navigation-icon",onClick:A},null,8,["size","disabled"])}}}),oy=Zp(ay,[["__scopeId","data-v-575dd67c"]]);function ly(x){return wg()?(Sg(x),!0):!1}const wh=new WeakMap,cy=(...x)=>{var L;const D=x[0],O=(L=Fh())==null?void 0:L.proxy;if(O==null&&!Yp())throw new Error("injectLocal must be called in setup");return O&&wh.has(O)&&D in wh.get(O)?wh.get(O)[D]:uc(...x)},uy=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const hy=Object.prototype.toString,dy=x=>hy.call(x)==="[object Object]",py=()=>{};
581function fy(...x){if(x.length!==1)return Tg(...x);const L=x[0];return typeof L=="function"?Bh(Ig(()=>({get:L,set:py}))):Wt(L)}function my(x,L){function D(...O){return new Promise((Y,Q)=>{Promise.resolve(x(()=>L.apply(this,O),{fn:L,thisArg:this,args:O})).then(Y).catch(Q)})}return D}const vf=x=>x();function gy(x=vf,L={}){const{initialState:D="active"}=L,O=fy(D==="active");function Y(){O.value=!1}function Q(){O.value=!0}const A=(...d)=>{O.value&&x(...d)};return{isActive:Bh(O),pause:Y,resume:Q,eventFilter:A}}function Fp(x){return x.endsWith("rem")?Number.parseFloat(x)*16:Number.parseFloat(x)}function Sh(x){return Array.isArray(x)?x:[x]}function _y(x){return Fh()}function yy(x,L,D={}){const{eventFilter:O=vf,...Y}=D;return Fi(x,my(O,L),Y)}function vy(x,L,D={}){const{eventFilter:O,initialState:Y="active",...Q}=D,{eventFilter:A,pause:d,resume:xe,isActive:Se}=gy(O,{initialState:Y});return{stop:yy(x,L,{...Q,eventFilter:A}),pause:d,resume:xe,isActive:Se}}function xf(x,L=!0,D){_y()?Ds(x,D):L?x():io(x)}function xy(x,L,D){return Fi(x,L,{...D,immediate:!0})}const oc=uy?window:void 0;function by(x){var L;const D=ba(x);return(L=D==null?void 0:D.$el)!=null?L:D}function lc(...x){const L=[],D=()=>{L.forEach(d=>d()),L.length=0},O=(d,xe,Se,ke)=>(d.addEventListener(xe,Se,ke),()=>d.removeEventListener(xe,Se,ke)),Y=ct(()=>{const d=Sh(ba(x[0])).filter(xe=>xe!=null);return d.every(xe=>typeof xe!="string")?d:void 0}),Q=xy(()=>{var d,xe;return[(xe=(d=Y.value)==null?void 0:d.map(Se=>by(Se)))!=null?xe:[oc].filter(Se=>Se!=null),Sh(ba(Y.value?x[1]:x[0])),Sh(Ht(Y.value?x[2]:x[1])),ba(Y.value?x[3]:x[2])]},([d,xe,Se,ke])=>{if(D(),!(d!=null&&d.length)||!(xe!=null&&xe.length)||!(Se!=null&&Se.length))return;const de=dy(ke)?{...ke}:ke;L.push(...d.flatMap(K=>xe.flatMap(Ze=>Se.map(vt=>O(K,Ze,vt,de)))))},{flush:"post"}),A=()=>{Q(),D()};return ly(D),A}function wy(){const x=xa(!1),L=Fh();return L&&Ds(()=>{x.value=!0},L),x}function Sy(x){const L=wy();return ct(()=>(L.value,!!x()))}const Ty=Symbol("vueuse-ssr-width");function Iy(){const x=Yp()?cy(Ty,null):null;return typeof x=="number"?x:void 0}function bf(x,L={}){const{window:D=oc,ssrWidth:O=Iy()}=L,Y=Sy(()=>D&&"matchMedia"in D&&typeof D.matchMedia=="function"),Q=xa(typeof O=="number"),A=xa(),d=xa(!1),xe=Se=>{d.value=Se.matches};return Ag(()=>{if(Q.value){Q.value=!Y.value;const Se=ba(x).split(",");d.value=Se.some(ke=>{const de=ke.includes("not all"),K=ke.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/),Ze=ke.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);let vt=!!(K||Ze);return K&&vt&&(vt=O>=Fp(K[1])),Ze&&vt&&(vt=O<=Fp(Ze[1])),de?!vt:vt});return}Y.value&&(A.value=D.matchMedia(ba(x)),d.value=A.value.matches)}),lc(A,"change",xe,{passive:!0}),ct(()=>d.value)}const iu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ru="__vueuse_ssr_handlers__",Ay=Ey();function Ey(){return ru in iu||(iu[ru]=iu[ru]||{}),iu[ru]}function Py(x,L){return Ay[x]||L}function Cy(x){return x==null?"any":x instanceof Set?"set":x instanceof Map?"map":x instanceof Date?"date":typeof x=="boolean"?"boolean":typeof x=="string"?"string":typeof x=="object"?"object":Number.isNaN(x)?"any":"number"}const My={boolean:{read:x=>x==="true",write:x=>String(x)},object:{read:x=>JSON.parse(x),write:x=>JSON.stringify(x)},number:{read:x=>Number.parseFloat(x),write:x=>String(x)},any:{read:x=>x,write:x=>String(x)},string:{read:x=>x,write:x=>String(x)},map:{read:x=>new Map(JSON.parse(x)),write:x=>JSON.stringify(Array.from(x.entries()))},set:{read:x=>new Set(JSON.parse(x)),write:x=>JSON.stringify(Array.from(x))},date:{read:x=>new Date(x),write:x=>x.toISOString()}},Op="vueuse-storage";function wf(x,L,D,O={}){var Y;const{flush:Q="pre",deep:A=!0,listenToStorageChanges:d=!0,writeDefaults:xe=!0,mergeDefaults:Se=!1,shallow:ke,window:de=oc,eventFilter:K,onError:Ze=Te=>{console.error(Te)},initOnMounted:vt}=O,Rt=(ke?xa:Wt)(typeof L=="function"?L():L),We=ct(()=>ba(x));if(!D)try{D=Py("getDefaultStorage",()=>{var Te;return(Te=oc)==null?void 0:Te.localStorage})()}catch(Te){Ze(Te)}if(!D)return Rt;const st=ba(L),xt=Cy(st),we=(Y=O.serializer)!=null?Y:My[xt],{pause:Vi,resume:Ot}=vy(Rt,Te=>qe(Te),{flush:Q,deep:A,eventFilter:K});Fi(We,()=>Ye(),{flush:Q});let Ge=!1;const ot=Te=>{vt&&!Ge||Ye(Te)},ge=Te=>{vt&&!Ge||at(Te)}
581;de&&d&&(D instanceof Storage?lc(de,"storage",ot,{passive:!0}):lc(de,Op,ge)),vt?xf(()=>{Ge=!0,Ye()}):Ye();function Ve(Te,pt){if(de){const Xt={key:We.value,oldValue:Te,newValue:pt,storageArea:D};de.dispatchEvent(D instanceof Storage?new StorageEvent("storage",Xt):new CustomEvent(Op,{detail:Xt}))}}function qe(Te){try{const pt=D.getItem(We.value);if(Te==null)Ve(pt,null),D.removeItem(We.value);else{const Xt=we.write(Te);pt!==Xt&&(D.setItem(We.value,Xt),Ve(pt,Xt))}}catch(pt){Ze(pt)}}function dt(Te){const pt=Te?Te.newValue:D.getItem(We.value);if(pt==null)return xe&&st!=null&&D.setItem(We.value,we.write(st)),st;if(!Te&&Se){const Xt=we.read(pt);return typeof Se=="function"?Se(Xt,st):xt==="object"&&!Array.isArray(Xt)?{...st,...Xt}:Xt}else return typeof pt!="string"?pt:we.read(pt)}function Ye(Te){if(!(Te&&Te.storageArea!==D)){if(Te&&Te.key==null){Rt.value=st;return}if(!(Te&&Te.key!==We.value)){Vi();try{const pt=we.write(Rt.value);(Te===void 0||(Te==null?void 0:Te.newValue)!==pt)&&(Rt.value=dt(Te))}catch(pt){Ze(pt)}finally{Te?io(Ot):Ot()}}}}function at(Te){Ye(Te.detail)}return Rt}function ov(x={}){const{window:L=oc,initialWidth:D=Number.POSITIVE_INFINITY,initialHeight:O=Number.POSITIVE_INFINITY,listenOrientation:Y=!0,includeScrollbar:Q=!0,type:A="inner"}=x,d=xa(D),xe=xa(O),Se=()=>{if(L)if(A==="outer")d.value=L.outerWidth,xe.value=L.outerHeight;else if(A==="visual"&&L.visualViewport){const{width:de,height:K,scale:Ze}=L.visualViewport;d.value=Math.round(de*Ze),xe.value=Math.round(K*Ze)}else Q?(d.value=L.innerWidth,xe.value=L.innerHeight):(d.value=L.document.documentElement.clientWidth,xe.value=L.document.documentElement.clientHeight)};Se(),xf(Se);const ke={passive:!0};if(lc("resize",Se,ke),L&&A==="visual"&&L.visualViewport&&lc(L.visualViewport,"resize",Se,ke),Y){const de=bf("(orientation: portrait)");Fi(de,()=>Se())}return{width:d,height:xe}}const ky=x=>x&&typeof x=="object"&&"response"in x,zy=()=>{const{showError:x}=Xp();return{handleApiError:(D,O)=>{var Q;if(O){x(O);return}switch(ky(D)?(Q=D.response)==null?void 0:Q.status:void 0){case 404:x("Data not found");break;case 500:case 502:case 503:x("Server error. Please try again later.");break;default:x("Request failed. Please try again.")}}}};function Dy(x,L){let D=null;return el(()=>{D!==null&&clearTimeout(D)}),O=>{D!==null&&(clearTimeout(D),D=null),D=setTimeout(async()=>{await x(O).catch(Y=>console.error("Debounce function error:",Y)),D=null},L)}}const Ly=xa(null),Ry=/^#?[0-9a-fA-F]{6}$/;function $h(x){if(!x)return null;const L=x.startsWith("#")?x:`#${x}`;return Ry.test(L)?L:null}function zh(x){const L=$h(x);if(!L)return null;const D=L.replace("#",""),O=parseInt(D.slice(0,2),16),Y=parseInt(D.slice(2,4),16),Q=parseInt(D.slice(4,6),16);return{r:O,g:Y,b:Q}}function By(x,L,D){const O=Q=>Math.max(0,Math.min(255,Math.round(Q))),Y=Q=>O(Q).toString(16).padStart(2,"0");return`#${Y(x)}${Y(L)}${Y(D)}`}function Th(x,L,D){const O=zh(x),Y=zh(L);if(!O||!Y)return null;const Q=(A,d)=>A+(d-A)*D;return By(Q(O.r,Y.r),Q(O.g,Y.g),Q(O.b,Y.b))}function Np(x,L){const D=$h(x);return D?L===500?D:L===700?Th(D,"#000000",.35):L===300?Th(D,"#ffffff",.35):Th(D,"#ffffff",.7):null}function Fy(x){const L=zh(x);return L&&(.299*L.r+.587*L.g+.114*L.b)/255>.6?"#1a1a1a":"#ffffff"}function Oy(x,L,D){var Q,A,d;const O=((Q=x.bandTextColors)==null?void 0:Q[L])??((A=x.bandTextColors)==null?void 0:A.default)??null,Y=(O==null?void 0:O[D])??((d=x.accentColors)==null?void 0:d[D])??null;return $h(Y)??Y}function Vp(x,L){if(!x)return"";if(x[L])return x[L];const D=L.split("-")[0];return x[D]?x[D]:x.en?x.en:Object.values(x)[0]||""}function Up(x,L){if(!(x!=null&&x.length)||L===null||L===void 0||Number.isNaN(L))return null;for(const D of x){const O=D.max??Number.POSITIVE_INFINITY;if(L>=D.min&&L<=O)return D}return x[x.length-1]??null}function Ny(x){if(!x)return null;switch(x){case"aqi_mascot_very_good":return"very-good";case"aqi_mascot_good":return"good";case"aqi_mascot_moderate":return"moderate";case"aqi_mascot_unhealthy_sensitive":return"unhealthy-sensitive";case"aqi_mascot_unhealthy":return"unhealthy";case"aqi_mascot_very_unhealthy":return"very-unhealthy";case"aqi_mascot_hazardous":return"hazardous";default:return null}}function Vy(x){switch(x){case"green":case"greenLow":case"greenHigh":return"good";case"yellow":case"yellowLow":case"yellowHigh":return"moderate";case"orange":case"orangeLow":case"orangeHigh":return"unhealthy-se
581nsitive";case"red":case"redLow":case"redHigh":return"unhealthy";case"purple":return"very-unhealthy";case"maroon":case"brown":return"hazardous";default:return"good"}}function Uy(){const x=Kp(),{locale:L}=Dh("map"),D=yf(),O=Ly,Y=wf(H_,null),Q=Wt(!1),A=Wt(null),d=async()=>{if(Q.value||O.value)return O.value;Q.value=!0,A.value=null;try{const Ge=Jp(x.public.apiUrl),ot={},ge=x.public.trustedContext;ge&&(ot["data-permission-context"]=ge),O.value&&Y.value&&(ot["If-None-Match"]=Y.value);const Ve=await $fetch.raw(`${Ge}/aqi-standards`,{headers:ot,retry:1});if(Ve.status!==304&&Ve._data){O.value=Ve._data;const qe=Ve.headers.get("etag");qe&&(Y.value=qe)}else if(Ve.status===304&&!O.value){const qe={};ge&&(qe["data-permission-context"]=ge);const dt=await $fetch.raw(`${Ge}/aqi-standards`,{headers:qe,retry:1});if(dt._data){O.value=dt._data;const Ye=dt.headers.get("etag");Ye&&(Y.value=Ye)}}}catch(Ge){A.value=Ge}finally{Q.value=!1}return O.value},xe=ct(()=>{const Ge=O.value;return Ge!=null&&Ge.standards?Ge.standards.reduce((ot,ge)=>(ot[ge.id]=ge,ot),{}):{}}),Se=Ge=>{var ot,ge;return!!((ge=(ot=O.value)==null?void 0:ot.visibility)!=null&&ge[Ge])},ke=ct(()=>D.selectedAqiStandardId||Yi),de=ct(()=>D.selectedMeasure===nt.PM_AQI||ke.value===Yi?Pn:ke.value),K=ct(()=>xe.value[de.value]),Ze=ct(()=>{const Ge=O.value;if(!(Ge!=null&&Ge.standards))return[];const ot=L.value||"en";return Ge.standards.filter(ge=>ge.pollutant==="pm25"&&ge.id!==Pn&&ge.id!==Yi&&Se(ge.id)).sort((ge,Ve)=>ge.displayName.localeCompare(Ve.displayName,ot))}),vt=ct(()=>{var ge;const Ge=K.value;if(!((ge=Ge==null?void 0:Ge.ranges)!=null&&ge.length))return q_;const ot=L.value||"en";return Ge.ranges.map(Ve=>Vp(Ve.labels,ot))}),Rt=ct(()=>{var Ge,ot;return!!((ot=(Ge=K.value)==null?void 0:Ge.ranges)!=null&&ot.length)}),We=ct(()=>{var ge;const Ge=O.value,ot=K.value;return!Ge||!((ge=ot==null?void 0:ot.ranges)!=null&&ge.length)?[]:ot.ranges.map(Ve=>{var qe;return Np(((qe=Ge.colors)==null?void 0:qe[Ve.color])??"",500)}).filter(Ve=>!!Ve)}),st=(Ge,ot=500)=>xt(Ge,de.value,ot),xt=(Ge,ot,ge=500)=>{var Xt,Ii;const Ve=O.value,qe=!ot||ot===Yi?Pn:ot,dt=xe.value[qe];if(!Ve||!((Xt=dt==null?void 0:dt.ranges)!=null&&Xt.length))return vh(Ge,ge);const Ye=Up(dt.ranges,Ge);if(!Ye)return vh(Ge,ge);const at=(Ii=Ve.colors)==null?void 0:Ii[Ye.color],Te=Np(at??"",ge);if(!Te)return vh(Ge,ge);const pt=Oy(Ve,dt.pollutant,Ye.color)||Fy(Te);return{bgColor:Te,textColor:pt}},we=(Ge,ot)=>{var dt;const ge=O.value,Ve=!ot||ot===Yi?Pn:ot,qe=xe.value[Ve]||null;return!ge||!((dt=qe==null?void 0:qe.ranges)!=null&&dt.length)?{range:null,standard:qe}:{range:Up(qe.ranges,Ge),standard:qe}};return{standardsPayload:O,standardsById:xe,selectedStandardId:ke,effectivePm25StandardId:de,visiblePm25Standards:Ze,pm25LegendLabels:vt,pm25LegendLabelsAreLocalized:Rt,pm25LegendColors:We,getPm25BandColor:st,getPm25BandColorForStandard:xt,getPm25CategoryLabelForStandard:(Ge,ot)=>{const{range:ge}=we(Ge,ot);if(!ge)return null;const Ve=L.value||"en";return Vp(ge.labels,Ve)||null},getPm25BandKeyForStandard:(Ge,ot)=>{const{range:ge}=we(Ge,ot),Ve=Ny(ge==null?void 0:ge.mascot);return Ve||Vy((ge==null?void 0:ge.color)??null)},ensureAqiStandardsLoaded:d,loading:Q,error:A}}const jy="/vendor/mapbox-gl-rtl-text.min.js";let Ih=!1,sc=null;async function $y(){if(!Ih)return sc||(sc=(async()=>{const L=(await dr(()=>import("./BUBwSmBz.js").then(D=>D.m),__vite__mapDeps([0,1]),import.meta.url)).default;if(typeof(L==null?void 0:L.setRTLTextPlugin)=="function"){try{L.setRTLTextPlugin(jy,void 0,!0)}catch{return}Ih=!0}})().finally(()=>{Ih||(sc=null)}),sc)}async function qy(x,L){typeof x.isStyleLoaded=="function"&&(x.isStyleLoaded()||await new Promise((D,O)=>{const Y=setTimeout(()=>O(new Error("Style load timeout")),L),Q=Nh(()=>{var A;(A=x.isStyleLoaded)!=null&&A.call(x)&&(clearInterval(Q),clearTimeout(Y),D())},50);typeof x.once=="function"&&x.once("styledata",()=>{clearInterval(Q),clearTimeout(Y),D()})}))}function Zy(x){return typeof x=="object"&&x!==null}function jp(x){return typeof x=="string"?x:String(x??"")}async function Gy(x,L={}){var A,d;if(!x||!Zy(x))return[];const D=x;await qy(D,L.timeoutMs??5e3);const O=(A=D.getStyle)==null?void 0:A.call(D),Y=Array.isArray(O==null?void 0:O.layers)?O==null?void 0:O.layers:[],Q=[];for(const xe of Y){const Se=jp(xe==null?void 0:xe.id);if(!Se)continue;
581const ke=jp(xe==null?void 0:xe.type),de=typeof(xe==null?void 0:xe["source-layer"])=="string"?xe["source-layer"]:"",K=`${Se} ${de}`.toLowerCase(),Ze=ke==="line"&&(K.includes("boundary")||K.includes("admin")||K.includes("dispute")||K.includes("country")),vt=ke==="symbol"&&(K.includes("place")||K.includes("label")||K.includes("country")||K.includes("state")||K.includes("province")||K.includes("capital")||K.includes("admin"));if(!(!Ze&&!vt))try{(d=D.setLayoutProperty)==null||d.call(D,Se,"visibility","none"),Q.push(Se)}catch{}}return Q}const Hy={class:"map-extra-controls-box"},Wy={class:"map-controls"},Xy={class:"map-layer-controls"},Ah="lao-pdr",In="dataSources",An="sensorTypes",Yy="Reference",$p="__pm25-standards-header__",Ky=us({__name:"Map",props:{embedded:{type:Boolean,default:!1},headless:{type:Boolean,default:!1},disableGeocoder:{type:Boolean,default:!1},disableGeolocation:{type:Boolean,default:!1},disableMeasureSelector:{type:Boolean,default:!1},disableDataSourceSelector:{type:Boolean,default:!1},disableInfoButton:{type:Boolean,default:!1},disableInternalDataFetch:{type:Boolean,default:!1},disableUrlSync:{type:Boolean,default:!1},initialUrlState:{type:Object,default:null},lightMapStyleUrl:{type:String,default:""},height:{type:String,default:""},externalGroups:{type:Array,default:()=>[]},externalSelectedGroupId:{type:String,default:""},externalMeasure:{type:String,default:""},externalTrailsEnabled:{type:Boolean,default:!1},showZoomControls:{type:Boolean,default:!1},maxZoom:{type:Number,default:void 0}},emits:["basemap-ready","external-group-click","view-change"],setup(x,{emit:L}){const D=Qc(()=>dr(()=>import("./Oc8CMiej.js"),__vite__mapDeps([2,1,3,4,5,6,7,8]),import.meta.url)),O=Qc(()=>dr(()=>import("./Dt-MQsI-.js"),__vite__mapDeps([9,3,4,1,8,6,7]),import.meta.url)),Y=Qc(()=>dr(()=>import("./C8_up2AI.js"),__vite__mapDeps([10,11,3,4,12,5,1,6,7,8,13]),import.meta.url)),Q=Qc(()=>dr(()=>import("./DCS5rCQu.js").then(N=>N.L),__vite__mapDeps([14,3,4,8,1,7,15]),import.meta.url)),A=[[102.1187,22.3975],[102.7103,21.6593],[102.7892,21.8203],[102.937,21.7351],[102.8128,21.2739],[103.147,20.846],[103.6579,20.6647],[104.0923,20.9612],[104.6072,20.6191],[104.3664,20.4585],[104.908,20.1753],[104.9532,20.0093],[104.6231,19.6181],[104.0217,19.6814],[104.078,19.5429],[103.918,19.2582],[105.1411,18.6531],[105.08,18.4544],[105.4809,18.1448],[105.7353,17.664],[106.3105,17.2271],[106.6707,16.4444],[106.8014,16.4961],[107.4356,16.0688],[107.1502,15.7943],[107.6431,15.2979],[107.4499,14.9811],[107.5496,14.8953],[107.4298,14.5783],[106.8208,14.3076],[106.5184,14.585],[106.236,14.4844],[106.0382,14.3477],[106.1421,14.035],[105.9974,13.9283],[105.3039,14.1524],[105.1974,14.2703],[105.5075,14.564],[105.5836,14.9776],[105.4544,15.1755],[105.6409,15.682],[104.7652,16.5113],[104.7927,17.4235],[104.4223,17.6998],[104.0186,18.2991],[103.3069,18.4257],[103.0731,18.0355],[102.6094,17.837],[102.5996,17.9552],[102.0785,18.2138],[101.1418,17.4672],[100.9019,17.5619],[101.1575,18.0404],[101.0303,18.4278],[101.3264,19.0205],[101.1778,19.4172],[101.2511,19.5603],[100.4743,19.525],[100.4077,19.7943],[100.5506,20.1065],[100.3644,20.369],[100.1525,20.2392],[100.1493,20.5481],[100.3648,20.8282],[100.6521,20.8766],[100.5292,20.9684],[100.7211,21.2807],[101.1432,21.5134],[101.2443,21.1929],[101.4951,21.2428],[101.7179,21.1345],[101.8062,21.606],[101.5157,22.2454],[101.7418,22.496],[102.1187,22.3975]],d=L;let xe=null,Se=null,ke=null;xe||(xe=Promise.all([dr(()=>Promise.resolve({}),__vite__mapDeps([16]),import.meta.url),dr(()=>Promise.resolve({}),__vite__mapDeps([17]),import.meta.url),dr(()=>Promise.resolve({}),__vite__mapDeps([18]),import.meta.url),dr(()=>Promise.resolve({}),__vite__mapDeps([19]),import.meta.url),dr(()=>Promise.resolve({}),__vite__mapDeps([20]),import.meta.url)]).then(()=>{})),xe;const K=x,Ze=Wt(!1),vt=Wt(!1),Rt=Wt(!1),We=Wt(!1),st=Wt(!0),xt=Wt();let we=null;const Vi=Kp(),Ot=Eg(),Ge=Jp(Vi.public.apiUrl),ot={"data-permission-context":Vi.public.trustedContext},ge=yf(),{handleApiError:Ve}=zy(),{t:qe,locale:dt}=Dh("map"),Ye=ct(()=>Pg({embedded:K.embedded||Ot.query.embedded,headless:K.headless||Ot.query.headless,supportStaffAuth:Ot.query.supportStaffAuth,url:Ot.fullPath||window.location.href})),{isSupportStaff:at}=zg({autoFetch:Ye.value}),Te=Wt(""),pt=ct(()=>K.disableInternalDataFetch),Xt=ct(()=>!K.disableDataSourceSelector&&!pt.value),Ii=ct(()=>({zoomControl:!1})),hs=ct(()=>{const N=Number(K.maxZoom);return Number.isFinite(N)?Math.max(fi.minZoom,N):fi.maxZoom}),{startRefreshInterval:Nn,stopRefreshInterval:cn}=ry(()=>ts(!1),ny,{skipFirstRefresh:!0,skipOnVisibilityHidden:!0}),Ai=wf("isLegendShown",!1),pr=bf("(max-width: 768px)"),qi=Wt(!1),ki=Wt(null),Ei=ct(()=>{var N;return((N=ki.value)==null?void 0:N.locationId)??null}),Yn=ct(()=>qi.value&&!pr.value),Zi=Wt(null);let zi=null;const Zr=Wt([]),{urlState:Vt,setUrlState:Pi}=ty({sync:!K.disableUrlSync});function Ci(N){return Array.isArray(N)?N.length?String(N[0]??""):null:N==null?null:String(N)}function Ar(N){const ie=Array.isArray(N)?N:[N],me=new Set,Pe=[];for(const Be of ie)if(Be!=null)for(const St of String(Be).split(",")){const bt=St.trim();!bt||me.has(bt)||(me.add(bt),Pe.push(bt))}return Pe}const un=Wt([]),Vn=Wt([]),he=Wt(!1),hn=Wt(!1);let dn=null,Ct=null;
581const kt=ct(()=>un.value.filter(N=>{var ie;return!!((ie=N.name)!=null&&ie.trim())}).map(N=>({label:N.name,value:N.name}))),ds=ct(()=>new Set(kt.value.map(N=>N.value))),pn=ct(()=>kt.value.map(N=>N.value)),di=ct(()=>Vn.value.filter(N=>{var ie;return!!((ie=N.name)!=null&&ie.trim())}).map(N=>({label:qe(N.name,N.name),value:N.name,description:N.description}))),Kn=ct(()=>new Set(di.value.map(N=>N.value))),fr=ct(()=>di.value.map(N=>N.value)),ps=ct(()=>he.value||hn.value),fs=ct(()=>Ze.value&&st.value||ps.value||!kt.value.length&&!di.value.length);function Ae(N,ie,me){if(!ie.length)return null;const Pe=new Map(ie.map(bt=>[bt.value,bt.label])),Be=new Set(Pe.keys()),St=N.filter(bt=>Be.has(bt));return St.length===ie.length?me.all:St.length?St.length===1?Pe.get(St[0])??St[0]:`${St.length} ${me.plural}`:me.none}const Gr=ct(()=>{const N=Ae(ge.selectedSensorTypes,di.value,{all:qe("all_sensor_types","All sensor types"),none:qe("no_sensor_types","No sensor types"),plural:qe("sensor_types_count","sensor types")}),ie=Ae(ge.selectedDataSources,kt.value,{all:qe("all_sources","All sources"),none:qe("no_sources","No sources"),plural:qe("sources_count","sources")});return[N,ie].filter(Boolean).join(" | ")||qe("filter","Filter")}),Gi=ct(()=>[{key:An,label:qe("sensor_type_filter","Sensor type"),allLabel:qe("all_sensor_types","All sensor types"),emptyLabel:qe("no_sensor_types","No sensor types"),multipleLabel:qe("sensor_types_count","sensor types"),options:di.value,selectedValues:ge.selectedSensorTypes},{key:In,label:qe("data_source_filter","Data source"),allLabel:qe("all_sources","All sources"),emptyLabel:qe("no_sources","No sources"),multipleLabel:qe("sources_count","sources"),options:kt.value,selectedValues:ge.selectedDataSources}]);function mr(){return Object.prototype.hasOwnProperty.call(Ot.query,In)}function Rr(){return Object.prototype.hasOwnProperty.call(Ot.query,An)}function Ce(N,ie){return ie&&Ar(N).length===0}function Tt(N,ie=!1){const me=new Set,Pe=ds.value,Be=ie&&Pe.size>0,St=[];for(const bt of N){const ft=String(bt||"").trim();!ft||me.has(ft)||Be&&!Pe.has(ft)||(me.add(ft),St.push(ft))}return St}function it(N,ie){return N.length!==ie.length?!1:N.every((me,Pe)=>me===ie[Pe])}function Ki(N){const ie=pn.value;if(!ie.length||N.length!==ie.length)return!1;const me=new Set(N);return ie.every(Pe=>me.has(Pe))}function Br(N){const ie=fr.value;if(!ie.length||N.length!==ie.length)return!1;const me=new Set(N);return ie.every(Pe=>me.has(Pe))}function ht(N){const ie=Tt(N,kt.value.length>0);if(!Ki(ie))return ie.length?ie.join(","):kt.value.length>0?"":void 0}function gr(N,ie){return!ie&&kt.value.length?pn.value:Tt(Ar(N),kt.value.length>0)}function Fr(N,ie=!1){const me=new Set,Pe=Kn.value,Be=ie&&Pe.size>0,St=[];for(const bt of N){const ft=String(bt||"").trim();!ft||me.has(ft)||Be&&!Pe.has(ft)||(me.add(ft),St.push(ft))}return St}function Er(N){const ie=Fr(N,di.value.length>0);if(!Br(ie))return ie.length?ie.join(","):di.value.length>0?"":void 0}function _r(N,ie){return!ie&&di.value.length?fr.value:Fr(Ar(N),di.value.length>0)}async function Z(){return dn||(he.value=!0,dn=$fetch(`${Ge}/catalog/datasources`,{headers:ot}).then(N=>{un.value=Array.isArray(N)?N:[],U()}).catch(N=>{console.error("Failed to fetch datasource catalog:",N)}).finally(()=>{he.value=!1,dn=null}),dn)}async function C(){return Ct||(hn.value=!0,Ct=$fetch(`${Ge}/catalog/sensor-types`,{headers:ot}).then(N=>{Vn.value=Array.isArray(N)?N:[],ee()}).catch(N=>{console.error("Failed to fetch sensor type catalog:",N)}).finally(()=>{hn.value=!1,Ct=null}),Ct)}function P(N){if(!ki.value)return!1;if(!N.length)return kt.value.length>0;const ie=ki.value.dataSource;return!!(ie&&!N.includes(ie))}function R(N){if(!ki.value)return!1;if(!N.length)return di.value.length>0;const ie=ki.value.sensorType;return!!(ie&&!N.includes(ie))}function U(){if(!kt.value.length)return;const N=gr(Ot.query[In],mr());if(it(N,ge.selectedDataSources))return;const ie=P(N);ge.setSelectedDataSources(N),Pi({[In]:ht(N)}),ie&&Or(),we&&mi()}function ee(){if(!di.value.length)return;const N=_r(Ot.query[An],Rr());if(it(N,ge.selectedSensorTypes))return;const ie=R(N);ge.setSelectedSensorTypes(N),Pi({[An]:Er(N)}),ie&&Or(),we&&mi()}const re=ct(()=>{const N=Ci(Vt.ownerId??Vt.owner_id);if(!N)return null;const ie=Number.parseInt(N,10);return Number.isFinite(ie)?ie:null}),oe=ct(()=>{const N=Ci(Vt.countryFilter??Vt.country_filter);return N===Ah?N:null}),X=(N,ie,me)=>{let Pe=!1;for(let Be=0,St=me.length-1;Be<me.length;
581St=Be,Be+=1){const[bt,ft]=me[Be],[ir,Li]=me[St];ft>ie!=Li>ie&&N<(ir-bt)*(ie-ft)/(Li-ft)+bt&&(Pe=!Pe)}return Pe},fe=N=>{if(oe.value!==Ah)return!0;const ie=Number(N.latitude),me=Number(N.longitude);return!Number.isFinite(ie)||!Number.isFinite(me)?!1:X(me,ie,A)},ve=N=>oe.value!==Ah?N:N.filter(fe);let ue=null,Ee=null,Xe=null;const rt=(N,ie="fly")=>{if(!we)return!1;const me=Number(N==null?void 0:N.lat),Pe=Number(N==null?void 0:N.long),Be=Number(N==null?void 0:N.zoom);if(!Number.isFinite(me)||!Number.isFinite(Pe)||!Number.isFinite(Be))return!1;const St=we.getCenter(),bt=we.getZoom();return Math.abs(St.lat-me)<1e-6&&Math.abs(St.lng-Pe)<1e-6&&Number(bt)===Be?!1:(we.stop(),ie==="set"?we.setView([me,Pe],Be,{animate:!1}):we.flyTo([me,Pe],Be,{animate:!0,duration:.8}),!0)},Bt=N=>{!N||typeof N!="object"||(Ee={...N},Xe===null&&(Xe=window.requestAnimationFrame(()=>{Xe=null,Ee&&we&&(es(),rt(Ee,"set"),Ee=null)})))};Fi(()=>K.initialUrlState,N=>{if(!N||typeof N!="object")return;if(Pi(N),Object.prototype.hasOwnProperty.call(N,In)){const me=gr(N[In],!0);it(me,ge.selectedDataSources)||ge.setSelectedDataSources(me)}if(Object.prototype.hasOwnProperty.call(N,An)){const me=_r(N[An],!0);it(me,ge.selectedSensorTypes)||ge.setSelectedSensorTypes(me)}if(!we){ue={...N};return}rt(N)||(Bt(N),ts(!1))},{deep:!0,immediate:!0});const wt=ct(()=>K.height?{"--map-height":K.height}:void 0),Ft=ct(()=>K.height?{height:K.height}:void 0),{standardsPayload:Et,ensureAqiStandardsLoaded:yi,visiblePm25Standards:ai,getPm25BandColor:It}=Uy(),Zt=ct(()=>Ye.value&&at.value),Yt=ct(()=>Vt.wind_layer==="true"),pi=ct(()=>Vt.fires_layer==="true"),Di=ct(()=>"light"),vi=ct(()=>!1),Hr=ct(()=>String(K.lightMapStyleUrl||"").trim()||fi.light_map_style_url),Gt=ct(()=>Vt.no_border==="true"),Ls=ct(()=>{const N=Ci(Vt.loc);if(!N)return null;const ie=Number.parseInt(N,10);return Number.isFinite(ie)?ie:null}),Rs=ct(()=>{const N=Ci(Vt.sidebar);return N?N==="1"||N==="true"||N==="open":!1}),Ji=ct(()=>ge.excludeOutliers),yr=ct(()=>{if(!ge.embedded||!Ei.value)return null;const N=Cg(Mg("/map",dt.value)),ie=new URLSearchParams;ie.set("zoom",Ci(Vt.zoom)??String(fi.zoom)),ie.set("long",Ci(Vt.long)??String(fi.center[1])),ie.set("lat",Ci(Vt.lat)??String(fi.center[0])),ie.set("meas",Ci(Vt.meas)??String(Qo.meas));const me=ht(ge.selectedDataSources);me!==void 0&&ie.set(In,me);const Pe=Er(ge.selectedSensorTypes);return Pe!==void 0&&ie.set(An,Pe),ie.set("wind_layer",Ci(Vt.wind_layer)??String(fi.wind_layer)),ie.set("map_theme",Ci(Vt.map_theme)??String(fi.map_theme)),ie.set("org",Ci(Vt.org)??String(Qo.org)),re.value&&ie.set("ownerId",String(re.value)),ie.set("embedded","false"),ie.set("sidebar","1"),ie.set("loc",String(Ei.value)),`${window.location.origin}${N}?${ie.toString()}`}),rl=ct(()=>{const N=xh[nt.PM25],ie=xh[nt.PM_AQI],me=xh[nt.RCO2],Pe=[{label:N,value:Yi},{label:ie,value:Pn},{label:me,value:nt.RCO2}];return ai.value.length&&(Pe.push({label:`Other ${Z_[nt.PM25]} Standards`,value:$p,disabled:!0,className:"ag-dropdown-subheader"}),Pe.push(...ai.value.map(Be=>({label:Be.displayName,value:Be.id})))),Pe}),Pr=ct(()=>ge.selectedMeasure===nt.RCO2?nt.RCO2:ge.selectedMeasure===nt.PM_AQI?Pn:ge.selectedAqiStandardId||Yi),mi=Dy(ts,400);let Hi,fn=null,zt,Kt=null,xi=null,ri=Hr.value,Un=!1,Qi,ms=!1,bi=null,Wr=null;const Xr=N=>{const ie=Number(N);return Number.isFinite(ie)?ie:null},mn=(N,ie)=>N!==null&&ie!==null&&!(N===0&&ie===0),Mn=()=>K.externalMeasure==="rco2"?"rco2":"pm25",Nt=(N,ie)=>{const me=ie==="rco2"?N.co2:N.pm25;return Xr(me)??0},Bs=(N,ie,me)=>me,wa=N=>N==="rco2"?{label:qe("tooltip_co2_label","CO2"),unit:qe("unit_ppm","ppm")}:{label:qe("tooltip_pm25_label","PM2.5"),unit:qe("unit_ug_m3","μg/m³")},Jn=(N,ie)=>ie==="rco2"?String(Math.round(N)):N.toFixed(1),Sa=N=>!N||!Number.isFinite(N)?"":new Intl.DateTimeFormat(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit"}).format(N),Fs=(N,ie,me,Pe)=>{const Be=wa(me),St=String(N.name||"Monitor"),bt=Jn(ie,me),ft=Sa(Pe);return`
582      <div class="ag-route-tooltip">
583        <div class="tooltip-header">${St}</div>
584        <div class="tooltip-content">
585          <strong>${Be.label}:</strong> ${bt} ${Be.unit}
586          ${ft?`<div class="tooltip-timestamp">${ft}</div>`:""}
587        </div>
588      </div>
589    `};function Qn(){Wr&&Wr.clearLayers()}function Os(N,ie,me,Pe){const Be=String(N.color||"#225f90"),St=Bs(ie,me,Be),bt=String(N.status||"")==="OFFLINE",ft=["ag-event-marker"];Pe&&ft.push("is-selected"),bt&&ft.push("is-offline");const ir=Math.round(ie);return hr.divIcon({html:`<div class="${ft.join(" ")}" style="--ag-event-fill:${St};--ag-event-border:${Be};"><span>${ir}</span></div>`,className:"ag-event-marker-box",iconSize:hr.point(32,32)})}function jn(){if(!we||!Wr)return;Qn();const N=String(K.externalSelectedGroupId||""),me=[...Array.isArray(K.externalGroups)?K.externalGroups:[]].sort((Be,St)=>{const bt=String(Be.id||"")===N,ft=String(St.id||"")===N;return bt===ft?0:bt?1:-1}),Pe=Mn();for(const Be of me){const St=String(Be.status||"")==="OFFLINE",bt=N&&String(Be.id||"")===N,ft=Be.point,ir=ft?Xr(ft.lat):null,
589Li=ft?Xr(ft.lon):null,Kr=mn(ir,Li);if(K.externalTrailsEnabled&&Array.isArray(Be.recentPoints)&&Be.recentPoints.length>1){const vr=[];for(const Oi of Be.recentPoints){const is=Xr(Oi.lat),Ri=Xr(Oi.lon);mn(is,Ri)&&vr.push({latlng:[is,Ri],value:Nt(Oi,Pe),timestamp:Oi.timestamp})}if(vr.length>1){const Oi=vr.map(Ri=>Ri.latlng);bt&&(hr.polyline(Oi,{color:"rgba(31, 53, 72, 0.18)",weight:15,opacity:1}).addTo(Wr),hr.polyline(Oi,{color:"#ffffff",weight:11,opacity:.92}).addTo(Wr)),hr.polyline(Oi,{color:bt?"#ffffff":String(Be.color||"#225f90"),weight:bt?7:6,opacity:bt?.98:.45}).addTo(Wr);for(let Ri=1;Ri<vr.length;Ri+=1){const Qr=vr[Ri].value,vs=bt?6:3,Ea=bt?1:.9,Dn=hr.polyline([Oi[Ri-1],Oi[Ri]],{color:Bs(Qr,Pe,String(Be.color||"#225f90")),weight:vs,opacity:Ea});Dn.bindTooltip(Fs(Be,Qr,Pe,vr[Ri].timestamp),{direction:"top",sticky:!0,className:"ag-route-tooltip-popup"}),Dn.on("mouseover",()=>{Dn.setStyle({weight:vs+3,opacity:1}),Dn.bringToFront()}),Dn.on("mouseout",()=>{Dn.setStyle({weight:vs,opacity:Ea})}),Dn.addTo(Wr)}}}if(St||!ft||!Kr)continue;const Jr=Nt(ft,Pe),Gs=Os(Be,Jr,Pe,bt),ys=hr.marker([ir,Li],{icon:Gs,zIndexOffset:bt?2e4:12e3});ys.on("click",()=>{const vr=String(Be.id||"");vr&&d("external-group-click",vr)}),ys.addTo(Wr)}}function ro(){if(!we)return;const N=String(K.externalSelectedGroupId||"");if(!N)return;const me=(Array.isArray(K.externalGroups)?K.externalGroups:[]).find(ft=>String(ft.id||"")===N);if(!(me!=null&&me.point))return;const Pe=Xr(me.point.lat),Be=Xr(me.point.lon);if(!mn(Pe,Be))return;const St=we.getCenter();Math.abs(St.lat-Pe)<1e-6&&Math.abs(St.lng-Be)<1e-6||(we.stop(),we.panTo([Pe,Be],{animate:!0}))}function nl(){var ft;if(ms||!Kt)return;const N=(ft=Kt==null?void 0:Kt.getMaplibreMap)==null?void 0:ft.call(Kt);if(!N)return;const ie=()=>{ms||(ms=!0,bi==null||bi(),bi=null,d("basemap-ready"))},me=()=>typeof N.areTilesLoaded=="function"?!!N.areTilesLoaded():typeof N.loaded=="function"?!!N.loaded():!1,Pe=()=>{me()&&ie()},Be=()=>{Pe()},St=()=>{Pe()},bt=()=>{Pe()};N.on("load",Be),N.on("idle",St),N.on("render",bt),bi=()=>{N.off("load",Be),N.off("idle",St),N.off("render",bt)}}function no(N){vt.value=N}function sl(N){Rt.value=N}const $n=async()=>{await tr(),K.disableGeocoder||$s()};function es(){we&&ke===null&&(ke=window.requestAnimationFrame(()=>{ke=null;try{we==null||we.invalidateSize({pan:!1})}catch{}}))}function er(){var ie,me;if(Se)return;const N=()=>es();window.addEventListener("resize",N,{passive:!0}),(ie=window.visualViewport)==null||ie.addEventListener("resize",N,{passive:!0}),(me=window.visualViewport)==null||me.addEventListener("scroll",N,{passive:!0}),Se=()=>{var Pe,Be;window.removeEventListener("resize",N),(Pe=window.visualViewport)==null||Pe.removeEventListener("resize",N),(Be=window.visualViewport)==null||Be.removeEventListener("scroll",N)}}async function tr(){if(xt.value){we=xt.value.leafletObject,ue&&(rt(ue),ue=null),er(),gs(),xi==null||xi.remove(),xi=null,K.showZoomControls&&!K.headless&&!pr.value&&(xi=hr.control.zoom({position:"topright"}),xi.addTo(we)),zn();try{const N=`
590      <span style="font-size: 10px; margin-right: 4px;">🇺🇦</span>
591      <a target="_blank" href="https://leafletjs.com/">Leaflet</a> |
592      © <a target="_blank" href="https://www.airgradient.com/">AirGradient</a> |
593      © <a target="_blank" href="https://openaq.org/">OpenAQ</a>
594    `;we.attributionControl?we.attributionControl.setPrefix(N):hr.control.attribution({prefix:N}).addTo(we)}catch(N){console.warn("Attribution init failed:",N)}ri=vi.value?fi.dark_map_style_url:Hr.value,await $y();try{Kt=hr.maplibreGL({style:ri,center:[Number(Vt.lat),Number(Vt.long)],zoom:Number(Vt.zoom)}),Kt.addTo(we),nl()}catch(N){console.warn("MapLibre basemap init failed:",N),Kt=null,bi=null}zt=hr.geoJson(null,{pointToLayer:ao}).addTo(we),Wr=hr.layerGroup().addTo(we),jn(),we.on("moveend",()=>{const N=we.getCenter(),ie=we.getZoom();Pi({zoom:ie,lat:N.lat.toFixed(2),long:N.lng.toFixed(2)}),d("view-change",{lat:N.lat,long:N.lng,zoom:ie}),pt.value||mi()}),pt.value||Nn(),we.whenReady(async()=>{await Aa(),pt.value||(Xt.value&&await Z(),await ts(!0)),setTimeout(()=>{We.value=!0},200)})}}function Ns(){Pi({wind_layer:String(!Yt.value)})}function Vs(){Pi({fires_layer:String(!pi.value)})}function gs(){if(!we)return;we.getContainer().classList.toggle("is-dark-map",vi.value)}function Ta(N){Zi.value=N,zi&&(window.clearTimeout(zi),zi=null),zi=window.setTimeout(()=>{Zi.value=null,zi=null},800)}function qn(N){if(!we)return;const ie=we.getZoom(),me=hr.latLng(N),Pe=we.project(me,ie),Be=we.getSize(),bt=Math.round(468/2+14),ft=-Math.max(80,Math.round(Be.y*.24)),ir=pr.value?hr.point(0,ft):hr.point(bt,0),Li=Pe.subtract(ir),Kr=we.unproject(Li,ie);we.flyTo(Kr,ie,{animate:!0,duration:.6})}function al(N){for(const ie of Zr.value||[])if(ie.type===au.sensor&&ie.locationId===N)return ie;return null}function so(){if(!we)return;if(!Rs.value){qi.value&&Or();return}const N=Ls.value;if(N===null)return;const ie=al(N);ie&&(Ei.value===ie.locationId&&qi.value||(Ta(ie.locationId),ki.value=ie,qi.value=!0,qn([ie.latitude,ie.longitude])))}function ao(N,ie){var vr,Oi,is,Ri;let me=(vr=N.properties)==null?void 0:vr.value;(me==null||Number.isNaN(me))&&(me=0);let Pe=me;ge.selectedMeasure===nt.PM_AQI&&(Pe=kh(me));const Be=ge.selectedMeasure===nt.RCO2?$_(me):It(me),St="textColor"in Be&&Be.textColor?`color: ${Be.textColor};`:"",bt=Be.textColorClass?` ${Be.textColorClass}`:"",ft=((Oi=N.properties)==null?void 0:Oi.type)===au.sensor,ir=((is=N.properties)==null?void 0:is.sensorType)===Yy,Li=ft&&Ei.value!==null&&((Ri=N.properties)==null?void 0:Ri.locationId)===Ei.value,Kr=Li&&Zi.value===Ei.value,Jr=ft?28:40,Gs=hr.divIcon({html:`<div class="ag-marker${ft?"":" is-cluster"}${Li?" is-selected":""}${Kr?" is-selected-intro":""}${ir?" is-reference":""}${bt}"
595            style="background-color: ${Be==null?void 0:Be.bgColor}; ${St} --marker-highlight: ${Be==null?void 0:Be.bgColor};">
596            <span>${Math.round(Pe)}</span>
597          </div>`,className:`marker-box ${ft?"":"is-cluster-marker-box"}`,iconSize:hr.point(Jr,Jr)}),ys=hr.marker(ie,{icon:Gs,zIndexOffset:Li?1e4:0});return ys.on("click",()=>{if(ft&&N.properties){const Qr=N.properties;if(Ei.value===Qr.locationId&&qi.value){Or();return}Ta(Qr.locationId),ki.value=Qr,qi.value=!0,Pi({sidebar:"1",loc:String(Qr.locationId)}),qn(ie)}else if(!ft){const Qr=we.getZoom(),vs=Math.min(Qr+2,hs.value);we.flyTo(ie,vs,{animate:!0,duration:.8})}}),ys}async function ts(N=!0){if(pt.value){Ze.value=!1;return}if(!(Ze.value||!we)){Ze.value=!0,st.value=N;try{const ie=we.getBounds(),me=ge.selectedMeasure===nt.PM_AQI?nt.PM25:ge.selectedMeasure,Pe=!ge.selectedDataSources.length&&Ce(Ot.query[In],mr()),Be=!ge.selectedSensorTypes.length&&Ce(Ot.query[An],Rr());if(Xt.value&&(Pe||Be||kt.value.length>0&&!ge.selectedDataSources.length||di.value.length>0&&!ge.selectedSensorTypes.length)){const Li={type:"FeatureCollection",features:[]};Hi=Li,fn=me,Zr.value=[],ki.value&&Or(),requestAnimationFrame(()=>{zt.clearLayers(),zt.addData(Li)});return}const bt=await $fetch(`${Ge}/measurements/current/cluster`,{params:{xmin:ie.getWest(),ymin:ie.getSouth(),xmax:ie.getEast(),ymax:ie.getNorth(),zoom:we.getZoom(),measure:me,excludeOutliers:Ji.value,ownerId:re.value??void 0,dataSources:ht(ge.selectedDataSources),sensorTypes:Er(ge.selectedSensorTypes)},retry:1,headers:ot}),ft=ve(bt.data),ir=F_(ft);if(Hi=ir,fn=me,Zr.value=ft,requestAnimationFrame(()=>{zt.clearLayers(),zt.addData(ir)}),Ei.value!==null){const Li=ft.find(Kr=>Kr.type===au.sensor&&Kr.locationId===Ei.value);Li&&(ki.value=Li)}}catch(ie){console.error("Failed to fetch map data:",ie),Ve(ie,"Failed to load map data. Please try again.")}finally{Ze.value=!1}}}function Or(){qi.value=!1,ki.value=null,Pi({sidebar:void 0,loc:void 0}),zt&&Hi&&(zt.clearLayers(),zt.addData(Hi))}async function oo(N){await ts(!1);const ie=Ji.value&&[nt.PM25,nt.PM_AQI].includes(ge.selectedMeasure);N.action==="set"&&N.enabled&&ie&&Or()}function _s(N){const ie=Tt(N,!0);if(it(ie,ge.selectedDataSources))return;const me=P(ie);ge.setSelectedDataSources(ie),Pi({[In]:ht(ie)}),me&&Or(),mi()}function Ia(N){const ie=Fr(N,!0);if(it(ie,ge.selectedSensorTypes))return;const me=R(ie);ge.setSelectedSensorTypes(ie),Pi({[An]:Er(ie)}),me&&Or(),mi()}function Us(N){if(N.key===An){Ia(N.selectedValues);return}N.key===In&&_s(N.selectedValues)}function js(N){if(N&&ge.embedded)return;const ie=document.body;if(ie){if(N){Te.value=ie.style.overflow||"",ie.style.overflow="hidden";return}ie.style.overflow=Te.value||""}}Fi(()=>qi.value,N=>{js(N)},{immediate:!0}),Fi(Ei,()=>{zt&&Hi&&(zt.clearLayers(),zt.addData(Hi))}),Fi(()=>[K.externalGroups,K.externalSelectedGroupId,K.externalMeasure,K.externalTrailsEnabled],()=>{jn()},{deep:!0,immediate:!0}),Fi(()=>K.externalSelectedGroupId,()=>{ro()}),Fi([Rs,Ls,Zr],()=>{so()},{immediate:!0}),Fi(()=>Ot.query[In],N=>{const ie=mr(),me=Ar(N),Pe=gr(N,ie);if(ie&&kt.value.length>0&&!it(me,Pe)&&Pi({[In]:ht(Pe)}),it(Pe,ge.selectedDataSources))return;const Be=P(Pe);ge.setSelectedDataSources(Pe),Be&&Or(),we&&mi()},{deep:!0}),Fi(()=>Ot.query[An],N=>{const ie=Rr(),me=Ar(N),Pe=_r(N,ie);if(ie&&di.value.length>0&&!it(me,Pe)&&Pi({[An]:Er(Pe)}),it(Pe,ge.selectedSensorTypes))return;const Be=R(Pe);ge.setSelectedSensorTypes(Pe),Be&&Or(),we&&mi()},{deep:!0}),Fi(kt,()=>{U()},{deep:!0}),Fi(di,()=>{ee()},{deep:!0});function $s(){if(!we)return;const N=new B_;Qi=L_({provider:N,style:"bar",autoClose:!0,keepResult:!0,searchLabel:qe("search_placeholder","Search")}),we.addControl(Qi)}function Yr(N){const ie=N&&typeof N=="object"&&"value"in N?N.value:N;if(ie===$p)return;const me=ge.selectedMeasure,Pe=String(ie);Pe===nt.RCO2?ge.setSelectedMeasure(nt.RCO2):Pe===Pn?(ge.setSelectedMeasure(nt.PM_AQI),ge.setSelectedAqiStandardId(Pn)):Pe===Yi?(ge.setSelectedMeasure(nt.PM25),ge.setSelectedAqiStandardId(Yi)):(ge.setSelectedMeasure(nt.PM25),ge.setSelectedAqiStandardId(Pe));const Be=ge.selectedMeasure,St=Be===nt.RCO2?nt.RCO2:Pe;Pi({meas:St}),[nt.PM25,nt.PM_AQI].includes(me)&&[nt.PM25,nt.PM_AQI].includes(Be)&&zt&&Hi?(zt.clearLayers(),zt.addData(Hi)):mi()}async function Aa(){if(!Kt||Un)return;const N=vi.value?fi.dark_map_style_url:Hr.value;if(ri===N){vi.value&&await kn(),Gt.value&&await qs();return}Un=!0;try{const ie=typeof Kt.getMaplibreMap=="function"?Kt.getMaplibreMap():Kt._glMap;ie&&typeof ie.setStyle=="function"&&(await new Promise(me=>{const Pe=async()=>{ie.off("styledata",Pe),vi.value&&await kn(),Gt.value&&await qs(),me()};ie.on("styledata",Pe),ie.setStyle(N)}),ri=N)}catch(ie){console.error("Failed to update base map style:",ie)}finally{Un=!1}}async function qs(){try{const N=typeof(Kt==null?void 0:Kt.getMaplibreMap)=="function"?Kt.getMaplibreMap():Kt==null?void 0:Kt._glMap;if(!N)return;const ie=await Gy(N,{timeoutMs:5e3});Zt.value&&ie.length&&console.debug("[Map] no_border enabled; hidden layers:",ie)}catch(N){console.error("Failed to hide administrative map features:",N)}}async function kn(){if(vi.value)try{const N=typeof Kt.getMaplibreMap=="function"?Kt.getMaplibreMap():Kt._glMap;if(!N){console.warn("MapLibre map instance not found");return}if(!N.isStyleLoaded())try{await new Promise((me,Pe)=>{const Be=setTimeout(()=>{Pe(new Error("Style load timeout"))},5e3),St=Nh(()=>{N.isStyleLoaded()&&(clearInterval(St),clearTimeout(Be),me())},50);N.once("styledata",()=>{clearInterval(St),clearTimeout(Be),me()})})}catch(me){console.error("Style loading failed:",me);return}const ie=N.getStyle();N.getPaintProperty("background","background-color")!==void 0&&N.setPaintProperty("background","background-color","#2a2a2a"),ie.layers.forEac
597h(me=>{try{me.type==="fill"&&me.id.includes("water")&&N.setPaintProperty(me.id,"fill-color","#383838"),me.type==="fill"&&(me.id.includes("land")||me.id.includes("background"))&&N.setPaintProperty(me.id,"fill-color","#333333"),me.type==="line"&&me.id.includes("boundary")&&N.setPaintProperty(me.id,"line-color","#5a5a5a"),me.type==="line"&&me.id.includes("road")&&N.setPaintProperty(me.id,"line-color","#4a4a4a"),me.type==="symbol"&&(me.id.includes("place")||me.id.includes("label"))&&N.setPaintProperty(me.id,"text-color","#c0c0c0")}catch{}})}catch(N){console.error("Failed to customize dark style colors:",N)}}function zn(){ge.headless&&we&&we.scrollWheelZoom.disable()}function Ut(N,ie){we&&we.flyTo([N,ie],12,{animate:!0,duration:1.2})}function Zs(N){console.error("Geolocation error:",N)}return Ds(async()=>{ge.setHeadless(K.headless||Ep(Ot.query.headless)),ge.setEmbedded(K.embedded||Ep(Ot.query.embedded)),ge.setSelectedDataSources(gr(Vt[In],mr())),ge.setSelectedSensorTypes(_r(Vt[An],Rr())),Xt.value&&(Z(),C()),await yi();const N=Array.isArray(Vt.meas)?String(Vt.meas[0]??""):String(Vt.meas??"");let ie=nt.PM25,me=ge.selectedAqiStandardId||Yi;N===nt.RCO2?ie=nt.RCO2:N===nt.PM_AQI||N==="pi02"||N===Pn?(ie=nt.PM_AQI,me=Pn):!N||N===nt.PM25||N==="pm02"||N==="pm02_raw"||N===Yi?(ie=nt.PM25,me=Yi):(ie=nt.PM25,me=N),!N&&ge.selectedAqiStandardId===Pn&&(ie=nt.PM_AQI,me=Pn),ge.setSelectedAqiStandardId(me),ge.setSelectedMeasure(ie);const Pe=ie===nt.RCO2?nt.RCO2:me;Pi({meas:Pe})}),Fi(()=>Di.value,async()=>{We.value&&await Aa(),gs()}),Fi(()=>Hr.value,async()=>{We.value&&await Aa()}),Fi(()=>dt.value,()=>{K.disableGeocoder||we&&Qi&&(we.removeControl(Qi),$s())}),Fi(()=>[Et.value,ge.selectedAqiStandardId],()=>{var N;if(Et.value&&ge.selectedAqiStandardId!==Yi&&!((N=Et.value.visibility)!=null&&N[ge.selectedAqiStandardId])&&(ge.selectedMeasure===nt.PM_AQI&&ge.setSelectedMeasure(nt.PM25),ge.setSelectedAqiStandardId(Yi),Pi({meas:Yi})),!(!we||!Hi||!zt)&&(ge.selectedMeasure===nt.PM25||ge.selectedMeasure===nt.PM_AQI)){if(fn!==nt.PM25)return;zt.clearLayers(),zt.addData(Hi)}}),el(()=>{bi==null||bi(),bi=null,Se==null||Se(),Se=null,ke!==null&&(window.cancelAnimationFrame(ke),ke=null),Xe!==null&&(window.cancelAnimationFrame(Xe),Xe=null),cn(),xi==null||xi.remove(),xi=null,Qn(),Wr=null,Kt=null,ri=Hr.value,we=null,We.value=!1,Un=!1,js(!1),zi&&(window.clearTimeout(zi),zi=null)}),(N,ie)=>{const me=Qp,Pe=Bg,Be=$g,St=t_;return Jt(),Ir("div",{id:"map-wrapper",class:Tr(["map-wrapper",{"has-location-panel":Yn.value}]),style:uu(wt.value)},[_i("div",Hy,[Zt.value?(Jt(),qr(me,{key:0,ripple:!1,size:"normal",customIcon:Ht(ge).excludeOutliers?"filter.svg":"filter-off.svg",iconAlt:Ht(ge).excludeOutliers?"Filter":"No filter",style:"light",title:Ht(ge).excludeOutliers?"Experimental: Outliers filtered":"Show all data points",onClick:ie[0]||(ie[0]=()=>{Ht(ge).setExcludeOutliers(!Ht(ge).excludeOutliers),ts()})},null,8,["customIcon","iconAlt","title"])):ln("",!0)]),Pp(Pe,{show:Ze.value&&st.value||vt.value||Rt.value},null,8,["show"]),_i("div",{id:"map",style:uu(Ft.value)},[_i("div",Wy,[K.disableMeasureSelector?ln("",!0):(Jt(),qr(Be,{key:0,class:"aqi-standard-selector","selected-value":Pr.value,options:rl.value,disabled:Ze.value&&st.value,placeholder:Ht(qe)("select_option","Select an option..."),translate:!1,onChange:Yr},null,8,["selected-value","options","disabled","placeholder"])),Xt.value?(Jt(),qr(St,{key:1,class:"map-filter-control",sections:Gi.value,"display-value":Gr.value,disabled:fs.value,placeholder:Ht(qe)("filter","Filter"),variant:"mapOverlay",onSectionChange:Us},null,8,["sections","display-value","disabled","placeholder"])):ln("",!0),_i("div",Xy,[K.disableInfoButton?ln("",!0):(Jt(),qr(me,{key:0,ripple:!1,size:"normal",customIcon:"info_icon.svg",iconAlt:"Info",style:"light",active:Ht(Ai),onClick:ie[1]||(ie[1]=bt=>Ai.value=!Ht(Ai))},null,8,["active"])),K.disableGeolocation?ln("",!0):(Jt(),qr(oy,{key:1,onLocationFound:Ut,onError:Zs})),Ht(ge).embedded?ln("",!0):(Jt(),qr(me,{key:2,ripple:!1,size:"normal",customIcon:"wind-icon.svg",active:Yt.value,title:"Toggle Wind Layer",onClick:Ns},null,8,["active"])),Ht(ge).embedded?ln("",!0):(Jt(),qr(me,{key:3,ripple:!1,size:"normal",customIcon:"fire-icon.svg",active:pi.value,title:"Toggle Wildfire Layer",onClick:Vs},null,8,["active"]))])]),Pp(Ht(I_),{ref_key:"map",ref:xt,class:"map",options:Ii.value,maxBoundsViscosity:Ht(fi).maxBoundsViscosity,maxBounds:Ht(fi).maxBounds,zoom:Number(Ht(Vt).zoom),"max-zoom":hs.value,"min-zoom":Ht(fi).minZoom,center:[Number(Ht(Vt).lat),Number(Ht(Vt).long)],attributionControl:!0,onReady:$n},null,8,["options","maxBoundsViscosity","maxBounds","zoom","max-zoom","min-zoom","center"]),Ht(we)&&We.value&&Yt.value?(Jt(),qr(Ht(O),{key:0,map:Ht(we),enabled:Yt.value,"map-theme":Di.value,onLoadingChange:no},null,8,["map","enabled","map-theme"])):ln("",!0),Ht(we)&&We.value&&pi.value?(Jt(),qr(Ht(D),{key:1,map:Ht(we),enabled:pi.value,onLoadingChange:sl},null,8,["map","enabled"])):ln("",!0),Ht(Ai)?(Jt(),qr(Ht(Y),{key:2,open:Ht(Ai),"show-fires":pi.value,onClose:ie[2]||(ie[2]=bt=>Ai.value=!1)},null,8,["open","show-fires"])):ln("",!0)],4),qi.value?(Jt(),qr(Ht(Q),{key:0,open:qi.value,location:ki.value,"open-more-detail-url":yr.value,onAdminPm25Updated:oo,onClose:Or},null,8,["open","location","open-more-detail-url"])):ln("",!0)],6)}}}),lv=Object.freeze(Object.defineProperty({__proto__:null,default:Ky},Symbol.toStringTag,{value:"Module"}));
597export{En as H,nt as M,Yi as R,Pn as U,Qp as _,yf as a,Uy as b,Dy as c,Z_ as d,av as e,Ya as f,$_ as g,cf as h,xh as i,rv as j,ov as k,nv as l,Bg as m,G_ as n,bf as o,kh as p,lv as q,r_ as r,sv as t,zy 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.