1import{_ as V_}from"./BA0vC9BE.js";import{_ as Z_}from"./CuWbcW7m.js";import{bH as Pm,bc as $a,bd as Op,bI as q_,c6 as G_,bM as Ru,c7 as H_,bm as km,bF as W_,bz as X_,cK as Y_,b6 as Em,aY as K_,cG as J_,cH as Q_,bv as ey,b3 as pp,bi as ty}from"./Dr_aj0OX.js";import{V as ry,Q as iy,N as ay,a as sy}from"./BemPtwop.js";import{s as ny}from"./CxDNZeNt.js";import{z as jp,t as Kf,d as Vn,b as Ci,w as fc,ax as oy,M as Ni,R as nr,V as zm,aa as Dm,X as Sa,Y as Mi,S as _i,U as dp,Z as Jf,a7 as ua,ag as Qf,J as fp,ae as Lm,a2 as em,a8 as Ws,T as Pp,af as ly,aB as cy,aC as tm,I as Rm,B as uy,ap as hy,n as py,ao as dy,a9 as lr,a6 as Ua,ad as fy,u as Xe,_ as my,f as rm}from"./bHGN7eKL.js";import"./BpmEf2C-.js";import"./83OoKLpT.js";import"./CJmY1hnY.js";import"./BZbghl0U.js";import"./C5o1H56f.js";import"./CsamSkNi.js";import"./C6ZNb4g7.js";import"./DWCIUJv3.js";(function(){try{var b=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},f=new b.Error().stack;f&&(b._sentryDebugIds=b._sentryDebugIds||{},b._sentryDebugIds[f]="cf5db8bf-0321-4295-8d3b-a7f048093961",b._sentryDebugIdIdentifier="sentry-dbid-cf5db8bf-0321-4295-8d3b-a7f048093961")}catch{}})();const mp=Pm(Ru.ui.strategy,Ru.ui.accordion,sy),gy=Pm(Ru.ui.strategy,Ru.ui.button,H_),_y=jp({components:{HDisclosure:ay,HDisclosureButton:iy,HDisclosurePanel:ry,UIcon:Op,UButton:$a},inheritAttrs:!1,props:{items:{type:Array,default:()=>[]},defaultOpen:{type:Boolean,default:!1},openIcon:{type:String,default:()=>mp.default.openIcon},states:{type:Array,default:()=>["closed"]},unmount:{type:Boolean,default:!1},closeIcon:{type:String,default:()=>mp.default.closeIcon},multiple:{type:Boolean,default:!1},class:{type:[String,Object,Array],default:()=>""},ui:{type:Object,default:()=>({})}},emits:["open","close"],setup(b,{emit:f}){const{ui:x,attrs:C}=q_("accordion",Kf(b,"ui"),mp,Kf(b,"class")),E=Vn(()=>gy),F=Ci([]),T=Vn(()=>F.value.map(({open:ie})=>ie));fc(T,(ie,be)=>{for(const et in ie){const ft=be[et],Nt=ie[et];!ft&&Nt?f("open",et):ft&&!Nt&&f("close",et)}},{immediate:!0});function o(ie,be){!b.items[ie].closeOthers&&b.multiple||F.value.forEach(et=>{et.open&&et.close(be.target)})}function fe(ie,be){const et=ie;et.style.height="0",et.offsetHeight,et.style.height=et.scrollHeight+"px",et.addEventListener("transitionend",be,{once:!0})}function ce(ie){const be=ie;be.style.height=be.scrollHeight+"px",be.offsetHeight}function Ae(ie){const be=ie;be.style.height="auto"}function Ie(ie,be){const et=ie;et.style.height="0",et.addEventListener("transitionend",be,{once:!0})}function De(ie){const be=F.value[ie];be&&be.$el.$el.$el.click()}return ny(()=>oy()),{ui:x,uiButton:E,attrs:C,buttonRefs:F,closeOthers:o,omit:G_,onEnter:fe,onBeforeLeave:ce,onAfterEnter:Ae,onLeave:Ie,openItem:De}}});function yy(b,f,x,C,E,F){const T=Op,o=$a,fe=fp("HDisclosureButton"),ce=fp("HDisclosurePanel"),Ae=fp("HDisclosure");return nr(),Ni("div",{class:ua(b.ui.wrapper)},[(nr(!0),Ni(zm,null,Dm(b.items,(Ie,De)=>(nr(),Sa(Ae,{key:De,as:"div",class:ua(b.ui.container),"default-open":b.defaultOpen||Ie.defaultOpen},{default:Mi(({open:ie,close:be})=>[_i(fe,{ref_for:!0,ref:et=>b.buttonRefs[De]={$el:et,open:ie,close:be},as:"template",disabled:Ie.disabled,onClick:et=>b.closeOthers(De,et),onKeydown:[Qf(et=>b.closeOthers(De,et),["enter"]),Qf(et=>b.closeOthers(De,et),["space"])]},{default:Mi(()=>[dp(b.$slots,"default",{item:Ie,index:De,open:ie,close:be},()=>[_i(o,Jf({ref_for:!0},{...b.omit(b.ui.default,["openIcon","closeIcon"]),...b.attrs,...b.omit(Ie,["slot","disabled","content","defaultOpen"])}),{trailing:Mi(()=>[_i(T,{name:ie&&b.closeIcon?b.closeIcon:b.openIcon,class:ua([ie&&!b.closeIcon?"-rotate-180":"",b.uiButton.icon.size[Ie.size||b.uiButton.default.size],b.ui.item.icon])},null,8,["name","class"])]),_:2},1040)])]),_:2},1032,["disabled","onClick","onKeydown"]),_i(Pp,Jf({ref_for:!0},b.ui.transition,{onEnter:b.onEnter,onAfterEnter:b.onAfterEnter,onBeforeLeave:b.onBeforeLeave,onLeave:b.onLeave}),{default:Mi(()=>[b.unmount?(nr(),Sa(ce,{key:0,class:ua([b.ui.item.base,b.ui.item.size,b.ui.item.color,b.ui.item.padding]),unmount:""},{default:Mi(()=>[dp(b.$slots,Ie.slot||"item",{item:Ie,index:De,open:ie,close:be},()=>[em(Ws(Ie.content),1)])]),_:2},1032,["class"])):Lm((nr(),Ni("div",{key:1,class:ua([b.ui.item.base,b.ui.item.size,b.ui.item.color,b.ui.item.padding])},[_i(ce,{static:""},{default:Mi(()=>[dp(b.$slots,Ie.slot||"item",{item:Ie,index:De,open:ie,close:be},()=>[em(Ws(Ie.content),1)])]),_:2},1024)],2)),[[ly,ie]])]),_:2},1040,["onEnter","onAfterEnter","onBeforeLeave","onLeave"])]),_:2},1032,["class","default-open"]))),128))],2)}
1const xy=km(_y,[["render",yy]]);function vy(b){return b&&b.__esModule&&Object.prototype.hasOwnProperty.call(b,"default")?b.default:b}var kp={exports:{}};/** 2* MapLibre GL JS 3* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v5.6.1/LICENSE.txt 4*/var by=kp.exports,im;function wy(){return im||(im=1,function(b,f){(function(x,C){b.exports=C()})(by,function(){var x={},C={};function E(T,o,fe){if(C[T]=fe,T==="index"){var ce="var sharedModule = {}; ("+C.shared+")(sharedModule); ("+C.worker+")(sharedModule);",Ae={};return C.shared(Ae),C.index(x,Ae),typeof window<"u"&&x.setWorkerUrl(window.URL.createObjectURL(new Blob([ce],{type:"text/javascript"}))),x}}E("shared",["exports"],function(T){function o(a,t,r,s){return new(r||(r=Promise))(function(c,p){function d(w){try{y(s.next(w))}catch(M){p(M)}}function g(w){try{y(s.throw(w))}catch(M){p(M)}}function y(w){var M;w.done?c(w.value):(M=w.value,M instanceof r?M:new r(function(A){A(M)})).then(d,g)}y((s=s.apply(a,t||[])).next())})}function fe(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var ce,Ae;function Ie(){if(Ae)return ce;function a(t,r){this.x=t,this.y=r}return Ae=1,ce=a,a.prototype={clone:function(){return new a(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,r){return this.clone()._rotateAround(t,r)},matMult:function(t){return this.clone()._matMult(t)},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(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var r=t.x-this.x,s=t.y-this.y;return r*r+s*s},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,r){return Math.atan2(this.x*r-this.y*t,this.x*t+this.y*r)},_matMult:function(t){var r=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var r=Math.cos(t),s=Math.sin(t),c=s*this.x+r*this.y;return this.x=r*this.x-s*this.y,this.y=c,this},_rotateAround:function(t,r){var s=Math.cos(t),c=Math.sin(t),p=r.y+c*(this.x-r.x)+s*(this.y-r.y);return this.x=r.x+s*(this.x-r.x)-c*(this.y-r.y),this.y=p,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},a.convert=function(t){return t instanceof a?t:Array.isArray(t)?new a(t[0],t[1]):t},ce}typeof SuppressedError=="function"&&SuppressedError;var De,ie,be=fe(Ie()),et=function(){if(ie)return De;function a(t,r,s,c){this.cx=3*t,this.bx=3*(s-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(c-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=r,this.p2x=s,this.p2y=c}return ie=1,De=a,a.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,r){if(r===void 0&&(r=1e-6),t<0)return 0;if(t>1)return 1;for(var s=t,c=0;c<8;c++){var p=this.sampleCurveX(s)-t;if(Math.abs(p)<r)return s;var d=this.sampleCurveDerivativeX(s);
4if(Math.abs(d)<1e-6)break;s-=p/d}var g=0,y=1;for(s=t,c=0;c<20&&(p=this.sampleCurveX(s),!(Math.abs(p-t)<r));c++)t>p?g=s:y=s,s=.5*(y-g)+g;return s},solve:function(t,r){return this.sampleCurveY(this.solveCurveX(t,r))}},De}(),ft=fe(et);let Nt,qt;function vr(){return Nt==null&&(Nt=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Nt}function Bt(){if(qt==null&&(qt=!1,vr())){const a=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(a){for(let r=0;r<5*5;r++){const s=4*r;a.fillStyle=`rgb(${s},${s+1},${s+2})`,a.fillRect(r%5,Math.floor(r/5),1,1)}const t=a.getImageData(0,0,5,5).data;for(let r=0;r<5*5*4;r++)if(r%4!=3&&t[r]!==r){qt=!0;break}}}return qt||!1}var Et=1e-6,zt=typeof Float32Array<"u"?Float32Array:Array;function fr(){var a=new zt(9);return zt!=Float32Array&&(a[1]=0,a[2]=0,a[3]=0,a[5]=0,a[6]=0,a[7]=0),a[0]=1,a[4]=1,a[8]=1,a}function ri(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a}function Je(){var a=new zt(3);return zt!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0),a}function ot(a){return Math.hypot(a[0],a[1],a[2])}function We(a,t,r){var s=new zt(3);return s[0]=a,s[1]=t,s[2]=r,s}function nt(a,t,r){return a[0]=t[0]+r[0],a[1]=t[1]+r[1],a[2]=t[2]+r[2],a}function Lt(a,t,r){return a[0]=t[0]*r,a[1]=t[1]*r,a[2]=t[2]*r,a}function ur(a,t,r){var s=t[0],c=t[1],p=t[2],d=r[0],g=r[1],y=r[2];return a[0]=c*y-p*g,a[1]=p*d-s*y,a[2]=s*g-c*d,a}Math.hypot||(Math.hypot=function(){for(var a=0,t=arguments.length;t--;)a+=arguments[t]*arguments[t];return Math.sqrt(a)});var mr,Ui=ot;function Ai(a,t,r){var s=t[0],c=t[1],p=t[2],d=t[3];return a[0]=r[0]*s+r[4]*c+r[8]*p+r[12]*d,a[1]=r[1]*s+r[5]*c+r[9]*p+r[13]*d,a[2]=r[2]*s+r[6]*c+r[10]*p+r[14]*d,a[3]=r[3]*s+r[7]*c+r[11]*p+r[15]*d,a}function $i(){var a=new zt(4);return zt!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0),a[3]=1,a}function Vi(a,t,r,s){var c=.5*Math.PI/180;t*=c,r*=c,s*=c;var p=Math.sin(t),d=Math.cos(t),g=Math.sin(r),y=Math.cos(r),w=Math.sin(s),M=Math.cos(s);return a[0]=p*y*M-d*g*w,a[1]=d*g*M+p*y*w,a[2]=d*y*w-p*g*M,a[3]=d*y*M+p*g*w,a}function Pi(){var a=new zt(2);return zt!=Float32Array&&(a[0]=0,a[1]=0),a}function br(a,t){var r=new zt(2);return r[0]=a,r[1]=t,r}Je(),mr=new zt(4),zt!=Float32Array&&(mr[0]=0,mr[1]=0,mr[2]=0,mr[3]=0),Je(),We(1,0,0),We(0,1,0),$i(),$i(),fr(),Pi();const Ct=8192;function Nr(a,t,r){return t*(Ct/(a.tileSize*Math.pow(2,r-a.tileID.overscaledZ)))}function Ur(a,t){return(a%t+t)%t}function ci(a,t,r){return a*(1-r)+t*r}function yi(a){if(a<=0)return 0;if(a>=1)return 1;const t=a*a,r=t*a;return 4*(a<.5?r:3*(a-t)+r-.75)}function ki(a,t,r,s){const c=new ft(a,t,r,s);return p=>c.solve(p)}const Qi=ki(.25,.1,.25,1);function Gt(a,t,r){return Math.min(r,Math.max(t,a))}function Zi(a,t,r){const s=r-t,c=((a-t)%s+s)%s+t;return c===t?r:c}function wr(a,...t){for(const r of t)for(const s in r)a[s]=r[s];return a}let Tr=1;function It(a,t,r){const s={};for(const c in a)s[c]=t.call(this,a[c],c,a);return s}function Sr(a,t,r){const s={};for(const c in a)t.call(this,a[c],c,a)&&(s[c]=a[c]);return s}function hr(a){return Array.isArray(a)?a.map(hr):typeof a=="object"&&a?It(a,hr):a}const Ei={};function rr(a){Ei[a]||(typeof console<"u"&&console.warn(a),Ei[a]=!0)}function Cr(a,t,r){return(r.y-a.y)*(t.x-a.x)>(t.y-a.y)*(r.x-a.x)}function Pr(a){return typeof WorkerGlobalScope<"u"&&a!==void 0&&a instanceof WorkerGlobalScope}let $r=null;function ui(a){return typeof ImageBitmap<"u"&&a instanceof ImageBitmap}const qi="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function ea(a,t,r,s,c){return o(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const p=new VideoFrame(a,{timestamp:0});try{const d=p==null?void 0:p.format;if(!d||!d.startsWith("BGR")&&!d.startsWith("RGB"))throw new Error(`Unrecognized format ${d}`);const g=d.startsWith("BGR"),y=new Uint8ClampedArray(s*c*4);if(yield p.copyTo(y,function(w,M,A,z,R){const B=4*Math.max(-M,0),j=(Math.max(0,A)-A)*z*4+B,V=4*z,W=Math.max(0,M),oe=Math.max(0,A);return{rect:{x:W,y:oe,width:Math.min(w.width,M+z)-W,height:Math.min(w.height,A+R)-oe},layout:[{offset:j,stride:V}]}}(a,t,r,s,c)),g)for(let w=0;w<y.length;w+=4){const M=y[w];y[w]=y[w+2],y[w+2]=M}return y}finally{p.close()}})}let zi,ta;function Di(a,t,r,s){return a.addEventListener(t,r,s),{unsubscribe:()=>{a.removeEventListener(t,r,s)}}}function Kr(a){return a*Math.PI/180}function $t(a){return a/Math.PI*180}const Ma={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0}
4,Ha={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},Li="AbortError";function he(){return new Error(Li)}const N={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function U(a){return N.REGISTERED_PROTOCOLS[a.substring(0,a.indexOf("://"))]}const Z="global-dispatcher";class J extends Error{constructor(t,r,s,c){super(`AJAXError: ${r} (${t}): ${s}`),this.status=t,this.statusText=r,this.url=s,this.body=c}}const ne=()=>Pr(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,pe=function(a,t){if(/:\/\//.test(a.url)&&!/^https?:|^file:/.test(a.url)){const s=U(a.url);if(s)return s(a,t);if(Pr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:a,targetMapId:Z},t)}if(!(/^file:/.test(r=a.url)||/^file:/.test(ne())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(s,c){return o(this,void 0,void 0,function*(){const p=new Request(s.url,{method:s.method||"GET",body:s.body,credentials:s.credentials,headers:s.headers,cache:s.cache,referrer:ne(),signal:c.signal});let d,g;s.type!=="json"||p.headers.has("Accept")||p.headers.set("Accept","application/json");try{d=yield fetch(p)}catch(w){throw new J(0,w.message,s.url,new Blob)}if(!d.ok){const w=yield d.blob();throw new J(d.status,d.statusText,s.url,w)}g=s.type==="arrayBuffer"||s.type==="image"?d.arrayBuffer():s.type==="json"?d.json():d.text();const y=yield g;if(c.signal.aborted)throw he();return{data:y,cacheControl:d.headers.get("Cache-Control"),expires:d.headers.get("Expires")}})}(a,t);if(Pr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:a,mustQueue:!0,targetMapId:Z},t)}var r;return function(s,c){return new Promise((p,d)=>{var g;const y=new XMLHttpRequest;y.open(s.method||"GET",s.url,!0),s.type!=="arrayBuffer"&&s.type!=="image"||(y.responseType="arraybuffer");for(const w in s.headers)y.setRequestHeader(w,s.headers[w]);s.type==="json"&&(y.responseType="text",!((g=s.headers)===null||g===void 0)&&g.Accept||y.setRequestHeader("Accept","application/json")),y.withCredentials=s.credentials==="include",y.onerror=()=>{d(new Error(y.statusText))},y.onload=()=>{if(!c.signal.aborted)if((y.status>=200&&y.status<300||y.status===0)&&y.response!==null){let w=y.response;if(s.type==="json")try{w=JSON.parse(y.response)}catch(M){return void d(M)}p({data:w,cacheControl:y.getResponseHeader("Cache-Control"),expires:y.getResponseHeader("Expires")})}else{const w=new Blob([y.response],{type:y.getResponseHeader("Content-Type")});d(new J(y.status,y.statusText,s.url,w))}},c.signal.addEventListener("abort",()=>{y.abort(),d(he())}),y.send(s.body)})}(a,t)};function ye(a){if(!a||a.indexOf("://")<=0||a.indexOf("data:image/")===0||a.indexOf("blob:")===0)return!0;const t=new URL(a),r=window.location;return t.protocol===r.protocol&&t.host===r.host}function ue(a,t,r){r[a]&&r[a].indexOf(t)!==-1||(r[a]=r[a]||[],r[a].push(t))}function Ce(a,t,r){if(r&&r[a]){const s=r[a].indexOf(t);s!==-1&&r[a].splice(s,1)}}class Te{constructor(t,r={}){wr(this,r),this.type=t}}class de extends Te{constructor(t,r={}){super("error",wr({error:t},r))}}class Pe{on(t,r){return this._listeners=this._listeners||{},ue(t,r,this._listeners),{unsubscribe:()=>{this.off(t,r)}}}off(t,r){return Ce(t,r,this._listeners),Ce(t,r,this._oneTimeListeners),this}once(t,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},ue(t,r,this._oneTimeListeners),this):new Promise(s=>this.once(t,s))}fire(t,r){typeof t=="string"&&(t=new Te(t,r||{}));const s=t.type;if(this.listens(s)){t.target=this;const c=this._listeners&&this._listeners[s]?this._listeners[s].slice():[];for(const g of c)g.call(this,t);const p=this._oneTimeListeners&&this._oneTimeListeners[s]?this._oneTimeListeners[s].slice():[];for(const g of p)Ce(s,g,this._oneTimeListeners),g.call(this,t);const d=this._eventedParent;d&&(wr(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),d.fire(t))}else t instanceof de&&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 se={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"}
vendor: 17,180 bytes, line 4
4,bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},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:{},"color-relief":{},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_color-relief","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"}},"layout_color-relief":{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:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief
vendor: 12,079 bytes, line 4
4","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
4Array",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,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:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",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"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"}},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 Ne=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function rt(a,t){const r={};for(const s in a)s!=="ref"&&(r[s]=a[s]);return Ne.forEach(s=>{s in t&&(r[s]=t[s])}),r}function Ve(a,t){if(Array.isArray(a)){if(!Array.isArray(t)||a.length!==t.length)return!1;for(let r=0;r<a.length;r++)if(!Ve(a[r],t[r]))return!1;return!0}if(typeof a=="object"&&a!==null&&t!==null){if(typeof t!="object"||Object.keys(a).length!==Object.keys(t).length)return!1;for(const r in a)if(!Ve(a[r],t[r]))return!1;return!0}return a===t}function Ye(a,t){a.push(t)}function st(a,t,r){Ye(r,{command:"addSource",args:[a,t[a]]})}function Ut(a,t,r){Ye(t,{command:"removeSource",args:[a]}),r[a]=!0}function Dt(a,t,r,s){Ut(a,r,s),st(a,t,r)}function At(a,t,r){let s;for(s in a[r])if(Object.prototype.hasOwnProperty.call(a[r],s)&&s!=="data"&&!Ve(a[r][s],t[r][s]))return!1;for(s in t[r])if(Object.prototype.hasOwnProperty.call(t[r],s)&&s!=="data"&&!Ve(a[r][s],t[r][s]))return!1;return!0}function it(a,t,r,s,c,p){a=a||{},t=t||{};for(const d in a)Object.prototype.hasOwnProperty.call(a,d)&&(Ve(a[d],t[d])||r.push({command:p,args:[s,d,t[d],c]}));for(const d in t)Object.prototype.hasOwnProperty.call(t,d)&&!Object.prototype.hasOwnProperty.call(a,d)&&(Ve(a[d],t[d])||r.push({command:p,args:[s,d,t[d],c]}))}function wt(a){return a.id}function kr(a,t){return a[t.id]=t,a}class Fe{constructor(t,r,s,c){this.message=(t?`${t}: `:"")+s,c&&(this.identifier=c),r!=null&&r.__line__&&(this.line=r.__line__)}}function Vr(a,...t){for(const r of t)for(const s in r)a[s]=r[s];return a}
4class Xt extends Error{constructor(t,r){super(r),this.message=r,this.key=t}}class Ia{constructor(t,r=[]){this.parent=t,this.bindings={};for(const[s,c]of r)this.bindings[s]=c}concat(t){return new Ia(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 Wa={kind:"null"},je={kind:"number"},ht={kind:"string"},pt={kind:"boolean"},xi={kind:"color"},Kn={kind:"projectionDefinition"},ra={kind:"object"},dt={kind:"value"},da={kind:"collator"},Xa={kind:"formatted"},pr={kind:"padding"},Ks={kind:"colorArray"},Js={kind:"numberArray"},fa={kind:"resolvedImage"},Qs={kind:"variableAnchorOffsetCollection"};function vi(a,t){return{kind:"array",itemType:a,N:t}}function Yt(a){if(a.kind==="array"){const t=Yt(a.itemType);return typeof a.N=="number"?`array<${t}, ${a.N}>`:a.itemType.kind==="value"?"array":`array<${t}>`}return a.kind}const bc=[Wa,je,ht,pt,xi,Kn,Xa,ra,vi(dt),pr,Js,Ks,fa,Qs];function en(a,t){if(t.kind==="error")return null;if(a.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!en(a.itemType,t.itemType))&&(typeof a.N!="number"||a.N===t.N))return null}else{if(a.kind===t.kind)return null;if(a.kind==="value"){for(const r of bc)if(!en(r,t))return null}}return`Expected ${Yt(a)} but found ${Yt(t)} instead.`}function Jn(a,t){return t.some(r=>r.kind===a.kind)}function Ya(a,t){return t.some(r=>r==="null"?a===null:r==="array"?Array.isArray(a):r==="object"?a&&!Array.isArray(a)&&typeof a=="object":r===typeof a)}function Aa(a,t){return a.kind==="array"&&t.kind==="array"?a.itemType.kind===t.itemType.kind&&typeof a.N=="number":a.kind===t.kind}const wc=.96422,Tc=.82521,Sc=4/29,ms=6/29,Cc=3*ms*ms,Mc=ms*ms*ms,tn=Math.PI/180,Yu=180/Math.PI;function Ic(a){return(a%=360)<0&&(a+=360),a}function gs([a,t,r,s]){let c,p;const d=il((.2225045*(a=rl(a))+.7168786*(t=rl(t))+.0606169*(r=rl(r)))/1);a===t&&t===r?c=p=d:(c=il((.4360747*a+.3850649*t+.1430804*r)/wc),p=il((.0139322*a+.0971045*t+.7141733*r)/Tc));const g=116*d-16;return[g<0?0:g,500*(c-d),200*(d-p),s]}function rl(a){return a<=.04045?a/12.92:Math.pow((a+.055)/1.055,2.4)}function il(a){return a>Mc?Math.pow(a,1/3):a/Cc+Sc}function Ac([a,t,r,s]){let c=(a+16)/116,p=isNaN(t)?c:c+t/500,d=isNaN(r)?c:c-r/200;return c=1*eo(c),p=wc*eo(p),d=Tc*eo(d),[Qn(3.1338561*p-1.6168667*c-.4906146*d),Qn(-.9787684*p+1.9161415*c+.033454*d),Qn(.0719453*p-.2289914*c+1.4052427*d),s]}function Qn(a){return(a=a<=.00304?12.92*a:1.055*Math.pow(a,1/2.4)-.055)<0?0:a>1?1:a}function eo(a){return a>ms?a*a*a:Cc*(a-Sc)}const ia=Object.hasOwn||function(a,t){return Object.prototype.hasOwnProperty.call(a,t)};function mt(a,t){return ia(a,t)?a[t]:void 0}function ma(a){return parseInt(a.padEnd(2,a),16)/255}function ga(a,t){return Ka(t?a/100:a,0,1)}function Ka(a,t,r){return Math.min(Math.max(t,a),r)}function al(a){return!a.some(Number.isNaN)}const sl={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
4ive:[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]};function Ri(a,t,r){return a+r*(t-a)}function _a(a,t,r){return a.map((s,c)=>Ri(s,t[c],r))}class gt{constructor(t,r,s,c=1,p=!0){this.r=t,this.g=r,this.b=s,this.a=c,p||(this.r*=c,this.g*=c,this.b*=c,c||this.overwriteGetter("rgb",[t,r,s,c]))}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 c=mt(sl,s);if(c){const[d,g,y]=c;return[d/255,g/255,y/255,1]}if(s.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(s)){const d=s.length<6?1:2;let g=1;return[ma(s.slice(g,g+=d)),ma(s.slice(g,g+=d)),ma(s.slice(g,g+=d)),ma(s.slice(g,g+d)||"ff")]}if(s.startsWith("rgb")){const d=s.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){const[g,y,w,M,A,z,R,B,j,V,W,oe]=d,Q=[M||" ",R||" ",V].join("");if(Q===" "||Q===" /"||Q===",,"||Q===",,,"){const L=[w,z,j].join(""),$=L==="%%%"?100:L===""?255:0;if($){const te=[Ka(+y/$,0,1),Ka(+A/$,0,1),Ka(+B/$,0,1),W?ga(+W,oe):1];if(al(te))return te}}return}}const p=s.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(p){const[d,g,y,w,M,A,z,R,B]=p,j=[y||" ",M||" ",z].join("");if(j===" "||j===" /"||j===",,"||j===",,,"){const V=[+g,Ka(+w,0,100),Ka(+A,0,100),R?ga(+R,B):1];if(al(V))return function([W,oe,Q,L]){function $(te){const _e=(te+W/30)%12,ze=oe*Math.min(Q,1-Q);return Q-ze*Math.max(-1,Math.min(_e-3,9-_e,1))}return W=Ic(W),oe/=100,Q/=100,[$(0),$(8),$(4),L]}(V)}}}(t);return r?new gt(...r,!1):void 0}get rgb(){const{r:t,g:r,b:s,a:c}=this,p=c||1/0;
4return this.overwriteGetter("rgb",[t/p,r/p,s/p,c])}get hcl(){return this.overwriteGetter("hcl",function(t){const[r,s,c,p]=gs(t),d=Math.sqrt(s*s+c*c);return[Math.round(1e4*d)?Ic(Math.atan2(c,s)*Yu):NaN,d,r,p]}(this.rgb))}get lab(){return this.overwriteGetter("lab",gs(this.rgb))}overwriteGetter(t,r){return Object.defineProperty(this,t,{value:r}),r}toString(){const[t,r,s,c]=this.rgb;return`rgba(${[t,r,s].map(p=>Math.round(255*p)).join(",")},${c})`}static interpolate(t,r,s,c="rgb"){switch(c){case"rgb":{const[p,d,g,y]=_a(t.rgb,r.rgb,s);return new gt(p,d,g,y,!1)}case"hcl":{const[p,d,g,y]=t.hcl,[w,M,A,z]=r.hcl;let R,B;if(isNaN(p)||isNaN(w))isNaN(p)?isNaN(w)?R=NaN:(R=w,g!==1&&g!==0||(B=M)):(R=p,A!==1&&A!==0||(B=d));else{let Q=w-p;w>p&&Q>180?Q-=360:w<p&&p-w>180&&(Q+=360),R=p+s*Q}const[j,V,W,oe]=function([Q,L,$,te]){return Q=isNaN(Q)?0:Q*tn,Ac([$,Math.cos(Q)*L,Math.sin(Q)*L,te])}([R,B??Ri(d,M,s),Ri(g,A,s),Ri(y,z,s)]);return new gt(j,V,W,oe,!1)}case"lab":{const[p,d,g,y]=Ac(_a(t.lab,r.lab,s));return new gt(p,d,g,y,!1)}}}}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 rn{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}}const to=["bottom","center","top"];class nl{constructor(t,r,s,c,p,d){this.text=t,this.image=r,this.scale=s,this.fontStack=c,this.textColor=p,this.verticalAlign=d}}class Jr{constructor(t){this.sections=t}static fromString(t){return new Jr([new nl(t,null,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 Jr?t:Jr.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}}class gr{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof gr)return t;if(typeof t=="number")return new gr([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 gr(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,s){return new gr(_a(t.values,r.values,s))}}class Qr{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Qr)return t;if(typeof t=="number")return new Qr([t]);if(Array.isArray(t)){for(const r of t)if(typeof r!="number")return;return new Qr(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,s){return new Qr(_a(t.values,r.values,s))}}class Er{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Er)return t;if(typeof t=="string"){const s=gt.parse(t);return s?new Er([s]):void 0}if(!Array.isArray(t))return;const r=[];for(const s of t){if(typeof s!="string")return;const c=gt.parse(s);if(!c)return;r.push(c)}return new Er(r)}toString(){return JSON.stringify(this.values)}static interpolate(t,r,s,c="rgb"){const p=[];if(t.values.length!=r.values.length)throw new Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${r.values.length}), cannot interpolate.`);for(let d=0;d<t.values.length;d++)p.push(gt.interpolate(t.values[d],r.values[d],s,c));return new Er(p)}}class Kt extends Error{constructor(t){super(t),this.name="RuntimeError"}toJSON(){return this.message}}const ro=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Tt{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Tt)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],c=t[r+1];if(typeof s!="string"||!ro.has(s)||!Array.isArray(c)||c.length!==2||typeof c[0]!="number"||typeof c[1]!="number")return}return new Tt(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,s){const c=t.values,p=r.values;if(c.length!==p.length)throw new Kt(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${r.toString()}`);const d=[];for(let g=0;g<c.length;g+=2){if(c[g]!==p[g])throw new Kt(`Cannot interpolate values containing mismatched anchors. from[${g}]: ${c[g]}, to[${g}]: ${p[g]}`);d.push(c[g]);const[y,w]=c[g+1],[M,A]=p[g+1];d.push([Ri(y,M,s),Ri(w,A,s)])}return new Tt(d)}}class hi{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}
4static fromString(t){return t?new hi({name:t,available:!1}):null}}class lt{constructor(t,r,s){this.from=t,this.to=r,this.transition=s}static interpolate(t,r,s){return new lt(t,r,s)}static parse(t){return t instanceof lt?t:Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number"?new lt(t[0],t[1],t[2]):typeof t=="object"&&typeof t.from=="string"&&typeof t.to=="string"&&typeof t.transition=="number"?new lt(t.from,t.to,t.transition):typeof t=="string"?new lt(t,t,1):void 0}}function ct(a,t,r,s){return typeof a=="number"&&a>=0&&a<=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 [${[a,t,r,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[a,t,r,s]:[a,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ja(a){if(a===null||typeof a=="string"||typeof a=="boolean"||typeof a=="number"||a instanceof lt||a instanceof gt||a instanceof rn||a instanceof Jr||a instanceof gr||a instanceof Qr||a instanceof Er||a instanceof Tt||a instanceof hi)return!0;if(Array.isArray(a)){for(const t of a)if(!Ja(t))return!1;return!0}if(typeof a=="object"){for(const t in a)if(!Ja(a[t]))return!1;return!0}return!1}function at(a){if(a===null)return Wa;if(typeof a=="string")return ht;if(typeof a=="boolean")return pt;if(typeof a=="number")return je;if(a instanceof gt)return xi;if(a instanceof lt)return Kn;if(a instanceof rn)return da;if(a instanceof Jr)return Xa;if(a instanceof gr)return pr;if(a instanceof Qr)return Js;if(a instanceof Er)return Ks;if(a instanceof Tt)return Qs;if(a instanceof hi)return fa;if(Array.isArray(a)){const t=a.length;let r;for(const s of a){const c=at(s);if(r){if(r===c)continue;r=dt;break}r=c}return vi(r||dt,t)}return ra}function Qa(a){const t=typeof a;return a===null?"":t==="string"||t==="number"||t==="boolean"?String(a):a instanceof gt||a instanceof lt||a instanceof Jr||a instanceof gr||a instanceof Qr||a instanceof Er||a instanceof Tt||a instanceof hi?a.toString():JSON.stringify(a)}class ii{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(!Ja(t[1]))return r.error("invalid value");const s=t[1];let c=at(s);const p=r.expectedType;return c.kind!=="array"||c.N!==0||!p||p.kind!=="array"||typeof p.N=="number"&&p.N!==0||(c=p),new ii(c,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const _s={string:ht,number:je,boolean:pt,object:ra};class pi{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,c=1;const p=t[0];if(p==="array"){let g,y;if(t.length>2){const w=t[1];if(typeof w!="string"||!(w in _s)||w==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);g=_s[w],c++}else g=dt;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);y=t[2],c++}s=vi(g,y)}else{if(!_s[p])throw new Error(`Types doesn't contain name = ${p}`);s=_s[p]}const d=[];for(;c<t.length;c++){const g=r.parse(t[c],c,dt);if(!g)return null;d.push(g)}return new pi(s,d)}evaluate(t){for(let r=0;r<this.args.length;r++){const s=this.args[r].evaluate(t);if(!en(this.type,at(s)))return s;if(r===this.args.length-1)throw new Kt(`Expected value to be of type ${Yt(this.type)}, but found ${Yt(at(s))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const ol={"to-boolean":pt,"to-color":xi,"to-number":je,"to-string":ht};class aa{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(!ol[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 c=ol[s],p=[];for(let d=1;d<t.length;d++){const g=r.parse(t[d],d,dt);if(!g)return null;p.push(g)}return new aa(c,p)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let r,s;for(const c of this.args){if(r=c.evaluate(t),s=null,r instanceof gt)return r;if(typeof r=="string"){const p=t.parseColor(r);if(p)return p}else if(Array.isArray(r)&&(s=r.length<3||r.length>4?`Invalid rgba value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:ct(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 Kt(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 c=gr.parse(r);if(c)return c}throw new Kt(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"numberArray":{let r;for(const s of this.args){r=s.evaluate(t);const c=Qr.parse(r);if(c)return c}throw new Kt(`Could not parse numberArray from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"colorArray":{let r;for(const s of this.args){r=s.evaluate(t);const c=Er.parse(r);if(c)return c}throw new Kt(`Could not parse colorArray from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(const s of this.args){r=s.evaluate(t);const c=Tt.parse(r);if(c)return c}throw new Kt(`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 c=Number(r);
4if(!isNaN(c))return c}throw new Kt(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return Jr.fromString(Qa(this.args[0].evaluate(t)));case"resolvedImage":return hi.fromString(Qa(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return Qa(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const Pc=["Unknown","Point","LineString","Polygon"];class kc{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,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"?Pc[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.get(t);return r||(r=gt.parse(t),this._parseColorCache.set(t,r)),r}}class an{constructor(t,r,s=[],c,p=new Ia,d=[]){this.registry=t,this.path=s,this.key=s.map(g=>`[${g}]`).join(""),this.scope=p,this.errors=d,this.expectedType=c,this._isConstant=r}parse(t,r,s,c,p={}){return r?this.concat(r,s,c)._parse(t,p):this._parse(t,p)}_parse(t,r){function s(c,p,d){return d==="assert"?new pi(p,[c]):d==="coerce"?new aa(p,[c]):c}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 c=t[0];if(typeof c!="string")return this.error(`Expression name must be a string, but found ${typeof c} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const p=this.registry[c];if(p){let d=p.parse(t,this);if(!d)return null;if(this.expectedType){const g=this.expectedType,y=d.type;if(g.kind!=="string"&&g.kind!=="number"&&g.kind!=="boolean"&&g.kind!=="object"&&g.kind!=="array"||y.kind!=="value"){if(g.kind==="projectionDefinition"&&["string","array"].includes(y.kind)||["color","formatted","resolvedImage"].includes(g.kind)&&["value","string"].includes(y.kind)||["padding","numberArray"].includes(g.kind)&&["value","number","array"].includes(y.kind)||g.kind==="colorArray"&&["value","string","array"].includes(y.kind)||g.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(y.kind))d=s(d,g,r.typeAnnotation||"coerce");else if(this.checkSubtype(g,y))return null}else d=s(d,g,r.typeAnnotation||"assert")}if(!(d instanceof ii)&&d.type.kind!=="resolvedImage"&&this._isConstant(d)){const g=new kc;try{d=new ii(d.type,d.evaluate(g))}catch(y){return this.error(y.message),null}}return d}return this.error(`Unknown expression "${c}". 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 c=typeof t=="number"?this.path.concat(t):this.path,p=s?this.scope.concat(s):this.scope;return new an(this.registry,this._isConstant,c,r||null,p,this.errors)}error(t,...r){const s=`${this.key}${r.map(c=>`[${c}]`).join("")}`;this.errors.push(new Xt(s,t))}checkSubtype(t,r){const s=en(t,r);return s&&this.error(s),s}}class sn{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 p=1;p<t.length-1;p+=2){const d=t[p];if(typeof d!="string")return r.error(`Expected string, but found ${typeof d} instead.`,p);if(/[^a-zA-Z0-9_]/.test(d))return r.error("Variable names must contain only alphanumeric characters or '_'.",p);const g=r.parse(t[p+1],p+1);if(!g)return null;s.push([d,g])}const c=r.parse(t[t.length-1],t.length-1,r.expectedType,s);return c?new sn(s,c):null}outputDefined(){return this.result.outputDefined()}}class Gi{constructor(t,r){this.type=r.type,this.name=t,this.boundExpression=r}
4static 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 Gi(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 zr{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,je),c=r.parse(t[2],2,vi(r.expectedType||dt));return s&&c?new zr(c.type.itemType,s,c):null}evaluate(t){const r=this.index.evaluate(t),s=this.input.evaluate(t);if(r<0)throw new Kt(`Array index out of bounds: ${r} < 0.`);if(r>=s.length)throw new Kt(`Array index out of bounds: ${r} > ${s.length-1}.`);if(r!==Math.floor(r))throw new Kt(`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 ys{constructor(t,r){this.type=pt,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,dt),c=r.parse(t[2],2,dt);return s&&c?Jn(s.type,[pt,ht,je,Wa,dt])?new ys(s,c):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Yt(s.type)} instead`):null}evaluate(t){const r=this.needle.evaluate(t),s=this.haystack.evaluate(t);if(!s)return!1;if(!Ya(r,["boolean","string","number","null"]))throw new Kt(`Expected first argument to be of type boolean, string, number or null, but found ${Yt(at(r))} instead.`);if(!Ya(s,["string","array"]))throw new Kt(`Expected second argument to be of type array or string, but found ${Yt(at(s))} instead.`);return s.indexOf(r)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class nn{constructor(t,r,s){this.type=je,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,dt),c=r.parse(t[2],2,dt);if(!s||!c)return null;if(!Jn(s.type,[pt,ht,je,Wa,dt]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Yt(s.type)} instead`);if(t.length===4){const p=r.parse(t[3],3,je);return p?new nn(s,c,p):null}return new nn(s,c)}evaluate(t){const r=this.needle.evaluate(t),s=this.haystack.evaluate(t);if(!Ya(r,["boolean","string","number","null"]))throw new Kt(`Expected first argument to be of type boolean, string, number or null, but found ${Yt(at(r))} instead.`);let c;if(this.fromIndex&&(c=this.fromIndex.evaluate(t)),Ya(s,["string"])){const p=s.indexOf(r,c);return p===-1?-1:[...s.slice(0,p)].length}if(Ya(s,["array"]))return s.indexOf(r,c);throw new Kt(`Expected second argument to be of type array or string, but found ${Yt(at(s))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class xs{constructor(t,r,s,c,p,d){this.inputType=t,this.type=r,this.input=s,this.cases=c,this.outputs=p,this.otherwise=d}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,c;r.expectedType&&r.expectedType.kind!=="value"&&(c=r.expectedType);const p={},d=[];for(let w=2;w<t.length-1;w+=2){let M=t[w];const A=t[w+1];Array.isArray(M)||(M=[M]);const z=r.concat(w);if(M.length===0)return z.error("Expected at least one branch label.");for(const B of M){if(typeof B!="number"&&typeof B!="string")return z.error("Branch labels must be numbers or strings.");if(typeof B=="number"&&Math.abs(B)>Number.MAX_SAFE_INTEGER)return z.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof B=="number"&&Math.floor(B)!==B)return z.error("Numeric branch labels must be integer values.");if(s){if(z.checkSubtype(s,at(B)))return null}else s=at(B);if(p[String(B)]!==void 0)return z.error("Branch labels must be unique.");p[String(B)]=d.length}const R=r.parse(A,w,c);if(!R)return null;c=c||R.type,d.push(R)}const g=r.parse(t[1],1,dt);if(!g)return null;const y=r.parse(t[t.length-1],t.length-1,c);return y?g.type.kind!=="value"&&r.concat(1).checkSubtype(s,g.type)?null:new xs(s,c,g,p,d,y):null}evaluate(t){const r=this.input.evaluate(t);return(at(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(t)}
4eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}}class _r{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 c=[];for(let d=1;d<t.length-1;d+=2){const g=r.parse(t[d],d,pt);if(!g)return null;const y=r.parse(t[d+1],d+1,s);if(!y)return null;c.push([g,y]),s=s||y.type}const p=r.parse(t[t.length-1],t.length-1,s);if(!p)return null;if(!s)throw new Error("Can't infer output type");return new _r(s,c,p)}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 on{constructor(t,r,s,c){this.type=t,this.input=r,this.beginIndex=s,this.endIndex=c}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,dt),c=r.parse(t[2],2,je);if(!s||!c)return null;if(!Jn(s.type,[vi(dt),ht,dt]))return r.error(`Expected first argument to be of type array or string, but found ${Yt(s.type)} instead`);if(t.length===4){const p=r.parse(t[3],3,je);return p?new on(s.type,s,c,p):null}return new on(s.type,s,c)}evaluate(t){const r=this.input.evaluate(t),s=this.beginIndex.evaluate(t);let c;if(this.endIndex&&(c=this.endIndex.evaluate(t)),Ya(r,["string"]))return[...r].slice(s,c).join("");if(Ya(r,["array"]))return r.slice(s,c);throw new Kt(`Expected first argument to be of type array or string, but found ${Yt(at(r))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function vs(a,t){const r=a.length-1;let s,c,p=0,d=r,g=0;for(;p<=d;)if(g=Math.floor((p+d)/2),s=a[g],c=a[g+1],s<=t){if(g===r||t<c)return g;p=g+1}else{if(!(s>t))throw new Kt("Input is not a number.");d=g-1}return 0}class bs{constructor(t,r,s){this.type=t,this.input=r,this.labels=[],this.outputs=[];for(const[c,p]of s)this.labels.push(c),this.outputs.push(p)}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,je);if(!s)return null;const c=[];let p=null;r.expectedType&&r.expectedType.kind!=="value"&&(p=r.expectedType);for(let d=1;d<t.length;d+=2){const g=d===1?-1/0:t[d],y=t[d+1],w=d,M=d+1;if(typeof g!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',w);if(c.length&&c[c.length-1][0]>=g)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',w);const A=r.parse(y,M,p);if(!A)return null;p=p||A.type,c.push([g,A])}return new bs(p,s,c)}evaluate(t){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(t);const c=this.input.evaluate(t);if(c<=r[0])return s[0].evaluate(t);const p=r.length;return c>=r[p-1]?s[p-1].evaluate(t):s[vs(r,c)].evaluate(t)}eachChild(t){t(this.input);for(const r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function Ku(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var Pa,ln,ll=function(){if(ln)return Pa;function a(t,r,s,c){this.cx=3*t,this.bx=3*(s-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(c-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=r,this.p2x=s,this.p2y=c}return ln=1,Pa=a,a.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,r){if(r===void 0&&(r=1e-6),t<0)return 0;if(t>1)return 1;for(var s=t,c=0;c<8;c++){var p=this.sampleCurveX(s)-t;if(Math.abs(p)<r)return s;var d=this.sampleCurveDerivativeX(s);
4if(Math.abs(d)<1e-6)break;s-=p/d}var g=0,y=1;for(s=t,c=0;c<20&&(p=this.sampleCurveX(s),!(Math.abs(p-t)<r));c++)t>p?g=s:y=s,s=.5*(y-g)+g;return s},solve:function(t,r){return this.sampleCurveY(this.solveCurveX(t,r))}},Pa}(),Ju=Ku(ll);class ai{constructor(t,r,s,c,p){this.type=t,this.operator=r,this.interpolation=s,this.input=c,this.labels=[],this.outputs=[];for(const[d,g]of p)this.labels.push(d),this.outputs.push(g)}static interpolationFactor(t,r,s,c){let p=0;if(t.name==="exponential")p=ws(r,t.base,s,c);else if(t.name==="linear")p=ws(r,1,s,c);else if(t.name==="cubic-bezier"){const d=t.controlPoints;p=new Ju(d[0],d[1],d[2],d[3]).solve(ws(r,1,s,c))}return p}static parse(t,r){let[s,c,p,...d]=t;if(!Array.isArray(c)||c.length===0)return r.error("Expected an interpolation type expression.",1);if(c[0]==="linear")c={name:"linear"};else if(c[0]==="exponential"){const w=c[1];if(typeof w!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);c={name:"exponential",base:w}}else{if(c[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(c[0])}`,1,0);{const w=c.slice(1);if(w.length!==4||w.some(M=>typeof M!="number"||M<0||M>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);c={name:"cubic-bezier",controlPoints:w}}}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(p=r.parse(p,2,je),!p)return null;const g=[];let y=null;s!=="interpolate-hcl"&&s!=="interpolate-lab"||r.expectedType==Ks?r.expectedType&&r.expectedType.kind!=="value"&&(y=r.expectedType):y=xi;for(let w=0;w<d.length;w+=2){const M=d[w],A=d[w+1],z=w+3,R=w+4;if(typeof M!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',z);if(g.length&&g[g.length-1][0]>=M)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',z);const B=r.parse(A,R,y);if(!B)return null;y=y||B.type,g.push([M,B])}return Aa(y,je)||Aa(y,Kn)||Aa(y,xi)||Aa(y,pr)||Aa(y,Js)||Aa(y,Ks)||Aa(y,Qs)||Aa(y,vi(je))?new ai(y,s,c,p,g):r.error(`Type ${Yt(y)} is not interpolatable.`)}evaluate(t){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(t);const c=this.input.evaluate(t);if(c<=r[0])return s[0].evaluate(t);const p=r.length;if(c>=r[p-1])return s[p-1].evaluate(t);const d=vs(r,c),g=ai.interpolationFactor(this.interpolation,c,r[d],r[d+1]),y=s[d].evaluate(t),w=s[d+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Ri(y,w,g);case"color":return gt.interpolate(y,w,g);case"padding":return gr.interpolate(y,w,g);case"colorArray":return Er.interpolate(y,w,g);case"numberArray":return Qr.interpolate(y,w,g);case"variableAnchorOffsetCollection":return Tt.interpolate(y,w,g);case"array":return _a(y,w,g);case"projectionDefinition":return lt.interpolate(y,w,g)}case"interpolate-hcl":switch(this.type.kind){case"color":return gt.interpolate(y,w,g,"hcl");case"colorArray":return Er.interpolate(y,w,g,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return gt.interpolate(y,w,g,"lab");case"colorArray":return Er.interpolate(y,w,g,"lab")}}}eachChild(t){t(this.input);for(const r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function ws(a,t,r,s){const c=s-r,p=a-r;return c===0?0:t===1?p/c:(Math.pow(t,p)-1)/(Math.pow(t,c)-1)}const bi={color:gt.interpolate,number:Ri,padding:gr.interpolate,numberArray:Qr.interpolate,colorArray:Er.interpolate,variableAnchorOffsetCollection:Tt.interpolate,array:_a};class di{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=null;const c=r.expectedType;c&&c.kind!=="value"&&(s=c);const p=[];for(const g of t.slice(1)){const y=r.parse(g,1+p.length,s,void 0,{typeAnnotation:"omit"});if(!y)return null;s=s||y.type,p.push(y)}if(!s)throw new Error("No output type");const d=c&&p.some(g=>en(c,g.type));return new di(d?dt:s,p)}evaluate(t){let r,s=null,c=0;for(const p of this.args)if(c++,s=p.evaluate(t),s&&s instanceof hi&&!s.available&&(r||(r=s.name),s=null,c===this.args.length&&(s=r)),s!==null)break;return s}
4eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function cl(a,t){return a==="=="||a==="!="?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 cn(a,t,r,s){return s.compare(t,r)===0}function Ts(a,t,r){const s=a!=="=="&&a!=="!=";return class Fm{constructor(p,d,g){this.type=pt,this.lhs=p,this.rhs=d,this.collator=g,this.hasUntypedArgument=p.type.kind==="value"||d.type.kind==="value"}static parse(p,d){if(p.length!==3&&p.length!==4)return d.error("Expected two or three arguments.");const g=p[0];let y=d.parse(p[1],1,dt);if(!y)return null;if(!cl(g,y.type))return d.concat(1).error(`"${g}" comparisons are not supported for type '${Yt(y.type)}'.`);let w=d.parse(p[2],2,dt);if(!w)return null;if(!cl(g,w.type))return d.concat(2).error(`"${g}" comparisons are not supported for type '${Yt(w.type)}'.`);if(y.type.kind!==w.type.kind&&y.type.kind!=="value"&&w.type.kind!=="value")return d.error(`Cannot compare types '${Yt(y.type)}' and '${Yt(w.type)}'.`);s&&(y.type.kind==="value"&&w.type.kind!=="value"?y=new pi(w.type,[y]):y.type.kind!=="value"&&w.type.kind==="value"&&(w=new pi(y.type,[w])));let M=null;if(p.length===4){if(y.type.kind!=="string"&&w.type.kind!=="string"&&y.type.kind!=="value"&&w.type.kind!=="value")return d.error("Cannot use collator to compare non-string types.");if(M=d.parse(p[3],3,da),!M)return null}return new Fm(y,w,M)}evaluate(p){const d=this.lhs.evaluate(p),g=this.rhs.evaluate(p);if(s&&this.hasUntypedArgument){const y=at(d),w=at(g);if(y.kind!==w.kind||y.kind!=="string"&&y.kind!=="number")throw new Kt(`Expected arguments for "${a}" to be (string, string) or (number, number), but found (${y.kind}, ${w.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const y=at(d),w=at(g);if(y.kind!=="string"||w.kind!=="string")return t(p,d,g)}return this.collator?r(p,d,g,this.collator.evaluate(p)):t(p,d,g)}eachChild(p){p(this.lhs),p(this.rhs),this.collator&&p(this.collator)}outputDefined(){return!0}}}const ul=Ts("==",function(a,t,r){return t===r},cn),Qu=Ts("!=",function(a,t,r){return t!==r},function(a,t,r,s){return!cn(0,t,r,s)}),eh=Ts("<",function(a,t,r){return t<r},function(a,t,r,s){return s.compare(t,r)<0}),th=Ts(">",function(a,t,r){return t>r},function(a,t,r,s){return s.compare(t,r)>0}),rh=Ts("<=",function(a,t,r){return t<=r},function(a,t,r,s){return s.compare(t,r)<=0}),io=Ts(">=",function(a,t,r){return t>=r},function(a,t,r,s){return s.compare(t,r)>=0});class ao{constructor(t,r,s){this.type=da,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 c=r.parse(s["case-sensitive"]!==void 0&&s["case-sensitive"],1,pt);if(!c)return null;const p=r.parse(s["diacritic-sensitive"]!==void 0&&s["diacritic-sensitive"],1,pt);if(!p)return null;let d=null;return s.locale&&(d=r.parse(s.locale,1,ht),!d)?null:new ao(c,p,d)}evaluate(t){return new rn(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 so{constructor(t,r,s,c,p){this.type=ht,this.number=t,this.locale=r,this.currency=s,this.minFractionDigits=c,this.maxFractionDigits=p}static parse(t,r){if(t.length!==3)return r.error("Expected two arguments.");const s=r.parse(t[1],1,je);if(!s)return null;const c=t[2];if(typeof c!="object"||Array.isArray(c))return r.error("NumberFormat options argument must be an object.");let p=null;if(c.locale&&(p=r.parse(c.locale,1,ht),!p))return null;let d=null;if(c.currency&&(d=r.parse(c.currency,1,ht),!d))return null;let g=null;if(c["min-fraction-digits"]&&(g=r.parse(c["min-fraction-digits"],1,je),!g))return null;let y=null;return c["max-fraction-digits"]&&(y=r.parse(c["max-fraction-digits"],1,je),!y)?null:new so(s,p,d,g,y)}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 un{constructor(t){this.type=Xa,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 c=[];let p=!1;for(let d=1;d<=t.length-1;
4++d){const g=t[d];if(p&&typeof g=="object"&&!Array.isArray(g)){p=!1;let y=null;if(g["font-scale"]&&(y=r.parse(g["font-scale"],1,je),!y))return null;let w=null;if(g["text-font"]&&(w=r.parse(g["text-font"],1,vi(ht)),!w))return null;let M=null;if(g["text-color"]&&(M=r.parse(g["text-color"],1,xi),!M))return null;let A=null;if(g["vertical-align"]){if(typeof g["vertical-align"]=="string"&&!to.includes(g["vertical-align"]))return r.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${g["vertical-align"]}' instead.`);if(A=r.parse(g["vertical-align"],1,ht),!A)return null}const z=c[c.length-1];z.scale=y,z.font=w,z.textColor=M,z.verticalAlign=A}else{const y=r.parse(t[d],1,dt);if(!y)return null;const w=y.type.kind;if(w!=="string"&&w!=="value"&&w!=="null"&&w!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");p=!0,c.push({content:y,scale:null,font:null,textColor:null,verticalAlign:null})}}return new un(c)}evaluate(t){return new Jr(this.sections.map(r=>{const s=r.content.evaluate(t);return at(s)===fa?new nl("",s,null,null,null,r.verticalAlign?r.verticalAlign.evaluate(t):null):new nl(Qa(s),null,r.scale?r.scale.evaluate(t):null,r.font?r.font.evaluate(t).join(","):null,r.textColor?r.textColor.evaluate(t):null,r.verticalAlign?r.verticalAlign.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),r.verticalAlign&&t(r.verticalAlign)}outputDefined(){return!1}}class hl{constructor(t){this.type=fa,this.input=t}static parse(t,r){if(t.length!==2)return r.error("Expected two arguments.");const s=r.parse(t[1],1,ht);return s?new hl(s):r.error("No image name provided.")}evaluate(t){const r=this.input.evaluate(t),s=hi.fromString(r);return s&&t.availableImages&&(s.available=t.availableImages.indexOf(r)>-1),s}eachChild(t){t(this.input)}outputDefined(){return!1}}class no{constructor(t){this.type=je,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 ${Yt(s.type)} instead.`):new no(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 Kt(`Expected value to be of type string or array, but found ${Yt(at(r))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const sa=8192;function ih(a,t){const r=(180+a[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+a[1]*Math.PI/360)))/360,c=Math.pow(2,t.z);return[Math.round(r*c*sa),Math.round(s*c*sa)]}function pl(a,t){const r=Math.pow(2,t.z);return[(c=(a[0]/sa+t.x)/r,360*c-180),(s=(a[1]/sa+t.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90)];var s,c}function hn(a,t){a[0]=Math.min(a[0],t[0]),a[1]=Math.min(a[1],t[1]),a[2]=Math.max(a[2],t[0]),a[3]=Math.max(a[3],t[1])}function pn(a,t){return!(a[0]<=t[0]||a[2]>=t[2]||a[1]<=t[1]||a[3]>=t[3])}function Ec(a,t,r){const s=a[0]-t[0],c=a[1]-t[1],p=a[0]-r[0],d=a[1]-r[1];return s*d-p*c==0&&s*p<=0&&c*d<=0}function dn(a,t,r,s){return(c=[s[0]-r[0],s[1]-r[1]])[0]*(p=[t[0]-a[0],t[1]-a[1]])[1]-c[1]*p[0]!=0&&!(!oo(a,t,r,s)||!oo(r,s,a,t));var c,p}function zc(a,t,r){for(const s of r)for(let c=0;c<s.length-1;++c)if(dn(a,t,s[c],s[c+1]))return!0;return!1}function Ss(a,t,r=!1){let s=!1;for(const g of t)for(let y=0;y<g.length-1;y++){if(Ec(a,g[y],g[y+1]))return r;(p=g[y])[1]>(c=a)[1]!=(d=g[y+1])[1]>c[1]&&c[0]<(d[0]-p[0])*(c[1]-p[1])/(d[1]-p[1])+p[0]&&(s=!s)}var c,p,d;return s}function ah(a,t){for(const r of t)if(Ss(a,r))return!0;return!1}function Dc(a,t){for(const r of a)if(!Ss(r,t))return!1;for(let r=0;r<a.length-1;++r)if(zc(a[r],a[r+1],t))return!1;return!0}function sh(a,t){for(const r of t)if(Dc(a,r))return!0;return!1}function oo(a,t,r,s){const c=s[0]-r[0],p=s[1]-r[1],d=(a[0]-r[0])*p-c*(a[1]-r[1]),g=(t[0]-r[0])*p-c*(t[1]-r[1]);return d>0&&g<0||d<0&&g>0}function dl(a,t,r){const s=[];for(let c=0;c<a.length;c++){const p=[];for(let d=0;d<a[c].length;d++){const g=ih(a[c][d],r);hn(t,g),p.push(g)}s.push(p)}return s}function Lc(a,t,r){const s=[];for(let c=0;c<a.length;c++){const p=dl(a[c],t,r);s.push(p)}return s}function Rc(a,t,r,s){if(a[0]<r[0]||a[0]>r[2]){const c=.5*s;let p=a[0]-r[0]>c?-s:r[0]-a[0]>c?s:0;p===0&&(p=a[0]-r[2]>c?-s:r[2]-a[0]>c?s:0),a[0]+=p}hn(t,a)}function fl(a,t,r,s){const c=Math.pow(2,s.z)*sa,p=[s.x*sa,s.y*sa],d=[];for(const g of a)for(const y of g){const w=[y.x+p[0],y.y+p[1]];Rc(w,t,r,c),d.push(w)}return d}function ml(a,t,r,s){const c=Math.pow(2,s.z)*sa,p=[s.x*sa,s.y*sa],d=[];for(const y of a){const w=[];for(const M of y){const A=[M.x+p[0],M.y+p[1]];hn(t,A),w.push(A)}d.push(w)}if(t[2]-t[0]<=c/2){(g=t)[0]=g[1]=1/0,g[2]=g[3]=-1/0;for(const y of d)for(const w of y)Rc(w,t,r,c)}var g;return d}class es{constructor(t,r){this.type=pt,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(Ja(t[1])){const s=t[1];if(s.type==="FeatureCollection"){const c=[];for(const p of s.features){const{type:d,coordinates:g}=p.geometry;d==="Polygon"&&c.push(g),d==="MultiPolygon"&&c.push(...g)}if(c.length)return new es(s,{type:"MultiPolygon",coordinates:c})}else if(s.type==="Feature"){const c=s.geometry.type;if(c==="Polygon"||c==="MultiPolygon")return new es(s,s.geometry)}else if(s.type==="Polygon"||s.type==="MultiPolygon")return new es(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 c=[1/0,1/0,-1/0,-1/0],p=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(s.type==="Polygon"){const g=dl(s.coordinates,p,d),y=fl(r.geometry(),c,p,d);if(!pn(c,p))return!1;for(const w of y)if(!Ss(w,g))return!1}if(s.type==="MultiPolygon"){const g=Lc(s.coordinates,p,d),y=fl(r.geometry(),c,p,d);if(!pn(c,p))return!1;for(const w of y)if(!ah(w,g))return!1}return!0}(t,this.geometries);if(t.geometryType()==="LineString")return function(r,s){const c=[1/0,1/0,-1/0,-1/0],p=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(s.type==="Polygon"){const g=dl(s.coordinates,p,d),y=ml(r.geometry(),c,p,d);if(!pn(c,p))return!1;for(const w of y)if(!Dc(w,g))return!1}if(s.type==="MultiPolygon"){const g=Lc(s.coordinates,p,d),y=ml(r.geometry(),c,p,d);if(!pn(c,p))return!1;
4for(const w of y)if(!sh(w,g))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Fc=class{constructor(a=[],t=(r,s)=>r<s?-1:r>s?1:0){if(this.data=a,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(a){this.data.push(a),this._up(this.length++)}pop(){if(this.length===0)return;const a=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),a}peek(){return this.data[0]}_up(a){const{data:t,compare:r}=this,s=t[a];for(;a>0;){const c=a-1>>1,p=t[c];if(r(s,p)>=0)break;t[a]=p,a=c}t[a]=s}_down(a){const{data:t,compare:r}=this,s=this.length>>1,c=t[a];for(;a<s;){let p=1+(a<<1);const d=p+1;if(d<this.length&&r(t[d],t[p])<0&&(p=d),r(t[p],c)>=0)break;t[a]=t[p],a=p}t[a]=c}};function gl(a,t,r=0,s=a.length-1,c=nh){for(;s>r;){if(s-r>600){const y=s-r+1,w=t-r+1,M=Math.log(y),A=.5*Math.exp(2*M/3),z=.5*Math.sqrt(M*A*(y-A)/y)*(w-y/2<0?-1:1);gl(a,t,Math.max(r,Math.floor(t-w*A/y+z)),Math.min(s,Math.floor(t+(y-w)*A/y+z)),c)}const p=a[t];let d=r,g=s;for(Cs(a,r,t),c(a[s],p)>0&&Cs(a,r,s);d<g;){for(Cs(a,d,g),d++,g--;c(a[d],p)<0;)d++;for(;c(a[g],p)>0;)g--}c(a[r],p)===0?Cs(a,r,g):(g++,Cs(a,g,s)),g<=t&&(r=g+1),t<=g&&(s=g-1)}}function Cs(a,t,r){const s=a[t];a[t]=a[r],a[r]=s}function nh(a,t){return a<t?-1:a>t?1:0}function lo(a,t){if(a.length<=1)return[a];const r=[];let s,c;for(const p of a){const d=Bc(p);d!==0&&(p.area=Math.abs(d),c===void 0&&(c=d<0),c===d<0?(s&&r.push(s),s=[p]):s.push(p))}if(s&&r.push(s),t>1)for(let p=0;p<r.length;p++)r[p].length<=t||(gl(r[p],t,1,r[p].length-1,oh),r[p]=r[p].slice(0,t));return r}function oh(a,t){return t.area-a.area}function Bc(a){let t=0;for(let r,s,c=0,p=a.length,d=p-1;c<p;d=c++)r=a[c],s=a[d],t+=(s.x-r.x)*(r.y+s.y);return t}const Oc=1/298.257223563,jc=Oc*(2-Oc),Nc=Math.PI/180;class _l{constructor(t){const r=6378.137*Nc*1e3,s=Math.cos(t*Nc),c=1/(1-jc*(1-s*s)),p=Math.sqrt(c);this.kx=r*p*s,this.ky=r*p*c*(1-jc)}distance(t,r){const s=this.wrap(t[0]-r[0])*this.kx,c=(t[1]-r[1])*this.ky;return Math.sqrt(s*s+c*c)}pointOnLine(t,r){let s,c,p,d,g=1/0;for(let y=0;y<t.length-1;y++){let w=t[y][0],M=t[y][1],A=this.wrap(t[y+1][0]-w)*this.kx,z=(t[y+1][1]-M)*this.ky,R=0;A===0&&z===0||(R=(this.wrap(r[0]-w)*this.kx*A+(r[1]-M)*this.ky*z)/(A*A+z*z),R>1?(w=t[y+1][0],M=t[y+1][1]):R>0&&(w+=A/this.kx*R,M+=z/this.ky*R)),A=this.wrap(r[0]-w)*this.kx,z=(r[1]-M)*this.ky;const B=A*A+z*z;B<g&&(g=B,s=w,c=M,p=y,d=R)}return{point:[s,c],index:p,t:Math.max(0,Math.min(1,d))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}function Pt(a,t){return t[0]-a[0]}function co(a){return a[1]-a[0]+1}function ya(a,t){return a[1]>=a[0]&&a[1]<t}function yl(a,t){if(a[0]>a[1])return[null,null];const r=co(a);if(t){if(r===2)return[a,null];const c=Math.floor(r/2);return[[a[0],a[0]+c],[a[0]+c,a[1]]]}if(r===1)return[a,null];const s=Math.floor(r/2)-1;return[[a[0],a[0]+s],[a[0]+s+1,a[1]]]}function xl(a,t){if(!ya(t,a.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)hn(r,a[s]);return r}function vl(a){const t=[1/0,1/0,-1/0,-1/0];for(const r of a)for(const s of r)hn(t,s);return t}function Uc(a){return a[0]!==-1/0&&a[1]!==-1/0&&a[2]!==1/0&&a[3]!==1/0}function bl(a,t,r){if(!Uc(a)||!Uc(t))return NaN;let s=0,c=0;return a[2]<t[0]&&(s=t[0]-a[2]),a[0]>t[2]&&(s=a[0]-t[2]),a[1]>t[3]&&(c=a[1]-t[3]),a[3]<t[1]&&(c=t[1]-a[3]),r.distance([0,0],[s,c])}function ts(a,t,r){const s=r.pointOnLine(t,a);return r.distance(a,s.point)}function wl(a,t,r,s,c){const p=Math.min(ts(a,[r,s],c),ts(t,[r,s],c)),d=Math.min(ts(r,[a,t],c),ts(s,[a,t],c));return Math.min(p,d)}function lh(a,t,r,s,c){if(!ya(t,a.length)||!ya(s,r.length))return 1/0;let p=1/0;for(let d=t[0];d<t[1];++d){const g=a[d],y=a[d+1];for(let w=s[0];w<s[1];++w){const M=r[w],A=r[w+1];if(dn(g,y,M,A))return 0;p=Math.min(p,wl(g,y,M,A,c))}}return p}function ch(a,t,r,s,c){if(!ya(t,a.length)||!ya(s,r.length))return NaN;let p=1/0;for(let d=t[0];d<=t[1];++d)for(let g=s[0];g<=s[1];++g)if(p=Math.min(p,c.distance(a[d],r[g])),p===0)return p;return p}function uh(a,t,r){if(Ss(a,t,!0))return 0;let s=1/0;for(const c of t){const p=c[0],d=c[c.length-1];if(p!==d&&(s=Math.min(s,ts(a,[d,p],r)),s===0))return s;const g=r.pointOnLine(c,a);if(s=Math.min(s,r.distance(a,g.point)),s===0)return s}return s}function hh(a,t,r,s){if(!ya(t,a.length))return NaN;for(let p=t[0];p<=t[1];++p)if(Ss(a[p],r,!0))return 0;let c=1/0;for(let p=t[0];p<t[1];++p){const d=a[p],g=a[p+1];for(const y of r)for(let w=0,M=y.length,A=M-1;w<M;A=w++){const z=y[A],R=y[w];if(dn(d,g,z,R))return 0;c=Math.min(c,wl(d,g,z,R,s))}}return c}function $c(a,t){for(const r of a)for(const s of r)if(Ss(s,t,!0))return!0;return!1}function ph(a,t,r,s=1/0){const c=vl(a),p=vl(t);if(s!==1/0&&bl(c,p,r)>=s)return s;if(pn(c,p)){if($c(a,t))return 0}else if($c(t,a))return 0;let d=1/0;for(const g of a)for(let y=0,w=g.length,M=w-1;y<w;M=y++){const A=g[M],z=g[y];for(const R of t)for(let B=0,j=R.length,V=j-1;B<j;V=B++){const W=R[V],oe=R[B];if(dn(A,z,W,oe))return 0;d=Math.min(d,wl(A,z,W,oe,r))}}return d}function Vc(a,t,r,s,c,p){if(!p)return;const d=bl(xl(s,p),c,r);d<t&&a.push([d,p,[0,0]])}function uo(a,t,r,s,c,p,d){if(!p||!d)return;const g=bl(xl(s,p),xl(c,d),r);g<t&&a.push([g,p,d])}function ho(a,t,r,s,c=1/0){let p=Math.min(s.distance(a[0],r[0][0]),c);if(p===0)return p;const d=new Fc([[0,[0,a.length-1],[0,0]]],Pt),g=vl(r);for(;d.length>0;){const y=d.pop();if(y[0]>=p)continue;const w=y[1],M=t?50:100;if(co(w)<=M){if(!ya(w,a.length))return NaN;if(t){const A=hh(a,w,r,s);if(isNaN(A)||A===0)return A;p=Math.min(p,A)}else for(let A=w[0];A<=w[1];++A){const z=uh(a[A],r,s);if(p=Math.min(p,z),p===0)return 0}}else{const A=yl(w,t);Vc(d,p,s,a,g,A[0]),Vc(d,p,s,a,g,A[1])}}return p}function po(a,t,r,s,c,p=1/0){let d=Math.min(p,c.distance(a[0],r[0]));if(d===0)return d;const g=new Fc([[0,[0,a.length-1],[0,r.length-1]]],Pt);for(;g.length>0;){const y=g.pop();if(y[0]>=d)continue;const w=y[1],M=y[2],A=t?50:100,z=s?50:100;if(co(w)<=A&&co(M)<=z){if(!ya(w,a.length)&&ya(M,r.length))return NaN;let R;if(t&&s)R=lh(a,w,r,M,c),d=Math.min(d,R);else if(t&&!s){const B=a.slice(w[0],w[1]+1);for(let j=M[0];j<=M[1];++j)if(R=ts(r[j],B,c),d=Math.min(d,R),d===0)return d}else if(!t&&s){const B=r.slice(M[0],M[1]+1);for(let j=w[0];j<=w[1];++j)if(R=ts(a[j],B,c),d=Math.min(d,R),d===0)return d}else R=ch(a,w,r,M,c),d=Math.min(d,R)}else{const R=yl(w,t),B=yl(M,s);uo(g,d,c,a,r,R[0],B[0]),uo(g,d,c,a,r,R[0],B[1]),uo(g,d,c,a,r,R[1],B[0]),uo(g,d,c,a,r,R[1],B[1])}}return d}function Tl(a){return a.type==="MultiPolygon"?a.coordinates.map(t=>({type:"Polygon",coordinates:t})):a.type==="MultiLineString"?a.coordinates.map(t=>({type:"LineString",coordinates:t})):a.type==="MultiPoint"?a.coordinates.map(t=>({type:"Point",coordinates:t})):[a]}class rs{constructor(t,r){this.type=je,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(Ja(t[1])){const s=t[1];if(s.type==="FeatureCollection")return new rs(s,s.features.map(c=>Tl(c.geometry)).flat());if(s.type==="Feature")return new rs(s,Tl(s.geometry));if("type"in s&&"coordinates"in s)return new rs(s,Tl(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 c=r.geometry(),p=c.flat().map(y=>pl([y.x,y.y],r.canonical));if(c.length===0)return NaN;const d=new _l(p[0][1]);let g=1/0;for(const y of s){switch(y.type){case"Point":g=Math.min(g,po(p,!1,[y.coordinates],!1,d,g));break;case"LineString":g=Math.min(g,po(p,!1,y.coordinates,!0,d,g));break;case"Polygon":g=Math.min(g,ho(p,!1,y.coordinates,d,g))}if(g===0)return g}return g}(t,this.geometries);if(t.geometryType()==="LineString")return function(r,s){const c=r.geometry(),p=c.flat().map(y=>pl([y.x,y.y],r.canonical));if(c.length===0)return NaN;const d=new _l(p[0][1]);let g=1/0;for(const y of s){switch(y.type){case"Point":g=Math.min(g,po(p,!0,[y.coordinates],!1,d,g));break;case"LineString":g=Math.min(g,po(p,!0,y.coordinates,!0,d,g));break;case"Polygon":g=Math.min(g,ho(p,!0,y.coordinates,d,g))}if(g===0)return g}return g}(t,this.geometries);if(t.geometryType()==="Polygon")return function(r,s){const c=r.geometry();if(c.length===0||c[0].length===0)return NaN;const p=lo(c,0).map(y=>y.map(w=>w.map(M=>pl([M.x,M.y],r.canonical)))),d=new _l(p[0][0][0][1]);let g=1/0;for(const y of s)for(const w of p){switch(y.type){case"Point":g=Math.min(g,ho([y.coordinates],!1,w,d,g));break;case"LineString":g=Math.min(g,ho(y.coordinates,!0,w,d,g));break;case"Polygon":g=Math.min(g,ph(w,y.coordinates,d,g))}if(g===0)return g}return g}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class fn{constructor(t){this.type=dt,this.key=t}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);const s=t[1];return s==null?r.error("Global state property must be defined."):typeof s!="str
4ing"?r.error(`Global state property must be string, but found ${typeof t[1]} instead.`):new fn(s)}evaluate(t){var r;const s=(r=t.globals)===null||r===void 0?void 0:r.globalState;return s&&Object.keys(s).length!==0?mt(s,this.key):null}eachChild(){}outputDefined(){return!1}}const Ms={"==":ul,"!=":Qu,">":th,"<":eh,">=":io,"<=":rh,array:pi,at:zr,boolean:pi,case:_r,coalesce:di,collator:ao,format:un,image:hl,in:ys,"index-of":nn,interpolate:ai,"interpolate-hcl":ai,"interpolate-lab":ai,length:no,let:sn,literal:ii,match:xs,number:pi,"number-format":so,object:pi,slice:on,step:bs,string:pi,"to-boolean":aa,"to-color":aa,"to-number":aa,"to-string":aa,var:Gi,within:es,distance:rs,"global-state":fn};class Fi{constructor(t,r,s,c){this.name=t,this.type=r,this._evaluate=s,this.args=c}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,r){const s=t[0],c=Fi.definitions[s];if(!c)return r.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0);const p=Array.isArray(c)?c[0]:c.type,d=Array.isArray(c)?[[c[1],c[2]]]:c.overloads,g=d.filter(([w])=>!Array.isArray(w)||w.length===t.length-1);let y=null;for(const[w,M]of g){y=new an(r.registry,fo,r.path,null,r.scope);const A=[];let z=!1;for(let R=1;R<t.length;R++){const B=t[R],j=Array.isArray(w)?w[R-1]:w.type,V=y.parse(B,1+A.length,j);if(!V){z=!0;break}A.push(V)}if(!z)if(Array.isArray(w)&&w.length!==A.length)y.error(`Expected ${w.length} arguments, but found ${A.length} instead.`);else{for(let R=0;R<A.length;R++){const B=Array.isArray(w)?w[R]:w.type,j=A[R];y.concat(R+1).checkSubtype(B,j.type)}if(y.errors.length===0)return new Fi(s,p,M,A)}}if(g.length===1)r.errors.push(...y.errors);else{const w=(g.length?g:d).map(([A])=>{return z=A,Array.isArray(z)?`(${z.map(Yt).join(", ")})`:`(${Yt(z.type)}...)`;var z}).join(" | "),M=[];for(let A=1;A<t.length;A++){const z=r.parse(t[A],1+M.length);if(!z)return null;M.push(Yt(z.type))}r.error(`Expected arguments of type ${w}, but found (${M.join(", ")}) instead.`)}return null}static register(t,r){Fi.definitions=r;for(const s in r)t[s]=Fi}}function Zc(a,[t,r,s,c]){t=t.evaluate(a),r=r.evaluate(a),s=s.evaluate(a);const p=c?c.evaluate(a):1,d=ct(t,r,s,p);if(d)throw new Kt(d);return new gt(t/255,r/255,s/255,p,!1)}function qc(a,t){return a in t}function Sl(a,t){const r=t[a];return r===void 0?null:r}function is(a){return{type:a}}function fo(a){if(a instanceof Gi)return fo(a.boundExpression);if(a instanceof Fi&&a.name==="error"||a instanceof ao||a instanceof es||a instanceof rs||a instanceof fn)return!1;const t=a instanceof aa||a instanceof pi;let r=!0;return a.eachChild(s=>{r=t?r&&fo(s):r&&s instanceof ii}),!!r&&mo(a)&&Is(a,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function mo(a){if(a instanceof Fi&&(a.name==="get"&&a.args.length===1||a.name==="feature-state"||a.name==="has"&&a.args.length===1||a.name==="properties"||a.name==="geometry-type"||a.name==="id"||/^filter-/.test(a.name))||a instanceof es||a instanceof rs)return!1;let t=!0;return a.eachChild(r=>{t&&!mo(r)&&(t=!1)}),t}function mn(a){if(a instanceof Fi&&a.name==="feature-state")return!1;let t=!0;return a.eachChild(r=>{t&&!mn(r)&&(t=!1)}),t}function Is(a,t){if(a instanceof Fi&&t.indexOf(a.name)>=0)return!1;let r=!0;return a.eachChild(s=>{r&&!Is(s,t)&&(r=!1)}),r}function Gc(a){return{result:"success",value:a}}function As(a){return{result:"error",value:a}}function Ps(a){return a["property-type"]==="data-driven"||a["property-type"]==="cross-faded-data-driven"}function Cl(a){return!!a.expression&&a.expression.parameters.indexOf("zoom")>-1}function Ml(a){return!!a.expression&&a.expression.interpolated}function _t(a){return a instanceof Number?"number":a instanceof String?"string":a instanceof Boolean?"boolean":Array.isArray(a)?"array":a===null?"null":typeof a}function as(a){return typeof a=="object"&&a!==null&&!Array.isArray(a)&&at(a)===ra}function Hc(a){return a}function Wc(a,t){const r=a.stops&&typeof a.stops[0][0]=="object",s=r||!(r||a.property!==void 0),c=a.type||(Ml(t)?"exponential":"interval"),p=function(M){switch(M.type){case"color":return gt.parse;case"padding":return gr.parse;case"numberArray":return Qr.parse;case"colorArray":return Er.parse;default:return null}}(t);if(p&&((a=Vr({},a)).stops&&(a.stops=a.stops.map(M=>[M[0],p(M[1])])),a.default=p(a.default?a.default:t.default)),a.colorSpace&&(d=a.colorSpace)!=="rgb"&&d!=="hcl"&&d!=="lab")throw new Error(`Unknown color space: "${a.colorSpace}"`);var d;const g=function(M){switch(M){case"exponential":return Xc;case"interval":return fh;case"categorical":return dh;case"identity":return Yc;default:throw new Error(`Unknown function type "${M}"`)}}(c);let y,w;if(c==="categorical"){y=Object.create(null);for(const M of a.stops)y[M[0]]=M[1];w=typeof a.stops[0][0]}if(r){const M={},A=[];for(let B=0;B<a.stops.length;B++){const j=a.stops[B],V=j[0].zoom;M[V]===void 0&&(M[V]={zoom:V,type:a.type,property:a.property,default:a.default,stops:[]},A.push(V)),M[V].stops.push([j[0].value,j[1]])}const z=[];for(const B of A)z.push([M[B].zoom,Wc(M[B],t)]);const R={name:"linear"};return{kind:"composite",interpolationType:R,interpolationFactor:ai.interpolationFactor.bind(void 0,R),zoomStops:z.map(B=>B[0]),evaluate:({zoom:B},j)=>Xc({stops:z,base:a.base},t,B).evaluate(B,j)}}if(s){const M=c==="exponential"?{name:"exponential",base:a.base!==void 0?a.base:1}:null;return{kind:"camera",interpolationType:M,interpolationFactor:ai.interpolationFactor.bind(void 0,M),zoomStops:a.stops.map(A=>A[0]),evaluate:({zoom:A})=>g(a,t,A,y,w)}}return{kind:"source",evaluate(M,A){const z=A&&A.properties?A.properties[a.property]:void 0;return z===void 0?gn(a.default,t.default):g(a,t,z,y,w)}}}function gn(a,t,r){return a!==void 0?a:t!==void 0?t:r!==void 0?r:void 0}function dh(a,t,r,s,c){return gn(typeof r===c?s[r]:void 0,a.default,t.default)}function fh(a,t,r){if(_t(r)!=="number")return gn(a.default,t.default);const s=a.stops.length;if(s===1||r<=a.stops[0][0])return a.stops[0][1];if(r>=a.stops[s-1][0])return a.stops[s-1][1];const c=vs(a.stops.map(p=>p[0]),r);return a.stops[c][1]}function Xc(a,t,r){const s=a.base!==void 0?a.base:1;if(_t(r)!=="number")return gn(a.default,t.default);const c=a.stops.length;if(c===1||r<=a.stops[0][0])return a.stops[0][1];if(r>=a.stops[c-1][0])return a.stops[c-1][1];const p=vs(a.stops.map(M=>M[0]),r),d=function(M,A,z,R){const B=R-z,j=M-z;return B===0?0:A===1?j/B:(Math.pow(A,j)-1)/(Math.pow(A,B)-1)}(r,s,a.stops[p][0],a.stops[p+1][0]),g=a.stops[p][1],y=a.stops[p+1][1],w=bi[t.type]||Hc;return typeof g.evaluate=="function"?{evaluate(...M){const A=g.evaluate.apply(void 0,M),z=y.evaluate.apply(void 0,M);if(A!==void 0&&z!==void 0)return w(A,z,d,a.colorSpace)}}:w(g,y,d,a.colorSpace)}function Yc(a,t,r){switch(t.type){case"color":r=gt.parse(r);break;case"formatted":r=Jr.fromString(r.toString());break;case"resolvedImage":r=hi.fromString(r.toString());break;case"padding":r=gr.parse(r);break;case"colorArray":r=Er.parse(r);break;case"numberArray":r=Qr.parse(r);break;default:_t(r)===t.type||t.type==="enum"&&t.values[r]||(r=void 0)}return gn(r,a.default,t.default)}Fi.register(Ms,{error:[{kind:"error"},[ht],(a,[t])=>{throw new Kt(t.evaluate(a))}],typeof:[ht,[dt],(a,[t])=>Yt(at(t.evaluate(a)))],"to-rgba":[vi(je,4),[xi],(a,[t])=>{const[r,s,c,p]=t.evaluate(a).rgb;return[255*r,255*s,255*c,p]}],rgb:[xi,[je,je,je],Zc],rgba:[xi,[je,je,je,je],Zc],has:{type:pt,overloads:[[[ht],(a,[t])=>qc(t.evaluate(a),a.properties())],[[ht,ra],(a,[t,r])=>qc(t.evaluate(a),r.evaluate(a))]]},get:{type:dt,overloads:[[[ht],(a,[t])=>Sl(t.evaluate(a),a.properties())],[[ht,ra],(a,[t,r])=>Sl(t.evaluate(a),r.evaluate(a))]]},"feature-state":[dt,[ht],(a,[t])=>Sl(t.evaluate(a),a.featureState||{})],properties:[ra,[],a=>a.properties()],"geometry-type":[ht,[],a=>a.geometryType()],id:[dt,[],a=>a.id()],zoom:[je,[],a=>a.globals.zoom],"heatmap-density":[je,[],a=>a.globals.heatmapDensity||0],elevation:[je,[],a=>a.globals.elevation||0],"line-progress":[je,[],a=>a.globals.lineProgress||0],accumulated:[dt,[],a=>a.globals.accumulated===void 0?null:a.globals.accumulated],"+":[je,is(je),(a,t)=>{let r=0;for(const s of t)r+=s.evaluate(a);return r}],"*":[je,is(je),(a,t)=>{let r=1;for(const s of t)r*=s.evaluate(a);return r}],"-":{type:je,overloads:[[[je,je],(a,[t,r])=>t.evaluate(a)-r.evaluate(a)],[[je],(a,[t])=>-t.evaluate(a)]]},"/":[je,[je,je],(a,[t,r])=>t.evaluate(a)/r.evaluate(a)],"%":[je,[je,je],(a,[t,r])=>t.evaluate(a)%r.evaluate(a)],ln2:[je,[],()=>Math.LN2],pi:[je,[],()=>Math.PI],e:[je,[],()=>Math.E],"^":[je,[je,je],(a,[t,r])=>Math.pow(t.evaluate(a),r.evaluate(a))],sqrt:[je,[je],(a,[t])=>Math.sqrt(t.evaluate(a))],log10:[je,[je],(a,[t])=>Math.log(t.evaluate(a))/Math.LN10],ln:[je,[je],(a,[t])=>Math.log(t.evaluate(a))],log2:[je,[je],(a,[t])=>Math.log(t.evaluate(a))/Math.LN2],sin:[je,[je],(a,[t])=>Math.sin(t.evaluate(a))],cos:[je,[je],(a,[t])=>Math.cos(t.evaluate(a))],tan:[je,[je],(a,[t])=>Math.tan(t.evaluate(a))],asin:[je,[je],(a,[t])=>Math.asin(t.evaluate(a))],acos:[je,[je],(a,[t])=>Math.acos(t.evaluate(a))],atan:[je,[je],(a,[t])=>Math.atan(t.evaluate(a))],min:[je,is(je),(a,t)=>Math.min(...t.map(r=>r.evaluate(a)))],max:[je,is(je),(a,t)=>Math.max(...t.map(r=>r.evaluate(a)))],abs:[je,[je],(a,[t])=>Math.abs(t.evaluate(a))],round:[je,[je],(a,[t])=>{const r=t.evaluate(a);return r<0?-Math.round(-r):Math.round(r)}],floor:[je,[je],(a,[t])=>Math.floor(t.evaluate(a))],ceil:[je,[je],(a,[t])=>Math.ceil(t.evaluate(a))],"filter-==":[pt,[ht,dt],(a,[t,r])=>a.properties()[t.value]===r.value],"filter-id-==":[pt,[dt],(a,[t])=>a.id()===t.value],"filter-type-==":[pt,[ht],(a,[t])=>a.geometryType()===t.value],"filter-<":[pt,[ht,dt],(a,[t,r])=>{const s=a.properties()[t.value],c=r.value;return typeof s==typeof c&&s<c}],"filter-id-<":[pt,[dt],(a,[t])=>{const r=a.id(),s=t.value;return typeof r==typeof s&&r<s}],"filter->":[pt,[ht,dt],(a,[t,r])=>{const s=a.properties()[t.value],c=r.value;return typeof s==typeof c&&s>c}],"filter-id->":[pt,[dt],(a,[t])=>{const r=a.id(),s=t.value;return typeof r==typeof s&&r>s}],"filter-<=":[pt,[ht,dt],(a,[t,r])=>{const s=a.properties()[t.value],c=r.value;return typeof s==typeof c&&s<=c}],"filter-id-<=":[pt,[dt],(a,[t])=>{const r=a.id(),s=t.value;return typeof r==typeof s&&r<=s}],"filter->=":[pt,[ht,dt],(a,[t,r])=>{const s=a.properties()[t.value],c=r.value;return typeof s==typeof c&&s>=c}],"filter-id->=":[pt,[dt],(a,[t])=>{const r=a.id(),s=t.value;return typeof r==typeof s&&r>=s}],"filter-has":[pt,[dt],(a,[t])=>t.value in a.properties()],"filter-has-id":[pt,[],a=>a.id()!==null&&a.id()!==void 0],"filter-type-in":[pt,[vi(ht)],(a,[t])=>t.value.indexOf(a.geometryType())>=0],"filter-id-in":[pt,[vi(dt)],(a,[t])=>t.value.indexOf(a.id())>=0],"filter-in-small":[pt,[ht,vi(dt)],(a,[t,r])=>r.value.indexOf(a.properties()[t.value])>=0],"filter-in-large":[pt,[ht,vi(dt)],(a,[t,r])=>function(s,c,p,d){for(;p<=d;){const g=p+d>>1;if(c[g]===s)return!0;c[g]>s?d=g-1:p=g+1}return!1}(a.properties()[t.value],r.value,0,r.value.length-1)],all:{type:pt,overloads:[[[pt,pt],(a,[t,r])=>t.evaluate(a)&&r.evaluate(a)],[is(pt),(a,t)=>{for(const r of t)if(!r.evaluate(a))return!1;return!0}]]},any:{type:pt,overloads:[[[pt,pt],(a,[t,r])=>t.evaluate(a)||r.evaluate(a)],[is(pt),(a,t)=>{for(const r of t)if(r.evaluate(a))return!0;return!1}]]},"!":[pt,[pt],(a,[t])=>!t.evaluate(a)],"is-supported-script":[pt,[ht],(a,[t])=>{const r=a.globals&&a.globals.isSupportedScript;return!r||r(t.evaluate(a))}],upcase:[ht,[ht],(a,[t])=>t.evaluate(a).toUpperCase()],downcase:[ht,[ht],(a,[t])=>t.evaluate(a).toLowerCase()],concat:[ht,is(dt),(a,t)=>t.map(r=>Qa(r.evaluate(a))).join("")],"resolved-locale":[ht,[da],(a,[t])=>t.evaluate(a).resolvedLocale()]});class go{constructor(t,r){this.expression=t,this._warningHistory={},this._evaluator=new kc,this._defaultValue=r?function(s){if(s.type==="color"&&as(s.default))return new gt(0,0,0,0);switch(s.type){case"color":return gt.parse(s.default)||null;case"padding":return gr.parse(s.default)||null;case"numberArray":return Qr.parse(s.default)||null;case"colorArray":return Er.parse(s.default)||null;case"variableAnchorOffsetCollection":return Tt.parse(s.default)||null;case"projectionDefinition":return lt.parse(s.default)||null;default:return s.default===void 0?null:s.default}}(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(t,r,s,c,p,d){return this._evaluator.globals=t,this._evaluator.feature=r,this._evaluator.featureState=s,this._evaluator.canonical=c,this._evaluator.availableImages=p||null,this._evaluator.formattedSection=d,this.expression.evaluate(this._evaluator)}evaluate(t,r,s,c,p,d){this._evaluator.globals=t,this._evaluator.feature=r||null,this._evaluator.featureState=s||null,this._evaluator.canonical=c,this._evaluator.availableImages=p||null,this._evaluator.formattedSection=d||null;try{const g=this.expression.evaluate(this._evaluator);if(g==null||typeof g=="number"&&g!=g)return this._defaultValue;if(this._enumValues&&!(g in this._enumValues))throw new Kt(`Expected value to be one of ${Object.keys(this._enumValues).map(y=>
4JSON.stringify(y)).join(", ")}, but found ${JSON.stringify(g)} instead.`);return g}catch(g){return this._warningHistory[g.message]||(this._warningHistory[g.message]=!0,typeof console<"u"&&console.warn(g.message)),this._defaultValue}}}function _o(a){return Array.isArray(a)&&a.length>0&&typeof a[0]=="string"&&a[0]in Ms}function yo(a,t){const r=new an(Ms,fo,[],t?function(c){const p={color:xi,string:ht,number:je,enum:ht,boolean:pt,formatted:Xa,padding:pr,numberArray:Js,colorArray:Ks,projectionDefinition:Kn,resolvedImage:fa,variableAnchorOffsetCollection:Qs};return c.type==="array"?vi(p[c.value]||dt,c.length):p[c.type]}(t):void 0),s=r.parse(a,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?Gc(new go(s,t)):As(r.errors)}class _n{constructor(t,r){this.kind=t,this._styleExpression=r,this.isStateDependent=t!=="constant"&&!mn(r.expression),this.globalStateRefs=Es(r.expression)}evaluateWithoutErrorHandling(t,r,s,c,p,d){return this._styleExpression.evaluateWithoutErrorHandling(t,r,s,c,p,d)}evaluate(t,r,s,c,p,d){return this._styleExpression.evaluate(t,r,s,c,p,d)}}class xo{constructor(t,r,s,c){this.kind=t,this.zoomStops=s,this._styleExpression=r,this.isStateDependent=t!=="camera"&&!mn(r.expression),this.globalStateRefs=Es(r.expression),this.interpolationType=c}evaluateWithoutErrorHandling(t,r,s,c,p,d){return this._styleExpression.evaluateWithoutErrorHandling(t,r,s,c,p,d)}evaluate(t,r,s,c,p,d){return this._styleExpression.evaluate(t,r,s,c,p,d)}interpolationFactor(t,r,s){return this.interpolationType?ai.interpolationFactor(this.interpolationType,t,r,s):0}}function Il(a,t){const r=yo(a,t);if(r.result==="error")return r;const s=r.value.expression,c=mo(s);if(!c&&!Ps(t))return As([new Xt("","data expressions not supported")]);const p=Is(s,["zoom"]);if(!p&&!Cl(t))return As([new Xt("","zoom expressions not supported")]);const d=ks(s);return d||p?d instanceof Xt?As([d]):d instanceof ai&&!Ml(t)?As([new Xt("",'"interpolate" expressions cannot be used with this property')]):Gc(d?new xo(c?"camera":"composite",r.value,d.labels,d instanceof ai?d.interpolation:void 0):new _n(c?"constant":"source",r.value)):As([new Xt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class yn{constructor(t,r){this._parameters=t,this._specification=r,Vr(this,Wc(this._parameters,this._specification))}static deserialize(t){return new yn(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function ks(a){let t=null;if(a instanceof sn)t=ks(a.result);else if(a instanceof di){for(const r of a.args)if(t=ks(r),t)break}else(a instanceof bs||a instanceof ai)&&a.input instanceof Fi&&a.input.name==="zoom"&&(t=a);return t instanceof Xt||a.eachChild(r=>{const s=ks(r);s instanceof Xt?t=s:!t&&s?t=new Xt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&s&&t!==s&&(t=new Xt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function Es(a,t=new Set){return a instanceof fn&&t.add(a.key),a.eachChild(r=>{Es(r,t)}),t}function xn(a){if(a===!0||a===!1)return!0;if(!Array.isArray(a)||a.length===0)return!1;switch(a[0]){case"has":return a.length>=2&&a[1]!=="$id"&&a[1]!=="$type";case"in":return a.length>
4=3&&(typeof a[1]!="string"||Array.isArray(a[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return a.length!==3||Array.isArray(a[1])||Array.isArray(a[2]);case"any":case"all":for(const t of a.slice(1))if(!xn(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}const Al={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function ka(a){if(a==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};xn(a)||(a=vo(a));const t=yo(a,Al);if(t.result==="error")throw new Error(t.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,s,c)=>t.value.evaluate(r,s,{},c),needGeometry:Kc(a),getGlobalStateRefs:()=>Es(t.value.expression)}}function mh(a,t){return a<t?-1:a>t?1:0}function Kc(a){if(!Array.isArray(a))return!1;if(a[0]==="within"||a[0]==="distance")return!0;for(let t=1;t<a.length;t++)if(Kc(a[t]))return!0;return!1}function vo(a){if(!a)return!0;const t=a[0];return a.length<=1?t!=="any":t==="=="?Pl(a[1],a[2],"=="):t==="!="?vn(Pl(a[1],a[2],"==")):t==="<"||t===">"||t==="<="||t===">="?Pl(a[1],a[2],t):t==="any"?(r=a.slice(1),["any"].concat(r.map(vo))):t==="all"?["all"].concat(a.slice(1).map(vo)):t==="none"?["all"].concat(a.slice(1).map(vo).map(vn)):t==="in"?Jc(a[1],a.slice(2)):t==="!in"?vn(Jc(a[1],a.slice(2))):t==="has"?Qc(a[1]):t!=="!has"||vn(Qc(a[1]));var r}function Pl(a,t,r){switch(a){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,a,t]}}function Jc(a,t){if(t.length===0)return!1;switch(a){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",a,["literal",t.sort(mh)]]:["filter-in-small",a,["literal",t]]}}function Qc(a){switch(a){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",a]}}function vn(a){return["!",a]}function bo(a){const t=typeof a;if(t==="number"||t==="boolean"||t==="string"||a==null)return JSON.stringify(a);if(Array.isArray(a)){let c="[";for(const p of a)c+=`${bo(p)},`;return`${c}]`}const r=Object.keys(a).sort();let s="{";for(let c=0;c<r.length;c++)s+=`${JSON.stringify(r[c])}:${bo(a[r[c]])},`;return`${s}}`}function wo(a){let t="";for(const r of Ne)t+=`/${bo(a[r])}`;return t}function eu(a){const t=a.value;return t?[new Fe(a.key,t,"constants have been deprecated as of v8")]:[]}function ir(a){return a instanceof Number||a instanceof String||a instanceof Boolean?a.valueOf():a}function Ea(a){if(Array.isArray(a))return a.map(Ea);if(a instanceof Object&&!(a instanceof Number||a instanceof String||a instanceof Boolean)){const t={};for(const r in a)t[r]=Ea(a[r]);return t}return ir(a)}function Bi(a){const t=a.key,r=a.value,s=a.valueSpec||{},c=a.objectElementValidators||{},p=a.style,d=a.styleSpec,g=a.validateSpec;let y=[];const w=_t(r);if(w!=="object")return[new Fe(t,r,`object expected, ${w} found`)];for(const M in r){const A=M.split(".")[0],z=mt(s,A)||s["*"];let R;if(mt(c,A))R=c[A];else if(mt(s,A))R=g;else if(c["*"])R=c["*"];else{if(!s["*"]){y.push(new Fe(t,r[M],`unknown property "${M}"`));continue}R=g}y=y.concat(R({key:(t&&`${t}.`)+M,value:r[M],valueSpec:z,style:p,styleSpec:d,object:r,objectKey:M,validateSpec:g},r))}for(const M in s)c[M]||s[M].required&&s[M].default===void 0&&r[M]===void 0&&y.push(new Fe(t,r,`missing required property "${M}"`));return y}function To(a){const t=a.value,r=a.valueSpec,s=a.style,c=a.styleSpec,p=a.key,d=a.arrayElementValidator||a.validateSpec;if(_t(t)!=="array")return[new Fe(p,t,`array expected, ${_t(t)} found`)];if(r.length&&t.length!==r.length)return[new Fe(p,t,`array length ${r.length} expected, length ${t.length} found`)];if(r["min-length"]&&t.length<r["min-length"])return[new Fe(p,t,`array length at least ${r["min-length"]} expected, length ${t.length} found`)];let g={type:r.value,values:r.values};c.$version<7&&(g.function=r.function),_t(r.value)==="object"&&(g=r.value);let y=[];for(let w=0;w<t.length;w++)y=y.concat(d({array:t,arrayIndex:w,value:t[w],valueSpec:g,validateSpec:a.validateSpec,style:s,styleSpec:c,key:`${p}[${w}]`}));return y}function bn(a){const t=a.key,r=a.value,s=a.valueSpec;let c=_t(r);return c==="number"&&r!=r&&(c="NaN"),c!=="number"?[new Fe(t,r,`number expected, ${c} found`)]:"minimum"in s&&r<s.minimum?[new Fe(t,r,`${r} is less than the minimum value ${s.minimum}`)]:"maximum"in s&&r>s.maximum?[new Fe(t,r,`${r} is greater than the maximum value ${s.maximum}`)]:[]}function zs(a){const t=a.valueSpec,r=ir(a.value.type);let s,c,p,d={};const g=r!=="categorical"&&a.value.property===void 0,y=!g,w=_t(a.value.stops)==="array"&&_t(a.value.stops[0])==="array"&&_t(a.value.stops[0][0])==="object",M=Bi({key:a.key,value:a.value,valueSpec:a.styleSpec.function,validateSpec:a.validateSpec,style:a.style,styleSpec:a.styleSpec,objectElementValidators:{stops:function(R){if(r==="identity")return[new Fe(R.key,R.value,'identity function may not have a "stops" property')];let B=[];const j=R.value;return B=B.concat(To({key:R.key,value:j,valueSpec:R.valueSpec,validateSpec:R.validateSpec,style:R.style,styleSpec:R.styleSpec,arrayElementValidator:A})),_t(j)==="array"&&j.length===0&&B.push(new Fe(R.key,j,"array must have at least one stop")),B},default:function(R){return R.validateSpec({key:R.key,value:R.value,valueSpec:t,validateSpec:R.validateSpec,style:R.style,styleSpec:R.styleSpec})}}});return r==="identity"&&g&&M.push(new Fe(a.key,a.value,'missing required property "property"')),r==="identity"||a.value.stops||M.push(new Fe(a.key,a.value,'missing required property "stops"')),r==="exponential"&&a.valueSpec.expression&&!Ml(a.valueSpec)&&M.push(new Fe(a.key,a.value,"exponential functions not supported")),a.styleSpec.$version>=8&&(y&&!Ps(a.valueSpec)?M.push(new Fe(a.key,a.value,"property functions not supported")):g&&!Cl(a.valueSpec)&&M.push(new Fe(a.key,a.value,"zoom functions not supported"))),r!=="categorical"&&!w||a.value.property!==void 0||M.push(new Fe(a.key,a.value,'"property" property is required')),M;function A(R){let B=[];const j=R.value,V=R.key;if(_t(j)!=="array")return[new Fe(V,j,`array expected, ${_t(j)} found`)];if(j.length!==2)return[new Fe(V,j,`array length 2 expected, length ${j.length} found`)];if(w){if(_t(j[0])!=="object")return[new Fe(V,j,`object expected, ${_t(j[0])} found`)];if(j[0].zoom===void 0)return[new Fe(V,j,"object stop key must have zoom")];if(j[0].value===void 0)return[new Fe(V,j,"object stop key must have value")];if(p&&p>ir(j[0].zoom))return[new Fe(V,j[0].zoom,"stop zoom values must appear in ascending order")];ir(j[0].zoom)!==p&&(p=ir(j[0].zoom),c=void 0,d={}),B=B.concat(Bi({key:`${V}[0]`,value:j[0],valueSpec:{zoom:{}},validateSpec:R.validateSpec,style:R.style,styleSpec:R.styleSpec,objectElementValidators:{zoom:bn,value:z}}))}else B=B.concat(z({key:`${V}[0]`,value:j[0],validateSpec:R.validateSpec,style:R.style,styleSpec:R.styleSpec},j));return _o(Ea(j[1]))?B.concat([new Fe(`${V}[1]`,j[1],"expressions are not allowed in function stops.")]):B.concat(R.validateSpec({key:`${V}[1]`,value:j[1],valueSpec:t,validateSpec:R.validateSpec,style:R.style,styleSpec:R.styleSpec}))}function z(R,B){const j=_t(R.value),V=ir(R.value),W=R.value!==null?R.value:B;if(s){if(j!==s)return[new Fe(R.key,W,`${j} stop domain type must match previous stop domain type ${s}`)]}else s=j;if(j!=="number"&&j!=="string"&&j!=="boolean")return[new Fe(R.key,W,"stop domain value must be a number, string, or boolean")];if(j!=="number"&&r!=="categorical"){let oe=`number expected, ${j} found`;return Ps(t)&&r===void 0&&(oe+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Fe(R.key,W,oe)]}return r!=="categorical"||j!=="number"||isFinite(V)&&Math.floor(V)===V?r!=="categorical"&&j==="number"&&c!==void 0&&V<c?[new Fe(R.key,W,"stop domain values must appear in ascending order")]:(c=V,r==="categorical"&&V in d?[new Fe(R.key,W,"stop domain values must be unique")]:(d[V]=!0,[])):[new Fe(R.key,W,`integer expected, found ${V}`)]}}function Ds(a){const t=(a.expressionContext==="property"?Il:yo)(Ea(a.value),a.valueSpec);if(t.result==="error")return t.value.map(s=>new Fe(`${a.key}${s.key}`,a.value,s.message));const r=t.value.expression||t.value._styleExpression.expression;if(a.expressionContext==="property"&&a.propertyKey==="text-font"&&!r.outputDefined())return[new Fe(a.key,a.value,`Invalid data expression for "${a.propertyKey}". Output values must be contained as literals within the expression.`)];if(a.expressionContext==="property"&&a.propertyType==="layout"&&!mn(r))return[new Fe(a.key,a.value,'"feature-state" data expressions are not supported with layout properties.')];if(a.expressionContext==="filter"&&!mn(r))return[new Fe(a.key,a.value,'"feature-state" data expressions are not supported with filters.')];if(a.expressionContext&&a.expressionContext.indexOf("cluster")===0){if(!Is(r,["zoom","feature-state"]))return[new Fe(a.key,a.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(a.expressionContext==="cluster-initial"&&!mo(r))return[new Fe(a.key,a.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function kl(a){const t=a.key,r=a.value,s=_t(r);return s!=="string"?[new Fe(t,r,`color expected, ${s} found`)]:gt.parse(String(r))?[]:[new Fe(t,r,`color expected, "${r}" found`)]}function wn(a){const t=a.key,r=a.value,s=a.valueSpec,c=[];return Array.isArray(s.values)?s.values.indexOf(ir(r))===-1&&c.push(new Fe(t,r,`expected one of [${s.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(s.values).indexOf(ir(r))===-1&&c.push(new Fe(t,r,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(r)} found`)),c}function El(a){return xn(Ea(a.value))?Ds(Vr({},a,{expressionContext:"filter",valueSpec:{value:"boolean"}})):tu(a)}function tu(a){const t=a.value,r=a.key;if(_t(t)!=="array")return[new Fe(r,t,`array expected, ${_t(t)} found`)];const s=a.styleSpec;let c,p=[];if(t.length<1)return[new Fe(r,t,"filter array must have at least 1 element")];switch(p=p.concat(wn({key:`${r}[0]`,value:t[0],valueSpec:s.filter_operator,style:a.style,styleSpec:a.styleSpec}
4)),ir(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&ir(t[1])==="$type"&&p.push(new Fe(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&p.push(new Fe(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(c=_t(t[1]),c!=="string"&&p.push(new Fe(`${r}[1]`,t[1],`string expected, ${c} found`)));for(let d=2;d<t.length;d++)c=_t(t[d]),ir(t[1])==="$type"?p=p.concat(wn({key:`${r}[${d}]`,value:t[d],valueSpec:s.geometry_type,style:a.style,styleSpec:a.styleSpec})):c!=="string"&&c!=="number"&&c!=="boolean"&&p.push(new Fe(`${r}[${d}]`,t[d],`string, number, or boolean expected, ${c} found`));break;case"any":case"all":case"none":for(let d=1;d<t.length;d++)p=p.concat(tu({key:`${r}[${d}]`,value:t[d],style:a.style,styleSpec:a.styleSpec}));break;case"has":case"!has":c=_t(t[1]),t.length!==2?p.push(new Fe(r,t,`filter array for "${t[0]}" operator must have 2 elements`)):c!=="string"&&p.push(new Fe(`${r}[1]`,t[1],`string expected, ${c} found`))}return p}function ru(a,t){const r=a.key,s=a.validateSpec,c=a.style,p=a.styleSpec,d=a.value,g=a.objectKey,y=p[`${t}_${a.layerType}`];if(!y)return[];const w=g.match(/^(.*)-transition$/);if(t==="paint"&&w&&y[w[1]]&&y[w[1]].transition)return s({key:r,value:d,valueSpec:p.transition,style:c,styleSpec:p});const M=a.valueSpec||y[g];if(!M)return[new Fe(r,d,`unknown property "${g}"`)];let A;if(_t(d)==="string"&&Ps(M)&&!M.tokens&&(A=/^{([^}]+)}$/.exec(d)))return[new Fe(r,d,`"${g}" does not support interpolation syntax 5Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(A[1])} }\`.`)];const z=[];return a.layerType==="symbol"&&(g==="text-field"&&c&&!c.glyphs&&z.push(new Fe(r,d,'use of "text-field" requires a style "glyphs" property')),g==="text-font"&&as(Ea(d))&&ir(d.type)==="identity"&&z.push(new Fe(r,d,'"text-font" does not support identity functions'))),z.concat(s({key:a.key,value:d,valueSpec:M,style:c,styleSpec:p,expressionContext:"property",propertyType:t,propertyKey:g}))}function Ls(a){return ru(a,"paint")}function Rs(a){return ru(a,"layout")}function fi(a){let t=[];const r=a.value,s=a.key,c=a.style,p=a.styleSpec;if(_t(r)!=="object")return[new Fe(s,r,`object expected, ${_t(r)} found`)];r.type||r.ref||t.push(new Fe(s,r,'either "type" or "ref" is required'));let d=ir(r.type);const g=ir(r.ref);if(r.id){const y=ir(r.id);for(let w=0;w<a.arrayIndex;w++){const M=c.layers[w];ir(M.id)===y&&t.push(new Fe(s,r.id,`duplicate layer id "${r.id}", previously used at line ${M.id.__line__}`))}}if("ref"in r){let y;["type","source","source-layer","filter","layout"].forEach(w=>{w in r&&t.push(new Fe(s,r[w],`"${w}" is prohibited for ref layers`))}),c.layers.forEach(w=>{ir(w.id)===g&&(y=w)}),y?y.ref?t.push(new Fe(s,r.ref,"ref cannot reference another ref layer")):d=ir(y.type):t.push(new Fe(s,r.ref,`ref layer "${g}" not found`))}else if(d!=="background")if(r.source){const y=c.sources&&c.sources[r.source],w=y&&ir(y.type);y?w==="vector"&&d==="raster"?t.push(new Fe(s,r.source,`layer "${r.id}" requires a raster source`)):w!=="raster-dem"&&d==="hillshade"||w!=="raster-dem"&&d==="color-relief"?t.push(new Fe(s,r.source,`layer "${r.id}" requires a raster-dem source`)):w==="raster"&&d!=="raster"?t.push(new Fe(s,r.source,`layer "${r.id}" requires a vector source`)):w!=="vector"||r["source-layer"]?w==="raster-dem"&&d!=="hillshade"&&d!=="color-relief"?t.push(new Fe(s,r.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):d!=="line"||!r.paint||!r.paint["line-gradient"]||w==="geojson"&&y.lineMetrics||t.push(new Fe(s,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new Fe(s,r,`layer "${r.id}" must specify a "source-layer"`)):t.push(new Fe(s,r.source,`source "${r.source}" not found`))}else t.push(new Fe(s,r,'missing required property "source"'));return t=t.concat(Bi({key:s,value:r,valueSpec:p.layer,style:a.style,styleSpec:a.styleSpec,validateSpec:a.validateSpec,objectElementValidators:{"*":()=>[],type:()=>a.validateSpec({key:`${s}.type`,value:r.type,valueSpec:p.layer.type,style:a.style,styleSpec:a.styleSpec,validateSpec:a.validateSpec,object:r,objectKey:"type"}),filter:El,layout:y=>Bi({layer:r,key:y.key,value:y.value,style:y.style,styleSpec:y.styleSpec,validateSpec:y.validateSpec,objectElementValidators:{"*":w=>Rs(Vr({layerType:d},w))}}),paint:y=>Bi({layer:r,key:y.key,value:y.value,style:y.style,styleSpec:y.styleSpec,validateSpec:y.validateSpec,objectElementValidators:{"*":w=>Ls(Vr({layerType:d},w))}})}})),t}function Hi(a){const t=a.value,r=a.key,s=_t(t);return s!=="string"?[new Fe(r,t,`string expected, ${s} found`)]:[]}const zl={promoteId:function({key:a,value:t}
5){if(_t(t)==="string")return Hi({key:a,value:t});{const r=[];for(const s in t)r.push(...Hi({key:`${a}.${s}`,value:t[s]}));return r}}};function iu(a){const t=a.value,r=a.key,s=a.styleSpec,c=a.style,p=a.validateSpec;if(!t.type)return[new Fe(r,t,'"type" is required')];const d=ir(t.type);let g;switch(d){case"vector":case"raster":return g=Bi({key:r,value:t,valueSpec:s[`source_${d.replace("-","_")}`],style:a.style,styleSpec:s,objectElementValidators:zl,validateSpec:p}),g;case"raster-dem":return g=function(y){var w;const M=(w=y.sourceName)!==null&&w!==void 0?w:"",A=y.value,z=y.styleSpec,R=z.source_raster_dem,B=y.style;let j=[];const V=_t(A);if(A===void 0)return j;if(V!=="object")return j.push(new Fe("source_raster_dem",A,`object expected, ${V} found`)),j;const W=ir(A.encoding)==="custom",oe=["redFactor","greenFactor","blueFactor","baseShift"],Q=y.value.encoding?`"${y.value.encoding}"`:"Default";for(const L in A)!W&&oe.includes(L)?j.push(new Fe(L,A[L],`In "${M}": "${L}" is only valid when "encoding" is set to "custom". ${Q} encoding found`)):R[L]?j=j.concat(y.validateSpec({key:L,value:A[L],valueSpec:R[L],validateSpec:y.validateSpec,style:B,styleSpec:z})):j.push(new Fe(L,A[L],`unknown property "${L}"`));return j}({sourceName:r,value:t,style:a.style,styleSpec:s,validateSpec:p}),g;case"geojson":if(g=Bi({key:r,value:t,valueSpec:s.source_geojson,style:c,styleSpec:s,validateSpec:p,objectElementValidators:zl}),t.cluster)for(const y in t.clusterProperties){const[w,M]=t.clusterProperties[y],A=typeof w=="string"?[w,["accumulated"],["get",y]]:w;g.push(...Ds({key:`${r}.${y}.map`,value:M,expressionContext:"cluster-map"})),g.push(...Ds({key:`${r}.${y}.reduce`,value:A,expressionContext:"cluster-reduce"}))}return g;case"video":return Bi({key:r,value:t,valueSpec:s.source_video,style:c,validateSpec:p,styleSpec:s});case"image":return Bi({key:r,value:t,valueSpec:s.source_image,style:c,validateSpec:p,styleSpec:s});case"canvas":return[new Fe(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return wn({key:`${r}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function au(a){const t=a.value,r=a.styleSpec,s=r.light,c=a.style;let p=[];const d=_t(t);if(t===void 0)return p;if(d!=="object")return p=p.concat([new Fe("light",t,`object expected, ${d} found`)]),p;for(const g in t){const y=g.match(/^(.*)-transition$/);p=p.concat(y&&s[y[1]]&&s[y[1]].transition?a.validateSpec({key:g,value:t[g],valueSpec:r.transition,validateSpec:a.validateSpec,style:c,styleSpec:r}):s[g]?a.validateSpec({key:g,value:t[g],valueSpec:s[g],validateSpec:a.validateSpec,style:c,styleSpec:r}):[new Fe(g,t[g],`unknown property "${g}"`)])}return p}function Fs(a){const t=a.value,r=a.styleSpec,s=r.sky,c=a.style,p=_t(t);if(t===void 0)return[];if(p!=="object")return[new Fe("sky",t,`object expected, ${p} found`)];let d=[];for(const g in t)d=d.concat(s[g]?a.validateSpec({key:g,value:t[g],valueSpec:s[g],style:c,styleSpec:r}):[new Fe(g,t[g],`unknown property "${g}"`)]);return d}function Dl(a){const t=a.value,r=a.styleSpec,s=r.terrain,c=a.style;let p=[];const d=_t(t);if(t===void 0)return p;if(d!=="object")return p=p.concat([new Fe("terrain",t,`object expected, ${d} found`)]),p;for(const g in t)p=p.concat(s[g]?a.validateSpec({key:g,value:t[g],valueSpec:s[g],validateSpec:a.validateSpec,style:c,styleSpec:r}):[new Fe(g,t[g],`unknown property "${g}"`)]);return p}function So(a){let t=[];const r=a.value,s=a.key;if(Array.isArray(r)){const c=[],p=[];for(const d in r)r[d].id&&c.includes(r[d].id)&&t.push(new Fe(s,r,`all the sprites' ids must be unique, but ${r[d].id} is duplicated`)),c.push(r[d].id),r[d].url&&p.includes(r[d].url)&&t.push(new Fe(s,r,`all the sprites' URLs must be unique, but ${r[d].url} is duplicated`)),p.push(r[d].url),t=t.concat(Bi({key:`${s}[${d}]`,value:r[d],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:a.validateSpec}));return t}return Hi({key:s,value:r})}function su(a){return t=a.value,t&&t.constructor===Object?[]:[new Fe(a.key,a.value,`object expected, ${_t(a.value)} found`)];var t}const Co={"*":()=>[],array:To,boolean:function(a){const t=a.value,r=a.key,s=_t(t);return s!=="boolean"?[new Fe(r,t,`boolean expected, ${s} found`)]:[]},number:bn,color:kl,constants:eu,enum:wn,filter:El,function:zs,layer:fi,object:Bi,source:iu,light:au,sky:Fs,terrain:Dl,projection:function(a){const t=a.value,r=a.styleSpec,s=r.projection,c=a.style,p=_t(t);if(t===void 0)return[];if(p!=="object")return[new Fe("projection",t,`object expected, ${p} found`)];let d=[];
5for(const g in t)d=d.concat(s[g]?a.validateSpec({key:g,value:t[g],valueSpec:s[g],style:c,styleSpec:r}):[new Fe(g,t[g],`unknown property "${g}"`)]);return d},projectionDefinition:function(a){const t=a.key;let r=a.value;r=r instanceof String?r.valueOf():r;const s=_t(r);return s!=="array"||function(c){return Array.isArray(c)&&c.length===3&&typeof c[0]=="string"&&typeof c[1]=="string"&&typeof c[2]=="number"}(r)||function(c){return!!["interpolate","step","literal"].includes(c[0])}(r)?["array","string"].includes(s)?[]:[new Fe(t,r,`projection expected, invalid type "${s}" found`)]:[new Fe(t,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]},string:Hi,formatted:function(a){return Hi(a).length===0?[]:Ds(a)},resolvedImage:function(a){return Hi(a).length===0?[]:Ds(a)},padding:function(a){const t=a.key,r=a.value;if(_t(r)==="array"){if(r.length<1||r.length>4)return[new Fe(t,r,`padding requires 1 to 4 values; ${r.length} values found`)];const s={type:"number"};let c=[];for(let p=0;p<r.length;p++)c=c.concat(a.validateSpec({key:`${t}[${p}]`,value:r[p],validateSpec:a.validateSpec,valueSpec:s}));return c}return bn({key:t,value:r,valueSpec:{}})},numberArray:function(a){const t=a.key,r=a.value;if(_t(r)==="array"){const s={type:"number"};if(r.length<1)return[new Fe(t,r,"array length at least 1 expected, length 0 found")];let c=[];for(let p=0;p<r.length;p++)c=c.concat(a.validateSpec({key:`${t}[${p}]`,value:r[p],validateSpec:a.validateSpec,valueSpec:s}));return c}return bn({key:t,value:r,valueSpec:{}})},colorArray:function(a){const t=a.key,r=a.value;if(_t(r)==="array"){if(r.length<1)return[new Fe(t,r,"array length at least 1 expected, length 0 found")];let s=[];for(let c=0;c<r.length;c++)s=s.concat(kl({key:`${t}[${c}]`,value:r[c]}));return s}return kl({key:t,value:r})},variableAnchorOffsetCollection:function(a){const t=a.key,r=a.value,s=_t(r),c=a.styleSpec;if(s!=="array"||r.length<1||r.length%2!=0)return[new Fe(t,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let p=[];for(let d=0;d<r.length;d+=2)p=p.concat(wn({key:`${t}[${d}]`,value:r[d],valueSpec:c.layout_symbol["text-anchor"]})),p=p.concat(To({key:`${t}[${d+1}]`,value:r[d+1],valueSpec:{length:2,value:"number"},validateSpec:a.validateSpec,style:a.style,styleSpec:c}));return p},sprite:So,state:su};function Mo(a){const t=a.value,r=a.valueSpec,s=a.styleSpec;return a.validateSpec=Mo,r.expression&&as(ir(t))?zs(a):r.expression&&_o(Ea(t))?Ds(a):r.type&&Co[r.type]?Co[r.type](a):Bi(Vr({},a,{valueSpec:r.type?s[r.type]:r}))}function Bs(a){const t=a.value,r=a.key,s=Hi(a);return s.length||(t.indexOf("{fontstack}")===-1&&s.push(new Fe(r,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&s.push(new Fe(r,t,'"glyphs" url must include a "{range}" token'))),s}function Oi(a,t=se){let r=[];return r=r.concat(Mo({key:"",value:a,valueSpec:t.$root,styleSpec:t,style:a,validateSpec:Mo,objectElementValidators:{glyphs:Bs,"*":()=>[]}})),a.constants&&(r=r.concat(eu({key:"constants",value:a.constants}))),nu(r)}function Wi(a){return function(t){return a({...t,validateSpec:Mo})}}function nu(a){return[].concat(a).sort((t,r)=>t.line-r.line)}function si(a){return function(...t){return nu(a.apply(this,t))}}Oi.source=si(Wi(iu)),Oi.sprite=si(Wi(So)),Oi.glyphs=si(Wi(Bs)),Oi.light=si(Wi(au)),Oi.sky=si(Wi(Fs)),Oi.terrain=si(Wi(Dl)),Oi.state=si(Wi(su)),Oi.layer=si(Wi(fi)),Oi.filter=si(Wi(El)),Oi.paintProperty=si(Wi(Ls)),Oi.layoutProperty=si(Wi(Rs));const Os=Oi,gh=Os.light,Io=Os.sky,_h=Os.paintProperty,Ll=Os.layoutProperty;function Tn(a,t){let r=!1;if(t&&t.length)for(const s of t)a.fire(new de(new Error(s.message))),r=!0;return r}class js{constructor(t,r,s){const c=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const d=new Int32Array(this.arrayBuffer);t=d[0],this.d=(r=d[1])+2*(s=d[2]);for(let y=0;y<this.d*this.d;y++){const w=d[3+y],M=d[3+y+1];c.push(w===M?null:d.subarray(w,M))}const g=d[3+c.length+1];this.keys=d.subarray(d[3+c.length],g),this.bboxes=d.subarray(g),this.insert=this._insertReadonly}else{this.d=r+2*s;for(let d=0;d<this.d*this.d;d++)c.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=t,this.padding=s,this.scale=r/t,this.uid=0;const p=s/r*t;this.min=-p,this.max=t+p}
5insert(t,r,s,c,p){this._forEachCell(r,s,c,p,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(r),this.bboxes.push(s),this.bboxes.push(c),this.bboxes.push(p)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,r,s,c,p,d){this.cells[p].push(d)}query(t,r,s,c,p){const d=this.min,g=this.max;if(t<=d&&r<=d&&g<=s&&g<=c&&!p)return Array.prototype.slice.call(this.keys);{const y=[];return this._forEachCell(t,r,s,c,this._queryCell,y,{},p),y}}_queryCell(t,r,s,c,p,d,g,y){const w=this.cells[p];if(w!==null){const M=this.keys,A=this.bboxes;for(let z=0;z<w.length;z++){const R=w[z];if(g[R]===void 0){const B=4*R;(y?y(A[B+0],A[B+1],A[B+2],A[B+3]):t<=A[B+2]&&r<=A[B+3]&&s>=A[B+0]&&c>=A[B+1])?(g[R]=!0,d.push(M[R])):g[R]=!1}}}}_forEachCell(t,r,s,c,p,d,g,y){const w=this._convertToCellCoord(t),M=this._convertToCellCoord(r),A=this._convertToCellCoord(s),z=this._convertToCellCoord(c);for(let R=w;R<=A;R++)for(let B=M;B<=z;B++){const j=this.d*B+R;if((!y||y(this._convertFromCellCoord(R),this._convertFromCellCoord(B),this._convertFromCellCoord(R+1),this._convertFromCellCoord(B+1)))&&p.call(this,t,r,s,c,j,d,g,y))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 d=0;d<this.cells.length;d++)s+=this.cells[d].length;const c=new Int32Array(r+s+this.keys.length+this.bboxes.length);c[0]=this.extent,c[1]=this.n,c[2]=this.padding;let p=r;for(let d=0;d<t.length;d++){const g=t[d];c[3+d]=p,c.set(g,p),p+=g.length}return c[3+t.length]=p,c.set(this.keys,p),p+=this.keys.length,c[3+t.length+1]=p,c.set(this.bboxes,p),p+=this.bboxes.length,c.buffer}static serialize(t,r){const s=t.toArrayBuffer();return r&&r.push(s),{buffer:s}}static deserialize(t){return new js(t.buffer)}}const na={};function $e(a,t,r={}){if(na[a])throw new Error(`${a} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:a,writeable:!1}),na[a]={klass:t,omit:r.omit||[],shallow:r.shallow||[]}}$e("Object",Object),$e("Set",Set),$e("TransferableGridIndex",js),$e("Color",gt),$e("Error",Error),$e("AJAXError",J),$e("ResolvedImage",hi),$e("StylePropertyFunction",yn),$e("StyleExpression",go,{omit:["_evaluator"]}),$e("ZoomDependentExpression",xo),$e("ZoomConstantExpression",_n),$e("CompoundExpression",Fi,{omit:["_evaluate"]});for(const a in Ms)Ms[a]._classRegistryKey||$e(`Expression_${a}`,Ms[a]);function Rl(a){return a&&typeof ArrayBuffer<"u"&&(a instanceof ArrayBuffer||a.constructor&&a.constructor.name==="ArrayBuffer")}function Sn(a){return a.$name||a.constructor._classRegistryKey}function Fl(a){return!function(t){if(t===null||typeof t!="object")return!1;const r=Sn(t);return!(!r||r==="Object")}(a)&&(a==null||typeof a=="boolean"||typeof a=="number"||typeof a=="string"||a instanceof Boolean||a instanceof Number||a instanceof String||a instanceof Date||a instanceof RegExp||a instanceof Blob||a instanceof Error||Rl(a)||ui(a)||ArrayBuffer.isView(a)||a instanceof ImageData)}function Cn(a,t){if(Fl(a))return(Rl(a)||ui(a))&&t&&t.push(a),ArrayBuffer.isView(a)&&t&&t.push(a.buffer),a instanceof ImageData&&t&&t.push(a.data.buffer),a;if(Array.isArray(a)){const p=[];for(const d of a)p.push(Cn(d,t));return p}if(typeof a!="object")throw new Error("can't serialize object of type "+typeof a);const r=Sn(a);if(!r)throw new Error(`can't serialize object of unregistered class ${a.constructor.name}`);if(!na[r])throw new Error(`${r} is not registered.`);const{klass:s}=na[r],c=s.serialize?s.serialize(a,t):{};if(s.serialize){if(t&&c===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const p in a){if(!a.hasOwnProperty(p)||na[r].omit.indexOf(p)>=0)continue;const d=a[p];c[p]=na[r].shallow.indexOf(p)>=0?d:Cn(d,t)}a instanceof Error&&(c.message=a.message)}if(c.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(c.$name=r),c}
5function Ns(a){if(Fl(a))return a;if(Array.isArray(a))return a.map(Ns);if(typeof a!="object")throw new Error("can't deserialize object of type "+typeof a);const t=Sn(a)||"Object";if(!na[t])throw new Error(`can't deserialize unregistered class ${t}`);const{klass:r}=na[t];if(!r)throw new Error(`can't deserialize unregistered class ${t}`);if(r.deserialize)return r.deserialize(a);const s=Object.create(r.prototype);for(const c of Object.keys(a)){if(c==="$name")continue;const p=a[c];s[c]=na[t].shallow.indexOf(c)>=0?p:Ns(p)}return s}class Bl{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 yt={"Latin-1 Supplement":a=>a>=128&&a<=255,"Hangul Jamo":a=>a>=4352&&a<=4607,Khmer:a=>a>=6016&&a<=6143,"General Punctuation":a=>a>=8192&&a<=8303,"Letterlike Symbols":a=>a>=8448&&a<=8527,"Number Forms":a=>a>=8528&&a<=8591,"Miscellaneous Technical":a=>a>=8960&&a<=9215,"Control Pictures":a=>a>=9216&&a<=9279,"Optical Character Recognition":a=>a>=9280&&a<=9311,"Enclosed Alphanumerics":a=>a>=9312&&a<=9471,"Geometric Shapes":a=>a>=9632&&a<=9727,"Miscellaneous Symbols":a=>a>=9728&&a<=9983,"Miscellaneous Symbols and Arrows":a=>a>=11008&&a<=11263,"Ideographic Description Characters":a=>a>=12272&&a<=12287,"CJK Symbols and Punctuation":a=>a>=12288&&a<=12351,Hiragana:a=>a>=12352&&a<=12447,Katakana:a=>a>=12448&&a<=12543,Kanbun:a=>a>=12688&&a<=12703,"CJK Strokes":a=>a>=12736&&a<=12783,"Enclosed CJK Letters and Months":a=>a>=12800&&a<=13055,"CJK Compatibility":a=>a>=13056&&a<=13311,"Yijing Hexagram Symbols":a=>a>=19904&&a<=19967,"CJK Unified Ideographs":a=>a>=19968&&a<=40959,"Hangul Syllables":a=>a>=44032&&a<=55215,"Private Use Area":a=>a>=57344&&a<=63743,"Vertical Forms":a=>a>=65040&&a<=65055,"CJK Compatibility Forms":a=>a>=65072&&a<=65103,"Small Form Variants":a=>
5a>=65104&&a<=65135,"Halfwidth and Fullwidth Forms":a=>a>=65280&&a<=65519};function Ol(a){for(const t of a)if(Po(t.charCodeAt(0)))return!0;return!1}function ou(a){for(const t of a)if(!xh(t.charCodeAt(0)))return!1;return!0}function Ao(a){const t=a.map(r=>{try{return new RegExp(`\\p{sc=${r}}`,"u").source}catch{return null}}).filter(r=>r);return new RegExp(t.join("|"),"u")}const yh=Ao(["Arab","Dupl","Mong","Ougr","Syrc"]);function xh(a){return!yh.test(String.fromCodePoint(a))}const jl=Ao(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function Po(a){return!(a!==746&&a!==747&&(a<4352||!(yt["CJK Compatibility Forms"](a)&&!(a>=65097&&a<=65103)||yt["CJK Compatibility"](a)||yt["CJK Strokes"](a)||!(!yt["CJK Symbols and Punctuation"](a)||a>=12296&&a<=12305||a>=12308&&a<=12319||a===12336)||yt["Enclosed CJK Letters and Months"](a)||yt["Ideographic Description Characters"](a)||yt.Kanbun(a)||yt.Katakana(a)&&a!==12540||!(!yt["Halfwidth and Fullwidth Forms"](a)||a===65288||a===65289||a===65293||a>=65306&&a<=65310||a===65339||a===65341||a===65343||a>=65371&&a<=65503||a===65507||a>=65512&&a<=65519)||!(!yt["Small Form Variants"](a)||a>=65112&&a<=65118||a>=65123&&a<=65126)||yt["Vertical Forms"](a)||yt["Yijing Hexagram Symbols"](a)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(a))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(a))||jl.test(String.fromCodePoint(a)))))}function Nl(a){return!(Po(a)||function(t){return!!(yt["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||yt["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)||yt["Letterlike Symbols"](t)||yt["Number Forms"](t)||yt["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)||yt["Control Pictures"](t)&&t!==9251||yt["Optical Character Recognition"](t)||yt["Enclosed Alphanumerics"](t)||yt["Geometric Shapes"](t)||yt["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||yt["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||yt["CJK Symbols and Punctuation"](t)||yt.Katakana(t)||yt["Private Use Area"](t)||yt["CJK Compatibility Forms"](t)||yt["Small Form Variants"](t)||yt["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}(a))}const lu=Ao(["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 Mn(a){return lu.test(String.fromCodePoint(a))}function vh(a,t){return!(!t&&Mn(a)||a>=2304&&a<=3583||a>=3840&&a<=4255||yt.Khmer(a))}function Ul(a){for(const t of a)if(Mn(t.charCodeAt(0)))return!0;return!1}const za=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(a){this.pluginStatus=a.pluginStatus,this.pluginURL=a.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}
5setMethods(a){if(za.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=a.applyArabicShaping,this.processBidirectionalText=a.processBidirectionalText,this.processStyledBidirectionalText=a.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(a,t){return o(this,void 0,void 0,function*(){if(this.isParsed())return this.getState();if(a.pluginStatus!=="loading")return this.setState(a),a;const r=a.pluginURL,s=new Promise(p=>{this.loadScriptResolve=p});t(r);const c=new Promise(p=>setTimeout(()=>p(),this.TIMEOUT));if(yield Promise.race([s,c]),this.isParsed()){const p={pluginStatus:"loaded",pluginURL:r};return this.setState(p),p}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${r}`)})}};class Ht{constructor(t,r){this.zoom=t,r?(this.now=r.now||0,this.fadeDuration=r.fadeDuration||0,this.zoomHistory=r.zoomHistory||new Bl,this.transition=r.transition||{},this.globalState=r.globalState||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Bl,this.transition={},this.globalState={})}isSupportedScript(t){return function(r,s){for(const c of r)if(!vh(c.charCodeAt(0),s))return!1;return!0}(t,za.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 In{constructor(t,r){this.property=t,this.value=r,this.expression=function(s,c){if(as(s))return new yn(s,c);if(_o(s)){const p=Il(s,c);if(p.result==="error")throw new Error(p.value.map(d=>`${d.key}: ${d.message}`).join(", "));return p.value}{let p=s;return c.type==="color"&&typeof s=="string"?p=gt.parse(s):c.type!=="padding"||typeof s!="number"&&!Array.isArray(s)?c.type!=="numberArray"||typeof s!="number"&&!Array.isArray(s)?c.type!=="colorArray"||typeof s!="string"&&!Array.isArray(s)?c.type==="variableAnchorOffsetCollection"&&Array.isArray(s)?p=Tt.parse(s):c.type==="projectionDefinition"&&typeof s=="string"&&(p=lt.parse(s)):p=Er.parse(s):p=Qr.parse(s):p=gr.parse(s),{globalStateRefs:new Set,kind:"constant",evaluate:()=>p}}}(r===void 0?t.specification.default:r,t.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(t,r,s){return this.property.possiblyEvaluate(this,t,r,s)}}class ko{constructor(t){this.property=t,this.value=new In(t,void 0)}transitioned(t,r){return new cu(this.property,this.value,r,wr({},t.transition,this.transition),t.now)}untransitioned(){return new cu(this.property,this.value,null,{},0)}}class $l{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return hr(this._values[t].value.value)}setValue(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new ko(this._values[t].property)),this._values[t].value=new In(this._values[t].property,r===null?void 0:hr(r))}getTransition(t){return hr(this._values[t].transition)}setTransition(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new ko(this._values[t].property)),this._values[t].transition=hr(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 c=this.getTransition(r);c!==void 0&&(t[`${r}-transition`]=c)}return t}transitioned(t,r){const s=new uu(this._properties);for(const c of Object.keys(this._values))s._values[c]=this._values[c].transitioned(t,r._values[c]);return s}untransitioned(){const t=new uu(this._properties);for(const r of Object.keys(this._values))t._values[r]=this._values[r].untransitioned();return t}}class cu{constructor(t,r,s,c,p){this.property=t,this.value=r,this.begin=p+c.delay||0,this.end=this.begin+c.duration||0,t.specification.transition&&(c.delay||c.duration)&&(this.prior=s)}possiblyEvaluate(t,r,s){const c=t.now||0,p=this.value.possiblyEvaluate(t,r,s),d=this.prior;if(d){if(c>this.end)return this.prior=null,p;if(this.value.isDataDriven())return this.prior=null,p;if(c<this.begin)return d.possiblyEvaluate(t,r,s);{const g=(c-this.begin)/(this.end-this.begin);return this.property.interpolate(d.possiblyEvaluate(t,r,s),p,yi(g))}}return p}}class uu{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,r,s){const c=new Eo(this._properties);for(const p of Object.keys(this._values))c._values[p]=this._values[p].possiblyEvaluate(t,r,s);return c}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class bh{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return this._values[t].value!==void 0}getValue(t){return hr(this._values[t].value)}setValue(t,r){this._values[t]=new In(this._values[t].property,r===null?void 0:hr(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 c=new Eo(this._properties);for(const p of Object.keys(this._values))c._values[p]=this._values[p].possiblyEvaluate(t,r,s);return c}}class oa{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,c){return this.property.evaluate(this.value,this.parameters,t,r,s,c)}}class Eo{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class Ge{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 c=bi[this.specification.type];return c?c(t,r,s):t}}class tt{constructor(t,r){this.specification=t,this.overrides=r}possiblyEvaluate(t,r,s,c){return new oa(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(r,null,{},s,c)}: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 oa(this,{kind:"constant",value:void 0},t.parameters);const c=bi[this.specification.type];if(c){const p=c(t.value.value,r.value.value,s);return new oa(this,{kind:"constant",value:p},t.parameters)}return t}evaluate(t,r,s,c,p,d){return t.kind==="constant"?t.value:t.evaluate(r,s,c,p,d)}}class zo extends tt{possiblyEvaluate(t,r,s,c){if(t.value===void 0)return new oa(this,{kind:"constant",value:void 0},r);if(t.expression.kind==="constant"){const p=t.expression.evaluate(r,null,{},s,c),d=t.property.specification.type==="resolvedImage"&&typeof p!="string"?p.name:p,g=this._calculate(d,d,d,r);return new oa(this,{kind:"constant",value:g},r)}if(t.expression.kind==="camera"){const p=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 oa(this,{kind:"constant",value:p},r)}return new oa(this,t.expression,r)}evaluate(t,r,s,c,p,d){if(t.kind==="source"){const g=t.evaluate(r,s,c,p,d);return this._calculate(g,g,g,r)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(r.zoom)-1},s,c),t.evaluate({zoom:Math.floor(r.zoom)},s,c),t.evaluate({zoom:Math.floor(r.zoom)+1},s,c),r):t.value}_calculate(t,r,s,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:s,to:r}}interpolate(t){return t}}class Vl{constructor(t){this.specification=t}possiblyEvaluate(t,r,s,c){if(t.value!==void 0){if(t.expression.kind==="constant"){const p=t.expression.evaluate(r,null,{},s,c);return this._calculate(p,p,p,r)}return this._calculate(t.expression.evaluate(new Ht(Math.floor(r.zoom-1),r)),t.expression.evaluate(new Ht(Math.floor(r.zoom),r)),t.expression.evaluate(new Ht(Math.floor(r.zoom+1),r)),r)}}_calculate(t,r,s,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:s,to:r}}interpolate(t){return t}}class An{constructor(t){this.specification=t}possiblyEvaluate(t,r,s,c){return!!t.expression.evaluate(r,null,{},s,c)}interpolate(){return!1}}class ni{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 c=this.defaultPropertyValues[r]=new In(s,void 0),p=this.defaultTransitionablePropertyValues[r]=new ko(s);this.defaultTransitioningPropertyValues[r]=p.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=c.possiblyEvaluate({})}}}$e("DataDrivenProperty",tt),$e("DataConstantProperty",Ge),$e("CrossFadedDataDrivenProperty",zo),$e("CrossFadedProperty",Vl),$e("ColorRampProperty",An);const hu="-transition";class Zr extends Pe{constructor(t,r){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},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,this._featureFilter=ka(t.filter)),r.layout&&(this._unevaluatedLayout=new bh(r.layout)),r.paint)){this._transitionablePaint=new $l(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 Eo(r.paint)}}setFilter(t){this.filter=t,this._featureFilter=ka(t)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return t==="visibility"?this.visibility:this._unevaluatedLayout.getValue(t)}getLayoutAffectingGlobalStateRefs(){const t=new Set;if(this._unevaluatedLayout)for(const r in this._unevaluatedLayout._values){const s=this._unevaluatedLayout._values[r];for(const c of s.getGlobalStateRefs())t.add(c)}for(const r of this._featureFilter.getGlobalStateRefs())t.add(r);return t}setLayoutProperty(t,r,s={}
5){r!=null&&this._validate(Ll,`layers.${this.id}.layout.${t}`,t,r,s)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,r):this.visibility=r)}getPaintProperty(t){return t.endsWith(hu)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,r,s={}){if(r!=null&&this._validate(_h,`layers.${this.id}.paint.${t}`,t,r,s))return!1;if(t.endsWith(hu))return this._transitionablePaint.setTransition(t.slice(0,-11),r||void 0),!1;{const c=this._transitionablePaint._values[t],p=c.property.specification["property-type"]==="cross-faded-data-driven",d=c.value.isDataDriven(),g=c.value;this._transitionablePaint.setValue(t,r),this._handleSpecialPaintPropertyUpdate(t);const y=this._transitionablePaint._values[t].value;return y.isDataDriven()||d||p||this._handleOverridablePaintPropertyUpdate(t,g,y)}}_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)}
5serialize(){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),Sr(t,(r,s)=>!(r===void 0||s==="layout"&&!Object.keys(r).length||s==="paint"&&!Object.keys(r).length))}_validate(t,r,s,c,p={}){return(!p||p.validate!==!1)&&Tn(this,t.call(Os,{key:r,layerType:this.type,objectKey:s,value:c,styleSpec:se,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 oa&&Ps(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const pu={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class ss{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 Jt{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 ar(a,t=1){let r=0,s=0;return{members:a.map(c=>{const p=pu[c.type].BYTES_PER_ELEMENT,d=r=du(r,Math.max(t,p)),g=c.components||1;return s=Math.max(s,p),r+=p*g,{name:c.name,type:c.type,components:g,offset:d}}),size:du(r,Math.max(s,t)),alignment:t}}function du(a,t){return Math.ceil(a/t)*t}class Da extends Jt{_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 c=2*t;return this.int16[c+0]=r,this.int16[c+1]=s,t}}Da.prototype.bytesPerElement=4,$e("StructArrayLayout2i4",Da);class La extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s){const c=this.length;return this.resize(c+1),this.emplace(c,t,r,s)}emplace(t,r,s,c){const p=3*t;return this.int16[p+0]=r,this.int16[p+1]=s,this.int16[p+2]=c,t}}La.prototype.bytesPerElement=6,$e("StructArrayLayout3i6",La);class Zl extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,c){const p=this.length;return this.resize(p+1),this.emplace(p,t,r,s,c)}emplace(t,r,s,c,p){const d=4*t;return this.int16[d+0]=r,this.int16[d+1]=s,this.int16[d+2]=c,this.int16[d+3]=p,t}}Zl.prototype.bytesPerElement=8,$e("StructArrayLayout4i8",Zl);class Do extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,c,p,d){const g=this.length;return this.resize(g+1),this.emplace(g,t,r,s,c,p,d)}emplace(t,r,s,c,p,d,g){const y=6*t;return this.int16[y+0]=r,this.int16[y+1]=s,this.int16[y+2]=c,this.int16[y+3]=p,this.int16[y+4]=d,this.int16[y+5]=g,t}}Do.prototype.bytesPerElement=12,$e("StructArrayLayout2i4i12",Do);class ns extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,c,p,d){const g=this.length;return this.resize(g+1),this.emplace(g,t,r,s,c,p,d)}emplace(t,r,s,c,p,d,g){const y=4*t,w=8*t;return this.int16[y+0]=r,this.int16[y+1]=s,this.uint8[w+4]=c,this.uint8[w+5]=p,this.uint8[w+6]=d,this.uint8[w+7]=g,t}}ns.prototype.bytesPerElement=8,$e("StructArrayLayout2i4ub8",ns);class Pn extends Jt{_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 c=2*t;return this.float32[c+0]=r,this.float32[c+1]=s,t}}Pn.prototype.bytesPerElement=8,$e("StructArrayLayout2f8",Pn);class ql extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,s,c,p,d,g,y,w,M){const A=this.length;return this.resize(A+1),this.emplace(A,t,r,s,c,p,d,g,y,w,M)}emplace(t,r,s,c,p,d,g,y,w,M,A){const z=10*t;return this.uint16[z+0]=r,this.uint16[z+1]=s,this.uint16[z+2]=c,this.uint16[z+3]=p,this.uint16[z+4]=d,this.uint16[z+5]=g,this.uint16[z+6]=y,this.uint16[z+7]=w,this.uint16[z+8]=M,this.uint16[z+9]=A,t}}ql.prototype.bytesPerElement=20,$e("StructArrayLayout10ui20",ql);class Lo extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,s,c,p,d,g,y,w,M,A,z){const R=this.length;return this.resize(R+1),this.emplace(R,t,r,s,c,p,d,g,y,w,M,A,z)}emplace(t,r,s,c,p,d,g,y,w,M,A,z,R){const B=12*t;return this.int16[B+0]=r,this.int16[B+1]=s,this.int16[B+2]=c,this.int16[B+3]=p,this.uint16[B+4]=d,this.uint16[B+5]=g,this.uint16[B+6]=y,this.uint16[B+7]=w,this.int16[B+8]=M,this.int16[B+9]=A,this.int16[B+10]=z,this.int16[B+11]=R,t}}Lo.prototype.bytesPerElement=24,$e("StructArrayLayout4i4ui4i24",Lo);class Gl extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,s){const c=this.length;return this.resize(c+1),this.emplace(c,t,r,s)}emplace(t,r,s,c){const p=3*t;return this.float32[p+0]=r,this.float32[p+1]=s,this.float32[p+2]=c,t}}Gl.prototype.bytesPerElement=12,$e("StructArrayLayout3f12",Gl);class u extends Jt{_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}}u.prototype.bytesPerElement=4,$e("StructArrayLayout1ul4",u);class e extends Jt{_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,c,p,d,g,y,w){const M=this.length;return this.resize(M+1),this.emplace(M,t,r,s,c,p,d,g,y,w)}emplace(t,r,s,c,p,d,g,y,w,M){const A=10*t,z=5*t;return this.int16[A+0]=r,this.int16[A+1]=s,this.int16[A+2]=c,this.int16[A+3]=p,this.int16[A+4]=d,this.int16[A+5]=g,this.uint32[z+3]=y,this.uint16[A+8]=w,this.uint16[A+9]=M,t}}e.prototype.bytesPerElement=20,$e("StructArrayLayout6i1ul2ui20",e);class i extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,c,p,d){const g=this.length;return this.resize(g+1),this.emplace(g,t,r,s,c,p,d)}emplace(t,r,s,c,p,d,g){const y=6*t;return this.int16[y+0]=r,this.int16[y+1]=s,this.int16[y+2]=c,this.int16[y+3]=p,this.int16[y+4]=d,this.int16[y+5]=g,t}}i.prototype.bytesPerElement=12,$e("StructArrayLayout2i2i2i12",i);
vendor: 6,224 bytes, line 5
5class n extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,c,p){const d=this.length;return this.resize(d+1),this.emplace(d,t,r,s,c,p)}emplace(t,r,s,c,p,d){const g=4*t,y=8*t;return this.float32[g+0]=r,this.float32[g+1]=s,this.float32[g+2]=c,this.int16[y+6]=p,this.int16[y+7]=d,t}}n.prototype.bytesPerElement=16,$e("StructArrayLayout2f1f2i16",n);class l extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,c,p,d){const g=this.length;return this.resize(g+1),this.emplace(g,t,r,s,c,p,d)}emplace(t,r,s,c,p,d,g){const y=16*t,w=4*t,M=8*t;return this.uint8[y+0]=r,this.uint8[y+1]=s,this.float32[w+1]=c,this.float32[w+2]=p,this.int16[M+6]=d,this.int16[M+7]=g,t}}l.prototype.bytesPerElement=16,$e("StructArrayLayout2ub2f2i16",l);class h extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,s){const c=this.length;return this.resize(c+1),this.emplace(c,t,r,s)}emplace(t,r,s,c){const p=3*t;return this.uint16[p+0]=r,this.uint16[p+1]=s,this.uint16[p+2]=c,t}}h.prototype.bytesPerElement=6,$e("StructArrayLayout3ui6",h);class m extends Jt{_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,c,p,d,g,y,w,M,A,z,R,B,j,V,W){const oe=this.length;return this.resize(oe+1),this.emplace(oe,t,r,s,c,p,d,g,y,w,M,A,z,R,B,j,V,W)}emplace(t,r,s,c,p,d,g,y,w,M,A,z,R,B,j,V,W,oe){const Q=24*t,L=12*t,$=48*t;return this.int16[Q+0]=r,this.int16[Q+1]=s,this.uint16[Q+2]=c,this.uint16[Q+3]=p,this.uint32[L+2]=d,this.uint32[L+3]=g,this.uint32[L+4]=y,this.uint16[Q+10]=w,this.uint16[Q+11]=M,this.uint16[Q+12]=A,this.float32[L+7]=z,this.float32[L+8]=R,this.uint8[$+36]=B,this.uint8[$+37]=j,this.uint8[$+38]=V,this.uint32[L+10]=W,this.int16[Q+22]=oe,t}}m.prototype.bytesPerElement=48,$e("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",m);class _ extends Jt{_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,c,p,d,g,y,w,M,A,z,R,B,j,V,W,oe,Q,L,$,te,_e,ze,we,Se,Re,Ee){const Le=this.length;return this.resize(Le+1),this.emplace(Le,t,r,s,c,p,d,g,y,w,M,A,z,R,B,j,V,W,oe,Q,L,$,te,_e,ze,we,Se,Re,Ee)}emplace(t,r,s,c,p,d,g,y,w,M,A,z,R,B,j,V,W,oe,Q,L,$,te,_e,ze,we,Se,Re,Ee,Le){const Me=32*t,qe=16*t;return this.int16[Me+0]=r,this.int16[Me+1]=s,this.int16[Me+2]=c,this.int16[Me+3]=p,this.int16[Me+4]=d,this.int16[Me+5]=g,this.int16[Me+6]=y,this.int16[Me+7]=w,this.uint16[Me+8]=M,this.uint16[Me+9]=A,this.uint16[Me+10]=z,this.uint16[Me+11]=R,this.uint16[Me+12]=B,this.uint16[Me+13]=j,this.uint16[Me+14]=V,this.uint16[Me+15]=W,this.uint16[Me+16]=oe,this.uint16[Me+17]=Q,this.uint16[Me+18]=L,this.uint16[Me+19]=$,this.uint16[Me+20]=te,this.uint16[Me+21]=_e,this.uint16[Me+22]=ze,this.uint32[qe+12]=we,this.float32[qe+13]=Se,this.float32[qe+14]=Re,this.uint16[Me+30]=Ee,this.uint16[Me+31]=Le,t}}_.prototype.bytesPerElement=64,$e("StructArrayLayout8i15ui1ul2f2ui64",_);class v extends Jt{_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}}v.prototype.bytesPerElement=4,$e("StructArrayLayout1f4",v);class S extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,s){const c=this.length;return this.resize(c+1),this.emplace(c,t,r,s)}emplace(t,r,s,c){const p=3*t;return this.uint16[6*t+0]=r,this.float32[p+1]=s,this.float32[p+2]=c,t}}S.prototype.bytesPerElement=12,$e("StructArrayLayout1ui2f12",S);class I extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,s){const c=this.length;return this.resize(c+1),this.emplace(c,t,r,s)}emplace(t,r,s,c){const p=4*t;return this.uint32[2*t+0]=r,this.uint16[p+2]=s,this.uint16[p+3]=c,t}}I.prototype.bytesPerElement=8,$e("StructArrayLayout1ul2ui8",I);class k extends Jt{_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 c=2*t;return this.uint16[c+0]=r,this.uint16[c+1]=s,t}}k.prototype.bytesPerElement=4,$e("StructArrayLayout2ui4",k);class P extends Jt{_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}}P.prototype.bytesPerElement=2,$e("StructArrayLayout1ui2",P);class D extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,s,c){const p=this.length;return this.resize(p+1),this.emplace(p,t,r,s,c)}emplace(t,r,s,c,p){const d=4*t;return this.float32[d+0]=r,this.float32[d+1]=s,this.float32[d+2]=c,this.float32[d+3]=p,t}}D.prototype.bytesPerElement=16,$e("StructArrayLayout4f16",D);class O extends ss{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]}
5get anchorPoint(){return new be(this.anchorPointX,this.anchorPointY)}}O.prototype.size=20;class G extends e{get(t){return new O(this,t)}}$e("CollisionBoxArray",G);class q extends ss{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]}}q.prototype.size=48;class H extends m{get(t){return new q(this,t)}}$e("PlacedSymbolArray",H);class X extends ss{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]}get 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]}}X.prototype.size=64;class ee extends _{get(t){return new X(this,t)}}$e("SymbolInstanceArray",ee);class Y extends v{getoffsetX(t){return this.float32[1*t+0]}}$e("GlyphOffsetArray",Y);class re extends La{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",re);class ae extends ss{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]}}ae.prototype.size=12;class K extends S{get(t){return new ae(this,t)}}$e("TextAnchorOffsetArray",K);class le extends ss{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]}}le.prototype.size=8;class xe extends I{get(t){return new le(this,t)}}$e("FeatureIndexArray",xe);class me extends Da{}class ge extends Da{}class ve extends Da{}class Oe extends Do{}class Be extends ns{}class ke extends Pn{}class Ze extends ql{}class ut extends Lo{}class kt extends Gl{}class Qt extends u{}class Rt extends i{}class er extends l{}class Ot extends h{}class Ft extends k{}const jt=ar([{name:"a_pos",components:2,type:"Int16"}],4),{members:qr}=jt;class St{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,r,s,c){const p=this.segments[this.segments.length-1];return t>St.MAX_VERTEX_ARRAY_LENGTH&&rr(`Max vertices per segment is ${St.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${St.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!p||p.vertexLength+t>St.MAX_VERTEX_ARRAY_LENGTH||p.sortKey!==c?this.createNewSegment(r,s,c):p}createNewSegment(t,r,s){const c={vertexOffset:t.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0,vaos:{}};return s!==void 0&&(c.sortKey=s),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(c),c}getOrCreateLatestSegment(t,r,s){return this.prepareSegment(0,t,r,s)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}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,c){return new St([{vertexOffset:t,primitiveOffset:r,vertexLength:s,primitiveLength:c,vaos:{},sortKey:0}])}}function Dr(a,t){return 256*(a=Gt(Math.floor(a),0,255))+Gt(Math.floor(t),0,255)}St.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,$e("SegmentVector",St);const Lr=ar([{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 Ra,Fa,Ba,la={exports:{}},kn={exports:{}},En={exports:{}},Us=function(){if(Ba)return la.exports;Ba=1;
vendor: 3,485 bytes, line 5
5var a=(Ra||(Ra=1,kn.exports=function(r,s){var c,p,d,g,y,w,M,A;for(p=r.length-(c=3&r.length),d=s,y=3432918353,w=461845907,A=0;A<p;)M=255&r.charCodeAt(A)|(255&r.charCodeAt(++A))<<8|(255&r.charCodeAt(++A))<<16|(255&r.charCodeAt(++A))<<24,++A,d=27492+(65535&(g=5*(65535&(d=(d^=M=(65535&(M=(M=(65535&M)*y+(((M>>>16)*y&65535)<<16)&4294967295)<<15|M>>>17))*w+(((M>>>16)*w&65535)<<16)&4294967295)<<13|d>>>19))+((5*(d>>>16)&65535)<<16)&4294967295))+((58964+(g>>>16)&65535)<<16);switch(M=0,c){case 3:M^=(255&r.charCodeAt(A+2))<<16;case 2:M^=(255&r.charCodeAt(A+1))<<8;case 1:d^=M=(65535&(M=(M=(65535&(M^=255&r.charCodeAt(A)))*y+(((M>>>16)*y&65535)<<16)&4294967295)<<15|M>>>17))*w+(((M>>>16)*w&65535)<<16)&4294967295}return d^=r.length,d=2246822507*(65535&(d^=d>>>16))+((2246822507*(d>>>16)&65535)<<16)&4294967295,d=3266489909*(65535&(d^=d>>>13))+((3266489909*(d>>>16)&65535)<<16)&4294967295,(d^=d>>>16)>>>0}),kn.exports),t=(Fa||(Fa=1,En.exports=function(r,s){for(var c,p=r.length,d=s^p,g=0;p>=4;)c=1540483477*(65535&(c=255&r.charCodeAt(g)|(255&r.charCodeAt(++g))<<8|(255&r.charCodeAt(++g))<<16|(255&r.charCodeAt(++g))<<24))+((1540483477*(c>>>16)&65535)<<16),d=1540483477*(65535&d)+((1540483477*(d>>>16)&65535)<<16)^(c=1540483477*(65535&(c^=c>>>24))+((1540483477*(c>>>16)&65535)<<16)),p-=4,++g;switch(p){case 3:d^=(255&r.charCodeAt(g+2))<<16;case 2:d^=(255&r.charCodeAt(g+1))<<8;case 1:d=1540483477*(65535&(d^=255&r.charCodeAt(g)))+((1540483477*(d>>>16)&65535)<<16)}return d=1540483477*(65535&(d^=d>>>13))+((1540483477*(d>>>16)&65535)<<16),(d^=d>>>15)>>>0}),En.exports);return la.exports=a,la.exports.murmur3=a,la.exports.murmur2=t,la.exports}(),mi=fe(Us);class Xi{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,r,s,c){this.ids.push(Oa(t)),this.positions.push(r,s,c)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=Oa(t);let s=0,c=this.ids.length-1;for(;s<c;){const d=s+c>>1;this.ids[d]>=r?c=d:s=d+1}const p=[];for(;this.ids[s]===r;)p.push({index:this.positions[3*s],start:this.positions[3*s+1],end:this.positions[3*s+2]}),s++;return p}static serialize(t,r){const s=new Float64Array(t.ids),c=new Uint32Array(t.positions);return os(s,c,0,s.length-1),r&&r.push(s.buffer,c.buffer),{ids:s,positions:c}}static deserialize(t){const r=new Xi;return r.ids=t.ids,r.positions=t.positions,r.indexed=!0,r}}function Oa(a){const t=+a;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:mi(String(a))}function os(a,t,r,s){for(;r<s;){const c=a[r+s>>1];let p=r-1,d=s+1;for(;;){do p++;while(a[p]<c);do d--;while(a[d]>c);if(p>=d)break;or(a,p,d),or(t,3*p,3*d),or(t,3*p+1,3*d+1),or(t,3*p+2,3*d+2)}d-r<s-d?(os(a,t,r,d),r=d+1):(os(a,t,d+1,s),s=d)}}function or(a,t,r){const s=a[t];a[t]=a[r],a[r]=s}$e("FeaturePositionMap",Xi);class Vt{constructor(t,r){this.gl=t.gl,this.location=r}}class oi extends Vt{constructor(t,r){super(t,r),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class Mr extends Vt{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 fu extends Vt{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 wh=new Float32Array(16);
5function Hl(a){return[Dr(255*a.r,255*a.g),Dr(255*a.b,255*a.a)]}class zn{constructor(t,r,s){this.value=t,this.uniformNames=r.map(c=>`u_${c}`),this.type=s}setUniform(t,r,s){t.set(s.constantOr(this.value))}getBinding(t,r,s){return this.type==="color"?new fu(t,r):new oi(t,r)}}class $s{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,c){const p=c==="u_pattern_to"?this.patternTo:c==="u_pattern_from"?this.patternFrom:c==="u_pixel_ratio_to"?this.pixelRatioTo:c==="u_pixel_ratio_from"?this.pixelRatioFrom:null;p&&t.set(p)}getBinding(t,r,s){return s.substr(0,9)==="u_pattern"?new Mr(t,r):new oi(t,r)}}class xa{constructor(t,r,s,c){this.expression=t,this.type=s,this.maxValue=0,this.paintVertexAttributes=r.map(p=>({name:`a_${p}`,type:"Float32",components:s==="color"?2:1,offset:0})),this.paintVertexArray=new c}populatePaintArray(t,r,s,c,p){const d=this.paintVertexArray.length,g=this.expression.evaluate(new Ht(0),r,{},c,[],p);this.paintVertexArray.resize(t),this._setPaintValue(d,t,g)}updatePaintArray(t,r,s,c){const p=this.expression.evaluate({zoom:0},s,c);this._setPaintValue(t,r,p)}_setPaintValue(t,r,s){if(this.type==="color"){const c=Hl(s);for(let p=t;p<r;p++)this.paintVertexArray.emplace(p,c[0],c[1])}else{for(let c=t;c<r;c++)this.paintVertexArray.emplace(c,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 Gr{constructor(t,r,s,c,p,d){this.expression=t,this.uniformNames=r.map(g=>`u_${g}_t`),this.type=s,this.useIntegerZoom=c,this.zoom=p,this.maxValue=0,this.paintVertexAttributes=r.map(g=>({name:`a_${g}`,type:"Float32",components:s==="color"?4:2,offset:0})),this.paintVertexArray=new d}populatePaintArray(t,r,s,c,p){const d=this.expression.evaluate(new Ht(this.zoom),r,{},c,[],p),g=this.expression.evaluate(new Ht(this.zoom+1),r,{},c,[],p),y=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(y,t,d,g)}updatePaintArray(t,r,s,c){const p=this.expression.evaluate({zoom:this.zoom},s,c),d=this.expression.evaluate({zoom:this.zoom+1},s,c);this._setPaintValue(t,r,p,d)}_setPaintValue(t,r,s,c){if(this.type==="color"){const p=Hl(s),d=Hl(c);for(let g=t;g<r;g++)this.paintVertexArray.emplace(g,p[0],p[1],d[0],d[1])}else{for(let p=t;p<r;p++)this.paintVertexArray.emplace(p,s,c);this.maxValue=Math.max(this.maxValue,Math.abs(s),Math.abs(c))}}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,c=Gt(this.expression.interpolationFactor(s,this.zoom,this.zoom+1),0,1);t.set(c)}getBinding(t,r,s){return new oi(t,r)}}class va{constructor(t,r,s,c,p,d){this.expression=t,this.type=r,this.useIntegerZoom=s,this.zoom=c,this.layerId=d,this.zoomInPaintVertexArray=new p,this.zoomOutPaintVertexArray=new p}populatePaintArray(t,r,s){const c=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(c,t,r.patterns&&r.patterns[this.layerId],s)}updatePaintArray(t,r,s,c,p){this._setPaintValues(t,r,s.patterns&&s.patterns[this.layerId],p)}_setPaintValues(t,r,s,c){if(!c||!s)return;const{min:p,mid:d,max:g}=s,y=c[p],w=c[d],M=c[g];if(y&&w&&M)for(let A=t;A<r;A++)this.zoomInPaintVertexArray.emplace(A,w.tl[0],w.tl[1],w.br[0],w.br[1],y.tl[0],y.tl[1],y.br[0],y.br[1],w.pixelRatio,y.pixelRatio),this.zoomOutPaintVertexArray.emplace(A,w.tl[0],w.tl[1],w.br[0],w.br[1],M.tl[0],M.tl[1],M.br[0],M.br[1],w.pixelRatio,M.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,Lr.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,Lr.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Wl{constructor(t,r,s){this.binders={},this._buffers=[];const c=[];for(const p in t.paint._values){if(!s(p))continue;const d=t.paint.get(p);if(!(d instanceof oa&&Ps(d.property.specification)))continue;const g=Xl(p,t.type),y=d.value,w=d.property.specification.type,M=d.property.useIntegerZoom,A=d.property.specification["property-type"],z=A==="cross-faded"||A==="cross-faded-data-driven";if(y.kind==="constant")this.binders[p]=z?new $s(y.value,g):new zn(y.value,g,w),c.push(`/u_${p}`);else if(y.kind==="source"||z){const R=Yl(p,w,"source");this.binders[p]=z?new va(y,w,M,r,R,t.id):new xa(y,g,w,R),c.push(`/a_${p}`)}else{const R=Yl(p,w,"composite");this.binders[p]=new Gr(y,g,w,M,r,R),c.push(`/z_${p}`)}}this.cacheKey=c.sort().join("")}getMaxValue(t){const r=this.binders[t];return r instanceof xa||r instanceof Gr?r.maxValue:0}populatePaintArrays(t,r,s,c,p){for(const d in this.binders){const g=this.binders[d];(g instanceof xa||g instanceof Gr||g instanceof va)&&g.populatePaintArray(t,r,s,c,p)}}setConstantPatternPositions(t,r){for(const s in this.binders){const c=this.binders[s];c instanceof $s&&c.setConstantPatternPositions(t,r)}}updatePaintArrays(t,r,s,c,p){let d=!1;for(const g in t){const y=r.getPositions(g);for(const w of y){const M=s.feature(w.index);for(const A in this.binders){const z=this.binders[A];if((z instanceof xa||z instanceof Gr||z instanceof va)&&z.expression.isStateDependent===!0){const R=c.paint.get(A);z.expression=R.value,z.updatePaintArray(w.start,w.end,M,t[g],p),d=!0}}}}return d}defines(){const t=[];for(const r in this.binders){const s=this.binders[r];
5(s instanceof zn||s instanceof $s)&&t.push(...s.uniformNames.map(c=>`#define HAS_UNIFORM_${c}`))}return t}getBinderAttributes(){const t=[];for(const r in this.binders){const s=this.binders[r];if(s instanceof xa||s instanceof Gr)for(let c=0;c<s.paintVertexAttributes.length;c++)t.push(s.paintVertexAttributes[c].name);else if(s instanceof va)for(let c=0;c<Lr.members.length;c++)t.push(Lr.members[c].name)}return t}getBinderUniforms(){const t=[];for(const r in this.binders){const s=this.binders[r];if(s instanceof zn||s instanceof $s||s instanceof Gr)for(const c of s.uniformNames)t.push(c)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,r){const s=[];for(const c in this.binders){const p=this.binders[c];if(p instanceof zn||p instanceof $s||p instanceof Gr){for(const d of p.uniformNames)if(r[d]){const g=p.getBinding(t,r[d],d);s.push({name:d,property:c,binding:g})}}}return s}setUniforms(t,r,s,c){for(const{name:p,property:d,binding:g}of r)this.binders[d].setUniform(g,c,s.get(d),p)}updatePaintBuffers(t){this._buffers=[];for(const r in this.binders){const s=this.binders[r];if(t&&s instanceof va){const c=t.fromScale===2?s.zoomInPaintVertexBuffer:s.zoomOutPaintVertexBuffer;c&&this._buffers.push(c)}else(s instanceof xa||s instanceof Gr)&&s.paintVertexBuffer&&this._buffers.push(s.paintVertexBuffer)}}upload(t){for(const r in this.binders){const s=this.binders[r];(s instanceof xa||s instanceof Gr||s instanceof va)&&s.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const r=this.binders[t];(r instanceof xa||r instanceof Gr||r instanceof va)&&r.destroy()}}}class ja{constructor(t,r,s=()=>!0){this.programConfigurations={};for(const c of t)this.programConfigurations[c.id]=new Wl(c,r,s);this.needsUpload=!1,this._featureMap=new Xi,this._bufferOffset=0}populatePaintArrays(t,r,s,c,p,d){for(const g in this.programConfigurations)this.programConfigurations[g].populatePaintArrays(t,r,c,p,d);r.id!==void 0&&this._featureMap.add(r.id,s,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,r,s,c){for(const p of s)this.needsUpload=this.programConfigurations[p.id].updatePaintArrays(t,this._featureMap,r,p,c)||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 Xl(a,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"]}[a]||[a.replace(`${t}-`,"").replace(/-/g,"_")]}function Yl(a,t,r){const s={color:{source:Pn,composite:D},number:{source:v,composite:Pn}},c=function(p){return{"line-pattern":{source:Ze,composite:Ze},"fill-pattern":{source:Ze,composite:Ze},"fill-extrusion-pattern":{source:Ze,composite:Ze}}[p]}(a);return c&&c[r]||s[t][r]}$e("ConstantBinder",zn),$e("CrossFadedConstantBinder",$s),$e("SourceExpressionBinder",xa),$e("CrossFadedCompositeBinder",va),$e("CompositeExpressionBinder",Gr),$e("ProgramConfiguration",Wl,{omit:["_buffers"]}),$e("ProgramConfigurationSet",ja);const Dn=Math.pow(2,14)-1,ud=-Dn-1;function Ln(a){const t=Ct/a.extent,r=a.loadGeometry();for(let s=0;s<r.length;s++){const c=r[s];for(let p=0;p<c.length;p++){const d=c[p],g=Math.round(d.x*t),y=Math.round(d.y*t);d.x=Gt(g,ud,Dn),d.y=Gt(y,ud,Dn),(g<d.x||g>d.x+1||y<d.y||y>d.y+1)&&rr("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function Rn(a,t){return{type:a.type,id:a.id,properties:a.properties,geometry:t?Ln(a):[]}}const hd=-32768;function ag(a,t,r,s,c){a.emplaceBack(hd+8*t+s,hd+8*r+c)}class Th{constructor(t){this.zoom=t.zoom,this.globalState=t.globalState,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 ge,this.indexArray=new Ot,this.segments=new St,this.programConfigurations=new ja(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,s){const c=this.layers[0],p=[];let d=null,g=!1,y=c.type==="heatmap";if(c.type==="circle"){const M=c;
5d=M.layout.get("circle-sort-key"),g=!d.isConstant(),y=y||M.paint.get("circle-pitch-alignment")==="map"}const w=y?r.subdivisionGranularity.circle:1;for(const{feature:M,id:A,index:z,sourceLayerIndex:R}of t){const B=this.layers[0]._featureFilter.needGeometry,j=Rn(M,B);if(!this.layers[0]._featureFilter.filter(new Ht(this.zoom,{globalState:this.globalState}),j,s))continue;const V=g?d.evaluate(j,{},s):void 0,W={id:A,properties:M.properties,type:M.type,sourceLayerIndex:R,index:z,geometry:B?j.geometry:Ln(M),patterns:{},sortKey:V};p.push(W)}g&&p.sort((M,A)=>M.sortKey-A.sortKey);for(const M of p){const{geometry:A,index:z,sourceLayerIndex:R}=M,B=t[z].feature;this.addFeature(M,A,z,s,w),r.featureIndex.insert(B,A,z,R,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,qr),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,c,p=1){let d;switch(p){case 1:d=[0,7];break;case 3:d=[0,2,5,7];break;case 5:d=[0,1,3,4,6,7];break;case 7:d=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${p}; valid values are 1, 3, 5, 7.`)}const g=d.length;for(const y of r)for(const w of y){const M=w.x,A=w.y;if(M<0||M>=Ct||A<0||A>=Ct)continue;const z=this.segments.prepareSegment(g*g,this.layoutVertexArray,this.indexArray,t.sortKey),R=z.vertexLength;for(let B=0;B<g;B++)for(let j=0;j<g;j++)ag(this.layoutVertexArray,M,A,d[j],d[B]);for(let B=0;B<g-1;B++)for(let j=0;j<g-1;j++){const V=R+B*g+j,W=R+(B+1)*g+j;this.indexArray.emplaceBack(V,W+1,V+1),this.indexArray.emplaceBack(V,W,W+1)}z.vertexLength+=g*g,z.primitiveLength+=(g-1)*(g-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,s,{},c)}}function pd(a,t){for(let r=0;r<a.length;r++)if(Ro(t,a[r]))return!0;for(let r=0;r<t.length;r++)if(Ro(a,t[r]))return!0;return!!Sh(a,t)}function sg(a,t,r){return!!Ro(a,t)||!!Ch(t,a,r)}function dd(a,t){if(a.length===1)return md(t,a[0]);for(let r=0;r<t.length;r++){const s=t[r];for(let c=0;c<s.length;c++)if(Ro(a,s[c]))return!0}for(let r=0;r<a.length;r++)if(md(t,a[r]))return!0;for(let r=0;r<t.length;r++)if(Sh(a,t[r]))return!0;return!1}function ng(a,t,r){if(a.length>1){if(Sh(a,t))return!0;for(let s=0;s<t.length;s++)if(Ch(t[s],a,r))return!0}for(let s=0;s<a.length;s++)if(Ch(a[s],t,r))return!0;return!1}function Sh(a,t){if(a.length===0||t.length===0)return!1;for(let r=0;r<a.length-1;r++){const s=a[r],c=a[r+1];for(let p=0;p<t.length-1;p++)if(og(s,c,t[p],t[p+1]))return!0}return!1}function og(a,t,r,s){return Cr(a,r,s)!==Cr(t,r,s)&&Cr(a,t,r)!==Cr(a,t,s)}function Ch(a,t,r){const s=r*r;if(t.length===1)return a.distSqr(t[0])<s;for(let c=1;c<t.length;c++)if(fd(a,t[c-1],t[c])<s)return!0;return!1}function fd(a,t,r){const s=t.distSqr(r);if(s===0)return a.distSqr(t);const c=((a.x-t.x)*(r.x-t.x)+(a.y-t.y)*(r.y-t.y))/s;return a.distSqr(c<0?t:c>1?r:r.sub(t)._mult(c)._add(t))}function md(a,t){let r,s,c,p=!1;for(let d=0;d<a.length;d++){r=a[d];for(let g=0,y=r.length-1;g<r.length;y=g++)s=r[g],c=r[y],s.y>t.y!=c.y>t.y&&t.x<(c.x-s.x)*(t.y-s.y)/(c.y-s.y)+s.x&&(p=!p)}return p}function Ro(a,t){let r=!1;for(let s=0,c=a.length-1;s<a.length;c=s++){const p=a[s],d=a[c];p.y>t.y!=d.y>t.y&&t.x<(d.x-p.x)*(t.y-p.y)/(d.y-p.y)+p.x&&(r=!r)}return r}function lg(a,t,r){const s=r[0],c=r[2];if(a.x<s.x&&t.x<s.x||a.x>c.x&&t.x>c.x||a.y<s.y&&t.y<s.y||a.y>c.y&&t.y>c.y)return!1;const p=Cr(a,t,r[0]);return p!==Cr(a,t,r[1])||p!==Cr(a,t,r[2])||p!==Cr(a,t,r[3])}function Kl(a,t,r){const s=t.paint.get(a).value;return s.kind==="constant"?s.value:r.programConfigurations.get(t.id).getMaxValue(a)}function mu(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1])}function gu(a,t,r,s,c){if(!t[0]&&!t[1])return a;const p=be.convert(t)._mult(c);r==="viewport"&&p._rotate(-s);const d=[];for(let g=0;g<a.length;g++)d.push(a[g].sub(p));return d}let gd,_d;$e("CircleBucket",Th,{omit:["layers"]});var cg={get paint(){return _d=_d||new ni({"circle-radius":new tt(se.paint_circle["circle-radius"]),"circle-color":new tt(se.paint_circle["circle-color"]),"circle-blur":new tt(se.paint_circle["circle-blur"]),"circle-opacity":new tt(se.paint_circle["circle-opacity"]),"circle-translate":new Ge(se.paint_circle["circle-translate"]),"circle-translate-anchor":new Ge(se.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ge(se.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ge(se.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new tt(se.paint_circle["circle-stroke-width"]),"circle-stroke-color":new tt(se.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new tt(se.paint_circle["circle-stroke-opacity"])})},get layout(){return gd=gd||new ni({"circle-sort-key":new tt(se.layout_circle["circle-sort-key"])})}};class ug extends Zr{constructor(t){super(t,cg)}createBucket(t){return new Th(t)}queryRadius(t){const r=t;return Kl("circle-radius",this,r)+Kl("circle-stroke-width",this,r)+mu(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:r,featureState:s,geometry:c,transform:p,pixelsToTileUnits:d,unwrappedTileID:g,getElevation:y}){const w=gu(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-p.bearingInRadians,d),M=this.paint.get("circle-radius").evaluate(r,s)+this.paint.get("circle-stroke-width").evaluate(r,s),A=this.paint.get("circle-pitch-alignment")==="map",z=A?w:function(B,j,V,W){return B.map(oe=>yd(oe,j,V,W))}(w,p,g,y),R=A?M*d:M;for(const B of c)for(const j of B){const V=A?j:yd(j,p,g,y);let W=R;const oe=p.projectTileCoordinates(j.x,j.y,g,y).signedDistanceFromCamera;if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?W*=oe/p.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(W*=p.cameraToCenterDistance/oe),sg(z,V,W))return!0}return!1}}function yd(a,t,r,s){const c=t.projectTileCoordinates(a.x,a.y,r,s).point;return new be((.5*c.x+.5)*t.width,(.5*-c.y+.5)*t.height)}class xd extends Th{}let vd;$e("HeatmapBucket",xd,{omit:["layers"]});var hg={get paint(){return vd=vd||new ni({"heatmap-radius":new tt(se.paint_heatmap["heatmap-radius"]),"heatmap-weight":new tt(se.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ge(se.paint_heatmap["heatmap-intensity"]),"heatmap-color":new An(se.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ge(se.paint_heatmap["heatmap-opacity"])})}};function Mh(a,{width:t,height:r},s,c){if(c){if(c instanceof Uint8ClampedArray)c=new Uint8Array(c.buffer);else if(c.length!==t*r*s)throw new RangeError(`mismatched image size. expected: ${c.length} but got: ${t*r*s}`)}else c=new Uint8Array(t*r*s);return a.width=t,a.height=r,a.data=c,a}function bd(a,{width:t,height:r},s){if(t===a.width&&r===a.height)return;const c=Mh({},{width:t,height:r},s);Ih(a,c,{x:0,y:0},{x:0,y:0},{width:Math.min(a.width,t),height:Math.min(a.height,r)},s),a.width=t,a.height=r,a.data=c.data}function Ih(a,t,r,s,c,p){if(c.width===0||c.height===0)return t;if(c.width>a.width||c.height>a.height||r.x>a.width-c.width||r.y>a.height-c.height)throw new RangeError("out of range source coordinates for image copy");if(c.width>t.width||c.height>t.height||s.x>t.width-c.width||s.y>t.height-c.height)throw new RangeError("out of range destination coordinates for image copy");const d=a.data,g=t.data;if(d===g)throw new Error("srcData equals dstData, so image is already copied");for(let y=0;y<c.height;y++){const w=((r.y+y)*a.width+r.x)*p,M=((s.y+y)*t.width+s.x)*p;for(let A=0;A<c.width*p;A++)g[M+A]=d[w+A]}
5return t}class Jl{constructor(t,r){Mh(this,t,1,r)}resize(t){bd(this,t,1)}clone(){return new Jl({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,s,c,p){Ih(t,r,s,c,p,1)}}class wi{constructor(t,r){Mh(this,t,4,r)}resize(t){bd(this,t,4)}replace(t,r){r?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new wi({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,s,c,p){Ih(t,r,s,c,p,4)}setPixel(t,r,s){const c=4*(t*this.width+r);this.data[c+0]=Math.round(255*s.r/s.a),this.data[c+1]=Math.round(255*s.g/s.a),this.data[c+2]=Math.round(255*s.b/s.a),this.data[c+3]=Math.round(255*s.a)}}function wd(a){const t={},r=a.resolution||256,s=a.clips?a.clips.length:1,c=a.image||new wi({width:r,height:s});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const p=(d,g,y)=>{t[a.evaluationKey]=y;const w=a.expression.evaluate(t);c.setPixel(d/4/r,g/4,w)};if(a.clips)for(let d=0,g=0;d<s;++d,g+=4*r)for(let y=0,w=0;y<r;y++,w+=4){const M=y/(r-1),{start:A,end:z}=a.clips[d];p(g,w,A*(1-M)+z*M)}else for(let d=0,g=0;d<r;d++,g+=4)p(0,g,d/(r-1));return c}$e("AlphaImage",Jl),$e("RGBAImage",wi);const Ah="big-fb";class pg extends Zr{createBucket(t){return new xd(t)}constructor(t){super(t,hg),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=wd({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Ah)&&this.heatmapFbos.delete(Ah)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let Td;var dg={get paint(){return Td=Td||new ni({"hillshade-illumination-direction":new Ge(se.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new Ge(se.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new Ge(se.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ge(se.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ge(se.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ge(se.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ge(se.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new Ge(se.paint_hillshade["hillshade-method"])})}};class fg extends Zr{constructor(t){super(t,dg),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let t=this.paint.get("hillshade-illumination-direction").values,r=this.paint.get("hillshade-illumination-altitude").values,s=this.paint.get("hillshade-highlight-color").values,c=this.paint.get("hillshade-shadow-color").values;const p=Math.max(t.length,r.length,s.length,c.length);t=t.concat(Array(p-t.length).fill(t.at(-1))),r=r.concat(Array(p-r.length).fill(r.at(-1))),s=s.concat(Array(p-s.length).fill(s.at(-1))),c=c.concat(Array(p-c.length).fill(c.at(-1)));const d=r.map(Kr);return{directionRadians:t.map(Kr),altitudeRadians:d,shadowColor:c,highlightColor:s}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}let Sd;var mg={get paint(){return Sd=Sd||new ni({"color-relief-opacity":new Ge(se["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new An(se["paint_color-relief"]["color-relief-color"])})}};class Ph{constructor(t,r,s,c){this.context=t,this.format=s,this.texture=t.gl.createTexture(),this.update(r,c)}update(t,r,s){const{width:c,height:p}=t,d=!(this.size&&this.size[0]===c&&this.size[1]===p||s),{context:g}=this,{gl:y}=g;if(this.useMipmap=!!(r&&r.useMipmap),y.bindTexture(y.TEXTURE_2D,this.texture),g.pixelStoreUnpackFlipY.set(!1),g.pixelStoreUnpack.set(1),g.pixelStoreUnpackPremultiplyAlpha.set(this.format===y.RGBA&&(!r||r.premultiply!==!1)),d)this.size=[c,p],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||ui(t)?y.texImage2D(y.TEXTURE_2D,0,this.format,this.format,y.UNSIGNED_BYTE,t):y.texImage2D(y.TEXTURE_2D,0,this.format,c,p,0,this.format,y.UNSIGNED_BYTE,t.data);else{const{x:w,y:M}=s||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||ui(t)?y.texSubImage2D(y.TEXTURE_2D,0,w,M,y.RGBA,y.UNSIGNED_BYTE,t):y.texSubImage2D(y.TEXTURE_2D,0,w,M,c,p,y.RGBA,y.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&y.generateMipmap(y.TEXTURE_2D),g.pixelStoreUnpackFlipY.setDefault(),g.pixelStoreUnpack.setDefault(),g.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(t,r,s){const{context:c}=this,{gl:p}=c;p.bindTexture(p.TEXTURE_2D,this.texture),s!==p.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=p.LINEAR),t!==this.filter&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,t),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,s||t),this.filter=t),r!==this.wrap&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,r),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,r),this.wrap=r)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}class Cd{constructor(t,r,s,c=1,p=1,d=1,g=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 rr(`"${s}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=r.height;const y=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;
5case"custom":this.redFactor=c,this.greenFactor=p,this.blueFactor=d,this.baseShift=g;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let w=0;w<y;w++)this.data[this._idx(-1,w)]=this.data[this._idx(0,w)],this.data[this._idx(y,w)]=this.data[this._idx(y-1,w)],this.data[this._idx(w,-1)]=this.data[this._idx(w,0)],this.data[this._idx(w,y)]=this.data[this._idx(w,y-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(y,-1)]=this.data[this._idx(y-1,0)],this.data[this._idx(-1,y)]=this.data[this._idx(0,y-1)],this.data[this._idx(y,y)]=this.data[this._idx(y-1,y-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let w=0;w<y;w++)for(let M=0;M<y;M++){const A=this.get(w,M);A>this.max&&(this.max=A),A<this.min&&(this.min=A)}}get(t,r){const s=new Uint8Array(this.data.buffer),c=4*this._idx(t,r);return this.unpack(s[c],s[c+1],s[c+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}pack(t){return Md(t,this.getUnpackVector())}getPixels(){return new wi({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 c=r*this.dim,p=r*this.dim+this.dim,d=s*this.dim,g=s*this.dim+this.dim;switch(r){case-1:c=p-1;break;case 1:p=c+1}switch(s){case-1:d=g-1;break;case 1:g=d+1}const y=-r*this.dim,w=-s*this.dim;for(let M=d;M<g;M++)for(let A=c;A<p;A++)this.data[this._idx(A,M)]=t.data[this._idx(A+y,M+w)]}}function Md(a,t){const r=t[0],s=t[1],c=t[2],p=t[3],d=Math.min(r,s,c),g=Math.round((a+p)/d);return{r:Math.floor(g*d/r)%256,g:Math.floor(g*d/s)%256,b:Math.floor(g*d/c)%256}}$e("DEMData",Cd);class gg extends Zr{constructor(t){super(t,mg)}_createColorRamp(t){const r={elevationStops:[],colorStops:[]},s=this._transitionablePaint._values["color-relief-color"].value.expression;if(s instanceof _n&&s._styleExpression.expression instanceof ai){this.colorRampExpression=s;const d=s._styleExpression.expression;r.elevationStops=d.labels,r.colorStops=[];for(const g of r.elevationStops)r.colorStops.push(d.evaluate({globals:{elevation:g}}))}if(r.elevationStops.length<1&&(r.elevationStops=[0],r.colorStops=[gt.transparent]),r.elevationStops.length<2&&(r.elevationStops.push(r.elevationStops[0]+1),r.colorStops.push(r.colorStops[0])),r.elevationStops.length<=t)return r;const c={elevationStops:[],colorStops:[]},p=(r.elevationStops.length-1)/(t-1);for(let d=0;d<r.elevationStops.length-.5;d+=p)c.elevationStops.push(r.elevationStops[Math.round(d)]),c.colorStops.push(r.colorStops[Math.round(d)]);return rr(`Too many colors in specification of ${this.id} color-relief layer, may not render properly.`),c}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(t,r,s){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;const c=this._createColorRamp(r),p=new wi({width:c.colorStops.length,height:1}),d=new wi({width:c.colorStops.length,height:1});for(let g=0;g<c.elevationStops.length;g++){const y=Md(c.elevationStops[g],s);d.setPixel(0,g,new gt(y.r/255,y.g/255,y.b/255,1)),p.setPixel(0,g,c.colorStops[g])}return this.colorRampTextures={elevationTexture:new Ph(t,d,t.gl.RGBA),colorTexture:new Ph(t,p,t.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return this.visibility!=="none"&&!!this.colorRampTextures}}const _g=ar([{name:"a_pos",components:2,type:"Int16"}],4),{members:yg}=_g;function kh(a,t,r){const s=r.patternDependencies;let c=!1;for(const p of t){const d=p.paint.get(`${a}-pattern`);d.isConstant()||(c=!0);const g=d.constantOr(null);g&&(c=!0,s[g.to]=!0,s[g.from]=!0)}return c}function Eh(a,t,r,s,c){const p=c.patternDependencies;for(const d of t){const g=d.paint.get(`${a}-pattern`).value;if(g.kind!=="constant"){let y=g.evaluate({zoom:s-1},r,{},c.availableImages),w=g.evaluate({zoom:s},r,{},c.availableImages),M=g.evaluate({zoom:s+1},r,{},c.availableImages);y=y&&y.name?y.name:y,w=w&&w.name?w.name:w,M=M&&M.name?M.name:M,p[y]=!0,p[w]=!0,p[M]=!0,r.patterns[d.id]={min:y,mid:w,max:M}}}return r}function Id(a,t,r,s,c){let p;if(c===function(d,g,y,w){let M=0;for(let A=g,z=y-w;A<y;A+=w)M+=(d[z]-d[A])*(d[A+1]+d[z+1]),z=A;return M}(a,t,r,s)>0)for(let d=t;d<r;d+=s)p=Ed(d/s|0,a[d],a[d+1],p);else for(let d=r-s;d>=t;d-=s)p=Ed(d/s|0,a[d],a[d+1],p);return p&&Fo(p,p.next)&&(rc(p),p=p.next),p}function Fn(a,t){if(!a)return a;t||(t=a);let r,s=a;do if(r=!1,s.steiner||!Fo(s,s.next)&&dr(s.prev,s,s.next)!==0)s=s.next;else{if(rc(s),s=t=s.prev,s===s.next)break;r=!0}while(r||s!==t);return t}function Ql(a,t,r,s,c,p,d){if(!a)return;!d&&p&&function(y,w,M,A){let z=y;do z.z===0&&(z.z=zh(z.x,z.y,w,M,A)),z.prevZ=z.prev,z.nextZ=z.next,z=z.next;while(z!==y);z.prevZ.nextZ=null,z.prevZ=null,function(R){let B,j=1;do{let V,W=R;R=null;let oe=null;for(B=0;W;){B++;let Q=W,L=0;for(let te=0;te<j&&(L++,Q=Q.nextZ,Q);te++);let $=j;for(;L>0||$>0&&Q;)L!==0&&($===0||!Q||W.z<=Q.z)?(V=W,W=W.nextZ,L--):(V=Q,Q=Q.nextZ,$--),oe?oe.nextZ=V:R=V,V.prevZ=oe,oe=V;W=Q}oe.nextZ=null,j*=2}while(B>1)}(z)}(a,s,c,p);let g=a;for(;a.prev!==a.next;){const y=a.prev,w=a.next;if(p?vg(a,s,c,p):xg(a))t.push(y.i,a.i,w.i),rc(a),a=w.next,g=w.next;else if((a=w)===g){d?d===1?Ql(a=bg(Fn(a),t),t,r,s,c,p,2):d===2&&wg(a,t,r,s,c,p):Ql(Fn(a),t,r,s,c,p,1);break}}}function xg(a){const t=a.prev,r=a,s=a.next;if(dr(t,r,s)>=0)return!1;const c=t.x,p=r.x,d=s.x,g=t.y,y=r.y,w=s.y,M=Math.min(c,p,d),A=Math.min(g,y,w),z=Math.max(c,p,d),R=Math.max(g,y,w);let B=s.next;for(;B!==t;){if(B.x>=M&&B.x<=z&&B.y>=A&&B.y<=R&&ec(c,g,p,y,d,w,B.x,B.y)&&dr(B.prev,B,B.next)>=0)return!1;B=B.next}return!0}function vg(a,t,r,s){const c=a.prev,p=a,d=a.next;if(dr(c,p,d)>=0)return!1;const g=c.x,y=p.x,w=d.x,M=c.y,A=p.y,z=d.y,R=Math.min(g,y,w),B=Math.min(M,A,z),j=Math.max(g,y,w),V=Math.max(M,A,z),W=zh(R,B,t,r,s),oe=zh(j,V,t,r,s);let Q=a.prevZ,L=a.nextZ;for(;Q&&Q.z>=W&&L&&L.z<=oe;){if(Q.x>=R&&Q.x<=j&&Q.y>=B&&Q.y<=V&&Q!==c&&Q!==d&&ec(g,M,y,A,w,z,Q.x,Q.y)&&dr(Q.prev,Q,Q.next)>=0||(Q=Q.prevZ,L.x>=R&&L.x<=j&&L.y>=B&&L.y<=V&&L!==c&&L!==d&&ec(g,M,y,A,w,z,L.x,L.y)&&dr(L.prev,L,L.next)>=0))return!1;L=L.nextZ}for(;Q&&Q.z>=W;){if(Q.x>=R&&Q.x<=j&&Q.y>=B&&Q.y<=V&&Q!==c&&Q!==d&&ec(g,M,y,A,w,z,Q.x,Q.y)&&dr(Q.prev,Q,Q.next)>=0)return!1;Q=Q.prevZ}for(;L&&L.z<=oe;){if(L.x>=R&&L.x<=j&&L.y>=B&&L.y<=V&&L!==c&&L!==d&&ec(g,M,y,A,w,z,L.x,L.y)&&dr(L.prev,L,L.next)>=0)return!1;L=L.nextZ}return!0}function bg(a,t){let r=a;do{const s=r.prev,c=r.next.next;!Fo(s,c)&&Pd(s,r,r.next,c)&&tc(s,c)&&tc(c,s)&&(t.push(s.i,r.i,c.i),rc(r),rc(r.next),r=a=c),r=r.next}
5while(r!==a);return Fn(r)}function wg(a,t,r,s,c,p){let d=a;do{let g=d.next.next;for(;g!==d.prev;){if(d.i!==g.i&&Ig(d,g)){let y=kd(d,g);return d=Fn(d,d.next),y=Fn(y,y.next),Ql(d,t,r,s,c,p,0),void Ql(y,t,r,s,c,p,0)}g=g.next}d=d.next}while(d!==a)}function Tg(a,t){let r=a.x-t.x;return r===0&&(r=a.y-t.y,r===0)&&(r=(a.next.y-a.y)/(a.next.x-a.x)-(t.next.y-t.y)/(t.next.x-t.x)),r}function Sg(a,t){const r=function(c,p){let d=p;const g=c.x,y=c.y;let w,M=-1/0;if(Fo(c,d))return d;do{if(Fo(c,d.next))return d.next;if(y<=d.y&&y>=d.next.y&&d.next.y!==d.y){const j=d.x+(y-d.y)*(d.next.x-d.x)/(d.next.y-d.y);if(j<=g&&j>M&&(M=j,w=d.x<d.next.x?d:d.next,j===g))return w}d=d.next}while(d!==p);if(!w)return null;const A=w,z=w.x,R=w.y;let B=1/0;d=w;do{if(g>=d.x&&d.x>=z&&g!==d.x&&Ad(y<R?g:M,y,z,R,y<R?M:g,y,d.x,d.y)){const j=Math.abs(y-d.y)/(g-d.x);tc(d,c)&&(j<B||j===B&&(d.x>w.x||d.x===w.x&&Cg(w,d)))&&(w=d,B=j)}d=d.next}while(d!==A);return w}(a,t);if(!r)return t;const s=kd(r,a);return Fn(s,s.next),Fn(r,r.next)}function Cg(a,t){return dr(a.prev,a,t.prev)<0&&dr(t.next,a,a.next)<0}function zh(a,t,r,s,c){return(a=1431655765&((a=858993459&((a=252645135&((a=16711935&((a=(a-r)*c|0)|a<<8))|a<<4))|a<<2))|a<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-s)*c|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Mg(a){let t=a,r=a;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==a);return r}function Ad(a,t,r,s,c,p,d,g){return(c-d)*(t-g)>=(a-d)*(p-g)&&(a-d)*(s-g)>=(r-d)*(t-g)&&(r-d)*(p-g)>=(c-d)*(s-g)}function ec(a,t,r,s,c,p,d,g){return!(a===d&&t===g)&&Ad(a,t,r,s,c,p,d,g)}function Ig(a,t){return a.next.i!==t.i&&a.prev.i!==t.i&&!function(r,s){let c=r;do{if(c.i!==r.i&&c.next.i!==r.i&&c.i!==s.i&&c.next.i!==s.i&&Pd(c,c.next,r,s))return!0;c=c.next}while(c!==r);return!1}(a,t)&&(tc(a,t)&&tc(t,a)&&function(r,s){let c=r,p=!1;const d=(r.x+s.x)/2,g=(r.y+s.y)/2;do c.y>g!=c.next.y>g&&c.next.y!==c.y&&d<(c.next.x-c.x)*(g-c.y)/(c.next.y-c.y)+c.x&&(p=!p),c=c.next;while(c!==r);return p}(a,t)&&(dr(a.prev,a,t.prev)||dr(a,t.prev,t))||Fo(a,t)&&dr(a.prev,a,a.next)>0&&dr(t.prev,t,t.next)>0)}function dr(a,t,r){return(t.y-a.y)*(r.x-t.x)-(t.x-a.x)*(r.y-t.y)}function Fo(a,t){return a.x===t.x&&a.y===t.y}function Pd(a,t,r,s){const c=yu(dr(a,t,r)),p=yu(dr(a,t,s)),d=yu(dr(r,s,a)),g=yu(dr(r,s,t));return c!==p&&d!==g||!(c!==0||!_u(a,r,t))||!(p!==0||!_u(a,s,t))||!(d!==0||!_u(r,a,s))||!(g!==0||!_u(r,t,s))}function _u(a,t,r){return t.x<=Math.max(a.x,r.x)&&t.x>=Math.min(a.x,r.x)&&t.y<=Math.max(a.y,r.y)&&t.y>=Math.min(a.y,r.y)}function yu(a){return a>0?1:a<0?-1:0}function tc(a,t){return dr(a.prev,a,a.next)<0?dr(a,t,a.next)>=0&&dr(a,a.prev,t)>=0:dr(a,t,a.prev)<0||dr(a,a.next,t)<0}function kd(a,t){const r=Dh(a.i,a.x,a.y),s=Dh(t.i,t.x,t.y),c=a.next,p=t.prev;return a.next=t,t.prev=a,r.next=c,c.prev=r,s.next=r,r.prev=s,p.next=s,s.prev=p,s}function Ed(a,t,r,s){const c=Dh(a,t,r);return s?(c.next=s.next,c.prev=s,s.next.prev=c,s.next=c):(c.prev=c,c.next=c),c}function rc(a){a.next.prev=a.prev,a.prev.next=a.next,a.prevZ&&(a.prevZ.nextZ=a.nextZ),a.nextZ&&(a.nextZ.prevZ=a.prevZ)}function Dh(a,t,r){return{i:a,x:t,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class Bo{constructor(t,r){if(r>t)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=r}getGranularityForZoomLevel(t){return Math.max(Math.floor(this._baseZoomGranularity/(1<<t)),this._minGranularity,1)}}class xu{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}}xu.noSubdivision=new xu({fill:new Bo(0,0),line:new Bo(0,0),tile:new Bo(0,0),stencil:new Bo(0,0),circle:1}),$e("SubdivisionGranularityExpression",Bo),$e("SubdivisionGranularitySetting",xu);const Oo=-32768,ic=32767;class Ag{constructor(t,r){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=Ct/t,this._canonical=r}_getKey(t,r){return(t+=32768)<<16|r+32768}_vertexToIndex(t,r){if(t<-32768||r<-32768||t>32767||r>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const s=0|Math.round(t),c=0|Math.round(r),p=this._getKey(s,c);
5if(this._vertexDictionary.has(p))return this._vertexDictionary.get(p);const d=this._vertexBuffer.length/2;return this._vertexDictionary.set(p,d),this._vertexBuffer.push(s,c),d}_subdivideTrianglesScanline(t){if(this._granularity<2)return function(c,p){const d=[];for(let g=0;g<p.length;g+=3){const y=p[g],w=p[g+1],M=p[g+2],A=c[2*y],z=c[2*y+1];(c[2*w]-A)*(c[2*M+1]-z)-(c[2*w+1]-z)*(c[2*M]-A)>0?(d.push(y),d.push(M),d.push(w)):(d.push(y),d.push(w),d.push(M))}return d}(this._vertexBuffer,t);const r=[],s=t.length;for(let c=0;c<s;c+=3){const p=[t[c+0],t[c+1],t[c+2]],d=[this._vertexBuffer[2*t[c+0]+0],this._vertexBuffer[2*t[c+0]+1],this._vertexBuffer[2*t[c+1]+0],this._vertexBuffer[2*t[c+1]+1],this._vertexBuffer[2*t[c+2]+0],this._vertexBuffer[2*t[c+2]+1]];let g=1/0,y=1/0,w=-1/0,M=-1/0;for(let j=0;j<3;j++){const V=d[2*j],W=d[2*j+1];g=Math.min(g,V),w=Math.max(w,V),y=Math.min(y,W),M=Math.max(M,W)}if(g===w||y===M)continue;const A=Math.floor(g/this._granularityCellSize),z=Math.ceil(w/this._granularityCellSize),R=Math.floor(y/this._granularityCellSize),B=Math.ceil(M/this._granularityCellSize);if(A!==z||R!==B)for(let j=R;j<B;j++){const V=this._scanlineGenerateVertexRingForCellRow(j,d,p);Pg(this._vertexBuffer,V,r)}else r.push(...p)}return r}_scanlineGenerateVertexRingForCellRow(t,r,s){const c=t*this._granularityCellSize,p=c+this._granularityCellSize,d=[];for(let g=0;g<3;g++){const y=r[2*g],w=r[2*g+1],M=r[2*(g+1)%6],A=r[(2*(g+1)+1)%6],z=r[2*(g+2)%6],R=r[(2*(g+2)+1)%6],B=M-y,j=A-w,V=B===0,W=j===0,oe=(c-w)/j,Q=(p-w)/j,L=Math.min(oe,Q),$=Math.max(oe,Q);if(!W&&(L>=1||$<=0)||W&&(w<c||w>p)){A>=c&&A<=p&&d.push(s[(g+1)%3]);continue}!W&&L>0&&d.push(this._vertexToIndex(y+B*L,w+j*L));const te=y+B*Math.max(L,0),_e=y+B*Math.min($,1);V||this._generateIntraEdgeVertices(d,y,w,M,A,te,_e),!W&&$<1&&d.push(this._vertexToIndex(y+B*$,w+j*$)),(W||A>=c&&A<=p)&&d.push(s[(g+1)%3]),!W&&(A<=c||A>=p)&&this._generateInterEdgeVertices(d,y,w,M,A,z,R,_e,c,p)}return d}_generateIntraEdgeVertices(t,r,s,c,p,d,g){const y=c-r,w=p-s,M=w===0,A=M?Math.min(r,c):Math.min(d,g),z=M?Math.max(r,c):Math.max(d,g),R=Math.floor(A/this._granularityCellSize)+1,B=Math.ceil(z/this._granularityCellSize)-1;if(M?r<c:d<g)for(let j=R;j<=B;j++){const V=j*this._granularityCellSize;t.push(this._vertexToIndex(V,s+w*(V-r)/y))}else for(let j=B;j>=R;j--){const V=j*this._granularityCellSize;t.push(this._vertexToIndex(V,s+w*(V-r)/y))}}_generateInterEdgeVertices(t,r,s,c,p,d,g,y,w,M){const A=p-s,z=d-c,R=g-p,B=(w-p)/R,j=(M-p)/R,V=Math.min(B,j),W=Math.max(B,j),oe=c+z*V;let Q=Math.floor(Math.min(oe,y)/this._granularityCellSize)+1,L=Math.ceil(Math.max(oe,y)/this._granularityCellSize)-1,$=y<oe;const te=R===0;if(te&&(g===w||g===M))return;if(te||V>=1||W<=0){const ze=s-g,we=d+(r-d)*Math.min((w-g)/ze,(M-g)/ze);Q=Math.floor(Math.min(we,y)/this._granularityCellSize)+1,L=Math.ceil(Math.max(we,y)/this._granularityCellSize)-1,$=y<we}const _e=A>0?M:w;if($)for(let ze=Q;ze<=L;ze++)t.push(this._vertexToIndex(ze*this._granularityCellSize,_e));else for(let ze=L;ze>=Q;ze--)t.push(this._vertexToIndex(ze*this._granularityCellSize,_e))}_generateOutline(t){const r=[];for(const s of t){const c=Bn(s,this._granularity,!0),p=this._pointArrayToIndices(c),d=[];for(let g=1;g<p.length;g++)d.push(p[g-1]),d.push(p[g]);r.push(d)}return r}_handlePoles(t){let r=!1,s=!1;this._canonical&&(this._canonical.y===0&&(r=!0),this._canonical.y===(1<<this._canonical.z)-1&&(s=!0)),(r||s)&&this._fillPoles(t,r,s)}_ensureNoPoleVertices(){const t=this._vertexBuffer;for(let r=0;r<t.length;r+=2){const s=t[r+1];s===Oo&&(t[r+1]=-32767),s===ic&&(t[r+1]=32766)}}_generatePoleQuad(t,r,s,c,p,d){c>p!=(d===Oo)?(t.push(r),t.push(s),t.push(this._vertexToIndex(c,d)),t.push(s),t.push(this._vertexToIndex(p,d)),t.push(this._vertexToIndex(c,d))):(t.push(s),t.push(r),t.push(this._vertexToIndex(c,d)),t.push(this._vertexToIndex(p,d)),t.push(s),t.push(this._vertexToIndex(c,d)))}_fillPoles(t,r,s){const c=this._vertexBuffer,p=Ct,d=t.length;for(let g=2;g<d;g+=3){const y=t[g-2],w=t[g-1],M=t[g],A=c[2*y],z=c[2*y+1],R=c[2*w],B=c[2*w+1],j=c[2*M],V=c[2*M+1];r&&(z===0&&B===0&&this._generatePoleQuad(t,y,w,A,R,Oo),B===0&&V===0&&this._generatePoleQuad(t,w,M,R,j,Oo),V===0&&z===0&&this._generatePoleQuad(t,M,y,j,A,Oo)),s&&(z===p&&B===p&&this._generatePoleQuad(t,y,w,A,R,ic),B===p&&V===p&&this._generatePoleQuad(t,w,M,R,j,ic),V===p&&z===p&&this._generatePoleQuad(t,M,y,j,A,ic))}}_initializeVertices(t){for(let r=0;r<t.length;r+=2)this._vertexToIndex(t[r],t[r+1])}subdividePolygonInternal(t,r){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:s,holeIndices:c}=function(g){const y=[],w=[];for(const M of g)if(M.length!==0){M!==g[0]&&y.push(w.length/2);for(let A=0;A<M.length;A++)w.push(M[A].x),w.push(M[A].y)}return{flattened:w,holeIndices:y}}(t);let p;this._initializeVertices(s);try{const g=function(w,M,A=2){const z=M&&M.length,R=z?M[0]*A:w.length;let B=Id(w,0,R,A,!0);const j=[];if(!B||B.next===B.prev)return j;let V,W,oe;if(z&&(B=function(Q,L,$,te){const _e=[];for(let ze=0,we=L.length;ze<we;ze++){const Se=Id(Q,L[ze]*te,ze<we-1?L[ze+1]*te:Q.length,te,!1);Se===Se.next&&(Se.steiner=!0),_e.push(Mg(Se))}_e.sort(Tg);for(let ze=0;ze<_e.length;ze++)$=Sg(_e[ze],$);return $}(w,M,B,A)),w.length>80*A){V=1/0,W=1/0;let Q=-1/0,L=-1/0;for(let $=A;$<R;$+=A){const te=w[$],_e=w[$+1];te<V&&(V=te),_e<W&&(W=_e),te>Q&&(Q=te),_e>L&&(L=_e)}oe=Math.max(Q-V,L-W),oe=oe!==0?32767/oe:0}return Ql(B,j,A,V,W,oe,0),j}(s,c),y=this._convertIndices(s,g);p=this._subdivideTrianglesScanline(y)}catch(g){console.error(g)}let d=[];return r&&(d=this._generateOutline(t)),this._ensureNoPoleVertices(),this._handlePoles(p),{verticesFlattened:this._vertexBuffer,indicesTriangles:p,indicesLineList:d}}_convertIndices(t,r){const s=[];for(let c=0;c<r.length;c++)s.push(this._vertexToIndex(t[2*r[c]],t[2*r[c]+1]));return s}_pointArrayToIndices(t){const r=[];for(let s=0;s<t.length;s++){const c=t[s];
5r.push(this._vertexToIndex(c.x,c.y))}return r}}function zd(a,t,r,s=!0){return new Ag(r,t).subdividePolygonInternal(a,s)}function Bn(a,t,r=!1){if(!a||a.length<1)return[];if(a.length<2)return[];const s=a[0],c=a[a.length-1],p=r&&(s.x!==c.x||s.y!==c.y);if(t<2)return p?[...a,a[0]]:[...a];const d=Math.floor(Ct/t),g=[];g.push(new be(a[0].x,a[0].y));const y=a.length,w=p?y:y-1;for(let M=0;M<w;M++){const A=a[M],z=M<y-1?a[M+1]:a[0],R=A.x,B=A.y,j=z.x,V=z.y,W=R!==j,oe=B!==V;if(!W&&!oe)continue;const Q=j-R,L=V-B,$=Math.abs(Q),te=Math.abs(L);let _e=R,ze=B;for(;;){const Se=Q>0?(Math.floor(_e/d)+1)*d:(Math.ceil(_e/d)-1)*d,Re=L>0?(Math.floor(ze/d)+1)*d:(Math.ceil(ze/d)-1)*d,Ee=Math.abs(_e-Se),Le=Math.abs(ze-Re),Me=Math.abs(_e-j),qe=Math.abs(ze-V),Qe=W?Ee/$:Number.POSITIVE_INFINITY,Ke=oe?Le/te:Number.POSITIVE_INFINITY;if((Me<=Ee||!W)&&(qe<=Le||!oe))break;if(Qe<Ke&&W||!oe){_e=Se,ze+=L*Qe;const He=new be(_e,Math.round(ze));g[g.length-1].x===He.x&&g[g.length-1].y===He.y||g.push(He)}else{_e+=Q*Ke,ze=Re;const He=new be(Math.round(_e),ze);g[g.length-1].x===He.x&&g[g.length-1].y===He.y||g.push(He)}}const we=new be(j,V);g[g.length-1].x===we.x&&g[g.length-1].y===we.y||g.push(we)}return g}function Pg(a,t,r){if(t.length===0)throw new Error("Subdivision vertex ring is empty.");let s=0,c=a[2*t[0]];for(let y=1;y<t.length;y++){const w=a[2*t[y]];w<c&&(c=w,s=y)}const p=t.length;let d=s,g=(d+1)%p;for(;;){const y=d-1>=0?d-1:p-1,w=(g+1)%p,M=a[2*t[y]],A=a[2*t[w]],z=a[2*t[d]],R=a[2*t[d]+1],B=a[2*t[g]+1];let j=!1;if(M<A)j=!0;else if(M>A)j=!1;else{const V=B-R,W=-(a[2*t[g]]-z),oe=R<B?1:-1;((M-z)*V+(a[2*t[y]+1]-R)*W)*oe>((A-z)*V+(a[2*t[w]+1]-R)*W)*oe&&(j=!0)}if(j){const V=t[y],W=t[d],oe=t[g];V!==W&&V!==oe&&W!==oe&&r.push(oe,W,V),d--,d<0&&(d=p-1)}else{const V=t[w],W=t[d],oe=t[g];V!==W&&V!==oe&&W!==oe&&r.push(oe,W,V),g++,g>=p&&(g=0)}if(y===w)break}}function Dd(a,t,r,s,c,p,d,g,y){const w=c.length/2,M=d&&g&&y;if(w<St.MAX_VERTEX_ARRAY_LENGTH){const A=t.prepareSegment(w,r,s),z=A.vertexLength;for(let j=0;j<p.length;j+=3)s.emplaceBack(z+p[j],z+p[j+1],z+p[j+2]);let R,B;A.vertexLength+=w,A.primitiveLength+=p.length/3,M&&(B=d.prepareSegment(w,r,g),R=B.vertexLength,B.vertexLength+=w);for(let j=0;j<c.length;j+=2)a(c[j],c[j+1]);if(M)for(let j=0;j<y.length;j++){const V=y[j];for(let W=1;W<V.length;W+=2)g.emplaceBack(R+V[W-1],R+V[W]);B.primitiveLength+=V.length/2}}else(function(A,z,R,B,j,V){const W=[];for(let te=0;te<B.length/2;te++)W.push(-1);const oe={count:0};let Q=0,L=A.getOrCreateLatestSegment(z,R),$=L.vertexLength;for(let te=2;te<j.length;te+=3){const _e=j[te-2],ze=j[te-1],we=j[te];let Se=W[_e]<Q,Re=W[ze]<Q,Ee=W[we]<Q;L.vertexLength+((Se?1:0)+(Re?1:0)+(Ee?1:0))>St.MAX_VERTEX_ARRAY_LENGTH&&(L=A.createNewSegment(z,R),Q=oe.count,Se=!0,Re=!0,Ee=!0,$=0);const Le=ac(W,B,V,oe,_e,Se,L),Me=ac(W,B,V,oe,ze,Re,L),qe=ac(W,B,V,oe,we,Ee,L);R.emplaceBack($+Le-Q,$+Me-Q,$+qe-Q),L.primitiveLength++}})(t,r,s,c,p,a),M&&function(A,z,R,B,j,V){const W=[];for(let te=0;te<B.length/2;te++)W.push(-1);const oe={count:0};let Q=0,L=A.getOrCreateLatestSegment(z,R),$=L.vertexLength;for(let te=0;te<j.length;te++){const _e=j[te];for(let ze=1;ze<j[te].length;ze+=2){const we=_e[ze-1],Se=_e[ze];let Re=W[we]<Q,Ee=W[Se]<Q;L.vertexLength+((Re?1:0)+(Ee?1:0))>St.MAX_VERTEX_ARRAY_LENGTH&&(L=A.createNewSegment(z,R),Q=oe.count,Re=!0,Ee=!0,$=0);const Le=ac(W,B,V,oe,we,Re,L),Me=ac(W,B,V,oe,Se,Ee,L);R.emplaceBack($+Le-Q,$+Me-Q),L.primitiveLength++}}}(d,r,g,c,y,a),t.forceNewSegmentOnNextPrepare(),d==null||d.forceNewSegmentOnNextPrepare()}function ac(a,t,r,s,c,p,d){if(p){const g=s.count;return r(t[2*c],t[2*c+1]),a[c]=s.count,s.count++,d.vertexLength++,g}return a[c]}class Lh{constructor(t){this.zoom=t.zoom,this.globalState=t.globalState,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 ve,this.indexArray=new Ot,this.indexArray2=new Ft,this.programConfigurations=new ja(t.layers,t.zoom),this.segments=new St,this.segments2=new St,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,s){this.hasPattern=kh("fill",this.layers,r);const c=this.layers[0].layout.get("fill-sort-key"),p=!c.isConstant(),d=[];for(const{feature:g,id:y,index:w,sourceLayerIndex:M}of t){const A=this.layers[0]._featureFilter.needGeometry,z=Rn(g,A);if(!this.layers[0]._featureFilter.filter(new Ht(this.zoom,{globalState:this.globalState}),z,s))continue;const R=p?c.evaluate(z,{},s,r.availableImages):void 0,B={id:y,properties:g.properties,type:g.type,sourceLayerIndex:M,index:w,geometry:A?z.geometry:Ln(g),patterns:{},sortKey:R};d.push(B)}p&&d.sort((g,y)=>g.sortKey-y.sortKey);for(const g of d){const{geometry:y,index:w,sourceLayerIndex:M}=g;if(this.hasPattern){const A=Eh("fill",this.layers,g,this.zoom,r);this.patternFeatures.push(A)}else this.addFeature(g,y,w,s,{},r.subdivisionGranularity);r.featureIndex.insert(t[w].feature,y,w,M,this.index)}}update(t,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,s)}addFeatures(t,r,s){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,r,s,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,yg),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,c,p,d){for(const g of lo(r,500)){const y=zd(g,c,d.fill.getGranularityForZoomLevel(c.z)),w=this.layoutVertexArray;Dd((M,A)=>{w.emplaceBack(M,A)},this.segments,this.layoutVertexArray,this.indexArray,y.verticesFlattened,y.indicesTriangles,this.segments2,this.indexArray2,y.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,s,p,c)}}let Ld,Rd;
5$e("FillBucket",Lh,{omit:["layers","patternFeatures"]});var kg={get paint(){return Rd=Rd||new ni({"fill-antialias":new Ge(se.paint_fill["fill-antialias"]),"fill-opacity":new tt(se.paint_fill["fill-opacity"]),"fill-color":new tt(se.paint_fill["fill-color"]),"fill-outline-color":new tt(se.paint_fill["fill-outline-color"]),"fill-translate":new Ge(se.paint_fill["fill-translate"]),"fill-translate-anchor":new Ge(se.paint_fill["fill-translate-anchor"]),"fill-pattern":new zo(se.paint_fill["fill-pattern"])})},get layout(){return Ld=Ld||new ni({"fill-sort-key":new tt(se.layout_fill["fill-sort-key"])})}};class Eg extends Zr{constructor(t){super(t,kg)}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 Lh(t)}queryRadius(){return mu(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:r,transform:s,pixelsToTileUnits:c}){return dd(gu(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-s.bearingInRadians,c),r)}isTileClipped(){return!0}}const zg=ar([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Dg=ar([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Lg}=zg;var Rh,Fd,Fh,Bd,Bh,Od,jd,vu={};function Nd(){if(Fd)return Rh;Fd=1;var a=Ie();function t(c,p,d,g,y){this.properties={},this.extent=d,this.type=0,this._pbf=c,this._geometry=-1,this._keys=g,this._values=y,c.readFields(r,this,p)}function r(c,p,d){c==1?p.id=d.readVarint():c==2?function(g,y){for(var w=g.readVarint()+g.pos;g.pos<w;){var M=y._keys[g.readVarint()],A=y._values[g.readVarint()];y.properties[M]=A}}(d,p):c==3?p.type=d.readVarint():c==4&&(p._geometry=d.pos)}function s(c){for(var p,d,g=0,y=0,w=c.length,M=w-1;y<w;M=y++)g+=((d=c[M]).x-(p=c[y]).x)*(p.y+d.y);return g}return Rh=t,t.types=["Unknown","Point","LineString","Polygon"],t.prototype.loadGeometry=function(){var c=this._pbf;c.pos=this._geometry;for(var p,d=c.readVarint()+c.pos,g=1,y=0,w=0,M=0,A=[];c.pos<d;){if(y<=0){var z=c.readVarint();g=7&z,y=z>>3}if(y--,g===1||g===2)w+=c.readSVarint(),M+=c.readSVarint(),g===1&&(p&&A.push(p),p=[]),p.push(new a(w,M));else{if(g!==7)throw new Error("unknown command "+g);p&&p.push(p[0].clone())}}return p&&A.push(p),A},t.prototype.bbox=function(){var c=this._pbf;c.pos=this._geometry;for(var p=c.readVarint()+c.pos,d=1,g=0,y=0,w=0,M=1/0,A=-1/0,z=1/0,R=-1/0;c.pos<p;){if(g<=0){var B=c.readVarint();d=7&B,g=B>>3}if(g--,d===1||d===2)(y+=c.readSVarint())<M&&(M=y),y>A&&(A=y),(w+=c.readSVarint())<z&&(z=w),w>R&&(R=w);else if(d!==7)throw new Error("unknown command "+d)}return[M,z,A,R]},t.prototype.toGeoJSON=function(c,p,d){var g,y,w=this.extent*Math.pow(2,d),M=this.extent*c,A=this.extent*p,z=this.loadGeometry(),R=t.types[this.type];function B(W){for(var oe=0;oe<W.length;oe++){var Q=W[oe];W[oe]=[360*(Q.x+M)/w-180,360/Math.PI*Math.atan(Math.exp((180-360*(Q.y+A)/w)*Math.PI/180))-90]}}switch(this.type){case 1:var j=[];for(g=0;g<z.length;g++)j[g]=z[g][0];B(z=j);break;case 2:for(g=0;g<z.length;g++)B(z[g]);break;case 3:for(z=function(W){var oe=W.length;if(oe<=1)return[W];for(var Q,L,$=[],te=0;te<oe;te++){var _e=s(W[te]);_e!==0&&(L===void 0&&(L=_e<0),L===_e<0?(Q&&$.push(Q),Q=[W[te]]):Q.push(W[te]))}return Q&&$.push(Q),$}(z),g=0;g<z.length;g++)for(y=0;y<z[g].length;y++)B(z[g][y])}z.length===1?z=z[0]:R="Multi"+R;var V={type:"Feature",geometry:{type:R,coordinates:z},properties:this.properties};return"id"in this&&(V.id=this.id),V},Rh}function Ud(){if(Bd)return Fh;Bd=1;var a=Nd();function t(s,c){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=s,this._keys=[],this._values=[],this._features=[],s.readFields(r,this,c),this.length=this._features.length}function r(s,c,p){s===15?c.version=p.readVarint():s===1?c.name=p.readString():s===5?c.extent=p.readVarint():s===2?c._features.push(p.pos):s===3?c._keys.push(p.readString()):s===4&&c._values.push(function(d){for(var g=null,y=d.readVarint()+d.pos;d.pos<y;){var w=d.readVarint()>>3;g=w===1?d.readString():w===2?d.readFloat():w===3?d.readDouble():w===4?d.readVarint64():w===5?d.readVarint():w===6?d.readSVarint():w===7?d.readBoolean():null}return g}(p))}return Fh=t,t.prototype.feature=function(s){if(s<0||s>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[s];var c=this._pbf.readVarint()+this._pbf.pos;return new a(this._pbf,c,this.extent,this._keys,this._values)},Fh}function $d(){return jd||(jd=1,vu.VectorTile=function(){if(Od)return Bh;Od=1;var a=Ud();function t(r,s,c){if(r===3){var p=new a(c,c.readVarint()+c.pos);p.length&&(s[p.name]=p)}}return Bh=function(r,s){this.layers=r.readFields(t,{},s)},Bh}(),vu.VectorTileFeature=Nd(),vu.VectorTileLayer=Ud()),vu}var sc=fe($d());const Rg=sc.VectorTileFeature.types,Oh=Math.pow(2,13);function nc(a,t,r,s,c,p,d,g){a.emplaceBack(t,r,2*Math.floor(s*Oh)+d,c*Oh*2,p*Oh*2,Math.round(g))}class jh{constructor(t){this.zoom=t.zoom,this.globalState=t.globalState,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 Oe,this.centroidVertexArray=new me,this.indexArray=new Ot,this.programConfigurations=new ja(t.layers,t.zoom),this.segments=new St,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,s){this.features=[],this.hasPattern=kh("fill-extrusion",this.layers,r);for(const{feature:c,id:p,index:d,sourceLayerIndex:g}of t){const y=this.layers[0]._featureFilter.needGeometry,w=Rn(c,y);if(!this.layers[0]._featureFilter.filter(new Ht(this.zoom,{globalState:this.globalState}),w,s))continue;const M={id:p,sourceLayerIndex:g,index:d,geometry:y?w.geometry:Ln(c),properties:c.properties,type:c.type,patterns:{}};this.hasPattern?this.features.push(Eh("fill-extrusion",this.layers,M,this.zoom,r)):this.addFeature(M,M.geometry,d,s,{},r.subdivisionGranularity),r.featureIndex.insert(c,M.geometry,d,g,this.index,!0)}}addFeatures(t,r,s){for(const c of this.features){const{geometry:p}=c;this.addFeature(c,p,c.index,r,s,t.subdivisionGranularity)}}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,Lg),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Dg.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,c,p,d){for(const g of lo(r,500)){const y={x:0,y:0,sampleCount:0},w=this.layoutVertexArray.length;this.processPolygon(y,c,t,g,d);const M=this.layoutVertexArray.length-w,A=Math.floor(y.x/y.sampleCount),z=Math.floor(y.y/y.sampleCount);for(let R=0;R<M;R++)this.centroidVertexArray.emplaceBack(A,z)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,s,p,c)}processPolygon(t,r,s,c,p){if(c.length<1||Vd(c[0]))return;for(const A of c)A.length!==0&&Fg(t,A);const d={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},g=p.fill.getGranularityForZoomLevel(r.z),y=Rg[s.type]==="Polygon";
5for(const A of c){if(A.length===0||Vd(A))continue;const z=Bn(A,g,y);this._generateSideFaces(z,d)}if(!y)return;const w=zd(c,r,g,!1),M=this.layoutVertexArray;Dd((A,z)=>{nc(M,A,z,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,w.verticesFlattened,w.indicesTriangles)}_generateSideFaces(t,r){let s=0;for(let c=1;c<t.length;c++){const p=t[c],d=t[c-1];if(Bg(p,d))continue;r.segment.vertexLength+4>St.MAX_VERTEX_ARRAY_LENGTH&&(r.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const g=p.sub(d)._perp()._unit(),y=d.dist(p);s+y>32768&&(s=0),nc(this.layoutVertexArray,p.x,p.y,g.x,g.y,0,0,s),nc(this.layoutVertexArray,p.x,p.y,g.x,g.y,0,1,s),s+=y,nc(this.layoutVertexArray,d.x,d.y,g.x,g.y,0,0,s),nc(this.layoutVertexArray,d.x,d.y,g.x,g.y,0,1,s);const w=r.segment.vertexLength;this.indexArray.emplaceBack(w,w+2,w+1),this.indexArray.emplaceBack(w+1,w+2,w+3),r.segment.vertexLength+=4,r.segment.primitiveLength+=2}}}function Fg(a,t){for(let r=0;r<t.length;r++){const s=t[r];r===t.length-1&&t[0].x===s.x&&t[0].y===s.y||(a.x+=s.x,a.y+=s.y,a.sampleCount++)}}function Bg(a,t){return a.x===t.x&&(a.x<0||a.x>Ct)||a.y===t.y&&(a.y<0||a.y>Ct)}function Vd(a){return a.every(t=>t.x<0)||a.every(t=>t.x>Ct)||a.every(t=>t.y<0)||a.every(t=>t.y>Ct)}let Zd;$e("FillExtrusionBucket",jh,{omit:["layers","features"]});var Og={get paint(){return Zd=Zd||new ni({"fill-extrusion-opacity":new Ge(se["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new tt(se["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ge(se["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ge(se["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new zo(se["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new tt(se["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new tt(se["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ge(se["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class jg extends Zr{constructor(t){super(t,Og)}createBucket(t){return new jh(t)}queryRadius(){return mu(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:r,featureState:s,geometry:c,transform:p,pixelsToTileUnits:d,pixelPosMatrix:g}){const y=gu(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-p.bearingInRadians,d),w=this.paint.get("fill-extrusion-height").evaluate(r,s),M=this.paint.get("fill-extrusion-base").evaluate(r,s),A=function(R,B){const j=[];for(const V of R){const W=[V.x,V.y,0,1];Ai(W,W,B),j.push(new be(W[0]/W[3],W[1]/W[3]))}return j}(y,g),z=function(R,B,j,V){const W=[],oe=[],Q=V[8]*B,L=V[9]*B,$=V[10]*B,te=V[11]*B,_e=V[8]*j,ze=V[9]*j,we=V[10]*j,Se=V[11]*j;for(const Re of R){const Ee=[],Le=[];for(const Me of Re){const qe=Me.x,Qe=Me.y,Ke=V[0]*qe+V[4]*Qe+V[12],He=V[1]*qe+V[5]*Qe+V[13],vt=V[2]*qe+V[6]*Qe+V[14],sr=V[3]*qe+V[7]*Qe+V[15],Ir=vt+$,ti=sr+te,Ki=Ke+_e,Ti=He+ze,Hr=vt+we,tr=sr+Se,Fr=new be((Ke+Q)/ti,(He+L)/ti);Fr.z=Ir/ti,Ee.push(Fr);const Wr=new be(Ki/tr,Ti/tr);Wr.z=Hr/tr,Le.push(Wr)}W.push(Ee),oe.push(Le)}return[W,oe]}(c,M,w,g);return function(R,B,j){let V=1/0;dd(j,B)&&(V=qd(j,B[0]));for(let W=0;W<B.length;W++){const oe=B[W],Q=R[W];for(let L=0;L<oe.length-1;L++){const $=oe[L],te=[$,oe[L+1],Q[L+1],Q[L],$];pd(j,te)&&(V=Math.min(V,qd(j,te)))}}return V!==1/0&&V}(z[0],z[1],A)}}function oc(a,t){return a.x*t.x+a.y*t.y}function qd(a,t){if(a.length===1){let r=0;const s=t[r++];let c;for(;!c||s.equals(c);)if(c=t[r++],!c)return 1/0;for(;r<t.length;r++){const p=t[r],d=a[0],g=c.sub(s),y=p.sub(s),w=d.sub(s),M=oc(g,g),A=oc(g,y),z=oc(y,y),R=oc(w,g),B=oc(w,y),j=M*z-A*A,V=(z*R-A*B)/j,W=(M*B-A*R)/j,oe=s.z*(1-V-W)+c.z*V+p.z*W;if(isFinite(oe))return oe}return 1/0}{let r=1/0;for(const s of t)r=Math.min(r,s.z);return r}}const Ng=ar([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Ug}=Ng,$g=ar([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Vg}=$g,Zg=sc.VectorTileFeature.types,qg=Math.cos(Math.PI/180*37.5),Gd=Math.pow(2,14)/.5;class Nh{constructor(t){this.zoom=t.zoom,this.globalState=t.globalState,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.lineClipsArray=[],this.gradients={}
5,this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new Be,this.layoutVertexArray2=new ke,this.indexArray=new Ot,this.programConfigurations=new ja(t.layers,t.zoom),this.segments=new St,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,s){this.hasPattern=kh("line",this.layers,r);const c=this.layers[0].layout.get("line-sort-key"),p=!c.isConstant(),d=[];for(const{feature:g,id:y,index:w,sourceLayerIndex:M}of t){const A=this.layers[0]._featureFilter.needGeometry,z=Rn(g,A);if(!this.layers[0]._featureFilter.filter(new Ht(this.zoom,{globalState:this.globalState}),z,s))continue;const R=p?c.evaluate(z,{},s):void 0,B={id:y,properties:g.properties,type:g.type,sourceLayerIndex:M,index:w,geometry:A?z.geometry:Ln(g),patterns:{},sortKey:R};d.push(B)}p&&d.sort((g,y)=>g.sortKey-y.sortKey);for(const g of d){const{geometry:y,index:w,sourceLayerIndex:M}=g;if(this.hasPattern){const A=Eh("line",this.layers,g,this.zoom,r);this.patternFeatures.push(A)}else this.addFeature(g,y,w,s,{},r.subdivisionGranularity);r.featureIndex.insert(t[w].feature,y,w,M,this.index)}}update(t,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,s)}addFeatures(t,r,s){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,r,s,t.subdivisionGranularity)}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,Vg)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ug),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,c,p,d){const g=this.layers[0].layout,y=g.get("line-join").evaluate(t,{}),w=g.get("line-cap"),M=g.get("line-miter-limit"),A=g.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const z of r)this.addLine(z,t,y,w,M,A,c,d);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,s,p,c)}addLine(t,r,s,c,p,d,g,y){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,t=Bn(t,g?y.line.getGranularityForZoomLevel(g.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let Q=0;Q<t.length-1;Q++)this.totalDistance+=t[Q].dist(t[Q+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const w=Zg[r.type]==="Polygon";let M=t.length;for(;M>=2&&t[M-1].equals(t[M-2]);)M--;let A=0;for(;A<M-1&&t[A].equals(t[A+1]);)A++;if(M<(w?3:2))return;s==="bevel"&&(p=1.05);const z=this.overscaling<=16?122880/(512*this.overscaling):0,R=this.segments.prepareSegment(10*M,this.layoutVertexArray,this.indexArray);let B,j,V,W,oe;this.e1=this.e2=-1,w&&(B=t[M-2],oe=t[A].sub(B)._unit()._perp());for(let Q=A;Q<M;Q++){if(V=Q===M-1?w?t[A+1]:void 0:t[Q+1],V&&t[Q].equals(V))continue;oe&&(W=oe),B&&(j=B),B=t[Q],oe=V?V.sub(B)._unit()._perp():W,W=W||oe;let L=W.add(oe);L.x===0&&L.y===0||L._unit();const $=W.x*oe.x+W.y*oe.y,te=L.x*oe.x+L.y*oe.y,_e=te!==0?1/te:1/0,ze=2*Math.sqrt(2-2*te),we=te<qg&&j&&V,Se=W.x*oe.y-W.y*oe.x>0;if(we&&Q>A){const Le=B.dist(j);if(Le>2*z){const Me=B.sub(B.sub(j)._mult(z/Le)._round());this.updateDistance(j,Me),this.addCurrentVertex(Me,W,0,0,R),j=Me}}const Re=j&&V;let Ee=Re?s:w?"butt":c;if(Re&&Ee==="round"&&(_e<d?Ee="miter":_e<=2&&(Ee="fakeround")),Ee==="miter"&&_e>p&&(Ee="bevel"),Ee==="bevel"&&(_e>2&&(Ee="flipbevel"),_e<p&&(Ee="miter")),j&&this.updateDistance(j,B),Ee==="miter")L._mult(_e),this.addCurrentVertex(B,L,0,0,R);else if(Ee==="flipbevel"){if(_e>100)L=oe.mult(-1);else{const Le=_e*W.add(oe).mag()/W.sub(oe).mag();L._perp()._mult(Le*(Se?-1:1))}this.addCurrentVertex(B,L,0,0,R),this.addCurrentVertex(B,L.mult(-1),0,0,R)}else if(Ee==="bevel"||Ee==="fakeround"){const Le=-Math.sqrt(_e*_e-1),Me=Se?Le:0,qe=Se?0:Le;if(j&&this.addCurrentVertex(B,W,Me,qe,R),Ee==="fakeround"){const Qe=Math.round(180*ze/Math.PI/20);for(let Ke=1;Ke<Qe;Ke++){let He=Ke/Qe;if(He!==.5){const sr=He-.5;He+=He*sr*(He-1)*((1.0904+$*($*(3.55645-1.43519*$)-3.2452))*sr*sr+(.848013+$*(.215638*$-1.06021)))}const vt=oe.sub(W)._mult(He)._add(W)._unit()._mult(Se?-1:1);this.addHalfVertex(B,vt.x,vt.y,!1,Se,0,R)}}V&&this.addCurrentVertex(B,oe,-Me,-qe,R)}else if(Ee==="butt")this.addCurrentVertex(B,L,0,0,R);else if(Ee==="square"){const Le=j?1:-1;this.addCurrentVertex(B,L,Le,Le,R)}else Ee==="round"&&(j&&(this.addCurrentVertex(B,W,0,0,R),this.addCurrentVertex(B,W,1,1,R,!0)),V&&(this.addCurrentVertex(B,oe,-1,-1,R,!0),this.addCurrentVertex(B,oe,0,0,R)));if(we&&Q<M-1){const Le=B.dist(V);if(Le>2*z){const Me=B.add(V.sub(B)._mult(z/Le)._round());this.updateDistance(B,Me),this.addCurrentVertex(Me,oe,0,0,R),B=Me}}}}addCurrentVertex(t,r,s,c,p,d=!1){const g=r.y*c-r.x,y=-r.y-r.x*c;this.addHalfVertex(t,r.x+r.y*s,r.y-r.x*s,d,!1,s,p),this.addHalfVertex(t,g,y,d,!0,-c,p),this.distance>Gd/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,r,s,c,p,d))}addHalfVertex({x:t,y:r},s,c,p,d,g,y){const w=.5*(this.lineClips?this.scaledDistance*(Gd-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(p?1:0),(r<<1)+(d?1:0),Math.round(63*s)+128,Math.round(63*c)+128,1+(g===0?0:g<0?-1:1)|(63&w)<<2,w>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const M=y.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,M,this.e2),y.primitiveLength++),d?this.e2=M:this.e1=M}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 Hd,Wd;$e("LineBucket",Nh,{omit:["layers","patternFeatures"]});var Xd={get paint(){return Wd=Wd||new ni({"line-opacity":new tt(se.paint_line["line-opacity"]),"line-color":new tt(se.paint_line["line-color"]),"line-translate":new Ge(se.paint_line["line-translate"]),"line-translate-anchor":new Ge(se.paint_line["line-translate-anchor"]),"line-width":new tt(se.paint_line["line-width"]),"line-gap-width":new tt(se.paint_line["line-gap-width"]),"line-offset":new tt(se.paint_line["line-offset"]),"line-blur"
5:new tt(se.paint_line["line-blur"]),"line-dasharray":new Vl(se.paint_line["line-dasharray"]),"line-pattern":new zo(se.paint_line["line-pattern"]),"line-gradient":new An(se.paint_line["line-gradient"])})},get layout(){return Hd=Hd||new ni({"line-cap":new Ge(se.layout_line["line-cap"]),"line-join":new tt(se.layout_line["line-join"]),"line-miter-limit":new Ge(se.layout_line["line-miter-limit"]),"line-round-limit":new Ge(se.layout_line["line-round-limit"]),"line-sort-key":new tt(se.layout_line["line-sort-key"])})}};class Gg extends tt{possiblyEvaluate(t,r){return r=new Ht(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(t,r)}evaluate(t,r,s,c){return r=wr({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(t,r,s,c)}}let bu;class Hg extends Zr{constructor(t){super(t,Xd),this.gradientVersion=0,bu||(bu=new Gg(Xd.paint.properties["line-width"].specification),bu.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 bs,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"]=bu.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Nh(t)}queryRadius(t){const r=t,s=Yd(Kl("line-width",this,r),Kl("line-gap-width",this,r)),c=Kl("line-offset",this,r);return s/2+Math.abs(c)+mu(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:r,featureState:s,geometry:c,transform:p,pixelsToTileUnits:d}){const g=gu(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-p.bearingInRadians,d),y=d/2*Yd(this.paint.get("line-width").evaluate(r,s),this.paint.get("line-gap-width").evaluate(r,s)),w=this.paint.get("line-offset").evaluate(r,s);return w&&(c=function(M,A){const z=[];for(let R=0;R<M.length;R++){const B=M[R],j=[];for(let V=0;V<B.length;V++){const W=B[V-1],oe=B[V],Q=B[V+1],L=V===0?new be(0,0):oe.sub(W)._unit()._perp(),$=V===B.length-1?new be(0,0):Q.sub(oe)._unit()._perp(),te=L._add($)._unit(),_e=te.x*$.x+te.y*$.y;_e!==0&&te._mult(1/_e),j.push(te._mult(A)._add(oe))}z.push(j)}return z}(c,w*d)),function(M,A,z){for(let R=0;R<A.length;R++){const B=A[R];if(M.length>=3){for(let j=0;j<B.length;j++)if(Ro(M,B[j]))return!0}if(ng(M,B,z))return!0}return!1}(g,c,y)}isTileClipped(){return!0}}function Yd(a,t){return t>0?t+2*a:a}const Wg=ar([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Xg=ar([{name:"a_projected_pos",components:3,type:"Float32"}],4);ar([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Yg=ar([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);ar([{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 Kd=ar([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Kg=ar([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Jg(a,t,r){return a.sections.forEach(s=>{s.text=function(c,p,d){const g=p.layout.get("text-transform").evaluate(d,{});return g==="uppercase"?c=c.toLocaleUpperCase():g==="lowercase"&&(c=c.toLocaleLowerCase()),za.applyArabicShaping&&(c=za.applyArabicShaping(c)),c}(s.text,t,r)}),a}ar([{name:"triangle",components:3,type:"Uint16"}]),ar([{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"}]),ar([{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"}]),ar([{type:"Float32",name:"offsetX"}]),ar([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),ar([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const lc={"!":"ï¸","#":"ï¼",$:"ï¼","%":"ï¼
","&":"ï¼","(":"︵",")":"︶","*":"ï¼","+":"ï¼",",":"ï¸","-":"︲",".":"ã»","/":"ï¼",":":"ï¸",";":"ï¸","<":"︿","=":"ï¼",">":"ï¹","?":"ï¸","@":"ï¼ ","[":"ï¹","\\":"ï¼¼","]":"ï¹","^":"ï¼¾",_:"︳","`":"ï½","{":"︷","|":"â","}":"︸","~":"ï½","¢":"ï¿ ","£":"ï¿¡","Â¥":"ï¿¥","¦":"¦","¬":"ï¿¢","¯":"ï¿£","â":"︲","â":"︱","â":"ï¹","â":"ï¹","â":"ï¹","â":"ï¹","â¦":"ï¸","â§":"ã»","â©":"₩","ã":"ï¸","ã":"ï¸","ã":"︿","ã":"ï¹","ã":"︽","ã":"︾","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"︻","ã":"︼","ã":"︹","ã":"︺","ã":"ï¸","ã":"ï¸","ï¼":"ï¸","ï¼":"︵","ï¼":"︶","ï¼":"ï¸","ï¼":"︲","ï¼":"ã»","ï¼":"ï¸","ï¼":"ï¸","ï¼":"︿","ï¼":"ï¹","ï¼":"ï¸","ï¼»":"ï¹","ï¼½":"ï¹","_":"︳","ï½":"︷","ï½":"â","ï½":"︸","ï½":"︵","ï½ ":"︶","。":"ï¸","ï½¢":"ï¹","ï½£":"ï¹"};var Jd,Uh,Qd,Rr=24,$h={};function Qg(){return Jd||(Jd=1,$h.read=function(a,t,r,s,c){var p,d,g=8*c-s-1,y=(1<<g)-1,w=y>
5>1,M=-7,A=r?c-1:0,z=r?-1:1,R=a[t+A];for(A+=z,p=R&(1<<-M)-1,R>>=-M,M+=g;M>0;p=256*p+a[t+A],A+=z,M-=8);for(d=p&(1<<-M)-1,p>>=-M,M+=s;M>0;d=256*d+a[t+A],A+=z,M-=8);if(p===0)p=1-w;else{if(p===y)return d?NaN:1/0*(R?-1:1);d+=Math.pow(2,s),p-=w}return(R?-1:1)*d*Math.pow(2,p-s)},$h.write=function(a,t,r,s,c,p){var d,g,y,w=8*p-c-1,M=(1<<w)-1,A=M>>1,z=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,R=s?0:p-1,B=s?1:-1,j=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(g=isNaN(t)?1:0,d=M):(d=Math.floor(Math.log(t)/Math.LN2),t*(y=Math.pow(2,-d))<1&&(d--,y*=2),(t+=d+A>=1?z/y:z*Math.pow(2,1-A))*y>=2&&(d++,y/=2),d+A>=M?(g=0,d=M):d+A>=1?(g=(t*y-1)*Math.pow(2,c),d+=A):(g=t*Math.pow(2,A-1)*Math.pow(2,c),d=0));c>=8;a[r+R]=255&g,R+=B,g/=256,c-=8);for(d=d<<c|g,w+=c;w>0;a[r+R]=255&d,R+=B,d/=256,w-=8);a[r+R-B]|=128*j}),$h}function ef(){if(Qd)return Uh;Qd=1,Uh=t;var a=Qg();function t(L){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(L)?L:new Uint8Array(L||0),this.pos=0,this.type=0,this.length=this.buf.length}t.Varint=0,t.Fixed64=1,t.Bytes=2,t.Fixed32=5;var r=4294967296,s=1/r,c=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function p(L){return L.type===t.Bytes?L.readVarint()+L.pos:L.pos+1}function d(L,$,te){return te?4294967296*$+(L>>>0):4294967296*($>>>0)+(L>>>0)}function g(L,$,te){var _e=$<=16383?1:$<=2097151?2:$<=268435455?3:Math.floor(Math.log($)/(7*Math.LN2));te.realloc(_e);for(var ze=te.pos-1;ze>=L;ze--)te.buf[ze+_e]=te.buf[ze]}function y(L,$){for(var te=0;te<L.length;te++)$.writeVarint(L[te])}function w(L,$){for(var te=0;te<L.length;te++)$.writeSVarint(L[te])}function M(L,$){for(var te=0;te<L.length;te++)$.writeFloat(L[te])}function A(L,$){for(var te=0;te<L.length;te++)$.writeDouble(L[te])}function z(L,$){for(var te=0;te<L.length;te++)$.writeBoolean(L[te])}function R(L,$){for(var te=0;te<L.length;te++)$.writeFixed32(L[te])}function B(L,$){for(var te=0;te<L.length;te++)$.writeSFixed32(L[te])}function j(L,$){for(var te=0;te<L.length;te++)$.writeFixed64(L[te])}function V(L,$){for(var te=0;te<L.length;te++)$.writeSFixed64(L[te])}function W(L,$){return(L[$]|L[$+1]<<8|L[$+2]<<16)+16777216*L[$+3]}function oe(L,$,te){L[te]=$,L[te+1]=$>>>8,L[te+2]=$>>>16,L[te+3]=$>>>24}function Q(L,$){return(L[$]|L[$+1]<<8|L[$+2]<<16)+(L[$+3]<<24)}return t.prototype={destroy:function(){this.buf=null},readFields:function(L,$,te){for(te=te||this.length;this.pos<te;){var _e=this.readVarint(),ze=_e>>3,we=this.pos;this.type=7&_e,L(ze,$,this),this.pos===we&&this.skip(_e)}return $},readMessage:function(L,$){return this.readFields(L,$,this.readVarint()+this.pos)},readFixed32:function(){var L=W(this.buf,this.pos);return this.pos+=4,L},readSFixed32:function(){var L=Q(this.buf,this.pos);return this.pos+=4,L},readFixed64:function(){var L=W(this.buf,this.pos)+W(this.buf,this.pos+4)*r;return this.pos+=8,L},readSFixed64:function(){var L=W(this.buf,this.pos)+Q(this.buf,this.pos+4)*r;return this.pos+=8,L},readFloat:function(){var L=a.read(this.buf,this.pos,!0,23,4);return this.pos+=4,L},readDouble:function(){var L=a.read(this.buf,this.pos,!0,52,8);return this.pos+=8,L},readVarint:function(L){var $,te,_e=this.buf;return $=127&(te=_e[this.pos++]),te<128?$:($|=(127&(te=_e[this.pos++]))<<7,te<128?$:($|=(127&(te=_e[this.pos++]))<<14,te<128?$:($|=(127&(te=_e[this.pos++]))<<21,te<128?$:function(ze,we,Se){var Re,Ee,Le=Se.buf;if(Re=(112&(Ee=Le[Se.pos++]))>>4,Ee<128||(Re|=(127&(Ee=Le[Se.pos++]))<<3,Ee<128)||(Re|=(127&(Ee=Le[Se.pos++]))<<10,Ee<128)||(Re|=(127&(Ee=Le[Se.pos++]))<<17,Ee<128)||(Re|=(127&(Ee=Le[Se.pos++]))<<24,Ee<128)||(Re|=(1&(Ee=Le[Se.pos++]))<<31,Ee<128))return d(ze,Re,we);throw new Error("Expected varint not more than 10 bytes")}($|=(15&(te=_e[this.pos]))<<28,L,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var L=this.readVarint();return L%2==1?(L+1)/-2:L/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var L=this.readVarint()+this.pos,$=this.pos;return this.pos=L,L-$>=12&&c?function(te,_e,ze){return c.decode(te.subarray(_e,ze))}(this.buf,$,L):function(te,_e,ze){for(var we="",Se=_e;Se<ze;){var Re,Ee,Le,Me=te[Se],qe=null,Qe=Me>239?4:Me>223?3:Me>191?2:1;if(Se+Qe>ze)break;Qe===1?Me<128&&(qe=Me):Qe===2?(192&(Re=te[Se+1]))==128&&(qe=(31&Me)<<6|63&Re)<=127&&(qe=null):Qe===3?(Ee=te[Se+2],(192&(Re=te[Se+1]))==128&&(192&Ee)==128&&((qe=(15&Me)<<12|(63&Re)<<6|63&Ee)<=2047||qe>=55296&&qe<=57343)&&(qe=null)):Qe===4&&(Ee=te[Se+2],Le=te[Se+3],(192&(Re=te[Se+1]))==128&&(192&Ee)==128&&(192&Le)==128&&((qe=(15&Me)<<18|(63&Re)<<12|(63&Ee)<<6|63&Le)<=65535||qe>=1114112)&&(qe=null)),qe===null?(qe=65533,Qe=1):qe>65535&&(qe-=65536,we+=String.fromCharCode(qe>>>10&1023|55296),qe=56320|1023&qe),we+=String.fromCharCode(qe),Se+=Qe}return we}
vendor: 5,885 bytes, line 5
5(this.buf,$,L)},readBytes:function(){var L=this.readVarint()+this.pos,$=this.buf.subarray(this.pos,L);return this.pos=L,$},readPackedVarint:function(L,$){if(this.type!==t.Bytes)return L.push(this.readVarint($));var te=p(this);for(L=L||[];this.pos<te;)L.push(this.readVarint($));return L},readPackedSVarint:function(L){if(this.type!==t.Bytes)return L.push(this.readSVarint());var $=p(this);for(L=L||[];this.pos<$;)L.push(this.readSVarint());return L},readPackedBoolean:function(L){if(this.type!==t.Bytes)return L.push(this.readBoolean());var $=p(this);for(L=L||[];this.pos<$;)L.push(this.readBoolean());return L},readPackedFloat:function(L){if(this.type!==t.Bytes)return L.push(this.readFloat());var $=p(this);for(L=L||[];this.pos<$;)L.push(this.readFloat());return L},readPackedDouble:function(L){if(this.type!==t.Bytes)return L.push(this.readDouble());var $=p(this);for(L=L||[];this.pos<$;)L.push(this.readDouble());return L},readPackedFixed32:function(L){if(this.type!==t.Bytes)return L.push(this.readFixed32());var $=p(this);for(L=L||[];this.pos<$;)L.push(this.readFixed32());return L},readPackedSFixed32:function(L){if(this.type!==t.Bytes)return L.push(this.readSFixed32());var $=p(this);for(L=L||[];this.pos<$;)L.push(this.readSFixed32());return L},readPackedFixed64:function(L){if(this.type!==t.Bytes)return L.push(this.readFixed64());var $=p(this);for(L=L||[];this.pos<$;)L.push(this.readFixed64());return L},readPackedSFixed64:function(L){if(this.type!==t.Bytes)return L.push(this.readSFixed64());var $=p(this);for(L=L||[];this.pos<$;)L.push(this.readSFixed64());return L},skip:function(L){var $=7&L;if($===t.Varint)for(;this.buf[this.pos++]>127;);else if($===t.Bytes)this.pos=this.readVarint()+this.pos;else if($===t.Fixed32)this.pos+=4;else{if($!==t.Fixed64)throw new Error("Unimplemented type: "+$);this.pos+=8}},writeTag:function(L,$){this.writeVarint(L<<3|$)},realloc:function(L){for(var $=this.length||16;$<this.pos+L;)$*=2;if($!==this.length){var te=new Uint8Array($);te.set(this.buf),this.buf=te,this.length=$}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(L){this.realloc(4),oe(this.buf,L,this.pos),this.pos+=4},writeSFixed32:function(L){this.realloc(4),oe(this.buf,L,this.pos),this.pos+=4},writeFixed64:function(L){this.realloc(8),oe(this.buf,-1&L,this.pos),oe(this.buf,Math.floor(L*s),this.pos+4),this.pos+=8},writeSFixed64:function(L){this.realloc(8),oe(this.buf,-1&L,this.pos),oe(this.buf,Math.floor(L*s),this.pos+4),this.pos+=8},writeVarint:function(L){(L=+L||0)>268435455||L<0?function($,te){var _e,ze;if($>=0?(_e=$%4294967296|0,ze=$/4294967296|0):(ze=~(-$/4294967296),4294967295^(_e=~(-$%4294967296))?_e=_e+1|0:(_e=0,ze=ze+1|0)),$>=18446744073709552e3||$<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");te.realloc(10),function(we,Se,Re){Re.buf[Re.pos++]=127&we|128,we>>>=7,Re.buf[Re.pos++]=127&we|128,we>>>=7,Re.buf[Re.pos++]=127&we|128,we>>>=7,Re.buf[Re.pos++]=127&we|128,Re.buf[Re.pos]=127&(we>>>=7)}(_e,0,te),function(we,Se){var Re=(7&we)<<4;Se.buf[Se.pos++]|=Re|((we>>>=3)?128:0),we&&(Se.buf[Se.pos++]=127&we|((we>>>=7)?128:0),we&&(Se.buf[Se.pos++]=127&we|((we>>>=7)?128:0),we&&(Se.buf[Se.pos++]=127&we|((we>>>=7)?128:0),we&&(Se.buf[Se.pos++]=127&we|((we>>>=7)?128:0),we&&(Se.buf[Se.pos++]=127&we)))))}(ze,te)}(L,this):(this.realloc(4),this.buf[this.pos++]=127&L|(L>127?128:0),L<=127||(this.buf[this.pos++]=127&(L>>>=7)|(L>127?128:0),L<=127||(this.buf[this.pos++]=127&(L>>>=7)|(L>127?128:0),L<=127||(this.buf[this.pos++]=L>>>7&127))))},writeSVarint:function(L){this.writeVarint(L<0?2*-L-1:2*L)},writeBoolean:function(L){this.writeVarint(!!L)},writeString:function(L){L=String(L),this.realloc(4*L.length),this.pos++;var $=this.pos;this.pos=function(_e,ze,we){for(var Se,Re,Ee=0;Ee<ze.length;Ee++){if((Se=ze.charCodeAt(Ee))>55295&&Se<57344){if(!Re){Se>56319||Ee+1===ze.length?(_e[we++]=239,_e[we++]=191,_e[we++]=189):Re=Se;continue}if(Se<56320){_e[we++]=239,_e[we++]=191,_e[we++]=189,Re=Se;continue}Se=Re-55296<<10|Se-56320|65536,Re=null}else Re&&(_e[we++]=239,_e[we++]=191,_e[we++]=189,Re=null);Se<128?_e[we++]=Se:(Se<2048?_e[we++]=Se>>6|192:(Se<65536?_e[we++]=Se>>12|224:(_e[we++]=Se>>18|240,_e[we++]=Se>>12&63|128),_e[we++]=Se>>6&63|128),_e[we++]=63&Se|128)}return we}(this.buf,L,this.pos);var te=this.pos-$;te>=128&&g($,te,this),this.pos=$-1,this.writeVarint(te),this.pos+=te},writeFloat:function(L){this.realloc(4),a.write(this.buf,L,this.pos,!0,23,4),this.pos+=4},writeDouble:function(L){this.realloc(8),a.write(this.buf,L,this.pos,!0,52,8),this.pos+=8},writeBytes:function(L){var $=L.length;this.writeVarint($),this.realloc($);for(var te=0;te<$;te++)this.buf[this.pos++]=L[te]},writeRawMessage:function(L,$){this.pos++;var te=this.pos;L($,this);var _e=this.pos-te;_e>=128&&g(te,_e,this),this.pos=te-1,this.writeVarint(_e),this.pos+=_e},writeMessage:function(L,$,te){this.writeTag(L,t.Bytes),this.writeRawMessage($,te)},writePackedVarint:function(L,$){$.length&&this.writeMessage(L,y,$)},writePackedSVarint:function(L,$){$.length&&this.writeMessage(L,w,$)},writePackedBoolean:function(L,$){$.length&&this.writeMessage(L,z,$)},writePackedFloat:function(L,$){$.length&&this.writeMessage(L,M,$)},writePackedDouble:function(L,$){$.length&&this.writeMessage(L,A,$)},writePackedFixed32:function(L,$){$.length&&this.writeMessage(L,R,$)},writePackedSFixed32:function(L,$){$.length&&this.writeMessage(L,B,$)},writePackedFixed64:function(L,$){$.length&&this.writeMessage(L,j,$)},writePackedSFixed64:function(L,$){$.length&&this.writeMessage(L,V,$)},writeBytesField:function(L,$){this.writeTag(L,t.Bytes),this.writeBytes($)},writeFixed32Field:function(L,$){this.writeTag(L,t.Fixed32),this.writeFixed32($)},writeSFixed32Field:function(L,$){this.writeTag(L,t.Fixed32),this.writeSFixed32($)},writeFixed64Field:function(L,$){this.writeTag(L,t.Fixed64),this.writeFixed64
5($)},writeSFixed64Field:function(L,$){this.writeTag(L,t.Fixed64),this.writeSFixed64($)},writeVarintField:function(L,$){this.writeTag(L,t.Varint),this.writeVarint($)},writeSVarintField:function(L,$){this.writeTag(L,t.Varint),this.writeSVarint($)},writeStringField:function(L,$){this.writeTag(L,t.Bytes),this.writeString($)},writeFloatField:function(L,$){this.writeTag(L,t.Fixed32),this.writeFloat($)},writeDoubleField:function(L,$){this.writeTag(L,t.Fixed64),this.writeDouble($)},writeBooleanField:function(L,$){this.writeVarintField(L,!!$)}},Uh}var Vs,Vh=fe(ef());function e_(a,t,r){a===1&&r.readMessage(t_,t)}function t_(a,t,r){if(a===3){const{id:s,bitmap:c,width:p,height:d,left:g,top:y,advance:w}=r.readMessage(r_,{});t.push({id:s,bitmap:new Jl({width:p+6,height:d+6},c),metrics:{width:p,height:d,left:g,top:y,advance:w}})}}function r_(a,t,r){a===1?t.id=r.readVarint():a===2?t.bitmap=r.readBytes():a===3?t.width=r.readVarint():a===4?t.height=r.readVarint():a===5?t.left=r.readSVarint():a===6?t.top=r.readSVarint():a===7&&(t.advance=r.readVarint())}function tf(a){let t=0,r=0;for(const d of a)t+=d.w*d.h,r=Math.max(r,d.w);a.sort((d,g)=>g.h-d.h);const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}];let c=0,p=0;for(const d of a)for(let g=s.length-1;g>=0;g--){const y=s[g];if(!(d.w>y.w||d.h>y.h)){if(d.x=y.x,d.y=y.y,p=Math.max(p,d.y+d.h),c=Math.max(c,d.x+d.w),d.w===y.w&&d.h===y.h){const w=s.pop();g<s.length&&(s[g]=w)}else d.h===y.h?(y.x+=d.w,y.w-=d.w):d.w===y.w?(y.y+=d.h,y.h-=d.h):(s.push({x:y.x+d.w,y:y.y,w:y.w-d.w,h:d.h}),y.y+=d.h,y.h-=d.h);break}}return{w:c,h:p,fill:t/(c*p)||0}}class Zh{constructor(t,{pixelRatio:r,version:s,stretchX:c,stretchY:p,content:d,textFitWidth:g,textFitHeight:y}){this.paddedRect=t,this.pixelRatio=r,this.stretchX=c,this.stretchY=p,this.content=d,this.version=s,this.textFitWidth=g,this.textFitHeight=y}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class rf{constructor(t,r){const s={},c={};this.haveRenderCallbacks=[];const p=[];this.addImages(t,s,p),this.addImages(r,c,p);const{w:d,h:g}=tf(p),y=new wi({width:d||1,height:g||1});for(const w in t){const M=t[w],A=s[w].paddedRect;wi.copy(M.data,y,{x:0,y:0},{x:A.x+1,y:A.y+1},M.data)}for(const w in r){const M=r[w],A=c[w].paddedRect,z=A.x+1,R=A.y+1,B=M.data.width,j=M.data.height;wi.copy(M.data,y,{x:0,y:0},{x:z,y:R},M.data),wi.copy(M.data,y,{x:0,y:j-1},{x:z,y:R-1},{width:B,height:1}),wi.copy(M.data,y,{x:0,y:0},{x:z,y:R+j},{width:B,height:1}),wi.copy(M.data,y,{x:B-1,y:0},{x:z-1,y:R},{width:1,height:j}),wi.copy(M.data,y,{x:0,y:0},{x:z+B,y:R},{width:1,height:j})}this.image=y,this.iconPositions=s,this.patternPositions=c}addImages(t,r,s){for(const c in t){const p=t[c],d={x:0,y:0,w:p.data.width+2,h:p.data.height+2};s.push(d),r[c]=new Zh(d,p),p.hasRenderCallback&&this.haveRenderCallbacks.push(c)}}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[c,p]=t.tl;s.update(r.data,void 0,{x:c,y:p})}}$e("ImagePosition",Zh),$e("ImageAtlas",rf),T.an=void 0,(Vs=T.an||(T.an={}))[Vs.none=0]="none",Vs[Vs.horizontal=1]="horizontal",Vs[Vs.vertical=2]="vertical",Vs[Vs.horizontalOnly=3]="horizontalOnly";class cc{constructor(){this.scale=1,this.fontStack="",this.imageName=null,this.verticalAlign="bottom"}static forText(t,r,s){const c=new cc;return c.scale=t||1,c.fontStack=r,c.verticalAlign=s||"bottom",c}static forImage(t,r){const s=new cc;return s.imageName=t,s.verticalAlign=r||"bottom",s}}class jo{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,r){const s=new jo;for(let c=0;c<t.sections.length;c++){const p=t.sections[c];p.image?s.addImageSection(p):s.addTextSection(p,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 c=t.charCodeAt(s+1)||null,p=t.charCodeAt(s-1)||null;r+=c&&Nl(c)&&!lc[t[s+1]]||p&&Nl(p)&&!lc[t[s-1]]||!lc[t[s]]?t[s]:lc[t[s]]}return r}(this.text)}trim(){let t=0;for(let s=0;s<this.text.length&&Tu[this.text.charCodeAt(s)];s++)t++;let r=this.text.length;for(let s=this.text.length-1;s>=0&&s>=t&&Tu[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)}getMaxImageSize(t){let r=0,s=0;for(let c=0;c<this.length();c++){const p=this.getSection(c);if(p.imageName){const d=t[p.imageName];if(!d)continue;const g=d.displaySize;r=Math.max(r,g[0]),s=Math.max(s,g[1])}}return{maxImageWidth:r,maxImageHeight:s}}addTextSection(t,r){this.text+=t.text,this.sections.push(cc.forText(t.scale,t.fontStack||r,t.verticalAlign));const s=this.sections.length-1;for(let c=0;c<t.text.length;++c)this.sectionIndex.push(s)}addImageSection(t){const r=t.image?t.image.name:"";if(r.length===0)return void rr("Can't add FormattedSection with an empty image.");const s=this.getNextImageSectionCharCode();s?(this.text+=String.fromCharCode(s),this.sections.push(cc.forImage(r,t.verticalAlign)),this.sectionIndex.push(this.sections.length-1)):rr("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function wu(a,t,r,s,c,p,d,g,y,w,M,A,z,R,B){const j=jo.fromFeature(a,c);let V;A===T.an.vertical&&j.verticalizePunctuation();const{processBidirectionalText:W,processStyledBidirectionalText:oe}=za;if(W&&j.sections.length===1){V=[];const $=W(j.toString(),qh(j,w,p,t,s,R));for(const te of $){const _e=new jo;_e.text=te,_e.sections=j.sections;for(let ze=0;ze<te.length;ze++)_e.sectionIndex.push(0);V.push(_e)}}else if(oe){V=[];const $=oe(j.text,j.sectionIndex,qh(j,w,p,t,s,R));for(const te of $){const _e=new jo;_e.text=te[0],_e.sectionIndex=te[1],_e.sections=j.sections,V.push(_e)}}else V=function($,te){const _e=[],ze=$.text;let we=0;for(const Se of te)_e.push($.substring(we,Se)),we=Se;return we<ze.length&&_e.push($.substring(we,ze.length)),_e}(j,qh(j,w,p,t,s,R));const Q=[],L={positionedLines:Q,text:j.toString(),top:M[1],bottom:M[1],left:M[0],right:M[0],writingMode:A,iconsInText:!1,verticalizable:!1};return function($,te,_e,ze,we,Se,Re,Ee,Le,Me,qe,Qe){let Ke=0,He=0,vt=0,sr=0;const Ir=Ee==="right"?1:Ee==="left"?0:.5,ti=Rr/Qe;let Ki=0;for(const tr of we){tr.trim();const Fr=tr.getMaxScale(),Wr={positionedGlyphs:[],lineOffset:0};$.positionedLines[Ki]=Wr;const Xr=Wr.positionedGlyphs;let gi=0;if(!tr.length()){He+=Se,++Ki;continue}const Ji=n_(ze,tr,ti);for(let Si=0;Si<tr.length();Si++){const Ar=tr.getSection(Si),Or=tr.getSectionIndex(Si),jr=tr.getCharCode(Si),yr=o_(Le,qe,jr);let Zt;if(Ar.imageName){if($.iconsInText=!0,Ar.scale=Ar.scale*ti,Zt=c_(Ar,yr,Fr,Ji,ze),!Zt)continue;gi=Math.max(gi,Zt.imageOffset)}else if(Zt=l_(Ar,jr,yr,Ji,te,_e),!Zt)continue;const{rect:ba,metrics:Vo,baselineOffset:wa}=Zt;
5Xr.push({glyph:jr,imageName:Ar.imageName,x:Ke,y:He+wa+-17,vertical:yr,scale:Ar.scale,fontStack:Ar.fontStack,sectionIndex:Or,metrics:Vo,rect:ba}),yr?($.verticalizable=!0,Ke+=(Ar.imageName?Vo.advance:Rr)*Ar.scale+Me):Ke+=Vo.advance*Ar.scale+Me}Xr.length!==0&&(vt=Math.max(Ke-Me,vt),u_(Xr,0,Xr.length-1,Ir)),Ke=0,Wr.lineOffset=Math.max(gi,(Fr-1)*Rr);const Br=Se*Fr+gi;He+=Br,sr=Math.max(Br,sr),++Ki}const{horizontalAlign:Ti,verticalAlign:Hr}=Gh(Re);(function(tr,Fr,Wr,Xr,gi,Ji,Br,Si,Ar){const Or=(Fr-Wr)*gi;let jr=0;jr=Ji!==Br?-Si*Xr- -17:-Xr*Ar*Br+.5*Br;for(const yr of tr)for(const Zt of yr.positionedGlyphs)Zt.x+=Or,Zt.y+=jr})($.positionedLines,Ir,Ti,Hr,vt,sr,Se,He,we.length),$.top+=-Hr*He,$.bottom=$.top+He,$.left+=-Ti*vt,$.right=$.left+vt}(L,t,r,s,V,d,g,y,A,w,z,B),!function($){for(const te of $)if(te.positionedGlyphs.length!==0)return!1;return!0}(Q)&&L}const Tu={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},i_={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},a_={40:!0};function af(a,t,r,s,c,p){if(t.imageName){const d=s[t.imageName];return d?d.displaySize[0]*t.scale*Rr/p+c:0}{const d=r[t.fontStack],g=d&&d[a];return g?g.metrics.advance*t.scale+c:0}}function sf(a,t,r,s){const c=Math.pow(a-t,2);return s?a<t?c/2:2*c:c+Math.abs(r)*r}function s_(a,t,r){let s=0;return a===10&&(s-=1e4),r&&(s+=150),a!==40&&a!==65288||(s+=50),t!==41&&t!==65289||(s+=50),s}function nf(a,t,r,s,c,p){let d=null,g=sf(t,r,c,p);for(const y of s){const w=sf(t-y.x,r,c,p)+y.badness;w<=g&&(d=y,g=w)}return{index:a,x:t,priorBreak:d,badness:g}}function of(a){return a?of(a.priorBreak).concat(a.index):[]}function qh(a,t,r,s,c,p){if(!a)return[];const d=[],g=function(A,z,R,B,j,V){let W=0;for(let oe=0;oe<A.length();oe++){const Q=A.getSection(oe);W+=af(A.getCharCode(oe),Q,B,j,z,V)}return W/Math.max(1,Math.ceil(W/R))}(a,t,r,s,c,p),y=a.text.indexOf("â")>=0;let w=0;for(let A=0;A<a.length();A++){const z=a.getSection(A),R=a.getCharCode(A);if(Tu[R]||(w+=af(R,z,s,c,t,p)),A<a.length()-1){const B=!((M=R)<11904)&&(!!yt["CJK Compatibility Forms"](M)||!!yt["CJK Compatibility"](M)||!!yt["CJK Strokes"](M)||!!yt["CJK Symbols and Punctuation"](M)||!!yt["Enclosed CJK Letters and Months"](M)||!!yt["Halfwidth and Fullwidth Forms"](M)||!!yt["Ideographic Description Characters"](M)||!!yt["Vertical Forms"](M)||jl.test(String.fromCodePoint(M)));(i_[R]||B||z.imageName||A!==a.length()-2&&a_[a.getCharCode(A+1)])&&d.push(nf(A+1,w,g,d,s_(R,a.getCharCode(A+1),B&&y),!1))}}var M;return of(nf(a.length(),w,g,d,0,!0))}function Gh(a){let t=.5,r=.5;switch(a){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(a){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}}function n_(a,t,r){const s=t.getMaxScale()*Rr,{maxImageWidth:c,maxImageHeight:p}=t.getMaxImageSize(a),d=Math.max(s,p*r);return{verticalLineContentWidth:Math.max(s,c*r),horizontalLineContentHeight:d}}function lf(a){switch(a){case"top":return 0;case"center":return .5;default:return 1}}function o_(a,t,r){return!(a===T.an.horizontal||!t&&!Po(r)||t&&(Tu[r]||(s=r,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(s)))));var s}function l_(a,t,r,s,c,p){const d=p[a.fontStack],g=function(w,M,A,z){if(w&&w.rect)return w;const R=M[A.fontStack],B=R&&R[z];return B?{rect:null,metrics:B.metrics}:null}(d&&d[t],c,a,t);if(g===null)return null;let y;if(r)y=s.verticalLineContentWidth-a.scale*Rr;else{const w=lf(a.verticalAlign);y=(s.horizontalLineContentHeight-a.scale*Rr)*w}return{rect:g.rect,metrics:g.metrics,baselineOffset:y}}function c_(a,t,r,s,c){const p=c[a.imageName];if(!p)return null;const d=p.paddedRect,g=p.displaySize,y={width:g[0],height:g[1],left:1,top:-3,advance:t?g[1]:g[0]};let w;if(t)w=s.verticalLineContentWidth-g[1]*a.scale;else{const M=lf(a.verticalAlign);w=(s.horizontalLineContentHeight-g[1]*a.scale)*M}return{rect:d,metrics:y,baselineOffset:w,imageOffset:(t?g[0]:g[1])*a.scale-Rr*r}}function u_(a,t,r,s){if(s===0)return;const c=a[r],p=(a[r].x+c.metrics.advance*c.scale)*s;for(let d=t;d<=r;d++)a[d].x-=p}function h_(a,t,r){const{horizontalAlign:s,verticalAlign:c}=Gh(r),p=t[0]-a.displaySize[0]*s,d=t[1]-a.displaySize[1]*c;return{image:a,top:d,bottom:d+a.displaySize[1],left:p,right:p+a.displaySize[0]}}function cf(a){var t,r;let s=a.left,c=a.top,p=a.right-s,d=a.bottom-c;const g=(t=a.image.textFitWidth)!==null&&t!==void 0?t:"stretchOrShrink",y=(r=a.image.textFitHeight)!==null&&r!==void 0?r:"stretchOrShrink",w=(a.image.content[2]-a.image.content[0])/(a.image.content[3]-a.image.content[1]);if(y==="proportional"){if(g==="stretchOnly"&&p/d<w||g==="proportional"){const M=Math.ceil(d*w);s*=M/p,p=M}}else if(g==="proportional"&&y==="stretchOnly"&&w!==0&&p/d>w){const M=Math.ceil(p/w);c*=M/d,d=M}return{x1:s,y1:c,x2:s+p,y2:c+d}}function uf(a,t,r,s,c,p){const d=a.image;let g;if(d.content){const V=d.content,W=d.pixelRatio||1;g=[V[0]/W,V[1]/W,d.displaySize[0]-V[2]/W,d.displaySize[1]-V[3]/W]}const y=t.left*p,w=t.right*p;let M,A,z,R;r==="width"||r==="both"?(R=c[0]+y-s[3],A=c[0]+w+s[1]):(R=c[0]+(y+w-d.displaySize[0])/2,A=R+d.displaySize[0]);
5const B=t.top*p,j=t.bottom*p;return r==="height"||r==="both"?(M=c[1]+B-s[0],z=c[1]+j+s[2]):(M=c[1]+(B+j-d.displaySize[1])/2,z=M+d.displaySize[1]),{image:d,top:M,right:A,bottom:z,left:R,collisionPadding:g}}const ls=128,Zs=32640;function hf(a,t){const{expression:r}=t;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new Ht(a+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:s,interpolationType:c}=r;let p=0;for(;p<s.length&&s[p]<=a;)p++;p=Math.max(0,p-1);let d=p;for(;d<s.length&&s[d]<a+1;)d++;d=Math.min(s.length-1,d);const g=s[p],y=s[d];return r.kind==="composite"?{kind:"composite",minZoom:g,maxZoom:y,interpolationType:c}:{kind:"camera",minZoom:g,maxZoom:y,minSize:r.evaluate(new Ht(g)),maxSize:r.evaluate(new Ht(y)),interpolationType:c}}}function Hh(a,t,r){let s="never";const c=a.get(t);return c?s=c:a.get(r)&&(s="always"),s}const p_=sc.VectorTileFeature.types,d_=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Su(a,t,r,s,c,p,d,g,y,w,M,A,z){const R=g?Math.min(Zs,Math.round(g[0])):0,B=g?Math.min(Zs,Math.round(g[1])):0;a.emplaceBack(t,r,Math.round(32*s),Math.round(32*c),p,d,(R<<1)+(y?1:0),B,16*w,16*M,256*A,256*z)}function Wh(a,t,r){a.emplaceBack(t.x,t.y,r),a.emplaceBack(t.x,t.y,r),a.emplaceBack(t.x,t.y,r),a.emplaceBack(t.x,t.y,r)}function f_(a){for(const t of a.sections)if(Ul(t.text))return!0;return!1}class Xh{constructor(t){this.layoutVertexArray=new ut,this.indexArray=new Ot,this.programConfigurations=t,this.segments=new St,this.dynamicLayoutVertexArray=new kt,this.opacityVertexArray=new Qt,this.hasVisibleVertices=!1,this.placedSymbolArray=new H}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,r,s,c){this.isEmpty()||(s&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Wg.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Xg.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,d_,!0),this.opacityVertexBuffer.itemSize=1),(s||c)&&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",Xh);class Yh{constructor(t,r,s){this.layoutVertexArray=new t,this.layoutAttributes=r,this.indexArray=new s,this.segments=new St,this.collisionVertexArray=new er}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Yg.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}$e("CollisionBuffers",Yh);class No{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.globalState=t.globalState,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(d=>d.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=hf(this.zoom,r["text-size"]),this.iconSizeData=hf(this.zoom,r["icon-size"]);const s=this.layers[0].layout,c=s.get("symbol-sort-key"),p=s.get("symbol-z-order");this.canOverlap=Hh(s,"text-overlap","text-allow-overlap")!=="never"||Hh(s,"icon-overlap","icon-allow-overlap")!=="never"||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=p!=="viewport-y"&&!c.isConstant(),this.sortFeaturesByY=(p==="viewport-y"||p==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,s.get("symbol-placement")==="point"&&(this.writingModes=s.get("text-writing-mode").map(d=>T.an[d])),this.stateDependentLayerIds=this.layers.filter(d=>d.isStateDependent()).map(d=>d.id),this.sourceID=t.sourceID}createArrays(){this.text=new Xh(new ja(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new Xh(new ja(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new Y,this.lineVertexArray=new re,this.symbolInstances=new ee,this.textAnchorOffsets=new K}calculateGlyphDependencies(t,r,s,c,p){for(let d=0;d<t.length;d++)if(r[t.charCodeAt(d)]=!0,(s||c)&&p){const g=lc[t.charAt(d)];g&&(r[g.charCodeAt(0)]=!0)}}populate(t,r,s){const c=this.layers[0],p=c.layout,d=p.get("text-font"),g=p.get("text-field"),y=p.get("icon-image"),w=(g.value.kind!=="constant"||g.value.value instanceof Jr&&!g.value.value.isEmpty()||g.value.value.toString().length>0)&&(d.value.kind!=="constant"||d.value.value.length>0),M=y.value.kind!=="constant"||!!y.value.value||Object.keys(y.parameters).length>0,A=p.get("symbol-sort-key");if(this.features=[],!w&&!M)return;const z=r.iconDependencies,R=r.glyphDependencies,B=r.availableImages,j=new Ht(this.zoom,{globalState:this.globalState});for(const{feature:V,id:W,index:oe,sourceLayerIndex:Q}of t){const L=c._featureFilter.needGeometry,$=Rn(V,L);if(!c._featureFilter.filter(j,$,s))continue;let te,_e;if(L||($.geometry=Ln(V)),w){const we=c.getValueAndResolveTokens("text-field",$,s,B),Se=Jr.factory(we),Re=this.hasRTLText=this.hasRTLText||f_(Se);(!Re||za.getRTLTextPluginStatus()==="unavailable"||Re&&za.isParsed())&&(te=Jg(Se,c,$))}if(M){const we=c.getValueAndResolveTokens("icon-image",$,s,B);_e=we instanceof hi?we:hi.fromString(we)}if(!te&&!_e)continue;const ze=this.sortFeaturesByKey?A.evaluate($,{},s):void 0;if(this.features.push({id:W,text:te,icon:_e,index:oe,sourceLayerIndex:Q,geometry:$.geometry,properties:V.properties,type:p_[V.type],sortKey:ze}),_e&&(z[_e.name]=!0),te){const we=d.evaluate($,{},s).join(","),Se=p.get("text-rotation-alignment")!=="viewport"&&p.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(T.an.vertical)>=0;for(const Re of te.sections)if(Re.image)z[Re.image.name]=!0;
5else{const Ee=Ol(te.toString()),Le=Re.fontStack||we,Me=R[Le]=R[Le]||{};this.calculateGlyphDependencies(Re.text,Me,Se,this.allowVerticalPlacement,Ee)}}}p.get("symbol-placement")==="line"&&(this.features=function(V){const W={},oe={},Q=[];let L=0;function $(we){Q.push(V[we]),L++}function te(we,Se,Re){const Ee=oe[we];return delete oe[we],oe[Se]=Ee,Q[Ee].geometry[0].pop(),Q[Ee].geometry[0]=Q[Ee].geometry[0].concat(Re[0]),Ee}function _e(we,Se,Re){const Ee=W[Se];return delete W[Se],W[we]=Ee,Q[Ee].geometry[0].shift(),Q[Ee].geometry[0]=Re[0].concat(Q[Ee].geometry[0]),Ee}function ze(we,Se,Re){const Ee=Re?Se[0][Se[0].length-1]:Se[0][0];return`${we}:${Ee.x}:${Ee.y}`}for(let we=0;we<V.length;we++){const Se=V[we],Re=Se.geometry,Ee=Se.text?Se.text.toString():null;if(!Ee){$(we);continue}const Le=ze(Ee,Re),Me=ze(Ee,Re,!0);if(Le in oe&&Me in W&&oe[Le]!==W[Me]){const qe=_e(Le,Me,Re),Qe=te(Le,Me,Q[qe].geometry);delete W[Le],delete oe[Me],oe[ze(Ee,Q[Qe].geometry,!0)]=Qe,Q[qe].geometry=null}else Le in oe?te(Le,Me,Re):Me in W?_e(Le,Me,Re):($(we),W[Le]=L-1,oe[Me]=L-1)}return Q.filter(we=>we.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((V,W)=>V.sortKey-W.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 c=t.dist(r[t.segment+1]),p=t.dist(r[t.segment]);const d={};for(let g=t.segment+1;g<r.length;g++)d[g]={x:r[g].x,y:r[g].y,tileUnitDistanceFromAnchor:c},g<r.length-1&&(c+=r[g+1].dist(r[g]));for(let g=t.segment||0;g>=0;g--)d[g]={x:r[g].x,y:r[g].y,tileUnitDistanceFromAnchor:p},g>0&&(p+=r[g-1].dist(r[g]));for(let g=0;g<r.length;g++){const y=d[g];this.lineVertexArray.emplaceBack(y.x,y.y,y.tileUnitDistanceFromAnchor)}}return{lineStartIndex:s,lineLength:this.lineVertexArray.length-s}}addSymbols(t,r,s,c,p,d,g,y,w,M,A,z){const R=t.indexArray,B=t.layoutVertexArray,j=t.segments.prepareSegment(4*r.length,B,R,this.canOverlap?d.sortKey:void 0),V=this.glyphOffsetArray.length,W=j.vertexLength,oe=this.allowVerticalPlacement&&g===T.an.vertical?Math.PI/2:0,Q=d.text&&d.text.sections;for(let L=0;L<r.length;L++){const{tl:$,tr:te,bl:_e,br:ze,tex:we,pixelOffsetTL:Se,pixelOffsetBR:Re,minFontScaleX:Ee,minFontScaleY:Le,glyphOffset:Me,isSDF:qe,sectionIndex:Qe}=r[L],Ke=j.vertexLength,He=Me[1];Su(B,y.x,y.y,$.x,He+$.y,we.x,we.y,s,qe,Se.x,Se.y,Ee,Le),Su(B,y.x,y.y,te.x,He+te.y,we.x+we.w,we.y,s,qe,Re.x,Se.y,Ee,Le),Su(B,y.x,y.y,_e.x,He+_e.y,we.x,we.y+we.h,s,qe,Se.x,Re.y,Ee,Le),Su(B,y.x,y.y,ze.x,He+ze.y,we.x+we.w,we.y+we.h,s,qe,Re.x,Re.y,Ee,Le),Wh(t.dynamicLayoutVertexArray,y,oe),R.emplaceBack(Ke,Ke+2,Ke+1),R.emplaceBack(Ke+1,Ke+2,Ke+3),j.vertexLength+=4,j.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Me[0]),L!==r.length-1&&Qe===r[L+1].sectionIndex||t.programConfigurations.populatePaintArrays(B.length,d,d.index,{},z,Q&&Q[Qe])}t.placedSymbolArray.emplaceBack(y.x,y.y,V,this.glyphOffsetArray.length-V,W,w,M,y.segment,s?s[0]:0,s?s[1]:0,c[0],c[1],g,0,!1,0,A)}_addCollisionDebugVertex(t,r,s,c,p,d){return r.emplaceBack(0,0),t.emplaceBack(s.x,s.y,c,p,Math.round(d.x),Math.round(d.y))}addCollisionDebugVertices(t,r,s,c,p,d,g){const y=p.segments.prepareSegment(4,p.layoutVertexArray,p.indexArray),w=y.vertexLength,M=p.layoutVertexArray,A=p.collisionVertexArray,z=g.anchorX,R=g.anchorY;this._addCollisionDebugVertex(M,A,d,z,R,new be(t,r)),this._addCollisionDebugVertex(M,A,d,z,R,new be(s,r)),this._addCollisionDebugVertex(M,A,d,z,R,new be(s,c)),this._addCollisionDebugVertex(M,A,d,z,R,new be(t,c)),y.vertexLength+=4;const B=p.indexArray;B.emplaceBack(w,w+1),B.emplaceBack(w+1,w+2),B.emplaceBack(w+2,w+3),B.emplaceBack(w+3,w),y.primitiveLength+=4}addDebugCollisionBoxes(t,r,s,c){for(let p=t;p<r;p++){const d=this.collisionBoxArray.get(p);this.addCollisionDebugVertices(d.x1,d.y1,d.x2,d.y2,c?this.textCollisionBox:this.iconCollisionBox,d.anch
5orPoint,s)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Yh(Rt,Kd.members,Ft),this.iconCollisionBox=new Yh(Rt,Kd.members,Ft);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,c,p,d,g,y,w){const M={};for(let A=r;A<s;A++){const z=t.get(A);M.textBox={x1:z.x1,y1:z.y1,x2:z.x2,y2:z.y2,anchorPointX:z.anchorPointX,anchorPointY:z.anchorPointY},M.textFeatureIndex=z.featureIndex;break}for(let A=c;A<p;A++){const z=t.get(A);M.verticalTextBox={x1:z.x1,y1:z.y1,x2:z.x2,y2:z.y2,anchorPointX:z.anchorPointX,anchorPointY:z.anchorPointY},M.verticalTextFeatureIndex=z.featureIndex;break}for(let A=d;A<g;A++){const z=t.get(A);M.iconBox={x1:z.x1,y1:z.y1,x2:z.x2,y2:z.y2,anchorPointX:z.anchorPointX,anchorPointY:z.anchorPointY},M.iconFeatureIndex=z.featureIndex;break}for(let A=y;A<w;A++){const z=t.get(A);M.verticalIconBox={x1:z.x1,y1:z.y1,x2:z.x2,y2:z.y2,anchorPointX:z.anchorPointX,anchorPointY:z.anchorPointY},M.verticalIconFeatureIndex=z.featureIndex;break}return M}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),c=s.vertexStartIndex+4*s.numGlyphs;for(let p=s.vertexStartIndex;p<c;p+=4)t.indexArray.emplaceBack(p,p+2,p+1),t.indexArray.emplaceBack(p+1,p+2,p+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(t),s=Math.cos(t),c=[],p=[],d=[];for(let g=0;g<this.symbolInstances.length;++g){d.push(g);const y=this.symbolInstances.get(g);c.push(0|Math.round(r*y.anchorX+s*y.anchorY)),p.push(y.featureIndex)}return d.sort((g,y)=>c[g]-c[y]||p[y]-p[g]),d}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((c,p,d)=>{c>=0&&d.indexOf(c)===p&&this.addIndicesForPlacedSymbol(this.text,c)}),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 pf,df;$e("SymbolBucket",No,{omit:["layers","collisionBoxArray","features","compareText"]}),No.MAX_GLYPHS=65535,No.addDynamicAttributes=Wh;var Kh={get paint(){return df=df||new ni({"icon-opacity":new tt(se.paint_symbol["icon-opacity"]),"icon-color":new tt(se.paint_symbol["icon-color"]),"icon-halo-color":new tt(se.paint_symbol["icon-halo-color"]),"icon-halo-width":new tt(se.paint_symbol["icon-halo-width"]),"icon-halo-blur":new tt(se.paint_symbol["icon-halo-blur"]),"icon-translate":new Ge(se.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ge(se.paint_symbol["icon-translate-anchor"]),"text-opacity":new tt(se.paint_symbol["text-opacity"]),"text-color":new tt(se.paint_symbol["text-color"],{runtimeType:xi,getOverride:a=>a.textColor,hasOverride:a=>!!a.textColor}),"text-halo-color":new tt(se.paint_symbol["text-halo-color"]),"text-halo-width":new tt(se.paint_symbol["text-halo-width"]),"text-halo-blur":new tt(se.paint_symbol["text-halo-blur"]),"text-translate":new Ge(se.paint_symbol["text-translate"]),"text-translate-anchor":new Ge(se.paint_symbol["text-translate-anchor"])})},get layout(){return pf=pf||new ni({"symbol-placement":new Ge(se.layout_symbol["symbol-placement"]),"symbol-spacing":new Ge(se.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ge(se.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new tt(se.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ge(se.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ge(se.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ge(se.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ge(se.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ge(se.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ge(se.layout_symbol["icon-rotation-alignment"]),"icon-size":new tt(se.layout_symbol["icon-size"]),"icon-text-fit":new Ge(se.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ge(se.layout_symbol["icon-text-fit-padding"]),"icon-image":new tt(se.layout_symbol["icon-image"]),"icon-rotate":new tt(se.layout_symbol["icon-rotate"]),"icon-padding":new tt(se.layout_symbol["icon-padding"]),"icon-keep-upright":new Ge(se.layout_symbol["icon-keep-upright"]),"icon-offset":new tt(se.layout_symbol["icon-offset"]),"icon-anchor":new tt(se.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ge(se.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ge(se.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ge(se.layout_symbol["text-rotation-alignment"]),"text-field":new tt(se.layout_symbol["text-field"]),"text-font":new tt(se.layout_symbol["text-font"]),"text-size":new tt(se.layout_symbol["text-size"]),"text-max-width":new tt(se.layout_symbol["text-max-width"]),"text-line-height":new Ge(se.layout_symbol["text-line-height"]),"text-letter-spacing":new tt(se.layout_symbol["text-letter-spacing"]),"text-justify":new tt(se.layout_symbol["text-justify"]),"text-radial-offset":new tt(se.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ge(se.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new tt(se.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new tt(se.layout_symbol["text-anchor"]),"text-max-angle":new Ge(se.layout_symbol["text-max-angle"]),"text-writing-mode":new Ge(se.layout_symbol["text-writing-mode"]),"text-rotate":new tt(se.layout_symbol["text-rotate"]),"text-padding":new Ge(se.layout_symbol["text-padding"]),"text-keep-upright":new Ge(se.layout_symbol["text-keep-upright"]),"text-transform":new tt(se.layout_symbol["text-transform"]),"text-offset":new tt(se.layout_symbol["text-offset"]),"text-allow-overlap":new Ge(se.layout_symbol["text-allow-overlap"]),"text-overlap":new Ge(se.layout_symbol["text-overlap"]),"text-ignore-placement":new Ge(se.layout_symbol["text-ignore-placement"]),"text-optional":new Ge(se.layout_symbol["text-optional"])})}};class ff{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:Wa,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",ff,{omit:["defaultValue"]});class Cu extends Zr{constructor(t){super(t,Kh)}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 c=[];for(const p of s)c.indexOf(p)<0&&c.push(p);this.layout._values["text-writing-mode"]=c}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,r,s,c){const p=this.layout.get(t).evaluate(r,{},s,c),d=this._unevaluatedLayout._values[t];return d.isDataDriven()||_o(d.value)||!p?p:function(g,y){return y.replace(/{([^{}]+)}/g,(w,M)=>g&&M in g?String(g[M]):"")}(r.properties,p)}createBucket(t){return new No(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of Kh.paint.overridableProperties){if(!Cu.hasPaintOverride(this.layout,t))continue;const r=this.paint.get(t),s=new ff(r),c=new go(s,r.property.specification);let p=null;p=r.value.kind==="constant"||r.value.kind==="source"?new _n("source",c):new xo("composite",c,r.value.zoomStops),this.paint._values[t]=new oa(r.property,p,r.parameters)}}_handleOverridablePaintPropertyUpdate(t,r,s){return!(!this.layout||r.isDataDriven()||s.isDataDriven())&&Cu.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,r){const s=t.get("text-field"),c=Kh.paint.properties[r];let p=!1;const d=g=>{for(const y of g)if(c.overrides&&c.overrides.hasOverride(y))return void(p=!0)};if(s.value.kind==="constant"&&s.value.value instanceof Jr)d(s.value.value.sections);else if(s.value.kind==="source"){const g=w=>{p||(w instanceof ii&&at(w.value)===Xa?d(w.value.sections):w instanceof un?d(w.sections):w.eachChild(g))},y=s.value;y._styleExpression&&g(y._styleExpression.expression)}return p}}let mf;var m_={get paint(){return mf=mf||new ni({"background-color":new Ge(se.paint_background["background-color"]),"background-pattern":new Vl(se.paint_background["background-pattern"]),"background-opacity":new Ge(se.paint_background["background-opacity"])})}};class g_ extends Zr{constructor(t){super(t,m_)}}let gf;var __={get paint(){return gf=gf||new ni({"raster-opacity":new Ge(se.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ge(se.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ge(se.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ge(se.paint_raster["raster-brightness-max"]),"raster-saturation":new Ge(se.paint_raster["raster-saturation"]),"raster-contrast":new Ge(se.paint_raster["raster-contrast"]),"raster-resampling":new Ge(se.paint_raster["raster-resampling"]),"raster-fade-duration":new Ge(se.paint_raster["raster-fade-duration"])})}};class y_ extends Zr{constructor(t){super(t,__)}}class x_ extends Zr{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 v_{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 b_={once:!0},Jh=63710088e-1;class qs{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 qs(Zi(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,c=t.lat*r,p=Math.sin(s)*Math.sin(c)+Math.cos(s)*Math.cos(c)*Math.cos((t.lng-this.lng)*r);return Jh*Math.acos(Math.min(p,1))}static convert(t){if(t instanceof qs)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new qs(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new qs(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 _f=2*Math.PI*Jh;function yf(a){return _f*Math.cos(a*Math.PI/180)}function xf(a){return(180+a)/360}function vf(a){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+a*Math.PI/360)))/360}function bf(a,t){return a/yf(t)}function Qh(a){return 360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180)
5)-90}function wf(a,t){return a*yf(Qh(t))}class uc{constructor(t,r,s=0){this.x=+t,this.y=+r,this.z=+s}static fromLngLat(t,r=0){const s=qs.convert(t);return new uc(xf(s.lng),vf(s.lat),bf(r,s.lat))}toLngLat(){return new qs(360*this.x-180,Qh(this.y))}toAltitude(){return wf(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/_f*(t=Qh(this.y),1/Math.cos(t*Math.PI/180));var t}}function Tf(a,t,r){var s=2*Math.PI*6378137/256/Math.pow(2,r);return[a*s-2*Math.PI*6378137/2,t*s-2*Math.PI*6378137/2]}class ep{constructor(t,r,s){if(!function(c,p,d){return!(c<0||c>25||d<0||d>=Math.pow(2,c)||p<0||p>=Math.pow(2,c))}(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=Uo(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 c=(d=this.y,g=this.z,y=Tf(256*(p=this.x),256*(d=Math.pow(2,g)-d-1),g),w=Tf(256*(p+1),256*(d+1),g),y[0]+","+y[1]+","+w[0]+","+w[1]);var p,d,g,y,w;const M=function(A,z,R){let B,j="";for(let V=A;V>0;V--)B=1<<V-1,j+=(z&B?1:0)+(R&B?2:0);return j}(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,M).replace(/{bbox-epsg-3857}/g,c)}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 be((t.x*r-this.x)*Ct,(t.y*r-this.y)*Ct)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Sf{constructor(t,r){this.wrap=t,this.canonical=r,this.key=Uo(t,r.z,r.z,r.x,r.y)}}class Yi{constructor(t,r,s,c,p){if(this.terrainRttPosMatrix32f=null,t<s)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${s}`);this.overscaledZ=t,this.wrap=r,this.canonical=new ep(s,+c,+p),this.key=Uo(r,t,s,c,p)}clone(){return new Yi(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 Yi(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Yi(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?Uo(this.wrap*+r,t,this.canonical.z,this.canonical.x,this.canonical.y):Uo(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 Yi(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,c=2*this.canonical.y;return[new Yi(r,this.wrap,r,s,c),new Yi(r,this.wrap,r,s+1,c),new Yi(r,this.wrap,r,s,c+1),new Yi(r,this.wrap,r,s+1,c+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 Yi(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new Yi(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 Sf(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new uc(t.x-this.wrap,t.y))}}function Uo(a,t,r,s,c){(a*=2)<0&&(a=-1*a-1);const p=1<<r;return(p*p*a+p*c+s).toString(36)+r.toString(36)+t.toString(36)}$e("CanonicalTileID",ep),$e("OverscaledTileID",Yi,{omit:["terrainRttPosMatrix32f"]});class On{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(t){return this.minX=Math.min(this.minX,t.x),this.minY=Math.min(this.minY,t.y),this.maxX=Math.max(this.maxX,t.x),this.maxY=Math.max(this.maxY,t.y),this}expandBy(t){return this.minX-=t,this.minY-=t,this.maxX+=t,this.maxY+=t,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(t){return this.expandBy(-t)}map(t){const r=new On;return r.extend(t(new be(this.minX,this.minY))),r.extend(t(new be(this.maxX,this.minY))),r.extend(t(new be(this.minX,this.maxY))),r.extend(t(new be(this.maxX,this.maxY))),r}static fromPoints(t){const r=new On;for(const s of t)r.extend(s);return r}contains(t){return t.x>=this.minX&&t.x<=this.maxX&&t.y>=this.minY&&t.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(t){return!this.empty()&&!t.empty()&&t.minX>=this.minX&&t.maxX<=this.maxX&&t.minY>=this.minY&&t.maxY<=this.maxY}intersects(t){return!this.empty()&&!t.empty()&&t.minX<=this.maxX&&t.maxX>=this.minX&&t.minY<=this.maxY&&t.maxY>=this.minY}}class Cf{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 Mf{constructor(t,r,s,c,p){this.type="Feature",this._vectorTileFeature=t,t._z=r,t._x=s,t._y=c,this.properties=t.properties,this.id=p}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 If{constructor(t,r){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new js(Ct,16,0),this.grid3D=new js(Ct,16,0),this.featureIndexArray=new xe,this.promoteId=r}insert(t,r,s,c,p,d){const g=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,c,p);const y=d?this.grid3D:this.grid;for(let w=0;w<r.length;w++){const M=r[w],A=[1/0,1/0,-1/0,-1/0];for(let z=0;z<M.length;z++){const R=M[z];A[0]=Math.min(A[0],R.x),A[1]=Math.min(A[1],R.y),A[2]=Math.max(A[2],R.x),A[3]=Math.max(A[3],R.y)}A[0]<Ct&&A[1]<Ct&&A[2]>=0&&A[3]>=0&&y.insert(g,A[0],A[1],A[2],A[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new sc.VectorTile(new Vh(this.rawTileData)).layers,this.sourceLayerCoder=new Cf(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,r,s,c){this.loadVTLayers();const p=t.params,d=Ct/t.tileSize/t.scale,g=ka(p.filter),y=t.queryGeometry,w=t.queryPadding*d,M=On.fromPoints(y),A=this.grid.query(M.minX-w,M.minY-w,M.maxX+w,M.maxY+w),z=On.fromPoints(t.cameraQueryGeometry).expandBy(w),R=this.grid3D.query(z.minX,z.minY,z.maxX,z.maxY,(V,W,oe,Q)=>function(L,$,te,_e,ze){for(const Se of L)if($<=Se.x&&te<=Se.y&&_e>=Se.x&&ze>
5=Se.y)return!0;const we=[new be($,te),new be($,ze),new be(_e,ze),new be(_e,te)];if(L.length>2){for(const Se of we)if(Ro(L,Se))return!0}for(let Se=0;Se<L.length-1;Se++)if(lg(L[Se],L[Se+1],we))return!0;return!1}(t.cameraQueryGeometry,V-w,W-w,oe+w,Q+w));for(const V of R)A.push(V);A.sort(w_);const B={};let j;for(let V=0;V<A.length;V++){const W=A[V];if(W===j)continue;j=W;const oe=this.featureIndexArray.get(W);let Q=null;this.loadMatchingFeature(B,oe.bucketIndex,oe.sourceLayerIndex,oe.featureIndex,g,p.layers,p.availableImages,r,s,c,(L,$,te)=>(Q||(Q=Ln(L)),$.queryIntersectsFeature({queryGeometry:y,feature:L,featureState:te,geometry:Q,zoom:this.z,transform:t.transform,pixelsToTileUnits:d,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation})))}return B}loadMatchingFeature(t,r,s,c,p,d,g,y,w,M,A){const z=this.bucketLayerIDs[r];if(d&&!z.some(V=>d.has(V)))return;const R=this.sourceLayerCoder.decode(s),B=this.vtLayers[R].feature(c);if(p.needGeometry){const V=Rn(B,!0);if(!p.filter(new Ht(this.tileID.overscaledZ),V,this.tileID.canonical))return}else if(!p.filter(new Ht(this.tileID.overscaledZ),B))return;const j=this.getId(B,R);for(let V=0;V<z.length;V++){const W=z[V];if(d&&!d.has(W))continue;const oe=y[W];if(!oe)continue;let Q={};j&&M&&(Q=M.getState(oe.sourceLayer||"_geojsonTileLayer",j));const L=wr({},w[W]);L.paint=Af(L.paint,oe.paint,B,Q,g),L.layout=Af(L.layout,oe.layout,B,Q,g);const $=!A||A(B,oe,Q);if(!$)continue;const te=new Mf(B,this.z,this.x,this.y,j);te.layer=L;let _e=t[W];_e===void 0&&(_e=t[W]=[]),_e.push({featureIndex:c,feature:te,intersectionZ:$})}}lookupSymbolFeatures(t,r,s,c,p,d,g,y){const w={};this.loadVTLayers();const M=ka(p);for(const A of t)this.loadMatchingFeature(w,s,c,A,M,d,g,y,r);return w}hasLayer(t){for(const r of this.bucketLayerIDs)for(const s of r)if(t===s)return!0;return!1}getId(t,r){var s;let c=t.id;return this.promoteId&&(c=t.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof c=="boolean"&&(c=Number(c)),c===void 0&&!((s=t.properties)===null||s===void 0)&&s.cluster&&this.promoteId&&(c=Number(t.properties.cluster_id))),c}}function Af(a,t,r,s,c){return It(a,(p,d)=>{const g=t instanceof Eo?t.get(d):null;return g&&g.evaluate?g.evaluate(r,s,c):g})}function w_(a,t){return t-a}function Pf(a,t,r,s,c){const p=[];for(let d=0;d<a.length;d++){const g=a[d];let y;for(let w=0;w<g.length-1;w++){let M=g[w],A=g[w+1];M.x<t&&A.x<t||(M.x<t?M=new be(t,M.y+(t-M.x)/(A.x-M.x)*(A.y-M.y))._round():A.x<t&&(A=new be(t,M.y+(t-M.x)/(A.x-M.x)*(A.y-M.y))._round()),M.y<r&&A.y<r||(M.y<r?M=new be(M.x+(r-M.y)/(A.y-M.y)*(A.x-M.x),r)._round():A.y<r&&(A=new be(M.x+(r-M.y)/(A.y-M.y)*(A.x-M.x),r)._round()),M.x>=s&&A.x>=s||(M.x>=s?M=new be(s,M.y+(s-M.x)/(A.x-M.x)*(A.y-M.y))._round():A.x>=s&&(A=new be(s,M.y+(s-M.x)/(A.x-M.x)*(A.y-M.y))._round()),M.y>=c&&A.y>=c||(M.y>=c?M=new be(M.x+(c-M.y)/(A.y-M.y)*(A.x-M.x),c)._round():A.y>=c&&(A=new be(M.x+(c-M.y)/(A.y-M.y)*(A.x-M.x),c)._round()),y&&M.equals(y[y.length-1])||(y=[M],p.push(y)),y.push(A)))))}}return p}$e("FeatureIndex",If,{omit:["rawTileData","sourceLayerCoder"]});class Gs extends be{constructor(t,r,s,c){super(t,r),this.angle=s,c!==void 0&&(this.segment=c)}clone(){return new Gs(this.x,this.y,this.angle,this.segment)}}function kf(a,t,r,s,c){if(t.segment===void 0||r===0)return!0;let p=t,d=t.segment+1,g=0;for(;g>-r/2;){if(d--,d<0)return!1;g-=a[d].dist(p),p=a[d]}g+=a[d].dist(a[d+1]),d++;const y=[];let w=0;for(;g<r/2;){const M=a[d],A=a[d+1];if(!A)return!1;let z=a[d-1].angleTo(M)-M.angleTo(A);for(z=Math.abs((z+3*Math.PI)%(2*Math.PI)-Math.PI),y.push({distance:g,angleDelta:z}),w+=z;g-y[0].distance>s;)w-=y.shift().angleDelta;if(w>c)return!1;d++,g+=M.dist(A)}return!0}function Ef(a){let t=0;for(let r=0;r<a.length-1;r++)t+=a[r].dist(a[r+1]);return t}function zf(a,t,r){return a?.6*t*r:0}function Df(a,t){return Math.max(a?a.right-a.left:0,t?t.right-t.left:0)}function T_(a,t,r,s,c,p){const d=zf(r,c,p),g=Df(r,s)*p;let y=0;const w=Ef(a)/2;for(let M=0;M<a.length-1;M++){const A=a[M],z=a[M+1],R=A.dist(z);if(y+R>w){const B=(w-y)/R,j=bi.number(A.x,z.x,B),V=bi.number(A.y,z.y,B),W=new Gs(j,V,z.angleTo(A),M);
5return W._round(),!d||kf(a,W,g,d,t)?W:void 0}y+=R}}function S_(a,t,r,s,c,p,d,g,y){const w=zf(s,p,d),M=Df(s,c),A=M*d,z=a[0].x===0||a[0].x===y||a[0].y===0||a[0].y===y;return t-A<t/4&&(t=A+t/4),Lf(a,z?t/2*g%t:(M/2+2*p)*d*g%t,t,w,r,A,z,!1,y)}function Lf(a,t,r,s,c,p,d,g,y){const w=p/2,M=Ef(a);let A=0,z=t-r,R=[];for(let B=0;B<a.length-1;B++){const j=a[B],V=a[B+1],W=j.dist(V),oe=V.angleTo(j);for(;z+r<A+W;){z+=r;const Q=(z-A)/W,L=bi.number(j.x,V.x,Q),$=bi.number(j.y,V.y,Q);if(L>=0&&L<y&&$>=0&&$<y&&z-w>=0&&z+w<=M){const te=new Gs(L,$,oe,B);te._round(),s&&!kf(a,te,p,s,c)||R.push(te)}}A+=W}return g||R.length||d||(R=Lf(a,A/2,r,s,c,p,d,!0,y)),R}function Rf(a,t,r,s){const c=[],p=a.image,d=p.pixelRatio,g=p.paddedRect.w-2,y=p.paddedRect.h-2;let w={x1:a.left,y1:a.top,x2:a.right,y2:a.bottom};const M=p.stretchX||[[0,g]],A=p.stretchY||[[0,y]],z=(Me,qe)=>Me+qe[1]-qe[0],R=M.reduce(z,0),B=A.reduce(z,0),j=g-R,V=y-B;let W=0,oe=R,Q=0,L=B,$=0,te=j,_e=0,ze=V;if(p.content&&s){const Me=p.content,qe=Me[2]-Me[0],Qe=Me[3]-Me[1];(p.textFitWidth||p.textFitHeight)&&(w=cf(a)),W=Mu(M,0,Me[0]),Q=Mu(A,0,Me[1]),oe=Mu(M,Me[0],Me[2]),L=Mu(A,Me[1],Me[3]),$=Me[0]-W,_e=Me[1]-Q,te=qe-oe,ze=Qe-L}const we=w.x1,Se=w.y1,Re=w.x2-we,Ee=w.y2-Se,Le=(Me,qe,Qe,Ke)=>{const He=Iu(Me.stretch-W,oe,Re,we),vt=Au(Me.fixed-$,te,Me.stretch,R),sr=Iu(qe.stretch-Q,L,Ee,Se),Ir=Au(qe.fixed-_e,ze,qe.stretch,B),ti=Iu(Qe.stretch-W,oe,Re,we),Ki=Au(Qe.fixed-$,te,Qe.stretch,R),Ti=Iu(Ke.stretch-Q,L,Ee,Se),Hr=Au(Ke.fixed-_e,ze,Ke.stretch,B),tr=new be(He,sr),Fr=new be(ti,sr),Wr=new be(ti,Ti),Xr=new be(He,Ti),gi=new be(vt/d,Ir/d),Ji=new be(Ki/d,Hr/d),Br=t*Math.PI/180;if(Br){const Or=Math.sin(Br),jr=Math.cos(Br),yr=[jr,-Or,Or,jr];tr._matMult(yr),Fr._matMult(yr),Xr._matMult(yr),Wr._matMult(yr)}const Si=Me.stretch+Me.fixed,Ar=qe.stretch+qe.fixed;return{tl:tr,tr:Fr,bl:Xr,br:Wr,tex:{x:p.paddedRect.x+1+Si,y:p.paddedRect.y+1+Ar,w:Qe.stretch+Qe.fixed-Si,h:Ke.stretch+Ke.fixed-Ar},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:gi,pixelOffsetBR:Ji,minFontScaleX:te/d/Re,minFontScaleY:ze/d/Ee,isSDF:r}};if(s&&(p.stretchX||p.stretchY)){const Me=Ff(M,j,R),qe=Ff(A,V,B);for(let Qe=0;Qe<Me.length-1;Qe++){const Ke=Me[Qe],He=Me[Qe+1];for(let vt=0;vt<qe.length-1;vt++)c.push(Le(Ke,qe[vt],He,qe[vt+1]))}}else c.push(Le({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:g+1},{fixed:0,stretch:y+1}));return c}function Mu(a,t,r){let s=0;for(const c of a)s+=Math.max(t,Math.min(r,c[1]))-Math.max(t,Math.min(r,c[0]));return s}function Ff(a,t,r){const s=[{fixed:-1,stretch:0}];for(const[c,p]of a){const d=s[s.length-1];s.push({fixed:c-d.stretch,stretch:d.stretch}),s.push({fixed:c-d.stretch,stretch:d.stretch+(p-c)})}return s.push({fixed:t+1,stretch:r}),s}function Iu(a,t,r,s){return a/t*r+s}function Au(a,t,r,s){return a-t*r/s}$e("Anchor",Gs);class Pu{constructor(t,r,s,c,p,d,g,y,w,M){var A;if(this.boxStartIndex=t.length,w){let z=d.top,R=d.bottom;const B=d.collisionPadding;B&&(z-=B[1],R+=B[3]);let j=R-z;j>0&&(j=Math.max(10,j),this.circleDiameter=j)}else{const z=!((A=d.image)===null||A===void 0)&&A.content&&(d.image.textFitWidth||d.image.textFitHeight)?cf(d):{x1:d.left,y1:d.top,x2:d.right,y2:d.bottom};z.y1=z.y1*g-y[0],z.y2=z.y2*g+y[2],z.x1=z.x1*g-y[3],z.x2=z.x2*g+y[1];const R=d.collisionPadding;if(R&&(z.x1-=R[0]*g,z.y1-=R[1]*g,z.x2+=R[2]*g,z.y2+=R[3]*g),M){const B=new be(z.x1,z.y1),j=new be(z.x2,z.y1),V=new be(z.x1,z.y2),W=new be(z.x2,z.y2),oe=M*Math.PI/180;B._rotate(oe),j._rotate(oe),V._rotate(oe),W._rotate(oe),z.x1=Math.min(B.x,j.x,V.x,W.x),z.x2=Math.max(B.x,j.x,V.x,W.x),z.y1=Math.min(B.y,j.y,V.y,W.y),z.y2=Math.max(B.y,j.y,V.y,W.y)}t.emplaceBack(r.x,r.y,z.x1,z.y1,z.x2,z.y2,s,c,p)}this.boxEndIndex=t.length}}class C_{constructor(t=[],r=(s,c)=>s<c?-1:s>c?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,c=r[t];for(;t>0;){const p=t-1>>1,d=r[p];if(s(c,d)>=0)break;r[t]=d,t=p}r[t]=c}_down(t){const{data:r,compare:s}=this,c=this.length>>1,p=r[t];for(;t<c;){let d=1+(t<<1);const g=d+1;if(g<this.length&&s(r[g],r[d])<0&&(d=g),s(r[d],p)>=0)break;r[t]=r[d],t=d}r[t]=p}}function M_(a,t=1,r=!1){const s=On.fromPoints(a[0]),c=Math.min(s.width(),s.height());let p=c/2;const d=new C_([],I_),{minX:g,minY:y,maxX:w,maxY:M}=s;
5if(c===0)return new be(g,y);for(let R=g;R<w;R+=c)for(let B=y;B<M;B+=c)d.push(new $o(R+p,B+p,p,a));let A=function(R){let B=0,j=0,V=0;const W=R[0];for(let oe=0,Q=W.length,L=Q-1;oe<Q;L=oe++){const $=W[oe],te=W[L],_e=$.x*te.y-te.x*$.y;j+=($.x+te.x)*_e,V+=($.y+te.y)*_e,B+=3*_e}return new $o(j/B,V/B,0,R)}(a),z=d.length;for(;d.length;){const R=d.pop();(R.d>A.d||!A.d)&&(A=R,r&&console.log("found best %d after %d probes",Math.round(1e4*R.d)/1e4,z)),R.max-A.d<=t||(p=R.h/2,d.push(new $o(R.p.x-p,R.p.y-p,p,a)),d.push(new $o(R.p.x+p,R.p.y-p,p,a)),d.push(new $o(R.p.x-p,R.p.y+p,p,a)),d.push(new $o(R.p.x+p,R.p.y+p,p,a)),z+=4)}return r&&(console.log(`num probes: ${z}`),console.log(`best distance: ${A.d}`)),A.p}function I_(a,t){return t.max-a.max}function $o(a,t,r,s){this.p=new be(a,t),this.h=r,this.d=function(c,p){let d=!1,g=1/0;for(let y=0;y<p.length;y++){const w=p[y];for(let M=0,A=w.length,z=A-1;M<A;z=M++){const R=w[M],B=w[z];R.y>c.y!=B.y>c.y&&c.x<(B.x-R.x)*(c.y-R.y)/(B.y-R.y)+R.x&&(d=!d),g=Math.min(g,fd(c,R,B))}}return(d?1:-1)*Math.sqrt(g)}(this.p,s),this.max=this.d+this.h*Math.SQRT2}var ei;T.aD=void 0,(ei=T.aD||(T.aD={}))[ei.center=1]="center",ei[ei.left=2]="left",ei[ei.right=3]="right",ei[ei.top=4]="top",ei[ei.bottom=5]="bottom",ei[ei["top-left"]=6]="top-left",ei[ei["top-right"]=7]="top-right",ei[ei["bottom-left"]=8]="bottom-left",ei[ei["bottom-right"]=9]="bottom-right";const tp=Number.POSITIVE_INFINITY;function Bf(a,t){return t[1]!==tp?function(r,s,c){let p=0,d=0;switch(s=Math.abs(s),c=Math.abs(c),r){case"top-right":case"top-left":case"top":d=c-7;break;case"bottom-right":case"bottom-left":case"bottom":d=7-c}switch(r){case"top-right":case"bottom-right":case"right":p=-s;break;case"top-left":case"bottom-left":case"left":p=s}return[p,d]}(a,t[0],t[1]):function(r,s){let c=0,p=0;s<0&&(s=0);const d=s/Math.SQRT2;switch(r){case"top-right":case"top-left":p=d-7;break;case"bottom-right":case"bottom-left":p=7-d;break;case"bottom":p=7-s;break;case"top":p=s-7}switch(r){case"top-right":case"bottom-right":c=-d;break;case"top-left":case"bottom-left":c=d;break;case"left":c=s;break;case"right":c=-s}return[c,p]}(a,t[0])}function Of(a,t,r){var s;const c=a.layout,p=(s=c.get("text-variable-anchor-offset"))===null||s===void 0?void 0:s.evaluate(t,{},r);if(p){const g=p.values,y=[];for(let w=0;w<g.length;w+=2){const M=y[w]=g[w],A=g[w+1].map(z=>z*Rr);M.startsWith("top")?A[1]-=7:M.startsWith("bottom")&&(A[1]+=7),y[w+1]=A}return new Tt(y)}const d=c.get("text-variable-anchor");if(d){let g;g=a._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[c.get("text-radial-offset").evaluate(t,{},r)*Rr,tp]:c.get("text-offset").evaluate(t,{},r).map(w=>w*Rr);const y=[];for(const w of d)y.push(w,Bf(w,g));return new Tt(y)}return null}function rp(a){switch(a){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function A_(a,t,r,s,c,p,d,g,y,w,M,A){let z=p.textMaxSize.evaluate(t,{});z===void 0&&(z=d);const R=a.layers[0].layout,B=R.get("icon-offset").evaluate(t,{},M),j=Nf(r.horizontal),V=d/24,W=a.tilePixelRatio*V,oe=a.tilePixelRatio*z/24,Q=a.tilePixelRatio*g,L=a.tilePixelRatio*R.get("symbol-spacing"),$=R.get("text-padding")*a.tilePixelRatio,te=function(Qe,Ke,He,vt=1){const sr=Qe.get("icon-padding").evaluate(Ke,{},He),Ir=sr&&sr.values;return[Ir[0]*vt,Ir[1]*vt,Ir[2]*vt,Ir[3]*vt]}(R,t,M,a.tilePixelRatio),_e=R.get("text-max-angle")/180*Math.PI,ze=R.get("text-rotation-alignment")!=="viewport"&&R.get("symbol-placement")!=="point",we=R.get("icon-rotation-alignment")==="map"&&R.get("symbol-placement")!=="point",Se=R.get("symbol-placement"),Re=L/2,Ee=R.get("icon-text-fit");let Le;s&&Ee!=="none"&&(a.allowVerticalPlacement&&r.vertical&&(Le=uf(s,r.vertical,Ee,R.get("icon-text-fit-padding"),B,V)),j&&(s=uf(s,j,Ee,R.get("icon-text-fit-padding"),B,V)));const Me=M?A.line.getGranularityForZoomLevel(M.z):1,qe=(Qe,Ke)=>{Ke.x<0||Ke.x>=Ct||Ke.y<0||Ke.y>=Ct||function(He,vt,sr,Ir,ti,Ki,Ti,Hr,tr,Fr,Wr,Xr,gi,Ji,Br,Si,Ar,Or,jr,yr,Zt,ba,Vo,wa,E_){const Zo=He.addToLineVertexArray(vt,sr);let jn,qo,Go,Ho,Zf=0,qf=0,Gf=0,Hf=0,up=-1,hp=-1;const cs={};let Wf=mi("");if(He.allowVerticalPlacement&&Ir.vertical){const li=Hr.layout.get("text-rotate").evaluate(Zt,{},wa)+90;Go=new Pu(tr,vt,Fr,Wr,Xr,Ir.vertical,gi,Ji,Br,li),Ti&&(Ho=new Pu(tr,vt,Fr,Wr,Xr,Ti,Ar,Or,Br,li))}if(ti){const li=Hr.layout.get("icon-rotate").evaluate(Zt,{}
5),ji=Hr.layout.get("icon-text-fit")!=="none",Nn=Rf(ti,li,Vo,ji),ca=Ti?Rf(Ti,li,Vo,ji):void 0;qo=new Pu(tr,vt,Fr,Wr,Xr,ti,Ar,Or,!1,li),Zf=4*Nn.length;const Un=He.iconSizeData;let Na=null;Un.kind==="source"?(Na=[ls*Hr.layout.get("icon-size").evaluate(Zt,{})],Na[0]>Zs&&rr(`${He.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):Un.kind==="composite"&&(Na=[ls*ba.compositeIconSizes[0].evaluate(Zt,{},wa),ls*ba.compositeIconSizes[1].evaluate(Zt,{},wa)],(Na[0]>Zs||Na[1]>Zs)&&rr(`${He.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),He.addSymbols(He.icon,Nn,Na,yr,jr,Zt,T.an.none,vt,Zo.lineStartIndex,Zo.lineLength,-1,wa),up=He.icon.placedSymbolArray.length-1,ca&&(qf=4*ca.length,He.addSymbols(He.icon,ca,Na,yr,jr,Zt,T.an.vertical,vt,Zo.lineStartIndex,Zo.lineLength,-1,wa),hp=He.icon.placedSymbolArray.length-1)}const Xf=Object.keys(Ir.horizontal);for(const li of Xf){const ji=Ir.horizontal[li];if(!jn){Wf=mi(ji.text);const ca=Hr.layout.get("text-rotate").evaluate(Zt,{},wa);jn=new Pu(tr,vt,Fr,Wr,Xr,ji,gi,Ji,Br,ca)}const Nn=ji.positionedLines.length===1;if(Gf+=jf(He,vt,ji,Ki,Hr,Br,Zt,Si,Zo,Ir.vertical?T.an.horizontal:T.an.horizontalOnly,Nn?Xf:[li],cs,up,ba,wa),Nn)break}Ir.vertical&&(Hf+=jf(He,vt,Ir.vertical,Ki,Hr,Br,Zt,Si,Zo,T.an.vertical,["vertical"],cs,hp,ba,wa));const z_=jn?jn.boxStartIndex:He.collisionBoxArray.length,D_=jn?jn.boxEndIndex:He.collisionBoxArray.length,L_=Go?Go.boxStartIndex:He.collisionBoxArray.length,R_=Go?Go.boxEndIndex:He.collisionBoxArray.length,F_=qo?qo.boxStartIndex:He.collisionBoxArray.length,B_=qo?qo.boxEndIndex:He.collisionBoxArray.length,O_=Ho?Ho.boxStartIndex:He.collisionBoxArray.length,j_=Ho?Ho.boxEndIndex:He.collisionBoxArray.length;let Ta=-1;const Eu=(li,ji)=>li&&li.circleDiameter?Math.max(li.circleDiameter,ji):ji;Ta=Eu(jn,Ta),Ta=Eu(Go,Ta),Ta=Eu(qo,Ta),Ta=Eu(Ho,Ta);const Yf=Ta>-1?1:0;Yf&&(Ta*=E_/Rr),He.glyphOffsetArray.length>=No.MAX_GLYPHS&&rr("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Zt.sortKey!==void 0&&He.addToSortKeyRanges(He.symbolInstances.length,Zt.sortKey);const N_=Of(Hr,Zt,wa),[U_,$_]=function(li,ji){const Nn=li.length,ca=ji==null?void 0:ji.values;if((ca==null?void 0:ca.length)>0)for(let Un=0;Un<ca.length;Un+=2){const Na=ca[Un+1];li.emplaceBack(T.aD[ca[Un]],Na[0],Na[1])}return[Nn,li.length]}(He.textAnchorOffsets,N_);He.symbolInstances.emplaceBack(vt.x,vt.y,cs.right>=0?cs.right:-1,cs.center>=0?cs.center:-1,cs.left>=0?cs.left:-1,cs.vertical||-1,up,hp,Wf,z_,D_,L_,R_,F_,B_,O_,j_,Fr,Gf,Hf,Zf,qf,Yf,0,gi,Ta,U_,$_)}(a,Ke,Qe,r,s,c,Le,a.layers[0],a.collisionBoxArray,t.index,t.sourceLayerIndex,a.index,W,[$,$,$,$],ze,y,Q,te,we,B,t,p,w,M,d)};if(Se==="line")for(const Qe of Pf(t.geometry,0,0,Ct,Ct)){const Ke=Bn(Qe,Me),He=S_(Ke,L,_e,r.vertical||j,s,24,oe,a.overscaling,Ct);for(const vt of He)j&&P_(a,j.text,Re,vt)||qe(Ke,vt)}else if(Se==="line-center"){for(const Qe of t.geometry)if(Qe.length>1){const Ke=Bn(Qe,Me),He=T_(Ke,_e,r.vertical||j,s,24,oe);He&&qe(Ke,He)}}else if(t.type==="Polygon")for(const Qe of lo(t.geometry,0)){const Ke=M_(Qe,16);qe(Bn(Qe[0],Me,!0),new Gs(Ke.x,Ke.y,0))}else if(t.type==="LineString")for(const Qe of t.geometry){const Ke=Bn(Qe,Me);qe(Ke,new Gs(Ke[0].x,Ke[0].y,0))}else if(t.type==="Point")for(const Qe of t.geometry)for(const Ke of Qe)qe([Ke],new Gs(Ke.x,Ke.y,0))}function jf(a,t,r,s,c,p,d,g,y,w,M,A,z,R,B){const j=function(oe,Q,L,$,te,_e,ze,we){const Se=$.layout.get("text-rotate").evaluate(_e,{})*Math.PI/180,Re=[];for(const Ee of Q.positionedLines)for(const Le of Ee.positionedGlyphs){if(!Le.rect)continue;const Me=Le.rect||{};let qe=4,Qe=!0,Ke=1,He=0;const vt=(te||we)&&Le.vertical,sr=Le.metrics.advance*Le.scale/2;if(we&&Q.verticalizable&&(He=Ee.lineOffset/2-(Le.imageName?-(Rr-Le.metrics.width*Le.scale)/2:(Le.scale-1)*Rr)),Le.imageName){const Or=ze[Le.imageName];Qe=Or.sdf,Ke=Or.pixelRatio,qe=1/Ke}const Ir=te?[Le.x+sr,Le.y]:[0,0];let ti=te?[0,0]:[Le.x+sr+L[0],Le.y+L[1]-He],Ki=[0,0];vt&&(Ki=ti,ti=[0,0]);const Ti=Le.metrics.isDoubleResolution?2:1,Hr=(Le.metrics.left-qe)*Le.scale-sr+ti[0],tr=(-Le.metrics.top-qe)*Le.scale+ti[1],Fr=Hr+Me.w/Ti*Le.scale/Ke,Wr=tr+Me.h/Ti*Le.scale/Ke,Xr=new be(Hr,tr),gi=new be(Fr,tr),Ji=new be(Hr,Wr),Br=new be(Fr,Wr);if(vt){const Or=new be(-sr,sr- -17),jr=-Math.PI/2,yr=12-sr,Zt=new be(22-yr,-(Le.imageName?yr:0)),ba=new be(...Ki);
5Xr._rotateAround(jr,Or)._add(Zt)._add(ba),gi._rotateAround(jr,Or)._add(Zt)._add(ba),Ji._rotateAround(jr,Or)._add(Zt)._add(ba),Br._rotateAround(jr,Or)._add(Zt)._add(ba)}if(Se){const Or=Math.sin(Se),jr=Math.cos(Se),yr=[jr,-Or,Or,jr];Xr._matMult(yr),gi._matMult(yr),Ji._matMult(yr),Br._matMult(yr)}const Si=new be(0,0),Ar=new be(0,0);Re.push({tl:Xr,tr:gi,bl:Ji,br:Br,tex:Me,writingMode:Q.writingMode,glyphOffset:Ir,sectionIndex:Le.sectionIndex,isSDF:Qe,pixelOffsetTL:Si,pixelOffsetBR:Ar,minFontScaleX:0,minFontScaleY:0})}return Re}(0,r,g,c,p,d,s,a.allowVerticalPlacement),V=a.textSizeData;let W=null;V.kind==="source"?(W=[ls*c.layout.get("text-size").evaluate(d,{})],W[0]>Zs&&rr(`${a.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):V.kind==="composite"&&(W=[ls*R.compositeTextSizes[0].evaluate(d,{},B),ls*R.compositeTextSizes[1].evaluate(d,{},B)],(W[0]>Zs||W[1]>Zs)&&rr(`${a.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),a.addSymbols(a.text,j,W,g,p,d,w,t,y.lineStartIndex,y.lineLength,z,B);for(const oe of M)A[oe]=a.text.placedSymbolArray.length-1;return 4*j.length}function Nf(a){for(const t in a)return a[t];return null}function P_(a,t,r,s){const c=a.compareText;if(t in c){const p=c[t];for(let d=p.length-1;d>=0;d--)if(s.dist(p[d])<r)return!0}else c[t]=[];return c[t].push(s),!1}const Uf=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class ip{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 c=s>>4;if(c!==1)throw new Error(`Got v${c} data when expected v1.`);const p=Uf[15&s];if(!p)throw new Error("Unrecognized array type.");const[d]=new Uint16Array(t,2,1),[g]=new Uint32Array(t,4,1);return new ip(g,d,p,t)}constructor(t,r=64,s=Float64Array,c){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 p=Uf.indexOf(this.ArrayType),d=2*t*this.ArrayType.BYTES_PER_ELEMENT,g=t*this.IndexArrayType.BYTES_PER_ELEMENT,y=(8-g%8)%8;if(p<0)throw new Error(`Unexpected typed array class: ${s}.`);c&&c instanceof ArrayBuffer?(this.data=c,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+g+y,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+d+g+y),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+g+y,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+p]),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 ap(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,r,s,c){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:p,coords:d,nodeSize:g}=this,y=[0,p.length-1,0],w=[];for(;y.length;){const M=y.pop()||0,A=y.pop()||0,z=y.pop()||0;if(A-z<=g){for(let V=z;V<=A;V++){const W=d[2*V],oe=d[2*V+1];W>=t&&W<=s&&oe>=r&&oe<=c&&w.push(p[V])}continue}const R=z+A>>1,B=d[2*R],j=d[2*R+1];B>=t&&B<=s&&j>=r&&j<=c&&w.push(p[R]),(M===0?t<=B:r<=j)&&(y.push(z),y.push(R-1),y.push(1-M)),(M===0?s>=B:c>=j)&&(y.push(R+1),y.push(A),y.push(1-M))}return w}within(t,r,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:c,coords:p,nodeSize:d}=this,g=[0,c.length-1,0],y=[],w=s*s;for(;g.length;){const M=g.pop()||0,A=g.pop()||0,z=g.pop()||0;if(A-z<=d){for(let V=z;V<=A;V++)Vf(p[2*V],p[2*V+1],t,r)<=w&&y.push(c[V]);continue}const R=z+A>>1,B=p[2*R],j=p[2*R+1];Vf(B,j,t,r)<=w&&y.push(c[R]),(M===0?t-s<=B:r-s<=j)&&(g.push(z),g.push(R-1),g.push(1-M)),(M===0?t+s>=B:r+s>=j)&&(g.push(R+1),g.push(A),g.push(1-M))}return y}}function ap(a,t,r,s,c,p){if(c-s<=r)return;const d=s+c>>1;$f(a,t,d,s,c,p),ap(a,t,r,s,d-1,1-p),ap(a,t,r,d+1,c,1-p)}function $f(a,t,r,s,c,p){for(;c>s;){if(c-s>600){const w=c-s+1,M=r-s+1,A=Math.log(w),z=.5*Math.exp(2*A/3),R=.5*Math.sqrt(A*z*(w-z)/w)*(M-w/2<0?-1:1);$f(a,t,r,Math.max(s,Math.floor(r-M*z/w+R)),Math.min(c,Math.floor(r+(w-M)*z/w+R)),p)}const d=t[2*r+p];let g=s,y=c;for(hc(a,t,s,r),t[2*c+p]>d&&hc(a,t,s,c);g<y;){for(hc(a,t,g,y),g++,y--;t[2*g+p]<d;)g++;for(;t[2*y+p]>d;)y--}t[2*s+p]===d?hc(a,t,s,y):(y++,hc(a,t,y,c)),y<=r&&(s=y+1),r<=y&&(c=y-1)}}function hc(a,t,r,s){sp(a,r,s),sp(t,2*r,2*s),sp(t,2*r+1,2*s+1)}function sp(a,t,r){const s=a[t];a[t]=a[r],a[r]=s}function Vf(a,t,r,s){const c=a-r,p=t-s;return c*c+p*p}var np;T.cw=void 0,(np=T.cw||(T.cw={})).create="create",np.load="load",np.fullLoad="fullLoad";let ku=null,pc=[];const op=1e3/60,lp="loadTime",cp="fullLoadTime",k_={mark(a){performance.mark(a)},frame(a){const t=a;ku!=null&&pc.push(t-ku),ku=t},clearMetrics(){ku=null,pc=[],performance.clearMeasures(lp),performance.clearMeasures(cp);for(const a in T.cw)performance.clearMarks(T.cw[a])},getPerformanceMetrics(){performance.measure(lp,T.cw.create,T.cw.load),performance.measure(cp,T.cw.create,T.cw.fullLoad);const a=performance.getEntriesByName(lp)[0].duration,t=performance.getEntriesByName(cp)[0].duration,r=pc.length,s=1/(pc.reduce((p,d)=>p+d,0)/r/1e3),c=pc.filter(p=>p>op).reduce((p,d)=>p+(d-op)/op,0);return{loadTime:a,fullLoadTime:t,fps:s,percentDroppedFrames:c/(r+c)*100,totalFrames:r}}};T.$=Ct,T.A=zt,T.B=function([a,t,r]){return t+=90,t*=Math.PI/180,r*=Math.PI/180,{x:a*Math.cos(t)*Math.sin(r),y:a*M
5ath.sin(t)*Math.sin(r),z:a*Math.cos(r)}},T.C=bi,T.D=Ge,T.E=Pe,T.F=Ht,T.G=Io,T.H=function(a){if($r==null){const t=a.navigator?a.navigator.userAgent:null;$r=!!a.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return $r},T.I=Zh,T.J=class{constructor(a,t){this.target=a,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new v_(()=>this.process()),this.subscription=Di(this.target,"message",r=>this.receive(r),!1),this.globalScope=Pr(self)?a:window}registerMessageHandler(a,t){this.messageHandlers[a]=t}sendAsync(a,t){return new Promise((r,s)=>{const c=Math.round(1e18*Math.random()).toString(36).substring(0,10),p=t?Di(t.signal,"abort",()=>{p==null||p.unsubscribe(),delete this.resolveRejects[c];const y={id:c,type:"<cancel>",origin:location.origin,targetMapId:a.targetMapId,sourceMapId:this.mapId};this.target.postMessage(y)},b_):null;this.resolveRejects[c]={resolve:y=>{p==null||p.unsubscribe(),r(y)},reject:y=>{p==null||p.unsubscribe(),s(y)}};const d=[],g=Object.assign(Object.assign({},a),{id:c,sourceMapId:this.mapId,origin:location.origin,data:Cn(a.data,d)});this.target.postMessage(g,{transfer:d})})}receive(a){const t=a.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(Pr(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 a=this.taskQueue.shift(),t=this.tasks[a];delete this.tasks[a],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(a,t)}processTask(a,t){return o(this,void 0,void 0,function*(){if(t.type==="<response>"){const c=this.resolveRejects[a];return delete this.resolveRejects[a],c?void(t.error?c.reject(Ns(t.error)):c.resolve(Ns(t.data))):void 0}if(!this.messageHandlers[t.type])return void this.completeTask(a,new Error(`Could not find a registered handler for ${t.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const r=Ns(t.data),s=new AbortController;this.abortControllers[a]=s;try{const c=yield this.messageHandlers[t.type](t.sourceMapId,r,s);this.completeTask(a,null,c)}catch(c){this.completeTask(a,c)}})}completeTask(a,t,r){const s=[];delete this.abortControllers[a];const c={id:a,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?Cn(t):null,data:Cn(r,s)};this.target.postMessage(c,{transfer:s})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},T.K=Z,T.L=function(){var a=new zt(16);return zt!=Float32Array&&(a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[11]=0,a[12]=0,a[13]=0,a[14]=0),a[0]=1,a[5]=1,a[10]=1,a[15]=1,a},T.M=function(a,t,r){var s,c,p,d,g,y,w,M,A,z,R,B,j=r[0],V=r[1],W=r[2];return t===a?(a[12]=t[0]*j+t[4]*V+t[8]*W+t[12],a[13]=t[1]*j+t[5]*V+t[9]*W+t[13],a[14]=t[2]*j+t[6]*V+t[10]*W+t[14],a[15]=t[3]*j+t[7]*V+t[11]*W+t[15]):(c=t[1],p=t[2],d=t[3],g=t[4],y=t[5],w=t[6],M=t[7],A=t[8],z=t[9],R=t[10],B=t[11],a[0]=s=t[0],a[1]=c,a[2]=p,a[3]=d,a[4]=g,a[5]=y,a[6]=w,a[7]=M,a[8]=A,a[9]=z,a[10]=R,a[11]=B,a[12]=s*j+g*V+A*W+t[12],a[13]=c*j+y*V+z*W+t[13],a[14]=p*j+w*V+R*W+t[14],a[15]=d*j+M*V+B*W+t[15]),a},T.N=function(a,t,r){var s=r[0],c=r[1],p=r[2];return a[0]=t[0]*s,a[1]=t[1]*s,a[2]=t[2]*s,a[3]=t[3]*s,a[4]=t[4]*c,a[5]=t[5]*c,a[6]=t[6]*c,a[7]=t[7]*c,a[8]=t[8]*p,a[9]=t[9]*p,a[10]=t[10]*p,a[11]=t[11]*p,a[12]=t[12],a[13]=t[13],a[14]=t[14],a[15]=t[15],a},T.O=function(a,t,r){var s=t[0],c=t[1],p=t[2],d=t[3],g=t[4],y=t[5],w=t[6],M=t[7],A=t[8],z=t[9],R=t[10],B=t[11],j=t[12],V=t[13],W=t[14],oe=t[15],Q=r[0],L=r[1],$=r[2],te=r[3];return a[0]=Q*s+L*g+$*A+te*j,a[1]=Q*c+L*y+$*z+te*V,a[2]=Q*p+L*w+$*R+te*W,a[3]=Q*d+L*M+$*B+te*oe,a[4]=(Q=r[4])*s+(L=r[5])*g+($=r[6])*A+(te=r[7])*j,a[5]=Q*c+L*y+$*z+te*V,a[6]=Q*p+L*w+$*R+te*W,a[7]=Q*d+L*M+$*B+te*oe,a[8]=(Q=r[8])*s+(L=r[9])*g+($=r[10])*A+(te=r[11])*j,a[9]=Q*c+L*y+$*z+te*V,a[10]=Q*p+L*w+$*R+te*W,a[11]=Q*d+L*M+$*B+te*oe,a[12]=(Q=r[12])*s+(L=r[13])*g+($=r[14])*A+(te=r[15])*j,a[13]=Q*c+L*y+$*z+te*V,a[14]=Q*p+L*w+$*R+te*W,a[15]=Q*d+L*M+$*B+te*oe,a},T.P=be,T.Q=function(a,t){const r={};for(let s=0;s<t.length;s++){const c=t[s];c in a&&(r[c]=a[c])}return r},T.R=wi,T.S=qs,T.T=Ph,T.U=vf,T.V=xf,T.W=vr,T.X=Bt,T.Y=ea,T.Z=Yi,T._=o,T.a=N,T.a$=function(a,t,r){return a[0]=t[0]*r,a[1]=t[1]*r,a[2]=t[2]*r,a[3]=t[3]*r,a},T.a0=uc,T.a1=On,T.a2=25,T.a3=ep,T.a4=a=>{const t=window.document.createElement("video");return t.muted=!0,new Promise(r=>{t.onloadstart=()=>{r(t)};for(const s of a){const c=window.document.createElement("source");ye(s)||(t.crossOrigin="Anonymous"),c.src=s,t.appendChild(c)}})},T.a5=Fe,T.a6=function(){return Tr++},T.a7=G,T.a8=No,T.a9=ka,T.aA=Rr,T.aB=Nr,T.aC=function(a,t,r,s,c=!1){if(!r[0]&&!r[1])return[0,0];const p=c?s==="map"?-a.bearingInRadians:0:s==="viewport"?a.bearingInRadians:0;if(p){const d=Math.sin(p),g=Math.cos(p);r=[r[0]*g-r[1]*d,r[0]*d+r[1]*g]}return[c?r[0]:Nr(t,r[0],a.zoom),c?r[1]:Nr(t,r[1],a.zoom)]},T.aE=Hh,T.aF=rp,T.aG=Gh,T.aH=ip,T.aI=ar,T.aJ=xu,T.aK=me,T.aL=St,T.aM=Ot,T.aN=Zi,T.aO=$t,T.aP=wf,T.aQ=Lt,T.aR=nt,T.aS=function(a){var t=new zt(3);return t[0]=a[0],t[1]=a[1],t[2]=a[2],t},T.aT=function(a,t,r){return a[0]=t[0]-r[0],a[1]=t[1]-r[1],a[2]=t[2]-r[2],a},T.aU=function(a,t){var r=t[0],s=t[1],c=t[2],p=r*r+s*s+c*c;return p>0&&(p=1/Math.sqrt(p)),a[0]=t[0]*p,a[1]=t[1]*p,a[2]=t[2]*p,a},T.aV=ur,T.aW=function(a,t){return a[0]*t[0]+a[1]*t[1]+a[2]*t[2]},T.aX=function(a,t,r){return a[0]=t[0]*r[0],a[1]=t[1]*r[1],a[2]=t[2]*r[2],a[3]=t[3]*r[3],a},T.aY=ot,T.aZ=function(a,t,r){const s=t[0]*r[0]+t[1]*r[1]+t[2]*r[2];return s===0?null:(-(a[0]*r[0]+a[1]*r[1]+a[2]*r[2])-r[3])/s},T.a_=Ui,T.aa=Rn,T.ab=Mf,T.ac=function(a){const t={};if(a.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,s,c,p)=>{const d=c||p;return t[s]=!d||d.toLowerCase(),""}),t["max-age"]){const r=parseInt(t["max-age"],10);isNaN(r)?delete t["max-age"]:t["max-age"]=r}return t},T.ad=Kr,T.ae=function(a){return Math.pow(2,a)},T.af=ri,T.ag=Gt,T.ah=85.051129,T.ai=bf,T.aj=function(a){return Math.log(a)/Math.LN2},T.ak=function(a){var t=a[0],r=a[1];return t*t+r*r},T.al=function(a,t){const r=[];for(const s in a)s in t||r.push(s);return r},T.am=function(a,t){let r=0,s=0;if(a.kind==="constant")s=a.layoutSize;else if(a.kind!=="source"){const{interpolationType:c,minZoom:p,maxZoom:d}=a,g=c?Gt(ai.interpolationFactor(c,t,p,d),0,1):0;a.kind==="camera"?s=bi.number(a.minSize,a.maxSize,g):r=g}return{uSizeT:r,uSize:s}},T.ao=function(a,{uSize:t,uSizeT:r},{lowerSize:s,upperSize:c}){return a.kind==="source"?s/ls:a.kind==="composite"?bi.number(s/ls,c/ls,r):t},T.ap=function(a,t){var r=t[0],s=t[1],c=t[2],p=t[3],d=t[4],g=t[5],y=t[6],w=t[7],M=t[8],A=t[9],z=t[10],R=t[11],B=t[12],j=t[13],V=t[14],W=t[15],oe=r*g-s*d,Q=r*y-c*d,L=r*w-p*d,$=s*y-c*g,te=s*w-p*g,_e=c*w-p*y,ze=M*j-A*B,we=M*V-z*B,Se=M*W-R*B,Re=A*V-z*j,Ee=A*W-R*j,Le=z*W-R*V,Me=oe*Le-Q*Ee+L*Re+$*Se-te*we+_e*ze;return Me?(a[0]=(g*Le-y*Ee+w*Re)*(Me=1/Me),a[1]=(c*Ee-s*Le-p*Re)*Me,a[2]=(j*_e-V*te+W*$)*Me,a[3]=(z*te-A*_e-R*$)*Me,a[4]=(y*Se-d*Le-w*we)*Me,a[5]=(r*Le-c*Se+p*we)*Me,a[6]=(V*L-B*_e-W*Q)*Me,a[7]=(M*_e-z*L+R*Q)*Me,a[8]=(d*Ee-g*Se+w*ze)*Me,a[9]=(s*Se-r*Ee-p
5*ze)*Me,a[10]=(B*te-j*L+W*oe)*Me,a[11]=(A*L-M*te-R*oe)*Me,a[12]=(g*we-d*Re-y*ze)*Me,a[13]=(r*Re-s*we+c*ze)*Me,a[14]=(j*Q-B*$-V*oe)*Me,a[15]=(M*$-A*Q+z*oe)*Me,a):null},T.aq=Pi,T.ar=function(a){return Math.hypot(a[0],a[1])},T.as=function(a){return a[0]=0,a[1]=0,a},T.at=function(a,t,r){return a[0]=t[0]*r,a[1]=t[1]*r,a},T.au=Wh,T.av=Ai,T.aw=function(a,t,r,s){const c=t.y-a.y,p=t.x-a.x,d=s.y-r.y,g=s.x-r.x,y=d*p-g*c;if(y===0)return null;const w=(g*(a.y-r.y)-d*(a.x-r.x))/y;return new be(a.x+w*p,a.y+w*c)},T.ax=Pf,T.ay=pd,T.az=function(a){let t=1/0,r=1/0,s=-1/0,c=-1/0;for(const p of a)t=Math.min(t,p.x),r=Math.min(r,p.y),s=Math.max(s,p.x),c=Math.max(c,p.y);return[t,r,s,c]},T.b=ui,T.b$=Kg,T.b0=function(a,t){return a[0]*t[0]+a[1]*t[1]+a[2]*t[2]+a[3]},T.b1=Sf,T.b2=Uo,T.b3=function(a,t,r,s,c){var p,d=1/Math.tan(t/2);return a[0]=d/r,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=d,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[11]=-1,a[12]=0,a[13]=0,a[15]=0,c!=null&&c!==1/0?(a[10]=(c+s)*(p=1/(s-c)),a[14]=2*c*s*p):(a[10]=-1,a[14]=-2*s),a},T.b4=function(a){var t=new zt(16);return t[0]=a[0],t[1]=a[1],t[2]=a[2],t[3]=a[3],t[4]=a[4],t[5]=a[5],t[6]=a[6],t[7]=a[7],t[8]=a[8],t[9]=a[9],t[10]=a[10],t[11]=a[11],t[12]=a[12],t[13]=a[13],t[14]=a[14],t[15]=a[15],t},T.b5=function(a,t,r){var s=Math.sin(r),c=Math.cos(r),p=t[0],d=t[1],g=t[2],y=t[3],w=t[4],M=t[5],A=t[6],z=t[7];return t!==a&&(a[8]=t[8],a[9]=t[9],a[10]=t[10],a[11]=t[11],a[12]=t[12],a[13]=t[13],a[14]=t[14],a[15]=t[15]),a[0]=p*c+w*s,a[1]=d*c+M*s,a[2]=g*c+A*s,a[3]=y*c+z*s,a[4]=w*c-p*s,a[5]=M*c-d*s,a[6]=A*c-g*s,a[7]=z*c-y*s,a},T.b6=function(a,t,r){var s=Math.sin(r),c=Math.cos(r),p=t[4],d=t[5],g=t[6],y=t[7],w=t[8],M=t[9],A=t[10],z=t[11];return t!==a&&(a[0]=t[0],a[1]=t[1],a[2]=t[2],a[3]=t[3],a[12]=t[12],a[13]=t[13],a[14]=t[14],a[15]=t[15]),a[4]=p*c+w*s,a[5]=d*c+M*s,a[6]=g*c+A*s,a[7]=y*c+z*s,a[8]=w*c-p*s,a[9]=M*c-d*s,a[10]=A*c-g*s,a[11]=z*c-y*s,a},T.b7=function(){const a=new Float32Array(16);return ri(a),a},T.b8=function(){const a=new Float64Array(16);return ri(a),a},T.b9=function(){return new Float64Array(16)},T.bA=function(a){return a[0]=0,a[1]=0,a[2]=0,a},T.bB=function(a,t,r,s){const c=Math.sqrt(a*a+t*t),p=Math.sqrt(r*r+s*s);a/=c,t/=c,r/=p,s/=p;const d=Math.acos(a*r+t*s);return-t*r+a*s>0?d:-d},T.bC=function(a,t){const r=Ur(a,2*Math.PI),s=Ur(t,2*Math.PI);return Math.min(Math.abs(r-s),Math.abs(r-s+2*Math.PI),Math.abs(r-s-2*Math.PI))},T.bD=function(){const a={},t=se.$version;for(const r in se.$root){const s=se.$root[r];if(s.required){let c=null;c=r==="version"?t:s.type==="array"?[]:{},c!=null&&(a[r]=c)}}return a},T.bE=Bl,T.bF=ne,T.bG=function a(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(!a(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(!a(t[s],r[s]))return!1;return!0}return t===r},T.bH=function(a){a=a.slice();const t=Object.create(null);for(let r=0;r<a.length;r++)t[a[r].id]=a[r];for(let r=0;r<a.length;r++)"ref"in a[r]&&(a[r]=rt(a[r],t[a[r].ref]));return a},T.bI=function(a){if(a.type==="custom")return new x_(a);switch(a.type){case"background":return new g_(a);case"circle":return new ug(a);case"color-relief":return new gg(a);case"fill":return new Eg(a);case"fill-extrusion":return new jg(a);case"heatmap":return new pg(a);case"hillshade":return new fg(a);case"line":return new Hg(a);case"raster":return new y_(a);case"symbol":return new Cu(a)}},T.bJ=hr,T.bK=function(a,t){if(!a)return[{command:"setStyle",args:[t]}];let r=[];try{if(!Ve(a.version,t.version))return[{command:"setStyle",args:[t]}];Ve(a.center,t.center)||r.push({command:"setCenter",args:[t.center]}),Ve(a.state,t.state)||r.push({command:"setGlobalState",args:[t.state]}),Ve(a.centerAltitude,t.centerAltitude)||r.push({command:"setCenterAltitude",args:[t.centerAltitude]}),Ve(a.zoom,t.zoom)||r.push({command:"setZoom",args:[t.zoom]}),Ve(a.bearing,t.bearing)||r.push({command:"setBearing",args:[t.bearing]}),Ve(a.pitch,t.pitch)||r.push({command:"setPitch",args:[t.pitch]}),Ve(a.roll,t.roll)||r.push({command:"setRoll",args:[t.roll]}
5),Ve(a.sprite,t.sprite)||r.push({command:"setSprite",args:[t.sprite]}),Ve(a.glyphs,t.glyphs)||r.push({command:"setGlyphs",args:[t.glyphs]}),Ve(a.transition,t.transition)||r.push({command:"setTransition",args:[t.transition]}),Ve(a.light,t.light)||r.push({command:"setLight",args:[t.light]}),Ve(a.terrain,t.terrain)||r.push({command:"setTerrain",args:[t.terrain]}),Ve(a.sky,t.sky)||r.push({command:"setSky",args:[t.sky]}),Ve(a.projection,t.projection)||r.push({command:"setProjection",args:[t.projection]});const s={},c=[];(function(d,g,y,w){let M;for(M in g=g||{},d=d||{})Object.prototype.hasOwnProperty.call(d,M)&&(Object.prototype.hasOwnProperty.call(g,M)||Ut(M,y,w));for(M in g)Object.prototype.hasOwnProperty.call(g,M)&&(Object.prototype.hasOwnProperty.call(d,M)?Ve(d[M],g[M])||(d[M].type==="geojson"&&g[M].type==="geojson"&&At(d,g,M)?Ye(y,{command:"setGeoJSONSourceData",args:[M,g[M].data]}):Dt(M,g,y,w)):st(M,g,y))})(a.sources,t.sources,c,s);const p=[];a.layers&&a.layers.forEach(d=>{"source"in d&&s[d.source]?r.push({command:"removeLayer",args:[d.id]}):p.push(d)}),r=r.concat(c),function(d,g,y){g=g||[];const w=(d=d||[]).map(wt),M=g.map(wt),A=d.reduce(kr,{}),z=g.reduce(kr,{}),R=w.slice(),B=Object.create(null);let j,V,W,oe,Q;for(let L=0,$=0;L<w.length;L++)j=w[L],Object.prototype.hasOwnProperty.call(z,j)?$++:(Ye(y,{command:"removeLayer",args:[j]}),R.splice(R.indexOf(j,$),1));for(let L=0,$=0;L<M.length;L++)j=M[M.length-1-L],R[R.length-1-L]!==j&&(Object.prototype.hasOwnProperty.call(A,j)?(Ye(y,{command:"removeLayer",args:[j]}),R.splice(R.lastIndexOf(j,R.length-$),1)):$++,oe=R[R.length-L],Ye(y,{command:"addLayer",args:[z[j],oe]}),R.splice(R.length-L,0,j),B[j]=!0);for(let L=0;L<M.length;L++)if(j=M[L],V=A[j],W=z[j],!B[j]&&!Ve(V,W))if(Ve(V.source,W.source)&&Ve(V["source-layer"],W["source-layer"])&&Ve(V.type,W.type)){for(Q in it(V.layout,W.layout,y,j,null,"setLayoutProperty"),it(V.paint,W.paint,y,j,null,"setPaintProperty"),Ve(V.filter,W.filter)||Ye(y,{command:"setFilter",args:[j,W.filter]}),Ve(V.minzoom,W.minzoom)&&Ve(V.maxzoom,W.maxzoom)||Ye(y,{command:"setLayerZoomRange",args:[j,W.minzoom,W.maxzoom]}),V)Object.prototype.hasOwnProperty.call(V,Q)&&Q!=="layout"&&Q!=="paint"&&Q!=="filter"&&Q!=="metadata"&&Q!=="minzoom"&&Q!=="maxzoom"&&(Q.indexOf("paint.")===0?it(V[Q],W[Q],y,j,Q.slice(6),"setPaintProperty"):Ve(V[Q],W[Q])||Ye(y,{command:"setLayerProperty",args:[j,Q,W[Q]]}));for(Q in W)Object.prototype.hasOwnProperty.call(W,Q)&&!Object.prototype.hasOwnProperty.call(V,Q)&&Q!=="layout"&&Q!=="paint"&&Q!=="filter"&&Q!=="metadata"&&Q!=="minzoom"&&Q!=="maxzoom"&&(Q.indexOf("paint.")===0?it(V[Q],W[Q],y,j,Q.slice(6),"setPaintProperty"):Ve(V[Q],W[Q])||Ye(y,{command:"setLayerProperty",args:[j,Q,W[Q]]}))}else Ye(y,{command:"removeLayer",args:[j]}),oe=R[R.lastIndexOf(j)+1],Ye(y,{command:"addLayer",args:[W,oe]})}(p,t.layers,r)}catch(s){console.warn("Unable to compute style diff:",s),r=[{command:"setStyle",args:[t]}]}return r},T.bL=function(a){const t=[],r=a.id;return r===void 0&&t.push({message:`layers.${r}: missing required property "id"`}),a.render===void 0&&t.push({message:`layers.${r}: missing required method "render"`}),a.renderingMode&&a.renderingMode!=="2d"&&a.renderingMode!=="3d"&&t.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),t},T.bM=It,T.bN=Sr,T.bO=class extends Vt{constructor(a,t){super(a,t),this.current=0}set(a){this.current!==a&&(this.current=a,this.gl.uniform1i(this.location,a))}},T.bP=fu,T.bQ=class extends Vt{constructor(a,t){super(a,t),this.current=wh}set(a){if(a[12]!==this.current[12]||a[0]!==this.current[0])return this.current=a,void this.gl.uniformMatrix4fv(this.location,!1,a);for(let t=1;t<16;t++)if(a[t]!==this.current[t]){this.current=a,this.gl.uniformMatrix4fv(this.location,!1,a);break}}},T.bR=Mr,T.bS=class extends Vt{constructor(a,t){super(a,t),this.current=[0,0,0]}set(a){a[0]===this.current[0]&&a[1]===this.current[1]&&a[2]===this.current[2]||(this.current=a,this.gl.uniform3f(this.location,a[0],a[1],a[2]))}},T.bT=class extends Vt{constructor(a,t){super(a,t),this.current=[0,0]}set(a){a[0]===this.current[0]&&a[1]===this.current[1]||(this.current=a,this.gl.uniform2f(this.location,a[0],a[1]))}},T.bU=fr,T.bV=function(a,t){var r=Math.sin(t),s=Math.cos(t);return a[0]=s,a[1]=r,a[2]=0,a[3]=-r,a[4]=s,a[5]=0,a[6]=0,a[7]=0,a[8]=1,a},T.bW=function(a,t,r){var s=t[0],c=t[1],p=t[2];return a[0]=s*r[0]+c*r[3]+p*r[6],a[1]=s*r[1]+c*r[4]+p*r[7],a[2]=s*r[2]+c*r[5]+p*r[8],a},T.bX=function(a,t,r,s,c,p,d){var g=1/(t-r),y=1/(s-c),w=1/(p-d);return a[0]=-2*g,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=-2*y,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=2*w,a[11]=0,a[12]=(t+r)*g,a[13]=(c+s)*y,a[14]=(d+p)*w,a[15]=1,a},T.bY=class extends Vt{constructor(a,t){super(a,t),this.current=ne
5w Array}set(a){if(a!=this.current){this.current=a;const t=new Float32Array(4*a.length);for(let r=0;r<a.length;r++)t[4*r]=a[r].r,t[4*r+1]=a[r].g,t[4*r+2]=a[r].b,t[4*r+3]=a[r].a;this.gl.uniform4fv(this.location,t)}}},T.bZ=class extends Vt{constructor(a,t){super(a,t),this.current=new Array}set(a){if(a!=this.current){this.current=a;const t=new Float32Array(a);this.gl.uniform1fv(this.location,t)}}},T.b_=class extends n{},T.ba=function(a,t,r){const s=new Float64Array(4);return Vi(s,a,t-90,r),s},T.bb=function(a,t,r,s){var c,p,d,g,y,w=t[0],M=t[1],A=t[2],z=t[3],R=r[0],B=r[1],j=r[2],V=r[3];return(p=w*R+M*B+A*j+z*V)<0&&(p=-p,R=-R,B=-B,j=-j,V=-V),1-p>Et?(c=Math.acos(p),d=Math.sin(c),g=Math.sin((1-s)*c)/d,y=Math.sin(s*c)/d):(g=1-s,y=s),a[0]=g*w+y*R,a[1]=g*M+y*B,a[2]=g*A+y*j,a[3]=g*z+y*V,a},T.bc=function(a){const t=new Float64Array(9);var r,s,c,p,d,g,y,w,M,A,z,R,B,j,V,W,oe,Q;A=(c=(s=a)[0])*(y=c+c),z=(p=s[1])*y,B=(d=s[2])*y,j=d*(w=p+p),W=(g=s[3])*y,oe=g*w,Q=g*(M=d+d),(r=t)[0]=1-(R=p*w)-(V=d*M),r[3]=z-Q,r[6]=B+oe,r[1]=z+Q,r[4]=1-A-V,r[7]=j-W,r[2]=B-oe,r[5]=j+W,r[8]=1-A-R;const L=$t(-Math.asin(Gt(t[2],-1,1)));let $,te;return Math.hypot(t[5],t[8])<.001?($=0,te=-$t(Math.atan2(t[3],t[4]))):($=$t(t[5]===0&&t[8]===0?0:Math.atan2(t[5],t[8])),te=$t(t[1]===0&&t[0]===0?0:Math.atan2(t[1],t[0]))),{roll:$,pitch:L+90,bearing:te}},T.bd=function(a,t){return a.roll==t.roll&&a.pitch==t.pitch&&a.bearing==t.bearing},T.be=gt,T.bf=oi,T.bg=Oo,T.bh=ic,T.bi=Bo,T.bj=ci,T.bk=yi,T.bl=lt,T.bm=function(a,t,r,s,c){return ci(s,c,Gt((a-t)/(r-t),0,1))},T.bn=Ur,T.bo=function(){return new Float64Array(3)},T.bp=function(a,t,r,s){return a[0]=t[0]+r[0]*s,a[1]=t[1]+r[1]*s,a[2]=t[2]+r[2]*s,a},T.bq=Vi,T.br=function(a,t,r){var s=r[0],c=r[1],p=r[2],d=t[0],g=t[1],y=t[2],w=c*y-p*g,M=p*d-s*y,A=s*g-c*d,z=c*A-p*M,R=p*w-s*A,B=s*M-c*w,j=2*r[3];return M*=j,A*=j,R*=2,B*=2,a[0]=d+(w*=j)+(z*=2),a[1]=g+M+R,a[2]=y+A+B,a},T.bs=function(a,t,r){const s=(c=[a[0],a[1],a[2],t[0],t[1],t[2],r[0],r[1],r[2]])[0]*((M=c[8])*(d=c[4])-(g=c[5])*(w=c[7]))+c[1]*(-M*(p=c[3])+g*(y=c[6]))+c[2]*(w*p-d*y);var c,p,d,g,y,w,M;if(s===0)return null;const A=ur([],[t[0],t[1],t[2]],[r[0],r[1],r[2]]),z=ur([],[r[0],r[1],r[2]],[a[0],a[1],a[2]]),R=ur([],[a[0],a[1],a[2]],[t[0],t[1],t[2]]),B=Lt([],A,-a[3]);return nt(B,B,Lt([],z,-t[3])),nt(B,B,Lt([],R,-r[3])),Lt(B,B,1/s),B},T.bt=Jh,T.bu=function(){return new Float64Array(4)},T.bv=function(a,t,r,s){var c=[],p=[];return c[0]=t[0]-r[0],c[1]=t[1]-r[1],c[2]=t[2]-r[2],p[0]=c[0]*Math.cos(s)-c[1]*Math.sin(s),p[1]=c[0]*Math.sin(s)+c[1]*Math.cos(s),p[2]=c[2],a[0]=p[0]+r[0],a[1]=p[1]+r[1],a[2]=p[2]+r[2],a},T.bw=function(a,t,r,s){var c=[],p=[];return c[0]=t[0]-r[0],c[1]=t[1]-r[1],c[2]=t[2]-r[2],p[0]=c[0],p[1]=c[1]*Math.cos(s)-c[2]*Math.sin(s),p[2]=c[1]*Math.sin(s)+c[2]*Math.cos(s),a[0]=p[0]+r[0],a[1]=p[1]+r[1],a[2]=p[2]+r[2],a},T.bx=function(a,t,r,s){var c=[],p=[];return c[0]=t[0]-r[0],c[1]=t[1]-r[1],c[2]=t[2]-r[2],p[0]=c[2]*Math.sin(s)+c[0]*Math.cos(s),p[1]=c[1],p[2]=c[2]*Math.cos(s)-c[0]*Math.sin(s),a[0]=p[0]+r[0],a[1]=p[1]+r[1],a[2]=p[2]+r[2],a},T.by=function(a,t,r){var s=Math.sin(r),c=Math.cos(r),p=t[0],d=t[1],g=t[2],y=t[3],w=t[8],M=t[9],A=t[10],z=t[11];return t!==a&&(a[4]=t[4],a[5]=t[5],a[6]=t[6],a[7]=t[7],a[12]=t[12],a[13]=t[13],a[14]=t[14],a[15]=t[15]),a[0]=p*c-w*s,a[1]=d*c-M*s,a[2]=g*c-A*s,a[3]=y*c-z*s,a[8]=p*s+w*c,a[9]=d*s+M*c,a[10]=g*s+A*c,a[11]=y*s+z*c,a},T.bz=function(a,t){const r=Ur(a,360),s=Ur(t,360),c=s-r,p=s>r?c-360:c+360;return Math.abs(c)<Math.abs(p)?c:p},T.c=he,T.c0=class extends h{},T.c1=Ah,T.c2=function(a){return a<=1?1:Math.pow(2,Math.ceil(Math.log(a)/Math.LN2))},T.c3=wd,T.c4=function(a,t,r){var s=t[0],c=t[1],p=t[2],d=r[3]*s+r[7]*c+r[11]*p+r[15];return a[0]=(r[0]*s+r[4]*c+r[8]*p+r[12])/(d=d||1),a[1]=(r[1]*s+r[5]*c+r[9]*p+r[13])/d,a[2]=(r[2]*s+r[6]*c+r[10]*p+r[14])/d,a},T.c5=class extends Zl{},T.c6=class extends P{},T.c7=function(a,t){return a[0]===t[0]&&a[1]===t[1]&&a[2]===t[2]&&a[3]===t[3]&&a[4]===t[4]&&a[5]===t[5]&&a[6]===t[6]&&a[7]===t[7]&&a[8]===t[8]&&a[9]===t[9]&&a[10]===t[10]&&a[11]===t[11]&&a[12]===t[12]&&a[13]===t[13]&&a[14]===t[14]&&a[15]===t[15]},T.c8=function(a,t){var r=a[0],s=a[1],c=a[2],p=a[3],d=a[4],g=a[5],y=a[6],w=a[7],M=a[8],A=a[9],z=a[10],R=a[11],B=a[12],j=a[13],V=a[14],W=a[15],oe=t[0],Q=t[1],L=t[2],$=t[3],te=t[4],_e=t[5],ze=t[6],we=t[7],Se=t[8],Re=t[9],Ee=t[10],Le=t[11],Me=t[12],qe=t[13],Qe=t[14],Ke=t[15];return Math.abs(r-oe)<=Et*Math.max(1,Math.abs(r),Math.abs(oe))&&Math.abs(s-Q)<=Et*Math.max(1,Math.abs(s),Math.abs(Q))&&Math.abs(c-L)<=Et*Math.max(1,Math.abs(c),Math.abs(L))&&Math.abs(p-$)<=Et*Math.max(1,Math.abs(p),Math.abs($))&&Math.abs(d-te)<=Et*Math.max(1,Math.abs(d),Math.abs(te))&&Math.abs(g-_e)<=Et*Math.max(1,Math.abs(g),Math.abs(_e))&&Math.abs(y-ze)<=Et*Math.max(1,Math.abs(y),Math.abs(ze))&&Math.abs(w-we)<=Et*Math.max(1,Math.abs(w),Math.abs(we))&&Math.abs(M-Se)<=Et*Math.max(1,Math.abs(M),Math.abs(Se))&&Math.abs(A-Re)<=Et*Math.max(1,Math.abs(A),Math.abs(Re))&&Math.abs(z-Ee)<=Et*Math.max(1,Math.abs(z),Math.abs(Ee))&&Math.abs(R-Le)<=Et*Math.max(1,Math.abs(R),Math.abs(Le))&&Math.abs(B-Me)<=Et*Math.max(1,Math.abs(B),Math.abs(Me))&&Math.abs(j-qe)<=Et*Math.max(1,Math.abs(j),Math.abs(qe))&&Math.abs(V-Qe)<=Et*Math.max(1,Math.abs(V),Math.abs(Qe))&&Math.abs(W-Ke)<=Et*Math.max(1,Math.abs(W),Math.abs(Ke))},T.c9=function(a,t){return a[0]=t[0],a[1]=t[1],a[2]=t[2],a[3]=t[3],a[4]=t[4],a[5]=t[5],a[6]=t[6],a[7]=t[7],a[8]=t[8],a[9]=t[9],a[10]=t[10],a[11]=t[11],a[12]=t[12],a[13]=t[13],a[14]=t[14],a[15]=t[15],a},T.cA=function(a){delete N.REGISTERED_PROTOCOLS[a]},T.cB=function(a,t){const r={};for(let c=0;c<a.length;c++){const p=t&&t[a[c].id]||wo(a[c]);t&&(t[a[c].id]=p);let d=r[p];d||(d=r[p]=[]),d.push(a[c])}const s=[];for(const c in r)s.push(r[c]);return s},T.cC=$e,T.cD=Cf,T.cE=If,T.cF=rf,T.cG=function(a){a.bucket.createArrays(),a.bucket.tilePixelRatio=Ct/(512*a.bucket.overscaling),a.bucket.compareText={},a.bucket.iconsNeedLinear=!1;const t=a.bucket.layers[0],r=t.layout,s=t._unevaluatedLayout._values,c={layoutIconSize:s["icon-size"].possiblyEvaluate(new Ht(a.bucket.zoom+1),a.canonical),layoutTextSize:s["text-size"].possiblyEvaluate(new Ht(a.bucket.zoom+1),a.canonical),textMaxSize:s["text-size"].possiblyEvaluate(new Ht(18))};if(a.bucket.textSizeData.kind==="composite"){const{minZoom:w,maxZoom:M}=a.bucket.textSizeData;c.compositeTextSizes=[s["text-size"].possiblyEvaluate(new Ht(w),a.canonical),s["text-size"].possiblyEvaluate(new Ht(M),a.canonical)]}if(a.bucket.iconSizeData.kind==="composite"){const{minZoom:w,maxZoom:M}=a.bucket.iconSizeData;c.compositeIconSizes=[s["icon-size"].possiblyEvaluate(new Ht(w),a.canonical),s["icon-size"].possiblyEvaluate(new Ht(M),a.canonical)]}const p=r.get("text-line-height")*Rr,d=r.get("text-rotation-alignment")!=="viewport"&&r.get("symbol-placement")!=="point",g=r.get("text-keep-upright"),y=r.get("text-size");for(const w of a.bucket.features){const M=r.get("text-font").evaluate(w,{},a.canonical).join(","),A=y.evaluate(w,{},a.canonical),z=c.layoutTextSize.evaluate(w,{},a.canonical),R=c.layoutIconSize.evaluate(w,{},a.canonical),B={horizontal:{},vertical:void 0},j=w.text;let V,W=[0,0];if(j){const L=j.toString(),$=r.get("text-letter-spacing").evaluate(w,{},a.canonical)*Rr,te=ou(L)?$:0,_e=r.get("text-anchor").evaluate(w,{},a.canonical),ze=Of(t,w,a.canonical);if(!ze){const Ee=r.get("text-radial-offset").evaluate(w,{},a.canonical);
5W=Ee?Bf(_e,[Ee*Rr,tp]):r.get("text-offset").evaluate(w,{},a.canonical).map(Le=>Le*Rr)}let we=d?"center":r.get("text-justify").evaluate(w,{},a.canonical);const Se=r.get("symbol-placement")==="point"?r.get("text-max-width").evaluate(w,{},a.canonical)*Rr:1/0,Re=()=>{a.bucket.allowVerticalPlacement&&Ol(L)&&(B.vertical=wu(j,a.glyphMap,a.glyphPositions,a.imagePositions,M,Se,p,_e,"left",te,W,T.an.vertical,!0,z,A))};if(!d&&ze){const Ee=new Set;if(we==="auto")for(let Me=0;Me<ze.values.length;Me+=2)Ee.add(rp(ze.values[Me]));else Ee.add(we);let Le=!1;for(const Me of Ee)if(!B.horizontal[Me])if(Le)B.horizontal[Me]=B.horizontal[0];else{const qe=wu(j,a.glyphMap,a.glyphPositions,a.imagePositions,M,Se,p,"center",Me,te,W,T.an.horizontal,!1,z,A);qe&&(B.horizontal[Me]=qe,Le=qe.positionedLines.length===1)}Re()}else{we==="auto"&&(we=rp(_e));const Ee=wu(j,a.glyphMap,a.glyphPositions,a.imagePositions,M,Se,p,_e,we,te,W,T.an.horizontal,!1,z,A);Ee&&(B.horizontal[we]=Ee),Re(),Ol(L)&&d&&g&&(B.vertical=wu(j,a.glyphMap,a.glyphPositions,a.imagePositions,M,Se,p,_e,we,te,W,T.an.vertical,!1,z,A))}}let oe=!1;if(w.icon&&w.icon.name){const L=a.imageMap[w.icon.name];L&&(V=h_(a.imagePositions[w.icon.name],r.get("icon-offset").evaluate(w,{},a.canonical),r.get("icon-anchor").evaluate(w,{},a.canonical)),oe=!!L.sdf,a.bucket.sdfIcons===void 0?a.bucket.sdfIcons=oe:a.bucket.sdfIcons!==oe&&rr("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(L.pixelRatio!==a.bucket.pixelRatio||r.get("icon-rotate").constantOr(1)!==0)&&(a.bucket.iconsNeedLinear=!0))}const Q=Nf(B.horizontal)||B.vertical;a.bucket.iconsInText=!!Q&&Q.iconsInText,(Q||V)&&A_(a.bucket,w,B,V,a.imageMap,c,z,R,W,oe,a.canonical,a.subdivisionGranularity)}a.showCollisionBoxes&&a.bucket.generateCollisionDebugBuffers()},T.cH=Nh,T.cI=Lh,T.cJ=jh,T.cK=sc,T.cL=Vh,T.cM=class{constructor(a){this._marks={start:[a.url,"start"].join("#"),end:[a.url,"end"].join("#"),measure:a.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let a=performance.getEntriesByName(this._marks.measure);return a.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),a=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),a}},T.cN=function(a,t,r,s,c){return o(this,void 0,void 0,function*(){if(Bt())try{return yield ea(a,t,r,s,c)}catch{}return function(p,d,g,y,w){const M=p.width,A=p.height;zi&&ta||(zi=new OffscreenCanvas(M,A),ta=zi.getContext("2d",{willReadFrequently:!0})),zi.width=M,zi.height=A,ta.drawImage(p,0,0,M,A);const z=ta.getImageData(d,g,y,w);return ta.clearRect(0,0,M,A),z.data}(a,t,r,s,c)})},T.cO=Cd,T.cP=fe,T.cQ=Ie,T.cR=$d,T.cS=ef,T.cT=yo,T.cU=za,T.ca=a=>a.type==="symbol",T.cb=a=>a.type==="circle",T.cc=a=>a.type==="heatmap",T.cd=a=>a.type==="line",T.ce=a=>a.type==="fill",T.cf=a=>a.type==="fill-extrusion",T.cg=a=>a.type==="hillshade",T.ch=a=>a.type==="color-relief",T.ci=a=>a.type==="raster",T.cj=a=>a.type==="background",T.ck=a=>a.type==="custom",T.cl=ki,T.cm=function(a,t,r){const s=br(t.x-r.x,t.y-r.y),c=br(a.x-r.x,a.y-r.y);var p,d;return $t(Math.atan2(s[0]*c[1]-s[1]*c[0],(p=s)[0]*(d=c)[0]+p[1]*d[1]))},T.cn=Qi,T.co=function(a,t){return Ha[t]&&(a instanceof MouseEvent||a instanceof WheelEvent)},T.cp=function(a,t){return Ma[t]&&"touches"in a},T.cq=function(a){return Ma[a]||Ha[a]},T.cr=function(a,t,r){var s=t[0],c=t[1];return a[0]=r[0]*s+r[4]*c+r[12],a[1]=r[1]*s+r[5]*c+r[13],a},T.cs=function(a,t){const{x:r,y:s}=uc.fromLngLat(t);return!(a<0||a>25||s<0||s>=1||r<0||r>=1)},T.ct=function(a,t){return a[0]=t[0],a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=t[1],a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=t[2],a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a},T.cu=class extends La{},T.cv=k_,T.cx=function(a){return a.message===Li},T.cy=J,T.cz=function(a,t){N.REGISTERED_PROTOCOLS[a]=t},T.d=ye,T.e=wr,T.f=a=>o(void 0,void 0,void 0,function*(){if(a.byteLength===0)return createImageBitmap(new ImageData(1,1));const t=new Blob([new Uint8Array(a)],{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.`)}}),T.g=U,T.h=a=>new Promise((t,r)=>{const s=new Image;s.onload=()=>{t(s),URL.revokeObjectURL(s.src),s.onload=null,window.requestAnimationFrame(()=>{s.src=qi})},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 c=new Blob([new Uint8Array(a)],{type:"image/png"});s.src=a.byteLength?URL.createObjectURL(c):qi}),T.i=Pr,T.j=(a,t)=>pe(wr(a,{type:"json"}),t),T.k=de,T.l=Te,T.m=pe,T.n=(a,t)=>pe(wr(a,{type:"arrayBuffer"}),t),T.o=function(a){return new Vh(a).readFields(e_,[])},T.p=tf,T.q=Jl,T.r=ni,T.s=Di,T.t=$l,T.u=yt,T.v=se,T.w=rr,T.x=gh,T.y=Tn,T.z=Os}),E("worker",["./shared"],function(T){class o{constructor(N){this.keyCache={},N&&this.replace(N)}replace(N){this._layerConfigs={},this._layers={},this.update(N,[])}update(N,U){for(const J of N){this._layerConfigs[J.id]=J;const ne=this._layers[J.id]=T.bI(J);ne._featureFilter=T.a9(ne.filter),this.keyCache[J.id]&&delete this.keyCache[J.id]}for(const J of U)delete this.keyCache[J],delete this._layerConfigs[J],delete this._layers[J];this.familiesBySource={};const Z=T.cB(Object.values(this._layerConfigs),this.keyCache);for(const J of Z){const ne=J.map(de=>this._layers[de.id]),pe=ne[0];if(pe.visibility==="none")continue;const ye=pe.source||"";let ue=this.familiesBySource[ye];ue||(ue=this.familiesBySource[ye]={});const Ce=pe.sourceLayer||"_geojsonTileLayer";let Te=ue[Ce];Te||(Te=ue[Ce]=[]),Te.push(ne)}}}class fe{constructor(N){const U={},Z=[];for(const ye in N){const ue=N[ye],Ce=U[ye]={};for(const Te in ue){const de=ue[+Te];if(!de||de.bitmap.width===0||de.bitmap.height===0)continue;const Pe={x:0,y:0,w:de.bitmap.width+2,h:de.bitmap.height+2};Z.push(Pe),Ce[Te]={rect:Pe,metrics:de.metrics}}}const{w:J,h:ne}=T.p(Z),pe=new T.q({width:J||1,height:ne||1});for(const ye in N){const ue=N[ye];for(const Ce in ue){const Te=ue[+Ce];if(!Te||Te.bitmap.width===0||Te.bitmap.height===0)continue;const de=U[ye][Ce].rect;T.q.copy(Te.bitmap,pe,{x:0,y:0},{x:de.x+1,y:de.y+1},Te.bitmap)}}this.image=pe,this.positions=U}}T.cC("GlyphAtlas",fe);class ce{constructor(N){this.tileID=new T.Z(N.tileID.overscaledZ,N.tileID.wrap,N.tileID.canonical.z,N.tileID.canonical.x,N.tileID.canonical.y),this.uid=N.uid,this.zoom=N.zoom,this.pixelRatio=N.pixelRatio,this.tileSize=N.tileSize,this.source=N.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=N.showCollisionBoxes,this.collectResourceTiming=!!N.collectResourceTiming,this.returnDependencies=!!N.returnDependencies,this.promoteId=N.promoteId,this.inFlightDependencies=[],this.globalState=N.globalState}parse(N,U,Z,J,ne){return T._(this,void 0,void 0,function*(){this.status="parsing",this.data=N,this.collisionBoxArray=new T.a7;const pe=new T.cD(Object.keys(N.layers).sort()),ye=new T.cE(this.tileID,this.promoteId);ye.bucketLayerIDs=[];const ue={},Ce={featureIndex:ye,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:Z,subdivisionGranularity:ne},Te=U.familiesBySource[this.source];for(const it in Te){const wt=N.layers[it];
5if(!wt)continue;wt.version===1&&T.w(`Vector tile source "${this.source}" layer "${it}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const kr=pe.encode(it),Fe=[];for(let Vr=0;Vr<wt.length;Vr++){const Xt=wt.feature(Vr),Ia=ye.getId(Xt,it);Fe.push({feature:Xt,id:Ia,index:Vr,sourceLayerIndex:kr})}for(const Vr of Te[it]){const Xt=Vr[0];Xt.source!==this.source&&T.w(`layer.source = ${Xt.source} does not equal this.source = ${this.source}`),Xt.minzoom&&this.zoom<Math.floor(Xt.minzoom)||Xt.maxzoom&&this.zoom>=Xt.maxzoom||Xt.visibility!=="none"&&(Ae(Vr,this.zoom,Z),(ue[Xt.id]=Xt.createBucket({index:ye.bucketLayerIDs.length,layers:Vr,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:kr,sourceID:this.source,globalState:this.globalState})).populate(Fe,Ce,this.tileID.canonical),ye.bucketLayerIDs.push(Vr.map(Ia=>Ia.id)))}}const de=T.bM(Ce.glyphDependencies,it=>Object.keys(it).map(Number));this.inFlightDependencies.forEach(it=>it==null?void 0:it.abort()),this.inFlightDependencies=[];let Pe=Promise.resolve({});if(Object.keys(de).length){const it=new AbortController;this.inFlightDependencies.push(it),Pe=J.sendAsync({type:"GG",data:{stacks:de,source:this.source,tileID:this.tileID,type:"glyphs"}},it)}const se=Object.keys(Ce.iconDependencies);let Ne=Promise.resolve({});if(se.length){const it=new AbortController;this.inFlightDependencies.push(it),Ne=J.sendAsync({type:"GI",data:{icons:se,source:this.source,tileID:this.tileID,type:"icons"}},it)}const rt=Object.keys(Ce.patternDependencies);let Ve=Promise.resolve({});if(rt.length){const it=new AbortController;this.inFlightDependencies.push(it),Ve=J.sendAsync({type:"GI",data:{icons:rt,source:this.source,tileID:this.tileID,type:"patterns"}},it)}const[Ye,st,Ut]=yield Promise.all([Pe,Ne,Ve]),Dt=new fe(Ye),At=new T.cF(st,Ut);for(const it in ue){const wt=ue[it];wt instanceof T.a8?(Ae(wt.layers,this.zoom,Z),T.cG({bucket:wt,glyphMap:Ye,glyphPositions:Dt.positions,imageMap:st,imagePositions:At.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:Ce.subdivisionGranularity})):wt.hasPattern&&(wt instanceof T.cH||wt instanceof T.cI||wt instanceof T.cJ)&&(Ae(wt.layers,this.zoom,Z),wt.addFeatures(Ce,this.tileID.canonical,At.patternPositions))}return this.status="done",{buckets:Object.values(ue).filter(it=>!it.isEmpty()),featureIndex:ye,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Dt.image,imageAtlas:At,glyphMap:this.returnDependencies?Ye:null,iconMap:this.returnDependencies?st:null,glyphPositions:this.returnDependencies?Dt.positions:null}})}}function Ae(he,N,U){const Z=new T.F(N);for(const J of he)J.recalculate(Z,U)}class Ie{constructor(N,U,Z){this.actor=N,this.layerIndex=U,this.availableImages=Z,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(N,U){return T._(this,void 0,void 0,function*(){const Z=yield T.n(N.request,U);try{return{vectorTile:new T.cK.VectorTile(new T.cL(Z.data)),rawData:Z.data,cacheControl:Z.cacheControl,expires:Z.expires}}catch(J){const ne=new Uint8Array(Z.data);let pe=`Unable to parse the tile at ${N.request.url}, `;throw pe+=ne[0]===31&&ne[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${J.message}`,new Error(pe)}})}loadTile(N){return T._(this,void 0,void 0,function*(){const U=N.uid,Z=!!(N&&N.request&&N.request.collectResourceTiming)&&new T.cM(N.request),J=new ce(N);this.loading[U]=J;const ne=new AbortController;J.abort=ne;try{const pe=yield this.loadVectorTile(N,ne);if(delete this.loading[U],!pe)return null;const ye=pe.rawData,ue={};pe.expires&&(ue.expires=pe.expires),pe.cacheControl&&(ue.cacheControl=pe.cacheControl);const Ce={};if(Z){const de=Z.finish();de&&(Ce.resourceTiming=JSON.parse(JSON.stringify(de)))}J.vectorTile=pe.vectorTile;const Te=J.parse(pe.vectorTile,this.layerIndex,this.availableImages,this.actor,N.subdivisionGranularity);this.loaded[U]=J,this.fetching[U]={rawTileData:ye,cacheControl:ue,resourceTiming:Ce};try{const de=yield Te;return T.e({rawTileData:ye.slice(0)},de,ue,Ce)}finally{delete this.fetching[U]}}catch(pe){throw delete this.loading[U],J.status="done",this.loaded[U]=J,pe}})}reloadTile(N){return T._(this,void 0,void 0,function*(){const U=N.uid;if(!this.loaded||!this.loaded[U])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const Z=this.loaded[U];if(Z.showCollisionBoxes=N.showCollisionBoxes,Z.globalState=N.globalState,Z.status==="parsing"){const J=yield Z.parse(Z.vectorTile,this.layerIndex,this.availableImages,this.actor,N.subdivisionGranularity);let ne;if(this.fetching[U]){const{rawTileData:pe,cacheControl:ye,resourceTiming:ue}=this.fetching[U];delete this.fetching[U],ne=T.e({rawTileData:pe.slice(0)},J,ye,ue)}else ne=J;return ne}if(Z.status==="done"&&Z.vectorTile)return Z.parse(Z.vectorTile,this.layerIndex,this.availableImages,this.actor,N.subdivisionGranularity)})}abortTile(N){return T._(this,void 0,void 0,function*(){const U=this.loading,Z=N.uid;U&&U[Z]&&U[Z].abort&&(U[Z].abort.abort(),delete U[Z])})}removeTile(N){return T._(this,void 0,void 0,function*(){this.loaded&&this.loaded[N.uid]&&delete this.loaded[N.uid]})}}class De{constructor(){this.loaded={}}loadTile(N){return T._(this,void 0,void 0,function*(){const{uid:U,encoding:Z,rawImageData:J,redFactor:ne,greenFactor:pe,blueFactor:ye,baseShift:ue}=N,Ce=J.width+2,Te=J.height+2,de=T.b(J)?new T.R({width:Ce,height:Te},yield T.cN(J,-1,-1,Ce,Te)):J,Pe=new T.cO(U,de,Z,ne,pe,ye,ue);return this.loaded=this.loaded||{},this.loaded[U]=Pe,Pe})}removeTile(N){const U=this.loaded,Z=N.uid;U&&U[Z]&&delete U[Z]}}var ie,be,et=function(){if(be)return ie;function he(U,Z){if(U.length!==0){N(U[0],Z);for(var J=1;J<U.length;J++)N(U[J],!Z)}}function N(U,Z){for(var J=0,ne=0,pe=0,ye=U.length,ue=ye-1;pe<ye;ue=pe++){var Ce=(U[pe][0]-U[ue][0])*(U[ue][1]+U[pe][1]),Te=J+Ce;ne+=Math.abs(J)>=Math.abs(Ce)?J-Te+Ce:Ce-Te+J,J=Te}J+ne>=0!=!!Z&&U.reverse()}return be=1,ie=function U(Z,J){var ne,pe=Z&&Z.type;if(pe==="FeatureCollection")for(ne=0;ne<Z.features.length;ne++)U(Z.features[ne],J);else if(pe==="GeometryCollection")for(ne=0;ne<Z.geometries.length;ne++)U(Z.geometries[ne],J);else if(pe==="Feature")U(Z.geometry,J);else if(pe==="Polygon")he(Z.coordinates,J);else if(pe==="MultiPolygon")for(ne=0;ne<Z.coordinates.length;ne++)he(Z.coordinates[ne],J);return Z}}
5(),ft=T.cP(et);const Nt=T.cK.VectorTileFeature.prototype.toGeoJSON;class qt{constructor(N){this._feature=N,this.extent=T.$,this.type=N.type,this.properties=N.tags,"id"in N&&!isNaN(N.id)&&(this.id=parseInt(N.id,10))}loadGeometry(){if(this._feature.type===1){const N=[];for(const U of this._feature.geometry)N.push([new T.P(U[0],U[1])]);return N}{const N=[];for(const U of this._feature.geometry){const Z=[];for(const J of U)Z.push(new T.P(J[0],J[1]));N.push(Z)}return N}}toGeoJSON(N,U,Z){return Nt.call(this,N,U,Z)}}class vr{constructor(N){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=T.$,this.length=N.length,this._features=N}feature(N){return new qt(this._features[N])}}var Bt,Et,zt,fr={exports:{}},ri=function(){if(zt)return fr.exports;zt=1;var he=T.cS(),N=function(){if(Et)return Bt;Et=1;var Te=T.cQ(),de=T.cR().VectorTileFeature;function Pe(Ne,rt){this.options=rt||{},this.features=Ne,this.length=Ne.length}function se(Ne,rt){this.id=typeof Ne.id=="number"?Ne.id:void 0,this.type=Ne.type,this.rawGeometry=Ne.type===1?[Ne.geometry]:Ne.geometry,this.properties=Ne.tags,this.extent=rt||4096}return Bt=Pe,Pe.prototype.feature=function(Ne){return new se(this.features[Ne],this.options.extent)},se.prototype.loadGeometry=function(){var Ne=this.rawGeometry;this.geometry=[];for(var rt=0;rt<Ne.length;rt++){for(var Ve=Ne[rt],Ye=[],st=0;st<Ve.length;st++)Ye.push(new Te(Ve[st][0],Ve[st][1]));this.geometry.push(Ye)}return this.geometry},se.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var Ne=this.geometry,rt=1/0,Ve=-1/0,Ye=1/0,st=-1/0,Ut=0;Ut<Ne.length;Ut++)for(var Dt=Ne[Ut],At=0;At<Dt.length;At++){var it=Dt[At];rt=Math.min(rt,it.x),Ve=Math.max(Ve,it.x),Ye=Math.min(Ye,it.y),st=Math.max(st,it.y)}return[rt,Ye,Ve,st]},se.prototype.toGeoJSON=de.prototype.toGeoJSON,Bt}();function U(Te){var de=new he;return function(Pe,se){for(var Ne in Pe.layers)se.writeMessage(3,Z,Pe.layers[Ne])}(Te,de),de.finish()}function Z(Te,de){var Pe;de.writeVarintField(15,Te.version||1),de.writeStringField(1,Te.name||""),de.writeVarintField(5,Te.extent||4096);var se={keys:[],values:[],keycache:{},valuecache:{}};for(Pe=0;Pe<Te.length;Pe++)se.feature=Te.feature(Pe),de.writeMessage(2,J,se);var Ne=se.keys;for(Pe=0;Pe<Ne.length;Pe++)de.writeStringField(3,Ne[Pe]);var rt=se.values;for(Pe=0;Pe<rt.length;Pe++)de.writeMessage(4,Ce,rt[Pe])}function J(Te,de){var Pe=Te.feature;Pe.id!==void 0&&de.writeVarintField(1,Pe.id),de.writeMessage(2,ne,Te),de.writeVarintField(3,Pe.type),de.writeMessage(4,ue,Pe)}function ne(Te,de){var Pe=Te.feature,se=Te.keys,Ne=Te.values,rt=Te.keycache,Ve=Te.valuecache;for(var Ye in Pe.properties){var st=Pe.properties[Ye],Ut=rt[Ye];if(st!==null){Ut===void 0&&(se.push(Ye),rt[Ye]=Ut=se.length-1),de.writeVarint(Ut);var Dt=typeof st;Dt!=="string"&&Dt!=="boolean"&&Dt!=="number"&&(st=JSON.stringify(st));var At=Dt+":"+st,it=Ve[At];it===void 0&&(Ne.push(st),Ve[At]=it=Ne.length-1),de.writeVarint(it)}}}function pe(Te,de){return(de<<3)+(7&Te)}function ye(Te){return Te<<1^Te>>31}function ue(Te,de){for(var Pe=Te.loadGeometry(),se=Te.type,Ne=0,rt=0,Ve=Pe.length,Ye=0;Ye<Ve;Ye++){var st=Pe[Ye],Ut=1;se===1&&(Ut=st.length),de.writeVarint(pe(1,Ut));for(var Dt=se===3?st.length-1:st.length,At=0;At<Dt;At++){At===1&&se!==1&&de.writeVarint(pe(2,Dt-1));var it=st[At].x-Ne,wt=st[At].y-rt;de.writeVarint(ye(it)),de.writeVarint(ye(wt)),Ne+=it,rt+=wt}se===3&&de.writeVarint(pe(7,1))}}function Ce(Te,de){var Pe=typeof Te;Pe==="string"?de.writeStringField(1,Te):Pe==="boolean"?de.writeBooleanField(7,Te):Pe==="number"&&(Te%1!=0?de.writeDoubleField(3,Te):Te<0?de.writeSVarintField(6,Te):de.writeVarintField(5,Te))}return fr.exports=U,fr.exports.fromVectorTileJs=U,fr.exports.fromGeojsonVt=function(Te,de){de=de||{};var Pe={};for(var se in Te)Pe[se]=new N(Te[se].features,de),Pe[se].name=se,Pe[se].version=de.version,Pe[se].extent=de.extent;return U({layers:Pe})},fr.exports.GeoJSONWrapper=N,fr.exports}(),Je=T.cP(ri);const ot={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:he=>he},We=Math.fround||(nt=new Float32Array(1),he=>
vendor: 5,061 bytes, line 5
5(nt[0]=+he,nt[0]));var nt;class Lt{constructor(N){this.options=Object.assign(Object.create(ot),N),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(N){const{log:U,minZoom:Z,maxZoom:J}=this.options;U&&console.time("total time");const ne=`prepare ${N.length} points`;U&&console.time(ne),this.points=N;const pe=[];for(let ue=0;ue<N.length;ue++){const Ce=N[ue];if(!Ce.geometry)continue;const[Te,de]=Ce.geometry.coordinates,Pe=We(Ui(Te)),se=We(Ai(de));pe.push(Pe,se,1/0,ue,-1,1),this.options.reduce&&pe.push(0)}let ye=this.trees[J+1]=this._createTree(pe);U&&console.timeEnd(ne);for(let ue=J;ue>=Z;ue--){const Ce=+Date.now();ye=this.trees[ue]=this._createTree(this._cluster(ye,ue)),U&&console.log("z%d: %d clusters in %dms",ue,ye.numItems,+Date.now()-Ce)}return U&&console.timeEnd("total time"),this}getClusters(N,U){let Z=((N[0]+180)%360+360)%360-180;const J=Math.max(-90,Math.min(90,N[1]));let ne=N[2]===180?180:((N[2]+180)%360+360)%360-180;const pe=Math.max(-90,Math.min(90,N[3]));if(N[2]-N[0]>=360)Z=-180,ne=180;else if(Z>ne){const de=this.getClusters([Z,J,180,pe],U),Pe=this.getClusters([-180,J,ne,pe],U);return de.concat(Pe)}const ye=this.trees[this._limitZoom(U)],ue=ye.range(Ui(Z),Ai(pe),Ui(ne),Ai(J)),Ce=ye.data,Te=[];for(const de of ue){const Pe=this.stride*de;Te.push(Ce[Pe+5]>1?ur(Ce,Pe,this.clusterProps):this.points[Ce[Pe+3]])}return Te}getChildren(N){const U=this._getOriginId(N),Z=this._getOriginZoom(N),J="No cluster with the specified id.",ne=this.trees[Z];if(!ne)throw new Error(J);const pe=ne.data;if(U*this.stride>=pe.length)throw new Error(J);const ye=this.options.radius/(this.options.extent*Math.pow(2,Z-1)),ue=ne.within(pe[U*this.stride],pe[U*this.stride+1],ye),Ce=[];for(const Te of ue){const de=Te*this.stride;pe[de+4]===N&&Ce.push(pe[de+5]>1?ur(pe,de,this.clusterProps):this.points[pe[de+3]])}if(Ce.length===0)throw new Error(J);return Ce}getLeaves(N,U,Z){const J=[];return this._appendLeaves(J,N,U=U||10,Z=Z||0,0),J}getTile(N,U,Z){const J=this.trees[this._limitZoom(N)],ne=Math.pow(2,N),{extent:pe,radius:ye}=this.options,ue=ye/pe,Ce=(Z-ue)/ne,Te=(Z+1+ue)/ne,de={features:[]};return this._addTileFeatures(J.range((U-ue)/ne,Ce,(U+1+ue)/ne,Te),J.data,U,Z,ne,de),U===0&&this._addTileFeatures(J.range(1-ue/ne,Ce,1,Te),J.data,ne,Z,ne,de),U===ne-1&&this._addTileFeatures(J.range(0,Ce,ue/ne,Te),J.data,-1,Z,ne,de),de.features.length?de:null}getClusterExpansionZoom(N){let U=this._getOriginZoom(N)-1;for(;U<=this.options.maxZoom;){const Z=this.getChildren(N);if(U++,Z.length!==1)break;N=Z[0].properties.cluster_id}return U}_appendLeaves(N,U,Z,J,ne){const pe=this.getChildren(U);for(const ye of pe){const ue=ye.properties;if(ue&&ue.cluster?ne+ue.point_count<=J?ne+=ue.point_count:ne=this._appendLeaves(N,ue.cluster_id,Z,J,ne):ne<J?ne++:N.push(ye),N.length===Z)break}return ne}_createTree(N){const U=new T.aH(N.length/this.stride|0,this.options.nodeSize,Float32Array);for(let Z=0;Z<N.length;Z+=this.stride)U.add(N[Z],N[Z+1]);return U.finish(),U.data=N,U}_addTileFeatures(N,U,Z,J,ne,pe){for(const ye of N){const ue=ye*this.stride,Ce=U[ue+5]>1;let Te,de,Pe;if(Ce)Te=mr(U,ue,this.clusterProps),de=U[ue],Pe=U[ue+1];else{const rt=this.points[U[ue+3]];Te=rt.properties;const[Ve,Ye]=rt.geometry.coordinates;de=Ui(Ve),Pe=Ai(Ye)}const se={type:1,geometry:[[Math.round(this.options.extent*(de*ne-Z)),Math.round(this.options.extent*(Pe*ne-J))]],tags:Te};let Ne;Ne=Ce||this.options.generateId?U[ue+3]:this.points[U[ue+3]].id,Ne!==void 0&&(se.id=Ne),pe.features.push(se)}}_limitZoom(N){return Math.max(this.options.minZoom,Math.min(Math.floor(+N),this.options.maxZoom+1))}_cluster(N,U){const{radius:Z,extent:J,reduce:ne,minPoints:pe}=this.options,ye=Z/(J*Math.pow(2,U)),ue=N.data,Ce=[],Te=this.stride;for(let de=0;de<ue.length;de+=Te){if(ue[de+2]<=U)continue;ue[de+2]=U;const Pe=ue[de],se=ue[de+1],Ne=N.within(ue[de],ue[de+1],ye),rt=ue[de+5];let Ve=rt;for(const Ye of Ne){const st=Ye*Te;ue[st+2]>U&&(Ve+=ue[st+5])}if(Ve>rt&&Ve>=pe){let Ye,st=Pe*rt,Ut=se*rt,Dt=-1;const At=(de/Te<<5)+(U+1)+this.points.length;for(const it of Ne){const wt=it*Te;if(ue[wt+2]<=U)continue;ue[wt+2]=U;const kr=ue[wt+5];st+=ue[wt]*kr,Ut+=ue[wt+1]*kr,ue[wt+4]=At,ne&&(Ye||(Ye=this._map(ue,de,!0),Dt=this.clusterProps.length,this.clusterProps.push(Ye)),ne(Ye,this._map(ue,wt)))}ue[de+4]=At,Ce.push(st/Ve,Ut/Ve,1/0,At,-1,Ve),ne&&Ce.push(Dt)}else{for(let Ye=0;Ye<Te;Ye++)Ce.push(ue[de+Ye]);if(Ve>1)for(const Ye of Ne){const st=Ye*Te;if(!(ue[st+2]<=U)){ue[st+2]=U;for(let Ut=0;Ut<Te;Ut++)Ce.push(ue[st+Ut])}}}}return Ce}_getOriginId(N){return N-this.points.length>>5}_getOriginZoom(N){return(N-this.points.length)%32}_map(N,U,Z){if(N[U+5]>1){const pe=this.clusterProps[N[U+6]];return Z?Object.assign({},pe):pe}const J=this.points[N[U+3]].properties,ne=this.options.map(J);return Z&&ne===J?Object.assign({},ne):ne}}function ur(he,N,U){return{type:"Feature",id:he[N+3],properties:mr(he,N,U),geometry:{type:"Point",coordinates:[(Z=he[N],360*(Z-.5)),$i(he[N+1])]}};var Z}function mr(he,N,U){const Z=he[N+5],J=Z>=1e4?`${Math.round(Z/1e3)}
5k`:Z>=1e3?Math.round(Z/100)/10+"k":Z,ne=he[N+6],pe=ne===-1?{}:Object.assign({},U[ne]);return Object.assign(pe,{cluster:!0,cluster_id:he[N+3],point_count:Z,point_count_abbreviated:J})}function Ui(he){return he/360+.5}function Ai(he){const N=Math.sin(he*Math.PI/180),U=.5-.25*Math.log((1+N)/(1-N))/Math.PI;return U<0?0:U>1?1:U}function $i(he){const N=(180-360*he)*Math.PI/180;return 360*Math.atan(Math.exp(N))/Math.PI-90}function Vi(he,N,U,Z){let J=Z;const ne=N+(U-N>>1);let pe,ye=U-N;const ue=he[N],Ce=he[N+1],Te=he[U],de=he[U+1];for(let Pe=N+3;Pe<U;Pe+=3){const se=Pi(he[Pe],he[Pe+1],ue,Ce,Te,de);if(se>J)pe=Pe,J=se;else if(se===J){const Ne=Math.abs(Pe-ne);Ne<ye&&(pe=Pe,ye=Ne)}}J>Z&&(pe-N>3&&Vi(he,N,pe,Z),he[pe+2]=J,U-pe>3&&Vi(he,pe,U,Z))}function Pi(he,N,U,Z,J,ne){let pe=J-U,ye=ne-Z;if(pe!==0||ye!==0){const ue=((he-U)*pe+(N-Z)*ye)/(pe*pe+ye*ye);ue>1?(U=J,Z=ne):ue>0&&(U+=pe*ue,Z+=ye*ue)}return pe=he-U,ye=N-Z,pe*pe+ye*ye}function br(he,N,U,Z){const J={id:he??null,type:N,geometry:U,tags:Z,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(N==="Point"||N==="MultiPoint"||N==="LineString")Ct(J,U);else if(N==="Polygon")Ct(J,U[0]);else if(N==="MultiLineString")for(const ne of U)Ct(J,ne);else if(N==="MultiPolygon")for(const ne of U)Ct(J,ne[0]);return J}function Ct(he,N){for(let U=0;U<N.length;U+=3)he.minX=Math.min(he.minX,N[U]),he.minY=Math.min(he.minY,N[U+1]),he.maxX=Math.max(he.maxX,N[U]),he.maxY=Math.max(he.maxY,N[U+1])}function Nr(he,N,U,Z){if(!N.geometry)return;const J=N.geometry.coordinates;if(J&&J.length===0)return;const ne=N.geometry.type,pe=Math.pow(U.tolerance/((1<<U.maxZoom)*U.extent),2);let ye=[],ue=N.id;if(U.promoteId?ue=N.properties[U.promoteId]:U.generateId&&(ue=Z||0),ne==="Point")Ur(J,ye);else if(ne==="MultiPoint")for(const Ce of J)Ur(Ce,ye);else if(ne==="LineString")ci(J,ye,pe,!1);else if(ne==="MultiLineString"){if(U.lineMetrics){for(const Ce of J)ye=[],ci(Ce,ye,pe,!1),he.push(br(ue,"LineString",ye,N.properties));return}yi(J,ye,pe,!1)}else if(ne==="Polygon")yi(J,ye,pe,!0);else{if(ne!=="MultiPolygon"){if(ne==="GeometryCollection"){for(const Ce of N.geometry.geometries)Nr(he,{id:ue,geometry:Ce,properties:N.properties},U,Z);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const Ce of J){const Te=[];yi(Ce,Te,pe,!0),ye.push(Te)}}he.push(br(ue,ne,ye,N.properties))}function Ur(he,N){N.push(ki(he[0]),Qi(he[1]),0)}function ci(he,N,U,Z){let J,ne,pe=0;for(let ue=0;ue<he.length;ue++){const Ce=ki(he[ue][0]),Te=Qi(he[ue][1]);N.push(Ce,Te,0),ue>0&&(pe+=Z?(J*Te-Ce*ne)/2:Math.sqrt(Math.pow(Ce-J,2)+Math.pow(Te-ne,2))),J=Ce,ne=Te}const ye=N.length-3;N[2]=1,Vi(N,0,ye,U),N[ye+2]=1,N.size=Math.abs(pe),N.start=0,N.end=N.size}function yi(he,N,U,Z){for(let J=0;J<he.length;J++){const ne=[];ci(he[J],ne,U,Z),N.push(ne)}}function ki(he){return he/360+.5}function Qi(he){const N=Math.sin(he*Math.PI/180),U=.5-.25*Math.log((1+N)/(1-N))/Math.PI;return U<0?0:U>1?1:U}function Gt(he,N,U,Z,J,ne,pe,ye){if(Z/=N,ne>=(U/=N)&&pe<Z)return he;if(pe<U||ne>=Z)return null;const ue=[];for(const Ce of he){const Te=Ce.geometry;let de=Ce.type;const Pe=J===0?Ce.minX:Ce.minY,se=J===0?Ce.maxX:Ce.maxY;if(Pe>=U&&se<Z){ue.push(Ce);continue}if(se<U||Pe>=Z)continue;let Ne=[];if(de==="Point"||de==="MultiPoint")Zi(Te,Ne,U,Z,J);else if(de==="LineString")wr(Te,Ne,U,Z,J,!1,ye.lineMetrics);else if(de==="MultiLineString")It(Te,Ne,U,Z,J,!1);else if(de==="Polygon")It(Te,Ne,U,Z,J,!0);else if(de==="MultiPolygon")for(const rt of Te){const Ve=[];It(rt,Ve,U,Z,J,!0),Ve.length&&Ne.push(Ve)}if(Ne.length){if(ye.lineMetrics&&de==="LineString"){for(const rt of Ne)ue.push(br(Ce.id,de,rt,Ce.tags));continue}de!=="LineString"&&de!=="MultiLineString"||(Ne.length===1?(de="LineString",Ne=Ne[0]):de="MultiLineString"),de!=="Point"&&de!=="MultiPoint"||(de=Ne.length===3?"Point":"MultiPoint"),ue.push(br(Ce.id,de,Ne,Ce.tags))}}return ue.length?ue:null}function Zi(he,N,U,Z,J){for(let ne=0;ne<he.length;ne+=3){const pe=he[ne+J];pe>=U&&pe<=Z&&Sr(N,he[ne],he[ne+1],he[ne+2])}}function wr(he,N,U,Z,J,ne,pe){let ye=Tr(he);const ue=J===0?hr:Ei;let Ce,Te,de=he.start;for(let Ve=0;Ve<he.length-3;Ve+=3){const Ye=he[Ve],st=he[Ve+1],Ut=he[Ve+2],Dt=he[Ve+3],At=he[Ve+4],it=J===0?Ye:st,wt=J===0?Dt:At;let kr=!1;pe&&(Ce=Math.sqrt(Math.pow(Ye-Dt,2)+Math.pow(st-At,2))),it<U?wt>U&&(Te=ue(ye,Ye,st,Dt,At,U),pe&&(ye.start=de+Ce*Te)):it>Z?wt<Z&&(Te=ue(ye,Ye,st,Dt,At,Z),pe&&(ye.start=de+Ce*Te)):Sr(ye,Ye,st,Ut),wt<U&&it>=U&&(Te=ue(ye,Ye,st,Dt,At,U),kr=!0),wt>Z&&it<=Z&&(Te=ue(ye,Ye,st,Dt,At,Z),kr=!0),!ne&&kr&&(pe&&(ye.end=de+Ce*Te),N.push(ye),ye=Tr(he)),pe&&(de+=Ce)}let Pe=he.length-3;const se=he[Pe],Ne=he[Pe+1],rt=J===0?se:Ne;rt>=U&&rt<=Z&&Sr(ye,se,Ne,he[Pe+2]),Pe=ye.length-3,ne&&Pe>=3&&(ye[Pe]!==ye[0]||ye[Pe+1]!==ye[1])&&Sr(ye,ye[0],ye[1],ye[2]),ye.length&&N.push(ye)}function Tr(he){const N=[];return N.size=he.size,N.start=he.start,N.end=he.end,N}function It(he,N,U,Z,J,ne){for(const pe of he)wr(pe,N,U,Z,J,ne,!1)}function Sr(he,N,U,Z){he.push(N,U,Z)}function hr(he,N,U,Z,J,ne){const pe=(ne-N)/(Z-N);return Sr(he,ne,U+(J-U)*pe,1),pe}function Ei(he,N,U,Z,J,ne){const pe=(ne-U)/(J-U);return Sr(he,N+(Z-N)*pe,ne,1),pe}function rr(he,N){const U=[];for(let Z=0;Z<he.length;Z++){const J=he[Z],ne=J.type;let pe;if(ne==="Point"||ne==="MultiPoint"||ne==="LineString")pe=Cr(J.geometry,N);else if(ne==="MultiLineString"||ne==="Polygon"){pe=[];
5for(const ye of J.geometry)pe.push(Cr(ye,N))}else if(ne==="MultiPolygon"){pe=[];for(const ye of J.geometry){const ue=[];for(const Ce of ye)ue.push(Cr(Ce,N));pe.push(ue)}}U.push(br(J.id,ne,pe,J.tags))}return U}function Cr(he,N){const U=[];U.size=he.size,he.start!==void 0&&(U.start=he.start,U.end=he.end);for(let Z=0;Z<he.length;Z+=3)U.push(he[Z]+N,he[Z+1],he[Z+2]);return U}function Pr(he,N){if(he.transformed)return he;const U=1<<he.z,Z=he.x,J=he.y;for(const ne of he.features){const pe=ne.geometry,ye=ne.type;if(ne.geometry=[],ye===1)for(let ue=0;ue<pe.length;ue+=2)ne.geometry.push($r(pe[ue],pe[ue+1],N,U,Z,J));else for(let ue=0;ue<pe.length;ue++){const Ce=[];for(let Te=0;Te<pe[ue].length;Te+=2)Ce.push($r(pe[ue][Te],pe[ue][Te+1],N,U,Z,J));ne.geometry.push(Ce)}}return he.transformed=!0,he}function $r(he,N,U,Z,J,ne){return[Math.round(U*(he*Z-J)),Math.round(U*(N*Z-ne))]}function ui(he,N,U,Z,J){const ne=N===J.maxZoom?0:J.tolerance/((1<<N)*J.extent),pe={features:[],numPoints:0,numSimplified:0,numFeatures:he.length,source:null,x:U,y:Z,z:N,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const ye of he)qi(pe,ye,ne,J);return pe}function qi(he,N,U,Z){const J=N.geometry,ne=N.type,pe=[];if(he.minX=Math.min(he.minX,N.minX),he.minY=Math.min(he.minY,N.minY),he.maxX=Math.max(he.maxX,N.maxX),he.maxY=Math.max(he.maxY,N.maxY),ne==="Point"||ne==="MultiPoint")for(let ye=0;ye<J.length;ye+=3)pe.push(J[ye],J[ye+1]),he.numPoints++,he.numSimplified++;else if(ne==="LineString")ea(pe,J,he,U,!1,!1);else if(ne==="MultiLineString"||ne==="Polygon")for(let ye=0;ye<J.length;ye++)ea(pe,J[ye],he,U,ne==="Polygon",ye===0);else if(ne==="MultiPolygon")for(let ye=0;ye<J.length;ye++){const ue=J[ye];for(let Ce=0;Ce<ue.length;Ce++)ea(pe,ue[Ce],he,U,!0,Ce===0)}if(pe.length){let ye=N.tags||null;if(ne==="LineString"&&Z.lineMetrics){ye={};for(const Ce in N.tags)ye[Ce]=N.tags[Ce];ye.mapbox_clip_start=J.start/J.size,ye.mapbox_clip_end=J.end/J.size}const ue={geometry:pe,type:ne==="Polygon"||ne==="MultiPolygon"?3:ne==="LineString"||ne==="MultiLineString"?2:1,tags:ye};N.id!==null&&(ue.id=N.id),he.features.push(ue)}}function ea(he,N,U,Z,J,ne){const pe=Z*Z;if(Z>0&&N.size<(J?pe:Z))return void(U.numPoints+=N.length/3);const ye=[];for(let ue=0;ue<N.length;ue+=3)(Z===0||N[ue+2]>pe)&&(U.numSimplified++,ye.push(N[ue],N[ue+1])),U.numPoints++;J&&function(ue,Ce){let Te=0;for(let de=0,Pe=ue.length,se=Pe-2;de<Pe;se=de,de+=2)Te+=(ue[de]-ue[se])*(ue[de+1]+ue[se+1]);if(Te>0===Ce)for(let de=0,Pe=ue.length;de<Pe/2;de+=2){const se=ue[de],Ne=ue[de+1];ue[de]=ue[Pe-2-de],ue[de+1]=ue[Pe-1-de],ue[Pe-2-de]=se,ue[Pe-1-de]=Ne}}(ye,ne),he.push(ye)}const zi={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class ta{constructor(N,U){const Z=(U=this.options=function(ne,pe){for(const ye in pe)ne[ye]=pe[ye];return ne}(Object.create(zi),U)).debug;if(Z&&console.time("preprocess data"),U.maxZoom<0||U.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(U.promoteId&&U.generateId)throw new Error("promoteId and generateId cannot be used together.");let J=function(ne,pe){const ye=[];if(ne.type==="FeatureCollection")for(let ue=0;ue<ne.features.length;ue++)Nr(ye,ne.features[ue],pe,ue);else Nr(ye,ne.type==="Feature"?ne:{geometry:ne},pe);return ye}(N,U);this.tiles={},this.tileCoords=[],Z&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",U.indexMaxZoom,U.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),J=function(ne,pe){const ye=pe.buffer/pe.extent;let ue=ne;const Ce=Gt(ne,1,-1-ye,ye,0,-1,2,pe),Te=Gt(ne,1,1-ye,2+ye,0,-1,2,pe);return(Ce||Te)&&(ue=Gt(ne,1,-ye,1+ye,0,-1,2,pe)||[],Ce&&(ue=rr(Ce,1).concat(ue)),Te&&(ue=ue.concat(rr(Te,-1)))),ue}(J,U),J.length&&this.splitTile(J,0,0,0),Z&&(J.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(N,U,Z,J,ne,pe,ye){const ue=[N,U,Z,J],Ce=this.options,Te=Ce.debug;for(;ue.length;){J=ue.pop(),Z=ue.pop(),U=ue.pop(),N=ue.pop();const de=1<<U,Pe=Di(U,Z,J);let se=this.tiles[Pe];if(!se&&(Te>1&&console.time("creation"),se=this.tiles[Pe]=ui(N,U,Z,J,Ce),this.tileCoords.push({z:U,x:Z,y:J}),Te)){Te>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",U,Z,J,se.numFeatures,se.numPoints,se.numSimplified),console.timeEnd("creation"));const kr=`z${U}`;this.stats[kr]=(this.stats[kr]||0)+1,this.total++}if(se.source=N,ne==null){if(U===Ce.indexMaxZoom||se.numPoints<=Ce.indexMaxPoints)continue}else{if(U===Ce.maxZoom||U===ne)continue;if(ne!=null){const kr=ne-U;
5if(Z!==pe>>kr||J!==ye>>kr)continue}}if(se.source=null,N.length===0)continue;Te>1&&console.time("clipping");const Ne=.5*Ce.buffer/Ce.extent,rt=.5-Ne,Ve=.5+Ne,Ye=1+Ne;let st=null,Ut=null,Dt=null,At=null,it=Gt(N,de,Z-Ne,Z+Ve,0,se.minX,se.maxX,Ce),wt=Gt(N,de,Z+rt,Z+Ye,0,se.minX,se.maxX,Ce);N=null,it&&(st=Gt(it,de,J-Ne,J+Ve,1,se.minY,se.maxY,Ce),Ut=Gt(it,de,J+rt,J+Ye,1,se.minY,se.maxY,Ce),it=null),wt&&(Dt=Gt(wt,de,J-Ne,J+Ve,1,se.minY,se.maxY,Ce),At=Gt(wt,de,J+rt,J+Ye,1,se.minY,se.maxY,Ce),wt=null),Te>1&&console.timeEnd("clipping"),ue.push(st||[],U+1,2*Z,2*J),ue.push(Ut||[],U+1,2*Z,2*J+1),ue.push(Dt||[],U+1,2*Z+1,2*J),ue.push(At||[],U+1,2*Z+1,2*J+1)}}getTile(N,U,Z){N=+N,U=+U,Z=+Z;const J=this.options,{extent:ne,debug:pe}=J;if(N<0||N>24)return null;const ye=1<<N,ue=Di(N,U=U+ye&ye-1,Z);if(this.tiles[ue])return Pr(this.tiles[ue],ne);pe>1&&console.log("drilling down to z%d-%d-%d",N,U,Z);let Ce,Te=N,de=U,Pe=Z;for(;!Ce&&Te>0;)Te--,de>>=1,Pe>>=1,Ce=this.tiles[Di(Te,de,Pe)];return Ce&&Ce.source?(pe>1&&(console.log("found parent tile z%d-%d-%d",Te,de,Pe),console.time("drilling down")),this.splitTile(Ce.source,Te,de,Pe,N,U,Z),pe>1&&console.timeEnd("drilling down"),this.tiles[ue]?Pr(this.tiles[ue],ne):null):null}}function Di(he,N,U){return 32*((1<<he)*U+N)+he}function Kr(he,N){return N?he.properties[N]:he.id}function $t(he,N){if(he==null)return!0;if(he.type==="Feature")return Kr(he,N)!=null;if(he.type==="FeatureCollection"){const U=new Set;for(const Z of he.features){const J=Kr(Z,N);if(J==null||U.has(J))return!1;U.add(J)}return!0}return!1}function Ma(he,N){const U=new Map;if(he!=null)if(he.type==="Feature")U.set(Kr(he,N),he);else for(const Z of he.features)U.set(Kr(Z,N),Z);return U}class Ha extends Ie{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(N,U){return T._(this,void 0,void 0,function*(){const Z=N.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const J=this._geoJSONIndex.getTile(Z.z,Z.x,Z.y);if(!J)return null;const ne=new vr(J.features);let pe=Je(ne);return pe.byteOffset===0&&pe.byteLength===pe.buffer.byteLength||(pe=new Uint8Array(pe)),{vectorTile:ne,rawData:pe.buffer}})}loadData(N){return T._(this,void 0,void 0,function*(){var U;(U=this._pendingRequest)===null||U===void 0||U.abort();const Z=!!(N&&N.request&&N.request.collectResourceTiming)&&new T.cM(N.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(N,this._pendingRequest),this._geoJSONIndex=N.cluster?new Lt(function({superclusterOptions:pe,clusterProperties:ye}){if(!ye||!pe)return pe;const ue={},Ce={},Te={accumulated:null,zoom:0},de={properties:null},Pe=Object.keys(ye);for(const se of Pe){const[Ne,rt]=ye[se],Ve=T.cT(rt),Ye=T.cT(typeof Ne=="string"?[Ne,["accumulated"],["get",se]]:Ne);ue[se]=Ve.value,Ce[se]=Ye.value}return pe.map=se=>{de.properties=se;const Ne={};for(const rt of Pe)Ne[rt]=ue[rt].evaluate(Te,de);return Ne},pe.reduce=(se,Ne)=>{de.properties=Ne;for(const rt of Pe)Te.accumulated=se[rt],se[rt]=Ce[rt].evaluate(Te,de)},pe}(N)).load((yield this._pendingData).features):(J=yield this._pendingData,new ta(J,N.geojsonVtOptions)),this.loaded={};const ne={};if(Z){const pe=Z.finish();pe&&(ne.resourceTiming={},ne.resourceTiming[N.source]=JSON.parse(JSON.stringify(pe)))}return ne}catch(ne){if(delete this._pendingRequest,T.cx(ne))return{abandoned:!0};throw ne}var J})}getData(){return T._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(N){const U=this.loaded;return U&&U[N.uid]?super.reloadTile(N):this.loadTile(N)}loadAndProcessGeoJSON(N,U){return T._(this,void 0,void 0,function*(){let Z=yield this.loadGeoJSON(N,U);if(delete this._pendingRequest,typeof Z!="object")throw new Error(`Input data given to '${N.source}' is not a valid GeoJSON object.`);if(ft(Z,!0),N.filter){const J=T.cT(N.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(J.result==="error")throw new Error(J.value.map(ne=>`${ne.key}: ${ne.message}`).join(", "));Z={type:"FeatureCollection",features:Z.features.filter(ne=>J.value.evaluate({zoom:0},ne))}}return Z})}loadGeoJSON(N,U){return T._(this,void 0,void 0,function*(){const{promoteId:Z}=N;if(N.request){const J=yield T.j(N.request,U);return this._dataUpdateable=$t(J.data,Z)?Ma(J.data,Z):void 0,J.data}
5if(typeof N.data=="string")try{const J=JSON.parse(N.data);return this._dataUpdateable=$t(J,Z)?Ma(J,Z):void 0,J}catch{throw new Error(`Input data given to '${N.source}' is not a valid GeoJSON object.`)}if(!N.dataDiff)throw new Error(`Input data given to '${N.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${N.source}`);return function(J,ne,pe){var ye,ue,Ce,Te;if(ne.removeAll&&J.clear(),ne.remove)for(const de of ne.remove)J.delete(de);if(ne.add)for(const de of ne.add){const Pe=Kr(de,pe);Pe!=null&&J.set(Pe,de)}if(ne.update)for(const de of ne.update){let Pe=J.get(de.id);if(Pe==null)continue;const se=!de.removeAllProperties&&(((ye=de.removeProperties)===null||ye===void 0?void 0:ye.length)>0||((ue=de.addOrUpdateProperties)===null||ue===void 0?void 0:ue.length)>0);if((de.newGeometry||de.removeAllProperties||se)&&(Pe=Object.assign({},Pe),J.set(de.id,Pe),se&&(Pe.properties=Object.assign({},Pe.properties))),de.newGeometry&&(Pe.geometry=de.newGeometry),de.removeAllProperties)Pe.properties={};else if(((Ce=de.removeProperties)===null||Ce===void 0?void 0:Ce.length)>0)for(const Ne of de.removeProperties)Object.prototype.hasOwnProperty.call(Pe.properties,Ne)&&delete Pe.properties[Ne];if(((Te=de.addOrUpdateProperties)===null||Te===void 0?void 0:Te.length)>0)for(const{key:Ne,value:rt}of de.addOrUpdateProperties)Pe.properties[Ne]=rt}}(this._dataUpdateable,N.dataDiff,Z),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(N){return T._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(N){return this._geoJSONIndex.getClusterExpansionZoom(N.clusterId)}
5getClusterChildren(N){return this._geoJSONIndex.getChildren(N.clusterId)}getClusterLeaves(N){return this._geoJSONIndex.getLeaves(N.clusterId,N.limit,N.offset)}}class Li{constructor(N){this.self=N,this.actor=new T.J(N),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(U,Z)=>{if(this.externalWorkerSourceTypes[U])throw new Error(`Worker source with name "${U}" already registered.`);this.externalWorkerSourceTypes[U]=Z},this.self.addProtocol=T.cz,this.self.removeProtocol=T.cA,this.self.registerRTLTextPlugin=U=>{T.cU.setMethods(U)},this.actor.registerMessageHandler("LDT",(U,Z)=>this._getDEMWorkerSource(U,Z.source).loadTile(Z)),this.actor.registerMessageHandler("RDT",(U,Z)=>T._(this,void 0,void 0,function*(){this._getDEMWorkerSource(U,Z.source).removeTile(Z)})),this.actor.registerMessageHandler("GCEZ",(U,Z)=>T._(this,void 0,void 0,function*(){return this._getWorkerSource(U,Z.type,Z.source).getClusterExpansionZoom(Z)})),this.actor.registerMessageHandler("GCC",(U,Z)=>T._(this,void 0,void 0,function*(){return this._getWorkerSource(U,Z.type,Z.source).getClusterChildren(Z)})),this.actor.registerMessageHandler("GCL",(U,Z)=>T._(this,void 0,void 0,function*(){return this._getWorkerSource(U,Z.type,Z.source).getClusterLeaves(Z)})),this.actor.registerMessageHandler("LD",(U,Z)=>this._getWorkerSource(U,Z.type,Z.source).loadData(Z)),this.actor.registerMessageHandler("GD",(U,Z)=>this._getWorkerSource(U,Z.type,Z.source).getData()),this.actor.registerMessageHandler("LT",(U,Z)=>this._getWorkerSource(U,Z.type,Z.source).loadTile(Z)),this.actor.registerMessageHandler("RT",(U,Z)=>this._getWorkerSource(U,Z.type,Z.source).reloadTile(Z)),this.actor.registerMessageHandler("AT",(U,Z)=>this._getWorkerSource(U,Z.type,Z.source).abortTile(Z)),this.actor.registerMessageHandler("RMT",(U,Z)=>this._getWorkerSource(U,Z.type,Z.source).removeTile(Z)),this.actor.registerMessageHandler("RS",(U,Z)=>T._(this,void 0,void 0,function*(){if(!this.workerSources[U]||!this.workerSources[U][Z.type]||!this.workerSources[U][Z.type][Z.source])return;const J=this.workerSources[U][Z.type][Z.source];delete this.workerSources[U][Z.type][Z.source],J.removeSource!==void 0&&J.removeSource(Z)})),this.actor.registerMessageHandler("RM",U=>T._(this,void 0,void 0,function*(){delete this.layerIndexes[U],delete this.availableImages[U],delete this.workerSources[U],delete this.demWorkerSources[U]})),this.actor.registerMessageHandler("SR",(U,Z)=>T._(this,void 0,void 0,function*(){this.referrer=Z})),this.actor.registerMessageHandler("SRPS",(U,Z)=>this._syncRTLPluginState(U,Z)),this.actor.registerMessageHandler("IS",(U,Z)=>T._(this,void 0,void 0,function*(){this.self.importScripts(Z)})),this.actor.registerMessageHandler("SI",(U,Z)=>this._setImages(U,Z)),this.actor.registerMessageHandler("UL",(U,Z)=>T._(this,void 0,void 0,function*(){this._getLayerIndex(U).update(Z.layers,Z.removedIds)})),this.actor.registerMessageHandler("SL",(U,Z)=>T._(this,void 0,void 0,function*(){this._getLayerIndex(U).replace(Z)}))}_setImages(N,U){return T._(this,void 0,void 0,function*(){this.availableImages[N]=U;for(const Z in this.workerSources[N]){const J=this.workerSources[N][Z];for(const ne in J)J[ne].availableImages=U}})}_syncRTLPluginState(N,U){return T._(this,void 0,void 0,function*(){return yield T.cU.syncState(U,this.self.importScripts)})}_getAvailableImages(N){let U=this.availableImages[N];return U||(U=[]),U}_getLayerIndex(N){let U=this.layerIndexes[N];return U||(U=this.layerIndexes[N]=new o),U}_getWorkerSource(N,U,Z){if(this.workerSources[N]||(this.workerSources[N]={}),this.workerSources[N][U]||(this.workerSources[N][U]={}),!this.workerSources[N][U][Z]){const J={sendAsync:(ne,pe)=>(ne.targetMapId=N,this.actor.sendAsync(ne,pe))};switch(U){case"vector":this.workerSources[N][U][Z]=new Ie(J,this._getLayerIndex(N),this._getAvailableImages(N));break;case"geojson":this.workerSources[N][U][Z]=new Ha(J,this._getLayerIndex(N),this._getAvailableImages(N));break;default:this.workerSources[N][U][Z]=new this.externalWorkerSourceTypes[U](J,this._getLayerIndex(N),this._getAvailableImages(N))}}return this.workerSources[N][U][Z]}_getDEMWorkerSource(N,U){return this.demWorkerSources[N]||(this.demWorkerSources[N]={}),this.demWorkerSources[N][U]||(this.demWorkerSources[N][U]=new De),this.demWorkerSources[N][U]}}return T.i(self)&&(self.worker=new Li(self)),Li}),E("index",["exports","./shared"],function(T,o){var fe="5.6.1";function ce(){var u=new o.A(4);return o.A!=Float32Array&&(u[1]=0,u[2]=0),u[0]=1,u[3]=1,u}let Ae,Ie;const De={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(u,e,i){const n=requestAnimationFrame(h=>{l(),e(h)}),{unsubscribe:l}=o.s(u.signal,"abort",()=>{l(),cancelAnimationFrame(n),i(o.c())},!1)},frameAsync(u){return new Promise((e,i)=>{this.frame(u,e,i)})},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"),i=e.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return e.width=u.width,e.height=u.height,i.drawImage(u,0,0,u.width,u.height),i},resolveURL:u=>(Ae||(Ae=document.createElement("a")),Ae.href=u,Ae.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Ie==null&&(Ie=matchMedia("(prefers-reduced-motion: reduce)")),Ie.matches)}};class ie{static testProp(e){if(!ie.docStyle)return e[0];for(let i=0;i<e.length;i++)if(e[i]in ie.docStyle)return e[i];return e[0]}static create(e,i,n){const l=window.document.createElement(e);return i!==void 0&&(l.className=i),n&&n.appendChild(l),l}static createNS(e,i){return window.document.createElementNS(e,i)}static disableDrag(){ie.docStyle&&ie.selectProp&&(ie.userSelect=ie.docStyle[ie.selectProp],ie.docStyle[ie.selectProp]="none")}static enableDrag(){ie.docStyle&&ie.selectProp&&(ie.docStyle[ie.selectProp]=ie.userSelect)}static setTransform(e,i){e.style[ie.transformProp]=i}static addEventListener(e,i,n,l={}){e.addEventListener(i,n,"passive"in l?l:l.capture)}static removeEventListener(e,i,n,l={}){e.removeEventListener(i,n,"passive"in l?l:l.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",ie.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",ie.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",ie.suppressClickInternal,!0)},0)}static getScale(e){const i=e.getBoundingClientRect();return{x:i.width/e.offsetWidth||1,y:i.height/e.offsetHeight||1,boundingClientRect:i}}static getPoint(e,i,n){const l=i.boundingClientRect;return new o.P((n.clientX-l.left)/i.x-e.clientLeft,(n.clientY-l.top)/i.y-e.clientTop)}static mousePos(e,i){const n=ie.getScale(e);return ie.getPoint(e,n,i)}static touchPos(e,i){const n=[],l=ie.getScale(e);for(let h=0;h<i.length;h++)n.push(ie.getPoint(e,l,i[h]));return n}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}static sanitize(e){const i=new DOMParser().parseFromString(e,"text/html").body||document.createElement("body"),n=i.querySelectorAll("script");for(const l of n)l.remove();return ie.clean(i),i.innerHTML}static isPossiblyDangerous(e,i){const n=i.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!n.includes("javascript:")&&!n.includes("data:"))||!!e.startsWith("on")||void 0}static clean(e){const i=e.children;for(const n of i)ie.removeAttributes(n),ie.clean(n)}static removeAttributes(e){for(const{name:i,value:n}of e.attributes)ie.isPossiblyDangerous(i,n)&&e.removeAttribute(i)}}ie.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,ie.selectProp=ie.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),ie.transformProp=ie.testProp(["transform","WebkitTransform"]);const be={supported:!1,testSupport:function(u){!Nt&&ft&&(qt?vr(u):et=u)}};let et,ft,Nt=!1,qt=!1;function vr(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,ft),u.isContextLost())return;be.supported=!0}
5catch{}u.deleteTexture(e),Nt=!0}var Bt;typeof document<"u"&&(ft=document.createElement("img"),ft.onload=()=>{et&&vr(et),et=null,qt=!0},ft.onerror=()=>{Nt=!0,et=null},ft.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(u){let e,i,n,l;u.resetRequestQueue=()=>{e=[],i=0,n=0,l={}},u.addThrottleControl=v=>{const S=n++;return l[S]=v,S},u.removeThrottleControl=v=>{delete l[v],m()},u.getImage=(v,S,I=!0)=>new Promise((k,P)=>{be.supported&&(v.headers||(v.headers={}),v.headers.accept="image/webp,*/*"),o.e(v,{type:"image"}),e.push({abortController:S,requestParameters:v,supportImageRefresh:I,state:"queued",onError:D=>{P(D)},onSuccess:D=>{k(D)}}),m()});const h=v=>o._(this,void 0,void 0,function*(){v.state="running";const{requestParameters:S,supportImageRefresh:I,onError:k,onSuccess:P,abortController:D}=v,O=I===!1&&!o.i(self)&&!o.g(S.url)&&(!S.headers||Object.keys(S.headers).reduce((H,X)=>H&&X==="accept",!0));i++;const G=O?_(S,D):o.m(S,D);try{const H=yield G;delete v.abortController,v.state="completed",H.data instanceof HTMLImageElement||o.b(H.data)?P(H):H.data&&P({data:yield(q=H.data,typeof createImageBitmap=="function"?o.f(q):o.h(q)),cacheControl:H.cacheControl,expires:H.expires})}catch(H){delete v.abortController,k(H)}finally{i--,m()}var q}),m=()=>{const v=(()=>{for(const S of Object.keys(l))if(l[S]())return!0;return!1})()?o.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:o.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let S=i;S<v&&e.length>0;S++){const I=e.shift();I.abortController.signal.aborted?S--:h(I)}},_=(v,S)=>new Promise((I,k)=>{const P=new Image,D=v.url,O=v.credentials;O&&O==="include"?P.crossOrigin="use-credentials":(O&&O==="same-origin"||!o.d(D))&&(P.crossOrigin="anonymous"),S.signal.addEventListener("abort",()=>{P.src="",k(o.c())}),P.fetchPriority="high",P.onload=()=>{P.onerror=P.onload=null,I({data:P})},P.onerror=()=>{P.onerror=P.onload=null,S.signal.aborted||k(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."))},P.src=D})}(Bt||(Bt={})),Bt.resetRequestQueue();class Et{constructor(e){this._transformRequestFn=e}transformRequest(e,i){return this._transformRequestFn&&this._transformRequestFn(e,i)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function zt(u){const e=[];if(typeof u=="string")e.push({id:"default",url:u});else if(u&&u.length>0){const i=[];for(const{id:n,url:l}of u){const h=`${n}${l}`;i.indexOf(h)===-1&&(i.push(h),e.push({id:n,url:l}))}}return e}function fr(u,e,i){try{const n=new URL(u);return n.pathname+=`${e}${i}`,n.toString()}catch{throw new Error(`Invalid sprite URL "${u}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}function ri(u){const{userImage:e}=u;return!!(e&&e.render&&e.render())&&(u.data.replace(new Uint8Array(e.data.buffer)),!0)}class Je extends o.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new o.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:i,promiseResolve:n}of this.requestors)n(this._getImagesForIds(i));this.requestors=[]}}getImage(e){const i=this.images[e];if(i&&!i.data&&i.spriteData){const n=i.spriteData;i.data=new o.R({width:n.width,height:n.height},n.context.getImageData(n.x,n.y,n.width,n.height).data),i.spriteData=null}return i}addImage(e,i){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,i)&&(this.images[e]=i)}_validate(e,i){let n=!0;const l=i.data||i.spriteData;return this._validateStretch(i.stretchX,l&&l.width)||(this.fire(new o.k(new Error(`Image "${e}" has invalid "stretchX" value`))),n=!1),this._validateStretch(i.stretchY,l&&l.height)||(this.fire(new o.k(new Error(`Image "${e}" has invalid "stretchY" value`))),n=!1),this._validateContent(i.content,i)||(this.fire(new o.k(new Error(`Image "${e}" has invalid "content" value`))),n=!1),n}_validateStretch(e,i){if(!e)return!0;let n=0;for(const l of e){if(l[0]<n||l[1]<l[0]||i<l[1])return!1;n=l[1]}return!0}_validateContent(e,i){if(!e)return!0;
5if(e.length!==4)return!1;const n=i.spriteData,l=n&&n.width||i.data.width,h=n&&n.height||i.data.height;return!(e[0]<0||l<e[0]||e[1]<0||h<e[1]||e[2]<0||l<e[2]||e[3]<0||h<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,i,n=!0){const l=this.getImage(e);if(n&&(l.data.width!==i.data.width||l.data.height!==i.data.height))throw new Error(`size mismatch between old image (${l.data.width}x${l.data.height}) and new image (${i.data.width}x${i.data.height}).`);i.version=l.version+1,this.images[e]=i,this.updatedImages[e]=!0}removeImage(e){const i=this.images[e];delete this.images[e],delete this.patterns[e],i.userImage&&i.userImage.onRemove&&i.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise((i,n)=>{let l=!0;if(!this.isLoaded())for(const h of e)this.images[h]||(l=!1);this.isLoaded()||l?i(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:i})})}_getImagesForIds(e){const i={};for(const n of e){let l=this.getImage(n);l||(this.fire(new o.l("styleimagemissing",{id:n})),l=this.getImage(n)),l?i[n]={data:l.data.clone(),pixelRatio:l.pixelRatio,sdf:l.sdf,version:l.version,stretchX:l.stretchX,stretchY:l.stretchY,content:l.content,textFitWidth:l.textFitWidth,textFitHeight:l.textFitHeight,hasRenderCallback:!!(l.userImage&&l.userImage.render)}:o.w(`Image "${n}" 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 i}getPixelSize(){const{width:e,height:i}=this.atlasImage;return{width:e,height:i}}getPattern(e){const i=this.patterns[e],n=this.getImage(e);if(!n)return null;if(i&&i.position.version===n.version)return i.position;if(i)i.position.version=n.version;else{const l={w:n.data.width+2,h:n.data.height+2,x:0,y:0},h=new o.I(l,n);this.patterns[e]={bin:l,position:h}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){const i=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new o.T(e,this.atlasImage,i.RGBA),this.atlasTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const h in this.patterns)e.push(this.patterns[h].bin);const{w:i,h:n}=o.p(e),l=this.atlasImage;l.resize({width:i||1,height:n||1});for(const h in this.patterns){const{bin:m}=this.patterns[h],_=m.x+1,v=m.y+1,S=this.getImage(h).data,I=S.width,k=S.height;o.R.copy(S,l,{x:0,y:0},{x:_,y:v},{width:I,height:k}),o.R.copy(S,l,{x:0,y:k-1},{x:_,y:v-1},{width:I,height:1}),o.R.copy(S,l,{x:0,y:0},{x:_,y:v+k},{width:I,height:1}),o.R.copy(S,l,{x:I-1,y:0},{x:_-1,y:v},{width:1,height:k}),o.R.copy(S,l,{x:0,y:0},{x:_+I,y:v},{width:1,height:k})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(const i of e){if(this.callbackDispatchedThisFrame[i])continue;this.callbackDispatchedThisFrame[i]=!0;const n=this.getImage(i);n||o.w(`Image with ID: "${i}" was not found`),ri(n)&&this.updateImage(i,n)}}}const ot=1e20;function We(u,e,i,n,l,h,m,_,v){for(let S=e;S<e+n;S++)nt(u,i*h+S,h,l,m,_,v);for(let S=i;S<i+l;S++)nt(u,S*h+e,1,n,m,_,v)}function nt(u,e,i,n,l,h,m){h[0]=0,m[0]=-1e20,m[1]=ot,l[0]=u[e];for(let _=1,v=0,S=0;_<n;_++){l[_]=u[e+_*i];const I=_*_;do{const k=h[v];S=(l[_]-l[k]+I-k*k)/(_-k)/2}while(S<=m[v]&&--v>-1);v++,h[v]=_,m[v]=S,m[v+1]=ot}for(let _=0,v=0;_<n;_++){for(;m[v+1]<_;)v++;const S=h[v],I=_-S;u[e+_*i]=l[S]+I*I}}class Lt{constructor(e,i){this.requestManager=e,this.localIdeographFontFamily=i,this.entries={}}setURL(e){this.url=e}getGlyphs(e){return o._(this,void 0,void 0,function*(){const i=[];for(const h in e)for(const m of e[h])i.push(this._getAndCacheGlyphsPromise(h,m));const n=yield Promise.all(i),l={};for(const{stack:h,id:m,glyph:_}of n)l[h]||(l[h]={}),l[h][m]=_&&{id:_.id,bitmap:_.bitmap.clone(),metrics:_.metrics};return l})}_getAndCacheGlyphsPromise(e,i){return o._(this,void 0,void 0,function*(){let n=this.entries[e];n||(n=this.entries[e]={glyphs:{},requests:{},ranges:{}});let l=n.glyphs[i];if(l!==void 0)return{stack:e,id:i,glyph:l};if(l=this._tinySDF(n,e,i),l)return n.glyphs[i]=l,{stack:e,id:i,glyph:l};const h=Math.floor(i/256);if(256*h>65535)throw new Error("glyphs > 65535 not supported");if(n.ranges[h])return{stack:e,id:i,glyph:l};if(!this.url)throw new Error("glyphsUrl is not set");if(!n.requests[h]){const _=Lt.loadGlyphRange(e,h,this.url,this.requestManager);n.requests[h]=_}const m=yield n.requests[h];for(const _ in m)this._doesCharSupportLocalGlyph(+_)||(n.glyphs[+_]=m[+_]);return n.ranges[h]=!0,{stack:e,id:i,glyph:m[i]||null}})}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&
5(new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(e))||o.u["CJK Unified Ideographs"](e)||o.u["Hangul Syllables"](e)||o.u.Hiragana(e)||o.u.Katakana(e)||o.u["CJK Symbols and Punctuation"](e)||o.u["Halfwidth and Fullwidth Forms"](e))}_tinySDF(e,i,n){const l=this.localIdeographFontFamily;if(!l||!this._doesCharSupportLocalGlyph(n))return;let h=e.tinySDF;if(!h){let _="400";/bold/i.test(i)?_="900":/medium/i.test(i)?_="500":/light/i.test(i)&&(_="200"),h=e.tinySDF=new Lt.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:l,fontWeight:_})}const m=h.draw(String.fromCharCode(n));return{id:n,bitmap:new o.q({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}}}}Lt.loadGlyphRange=function(u,e,i,n){return o._(this,void 0,void 0,function*(){const l=256*e,h=l+255,m=n.transformRequest(i.replace("{fontstack}",u).replace("{range}",`${l}-${h}`),"Glyphs"),_=yield o.n(m,new AbortController);if(!_||!_.data)throw new Error(`Could not load glyph range. range: ${e}, ${l}-${h}`);const v={};for(const S of o.o(_.data))v[S.id]=S;return v})},Lt.TinySDF=class{constructor({fontSize:u=24,buffer:e=3,radius:i=8,cutoff:n=.25,fontFamily:l="sans-serif",fontWeight:h="normal",fontStyle:m="normal"}={}){this.buffer=e,this.cutoff=n,this.radius=i;const _=this.size=u+4*e,v=this._createCanvas(_),S=this.ctx=v.getContext("2d",{willReadFrequently:!0});S.font=`${m} ${h} ${u}px ${l}`,S.textBaseline="alphabetic",S.textAlign="left",S.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:i,actualBoundingBoxDescent:n,actualBoundingBoxLeft:l,actualBoundingBoxRight:h}=this.ctx.measureText(u),m=Math.ceil(i),_=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(h-l))),v=Math.min(this.size-this.buffer,m+Math.ceil(n)),S=_+2*this.buffer,I=v+2*this.buffer,k=Math.max(S*I,0),P=new Uint8ClampedArray(k),D={data:P,width:S,height:I,glyphWidth:_,glyphHeight:v,glyphTop:m,glyphLeft:0,glyphAdvance:e};if(_===0||v===0)return D;const{ctx:O,buffer:G,gridInner:q,gridOuter:H}=this;O.clearRect(G,G,_,v),O.fillText(u,G,G+m);const X=O.getImageData(G,G,_,v);H.fill(ot,0,k),q.fill(0,0,k);for(let ee=0;ee<v;ee++)for(let Y=0;Y<_;Y++){const re=X.data[4*(ee*_+Y)+3]/255;if(re===0)continue;const ae=(ee+G)*S+Y+G;if(re===1)H[ae]=0,q[ae]=ot;else{const K=.5-re;H[ae]=K>0?K*K:0,q[ae]=K<0?K*K:0}}We(H,0,0,S,I,S,this.f,this.v,this.z),We(q,G,G,_,v,S,this.f,this.v,this.z);for(let ee=0;ee<k;ee++){const Y=Math.sqrt(H[ee])-Math.sqrt(q[ee]);P[ee]=Math.round(255-255*(Y/this.radius+this.cutoff))}return D}};class ur{constructor(){this.specification=o.v.light.position}possiblyEvaluate(e,i){return o.B(e.expression.evaluate(i))}interpolate(e,i,n){return{x:o.C.number(e.x,i.x,n),y:o.C.number(e.y,i.y,n),z:o.C.number(e.z,i.z,n)}}}let mr;class Ui extends o.E{constructor(e){super(),mr=mr||new o.r({anchor:new o.D(o.v.light.anchor),position:new ur,color:new o.D(o.v.light.color),intensity:new o.D(o.v.light.intensity)}),this._transitionable=new o.t(mr),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,i={}){if(!this._validate(o.x,e,i))for(const n in e){const l=e[n];n.endsWith("-transition")?this._transitionable.setTransition(n.slice(0,-11),l):this._transitionable.setValue(n,l)}}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,i,n){return(!n||n.validate!==!1)&&o.y(this,e.call(o.z,{value:i,style:{glyphs:!0,sprite:!0},styleSpec:o.v}))}}const Ai=new o.r({"sky-color":new o.D(o.v.sky["sky-color"]),"horizon-color":new o.D(o.v.sky["horizon-color"]),"fog-color":new o.D(o.v.sky["fog-color"]),"fog-ground-blend":ne
5w o.D(o.v.sky["fog-ground-blend"]),"horizon-fog-blend":new o.D(o.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new o.D(o.v.sky["sky-horizon-blend"]),"atmosphere-blend":new o.D(o.v.sky["atmosphere-blend"])});class $i extends o.E{constructor(e){super(),this._transitionable=new o.t(Ai),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new o.F(0))}setSky(e,i={}){if(!this._validate(o.G,e,i)){e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const n in e){const l=e[n];n.endsWith("-transition")?this._transitionable.setTransition(n.slice(0,-11),l):this._transitionable.setValue(n,l)}}}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,i,n={}){return(n==null?void 0:n.validate)!==!1&&o.y(this,e.call(o.z,o.e({value:i,style:{glyphs:!0,sprite:!0},styleSpec:o.v})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class Vi{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,i){const n=e.join(",")+String(i);return this.dashEntry[n]||(this.dashEntry[n]=this.addDash(e,i)),this.dashEntry[n]}getDashRanges(e,i,n){const l=[];let h=e.length%2==1?-e[e.length-1]*n:0,m=e[0]*n,_=!0;l.push({left:h,right:m,isDash:_,zeroLength:e[0]===0});let v=e[0];for(let S=1;S<e.length;S++){_=!_;const I=e[S];h=v*n,v+=I,m=v*n,l.push({left:h,right:m,isDash:_,zeroLength:I===0})}return l}addRoundDash(e,i,n){const l=i/2;for(let h=-n;h<=n;h++){const m=this.width*(this.nextRow+n+h);let _=0,v=e[_];for(let S=0;S<this.width;S++){S/v.right>1&&(v=e[++_]);const I=Math.abs(S-v.left),k=Math.abs(S-v.right),P=Math.min(I,k);let D;const O=h/n*(l+1);if(v.isDash){const G=l-Math.abs(O);D=Math.sqrt(P*P+G*G)}else D=l-Math.sqrt(P*P+O*O);this.data[m+S]=Math.max(0,Math.min(255,D+128))}}}addRegularDash(e){for(let _=e.length-1;_>=0;--_){const v=e[_],S=e[_+1];v.zeroLength?e.splice(_,1):S&&S.isDash===v.isDash&&(S.left=v.left,e.splice(_,1))}const i=e[0],n=e[e.length-1];i.isDash===n.isDash&&(i.left=n.left-this.width,n.right=i.right+this.width);const l=this.width*this.nextRow;let h=0,m=e[h];for(let _=0;_<this.width;_++){_/m.right>1&&(m=e[++h]);const v=Math.abs(_-m.left),S=Math.abs(_-m.right),I=Math.min(v,S);this.data[l+_]=Math.max(0,Math.min(255,(m.isDash?I:-I)+128))}}addDash(e,i){const n=i?7:0,l=2*n+1;if(this.nextRow+l>this.height)return o.w("LineAtlas out of space"),null;let h=0;for(let _=0;_<e.length;_++)h+=e[_];if(h!==0){const _=this.width/h,v=this.getDashRanges(e,this.width,_);i?this.addRoundDash(v,_,n):this.addRegularDash(v)}const m={y:(this.nextRow+n+.5)/this.height,height:2*n/this.height,width:h};return this.nextRow+=l,this.dirty=!0,m}bind(e){const i=e.gl;this.texture?(i.bindTexture(i.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,i.texSubImage2D(i.TEXTURE_2D,0,0,0,this.width,this.height,i.ALPHA,i.UNSIGNED_BYTE,this.data))):(this.texture=i.createTexture(),i.bindTexture(i.TEXTURE_2D,this.texture),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texImage2D(i.TEXTURE_2D,0,i.ALPHA,this.width,this.height,0,i.ALPHA,i.UNSIGNED_BYTE,this.data))}}const Pi="maplibre_preloaded_worker_pool";class br{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<br.workerCount;)this.workers.push(new Worker(o.a.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.numActive()===0&&(this.workers.forEach(i=>{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Pi]}numActive(){return Object.keys(this.active).length}}const Ct=Math.floor(De.hardwareConcurrency/2);let Nr,Ur;function ci(){return Nr||(Nr=new br),Nr}br.workerCount=o.H(globalThis)?Math.max(Math.min(Ct,3),1):1;class yi{constructor(e,i){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=i;const n=this.workerPool.acquire(i);for(let l=0;l<n.length;l++){const h=new o.J(n[l],i);h.name=`Worker ${l}`,this.actors.push(h)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,i){const n=[];for(const l of this.actors)n.push(l.sendAsync({type:e,data:i}));return Promise.all(n)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}
5remove(e=!0){this.actors.forEach(i=>{i.remove()}),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,i){for(const n of this.actors)n.registerMessageHandler(e,i)}}function ki(){return Ur||(Ur=new yi(ci(),o.K),Ur.registerMessageHandler("GR",(u,e,i)=>o.m(e,i))),Ur}function Qi(u,e){const i=o.L();return o.M(i,i,[1,1,0]),o.N(i,i,[.5*u.width,.5*u.height,1]),u.calculatePosMatrix?o.O(i,i,u.calculatePosMatrix(e.toUnwrapped())):i}function Gt(u,e,i,n,l,h,m){var _;const v=function(P,D,O){if(P)for(const G of P){const q=D[G];if(q&&q.source===O&&q.type==="fill-extrusion")return!0}else for(const G in D){const q=D[G];if(q.source===O&&q.type==="fill-extrusion")return!0}return!1}((_=l==null?void 0:l.layers)!==null&&_!==void 0?_:null,e,u.id),S=h.maxPitchScaleFactor(),I=u.tilesIn(n,S,v);I.sort(Zi);const k=[];for(const P of I)k.push({wrappedTileID:P.tileID.wrapped().key,queryResults:P.tile.queryRenderedFeatures(e,i,u._state,P.queryGeometry,P.cameraQueryGeometry,P.scale,l,h,S,Qi(u.transform,P.tileID),m?(D,O)=>m(P.tileID,D,O):void 0)});return function(P,D){for(const O in P)for(const G of P[O])wr(G,D);return P}(function(P){const D={},O={};for(const G of P){const q=G.queryResults,H=G.wrappedTileID,X=O[H]=O[H]||{};for(const ee in q){const Y=q[ee],re=X[ee]=X[ee]||{},ae=D[ee]=D[ee]||[];for(const K of Y)re[K.featureIndex]||(re[K.featureIndex]=!0,ae.push(K))}}return D}(k),u)}function Zi(u,e){const i=u.tileID,n=e.tileID;return i.overscaledZ-n.overscaledZ||i.canonical.y-n.canonical.y||i.wrap-n.wrap||i.canonical.x-n.canonical.x}function wr(u,e){const i=u.feature,n=e.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=n}function Tr(u,e,i){return o._(this,void 0,void 0,function*(){let n=u;if(u.url?n=(yield o.j(e.transformRequest(u.url,"Source"),i)).data:yield De.frameAsync(i),!n)return null;const l=o.Q(o.e(n,u),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in n&&n.vector_layers&&(l.vectorLayerIds=n.vector_layers.map(h=>h.id)),l})}class It{constructor(e,i){e&&(i?this.setSouthWest(e).setNorthEast(i):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 o.S?new o.S(e.lng,e.lat):o.S.convert(e),this}setSouthWest(e){return this._sw=e instanceof o.S?new o.S(e.lng,e.lat):o.S.convert(e),this}extend(e){const i=this._sw,n=this._ne;let l,h;if(e instanceof o.S)l=e,h=e;else{if(!(e instanceof It))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(It.convert(e)):this.extend(o.S.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(o.S.convert(e)):this;if(l=e._sw,h=e._ne,!l||!h)return this}return i||n?(i.lng=Math.min(l.lng,i.lng),i.lat=Math.min(l.lat,i.lat),n.lng=Math.max(h.lng,n.lng),n.lat=Math.max(h.lat,n.lat)):(this._sw=new o.S(l.lng,l.lat),this._ne=new o.S(h.lng,h.lat)),this}getCenter(){return new o.S((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new o.S(this.getWest(),this.getNorth())}getSouthEast(){return new o.S(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:i,lat:n}=o.S.convert(e);let l=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(l=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&l}static convert(e){return e instanceof It?e:e&&new It(e)}static fromLngLat(e,i=0){const n=360*i/40075017,l=n/Math.cos(Math.PI/180*e.lat);return new It(new o.S(e.lng-l,e.lat-n),new o.S(e.lng+l,e.lat+n))}adjustAntiMeridian(){const e=new o.S(this._sw.lng,this._sw.lat),i=new o.S(this._ne.lng,this._ne.lat);return new It(e,e.lng>i.lng?new o.S(i.lng+360,i.lat):i)}}class Sr{constructor(e,i,n){this.bounds=It.convert(this.validateBounds(e)),this.minzoom=i||0,this.maxzoom=n||24}
5validateBounds(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 i=Math.pow(2,e.z),n=Math.floor(o.V(this.bounds.getWest())*i),l=Math.floor(o.U(this.bounds.getNorth())*i),h=Math.ceil(o.V(this.bounds.getEast())*i),m=Math.ceil(o.U(this.bounds.getSouth())*i);return e.x>=n&&e.x<h&&e.y>=l&&e.y<m}}class hr extends o.E{constructor(e,i,n,l){if(super(),this.id=e,this.dispatcher=n,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,o.e(this,o.Q(i,["url","scheme","tileSize","promoteId"])),this._options=o.e({type:"vector"},i),this._collectResourceTiming=i.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(l)}load(){return o._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new o.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const e=yield Tr(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(o.e(this,e),e.bounds&&(this.tileBounds=new Sr(e.bounds,this.minzoom,this.maxzoom)),this.fire(new o.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.l("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new o.k(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 o.e({},this._options)}loadTile(e){return o._(this,void 0,void 0,function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),n={request:this.map._requestManager.transformRequest(i,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.t
5ype,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,globalState:this.map.getGlobalState()};n.request.collectResourceTiming=this._collectResourceTiming;let l="RT";if(e.actor&&e.state!=="expired"){if(e.state==="loading")return new Promise((h,m)=>{e.reloadPromise={resolve:h,reject:m}})}else e.actor=this.dispatcher.getActor(),l="LT";e.abortController=new AbortController;try{const h=yield e.actor.sendAsync({type:l,data:n},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,h)}catch(h){if(delete e.abortController,e.aborted)return;if(h&&h.status!==404)throw h;this._afterTileLoadWorkerResponse(e,null)}})}_afterTileLoadWorkerResponse(e,i){if(i&&i.resourceTiming&&(e.resourceTiming=i.resourceTiming),i&&this.map._refreshExpiredTiles&&e.setExpiryData(i),e.loadVectorData(i,this.map.painter),e.reloadPromise){const n=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(n.resolve).catch(n.reject)}}abortTile(e){return o._(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
5ype,source:this.id}}))})}unloadTile(e){return o._(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 Ei extends o.E{constructor(e,i,n,l){super(),this.id=e,this.dispatcher=n,this.setEventedParent(l),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=o.e({type:"raster"},i),o.e(this,o.Q(i,["url","scheme","tileSize"]))}load(){return o._(this,arguments,void 0,function*(e=!1){this._loaded=!1,this.fire(new o.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const i=yield Tr(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,i&&(o.e(this,i),i.bounds&&(this.tileBounds=new Sr(i.bounds,this.minzoom,this.maxzoom)),this.fire(new o.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(i){this._tileJSONRequest=null,this.fire(new o.k(i))}})}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(!0)}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 o.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return o._(this,void 0,void 0,function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{const n=yield Bt.getImage(this.map._requestManager.transformRequest(i,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(n&&n.data){this.map._refreshExpiredTiles&&(n.cacheControl||n.expires)&&e.setExpiryData({cacheControl:n.cacheControl,expires:n.expires});const l=this.map.painter.context,h=l.gl,m=n.data;e.texture=this.map.painter.getTileTexture(m.width),e.texture?e.texture.update(m,{useMipmap:!0}):(e.texture=new o.T(l,m,h.RGBA,{useMipmap:!0}),e.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE,h.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(n){if(delete e.abortController,e.aborted)e.state="unloaded";else if(n)throw e.state="errored",n}})}abortTile(e){return o._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)})}unloadTile(e){return o._(this,void 0,void 0,function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)})}hasTransition(){return!1}}class rr extends Ei{constructor(e,i,n,l){super(e,i,n,l),this.type="raster-dem",this.maxzoom=22,this._options=o.e({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox",this.redFactor=i.redFactor,this.greenFactor=i.greenFactor,this.blueFactor=i.blueFactor,this.baseShift=i.baseShift}loadTile(e){return o._(this,void 0,void 0,function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),n=this.map._requestManager.transformRequest(i,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{const l=yield Bt.getImage(n,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(l&&l.data){const h=l.data;this.map._refreshExpiredTiles&&(l.cacheControl||l.expires)&&e.setExpiryData({cacheControl:l.cacheControl,expires:l.expires});const m=o.b(h)&&o.W()?h:yield this.readImageNow(h),_={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 v=yield e.actor.sendAsync({type:"LDT",data:_});e.dem=v,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(l){if(delete e.abortController,e.aborted)e.state="unloaded";else if(l)throw e.state="errored",l}})}readImageNow(e){return o._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&o.X()){const i=e.width+2,n=e.height+2;try{return new o.R({width:i,height:n},yield o.Y(e,-1,-1,i,n))}catch{}}return De.getImageData(e,1)})}_getNeighboringTiles(e){const i=e.canonical,n=Math.pow(2,i.z),l=(i.x-1+n)%n,h=i.x===0?e.wrap-1:e.wrap,m=(i.x+1+n)%n,_=i.x+1===n?e.wrap+1:e.wrap,v={};return v[new o.Z(e.overscaledZ,h,i.z,l,i.y).key]={backfilled:!1},v[new o.Z(e.overscaledZ,_,i.z,m,i.y).key]={backfilled:!1},i.y>0&&(v[new o.Z(e.overscaledZ,h,i.z,l,i.y-1).key]={backfilled:!1},v[new o.Z(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},v[new o.Z(e.overscaledZ,_,i.z,m,i.y-1).key]={backfilled:!1}),i.y+1<n&&(v[new o.Z(e.overscaledZ,h,i.z,l,i.y+1).key]={backfilled:!1},v[new o.Z(e.overscaledZ,e.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},v[new o.Z(e.overscaledZ,_,i.z,m,i.y+1).key]={backfilled:!1}),v}unloadTile(e){return o._(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
5ype,uid:e.uid,source:this.id}}))})}}class Cr extends o.E{constructor(e,i,n,l){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=n.getActor(),this.setEventedParent(l),this._data=i.data,this._options=o.e({},i),this._collectResourceTiming=i.collectResourceTiming,i.maxzoom!==void 0&&(this.maxzoom=i.maxzoom),i.type&&(this.type=i.type),i.attribution&&(this.attribution=i.attribution),this.promoteId=i.promoteId,i.clusterMaxZoom!==void 0&&this.maxzoom<=i.clusterMaxZoom&&o.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${i.clusterMaxZoom}".`),this.workerOptions=o.e({source:this.id,cluster:i.cluster||!1,geojsonVtOptions:{buffer:this._pixelsToTileUnits(i.buffer!==void 0?i.buffer:128),tolerance:this._pixelsToTileUnits(i.tolerance!==void 0?i.tolerance:.375),extent:o.$,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1},superclusterOptions:{maxZoom:this._getClusterMaxZoom(i.clusterMaxZoom),minPoints:Math.max(2,i.clusterMinPoints||2),extent:o.$,radius:this._pixelsToTileUnits(i.clusterRadius||50),log:!1,generateId:i.generateId||!1},clusterProperties:i.clusterProperties,filter:i.filter},i.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}_pixelsToTileUnits(e){return e*(o.$/this.tileSize)}_getClusterMaxZoom(e){const i=e?Math.round(e):this.maxzoom-1;return Number.isInteger(e)||e===void 0||o.w(`Integer expected for option 'clusterMaxZoom': provided value "${e}" rounded to "${i}"`),i}load(){return o._(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 o._(this,void 0,void 0,function*(){const e=o.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:e})})}getCoordinatesFromGeometry(e){return e.type==="GeometryCollection"?e.geometries.map(i=>i.coordinates).flat(1/0):e.coordinates.flat(1/0)}getBounds(){return o._(this,void 0,void 0,function*(){const e=new It,i=yield this.getData();let n;switch(i.type){case"FeatureCollection":n=i.features.map(l=>this.getCoordinatesFromGeometry(l.geometry)).flat(1/0);break;case"Feature":n=this.getCoordinatesFromGeometry(i.geometry);break;default:n=this.getCoordinatesFromGeometry(i)}if(n.length==0)return e;for(let l=0;l<n.length-1;l+=2)e.extend([n[l],n[l+1]]);return e})}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=this._getClusterMaxZoom(e.clusterMa
5xZoom))),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,i,n){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:i,offset:n}})}_updateWorkerData(e){return o._(this,void 0,void 0,function*(){const i=o.e({type:this.type},this.workerOptions);e?i.dataDiff=e:typeof this._data=="string"?(i.request=this.map._requestManager.transformRequest(De.resolveURL(this._data),"Source"),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new o.l("dataloading",{dataType:"source"}));try{const n=yield this.actor.sendAsync({type:"LD",data:i});if(this._pendingLoads--,this._removed||n.abandoned)return void this.fire(new o.l("dataabort",{dataType:"source"}));let l=null;n.resourceTiming&&n.resourceTiming[this.id]&&(l=n.resourceTiming[this.id].slice(0));const h={dataType:"source"};this._collectResourceTiming&&l&&l.length>0&&o.e(h,{resourceTiming:l}),this.fire(new o.l("data",Object.assign(Object.assign({},h),{sourceDataType:"metadata"}))),this.fire(new o.l("data",Object.assign(Object.assign({},h),{sourceDataType:"content"})))}catch(n){if(this._pendingLoads--,this._removed)return void this.fire(new o.l("dataabort",{dataType:"source"}));this.fire(new o.k(n))}})}loaded(){return this._pendingLoads===0}loadTile(e){return o._(this,void 0,void 0,function*(){const i=e.actor?"RT":"LT";e.actor=this.actor;const n={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,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,globalState:this.map.getGlobalState()};e.abortController=new AbortController;const l=yield this.actor.sendAsync({type:i,data:n},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(l,this.map.painter,i==="RT")})}abortTile(e){return o._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0})}unloadTile(e){return o._(this,void 0,void 0,function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.t
5ype,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return o.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}class Pr extends o.E{constructor(e,i,n,l){super(),this.flippedWindingOrder=!1,this.id=e,this.dispatcher=n,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(l),this.options=i}load(e){return o._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new o.l("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const i=yield Bt.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,i&&i.data&&(this.image=i.data,e&&(this.coordinates=e),this._finishLoading())}catch(i){this._request=null,this._loaded=!0,this.fire(new o.k(i))}})}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 o.l("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 i=e.map(o.a0.fromLngLat);var n;return this.tileID=function(l){const h=o.a1.fromPoints(l),m=h.width(),_=h.height(),v=Math.max(m,_),S=Math.max(0,Math.floor(-Math.log(v)/Math.LN2)),I=Math.pow(2,S);return new o.a3(S,Math.floor((h.minX+h.maxX)/2*I),Math.floor((h.minY+h.maxY)/2*I))}(i),this.terrainTileRanges=this._getOverlappingTileRanges(i),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=i.map(l=>this.tileID.getTilePoint(l)._round()),this.flippedWindingOrder=((n=this.tileCoords)[1].x-n[0].x)*(n[2].y-n[0].y)-(n[1].y-n[0].y)*(n[2].x-n[0].x)<0,this.fire(new o.l("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const e=this.map.painter.context,i=e.gl;this.texture||(this.texture=new o.T(e,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let n=!1;for(const l in this.tiles){const h=this.tiles[l];h.state!=="loaded"&&(h.state="loaded",h.texture=this.texture,n=!0)}n&&this.fire(new o.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return o._(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}_getOverlappingTileRanges(e){const{minX:i,minY:n,maxX:l,maxY:h}=o.a1.fromPoints(e),m={};for(let _=0;_<=o.a2;_++){const v=Math.pow(2,_),S=Math.floor(i*v),I=Math.floor(n*v),k=Math.floor(l*v),P=Math.floor(h*v);m[_]={minTileX:S,minTileY:I,maxTileX:k,maxTileY:P}}return m}}class $r extends Pr{constructor(e,i,n,l){super(e,i,n,l),this.roundZoom=!0,this.type="video",this.options=i}load(){return o._(this,void 0,void 0,function*(){this._loaded=!1;const e=this.options;this.urls=[];for(const i of e.urls)this.urls.push(this.map._requestManager.transformRequest(i,"Source").url);try{const i=yield o.a4(this.urls);if(this._loaded=!0,!i)return;this.video=i,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(i){this.fire(new o.k(i))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){const i=this.video.seekable;e<i.start(0)||e>i.end(0)?this.fire(new o.k(new o.a5(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const e=this.map.painter.context,i=e.gl;this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new o.T(e,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let n=!1;for(const l in this.tiles){const h=this.tiles[l];h.state!=="loaded"&&(h.state="loaded",h.texture=this.texture,n=!0)}n&&this.fire(new o.l("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 ui extends Pr{constructor(e,i,n,l){super(e,i,n,l),i.coordinates?Array.isArray(i.coordinates)&&i.c
5oordinates.length===4&&!i.coordinates.some(h=>!Array.isArray(h)||h.length!==2||h.some(m=>typeof m!="number"))||this.fire(new o.k(new o.a5(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new o.k(new o.a5(`sources.${e}`,null,'missing required property "coordinates"'))),i.animate&&typeof i.animate!="boolean"&&this.fire(new o.k(new o.a5(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),i.canvas?typeof i.canvas=="string"||i.canvas instanceof HTMLCanvasElement||this.fire(new o.k(new o.a5(`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 o.k(new o.a5(`sources.${e}`,null,'missing required property "canvas"'))),this.options=i,this.animate=i.animate===void 0||i.animate}load(){return o._(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 o.k(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 i=this.map.painter.context,n=i.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new o.T(i,this.canvas,n.RGBA,{premultiply:!0});let l=!1;for(const h in this.tiles){const m=this.tiles[h];m.state!=="loaded"&&(m.state="loaded",m.texture=this.texture,l=!0)}l&&this.fire(new o.l("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 qi={},ea=u=>{switch(u){case"geojson":return Cr;case"image":return Pr;case"raster":return Ei;case"raster-dem":return rr;case"vector":return hr;case"video":return $r;case"canvas":return ui}return qi[u]},zi="RTLPluginLoaded";class ta extends o.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=ki()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(i=>{throw this.status="error",i})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return o._(this,arguments,void 0,function*(i,n=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=De.resolveURL(i),!this.url)throw new Error(`requested url ${i}
5 is invalid`);if(this.status==="unavailable"){if(!n)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return o._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new o.l(zi))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Di=null;function Kr(){return Di||(Di=new ta),Di}class $t{constructor(e,i){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=o.a6(),this.uses=0,this.tileSize=i,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 i=e+this.timeAdded;i<this.fadeEndTime||(this.fadeEndTime=i)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,i,n){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(l,h){const m={};if(!h)return m;for(const _ of l){const v=_.layerIds.map(S=>h.getLayer(S)).filter(Boolean);if(v.length!==0){_.layers=v,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map(S=>v.filter(I=>I.id===S)[0]));for(const S of v)m[S.id]=_}}return m}(e.buckets,i==null?void 0:i.style),this.hasSymbolBuckets=!1;for(const l in this.buckets){const h=this.buckets[l];if(h instanceof o.a8){if(this.hasSymbolBuckets=!0,!n)break;h.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const l in this.buckets){const h=this.buckets[l];if(h instanceof o.a8&&h.hasRTLText){this.hasRTLText=!0,Kr().lazyLoad();break}}this.queryPadding=0;for(const l in this.buckets){const h=this.buckets[l];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(l).queryRadius(h))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new o.a7}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 n in this.buckets){const l=this.buckets[n];l.uploadPending()&&l.upload(e)}const i=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new o.T(e,this.imageAtlas.image,i.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new o.T(e,this.glyphAtlasImage,i.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,i,n,l,h,m,_,v,S,I,k){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:l,cameraQueryGeometry:h,scale:m,tileSize:this.tileSize,pixelPosMatrix:I,transform:v,params:_,queryPadding:this.queryPadding*S,getElevation:k},e,i,n):{}}querySourceFeatures(e,i){const n=this.latestFeatureIndex;if(!n||!n.rawTileData)return;const l=n.loadVTLayers(),h=i&&i.sourceLayer?i.sourceLayer:"",m=l._geojsonTileLayer||l[h];if(!m)return;const _=o.a9(i&&i.filter),{z:v,x:S,y:I}=this.tileID.canonical,k={z:v,x:S,y:I};for(let P=0;P<m.length;P++){const D=m.feature(P);if(_.needGeometry){const q=o.aa(D,!0);if(!_.filter(new o.F(this.tileID.overscaledZ),q,this.tileID.canonical))continue}else if(!_.filter(new o.F(this.tileID.overscaledZ),D))continue;const O=n.getId(D,h),G=new o.ab(D,v,S,I,O);G.tile=k,e.push(G)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){const i=this.expirationTime;
5if(e.cacheControl){const n=o.ac(e.cacheControl);n["max-age"]&&(this.expirationTime=Date.now()+1e3*n["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const n=Date.now();let l=!1;if(this.expirationTime>n)l=!1;else if(i)if(this.expirationTime<i)l=!0;else{const h=this.expirationTime-i;h?this.expirationTime=n+Math.max(h,3e4):l=!0}else l=!0;l?(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,i){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;const n=this.latestFeatureIndex.loadVTLayers();for(const l in this.buckets){if(!i.style.hasLayer(l))continue;const h=this.buckets[l],m=h.layers[0].sourceLayer||"_geojsonTileLayer",_=n[m],v=e[m];if(!_||!v||Object.keys(v).length===0)continue;h.update(v,_,this.imageAtlas&&this.imageAtlas.patternPositions||{});const S=i&&i.style&&i.style.getLayer(l);S&&(this.queryPadding=Math.max(this.queryPadding,S.queryRadius(h)))}}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,i){const n={};for(const l of i)n[l]=!0;this.dependencies[e]=n}hasDependency(e,i){for(const n of e){const l=this.dependencies[n];if(l){for(const h of i)if(l[h])return!0}}return!1}}class Ma{constructor(e,i){this.max=e,this.onRemove=i,this.reset()}reset(){for(const e in this.data)for(const i of this.data[e])i.timeout&&clearTimeout(i.timeout),this.onRemove(i.value);return this.data={},this.order=[],this}add(e,i,n){const l=e.wrapped().key;this.data[l]===void 0&&(this.data[l]=[]);const h={value:i,timeout:void 0};if(n!==void 0&&(h.timeout=setTimeout(()=>{this.remove(e,h)},n)),this.data[l].push(h),this.order.push(l),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 i=this.data[e].shift();return i.timeout&&clearTimeout(i.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),i.value}getByKey(e){const i=this.data[e];return i?i[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,i){if(!this.has(e))return this;const n=e.wrapped().key,l=i===void 0?0:this.data[n].indexOf(i),h=this.data[n][l];return this.data[n].splice(l,1),h.timeout&&clearTimeout(h.timeout),this.data[n].length===0&&delete this.data[n],this.onRemove(h.value),this.order.splice(this.order.indexOf(n),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const i=this._getAndRemoveByKey(this.order[0]);i&&this.onRemove(i)}return this}filter(e){const i=[];for(const n in this.data)for(const l of this.data[n])e(l.value)||i.push(l);for(const n of i)this.remove(n.value.tileID,n)}}class Ha{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,i,n){const l=String(i);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][l]=this.stateChanges[e][l]||{},o.e(this.stateChanges[e][l],n),this.deletedStates[e]===null){this.deletedStates[e]={};for(const h in this.state[e])h!==l&&(this.deletedStates[e][h]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][l]===null){this.deletedStates[e][l]={};for(const h in this.state[e][l])n[h]||(this.deletedStates[e][l][h]=null)}else for(const h in n)this.deletedStates[e]&&this.deletedStates[e][l]&&this.deletedStates[e][l][h]===null&&delete this.deletedStates[e][l][h]}removeFeatureState(e,i,n){if(this.deletedStates[e]===null)return;const l=String(i);if(this.deletedStates[e]=this.deletedStates[e]||{},n&&i!==void 0)this.deletedStates[e][l]!==null&&(this.deletedStates[e][l]=this.deletedStates[e][l]||{},this.deletedStates[e][l][n]=null);else if(i!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][l])for(n in this.deletedStates[e][l]={},this.stateChanges[e][l])this.deletedStates[e][l][n]=null;else this.deletedStates[e][l]=null;else this.deletedStates[e]=null}getState(e,i){const n=String(i),l=o.e({},(this.state[e]||{})[n],(this.stateChanges[e]||{})[n]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){const h=this.deletedStates[e][i];if(h===null)return{};for(const m in h)delete l[m]}return l}initializeTileState(e,i){e.setFeatureState(this.state,i)}coalesceChanges(e,i){const n={};for(const l in this.stateChanges){this.state[l]=this.state[l]||{};const h={};for(const m in this.stateChanges[l])this.state[l][m]||(this.state[l][m]={}),o.e(this.state[l][m],this.stateChanges[l][m]),h[m]=this.state[l][m];n[l]=h}for(const l in this.deletedStates){this.state[l]=this.state[l]||{};const h={};if(this.deletedStates[l]===null)for(const m in this.state[l])h[m]={},this.state[l][m]={};else for(const m in this.deletedStates[l]){if(this.deletedStates[l][m]===null)this.state[l][m]={};else for(const _ of Object.keys(this.deletedStates[l][m]))delete this.state[l][m][_];h[m]=this.state[l][m]}n[l]=n[l]||{},o.e(n[l],h)}if(this.stateChanges={},this.deletedStates={},Object.keys(n).length!==0)for(const l in e)e[l].setFeatureState(n,i)}}const Li=89.25;function he(u,e){const i=o.ag(e.lat,-o.ah,o.ah);return new o.P(o.V(e.lng)*u,o.U(i)*u)}function N(u,e){return new o.a0(e.x/u,e.y/u).toLngLat()}function U(u){return u.cameraToCenterDistance*Math.min(.85*Math.tan(o.ad(90-u.pitch)),Math.tan(o.ad(Li-u.pitch)))}function Z(u,e){const i=u.canonical,n=e/o.ae(i.z),l=i.x+Math.pow(2,i.z)*u.wrap,h=o.af(new Float64Array(16));return o.M(h,h,[l*n,i.y*n,0]),o.N(h,h,[n/o.$,n/o.$,1]),h}function J(u,e,i,n,l){const h=o.a0.fromLngLat(u,e),m=l*o.ai(1,u.lat),_=m*Math.cos(o.ad(i)),v=Math.sqrt(m*m-_*_),S=v*Math.sin(o.ad(-n)),I=v*Math.cos(o.ad(-n));return new o.a0(h.x+S,h.y+I,h.z+_)}function ne(u,e,i){const n=e.intersectsFrustum(u);if(!i||n===0)return n;const l=e.intersectsPlane(i);return l===0?0:n===2&&l===2?2:1}function pe(u,e,i){let n=0;const l=(i-e)/10;for(let h=0;h<10;h++)n+=l*Math.pow(Math.cos(e+(h+.5)/10*(i-e)),u);return n}function ye(u,e){return function(i,n,l,h,m){const _=2*((u-1)/o.aj(Math.cos(o.ad(Li-m))/Math.cos(o.ad(Li)))-1),v=Math.acos(l/h),S=2*pe(_-1,0,o.ad(m/2)),I=Math.min(o.ad(Li),v+o.ad(m/2)),k=pe(_-1,Math.min(I,v-o.ad(m/2)),I),P=Math.atan(n/l),D=Math.hypot(n,l);let O=i;return O+=o.aj(h/D/Math.max(.5,Math.cos(o.ad(m/2)))),O+=_*o.aj(Math.cos(P))/2,O-=o.aj(Math.max(1,k/S/e))/2,O}}const ue=ye(9.314,3);function Ce(u,e){const i=(e.roundZoom?Math.round:Math.floor)(u.zoom+o.aj(u.tileSize/e.tileSize));return Math.max(0,i)}function Te(u,e){const i=u.getCameraFrustum(),n=u.getClippingPlane(),l=u.screenPointToMercatorCoordinate(u.getCameraPoint()),h=o.a0.fromLngLat(u.center,u.elevation);l.z=h.z+Math.cos(u.pitchInRadians)*u.cameraToCenterDistance/u.worldSize;const m=u.getCoveringTilesDetailsProvider(),_=m.allowVariableZoom(u,e),v=Ce(u,e),S=e.minzoom||0,I=e.maxzoom!==void 0?e.maxzoom:u.maxZoom,k=Math.min(Math.max(0,v),I),P=Math.pow(2,k),D=[P*l.x,P*l.y,0],O=[P*h.x,P*h.y,0],G=Math.hypot(h.x-l.x,h.y-l.y),q=Math.abs(h.z-l.z),H=Math.hypot(G,q),X=re=>({zoom:0,x:0,y:0,wrap:re,fullyVisible:!1}),ee=[],Y=[];if(u.renderWorldCopies&&m.allowWorldCopies())for(let re=1;re<=3;re++)ee.push(X(-re)),ee.push(X(re));for(ee.push(X(0));ee.length>0;){const re=ee.pop(),ae=re.x,K=re.y;let le=re.fullyVisible;const xe={x:ae,y:K,z:re.zoom},me=m.getTileBoundingVolume(xe,re.wrap,u.elevation,e);if(!le){const Be=ne(i,me,n);if(Be===0)continue;le=Be===2}const ge=m.distanceToTile2d(l.x,l.y,xe,me);let ve=v;_&&(ve=(e.calculateTileZoom||ue)(u.zoom+o.aj(u.tileSize/e.tileSize),ge,q,H,u.fov)),ve=(e.roundZoom?Math.round:Math.floor)(ve),ve=Math.max(0,ve);const Oe=Math.min(ve,I);if(re.wrap=m.getWrap(h,xe,re.wrap),re.zoom>=Oe){if(re.zoom<S)continue;const Be=k-re.zoom,ke=D[0]-.5-(ae<<Be),Ze=D[1]-.5-(K<<Be),ut=e.reparseOverscaled?Math.max(re.zoom,ve):re.zoom;Y.push({tileID:new o.Z(re.zoom===I?ut:re.zoom,re.wrap,re.zoom,ae,K),distanceSq:o.ak([O[0]-.5-ae,O[1]-.5-K]),tileDistanceToCamera:Math.sqrt(ke*ke+Ze*Ze)})}else for(let Be=0;Be<4;Be++)ee.push({zoom:re.zoom+1,x:(ae<<1)+Be%2,y:(K<<1)+(Be>>1),wrap:re.wrap,fullyVisible:le})}return Y.sort((re,ae)=>re.distanceSq-ae.distanceSq).map(re=>re.tileID)}const de=o.a1.fromPoints([new o.P(0,0),new o.P(o.$,o.$)]);class Pe extends o.E{constructor(e,i,n){super(),this.id=e,this.dispatcher=n,this.on("data",l=>this._dataHandler(l)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((l,h,m,_)=>{const v=new(ea(h.type))(l,h,m,_);if(v.id!==l)throw new Error(`Expected Source id to be ${l} instead of ${v.id}`);return v})(e,i,n,this),this._tiles={},this._cache=new Ma(0,l=>this._unloadTile(l)),this._timers={},this._cacheTimers={}
5,this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Ha,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 i=this._tiles[e];if(i.state!=="loaded"&&i.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,i,n){return o._(this,void 0,void 0,function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,i,n)}catch(l){e.state="errored",l.status!==404?this._source.fire(new o.k(l,{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 o.l("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 i in this._tiles){const n=this._tiles[i];n.upload(e),n.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(se).map(e=>e.key)}getRenderableIds(e){const i=[];for(const n in this._tiles)this._isIdRenderable(n,e)&&i.push(this._tiles[n]);return e?i.sort((n,l)=>{const h=n.tileID,m=l.tileID,_=new o.P(h.canonical.x,h.canonical.y)._rotate(-this.transform.bearingInRadians),v=new o.P(m.canonical.x,m.canonical.y)._rotate(-this.transform.bearingInRadians);return h.overscaledZ-m.overscaledZ||v.y-_.y||v.x-_.x}).map(n=>n.tileID.key):i.map(n=>n.tileID).sort(se).map(n=>n.key)}hasRenderableParent(e){const i=this.findLoadedParent(e,0);return!!i&&this._isIdRenderable(i.tileID.key)}_isIdRenderable(e,i){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(i||!this._tiles[e].holdingForFade())}reload(e){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const i in this._tiles)e?this._reloadTile(i,"expired"):this._tiles[i].state!=="errored"&&this._reloadTile(i,"reloading")}}_reloadTile(e,i){return o._(this,void 0,void 0,function*(){const n=this._tiles[e];n&&(n.state!=="loading"&&(n.state=i),yield this._loadTile(n,e,i))})}_tileLoaded(e,i,n){e.timeAdded=De.now(),n==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(i,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 o.l("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){const i=this.getRenderableIds();for(let l=0;l<i.length;l++){const h=i[l];if(e.neighboringTiles&&e.neighboringTiles[h]){const m=this.getTileByID(h);n(e,m),n(m,e)}}function n(l,h){l.needsHillshadePrepare=!0,l.needsTerrainPrepare=!0;let m=h.tileID.canonical.x-l.tileID.canonical.x;const _=h.tileID.canonical.y-l.tileID.canonical.y,v=Math.pow(2,l.tileID.canonical.z),S=h.tileID.key;m===0&&_===0||Math.abs(_)>1||(Math.abs(m)>1&&(Math.abs(m+v)===1?m+=v:Math.abs(m-v)===1&&(m-=v)),h.dem&&l.dem&&(l.dem.backfillBorder(h.dem,m,_),l.neighboringTiles&&l.neighboringTiles[S]&&(l.neighboringTiles[S].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,i,n,l){for(const h in this._tiles){let m=this._tiles[h];if(l[h]||!m.hasData()||m.tileID.overscaledZ<=i||m.tileID.overscaledZ>n)continue;let _=m.tileID;for(;m&&m.tileID.overscaledZ>i+1;){const S=m.tileID.scaledTo(m.tileID.overscaledZ-1);m=this._tiles[S.key],m&&m.hasData()&&(_=S)}let v=_;for(;v.overscaledZ>i;)if(v=v.scaledTo(v.overscaledZ-1),e[v.key]||e[v.canonical.key]){l[_.key]=_;break}}}findLoadedParent(e,i){if(e.key in this._loadedParentTiles){const n=this._loadedParentTiles[e.key];return n&&n.tileID.overscaledZ>=i?n:null}for(let n=e.overscaledZ-1;n>=i;n--){const l=e.scaledTo(n),h=this._getLoadedTile(l);
5if(h)return h}}findLoadedSibling(e){return this._getLoadedTile(e)}_getLoadedTile(e){const i=this._tiles[e.key];return i&&i.hasData()?i:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){const i=Math.ceil(e.width/this._source.tileSize)+1,n=Math.ceil(e.height/this._source.tileSize)+1,l=Math.floor(i*n*(this._maxTileCacheZoomLevels===null?o.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),h=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,l):l;this._cache.setMaxSize(h)}handleWrapJump(e){const i=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,i){const n={};for(const l in this._tiles){const h=this._tiles[l];h.tileID=h.tileID.unwrapTo(h.tileID.wrap+i),n[h.tileID.key]=h}this._tiles=n;for(const l in this._timers)clearTimeout(this._timers[l]),delete this._timers[l];for(const l in this._tiles)this._setTileReloadTimer(l,this._tiles[l])}}_updateCoveredAndRetainedTiles(e,i,n,l,h,m){const _={},v={},S=Object.keys(e),I=De.now();for(const k of S){const P=e[k],D=this._tiles[k];if(!D||D.fadeEndTime!==0&&D.fadeEndTime<=I)continue;const O=this.findLoadedParent(P,i),G=this.findLoadedSibling(P),q=O||G||null;q&&(this._addTile(q.tileID),_[q.tileID.key]=q.tileID),v[k]=P}this._retainLoadedChildren(v,l,n,e);for(const k in _)e[k]||(this._coveredTiles[k]=!0,e[k]=_[k]);if(m){const k={},P={};for(const D of h)this._tiles[D.key].hasData()?k[D.key]=D:P[D.key]=D;for(const D in P){const O=P[D].children(this._source.maxzoom);this._tiles[O[0].key]&&this._tiles[O[1].key]&&this._tiles[O[2].key]&&this._tiles[O[3].key]&&(k[O[0].key]=e[O[0].key]=O[0],k[O[1].key]=e[O[1].key]=O[1],k[O[2].key]=e[O[2].key]=O[2],k[O[3].key]=e[O[3].key]=O[3],delete P[D])}for(const D in P){const O=P[D],G=this.findLoadedParent(O,this._source.minzoom),q=this.findLoadedSibling(O),H=G||q||null;if(H){k[H.tileID.key]=e[H.tileID.key]=H.tileID;for(const X in k)k[X].isChildOf(H.tileID)&&delete k[X]}}for(const D in this._tiles)k[D]||(this._coveredTiles[D]=!0)}}update(e,i){if(!this._sourceLoaded||this._paused)return;let n;this.transform=e,this.terrain=i,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?n=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(I=>new o.Z(I.canonical.z,I.wrap,I.canonical.z,I.canonical.x,I.canonical.y)):(n=Te(e,{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:i,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(n=n.filter(I=>this._source.hasTile(I)))):n=[];const l=Ce(e,this._source),h=Math.max(l-Pe.maxOverzooming,this._source.minzoom),m=Math.max(l+Pe.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const I={};for(const k of n)if(k.canonical.z>this._source.minzoom){const P=k.scaledTo(k.canonical.z-1);I[P.key]=P;const D=k.scaledTo(Math.max(this._source.minzoom,Math.min(k.canonical.z,5)));I[D.key]=D}n=n.concat(Object.values(I))}const _=n.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,_&&this.fire(new o.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const v=this._updateRetainedTiles(n,l);Ne(this._source.type)&&this._updateCoveredAndRetainedTiles(v,h,m,l,n,i);for(const I in v)this._tiles[I].clearFadeHold();const S=o.al(this._tiles,v);for(const I of S){const k=this._tiles[I];k.hasSymbolBuckets&&!k.holdingForFade()?k.setHoldDuration(this.map._fadeDuration):k.hasSymbolBuckets&&!k.symbolFadeFinished()||this._removeTile(I)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,i){var n;const l={},h={},m=Math.max(i-Pe.maxOverzooming,this._source.minzoom),_=Math.max(i+Pe.maxUnderzooming,this._source.minzoom),v={};for(const S of e){const I=this._addTile(S);l[S.key]=S,I.hasData()||i<this._source.maxzoom&&(v[S.key]=S)}this._retainLoadedChildren(v,i,_,l);for(const S of e){let I=this._tiles[S.key];if(I.hasData())continue;if(i+1>this._source.maxzoom){const P=S.children(this._source.maxzoom)[0],D=this.getTile(P);if(D&&D.hasData()){l[P.key]=P;continue}}else{const P=S.children(this._source.maxzoom);
5if(l[P[0].key]&&l[P[1].key]&&l[P[2].key]&&l[P[3].key])continue}let k=I.wasRequested();for(let P=S.overscaledZ-1;P>=m;--P){const D=S.scaledTo(P);if(h[D.key])break;if(h[D.key]=!0,I=this.getTile(D),!I&&k&&(I=this._addTile(D)),I){const O=I.hasData();if((O||!(!((n=this.map)===null||n===void 0)&&n.cancelPendingTileRequestsWhileZooming)||k)&&(l[D.key]=D),k=I.wasRequested(),O)break}}}return l}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const i=[];let n,l=this._tiles[e].tileID;for(;l.overscaledZ>0;){if(l.key in this._loadedParentTiles){n=this._loadedParentTiles[l.key];break}i.push(l.key);const h=l.scaledTo(l.overscaledZ-1);if(n=this._getLoadedTile(h),n)break;l=h}for(const h of i)this._loadedParentTiles[h]=n}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const e in this._tiles){const i=this._tiles[e].tileID,n=this._getLoadedTile(i);this._loadedSiblingTiles[i.key]=n}}_addTile(e){let i=this._tiles[e.key];if(i)return i;i=this._cache.getAndRemove(e),i&&(this._setTileReloadTimer(e.key,i),i.tileID=e,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,i)));const n=i;return i||(i=new $t(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(i,e.key,i.state)),i.uses++,this._tiles[e.key]=i,n||this._source.fire(new o.l("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(e,i){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const n=i.getExpiryTimeout();n&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},n))}refreshTiles(e){for(const i in this._tiles)(this._isIdRenderable(i)||this._tiles[i].state=="errored")&&e.some(n=>n.equals(this._tiles[i].tileID.canonical))&&this._reloadTile(i,"expired")}_removeTile(e){const i=this._tiles[e];i&&(i.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),i.uses>0||(i.hasData()&&i.state!=="reloading"?this._cache.add(i.tileID,i,i.getExpiryTimeout()):(i.aborted=!0,this._abortTile(i),this._unloadTile(i))))}_dataHandler(e){const i=e.sourceDataType;e.dataType==="source"&&i==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType==="source"&&i==="content"&&(this.reload(e.sourceDataChanged),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,i,n){const l=[],h=this.transform;if(!h)return l;const m=h.getCoveringTilesDetailsProvider().allowWorldCopies(),_=n?h.getCameraQueryGeometry(e):e,v=D=>h.screenPointToMercatorCoordinate(D,this.terrain),S=this.transformBbox(e,v,!m),I=this.transformBbox(_,v,!m),k=this.getIds(),P=o.a1.fromPoints(I);for(let D=0;D<k.length;D++){const O=this._tiles[k[D]];if(O.holdingForFade())continue;const G=m?[O.tileID]:[O.tileID.unwrapTo(-1),O.tileID.unwrapTo(0)],q=Math.pow(2,h.zoom-O.tileID.overscaledZ),H=i*O.queryPadding*o.$/O.tileSize/q;for(const X of G){const ee=P.map(Y=>X.getTilePoint(new o.a0(Y.x,Y.y)));if(ee.expandBy(H),ee.intersects(de)){const Y=S.map(ae=>X.getTilePoint(ae)),re=I.map(ae=>X.getTilePoint(ae));l.push({tile:O,tileID:m?X:X.unwrapTo(0),queryGeometry:Y,cameraQueryGeometry:re,scale:q})}}}return l}transformBbox(e,i,n){let l=e.map(i);if(n){const h=o.a1.fromPoints(e);h.shrinkBy(.001*Math.min(h.width(),h.height()));const m=h.map(i);o.a1.fromPoints(l).covers(m)||(l=l.map(_=>_.x>.5?new o.a0(_.x-1,_.y,_.z):_))}return l}getVisibleCoordinates(e){const i=this.getRenderableIds(e).map(n=>this._tiles[n].tileID);return this.transform&&this.transform.populateCache(i),i}hasTransition(){if(this._source.hasTransition())return!0;if(Ne(this._source.type)){const e=De.now();for(const i in this._tiles)if(this._tiles[i].fadeEndTime>=e)return!0}return!1}setFeatureState(e,i,n){this._state.updateState(e=e||"_geojsonTileLayer",i,n)}removeFeatureState(e,i,n){this._state.removeFeatureState(e=e||"_geojsonTileLayer",i,n)}getFeatureState(e,i){return this._state.getState(e=e||"_geojsonTileLayer",i)}
5setDependencies(e,i,n){const l=this._tiles[e];l&&l.setDependencies(i,n)}reloadTilesForDependencies(e,i){for(const n in this._tiles)this._tiles[n].hasDependency(e,i)&&this._reloadTile(n,"reloading");this._cache.filter(n=>!n.hasDependency(e,i))}}function se(u,e){const i=Math.abs(2*u.wrap)-+(u.wrap<0),n=Math.abs(2*e.wrap)-+(e.wrap<0);return u.overscaledZ-e.overscaledZ||n-i||e.canonical.y-u.canonical.y||e.canonical.x-u.canonical.x}function Ne(u){return u==="raster"||u==="image"||u==="video"}Pe.maxOverzooming=10,Pe.maxUnderzooming=3;class rt{constructor(e,i){this.reset(e,i)}reset(e,i){this.points=e||[],this._distances=[0];for(let n=1;n<this.points.length;n++)this._distances[n]=this._distances[n-1]+this.points[n].dist(this.points[n-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(i||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(this.points.length===1)return this.points[0];e=o.ag(e,0,1);let i=1,n=this._distances[i];const l=e*this.paddedLength+this.padding;for(;n<l&&i<this._distances.length;)n=this._distances[++i];const h=i-1,m=this._distances[h],_=n-m,v=_>0?(l-m)/_:0;return this.points[h].mult(1-v).add(this.points[i].mult(v))}}function Ve(u,e){let i=!0;return u==="always"||u!=="never"&&e!=="never"||(i=!1),i}class Ye{constructor(e,i,n){const l=this.boxCells=[],h=this.circleCells=[];this.xCellCount=Math.ceil(e/n),this.yCellCount=Math.ceil(i/n);for(let m=0;m<this.xCellCount*this.yCellCount;m++)l.push([]),h.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=i,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/i,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,i,n,l,h){this._forEachCell(i,n,l,h,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(i),this.bboxes.push(n),this.bboxes.push(l),this.bboxes.push(h)}insertCircle(e,i,n,l){this._forEachCell(i-l,n-l,i+l,n+l,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(i),this.circles.push(n),this.circles.push(l)}_insertBoxCell(e,i,n,l,h,m){this.boxCells[h].push(m)}_insertCircleCell(e,i,n,l,h,m){this.circleCells[h].push(m)}_query(e,i,n,l,h,m,_){if(n<0||e>this.width||l<0||i>this.height)return[];const v=[];if(e<=0&&i<=0&&this.width<=n&&this.height<=l){if(h)return[{key:null,x1:e,y1:i,x2:n,y2:l}];for(let S=0;S<this.boxKeys.length;S++)v.push({key:this.boxKeys[S],x1:this.bboxes[4*S],y1:this.bboxes[4*S+1],x2:this.bboxes[4*S+2],y2:this.bboxes[4*S+3]});for(let S=0;S<this.circleKeys.length;S++){const I=this.circles[3*S],k=this.circles[3*S+1],P=this.circles[3*S+2];v.push({key:this.circleKeys[S],x1:I-P,y1:k-P,x2:I+P,y2:k+P})}}else this._forEachCell(e,i,n,l,this._queryCell,v,{hitTest:h,overlapMode:m,seenUids:{box:{},circle:{}}},_);return v}query(e,i,n,l){return this._query(e,i,n,l,!1,null)}hitTest(e,i,n,l,h,m){return this._query(e,i,n,l,!0,h,m).length>0}hitTestCircle(e,i,n,l,h){const m=e-n,_=e+n,v=i-n,S=i+n;if(_<0||m>this.width||S<0||v>this.height)return!1;const I=[];return this._forEachCell(m,v,_,S,this._queryCellCircle,I,{hitTest:!0,overlapMode:l,circle:{x:e,y:i,radius:n},seenUids:{box:{},circle:{}}},h),I.length>0}_queryCell(e,i,n,l,h,m,_,v){const{seenUids:S,hitTest:I,overlapMode:k}=_,P=this.boxCells[h];if(P!==null){const O=this.bboxes;for(const G of P)if(!S.box[G]){S.box[G]=!0;const q=4*G,H=this.boxKeys[G];if(e<=O[q+2]&&i<=O[q+3]&&n>=O[q+0]&&l>=O[q+1]&&(!v||v(H))&&(!I||!Ve(k,H.overlapMode))&&(m.push({key:H,x1:O[q],y1:O[q+1],x2:O[q+2],y2:O[q+3]}),I))return!0}}const D=this.circleCells[h];if(D!==null){const O=this.circles;for(const G of D)if(!S.circle[G]){S.circle[G]=!0;const q=3*G,H=this.circleKeys[G];if(this._circleAndRectCollide(O[q],O[q+1],O[q+2],e,i,n,l)&&(!v||v(H))&&(!I||!Ve(k,H.overlapMode))){const X=O[q],ee=O[q+1],Y=O[q+2];if(m.push({key:H,x1:X-Y,y1:ee-Y,x2:X+Y,y2:ee+Y}),I)return!0}}}return!1}_queryCellCircle(e,i,n,l,h,m,_,v){const{circle:S,seenUids:I,overlapMode:k}=_,P=this.boxCells[h];if(P!==null){const O=this.bboxes;for(const G of P)if(!I.box[G]){I.box[G]=!0;const q=4*G,H=this.boxKeys[G];if(this._circleAndRectCollide(S.x,S.y,S.radius,O[q+0],O[q+1],O[q+2],O[q+3])&&(!v||v(H))&&!Ve(k,H.overlapMode))return m.push(!0),!0}}const D=this.circleCells[h];if(D!==null){const O=this.circles;for(const G of D)if(!I.circle[G]){I.circle[G]=!0;const q=3*G,H=this.circleKeys[G];
5if(this._circlesCollide(O[q],O[q+1],O[q+2],S.x,S.y,S.radius)&&(!v||v(H))&&!Ve(k,H.overlapMode))return m.push(!0),!0}}}_forEachCell(e,i,n,l,h,m,_,v){const S=this._convertToXCellCoord(e),I=this._convertToYCellCoord(i),k=this._convertToXCellCoord(n),P=this._convertToYCellCoord(l);for(let D=S;D<=k;D++)for(let O=I;O<=P;O++)if(h.call(this,e,i,n,l,this.xCellCount*O+D,m,_,v))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,i,n,l,h,m){const _=l-e,v=h-i,S=n+m;return S*S>_*_+v*v}_circleAndRectCollide(e,i,n,l,h,m,_){const v=(m-l)/2,S=Math.abs(e-(l+v));if(S>v+n)return!1;const I=(_-h)/2,k=Math.abs(i-(h+I));if(k>I+n)return!1;if(S<=v||k<=I)return!0;const P=S-v,D=k-I;return P*P+D*D<=n*n}}function st(u,e,i){const n=o.L();if(!u){const{vecSouth:k,vecEast:P}=Dt(e),D=ce();D[0]=P[0],D[1]=P[1],D[2]=k[0],D[3]=k[1],l=D,(I=(m=(h=D)[0])*(S=h[3])-(v=h[2])*(_=h[1]))&&(l[0]=S*(I=1/I),l[1]=-_*I,l[2]=-v*I,l[3]=m*I),n[0]=D[0],n[1]=D[1],n[4]=D[2],n[5]=D[3]}var l,h,m,_,v,S,I;return o.N(n,n,[1/i,1/i,1]),n}function Ut(u,e,i,n){if(u){const l=o.L();if(!e){const{vecSouth:h,vecEast:m}=Dt(i);l[0]=m[0],l[1]=m[1],l[4]=h[0],l[5]=h[1]}return o.N(l,l,[n,n,1]),l}return i.pixelsToClipSpaceMatrix}function Dt(u){const e=Math.cos(u.rollInRadians),i=Math.sin(u.rollInRadians),n=Math.cos(u.pitchInRadians),l=Math.cos(u.bearingInRadians),h=Math.sin(u.bearingInRadians),m=o.aq();m[0]=-l*n*i-h*e,m[1]=-h*n*i+l*e;const _=o.ar(m);_<1e-9?o.as(m):o.at(m,m,1/_);const v=o.aq();v[0]=l*n*e-h*i,v[1]=h*n*e+l*i;const S=o.ar(v);return S<1e-9?o.as(v):o.at(v,v,1/S),{vecEast:v,vecSouth:m}}function At(u,e,i,n){let l;n?(l=[u,e,n(u,e),1],o.av(l,l,i)):(l=[u,e,0,1],Xa(l,l,i));const h=l[3];return{point:new o.P(l[0]/h,l[1]/h),signedDistanceFromCamera:h,isOccluded:!1}}function it(u,e){return .5+u/e*.5}function wt(u,e){return u.x>=-e[0]&&u.x<=e[0]&&u.y>=-e[1]&&u.y<=e[1]}function kr(u,e,i,n,l,h,m,_,v,S,I,k,P){const D=i?u.textSizeData:u.iconSizeData,O=o.am(D,e.transform.zoom),G=[256/e.width*2+1,256/e.height*2+1],q=i?u.text.dynamicLayoutVertexArray:u.icon.dynamicLayoutVertexArray;q.clear();const H=u.lineVertexArray,X=i?u.text.placedSymbolArray:u.icon.placedSymbolArray,ee=e.transform.width/e.transform.height;let Y=!1;for(let re=0;re<X.length;re++){const ae=X.get(re);if(ae.hidden||ae.writingMode===o.an.vertical&&!Y){da(ae.numGlyphs,q);continue}Y=!1;const K=new o.P(ae.anchorX,ae.anchorY),le={getElevation:P,pitchedLabelPlaneMatrix:n,lineVertexArray:H,pitchWithMap:h,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:e.transform,tileAnchorPoint:K,unwrappedTileID:v,width:S,height:I,translation:k},xe=pt(ae.anchorX,ae.anchorY,le);if(!wt(xe.point,G)){da(ae.numGlyphs,q);continue}const me=it(e.transform.cameraToCenterDistance,xe.signedDistanceFromCamera),ge=o.ao(D,O,ae),ve=h?ge*e.transform.getPitchedTextCorrection(ae.anchorX,ae.anchorY,v)/me:ge*me,Oe=Xt({projectionContext:le,pitchedLabelPlaneMatrixInverse:l,symbol:ae,fontSize:ve,flip:!1,keepUpright:m,glyphOffsetArray:u.glyphOffsetArray,dynamicLayoutVertexArray:q,aspectRatio:ee,rotateToLine:_});Y=Oe.useVertical,(Oe.notEnoughRoom||Y||Oe.needsFlipping&&Xt({projectionContext:le,pitchedLabelPlaneMatrixInverse:l,symbol:ae,fontSize:ve,flip:!0,keepUpright:m,glyphOffsetArray:u.glyphOffsetArray,dynamicLayoutVertexArray:q,aspectRatio:ee,rotateToLine:_}).notEnoughRoom)&&da(ae.numGlyphs,q)}i?u.text.dynamicLayoutVertexBuffer.updateData(q):u.icon.dynamicLayoutVertexBuffer.updateData(q)}function Fe(u,e,i,n,l,h,m,_){const v=h.glyphStartIndex+h.numGlyphs,S=h.lineStartIndex,I=h.lineStartIndex+h.lineLength,k=e.getoffsetX(h.glyphStartIndex),P=e.getoffsetX(v-1),D=ra(u*k,i,n,l,h.segment,S,I,_,m);if(!D)return null;const O=ra(u*P,i,n,l,h.segment,S,I,_,m);return O?_.projectionCache.anyProjectionOccluded?null:{first:D,last:O}:null}function Vr(u,e,i,n){return u===o.an.horizontal&&Math.abs(i.y-e.y)>Math.abs(i.x-e.x)*n?{useVertical:!0}:(u===o.an.vertical?e.y<i.y:e.x>i.x)?{needsFlipping:!0}:null}
5function Xt(u){const{projectionContext:e,pitchedLabelPlaneMatrixInverse:i,symbol:n,fontSize:l,flip:h,keepUpright:m,glyphOffsetArray:_,dynamicLayoutVertexArray:v,aspectRatio:S,rotateToLine:I}=u,k=l/24,P=n.lineOffsetX*k,D=n.lineOffsetY*k;let O;if(n.numGlyphs>1){const G=n.glyphStartIndex+n.numGlyphs,q=n.lineStartIndex,H=n.lineStartIndex+n.lineLength,X=Fe(k,_,P,D,h,n,I,e);if(!X)return{notEnoughRoom:!0};const ee=ht(X.first.point.x,X.first.point.y,e,i),Y=ht(X.last.point.x,X.last.point.y,e,i);if(m&&!h){const re=Vr(n.writingMode,ee,Y,S);if(re)return re}O=[X.first];for(let re=n.glyphStartIndex+1;re<G-1;re++){const ae=ra(k*_.getoffsetX(re),P,D,h,n.segment,q,H,e,I);if(!ae)return{notEnoughRoom:!0};O.push(ae)}O.push(X.last)}else{if(m&&!h){const q=je(e.tileAnchorPoint.x,e.tileAnchorPoint.y,e).point,H=n.lineStartIndex+n.segment+1,X=new o.P(e.lineVertexArray.getx(H),e.lineVertexArray.gety(H)),ee=je(X.x,X.y,e),Y=ee.signedDistanceFromCamera>0?ee.point:Ia(e.tileAnchorPoint,X,q,1,e),re=ht(q.x,q.y,e,i),ae=ht(Y.x,Y.y,e,i),K=Vr(n.writingMode,re,ae,S);if(K)return K}const G=ra(k*_.getoffsetX(n.glyphStartIndex),P,D,h,n.segment,n.lineStartIndex,n.lineStartIndex+n.lineLength,e,I);if(!G||e.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};O=[G]}for(const G of O)o.au(v,G.point,G.angle);return{}}function Ia(u,e,i,n,l){const h=u.add(u.sub(e)._unit()),m=je(h.x,h.y,l).point,_=i.sub(m);return i.add(_._mult(n/_.mag()))}function Wa(u,e,i){const n=e.projectionCache;if(n.projections[u])return n.projections[u];const l=new o.P(e.lineVertexArray.getx(u),e.lineVertexArray.gety(u)),h=je(l.x,l.y,e);if(h.signedDistanceFromCamera>0)return n.projections[u]=h.point,n.anyProjectionOccluded=n.anyProjectionOccluded||h.isOccluded,h.point;const m=u-i.direction;return Ia(i.distanceFromAnchor===0?e.tileAnchorPoint:new o.P(e.lineVertexArray.getx(m),e.lineVertexArray.gety(m)),l,i.previousVertex,i.absOffsetX-i.distanceFromAnchor+1,e)}function je(u,e,i){const n=u+i.translation[0],l=e+i.translation[1];let h;return i.pitchWithMap?(h=At(n,l,i.pitchedLabelPlaneMatrix,i.getElevation),h.isOccluded=!1):(h=i.transform.projectTileCoordinates(n,l,i.unwrappedTileID,i.getElevation),h.point.x=(.5*h.point.x+.5)*i.width,h.point.y=(.5*-h.point.y+.5)*i.height),h}function ht(u,e,i,n){if(i.pitchWithMap){const l=[u,e,0,1];return o.av(l,l,n),i.transform.projectTileCoordinates(l[0]/l[3],l[1]/l[3],i.unwrappedTileID,i.getElevation).point}return{x:u/i.width*2-1,y:1-e/i.height*2}}function pt(u,e,i){return i.transform.projectTileCoordinates(u,e,i.unwrappedTileID,i.getElevation)}function xi(u,e,i){return u._unit()._perp()._mult(e*i)}function Kn(u,e,i,n,l,h,m,_,v){if(_.projectionCache.offsets[u])return _.projectionCache.offsets[u];const S=i.add(e);if(u+v.direction<n||u+v.direction>=l)return _.projectionCache.offsets[u]=S,S;const I=Wa(u+v.direction,_,v),k=xi(I.sub(i),m,v.direction),P=i.add(k),D=I.add(k);return _.projectionCache.offsets[u]=o.aw(h,S,P,D)||S,_.projectionCache.offsets[u]}function ra(u,e,i,n,l,h,m,_,v){const S=n?u-e:u+e;let I=S>0?1:-1,k=0;n&&(I*=-1,k=Math.PI),I<0&&(k+=Math.PI);let P,D=I>0?h+l:h+l+1;_.projectionCache.cachedAnchorPoint?P=_.projectionCache.cachedAnchorPoint:(P=je(_.tileAnchorPoint.x,_.tileAnchorPoint.y,_).point,_.projectionCache.cachedAnchorPoint=P);let O,G,q=P,H=P,X=0,ee=0;const Y=Math.abs(S),re=[];let ae;for(;X+ee<=Y;){if(D+=I,D<h||D>=m)return null;X+=ee,H=q,G=O;const xe={absOffsetX:Y,direction:I,distanceFromAnchor:X,previousVertex:H};if(q=Wa(D,_,xe),i===0)re.push(H),ae=q.sub(H);else{let me;const ge=q.sub(H);me=ge.mag()===0?xi(Wa(D+I,_,xe).sub(q),i,I):xi(ge,i,I),G||(G=H.add(me)),O=Kn(D,me,q,h,m,G,i,_,xe),re.push(G),ae=O.sub(G)}ee=ae.mag()}const K=ae._mult((Y-X)/ee)._add(G||H),le=k+Math.atan2(q.y-H.y,q.x-H.x);return re.push(K),{point:K,angle:v?le:0,path:re}}const dt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function da(u,e){for(let i=0;i<u;i++){const n=e.length;e.resize(n+4),e.float32.set(dt,3*n)}}function Xa(u,e,i){const n=e[0],l=e[1];return u[0]=i[0]*n+i[4]*l+i[12],u[1]=i[1]*n+i[5]*l+i[13],u[3]=i[3]*n+i[7]*l+i[15],u}const pr=100;class Ks{constructor(e,i=new Ye(e.width+200,e.height+200,25),n=new Ye(e.width+200,e.height+200,25)){this.transform=e,this.grid=i,this.ignoredGrid=n,this.pitchFactor=Math.cos(e.pitch
5*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+pr,this.screenBottomBoundary=e.height+pr,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,i,n,l,h,m,_,v,S,I,k,P){const D=this.projectAndGetPerspectiveRatio(e.anchorPointX+v[0],e.anchorPointY+v[1],h,I,P),O=n*D.perspectiveRatio;let G;if(m||_)G=this._projectCollisionBox(e,O,l,h,m,_,v,D,I,k,P);else{const ae=D.x+(k?k.x*O:0),K=D.y+(k?k.y*O:0);G={allPointsOccluded:!1,box:[ae+e.x1*O,K+e.y1*O,ae+e.x2*O,K+e.y2*O]}}const[q,H,X,ee]=G.box,Y=m?G.allPointsOccluded:D.isOccluded;let re=Y;return re||(re=D.perspectiveRatio<this.perspectiveRatioCutoff),re||(re=!this.isInsideGrid(q,H,X,ee)),re||i!=="always"&&this.grid.hitTest(q,H,X,ee,i,S)?{box:[q,H,X,ee],placeable:!1,offscreen:!1,occluded:Y}:{box:[q,H,X,ee],placeable:!0,offscreen:this.isOffscreen(q,H,X,ee),occluded:Y}}placeCollisionCircles(e,i,n,l,h,m,_,v,S,I,k,P,D,O){const G=[],q=new o.P(i.anchorX,i.anchorY),H=this.getPerspectiveRatio(q.x,q.y,m,O),X=(S?h*this.transform.getPitchedTextCorrection(i.anchorX,i.anchorY,m)/H:h*H)/o.aA,ee={getElevation:O,pitchedLabelPlaneMatrix:_,lineVertexArray:n,pitchWithMap:S,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:q,unwrappedTileID:m,width:this.transform.width,height:this.transform.height,translation:D},Y=Fe(X,l,i.lineOffsetX*X,i.lineOffsetY*X,!1,i,!1,ee);let re=!1,ae=!1,K=!0;if(Y){const le=.5*k*H+P,xe=new o.P(-100,-100),me=new o.P(this.screenRightBoundary,this.screenBottomBoundary),ge=new rt,ve=Y.first,Oe=Y.last;let Be=[];for(let ut=ve.path.length-1;ut>=1;ut--)Be.push(ve.path[ut]);for(let ut=1;ut<Oe.path.length;ut++)Be.push(Oe.path[ut]);const ke=2.5*le;if(S){const ut=this.projectPathToScreenSpace(Be,ee);Be=ut.some(kt=>kt.signedDistanceFromCamera<=0)?[]:ut.map(kt=>kt.point)}let Ze=[];if(Be.length>0){const ut=Be[0].clone(),kt=Be[0].clone();for(let Qt=1;Qt<Be.length;Qt++)ut.x=Math.min(ut.x,Be[Qt].x),ut.y=Math.min(ut.y,Be[Qt].y),kt.x=Math.max(kt.x,Be[Qt].x),kt.y=Math.max(kt.y,Be[Qt].y);Ze=ut.x>=xe.x&&kt.x<=me.x&&ut.y>=xe.y&&kt.y<=me.y?[Be]:kt.x<xe.x||ut.x>me.x||kt.y<xe.y||ut.y>me.y?[]:o.ax([Be],xe.x,xe.y,me.x,me.y)}for(const ut of Ze){ge.reset(ut,.25*le);let kt=0;kt=ge.length<=.5*le?1:Math.ceil(ge.paddedLength/ke)+1;for(let Qt=0;Qt<kt;Qt++){const Rt=Qt/Math.max(kt-1,1),er=ge.lerp(Rt),Ot=er.x+pr,Ft=er.y+pr;G.push(Ot,Ft,le,0);const jt=Ot-le,qr=Ft-le,St=Ot+le,Dr=Ft+le;if(K=K&&this.isOffscreen(jt,qr,St,Dr),ae=ae||this.isInsideGrid(jt,qr,St,Dr),e!=="always"&&this.grid.hitTestCircle(Ot,Ft,le,e,I)&&(re=!0,!v))return{circles:[],offscreen:!1,collisionDetected:re}}}}return{circles:!v&&re||!ae||H<this.perspectiveRatioCutoff?[]:G,offscreen:K,collisionDetected:re}}projectPathToScreenSpace(e,i){const n=function(l,h){const m=o.L();return o.ap(m,h.pitchedLabelPlaneMatrix),l.map(_=>{const v=At(_.x,_.y,m,h.getElevation),S=h.transform.projectTileCoordinates(v.point.x,v.point.y,h.unwrappedTileID,h.getElevation);return S.point.x=(.5*S.point.x+.5)*h.width,S.point.y=(.5*-S.point.y+.5)*h.height,S})}(e,i);return function(l){let h=0,m=0,_=0,v=0;for(let S=0;S<l.length;S++)l[S].isOccluded?(_=S+1,v=0):(v++,v>m&&(m=v,h=_));return l.slice(h,h+m)}(n)}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const i=[],n=new o.a1;for(const k of e){const P=new o.P(k.x+pr,k.y+pr);n.extend(P),i.push(P)}const{minX:l,minY:h,maxX:m,maxY:_}=n,v=this.grid.query(l,h,m,_).concat(this.ignoredGrid.query(l,h,m,_)),S={},I={};for(const k of v){const P=k.key;if(S[P.bucketInstanceId]===void 0&&(S[P.bucketInstanceId]={}),S[P.bucketInstanceId][P.featureIndex])continue;const D=[new o.P(k.x1,k.y1),new o.P(k.x2,k.y1),new o.P(k.x2,k.y2),new o.P(k.x1,k.y2)];o.ay(i,D)&&(S[P.bucketInstanceId][P.featureIndex]=!0,I[P.bucketInstanceId]===void 0&&(I[P.bucketInstanceId]=[]),I[P.bucketInstanceId].push(P.featureIndex))}return I}insertCollisionBox(e,i,n,l,h,m){(n?this.ignoredGrid:this.grid).insert({bucketInstanceId:l,featureIndex:h,collisionGroupID:m,overlapMode:i}
5,e[0],e[1],e[2],e[3])}insertCollisionCircles(e,i,n,l,h,m){const _=n?this.ignoredGrid:this.grid,v={bucketInstanceId:l,featureIndex:h,collisionGroupID:m,overlapMode:i};for(let S=0;S<e.length;S+=4)_.insertCircle(v,e[S],e[S+1],e[S+2])}projectAndGetPerspectiveRatio(e,i,n,l,h){if(h){let m;l?(m=[e,i,l(e,i),1],o.av(m,m,h)):(m=[e,i,0,1],Xa(m,m,h));const _=m[3];return{x:(m[0]/_+1)/2*this.transform.width+pr,y:(-m[1]/_+1)/2*this.transform.height+pr,perspectiveRatio:.5+this.transform.cameraToCenterDistance/_*.5,isOccluded:!1,signedDistanceFromCamera:_}}{const m=this.transform.projectTileCoordinates(e,i,n,l);return{x:(m.point.x+1)/2*this.transform.width+pr,y:(1-m.point.y)/2*this.transform.height+pr,perspectiveRatio:.5+this.transform.cameraToCenterDistance/m.signedDistanceFromCamera*.5,isOccluded:m.isOccluded,signedDistanceFromCamera:m.signedDistanceFromCamera}}}getPerspectiveRatio(e,i,n,l){const h=this.transform.projectTileCoordinates(e,i,n,l);return .5+this.transform.cameraToCenterDistance/h.signedDistanceFromCamera*.5}isOffscreen(e,i,n,l){return n<pr||e>=this.screenRightBoundary||l<pr||i>this.screenBottomBoundary}isInsideGrid(e,i,n,l){return n>=0&&e<this.gridRightBoundary&&l>=0&&i<this.gridBottomBoundary}getViewportMatrix(){const e=o.af([]);return o.M(e,e,[-100,-100,0]),e}_projectCollisionBox(e,i,n,l,h,m,_,v,S,I,k){let P=1,D=0,O=0,G=1;const q=e.anchorPointX+_[0],H=e.anchorPointY+_[1];if(m&&!h){const Be=this.projectAndGetPerspectiveRatio(q+1,H,l,S,k),ke=Be.x-v.x,Ze=Math.atan((Be.y-v.y)/ke)+(ke<0?Math.PI:0),ut=Math.sin(Ze),kt=Math.cos(Ze);P=kt,D=ut,O=-ut,G=kt}else if(!m&&h){const Be=Dt(this.transform);P=Be.vecEast[0],D=Be.vecEast[1],O=Be.vecSouth[0],G=Be.vecSouth[1]}let X=v.x,ee=v.y,Y=i;h&&(X=q,ee=H,Y=Math.pow(2,-(this.transform.zoom-n.overscaledZ)),Y*=this.transform.getPitchedTextCorrection(q,H,l),I||(Y*=o.ag(.5+v.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),I&&(X+=P*I.x*Y+O*I.y*Y,ee+=D*I.x*Y+G*I.y*Y);const re=e.x1*Y,ae=e.x2*Y,K=(re+ae)/2,le=e.y1*Y,xe=e.y2*Y,me=(le+xe)/2,ge=[{offsetX:re,offsetY:le},{offsetX:K,offsetY:le},{offsetX:ae,offsetY:le},{offsetX:ae,offsetY:me},{offsetX:ae,offsetY:xe},{offsetX:K,offsetY:xe},{offsetX:re,offsetY:xe},{offsetX:re,offsetY:me}];let ve=[];for(const{offsetX:Be,offsetY:ke}of ge)ve.push(new o.P(X+P*Be+O*ke,ee+D*Be+G*ke));let Oe=!1;if(h){const Be=ve.map(ke=>this.projectAndGetPerspectiveRatio(ke.x,ke.y,l,S,k));Oe=Be.some(ke=>!ke.isOccluded),ve=Be.map(ke=>new o.P(ke.x,ke.y))}else Oe=!0;return{box:o.az(ve),allPointsOccluded:!Oe}}}class Js{constructor(e,i,n,l){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?i:-i))):l&&n?1:0,this.placed=n}isHidden(){return this.opacity===0&&!this.placed}}class fa{constructor(e,i,n,l,h){this.text=new Js(e?e.text:null,i,n,h),this.icon=new Js(e?e.icon:null,i,l,h)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Qs{constructor(e,i,n){this.text=e,this.icon=i,this.skipFade=n}}class vi{constructor(e,i,n,l,h){this.bucketInstanceId=e,this.featureIndex=i,this.sourceLayerIndex=n,this.bucketIndex=l,this.tileID=h}}class Yt{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 i=++this.maxGroupID;this.collisionGroups[e]={ID:i,predicate:n=>n.collisionGroupID===i}}return this.collisionGroups[e]}}function bc(u,e,i,n,l){const{horizontalAlign:h,verticalAlign:m}=o.aG(u);return new o.P(-(h-.5)*e+n[0]*l,-(m-.5)*i+n[1]*l)}class en{constructor(e,i,n,l,h){this.transform=e.clone(),this.terrain=i,this.collisionIndex=new Ks(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=n,this.retainedQueryData={},this.collisionGroups=new Yt(l),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=h,h&&(h.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){const i=this.terrain;return i?(n,l)=>i.getElevation(e,n,l):null}getBucketParts(e,i,n,l){const h=n.getBucket(i),m=n.latestFeatureIndex;if(!h||!m||i.id!==h.layerIds[0])return;const _=n.collisionBoxArray,v=h.layers[0].layout,S=h.layers[0].paint,I=Math.pow(2,this.transform.zoom-n.tileID.overscaledZ
5),k=n.tileSize/o.$,P=n.tileID.toUnwrapped(),D=v.get("text-rotation-alignment")==="map",O=o.aB(n,1,this.transform.zoom),G=o.aC(this.collisionIndex.transform,n,S.get("text-translate"),S.get("text-translate-anchor")),q=o.aC(this.collisionIndex.transform,n,S.get("icon-translate"),S.get("icon-translate-anchor")),H=st(D,this.transform,O);this.retainedQueryData[h.bucketInstanceId]=new vi(h.bucketInstanceId,m,h.sourceLayerIndex,h.index,n.tileID);const X={bucket:h,layout:v,translationText:G,translationIcon:q,unwrappedTileID:P,pitchedLabelPlaneMatrix:H,scale:I,textPixelRatio:k,holdingForFade:n.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:o.am(h.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(h.sourceID)};if(l)for(const ee of h.sortKeyRanges){const{sortKey:Y,symbolInstanceStart:re,symbolInstanceEnd:ae}=ee;e.push({sortKey:Y,symbolInstanceStart:re,symbolInstanceEnd:ae,parameters:X})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:h.symbolInstances.length,parameters:X})}attemptAnchorPlacement(e,i,n,l,h,m,_,v,S,I,k,P,D,O,G,q,H,X,ee,Y){const re=o.aD[e.textAnchor],ae=[e.textOffset0,e.textOffset1],K=bc(re,n,l,ae,h),le=this.collisionIndex.placeCollisionBox(i,P,v,S,I,_,m,q,k.predicate,ee,K,Y);if((!X||this.collisionIndex.placeCollisionBox(X,P,v,S,I,_,m,H,k.predicate,ee,K,Y).placeable)&&le.placeable){let xe;if(this.prevPlacement&&this.prevPlacement.variableOffsets[D.crossTileID]&&this.prevPlacement.placements[D.crossTileID]&&this.prevPlacement.placements[D.crossTileID].text&&(xe=this.prevPlacement.variableOffsets[D.crossTileID].anchor),D.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[D.crossTileID]={textOffset:ae,width:n,height:l,anchor:re,textBoxScale:h,prevAnchor:xe},this.markUsedJustification(O,re,D,G),O.allowVerticalPlacement&&(this.markUsedOrientation(O,G,D),this.placedOrientations[D.crossTileID]=G),{shift:K,placedGlyphBoxes:le}}}placeLayerBucketPart(e,i,n){const{bucket:l,layout:h,translationText:m,translationIcon:_,unwrappedTileID:v,pitchedLabelPlaneMatrix:S,textPixelRatio:I,holdingForFade:k,collisionBoxArray:P,partiallyEvaluatedTextSize:D,collisionGroup:O}=e.parameters,G=h.get("text-optional"),q=h.get("icon-optional"),H=o.aE(h,"text-overlap","text-allow-overlap"),X=H==="always",ee=o.aE(h,"icon-overlap","icon-allow-overlap"),Y=ee==="always",re=h.get("text-rotation-alignment")==="map",ae=h.get("text-pitch-alignment")==="map",K=h.get("icon-text-fit")!=="none",le=h.get("symbol-z-order")==="viewport-y",xe=X&&(Y||!l.hasIconData()||q),me=Y&&(X||!l.hasTextData()||G);!l.collisionArrays&&P&&l.deserializeCollisionBoxes(P);const ge=this.retainedQueryData[l.bucketInstanceId].tileID,ve=this._getTerrainElevationFunc(ge),Oe=this.transform.getFastPathSimpleProjectionMatrix(ge),Be=(ke,Ze,ut)=>{var kt,Qt;if(i[ke.crossTileID])return;if(k)return void(this.placements[ke.crossTileID]=new Qs(!1,!1,!1));let Rt=!1,er=!1,Ot=!0,Ft=null,jt={box:null,placeable:!1,offscreen:null,occluded:!1},qr={placeable:!1},St=null,Dr=null,Lr=null,Ra=0,Fa=0,Ba=0;Ze.textFeatureIndex?Ra=Ze.textFeatureIndex:ke.useRuntimeCollisionCircles&&(Ra=ke.featureIndex),Ze.verticalTextFeatureIndex&&(Fa=Ze.verticalTextFeatureIndex);const la=Ze.textBox;if(la){const mi=or=>{let Vt=o.an.horizontal;if(l.allowVerticalPlacement&&!or&&this.prevPlacement){const oi=this.prevPlacement.placedOrientations[ke.crossTileID];oi&&(this.placedOrientations[ke.crossTileID]=oi,Vt=oi,this.markUsedOrientation(l,Vt,ke))}return Vt},Xi=(or,Vt)=>{if(l.allowVerticalPlacement&&ke.numVerticalGlyphVertices>0&&Ze.verticalTextBox){for(const oi of l.writingModes)if(oi===o.an.vertical?(jt=Vt(),qr=jt):jt=or(),jt&&jt.placeable)break}else jt=or()},Oa=ke.textAnchorOffsetStartIndex,os=ke.textAnchorOffsetEndIndex;if(os===Oa){const or=(Vt,oi)=>{const Mr=this.collisionIndex.placeCollisionBox(Vt,H,I,ge,v,ae,re,m,O.predicate,ve,void 0,Oe);return Mr&&Mr.placeable&&(this.markUsedOrientation(l,oi,ke),this.placedOrientations[ke.crossTileID]=oi),Mr};Xi(()=>or(la,o.an.horizontal),()=>{const Vt=Ze.verticalTextBox;return l.allowVerticalPlacement&&ke.numVerticalGlyphVertices>0&&Vt?or(Vt,o.an.vertical):{box:null,offscreen:null}}),mi(jt&&jt.placeable)}else{let or=o.aD[(Qt=(kt=this.prevPlacement)===null||kt===void 0?void 0:kt.variableOffsets[ke.crossTileID])===null||Qt===void 0?void 0:Qt.anchor];const Vt=(Mr,fu,wh)=>{const Hl=Mr.x2-Mr.x1,zn=Mr.y2-Mr.y1,$s=ke.textBoxScale,xa=K&&ee==="never"?fu:null;let Gr=null,va=H==="never"?1:2,Wl="never";or&&va++;for(let ja=0;ja<va;ja++){for(let Xl=Oa;Xl<os;Xl++){const Yl=l.textAnchorOffsets.get(Xl);if(or&&Yl.textAnchor!==or)continue;const Dn=this.attemptAnchorPlacement(Yl,Mr,Hl,zn,$s,re,ae,I,ge,v,O,Wl,ke,l,wh,m,_,xa,ve);if(Dn&&(Gr=Dn.placedGlyphBoxes,Gr&&Gr.placeable))return Rt=!0,Ft=Dn.shift,Gr}or?or=null:Wl=H}return n&&!Gr&&(Gr={box:this.collisionIndex.placeCollisionBox(la,"always",I,ge,v,ae,re,m,O.predicate,ve,void 0,Oe).box,offscreen:!1,placeable:!1,occluded:!1}),Gr};Xi(()=>Vt(la,Ze.iconBox,o.an.horizontal),()=>{const Mr=Ze.verticalTextBox;return l.allowVerticalPlacement&&(!jt||!jt.placeable)&&ke.numVerticalGlyphVertices>0&&Mr?Vt(Mr,Ze.verticalIconBox,o.an.vertical):{box:null,occluded:!0,offscreen:null}}),jt&&(Rt=jt.placeable,Ot=jt.offscreen);const oi=mi(jt&&jt.placeable);if(!Rt&&this.prevPlacement){const Mr=this.prevPlacement.variableOffsets[ke.crossTileID];Mr&&(this.variableOffsets[ke.crossTileID]=Mr,this.markUsedJustification(l,Mr.anchor,ke,oi))}}}if(St=jt,Rt=St&&St.placeable,Ot=St&&St.offscreen,ke.useRuntimeCollisionCircles){const mi=l.text.placedSymbolArray.get(ke.centerJustifiedTextSymbolIndex),Xi=o.ao(l.textSizeData,D,mi),Oa=h.get("text-padding");Dr=this.collisionIndex.placeCollisionCircles(H,mi,l.lineVertexArray,l.glyphOffsetArray,Xi,v,S,n,ae,O.predicate,ke.collisionCircleDiameter,Oa,m,ve),Dr.circles.length&&Dr.collisionDetected&&!n&&o.w("Collisions detected, but collision boxes are not shown"),Rt=X||Dr.circles.length>0&&!Dr.collisionDetected,Ot=Ot&&Dr.offscreen}if(Ze.iconFeatureIndex&&(Ba=Ze.iconFeatureIndex),Ze.iconBox){const mi=Xi=>this.collisionIndex.placeCollisionBox(Xi,ee,I,ge,v,ae,re,_,O.predicate,ve,K&&Ft?Ft:void 0,Oe);qr&&qr.placeable&&Ze.verticalIconBox?(Lr=mi(Ze.verticalIconBox),er=Lr.placeable):(Lr=mi(Ze.iconBox),er=Lr.placeable),Ot=Ot&&Lr.offscreen}const kn=G||ke.numHorizontalGlyphVertices===0&&ke.numVerticalGlyphVertices===0,En=q||ke.numIconVertices===0;kn||En?En?kn||(er=er&&Rt):Rt=er&&Rt:er=Rt=er&&Rt;const Us=er&&Lr.placeable;if(Rt&&St.placeable&&this.collisionIndex.insertCollisionBox(St.box,H,h.get("text-ignore-placement"),l.bucketInstanceId,qr&&qr.placeable&&Fa?Fa:Ra,O.ID),Us&&this.collisionIndex.insertCollisionBox(Lr.box,ee,h.get("icon-ignore-placement"),l.bucketInstanceId,Ba,O.ID),Dr&&Rt&&this.collisionIndex.insertCollisionCircles(Dr.circles,H,h.get("text-ignore-placement"),l.bucketInstanceId,Ra,O.ID),n&&this.storeCollisionData(l.bucketInstanceId,ut,Ze,St,Lr,Dr),ke.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(l.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[ke.crossTileID]=new Qs((Rt||xe)&&!(St!=null&&St.occluded),(er||me)&&!(Lr!=null&&Lr.occluded),Ot||l.justReloaded),i[ke.crossTileID]=!0};if(le){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");
5const ke=l.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let Ze=ke.length-1;Ze>=0;--Ze){const ut=ke[Ze];Be(l.symbolInstances.get(ut),l.collisionArrays[ut],ut)}}else for(let ke=e.symbolInstanceStart;ke<e.symbolInstanceEnd;ke++)Be(l.symbolInstances.get(ke),l.collisionArrays[ke],ke);l.justReloaded=!1}storeCollisionData(e,i,n,l,h,m){if(n.textBox||n.iconBox){let _,v;this.collisionBoxArrays.has(e)?_=this.collisionBoxArrays.get(e):(_=new Map,this.collisionBoxArrays.set(e,_)),_.has(i)?v=_.get(i):(v={text:null,icon:null},_.set(i,v)),n.textBox&&(v.text=l.box),n.iconBox&&(v.icon=h.box)}if(m){let _=this.collisionCircleArrays[e];_===void 0&&(_=this.collisionCircleArrays[e]=[]);for(let v=0;v<m.circles.length;v+=4)_.push(m.circles[v+0]-pr),_.push(m.circles[v+1]-pr),_.push(m.circles[v+2]),_.push(m.collisionDetected?1:0)}}markUsedJustification(e,i,n,l){let h;h=l===o.an.vertical?n.verticalPlacedTextSymbolIndex:{left:n.leftJustifiedTextSymbolIndex,center:n.centerJustifiedTextSymbolIndex,right:n.rightJustifiedTextSymbolIndex}[o.aF(i)];const m=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex,n.verticalPlacedTextSymbolIndex];for(const _ of m)_>=0&&(e.text.placedSymbolArray.get(_).crossTileID=h>=0&&_!==h?0:n.crossTileID)}markUsedOrientation(e,i,n){const l=i===o.an.horizontal||i===o.an.horizontalOnly?i:0,h=i===o.an.vertical?i:0,m=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex];for(const _ of m)e.text.placedSymbolArray.get(_).placedOrientation=l;n.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).placedOrientation=h)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const i=this.prevPlacement;let n=!1;this.prevZoomAdjustment=i?i.zoomAdjustment(this.transform.zoom):0;const l=i?i.symbolFadeChange(e):1,h=i?i.opacities:{},m=i?i.variableOffsets:{},_=i?i.placedOrientations:{};for(const v in this.placements){const S=this.placements[v],I=h[v];I?(this.opacities[v]=new fa(I,l,S.text,S.icon),n=n||S.text!==I.text.placed||S.icon!==I.icon.placed):(this.opacities[v]=new fa(null,l,S.text,S.icon,S.skipFade),n=n||S.text||S.icon)}for(const v in h){const S=h[v];if(!this.opacities[v]){const I=new fa(S,l,!1,!1);I.isHidden()||(this.opacities[v]=I,n=n||S.text.placed||S.icon.placed)}}for(const v in m)this.variableOffsets[v]||!this.opacities[v]||this.opacities[v].isHidden()||(this.variableOffsets[v]=m[v]);for(const v in _)this.placedOrientations[v]||!this.opacities[v]||this.opacities[v].isHidden()||(this.placedOrientations[v]=_[v]);if(i&&i.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");n?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=i?i.lastPlacementChangeTime:e)}updateLayerOpacities(e,i){const n={};for(const l of i){const h=l.getBucket(e);h&&l.latestFeatureIndex&&e.id===h.layerIds[0]&&this.updateBucketOpacities(h,l.tileID,n,l.collisionBoxArray)}}updateBucketOpacities(e,i,n,l){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();const h=e.layers[0],m=h.layout,_=new fa(null,0,!1,!1,!0),v=m.get("text-allow-overlap"),S=m.get("icon-allow-overlap"),I=h._unevaluatedLayout.hasValue("text-variable-anchor")||h._unevaluatedLayout.hasValue("text-variable-anchor-offset"),k=m.get("text-rotation-alignment")==="map",P=m.get("text-pitch-alignment")==="map",D=m.get("icon-text-fit")!=="none",O=new fa(null,0,v&&(S||!e.hasIconData()||m.get("icon-optional")),S&&(v||!e.hasTextData()||m.get("text-optional")),!0);!e.collisionArrays&&l&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(l);const G=(H,X,ee)=>{for(let Y=0;Y<X/4;Y++)H.opacityVertexArray.emplaceBack(ee);H.hasVisibleVertices=H.hasVisibleVertices||ee!==tn},q=this.collisionBoxArrays.get(e.bucketInstanceId);for(let H=0;H<e.symbolInstances.length;H++){const X=e.symbolInstances.get(H),{numHorizontalGlyphVertices:ee,numVerticalGlyphVertices:Y,crossTileID:re}=X;let ae=this.opacities[re];n[re]?ae=_:ae||(ae=O,this.opacities[re]=ae),n[re]=!0;const K=X.numIconVertices>0,le=this.placedOrientations[X.crossTileID],xe=le===o.an.vertical,me=le===o.an.horizontal||le===o.an.horizontalOnly;if(ee>0||Y>0){const ve=Mc(ae.text);G(e.text,ee,xe?tn:ve),G(e.text,Y,me?tn:ve);const Oe=ae.text.isHidden();[X.rightJustifiedTextSymbolIndex,X.centerJustifiedTextSymbolIndex,X.leftJustifiedTextSymbolIndex].forEac
5h(Ze=>{Ze>=0&&(e.text.placedSymbolArray.get(Ze).hidden=Oe||xe?1:0)}),X.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(X.verticalPlacedTextSymbolIndex).hidden=Oe||me?1:0);const Be=this.variableOffsets[X.crossTileID];Be&&this.markUsedJustification(e,Be.anchor,X,le);const ke=this.placedOrientations[X.crossTileID];ke&&(this.markUsedJustification(e,"left",X,ke),this.markUsedOrientation(e,ke,X))}if(K){const ve=Mc(ae.icon),Oe=!(D&&X.verticalPlacedIconSymbolIndex&&xe);X.placedIconSymbolIndex>=0&&(G(e.icon,X.numIconVertices,Oe?ve:tn),e.icon.placedSymbolArray.get(X.placedIconSymbolIndex).hidden=ae.icon.isHidden()),X.verticalPlacedIconSymbolIndex>=0&&(G(e.icon,X.numVerticalIconVertices,Oe?tn:ve),e.icon.placedSymbolArray.get(X.verticalPlacedIconSymbolIndex).hidden=ae.icon.isHidden())}const ge=q&&q.has(H)?q.get(H):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const ve=e.collisionArrays[H];if(ve){let Oe=new o.P(0,0);if(ve.textBox||ve.verticalTextBox){let Be=!0;if(I){const ke=this.variableOffsets[re];ke?(Oe=bc(ke.anchor,ke.width,ke.height,ke.textOffset,ke.textBoxScale),k&&Oe._rotate(P?-this.transform.bearingInRadians:this.transform.bearingInRadians)):Be=!1}if(ve.textBox||ve.verticalTextBox){let ke;ve.textBox&&(ke=xe),ve.verticalTextBox&&(ke=me),Jn(e.textCollisionBox.collisionVertexArray,ae.text.placed,!Be||ke,ge.text,Oe.x,Oe.y)}}if(ve.iconBox||ve.verticalIconBox){const Be=!!(!me&&ve.verticalIconBox);let ke;ve.iconBox&&(ke=Be),ve.verticalIconBox&&(ke=!Be),Jn(e.iconCollisionBox.collisionVertexArray,ae.icon.placed,ke,ge.icon,D?Oe.x:0,D?Oe.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),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`);e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],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,i){const n=this.zoomAtLastRecencyCheck===i?1-this.zoomAdjustment(i):1;return this.zoomAtLastRecencyCheck=i,this.commitTime+this.fadeDuration*n>e}setStale(){this.stale=!0}}function Jn(u,e,i,n,l,h){n&&n.length!==0||(n=[0,0,0,0]);const m=n[0]-pr,_=n[1]-pr,v=n[2]-pr,S=n[3]-pr;u.emplaceBack(e?1:0,i?1:0,l||0,h||0,m,_),u.emplaceBack(e?1:0,i?1:0,l||0,h||0,v,_),u.emplaceBack(e?1:0,i?1:0,l||0,h||0,v,S),u.emplaceBack(e?1:0,i?1:0,l||0,h||0,m,S)}const Ya=Math.pow(2,25),Aa=Math.pow(2,24),wc=Math.pow(2,17),Tc=Math.pow(2,16),Sc=Math.pow(2,9),ms=Math.pow(2,8),Cc=Math.pow(2,1);function Mc(u){if(u.opacity===0&&!u.placed)return 0;if(u.opacity===1&&u.placed)return 4294967295;const e=u.placed?1:0,i=Math.floor(127*u.opacity);return i*Ya+e*Aa+i*wc+e*Tc+i*Sc+e*ms+i*Cc+e}const tn=0;class Yu{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,i,n,l,h){const m=this._bucketParts;for(;this._currentTileIndex<e.length;)if(i.getBucketParts(m,l,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,h())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,m.sort((_,v)=>
5_.sortKey-v.sortKey));this._currentPartIndex<m.length;)if(i.placeLayerBucketPart(m[this._currentPartIndex],this._seenCrossTileIDs,n),this._currentPartIndex++,h())return!0;return!1}}class Ic{constructor(e,i,n,l,h,m,_,v){this.placement=new en(e,i,m,_,v),this._currentPlacementIndex=n.length-1,this._forceFullPlacement=l,this._showCollisionBoxes=h,this._done=!1}isDone(){return this._done}continuePlacement(e,i,n){const l=De.now(),h=()=>!this._forceFullPlacement&&De.now()-l>2;for(;this._currentPlacementIndex>=0;){const m=i[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 Yu(m)),this._inProgressLayer.continuePlacement(n[m.source],this.placement,this._showCollisionBoxes,m,h))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const gs=512/o.$/2;class rl{constructor(e,i,n){this.tileID=e,this.bucketInstanceId=n,this._symbolsByKey={};const l=new Map;for(let h=0;h<i.length;h++){const m=i.get(h),_=m.key,v=l.get(_);v?v.push(m):l.set(_,[m])}for(const[h,m]of l){const _={positions:m.map(v=>({x:Math.floor(v.anchorX*gs),y:Math.floor(v.anchorY*gs)})),crossTileIDs:m.map(v=>v.crossTileID)};if(_.positions.length>128){const v=new o.aH(_.positions.length,16,Uint16Array);for(const{x:S,y:I}of _.positions)v.add(S,I);v.finish(),delete _.positions,_.index=v}this._symbolsByKey[h]=_}}getScaledCoordinates(e,i){const{x:n,y:l,z:h}=this.tileID.canonical,{x:m,y:_,z:v}=i.canonical,S=gs/Math.pow(2,v-h),I=(_*o.$+e.anchorY)*S,k=l*o.$*gs;return{x:Math.floor((m*o.$+e.anchorX)*S-n*o.$*gs),y:Math.floor(I-k)}}findMatches(e,i,n){const l=this.tileID.canonical.z<i.canonical.z?1:Math.pow(2,this.tileID.canonical.z-i.canonical.z);for(let h=0;h<e.length;h++){const m=e.get(h);if(m.crossTileID)continue;const _=this._symbolsByKey[m.key];if(!_)continue;const v=this.getScaledCoordinates(m,i);if(_.index){const S=_.index.range(v.x-l,v.y-l,v.x+l,v.y+l).sort();for(const I of S){const k=_.crossTileIDs[I];if(!n[k]){n[k]=!0,m.crossTileID=k;break}}}else if(_.positions)for(let S=0;S<_.positions.length;S++){const I=_.positions[S],k=_.crossTileIDs[S];if(Math.abs(I.x-v.x)<=l&&Math.abs(I.y-v.y)<=l&&!n[k]){n[k]=!0,m.crossTileID=k;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}}class il{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Ac{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const i=Math.round((e-this.lng)/360);if(i!==0)for(const n in this.indexes){const l=this.indexes[n],h={};for(const m in l){const _=l[m];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+i),h[_.tileID.key]=_}this.indexes[n]=h}this.lng=e}addBucket(e,i,n){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===i.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let h=0;h<i.symbolInstances.length;h++)i.symbolInstances.get(h).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});const l=this.usedCrossTileIDs[e.overscaledZ];for(const h in this.indexes){const m=this.indexes[h];if(Number(h)>e.overscaledZ)for(const _ in m){const v=m[_];v.tileID.isChildOf(e)&&v.findMatches(i.symbolInstances,e,l)}else{const _=m[e.scaledTo(Number(h)).key];_&&_.findMatches(i.symbolInstances,e,l)}}for(let h=0;h<i.symbolInstances.length;h++){const m=i.symbolInstances.get(h);m.crossTileID||(m.crossTileID=n.generate(),l[m.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new rl(e,i.symbolInstances,i.bucketInstanceId),!0}removeBucketCrossTileIDs(e,i){for(const n of i.getCrossTileIDsLists())for(const l of n)delete this.usedCrossTileIDs[e][l]}removeStaleBuckets(e){let i=!1;for(const n in this.indexes){const l=this.indexes[n];for(const h in l)e[l[h].bucketInstanceId]||(this.removeBucketCrossTileIDs(n,l[h]),delete l[h],i=!0)}return i}}class Qn{constructor(){this.layerIndexes={},this.crossTileIDs=new il,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,i,n){let l=this.layerIndexes[e.id];l===void 0&&(l=this.layerIndexes[e.id]=new Ac);let h=!1;const m={};l.handleWrapJump(n);for(const _ of i){const v=_.getBucket(e);v&&e.id===v.layerIds[0]&&(v.bucketInstanceId||(v.bucketInstanceId=++this.maxBucketInstanceId),l.addBucket(_.tileID,v,this.crossTileIDs)&&(h=!0),m[v.bucketInstanceId]=!0)}return l.removeStaleBuckets(m)&&(h=!0),h}pruneUnusedLayers(e){const i={};e.forEach(n=>{i[n]=!0});for(const n in this.layerIndexes)i[n]||delete this.layerIndexes[n]}}var eo="void main() {fragColor=vec4(1.0);}";const ia={prelude:mt(`#ifdef GL_ES 6precision mediump float; 7#else 8#if !defined(lowp) 9#define lowp 10#endif 11#if !defined(mediump) 12#define mediump 13#endif 14#if !defined(highp) 15#define highp 16#endif 17#endif 18out highp vec4 fragColor;`,`#ifdef GL_ES 19precision highp float; 20#else 21#if !defined(lowp) 22#define lowp 23#endif 24#if !defined(mediump) 25#define mediump 26#endif 27#if !defined(highp) 28#define highp 29#endif 30#endif 31vec2 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 32);}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);
32return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c 33);} 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(texture(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=(texture(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 57#ifdef GLOBE 58if ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;} 59#endif 60vec2 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; 61#else 62return 0.0; 63#endif 64}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;`),projectionMercator:mt("","float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:mt("",`#define GLOBE_RADIUS 6371008.8 65uniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos 66);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY); 67if (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len 68);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}`),background:mt(`uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity; 69#ifdef OVERDRAW_INSPECTOR 70fragColor=vec4(1.0); 71#endif 72}`,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:mt(`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;
72uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in 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=texture(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=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity; 73#ifdef OVERDRAW_INSPECTOR 74fragColor=vec4(1.0); 75#endif 76}`,"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;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);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:mt(`in vec3 v_data;in float v_visibility; 77#pragma mapbox: define highp vec4 color 78#pragma mapbox: define mediump float radius 79#pragma mapbox: define lowp float blur 80#pragma mapbox: define lowp float opacity 81#pragma mapbox: define highp vec4 stroke_color 82#pragma mapbox: define mediump float stroke_width 83#pragma mapbox: define lowp float stroke_opacity 84void main() { 85#pragma mapbox: initialize highp vec4 color 86#pragma mapbox: initialize mediump float radius 87#pragma mapbox: initialize lowp float blur 88#pragma mapbox: initialize lowp float opacity 89#pragma mapbox: initialize highp vec4 stroke_color 90#pragma mapbox: initialize mediump float stroke_width 91#pragma mapbox: initialize lowp float stroke_opacity 92vec2 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));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;} 93#ifdef OVERDRAW_INSPECTOR 94fragColor=vec4(1.0); 95#endif 96}`,`uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out float v_visibility; 97#pragma mapbox: define highp vec4 color 98#pragma mapbox: define mediump float radius 99#pragma mapbox: define lowp float blur 100#pragma mapbox: define lowp float opacity 101#pragma mapbox: define highp vec4 stroke_color 102#pragma mapbox: define mediump float stroke_width 103#pragma mapbox: define lowp float stroke_opacity 104void main(void) { 105#pragma mapbox: initialize highp vec4 color 106#pragma mapbox: initialize mediump float radius 107#pragma mapbox: initialize lowp float blur 108#pragma mapbox: initialize lowp float opacity 109#pragma mapbox: initialize highp vec4 stroke_color 110#pragma mapbox: initialize mediump float stroke_width 111#pragma mapbox: initialize lowp float stroke_opacity 112vec2 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) { 113#ifdef GLOBE 114vec3 center_vector=projectToSphere(circle_center); 115#endif 116float angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else { 117#ifdef GLOBE 118vec4 projected_center=interpolateProjection(circle_center,center_vector,ele); 119#else 120vec4 projected_center=projectTileWithElevation(circle_center,ele); 121#endif 122corner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);} 123#ifdef GLOBE 124vec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele); 125#else 126gl_Position=projectTileWithElevation(corner_position,ele); 127#endif 128} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}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:mt(eo,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:mt(`uniform highp float u_intensity;in vec2 v_extrude; 129#pragma mapbox: define highp float weight 130#define GAUSS_COEF 0.3989422804014327 131void main() { 132#pragma mapbox: initialize highp float weight 133float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0); 134#ifdef OVERDRAW_INSPECTOR 135fragColor=vec4(1.0); 136#endif 137}`,`uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude; 138#pragma mapbox: define highp float weight 139#pragma mapbox: define mediump float radius 140const highp float ZERO=1.0/255.0/16.0; 141#define GAUSS_COEF 0.3989422804014327 142void main(void) { 143#pragma mapbox: initialize highp float weight 144#pragma mapbox: initialize mediump float radius 145vec2 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=floor(pos_raw/8.0); 146#ifdef GLOBE 147vec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0); 148#else 149gl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center)); 150#endif 151}`),heatmapTexture:mt(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity; 152#ifdef OVERDRAW_INSPECTOR 153fragColor=vec4(0.0); 154#endif 155}`,"uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out 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:mt("in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;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:mt("in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;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);fragColor=color*alpha*opacity_t;}","in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {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;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),colorRelief:mt(`#ifdef GL_ES 156precision highp float; 157#endif 158uniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {float x=(float(stop)+0.5)/float(u_color_ramp_size);vec4 data=texture(u_elevation_stops,vec2(x,0))*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else 159{l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0)); 160#ifdef OVERDRAW_INSPECTOR 161fragColor=vec4(1.0); 162#endif 163}`,"uniform vec2 u_dimension;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),debug:mt("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:mt(eo,`in vec2 a_pos;void main() { 164#ifdef GLOBE 165gl_Position=projectTileFor3D(a_pos,0.0); 166#else 167gl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0); 168#endif 169}`),fill:mt(`#pragma mapbox: define highp vec4 color 170#pragma mapbox: define lowp float opacity 171void main() { 172#pragma mapbox: initialize highp vec4 color 173#pragma mapbox: initialize lowp float opacity 174fragColor=color*opacity; 175#ifdef OVERDRAW_INSPECTOR 176fragColor=vec4(1.0); 177#endif 178}`,`uniform vec2 u_fill_translate;in vec2 a_pos; 179#pragma mapbox: define highp vec4 color 180#pragma mapbox: define lowp float opacity 181void main() { 182#pragma mapbox: initialize highp vec4 color 183#pragma mapbox: initialize lowp float opacity 184gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}`),fillOutline:mt(`in vec2 v_pos; 185#ifdef GLOBE 186in float v_depth; 187#endif 188#pragma mapbox: define highp vec4 outline_color 189#pragma mapbox: define lowp float opacity 190void main() { 191#pragma mapbox: initialize highp vec4 outline_color 192#pragma mapbox: initialize lowp float opacity 193float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity); 194#ifdef GLOBE 195if (v_depth > 1.0) {discard;} 196#endif 197#ifdef OVERDRAW_INSPECTOR 198fragColor=vec4(1.0); 199#endif 200}`,`uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos; 201#ifdef GLOBE 202out float v_depth; 203#endif 204#pragma mapbox: define highp vec4 outline_color 205#pragma mapbox: define lowp float opacity 206void main() { 207#pragma mapbox: initialize highp vec4 outline_color 208#pragma mapbox: initialize lowp float opacity 209gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; 210#ifdef GLOBE 211v_depth=gl_Position.z/gl_Position.w; 212#endif 213}`),fillOutlinePattern:mt(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos; 214#ifdef GLOBE 215in float v_depth; 216#endif 217#pragma mapbox: define lowp float opacity 218#pragma mapbox: define lowp vec4 pattern_from 219#pragma mapbox: define lowp vec4 pattern_to 220void main() { 221#pragma mapbox: initialize lowp float opacity 222#pragma mapbox: initialize mediump vec4 pattern_from 223#pragma mapbox: initialize mediump vec4 pattern_to 224vec2 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=texture(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=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity; 225#ifdef GLOBE 226if (v_depth > 1.0) {discard;} 227#endif 228#ifdef OVERDRAW_INSPECTOR 229fragColor=vec4(1.0); 230#endif 231}`,`uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos; 232#ifdef GLOBE 233out float v_depth; 234#endif 235#pragma mapbox: define lowp float opacity 236#pragma mapbox: define lowp vec4 pattern_from 237#pragma mapbox: define lowp vec4 pattern_to 238#pragma mapbox: define lowp float pixel_ratio_from 239#pragma mapbox: define lowp float pixel_ratio_to 240void main() { 241#pragma mapbox: initialize lowp float opacity 242#pragma mapbox: initialize mediump vec4 pattern_from 243#pragma mapbox: initialize mediump vec4 pattern_to 244#pragma mapbox: initialize lowp float pixel_ratio_from 245#pragma mapbox: initialize lowp float pixel_ratio_to 246vec2 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=projectTile(a_pos+u_fill_translate,a_pos);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; 247#ifdef GLOBE 248v_depth=gl_Position.z/gl_Position.w; 249#endif 250}`),fillPattern:mt(`#ifdef GL_ES 251precision highp float; 252#endif 253uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b; 254#pragma mapbox: define lowp float opacity 255#pragma mapbox: define lowp vec4 pattern_from 256#pragma mapbox: define lowp vec4 pattern_to 257void main() { 258#pragma mapbox: initialize lowp float opacity 259#pragma mapbox: initialize mediump vec4 pattern_from 260#pragma mapbox: initialize mediump vec4 pattern_to 261vec2 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=texture(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=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity; 262#ifdef OVERDRAW_INSPECTOR 263fragColor=vec4(1.0); 264#endif 265}`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b; 266#pragma mapbox: define lowp float opacity 267#pragma mapbox: define lowp vec4 pattern_from 268#pragma mapbox: define lowp vec4 pattern_to 269#pragma mapbox: define lowp float pixel_ratio_from 270#pragma mapbox: define lowp float pixel_ratio_to 271void main() { 272#pragma mapbox: initialize lowp float opacity 273#pragma mapbox: initialize mediump vec4 pattern_from 274#pragma mapbox: initialize mediump vec4 pattern_to 275#pragma mapbox: initialize lowp float pixel_ratio_from 276#pragma mapbox: initialize lowp float pixel_ratio_to 277vec2 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_siz
277e_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=projectTile(a_pos+u_fill_translate,a_pos);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:mt(`in vec4 v_color;void main() {fragColor=v_color; 278#ifdef OVERDRAW_INSPECTOR 279fragColor=vec4(1.0); 280#endif 281}`,`uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed; 282#ifdef TERRAIN3D 283in vec2 a_centroid; 284#endif 285out vec4 v_color; 286#pragma mapbox: define highp float base 287#pragma mapbox: define highp float height 288#pragma mapbox: define highp vec4 color 289void main() { 290#pragma mapbox: initialize highp float base 291#pragma mapbox: initialize highp float height 292#pragma mapbox: initialize highp vec4 color 293vec3 normal=a_normal_ed.xyz; 294#ifdef TERRAIN3D 295float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); 296#else 297float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; 298#endif 299base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate; 300#ifdef GLOBE 301vec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation); 302#else 303gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0); 304#endif 305float 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;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0); 306#ifdef GLOBE 307mat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition); 308#endif 309directional=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:mt(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting; 310#pragma mapbox: define lowp float base 311#pragma mapbox: define lowp float height 312#pragma mapbox: define lowp vec4 pattern_from 313#pragma mapbox: define lowp vec4 pattern_to 314#pragma mapbox: define lowp float pixel_ratio_from 315#pragma mapbox: define lowp float pixel_ratio_to 316void main() { 317#pragma mapbox: initialize lowp float base 318#pragma mapbox: initialize lowp float height 319#pragma mapbox: initialize mediump vec4 pattern_from 320#pragma mapbox: initialize mediump vec4 pattern_to 321#pragma mapbox: initialize lowp float pixel_ratio_from 322#pragma mapbox: initialize lowp float pixel_ratio_to 323vec2 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=texture(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=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting; 324#ifdef OVERDRAW_INSPECTOR 325fragColor=vec4(1.0); 326#endif 327}`,`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 vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed; 328#ifdef TERRAIN3D 329in vec2 a_centroid; 330#endif 331#ifdef GLOBE 332out vec3 v_sphere_pos; 333#endif 334out vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting; 335#pragma mapbox: define lowp float base 336#pragma mapbox: define lowp float height 337#pragma mapbox: define lowp vec4 pattern_from 338#pragma mapbox: define lowp vec4 pattern_to 339#pragma mapbox: define lowp float pixel_ratio_from 340#pragma mapbox: define lowp float pixel_ratio_to 341void main() { 342#pragma mapbox: initialize lowp float base 343#pragma mapbox: initialize lowp float height 344#pragma mapbox: initialize mediump vec4 pattern_from 345#pragma mapbox: initialize mediump vec4 pattern_to 346#pragma mapbox: initialize lowp float pixel_ratio_from 347#pragma mapbox: initialize lowp float pixel_ratio_to 348vec2 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; 349#ifdef TERRAIN3D 350float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); 351#else 352float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; 353#endif 354base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate; 355#ifdef GLOBE 356vec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation); 357#else 358gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0); 359#endif 360vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0 361? a_pos 362: vec2(edgedistance,elevation*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:mt(`#ifdef GL_ES 363precision highp float; 364#endif 365uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {vec2 epsilon=1.0/u_dimension;float tileSize=u_dimension.x-2.0;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))*tileSize/p
365ow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0); 366#ifdef OVERDRAW_INSPECTOR 367fragColor=vec4(1.0); 368#endif 369}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:mt(`uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES]; 370#define PI 3.141592653589793 371#define STANDARD 0 372#define COMBINED 1 373#define IGOR 2 374#define MULTIDIRECTIONAL 3 375#define BASIC 4 376float get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else 377{fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else 378{fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);} 379#ifdef OVERDRAW_INSPECTOR 380fragColor=vec4(1.0); 381#endif 382}`,"uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:mt(`uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale; 383#ifdef GLOBE 384in float v_depth; 385#endif 386#pragma mapbox: define highp vec4 color 387#pragma mapbox: define lowp float blur 388#pragma mapbox: define lowp float opacity 389void main() { 390#pragma mapbox: initialize highp vec4 color 391#pragma mapbox: initialize lowp float blur 392#pragma mapbox: initialize lowp float opacity 393float 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);fragColor=color*(alpha*opacity); 394#ifdef GLOBE 395if (v_depth > 1.0) {discard;} 396#endif 397#ifdef OVERDRAW_INSPECTOR 398fragColor=vec4(1.0); 399#endif 400}`,` 401#define scale 0.015873016 402in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar; 403#ifdef GLOBE 404out float v_depth; 405#endif 406#pragma mapbox: define highp vec4 color 407#pragma mapbox: define lowp float blur 408#pragma mapbox: define lowp float opacity 409#pragma mapbox: define mediump float gapwidth 410#pragma mapbox: define lowp float offset 411#pragma mapbox: define mediump float width 412void main() { 413#pragma mapbox: initialize highp vec4 color 414#pragma mapbox: initialize lowp float blur 415#pragma mapbox: initialize lowp float opacity 416#pragma mapbox: initialize mediump float gapwidth 417#pragma mapbox: initialize lowp float offset 418#pragma mapbox: initialize mediump float width 419float 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);
419float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; 420#ifdef GLOBE 421v_depth=gl_Position.z/gl_Position.w; 422#endif 423#ifdef TERRAIN3D 424v_gamma_scale=1.0; 425#else 426float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; 427#endif 428v_width2=vec2(outset,inset);}`),lineGradient:mt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv; 429#ifdef GLOBE 430in float v_depth; 431#endif 432#pragma mapbox: define lowp float blur 433#pragma mapbox: define lowp float opacity 434void main() { 435#pragma mapbox: initialize lowp float blur 436#pragma mapbox: initialize lowp float opacity 437float 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=texture(u_image,v_uv);fragColor=color*(alpha*opacity); 438#ifdef GLOBE 439if (v_depth > 1.0) {discard;} 440#endif 441#ifdef OVERDRAW_INSPECTOR 442fragColor=vec4(1.0); 443#endif 444}`,` 445#define scale 0.015873016 446in vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv; 447#ifdef GLOBE 448out float v_depth; 449#endif 450#pragma mapbox: define lowp float blur 451#pragma mapbox: define lowp float opacity 452#pragma mapbox: define mediump float gapwidth 453#pragma mapbox: define lowp float offset 454#pragma mapbox: define mediump float width 455void main() { 456#pragma mapbox: initialize lowp float blur 457#pragma mapbox: initialize lowp float opacity 458#pragma mapbox: initialize mediump float gapwidth 459#pragma mapbox: initialize lowp float offset 460#pragma mapbox: initialize mediump float width 461float 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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; 462#ifdef GLOBE 463v_depth=gl_Position.z/gl_Position.w; 464#endif 465#ifdef TERRAIN3D 466v_gamma_scale=1.0; 467#else 468float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; 469#endif 470v_width2=vec2(outset,inset);}`),linePattern:mt(`#ifdef GL_ES 471precision highp float; 472#endif 473uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width; 474#ifdef GLOBE 475in float v_depth; 476#endif 477#pragma mapbox: define lowp vec4 pattern_from 478#pragma mapbox: define lowp vec4 pattern_to 479#pragma mapbox: define lowp float pixel_ratio_from 480#pragma mapbox: define lowp float pixel_ratio_to 481#pragma mapbox: define lowp float blur 482#pragma mapbox: define lowp float opacity 483void main() { 484#pragma mapbox: initialize mediump vec4 pattern_from 485#pragma mapbox: initialize mediump vec4 pattern_to 486#pragma mapbox: initialize lowp float pixel_ratio_from 487#pragma mapbox: initialize lowp float pixel_ratio_to 488#pragma mapbox: initialize lowp float blur 489#pragma mapbox: initialize lowp float opacity 490vec2 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(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity; 491#ifdef GLOBE 492if (v_depth > 1.0) {discard;} 493#endif 494#ifdef OVERDRAW_INSPECTOR 495fragColor=vec4(1.0); 496#endif 497}`,` 498#define scale 0.015873016 499#define LINE_DISTANCE_SCALE 2.0 500in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width; 501#ifdef GLOBE 502out float v_depth; 503#endif 504#pragma mapbox: define lowp float blur 505#pragma mapbox: define lowp float opacity 506#pragma mapbox: define lowp float offset 507#pragma mapbox: define mediump float gapwidth 508#pragma mapbox: define mediump float width 509#pragma mapbox: define lowp float floorwidth 510#pragma mapbox: define lowp vec4 pattern_from 511#pragma mapbox: define lowp vec4 pattern_to 512#pragma mapbox: define lowp float pixel_ratio_from 513#pragma mapbox: define lowp float pixel_ratio_to 514void main() { 515#pragma mapbox: initialize lowp float blur 516#pragma mapbox: initialize lowp float opacity 517#pragma mapbox: initialize lowp float offset 518#pragma mapbox: initialize mediump float gapwidth 519#pragma mapbox: initialize mediump float width 520#pragma mapbox: initialize lowp float floorwidth 521#pragma mapbox: initialize mediump vec4 pattern_from 522#pragma mapbox: initialize mediump vec4 pattern_to 523#pragma mapbox: initialize lowp float pixel_ratio_from 524#pragma mapbox: initialize lowp float pixel_ratio_to 525float 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);
525float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; 526#ifdef GLOBE 527v_depth=gl_Position.z/gl_Position.w; 528#endif 529#ifdef TERRAIN3D 530v_gamma_scale=1.0; 531#else 532float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; 533#endif 534v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:mt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale; 535#ifdef GLOBE 536in float v_depth; 537#endif 538#pragma mapbox: define highp vec4 color 539#pragma mapbox: define lowp float blur 540#pragma mapbox: define lowp float opacity 541#pragma mapbox: define mediump float width 542#pragma mapbox: define lowp float floorwidth 543void main() { 544#pragma mapbox: initialize highp vec4 color 545#pragma mapbox: initialize lowp float blur 546#pragma mapbox: initialize lowp float opacity 547#pragma mapbox: initialize mediump float width 548#pragma mapbox: initialize lowp float floorwidth 549float 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=texture(u_image,v_tex_a).a;float sdfdist_b=texture(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);fragColor=color*(alpha*opacity); 550#ifdef GLOBE 551if (v_depth > 1.0) {discard;} 552#endif 553#ifdef OVERDRAW_INSPECTOR 554fragColor=vec4(1.0); 555#endif 556}`,` 557#define scale 0.015873016 558#define LINE_DISTANCE_SCALE 2.0 559in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;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;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale; 560#ifdef GLOBE 561out float v_depth; 562#endif 563#pragma mapbox: define highp vec4 color 564#pragma mapbox: define lowp float blur 565#pragma mapbox: define lowp float opacity 566#pragma mapbox: define mediump float gapwidth 567#pragma mapbox: define lowp float offset 568#pragma mapbox: define mediump float width 569#pragma mapbox: define lowp float floorwidth 570void main() { 571#pragma mapbox: initialize highp vec4 color 572#pragma mapbox: initialize lowp float blur 573#pragma mapbox: initialize lowp float opacity 574#pragma mapbox: initialize mediump float gapwidth 575#pragma mapbox: initialize lowp float offset 576#pragma mapbox: initialize mediump float width 577#pragma mapbox: initialize lowp float floorwidth 578float 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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; 579#ifdef GLOBE 580v_depth=gl_Position.z/gl_Position.w; 581#endif 582#ifdef TERRAIN3D 583v_gamma_scale=1.0; 584#else 585float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; 586#endif 587v_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:mt(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in 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=texture(u_image0,v_pos0);vec4 color1=texture(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);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a); 588#ifdef OVERDRAW_INSPECTOR 589fragColor=vec4(1.0); 590#endif 591}`,`uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5; 592#ifdef GLOBE 593if (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;} 594#endif 595v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),symbolIcon:mt(`uniform sampler2D u_texture;in vec2 v_tex;in float v_fade_opacity; 596#pragma mapbox: define lowp float opacity 597void main() { 598#pragma mapbox: initialize lowp float opacity 599lowp float alpha=opacity*v_fade_opacity;fragColor=texture(u_texture,v_tex)*alpha; 600#ifdef OVERDRAW_INSPECTOR 601fragColor=vec4(1.0); 602#endif 603}`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in 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_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;out vec2 v_tex;out float v_fade_opacity; 604#pragma mapbox: define lowp float opacity 605void main() { 606#pragma mapbox: initialize lowp float opacity 607vec2 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 ? 608camera_to_anchor_distance/u_camera_to_center_distance : 609u_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; 610#ifdef GLOBE 611if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);} 612#endif 613vec4 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:mt(`#define SDF_PX 8.0 614uniform 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;in vec2 v_data0;in vec3 v_data1; 615#pragma mapbox: define highp vec4 fill_color 616#pragma mapbox: define highp vec4 halo_color 617#pragma mapbox: define lowp float opacity 618#pragma mapbox: define lowp float halo_width 619#pragma mapbox: define lowp float halo_blur 620void main() { 621#pragma mapbox: initialize highp vec4 fill_color 622#pragma mapbox: initialize highp vec4 halo_color 623#pragma mapbox: initialize lowp float opacity 624#pragma mapbox: initialize lowp float halo_width 625#pragma mapbox: initialize lowp float halo_blur 626float 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=texture(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);}fragColor=color*(alpha*opacity*fade_opacity); 627#ifdef OVERDRAW_INSPECTOR 628fragColor=vec4(1.0); 629#endif 630}`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in 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_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;out vec2 v_data0;out vec3 v_data1; 631#pragma mapbox: define highp vec4 fill_color 632#pragma mapbox: define highp vec4 halo_color 633#pragma mapbox: define lowp float opacity 634#pragma mapbox: define lowp float halo_width 635#pragma mapbox: define lowp float halo_blur 636void main() { 637#pragma mapbox: initialize highp vec4 fill_color 638#pragma mapbox: initialize highp vec4 halo_color 639#pragma mapbox: initialize lowp float opacity 640#pragma mapbox: initialize lowp float halo_width 641#pragma mapbox: initialize lowp float halo_blur 642vec2 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 ? 643camera_to_anchor_distance/u_camera_to_center_distance : 644u_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; 645#ifdef GLOBE 646if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);} 647#endif 648vec4 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:mt(`#define SDF_PX 8.0 649#define SDF 1.0 650#define ICON 0.0 651uniform 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;in vec4 v_data0;in vec4 v_data1; 652#pragma mapbox: define highp vec4 fill_color 653#pragma mapbox: define highp vec4 halo_color 654#pragma mapbox: define lowp float opacity 655#pragma mapbox: define lowp float halo_width 656#pragma mapbox: define lowp float halo_blur 657void main() { 658#pragma mapbox: initialize highp vec4 fill_color 659#pragma mapbox: initialize highp vec4 halo_color 660#pragma mapbox: initialize lowp float opacity 661#pragma mapbox: initialize lowp float halo_width 662#pragma mapbox: initialize lowp float halo_blur 663float fad
663e_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;fragColor=texture(u_texture_icon,tex_icon)*alpha; 664#ifdef OVERDRAW_INSPECTOR 665fragColor=vec4(1.0); 666#endif 667return;}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=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);fragColor=color*(alpha*opacity*fade_opacity); 668#ifdef OVERDRAW_INSPECTOR 669fragColor=vec4(1.0); 670#endif 671}`,`in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in 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_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;out vec4 v_data0;out vec4 v_data1; 672#pragma mapbox: define highp vec4 fill_color 673#pragma mapbox: define highp vec4 halo_color 674#pragma mapbox: define lowp float opacity 675#pragma mapbox: define lowp float halo_width 676#pragma mapbox: define lowp float halo_blur 677void main() { 678#pragma mapbox: initialize highp vec4 fill_color 679#pragma mapbox: initialize highp vec4 halo_color 680#pragma mapbox: initialize lowp float opacity 681#pragma mapbox: initialize lowp float halo_width 682#pragma mapbox: initialize lowp float halo_blur 683vec2 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 ? 684camera_to_anchor_distance/u_camera_to_center_distance : 685u_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; 686#ifdef GLOBE 687if(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);} 688#endif 689vec4 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:mt("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;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in 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=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && 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);
689float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out 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=projectTileFor3D(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:mt("in 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() {fragColor=pack(v_depth);}","in vec3 a_pos3d;uniform float u_ele_delta;out 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=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:mt("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","in vec3 a_pos3d;uniform float u_ele_delta;out 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=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}"),projectionErrorMeasurement:mt("in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}","in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}"),atmosphere:mt(`in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758 690);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}`,"in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:mt("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};
690function mt(u,e){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,n=e.match(/in ([\w]+) ([\w]+)/g),l=u.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),h=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),m=h?h.concat(l):l,_={};return{fragmentSource:u=u.replace(i,(v,S,I,k,P)=>(_[P]=!0,S==="define"?` 691#ifndef HAS_UNIFORM_u_${P} 692in ${I} ${k} ${P}; 693#else 694uniform ${I} ${k} u_${P}; 695#endif 696`:` 697#ifdef HAS_UNIFORM_u_${P} 698 ${I} ${k} ${P} = u_${P}; 699#endif 700`)),vertexSource:e=e.replace(i,(v,S,I,k,P)=>{const D=k==="float"?"vec2":"vec4",O=P.match(/color/)?"color":D;return _[P]?S==="define"?` 701#ifndef HAS_UNIFORM_u_${P} 702uniform lowp float u_${P}_t; 703in ${I} ${D} a_${P}; 704out ${I} ${k} ${P}; 705#else 706uniform ${I} ${k} u_${P}; 707#endif 708`:O==="vec4"?` 709#ifndef HAS_UNIFORM_u_${P} 710 ${P} = a_${P}; 711#else 712 ${I} ${k} ${P} = u_${P}; 713#endif 714`:` 715#ifndef HAS_UNIFORM_u_${P} 716 ${P} = unpack_mix_${O}(a_${P}, u_${P}_t); 717#else 718 ${I} ${k} ${P} = u_${P}; 719#endif 720`:S==="define"?` 721#ifndef HAS_UNIFORM_u_${P} 722uniform lowp float u_${P}_t; 723in ${I} ${D} a_${P}; 724#else 725uniform ${I} ${k} u_${P}; 726#endif 727`:O==="vec4"?` 728#ifndef HAS_UNIFORM_u_${P} 729 ${I} ${k} ${P} = a_${P}; 730#else 731 ${I} ${k} ${P} = u_${P}; 732#endif 733`:` 734#ifndef HAS_UNIFORM_u_${P} 735 ${I} ${k} ${P} = unpack_mix_${O}(a_${P}, u_${P}_t); 736#else 737 ${I} ${k} ${P} = u_${P}; 738#endif 739`}),staticAttributes:n,staticUniforms:m}}class ma{constructor(e,i,n){this.vertexBuffer=e,this.indexBuffer=i,this.segments=n}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var ga=o.aI([{name:"a_pos",type:"Int16",components:2}]);const Ka="#define PROJECTION_MERCATOR",al="mercator";class sl{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return al}get shaderDefine(){return Ka}get shaderPreludeCode(){return ia.projectionMercator}get vertexShaderPreludeCode(){return ia.projectionMercator.vertexSource}get subdivisionGranularity(){return o.aJ.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(e){}getMeshFromTileID(e,i,n,l,h){if(this._cachedMesh)return this._cachedMesh;const m=new o.aK;m.emplaceBack(0,0),m.emplaceBack(o.$,0),m.emplaceBack(0,o.$),m.emplaceBack(o.$,o.$);const _=e.createVertexBuffer(m,ga.members),v=o.aL.simpleSegment(0,0,4,2),S=new o.aM;S.emplaceBack(1,0,2),S.emplaceBack(1,2,3);const I=e.createIndexBuffer(S);return this._cachedMesh=new ma(_,I,v),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(e){}}class Ri{constructor(e=0,i=0,n=0,l=0){if(isNaN(e)||e<0||isNaN(i)||i<0||isNaN(n)||n<0||isNaN(l)||l<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=i,this.left=n,this.right=l}interpolate(e,i,n){return i.top!=null&&e.top!=null&&(this.top=o.C.number(e.top,i.top,n)),i.bottom!=null&&e.bottom!=null&&(this.bottom=o.C.number(e.bottom,i.bottom,n)),i.left!=null&&e.left!=null&&(this.left=o.C.number(e.left,i.left,n)),i.right!=null&&e.right!=null&&(this.right=o.C.number(e.right,i.right,n)),this}getCenter(e,i){const n=o.ag((this.left+e-this.right)/2,0,e),l=o.ag((this.top+i-this.bottom)/2,0,i);return new o.P(n,l)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new Ri(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function _a(u,e){if(!u.renderWorldCopies||u.lngRange)return;const i=e.lng-u.center.lng;e.lng+=i>180?-360:i<-180?360:0}function gt(u){return Math.max(0,Math.floor(u))}class rn{constructor(e,i,n,l,h,m){this._callbacks=e,this._tileSize=512,this._renderWorldCopies=m===void 0||!!m,this._minZoom=i||0,this._maxZoom=n||22,this._minPitch=l??0,this._maxPitch=h??60,this.setMaxBounds(),this._width=0,this._height=0,this._center=new o.S(0,0),this._elevation=0,this._zoom=0,this._tileZoom=gt(this._zoom),this._scale=o.ae(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new Ri,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,i,n){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._tileZoom=gt(this._zoom),this._scale=o.ae(this._zoom),this._bearingInRadians=e.bearingInRadians,this._fovInRadians=e.fovInRadians,this._pitchInRadians=e.pitchInRadians,this._rollInRadians=e.rollInRadians,this._unmodified=e.unmodified,this._edgeInsets=new Ri(e.padding.top,e.padding.bottom,e.padding.left,e.padding.right),this._minZoom=e.minZoom,this._maxZoom=e.maxZoom,this._minPitch=e.minPitch,this._maxPitch=e.maxPitch,this._renderWorldCopies=e.renderWorldCopies,this._cameraToCenterDistance=e.cameraToCenterDistance,this._nearZ=e.nearZ,this._farZ=e.farZ,this._autoCalculateNearFarZ=!n&&e.autoCalculateNearFarZ,i&&this._constrain(),this._calcMatrices()}
739get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(e){this._minElevationForCurrentTile=e}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(e){this._minZoom!==e&&(this._minZoom=e,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(e){this._minPitch!==e&&(this._minPitch=e,this.setPitch(Math.max(this.pitch,e)))}get maxPitch(){return this._maxPitch}setMaxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.setPitch(Math.min(this.pitch,e)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(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 o.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){const i=o.aN(e,-180,180)*Math.PI/180;var n,l,h,m,_,v,S,I,k;this._bearingInRadians!==i&&(this._unmodified=!1,this._bearingInRadians=i,this._calcMatrices(),this._rotationMatrix=ce(),n=this._rotationMatrix,h=-this._bearingInRadians,m=(l=this._rotationMatrix)[0],_=l[1],v=l[2],S=l[3],I=Math.sin(h),k=Math.cos(h),n[0]=m*k+v*I,n[1]=_*k+S*I,n[2]=m*-I+v*k,n[3]=_*-I+S*k)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){const i=o.ag(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==i&&(this._unmodified=!1,this._pitchInRadians=i,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(e){const i=e/180*Math.PI;this._rollInRadians!==i&&(this._unmodified=!1,this._rollInRadians=i,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return o.aO(this._fovInRadians)}setFov(e){e=o.ag(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=o.ad(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){const i=this.getConstrained(this._center,e).zoom;this._zoom!==i&&(this._unmodified=!1,this._zoom=i,this._tileZoom=Math.max(0,Math.floor(i)),this._scale=o.ae(i),this._constrain(),this._calcMatrices())}get center(){return this._center}setCenter(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}setElevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(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)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(e,i){this._autoCalculateNearFarZ=!1,this._nearZ=e,this._farZ=i,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,i,n){this._unmodified=!1,this._edgeInsets.interpolate(e,i,n),this._constrain(),this._calcMatrices()}resize(e,i,n=!0){this._width=e,this._height=i,n&&this._constrain(),this._calcMatrices()}getMaxBounds(){return this._latRange&&this._latRange.length===2&&this._lngRange&&this._lngRange.length===2?new It([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]]):null}setMaxBounds(e){e?(this._lngRange=[e.getWest(),e.getEast()],this._latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this._lngRange=null,this._latRange=[-o.ah,o.ah])}getConstrained(e,i){return this._callbacks.getConstrained(e,i)}getCameraQueryGeometry(e,i){if(i.length===1)return[i[0],e];{const{minX:n,minY:l,maxX:h,maxY:m}=o.a1.fromPoints(i).extend(e);return[new o.P(n,l),new o.P(h,l),new o.P(h,m),new o.P(n,m),new o.P(n,l)]}}_constrain(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;const e=this._unmodified,{center:i,zoom:n}=this.getConstrained(this.center,this.zoom);this.setCenter(i),this.setZoom(n),this._unmodified=e,this._constraining=!1}
739_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=o.af(new Float64Array(16));o.N(e,e,[this._width/2,-this._height/2,1]),o.M(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=o.af(new Float64Array(16)),o.N(e,e,[1,-1,1]),o.M(e,e,[-1,-1,0]),o.N(e,e,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=e,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(e,i,n,l){const h=n!==void 0?n:this.bearing,m=l=l!==void 0?l:this.pitch,_=o.a0.fromLngLat(e,i),v=-Math.cos(o.ad(m)),S=Math.sin(o.ad(m)),I=S*Math.sin(o.ad(h)),k=-S*Math.cos(o.ad(h));let P=this.elevation;const D=i-P;let O;v*D>=0||Math.abs(v)<.1?(O=1e4,P=i+O*v):O=-D/v;let G,q,H=o.aP(1,_.y),X=0;do{if(X+=1,X>10)break;q=O/H,G=new o.a0(_.x+I*q,_.y+k*q),H=1/G.meterInMercatorCoordinateUnits()}while(Math.abs(O-q*H)>1e-12);return{center:G.toLngLat(),elevation:P,zoom:o.aj(this.height/2/Math.tan(this.fovInRadians/2)/q/this.tileSize)}}recalculateZoomAndCenter(e){if(this.elevation-e==0)return;const i=o.ai(1,this.center.lat)*this.worldSize,n=this.cameraToCenterDistance/i,l=o.a0.fromLngLat(this.center,this.elevation),h=J(this.center,this.elevation,this.pitch,this.bearing,n);this._elevation=e;const m=this.calculateCenterFromCameraLngLatAlt(h.toLngLat(),o.aP(h.z,l.y),this.bearing,this.pitch);this._elevation=m.elevation,this._center=m.center,this.setZoom(m.zoom)}getCameraPoint(){const e=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new o.P(e*Math.sin(this.rollInRadians),e*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){const e=o.ai(1,this.center.lat)*this.worldSize;return J(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/e).toLngLat()}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];const i=e.canonical.z>=0?1<<e.canonical.z:Math.pow(2,e.canonical.z);return[e.canonical.x/i,e.canonical.y/i,1/i/o.$,1/i/o.$]}}class to{constructor(e,i){this.min=e,this.max=i,this.center=o.aQ([],o.aR([],this.min,this.max),.5)}quadrant(e){const i=[e%2==0,e<2],n=o.aS(this.min),l=o.aS(this.max);for(let h=0;h<i.length;h++)n[h]=i[h]?this.min[h]:this.center[h],l[h]=i[h]?this.center[h]:this.max[h];return l[2]=this.max[2],new to(n,l)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}intersectsFrustum(e){let i=!0;for(let n=0;n<e.planes.length;n++){const l=this.intersectsPlane(e.planes[n]);if(l===0)return 0;l===1&&(i=!1)}return i?2:e.aabb.min[0]>this.max[0]||e.aabb.min[1]>this.max[1]||e.aabb.min[2]>this.max[2]||e.aabb.max[0]<this.min[0]||e.aabb.max[1]<this.min[1]||e.aabb.max[2]<this.min[2]?0:1}intersectsPlane(e){let i=e[3],n=e[3];for(let l=0;l<3;l++)e[l]>0?(i+=e[l]*this.min[l],n+=e[l]*this.max[l]):(n+=e[l]*this.min[l],i+=e[l]*this.max[l]);return i>=0?2:n<0?0:1}}class nl{distanceToTile2d(e,i,n,l){const h=l.distanceX([e,i]),m=l.distanceY([e,i]);return Math.hypot(h,m)}getWrap(e,i,n){return n}getTileBoundingVolume(e,i,n,l){var h,m;let _=n,v=n;if(l!=null&&l.terrain){const I=new o.Z(e.z,i,e.z,e.x,e.y),k=l.terrain.getMinMaxElevation(I);_=(h=k.minElevation)!==null&&h!==void 0?h:n,v=(m=k.maxElevation)!==null&&m!==void 0?m:n}const S=1<<e.z;return new to([i+e.x/S,e.y/S,_],[i+(e.x+1)/S,(e.y+1)/S,v])}allowVariableZoom(e,i){const n=e.fov*(Math.abs(Math.cos(e.rollInRadians))*e.height+Math.abs(Math.sin(e.rollInRadians))*e.width)/e.height,l=o.ag(78.5-n/2,0,60);return!!i.terrain||e.pitch>l}allowWorldCopies(){return!0}prepareNextFrame(){}}class Jr{constructor(e,i,n){this.points=e,this.planes=i,this.aabb=n}static fromInvProjectionMatrix(e,i=1,n=0,l,h){const m=h?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],_=Math.pow(2,n),v=[[-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(P=>function(D,O,G,q){const H=o.av([],D,O),X=1/H[3]/G*q;return o.aX(H,H,[X,X,1/H[3],X])}(P,e,i,_));l&&function(P,D,O,G){const q=G?4:0,H=G?0:4;let X=0;const ee=[],Y=[];for(let K=0;K<4;K++){const le=o.aT([],P[K+H],P[K+q]),xe=o.aY(le);o.aQ(le,le,1/xe),ee.push(xe),Y.push(le)}for(let K=0;K<4;K++){const le=o.aZ(P[K+q],Y[K],O);X=le!==null&&le>=0?Math.max(X,le):Math.max(X,ee[K])}const re=function(K,le){const xe=o.aT([],K[le[0]],K[le[1]]),me=o.aT([],K[le[2]],K[le[1]]),ge=[0,0,0,0];return o.aU(ge,o.aV([],xe,me)),ge[3]=-o.aW(ge,K[le[0]]),ge}(P,D),ae=function(K,le){const xe=o.a_(K),me=o.a$([],K,1/xe),ge=o.aT([],le,o.aQ([],me,o.aW(le,me))),ve=o.a_(ge);if(ve>0){const Oe=Math.sqrt(1-me[3]*me[3]),Be=o.aQ([],me,-me[3]),ke=o.aR([],Be,o.aQ([],ge,Oe/ve));return o.b0(le,ke)}return null}(O,re);if(ae!==null){const K=ae/o.aW(Y[0],re);X=Math.min(X,K)}for(let K=0;K<4;K++){const le=Math.min(X,ee[K]);P[K+H]=[P[K+q][0]+Y[K][0]*le,P[K+q][1]+Y[K][1]*le,P[K+q][2]+Y[K][2]*le,1]}}(v,m[0],l,h);const S=m.map(P=>{const D=o.aT([],v[P[0]],v[P[1]]),O=o.aT([],v[P[2]],v[P[1]]),G=o.aU([],o.aV([],D,O)),q=-o.aW(G,v[P[1]]);return G.concat(q)}),I=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],k=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const P of v)for(let D=0;D<3;D++)I[D]=Math.min(I[D],P[D]),k[D]=Math.max(k[D],P[D]);return new Jr(v,S,new to(I,k))}}
739class gr{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,i,n){return this._helper.interpolatePadding(e,i,n)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,i,n=!0){this._helper.resize(e,i,n)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,i){this._helper.overrideNearFarZ(e,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e,i){}constructor(e,i,n,l,h){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this._helper=new rn({calcMatrices:()=>{this._calcMatrices()},getConstrained:(m,_)=>this.getConstrained(m,_)},e,i,n,l,h),this._coveringTilesDetailsProvider=new nl}clone(){const e=new gr;return e.apply(this),e}apply(e,i,n){this._helper.apply(e,i,n)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(e){const i=[new o.b1(0,e)];if(this._helper._renderWorldCopies){const n=this.screenPointToMercatorCoordinate(new o.P(0,0)),l=this.screenPointToMercatorCoordinate(new o.P(this._helper._width,0)),h=this.screenPointToMercatorCoordinate(new o.P(this._helper._width,this._helper._height)),m=this.screenPointToMercatorCoordinate(new o.P(0,this._helper._height)),_=Math.floor(Math.min(n.x,l.x,h.x,m.x)),v=Math.floor(Math.max(n.x,l.x,h.x,m.x)),S=1;for(let I=_-S;I<=v+S;I++)I!==0&&i.push(new o.b1(I,e))}return i}getCameraFrustum(){return Jr.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){const i=this.screenPointToLocation(this.centerPoint,e),n=e?e.getElevationForLngLatZoom(i,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(n)}setLocationAtPoint(e,i){const n=o.ai(this.elevation,this.center.lat),l=this.screenPointToMercatorCoordinateAtZ(i,n),h=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,n),m=o.a0.fromLngLat(e),_=new o.a0(m.x-(l.x-h.x),m.y-(l.y-h.y));this.setCenter(_==null?void 0:_.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(e,i){return i?this.coordinatePoint(o.a0.fromLngLat(e),i.getElevationForLngLatZoom(e,this._helper._tileZoom),this._pixelMatrix3D):this.coordinatePoint(o.a0.fromLngLat(e))}screenPointToLocation(e,i){var n;return(n=this.screenPointToMercatorCoordinate(e,i))===null||n===void 0?void 0:n.toLngLat()}screenPointToMercatorCoordinate(e,i){if(i){const n=i.pointCoordinate(e);if(n!=null)return n}return this.screenPointToMercatorCoordinateAtZ(e)}screenPointToMercatorCoordinateAtZ(e,i){const n=i||0,l=[e.x,e.y,0,1],h=[e.x,e.y,1,1];o.av(l,l,this._pixelMatrixInverse),o.av(h,h,this._pixelMatrixInverse);const m=l[3],_=h[3],v=l[1]/m,S=h[1]/_,I=l[2]/m,k=h[2]/_,P=I===k?0:(n-I)/(k-I);return new o.a0(o.C.number(l[0]/m,h[0]/_,P)/this.worldSize,o.C.number(v,S,P)/this.worldSize,n)}coordinatePoint(e,i=0,n=this._pixelMatrix){const l=[e.x*this.worldSize,e.y*this.worldSize,i,1];return o.av(l,l,n),new o.P(l[0]/l[3],l[1]/l[3])}getBounds(){const e=Math.max(0,this._helper._height/2-U(this));return new It().extend(this.screenPointToLocation(new o.P(0,e))).extend(this.screenPointToLocation(new o.P(this._helper._width,e))).extend(this.screenPointToLocation(new o.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new o.P(0,this._helper._height)))}
739isPointOnMapSurface(e,i){return i?i.pointCoordinate(e)!=null:e.y>this.height/2-U(this)}calculatePosMatrix(e,i=!1,n){var l;const h=(l=e.key)!==null&&l!==void 0?l:o.b2(e.wrap,e.canonical.z,e.canonical.z,e.canonical.x,e.canonical.y),m=i?this._alignedPosMatrixCache:this._posMatrixCache;if(m.has(h)){const S=m.get(h);return n?S.f32:S.f64}const _=Z(e,this.worldSize);o.O(_,i?this._alignedProjMatrix:this._viewProjMatrix,_);const v={f64:_,f32:new Float32Array(_)};return m.set(h,v),n?v.f32:v.f64}calculateFogMatrix(e){const i=e.key,n=this._fogMatrixCacheF32;if(n.has(i))return n.get(i);const l=Z(e,this.worldSize);return o.O(l,this._fogMatrix,l),n.set(i,new Float32Array(l)),n.get(i)}getConstrained(e,i){i=o.ag(+i,this.minZoom,this.maxZoom);const n={center:new o.S(e.lng,e.lat),zoom:i};let l=this._helper._lngRange;!this._helper._renderWorldCopies&&l===null&&(l=[-179.9999999999,179.9999999999]);const h=this.tileSize*o.ae(n.zoom);let m=0,_=h,v=0,S=h,I=0,k=0;const{x:P,y:D}=this.size;if(this._helper._latRange){const ee=this._helper._latRange;m=o.U(ee[1])*h,_=o.U(ee[0])*h,_-m<D&&(I=D/(_-m))}l&&(v=o.aN(o.V(l[0])*h,0,h),S=o.aN(o.V(l[1])*h,0,h),S<v&&(S+=h),S-v<P&&(k=P/(S-v)));const{x:O,y:G}=he(h,e);let q,H;const X=Math.max(k||0,I||0);if(X){const ee=new o.P(k?(S+v)/2:O,I?(_+m)/2:G);return n.center=N(h,ee).wrap(),n.zoom+=o.aj(X),n}if(this._helper._latRange){const ee=D/2;G-ee<m&&(H=m+ee),G+ee>_&&(H=_-ee)}if(l){const ee=(v+S)/2;let Y=O;
739this._helper._renderWorldCopies&&(Y=o.aN(O,ee-h/2,ee+h/2));const re=P/2;Y-re<v&&(q=v+re),Y+re>S&&(q=S-re)}if(q!==void 0||H!==void 0){const ee=new o.P(q??O,H??G);n.center=N(h,ee).wrap()}return n}calculateCenterFromCameraLngLatAlt(e,i,n,l){return this._helper.calculateCenterFromCameraLngLatAlt(e,i,n,l)}_calculateNearFarZIfNeeded(e,i,n){if(!this._helper.autoCalculateNearFarZ)return;const l=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),h=e-l*this._helper._pixelPerMeter/Math.cos(i),m=l<0?h:e,_=Math.PI/2+this.pitchInRadians,v=o.ad(this.fov)*(Math.abs(Math.cos(o.ad(this.roll)))*this.height+Math.abs(Math.sin(o.ad(this.roll)))*this.width)/this.height*(.5+n.y/this.height),S=Math.sin(v)*m/Math.sin(o.ag(Math.PI-_-v,.01,Math.PI-.01)),I=U(this),k=Math.atan(I/this._helper.cameraToCenterDistance),P=o.ad(.75),D=k>P?2*k*(.5+n.y/(2*I)):P,O=Math.sin(D)*m/Math.sin(o.ag(Math.PI-_-D,.01,Math.PI-.01)),G=Math.min(S,O);this._helper._farZ=1.01*(Math.cos(Math.PI/2-i)*G+m),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;const e=this.centerOffset,i=he(this.worldSize,this.center),n=i.x,l=i.y;this._helper._pixelPerMeter=o.ai(1,this.center.lat)*this.worldSize;const h=o.ad(Math.min(this.pitch,Li)),m=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(h));let _;this._calculateNearFarZIfNeeded(m,h,e),_=new Float64Array(16),o.b3(_,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),o.ap(this._invProjMatrix,_),_[8]=2*-e.x/this._helper._width,_[9]=2*e.y/this._helper._height,this._projectionMatrix=o.b4(_),o.N(_,_,[1,-1,1]),o.M(_,_,[0,0,-this._helper.cameraToCenterDistance]),o.b5(_,_,-this.rollInRadians),o.b6(_,_,this.pitchInRadians),o.b5(_,_,-this.bearingInRadians),o.M(_,_,[-n,-l,0]),this._mercatorMatrix=o.N([],_,[this.worldSize,this.worldSize,this.worldSize]),o.N(_,_,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=o.O(new Float64Array(16),this.clipSpaceToPixelsMatrix,_),o.M(_,_,[0,0,-this.elevation]),this._viewProjMatrix=_,this._invViewProjMatrix=o.ap([],_);const v=[0,0,-1,1];o.av(v,v,this._invViewProjMatrix),this._cameraPosition=[v[0]/v[3],v[1]/v[3],v[2]/v[3]],this._fogMatrix=new Float64Array(16),o.b3(this._fogMatrix,this.fovInRadians,this.width/this.height,m,this._helper._farZ),this._fogMatrix[8]=2*-e.x/this.width,this._fogMatrix[9]=2*e.y/this.height,o.N(this._fogMatrix,this._fogMatrix,[1,-1,1]),o.M(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),o.b5(this._fogMatrix,this._fogMatrix,-this.rollInRadians),o.b6(this._fogMatrix,this._fogMatrix,this.pitchInRadians),o.b5(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),o.M(this._fogMatrix,this._fogMatrix,[-n,-l,0]),o.N(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),o.M(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=o.O(new Float64Array(16),this.clipSpaceToPixelsMatrix,_);const S=this._helper._width%2/2,I=this._helper._height%2/2,k=Math.cos(this.bearingInRadians),P=Math.sin(-this.bearingInRadians),D=n-Math.round(n)+k*S+P*I,O=l-Math.round(l)+k*I+P*S,G=new Float64Array(_);if(o.M(G,G,[D>.5?D-1:D,O>.5?O-1:O,0]),this._alignedProjMatrix=G,_=o.ap(new Float64Array(16),this._pixelMatrix),!_)throw new Error("failed to invert matrix");this._pixelMatrixInverse=_,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;const e=this.screenPointToMercatorCoordinate(new o.P(0,0)),i=[e.x*this.worldSize,e.y*this.worldSize,0,1];return o.av(i,i,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const e=o.ai(1,this.center.lat)*this.worldSize;return J(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/e).toLngLat()}lngLatToCameraDepth(e,i){const n=o.a0.fromLngLat(e),l=[n.x*this.worldSize,n.y*this.worldSize,i,1];return o.av(l,l,this._viewProjMatrix),l[2]/l[3]}getProjectionData(e){const{overscaledTileID:i,aligned:n,applyTerrainMatrix:l}=e,h=this._helper.getMercatorTileCoordinates(i),m=i?this.calculatePosMatrix(i,n,!0):null;let _;return _=i&&i.terrainRttPosMatrix32f&&l?i.terrainRttPosMatrix32f:m||o.b7(),{mainMatrix:_,tileMercatorCoords:h,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:_}}isLocationOccluded(e){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(e,i,n){return 1}transformLightDirection(e){return o.aS(e)}getRayDirectionFromPixel(e){throw new Error("Not implemented.")}projectTileCoordinates(e,i,n,l){const h=this.calculatePosMatrix(n);let m;l?(m=[e,i,l(e,i),1],o.av(m,m,h)):(m=[e,i,0,1],Xa(m,m,h));const _=m[3];return{point:new o.P(m[0]/_,m[1]/_),signedDistanceFromCamera:_,isOccluded:!1}}populateCache(e){for(const i of e)this.calculatePosMatrix(i)}getMatrixForModel(e,i){const n=o.a0.fromLngLat(e,i),l=n.meterInMercatorCoordinateUnits(),h=o.b8();return o.M(h,h,[n.x,n.y,n.z]),o.b5(h,h,Math.PI),o.b6(h,h,Math.PI/2),o.N(h,h,[-l,l,l]),h}getProjectionDataForCustomLayer(e=!0){const i=new o.Z(0,0,0,0,0),n=this.getProjectionData({overscaledTileID:i,applyGlobeMatrix:e}),l=Z(i,this.worldSize);o.O(l,this._viewProjMatrix,l),n.tileMercatorCoords=[0,0,1,1];const h=[o.$,o.$,this.worldSize/this._helper.pixelsPerMeter],m=o.b9();return o.N(m,l,h),n.fallbackMatrix=m,n.mainMatrix=m,n}getFastPathSimpleProjectionMatrix(e){return this.calculatePosMatrix(e)}}function Qr(){o.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function Er(u){if(u.useSlerp)if(u.k<1){const e=o.ba(u.startEulerAngles.roll,u.startEulerAngles.pitch,u.startEulerAngles.bearing),i=o.ba(u.endEulerAngles.roll,u.endEulerAngles.pitch,u.endEulerAngles.bearing),n=new Float64Array(4);o.bb(n,e,i,u.k);const l=o.bc(n);u.tr.setRoll(l.roll),u.tr.setPitch(l.pitch),u.tr.setBearing(l.bearing)}else u.tr.setRoll(u.endEulerAngles.roll),u.tr.setPitch(u.endEulerAngles.pitch),u.tr.setBearing(u.endEulerAngles.bearing);else u.tr.setRoll(o.C.number(u.startEulerAngles.roll,u.endEulerAngles.roll,u.k)),u.tr.setPitch(o.C.number(u.startEulerAngles.pitch,u.endEulerAngles.pitch,u.k)),u.tr.setBearing(o.C.number(u.startEulerAngles.bearing,u.endEulerAngles.bearing,u.k))}
739function Kt(u,e,i,n,l){const h=l.padding,m=he(l.worldSize,i.getNorthWest()),_=he(l.worldSize,i.getNorthEast()),v=he(l.worldSize,i.getSouthEast()),S=he(l.worldSize,i.getSouthWest()),I=o.ad(-n),k=m.rotate(I),P=_.rotate(I),D=v.rotate(I),O=S.rotate(I),G=new o.P(Math.max(k.x,P.x,O.x,D.x),Math.max(k.y,P.y,O.y,D.y)),q=new o.P(Math.min(k.x,P.x,O.x,D.x),Math.min(k.y,P.y,O.y,D.y)),H=G.sub(q),X=(l.width-(h.left+h.right+e.left+e.right))/H.x,ee=(l.height-(h.top+h.bottom+e.top+e.bottom))/H.y;if(ee<0||X<0)return void Qr();const Y=Math.min(o.aj(l.scale*Math.min(X,ee)),u.maxZoom),re=o.P.convert(u.offset),ae=new o.P((e.left-e.right)/2,(e.top-e.bottom)/2).rotate(o.ad(n)),K=re.add(ae).mult(l.scale/o.ae(Y));return{center:N(l.worldSize,m.add(v).div(2).sub(K)),zoom:Y,bearing:n}}class ro{get useGlobeControls(){return!1}handlePanInertia(e,i){return{easingOffset:e,easingCenter:i.center}}handleMapControlsRollPitchBearingZoom(e,i){e.bearingDelta&&i.setBearing(i.bearing+e.bearingDelta),e.pitchDelta&&i.setPitch(i.pitch+e.pitchDelta),e.rollDelta&&i.setRoll(i.roll+e.rollDelta),e.zoomDelta&&i.setZoom(i.zoom+e.zoomDelta)}handleMapControlsPan(e,i,n){e.around.distSqr(i.centerPoint)<.01||i.setLocationAtPoint(n,e.around)}cameraForBoxAndBearing(e,i,n,l,h){return Kt(e,i,n,l,h)}handleJumpToCenterZoom(e,i){e.zoom!==(i.zoom!==void 0?+i.zoom:e.zoom)&&e.setZoom(+i.zoom),i.center!==void 0&&e.setCenter(o.S.convert(i.center))}handleEaseTo(e,i){const n=e.zoom,l=e.padding,h={roll:e.roll,pitch:e.pitch,bearing:e.bearing},m={roll:i.roll===void 0?e.roll:i.roll,pitch:i.pitch===void 0?e.pitch:i.pitch,bearing:i.bearing===void 0?e.bearing:i.bearing},_=i.zoom!==void 0,v=!e.isPaddingEqual(i.padding);let S=!1;const I=_?+i.zoom:e.zoom;let k=e.centerPoint.add(i.offsetAsPoint);const P=e.screenPointToLocation(k),{center:D,zoom:O}=e.getConstrained(o.S.convert(i.center||P),I??n);_a(e,D);const G=he(e.worldSize,P),q=he(e.worldSize,D).sub(G),H=o.ae(O-n);return S=O!==n,{easeFunc:X=>{if(S&&e.setZoom(o.C.number(n,O,X)),o.bd(h,m)||Er({startEulerAngles:h,endEulerAngles:m,tr:e,k:X,useSlerp:h.roll!=m.roll}),v&&(e.interpolatePadding(l,i.padding,X),k=e.centerPoint.add(i.offsetAsPoint)),i.around)e.setLocationAtPoint(i.around,i.aroundPoint);else{const ee=o.ae(e.zoom-n),Y=O>n?Math.min(2,H):Math.max(.5,H),re=Math.pow(Y,1-X),ae=N(e.worldSize,G.add(q.mult(X*re)).mult(ee));e.setLocationAtPoint(e.renderWorldCopies?ae.wrap():ae,k)}},isZooming:S,elevationCenter:D}}handleFlyTo(e,i){const n=i.zoom!==void 0,l=e.zoom,h=e.getConstrained(o.S.convert(i.center||i.locationAtOffset),n?+i.zoom:l),m=h.center,_=h.zoom;_a(e,m);const v=he(e.worldSize,i.locationAtOffset),S=he(e.worldSize,m).sub(v),I=S.mag(),k=o.ae(_-l);let P;if(i.minZoom!==void 0){const D=Math.min(+i.minZoom,l,_),O=e.getConstrained(m,D).zoom;P=o.ae(O-l)}return{easeFunc:(D,O,G,q)=>{e.setZoom(D===1?_:l+o.aj(O));const H=D===1?m:N(e.worldSize,v.add(S.mult(G)).mult(O));e.setLocationAtPoint(e.renderWorldCopies?H.wrap():H,q)},scaleOfZoom:k,targetCenter:m,scaleOfMinZoom:P,pixelPathLength:I}}}class Tt{constructor(e,i,n){this.blendFunction=e,this.blendColor=i,this.mask=n}}Tt.Replace=[1,0],Tt.disabled=new Tt(Tt.Replace,o.be.transparent,[!1,!1,!1,!1]),Tt.unblended=new Tt(Tt.Replace,o.be.transparent,[!0,!0,!0,!0]),Tt.alphaBlended=new Tt([1,771],o.be.transparent,[!0,!0,!0,!0]);const hi=2305;class lt{constructor(e,i,n){this.enable=e,this.mode=i,this.frontFace=n}}lt.disabled=new lt(!1,1029,hi),lt.backCCW=new lt(!0,1029,hi),lt.frontCCW=new lt(!0,1028,hi);class ct{constructor(e,i,n){this.func=e,this.mask=i,this.range=n}}ct.ReadOnly=!1,ct.ReadWrite=!0,ct.disabled=new ct(519,ct.ReadOnly,[0,1]);const Ja=7680;class at{constructor(e,i,n,l,h,m){this.test=e,this.ref=i,this.mask=n,this.fail=l,this.depthFail=h,this.pass=m}}at.disabled=new at({func:519,mask:0},0,0,Ja,Ja,Ja);const Qa=new WeakMap;function ii(u){var e;if(Qa.has(u))return Qa.get(u);{const i=(e=u.getParameter(u.VERSION))===null||e===void 0?void 0:e.startsWith("WebGL 2.0");return Qa.set(u,i),i}}class _s{get awaitingQuery(){return!!this._readbackQueue}constructor(e){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=e;const i=e.context,n=i.gl;this._texFormat=n.RGBA,this._texType=n.UNSIGNED_BYTE;const l=new o.aK;l.emplaceBack(-1,-1),l.emplaceBack(2,-1),l.emplaceBack(-1,2);const h=new o.aM;h.emplaceBack(0,1,2),this._fullscreenTriangle=new ma(i.createVertexBuffer(l,ga.members),i.createIndexBuffer(h),o.aL.simpleSegment(0,0,l.length,h.length)),this._resultBuffer=new Uint8Array(4),i.activeTexture.set(n.TEXTURE1);const m=n.createTexture();n.bindTexture(n.TEXTURE_2D,m),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.NEAREST),n.texImage2D(n.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=i.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(m),ii(n)&&(this._pbo=n.createBuffer(),n.bindBuffer(n.PIXEL_PACK_BUFFER,this._pbo),n.bufferData(n.PIXEL_PACK_BUFFER,4,n.STREAM_READ),n.bindBuffer(n.PIXEL_PACK_BUFFER,null))}destroy(){const e=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),e.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(e,i){const n=this._updateCount;return this._readbackQueue?n>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():n>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(e,i),this._updateCount++,this._measuredError}_bindFramebuffer(){const e=this._cachedRenderContext.context,i=e.gl;e.activeTexture.set(i.TEXTURE1),i.bindTexture(i.TEXTURE_2D,this._fbo.colorAttachment.get()),e.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(e,i){const n=this._cachedRenderContext.context,l=n.gl;if(this._bindFramebuffer(),n.viewport.set([0,0,this._texWidth,this._texHeight]),n.clear({color:o.be.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(n,l.TRIANGLES,ct.disabled,at.disabled,Tt.unblended,lt.disabled,((h,m)=>
739({u_input:h,u_output_expected:m}))(e,i),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&ii(l)){l.bindBuffer(l.PIXEL_PACK_BUFFER,this._pbo),l.readBuffer(l.COLOR_ATTACHMENT0),l.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),l.bindBuffer(l.PIXEL_PACK_BUFFER,null);const h=l.fenceSync(l.SYNC_GPU_COMMANDS_COMPLETE,0);l.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:h}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){const e=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&ii(e)){const i=e.clientWaitSync(this._readbackQueue.sync,0,0);if(i===e.WAIT_FAILED)return o.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(i===e.TIMEOUT_EXPIRED)return;e.bindBuffer(e.PIXEL_PACK_BUFFER,this._pbo),e.getBufferSubData(e.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),e.bindBuffer(e.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),e.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=_s._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(e){let i=0;return i+=e[0]/256,i+=e[1]/65536,i+=e[2]/16777216,e[3]<127&&(i=-i),i/128}}const pi=o.$/128;function ol(u,e){const i=u.granularity!==void 0?Math.max(u.granularity,1):1,n=i+(u.generateBorders?2:0),l=i+(u.extendToNorthPole||u.generateBorders?1:0)+(u.extendToSouthPole||u.generateBorders?1:0),h=n+1,m=l+1,_=u.generateBorders?-1:0,v=u.generateBorders||u.extendToNorthPole?-1:0,S=i+(u.generateBorders?1:0),I=i+(u.generateBorders||u.extendToSouthPole?1:0),k=h*m,P=n*l*6,D=h*m>65536;if(D&&e==="16bit")throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");const O=D||e==="32bit",G=new Int16Array(2*k);let q=0;for(let ee=v;ee<=I;ee++)for(let Y=_;Y<=S;Y++){let re=Y/i*o.$;Y===-1&&(re=-pi),Y===i+1&&(re=o.$+pi);let ae=ee/i*o.$;ee===-1&&(ae=u.extendToNorthPole?o.bg:-pi),ee===i+1&&(ae=u.extendToSouthPole?o.bh:o.$+pi),G[q++]=re,G[q++]=ae}const H=O?new Uint32Array(P):new Uint16Array(P);let X=0;for(let ee=0;ee<l;ee++)for(let Y=0;Y<n;Y++){const re=Y+1+ee*h,ae=Y+(ee+1)*h,K=Y+1+(ee+1)*h;H[X++]=Y+ee*h,H[X++]=ae,H[X++]=re,H[X++]=re,H[X++]=ae,H[X++]=K}return{vertices:G.buffer.slice(0),indices:H.buffer.slice(0),uses32bitIndices:O}}const aa=new o.aJ({fill:new o.bi(128,2),line:new o.bi(512,0),tile:new o.bi(128,32),stencil:new o.bi(128,1),circle:3});class Pc{constructor(){this._tileMeshCache={},this._errorCorrectionUsable=0,this._errorMeasurementLastValue=0,this._errorCorrectionPreviousValue=0,this._errorMeasurementLastChangeTime=-1e3}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return"globe"}get shaderDefine(){return"#define GLOBE"}get shaderPreludeCode(){return ia.projectionGlobe}get vertexShaderPreludeCode(){return ia.projectionMercator.vertexSource}get subdivisionGranularity(){return aa}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(e){this._errorMeasurement||(this._errorMeasurement=new _s(e));const i=o.U(this._errorQueryLatitudeDegrees),n=2*Math.atan(Math.exp(Math.PI-i*Math.PI*2))-.5*Math.PI,l=this._errorMeasurement.updateErrorLoop(i,n),h=De.now();l!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=l,this._errorMeasurementLastChangeTime=h);const m=Math.min(Math.max((h-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=o.bj(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,o.bk(m))}_getMeshKey(e){return`${e.granularity.toString(36)}_${e.generateBorders?"b":""}${e.extendToNorthPole?"n":""}${e.extendToSouthPole?"s":""}`}getMeshFromTileID(e,i,n,l,h){const m=(h==="stencil"?aa.stencil:aa.tile).getGranularityForZoomLevel(i.z);return this._getMesh(e,{granularity:m,generateBorders:n,extendToNorthPole:i.y===0&&l,extendToSouthPole:i.y===(1<<i.z)-1&&l})}_getMesh(e,i){const n=this._getMeshKey(i);if(n in this._tileMeshCache)return this._tileMeshCache[n];const l=function(h,m){const _=ol(m,"16bit"),v=o.aK.deserialize({arrayBuffer:_.vertices,length:_.vertices.byteLength/2/2}),S=o.aM.deserialize({arrayBuffer:_.indices,length:_.indices.byteLength/2/3});return new ma(h.createVertexBuffer(v,ga.members),h.createIndexBuffer(S),o.aL.simpleSegment(0,0,v.length,S.length))}(e,i);return this._tileMeshCache[n]=l,l}recalculate(e){}hasTransition(){const e=De.now();let i=!1;return i=i||(e-this._errorMeasurementLastChangeTime)/1e3<.7,i=i||this._errorMeasurement&&this._errorMeasurement.awaitingQuery,i}setErrorQueryLatitudeDegrees(e){this._errorQueryLatitudeDegrees=e}}const kc=new o.r({type:new o.D(o.v.projection.type)});class an extends o.E{constructor(e){super(),this._transitionable=new o.t(kc),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new o.F(0)),this._mercatorProjection=new sl,this._verticalPerspectiveProjection=new Pc}get transitionState(){const e=this.properties.get("type");if(typeof e=="string"&&e==="mercator")return 0;if(typeof e=="string"&&e==="vertical-perspective")return 1;if(e instanceof o.bl){if(e.from==="vertical-perspective"&&e.to==="mercator")return 1-e.transition;if(e.from==="mercator"&&e.to==="vertical-perspective")return e.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(e){this._mercatorProjection.updateGPUdependent(e),this._verticalPerspectiveProjection.updateGPUdependent(e)}getMeshFromTileID(e,i,n,l,h){return this.currentProjection.getMeshFromTileID(e,i,n,l,h)}setProjection(e){this._transitionable.setValue("type",(e==null?void 0:e.type)||"mercator")}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}setErrorQueryLatitudeDegrees(e){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(e),this._mercatorProjection.setErrorQueryLatitudeDegrees(e)}}function sn(u){const e=ys(u.worldSize,u.center.lat);return 2*Math.PI*e}function Gi(u,e,i,n,l){const h=1/(1<<l),m=e/o.$*h+n*h,_=o.bn((u/o.$*h+i*h)*Math.PI*2+Math.PI,2*Math.PI),v=2*Math.atan(Math.exp(Math.PI-m*Math.PI*2))-.5*Math.PI,S=Math.cos(v),I=new Float64Array(3);return I[0]=Math.sin(_)*S,I[1]=Math.sin(v),I[2]=Math.cos(_)*S,I}function zr(u){return function(e,i){const n=Math.cos(i),l=new Float64Array(3);return l[0]=Math.sin(e)*n,l[1]=Math.sin(i),l[2]=Math.cos(e)*n,l}(u.lng*Math.PI/180,u.lat*Math.PI/180)}function ys(u,e){return u/(2*Math.PI)/Math.cos(e*Math.PI/180)}function nn(u){const e=Math.asin(u[1])/Math.PI*180,i=Math.sqrt(u[0]*u[0]+u[2]*u[2]);if(i>1e-6){const n=u[0]/i,l=Math.acos(u[2]/i),h=(n>0?l:-l)/Math.PI*180;return new o.S(o.aN(h,-180,180),e)}return new o.S(0,e)}function xs(u){return Math.cos(u*Math.PI/180)}function _r(u,e){const i=xs(u),n=xs(e);return o.aj(n/i)}function on(u,e){const i=u.rotate(e.bearingInRadians),n=e.zoom+_r(e.center.lat,0),l=o.bj(1/xs(e.center.lat),1/xs(Math.min(Math.abs(e.center.lat),60)),o.bm(n,7,3,0,1)),h=360/sn({worldSize:e.worldSize,center:{lat:e.center.lat}});return new o.S(e.center.lng-i.x*h*l,o.ag(e.center.lat+i.y*h,-o.ah,o.ah))}function vs(u){const e=.5*u,i=Math.sin(e),n=Math.cos(e);return Math.log(i+n)-Math.log(n-i)}function bs(u,e,i,n){const l=u.lat+i*n;if(Math.abs(i)>1){const h=(Math.sign(u.lat+i)!==Math.sign(u.lat)?-Math.abs(u.lat):Math.abs(u.lat))*Math.PI/180,m=Math.abs(u.lat+i)*Math.PI/180,_=vs(h+n*(m-h)),v=vs(h),S=vs(m);return new o.S(u.lng+e*((_-v)/(S-v)),l)}return new o.S(u.lng+e*n,l)}class Ku{constructor(e){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=e}swapBuffers(){if(!this._hadAnyChanges)return;const e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(e,i,n,l){const h=`${e.z}_${e.x}_${e.y}_${l!=null&&l.terrain?"t":""}`,m=this._cache.get(h);if(m)return m;const _=this._cachePrevious.get(h);if(_)return this._cache.set(h,_),_;const v=this._boundingVolumeFactory(e,i,n,l);return this._cache.set(h,v),this._hadAnyChanges=!0,v}}class Pa{constructor(e,i,n,l){this.min=n,this.max=l,this.points=e,this.planes=i}static fromAabb(e,i){const n=[];for(let l=0;l<8;l++)n.push([1&~l?e[0]:i[0],(l>>1&1)==1?i[1]:e[1],(l>>2&1)==1?i[2]:e[2]]);return new Pa(n,[[-1,0,0,i[0]],[1,0,0,-e[0]],[0,-1,0,i[1]],[0,1,0,-e[1]],[0,0,-1,i[2]],[0,0,1,-e[2]]],e,i)}static fromCenterSizeAngles(e,i,n){const l=o.bq([],n[0],n[1],n[2]),h=o.br([],[i[0],0,0],l),m=o.br([],[0,i[1],0],l),_=o.br([],[0,0,i[2]],l),v=[...e],S=[...e];for(let k=0;k<8;k++)for(let P=0;P<3;P++){const D=e[P]+h[P]*(1&~k?-1:1)+m[P]*((k>>1&1)==1?1:-1)+_[P]*((k>>2&1)==1?1:-1);v[P]=Math.min(v[P],D),S[P]=Math.max(S[P],D)}const I=[];for(let k=0;k<8;k++){const P=[...e];o.aR(P,P,o.aQ([],h,1&~k?-1:1)),o.aR(P,P,o.aQ([],m,(k>
739>1&1)==1?1:-1)),o.aR(P,P,o.aQ([],_,(k>>2&1)==1?1:-1)),I.push(P)}return new Pa(I,[[...h,-o.aW(h,I[0])],[...m,-o.aW(m,I[0])],[..._,-o.aW(_,I[0])],[-h[0],-h[1],-h[2],-o.aW(h,I[7])],[-m[0],-m[1],-m[2],-o.aW(m,I[7])],[-_[0],-_[1],-_[2],-o.aW(_,I[7])]],v,S)}intersectsFrustum(e){let i=!0;const n=this.points.length,l=this.planes.length,h=e.planes.length,m=e.points.length;for(let _=0;_<h;_++){const v=e.planes[_];let S=0;for(let I=0;I<n;I++){const k=this.points[I];v[0]*k[0]+v[1]*k[1]+v[2]*k[2]+v[3]>=0&&S++}if(S===0)return 0;S<n&&(i=!1)}if(i)return 2;for(let _=0;_<l;_++){const v=this.planes[_];let S=0;for(let I=0;I<m;I++){const k=e.points[I];v[0]*k[0]+v[1]*k[1]+v[2]*k[2]+v[3]>=0&&S++}if(S===0)return 0}return 1}intersectsPlane(e){const i=this.points.length;let n=0;for(let l=0;l<i;l++){const h=this.points[l];e[0]*h[0]+e[1]*h[1]+e[2]*h[2]+e[3]>=0&&n++}return n===i?2:n===0?0:1}}function ln(u,e,i){const n=u-e;return n<0?-n:Math.max(0,n-i)}function ll(u,e,i,n,l){const h=u-i;let m;return m=h<0?Math.min(-h,1+h-l):h>1?Math.min(Math.max(h-l,0),1-h):0,Math.max(m,ln(e,n,l))}class Ju{constructor(){this._boundingVolumeCache=new Ku(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(e,i,n,l){const h=1<<n.z,m=1/h,_=n.x/h,v=n.y/h;let S=2;return S=Math.min(S,ll(e,i,_,v,m)),S=Math.min(S,ll(e,i,_+.5,-v-m,m)),S=Math.min(S,ll(e,i,_+.5,2-v-m,m)),S}getWrap(e,i,n){const l=1<<i.z,h=1/l,m=i.x/l,_=ln(e.x,m,h),v=ln(e.x,m-1,h),S=ln(e.x,m+1,h),I=Math.min(_,v,S);return I===S?1:I===v?-1:0}allowVariableZoom(e,i){return Ce(e,i)>4}allowWorldCopies(){return!1}getTileBoundingVolume(e,i,n,l){return this._boundingVolumeCache.getTileBoundingVolume(e,i,n,l)}_computeTileBoundingVolume(e,i,n,l){var h,m;let _=n,v=n;if(l!=null&&l.terrain){const S=new o.Z(e.z,i,e.z,e.x,e.y),I=l.terrain.getMinMaxElevation(S);_=(h=I.minElevation)!==null&&h!==void 0?h:n,v=(m=I.maxElevation)!==null&&m!==void 0?m:n}if(_/=o.bt,v/=o.bt,_+=1,v+=1,e.z<=0)return Pa.fromAabb([-v,-v,-v],[v,v,v]);if(e.z===1)return Pa.fromAabb([e.x===0?-v:0,e.y===0?0:-v,-v],[e.x===0?0:v,e.y===0?v:0,v]);{const S=[Gi(0,0,e.x,e.y,e.z),Gi(o.$,0,e.x,e.y,e.z),Gi(o.$,o.$,e.x,e.y,e.z),Gi(0,o.$,e.x,e.y,e.z)],I=[];for(const ge of S)I.push(o.aQ([],ge,v));if(v!==_)for(const ge of S)I.push(o.aQ([],ge,_));e.y===0&&I.push([0,1,0]),e.y===(1<<e.z)-1&&I.push([0,-1,0]);const k=[1,1,1],P=[-1,-1,-1];for(const ge of I)for(let ve=0;ve<3;ve++)k[ve]=Math.min(k[ve],ge[ve]),P[ve]=Math.max(P[ve],ge[ve]);const D=Gi(o.$/2,o.$/2,e.x,e.y,e.z),O=o.aV([],[0,1,0],D);o.aU(O,O);const G=o.aV([],D,O);o.aU(G,G);const q=o.aV([],S[2],S[1]);o.aU(q,q);const H=o.aV([],S[0],S[3]);o.aU(H,H),I.push(o.aQ([],D,v)),e.y>=(1<<e.z)/2&&I.push(o.aQ([],Gi(o.$/2,0,e.x,e.y,e.z),v)),e.y<(1<<e.z)/2&&I.push(o.aQ([],Gi(o.$/2,o.$,e.x,e.y,e.z),v));const X=ai(D,I),ee=ai(G,I),Y=[-D[0],-D[1],-D[2],X.max],re=[D[0],D[1],D[2],-X.min],ae=[-G[0],-G[1],-G[2],ee.max],K=[G[0],G[1],G[2],-ee.min],le=[...q,0],xe=[...H,0],me=[];return e.y===0?me.push(o.bs(xe,le,Y),o.bs(xe,le,re)):me.push(o.bs(ae,le,Y),o.bs(ae,le,re),o.bs(ae,xe,Y),o.bs(ae,xe,re)),e.y===(1<<e.z)-1?me.push(o.bs(xe,le,Y),o.bs(xe,le,re)):me.push(o.bs(K,le,Y),o.bs(K,le,re),o.bs(K,xe,Y),o.bs(K,xe,re)),new Pa(me,[Y,re,ae,K,le,xe],k,P)}}}function ai(u,e){let i=1/0,n=-1/0;for(const l of e){const h=o.aW(u,l);i=Math.min(i,h),n=Math.max(n,h)}return{min:i,max:n}}class ws{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,i,n){return this._helper.interpolatePadding(e,i,n)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,i){this._helper.resize(e,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}
739overrideNearFarZ(e,i){this._helper.overrideNearFarZ(e,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e){}constructor(){this._cachedClippingPlane=o.bu(),this._projectionMatrix=o.b8(),this._globeViewProjMatrix32f=o.b7(),this._globeViewProjMatrixNoCorrection=o.b8(),this._globeViewProjMatrixNoCorrectionInverted=o.b8(),this._globeProjMatrixInverted=o.b8(),this._cameraPosition=o.bo(),this._globeLatitudeErrorCorrectionRadians=0,this._helper=new rn({calcMatrices:()=>{this._calcMatrices()},getConstrained:(e,i)=>this.getConstrained(e,i)}),this._coveringTilesDetailsProvider=new Ju}clone(){const e=new ws;return e.apply(this),e}apply(e,i){this._globeLatitudeErrorCorrectionRadians=i||0,this._helper.apply(e)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){const e=o.bo();return e[0]=this._cameraPosition[0],e[1]=this._cameraPosition[1],e[2]=this._cameraPosition[2],e}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(e){const{overscaledTileID:i,applyGlobeMatrix:n}=e,l=this._helper.getMercatorTileCoordinates(i);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:l,clippingPlane:this._cachedClippingPlane,projectionTransition:n?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(e){const i=this.pitchInRadians,n=this.cameraToCenterDistance/e,l=Math.sin(i)*n,h=Math.cos(i)*n+1,m=1/Math.sqrt(l*l+h*h)*1;let _=-l,v=h;const S=Math.sqrt(_*_+v*v);_/=S,v/=S;const I=[0,_,v];o.bv(I,I,[0,0,0],-this.bearingInRadians),o.bw(I,I,[0,0,0],-1*this.center.lat*Math.PI/180),o.bx(I,I,[0,0,0],this.center.lng*Math.PI/180);const k=1/o.aY(I);return o.aQ(I,I,k),[...I,-m*k]}isLocationOccluded(e){return!this.isSurfacePointVisible(zr(e))}transformLightDirection(e){const i=this._helper._center.lng*Math.PI/180,n=this._helper._center.lat*Math.PI/180,l=Math.cos(n),h=[Math.sin(i)*l,Math.sin(n),Math.cos(i)*l],m=[h[2],0,-h[0]],_=[0,0,0];o.aV(_,m,h),o.aU(m,m),o.aU(_,_);const v=[0,0,0];return o.aU(v,[m[0]*e[0]+_[0]*e[1]+h[0]*e[2],m[1]*e[0]+_[1]*e[1]+h[1]*e[2],m[2]*e[0]+_[2]*e[1]+h[2]*e[2]]),v}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(e,i,n){const l=function(_,v,S){const I=1/(1<<S.z);return new o.a0(_/o.$*I+S.x*I,v/o.$*I+S.y*I)}(e,i,n.canonical),h=(m=l.y,[o.bn(l.x*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-m*Math.PI*2))-.5*Math.PI]);var m;return this.getCircleRadiusCorrection()/Math.cos(h[1])}projectTileCoordinates(e,i,n,l){const h=n.canonical,m=Gi(e,i,h.x,h.y,h.z),_=1+(l?l(e,i):0)/o.bt,v=[m[0]*_,m[1]*_,m[2]*_,1];o.av(v,v,this._globeViewProjMatrixNoCorrection);const S=this._cachedClippingPlane,I=S[0]*m[0]+S[1]*m[1]+S[2]*m[2]+S[3]<0;return{point:new o.P(v[0]/v[3],v[1]/v[3]),signedDistanceFromCamera:v[3],isOccluded:I}}
739_calcMatrices(){if(!this._helper._width||!this._helper._height)return;const e=ys(this.worldSize,this.center.lat),i=o.b9(),n=o.b9();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*e),o.b3(i,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);const l=this.centerOffset;i[8]=2*-l.x/this._helper._width,i[9]=2*l.y/this._helper._height,this._projectionMatrix=o.b4(i),this._globeProjMatrixInverted=o.b9(),o.ap(this._globeProjMatrixInverted,i),o.M(i,i,[0,0,-this.cameraToCenterDistance]),o.b5(i,i,this.rollInRadians),o.b6(i,i,-this.pitchInRadians),o.b5(i,i,this.bearingInRadians),o.M(i,i,[0,0,-e]);const h=o.bo();h[0]=e,h[1]=e,h[2]=e,o.b6(n,i,this.center.lat*Math.PI/180),o.by(n,n,-this.center.lng*Math.PI/180),o.N(n,n,h),this._globeViewProjMatrixNoCorrection=n,o.b6(i,i,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),o.by(i,i,-this.center.lng*Math.PI/180),o.N(i,i,h),this._globeViewProjMatrix32f=new Float32Array(i),this._globeViewProjMatrixNoCorrectionInverted=o.b9(),o.ap(this._globeViewProjMatrixNoCorrectionInverted,n);const m=o.bo();this._cameraPosition=o.bo(),this._cameraPosition[2]=this.cameraToCenterDistance/e,o.bv(this._cameraPosition,this._cameraPosition,m,-this.rollInRadians),o.bw(this._cameraPosition,this._cameraPosition,m,this.pitchInRadians),o.bv(this._cameraPosition,this._cameraPosition,m,-this.bearingInRadians),o.aR(this._cameraPosition,this._cameraPosition,[0,0,1]),o.bw(this._cameraPosition,this._cameraPosition,m,-this.center.lat*Math.PI/180),o.bx(this._cameraPosition,this._cameraPosition,m,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(e);const _=o.b4(this._globeViewProjMatrixNoCorrectionInverted);o.N(_,_,[1,1,-1]),this._cachedFrustum=Jr.fromInvProjectionMatrix(_,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(e){o.w("calculateFogMatrix is not supported on globe projection.");const i=o.b9();return o.af(i),i}getVisibleUnwrappedCoordinates(e){return[new o.b1(0,e)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){e&&o.w("terrain is not fully supported on vertical perspective projection."),this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(e,i){if(!this._globeViewProjMatrixNoCorrection)return 1;const n=zr(e);o.aQ(n,n,1+i/o.bt);const l=o.bu();return o.av(l,[n[0],n[1],n[2],1],this._globeViewProjMatrixNoCorrection),l[2]/l[3]}populateCache(e){}getBounds(){const e=.5*this.width,i=.5*this.height,n=[new o.P(0,0),new o.P(e,0),new o.P(this.width,0),new o.P(this.width,i),new o.P(this.width,this.height),new o.P(e,this.height),new o.P(0,this.height),new o.P(0,i)],l=[];for(const k of n)l.push(this.unprojectScreenPoint(k));let h=0,m=0,_=0,v=0;const S=this.center;for(const k of l){const P=o.bz(S.lng,k.lng),D=o.bz(S.lat,k.lat);P<m&&(m=P),P>h&&(h=P),D<v&&(v=D),D>_&&(_=D)}const I=[S.lng+m,S.lat+v,S.lng+h,S.lat+_];return this.isSurfacePointOnScreen([0,1,0])&&(I[3]=90,I[0]=-180,I[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(I[1]=-90,I[0]=-180,I[2]=180),new It(I)}getConstrained(e,i){const n=o.ag(e.lat,-o.ah,o.ah),l=o.ag(+i,this.minZoom+_r(0,n),this.maxZoom);return{center:new o.S(e.lng,n),zoom:l}}calculateCenterFromCameraLngLatAlt(e,i,n,l){return this._helper.calculateCenterFromCameraLngLatAlt(e,i,n,l)}setLocationAtPoint(e,i){const n=zr(this.unprojectScreenPoint(i)),l=zr(e),h=o.bo();o.bA(h);const m=o.bo();o.bx(m,n,h,-this.center.lng*Math.PI/180),o.bw(m,m,h,this.center.lat*Math.PI/180);const _=l[0]*l[0]+l[2]*l[2],v=m[0]*m[0];if(_<v)return;const S=Math.sqrt(_-v),I=-S,k=o.bB(l[0],l[2],m[0],S),P=o.bB(l[0],l[2],m[0],I),D=o.bo();o.bx(D,l,h,-k);const O=o.bB(D[1],D[2],m[1],m[2]),G=o.bo();o.bx(G,l,h,-P);const q=o.bB(G[1],G[2],m[1],m[2]),H=.5*Math.PI,X=O>=-H&&O<=H,ee=q>=-H&&q<=H;let Y,re;if(X&&ee){const xe=this.center.lng*Math.PI/180,me=this.center.lat*Math.PI/180;o.bC(k,xe)+o.bC(O,me)<o.bC(P,xe)+o.bC(q,me)?(Y=k,re=O):(Y=P,re=q)}else if(X)Y=k,re=O;else{if(!ee)return;Y=P,re=q}const ae=Y/Math.PI*180,K=re/Math.PI*180,le=this.center.lat;this.setCenter(new o.S(ae,o.ag(K,-90,90))),this.setZoom(this.zoom+_r(le,this.center.lat))}locationToScreenPoint(e,i){const n=zr(e);if(i){const l=i.getElevationForLngLatZoom(e,this._helper._tileZoom);o.aQ(n,n,1+l/o.bt)}return this._projectSurfacePointToScreen(n)}_projectSurfacePointToScreen(e){const i=o.bu();return o.av(i,[...e,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],new o.P((.5*i[0]+.5)*this.width,(.5*-i[1]+.5)*this.height)}screenPointToMercatorCoordinate(e,i){if(i){const n=i.pointCoordinate(e);if(n)return n}return o.a0.fromLngLat(this.unprojectScreenPoint(e))}screenPointToLocation(e,i){var n;return(n=this.screenPointToMercatorCoordinate(e,i))===null||n===void 0?void 0:n.toLngLat()}
739isPointOnMapSurface(e,i){const n=this._cameraPosition,l=this.getRayDirectionFromPixel(e);return!!this.rayPlanetIntersection(n,l)}getRayDirectionFromPixel(e){const i=o.bu();i[0]=e.x/this.width*2-1,i[1]=-1*(e.y/this.height*2-1),i[2]=1,i[3]=1,o.av(i,i,this._globeViewProjMatrixNoCorrectionInverted),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3];const n=o.bo();n[0]=i[0]-this._cameraPosition[0],n[1]=i[1]-this._cameraPosition[1],n[2]=i[2]-this._cameraPosition[2];const l=o.bo();return o.aU(l,n),l}isSurfacePointVisible(e){const i=this._cachedClippingPlane;return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]>=0}isSurfacePointOnScreen(e){if(!this.isSurfacePointVisible(e))return!1;const i=o.bu();return o.av(i,[...e,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3],i[0]>-1&&i[0]<1&&i[1]>-1&&i[1]<1&&i[2]>-1&&i[2]<1}rayPlanetIntersection(e,i){const n=o.aW(e,i),l=o.bo(),h=o.bo();o.aQ(h,i,n),o.aT(l,e,h);const m=1-o.aW(l,l);if(m<0)return null;const _=o.aW(e,e)-1,v=-n+(n<0?1:-1)*Math.sqrt(m),S=_/v,I=v;return{tMin:Math.min(S,I),tMax:Math.max(S,I)}}unprojectScreenPoint(e){const i=this._cameraPosition,n=this.getRayDirectionFromPixel(e),l=this.rayPlanetIntersection(i,n);if(l){const I=o.bo();o.aR(I,i,[n[0]*l.tMin,n[1]*l.tMin,n[2]*l.tMin]);const k=o.bo();return o.aU(k,I),nn(k)}const h=this._cachedClippingPlane,m=h[0]*n[0]+h[1]*n[1]+h[2]*n[2],_=-o.b0(h,i)/m,v=o.bo();if(_>0)o.aR(v,i,[n[0]*_,n[1]*_,n[2]*_]);else{const I=o.bo();o.aR(I,i,[2*n[0],2*n[1],2*n[2]]);const k=o.b0(this._cachedClippingPlane,I);o.aT(v,I,[this._cachedClippingPlane[0]*k,this._cachedClippingPlane[1]*k,this._cachedClippingPlane[2]*k])}const S=function(I){const k=o.bo();return k[0]=I[0]*-I[3],k[1]=I[1]*-I[3],k[2]=I[2]*-I[3],{center:k,radius:Math.sqrt(1-I[3]*I[3])}}(h);return nn(function(I,k,P){const D=o.bo();o.aT(D,P,I);const O=o.bo();return o.bp(O,I,D,k/o.a_(D)),O}(S.center,S.radius,v))}getMatrixForModel(e,i){const n=o.S.convert(e),l=1/o.bt,h=o.b8();return o.by(h,h,n.lng/180*Math.PI),o.b6(h,h,-n.lat/180*Math.PI),o.M(h,h,[0,0,1+i/o.bt]),o.b6(h,h,.5*Math.PI),o.N(h,h,[l,l,l]),h}getProjectionDataForCustomLayer(e=!0){const i=this.getProjectionData({overscaledTileID:new o.Z(0,0,0,0,0),applyGlobeMatrix:e});return i.tileMercatorCoords=[0,0,1,1],i}getFastPathSimpleProjectionMatrix(e){}}class bi{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,i,n){return this._helper.interpolatePadding(e,i,n)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,i,n=!0){this._helper.resize(e,i,n)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,i){this._helper.overrideNearFarZ(e,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(e,i){this._globeness=e,this._globeLatitudeErrorCorrectionRadians=i,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this._helper=new rn({calcMatrices:()=>{this._calcMatrices()},getConstrained:(e,i)=>this.getConstrained(e,i)}),this._globeness=1,this._mercatorTransform=new gr,this._verticalPerspectiveTransform=new ws}clone(){const e=new bi;return e._globeness=this._globeness,e._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,e.apply(this),e}apply(e){this._helper.apply(e),this._mercatorTransform.apply(this),this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(e){const i=this._mercatorTransform.getProjectionData(e),n=this._verticalPerspectiveTransform.getProjectionData(e);return{mainMatrix:this.isGlobeRendering?n.mainMatrix:i.mainMatrix,clippingPlane:n.clippingPlane,tileMercatorCoords:n.tileMercatorCoords,projectionTransition:e.applyGlobeMatrix?this._globeness:0,fallbackMatrix:i.fallbackMatrix}}isLocationOccluded(e){return this.currentTransform.isLocationOccluded(e)}transformLightDirection(e){return this.currentTransform.transformLightDirection(e)}getPixelScale(){return o.bj(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return o.bj(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(e,i,n){const l=this._mercatorTransform.getPitchedTextCorrection(e,i,n),h=this._verticalPerspectiveTransform.getPitchedTextCorrection(e,i,n);return o.bj(l,h,this._globeness)}projectTileCoordinates(e,i,n,l){return this.currentTransform.projectTileCoordinates(e,i,n,l)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(e){return this.currentTransform.calculateFogMatrix(e)}getVisibleUnwrappedCoordinates(e){return this.currentTransform.getVisibleUnwrappedCoordinates(e)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(e){this._mercatorTransform.recalculateZoomAndCenter(e),this._verticalPerspectiveTransform.recalculateZoomAndCenter(e)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(e,i){return this.currentTransform.lngLatToCameraDepth(e,i)}populateCache(e){this._mercatorTransform.populateCache(e),this._verticalPerspectiveTransform.populateCache(e)}getBounds(){return this.currentTransform.getBounds()}getConstrained(e,i){return this.currentTransform.getConstrained(e,i)}calculateCenterFromCameraLngLatAlt(e,i,n,l){return this._helper.calculateCenterFromCameraLngLatAlt(e,i,n,l)}setLocationAtPoint(e,i){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(e,i),void this.apply(this._mercatorTransform);this._verticalPerspectiveTransform.setLocationAtPoint(e,i),this.apply(this._verticalPerspectiveTransform)}locationToScreenPoint(e,i){return this.currentTransform.locationToScreenPoint(e,i)}screenPointToMercatorCoordinate(e,i){return this.currentTransform.screenPointToMercatorCoordinate(e,i)}screenPointToLocation(e,i){return this.currentTransform.screenPointToLocation(e,i)}
739isPointOnMapSurface(e,i){return this.currentTransform.isPointOnMapSurface(e,i)}getRayDirectionFromPixel(e){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(e)}getMatrixForModel(e,i){return this.currentTransform.getMatrixForModel(e,i)}getProjectionDataForCustomLayer(e=!0){const i=this._mercatorTransform.getProjectionDataForCustomLayer(e);if(!this.isGlobeRendering)return i;const n=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(e);return n.fallbackMatrix=i.mainMatrix,n}getFastPathSimpleProjectionMatrix(e){return this.currentTransform.getFastPathSimpleProjectionMatrix(e)}}class di{get useGlobeControls(){return!0}handlePanInertia(e,i){const n=on(e,i);return Math.abs(n.lng-i.center.lng)>180&&(n.lng=i.center.lng+179.5*Math.sign(n.lng-i.center.lng)),{easingCenter:n,easingOffset:new o.P(0,0)}}handleMapControlsRollPitchBearingZoom(e,i){const n=e.around,l=i.screenPointToLocation(n);e.bearingDelta&&i.setBearing(i.bearing+e.bearingDelta),e.pitchDelta&&i.setPitch(i.pitch+e.pitchDelta),e.rollDelta&&i.setRoll(i.roll+e.rollDelta);const h=i.zoom;e.zoomDelta&&i.setZoom(i.zoom+e.zoomDelta);
739const m=i.zoom-h;if(m===0)return;const _=o.bz(i.center.lng,l.lng),v=_/(Math.abs(_/180)+1),S=o.bz(i.center.lat,l.lat),I=i.getRayDirectionFromPixel(n),k=i.cameraPosition,P=-1*o.aW(k,I),D=o.bo();o.aR(D,k,[I[0]*P,I[1]*P,I[2]*P]);const O=o.aY(D)-1,G=Math.exp(.5*-Math.max(O-.3,0)),q=ys(i.worldSize,i.center.lat)/Math.min(i.width,i.height),H=o.bm(q,.9,.5,1,.25),X=(1-o.ae(-m))*Math.min(G,H),ee=i.center.lat,Y=i.zoom,re=new o.S(i.center.lng+v*X,o.ag(i.center.lat+S*X,-o.ah,o.ah));i.setLocationAtPoint(l,n);const ae=i.center,K=o.bm(Math.abs(_),45,85,0,1),le=o.bm(q,.75,.35,0,1),xe=Math.pow(Math.max(K,le),.25),me=o.bz(ae.lng,re.lng),ge=o.bz(ae.lat,re.lat);i.setCenter(new o.S(ae.lng+me*xe,ae.lat+ge*xe).wrap()),i.setZoom(Y+_r(ee,i.center.lat))}handleMapControlsPan(e,i,n){if(!e.panDelta)return;const l=i.center.lat,h=i.zoom;i.setCenter(on(e.panDelta,i).wrap()),i.setZoom(h+_r(l,i.center.lat))}cameraForBoxAndBearing(e,i,n,l,h){const m=Kt(e,i,n,l,h),_=i.left/h.width*2-1,v=(h.width-i.right)/h.width*2-1,S=i.top/h.height*-2+1,I=(h.height-i.bottom)/h.height*-2+1,k=o.bz(n.getWest(),n.getEast())<0,P=k?n.getEast():n.getWest(),D=k?n.getWest():n.getEast(),O=Math.max(n.getNorth(),n.getSouth()),G=Math.min(n.getNorth(),n.getSouth()),q=P+.5*o.bz(P,D),H=O+.5*o.bz(O,G),X=h.clone();X.setCenter(m.center),X.setBearing(m.bearing),X.setPitch(0),X.setRoll(0),X.setZoom(m.zoom);const ee=X.modelViewProjectionMatrix,Y=[zr(n.getNorthWest()),zr(n.getNorthEast()),zr(n.getSouthWest
739()),zr(n.getSouthEast()),zr(new o.S(D,H)),zr(new o.S(P,H)),zr(new o.S(q,O)),zr(new o.S(q,G))],re=zr(m.center);let ae=Number.POSITIVE_INFINITY;for(const K of Y)_<0&&(ae=di.getLesserNonNegativeNonNull(ae,di.solveVectorScale(K,re,ee,"x",_))),v>0&&(ae=di.getLesserNonNegativeNonNull(ae,di.solveVectorScale(K,re,ee,"x",v))),S>0&&(ae=di.getLesserNonNegativeNonNull(ae,di.solveVectorScale(K,re,ee,"y",S))),I<0&&(ae=di.getLesserNonNegativeNonNull(ae,di.solveVectorScale(K,re,ee,"y",I)));if(Number.isFinite(ae)&&ae!==0)return m.zoom=X.zoom+o.aj(ae),m;Qr()}handleJumpToCenterZoom(e,i){const n=e.center.lat,l=e.getConstrained(i.center?o.S.convert(i.center):e.center,e.zoom).center;e.setCenter(l.wrap());const h=i.zoom!==void 0?+i.zoom:e.zoom+_r(n,l.lat);e.zoom!==h&&e.setZoom(h)}handleEaseTo(e,i){const n=e.zoom,l=e.center,h=e.padding,m={roll:e.roll,pitch:e.pitch,bearing:e.bearing},_={roll:i.roll===void 0?e.roll:i.roll,pitch:i.pitch===void 0?e.pitch:i.pitch,bearing:i.bearing===void 0?e.bearing:i.bearing},v=i.zoom!==void 0,S=!e.isPaddingEqual(i.padding);let I=!1;const k=i.center?o.S.convert(i.center):l,P=e.getConstrained(k,n).center;_a(e,P);const D=e.clone();D.setCenter(P),D.setZoom(v?+i.zoom:n+_r(l.lat,k.lat)),D.setBearing(i.bearing);const O=new o.P(o.ag(e.centerPoint.x+i.offsetAsPoint.x,0,e.width),o.ag(e.centerPoint.y+i.offsetAsPoint.y,0,e.height));D.setLocationAtPoint(P,O);const G=(i.offset&&i.offsetAsPoint.mag())>0?D.center:P,q=v?+i.zoom:n+_r(l.lat,G.lat),H=n+_r(l.lat,0),X=q+_r(G.lat,0),ee=o.bz(l.lng,G.lng),Y=o.bz(l.lat,G.lat),re=o.ae(X-H);return I=q!==n,{easeFunc:ae=>{if(o.bd(m,_)||Er({startEulerAngles:m,endEulerAngles:_,tr:e,k:ae,useSlerp:m.roll!=_.roll}),S&&e.interpolatePadding(h,i.padding,ae),i.around)o.w("Easing around a point is not supported under globe projection."),e.setLocationAtPoint(i.around,i.aroundPoint);else{const K=X>H?Math.min(2,re):Math.max(.5,re),le=Math.pow(K,1-ae),xe=bs(l,ee,Y,ae*le);e.setCenter(xe.wrap())}if(I){const K=o.C.number(H,X,ae)+_r(0,e.center.lat);e.setZoom(K)}},isZooming:I,elevationCenter:G}}handleFlyTo(e,i){const n=i.zoom!==void 0,l=e.center,h=e.zoom,m=e.padding,_=!e.isPaddingEqual(i.padding),v=e.getConstrained(o.S.convert(i.center||i.locationAtOffset),h).center,S=n?+i.zoom:e.zoom+_r(e.center.lat,v.lat),I=e.clone();I.setCenter(v),I.setZoom(S),I.setBearing(i.bearing);const k=new o.P(o.ag(e.centerPoint.x+i.offsetAsPoint.x,0,e.width),o.ag(e.centerPoint.y+i.offsetAsPoint.y,0,e.height));I.setLocationAtPoint(v,k);const P=I.center;_a(e,P);const D=function(Y,re,ae){const K=zr(re),le=zr(ae),xe=o.aW(K,le),me=Math.acos(xe),ge=sn(Y);return me/(2*Math.PI)*ge}(e,l,P),O=h+_r(l.lat,0),G=S+_r(P.lat,0),q=o.ae(G-O);let H;if(typeof i.minZoom=="number"){const Y=+i.minZoom+_r(P.lat,0),re=Math.min(Y,O,G)+_r(0,P.lat),ae=e.getConstrained(P,re).zoom+_r(P.lat,0);H=o.ae(ae-O)}const X=o.bz(l.lng,P.lng),ee=o.bz(l.lat,P.lat);return{easeFunc:(Y,re,ae,K)=>{const le=bs(l,X,ee,ae);_&&e.interpolatePadding(m,i.padding,Y);const xe=Y===1?P:le;e.setCenter(xe.wrap());const me=O+o.aj(re);e.setZoom(Y===1?S:me+_r(0,xe.lat))},scaleOfZoom:q,targetCenter:P,scaleOfMinZoom:H,pixelPathLength:D}}static solveVectorScale(e,i,n,l,h){const m=l==="x"?[n[0],n[4],n[8],n[12]]:[n[1],n[5],n[9],n[13]],_=[n[3],n[7],n[11],n[15]],v=e[0]*m[0]+e[1]*m[1]+e[2]*m[2],S=e[0]*_[0]+e[1]*_[1]+e[2]*_[2],I=i[0]*m[0]+i[1]*m[1]+i[2]*m[2],k=i[0]*_[0]+i[1]*_[1]+i[2]*_[2];return I+h*S===v+h*k||_[3]*(v-I)+m[3]*(k-S)+v*k==I*S?null:(I+m[3]-h*k-h*_[3])/(I-v-h*k+h*S)}static getLesserNonNegativeNonNull(e,i){return i!==null&&i>=0&&i<e?i:e}}class cl{constructor(e){this._globe=e,this._mercatorCameraHelper=new ro,this._verticalPerspectiveCameraHelper=new di}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(e,i){return this.currentHelper.handlePanInertia(e,i)}handleMapControlsRollPitchBearingZoom(e,i){return this.currentHelper.handleMapControlsRollPitchBearingZoom(e,i)}handleMapControlsPan(e,i,n){this.currentHelper.handleMapControlsPan(e,i,n)}cameraForBoxAndBearing(e,i,n,l,h){return this.currentHelper.cameraForBoxAndBearing(e,i,n,l,h)}handleJumpToCenterZoom(e,i){this.currentHelper.handleJumpToCenterZoom(e,i)}handleEaseTo(e,i){return this.currentHelper.handleEaseTo(e,i)}handleFlyTo(e,i){return this.currentHelper.handleFlyTo(e,i)}}const cn=(u,e)=>o.y(u,e&&e.filter(i=>i.identifier!=="source.canvas")),Ts=o.bD();class ul extends o.E{constructor(e,i={}){super(),this._rtlPluginLoaded=()=>{for(const n in this.sourceCaches){const l=this.sourceCaches[n].getSource().type;l!=="vector"&&l!=="geojson"||this.sourceCaches[n].reload()}},this.map=e,this.dispatcher=new yi(ci(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",(n,l)=>this.getGlyphs(n,l)),this.dispatcher.registerMessageHandler("GI",(n,l)=>this.getImages(n,l)),this.imageManager=new Je,this.imageManager.setEventedParent(this),this.glyphManager=new Lt(e._requestManager,i.localIdeographFontFamily),this.lineAtlas=new Vi(256,512),this.crossTileSymbolIndex=new Qn,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new o.bE,this._loaded=!1,this._availableImages=[],this._globalState={},this._resetUpdates(),this.dispatcher.broadcast("SR",o.bF()),Kr().on(zi,this._rtlPluginLoaded),this.on("data",n=>{if(n.dataType!=="source"||n.sourceDataType!=="metadata")return;const l=this.sourceCaches[n.sourceId];if(!l)return;const h=l.getSource();if(h&&h.vectorLayerIds)for(const m in this._layers){const _=this._layers[m];
739_.source===h.id&&this._validateLayer(_)}})}setGlobalStateProperty(e,i){var n,l,h;this._checkLoaded();const m=i===null?(h=(l=(n=this.stylesheet.state)===null||n===void 0?void 0:n[e])===null||l===void 0?void 0:l.default)!==null&&h!==void 0?h:null:i;if(o.bG(m,this._globalState[e]))return this;this._globalState[e]=m;const _=this._findGlobalStateAffectedSources([e]);for(const v in this.sourceCaches)_.has(v)&&(this._reloadSource(v),this._changed=!0)}getGlobalState(){return this._globalState}setGlobalState(e){this._checkLoaded();const i=[];for(const l in e)!o.bG(this._globalState[l],e[l].default)&&(i.push(l),this._globalState[l]=e[l].default);const n=this._findGlobalStateAffectedSources(i);for(const l in this.sourceCaches)n.has(l)&&(this._reloadSource(l),this._changed=!0)}_findGlobalStateAffectedSources(e){if(e.length===0)return new Set;const i=new Set;for(const n in this._layers){const l=this._layers[n],h=l.getLayoutAffectingGlobalStateRefs();for(const m of e)h.has(m)&&i.add(l.source)}return i}loadURL(e,i={},n){this.fire(new o.l("dataloading",{dataType:"style"})),i.validate=typeof i.validate!="boolean"||i.validate;const l=this.map._requestManager.transformRequest(e,"Style");this._loadStyleRequest=new AbortController;const h=this._loadStyleRequest;o.j(l,this._loadStyleRequest).then(m=>{this._loadStyleRequest=null,this._load(m.data,i,n)}).catch(m=>{this._loadStyleRequest=null,m&&!h.signal.aborted&&this.fire(new o.k(m))})}loadJSON(e,i={},n){this.fire(new o.l("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,De.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,i.validate=i.validate!==!1,this._load(e,i,n)}).catch(()=>{})}loadEmpty(){this.fire(new o.l("dataloading",{dataType:"style"})),this._load(Ts,{validate:!1})}_load(e,i,n){var l,h,m;const _=i.transformStyle?i.transformStyle(n,e):e;if(!i.validate||!cn(this,o.z(_))){this._loaded=!0,this.stylesheet=_;for(const v in _.sources)this.addSource(v,_.sources[v],{validate:!1});_.sprite?this._loadSprite(_.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(_.glyphs),this._createLayers(),this.light=new Ui(this.stylesheet.light),this._setProjectionInternal(((l=this.stylesheet.projection)===null||l===void 0?void 0:l.type)||"mercator"),this.sky=new $i(this.stylesheet.sky),this.map.setTerrain((h=this.stylesheet.terrain)!==null&&h!==void 0?h:null),this.setGlobalState((m=this.stylesheet.state)!==null&&m!==void 0?m:null),this.fire(new o.l("data",{dataType:"style"})),this.fire(new o.l("style.load"))}}_createLayers(){const e=o.bH(this.stylesheet.layers);this.dispatcher.broadcast("SL",e),this._order=e.map(i=>i.id),this._layers={},this._serializedLayers=null;for(const i of e){const n=o.bI(i);n.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=n}}_loadSprite(e,i=!1,n=void 0){let l;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(h,m,_,v){return o._(this,void 0,void 0,function*(){const S=zt(h),I=_>1?"@2x":"",k={},P={};for(const{id:D,url:O}of S){const G=m.transformRequest(fr(O,I,".json"),"SpriteJSON");k[D]=o.j(G,v);const q=m.transformRequest(fr(O,I,".png"),"SpriteImage");P[D]=Bt.getImage(q,v)}return yield Promise.all([...Object.values(k),...Object.values(P)]),function(D,O){return o._(this,void 0,void 0,function*(){const G={};for(const q in D){G[q]={};const H=De.getImageCanvasContext((yield O[q]).data),X=(yield D[q]).data;for(const ee in X){const{width:Y,height:re,x:ae,y:K,sdf:le,pixelRatio:xe,stretchX:me,stretchY:ge,content:ve,textFitWidth:Oe,textFitHeight:Be}=X[ee];G[q][ee]={data:null,pixelRatio:xe,sdf:le,stretchX:me,stretchY:ge,content:ve,textFitWidth:Oe,textFitHeight:Be,spriteData:{width:Y,height:re,x:ae,y:K,context:H}}}}return G})}(k,P)})}(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(h=>{if(this._spriteRequest=null,h)for(const m in h){this._spritesImagesIds[m]=[];const _=this._spritesImagesIds[m]?this._spritesImagesIds[m].filter(v=>!(v in h)):[];for(const v of _)this.imageManager.removeImage(v),this._changedImages[v]=!0;for(const v in h[m]){const S=m==="default"?v:`${m}:${v}`;this._spritesImagesIds[m].push(S),S in this.imageManager.images?this.imageManager.updateImage(S,h[m][v],!1):this.imageManager.addImage(S,h[m][v]),i&&(this._changedImages[S]=!0)}}}).catch(h=>{this._spriteRequest=null,l=h,this.fire(new o.k(l))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),i&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new o.l("data",{dataType:"style"})),n&&n(l)})}_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 o.l("data",{dataType:"style"}))}_validateLayer(e){const i=this.sourceCaches[e.source];if(!i)return;const n=e.sourceLayer;if(!n)return;const l=i.getSource();(l.type==="geojson"||l.vectorLayerIds&&l.vectorLayerIds.indexOf(n)===-1)&&this.fire(new o.k(new Error(`Source layer "${n}" does not exist on source "${l.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,i=!1){const n=this._serializedAllLayers();
739if(!e||e.length===0)return Object.values(i?o.bJ(n):n);const l=[];for(const h of e)if(n[h]){const m=i?o.bJ(n[h]):n[h];l.push(m)}return l}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};const i=Object.keys(this._layers);for(const n of i){const l=this._layers[n];l.type!=="custom"&&(e[n]=l.serialize())}return e}hasTransitions(){var e,i,n;if(!((e=this.light)===null||e===void 0)&&e.hasTransition()||!((i=this.sky)===null||i===void 0)&&i.hasTransition()||!((n=this.projection)===null||n===void 0)&&n.hasTransition())return!0;for(const l in this.sourceCaches)if(this.sourceCaches[l].hasTransition())return!0;for(const l in this._layers)if(this._layers[l].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;const i=this._changed;if(i){const l=Object.keys(this._updatedLayers),h=Object.keys(this._removedLayers);(l.length||h.length)&&this._updateWorkerLayers(l,h);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 n={};for(const l in this.sourceCaches){const h=this.sourceCaches[l];n[l]=h.used,h.used=!1}for(const l of this._order){const h=this._layers[l];h.recalculate(e,this._availableImages),!h.isHidden(e.zoom)&&h.source&&(this.sourceCaches[h.source].used=!0)}for(const l in n){const h=this.sourceCaches[l];!!n[l]!=!!h.used&&h.fire(new o.l("data",{sourceDataType:"visibility",dataType:"source",sourceId:l}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,i&&this.fire(new o.l("data",{dataType:"style"}))}_updateTilesForChangedImages(){const e=Object.keys(this._changedImages);if(e.length){for(const i in this.sourceCaches)this.sourceCaches[i].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,i){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:i})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,i={}){var n;this._checkLoaded();const l=this.serialize();if(e=i.transformStyle?i.transformStyle(l,e):e,((n=i.validate)===null||n===void 0||n)&&cn(this,o.z(e)))return!1;(e=o.bJ(e)).layers=o.bH(e.layers);const h=o.bK(l,e),m=this._getOperationsToPerform(h);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 i=[],n=[];for(const l of e)switch(l.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":i.push(()=>this.addLayer.apply(this,l.args));break;case"removeLayer":i.push(()=>this.removeLayer.apply(this,l.args));break;case"setPaintProperty":i.push(()=>this.setPaintProperty.apply(this,l.args));break;case"setLayoutProperty":i.push(()=>this.setLayoutProperty.apply(this,l.args));break;case"setFilter":i.push(()=>this.setFilter.apply(this,l.args));break;case"addSource":i.push(()=>this.addSource.apply(this,l.args));break;case"removeSource":i.push(()=>this.removeSource.apply(this,l.args));break;case"setLayerZoomRange":i.push(()=>this.setLayerZoomRange.apply(this,l.args));break;case"setLight":i.push(()=>this.setLight.apply(this,l.args));break;case"setGeoJSONSourceData":i.push(()=>this.setGeoJSONSourceData.apply(this,l.args));break;case"setGlyphs":i.push(()=>this.setGlyphs.apply(this,l.args));break;case"setSprite":i.push(()=>this.setSprite.apply(this,l.args));break;case"setTerrain":i.push(()=>this.map.setTerrain.apply(this,l.args));break;case"setSky":i.push(()=>this.setSky.apply(this,l.args));break;case"setProjection":this.setProjection.apply(this,l.args);break;case"setGlobalState":i.push(()=>this.setGlobalState.apply(this,l.args));break;case"setTransition":i.push(()=>{});break;default:n.push(l.command)}return{operations:i,unimplemented:n}}addImage(e,i){if(this.getImage(e))return this.fire(new o.k(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,i),this._afterImageUpdated(e)}updateImage(e,i){this.imageManager.updateImage(e,i)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new o.k(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 o.l("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,i,n={}){if(this._checkLoaded(),this.sourceCaches[e]!==void 0)throw new Error(`Source "${e}" already exists.`);if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Ob
739ject.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(o.z.source,`sources.${e}`,i,null,n))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const l=this.sourceCaches[e]=new Pe(e,i,this.dispatcher);l.style=this,l.setEventedParent(this,()=>({isSourceLoaded:l.loaded(),source:l.serialize(),sourceId:e})),l.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 n in this._layers)if(this._layers[n].source===e)return this.fire(new o.k(new Error(`Source "${e}" cannot be removed while layer "${n}" is using it.`)));const i=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],i.fire(new o.l("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),i.setEventedParent(null),i.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,i){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error(`There is no source with this ID=${e}`);const n=this.sourceCaches[e].getSource();if(n.type!=="geojson")throw new Error(`geojsonSource.type is ${n.type}, which is !== 'geojson`);n.setData(i),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,i,n={}){this._checkLoaded();const l=e.id;if(this.getLayer(l))return void this.fire(new o.k(new Error(`Layer "${l}" already exists on this map.`)));let h;if(e.type==="custom"){if(cn(this,o.bL(e)))return;h=o.bI(e)}else{if("source"in e&&typeof e.source=="object"&&(this.addSource(l,e.source),e=o.bJ(e),e=o.e(e,{source:l})),this._validate(o.z.layer,`layers.${l}`,e,{arrayIndex:-1},n))return;h=o.bI(e),this._validateLayer(h),h.setEventedParent(this,{layer:{id:l}})}const m=i?this._order.indexOf(i):this._order.length;if(i&&m===-1)this.fire(new o.k(new Error(`Cannot add layer "${l}" before non-existing layer "${i}".`)));else{if(this._order.splice(m,0,l),this._layerOrderChanged=!0,this._layers[l]=h,this._removedLayers[l]&&h.source&&h.type!=="custom"){const _=this._removedLayers[l];delete this._removedLayers[l],_.type!==h.type?this._updatedSources[h.source]="clear":(this._updatedSources[h.source]="reload",this.sourceCaches[h.source].pause())}this._updateLayer(h),h.onAdd&&h.onAdd(this.map)}}moveLayer(e,i){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new o.k(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===i)return;const n=this._order.indexOf(e);this._order.splice(n,1);const l=i?this._order.indexOf(i):this._order.length;i&&l===-1?this.fire(new o.k(new Error(`Cannot move layer "${e}" before non-existing layer "${i}".`))):(this._order.splice(l,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();const i=this._layers[e];if(!i)return void this.fire(new o.k(new Error(`Cannot remove non-existing layer "${e}".`)));i.setEventedParent(null);const n=this._order.indexOf(e);this._order.splice(n,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=i,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],i.onRemove&&i.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,i,n){this._checkLoaded();const l=this.getLayer(e);l?l.minzoom===i&&l.maxzoom===n||(i!=null&&(l.minzoom=i),n!=null&&(l.maxzoom=n),this._updateLayer(l)):this.fire(new o.k(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,i,n={}){this._checkLoaded();const l=this.getLayer(e);if(l){if(!o.bG(l.filter,i))return i==null?(l.setFilter(void 0),void this._updateLayer(l)):void(this._validate(o.z.filter,`layers.${l.id}.filter`,i,null,n)||(l.setFilter(o.bJ(i)),this._updateLayer(l)))}else this.fire(new o.k(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return o.bJ(this.getLayer(e).filter)}setLayoutProperty(e,i,n,l={}){this._checkLoaded();const h=this.getLayer(e);h?o.bG(h.getLayoutProperty(i),n)||(h.setLayoutProperty(i,n,l),this._updateLayer(h)):this.fire(new o.k(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,i){const n=this.getLayer(e);if(n)return n.getLayoutProperty(i);this.fire(new o.k(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,i,n,l={}){this._checkLoaded();const h=this.getLayer(e);h?o.bG(h.getPaintProperty(i),n)||(h.setPaintProperty(i,n,l)&&this._updateLayer(h),this._changed=!0,this._updatedPaintProps[e]=!0,this._serializedLayers=null):this.fire(new o.k(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(e,i){return this.getLayer(e).getPaintProperty(i)}setFeatureState(e,i){this._checkLoaded();const n=e.source,l=e.sourceLayer,h=this.sourceCaches[n];if(h===void 0)return void this.fire(new o.k(new Error(`The source '${n}' does not exist in the map's style.`)));const m=h.getSource().type;m==="geojson"&&l?this.fire(new o.k(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):m!=="vector"||l?(e.id===void 0&&this.fire(new o.k(new Error("The feature id parameter must be provided."))),h.setFeatureState(l,e.id,i)):this.fire(new o.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,i){this._checkLoaded();const n=e.source,l=this.sourceCaches[n];if(l===void 0)return void this.fire(new o.k(new Error(`The source '${n}' does not exist in the map's style.`)));const h=l.getSource().type,m=h==="vector"?e.sourceLayer:void 0;h!=="vector"||m?i&&typeof e.id!="string"&&typeof e.id!="number"?this.fire(new o.k(new Error("A feature id is required to remove its specific state property."))):l.removeFeatureState(m,e.id,i):this.fire(new o.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();const i=e.source,n=e.sourceLayer,l=this.sourceCaches[i];if(l!==void 0)return l.getSource().type!=="vector"||n?(e.id===void 0&&this.fire(new o.k(new Error("The feature id parameter must be provided."))),l.getFeatureState(n,e.id)):void this.fire(new o.k(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new o.k(new Error(`The source '${i}' does not exist in the map's style.`)))}getTransition(){return o.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const e=o.bM(this.sourceCaches,h=>h.serialize()),i=this._serializeByIds(this._order,!0),n=this.map.getTerrain()||void 0,l=this.stylesheet;return o.bN({version:l.version,name:l.name,metadata:l.metadata,light:l.light,sky:l.sky,center:l.center,zoom:l.zoom,bearing:l.bearing,pitch:l.pitch,sprite:l.sprite,glyphs:l.glyphs,transition:l.transition,projection:l.projection,sources:e,layers:i,terrain:n},h=>h!==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 i=m=>this._layers[m].type==="fill-extrusion",n={},l=[];for(let m=this._order.length-1;m>=0;m--){const _=this._order[m];if(i(_)){n[_]=m;for(const v of e){const S=v[_];
739if(S)for(const I of S)l.push(I)}}}l.sort((m,_)=>_.intersectionZ-m.intersectionZ);const h=[];for(let m=this._order.length-1;m>=0;m--){const _=this._order[m];if(i(_))for(let v=l.length-1;v>=0;v--){const S=l[v].feature;if(n[S.layer.id]<m)break;h.push(S),l.pop()}else for(const v of e){const S=v[_];if(S)for(const I of S)h.push(I.feature)}}return h}queryRenderedFeatures(e,i,n){i&&i.filter&&this._validate(o.z.filter,"queryRenderedFeatures.filter",i.filter,null,i);const l={};if(i&&i.layers){if(!(Array.isArray(i.layers)||i.layers instanceof Set))return this.fire(new o.k(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(const S of i.layers){const I=this._layers[S];if(!I)return this.fire(new o.k(new Error(`The layer '${S}' does not exist in the map's style and cannot be queried for features.`))),[];l[I.source]=!0}}const h=[];i.availableImages=this._availableImages;const m=this._serializedAllLayers(),_=i.layers instanceof Set?i.layers:Array.isArray(i.layers)?new Set(i.layers):null,v=Object.assign(Object.assign({},i),{layers:_});for(const S in this.sourceCaches)i.layers&&!l[S]||h.push(Gt(this.sourceCaches[S],this._layers,m,e,v,n,this.map.terrain?(I,k,P)=>this.map.terrain.getElevation(I,k,P):void 0));return this.placement&&h.push(function(S,I,k,P,D,O,G){const q={},H=O.queryRenderedSymbols(P),X=[];for(const ee of Object.keys(H).map(Number))X.push(G[ee]);X.sort(Zi);for(const ee of X){const Y=ee.featureIndex.lookupSymbolFeatures(H[ee.bucketInstanceId],I,ee.bucketIndex,ee.sourceLayerIndex,D.filter,D.layers,D.availableImages,S);for(const re in Y){const ae=q[re]=q[re]||[],K=Y[re];K.sort((le,xe)=>{const me=ee.featureSortOrder;if(me){const ge=me.indexOf(le.featureIndex);return me.indexOf(xe.featureIndex)-ge}return xe.featureIndex-le.featureIndex});for(const le of K)ae.push(le)}}return function(ee,Y,re){for(const ae in ee)for(const K of ee[ae])wr(K,re[Y[ae].source]);return ee}(q,S,k)}(this._layers,m,this.sourceCaches,e,v,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(h)}querySourceFeatures(e,i){i&&i.filter&&this._validate(o.z.filter,"querySourceFeatures.filter",i.filter,null,i);const n=this.sourceCaches[e];return n?function(l,h){const m=l.getRenderableIds().map(S=>l.getTileByID(S)),_=[],v={};for(let S=0;S<m.length;S++){const I=m[S],k=I.tileID.canonical.key;v[k]||(v[k]=!0,I.querySourceFeatures(_,h))}return _}(n,i):[]}getLight(){return this.light.getLight()}setLight(e,i={}){this._checkLoaded();const n=this.light.getLight();let l=!1;for(const m in e)if(!o.bG(e[m],n[m])){l=!0;break}if(!l)return;const h={now:De.now(),transition:o.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,i),this.light.updateTransitions(h)}getProjection(){var e;return(e=this.stylesheet)===null||e===void 0?void 0:e.projection}setProjection(e){if(this._checkLoaded(),this.projection){if(this.projection.name===e.type)return;this.projection.destroy(),delete this.projection}this.stylesheet.projection=e,this._setProjectionInternal(e.type)}getSky(){var e;return(e=this.stylesheet)===null||e===void 0?void 0:e.sky}setSky(e,i={}){this._checkLoaded();const n=this.getSky();let l=!1;if(!e&&!n)return;if(e&&!n)l=!0;else if(!e&&n)l=!0;else for(const m in e)if(!o.bG(e[m],n[m])){l=!0;break}if(!l)return;const h={now:De.now(),transition:o.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,i),this.sky.updateTransitions(h)}_setProjectionInternal(e){const i=function(n){if(Array.isArray(n)){const l=new an({type:n});return{projection:l,transform:new bi,cameraHelper:new cl(l)}}switch(n){case"mercator":return{projection:new sl,transform:new gr,cameraHelper:new ro};case"globe":{const l=new an({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:l,transform:new bi,cameraHelper:new cl(l)}}case"vertical-perspective":return{projection:new Pc,transform:new ws,cameraHelper:new di};default:return o.w(`Unknown projection name: ${n}. Falling back to mercator projection.`),{projection:new sl,transform:new gr,cameraHelper:new ro}}}(e);this.projection=i.projection,this.map.migrateProjection(i.transform,i.cameraHelper);for(const n in this.sourceCaches)this.sourceCaches[n].reload()}_validate(e,i,n,l,h={}){return(!h||h.validate!==!1)&&cn(this,e.call(o.z,o.e({key:i,style:this.serialize(),value:n,styleSpec:o.v},l)))}_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),Kr().off(zi,this._rtlPluginLoaded);for(const i in this._layers)this._layers[i].setEventedParent(null);for(const i in this.sourceCaches){const n=this.sourceCaches[i];n.setEventedParent(null),n.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 i in this.sourceCaches)this.sourceCaches[i].update(e,this.map.terrain)}_generateCollisionBoxes(){for(const e in this.sourceCaches)this._reloadSource(e)}_updatePlacement(e,i,n,l,h=!1){let m=!1,_=!1;const v={};for(const S of this._order){const I=this._layers[S];if(I.type!=="symbol")continue;if(!v[I.source]){const P=this.sourceCaches[I.source];v[I.source]=P.getRenderableIds(!0).map(D=>P.getTileByID(D)).sort((D,O)=>O.tileID.overscaledZ-D.tileID.overscaledZ||(D.tileID.isLessThan(O.tileID)?-1:1))}const k=this.crossTileSymbolIndex.addLayer(I,v[I.source],e.center.lng);m=m||k}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((h=h||this._layerOrderChanged||n===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(De.now(),e.zoom))&&(this.pauseablePlacement=new Ic(e,this.map.terrain,this._order,h,i,n,l,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,v),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(De.now()),_=!0),m&&this.pauseablePlacement.placement.setStale()),_||m)for(const S of this._order){const I=this._layers[S];I.type==="symbol"&&this.placement.updateLayerOpacities(I,v[I.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(De.now())}_releaseSymbolFadeTiles(){for(const e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,i){return o._(this,void 0,void 0,function*(){const n=yield this.imageManager.getImages(i.icons);this._updateTilesForChangedImages();const l=this.sourceCaches[i.source];return l&&l.setDependencies(i.tileID.key,i.type,i.icons),n})}getGlyphs(e,i){return o._(this,void 0,void 0,function*(){const n=yield this.glyphManager.getGlyphs(i.stacks),l=this.sourceCaches[i.source];return l&&l.setDependencies(i.tileID.key,i.type,[""]),n})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,i={}
739){this._checkLoaded(),e&&this._validate(o.z.glyphs,"glyphs",e,null,i)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,i,n={},l){this._checkLoaded();const h=[{id:e,url:i}],m=[...zt(this.stylesheet.sprite),...h];this._validate(o.z.sprite,"sprite",m,null,n)||(this.stylesheet.sprite=m,this._loadSprite(h,!0,l))}removeSprite(e){this._checkLoaded();const i=zt(this.stylesheet.sprite);if(i.find(n=>n.id===e)){if(this._spritesImagesIds[e])for(const n of this._spritesImagesIds[e])this.imageManager.removeImage(n),this._changedImages[n]=!0;i.splice(i.findIndex(n=>n.id===e),1),this.stylesheet.sprite=i.length>0?i:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new o.l("data",{dataType:"style"}))}else this.fire(new o.k(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return zt(this.stylesheet.sprite)}setSprite(e,i={}
739,n){this._checkLoaded(),e&&this._validate(o.z.sprite,"sprite",e,null,i)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,n):(this._unloadSprite(),n&&n(null)))}}var Qu=o.aI([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class eh{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,i,n,l,h,m,_,v,S){this.context=e;let I=this.boundPaintVertexBuffers.length!==l.length;for(let k=0;!I&&k<l.length;k++)this.boundPaintVertexBuffers[k]!==l[k]&&(I=!0);!this.vao||this.boundProgram!==i||this.boundLayoutVertexBuffer!==n||I||this.boundIndexBuffer!==h||this.boundVertexOffset!==m||this.boundDynamicVertexBuffer!==_||this.boundDynamicVertexBuffer2!==v||this.boundDynamicVertexBuffer3!==S?this.freshBind(i,n,l,h,m,_,v,S):(e.bindVertexArray.set(this.vao),_&&_.bind(),h&&h.dynamicDraw&&h.bind(),v&&v.bind(),S&&S.bind())}freshBind(e,i,n,l,h,m,_,v){const S=e.numAttributes,I=this.context,k=I.gl;this.vao&&this.destroy(),this.vao=I.createVertexArray(),I.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=i,this.boundPaintVertexBuffers=n,this.boundIndexBuffer=l,this.boundVertexOffset=h,this.boundDynamicVertexBuffer=m,this.boundDynamicVertexBuffer2=_,this.boundDynamicVertexBuffer3=v,i.enableAttributes(k,e);for(const P of n)P.enableAttributes(k,e);m&&m.enableAttributes(k,e),_&&_.enableAttributes(k,e),v&&v.enableAttributes(k,e),i.bind(),i.setVertexAttribPointers(k,e,h);for(const P of n)P.bind(),P.setVertexAttribPointers(k,e,h);m&&(m.bind(),m.setVertexAttribPointers(k,e,h)),l&&l.bind(),_&&(_.bind(),_.setVertexAttribPointers(k,e,h)),v&&(v.bind(),v.setVertexAttribPointers(k,e,h)),I.currentNumAttributes=S}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const th=(u,e,i,n,l)=>({u_texture:0,u_ele_delta:u,u_fog_matrix:e,u_fog_color:i?i.properties.get("fog-color"):o.be.white,u_fog_ground_blend:i?i.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:l?0:i?i.calculateFogBlendOpacity(n):0,u_horizon_color:i?i.properties.get("horizon-color"):o.be.white,u_horizon_fog_blend:i?i.properties.get("horizon-fog-blend"):1,u_is_globe_mode:l?1:0}),rh={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function io(u){const e=[];for(let i=0;i<u.length;i++){if(u[i]===null)continue;const n=u[i].split(" ");e.push(n.pop())}return e}class ao{constructor(e,i,n,l,h,m,_,v,S=[]){const I=e.gl;this.program=I.createProgram();const k=io(i.staticAttributes),P=n?n.getBinderAttributes():[],D=k.concat(P),O=ia.prelude.staticUniforms?io(ia.prelude.staticUniforms):[],G=_.staticUniforms?io(_.staticUniforms):[],q=i.staticUniforms?io(i.staticUniforms):[],H=n?n.getBinderUniforms():[],X=O.concat(G).concat(q).concat(H),ee=[];for(const me of X)ee.indexOf(me)<0&&ee.push(me);const Y=n?n.defines():[];ii(I)&&Y.unshift("#version 300 es"),h&&Y.push("#define OVERDRAW_INSPECTOR;"),m&&Y.push("#define TERRAIN3D;"),v&&Y.push(v),S&&Y.push(...S);let re=Y.concat(ia.prelude.fragmentSource,_.fragmentSource,i.fragmentSource).join(` 740`),ae=Y.concat(ia.prelude.vertexSource,_.vertexSource,i.vertexSource).join(` 741`);ii(I)||(re=function(me){return me.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}(re),ae=function(me){return me.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}(ae));const K=I.createShader(I.FRAGMENT_SHADER);if(I.isContextLost())return void(this.failedToCreate=!0);if(I.shaderSource(K,re),I.compileShader(K),!I.getShaderParameter(K,I.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${I.getShaderInfoLog(K)}`);I.attachShader(this.program,K);const le=I.createShader(I.VERTEX_SHADER);if(I.isContextLost())return void(this.failedToCreate=!0);if(I.shaderSource(le,ae),I.compileShader(le),!I.getShaderParameter(le,I.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${I.getShaderInfoLog(le)}`);I.attachShader(this.program,le),this.attributes={};const xe={};this.numAttributes=D.length;for(let me=0;me<this.numAttributes;me++)D[me]&&(I.bindAttribLocation(this.program,me,D[me]),this.attributes[D[me]]=me);if(I.linkProgram(this.program),!I.getProgramParameter(this.program,I.LINK_STATUS))throw new Error(`Program failed to link: ${I.getProgramInfoLog(this.program)}`);I.deleteShader(le),I.deleteShader(K);for(let me=0;me<ee.length;me++){const ge=ee[me];if(ge&&!xe[ge]){const ve=I.getUniformLocation(this.program,ge);ve&&(xe[ge]=ve)}}this.fixedUniforms=l(e,xe),this.terrainUniforms=((me,ge)=>({u_depth:new o.bO(me,ge.u_depth),u_terrain:new o.bO(me,ge.u_terrain),u_terrain_dim:new o.bf(me,ge.u_terrain_dim),u_terrain_matrix:new o.bQ(me,ge.u_terrain_matrix),u_terrain_unpack:new o.bR(me,ge.u_terrain_unpack),u_terrain_exaggeration:new o.bf(me,ge.u_terrain_exaggeration)}))(e,xe),this.projectionUniforms=((me,ge)=>({u_projection_matrix:new o.bQ(me,ge.u_projection_matrix),u_projection_tile_mercator_coords:new o.bR(me,ge.u_projection_tile_mercator_coords),u_projection_clipping_plane
741:new o.bR(me,ge.u_projection_clipping_plane),u_projection_transition:new o.bf(me,ge.u_projection_transition),u_projection_fallback_matrix:new o.bQ(me,ge.u_projection_fallback_matrix)}))(e,xe),this.binderUniforms=n?n.getUniforms(e,xe):[]}draw(e,i,n,l,h,m,_,v,S,I,k,P,D,O,G,q,H,X,ee){const Y=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(n),e.setStencilMode(l),e.setColorMode(h),e.setCullFace(m),v){e.activeTexture.set(Y.TEXTURE2),Y.bindTexture(Y.TEXTURE_2D,v.depthTexture),e.activeTexture.set(Y.TEXTURE3),Y.bindTexture(Y.TEXTURE_2D,v.texture);for(const ae in this.terrainUniforms)this.terrainUniforms[ae].set(v[ae])}if(S)for(const ae in S)this.projectionUniforms[rh[ae]].set(S[ae]);if(_)for(const ae in this.fixedUniforms)this.fixedUniforms[ae].set(_[ae]);q&&q.setUniforms(e,this.binderUniforms,O,{zoom:G});let re=0;switch(i){case Y.LINES:re=2;break;case Y.TRIANGLES:re=3;break;case Y.LINE_STRIP:re=1}for(const ae of D.get()){const K=ae.vaos||(ae.vaos={});(K[I]||(K[I]=new eh)).bind(e,this,k,q?q.getPaintVertexBuffers():[],P,ae.vertexOffset,H,X,ee),Y.drawElements(i,ae.primitiveLength*re,Y.UNSIGNED_SHORT,ae.primitiveOffset*re*2)}}}function so(u,e,i){const n=1/o.aB(i,1,e.transform.tileZoom),l=Math.pow(2,i.tileID.overscaledZ),h=i.tileSize*Math.pow(2,e.transform.tileZoom)/l,m=h*(i.tileID.canonical.x+i.tileID.wrap*l),_=h*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[n,u.fromScale,u.toScale],u_fade:u.t,u_pixel_coord_upper:[m>>16,_>>16],u_pixel_coord_lower:[65535&m,65535&_]}}const un=(u,e,i,n)=>{const l=u.style.light,h=l.properties.get("position"),m=[h.x,h.y,h.z],_=o.bU();l.properties.get("anchor")==="viewport"&&o.bV(_,u.transform.bearingInRadians),o.bW(m,m,_);const v=u.transform.transformLightDirection(m),S=l.properties.get("color");return{u_lightpos:m,u_lightpos_globe:v,u_lightintensity:l.properties.get("intensity"),u_lightcolor:[S.r,S.g,S.b],u_vertical_gradient:+e,u_opacity:i,u_fill_translate:n}},hl=(u,e,i,n,l,h,m)=>o.e(un(u,e,i,n),so(h,u,m),{u_height_factor:-Math.pow(2,l.overscaledZ)/m.tileSize/8}),no=(u,e,i,n)=>o.e(so(e,u,i),{u_fill_translate:n}),sa=(u,e)=>({u_world:u,u_fill_translate:e}),ih=(u,e,i,n,l)=>o.e(no(u,e,i,l),{u_world:n}),pl=(u,e,i,n,l)=>{const h=u.transform;let m,_,v=0;if(i.paint.get("circle-pitch-alignment")==="map"){const S=o.aB(e,1,h.zoom);m=!0,_=[S,S],v=S/(o.$*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*l}else m=!1,_=h.pixelsToGLUnits;return{u_camera_to_center_distance:h.cameraToCenterDistance,u_scale_with_map:+(i.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+m,u_device_pixel_ratio:u.pixelRatio,u_extrude_scale:_,u_globe_extrude_scale:v,u_translate:n}},hn=u=>({u_pixel_extrude_scale:[1/u.width,1/u.height]}),pn=u=>({u_viewport_size:[u.width,u.height]}),Ec=(u,e=1)=>({u_color:u,u_overlay:0,u_overlay_scale:e}),dn=(u,e,i,n)=>{const l=o.aB(u,1,e)/(o.$*Math.pow(2,u.tileID.overscaledZ))*2*Math.PI*n;return{u_extrude_scale:o.aB(u,1,e),u_intensity:i,u_globe_extrude_scale:l}},zc=(u,e,i,n)=>{const l=o.L();o.bX(l,0,u.width,u.height,0,0,1);const h=u.context.gl;return{u_matrix:l,u_world:[h.drawingBufferWidth,h.drawingBufferHeight],u_image:i,u_color_ramp:n,u_opacity:e.paint.get("heatmap-opacity")}},Ss=(u,e,i)=>{const n=i.paint.get("hillshade-accent-color");let l;switch(i.paint.get("hillshade-method")){case"basic":l=4;break;case"combined":l=1;break;case"igor":l=2;break;case"multidirectional":l=3;break;default:l=0}const h=i.getIlluminationProperties();for(let m=0;m<h.directionRadians.length;m++)i.paint.get("hillshade-illumination-anchor")==="viewport"&&(h.directionRadians[m]+=u.transform.bearingInRadians);return{u_image:0,u_latrange:Dc(0,e.tileID),u_exaggeration:i.paint.get("hillshade-exaggeration"),u_altitudes:h.altitudeRadians,u_azimuths:h.directionRadians,u_accent:n,u_method:l,u_highlights:h.highlightColor,u_shadows:h.shadowColor}},ah=(u,e)=>{const i=e.stride,n=o.L();return o.bX(n,0,o.$,-o.$,0,0,1),o.M(n,n,[0,-o.$,0]),{u_matrix:n,u_image:1,u_dimension:[i,i],u_zoom:u.overscaledZ,u_unpack:e.getUnpackVector()}};function Dc(u,e){const i=Math.pow(2,e.canonical.z),n=e.canonical.y;return[new o.a0(0,n/i).toLngLat().lat,new o.a0(0,(n+1)/i).toLngLat().lat]}const sh=(u,e,i=0)=>({u_image:0,u_unpack:e.getUnpackVector(),u_dimension:[e.stride,e.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:i,u_opacity:u.paint.get("color-relief-opacity")}),oo=(u,e,i,n)=>{const l=u.transform;return{u_translation:ml(u,e,i),u_ratio:n/o.aB(e,1,l.zoom),u_device_pixel_ratio:u.pixelRatio,u_units_to_pixels:[1/l.pixelsToGLUnits[0],1/l.pixelsToGLUnits[1]]}},dl=(u,e,i,n,l)=>o.e(oo(u,e,i,n),{u_image:0,u_image_height:l}),Lc=(u,e,i,n,l)=>{const h=u.transform,m=fl(e,h);return{u_translation:ml(u,e,i),u_texsize:e.imageAtlasTexture.size,u_ratio:n/o.aB(e,1,h.zoom),u_device_pixel_ratio:u.pixelRatio,u_image:0,u_scale:[m,l.fromScale,l.toScale],u_fade:l.t,u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]]}},Rc=(u,e,i,n,l,h)=>{const m=u.lineAtlas,_=fl(e,u.transform),v=i.layout.get("line-cap")==="round",S=m.getDash(l.from,v),I=m.getDash(l.to,v),k=S.width*h.fromScale,P=I.width*h.toScale;return o.e(oo(u,e,i,n),{u_patternscale_a:[_/k,-S.height/2],u_patternscale_b:[_/P,-I.height/2],u_sdfgamma:m.width/(256*Math.min(k,P)*u.pixelRatio)/2,u_image:0,u_tex_y_a:S.y,u_tex_y_b:I.y,u_mix:h.t})};function fl(u,e){return 1/o.aB(u,1,e.tileZoom)}function ml(u,e,i){return o.aC(u.transform,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const es=(u,e,i,n,l)=>{return{u_tl_parent:u,u_scale_parent:e,u_buffer_scale:1,u_fade_t:i.mix,u_opacity:i.opacity*n.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:n.paint.get("raster-brightness-min"),u_brightness_high:n.paint.get("raster-brightness-max"),u_saturation_factor:(m=n.paint.get("raster-saturation"),m>0?1-1/(1.001-m):-m),u_contrast_factor:(h=n.paint.get("raster-contrast"),h>0?1/(1-h):1+h),u_spin_weights:Fc(n.paint.get("raster-hue-rotate")),u_coords_top:[l[0].x,l[0].y,l[1].x,l[1].y],u_coords_bottom:[l[3].x,l[3].y,l[2].x,l[2].y]};var h,m};function Fc(u){u*=Math.PI/180;const e=Math.sin(u),i=Math.cos(u);return[(2*i+1)/3,(-Math.sqrt(3)*e-i+1)/3,(Math.sqrt(3)*e-i+1)/3]}const gl=(u,e,i,n,l,h,m,_,v,S,I,k,P)=>{const D=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:D.cameraToCenterDistance,u_pitch:D.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:D.width/D.height,u_fade_change:m.options.fadeDuration?m.symbolFadeChange:1,u_label_plane_matrix:_,u_coord_matrix:v,u_is_text:+I,u_pitch_with_map:+n,u_is_along_line:l,u_is_variable_anchor:h,u_texsize:k,u_texture:0,u_translation:S,u_pitched_scale:P}},Cs=(u,e,i,n,l,h,m,_,v,S,I,k,P,D)=>{const O=m.transform;return o.e(gl(u,e,i,n,l,h,m,_,v,S,I,k,D),{u_gamma_scale:n?Math.cos(O.pitch*Math.PI/180)*O.cameraToCenterDistance:1,u_device_pixel_ratio:m.pixelRatio,u_is_halo:1})},nh=(u,e,i,n,l,h,m,_,v,S,I,k,P)=>o.e(Cs(u,e,i,n,l,h,m,_,v,S,!0,I,0,P),{u_texsize_icon:k,u_texture_icon:1}),lo=(u,e)=>({u_opacity:u,u_color:e}),oh=(u,e,i,n,l)=>o.e(function(h,m,_,v){const S=_.imageManager.getPattern(h.from.toString()),I=_.imageManager.getPattern(h.to.toString()),{width:k,height:P}=_.imageManager.getPixelSize(),D=Math.pow(2,v.tileID.overscaledZ
vendor: 6,489 bytes, line 741
741),O=v.tileSize*Math.pow(2,_.transform.tileZoom)/D,G=O*(v.tileID.canonical.x+v.tileID.wrap*D),q=O*v.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:S.tl,u_pattern_br_a:S.br,u_pattern_tl_b:I.tl,u_pattern_br_b:I.br,u_texsize:[k,P],u_mix:m.t,u_pattern_size_a:S.displaySize,u_pattern_size_b:I.displaySize,u_scale_a:m.fromScale,u_scale_b:m.toScale,u_tile_units_to_pixels:1/o.aB(v,1,_.transform.tileZoom),u_pixel_coord_upper:[G>>16,q>>16],u_pixel_coord_lower:[65535&G,65535&q]}}(i,l,e,n),{u_opacity:u}),Bc=(u,e)=>{},Oc={fillExtrusion:(u,e)=>({u_lightpos:new o.bS(u,e.u_lightpos),u_lightpos_globe:new o.bS(u,e.u_lightpos_globe),u_lightintensity:new o.bf(u,e.u_lightintensity),u_lightcolor:new o.bS(u,e.u_lightcolor),u_vertical_gradient:new o.bf(u,e.u_vertical_gradient),u_opacity:new o.bf(u,e.u_opacity),u_fill_translate:new o.bT(u,e.u_fill_translate)}),fillExtrusionPattern:(u,e)=>({u_lightpos:new o.bS(u,e.u_lightpos),u_lightpos_globe:new o.bS(u,e.u_lightpos_globe),u_lightintensity:new o.bf(u,e.u_lightintensity),u_lightcolor:new o.bS(u,e.u_lightcolor),u_vertical_gradient:new o.bf(u,e.u_vertical_gradient),u_height_factor:new o.bf(u,e.u_height_factor),u_opacity:new o.bf(u,e.u_opacity),u_fill_translate:new o.bT(u,e.u_fill_translate),u_image:new o.bO(u,e.u_image),u_texsize:new o.bT(u,e.u_texsize),u_pixel_coord_upper:new o.bT(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bT(u,e.u_pixel_coord_lower),u_scale:new o.bS(u,e.u_scale),u_fade:new o.bf(u,e.u_fade)}),fill:(u,e)=>({u_fill_translate:new o.bT(u,e.u_fill_translate)}),fillPattern:(u,e)=>({u_image:new o.bO(u,e.u_image),u_texsize:new o.bT(u,e.u_texsize),u_pixel_coord_upper:new o.bT(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bT(u,e.u_pixel_coord_lower),u_scale:new o.bS(u,e.u_scale),u_fade:new o.bf(u,e.u_fade),u_fill_translate:new o.bT(u,e.u_fill_translate)}),fillOutline:(u,e)=>({u_world:new o.bT(u,e.u_world),u_fill_translate:new o.bT(u,e.u_fill_translate)}),fillOutlinePattern:(u,e)=>({u_world:new o.bT(u,e.u_world),u_image:new o.bO(u,e.u_image),u_texsize:new o.bT(u,e.u_texsize),u_pixel_coord_upper:new o.bT(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bT(u,e.u_pixel_coord_lower),u_scale:new o.bS(u,e.u_scale),u_fade:new o.bf(u,e.u_fade),u_fill_translate:new o.bT(u,e.u_fill_translate)}),circle:(u,e)=>({u_camera_to_center_distance:new o.bf(u,e.u_camera_to_center_distance),u_scale_with_map:new o.bO(u,e.u_scale_with_map),u_pitch_with_map:new o.bO(u,e.u_pitch_with_map),u_extrude_scale:new o.bT(u,e.u_extrude_scale),u_device_pixel_ratio:new o.bf(u,e.u_device_pixel_ratio),u_globe_extrude_scale:new o.bf(u,e.u_globe_extrude_scale),u_translate:new o.bT(u,e.u_translate)}),collisionBox:(u,e)=>({u_pixel_extrude_scale:new o.bT(u,e.u_pixel_extrude_scale)}),collisionCircle:(u,e)=>({u_viewport_size:new o.bT(u,e.u_viewport_size)}),debug:(u,e)=>({u_color:new o.bP(u,e.u_color),u_overlay:new o.bO(u,e.u_overlay),u_overlay_scale:new o.bf(u,e.u_overlay_scale)}),depth:Bc,clippingMask:Bc,heatmap:(u,e)=>({u_extrude_scale:new o.bf(u,e.u_extrude_scale),u_intensity:new o.bf(u,e.u_intensity),u_globe_extrude_scale:new o.bf(u,e.u_globe_extrude_scale)}),heatmapTexture:(u,e)=>({u_matrix:new o.bQ(u,e.u_matrix),u_world:new o.bT(u,e.u_world),u_image:new o.bO(u,e.u_image),u_color_ramp:new o.bO(u,e.u_color_ramp),u_opacity:new o.bf(u,e.u_opacity)}),hillshade:(u,e)=>({u_image:new o.bO(u,e.u_image),u_latrange:new o.bT(u,e.u_latrange),u_exaggeration:new o.bf(u,e.u_exaggeration),u_altitudes:new o.bZ(u,e.u_altitudes),u_azimuths:new o.bZ(u,e.u_azimuths),u_accent:new o.bP(u,e.u_accent),u_method:new o.bO(u,e.u_method),u_shadows:new o.bY(u,e.u_shadows),u_highlights:new o.bY(u,e.u_highlights)}),hillshadePrepare:(u,e)=>({u_matrix:new o.bQ(u,e.u_matrix),u_image:new o.bO(u,e.u_image),u_dimension:new o.bT(u,e.u_dimension),u_zoom:new o.bf(u,e.u_zoom),u_unpack:new o.bR(u,e.u_unpack)}),colorRelief:(u,e)=>({u_image:new o.bO(u,e.u_image),u_unpack:new o.bR(u,e.u_unpack),u_dimension:new o.bT(u,e.u_dimension),u_elevation_stops:new o.bO(u,e.u_elevation_stops),u_color_stops:new o.bO(u,e.u_color_stops),u_color_ramp_size:new o.bO(u,e.u_color_ramp_size),u_opacity:new o.bf(u,e.u_opacity)}),line:(u,e)=>({u_translation:new o.bT(u,e.u_translation),u_ratio:new o.bf(u,e.u_ratio),u_device_pixel_ratio:new o.bf(u,e.u_device_pixel_ratio),u_units_to_pixels:new o.bT(u,e.u_units_to_pixels)}),lineGradient:(u,e)=>({u_translation:new o.bT(u,e.u_translation),u_ratio:new o.bf(u,e.u_ratio),u_device_pixel_ratio:new o.bf(u,e.u_device_pixel_ratio),u_units_to_pixels:new o.bT(u,e.u_units_to_pixels),u_image:new o.bO(u,e.u_image),u_image_height:new o.bf(u,e.u_image_height)}),linePattern:(u,e)=>({u_translation:new o.bT(u,e.u_translation),u_texsize:new o.bT(u,e.u_texsize),u_ratio:new o.bf(u,e.u_ratio),u_device_pixel_ratio:new o.bf(u,e.u_device_pixel_ratio),u_image:new o.bO(u,e.u_image),u_units_to_pixels:new o.bT(u,e.u_units_to_pixels),u_scale:new o.bS(u,e.u_scale),u_fade:new o.bf(u,e.u_fade)}),lineSDF:(u,e)=>({u_translation:new o.bT(u,e.u_translation),u_ratio:new o.bf(u,e.u_ratio),u_device_pixel_ratio:new o.bf(u,e.u_device_pixel_ratio),u_units_to_pixels:new o.bT(u,e.u_units_to_pixels),u_patternscale_a:new o.bT(u,e.u_patternscale_a),u_patternscale_b:new o.bT(u,e.u_patternscale_b),u_sdfgamma:new o.bf(u,e.u_sdfgamma),u_image:new o.bO(u,e.u_image),u_tex_y_a:new o.bf(u,e.u_tex_y_a),u_tex_y_b:new o.bf(u,e.u_tex_y_b),u_mix:new o.bf(u,e.u_mix)}),raster:(u,e)=>({u_tl_parent:new o.bT(u,e.u_tl_parent),u_scale_parent:new o.bf(u,e.u_scale_parent),u_buffer_scale:new o.bf(u,e.u_buffer_scale),u_fade_t:new o.bf(u,e.u_fade_t),u_opacity:new o.bf(u,e.u_opacity),u_image0:new o.bO(u,e.u_image0),u_image1:new o.bO(u,e.u_image1),u_brightness_low:new o.bf(u,e.u_brightness_low),u_brightness_high:new o.bf(u,e.u_brightness_high),u_saturation_factor:new o.bf(u,e.u_saturation_factor),u_contrast_factor:new o.bf(u,e.u_contrast_factor),u_spin_weights:new o.bS(u,e.u_spin_weights),u_coords_top:new o.bR(u,e.u_coords_top),u_coords_bottom:new o.bR(u,e.u_coords_bottom)}),symbolIcon:(u,e)=>({u_is_size_zoom_constant:new o.bO(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new o.bO(u,e.u_is_size_feature_constant),u_size_t:new o.bf(u,e.u_size_t),u_size:new o.bf(u,e.u_size),u_camera_to_center_distance:new o.bf(u,e.u_camera_to_center_distance),u_pitch:new o.bf(u,e.u_pitch),u_rotate_symbol:new o.bO(u,e.u_rotate_symbol),u_aspect_ratio:new o.bf(u,e.u_aspect_ratio),u_fade_change:new o.bf(u,e.u_fade_change),u_label_plane_matrix:new o.bQ(u,e.u_label_plane_matrix
741),u_coord_matrix:new o.bQ(u,e.u_coord_matrix),u_is_text:new o.bO(u,e.u_is_text),u_pitch_with_map:new o.bO(u,e.u_pitch_with_map),u_is_along_line:new o.bO(u,e.u_is_along_line),u_is_variable_anchor:new o.bO(u,e.u_is_variable_anchor),u_texsize:new o.bT(u,e.u_texsize),u_texture:new o.bO(u,e.u_texture),u_translation:new o.bT(u,e.u_translation),u_pitched_scale:new o.bf(u,e.u_pitched_scale)}),symbolSDF:(u,e)=>({u_is_size_zoom_constant:new o.bO(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new o.bO(u,e.u_is_size_feature_constant),u_size_t:new o.bf(u,e.u_size_t),u_size:new o.bf(u,e.u_size),u_camera_to_center_distance:new o.bf(u,e.u_camera_to_center_distance),u_pitch:new o.bf(u,e.u_pitch),u_rotate_symbol:new o.bO(u,e.u_rotate_symbol),u_aspect_ratio:new o.bf(u,e.u_aspect_ratio),u_fade_change:new o.bf(u,e.u_fade_change),u_label_plane_matrix:new o.bQ(u,e.u_label_plane_matrix),u_coord_matrix:new o.bQ(u,e.u_coord_matrix),u_is_text:new o.bO(u,e.u_is_text),u_pitch_with_map:new o.bO(u,e.u_pitch_with_map),u_is_along_line:new o.bO(u,e.u_is_along_line),u_is_variable_anchor:new o.bO(u,e.u_is_variable_anchor),u_texsize:new o.bT(u,e.u_texsize),u_texture:new o.bO(u,e.u_texture),u_gamma_scale:new o.bf(u,e.u_gamma_scale),u_device_pixel_ratio:new o.bf(u,e.u_device_pixel_ratio),u_is_halo:new o.bO(u,e.u_is_halo),u_translation:new o.bT(u,e.u_translation),u_pitched_scale:new o.bf(u,e.u_pitched_scale)}),symbolTextAndIcon:(u,e)=>({u_is_size_zoom_constant:new o.bO(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new o.bO(u,e.u_is_size_feature_constant),u_size_t:new o.bf(u,e.u_size_t),u_size:new o.bf(u,e.u_size),u_camera_to_center_distance:new o.bf(u,e.u_camera_to_center_distance),u_pitch:new o.bf(u,e.u_pitch),u_rotate_symbol:new o.bO(u,e.u_rotate_symbol),u_aspect_ratio:new o.bf(u,e.u_aspect_ratio),u_fade_change:new o.bf(u,e.u_fade_change),u_label_plane_matrix:new o.bQ(u,e.u_label_plane_matrix),u_coord_matrix:new o.bQ(u,e.u_coord_matrix),u_is_text:new o.bO(u,e.u_is_text),u_pitch_with_map:new o.bO(u,e.u_pitch_with_map),u_is_along_line:new o.bO(u,e.u_is_along_line),u_is_variable_anchor:new o.bO(u,e.u_is_variable_anchor),u_texsize:new o.bT(u,e.u_texsize),u_texsize_icon:new o.bT(u,e.u_texsize_icon),u_texture:new o.bO(u,e.u_texture),u_texture_icon:new o.bO(u,e.u_texture_icon),u_gamma_scale:new o.bf(u,e.u_gamma_scale),u_device_pixel_ratio:new o.bf(u,e.u_device_pixel_ratio),u_is_halo:new o.bO(u,e.u_is_halo),u_translation:new o.bT(u,e.u_translation),u_pitched_scale:new o.bf(u,e.u_pitched_scale)}),background:(u,e)=>({u_opacity:new o.bf(u,e.u_opacity),u_color:new o.bP(u,e.u_color)}),backgroundPattern:(u,e)=>({u_opacity:new o.bf(u,e.u_opacity),u_image:new o.bO(u,e.u_image),u_pattern_tl_a:new o.bT(u,e.u_pattern_tl_a),u_pattern_br_a:new o.bT(u,e.u_pattern_br_a),u_pattern_tl_b:new o.bT(u,e.u_pattern_tl_b),u_pattern_br_b:new o.bT(u,e.u_pattern_br_b),u_texsize:new o.bT(u,e.u_texsize),u_mix:new o.bf(u,e.u_mix),u_pattern_size_a:new o.bT(u,e.u_pattern_size_a),u_pattern_size_b:new o.bT(u,e.u_pattern_size_b),u_scale_a:new o.bf(u,e.u_scale_a),u_scale_b:new o.bf(u,e.u_scale_b),u_pixel_coord_upper:new o.bT(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bT(u,e.u_pixel_coord_lower),u_tile_units_to_pixels:new o.bf(u,e.u_tile_units_to_pixels)}),terrain:(u,e)=>({u_texture:new o.bO(u,e.u_texture),u_ele_delta:new o.bf(u,e.u_ele_delta),u_fog_matrix:new o.bQ(u,e.u_fog_matrix),u_fog_color:new o.bP(u,e.u_fog_color),u_fog_ground_blend:new o.bf(u,e.u_fog_ground_blend),u_fog_ground_blend_opacity:new o.bf(u,e.u_fog_ground_blend_opacity),u_horizon_color:new o.bP(u,e.u_horizon_color),u_horizon_fog_blend:new o.bf(u,e.u_horizon_fog_blend),u_is_globe_mode:new o.bf(u,e.u_is_globe_mode)}),terrainDepth:(u,e)=>({u_ele_delta:new o.bf(u,e.u_ele_delta)}),terrainCoords:(u,e)=>({u_texture:new o.bO(u,e.u_texture),u_terrain_coords_id:new o.bf(u,e.u_terrain_coords_id),u_ele_delta:new o.bf(u,e.u_ele_delta)}),projectionErrorMeasurement:(u,e)=>({u_input:new o.bf(u,e.u_input),u_output_expected:new o.bf(u,e.u_output_expected)}),atmosphere:(u,e)=>({u_sun_pos:new o.bS(u,e.u_sun_pos),u_atmosphere_blend:new o.bf(u,e.u_atmosphere_blend),u_globe_position:new o.bS(u,e.u_globe_position),u_globe_radius:new o.bf(u,e.u_globe_radius),u_inv_proj_matrix:new o.bQ(u,e.u_inv_proj_matrix)}),sky:(u,e)=>({u_sky_color:new o.bP(u,e.u_sky_color),u_horizon_color:new o.bP(u,e.u_horizon_color),u_horizon:new o.bT(u,e.u_horizon),u_horizon_normal:new o.bT(u,e.u_horizon_normal),u_sky_horizon_blend:new o.bf(u,e.u_sky_horizon_blend),u_sky_blend:new o.bf(u,e.u_sky_blend)})};
vendor: 4,779 bytes, line 741
741class jc{constructor(e,i,n){this.context=e;const l=e.gl;this.buffer=l.createBuffer(),this.dynamicDraw=!!n,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),l.bufferData(l.ELEMENT_ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?l.DYNAMIC_DRAW:l.STATIC_DRAW),this.dynamicDraw||delete i.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){const i=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),i.bufferSubData(i.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Nc={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class _l{constructor(e,i,n,l){this.length=i.length,this.attributes=n,this.itemSize=i.bytesPerElement,this.dynamicDraw=l,this.context=e;const h=e.gl;this.buffer=h.createBuffer(),e.bindVertexBuffer.set(this.buffer),h.bufferData(h.ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?h.DYNAMIC_DRAW:h.STATIC_DRAW),this.dynamicDraw||delete i.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 i=this.context.gl;this.bind(),i.bufferSubData(i.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,i){for(let n=0;n<this.attributes.length;n++){const l=i.attributes[this.attributes[n].name];l!==void 0&&e.enableVertexAttribArray(l)}}setVertexAttribPointers(e,i,n){for(let l=0;l<this.attributes.length;l++){const h=this.attributes[l],m=i.attributes[h.name];m!==void 0&&e.vertexAttribPointer(m,h.components,e[Nc[h.type]],!1,this.itemSize,h.offset+this.itemSize*(n||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Pt{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 co extends Pt{getDefault(){return o.be.transparent}set(e){const i=this.current;(e.r!==i.r||e.g!==i.g||e.b!==i.b||e.a!==i.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class ya extends Pt{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class yl extends Pt{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class xl extends Pt{getDefault(){return[!0,!0,!0,!0]}set(e){const i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||e[3]!==i[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class vl extends Pt{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class Uc extends Pt{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class bl extends Pt{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){const i=this.current;(e.func!==i.func||e.ref!==i.ref||e.mask!==i.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class ts extends Pt{getDefault(){const e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){const i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class wl extends Pt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;e?i.enable(i.STENCIL_TEST):i.disable(i.STENCIL_TEST),this.current=e,this.dirty=!1}}class lh extends Pt{getDefault(){return[0,1]}set(e){const i=this.current;(e[0]!==i[0]||e[1]!==i[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class ch extends Pt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;e?i.enable(i.DEPTH_TEST):i.disable(i.DEPTH_TEST),this.current=e,this.dirty=!1}}class uh extends Pt{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class hh extends Pt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;e?i.enable(i.BLEND):i.disable(i.BLEND),this.current=e,this.dirty=!1}}class $c extends Pt{getDefault(){const e=this.gl;return[e.ONE,e.ZERO]}set(e){const i=this.current;(e[0]!==i[0]||e[1]!==i[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}}class ph extends Pt{getDefault(){return o.be.transparent}set(e){const i=this.current;(e.r!==i.r||e.g!==i.g||e.b!==i.b||e.a!==i.a||this.dirty)&&(this.gl.blendColor
741(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Vc extends Pt{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class uo extends Pt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;e?i.enable(i.CULL_FACE):i.disable(i.CULL_FACE),this.current=e,this.dirty=!1}}class ho extends Pt{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class po extends Pt{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class Tl extends Pt{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class rs extends Pt{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class fn extends Pt{getDefault(){const e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){const i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||e[3]!==i[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Ms extends Pt{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.bindFramebuffer(i.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class Fi extends Pt{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.bindRenderbuffer(i.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Zc extends Pt{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.bindTexture(i.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class qc extends Pt{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.bindBuffer(i.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Sl extends Pt{getDefault(){return null}set(e){const i=this.gl;i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class is extends Pt{getDefault(){return null}set(e){var i;if(e===this.current&&!this.dirty)return;const n=this.gl;ii(n)?n.bindVertexArray(e):(i=n.getExtension("OES_vertex_array_object"))===null||i===void 0||i.bindVertexArrayOES(e),this.current=e,this.dirty=!1}}class fo extends Pt{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.pixelStorei(i.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class mo extends Pt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class mn extends Pt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class Is extends Pt{constructor(e,i){super(e),this.context=e,this.parent=i}getDefault(){return null}}class Gc extends Is{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const i=this.gl;i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class As extends Is{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const i=this.gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Ps extends Is{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const i=this.gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,e),this.current=e,this.dirty=!1}}const Cl="Framebuffer is not complete";class Ml{constructor(e,i,n,l,h){this.context=e,this.width=i,this.height=n;const m=e.gl,_=this.framebuffer=m.createFramebuffer();if(this.colorAttachment=new Gc(e,_),l)this.depthAttachment=h?new Ps(e,_):new As(e,_);else if(h)throw new Error("Stencil cannot be set without depth");if(m.checkFramebufferStatus(m.FRAMEBUFFER)!==m.FRAMEBUFFER_COMPLETE)throw new Error(Cl)}destroy(){const e=this.context.gl,i=this.colorAttachment.get();if(i&&e.deleteTexture(i),this.depthAttachment){const n=this.depthAttachment.get();n&&e.deleteRenderbuffer(n)}e.deleteFramebuffer(this.framebuffer)}}class _t{constructor(e){var i,n;if(this.gl=e,this.clearColor=new co(this),this.clearDepth=new ya(this),this.clearStencil=new yl(this),this.colorMask=new xl(this),this.depthMask=new vl(this),this.stencilMask=new Uc(this),this.stencilFunc=new bl(this),this.stencilOp=new ts(this),this.stencilTest=new wl(this),this.depthRange=new lh(this),this.depthTest=new ch(this),this.depthFunc=new uh(this),this.blend=new hh(this),this.blendFunc=new $c(this),this.blendColor=new ph(this),this.blendEquation=new Vc(this),this.cullFace=new uo(this),this.cullFaceSide=new ho(this),this.frontFace=new po(this),this.program=new Tl(this),this.activeTexture=new rs(this),this.viewport=new fn(this),this.bindFramebuffer=new Ms(this),this.bindRenderbuffer=new Fi(this),this.bindTexture=new Zc(this),this.bindVertexBuffer=new qc(this),this.bindElementBuffer=new Sl(this),this.bindVertexArray=new is(this),this.pixelStoreUnpack=new fo(this),this.pixelStoreUnpackPremultiplyAlpha=new mo(this),this.pixelStoreUnpackFlipY=new mn(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),ii(e)){this.HALF_FLOAT=e.HALF_FLOAT;const l=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(i=e.RGBA16F)!==null&&i!==void 0?i:l==null?void 0:l.RGBA16F_EXT,this.RGB16F=(n=e.RGB16F)!==null&&n!==void 0?n:l==null?void 0:l.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");const l=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=l==null?void 0:l.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,i){return new jc(this,e,i)}createVertexBuffer(e,i,n){return new _l(this,e,i,n)}createRenderbuffer(e,i,n){const l=this.gl,h=l.createRenderbuffer();return this.bindRenderbuffer.set(h),l.renderbufferStorage(l.RENDERBUFFER,e,i,n),this.bindRenderbuffer.set(null),h}createFramebuffer(e,i,n,l){return new Ml(this,e,i,n,l)}clear({color:e,depth:i,stencil:n}){const l=this.gl;let h=0;e&&(h|=l.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),i!==void 0&&(h|=l.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(i),this.depthMask.set(!0)),n!==void 0&&(h|=l.STENCIL_BUFFER_BIT,this.clearStencil.set(n),this.stencilMask.set(255)),l.clear(h)}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){o.bG(e.blendFunction,Tt.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 ii(this.gl)?this.gl.createVertexArray():(e=this.gl.getExtension("OES_vertex_array_object"))===null||e===void 0?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var i;return ii(this.gl)?this.gl.deleteVertexArray(e):(i=this.gl.getExtension("OES_vertex_array_object"))===null||i===void 0?void 0:i.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}}let as;function Hc(u,e,i,n,l){const h=u.context,m=u.transform,_=h.gl,v=u.useProgram("collisionBox"),S=[];let I=0,k=0;for(let H=0;H<n.length;H++){const X=n[H],ee=e.getTile(X).getBucket(i);if(!ee)continue;const Y=l?ee.textCollisionBox:ee.iconCollisionBox,re=ee.collisionCircleArray;re.length>0&&(S.push({circleArray:re,circleOffset:k,coord:X}),I+=re.length/4,k=I),Y&&v.draw(h,_.LINES,ct.disabled,at.disabled,u.colorModeForRenderPass(),lt.disabled,hn(u.transform),u.style.map.terrain&&u.style.map.terrain.getTerrainData(X),m.getProjectionData({overscaledTileID:X,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),i.id,Y.layoutVertexBuffer,Y.indexBuffer,Y.segments,null,u.transform.zoom,null,null,Y.collisionVertexBuffer)}if(!l||!S.length)return;const P=u.useProgram("collisionCircle"),D=new o.b_;D.resize(4*I),D._trim();let O=0;for(const H of S)for(let X=0;X<H.circleArray.length/4;X++){const ee=4*X,Y=H.circleArray[ee+0],re=H.circleArray[ee+1],ae=H.circleArray[ee+2],K=H.circleArray[ee+3];D.emplace(O++,Y,re,ae,K,0),D.emplace(O++,Y,re,ae,K,1),D.emplace(O++,Y,re,ae,K,2),D.emplace(O++,Y,re,ae,K,3)}(!as||as.length<2*I)&&(as=function(H){const X=2*H,ee=new o.c0;ee.resize(X),ee._trim();for(let Y=0;Y<X;Y++){const re=6*Y;ee.uint16[re+0]=4*Y+0,ee.uint16[re+1]=4*Y+1,ee.uint16[re+2]=4*Y+2,ee.uint16[re+3]=4*Y+2,ee.uint16[re+4]=4*Y+3,ee.uint16[re+5]=4*Y+0}return ee}(I));const G=h.createIndexBuffer(as,!0),q=h.createVertexBuffer(D,o.b$.members,!0);for(const H of S){const X=pn(u.transform);P.draw(h,_.TRIANGLES,ct.disabled,at.disabled,u.colorModeForRenderPass(),lt.disabled,X,u.style.map.terrain&&u.style.map.terrain.getTerrainData(H.coord),null,i.id,q,G,o.aL.simpleSegment(0,2*H.circleOffset,H.circleArray.length,H.
741circleArray.length/2),null,u.transform.zoom,null,null,null)}q.destroy(),G.destroy()}const Wc=o.af(new Float32Array(16));function gn(u,e,i,n,l,h){const{horizontalAlign:m,verticalAlign:_}=o.aG(u);return new o.P((-(m-.5)*e/l+n[0])*h,(-(_-.5)*i/l+n[1])*h)}function dh(u,e,i,n,l,h){const m=e.tileAnchorPoint.add(new o.P(e.translation[0],e.translation[1]));if(e.pitchWithMap){let _=n.mult(h);i||(_=_.rotate(-l));const v=m.add(_);return At(v.x,v.y,e.pitchedLabelPlaneMatrix,e.getElevation).point}if(i){const _=je(e.tileAnchorPoint.x+1,e.tileAnchorPoint.y,e).point.sub(u),v=Math.atan(_.y/_.x)+(_.x<0?Math.PI:0);return u.add(n.rotate(v))}return u.add(n)}function fh(u,e,i,n,l,h,m,_,v,S,I,k){const P=u.text.placedSymbolArray,D=u.text.dynamicLayoutVertexArray,O=u.icon.dynamicLayoutVertexArray,G={};D.clear();for(let q=0;q<P.length;q++){const H=P.get(q),X=H.hidden||!H.crossTileID||u.allowVerticalPlacement&&!H.placedOrientation?null:n[H.crossTileID];if(X){const ee=new o.P(H.anchorX,H.anchorY),Y={getElevation:k,width:l.width,height:l.height,pitchedLabelPlaneMatrix:h,pitchWithMap:i,transform:l,tileAnchorPoint:ee,translation:S,unwrappedTileID:I},re=i?pt(ee.x,ee.y,Y):je(ee.x,ee.y,Y),ae=it(l.cameraToCenterDistance,re.signedDistanceFromCamera);let K=o.ao(u.textSizeData,_,H)*ae/o.aA;i&&(K*=u.tilePixelRatio/m);const{width:le,height:xe,anchor:me,textOffset:ge,textBoxScale:ve}=X,Oe=gn(me,le,xe,ge,ve,K),Be=l.getPitchedTextCorrection(ee.x+S[0],ee.y+S[1],I),ke=dh(re.point,Y,e,Oe,-l.bearingInRadians,Be),Ze=u.allowVerticalPlacement&&H.placedOrientation===o.an.vertical?Math.PI/2:0;for(let ut=0;ut<H.numGlyphs;ut++)o.au(D,ke,Ze);v&&H.associatedIconIndex>=0&&(G[H.associatedIconIndex]={shiftedAnchor:ke,angle:Ze})}else da(H.numGlyphs,D)}if(v){O.clear();const q=u.icon.placedSymbolArray;for(let H=0;H<q.length;H++){const X=q.get(H);if(X.hidden)da(X.numGlyphs,O);else{const ee=G[H];if(ee)for(let Y=0;Y<X.numGlyphs;Y++)o.au(O,ee.shiftedAnchor,ee.angle);else da(X.numGlyphs,O)}}u.icon.dynamicLayoutVertexBuffer.updateData(O)}u.text.dynamicLayoutVertexBuffer.updateData(D)}function Xc(u,e,i){return i.iconsInText&&e?"symbolTextAndIcon":u?"symbolSDF":"symbolIcon"}function Yc(u,e,i,n,l,h,m,_,v,S,I,k,P){const D=u.context,O=D.gl,G=u.transform,q=_==="map",H=v==="map",X=_!=="viewport"&&i.layout.get("symbol-placement")!=="point",ee=q&&!H&&!X,Y=!i.layout.get("symbol-sort-key").isConstant();let re=!1;const ae=u.getDepthModeForSublayer(0,ct.ReadOnly),K=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),le=[],xe=G.getCircleRadiusCorrection();for(const me of n){const ge=e.getTile(me),ve=ge.getBucket(i);if(!ve)continue;const Oe=l?ve.text:ve.icon;if(!Oe||!Oe.segments.get().length||!Oe.hasVisibleVertices)continue;const Be=Oe.programConfigurations.get(i.id),ke=l||ve.sdfIcons,Ze=l?ve.textSizeData:ve.iconSizeData,ut=H||G.pitch!==0,kt=u.useProgram(Xc(ke,l,ve),Be),Qt=o.am(Ze,G.zoom),Rt=u.style.map.terrain&&u.style.map.terrain.getTerrainData(me);let er,Ot,Ft,jt,qr=[0,0],St=null;if(l)Ot=ge.glyphAtlasTexture,Ft=O.LINEAR,er=ge.glyphAtlasTexture.size,ve.iconsInText&&(qr=ge.imageAtlasTexture.size,St=ge.imageAtlasTexture,jt=ut||u.options.rotating||u.options.zooming||Ze.kind==="composite"||Ze.kind==="camera"?O.LINEAR:O.NEAREST);else{const or=i.layout.get("icon-size").constantOr(0)!==1||ve.iconsNeedLinear;Ot=ge.imageAtlasTexture,Ft=ke||u.options.rotating||u.options.zooming||or||ut?O.LINEAR:O.NEAREST,er=ge.imageAtlasTexture.size}const Dr=o.aB(ge,1,u.transform.zoom),Lr=st(q,u.transform,Dr),Ra=o.L();o.ap(Ra,Lr);const Fa=Ut(H,q,u.transform,Dr),Ba=o.aC(G,ge,h,m),la=G.getProjectionData({overscaledTileID:me,applyGlobeMatrix:!P,applyTerrainMatrix:!0}),kn=K&&ve.hasTextData(),En=i.layout.get("icon-text-fit")!=="none"&&kn&&ve.hasIconData();if(X){const or=u.style.map.terrain?(oi,Mr)=>u.style.map.terrain.getElevation(me,oi,Mr):null,Vt=i.layout.get("text-rotation-alignment")==="map";kr(ve,u,l,Lr,Ra,H,S,Vt,me.toUnwrapped(),G.width,G.height,Ba,or)}const Us=l&&K||En,mi=X||Us?Wc:H?Lr:u.transform.clipSpaceToPixelsMatrix,Xi=ke&&i.paint.get(l?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Oa;
741Oa=ke?ve.iconsInText?nh(Ze.kind,Qt,ee,H,X,Us,u,mi,Fa,Ba,er,qr,xe):Cs(Ze.kind,Qt,ee,H,X,Us,u,mi,Fa,Ba,l,er,0,xe):gl(Ze.kind,Qt,ee,H,X,Us,u,mi,Fa,Ba,l,er,xe);const os={program:kt,buffers:Oe,uniformValues:Oa,projectionData:la,atlasTexture:Ot,atlasTextureIcon:St,atlasInterpolation:Ft,atlasInterpolationIcon:jt,isSDF:ke,hasHalo:Xi};if(Y&&ve.canOverlap){re=!0;const or=Oe.segments.get();for(const Vt of or)le.push({segments:new o.aL([Vt]),sortKey:Vt.sortKey,state:os,terrainData:Rt})}else le.push({segments:Oe.segments,sortKey:0,state:os,terrainData:Rt})}re&&le.sort((me,ge)=>me.sortKey-ge.sortKey);for(const me of le){const ge=me.state;if(D.activeTexture.set(O.TEXTURE0),ge.atlasTexture.bind(ge.atlasInterpolation,O.CLAMP_TO_EDGE),ge.atlasTextureIcon&&(D.activeTexture.set(O.TEXTURE1),ge.atlasTextureIcon&&ge.atlasTextureIcon.bind(ge.atlasInterpolationIcon,O.CLAMP_TO_EDGE)),ge.isSDF){const ve=ge.uniformValues;ge.hasHalo&&(ve.u_is_halo=1,go(ge.buffers,me.segments,i,u,ge.program,ae,I,k,ve,ge.projectionData,me.terrainData)),ve.u_is_halo=0}go(ge.buffers,me.segments,i,u,ge.program,ae,I,k,ge.uniformValues,ge.projectionData,me.terrainData)}}function go(u,e,i,n,l,h,m,_,v,S,I){const k=n.context;l.draw(k,k.gl.TRIANGLES,h,m,_,lt.backCCW,v,I,S,i.id,u.layoutVertexBuffer,u.indexBuffer,e,i.paint,n.transform.zoom,u.programConfigurations.get(i.id),u.dynamicLayoutVertexBuffer,u.opacityVertexBuffer)}function _o(u,e,i,n,l){const h=u.context,m=h.gl,_=at.disabled,v=new Tt([m.ONE,m.ONE],o.be.transparent,[!0,!0,!0,!0]),S=e.getBucket(i);if(!S)return;const I=n.key;let k=i.heatmapFbos.get(I);k||(k=_n(h,e.tileSize,e.tileSize),i.heatmapFbos.set(I,k)),h.bindFramebuffer.set(k.framebuffer),h.viewport.set([0,0,e.tileSize,e.tileSize]),h.clear({color:o.be.transparent});const P=S.programConfigurations.get(i.id),D=u.useProgram("heatmap",P,!l),O=u.transform.getProjectionData({overscaledTileID:e.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),G=u.style.map.terrain.getTerrainData(n);D.draw(h,m.TRIANGLES,ct.disabled,_,v,lt.disabled,dn(e,u.transform.zoom,i.paint.get("heatmap-intensity"),1),G,O,i.id,S.layoutVertexBuffer,S.indexBuffer,S.segments,i.paint,u.transform.zoom,P)}function yo(u,e,i,n,l){const h=u.context,m=h.gl,_=u.transform;h.setColorMode(u.colorModeForRenderPass());const v=xo(h,e),S=i.key,I=e.heatmapFbos.get(S);if(!I)return;h.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,I.colorAttachment.get()),h.activeTexture.set(m.TEXTURE1),v.bind(m.LINEAR,m.CLAMP_TO_EDGE);const k=_.getProjectionData({overscaledTileID:i,applyTerrainMatrix:l,applyGlobeMatrix:!n});u.useProgram("heatmapTexture").draw(h,m.TRIANGLES,ct.disabled,at.disabled,u.colorModeForRenderPass(),lt.disabled,zc(u,e,0,1),null,k,e.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments,e.paint,_.zoom),I.destroy(),e.heatmapFbos.delete(S)}function _n(u,e,i){var n,l;const h=u.gl,m=h.createTexture();h.bindTexture(h.TEXTURE_2D,m),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,h.LINEAR),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,h.LINEAR);const _=(n=u.HALF_FLOAT)!==null&&n!==void 0?n:h.UNSIGNED_BYTE,v=(l=u.RGBA16F)!==null&&l!==void 0?l:h.RGBA;h.texImage2D(h.TEXTURE_2D,0,v,e,i,0,h.RGBA,_,null);const S=u.createFramebuffer(e,i,!1,!1);return S.colorAttachment.set(m),S}function xo(u,e){return e.colorRampTexture||(e.colorRampTexture=new o.T(u,e.colorRamp,u.gl.RGBA)),e.colorRampTexture}function Il(u,e,i,n,l){if(!i||!n||!n.imageAtlas)return;const h=n.imageAtlas.patternPositions;let m=h[i.to.toString()],_=h[i.from.toString()];if(!m&&_&&(m=_),!_&&m&&(_=m),!m||!_){const v=l.getPaintProperty(e);m=h[v],_=h[v]}m&&_&&u.setConstantPatternPositions(m,_)}function yn(u,e,i,n,l,h,m,_){const v=u.context.gl,S="fill-pattern",I=i.paint.get(S),k=I&&I.constantOr(1),P=i.getCrossfadeParameters();let D,O,G,q,H;const X=u.transform,ee=i.paint.get("fill-translate"),Y=i.paint.get("fill-translate-anchor");m?(O=k&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",D=v.LINES):(O=k?"fillPattern":"fill",D=v.TRIANGLES);const re=I.constantOr(null);for(const ae of n){const K=e.getTile(ae);
741if(k&&!K.patternsLoaded())continue;const le=K.getBucket(i);if(!le)continue;const xe=le.programConfigurations.get(i.id),me=u.useProgram(O,xe),ge=u.style.map.terrain&&u.style.map.terrain.getTerrainData(ae);k&&(u.context.activeTexture.set(v.TEXTURE0),K.imageAtlasTexture.bind(v.LINEAR,v.CLAMP_TO_EDGE),xe.updatePaintBuffers(P)),Il(xe,S,re,K,i);const ve=X.getProjectionData({overscaledTileID:ae,applyGlobeMatrix:!_,applyTerrainMatrix:!0}),Oe=o.aC(X,K,ee,Y);if(m){q=le.indexBuffer2,H=le.segments2;const ke=[v.drawingBufferWidth,v.drawingBufferHeight];G=O==="fillOutlinePattern"&&k?ih(u,P,K,ke,Oe):sa(ke,Oe)}else q=le.indexBuffer,H=le.segments,G=k?no(u,P,K,Oe):{u_fill_translate:Oe};const Be=u.stencilModeForClipping(ae);me.draw(u.context,D,l,Be,h,lt.backCCW,G,ge,ve,i.id,le.layoutVertexBuffer,q,H,i.paint,u.transform.zoom,xe)}}function ks(u,e,i,n,l,h,m,_){const v=u.context,S=v.gl,I="fill-extrusion-pattern",k=i.paint.get(I),P=k.constantOr(1),D=i.getCrossfadeParameters(),O=i.paint.get("fill-extrusion-opacity"),G=k.constantOr(null),q=u.transform;for(const H of n){const X=e.getTile(H),ee=X.getBucket(i);if(!ee)continue;const Y=u.style.map.terrain&&u.style.map.terrain.getTerrainData(H),re=ee.programConfigurations.get(i.id),ae=u.useProgram(P?"fillExtrusionPattern":"fillExtrusion",re);P&&(u.context.activeTexture.set(S.TEXTURE0),X.imageAtlasTexture.bind(S.LINEAR,S.CLAMP_TO_EDGE),re.updatePaintBuffers(D));const K=q.getProjectionData({overscaledTileID:H,applyGlobeMatrix:!_,applyTerrainMatrix:!0});Il(re,I,G,X,i);const le=o.aC(q,X,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),xe=i.paint.get("fill-extrusion-vertical-gradient"),me=P?hl(u,xe,O,le,H,D,X):un(u,xe,O,le);ae.draw(v,v.gl.TRIANGLES,l,h,m,lt.backCCW,me,Y,K,i.id,ee.layoutVertexBuffer,ee.indexBuffer,ee.segments,i.paint,u.transform.zoom,re,u.style.map.terrain&&ee.centroidVertexBuffer)}}function Es(u,e,i,n,l,h,m,_,v){var S;const I=u.style.projection,k=u.context,P=u.transform,D=k.gl,O=[`#define NUM_ILLUMINATION_SOURCES ${i.paint.get("hillshade-highlight-color").values.length}`],G=u.useProgram("hillshade",null,!1,O),q=!u.options.moving;for(const H of n){const X=e.getTile(H),ee=X.fbo;if(!ee)continue;const Y=I.getMeshFromTileID(k,H.canonical,_,!0,"raster"),re=(S=u.style.map.terrain)===null||S===void 0?void 0:S.getTerrainData(H);k.activeTexture.set(D.TEXTURE0),D.bindTexture(D.TEXTURE_2D,ee.colorAttachment.get());const ae=P.getProjectionData({overscaledTileID:H,aligned:q,applyGlobeMatrix:!v,applyTerrainMatrix:!0});G.draw(k,D.TRIANGLES,h,l[H.overscaledZ],m,lt.backCCW,Ss(u,X,i),re,ae,i.id,Y.vertexBuffer,Y.indexBuffer,Y.segments)}}function xn(u,e,i,n,l,h,m,_,v){var S;const I=u.style.projection,k=u.context,P=u.transform,D=k.gl,O=u.useProgram("colorRelief"),G=!u.options.moving;let q=!0,H=0;for(const X of n){const ee=e.getTile(X),Y=ee.dem;if(q){const me=D.getParameter(D.MAX_TEXTURE_SIZE),{elevationTexture:ge,colorTexture:ve}=i.getColorRampTextures(k,me,Y.getUnpackVector());k.activeTexture.set(D.TEXTURE1),ge.bind(D.NEAREST,D.CLAMP_TO_EDGE),k.activeTexture.set(D.TEXTURE4),ve.bind(D.LINEAR,D.CLAMP_TO_EDGE),q=!1,H=ge.size[0]}if(!Y||!Y.data)continue;const re=Y.stride,ae=Y.getPixels();if(k.activeTexture.set(D.TEXTURE0),k.pixelStoreUnpackPremultiplyAlpha.set(!1),ee.demTexture=ee.demTexture||u.getTileTexture(re),ee.demTexture){const me=ee.demTexture;me.update(ae,{premultiply:!1}),me.bind(D.LINEAR,D.CLAMP_TO_EDGE)}else ee.demTexture=new o.T(k,ae,D.RGBA,{premultiply:!1}),ee.demTexture.bind(D.LINEAR,D.CLAMP_TO_EDGE);const K=I.getMeshFromTileID(k,X.canonical,_,!0,"raster"),le=(S=u.style.map.terrain)===null||S===void 0?void 0:S.getTerrainData(X),xe=P.getProjectionData({overscaledTileID:X,aligned:G,applyGlobeMatrix:!v,applyTerrainMatrix:!0});O.draw(k,D.TRIANGLES,h,l[X.overscaledZ],m,lt.backCCW,sh(i,ee.dem,H),le,xe,i.id,K.vertexBuffer,K.indexBuffer,K.segments)}}const Al=[new o.P(0,0),new o.P(o.$,0),new o.P(o.$,o.$),new o.P(0,o.$)];function ka(u,e,i,n,l,h,m,_,v=!1,S=!1){const I=n[n.length-1].overscaledZ,k=u.context,P=k.gl,D=u.useProgram("raster"),O=u.transform,G=u.style.projection,q=u.colorModeForRenderPass(),H=!u.options.moving;for(const X of n){const ee=u.getDepthModeForSublayer(X.overscaledZ-I,i.paint.get("raster-opacity")===1?ct.ReadWrite:ct.ReadOnly,P.LESS),Y=e.getTile(X);Y.registerFadeDuration(i.paint.get("raster-fade-duration"));const re=e.findLoadedParent(X,0),ae=e.findLoadedSibling(X),K=mh(Y,re||ae||null,e,i,u.transform,u.style.map.terrain);let le,xe;const me=i.paint.get("raster-resampling")==="nearest"?P.NEAREST:P.LINEAR;k.activeTexture.set(P.TEXTURE0),Y.texture.bind(me,P.CLAMP_TO_EDGE,P.LINEAR_MIPMAP_NEAREST),k.activeTexture.set(P.TEXTURE1),re?(re.texture.bind(me,P.CLAMP_TO_EDGE,P.LINEAR_MIPMAP_NEAREST),le=Math.pow(2,re.tileID.overscaledZ-Y.tileID.overscaledZ
741),xe=[Y.tileID.canonical.x*le%1,Y.tileID.canonical.y*le%1]):Y.texture.bind(me,P.CLAMP_TO_EDGE,P.LINEAR_MIPMAP_NEAREST),Y.texture.useMipmap&&k.extTextureFilterAnisotropic&&u.transform.pitch>20&&P.texParameterf(P.TEXTURE_2D,k.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,k.extTextureFilterAnisotropicMax);const ge=u.style.map.terrain&&u.style.map.terrain.getTerrainData(X),ve=O.getProjectionData({overscaledTileID:X,aligned:H,applyGlobeMatrix:!S,applyTerrainMatrix:!0}),Oe=es(xe||[0,0],le||1,K,i,_),Be=G.getMeshFromTileID(k,X.canonical,h,m,"raster");D.draw(k,P.TRIANGLES,ee,l?l[X.overscaledZ]:at.disabled,q,v?lt.frontCCW:lt.backCCW,Oe,ge,ve,i.id,Be.vertexBuffer,Be.indexBuffer,Be.segments)}}function mh(u,e,i,n,l,h){const m=n.paint.get("raster-fade-duration");if(!h&&m>0){const _=De.now(),v=(_-u.timeAdded)/m,S=e?(_-e.timeAdded)/m:-1,I=i.getSource(),k=Ce(l,{tileSize:I.tileSize,roundZoom:I.roundZoom}),P=!e||Math.abs(e.tileID.overscaledZ-k)>Math.abs(u.tileID.overscaledZ-k),D=P&&u.refreshedUponExpiration?1:o.ag(P?v:1-S,0,1);return u.refreshedUponExpiration&&v>=1&&(u.refreshedUponExpiration=!1),e?{opacity:1,mix:1-D}:{opacity:D,mix:0}}return{opacity:1,mix:0}}const Kc=new o.be(1,0,0,1),vo=new o.be(0,1,0,1),Pl=new o.be(0,0,1,1),Jc=new o.be(1,0,1,1),Qc=new o.be(0,1,1,1);function vn(u,e,i,n){wo(u,0,e+i/2,u.transform.width,i,n)}function bo(u,e,i,n){wo(u,e-i/2,0,i,u.transform.height,n)}function wo(u,e,i,n,l,h){const m=u.context,_=m.gl;_.enable(_.SCISSOR_TEST),_.scissor(e*u.pixelRatio,i*u.pixelRatio,n*u.pixelRatio,l*u.pixelRatio),m.clear({color:h}),_.disable(_.SCISSOR_TEST)}function eu(u,e,i){const n=u.context,l=n.gl,h=u.useProgram("debug"),m=ct.disabled,_=at.disabled,v=u.colorModeForRenderPass(),S="$debug",I=u.style.map.terrain&&u.style.map.terrain.getTerrainData(i);n.activeTexture.set(l.TEXTURE0);const k=e.getTileByID(i.key).latestRawTileData,P=Math.floor((k&&k.byteLength||0)/1024),D=e.getTile(i).tileSize,O=512/Math.min(D,512)*(i.overscaledZ/u.transform.zoom)*.5;let G=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(G+=` => ${i.overscaledZ}`),function(H,X){H.initDebugOverlayCanvas();const ee=H.debugOverlayCanvas,Y=H.context.gl,re=H.debugOverlayCanvas.getContext("2d");re.clearRect(0,0,ee.width,ee.height),re.shadowColor="white",re.shadowBlur=2,re.lineWidth=1.5,re.strokeStyle="white",re.textBaseline="top",re.font="bold 36px Open Sans, sans-serif",re.fillText(X,5,5),re.strokeText(X,5,5),H.debugOverlayTexture.update(ee),H.debugOverlayTexture.bind(Y.LINEAR,Y.CLAMP_TO_EDGE)}(u,`${G} ${P}kB`);const q=u.transform.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!0,applyTerrainMatrix:!0});h.draw(n,l.TRIANGLES,m,_,Tt.alphaBlended,lt.disabled,Ec(o.be.transparent,O),null,q,S,u.debugBuffer,u.quadTriangleIndexBuffer,u.debugSegments),h.draw(n,l.LINE_STRIP,m,_,v,lt.disabled,Ec(o.be.red),I,q,S,u.debugBuffer,u.tileBorderIndexBuffer,u.debugSegments)}function ir(u,e,i,n){const{isRenderingGlobe:l}=n,h=u.context,m=h.gl,_=u.transform,v=u.colorModeForRenderPass(),S=u.getDepthModeFor3D(),I=u.useProgram("terrain");h.bindFramebuffer.set(null),h.viewport.set([0,0,u.width,u.height]);for(const k of i){const P=e.getTerrainMesh(k.tileID),D=u.renderToTexture.getTexture(k),O=e.getTerrainData(k.tileID);h.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,D.texture);const G=e.getMeshFrameDelta(_.zoom),q=_.calculateFogMatrix(k.tileID.toUnwrapped()),H=th(G,q,u.style.sky,_.pitch,l),X=_.getProjectionData({overscaledTileID:k.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});I.draw(h,m.TRIANGLES,S,at.disabled,v,lt.backCCW,H,O,X,"terrain",P.vertexBuffer,P.indexBuffer,P.segments)}}function Ea(u,e){if(!e.mesh){const i=new o.aK;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1);const n=new o.aM;n.emplaceBack(0,1,2),n.emplaceBack(0,2,3),e.mesh=new ma(u.createVertexBuffer(i,ga.members),u.createIndexBuffer(n),o.aL.simpleSegment(0,0,i.length,n.length))}return e.mesh}class Bi{constructor(e,i){this.context=new _t(e),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:o.af(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Pe.maxUnderzooming+Pe.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Qn}resize(e,i,n){if(this.width=Math.floor(e*n),this.height=Math.floor(i*n),this.pixelRatio=n,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const l of this.style._order)this.style._layers[l].resize()}setup(){const e=this.context,i=new o.aK;i.emplaceBack(0,0),i.emplaceBack(o.$,0),i.emplaceBack(0,o.$),i.emplaceBack(o.$,o.$),this.tileExtentBuffer=e.createVertexBuffer(i,ga.members),this.tileExtentSegments=o.aL.simpleSegment(0,0,4,2);const n=new o.aK;n.emplaceBack(0,0),n.emplaceBack(o.$,0),n.emplaceBack(0,o.$),n.emplaceBack(o.$,o.$),this.debugBuffer=e.createVertexBuffer(n,ga.members),this.debugSegments=o.aL.simpleSegment(0,0,4,5);const l=new o.c5;l.emplaceBack(0,0,0,0),l.emplaceBack(o.$,0,o.$,0),l.emplaceBack(0,o.$,0,o.$),l.emplaceBack(o.$,o.$,o.$,o.$),this.rasterBoundsBuffer=e.createVertexBuffer(l,Qu.members),this.rasterBoundsSegments=o.aL.simpleSegment(0,0,4,2);const h=new o.aK;h.emplaceBack(0,0),h.emplaceBack(o.$,0),h.emplaceBack(0,o.$),h.emplaceBack(o.$,o.$),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(h,ga.members),this.rasterBoundsSegmentsPosOnly=o.aL.simpleSegment(0,0,4,5);const m=new o.aK;
741m.emplaceBack(0,0),m.emplaceBack(1,0),m.emplaceBack(0,1),m.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(m,ga.members),this.viewportSegments=o.aL.simpleSegment(0,0,4,2);const _=new o.c6;_.emplaceBack(0),_.emplaceBack(1),_.emplaceBack(3),_.emplaceBack(2),_.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(_);const v=new o.aM;v.emplaceBack(1,0,2),v.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(v);const S=this.context.gl;this.stencilClearMode=new at({func:S.ALWAYS,mask:0},0,255,S.ZERO,S.ZERO,S.ZERO),this.tileExtentMesh=new ma(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const e=this.context,i=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const n=o.L();o.bX(n,0,this.width,this.height,0,0,1),o.N(n,n,[i.drawingBufferWidth,i.drawingBufferHeight,0]);const l={mainMatrix:n,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:n};this.useProgram("clippingMask",null,!0).draw(e,i.TRIANGLES,ct.disabled,this.stencilClearMode,Tt.disabled,lt.disabled,null,null,l,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,i,n){if(this.currentStencilSource===e.source||!e.isTileClipped()||!i||!i.length)return;this.currentStencilSource=e.source,this.nextStencilID+i.length>256&&this.clearStencil();const l=this.context;l.setColorMode(Tt.disabled),l.setDepthMode(ct.disabled);const h={};for(const m of i)h[m.key]=this.nextStencilID++;this._renderTileMasks(h,i,n,!0),this._renderTileMasks(h,i,n,!1),this._tileClippingMaskIDs=h}_renderTileMasks(e,i,n,l){const h=this.context,m=h.gl,_=this.style.projection,v=this.transform,S=this.useProgram("clippingMask");for(const I of i){const k=e[I.key],P=this.style.map.terrain&&this.style.map.terrain.getTerrainData(I),D=_.getMeshFromTileID(this.context,I.canonical,l,!0,"stencil"),O=v.getProjectionData({overscaledTileID:I,applyGlobeMatrix:!n,applyTerrainMatrix:!0});S.draw(h,m.TRIANGLES,ct.disabled,new at({func:m.ALWAYS,mask:0},k,255,m.KEEP,m.KEEP,m.REPLACE),Tt.disabled,n?lt.disabled:lt.backCCW,null,P,O,"$clipping",D.vertexBuffer,D.indexBuffer,D.segments)}}_renderTilesDepthBuffer(){const e=this.context,i=e.gl,n=this.style.projection,l=this.transform,h=this.useProgram("depth"),m=this.getDepthModeFor3D(),_=Te(l,{tileSize:l.tileSize});for(const v of _){const S=this.style.map.terrain&&this.style.map.terrain.getTerrainData(v),I=n.getMeshFromTileID(this.context,v.canonical,!0,!0,"raster"),k=l.getProjectionData({overscaledTileID:v,applyGlobeMatrix:!0,applyTerrainMatrix:!0});h.draw(e,i.TRIANGLES,m,at.disabled,Tt.disabled,lt.backCCW,null,S,k,"$clipping",I.vertexBuffer,I.indexBuffer,I.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,i=this.context.gl;return new at({func:i.NOTEQUAL,mask:255},e,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(e){const i=this.context.gl;return new at({func:i.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,i.KEEP,i.KEEP,i.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){const i=this.context.gl,n=e.sort((m,_)=>_.overscaledZ-m.overscaledZ),l=n[n.length-1].overscaledZ,h=n[0].overscaledZ-l+1;if(h>1){this.currentStencilSource=void 0,this.nextStencilID+h>256&&this.clearStencil();const m={};for(let _=0;_<h;_++)m[_+l]=new at({func:i.GEQUAL,mask:255},_+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=h,[m,n]}return[{[l]:at.disabled},n]}stencilConfigForOverlapTwoPass(e){const i=this.context.gl,n=e.sort((m,_)=>_.overscaledZ-m.overscaledZ),l=n[n.length-1].overscaledZ,h=n[0].overscaledZ-l+1;if(this.clearStencil(),h>1){const m={},_={};for(let v=0;v<h;v++)m[v+l]=new at({func:i.GREATER,mask:255},h+1+v,255,i.KEEP,i.KEEP,i.REPLACE),_[v+l]=new at({func:i.GREATER,mask:255},1+v,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID=2*h+1,[m,_,n]}return this.nextStencilID=3,[{[l]:new at({func:i.GREATER,mask:255},2,255,i.KEEP,i.KEEP,i.REPLACE)},{[l]:new at({func:i.GREATER,mask:255},1,255,i.KEEP,i.KEEP,i.REPLACE)},n]}colorModeForRenderPass(){const e=this.context.gl;return this._showOverdrawInspector?new Tt([e.CONSTANT_COLOR,e.ONE],new o.be(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Tt.unblended:Tt.alphaBlended}getDepthModeForSublayer(e,i,n){if(!this.opaquePassEnabledForLayer())return ct.disabled;const l=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new ct(n||this.context.gl.LEQUAL,i,[l,l])}getDepthModeFor3D(){return new ct(this.context.gl.LEQUAL,ct.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,i){var n,l;this.style=e,this.options=i,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(De.now()),this.imageManager.beginFrame();const h=this.style._order,m=this.style.sourceCaches,_={},v={},S={},I={isRenderingToTexture:!1,isRenderingGlobe:((n=e.projection)===null||n===void 0?void 0:n.transitionState)>0};for(const P in m){const D=m[P];D.used&&D.prepare(this.context),_[P]=D.getVisibleCoordinates(!1),v[P]=_[P].slice().reverse(),S[P]=D.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let P=0;P<h.length;P++)if(this.style._layers[h[P]].is3D()){this.opaquePassCutoff=P;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const P of h){const D=this.style._layers[P];if(!D.hasOffscreenPass()||D.isHidden(this.transform.zoom))continue;const O=v[D.source];(D.type==="custom"||O.length)&&this.renderLayer(this,m[D.source],D,O,I)}if((l=this.style.projection)===null||l===void 0||l.updateGPUdependent({context:this.context,useProgram:P=>this.useProgram(P)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?o.be.black:o.be.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(P,D){const O=P.context,G=O.gl,q=((ae,K,le)=>{const xe=Math.cos(K.rollInRadians),me=Math.sin(K.rollInRadians),ge=U(K),ve=K.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:ae.properties.get("sky-color"),u_horizon_color:ae.properties.get("horizon-color"),u_horizon:[(K.width/2-ge*me)*le,(K.height/2+ge*xe)*le],u_horizon_normal:[-me,xe],u_sky_horizon_blend:ae.properties.get("sky-horizon-blend")*K.height/2*le,u_sky_blend:ve}})(D,P.style.map.transform,P.pixelRatio),H=new ct(G.LEQUAL,ct.ReadWrite,[0,1]),X=at.disabled,ee=P.colorModeForRenderPass(),Y=P.useProgram("sky"),re=Ea(O,D);Y.draw(O,G.TRIANGLES,H,X,ee,lt.disabled,q,null,void 0,"sky",re.vertexBuffer,re.indexBuffer,re.segments)}(this,this.style.sky),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=h.length-1;this.currentLayer>=0;this.currentLayer--){const P=this.style._layers[h[this.currentLayer]],D=m[P.source],O=_[P.source];this._renderTileClippingMasks(P,O,!1),this.renderLayer(this,D,P,O,I)}this.renderPass="translucent";let k=!1;for(this.currentLayer=0;this.currentLayer<h.length;this.currentLayer++){const P=this.style._layers[h[this.currentLayer]],D=m[P.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(P,I))continue;this.opaquePassEnabledForLayer()||k||(k=!0,I.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const O=(P.type==="symbol"?S:v)[P.source];this._renderTileClippingMasks(P,_[P.source],!!this.renderToTexture),this.renderLayer(this,D,P,O,I)}if(I.isRenderingGlobe&&function(P,D,O){const G=P.context,q=G.gl,H=P.useProgram("atmosphere"),X=new ct(q.LEQUAL,ct.ReadOnly,[0,1]),ee=P.transform,Y=function(ve,Oe){const Be=ve.properties.get("position"),ke=[-Be.x,-Be.y,-Be.z],Ze=o.af(new Float64Array(16));return ve.properties.get("anchor")==="map"&&(o.b5(Ze,Ze,Oe.rollInRadians),o.b6(Ze,Ze,-Oe.pitchInRadians),o.b5(Ze,Ze,Oe.bearingInRadians),o.b6(Ze,Ze,Oe.center.lat*Math.PI/180),o.by(Ze,Ze,-Oe.center.lng*Math.PI/180)
741),o.c4(ke,ke,Ze),ke}(O,P.transform),re=ee.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),ae=D.properties.get("atmosphere-blend")*re.projectionTransition;if(ae===0)return;const K=ys(ee.worldSize,ee.center.lat),le=ee.inverseProjectionMatrix,xe=new Float64Array(4);xe[3]=1,o.av(xe,xe,ee.modelViewProjectionMatrix),xe[0]/=xe[3],xe[1]/=xe[3],xe[2]/=xe[3],xe[3]=1,o.av(xe,xe,le),xe[0]/=xe[3],xe[1]/=xe[3],xe[2]/=xe[3],xe[3]=1;const me=((ve,Oe,Be,ke,Ze)=>({u_sun_pos:ve,u_atmosphere_blend:Oe,u_globe_position:Be,u_globe_radius:ke,u_inv_proj_matrix:Ze}))(Y,ae,[xe[0],xe[1],xe[2]],K,le),ge=Ea(G,D);H.draw(G,q.TRIANGLES,X,at.disabled,Tt.alphaBlended,lt.disabled,me,null,null,"atmosphere",ge.vertexBuffer,ge.indexBuffer,ge.segments)}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const P=function(D,O){let G=null;const q=Object.values(D._layers).flatMap(Y=>Y.source&&!Y.isHidden(O)?[D.sourceCaches[Y.source]]:[]),H=q.filter(Y=>Y.getSource().type==="vector"),X=q.filter(Y=>Y.getSource().type!=="vector"),ee=Y=>{(!G||G.getSource().maxzoom<Y.getSource().maxzoom)&&(G=Y)};return H.forEach(Y=>ee(Y)),G||X.forEach(Y=>ee(Y)),G}(this.style,this.transform.zoom);P&&function(D,O,G){for(let q=0;q<G.length;q++)eu(D,O,G[q])}(this,P,P.getVisibleCoordinates())}this.options.showPadding&&function(P){const D=P.transform.padding;vn(P,P.transform.height-(D.top||0),3,Kc),vn(P,D.bottom||0,3,vo),bo(P,D.left||0,3,Pl),bo(P,P.transform.width-(D.right||0),3,Jc);const O=P.transform.centerPoint;(function(G,q,H,X){wo(G,q-1,H-10,2,20,X),wo(G,q-10,H-1,20,2,X)})(P,O.x,P.transform.height-O.y,Qc)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(e){if(!this.style||!this.style.map||!this.style.map.terrain)return;const i=this.terrainFacilitator.matrix,n=this.transform.modelViewProjectionMatrix;let l=this.terrainFacilitator.dirty;l||(l=e?!o.c7(i,n):!o.c8(i,n)),l||(l=this.style.map.terrain.sourceCache.anyTilesAfterTime(this.terrainFacilitator.renderTime)),l&&(o.c9(i,n),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(h,m){const _=h.context,v=_.gl,S=h.transform,I=Tt.unblended,k=new ct(v.LEQUAL,ct.ReadWrite,[0,1]),P=m.sourceCache.getRenderableTiles(),D=h.useProgram("terrainDepth");_.bindFramebuffer.set(m.getFramebuffer("depth").framebuffer),_.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),_.clear({color:o.be.transparent,depth:1});for(const O of P){const G=m.getTerrainMesh(O.tileID),q=m.getTerrainData(O.tileID),H=S.getProjectionData({overscaledTileID:O.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),X={u_ele_delta:m.getMeshFrameDelta(S.zoom)};D.draw(_,v.TRIANGLES,k,at.disabled,I,lt.backCCW,X,q,H,"terrain",G.vertexBuffer,G.indexBuffer,G.segments)}_.bindFramebuffer.set(null),_.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain),function(h,m){const _=h.context,v=_.gl,S=h.transform,I=Tt.unblended,k=new ct(v.LEQUAL,ct.ReadWrite,[0,1]),P=m.getCoordsTexture(),D=m.sourceCache.getRenderableTiles(),O=h.useProgram("terrainCoords");_.bindFramebuffer.set(m.getFramebuffer("coords").framebuffer),_.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),_.clear({color:o.be.transparent,depth:1}),m.coordsIndex=[];for(const G of D){const q=m.getTerrainMesh(G.tileID),H=m.getTerrainData(G.tileID);_.activeTexture.set(v.TEXTURE0),v.bindTexture(v.TEXTURE_2D,P.texture);const X={u_terrain_coords_id:(255-m.coordsIndex.length)/255,u_texture:0,u_ele_delta:m.getMeshFrameDelta(S.zoom)},ee=S.getProjectionData({overscaledTileID:G.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});O.draw(_,v.TRIANGLES,k,at.disabled,I,lt.backCCW,X,H,ee,"terrain",q.vertexBuffer,q.indexBuffer,q.segments),m.coordsIndex.push(G.tileID.key)}_.bindFramebuffer.set(null),_.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain))}renderLayer(e,i,n,l,h){n.isHidden(this.transform.zoom)||(n.type==="background"||n.type==="custom"||(l||[]).length)&&(this.id=n.id,o.ca(n)?function(m,_,v,S,I,k){if(m.renderPass!=="translucent")return;const{isRenderingToTexture:P}=k,D=at.disabled,O=m.colorModeForRenderPass();(v._unevaluatedLayout.hasValue("text-variable-anchor")||v._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(G,q,H,X,ee,Y,re,ae,K){const le=q.transform,xe=q.style.map.terrain,me=ee==="map",ge=Y==="map";for(const ve of G){const Oe=X.getTile(ve),Be=Oe.getBucket(H);if(!Be||!Be.text||!Be.text.segments.get().length)continue;
741const ke=o.am(Be.textSizeData,le.zoom),Ze=o.aB(Oe,1,q.transform.zoom),ut=st(me,q.transform,Ze),kt=H.layout.get("icon-text-fit")!=="none"&&Be.hasIconData();if(ke){const Qt=Math.pow(2,le.zoom-Oe.tileID.overscaledZ),Rt=xe?(er,Ot)=>xe.getElevation(ve,er,Ot):null;fh(Be,me,ge,K,le,ut,Qt,ke,kt,o.aC(le,Oe,re,ae),ve.toUnwrapped(),Rt)}}}(S,m,v,_,v.layout.get("text-rotation-alignment"),v.layout.get("text-pitch-alignment"),v.paint.get("text-translate"),v.paint.get("text-translate-anchor"),I),v.paint.get("icon-opacity").constantOr(1)!==0&&Yc(m,_,v,S,!1,v.paint.get("icon-translate"),v.paint.get("icon-translate-anchor"),v.layout.get("icon-rotation-alignment"),v.layout.get("icon-pitch-alignment"),v.layout.get("icon-keep-upright"),D,O,P),v.paint.get("text-opacity").constantOr(1)!==0&&Yc(m,_,v,S,!0,v.paint.get("text-translate"),v.paint.get("text-translate-anchor"),v.layout.get("text-rotation-alignment"),v.layout.get("text-pitch-alignment"),v.layout.get("text-keep-upright"),D,O,P),_.map.showCollisionBoxes&&(Hc(m,_,v,S,!0),Hc(m,_,v,S,!1))}(e,i,n,l,this.style.placement.variableOffsets,h):o.cb(n)?function(m,_,v,S,I){if(m.renderPass!=="translucent")return;const{isRenderingToTexture:k}=I,P=v.paint.get("circle-opacity"),D=v.paint.get("circle-stroke-width"),O=v.paint.get("circle-stroke-opacity"),G=!v.layout.get("circle-sort-key").isConstant();if(P.constantOr(1)===0&&(D.constantOr(1)===0||O.constantOr(1)===0))return;const q=m.context,H=q.gl,X=m.transform,ee=m.getDepthModeForSublayer(0,ct.ReadOnly),Y=at.disabled,re=m.colorModeForRenderPass(),ae=[],K=X.getCircleRadiusCorrection();for(let le=0;le<S.length;le++){const xe=S[le],me=_.getTile(xe),ge=me.getBucket(v);if(!ge)continue;const ve=v.paint.get("circle-translate"),Oe=v.paint.get("circle-translate-anchor"),Be=o.aC(X,me,ve,Oe),ke=ge.programConfigurations.get(v.id),Ze=m.useProgram("circle",ke),ut=ge.layoutVertexBuffer,kt=ge.indexBuffer,Qt=m.style.map.terrain&&m.style.map.terrain.getTerrainData(xe),Rt={programConfiguration:ke,program:Ze,layoutVertexBuffer:ut,indexBuffer:kt,uniformValues:pl(m,me,v,Be,K),terrainData:Qt,projectionData:X.getProjectionData({overscaledTileID:xe,applyGlobeMatrix:!k,applyTerrainMatrix:!0})};if(G){const er=ge.segments.get();for(const Ot of er)ae.push({segments:new o.aL([Ot]),sortKey:Ot.sortKey,state:Rt})}else ae.push({segments:ge.segments,sortKey:0,state:Rt})}G&&ae.sort((le,xe)=>le.sortKey-xe.sortKey);for(const le of ae){const{programConfiguration:xe,program:me,layoutVertexBuffer:ge,indexBuffer:ve,uniformValues:Oe,terrainData:Be,projectionData:ke}=le.state;me.draw(q,H.TRIANGLES,ee,Y,re,lt.backCCW,Oe,Be,ke,v.id,ge,ve,le.segments,v.paint,m.transform.zoom,xe)}}(e,i,n,l,h):o.cc(n)?function(m,_,v,S,I){if(v.paint.get("heatmap-opacity")===0)return;const k=m.context,{isRenderingToTexture:P,isRenderingGlobe:D}=I;if(m.style.map.terrain){for(const O of S){const G=_.getTile(O);_.hasRenderableParent(O)||(m.renderPass==="offscreen"?_o(m,G,v,O,D):m.renderPass==="translucent"&&yo(m,v,O,P,D))}k.viewport.set([0,0,m.width,m.height])}else m.renderPass==="offscreen"?function(O,G,q,H){const X=O.context,ee=X.gl,Y=O.transform,re=at.disabled,ae=new Tt([ee.ONE,ee.ONE],o.be.transparent,[!0,!0,!0,!0]);(function(K,le,xe){const me=K.gl;K.activeTexture.set(me.TEXTURE1),K.viewport.set([0,0,le.width/4,le.height/4]);let ge=xe.heatmapFbos.get(o.c1);ge?(me.bindTexture(me.TEXTURE_2D,ge.colorAttachment.get()),K.bindFramebuffer.set(ge.framebuffer)):(ge=_n(K,le.width/4,le.height/4),xe.heatmapFbos.set(o.c1,ge))})(X,O,q),X.clear({color:o.be.transparent});for(let K=0;K<H.length;K++){const le=H[K];if(G.hasRenderableParent(le))continue;const xe=G.getTile(le),me=xe.getBucket(q);if(!me)continue;const ge=me.programConfigurations.get(q.id),ve=O.useProgram("heatmap",ge),Oe=Y.getProjectionData({overscaledTileID:le,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),Be=Y.getCircleRadiusCorrection();ve.draw(X,ee.TRIANGLES,ct.disabled,re,ae,lt.backCCW,dn(xe,Y.zoom,q.paint.get("heatmap-intensity"),Be),null,Oe,q.id,me.layoutVertexBuffer,me.indexBuffer,me.segments,q.paint,Y.zoom,ge)}X.viewport.set([0,0,O.width,O.height])}(m,_,v,S):m.renderPass==="translucent"&&function(O,G){const q=O.context,H=q.gl;q.setColorMode(O.colorModeForRenderPass());const X=G.heatmapFbos.get(o.c1);X&&(q.activeTexture.set(H.TEXTURE0),H.bindTexture(H.TEXTURE_2D,X.colorAttachment.get()),q.activeTexture.set(H.TEXTURE1),xo(q,G).bind(H.LINEAR,H.CLAMP_TO_EDGE),O.useProgram("heatmapTexture").draw(q,H.TRIANGLES,ct.disabled,at.disabled,O.colorModeForRenderPass(),lt.disabled,zc(O,G,0,1),null,null,G.id,O.viewportBuffer,O.quadTriangleIndexBuffer,O.viewportSegments,G.paint,O.transform.zoom))}(m,v)}(e,i,n,l,h):o.cd(n)?function(m,_,v,S,I){if(m.renderPass!=="translucent")return;const{isRenderingToTexture:k}=I,P=v.paint.get("line-opacity"),D=v.paint.get("line-width");if(P.constantOr(1)===0||D.constantOr(1)===0)return;const O=m.getDepthModeForSublayer(0,ct.ReadOnly),G=m.colorModeForRenderPass(),q=v.paint.get("line-dasharray"),H=v.paint.get("line-pattern"),X=H.constantOr(1),ee=v.paint.get("line-gradient"),Y=v.getCrossfadeParameters(),re=X?"linePattern":q?"lineSDF":ee?"lineGradient":"line",ae=m.context,K=ae.gl,le=m.transform;let xe=!0;for(const me of S){const ge=_.getTile(me);if(X&&!ge.patternsLoaded())continue;const ve=ge.getBucket(v);if(!ve)continue;const Oe=ve.programConfigurations.get(v.id),Be=m.context.program.get(),ke=m.useProgram(re,Oe),Ze=xe||ke.program!==Be,ut=m.style.map.terrain&&m.style.map.terrain.getTerrainData(me),kt=H.constantOr(null);if(kt&&ge.imageAtlas){const Ft=ge.imageAtlas,jt=Ft.patternPositions[kt.to.toString()],qr=Ft.patternPositions[kt.from.toString()];jt&&qr&&Oe.setConstantPatternPositions(jt,qr)}const Qt=le.getProjectionData({overscaledTileID:me,applyGlobeMatrix:!k,applyTerrainMatrix:!0}),Rt=le.getPixelScale(),er=X?Lc(m,ge,v,Rt,Y):q?Rc(m,ge,v,Rt,q,Y):ee?dl(m,ge,v,Rt,ve.lineClipsArray.length):oo(m,ge,v,Rt);if(X)ae.activeTexture.set(K.TEXTURE0),ge.imageAtlasTexture.bind(K.LINEAR,K.CLAMP_TO_EDGE),Oe.updatePaintBuffers(Y);else if(q&&(Ze||m.lineAtlas.dirty))ae.activeTexture.set(K.TEXTURE0),m.lineAtlas.bind(ae);else if(ee){const Ft=ve.gradients[v.id];let jt=Ft.texture;if(v.gradientVersion!==Ft.version){let qr=256;if(v.stepInterpolant){const St=_.getSource().maxzoom,Dr=me.canonical.z===St?Math.ceil(1<<m.transform.maxZoom-me.canonical.z):1;qr=o.ag(o.c2(ve.maxLineLength/o.$*1024*Dr),256,ae.maxTextureSize)}Ft.gradient=o.c3({expression:v.gradientExpression(),evaluationKey:"lineProgress",resolution:qr,image:Ft.gradient||void 0,clips:ve.lineClipsArray}),Ft.texture?Ft.texture.update(Ft.gradient):Ft.texture=new o.T(ae,Ft.gradient,K.RGBA),Ft.version=v.gradientVersion,jt=Ft.texture}ae.activeTexture.set(K.TEXTURE0),jt.bind(v.stepInterpolant?K.NEAREST:K.LINEAR,K.CLAMP_TO_EDGE)}const Ot=m.stencilModeForClipping(me);
741ke.draw(ae,K.TRIANGLES,O,Ot,G,lt.disabled,er,ut,Qt,v.id,ve.layoutVertexBuffer,ve.indexBuffer,ve.segments,v.paint,m.transform.zoom,Oe,ve.layoutVertexBuffer2),xe=!1}}(e,i,n,l,h):o.ce(n)?function(m,_,v,S,I){const k=v.paint.get("fill-color"),P=v.paint.get("fill-opacity");if(P.constantOr(1)===0)return;const{isRenderingToTexture:D}=I,O=m.colorModeForRenderPass(),G=v.paint.get("fill-pattern"),q=m.opaquePassEnabledForLayer()&&!G.constantOr(1)&&k.constantOr(o.be.transparent).a===1&&P.constantOr(0)===1?"opaque":"translucent";if(m.renderPass===q){const H=m.getDepthModeForSublayer(1,m.renderPass==="opaque"?ct.ReadWrite:ct.ReadOnly);yn(m,_,v,S,H,O,!1,D)}if(m.renderPass==="translucent"&&v.paint.get("fill-antialias")){const H=m.getDepthModeForSublayer(v.getPaintProperty("fill-outline-color")?2:0,ct.ReadOnly);yn(m,_,v,S,H,O,!0,D)}}(e,i,n,l,h):o.cf(n)?function(m,_,v,S,I){const k=v.paint.get("fill-extrusion-opacity");if(k===0)return;const{isRenderingToTexture:P}=I;if(m.renderPass==="translucent"){const D=new ct(m.context.gl.LEQUAL,ct.ReadWrite,m.depthRangeFor3D);if(k!==1||v.paint.get("fill-extrusion-pattern").constantOr(1))ks(m,_,v,S,D,at.disabled,Tt.disabled,P),ks(m,_,v,S,D,m.stencilModeFor3D(),m.colorModeForRenderPass(),P);else{const O=m.colorModeForRenderPass();ks(m,_,v,S,D,at.disabled,O,P)}}}(e,i,n,l,h):o.cg(n)?function(m,_,v,S,I){if(m.renderPass!=="offscreen"&&m.renderPass!=="translucent")return;const{isRenderingToTexture:k}=I,P=m.context,D=m.style.projection.useSubdivision,O=m.getDepthModeForSublayer(0,ct.ReadOnly),G=m.colorModeForRenderPass();if(m.renderPass==="offscreen")(function(q,H,X,ee,Y,re,ae){const K=q.context,le=K.gl;for(const xe of X){const me=H.getTile(xe),ge=me.dem;if(!ge||!ge.data||!me.needsHillshadePrepare)continue;const ve=ge.dim,Oe=ge.stride,Be=ge.getPixels();if(K.activeTexture.set(le.TEXTURE1),K.pixelStoreUnpackPremultiplyAlpha.set(!1),me.demTexture=me.demTexture||q.getTileTexture(Oe),me.demTexture){const Ze=me.demTexture;Ze.update(Be,{premultiply:!1}),Ze.bind(le.NEAREST,le.CLAMP_TO_EDGE)}else me.demTexture=new o.T(K,Be,le.RGBA,{premultiply:!1}),me.demTexture.bind(le.NEAREST,le.CLAMP_TO_EDGE);K.activeTexture.set(le.TEXTURE0);let ke=me.fbo;if(!ke){const Ze=new o.T(K,{width:ve,height:ve,data:null},le.RGBA);Ze.bind(le.LINEAR,le.CLAMP_TO_EDGE),ke=me.fbo=K.createFramebuffer(ve,ve,!0,!1),ke.colorAttachment.set(Ze.texture)}K.bindFramebuffer.set(ke.framebuffer),K.viewport.set([0,0,ve,ve]),q.useProgram("hillshadePrepare").draw(K,le.TRIANGLES,Y,re,ae,lt.disabled,ah(me.tileID,ge),null,null,ee.id,q.rasterBoundsBuffer,q.quadTriangleIndexBuffer,q.rasterBoundsSegments),me.needsHillshadePrepare=!1}})(m,_,S,v,O,at.disabled,G),P.viewport.set([0,0,m.width,m.height]);else if(m.renderPass==="translucent")if(D){const[q,H,X]=m.stencilConfigForOverlapTwoPass(S);Es(m,_,v,X,q,O,G,!1,k),Es(m,_,v,X,H,O,G,!0,k)}else{const[q,H]=m.getStencilConfigForOverlapAndUpdateStencilID(S);Es(m,_,v,H,q,O,G,!1,k)}}(e,i,n,l,h):o.ch(n)?function(m,_,v,S,I){if(m.renderPass!=="translucent"||!S.length)return;const{isRenderingToTexture:k}=I,P=m.style.projection.useSubdivision,D=m.getDepthModeForSublayer(0,ct.ReadOnly),O=m.colorModeForRenderPass();if(P){const[G,q,H]=m.stencilConfigForOverlapTwoPass(S);xn(m,_,v,H,G,D,O,!1,k),xn(m,_,v,H,q,D,O,!0,k)}else{const[G,q]=m.getStencilConfigForOverlapAndUpdateStencilID(S);xn(m,_,v,q,G,D,O,!1,k)}}(e,i,n,l,h):o.ci(n)?function(m,_,v,S,I){if(m.renderPass!=="translucent"||v.paint.get("raster-opacity")===0||!S.length)return;const{isRenderingToTexture:k}=I,P=_.getSource(),D=m.style.projection.useSubdivision;if(P instanceof Pr)ka(m,_,v,S,null,!1,!1,P.tileCoords,P.flippedWindingOrder,k);else if(D){const[O,G,q]=m.stencilConfigForOverlapTwoPass(S);ka(m,_,v,q,O,!1,!0,Al,!1,k),ka(m,_,v,q,G,!0,!0,Al,!1,k)}else{const[O,G]=m.getStencilConfigForOverlapAndUpdateStencilID(S);ka(m,_,v,G,O,!1,!0,Al,!1,k)}}(e,i,n,l,h):o.cj(n)?function(m,_,v,S,I){const k=v.paint.get("background-color"),P=v.paint.get("background-opacity");if(P===0)return;const{isRenderingToTexture:D}=I,O=m.context,G=O.gl,q=m.style.projection,H=m.transform,X=H.tileSize,ee=v.paint.get("background-pattern");if(m.isPatternMissing(ee))return;const Y=!ee&&k.a===1&&P===1&&m.opaquePassEnabledForLayer()?"opaque":"translucent";if(m.renderPass!==Y)return;const re=at.disabled,ae=m.getDepthModeForSublayer(0,Y==="opaque"?ct.ReadWrite:ct.ReadOnly),K=m.colorModeForRenderPass(),le=m.useProgram(ee?"backgroundPattern":"background"),xe=S||Te(H,{tileSize:X,terrain:m.style.map.terrain});ee&&(O.activeTexture.set(G.TEXTURE0),m.imageManager.bind(m.context));const me=v.getCrossfadeParameters();for(const ge of xe){const ve=H.getProjectionData({overscaledTileID:ge,applyGlobeMatrix:!D,applyTerrainMatrix:!0}),Oe=ee?oh(P,m,ee,{tileID:ge,tileSize:X},me):lo(P,k),Be=m.style.map.terrain&&m.style.map.terrain.getTerrainData(ge),ke=q.getMeshFromTileID(O,ge.canonical,!1,!0,"raster");le.draw(O,G.TRIANGLES,ae,re,K,lt.backCCW,Oe,Be,ve,v.id,ke.vertexBuffer,ke.indexBuffer,ke.segments)}}(e,0,n,l,h):o.ck(n)&&function(m,_,v,S){const{isRenderingGlobe:I}=S,k=m.context,P=v.implementation,D=m.style.projection,O=m.transform,G=O.getProjectionDataForCustomLayer(I),q={farZ:O.farZ,nearZ:O.nearZ,fov:O.fov*Math.PI/180,modelViewProjectionMatrix:O.modelViewProjectionMatrix,projectionMatrix:O.projectionMatrix,shaderData:{variantName:D.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793; 742uniform mat4 u_projection_matrix; 743${D.shaderPreludeCode.vertexSource}`,define:D.shaderDefine},defaultProjectionData:G},H=P.renderingMode?P.renderingMode:"2d";if(m.renderPass==="offscreen"){const X=P.prerender;X&&(m.setCustomLayerDefaults(),k.setColorMode(m.colorModeForRenderPass()),X.call(P,k.gl,q),k.setDirty(),m.setBaseState())}
743else if(m.renderPass==="translucent"){m.setCustomLayerDefaults(),k.setColorMode(m.colorModeForRenderPass()),k.setStencilMode(at.disabled);const X=H==="3d"?m.getDepthModeFor3D():m.getDepthModeForSublayer(0,ct.ReadOnly);k.setDepthMode(X),P.render(k.gl,q),k.setDirty(),m.setBaseState(),k.bindFramebuffer.set(null)}}(e,0,n,h))}saveTileTexture(e){const i=this._tileTextures[e.size[0]];i?i.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){const i=this._tileTextures[e];return i&&i.length>0?i.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const i=this.imageManager.getPattern(e.from.toString()),n=this.imageManager.getPattern(e.to.toString());return!i||!n}useProgram(e,i,n=!1,l=[]){this.cache=this.cache||{};const h=!!this.style.map.terrain,m=this.style.projection,_=n?ia.projectionMercator:m.shaderPreludeCode,v=n?Ka:m.shaderDefine,S=e+(i?i.cacheKey:"")+`/${n?al:m.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(h?"/terrain":"")+(l?`/${l.join("/")}`:"");return this.cache[S]||(this.cache[S]=new ao(this.context,ia[e],i,Oc[e],this._showOverdrawInspector,h,_,v,l)),this.cache[S]}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 o.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:e,drawingBufferHeight:i}=this.context.gl;return this.width!==e||this.height!==i}}function To(u,e){let i,n=!1,l=null,h=null;const m=()=>{l=null,n&&(u.apply(h,i),l=setTimeout(m,e),n=!1)};return(..._)=>(n=!0,h=this,i=_,l||m(),l)}class bn{constructor(e){this._getCurrentHash=()=>{const i=window.location.hash.replace("#","");if(this._hashName){let n;return i.split("&").map(l=>l.split("=")).forEach(l=>{l[0]===this._hashName&&(n=l)}),(n&&n[1]||"").split("/")}return i.split("/")},this._onHashChange=()=>{const i=this._getCurrentHash();if(!this._isValidHash(i))return!1;const n=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(i[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+i[2],+i[1]],zoom:+i[0],bearing:n,pitch:+(i[4]||0)}),!0},this._updateHashUnthrottled=()=>{const i=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,i)},this._removeHash=()=>{const i=this._getCurrentHash();if(i.length===0)return;const n=i.join("/");let l=n;l.split("&").length>0&&(l=l.split("&")[0]),this._hashName&&(l=`${this._hashName}=${n}`);let h=window.location.hash.replace(l,"");h.startsWith("#&")?h=h.slice(0,1)+h.slice(2):h==="#"&&(h="");let m=window.location.href.replace(/(#.+)?$/,h);m=m.replace("&&","&"),window.history.replaceState(window.history.state,null,m)},this._updateHash=To(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 i=this._map.getCenter(),n=Math.round(100*this._map.getZoom())/100,l=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),h=Math.pow(10,l),m=Math.round(i.lng*h)/h,_=Math.round(i.lat*h)/h,v=this._map.getBearing(),S=this._map.getPitch();let I="";if(I+=e?`/${m}/${_}/${n}`:`${n}/${_}/${m}`,(v||S)&&(I+="/"+Math.round(10*v)/10),S&&(I+=`/${Math.round(S)}`),this._hashName){const k=this._hashName;let P=!1;const D=window.location.hash.slice(1).split("&").map(O=>{const G=O.split("=")[0];return G===k?(P=!0,`${G}=${I}`):O}).filter(O=>O);return P||D.push(`${k}=${I}`),`#${D.join("&")}`}return`#${I}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new o.S(+e[2],+e[1])}catch{return!1}const i=+e[0],n=+(e[3]||0),l=+(e[4]||0);return i>=this._map.getMinZoom()&&i<=this._map.getMaxZoom()&&n>=-180&&n<=180&&l>=this._map.getMinPitch()&&l<=this._map.getMaxPitch()}}const zs={linearity:.3,easing:o.cl(0,0,.3,1)},Ds=o.e({deceleration:2500,maxSpeed:1400},zs),kl=o.e({deceleration:20,maxSpeed:1400},zs),wn=o.e({deceleration:1e3,maxSpeed:360},zs),El=o.e({deceleration:1e3,maxSpeed:90},zs),tu=o.e({deceleration:1e3,maxSpeed:360},zs);class ru{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,i=De.now();for(;e.length>0&&i-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,roll:0,pan:new o.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:h}of this._inertiaBuffer)i.zoom+=h.zoomDelta||0,i.bearing+=h.bearingDelta||0,i.pitch+=h.pitchDelta||0,i.roll+=h.rollDelta||0,h.panDelta&&i.pan._add(h.panDelta),h.around&&(i.around=h.around),h.pinchAround&&(i.pinchAround=h.pinchAround);const n=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,l={};if(i.pan.mag()){const h=Rs(i.pan.mag(),n,o.e({},Ds,e||{})),m=i.pan.mult(h.amount/i.pan.mag()),_=this._map.cameraHelper.handlePanInertia(m,this._map.transform);l.center=_.easingCenter,l.offset=_.easingOffset,Ls(l,h)}if(i.zoom){const h=Rs(i.zoom,n,kl);l.zoom=this._map.transform.zoom+h.amount,Ls(l,h)}if(i.bearing){const h=Rs(i.bearing,n,wn);
743l.bearing=this._map.transform.bearing+o.ag(h.amount,-179,179),Ls(l,h)}if(i.pitch){const h=Rs(i.pitch,n,El);l.pitch=this._map.transform.pitch+h.amount,Ls(l,h)}if(i.roll){const h=Rs(i.roll,n,tu);l.roll=this._map.transform.roll+o.ag(h.amount,-179,179),Ls(l,h)}if(l.zoom||l.bearing){const h=i.pinchAround===void 0?i.around:i.pinchAround;l.around=h?this._map.unproject(h):this._map.getCenter()}return this.clear(),o.e(l,{noMoveStart:!0})}}function Ls(u,e){(!u.duration||u.duration<e.duration)&&(u.duration=e.duration,u.easing=e.easing)}function Rs(u,e,i){const{maxSpeed:n,linearity:l,deceleration:h}=i,m=o.ag(u*l/(e/1e3),-n,n),_=Math.abs(m)/(h*l);return{easing:i.easing,duration:1e3*_,amount:m*(_/2)}}class fi extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,n,l={}){n=n instanceof MouseEvent?n:new MouseEvent(e,n);const h=ie.mousePos(i.getCanvas(),n),m=i.unproject(h);super(e,o.e({point:h,lngLat:m,originalEvent:n},l)),this._defaultPrevented=!1,this.target=i}}class Hi extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,n){const l=e==="touchend"?n.changedTouches:n.touches,h=ie.touchPos(i.getCanvasContainer(),l),m=h.map(v=>i.unproject(v)),_=h.reduce((v,S,I,k)=>v.add(S.div(k.length)),new o.P(0,0));super(e,{points:h,point:_,lngLats:m,lngLat:i.unproject(_),originalEvent:n}),this._defaultPrevented=!1}}class zl extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,n){super(e,{originalEvent:n}),this._defaultPrevented=!1}}class iu{constructor(e,i){this._map=e,this._clickTolerance=i.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new zl(e.type,this._map,e))}mousedown(e,i){return this._mousedownPos=i,this._firePreventable(new fi(e.type,this._map,e))}mouseup(e){this._map.fire(new fi(e.type,this._map,e))}click(e,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||this._map.fire(new fi(e.type,this._map,e))}dblclick(e){return this._firePreventable(new fi(e.type,this._map,e))}mouseover(e){this._map.fire(new fi(e.type,this._map,e))}mouseout(e){this._map.fire(new fi(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Hi(e.type,this._map,e))}touchmove(e){this._map.fire(new Hi(e.type,this._map,e))}touchend(e){this._map.fire(new Hi(e.type,this._map,e))}touchcancel(e){this._map.fire(new Hi(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class au{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new fi(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new fi("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new fi(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Fs{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.screenPointToLocation(o.P.convert(e),this._map.terrain)}}class Dl{constructor(e,i){this._map=e,this._tr=new Fs(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=i.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,i){this.isEnabled()&&e.shiftKey&&e.button===0&&(ie.disableDrag(),this._startPos=this._lastPos=i,this._active=!0)}mousemoveWindow(e,i){if(!this._active)return;const n=i;if(this._lastPos.equals(n)||!this._box&&n.dist(this._startPos)<this._clickTolerance)return;const l=this._startPos;this._lastPos=n,this._box||(this._box=ie.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));const h=Math.min(l.x,n.x),m=Math.max(l.x,n.x),_=Math.min(l.y,n.y),v=Math.max(l.y,n.y);ie.setTransform(this._box,`translate(${h}px,${_}px)`),this._box.style.width=m-h+"px",this._box.style.height=v-_+"px"}mouseupWindow(e,i){if(!this._active||e.button!==0)return;const n=this._startPos,l=i;if(this.reset(),ie.suppressClick(),n.x!==l.x||n.y!==l.y)return this._map.fire(new o.l("boxzoomend",{originalEvent:e})),{cameraAnimation:h=>h.fitScreenCoordinates(n,l,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&&(ie.remove(this._box),this._box=null),ie.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new o.l(e,{originalEvent:i}))}}function So(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 i={};for(let n=0;n<u.length;n++)i[u[n].identifier]=e[n];return i}class su{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,i,n){(this.centroid||n.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),n.length===this.numTouches&&(this.centroid=function(l){const h=new o.P(0,0);for(const m of l)h._add(m);return h.div(l.length)}(i),this.touches=So(n,i)))}touchmove(e,i,n){if(this.aborted||!this.centroid)return;const l=So(n,i);for(const h in this.touches){const m=l[h];(!m||m.dist(this.touches[h])>30)&&(this.aborted=!0)}}touchend(e,i,n){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),n.length===0){const l=!this.aborted&&this.centroid;if(this.reset(),l)return l}}}class Co{constructor(e){this.singleTap=new su(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,i,n){this.singleTap.touchstart(e,i,n)}touchmove(e,i,n){this.singleTap.touchmove(e,i,n)}touchend(e,i,n){const l=this.singleTap.touchend(e,i,n);if(l){const h=e.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(l)<30;if(h&&m||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=l,this.count===this.numTaps)return this.reset(),l}}}class Mo{constructor(e){this._tr=new Fs(e),this._zoomIn=new Co({numTouches:1,numTaps:2}),this._zoomOut=new Co({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,i,n){this._zoomIn.touchstart(e,i,n),this._zoomOut.touchstart(e,i,n)}touchmove(e,i,n){this._zoomIn.touchmove(e,i,n),this._zoomOut.touchmove(e,i,n)}touchend(e,i,n){const l=this._zoomIn.touchend(e,i,n),h=this._zoomOut.touchend(e,i,n),m=this._tr;return l?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:m.zoom+1,around:m.unproject(l)},{originalEvent:e})}):h?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:m.zoom-1,around:m.unproject(h)},{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 Bs{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 i=this._moveFunction(...e);if(i.bearingDelta||i.pitchDelta||i.rollDelta||i.around||i.panDelta)return this._active=!0,i}dragStart(e,i){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(i)?i[0]:i,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,i){if(!this.isEnabled())return;const n=this._lastPoint;if(!n)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);const l=Array.isArray(i)?i[0]:i;return!this._moved&&l.dist(n)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=l,this._move(n,l))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&ie.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 Oi=0,Wi=2,nu={[Oi]:1,[Wi]:2};class si{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const i=ie.mouseButton(e);this._eventButton=i}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(i,n){const l=nu[n];return i.buttons===void 0||(i.buttons&l)!==l}(e,this._eventButton)}isValidEndEvent(e){return ie.mouseButton(e)===this._eventButton}}class Os{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)}}class gh{constructor(e=new si({checkCorrectEvent:()=>!0}),i=new Os){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=i}_executeRelevantHandler(e,i,n){return e instanceof MouseEvent?i(e):typeof TouchEvent<"u"&&e instanceof TouchEvent?n(e):void 0}startMove(e){this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.startMove(i),i=>this.oneFingerTouchMoveStateManager.startMove(i))}endMove(e){this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.endMove(i),i=>this.oneFingerTouchMoveStateManager.endMove(i))}isValidStartEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidStartEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidStartEvent(i))}isValidMoveEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidMoveEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(i))}isValidEndEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidEndEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidEndEvent(i))}}const Io=u=>{u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=e=>{e.preventDefault()}};class _h{constructor(e,i){this._clickTolerance=e.clickTolerance||1,this._map=i,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new o.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,i,n){return this._calculateTransform(e,i,n)}touchmove(e,i,n){if(this._active){if(!this._shouldBePrevented(n.length))return e.preventDefault(),this._calculateTransform(e,i,n);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,i,n){this._calculateTransform(e,i,n),this._active&&this._shouldBePrevented(n.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,i,n){n.length>0&&(this._active=!0);const l=So(n,i),h=new o.P(0,0),m=new o.P(0,0);let _=0;for(const S in l){const I=l[S],k=this._touches[S];k&&(h._add(I),m._add(I.sub(k)),_++,l[S]=I)}if(this._touches=l,this._shouldBePrevented(_)||!m.mag())return;const v=m.div(_);return this._sum._add(v),this._sum.mag()<this._clickTolerance?void 0:{around:h.div(_),panDelta:v}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ll{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,i,n){this._firstTwoTouches||n.length<2||(this._firstTwoTouches=[n[0].identifier,n[1].identifier],this._start([i[0],i[1]]))}touchmove(e,i,n){if(!this._firstTwoTouches)return;e.preventDefault();const[l,h]=this._firstTwoTouches,m=Tn(n,i,l),_=Tn(n,i,h);if(!m||!_)return;const v=this._aroundCenter?null:m.add(_).div(2);return this._move([m,_],v,e)}touchend(e,i,n){if(!this._firstTwoTouches)return;const[l,h]=this._firstTwoTouches,m=Tn(n,i,l),_=Tn(n,i,h);m&&_||(this._active&&ie.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}}function Tn(u,e,i){for(let n=0;n<u.length;n++)if(u[n].identifier===i)return e[n]}function js(u,e){return Math.log(u/e)/Math.LN2}class na extends Ll{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,i){const n=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(js(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:js(this._distance,n),pinchAround:i}}}function $e(u,e){return 180*u.angleWith(e)/Math.PI}class Rl extends Ll{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,i,n){const l=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:$e(this._vector,l),pinchAround:i}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const i=25/(Math.PI*this._minDiameter)*360,n=$e(e,this._startVector);return Math.abs(n)<i}}function Sn(u){return Math.abs(u.y)>Math.abs(u.x)}class Fl extends Ll{constructor(e){super(),this._currentTouchCount=0,this._map=e}
743reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,i,n){super.touchstart(e,i,n),this._currentTouchCount=n.length}_start(e){this._lastPoints=e,Sn(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,i,n){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const l=e[0].sub(this._lastPoints[0]),h=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(l,h,n.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(l.y+h.y)/2*-.5}):void 0}gestureBeginsVertically(e,i,n){if(this._valid!==void 0)return this._valid;const l=e.mag()>=2,h=i.mag()>=2;if(!l&&!h)return;if(!l||!h)return this._firstMove===void 0&&(this._firstMove=n),n-this._firstMove<100&&void 0;const m=e.y>0==i.y>0;return Sn(e)&&Sn(i)&&m}}const Cn={panStep:100,bearingStep:15,pitchStep:10};class Ns{constructor(e){this._tr=new Fs(e);const i=Cn;this._panStep=i.panStep,this._bearingStep=i.bearingStep,this._pitchStep=i.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let i=0,n=0,l=0,h=0,m=0;switch(e.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:e.shiftKey?n=-1:(e.preventDefault(),h=-1);break;case 39:e.shiftKey?n=1:(e.preventDefault(),h=1);break;case 38:e.shiftKey?l=1:(e.preventDefault(),m=-1);break;case 40:e.shiftKey?l=-1:(e.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(n=0,l=0),{cameraAnimation:_=>{const v=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:Bl,zoom:i?Math.round(v.zoom)+i*(e.shiftKey?2:1):v.zoom,bearing:v.bearing+n*this._bearingStep,pitch:v.pitch+l*this._pitchStep,offset:[-h*this._panStep,-m*this._panStep],center:v.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 Bl(u){return u*(2-u)}const yt=4.000244140625,Ol=1/450;class ou{constructor(e,i){this._onTimeout=n=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(n)},this._map=e,this._tr=new Fs(e),this._triggerRenderFrame=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=Ol}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 i=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const n=De.now(),l=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,i!==0&&i%yt==0?this._type="wheel":i!==0&&Math.abs(i)<4?this._type="trackpad":l>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(l*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),e.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=e,this._delta-=i,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 i=ie.mousePos(this._map.getCanvas(),e),n=this._tr;this._aroundPoint=this._aroundCenter?n.transform.locationToScreenPoint(o.S.convert(n.center)):i,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const e=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){const _=e.zoom-this._lastExpectedZoom;
743typeof this._startZoom=="number"&&(this._startZoom+=_),typeof this._targetZoom=="number"&&(this._targetZoom+=_)}if(this._delta!==0){const _=this._type==="wheel"&&Math.abs(this._delta)>yt?this._wheelZoomRate:this._defaultZoomRate;let v=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&v!==0&&(v=1/v);const S=typeof this._targetZoom!="number"?e.scale:o.ae(this._targetZoom);this._targetZoom=e.getConstrained(e.getCameraLngLat(),o.aj(S*v)).zoom,this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const i=typeof this._targetZoom!="number"?e.zoom:this._targetZoom,n=this._startZoom,l=this._easing;let h,m=!1;if(this._type==="wheel"&&n&&l){const _=De.now()-this._lastWheelEventTime,v=Math.min((_+5)/200,1),S=l(v);h=o.C.number(n,i,S),v<1?this._frameId||(this._frameId=!0):m=!0}else h=i,m=!0;return this._active=!0,m&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=h,{noInertia:!0,needsRenderFrame:!m,zoomDelta:h-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=o.cn;if(this._prevEase){const n=this._prevEase,l=(De.now()-n.start)/n.duration,h=n.easing(l+.01)-n.easing(l),m=.27/Math.sqrt(h*h+1e-4)*.01,_=Math.sqrt(.0729-m*m);i=o.cl(m,_,.25,1)}return this._prevEase={start:De.now(),duration:e,easing:i},i}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Ao{constructor(e,i){this._clickZoom=e,this._tapZoom=i}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 yh{constructor(e){this._tr=new Fs(e),this.reset()}reset(){this._active=!1}dblclick(e,i){return e.preventDefault(),{cameraAnimation:n=>{n.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(i)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class xh{constructor(){this._tap=new Co({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,i,n){if(!this._swipePoint)if(this._tapTime){const l=i[0],h=e.timeStamp-this._tapTime<500,m=this._tapPoint.dist(l)<30;h&&m?n.length>0&&(this._swipePoint=l,this._swipeTouch=n[0].identifier):this.reset()}else this._tap.touchstart(e,i,n)}touchmove(e,i,n){if(this._tapTime){if(this._swipePoint){if(n[0].identifier!==this._swipeTouch)return;const l=i[0],h=l.y-this._swipePoint.y;return this._swipePoint=l,e.preventDefault(),this._active=!0,{zoomDelta:h/128}}}else this._tap.touchmove(e,i,n)}touchend(e,i,n){if(this._tapTime)this._swipePoint&&n.length===0&&this.reset();else{const l=this._tap.touchend(e,i,n);l&&(this._tapTime=e.timeStamp,this._tapPoint=l)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class jl{constructor(e,i,n){this._el=e,this._mousePan=i,this._touchPan=n}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 Po{constructor(e,i,n,l){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=i,this._mousePitch=n,this._mouseRoll=l}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class Nl{constructor(e,i,n,l){this._el=e,this._touchZoom=i,this._touchRotate=n,this._tapDragZoom=l,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 lu{constructor(e,i){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=e,this._options=i,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=ie.create("div","maplibregl-cooperative-gesture-screen",e);let i=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(i=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const n=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),l=document.createElement("div");l.className="maplibregl-desktop-message",l.textContent=i,this._container.appendChild(l);const h=document.createElement("div");h.className="maplibregl-mobile-message",h.textContent=n,this._container.appendChild(h),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(ie.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,i){this._enabled&&(this._map.fire(new o.l("cooperativegestureprevented",{gestureType:e,originalEvent:i})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Mn=u=>u.zoom||u.drag||u.roll||u.pitch||u.rotate;class vh extends o.l{}function Ul(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta||u.rollDelta}class za{constructor(e,i){this.handleWindowEvent=l=>{this.handleEvent(l,`${l.type}Window`)},this.handleEvent=(l,h)=>
743{if(l.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const m=l.type==="renderFrame"?void 0:l,_={needsRenderFrame:!1},v={},S={};for(const{handlerName:P,handler:D,allowed:O}of this._handlers){if(!D.isEnabled())continue;let G;if(this._blockedByActive(S,O,P))D.reset();else if(D[h||l.type]){if(o.co(l,h||l.type)){const q=ie.mousePos(this._map.getCanvas(),l);G=D[h||l.type](l,q)}else if(o.cp(l,h||l.type)){const q=this._getMapTouches(l.touches),H=ie.touchPos(this._map.getCanvas(),q);G=D[h||l.type](l,H,q)}else o.cq(h||l.type)||(G=D[h||l.type](l));this.mergeHandlerResult(_,v,G,P,m),G&&G.needsRenderFrame&&this._triggerRenderFrame()}(G||D.isActive())&&(S[P]=D)}const I={};for(const P in this._previousActiveHandlers)S[P]||(I[P]=m);this._previousActiveHandlers=S,(Object.keys(I).length||Ul(_))&&(this._changes.push([_,v,I]),this._triggerRenderFrame()),(Object.keys(S).length||Ul(_))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:k}=_;k&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],k(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ru(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);const n=this._el;this._listeners=[[n,"touchstart",{passive:!0}],[n,"touchmove",{passive:!1}],[n,"touchend",void 0],[n,"touchcancel",void 0],[n,"mousedown",void 0],[n,"mousemove",void 0],[n,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[n,"mouseover",void 0],[n,"mouseout",void 0],[n,"dblclick",void 0],[n,"click",void 0],[n,"keydown",{capture:!1}],[n,"keyup",void 0],[n,"wheel",{passive:!1}],[n,"contextmenu",void 0],[window,"blur",void 0]];for(const[l,h,m]of this._listeners)ie.addEventListener(l,h,l===document?this.handleWindowEvent:this.handleEvent,m)}destroy(){for(const[e,i,n]of this._listeners)ie.removeEventListener(e,i,e===document?this.handleWindowEvent:this.handleEvent,n)}_addDefaultHandlers(e){const i=this._map,n=i.getCanvasContainer();this._add("mapEvent",new iu(i,e));const l=i.boxZoom=new Dl(i,e);this._add("boxZoom",l),e.interactive&&e.boxZoom&&l.enable();const h=i.cooperativeGestures=new lu(i,e.cooperativeGestures);this._add("cooperativeGestures",h),e.cooperativeGestures&&h.enable();const m=new Mo(i),_=new yh(i);i.doubleClickZoom=new Ao(_,m),this._add("tapZoom",m),this._add("clickZoom",_),e.interactive&&e.doubleClickZoom&&i.doubleClickZoom.enable();const v=new xh;this._add("tapDragZoom",v);const S=i.touchPitch=new Fl(i);this._add("touchPitch",S),e.interactive&&e.touchPitch&&i.touchPitch.enable(e.touchPitch);const I=()=>i.project(i.getCenter()),k=function({enable:Y,clickTolerance:re,aroundCenter:ae=!0,minPixelCenterThreshold:K=100,rotateDegreesPerPixelMoved:le=.8},xe){const me=new si({checkCorrectEvent:ge=>ie.mouseButton(ge)===0&&ge.ctrlKey||ie.mouseButton(ge)===2&&!ge.ctrlKey});return new Bs({clickTolerance:re,move:(ge,ve)=>{const Oe=xe();if(ae&&Math.abs(Oe.y-ge.y)>K)return{bearingDelta:o.cm(new o.P(ge.x,ve.y),ve,Oe)};let Be=(ve.x-ge.x)*le;return ae&&ve.y<Oe.y&&(Be=-Be),{bearingDelta:Be}},moveStateManager:me,enable:Y,assignEvents:Io})}(e,I),P=function({enable:Y,clickTolerance:re,pitchDegreesPerPixelMoved:ae=-.5}){const K=new si({checkCorrectEvent:le=>ie.mouseButton(le)===0&&le.ctrlKey||ie.mouseButton(le)===2});return new Bs({clickTolerance:re,move:(le,xe)=>({pitchDelta:(xe.y-le.y)*ae}),moveStateManager:K,enable:Y,assignEvents:Io})}(e),D=function({enable:Y,clickTolerance:re,rollDegreesPerPixelMoved:ae=.3},K){const le=new si({checkCorrectEvent:xe=>ie.mouseButton(xe)===2&&xe.ctrlKey});return new Bs({clickTolerance:re,move:(xe,me)=>{const ge=K();let ve=(me.x-xe.x)*ae;return me.y<ge.y&&(ve=-ve),{rollDelta:ve}},moveStateManager:le,enable:Y,assignEvents:Io})}(e,I);i.dragRotate=new Po(e,k,P,D),this._add("mouseRotate",k,["mousePitch"]),this._add("mousePitch",P,["mouseRotate","mouseRoll"]),this._add("mouseRoll",D,["mousePitch"]),e.interactive&&e.dragRotate&&i.dragRotate.enable();const O=function({enable:Y,clickTolerance:re}){const ae=new si({checkCorrectEvent:K=>ie.mouseButton(K)===0&&!K.ctrlKey});return new Bs({clickTolerance:re,move:(K,le)=>({around:le,panDelta:le.sub(K)}),activateOnStart:!0,moveStateManager:ae,enable:Y,assignEvents:Io})}(e),G=new _h(e,i);i.dragPan=new jl(n,O,G),this._add("mousePan",O),this._add("touchPan",G,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&i.dragPan.enable(e.dragPan);const q=new Rl,H=new na;i.touchZoomRotate=new Nl(n,H,q,v),this._add("touchRotate",q,["touchPan","touchZoom"]),this._add("touchZoom",H,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&i.touchZoomRotate.enable(e.touchZoomRotate);const X=i.scrollZoom=new ou(i,()=>
743this._triggerRenderFrame());this._add("scrollZoom",X,["mousePan"]),e.interactive&&e.scrollZoom&&i.scrollZoom.enable(e.scrollZoom);const ee=i.keyboard=new Ns(i);this._add("keyboard",ee),e.interactive&&e.keyboard&&i.keyboard.enable(),this._add("blockableMapEvent",new au(i))}_add(e,i,n){this._handlers.push({handlerName:e,handler:i,allowed:n}),this._handlersById[e]=i}stop(e){if(!this._updatingCamera){for(const{handler:i}of this._handlers)i.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!!Mn(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,i,n){for(const l in e)if(l!==n&&(!i||i.indexOf(l)<0))return!0;return!1}_getMapTouches(e){const i=[];for(const n of e)this._el.contains(n.target)&&i.push(n);return i}mergeHandlerResult(e,i,n,l,h){if(!n)return;o.e(e,n);const m={handlerName:l,originalEvent:n.originalEvent||h};n.zoomDelta!==void 0&&(i.zoom=m),n.panDelta!==void 0&&(i.drag=m),n.rollDelta!==void 0&&(i.roll=m),n.pitchDelta!==void 0&&(i.pitch=m),n.bearingDelta!==void 0&&(i.rotate=m)}_applyChanges(){const e={},i={},n={};for(const[l,h,m]of this._changes)l.panDelta&&(e.panDelta=(e.panDelta||new o.P(0,0))._add(l.panDelta)),l.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+l.zoomDelta),l.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+l.bearingDelta),l.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+l.pitchDelta),l.rollDelta&&(e.rollDelta=(e.rollDelta||0)+l.rollDelta),l.around!==void 0&&(e.around=l.around),l.pinchAround!==void 0&&(e.pinchAround=l.pinchAround),l.noInertia&&(e.noInertia=l.noInertia),o.e(i,h),o.e(n,m);this._updateMapTransform(e,i,n),this._changes=[]}_updateMapTransform(e,i,n){const l=this._map,h=l._getTransformForUpdate(),m=l.terrain;if(!(Ul(e)||m&&this._terrainMovement))return this._fireEvents(i,n,!0);l._stop(!0);let{panDelta:_,zoomDelta:v,bearingDelta:S,pitchDelta:I,rollDelta:k,around:P,pinchAround:D}=e;D!==void 0&&(P=D),P=P||l.transform.centerPoint,m&&!h.isPointOnMapSurface(P)&&(P=h.centerPoint);const O={panDelta:_,zoomDelta:v,rollDelta:k,pitchDelta:I,bearingDelta:S,around:P};this._map.cameraHelper.useGlobeControls&&!h.isPointOnMapSurface(P)&&(P=h.centerPoint);const G=P.distSqr(h.centerPoint)<.01?h.center:h.screenPointToLocation(_?P.sub(_):P);m?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(O,h),this._terrainMovement||!i.drag&&!i.zoom?i.drag&&this._terrainMovement?h.setCenter(h.screenPointToLocation(h.centerPoint.sub(_))):this._map.cameraHelper.handleMapControlsPan(O,h,G):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(O,h,G))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(O,h),this._map.cameraHelper.handleMapControlsPan(O,h,G)),l._applyUpdatedTransform(h),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(i,n,!0)}_fireEvents(e,i,n){const l=Mn(this._eventsInProgress),h=Mn(e),m={};for(const k in e){const{originalEvent:P}=e[k];this._eventsInProgress[k]||(m[`${k}start`]=P),this._eventsInProgress[k]=e[k]}!l&&h&&this._fireEvent("movestart",h.originalEvent);for(const k in m)this._fireEvent(k,m[k]);h&&this._fireEvent("move",h.originalEvent);for(const k in e){const{originalEvent:P}=e[k];this._fireEvent(k,P)}const _={};let v;for(const k in this._eventsInProgress){const{handlerName:P,originalEvent:D}=this._eventsInProgress[k];this._handlersById[P].isActive()||(delete this._eventsInProgress[k],v=i[P]||D,_[`${k}end`]=v)}for(const k in _)this._fireEvent(k,_[k]);const S=Mn(this._eventsInProgress),I=(l||h)&&!S;if(I&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const k=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&k.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(k)}if(n&&I){this._updatingCamera=!0;const k=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),P=D=>D!==0&&-this._bearingSnap<D&&D<this._bearingSnap;!k||!k.essential&&De.prefersReducedMotion?(this._map.fire(new o.l("moveend",{originalEvent:v})),P(this._map.getBearing())&&this._map.resetNorth()):(P(k.bearing||this._map.getBearing())&&
743(k.bearing=0),k.freezeElevation=!0,this._map.easeTo(k,{originalEvent:v})),this._updatingCamera=!1}}_fireEvent(e,i){this._map.fire(new o.l(e,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new vh("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Ht extends o.E{constructor(e,i,n){super(),this._renderFrameCallback=()=>{const l=Math.min((De.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(l)),l<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.cameraHelper=i,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(e,i){e.apply(this.transform),this.transform=e,this.cameraHelper=i}getCenter(){return new o.S(this.transform.center.lng,this.transform.center.lat)}setCenter(e,i){return this.jumpTo({center:e},i)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,i){return this.jumpTo({elevation:e},i),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,i,n){return e=o.P.convert(e).mult(-1),this.panTo(this.transform.center,o.e({offset:e},i),n)}panTo(e,i,n){return this.easeTo(o.e({center:e},i),n)}getZoom(){return this.transform.zoom}setZoom(e,i){return this.jumpTo({zoom:e},i),this}zoomTo(e,i,n){return this.easeTo(o.e({zoom:e},i),n)}zoomIn(e,i){return this.zoomTo(this.getZoom()+1,e,i),this}zoomOut(e,i){return this.zoomTo(this.getZoom()-1,e,i),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,i){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new o.l("movestart",i)).fire(new o.l("move",i)).fire(new o.l("moveend",i))),this}getBearing(){return this.transform.bearing}setBearing(e,i){return this.jumpTo({bearing:e},i),this}getPadding(){return this.transform.padding}setPadding(e,i){return this.jumpTo({padding:e},i),this}rotateTo(e,i,n){return this.easeTo(o.e({bearing:e},i),n)}resetNorth(e,i){return this.rotateTo(0,o.e({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(o.e({bearing:0,pitch:0,roll:0,duration:1e3},e),i),this}snapToNorth(e,i){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,i):this}getPitch(){return this.transform.pitch}setPitch(e,i){return this.jumpTo({pitch:e},i),this}getRoll(){return this.transform.roll}setRoll(e,i){return this.jumpTo({roll:e},i),this}cameraForBounds(e,i){e=It.convert(e).adjustAntiMeridian();const n=i&&i.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),n,i)}_cameraForBoxAndBearing(e,i,n,l){const h={top:0,bottom:0,right:0,left:0};if(typeof(l=o.e({padding:h,offset:[0,0],maxZoom:this.transform.maxZoom},l)).padding=="number"){const S=l.padding;l.padding={top:S,bottom:S,right:S,left:S}}const m=o.e(h,l.padding);l.padding=m;const _=this.transform,v=new It(e,i);return this.cameraHelper.cameraForBoxAndBearing(l,m,v,n,_)}fitBounds(e,i,n){return this._fitInternal(this.cameraForBounds(e,i),i,n)}fitScreenCoordinates(e,i,n,l,h){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(o.P.convert(e)),this.transform.screenPointToLocation(o.P.convert(i)),n,l),l,h)}_fitInternal(e,i,n){return e?(delete(i=o.e(e,i)).padding,i.linear?this.easeTo(i,n):this.flyTo(i,n)):this}jumpTo(e,i){this.stop();const n=this._getTransformForUpdate();let l=!1,h=!1,m=!1;const _=n.zoom;this.cameraHelper.handleJumpToCenterZoom(n,e);const v=n.zoom!==_;return"elevation"in e&&n.elevation!==+e.elevation&&n.setElevation(+e.elevation),"bearing"in e&&n.bearing!==+e.bearing&&(l=!0,n.setBearing(+e.bearing)),"pitch"in e&&n.pitch!==+e.pitch&&(h=!0,n.setPitch(+e.pitch)),"roll"in e&&n.roll!==+e.roll&&(m=!0,n.setRoll(+e.roll)),e.padding==null||n.isPaddingEqual(e.padding)||n.setPadding(e.padding),this._applyUpdatedTransform(n),this.fire(new o.l("movestart",i)).fire(new o.l("move",i)),v&&this.fire(new o.l("zoomstart",i)).fire(new o.l("zoom",i)).fire(new o.l("zoomend",i)),l&&this.fire(new o.l("rotatestart",i)).fire(new o.l("rotate",i)).fire(new o.l("rotateend",i)),h&&this.fire(new o.l("pitchstart",i)).fire(new o.l("pitch",i)).fire(new o.l("pitchend",
743i)),m&&this.fire(new o.l("rollstart",i)).fire(new o.l("roll",i)).fire(new o.l("rollend",i)),this.fire(new o.l("moveend",i))}calculateCameraOptionsFromTo(e,i,n,l=0){const h=o.a0.fromLngLat(e,i),m=o.a0.fromLngLat(n,l),_=m.x-h.x,v=m.y-h.y,S=m.z-h.z,I=Math.hypot(_,v,S);if(I===0)throw new Error("Can't calculate camera options with same From and To");const k=Math.hypot(_,v),P=o.aj(this.transform.cameraToCenterDistance/I/this.transform.tileSize),D=180*Math.atan2(_,-v)/Math.PI;let O=180*Math.acos(k/I)/Math.PI;return O=S<0?90-O:90+O,{center:m.toLngLat(),elevation:l,zoom:P,pitch:O,bearing:D}}calculateCameraOptionsFromCameraLngLatAltRotation(e,i,n,l,h){const m=this.transform.calculateCenterFromCameraLngLatAlt(e,i,n,l);return{center:m.center,elevation:m.elevation,zoom:m.zoom,bearing:n,pitch:l,roll:h}}easeTo(e,i){this._stop(!1,e.easeId),((e=o.e({offset:[0,0],duration:500,easing:o.cn},e)).animate===!1||!e.essential&&De.prefersReducedMotion)&&(e.duration=0);const n=this._getTransformForUpdate(),l=this.getBearing(),h=n.pitch,m=n.roll,_="bearing"in e?this._normalizeBearing(e.bearing,l):l,v="pitch"in e?+e.pitch:h,S="roll"in e?this._normalizeBearing(e.roll,m):m,I="padding"in e?e.padding:n.padding,k=o.P.convert(e.offset);let P,D;e.around&&(P=o.S.convert(e.around),D=n.locationToScreenPoint(P));const O={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},G=this.cameraHelper.handleEaseTo(n,{bearing:_,pitch:v,roll:S,padding:I,around:P,aroundPoint:D,offsetAsPoint:k,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||l!==_,this._pitching=this._pitching||v!==h,this._rolling=this._rolling||S!==m,this._padding=!n.isPaddingEqual(I),this._zooming=this._zooming||G.isZooming,this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,O),this.terrain&&this._prepareElevation(G.elevationCenter),this._ease(q=>{G.easeFunc(q),this.terrain&&!e.freezeElevation&&this._updateElevation(q),this._applyUpdatedTransform(n),this._fireMoveEvents(i)},q=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i,q)},e),this}_prepareEase(e,i,n={}){this._moving=!0,i||n.moving||this.fire(new o.l("movestart",e)),this._zooming&&!n.zooming&&this.fire(new o.l("zoomstart",e)),this._rotating&&!n.rotating&&this.fire(new o.l("rotatestart",e)),this._pitching&&!n.pitching&&this.fire(new o.l("pitchstart",e)),this._rolling&&!n.rolling&&this.fire(new o.l("rollstart",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.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&i!==this._elevationTarget){const n=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(n-(i-(n*e+this._elevationStart))/(1-e)),this._elevationTarget=i}this.transform.setElevation(o.C.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};const i=e.getCameraLngLat(),n=e.getCameraAltitude(),l=this.terrain?this.terrain.getElevationForLngLatZoom(i,e.zoom):0;if(n<l){const h=this.calculateCameraOptionsFromTo(i,l,e.center,e.elevation);return{pitch:h.pitch,zoom:h.zoom}}return{}}_applyUpdatedTransform(e){const i=[];if(i.push(l=>this._elevateCameraIfInsideTerrain(l)),this.transformCameraUpdate&&i.push(l=>this.transformCameraUpdate(l)),!i.length)return;const n=e.clone();for(const l of i){const h=n.clone(),{center:m,zoom:_,roll:v,pitch:S,bearing:I,elevation:k}=l(h);m&&h.setCenter(m),k!==void 0&&h.setElevation(k),_!==void 0&&h.setZoom(_),v!==void 0&&h.setRoll(v),S!==void 0&&h.setPitch(S),I!==void 0&&h.setBearing(I),n.apply(h)}this.transform.apply(n)}
743_fireMoveEvents(e){this.fire(new o.l("move",e)),this._zooming&&this.fire(new o.l("zoom",e)),this._rotating&&this.fire(new o.l("rotate",e)),this._pitching&&this.fire(new o.l("pitch",e)),this._rolling&&this.fire(new o.l("roll",e))}_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const n=this._zooming,l=this._rotating,h=this._pitching,m=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,n&&this.fire(new o.l("zoomend",e)),l&&this.fire(new o.l("rotateend",e)),h&&this.fire(new o.l("pitchend",e)),m&&this.fire(new o.l("rollend",e)),this.fire(new o.l("moveend",e))}flyTo(e,i){if(!e.essential&&De.prefersReducedMotion){const ve=o.Q(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(ve,i)}this.stop(),e=o.e({offset:[0,0],speed:1.2,curve:1.42,easing:o.cn},e);const n=this._getTransformForUpdate(),l=n.bearing,h=n.pitch,m=n.roll,_=n.padding,v="bearing"in e?this._normalizeBearing(e.bearing,l):l,S="pitch"in e?+e.pitch:h,I="roll"in e?this._normalizeBearing(e.roll,m):m,k="padding"in e?e.padding:n.padding,P=o.P.convert(e.offset);let D=n.centerPoint.add(P);const O=n.screenPointToLocation(D),G=this.cameraHelper.handleFlyTo(n,{bearing:v,pitch:S,roll:I,padding:k,locationAtOffset:O,offsetAsPoint:P,center:e.center,minZoom:e.minZoom,zoom:e.zoom});let q=e.curve;const H=Math.max(n.width,n.height),X=H/G.scaleOfZoom,ee=G.pixelPathLength;typeof G.scaleOfMinZoom=="number"&&(q=Math.sqrt(H/G.scaleOfMinZoom/ee*2));const Y=q*q;function re(ve){const Oe=(X*X-H*H+(ve?-1:1)*Y*Y*ee*ee)/(2*(ve?X:H)*Y*ee);return Math.log(Math.sqrt(Oe*Oe+1)-Oe)}function ae(ve){return(Math.exp(ve)-Math.exp(-ve))/2}function K(ve){return(Math.exp(ve)+Math.exp(-ve))/2}const le=re(!1);let xe=function(ve){return K(le)/K(le+q*ve)},me=function(ve){return H*((K(le)*(ae(Oe=le+q*ve)/K(Oe))-ae(le))/Y)/ee;var Oe},ge=(re(!0)-le)/q;if(Math.abs(ee)<2e-6||!isFinite(ge)){if(Math.abs(H-X)<1e-6)return this.easeTo(e,i);const ve=X<H?-1:1;ge=Math.abs(Math.log(X/H))/q,me=()=>0,xe=Oe=>Math.exp(ve*q*Oe)}return e.duration="duration"in e?+e.duration:1e3*ge/("screenSpeed"in e?+e.screenSpeed/q:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=l!==v,this._pitching=S!==h,this._rolling=I!==m,this._padding=!n.isPaddingEqual(k),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(G.targetCenter),this._ease(ve=>{const Oe=ve*ge,Be=1/xe(Oe),ke=me(Oe);this._rotating&&n.setBearing(o.C.number(l,v,ve)),this._pitching&&n.setPitch(o.C.number(h,S,ve)),this._rolling&&n.setRoll(o.C.number(m,I,ve)),this._padding&&(n.interpolatePadding(_,k,ve),D=n.centerPoint.add(P)),G.easeFunc(ve,Be,ke,D),this.terrain&&!e.freezeElevation&&this._updateElevation(ve),this._applyUpdatedTransform(n),this._fireMoveEvents(i)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,i){var n;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const l=this._onEaseEnd;delete this._onEaseEnd,l.call(this,i)}return e||(n=this.handlers)===null||n===void 0||n.stop(!1),this}_ease(e,i,n){n.animate===!1||n.duration===0?(e(1),i()):(this._easeStart=De.now(),this._easeOptions=n,this._onEaseFrame=e,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,i){e=o.aN(e,-180,180);const n=Math.abs(e-i);return Math.abs(e-360-i)<n&&(e-=360),Math.abs(e+360-i)<n&&(e+=360),e}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(o.S.convert(e),this.transform.tileZoom):null}}const In={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class ko{constructor(e=In){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=i=>{!i||i.sourceDataType!=="metadata"&&i.sourceDataType!=="visibility"&&i.dataType!=="style"&&i.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=ie.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=ie.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ie.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(){ie.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,i){const n=this._map._getUIString(`AttributionControl.${i}`);e.title=n,e.setAttribute("aria-label",n)}_updateAttributions(){if(!this._map.style)return;let e=[];
743if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(l=>typeof l!="string"?"":l)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){const l=this._map.style.stylesheet;this.styleOwner=l.owner,this.styleId=l.id}const i=this._map.style.sourceCaches;for(const l in i){const h=i[l];if(h.used||h.usedForTerrain){const m=h.getSource();m.attribution&&e.indexOf(m.attribution)<0&&e.push(m.attribution)}}e=e.filter(l=>String(l).trim()),e.sort((l,h)=>l.length-h.length),e=e.filter((l,h)=>{for(let m=h+1;m<e.length;m++)if(e[m].indexOf(l)>=0)return!1;return!0});const n=e.join(" | ");n!==this._attribHTML&&(this._attribHTML=n,e.length?(this._innerContainer.innerHTML=ie.sanitize(n),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class $l{constructor(e={}){this._updateCompact=()=>{const i=this._container.children;if(i.length){const n=i[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&n.classList.add("maplibregl-compact"):n.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=ie.create("div","maplibregl-ctrl");const i=ie.create("a","maplibregl-ctrl-logo");return i.target="_blank",i.rel="noopener nofollow",i.href="https://maplibre.org/",i.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),i.setAttribute("rel","noopener nofollow"),this._container.appendChild(i),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){ie.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class cu{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const i=++this._id;return this._queue.push({callback:e,id:i,cancelled:!1}),i}remove(e){const i=this._currentlyRunning,n=i?this._queue.concat(i):this._queue;for(const l of n)if(l.id===e)return void(l.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const i=this._currentlyRunning=this._queue;this._queue=[];for(const n of i)if(!n.cancelled&&(n.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var uu=o.aI([{name:"a_pos3d",type:"Int16",components:3}]);class bh extends o.E{constructor(e){super(),this._lastTilesetChange=De.now(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,i){this.sourceCache.update(e,i),this._renderableTilesKeys=[];const n={};for(const l of Te(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i,calculateTileZoom:this.sourceCache._source.calculateTileZoom}))n[l.key]=!0,this._renderableTilesKeys.push(l.key),this._tiles[l.key]||(l.terrainRttPosMatrix32f=new Float64Array(16),o.bX(l.terrainRttPosMatrix32f,0,o.$,o.$,0,0,1),this._tiles[l.key]=new $t(l,this.tileSize),this._lastTilesetChange=De.now());for(const l in this._tiles)n[l]||delete this._tiles[l]}freeRtt(e){for(const i in this._tiles){const n=this._tiles[i];(!e||n.tileID.equals(e)||n.tileID.isChildOf(e)||e.isChildOf(n.tileID))&&(n.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,i){return i?this._getTerrainCoordsForTileRanges(e,i):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){const i={};for(const n of this._renderableTilesKeys){const l=this._tiles[n].tileID,h=e.clone(),m=o.b9();if(l.canonical.equals(e.canonical))o.bX(m,0,o.$,o.$,0,0,1);else if(l.canonical.isChildOf(e.canonical)){const _=l.canonical.z-e.canonical.z,v=l.canonical.x-(l.canonical.x>>_<<_),S=l.canonical.y-(l.canonical.y>>_<<_),I=o.$>>_;o.bX(m,0,I,I,0,0,1),o.M(m,m,[-v*I,-S*I,0])}else{if(!e.canonical.isChildOf(l.canonical))continue;
743{const _=e.canonical.z-l.canonical.z,v=e.canonical.x-(e.canonical.x>>_<<_),S=e.canonical.y-(e.canonical.y>>_<<_),I=o.$>>_;o.bX(m,0,o.$,o.$,0,0,1),o.M(m,m,[v*I,S*I,0]),o.N(m,m,[1/2**_,1/2**_,0])}}h.terrainRttPosMatrix32f=new Float32Array(m),i[n]=h}return i}_getTerrainCoordsForTileRanges(e,i){const n={};for(const l of this._renderableTilesKeys){const h=this._tiles[l].tileID;if(!this._isWithinTileRanges(h,i))continue;const m=e.clone(),_=o.b9();if(h.canonical.z===e.canonical.z){const v=e.canonical.x-h.canonical.x,S=e.canonical.y-h.canonical.y;o.bX(_,0,o.$,o.$,0,0,1),o.M(_,_,[v*o.$,S*o.$,0])}else if(h.canonical.z>e.canonical.z){const v=h.canonical.z-e.canonical.z,S=h.canonical.x-(h.canonical.x>>v<<v),I=h.canonical.y-(h.canonical.y>>v<<v),k=e.canonical.x-(h.canonical.x>>v),P=e.canonical.y-(h.canonical.y>>v),D=o.$>>v;o.bX(_,0,D,D,0,0,1),o.M(_,_,[-S*D+k*o.$,-I*D+P*o.$,0])}else{const v=e.canonical.z-h.canonical.z,S=e.canonical.x-(e.canonical.x>>v<<v),I=e.canonical.y-(e.canonical.y>>v<<v),k=(e.canonical.x>>v)-h.canonical.x,P=(e.canonical.y>>v)-h.canonical.y,D=o.$<<v;o.bX(_,0,D,D,0,0,1),o.M(_,_,[S*o.$+k*D,I*o.$+P*D,0])}m.terrainRttPosMatrix32f=new Float32Array(_),n[l]=m}return n}getSourceTile(e,i){const n=this.sourceCache._source;let l=e.overscaledZ-this.deltaZoom;if(l>n.maxzoom&&(l=n.maxzoom),l<n.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(l).key);let h=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if((!h||!h.dem)&&i)for(;l>=n.minzoom&&(!h||!h.dem);)h=this.sourceCache.getTileByID(e.scaledTo(l--).key);return h}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,i){return i[e.canonical.z]&&e.canonical.x>=i[e.canonical.z].minTileX&&e.canonical.x<=i[e.canonical.z].maxTileX&&e.canonical.y>=i[e.canonical.z].minTileY&&e.canonical.y<=i[e.canonical.z].maxTileY}}class oa{constructor(e,i,n){this._meshCache={},this.painter=e,this.sourceCache=new bh(i),this.options=n,this.exaggeration=typeof n.exaggeration=="number"?n.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,i,n,l=o.$){var h;if(!(i>=0&&i<l&&n>=0&&n<l))return 0;const m=this.getTerrainData(e),_=(h=m.tile)===null||h===void 0?void 0:h.dem;if(!_)return 0;const v=o.cr([],[i/l*o.$,n/l*o.$],m.u_terrain_matrix),S=[v[0]*_.dim,v[1]*_.dim],I=Math.floor(S[0]),k=Math.floor(S[1]),P=S[0]-I,D=S[1]-k;return _.get(I,k)*(1-P)*(1-D)+_.get(I+1,k)*P*(1-D)+_.get(I,k+1)*(1-P)*D+_.get(I+1,k+1)*P*D}getElevationForLngLatZoom(e,i){if(!o.cs(i,e.wrap()))return 0;const{tileID:n,mercatorX:l,mercatorY:h}=this._getOverscaledTileIDFromLngLatZoom(e,i);return this.getElevation(n,l%o.$,h%o.$,o.$)}getElevation(e,i,n,l=o.$){return this.getDEMElevation(e,i,n,l)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){const l=this.painter.context,h=new o.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new o.T(l,h,l.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new o.T(l,new o.R({width:1,height:1}),l.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(l.gl.NEAREST,l.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=o.af([])}const i=this.sourceCache.getSourceTile(e,!0);if(i&&i.dem&&(!i.demTexture||i.needsTerrainPrepare)){const l=this.painter.context;i.demTexture=this.painter.getTileTexture(i.dem.stride),i.demTexture?i.demTexture.update(i.dem.getPixels(),{premultiply:!1}):i.demTexture=new o.T(l,i.dem.getPixels(),l.gl.RGBA,{premultiply:!1}),i.demTexture.bind(l.gl.NEAREST,l.gl.CLAMP_TO_EDGE),i.needsTerrainPrepare=!1}const n=i&&i+i.tileID.key+e.key;if(n&&!this._demMatrixCache[n]){const l=this.sourceCache.sourceCache._source.maxzoom;let h=e.canonical.z-i.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=l?h=e.canonical.z-l:o.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const m=e.canonical.x-(e.canonical.x>>h<<h),_=e.canonical.y-(e.canonical.y>>h<<h),v=o.ct(new Float64Array(16),[1/(o.$<<h),1/(o.$<<h),0]);o.M(v,v,[m*o.$,_*o.$,0]),this._demMatrixCache[e.key]={matrix:v,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:i&&i.dem&&i.dem.dim||1,u_terrain_matrix:n?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:i&&i.dem&&i.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(i&&i.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:i}}getFramebuffer(e){const i=this.painter,n=i.width/devicePixelRatio,l=i.height/devicePixelRatio;return!this._fbo||this._fbo.width===n&&this._fbo.height===l||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new o.T(i.context,{width:n,height:l,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new o.T(i.context,{width:n,height:l,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=i.context.createFramebuffer(n,l,!0,!1),this._fbo.depthAttachment.set(i.context.createRenderbuffer(i.context.gl.DEPTH_COMPONENT16,n,l))),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 i=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let h=0,m=0;h<this._coordsTextureSize;h++)for(let _=0;_<this._coordsTextureSize;_++,m+=4)i[m+0]=255&_,i[m+1]=255&h,i[m+2]=_>>8<<4|h>>8,i[m+3]=0;const n=new o.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),l=new o.T(e,n,e.gl.RGBA,{premultiply:!1});return l.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=l,l}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);const i=new Uint8Array(4),n=this.painter.context,l=n.gl,h=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),m=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),_=Math.round(this.painter.height/devicePixelRatio);n.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),l.readPixels(h,_-m-1,1,1,l.RGBA,l.UNSIGNED_BYTE,i),n.bindFramebuffer.set(null);const v=i[0]+(i[2]>>4<<8),S=i[1]+((15&i[2])<<8),I=this.coordsIndex[255-i[3]],k=I&&this.sourceCache.getTileByID(I);if(!k)return null;const P=this._coordsTextureSize,D=(1<<k.tileID.canonical.z)*P;return new o.a0((k.tileID.canonical.x*P+v)/D+k.tileID.wrap,(k.tileID.canonical.y*P+S)/D,this.getElevation(k.tileID,v,S,P))}depthAtPoint(e){const i=new Uint8Array(4),n=this.painter.context,l=n.gl;return n.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),l.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,l.RGBA,l.UNSIGNED_BYTE,i),n.bindFramebuffer.set(null),(i[0]/16777216+i[1]/65536+i[2]/256+i[3])/256}getTerrainMesh(e){var i;const n=((i=this.painter.style.projection)===null||i===void 0?void 0:i.transitionState)>0,l=n&&e.canonical.y===0,h=n&&e.canonical.y===(1<<e.canonical.z)-1,m=`m_${l?"n":""}
743_${h?"s":""}`;if(this._meshCache[m])return this._meshCache[m];const _=this.painter.context,v=new o.cu,S=new o.aM,I=this.meshSize,k=o.$/I,P=I*I;for(let K=0;K<=I;K++)for(let le=0;le<=I;le++)v.emplaceBack(le*k,K*k,0);for(let K=0;K<P;K+=I+1)for(let le=0;le<I;le++)S.emplaceBack(le+K,I+le+K+1,I+le+K+2),S.emplaceBack(le+K,I+le+K+2,le+K+1);const D=v.length,O=D+(I+1),G=(I+1)*I,q=l?o.bg:0,H=l?0:1,X=h?o.bh:o.$,ee=h?0:1;for(let K=0;K<=I;K++)v.emplaceBack(K*k,q,H);for(let K=0;K<=I;K++)v.emplaceBack(K*k,X,ee);for(let K=0;K<I;K++)S.emplaceBack(G+K,O+K,O+K+1),S.emplaceBack(G+K,O+K+1,G+K+1),S.emplaceBack(0+K,D+K+1,D+K),S.emplaceBack(0+K,0+K+1,D+K+1);const Y=v.length,re=Y+2*(I+1);for(const K of[0,1])for(let le=0;le<=I;le++)for(const xe of[0,1])v.emplaceBack(K*o.$,le*k,xe);for(let K=0;K<2*I;K+=2)S.emplaceBack(Y+K,Y+K+1,Y+K+3),S.emplaceBack(Y+K,Y+K+3,Y+K+2),S.emplaceBack(re+K,re+K+3,re+K+1),S.emplaceBack(re+K,re+K+2,re+K+3);const ae=new ma(_.createVertexBuffer(v,uu.members),_.createIndexBuffer(S),o.aL.simpleSegment(0,0,v.length,S.length));return this._meshCache[m]=ae,ae}getMeshFrameDelta(e){return 2*Math.PI*o.bt/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,i){var n;const{tileID:l}=this._getOverscaledTileIDFromLngLatZoom(e,i);return(n=this.getMinMaxElevation(l).minElevation)!==null&&n!==void 0?n:0}getMinMaxElevation(e){const i=this.getTerrainData(e).tile,n={minElevation:null,maxElevation:null};return i&&i.dem&&(n.minElevation=i.dem.min*this.exaggeration,n.maxElevation=i.dem.max*this.exaggeration),n}_getOverscaledTileIDFromLngLatZoom(e,i){const n=o.a0.fromLngLat(e.wrap()),l=(1<<i)*o.$,h=n.x*l,m=n.y*l,_=Math.floor(h/o.$),v=Math.floor(m/o.$);return{tileID:new o.Z(i,0,i,_,v),mercatorX:h,mercatorY:m}}}class Eo{constructor(e,i,n){this._context=e,this._size=i,this._tileSize=n,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){const i=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),n=new o.T(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return n.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),i.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),i.colorAttachment.set(n.texture),{id:e,fbo:i,texture:n,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(i=>e.id!==i),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(const i of this._recentlyUsed)if(!this._objects[i].inUse)return this._objects[i];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 Ge={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class tt{constructor(e,i){this.painter=e,this.terrain=i,this.pool=new Eo(e.context,30,i.sourceCache.tileSize*i.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,i){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter(n=>!e._layers[n].isHidden(i)),this._coordsAscending={};for(const n in e.sourceCaches){this._coordsAscending[n]={};const l=e.sourceCaches[n].getVisibleCoordinates(),h=e.sourceCaches[n].getSource(),m=h instanceof Pr?h.terrainTileRanges:null;for(const _ of l){const v=this.terrain.sourceCache.getTerrainCoords(_,m);for(const S in v)this._coordsAscending[n][S]||(this._coordsAscending[n][S]=[]),this._coordsAscending[n][S].push(v[S])}}this._coordsAscendingStr={};for(const n of e._order){const l=e._layers[n],h=l.source;if(Ge[l.type]&&!this._coordsAscendingStr[h]){this._coordsAscendingStr[h]={};for(const m in this._coordsAscending[h])this._coordsAscendingStr[h][m]=this._coordsAscending[h][m].map(_=>_.key).sort().join()}}for(const n of this._renderableTiles)for(const l in this._coordsAscendingStr){const h=this._coordsAscendingStr[l][n.tileID.key];h&&h!==n.rttCoords[l]&&(n.rtt=[])}}renderLayer(e,i){if(e.isHidden(this.painter.transform.zoom))return!1;const n=Object.assign(Object.assign({},i),{isRenderingToTexture:!0}),l=e.type,h=this.painter,m=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(Ge[l]&&(this._prevType&&Ge[this._prevType]||this._stacks.push([]),this._prevType=l,this._stacks[this._stacks.length-1].push(e.id),!m))return!0;
743if(Ge[this._prevType]||Ge[l]&&m){this._prevType=l;const _=this._stacks.length-1,v=this._stacks[_]||[];for(const S of this._renderableTiles){if(this.pool.isFull()&&(ir(this.painter,this.terrain,this._rttTiles,n),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(S),S.rtt[_]){const k=this.pool.getObjectForId(S.rtt[_].id);if(k.stamp===S.rtt[_].stamp){this.pool.useObject(k);continue}}const I=this.pool.getOrCreateFreeObject();this.pool.useObject(I),this.pool.stampObject(I),S.rtt[_]={id:I.id,stamp:I.stamp},h.context.bindFramebuffer.set(I.fbo.framebuffer),h.context.clear({color:o.be.transparent,stencil:0}),h.currentStencilSource=void 0;for(let k=0;k<v.length;k++){const P=h.style._layers[v[k]],D=P.source?this._coordsAscending[P.source][S.tileID.key]:[S.tileID];h.context.viewport.set([0,0,I.fbo.width,I.fbo.height]),h._renderTileClippingMasks(P,D,!0),h.renderLayer(h,h.style.sourceCaches[P.source],P,D,n),P.source&&(S.rttCoords[P.source]=this._coordsAscendingStr[P.source][S.tileID.key])}}return ir(this.painter,this.terrain,this._rttTiles,n),this._rttTiles=[],this.pool.freeAllObjects(),Ge[l]}return!1}}const zo={"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","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","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"},Vl=fe,An={hash:!1,interactive:!0,bearingSnap:7,attributionControl:In,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 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],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:o.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0},ni={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class hu{constructor(e,i,n=!1){this.mousedown=h=>{this.startMove(h,ie.mousePos(this.element,h)),ie.addEventListener(window,"mousemove",this.mousemove),ie.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=h=>{this.move(h,ie.mousePos(this.element,h))},this.mouseup=h=>{this._rotatePitchHanlder.dragEnd(h),this.offTemp()},this.touchstart=h=>{h.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=ie.touchPos(this.element,h.targetTouches)[0],this.startMove(h,this._startPos),ie.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),ie.addEventListener(window,"touchend",this.touchend))},this.touchmove=h=>{h.targetTouches.length!==1?this.reset():(this._lastPos=ie.touchPos(this.element,h.targetTouches)[0],this.move(h,this._lastPos))},this.touchend=h=>{h.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._rotatePitchHanlder.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=i;const l=new gh;this._rotatePitchHanlder=new Bs({clickTolerance:3,move:(h,m)=>{const _=i.getBoundingClientRect(),v=new o.P((_.bottom-_.top)/2,(_.right-_.left)/2);return{bearingDelta:o.cm(new o.P(h.x,m.y),m,v),pitchDelta:n?-.5*(m.y-h.y):void 0}},moveStateManager:l,enable:!0,assignEvents:()=>{}}),this.map=e,ie.addEventListener(i,"mousedown",this.mousedown),ie.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),ie.addEventListener(i,"touchcancel",this.reset)}startMove(e,i){this._rotatePitchHanlder.dragStart(e,i),ie.disableDrag()}move(e,i){const n=this.map,{bearingDelta:l,pitchDelta:h}=this._rotatePitchHanlder.dragMove(e,i)||{};l&&n.setBearing(n.getBearing()+l),h&&n.setPitch(n.getPitch()+h)}off(){const e=this.element;ie.removeEventListener(e,"mousedown",this.mousedown),ie.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),ie.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ie.removeEventListener(window,"touchend",this.touchend),ie.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){ie.enableDrag(),ie.removeEventListener(window,"mousemove",this.mousemove),ie.removeEventListener(window,"mouseup",this.mouseup),ie.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ie.removeEventListener(window,"touchend",this.touchend)}}let Zr;function pu(u,e,i,n=!1){if(n||!i.getCoveringTilesDetailsProvider().allowWorldCopies())return u==null?void 0:u.wrap();const l=new o.S(u.lng,u.lat);if(u=new o.S(u.lng,u.lat),e){const h=new o.S(u.lng-360,u.lat),m=new o.S(u.lng+360,u.lat),_=i.locationToScreenPoint(u).distSqr(e);i.locationToScreenPoint(h).distSqr(e)<_?u=h:i.locationToScreenPoint(m).distSqr(e)<_&&(u=m)}for(;Math.abs(u.lng-i.center.lng)>180;){const h=i.locationToScreenPoint(u);if(h.x>=0&&h.y>=0&&h.x<=i.width&&h.y<=i.height)break;u.lng>i.center.lng?u.lng-=360:u.lng+=360}
743return u.lng!==l.lng&&i.isPointOnMapSurface(i.locationToScreenPoint(u))?u:l}const ss={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 Jt(u,e,i){const n=u.classList;for(const l in ss)n.remove(`maplibregl-${i}-anchor-${l}`);n.add(`maplibregl-${i}-anchor-${e}`)}class ar extends o.E{constructor(e){if(super(),this._onKeyPress=i=>{const n=i.code,l=i.charCode||i.keyCode;n!=="Space"&&n!=="Enter"&&l!==32&&l!==13||this.togglePopup()},this._onMapClick=i=>{const n=i.originalEvent.target,l=this._element;this._popup&&(n===l||l.contains(n))&&this.togglePopup()},this._update=i=>{if(!this._map)return;const n=this._map.loaded()&&!this._map.isMoving();((i==null?void 0:i.type)==="terrain"||(i==null?void 0:i.type)==="render"&&!n)&&this._map.once("render",this._update),this._lngLat=pu(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let l="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?l=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(l=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let h="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?h="rotateX(0deg)":this._pitchAlignment==="map"&&(h=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||i&&i.type!=="moveend"||(this._pos=this._pos.round()),ie.setTransform(this._element,`${ss[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${h} ${l}`),De.frameAsync(new AbortController).then(()=>{this._updateOpacity(i&&i.type==="moveend")}).catch(()=>{})},this._onMove=i=>{if(!this._isDragging){const n=this._clickTolerance||this._map._clickTolerance;this._isDragging=i.point.dist(this._pointerdownPos)>=n}this._isDragging&&(this._pos=i.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 o.l("dragstart"))),this.fire(new o.l("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 o.l("dragend")),this._state="inactive"},this._addDragHandler=i=>{this._element.contains(i.originalEvent.target)&&(i.preventDefault(),this._positionDelta=i.point.sub(this._pos).add(this._offset),this._pointerdownPos=i.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(e==null?void 0:e.opacity,e==null?void 0:e.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=o.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=ie.create("div");const i=ie.createNS("http://www.w3.org/2000/svg","svg"),n=41,l=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height",`${n}px`),i.setAttributeNS(null,"width",`${l}px`),i.setAttributeNS(null,"viewBox",`0 0 ${l} ${n}`);const h=ie.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"stroke","none"),h.setAttributeNS(null,"stroke-width","1"),h.setAttributeNS(null,"fill","none"),h.setAttributeNS(null,"fill-rule","evenodd");const m=ie.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"fill-rule","nonzero");const _=ie.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const v=[{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 H of v){const X=ie.createNS("http://www.w3.org/2000/svg","ellipse");X.setAttributeNS(null,"opacity","0.04"),X.setAttributeNS(null,"cx","10.5"),X.setAttributeNS(null,"cy","5.80029008"),X.setAttributeNS(null,"rx",H.rx),X.setAttributeNS(null,"ry",H.ry),_.appendChild(X)}const S=ie.createNS("http://www.w3.org/2000/svg","g");S.setAttributeNS(null,"fill",this._color);const I=ie.createNS("http://www.w3.org/2000/svg","path");I.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"),S.appendChild(I);const k=ie.createNS("http://www.w3.org/2000/svg","g");k.setAttributeNS(null,"opacity","0.25"),k.setAttributeNS(null,"fill","#000000");const P=ie.createNS("http://www.w3.org/2000/svg","path");P.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"),k.appendChild(P);const D=ie.createNS("http://www.w3.org/2000/svg","g");D.setAttributeNS(null,"transform","translate(6.0, 7.0)"),D.setAttributeNS(null,"fill","#FFFFFF");const O=ie.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"transform","translate(8.0, 8.0)");const G=ie.createNS("http://www.w3.org/2000/svg","circle");G.setAttributeNS(null,"fill","#000000"),G.setAttributeNS(null,"opacity","0.25"),G.setAttributeNS(null,"cx","5.5"),G.setAttributeNS(null,"cy","5.5"),G.setAttributeNS(null,"r","5.4999962");const q=ie.createNS("http://www.w3.org/2000/svg","circle");q.setAttributeNS(null,"fill","#FFFFFF"),q.setAttributeNS(null,"cx","5.5"),q.setAttributeNS(null,"cy","5.5"),q.setAttributeNS(null,"r","5.4999962"),O.appendChild(G),O.appendChild(q),m.appendChild(_),m.appendChild(S),m.appendChild(k),m.appendChild(D),m.appendChild(O),i.appendChild(m),i.setAttributeNS(null,"height",n*this._scale+"px"),i.setAttributeNS(null,"width",l*this._scale+"px"),this._element.appendChild(i),this._offset=o.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",i=>{i.preventDefault()}),this._element.addEventListener("mousedown",i=>{i.preventDefault()}),Jt(this._element,this._anchor,"marker"),e&&e.className)for(const i of e.className.split(" "))this._element.classList.add(i);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.hasAttribute("aria-label")||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),e.on("projectiontransition",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("projectiontransition",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),ie.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=o.S.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 i=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
7430,-38.1],"bottom-left":[i,-1*(38.1-13.5+i)],"bottom-right":[-i,-1*(38.1-13.5+i)],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 i,n;const l=(i=this._map)===null||i===void 0?void 0:i.terrain,h=this._map.transform.isLocationOccluded(this._lngLat);if(!l||h){const D=h?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==D&&(this._element.style.opacity=D))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const m=this._map,_=m.terrain.depthAtPoint(this._pos),v=m.terrain.getElevationForLngLatZoom(this._lngLat,m.transform.tileZoom);if(m.transform.lngLatToCameraDepth(this._lngLat,v)-_<.006)return void(this._element.style.opacity=this._opacity);const S=-this._offset.y/m.transform.pixelsPerMeter,I=Math.sin(m.getPitch()*Math.PI/180)*S,k=m.terrain.depthAtPoint(new o.P(this._pos.x,this._pos.y-this._offset.y)),P=m.transform.lngLatToCameraDepth(this._lngLat,v+I)-k>.006;!((n=this._popup)===null||n===void 0)&&n.isOpen()&&P&&this._popup.remove(),this._element.style.opacity=P?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=o.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,i){return(this._opacity===void 0||e===void 0&&i===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=e),i!==void 0&&(this._opacityWhenCovered=i),this._map&&this._updateOpacity(!0),this}}const du={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Da=0,La=!1;const Zl={maxWidth:100,unit:"metric"};function Do(u,e,i){const n=i&&i.maxWidth||100,l=u._container.clientHeight/2,h=u._container.clientWidth/2,m=u.unproject([h-n/2,l]),_=u.unproject([h+n/2,l]),v=Math.round(u.project(_).x-u.project(m).x),S=Math.min(n,v,u._container.clientWidth),I=m.distanceTo(_);if(i&&i.unit==="imperial"){const k=3.2808*I;k>5280?ns(e,S,k/5280,u._getUIString("ScaleControl.Miles")):ns(e,S,k,u._getUIString("ScaleControl.Feet"))}else i&&i.unit==="nautical"?ns(e,S,I/1852,u._getUIString("ScaleControl.NauticalMiles")):I>=1e3?ns(e,S,I/1e3,u._getUIString("ScaleControl.Kilometers")):ns(e,S,I,u._getUIString("ScaleControl.Meters"))}function ns(u,e,i,n){const l=function(h){const m=Math.pow(10,`${Math.floor(h)}`.length-1);let _=h/m;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(v){const S=Math.pow(10,Math.ceil(-Math.log(v)/Math.LN10));return Math.round(v*S)/S}(_),m*_}(i);u.style.width=e*(l/i)+"px",u.innerHTML=`${l} ${n}`}const Pn={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0}
743,ql=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Lo(u){if(u){if(typeof u=="number"){const e=Math.round(Math.abs(u)/Math.SQRT2);return{center:new o.P(0,0),top:new o.P(0,u),"top-left":new o.P(e,e),"top-right":new o.P(-e,e),bottom:new o.P(0,-u),"bottom-left":new o.P(e,-e),"bottom-right":new o.P(-e,-e),left:new o.P(u,0),right:new o.P(-u,0)}}if(u instanceof o.P||Array.isArray(u)){const e=o.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:o.P.convert(u.center||[0,0]),top:o.P.convert(u.top||[0,0]),"top-left":o.P.convert(u["top-left"]||[0,0]),"top-right":o.P.convert(u["top-right"]||[0,0]),bottom:o.P.convert(u.bottom||[0,0]),"bottom-left":o.P.convert(u["bottom-left"]||[0,0]),"bottom-right":o.P.convert(u["bottom-right"]||[0,0]),left:o.P.convert(u.left||[0,0]),right:o.P.convert(u.right||[0,0])}}return Lo(new o.P(0,0))}const Gl=fe;T.AJAXError=o.cy,T.Event=o.l,T.Evented=o.E,T.LngLat=o.S,T.MercatorCoordinate=o.a0,T.Point=o.P,T.addProtocol=o.cz,T.config=o.a,T.removeProtocol=o.cA,T.AttributionControl=ko,T.BoxZoomHandler=Dl,T.CanvasSource=ui,T.CooperativeGesturesHandler=lu,T.DoubleClickZoomHandler=Ao,T.DragPanHandler=jl,T.DragRotateHandler=Po,T.EdgeInsets=Ri,T.FullscreenControl=class extends o.E{constructor(u={}){super(),this._onFullscreenChange=()=>{var e;let i=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((e=i==null?void 0:i.shadowRoot)===null||e===void 0)&&e.fullscreenElement;)i=i.shadowRoot.fullscreenElement;i===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:o.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=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){ie.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const u=this._fullscreenButton=ie.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);ie.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 o.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new o.l("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()}},T.GeoJSONSource=Cr,T.GeolocateControl=class extends o.E{constructor(u){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new o.l("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
743RROR":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 o.l("geolocate",e)),this._finish()}},this._updateCamera=e=>{const i=new o.S(e.coords.longitude,e.coords.latitude),n=e.coords.accuracy,l=this._map.getBearing(),h=o.e({bearing:l},this.options.fitBoundsOptions),m=It.fromLngLat(i,n);this._map.fitBounds(m,h,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const i=new o.S(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).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(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 i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&La)return;this.options.trackUserLocation&&this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new o.l("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=ie.create("button","maplibregl-ctrl-geolocate",this._container),ie.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){o.w("Geolocation support is not available so the GeolocateControl will be disabled.");const i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{const i=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=ie.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new ar({element:this._dotElement}),this._circleElement=ie.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ar({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",i=>{i.geolocateSource||this._watchState!=="ACTIVE_LOCK"||i.originalEvent&&i.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 o.l("trackuserlocationend")),this.fire(new o.l("userlocationlostfocus")))})}},this.options=o.e({},du,u)}onAdd(u){return this._map=u,this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return o._(this,arguments,void 0,function*(e=!1){if(Zr!==void 0&&!e)return Zr;if(window.navigator.permissions===void 0)return Zr=!!window.navigator.geolocation,Zr;try{Zr=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Zr=!!window.navigator.geolocation}return Zr})}().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(),ie.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Da=0,La=!1}_isOutOfMapMaxBounds(u){const e=this._map.getMaxBounds(),i=u.coords;return e&&(i.longitude<e.getWest()||i.longitude>e.getEast()||i.latitude<e.getSouth()||i.latitude>e.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_E
743RROR",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(),i=u.getNorthEast(),n=e.distanceTo(i),l=Math.ceil(this._accuracy/(n/this._map._container.clientHeight)*2);this._circleElement.style.width=`${l}px`,this._circleElement.style.height=`${l}px`}trigger(){if(!this._setup)return o.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new o.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Da--,La=!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 o.l("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 o.l("trackuserlocationstart")),this.fire(new o.l("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"),Da++,Da>1?(u={maximumAge:6e5,timeout:0},La=!0):(u=this.options.positionOptions,La=!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)}},T.GlobeControl=class{constructor(){this._toggleProjection=()=>{var u;const e=(u=this._map.getProjection())===null||u===void 0?void 0:u.type;this._map.setProjection(e!=="mercator"&&e?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var u;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((u=this._map.getProjection())===null||u===void 0?void 0:u.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(u){return this._map=u,this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=ie.create("button","maplibregl-ctrl-globe",this._container),ie.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._container}onRemove(){ie.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},T.Hash=bn,T.ImageSource=Pr,T.KeyboardHandler=Ns,T.LngLatBounds=It,T.LogoControl
743=$l,T.Map=class extends Ht{constructor(u){var e,i;o.cv.mark(o.cw.create);const n=Object.assign(Object.assign(Object.assign({},An),u),{canvasContextAttributes:Object.assign(Object.assign({},An.canvasContextAttributes),u.canvasContextAttributes)});if(n.minZoom!=null&&n.maxZoom!=null&&n.minZoom>n.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(n.minPitch!=null&&n.maxPitch!=null&&n.minPitch>n.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(n.minPitch!=null&&n.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(n.maxPitch!=null&&n.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const l=new gr,h=new ro;if(n.minZoom!==void 0&&l.setMinZoom(n.minZoom),n.maxZoom!==void 0&&l.setMaxZoom(n.maxZoom),n.minPitch!==void 0&&l.setMinPitch(n.minPitch),n.maxPitch!==void 0&&l.setMaxPitch(n.maxPitch),n.renderWorldCopies!==void 0&&l.setRenderWorldCopies(n.renderWorldCopies),super(l,h,{bearingSnap:n.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new cu,this._controls=[],this._mapId=o.a6(),this._contextLost=_=>{_.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new o.l("webglcontextlost",{originalEvent:_}))},this._contextRestored=_=>{this._setupPainter(),this.resize(),this._update(),this.fire(new o.l("webglcontextrestored",{originalEvent:_}))},this._onMapScroll=_=>{if(_.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=n.interactive,this._maxTileCacheSize=n.maxTileCacheSize,this._maxTileCacheZoomLevels=n.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},n.canvasContextAttributes),this._trackResize=n.trackResize===!0,this._bearingSnap=n.bearingSnap,this._centerClampedToGround=n.centerClampedToGround,this._refreshExpiredTiles=n.refreshExpiredTiles===!0,this._fadeDuration=n.fadeDuration,this._crossSourceCollisions=n.crossSourceCollisions===!0,this._collectResourceTiming=n.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},zo),n.locale),this._clickTolerance=n.clickTolerance,this._overridePixelRatio=n.pixelRatio,this._maxCanvasSize=n.maxCanvasSize,this.transformCameraUpdate=n.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=n.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=Bt.addThrottleControl(()=>this.isMoving()),this._requestManager=new Et(n.transformRequest),typeof n.container=="string"){if(this._container=document.getElementById(n.container),!this._container)throw new Error(`Container '${n.container}' not found.`)}else{if(!(n.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=n.container}if(n.maxBounds&&this.setMaxBounds(n.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let _=!1;const v=To(S=>{this._trackResize&&!this._removed&&(this.resize(S),this.redraw())},50);this._resizeObserver=new ResizeObserver(S=>{_?v(S):_=!0}),this._resizeObserver.observe(this._container)}this.handlers=new za(this,n),this._hash=n.hash&&new bn(typeof n.hash=="string"&&n.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:n.center,elevation:n.elevation,zoom:n.zoom,bearing:n.bearing,pitch:n.pitch,roll:n.roll}),n.bounds&&(this.resize(),this.fitBounds(n.bounds,o.e({},n.fitBoundsOptions,{duration:0}))));const m=typeof n.style=="string"||((i=(e=n.style)===null||e===void 0?void 0:e.projection)===null||i===void 0?void 0:i.type)!=="globe";this.resize(null,m),this._localIdeographFontFamily=n.localIdeographFontFamily,this._validateStyle=n.validateStyle,n.style&&this.setStyle(n.style,{localIdeographFontFamily:n.localIdeographFontFamily}),n.attributionControl&&this.addControl(new ko(typeof n.attributionControl
743=="boolean"?void 0:n.attributionControl)),n.maplibreLogo&&this.addControl(new $l,n.logoPosition),this.on("style.load",()=>{if(m||this._resizeTransform(),this.transform.unmodified){const _=o.Q(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(_)}}),this.on("data",_=>{this._update(_.dataType==="style"),this.fire(new o.l(`${_.dataType}data`,_))}),this.on("dataloading",_=>{this.fire(new o.l(`${_.dataType}dataloading`,_))}),this.on("dataabort",_=>{this.fire(new o.l("sourcedataabort",_))})}_getMapId(){return this._mapId}setGlobalStateProperty(u,e){return this.style.setGlobalStateProperty(u,e),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(u,e){if(e===void 0&&(e=u.getDefaultPosition?u.getDefaultPosition():"top-right"),!u||!u.onAdd)return this.fire(new o.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const i=u.onAdd(this);this._controls.push(u);const n=this._controlPositions[e];return e.indexOf("bottom")!==-1?n.insertBefore(i,n.firstChild):n.appendChild(i),this}removeControl(u){if(!u||!u.onRemove)return this.fire(new o.k(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,i,n){return n==null&&this.terrain&&(n=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(u,e,i,n)}resize(u,e=!0){const[i,n]=this._containerDimensions(),l=this._getClampedPixelRatio(i,n);if(this._resizeCanvas(i,n,l),this.painter.resize(i,n,l),this.painter.overLimit()){const m=this.painter.context.gl;this._maxCanvasSize=[m.drawingBufferWidth,m.drawingBufferHeight];const _=this._getClampedPixelRatio(i,n);this._resizeCanvas(i,n,_),this.painter.resize(i,n,_)}this._resizeTransform(e);const h=!this._moving;return h&&(this.stop(),this.fire(new o.l("movestart",u)).fire(new o.l("move",u))),this.fire(new o.l("resize",u)),h&&this.fire(new o.l("moveend",u)),this}_resizeTransform(u=!0){var e;const[i,n]=this._containerDimensions();this.transform.resize(i,n,u),(e=this._requestedCameraState)===null||e===void 0||e.resize(i,n,u)}_getClampedPixelRatio(u,e){const{0:i,1:n}=this._maxCanvasSize,l=this.getPixelRatio(),h=u*l,m=e*l;return Math.min(h>i?i/h:1,m>n?n/m:1)*l}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(It.convert(u)),this._update()}setMinZoom(u){if((u=u??-2)>=-2&&u<=this.transform.maxZoom)return this.transform.setMinZoom(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.setMaxZoom(u),this._update(),this.getZoom()>u&&this.setZoom(u),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(u){if((u=u??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(u>=0&&u<=this.transform.maxPitch)return this.transform.setMinPitch(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)>180)throw new Error("maxPitch must be less than or equal to 180");if(u>=this.transform.minPitch)return this.transform.setMaxPitch(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.setRenderWorldCopies(u),this._update()}project(u){return this.transform.locationToScreenPoint(o.S.convert(u),this.style&&this.terrain)}unproject(u){return this.transform.screenPointToLocation(o.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,i){if(u==="mouseenter"||u==="mouseover"){let n=!1;return{layers:e,listener:i,delegates:{mousemove:l=>{const h=e.filter(_=>this.getLayer(_)),m=h.length!==0?this.queryRenderedFeatures(l.point,{layers:h}):[];m.length?n||(n=!0,i.call(this,new fi(u,this,l.originalEvent,{features:m}))):n=!1},mouseout:()=>{n=!1}}}}if(u==="mouseleave"||u==="mouseout"){let n=!1;return{layers:e,listener:i,delegates:{mousemove:l=>{const h=e.filter(m=>this.getLayer(m));(h.length!==0?this.queryRenderedFeatures(l.point,{layers:h}):[]).length?n=!0:n&&(n=!1,i.call(this,new fi(u,this,l.originalEvent)))},mouseout:l=>{n&&(n=!1,i.call(this,new fi(u,this,l.originalEvent)))}}}}{const n=l=>{const h=e.filter(_=>this.getLayer(_)),m=h.length!==0?this.queryRenderedFeatures(l.point,{layers:h}):[];m.length&&(l.features=m,i.call(this,l),delete l.features)};return{layers:e,listener:i,delegates:{[u]:n}}}}_saveDelegatedListener(u,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[u]=this._delegatedListeners[u]||[],this._delegatedListeners[u].push(e)}_removeDelegatedListener(u,e,i){if(!this._delegatedListeners||!this._delegatedListeners[u])return;const n=this._delegatedListeners[u];for(let l=0;l<n.length;l++){const h=n[l];if(h.listener===i&&h.layers.length===e.length&&h.layers.every(m=>e.includes(m))){for(const m in h.delegates)this.off(m,h.delegates[m]);return void n.splice(l,1)}}}on(u,e,i){if(i===void 0)return super.on(u,e);const n=typeof e=="string"?[e]:e,l=this._createDelegatedListener(u,n,i);this._saveDelegatedListener(u,l);for(const h in l.delegates)this.on(h,l.delegates[h]);return{unsubscribe:()=>{this._removeDelegatedListener(u,n,i)}}}once(u,e,i){if(i===void 0)return super.once(u,e);const n=typeof e=="string"?[e]:e,l=this._createDelegatedListener(u,n,i);for(const h in l.delegates){const m=l.delegates[h];l.delegates[h]=(..._)=>{this._removeDelegatedListener(u,n,i),m(..._)}}this._saveDelegatedListener(u,l);for(const h in l.delegates)this.once(h,l.delegates[h]);return this}off(u,e,i){return i===void 0?super.off(u,e):(this._removeDelegatedListener(u,typeof e=="string"?[e]:e,i),this)}queryRenderedFeatures(u,e){if(!this.style)return[];let i;const n=u instanceof o.P||Array.isArray(u),l=n?u:[[0,0],[this.transform.width,this.transform.height]];if(e=e||(n?{}:u)||{},l instanceof o.P||typeof l[0]=="number")i=[o.P.convert(l)];else{const h=o.P.convert(l[0]),m=o.P.convert(l[1]);i=[h,new o.P(m.x,h.y),m,new o.P(h.x,m.y),h]}return this.style.queryRenderedFeatures(i,e,this.transform)}querySourceFeatures(u,e){return this.style.querySourceFeatures(u,e)}setStyle(u,e){return(e=o.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._val
743idateStyle},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){var i,n;if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(u,e));const l=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!u)),u?(this.style=new ul(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof u=="string"?this.style.loadURL(u,e,l):this.style.loadJSON(u,e,l),this):((n=(i=this.style)===null||i===void 0?void 0:i.projection)===null||n===void 0||n.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new ul(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(u,e){if(typeof u=="string"){const i=this._requestManager.transformRequest(u,"Style");o.j(i,new AbortController).then(n=>{this._updateDiff(n.data,e)}).catch(n=>{n&&this.fire(new o.k(n))})}else typeof u=="object"&&this._updateDiff(u,e)}_updateDiff(u,e){try{this.style.setState(u,e)&&this._update(!0)}catch(i){o.w(`Unable to perform style diff: ${i.message||i.error||i}. Rebuilding the style from scratch.`),this._updateStyle(u,e)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():o.w("There is no style added to the map.")}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 o.k(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 i in this.style._layers){const n=this.style._layers[i];n.type==="hillshade"&&n.source===u.source&&o.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."),n.type==="color-relief"&&n.source===u.source&&o.w("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new oa(this.painter,e,u),this.painter.renderToTexture=new tt(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=i=>{var n;i.dataType==="style"?this.terrain.sourceCache.freeRtt():i.dataType==="source"&&i.tile&&(i.sourceId!==u.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),((n=i.source)===null||n===void 0?void 0:n.type)==="image"?this.terrain.sourceCache.freeRtt():this.terrain.sourceCache.freeRtt(i.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.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new o.l("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 i=u[e]._tiles;for(const n in i){const l=i[n];if(l.state!=="loaded"&&l.state!=="errored")return!1}}return!0}removeSource(u){return this.style.removeSource(u),this._update(!0)}getSource(u){return this.style.getSource(u)}setSourceTileLodParams(u,e,i){if(i){const n=this.getSource(i);if(!n)throw new Error(`There is no source with ID "${i}", cannot set LOD parameters`);n.calculateTileZoom=ye(Math.max(1,u),Math.max(1,e))}else for(const n in this.style.sourceCaches)this.style.sourceCaches[n].getSource().calculateTileZoom=ye(Math.max(1,u),Math.max(1,e));return this._update(!0),this}refreshTiles(u,e){const i=this.style.sourceCaches[u];if(!i)throw new Error(`There is no source cache with ID "${u}", cannot refresh tile`);e===void 0?i.reload(!0):i.refreshTiles(e.map(n=>new o.a3(n.z,n.x,n.y)))}addImage(u,e,i={}){const{pixelRatio:n=1,sdf:l=!1,stretchX:h,stretchY:m,content:_,textFitWidth:v,textFitHeight:S}=i;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||o.b(e))){if(e.width===void 0||e.height===void 0)return this.fire(new o.k(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:I,height:k,data:P}=e,D=e;return this.style.addImage(u,{data:new o.R({width:I,height:k},new Uint8Array(P)),pixelRatio:n,stretchX:h,stretchY:m,content:_,textFitWidth:v,textFitHeight:S,sdf:l,version:0,userImage:D}),D.onAdd&&D.onAdd(this,u),this}}{const{width:I,height:k,data:P}=De.getImageData(e);this.style.addImage(u,{data:new o.R({width:I,height:k},P),pixelRatio:n,stretchX:h,stretchY:m,content:_,textFitWidth:v,textFitHeight:S,sdf:l,version:0})}}updateImage(u,e){const i=this.style.getImage(u);if(!i)return this.fire(new o.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const n=e instanceof HTMLImageElement||o.b(e)?De.getImageData(e):e,{width:l,height:h,data:m}=n;if(l===void 0||h===void 0)return this.fire(new o.k(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(l!==i.data.width||h!==i.data.height)return this.fire(new o.k(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||o.b(e));
743return i.data.replace(m,_),this.style.updateImage(u,i),this}getImage(u){return this.style.getImage(u)}hasImage(u){return u?!!this.style.getImage(u):(this.fire(new o.k(new Error("Missing required image id"))),!1)}removeImage(u){this.style.removeImage(u)}loadImage(u){return Bt.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,i){return this.style.setLayerZoomRange(u,e,i),this._update(!0)}setFilter(u,e,i={}){return this.style.setFilter(u,e,i),this._update(!0)}getFilter(u){return this.style.getFilter(u)}setPaintProperty(u,e,i,n={}){return this.style.setPaintProperty(u,e,i,n),this._update(!0)}getPaintProperty(u,e){return this.style.getPaintProperty(u,e)}setLayoutProperty(u,e,i,n={}){return this.style.setLayoutProperty(u,e,i,n),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,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(u,e,i,n=>{n||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,i=>{i||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,e={}){return this._lazyInitEmptyStyle(),this.style.setSky(u,e),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=ie.create("div","maplibregl-canvas-container",u);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=ie.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","region");const i=this._containerDimensions(),n=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],n);const l=this._controlContainer=ie.create("div","maplibregl-control-container",u),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(m=>{h[m]=ie.create("div",`maplibregl-ctrl-${m} `,l)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(u,e,i){this._canvas.width=Math.floor(i*u),this._canvas.height=Math.floor(i*e),this._canvas.style.width=`${u}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const u=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let e=null;this._canvas.addEventListener("webglcontextcreationerror",n=>{e={requestedAttributes:u},n&&(e.statusMessage=n.statusMessage,e.type=n.type)},{once:!0});let i=null;if(i=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,u):this._canvas.getContext("webgl2",u)||this._canvas.getContext("webgl",u),!i){const n="Failed to initialize WebGL";throw e?(e.message=n,new Error(JSON.stringify(e))):new Error(n)}this.painter=new Bi(i,this.transform),be.testSupport(i)}migrateProjection(u,e){super.migrateProjection(u,e),this.painter.transform=u,this.fire(new o.l("projectiontransition",{newProjection:this.style.projection.name}))}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){var e,i,n,l,h;const m=this._idleTriggered?this._fadeDuration:0,_=((e=this.style.projection)===null||e===void 0?void 0:e.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(u),this._removed)return;let v=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const k=this.transform.zoom,P=De.now();this.style.zoomHistory.update(k,P);const D=new o.F(k,{now:P,fadeDuration:m,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition(),globalState:this.style.getGlobalState()}),O=D.crossFadingFactor();O===1&&O===this._crossFadingFactor||(v=!0,this._crossFadingFactor=O),this.style.update(D)}const S=((i=this.style.projection)===null||i===void 0?void 0:i.transitionState)>0!==_;(n=this.style.projection)===null||n===void 0||n.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((l
743=this.style.projection)===null||l===void 0?void 0:l.transitionState,(h=this.style.projection)===null||h===void 0?void 0:h.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||S)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,m,this._crossSourceCollisions,S),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:m,showPadding:this.showPadding}),this.fire(new o.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,o.cv.mark(o.cw.load),this.fire(new o.l("load"))),this.style&&(this.style.hasTransitions()||v)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const I=this._sourcesDirty||this._styleDirty||this._placementDirty;return I||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new o.l("idle")),!this._loaded||this._fullyLoaded||I||(this._fullyLoaded=!0,o.cv.mark(o.cw.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 i of this._controls)i.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),Bt.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),ie.remove(this._canvasContainer),ie.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),o.cv.clearMetrics(),this._removed=!0,this.fire(new o.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,De.frame(this._frameRequest,u=>{o.cv.frame(u),this._frameRequest=null;try{this._render(u)}catch(e){if(!o.cx(e)&&!function(i){return i.message===Cl}(e))throw e}},()=>{}))}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 Vl}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(u){return this._lazyInitEmptyStyle(),this.style.setProjection(u),this._update(!0)}},T.MapMouseEvent=fi,T.MapTouchEvent=Hi,T.MapWheelEvent=zl,T.Marker=ar,T.NavigationControl
743=class{constructor(u){this._updateZoomButtons=()=>{const e=this._map.getZoom(),i=e===this._map.getMaxZoom(),n=e===this._map.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(e,i)=>{const n=this._map._getUIString(`NavigationControl.${i}`);e.title=n,e.setAttribute("aria-label",n)},this.options=o.e({},ni,u),this._container=ie.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})),ie.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})),ie.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=ie.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.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new hu(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){ie.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.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(u,e){const i=ie.create("button",u,this._container);return i.type="button",i.addEventListener("click",e),i}},T.Popup=class extends o.E{constructor(u){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:"")},this.remove=()=>(this._content&&ie.remove(this._content),this._container&&(ie.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 o.l("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=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=ie.create("div","maplibregl-popup",this._map.getContainer()),this._tip=ie.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const m of this.options.className.split(" "))this._container.classList.add(m);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=pu(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!e)return;const i=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.locationToScreenPoint(this._lngLat));let n=this.options.anchor;const l=Lo(this.options.offset);if(!n){const m=this._container.offsetWidth,_=this._container.offsetHeight;let v;v=i.y+l.bottom.y<_?["top"]:i.y>this._map.transform.height-_?["bottom"]:[],i.x<m/2?v.push("left"):i.x>this._map.transform.width-m/2&&v.push("right"),n=v.length===0?"bottom":v.join("-")}let h=i.add(l[n]);this.options.subpixelPositioning||(h=h.round()),ie.setTransform(this._container,`${ss[n]} translate(${h.x}px,${h.y}px)`),Jt(this._container,n,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=o.e(Object.create(Pn),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 o.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(u){return this._lngLat=o.S.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(),i=document.createElement("body");let n;for(i.innerHTML=u;n=i.firstChild,n;)e.appendChild(n);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=ie.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=ie.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const u=this._container.querySelector(ql);u&&u.focus()}},T.RasterDEMTileSource=rr,T.RasterTileSource=Ei,T.ScaleControl=class{constructor(u){this._onMove=()=>{Do(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,Do(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Zl),u)}getDefaultPosition(){return"bottom-left"}onAdd(u){return this._map=u,this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-scale",u.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){ie.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}}
743,T.ScrollZoomHandler=ou,T.Style=ul,T.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=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=ie.create("button","maplibregl-ctrl-terrain",this._container),ie.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(){ie.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},T.TwoFingersTouchPitchHandler=Fl,T.TwoFingersTouchRotateHandler=Rl,T.TwoFingersTouchZoomHandler=na,T.TwoFingersTouchZoomRotateHandler=Nl,T.VectorTileSource=hr,T.VideoSource=$r,T.addSourceType=(u,e)=>o._(void 0,void 0,void 0,function*(){if(ea(u))throw new Error(`A source type called "${u}" already exists.`);((i,n)=>{qi[i]=n})(u,e)}),T.clearPrewarmedResources=function(){const u=Nr;u&&(u.isPreloaded()&&u.numActive()===1?(u.release(Pi),Nr=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()"))},T.createTileMesh=ol,T.getMaxParallelImageRequests=function(){return o.a.MAX_PARALLEL_IMAGE_REQUESTS},T.getRTLTextPluginStatus=function(){return Kr().getRTLTextPluginStatus()},T.getVersion=function(){return Gl},T.getWorkerCount=function(){return br.workerCount},T.getWorkerUrl=function(){return o.a.WORKER_URL},T.importScriptInWorkers=function(u){return ki().broadcast("IS",u)},T.prewarm=function(){ci().acquire(Pi)},T.setMaxParallelImageRequests=function(u){o.a.MAX_PARALLEL_IMAGE_REQUESTS=u},T.setRTLTextPlugin=function(u,e){return Kr().setRTLTextPlugin(u,e)},T.setWorkerCount=function(u){br.workerCount=u},T.setWorkerUrl=function(u){o.a.WORKER_URL=u}});var F=x;return F})}(kp)),kp.exports}var Xn=wy(),Yn=vy(Xn);class Ty extends Xn.Evented{constructor(){super(...arguments),this._locale="en",this._apiKey="",this._pixelRatio=1,this._webHost="https://www.maptoolkit.net",this._staticHost="https://static.maptoolkit.net",this._stylesHost="https://styles.maptoolkit.net",this._iconsHost="https://icons.maptoolkit.net",this._dataconnectorHost="https://dataconnector.maptoolkit.net",this._routingHost="https://routing.maptoolkit.net",this._staticmapHost="https://staticmap.maptoolkit.net",this._vtcCdnHost="https://vtc-cdn.maptoolkit.net",this._vtcHost="https://vtc.maptoolkit.net",this._rtcCdnHost="https://rtc-cdn.maptoolkit.net"}get locale(){return this._locale}set locale(f){this._locale=f,this.fire("config.locale.set")}get apiKey(){return this._apiKey||console.warn("Maptoolkit API key is not set."),this._apiKey}set apiKey(f){this._apiKey=f,this.fire("config.apiKey.set")}get pixelRatio(){return this._pixelRatio}set pixelRatio(f){this._pixelRatio=f,this.fire("config.pixelRatio.set")}get webHost(){return this._webHost}set webHost(f){this._webHost=f,this.fire("config.webHost.set")}get staticHost(){return this._staticHost}set staticHost(f){this._staticHost=f,this.fire("config.staticHost.set")}get stylesHost(){return this._stylesHost}set stylesHost(f){this._stylesHost=f,this.fire("config.stylesHost.set")}get iconsHost(){return this._iconsHost}set iconsHost(f){this._iconsHost=f,this.fire("config.iconsHost.set")}get dataconnectorHost(){return this._dataconnectorHost}set dataconnectorHost(f){this._dataconnectorHost=f,this.fire("config.dataconnectorHost.set")}get routingHost(){return this._routingHost}set routingHost(f){this._routingHost=f,this.fire("config.routingHost.set")}get staticmapHost(){return this._staticmapHost}set staticmapHost(f){this._staticmapHost=f,this.fire("config.staticmapHost.set")}get vtcCdnHost(){return this._vtcCdnHost}set vtcCdnHost(f){this._vtcCdnHost=f,this.fire("config.vtcCdnHost.set")}get vtcHost(){return this._vtcHost}set vtcHost(f){this._vtcHost=f,this.fire("config.vtcHost.set")}get rtcCdnHost(){return this._rtcCdnHost}set rtcCdnHost(f){this._rtcCdnHost=f,this.fire("config.rtcCdnHost.set")}}const Ii=new Ty;Xn.addProtocol("maptoolkit",(b,f)=>new Promise(x=>{const C=b.url.slice(13).split("?")[0].split("/"),E=new URLSearchParams(b.url.split("#")[0].split("?")[1]);let F=null;const[T,o,fe]=C;if(T==="styles")F=new URL(`/${o}/${fe}.json`,Ii.stylesHost);else if(T==="icons"){const ce=Ii.pixelRatio>1?`@${Math.min(Math.ceil(Ii.pixelRatio),4)}x`:"",Ae=b.type==="json"?"json":"png";F=new URL(`/${o.replace(/(@\dx)?\.(json|png)$/,"")}${ce}.${Ae}`,Ii.iconsHost)}else T==="fonts"?F=new URL(`/fonts/${C.slice(2).join("/")}`,Ii.staticHost):T==="vtc"||T==="rtc"?b.type==="json"?F=new URL(`/${C.slice(1).join("/")}.json`,Ii[`${T}CdnHost`]):F=new URL(`/${C.slice(1).join("/")}`,Ii[`${T}CdnHost`]):T==="dataconnector"&&(F=new URL(`/${o}/${fe}.json`,Ii.dataconnectorHost));F&&(E.forEach((ce,Ae)=>{F==null||F.searchParams.set(Ae,ce)}
743),F.searchParams.set("api_key",Ii.apiKey),fetch(F).then(ce=>b.type==="json"?ce.json():ce.arrayBuffer()).then(ce=>{ce?x({data:ce}):f.abort()}).catch(()=>{f.abort()}))}));const Sy={de:{"AttributionControl.ToggleAttribution":"Attribution ein-/ausblenden","AttributionControl.MapFeedback":"Feedback zur Karte","FullscreenControl.Enter":"Vollbild einschalten","FullscreenControl.Exit":"Vollbild ausschalten","GeolocateControl.FindMyLocation":"Suche meinen Standort","GeolocateControl.LocationNotAvailable":"Standort nicht verfügbar","LogoControl.Title":"MapLibre Logo","Map.Title":"Karte","Marker.Title":"Kartenmarker","NavigationControl.ResetBearing":"Nach Norden ausrichten","NavigationControl.ZoomIn":"Einzoomen","NavigationControl.ZoomOut":"Auszoomen","Popup.Close":"Popup schlieÃen","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.Enable":"Terrain einschalten","TerrainControl.Disable":"Terrain ausschalten","CooperativeGesturesHandler.WindowsHelpText":"Strg + Scroll um zu zoomen","CooperativeGesturesHandler.MacHelpText":"â + Scroll um zu zoomen","CooperativeGesturesHandler.MobileHelpText":"Benutze zwei Finger um die Karte zu bewegen","TerrainControl.ToggleTilt":"Karte kippen und Terrain umschalten, versuche Strg + Ziehen","PitchControl.ChangePitch":"Ziehen um Karte zu kippen","CompassControl.ResetBearing":"Nach Norden ausrichten","CompassControl.RotateLeft":"-90° drehen, versuche Strg + Ziehen","CompassControl.RotateRight":"+90° drehen, versuche Strg + Ziehen","StyleControl.Group.Styles":"Styles","StyleControl.Group.Layers":"Ebenen","StyleControl.Style.Terrain":"Terrain","StyleControl.Style.Light":"Light","StyleControl.Style.Dark":"Dark","StyleControl.Style.City":"CityMaps","StyleControl.Style.Green":"Green","StyleControl.Style.Winter":"Winter","StyleControl.Style.Satellite":"Satellit","StyleControl.Style.Hiking":"Wandern","StyleControl.Style.Cycling":"Fahrrad","StyleControl.Style.Pistes":"Schi","StyleControl.Style.Protected":"Naturschutzgebiete","StyleControl.Style.Oepnv":"ÃPNV","IsochroneControl.Tooltip.foot":"Zieh' mich auf die Karte, um {range} Min-FuÃweg anzuzeigen","IsochroneControl.Tooltip.bike":"Zieh' mich auf die Karte, um {range} Min-Radweg anzuzeigen","IsochroneControl.Tooltip.car":"Zieh' mich auf die Karte, um {range} Min-Autofahrt anzuzeigen"},en:{"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","TerrainControl.ToggleTilt":"Tilt map and toggle terrain, try Ctrl + mouse drag","PitchControl.ChangePitch":"Drag to change map pitch","CompassControl.ResetBearing":"Reset bearing to north","CompassControl.RotateLeft":"Rotate -90°, try Ctrl + mouse drag","CompassControl.RotateRight":"Rotate +90°, try Ctrl + mouse drag","StyleControl.Group.Styles":"Styles","StyleControl.Group.Layers":"Overlays","StyleControl.Style.Terrain":"Terrain","StyleControl.Style.Light":"Light","StyleControl.Style.Dark":"Dark","StyleControl.Style.City":"CityMaps","StyleControl.Style.Green":"Green","StyleControl.Style.Winter":"Winter","StyleControl.Style.Satellite":"Satellite","StyleControl.Style.Hiking":"Hiking","StyleControl.Style.Cycling":"Cycling","StyleControl.Style.Pistes":"Skiing","StyleControl.Style.Protected":"Protected Areas","StyleControl.Style.Oepnv":"ÃPNV","IsochroneControl.Tooltip.foot":"Drag me onto the map to show a {range}-min walking area.","IsochroneControl.Tooltip.bike":"Drag me onto the map to show a {range}-min cycling area.","IsochroneControl.Tooltip.car":"Drag me onto the map to show a {range}-min driving area."}};function Cy(){return Sy[Ii.locale||"en"]}const My={scale:{maxWidth:80,unit:"metric"}};class Iy{constructor(f){this.options=Object.assign(My,f),this._attribCtrl=ne
743w Xn.AttributionControl(this.options),this.options.scale!==!1&&(this._scaleCtrl=new Xn.ScaleControl(this.options.scale))}getDefaultPosition(){return"bottom-right"}onAdd(f){this._map=f;const x=this._attribCtrl.onAdd(f);if(x.classList.add("maptoolkit-ctrl-attrib"),this._scaleCtrl){const C=this._scaleCtrl.onAdd(f);C.classList.remove("maplibregl-ctrl"),x.appendChild(C)}return this._container=x,this._container}onRemove(){var f;(f=this._container)!=null&&f.parentNode&&this._container.parentNode.removeChild(this._container),this._map=void 0}}const Ay={};class Py{constructor(f){this.options=Object.assign(Ay,f)}getDefaultPosition(){return"bottom-left"}onAdd(f){this._map=f,this._container=document.createElement("div"),this._container.classList.add("maplibregl-ctrl","maptoolkit-ctrl","maptoolkit-ctrl-logo");const x=document.createElement("a");x.classList.add("maptoolkit-ctrl-logo-anchor"),x.href=Ii.webHost,x.target="_blank";const C=document.createElement("img");return C.classList.add("maptoolkit-ctrl-logo-image"),C.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJ0AAAAwCAYAAAALpHjmAAAAAXNSR0IArs4c6QAAFyJJREFUeF7tXAtUU1e63jxCoxfESqxFbRFHwQdOlasGkfLSCe2ACmKcK1axWh+oLdhlg/Qh1WoR7ChY310KlhEHUdAKCtyqYBWCL2AEheltSG3FF2mjsZYCMXd9mbOztocAIYhTHM5aXZaTvf+99/9/+9//ax8L0v10JgeEKpVqb01NTdLYsWMvEEIedeZgXYW2RVeZaBecp6VEIhmRnZ19YfPmzW9FR0cfJoTUd8F1PPEpd4PuibPUQFB4+PDhNdOnT5dt2LDhw5iYmK2EkHudN1zXodwNus6TlaNCoShydnYeFB0dHZ+QkBDXDbp/MbsbdJ0DOsv4+PhZMpnsbyC/YcOGnTExMau6Qdcy6Cyrq6ulhBB7V1fXZEJIoxlysbx48eI4oVDo6+bmlvQfaMvYy+XydLFYHMCA7iNCSJ0ZvGyzS0lJiQNtJBaLVcY6mNKmzYGeUANjms6xoaFBIRAIhEeOHAkJCQn5ygyvS/Tbb79V2djYOHSAxhNa4tMnI5FI3A4fPlxma2trhdG3bt164O23336nE0AnvH79+s6XXnopnK5SpVJliUSiuYSQB9y7Zm1++umnUw4ODtOYNqYySVBdXT0dCkmtVh9uCeBtEeODznLlypWvb9y4MRsda2pqCgcPHozJtccAFmRmZu4MCQmZDxpZWVl7p0+f/m47abQ179/z7wYHgk6yE0HnWFZWlv7KK6+8SseqqKioHjVqFDTs99w7R7lcnky1LidX5eDBg32ZNqbw01alUh3t06ePPxo3NDSo0tPTfefOnXu1vUqJDzphYmLi2sjIyPfoLDZu3DhFJpMdbwdhx/v371+2s7N7ETQKCgpK/Pz8QgghN01Z2TPQxuBA0LXs27cvZ968eQs7gQeuJ0+ezPL39x9Oxzp//vx1sVgcSAip4N4Nyc7OPhAYGDiWAebtUaNGvUYIKTOR35YJCQl/fu+9946x7UtLS790d3df1l6NyQedCJopODh4CiVeXl7+zejRo/G3KdpOcOzYsaigoKAE2r+mpga76k+EkP8zcYFdudljJ8UzBDpbmUw2Pz4+Hva54cnPz/86ICAAR3m7FAofdE5FRUXZEyZMcKOUm5qadDExMVM+++yzEyZoO9Hdu3flIpHoD7T/gwcPtHZ2dthlpu6qrgw6OBApYrE4mF3EkSNHjoWEhLzdzuPMFD48LU0nJIQEVFVVpbu6uj6HiUGuUql0e25uLkJBHQKda21trdzR0bE3u+KSkpI8Dw+Pv7Sh7SxTUlIWh4eHb+dza8aMGXMOHz6cZgJoTWF0Z7WxzMvLc3JwcHgBA6hUqjsBAQGwi9qTuhqiVqvL7O3t/+sZA50lIeSPIpEoYv78+aE9e/bUffXVV8WXL1/eAwuKh4s2+cjXdOMbGxvl1tbWj71vbGysnz179p8yMjLOtiJxkUKhuIBgKL9NUlLSxqioqNW/49CJpVwunyIWi4/QucNQfu6556CxTTEr9N2kUqlXcHDwFrVa/YcBAwYIvby8BA4ODhY5OTkXg4KCZnRhTYfl2RNCRhFCRhBCoO2qCSFXCCG3mY1pmZWVNTU4ODiLx8dhrOfOgksgk8ki+Oc27fzNN9+ke3t7v9WC0fhYMJQPOu54gTfbKXGqJ6D6bJOTk9fMmzcPXrb+McMsEBBC+hNC4BUOt7GxcbS2tnaUSqWO/fr1u5CQkLCmi4MObMExa8uxCHnkh7yTwDYuLi5y1apV61rjIwu6ZoxnhQkhhIaGjs7Pz6deEfuzvUKhOOrs7OxjDADFxcUVnp6eQZ3A9CeANz0JUVxc3CerVq1awmMWANSaduePD4HYEUJwvOL/cVRDQ8DmgVYwWWuauLCnZdOZOB1iL5PJYuLj46Nb4yMLOlFeXt4BiUQyuaURuJgbXGS2WkLvsSUkJGRbWDSPNet0OnLr1i11//79PTiVbOoCnma7JwU6/pyh/XpyL6EVzMnutMaHLg+6IVeuXMl2c3NzZVFKo+p4d+/evV969+49kqex7MvKyo6xAUpoRbYfPGCBQADQnTfCQUS53xSJRL6PHj0a36tXr94WFhZ6Q7y+vl7d0NBQrFQq41uoR9NH23v27NlLpVLlurq6fnnx4sVXnJ2dI21tbSWgo9Ppfnnw4EH5t99+u8XDwwNxJr5jYHv9+vWtTU1NPqw9ijlXVlaeHThwoN4k4OgbSwvqU34YUyAQ+AmFwt50zLq6Onh7pqQS9Tbl0KFD/2KExm5XV9fMFgD7pEBnGF+n0+EIJRYWFvUXL178ICAgoIaTmYHX9PecnJxPmeCw/vd79+55sBji8xHZElY1jVar1WdZzys6Olq1fv36PqxjkZmZmRAaGvohxwRLqVTqmZaWdoZtg37x8fGGfCAmGR0dHZmQkIDyHlbozQxPY9saE7906VKIEdA46XQ6JfrA8K+srMwZM2YM4kZGH6SIYmNjF27bto3mJ/U1b3l5eTj6WnygrZVKJbIzcAZYu1TP6IEDB4Yb0/IgWFdX992JEyeCW4rcL1u2zGHNmjVfODg4IIBu9Llz5055WVlZCAMA2u5JgE4POHd3978j9UkJQ8EsXLjwtYyMjCJOZk4NDQ1VbJvs7GzZlClTPod+QOqvLT5yYB1qAN24ceNeO3/+PGJxhmfSpElFERERw2bMmNGHvrx58yaOSngwsFNs5XJ5KhuXqq6u/s3d3f3MvXv3JrNATElJ2fTmm2/G8hwRoYuLy2vV1dUGb6clxms0mlu9evWC98QK3Uun033TGmD4v3GpPdiXyE1ajhs3TsJftzF6nF0KYNAgt61CochuyY5labSSMrK/fft24QsvvPBKW2vA+ouLiz15wOso6P4BbzMwMPAAC6abN29qZ8yYsa+oqAiA+gcHuvEajaaIPcG4qMR6QojGVD5aWFi8SkEniIuLk7FeB5gwYsSIhB49egy/dOmSIUOB9xzCEyUSiSub2MZvsbGx8rVr1x5TKpWxTk5ONpSZXPR6Fg80sHn8qqqqvhKJRDZVVVW/KhQKotFomhBymDp1qg2rQRISEt6Ijo4+wGhLX51Od9qYwFQqlQ7vEbLg/07nTwjRuri4TK2srMzkh4n4fXJycq4FBQUBdAgVCCoqKt4dOXLkBrYdZ79qn3/+eUuhUPjYuN
743BW/fr1g6NFnQmhXC5PFIvFi1ka0Oo3btxo7Nevn4ClwWhbumHQrSOgm5qVldXfGOCCgoKOX758OZUQAt7STe6l0WgKWNBxJVuonvkJfCwvL8/kr5vPRwsLCz/KGPvMzMxNNEmPhlCvDg4Oi7RareDs2bPbJ06cSA1iwjFwmlwuj2GZBkEPHz78g7t3714tKSnZMn78+JfpoEYS0fQnZD/eEAgEzrAjGhoaIJSH+HvPnj1Bc+bMMYxrRFs2Ax3syZkzZyoKCwv1x66Pj8+g1NTUISz4cOT17dsXNuZPhJCxIpFowdSpU6ft2bOnH50U6AwcOPAy/m5sbFQ/fPgQ9iAqbhAwdlSr1d+ypsi5c+cezp0797tbt27dEggEvVesWOG8evVqEbtp9u3bt3TevHm7sGlwHKGUndUwR48ebXj33XerKY1PP/3UdenSpb1YwfFy4WaDLjU19dN169bFs+NDfhKJJJsBHPhDzaFWQUf56Ofn53fw4MGhxvgoEAhK6+rqdlDQOZ4+fTrL19dXjMbYVeXl5Q/GjBnzOo6hRYsWrdu1axeSyIYHJdgRERExLOOTkpK+jYqKWk4IUe/fv39nWFjYGNqBc0IgaH7IBSEF59DQULewsLBRAwYMsLexsemhVCqb6uvr/WfNmmUINnPeM9xxuvuagS4qKqoyKSkJ2Y+L3NgjwsPDF6SkpBhSe3g/c+bMVzl7BaaD+6JFi95h18jF6VYSQlBF0UAI+ZEQcgsbgp95+f777xtcXFz+3tDQcIoDJdY0Ydu2bREsaLg8NkqDHiQnJ69n44JlZWUPxGJxplarzdNqtbVcqGVCRkbGQta84eKl0I7YnGaBDsennZ0dYbUWADdz5sziwsLCbVqtNp/bkKz93RroIA+secyiRYtWtsJHNU4KCjpXhUKRy3pv3HESxjF7elVV1Raad4PQ+B5qfX29zt3dfeO1a9eQBhMkJSXteOeddx4Lv4wfP/71Cxcu5LLgNcWQpu2NVGs0Ax1MgmvXrn1BCFFw/V4ihMzWaDRreUcD7i38lQv/tBQywfzPMPOFEJqdCtxmQ2UOUkIaQgjMimGenp5vnzt3Tl/ihYcpflDzw1OcWQKbt4SjAQ0/WiqVyg4ePGgwb3gnhlmg4x95UDKTJ08u4gCHI5XNMtDmbYEO7VqK07F8fERBN76hoaGQVbVbtmz5OjIyMoLbueLVq1dvXLNmDTSV0efQoUM/SaVSMPgkAqRvvfXWB1988QVieoaH82B3MO6/yYY0iJgCOh8fn+VnzpzZxzgseruxtrY2nc0pM0YwNEZ74nSOWVlZu9hKHIZXbCWNvZWVVWBTU9N+ygDOCfMjhPx8+vTpdHqy4Pfo6OhkI1kLew8Pj+XFxcX6CD/AUVlZibIk2IawLc0CHejwvW3GUcJmNZZv7gjoHguyA3SWoaGhYYcOHYLhyAIETPiA81Id+/btO6+8vPwTR0dHfTUs/5k4ceLeoqIilDSBGfbe3t5vFBYWIkRieHgFnc0KBKDiZTLZnYKCgjvotGnTJtdp06YZnBFTQMcVFxxiA9jwzM+cOXOcNXJ5l2XaBbrPP//8r8uXL4dTpH+4mkEURNDCSbxullasqKgAYKZCk6SkpGwLDw83mCxcqhDHJluxYZ+YmPgBW9946tSpa5MmTZrJmSlmgQ72Z11dnTXLW0z4hx9+2Pfyyy8jK2PsquQTBV2zwk1MYMKECR/K5XJ6bQ7xG4/ExMTdkZGRBiORMh2L8PHxWajVanM4W0OvXerq6nJZA55X0GmflZWVymoM7phKIYR8Swh5fsOGDUujo6MN4QQzQdcsrANTwNbW9g2tVgvHAKGT9oBO5OHhsZjVPk1NTfXvv//+DF75V7MCiLS0tNLZs2fjNLjNPwmYuJgh7QZnY//+/UfYUjFOq8JuNlvTQV6BgYGVBQUFw0ePHk1zqXpxcoWZAD8feGaBDrzu0aOHN5tOhKZrVrjJNUR4II8Z3Gn48OFLL1++/B7fLV68eHHO7t27ETCmMR3M36u0tPQEuyheQWezY4oTCnYajPdBRUVFB9jaPlNAhzEaGxvjNBpNeVNT04v9+/cPYe8QYGL5+fnqgIAAaCbYL0hNiWQy2Uo2Z4h20MwuLi7/fPHFF8UqlQrZBWQGUGExqbS09G/s2gCaH3/88ZP6+voCjOvs7LyGjb8hFDJlypStubm5sCNhUAcrlcrdbFgJsbibN2/GYu52dnaD+vTps54FHOTi5+f3kVwu38tpRLM0HadxN7i7u/tnZmYGsHPAuktKSnZ5eHhE8YBnFuhAD1p86NCh58BHmpFwunLlSh6bukCAd9iwYShnhhFNz3fsiElpaWmJrEfJtcWlEwiEDdyOzs7OTgsMDDSUUvMqNxxlMtn6+Pj4N6nGhGCuXLmSamNjc7Vv376z+EFTU0AHewVPSxkCCG7SpEnJjCmA5vZz5sxZ/uWXXxqqI/jmAxcmgkGMMMIfpVLp2rS0tKC24nuUzoEDB5RhYWEQJHU2PJcsWfLJjh07YO/on9bmjt+2bNlCowOQCzRRR0D3P1i3u7v7gvz8/CD2RMJYV69eXeXm5raJsb9NAZ2tt7d3ON+sYnlpYWGhz0i41dbWfsMa2VydPa4h8nOlQzw9PWPOnj07nwqV87rgudF0CR1jiDEPlinoRDVGs93OFzb7tymga60/mLlixQqEVGCrssWH+g1VW1t7uCWbFRsiLCzMm6spFFlZWUmWL1/+/ubNm0e2BHDW/PDy8kJ0H3lYmA7YyI6EkCmJiYkrjZks/HVwjhq0JBwTajt2BHRQKggD+fn7+0fl5ORM4Aejc3JykOZK5IBnCuj0FcZKpfIgX3vS9dCMxPhHjx6VsIzjjjnkMI3F1CR5eXm7JRJJbyYYDDuMX7LcTJNhYO4TC2CelhAidnd3l2VnZ//ZmLBxDKanp/9Gg7YdAR1iU5GRkYqMjAwIH7bcD2zxIYKbS5Ysid++fbuvMRDh+FywYMESrgIaSxlMCAmSSqVLN27c6GSMydCqe/fu1Sxbtgze9EGuZJ9eDYTdCxqh4eHhs+Li4oYb4wFoxMfHqz7++GNU6eI0gQlD7a2Ogg60EBCXhIeHr0xOTnZj146Ntnnz5qncxSzPVjIS9IRDhXGrfKQZidEI/lpbW/83OCkQCFQlJSUHGLuB3XQgOsLT03NFbGzs9OPHj99ISkqCUSs3YngiWCiJjIyMbWxs1Cf/Qfvo0aPrlEolrjjqDXjsNBsbm6CoqKhANze3Hr169bK+ceNGfXZ29u2TJ08WI0MRHh7u17t3b4vS0tIdZ86cSW8tOLxgwYLbQqFQ5+Hh0Qu07t+/31RQUKBJTU0tbGxsRDiHBnD5ZUZ6zePv7x+OQDXScOirUCgelpSU/HzixAnEF3Fjv5Tb+QCNEyHE38bGZuK0adMm+Pr69qP9Kioqft26devlhw8fQqPiODRWTwfNABo+AoFg0pw5c3x8fX3t6Lzlcvn9lJSUKxyNrzlbl4IWLNXb2RKJJBA8Bn+rq6tP5ebmbmFyxE4eHh5viMXiWbw22zhnBDJFLDMAax82bBg2gl5W9vb2mrVr10Zyax4Jk6Jv377jeLJEvp6tE4RMA/39/Rfx+VhZWVmckZGxDscrmD2eEIKUFcIhPxNCyrlJswuk4AOYkLkYa2VlpdRqtTDGjV3MoEJBVmIAOltZWd3RarWXuMAthI4FIyOAbMFoQgiuLSIoeoujjbgXsgFDraysBFqtFg5GFQPwZsHhiIiIgp07d/4vIQTpI9BCHRtiT+j7HQdYY3VttPIXvICHjrmg731mLvAYEfyldi6dP8qxUQQBgdExkb1AWVAld4y19MUmjAtBoaTMhUfjBgcMjIuALZ8GZIF+4B0dF+tkAU7bwLZ+nlvTPzkgUbDQtYMOxQFOIqwBJhZOBX3mhhvPyogsKT5YWiiDM/CR48V5gI4WGuJf/AeBAGwtMQmMhj2Gyzu/cChvqTiRTxtC/M0Ibex4MAR1dAA+xoaHBwHjb5p/5fdtBjouCY1dDBroC+aBFhjcVhEluzbMCX2xRsybBRvf5MI6IVzMn+2HPvyS7pbMTloKDr6y825LFuAN+lLZ8cvIsaa22mBOdO0UB3iHudPiU/7vLcmSpYW1UH6A93qZdvUP6LQEuk77bgiDGEPxZvdHD1tz35r/1g269vGLbS1MSUl5k165RM2cWq3+0draWtWOimHzR+/CPbtBZ77wkNwON3Z7jssxw2N90hdxzJ/t76hnN+jMF4bRgDIXLEe2A56yMUfM/BGfkZ7doDNfkEJvb+8F/Og7FyxHmAH1fO35OoD5M+liPbtBZ77AhKGhoTPY6hyk+QYPHvzR3bt3jQXLzR/pGevZDTrzBSocNGhQcE1NDe5s6B8uv4oKDZobNZ/6M9yzq4POq6SkZL+9vb3+bsOvv/7auGnTpg2pqalP40vmAhcXl0B6kw15XS8vL9QU4itG/wmfRTN7W3R10CEaHyoQCPQ1d42NjcgAIMWGz5J1thGPYOlknU6H8i+CGjUvL695qJzq9lpbx2NXBx2qQ5Bmwb+oMEaIAqmb1rIHZu9QIx3xVYLTSJK3UFP4JMd6Zmh1ddD9uwXhq9FovtZoNKR///5LjdQU/rvn97scvxt0HROLvsZsz549iqioKJSh4yZXW/ndjo34DPTuBl3HhOhVW1uLjwcl3L17F3dt2Ys5HaP8DPfuBl3HhAtHBtcyUTL1NJyXjs32d9K7G3QdEwTKmWgdW3ee1URe/j+RFHPchjfb3wAAAABJRU5ErkJggg==",C.alt="Maptoolkit Logo",x.appendChild(C),this._container.appendChild(x),this._container}onRemove(){var f;(f=this._container)!=null&&f.parentNode&&this._container.parentNode.removeChild(this._container),this._map=void 0}}const ky={TERRAIN:"maptoolkit://styles/toursprung/terrain"};function Ey(b){let f=0;for(let x=0;x<b.length;x++)f+=b.charCodeAt(x);return f.toString(16)}var zy=8,Dy={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"}
743,bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},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"}},Ly={"*":{type:"source"}},Ry=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],Fy={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:"*"}},By={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:"*"}},Oy={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:"*"}},jy={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"}},Ny={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"}}},Uy={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"}}},$y={id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},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"}},Vy=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],Zy={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},qy={"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"}},Gy={"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"}},Hy={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Wy={"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:{}
vendor: 7,428 bytes, line 743
743,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"}},Xy={"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"}
743,"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"}},Yy={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Ky={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Jy={type:"array",value:"*"},Qy={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},ex={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},tx={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},rx={type:"array",value:"*",minimum:1},ix={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}},ax={"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}},sx={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},nx={type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},ox=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],lx={"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"}},cx={"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"}
vendor: 6,693 bytes, line 743
743,"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"}},ux={"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"}},hx={"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"}},px={"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"}},dx={"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}
743,"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"}},fx={"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,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:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",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"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},mx={"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"}},gx={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},_x={"*":{type:"string"}},yx={$version:zy,$root:Dy,sources:Ly,source:Ry,source_vector:Fy,source_raster:By,source_raster_dem:Oy,source_geojson:jy,source_video:Ny,source_image:Uy,layer:$y,layout:Vy,layout_background:Zy,layout_fill:qy,layout_circle:Gy,layout_heatmap:Hy,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:Wy,layout_symbol:Xy,layout_raster:Yy,layout_hillshade:Ky,"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:Jy,filter_operator:Qy,geometry_type:ex,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:tx,expression:rx,light:ix,sky:ax,terrain:sx,projection:nx,paint:ox,paint_fill:lx,"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:cx,paint_circle:ux,paint_heatmap:hx,paint_symbol:px,paint_raster:dx,paint_hillshade:fx,"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"}},paint_background:mx,transition:gx,"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:_x};
743class xx extends Error{constructor(f,x){super(x),this.message=x,this.key=f}}class Np{constructor(f,x=[]){this.parent=f,this.bindings={};for(const[C,E]of x)this.bindings[C]=E}concat(f){return new Np(this,f)}get(f){if(this.bindings[f])return this.bindings[f];if(this.parent)return this.parent.get(f);throw new Error(`${f} not found in scope.`)}has(f){return this.bindings[f]?!0:this.parent?this.parent.has(f):!1}}const Vu={kind:"null"},Ue={kind:"number"},Mt={kind:"string"},bt={kind:"boolean"},hs={kind:"color"},Up={kind:"projectionDefinition"},Yo={kind:"object"},xt={kind:"value"},vx={kind:"error"},Zu={kind:"collator"},$p={kind:"formatted"},Vp={kind:"padding"},Fu={kind:"colorArray"},Zp={kind:"numberArray"},qu={kind:"resolvedImage"},qp={kind:"variableAnchorOffsetCollection"};function ha(b,f){return{kind:"array",itemType:b,N:f}}function cr(b){if(b.kind==="array"){const f=cr(b.itemType);return typeof b.N=="number"?`array<${f}, ${b.N}>`:b.itemType.kind==="value"?"array":`array<${f}>`}else return b.kind}const bx=[Vu,Ue,Mt,bt,hs,Up,$p,Yo,ha(xt),Vp,Zp,Fu,qu,qp];function gc(b,f){if(f.kind==="error")return null;if(b.kind==="array"){if(f.kind==="array"&&(f.N===0&&f.itemType.kind==="value"||!gc(b.itemType,f.itemType))&&(typeof b.N!="number"||b.N===f.N))return null}else{if(b.kind===f.kind)return null;if(b.kind==="value"){for(const x of bx)if(!gc(x,f))return null}}return`Expected ${cr(b)} but found ${cr(f)} instead.`}function Gp(b,f){return f.some(x=>x.kind===b.kind)}function qn(b,f){return f.some(x=>x==="null"?b===null:x==="array"?Array.isArray(b):x==="object"?b&&!Array.isArray(b)&&typeof b=="object":x===typeof b)}function Hs(b,f){return b.kind==="array"&&f.kind==="array"?b.itemType.kind===f.itemType.kind&&typeof b.N=="number":b.kind===f.kind}const Bm=.96422,Om=1,jm=.82521,Nm=4/29,Ko=6/29,Um=3*Ko*Ko,wx=Ko*Ko*Ko,Tx=Math.PI/180,Sx=180/Math.PI;function $m(b){return b=b%360,b<0&&(b+=360),b}function Vm([b,f,x,C]){b=gp(b),f=gp(f),x=gp(x);let E,F;const T=_p((.2225045*b+.7168786*f+.0606169*x)/Om);b===f&&f===x?E=F=T:(E=_p((.4360747*b+.3850649*f+.1430804*x)/Bm),F=_p((.0139322*b+.0971045*f+.7141733*x)/jm));const o=116*T-16;return[o<0?0:o,500*(E-T),200*(T-F),C]}function gp(b){return b<=.04045?b/12.92:Math.pow((b+.055)/1.055,2.4)}function _p(b){return b>wx?Math.pow(b,1/3):b/Um+Nm}function Zm([b,f,x,C]){let E=(b+16)/116,F=isNaN(f)?E:E+f/500,T=isNaN(x)?E:E-x/200;return E=Om*xp(E),F=Bm*xp(F),T=jm*xp(T),[yp(3.1338561*F-1.6168667*E-.4906146*T),yp(-.9787684*F+1.9161415*E+.033454*T),yp(.0719453*F-.2289914*E+1.4052427*T),C]}function yp(b){return b=b<=.00304?12.92*b:1.055*Math.pow(b,1/2.4)-.055,b<0?0:b>1?1:b}function xp(b){return b>Ko?b*b*b:Um*(b-Nm)}function Cx(b){const[f,x,C,E]=Vm(b),F=Math.sqrt(x*x+C*C);return[Math.round(F*1e4)?$m(Math.atan2(C,x)*Sx):NaN,F,f,E]}function Mx([b,f,x,C]){return b=isNaN(b)?0:b*Tx,Zm([x,Math.cos(b)*f,Math.sin(b)*f,C])}function Ix([b,f,x,C]){b=$m(b),f/=100,x/=100;function E(F){const T=(F+b/30)%12,o=f*Math.min(x,1-x);return x-o*Math.max(-1,Math.min(T-3,9-T,1))}return[E(0),E(8),E(4),C]}const Ax=Object.hasOwn||function(b,f){return Object.prototype.hasOwnProperty.call(b,f)};function qm(b,f){return Ax(b,f)?b[f]:void 0}function Px(b){if(b=b.toLowerCase().trim(),b==="transparent")return[0,0,0,0];const f=qm(kx,b);if(f){const[E,F,T]=f;return[E/255,F/255,T/255,1]}if(b.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(b)){const E=b.length<6?1:2;let F=1;return[zu(b.slice(F,F+=E)),zu(b.slice(F,F+=E)),zu(b.slice(F,F+=E)),zu(b.slice(F,F+E)||"ff")]}if(b.startsWith("rgb")){const E=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,F=b.match(E);if(F){const[T,o,fe,ce,Ae,Ie,De,ie,be,et,ft,Nt]=F,qt=[ce||" ",De||" ",et].join("");if(qt===" "||qt===" /"||qt===",,"||qt===",,,"){const vr=[fe,Ie,be].join(""),Bt=vr==="%%%"?100:vr===""?255:0;if(Bt){const Et=[Xo(+o/Bt,0,1),Xo(+Ae/Bt,0,1),Xo(+ie/Bt,0,1),ft?am(+ft,Nt):1];if(sm(Et))return Et}}return}}const x=/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,C=b.match(x);if(C){const[E,F,T,o,fe,ce,Ae,Ie,De]=C,ie=[T||" ",fe||" ",Ae].join("");if(ie===" "||ie===" /"||ie===",,"||ie===",,,"){const be=[+F,Xo(+o,0,100),Xo(+ce,0,100),Ie?am(+Ie,De):1];if(sm(be))return Ix(be)}}}function zu(b){return parseInt(b.padEnd(2,b),16)/255}function am(b,f){return Xo(f?b/100:b,0,1)}function Xo(b,f,x){return Math.min(Math.max(f,b),x)}function sm(b){return!b.some(Number.isNaN)}const kx={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
743ive:[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]};function Gn(b,f,x){return b+x*(f-b)}function _c(b,f,x){return b.map((C,E)=>Gn(C,f[E],x))}class Wt{constructor(f,x,C,E=1,F=!0){this.r=f,this.g=x,this.b=C,this.a=E,F||(this.r*=E,this.g*=E,this.b*=E,E||this.overwriteGetter("rgb",[f,x,C,E]))}static parse(f){if(f instanceof Wt)return f;if(typeof f!="string")return;const x=Px(f);if(x)return new Wt(...x,!1)}get rgb(){const{r:f,g:x,b:C,a:E}=this,F=E||1/0;return this.overwriteGetter("rgb",[f/F,x/F,C/F,E])}get hcl(){return this.overwriteGetter("hcl",Cx(this.rgb))}get lab(){return this.overwriteGetter("lab",Vm(this.rgb))}overwriteGetter(f,x){return Object.defineProperty(this,f,{value:x}),x}toString(){const[f,x,C,E]=this.rgb;return`rgba(${[f,x,C].map(F=>Math.round(F*255)).join(",")},${E})`}static interpolate(f,x,C,E="rgb"){switch(E){case"rgb":{const[F,T,o,fe]=_c(f.rgb,x.rgb,C);return new Wt(F,T,o,fe,!1)}case"hcl":{const[F,T,o,fe]=f.hcl,[ce,Ae,Ie,De]=x.hcl;let ie,be;if(!isNaN(F)&&!isNaN(ce)){let vr=ce-F;ce>F&&vr>180?vr-=360:ce<F&&F-ce>180&&(vr+=360),ie=F+C*vr}else isNaN(F)?isNaN(ce)?ie=NaN:(ie=ce,(o===1||o===0)&&(be=Ae)):(ie=F,(Ie===1||Ie===0)&&(be=T));const[et,ft,Nt,qt]=Mx([ie,be??Gn(T,Ae,C),Gn(o,Ie,C),Gn(fe,De,C)]);return new Wt(et,ft,Nt,qt,!1)}case"lab":{const[F,T,o,fe]=Zm(_c(f.lab,x.lab,C));return new Wt(F,T,o,fe,!1)}}}}Wt.black=new Wt(0,0,0,1),Wt.white=new Wt(1,1,1,1),Wt.transparent=new Wt(0,0,0,0),Wt.red=new Wt(1,0,0,1);class Hp{constructor(f,x,C){f?this.sensitivity=x?"variant":"case":this.sensitivity=x?"accent":"base",this.locale=C,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(f,x){return this.collator.compare(f,x)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const Ex=["bottom","center","top"];class Ep{constructor(f,x,C,E,F,T){this.text=f,this.image=x,this.scale=C,this.fontStack=E,this.textColor=F,this.verticalAlign=T}}class ps{constructor(f){this.sections=f}static fromString(f){return new ps([new Ep(f,null,null,null,null,null)])}isEmpty(){return this.sections.length===0?!0:!this.sections.some(f=>f.text.length!==0||f.image&&f.image.name.length!==0)}static factory(f){return f instanceof ps?f:ps.fromString(f)}toString(){return this.sections.length===0?"":this.sections.map(f=>f.text).join("")}}class Za{constructor(f){this.values=f.slice()}static parse(f){if(f instanceof Za)return f;if(typeof f=="number")return new Za([f,f,f,f]);if(Array.isArray(f)&&!(f.length<1||f.length>4)){for(const x of f)if(typeof x!="number")return;switch(f.length){case 1:f=[f[0],f[0],f[0],f[0]];break;case 2:f=[f[0],f[1],f[0],f[1]];break;case 3:f=[f[0],f[1],f[2],f[1]];break}return new Za(f)}}toString(){return JSON.stringify(this.values)}static interpolate(f,x,C){return new Za(_c(f.values,x.values,C))}}class qa{constructor(f){this.values=f.slice()}static parse(f){if(f instanceof qa)return f;if(typeof f=="number")return new qa([f]);if(Array.isArray(f)){for(const x of f)if(typeof x!="number")return;return new qa(f)}}toString(){return JSON.stringify(this.values)}static interpolate(f,x,C){return new qa(_c(f.values,x.values,C))}}class pa{constructor(f){this.values=f.slice()}static parse(f){if(f instanceof pa)return f;if(typeof f=="string"){const C=Wt.parse(f);return C?new pa([C]):void 0}if(!Array.isArray(f))return;const x=[];for(const C of f){if(typeof C!="string")return;const E=Wt.parse(C);if(!E)return;x.push(E)}return new pa(x)}toString(){return JSON.stringify(this.values)}static interpolate(f,x,C,E="rgb"){const F=[];if(f.values.length!=x.values.length)throw new Error(`colorArray: Arrays have mismatched length (${f.values.length} vs. ${x.values.length}), cannot interpolate.`);for(let T=0;T<f.values.length;T++)F.push(Wt.interpolate(f.values[T],x.values[T],C,E));return new pa(F)}}
743class xr extends Error{constructor(f){super(f),this.name="RuntimeError"}toJSON(){return this.message}}const zx=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class ds{constructor(f){this.values=f.slice()}static parse(f){if(f instanceof ds)return f;if(!(!Array.isArray(f)||f.length<1||f.length%2!==0)){for(let x=0;x<f.length;x+=2){const C=f[x],E=f[x+1];if(typeof C!="string"||!zx.has(C)||!Array.isArray(E)||E.length!==2||typeof E[0]!="number"||typeof E[1]!="number")return}return new ds(f)}}toString(){return JSON.stringify(this.values)}static interpolate(f,x,C){const E=f.values,F=x.values;if(E.length!==F.length)throw new xr(`Cannot interpolate values of different length. from: ${f.toString()}, to: ${x.toString()}`);const T=[];for(let o=0;o<E.length;o+=2){if(E[o]!==F[o])throw new xr(`Cannot interpolate values containing mismatched anchors. from[${o}]: ${E[o]}, to[${o}]: ${F[o]}`);T.push(E[o]);const[fe,ce]=E[o+1],[Ae,Ie]=F[o+1];T.push([Gn(fe,Ae,C),Gn(ce,Ie,C)])}return new ds(T)}}class Ys{constructor(f){this.name=f.name,this.available=f.available}toString(){return this.name}static fromString(f){return f?new Ys({name:f,available:!1}):null}}class Va{constructor(f,x,C){this.from=f,this.to=x,this.transition=C}static interpolate(f,x,C){return new Va(f,x,C)}static parse(f){if(f instanceof Va)return f;if(Array.isArray(f)&&f.length===3&&typeof f[0]=="string"&&typeof f[1]=="string"&&typeof f[2]=="number")return new Va(f[0],f[1],f[2]);if(typeof f=="object"&&typeof f.from=="string"&&typeof f.to=="string"&&typeof f.transition=="number")return new Va(f.from,f.to,f.transition);if(typeof f=="string")return new Va(f,f,1)}}function Gm(b,f,x,C){return typeof b=="number"&&b>=0&&b<=255&&typeof f=="number"&&f>=0&&f<=255&&typeof x=="number"&&x>=0&&x<=255?typeof C>"u"||typeof C=="number"&&C>=0&&C<=1?null:`Invalid rgba value [${[b,f,x,C].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof C=="number"?[b,f,x,C]:[b,f,x]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function yc(b){if(b===null||typeof b=="string"||typeof b=="boolean"||typeof b=="number"||b instanceof Va||b instanceof Wt||b instanceof Hp||b instanceof ps||b instanceof Za||b instanceof qa||b instanceof pa||b instanceof ds||b instanceof Ys)return!0;if(Array.isArray(b)){for(const f of b)if(!yc(f))return!1;return!0}else if(typeof b=="object"){for(const f in b)if(!yc(b[f]))return!1;return!0}else return!1}function Yr(b){if(b===null)return Vu;if(typeof b=="string")return Mt;if(typeof b=="boolean")return bt;if(typeof b=="number")return Ue;if(b instanceof Wt)return hs;if(b instanceof Va)return Up;if(b instanceof Hp)return Zu;if(b instanceof ps)return $p;if(b instanceof Za)return Vp;if(b instanceof qa)return Zp;if(b instanceof pa)return Fu;if(b instanceof ds)return qp;if(b instanceof Ys)return qu;if(Array.isArray(b)){const f=b.length;let x;for(const C of b){const E=Yr(C);if(!x)x=E;else{if(x===E)continue;x=xt;break}}return ha(x||xt,f)}else return Yo}function mc(b){const f=typeof b;return b===null?"":f==="string"||f==="number"||f==="boolean"?String(b):b instanceof Wt||b instanceof Va||b instanceof ps||b instanceof Za||b instanceof qa||b instanceof pa||b instanceof ds||b instanceof Ys?b.toString():JSON.stringify(b)}class Qo{constructor(f,x){this.type=f,this.value=x}static parse(f,x){if(f.length!==2)return x.error(`'literal' expression requires exactly one argument, but found ${f.length-1} instead.`);if(!yc(f[1]))return x.error("invalid value");const C=f[1];let E=Yr(C);const F=x.expectedType;return E.kind==="array"&&E.N===0&&F&&F.kind==="array"&&(typeof F.N!="number"||F.N===0)&&(E=F),new Qo(E,C)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Du={string:Mt,number:Ue,boolean:bt,object:Yo};class Ca{constructor(f,x){this.type=f,this.args=x}static parse(f,x){if(f.length<2)return x.error("Expected at least one argument.");let C=1,E;const F=f[0];if(F==="array"){let o;if(f.length>2){const ce=f[1];if(typeof ce!="string"||!(ce in Du)||ce==="object")return x.error('The item type argument of "array" must be one of string, number, boolean',1);o=Du[ce],C++}else o=xt;let fe;if(f.length>3){if(f[2]!==null&&(typeof f[2]!="number"||f[2]<0||f[2]!==Math.floor(f[2])))return x.error('The length argument to "array" must be a positive integer literal',2);fe=f[2],C++}E=ha(o,fe)}else{if(!Du[F])throw new Error(`Types doesn't contain name = ${F}`);E=Du[F]}const T=[];for(;C<f.length;C++){const o=x.parse(f[C],C,xt);if(!o)return null;T.push(o)}return new Ca(E,T)}evaluate(f){for(let x=0;x<this.args.length;x++){const C=this.args[x].evaluate(f);if(gc(this.type,Yr(C))){if(x===this.args.length-1)throw new xr(`Expected value to be of type ${cr(this.t
743ype)}, but found ${cr(Yr(C))} instead.`)}else return C}throw new Error}eachChild(f){this.args.forEach(f)}outputDefined(){return this.args.every(f=>f.outputDefined())}}const nm={"to-boolean":bt,"to-color":hs,"to-number":Ue,"to-string":Mt};class Xs{constructor(f,x){this.type=f,this.args=x}static parse(f,x){if(f.length<2)return x.error("Expected at least one argument.");const C=f[0];if(!nm[C])throw new Error(`Can't parse ${C} as it is not part of the known types`);if((C==="to-boolean"||C==="to-string")&&f.length!==2)return x.error("Expected one argument.");const E=nm[C],F=[];for(let T=1;T<f.length;T++){const o=x.parse(f[T],T,xt);if(!o)return null;F.push(o)}return new Xs(E,F)}evaluate(f){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(f);case"color":{let x,C;for(const E of this.args){if(x=E.evaluate(f),C=null,x instanceof Wt)return x;if(typeof x=="string"){const F=f.parseColor(x);if(F)return F}else if(Array.isArray(x)&&(x.length<3||x.length>4?C=`Invalid rgba value ${JSON.stringify(x)}: expected an array containing either three or four numeric values.`:C=Gm(x[0],x[1],x[2],x[3]),!C))return new Wt(x[0]/255,x[1]/255,x[2]/255,x[3])}throw new xr(C||`Could not parse color from value '${typeof x=="string"?x:JSON.stringify(x)}'`)}case"padding":{let x;for(const C of this.args){x=C.evaluate(f);const E=Za.parse(x);if(E)return E}throw new xr(`Could not parse padding from value '${typeof x=="string"?x:JSON.stringify(x)}'`)}case"numberArray":{let x;for(const C of this.args){x=C.evaluate(f);const E=qa.parse(x);if(E)return E}throw new xr(`Could not parse numberArray from value '${typeof x=="string"?x:JSON.stringify(x)}'`)}case"colorArray":{let x;for(const C of this.args){x=C.evaluate(f);const E=pa.parse(x);if(E)return E}throw new xr(`Could not parse colorArray from value '${typeof x=="string"?x:JSON.stringify(x)}'`)}case"variableAnchorOffsetCollection":{let x;for(const C of this.args){x=C.evaluate(f);const E=ds.parse(x);if(E)return E}throw new xr(`Could not parse variableAnchorOffsetCollection from value '${typeof x=="string"?x:JSON.stringify(x)}'`)}case"number":{let x=null;for(const C of this.args){if(x=C.evaluate(f),x===null)return 0;const E=Number(x);if(!isNaN(E))return E}throw new xr(`Could not convert ${JSON.stringify(x)} to number.`)}case"formatted":return ps.fromString(mc(this.args[0].evaluate(f)));case"resolvedImage":return Ys.fromString(mc(this.args[0].evaluate(f)));case"projectionDefinition":return this.args[0].evaluate(f);default:return mc(this.args[0].evaluate(f))}}eachChild(f){this.args.forEach(f)}outputDefined(){return this.args.every(f=>f.outputDefined())}}const Dx=["Unknown","Point","LineString","Polygon"];class Lx{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,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"?Dx[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(f){let x=this._parseColorCache.get(f);return x||(x=Wt.parse(f),this._parseColorCache.set(f,x)),x}}class Wp{constructor(f,x,C=[],E,F=new Np,T=[]){this.registry=f,this.path=C,this.key=C.map(o=>`[${o}]`).join(""),this.scope=F,this.errors=T,this.expectedType=E,this._isConstant=x}parse(f,x,C,E,F={}){return x?this.concat(x,C,E)._parse(f,F):this._parse(f,F)}_parse(f,x){(f===null||typeof f=="string"||typeof f=="boolean"||typeof f=="number")&&(f=["literal",f]);function C(E,F,T){return T==="assert"?new Ca(F,[E]):T==="coerce"?new Xs(F,[E]):E}if(Array.isArray(f)){if(f.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const E=f[0];if(typeof E!="string")return this.error(`Expression name must be a string, but found ${typeof E} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const F=this.registry[E];if(F){let T=F.parse(f,this);if(!T)return null;if(this.expectedType){const o=this.expectedType,fe=T.type;
743if((o.kind==="string"||o.kind==="number"||o.kind==="boolean"||o.kind==="object"||o.kind==="array")&&fe.kind==="value")T=C(T,o,x.typeAnnotation||"assert");else if(o.kind==="projectionDefinition"&&["string","array"].includes(fe.kind)||["color","formatted","resolvedImage"].includes(o.kind)&&["value","string"].includes(fe.kind)||["padding","numberArray"].includes(o.kind)&&["value","number","array"].includes(fe.kind)||o.kind==="colorArray"&&["value","string","array"].includes(fe.kind)||o.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(fe.kind))T=C(T,o,x.typeAnnotation||"coerce");else if(this.checkSubtype(o,fe))return null}if(!(T instanceof Qo)&&T.type.kind!=="resolvedImage"&&this._isConstant(T)){const o=new Lx;try{T=new Qo(T.type,T.evaluate(o))}catch(fe){return this.error(fe.message),null}}return T}return this.error(`Unknown expression "${E}". If you wanted a literal array, use ["literal", [...]].`,0)}else return typeof f>"u"?this.error("'undefined' value invalid. Use null instead."):typeof f=="object"?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof f} instead.`)}concat(f,x,C){const E=typeof f=="number"?this.path.concat(f):this.path,F=C?this.scope.concat(C):this.scope;return new Wp(this.registry,this._isConstant,E,x||null,F,this.errors)}error(f,...x){const C=`${this.key}${x.map(E=>`[${E}]`).join("")}`;this.errors.push(new xx(C,f))}checkSubtype(f,x){const C=gc(f,x);return C&&this.error(C),C}}class Xp{constructor(f,x){this.type=x.type,this.bindings=[].concat(f),this.result=x}evaluate(f){return this.result.evaluate(f)}eachChild(f){for(const x of this.bindings)f(x[1]);f(this.result)}static parse(f,x){if(f.length<4)return x.error(`Expected at least 3 arguments, but found ${f.length-1} instead.`);const C=[];for(let F=1;F<f.length-1;F+=2){const T=f[F];if(typeof T!="string")return x.error(`Expected string, but found ${typeof T} instead.`,F);if(/[^a-zA-Z0-9_]/.test(T))return x.error("Variable names must contain only alphanumeric characters or '_'.",F);const o=x.parse(f[F+1],F+1);if(!o)return null;C.push([T,o])}const E=x.parse(f[f.length-1],f.length-1,x.expectedType,C);return E?new Xp(C,E):null}outputDefined(){return this.result.outputDefined()}}class Gu{constructor(f,x){this.type=x.type,this.name=f,this.boundExpression=x}static parse(f,x){if(f.length!==2||typeof f[1]!="string")return x.error("'var' expression requires exactly one string literal argument.");const C=f[1];return x.scope.has(C)?new Gu(C,x.scope.get(C)):x.error(`Unknown variable "${C}". Make sure "${C}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(f){return this.boundExpression.evaluate(f)}eachChild(){}outputDefined(){return!1}}class Yp{constructor(f,x,C){this.type=f,this.index=x,this.input=C}static parse(f,x){if(f.length!==3)return x.error(`Expected 2 arguments, but found ${f.length-1} instead.`);const C=x.parse(f[1],1,Ue),E=x.parse(f[2],2,ha(x.expectedType||xt));if(!C||!E)return null;const F=E.type;return new Yp(F.itemType,C,E)}evaluate(f){const x=this.index.evaluate(f),C=this.input.evaluate(f);if(x<0)throw new xr(`Array index out of bounds: ${x} < 0.`);if(x>=C.length)throw new xr(`Array index out of bounds: ${x} > ${C.length-1}.`);if(x!==Math.floor(x))throw new xr(`Array index must be an integer, but found ${x} instead.`);return C[x]}eachChild(f){f(this.index),f(this.input)}outputDefined(){return!1}}class Kp{constructor(f,x){this.type=bt,this.needle=f,this.haystack=x}static parse(f,x){if(f.length!==3)return x.error(`Expected 2 arguments, but found ${f.length-1} instead.`);const C=x.parse(f[1],1,xt),E=x.parse(f[2],2,xt);return!C||!E?null:Gp(C.type,[bt,Mt,Ue,Vu,xt])?new Kp(C,E):x.error(`Expected first argument to be of type boolean, string, number or null, but found ${cr(C.type)} instead`)}evaluate(f){const x=this.needle.evaluate(f),C=this.haystack.evaluate(f);if(!C)return!1;if(!qn(x,["boolean","string","number","null"]))throw new xr(`Expected first argument to be of type boolean, string, number or null, but found ${cr(Yr(x))} instead.`);if(!qn(C,["string","array"]))throw new xr(`Expected second argument to be of type array or string, but found ${cr(Yr(C))} instead.`);return C.indexOf(x)>=0}eachChild(f){f(this.needle),f(this.haystack)}outputDefined(){return!0}}class Bu{constructor(f,x,C){this.type=Ue,this.needle=f,this.haystack=x,this.fromIndex=C}static parse(f,x){if(f.length<=2||f.length>=5)return x.error(`Expected 3 or 4 arguments, but found ${f.length-1} instead.`);const C=x.parse(f[1],1,xt),E=x.parse(f[2],2,xt);if(!C||!E)return null;if(!Gp(C.type,[bt,Mt,Ue,Vu,xt]))return x.error(`Expected first argument to be of type boolean, string, number or null, but found ${cr(C.type)} instead`);if(f.length===4){const F=x.parse(f[3],3,Ue);return F?new Bu(C,E,F):null}else return new Bu(C,E)}evaluate(f){const x=this.needle.evaluate(f),C=this.haystack.evaluate(f);if(!qn(x,["boolean","string","number","null"]))throw new xr(`Expected first argument to be of type boolean, string, number or null, but found ${cr(Yr(x))} instead.`);let E;if(this.fromIndex&&(E=this.fromIndex.evaluate(f)),qn(C,["string"])){const F=C.indexOf(x,E);return F===-1?-1:[...C.slice(0,F)].length}else{if(qn(C,["array"]))return C.indexOf(x,E);throw new xr(`Expected second argument to be of type array or string, but found ${cr(Yr(C))} instead.`)}}eachChild(f){f(this.needle),f(this.haystack),this.fromIndex&&f(this.fromIndex)}outputDefined(){return!1}}class Jp{constructor(f,x,C,E,F,T){this.inputType=f,this.type=x,this.input=C,this.cases=E,this.outputs=F,this.otherwise=T}static parse(f,x){if(f.length<5)return x.error(`Expected at least 4 arguments, but found only ${f.length-1}.`);if(f.length%2!==1)return x.error("Expected an even number of arguments.");let C,E;x.expectedType&&x.expectedType.kind!=="value"&&(E=x.expectedType);const F={},T=[];for(let ce=2;ce<f.length-1;ce+=2){let Ae=f[ce];const Ie=f[ce+1];Array.isArray(Ae)||(Ae=[Ae]);const De=x.concat(ce);if(Ae.length===0)return De.error("Expected at least one branch label.");for(const be of Ae){if(typeof be!="number"&&typeof be!="string")return De.error("Branch labels must be numbers or strings.");if(typeof be=="number"&&Math.abs(be)>Number.MAX_SAFE_INTEGER)return De.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof be=="number"&&Math.floor(be)!==be)return De.error("Numeric branch labels must be integer values.");if(!C)C=Yr(be);else if(De.checkSubtype(C,Yr(be)))return null;if(typeof F[String(be)]<"u")return De.error("Branch labels must be unique.");F[String(be)]=T.length}const ie=x.parse(Ie,ce,E);if(!ie)return null;E=E||ie.type,T.push(ie)}const o=x.parse(f[1],1,xt);if(!o)return null;const fe=x.parse(f[f.length-1],f.length-1,E);return!fe||o.type.kind!=="value"&&x.concat(1).checkSubtype(C,o.type)?null:new Jp(C,E,o,F,T,fe)}evaluate(f){const x=this.input.evaluate(f);return(Yr(x)===this.inputType&&this.outputs[this.cases[x]]||this.otherwise).evaluate(f)}
743eachChild(f){f(this.input),this.outputs.forEach(f),f(this.otherwise)}outputDefined(){return this.outputs.every(f=>f.outputDefined())&&this.otherwise.outputDefined()}}class Qp{constructor(f,x,C){this.type=f,this.branches=x,this.otherwise=C}static parse(f,x){if(f.length<4)return x.error(`Expected at least 3 arguments, but found only ${f.length-1}.`);if(f.length%2!==0)return x.error("Expected an odd number of arguments.");let C;x.expectedType&&x.expectedType.kind!=="value"&&(C=x.expectedType);const E=[];for(let T=1;T<f.length-1;T+=2){const o=x.parse(f[T],T,bt);if(!o)return null;const fe=x.parse(f[T+1],T+1,C);if(!fe)return null;E.push([o,fe]),C=C||fe.type}const F=x.parse(f[f.length-1],f.length-1,C);if(!F)return null;if(!C)throw new Error("Can't infer output type");return new Qp(C,E,F)}evaluate(f){for(const[x,C]of this.branches)if(x.evaluate(f))return C.evaluate(f);return this.otherwise.evaluate(f)}eachChild(f){for(const[x,C]of this.branches)f(x),f(C);f(this.otherwise)}outputDefined(){return this.branches.every(([f,x])=>x.outputDefined())&&this.otherwise.outputDefined()}}class Ou{constructor(f,x,C,E){this.type=f,this.input=x,this.beginIndex=C,this.endIndex=E}static parse(f,x){if(f.length<=2||f.length>=5)return x.error(`Expected 3 or 4 arguments, but found ${f.length-1} instead.`);const C=x.parse(f[1],1,xt),E=x.parse(f[2],2,Ue);if(!C||!E)return null;if(!Gp(C.type,[ha(xt),Mt,xt]))return x.error(`Expected first argument to be of type array or string, but found ${cr(C.type)} instead`);if(f.length===4){const F=x.parse(f[3],3,Ue);return F?new Ou(C.type,C,E,F):null}else return new Ou(C.type,C,E)}evaluate(f){const x=this.input.evaluate(f),C=this.beginIndex.evaluate(f);let E;if(this.endIndex&&(E=this.endIndex.evaluate(f)),qn(x,["string"]))return[...x].slice(C,E).join("");if(qn(x,["array"]))return x.slice(C,E);throw new xr(`Expected first argument to be of type array or string, but found ${cr(Yr(x))} instead.`)}eachChild(f){f(this.input),f(this.beginIndex),this.endIndex&&f(this.endIndex)}outputDefined(){return!1}}function Hm(b,f){const x=b.length-1;let C=0,E=x,F=0,T,o;for(;C<=E;)if(F=Math.floor((C+E)/2),T=b[F],o=b[F+1],T<=f){if(F===x||f<o)return F;C=F+1}else if(T>f)E=F-1;else throw new xr("Input is not a number.");return 0}class ed{constructor(f,x,C){this.type=f,this.input=x,this.labels=[],this.outputs=[];for(const[E,F]of C)this.labels.push(E),this.outputs.push(F)}static parse(f,x){if(f.length-1<4)return x.error(`Expected at least 4 arguments, but found only ${f.length-1}.`);if((f.length-1)%2!==0)return x.error("Expected an even number of arguments.");const C=x.parse(f[1],1,Ue);if(!C)return null;const E=[];let F=null;x.expectedType&&x.expectedType.kind!=="value"&&(F=x.expectedType);for(let T=1;T<f.length;T+=2){const o=T===1?-1/0:f[T],fe=f[T+1],ce=T,Ae=T+1;if(typeof o!="number")return x.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',ce);if(E.length&&E[E.length-1][0]>=o)return x.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',ce);const Ie=x.parse(fe,Ae,F);if(!Ie)return null;F=F||Ie.type,E.push([o,Ie])}return new ed(F,C,E)}evaluate(f){const x=this.labels,C=this.outputs;if(x.length===1)return C[0].evaluate(f);const E=this.input.evaluate(f);if(E<=x[0])return C[0].evaluate(f);const F=x.length;if(E>=x[F-1])return C[F-1].evaluate(f);const T=Hm(x,E);return C[T].evaluate(f)}eachChild(f){f(this.input);for(const x of this.outputs)f(x)}outputDefined(){return this.outputs.every(f=>f.outputDefined())}}function Rx(b){return b&&b.__esModule&&Object.prototype.hasOwnProperty.call(b,"default")?b.default:b}var vp,om;function Fx(){if(om)return vp;om=1,vp=b;function b(f,x,C,E){this.cx=3*f,this.bx=3*(C-f)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*x,this.by=3*(E-x)-this.cy,this.ay=1-this.cy-this.by,this.p1x=f,this.p1y=x,this.p2x=C,this.p2y=E}return b.prototype={sampleCurveX:function(f){return((this.ax*f+this.bx)*f+this.cx)*f},sampleCurveY:function(f){return((this.ay*f+this.by)*f+this.cy)*f},sampleCurveDerivativeX:function(f){return(3*this.ax*f+2*this.bx)*f+this.cx},solveCurveX:function(f,x){if(x===void 0&&(x=1e-6),f<0)return 0;if(f>1)return 1;for(var C=f,E=0;E<8;E++){var F=this.sampleCurveX(C)-f;if(Math.abs(F)<x)return C;var T=this.sampleCurveDerivativeX(C);if(Math.abs(T)<1e-6)break;C=C-F/T}var o=0,fe=1;for(C=f,E=0;E<20&&(F=this.sampleCurveX(C),!(Math.abs(F-f)<x));E++)f>F?o=C:fe=C,C=(fe-o)*.5+o;return C}
743,solve:function(f,x){return this.sampleCurveY(this.solveCurveX(f,x))}},vp}var Bx=Fx(),Ox=Rx(Bx);class Jo{constructor(f,x,C,E,F){this.type=f,this.operator=x,this.interpolation=C,this.input=E,this.labels=[],this.outputs=[];for(const[T,o]of F)this.labels.push(T),this.outputs.push(o)}static interpolationFactor(f,x,C,E){let F=0;if(f.name==="exponential")F=bp(x,f.base,C,E);else if(f.name==="linear")F=bp(x,1,C,E);else if(f.name==="cubic-bezier"){const T=f.controlPoints;F=new Ox(T[0],T[1],T[2],T[3]).solve(bp(x,1,C,E))}return F}static parse(f,x){let[C,E,F,...T]=f;if(!Array.isArray(E)||E.length===0)return x.error("Expected an interpolation type expression.",1);if(E[0]==="linear")E={name:"linear"};else if(E[0]==="exponential"){const ce=E[1];if(typeof ce!="number")return x.error("Exponential interpolation requires a numeric base.",1,1);E={name:"exponential",base:ce}}else if(E[0]==="cubic-bezier"){const ce=E.slice(1);if(ce.length!==4||ce.some(Ae=>typeof Ae!="number"||Ae<0||Ae>1))return x.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);E={name:"cubic-bezier",controlPoints:ce}}else return x.error(`Unknown interpolation type ${String(E[0])}`,1,0);if(f.length-1<4)return x.error(`Expected at least 4 arguments, but found only ${f.length-1}.`);if((f.length-1)%2!==0)return x.error("Expected an even number of arguments.");if(F=x.parse(F,2,Ue),!F)return null;const o=[];let fe=null;(C==="interpolate-hcl"||C==="interpolate-lab")&&x.expectedType!=Fu?fe=hs:x.expectedType&&x.expectedType.kind!=="value"&&(fe=x.expectedType);for(let ce=0;ce<T.length;ce+=2){const Ae=T[ce],Ie=T[ce+1],De=ce+3,ie=ce+4;if(typeof Ae!="number")return x.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',De);if(o.length&&o[o.length-1][0]>=Ae)return x.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',De);const be=x.parse(Ie,ie,fe);if(!be)return null;fe=fe||be.type,o.push([Ae,be])}return!Hs(fe,Ue)&&!Hs(fe,Up)&&!Hs(fe,hs)&&!Hs(fe,Vp)&&!Hs(fe,Zp)&&!Hs(fe,Fu)&&!Hs(fe,qp)&&!Hs(fe,ha(Ue))?x.error(`Type ${cr(fe)} is not interpolatable.`):new Jo(fe,C,E,F,o)}evaluate(f){const x=this.labels,C=this.outputs;if(x.length===1)return C[0].evaluate(f);const E=this.input.evaluate(f);if(E<=x[0])return C[0].evaluate(f);const F=x.length;if(E>=x[F-1])return C[F-1].evaluate(f);const T=Hm(x,E),o=x[T],fe=x[T+1],ce=Jo.interpolationFactor(this.interpolation,E,o,fe),Ae=C[T].evaluate(f),Ie=C[T+1].evaluate(f);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Gn(Ae,Ie,ce);case"color":return Wt.interpolate(Ae,Ie,ce);case"padding":return Za.interpolate(Ae,Ie,ce);case"colorArray":return pa.interpolate(Ae,Ie,ce);case"numberArray":return qa.interpolate(Ae,Ie,ce);case"variableAnchorOffsetCollection":return ds.interpolate(Ae,Ie,ce);case"array":return _c(Ae,Ie,ce);case"projectionDefinition":return Va.interpolate(Ae,Ie,ce)}case"interpolate-hcl":switch(this.type.kind){case"color":return Wt.interpolate(Ae,Ie,ce,"hcl");case"colorArray":return pa.interpolate(Ae,Ie,ce,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Wt.interpolate(Ae,Ie,ce,"lab");case"colorArray":return pa.interpolate(Ae,Ie,ce,"lab")}}}eachChild(f){f(this.input);for(const x of this.outputs)f(x)}outputDefined(){return this.outputs.every(f=>f.outputDefined())}}function bp(b,f,x,C){const E=C-x,F=b-x;return E===0?0:f===1?F/E:(Math.pow(f,F)-1)/(Math.pow(f,E)-1)}class ju{constructor(f,x){this.type=f,this.args=x}static parse(f,x){if(f.length<2)return x.error("Expected at least one argument.");let C=null;const E=x.expectedType;E&&E.kind!=="value"&&(C=E);const F=[];for(const T of f.slice(1)){const o=x.parse(T,1+F.length,C,void 0,{typeAnnotation:"omit"});if(!o)return null;C=C||o.type,F.push(o)}if(!C)throw new Error("No output type");return E&&F.some(T=>gc(E,T.type))?new ju(xt,F):new ju(C,F)}evaluate(f){let x=null,C=0,E;for(const F of this.args)if(C++,x=F.evaluate(f),x&&x instanceof Ys&&!x.available&&(E||(E=x.name),x=null,C===this.args.length&&(x=E)),x!==null)break;return x}
743eachChild(f){this.args.forEach(f)}outputDefined(){return this.args.every(f=>f.outputDefined())}}function lm(b,f){return b==="=="||b==="!="?f.kind==="boolean"||f.kind==="string"||f.kind==="number"||f.kind==="null"||f.kind==="value":f.kind==="string"||f.kind==="number"||f.kind==="value"}function jx(b,f,x){return f===x}function Nx(b,f,x){return f!==x}function Ux(b,f,x){return f<x}function $x(b,f,x){return f>x}function Vx(b,f,x){return f<=x}function Zx(b,f,x){return f>=x}function Wm(b,f,x,C){return C.compare(f,x)===0}function qx(b,f,x,C){return!Wm(b,f,x,C)}function Gx(b,f,x,C){return C.compare(f,x)<0}function Hx(b,f,x,C){return C.compare(f,x)>0}function Wx(b,f,x,C){return C.compare(f,x)<=0}function Xx(b,f,x,C){return C.compare(f,x)>=0}function el(b,f,x){const C=b!=="=="&&b!=="!=";return class Xm{constructor(F,T,o){this.type=bt,this.lhs=F,this.rhs=T,this.collator=o,this.hasUntypedArgument=F.type.kind==="value"||T.type.kind==="value"}static parse(F,T){if(F.length!==3&&F.length!==4)return T.error("Expected two or three arguments.");const o=F[0];let fe=T.parse(F[1],1,xt);if(!fe)return null;if(!lm(o,fe.type))return T.concat(1).error(`"${o}" comparisons are not supported for type '${cr(fe.type)}'.`);let ce=T.parse(F[2],2,xt);if(!ce)return null;if(!lm(o,ce.type))return T.concat(2).error(`"${o}" comparisons are not supported for type '${cr(ce.type)}'.`);if(fe.type.kind!==ce.type.kind&&fe.type.kind!=="value"&&ce.type.kind!=="value")return T.error(`Cannot compare types '${cr(fe.type)}' and '${cr(ce.type)}'.`);C&&(fe.type.kind==="value"&&ce.type.kind!=="value"?fe=new Ca(ce.type,[fe]):fe.type.kind!=="value"&&ce.type.kind==="value"&&(ce=new Ca(fe.type,[ce])));let Ae=null;if(F.length===4){if(fe.type.kind!=="string"&&ce.type.kind!=="string"&&fe.type.kind!=="value"&&ce.type.kind!=="value")return T.error("Cannot use collator to compare non-string types.");if(Ae=T.parse(F[3],3,Zu),!Ae)return null}return new Xm(fe,ce,Ae)}evaluate(F){const T=this.lhs.evaluate(F),o=this.rhs.evaluate(F);if(C&&this.hasUntypedArgument){const fe=Yr(T),ce=Yr(o);if(fe.kind!==ce.kind||!(fe.kind==="string"||fe.kind==="number"))throw new xr(`Expected arguments for "${b}" to be (string, string) or (number, number), but found (${fe.kind}, ${ce.kind}) instead.`)}if(this.collator&&!C&&this.hasUntypedArgument){const fe=Yr(T),ce=Yr(o);if(fe.kind!=="string"||ce.kind!=="string")return f(F,T,o)}return this.collator?x(F,T,o,this.collator.evaluate(F)):f(F,T,o)}eachChild(F){F(this.lhs),F(this.rhs),this.collator&&F(this.collator)}outputDefined(){return!0}}}const Yx=el("==",jx,Wm),Kx=el("!=",Nx,qx),Jx=el("<",Ux,Gx),Qx=el(">",$x,Hx),ev=el("<=",Vx,Wx),tv=el(">=",Zx,Xx);class Hu{constructor(f,x,C){this.type=Zu,this.locale=C,this.caseSensitive=f,this.diacriticSensitive=x}static parse(f,x){if(f.length!==2)return x.error("Expected one argument.");const C=f[1];if(typeof C!="object"||Array.isArray(C))return x.error("Collator options argument must be an object.");const E=x.parse(C["case-sensitive"]===void 0?!1:C["case-sensitive"],1,bt);if(!E)return null;const F=x.parse(C["diacritic-sensitive"]===void 0?!1:C["diacritic-sensitive"],1,bt);if(!F)return null;let T=null;return C.locale&&(T=x.parse(C.locale,1,Mt),!T)?null:new Hu(E,F,T)}evaluate(f){return new Hp(this.caseSensitive.evaluate(f),this.diacriticSensitive.evaluate(f),this.locale?this.locale.evaluate(f):null)}eachChild(f){f(this.caseSensitive),f(this.diacriticSensitive),this.locale&&f(this.locale)}outputDefined(){return!1}}class td{constructor(f,x,C,E,F){this.type=Mt,this.number=f,this.locale=x,this.currency=C,this.minFractionDigits=E,this.maxFractionDigits=F}static parse(f,x){if(f.length!==3)return x.error("Expected two arguments.");const C=x.parse(f[1],1,Ue);if(!C)return null;const E=f[2];if(typeof E!="object"||Array.isArray(E))return x.error("NumberFormat options argument must be an object.");let F=null;if(E.locale&&(F=x.parse(E.locale,1,Mt),!F))return null;let T=null;if(E.currency&&(T=x.parse(E.currency,1,Mt),!T))return null;let o=null;if(E["min-fraction-digits"]&&(o=x.parse(E["min-fraction-digits"],1,Ue),!o))return null;let fe=null;return E["max-fraction-digits"]&&(fe=x.parse(E["max-fraction-digits"],1,Ue),!fe)?null:new td(C,F,T,o,fe)}evaluate(f){return new Intl.NumberFormat(this.locale?this.locale.evaluate(f):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(f):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(f):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(f):void 0}).format(this.number.evaluate(f))}eachChild(f){f(this.number),this.locale&&f(this.locale),this.currency&&f(this.currency),this.minFractionDigits&&f(this.minFractionDigits),this.maxFractionDigits&&f(this.maxFractionDigits)}outputDefined(){return!1}}class rd{constructor(f){this.type=$p,this.sections=f}static parse(f,x){if(f.length<2)return x.error("Expected at least one argument.");const C=f[1];if(!Array.isArray(C)&&typeof C=="object")return x.error("First argument must be an image or text section.");const E=[];let F=!1;for(let T=1;T<=f.length-1;++T){const o=f[T];
743if(F&&typeof o=="object"&&!Array.isArray(o)){F=!1;let fe=null;if(o["font-scale"]&&(fe=x.parse(o["font-scale"],1,Ue),!fe))return null;let ce=null;if(o["text-font"]&&(ce=x.parse(o["text-font"],1,ha(Mt)),!ce))return null;let Ae=null;if(o["text-color"]&&(Ae=x.parse(o["text-color"],1,hs),!Ae))return null;let Ie=null;if(o["vertical-align"]){if(typeof o["vertical-align"]=="string"&&!Ex.includes(o["vertical-align"]))return x.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${o["vertical-align"]}' instead.`);if(Ie=x.parse(o["vertical-align"],1,Mt),!Ie)return null}const De=E[E.length-1];De.scale=fe,De.font=ce,De.textColor=Ae,De.verticalAlign=Ie}else{const fe=x.parse(f[T],1,xt);if(!fe)return null;const ce=fe.type.kind;if(ce!=="string"&&ce!=="value"&&ce!=="null"&&ce!=="resolvedImage")return x.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");F=!0,E.push({content:fe,scale:null,font:null,textColor:null,verticalAlign:null})}}return new rd(E)}evaluate(f){const x=C=>{const E=C.content.evaluate(f);return Yr(E)===qu?new Ep("",E,null,null,null,C.verticalAlign?C.verticalAlign.evaluate(f):null):new Ep(mc(E),null,C.scale?C.scale.evaluate(f):null,C.font?C.font.evaluate(f).join(","):null,C.textColor?C.textColor.evaluate(f):null,C.verticalAlign?C.verticalAlign.evaluate(f):null)};return new ps(this.sections.map(x))}eachChild(f){for(const x of this.sections)f(x.content),x.scale&&f(x.scale),x.font&&f(x.font),x.textColor&&f(x.textColor),x.verticalAlign&&f(x.verticalAlign)}outputDefined(){return!1}}class id{constructor(f){this.type=qu,this.input=f}static parse(f,x){if(f.length!==2)return x.error("Expected two arguments.");const C=x.parse(f[1],1,Mt);return C?new id(C):x.error("No image name provided.")}evaluate(f){const x=this.input.evaluate(f),C=Ys.fromString(x);return C&&f.availableImages&&(C.available=f.availableImages.indexOf(x)>-1),C}eachChild(f){f(this.input)}outputDefined(){return!1}}class ad{constructor(f){this.type=Ue,this.input=f}static parse(f,x){if(f.length!==2)return x.error(`Expected 1 argument, but found ${f.length-1} instead.`);const C=x.parse(f[1],1);return C?C.type.kind!=="array"&&C.type.kind!=="string"&&C.type.kind!=="value"?x.error(`Expected argument of type string or array, but found ${cr(C.type)} instead.`):new ad(C):null}evaluate(f){const x=this.input.evaluate(f);if(typeof x=="string")return[...x].length;if(Array.isArray(x))return x.length;throw new xr(`Expected value to be of type string or array, but found ${cr(Yr(x))} instead.`)}eachChild(f){f(this.input)}outputDefined(){return!1}}const Ga=8192;function rv(b,f){const x=iv(b[0]),C=sv(b[1]),E=Math.pow(2,f.z);return[Math.round(x*E*Ga),Math.round(C*E*Ga)]}function sd(b,f){const x=Math.pow(2,f.z),C=(b[0]/Ga+f.x)/x,E=(b[1]/Ga+f.y)/x;return[av(C),nv(E)]}function iv(b){return(180+b)/360}function av(b){return b*360-180}function sv(b){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+b*Math.PI/360)))/360}function nv(b){return 360/Math.PI*Math.atan(Math.exp((180-b*360)*Math.PI/180))-90}function vc(b,f){b[0]=Math.min(b[0],f[0]),b[1]=Math.min(b[1],f[1]),b[2]=Math.max(b[2],f[0]),b[3]=Math.max(b[3],f[1])}function xc(b,f){return!(b[0]<=f[0]||b[2]>=f[2]||b[1]<=f[1]||b[3]>=f[3])}function ov(b,f,x){return f[1]>b[1]!=x[1]>b[1]&&b[0]<(x[0]-f[0])*(b[1]-f[1])/(x[1]-f[1])+f[0]}function lv(b,f,x){const C=b[0]-f[0],E=b[1]-f[1],F=b[0]-x[0],T=b[1]-x[1];return C*T-F*E===0&&C*F<=0&&E*T<=0}function Wu(b,f,x,C){const E=[f[0]-b[0],f[1]-b[1]],F=[C[0]-x[0],C[1]-x[1]];return pv(F,E)===0?!1:!!(cm(b,f,x,C)&&cm(x,C,b,f))}function cv(b,f,x){for(const C of x)for(let E=0;E<C.length-1;++E)if(Wu(b,f,C[E],C[E+1]))return!0;return!1}function tl(b,f,x=!1){let C=!1;for(const E of f)for(let F=0;F<E.length-1;F++){if(lv(b,E[F],E[F+1]))return x;ov(b,E[F],E[F+1])&&(C=!C)}return C}function uv(b,f){for(const x of f)if(tl(b,x))return!0;return!1}function Ym(b,f){for(const x of b)if(!tl(x,f))return!1;for(let x=0;x<b.length-1;++x)if(cv(b[x],b[x+1],f))return!1;return!0}function hv(b,f){for(const x of f)if(Ym(b,x))return!0;return!1}function pv(b,f){return b[0]*f[1]-b[1]*f[0]}function cm(b,f,x,C){const E=b[0]-x[0],F=b[1]-x[1],T=f[0]-x[0],o=f[1]-x[1],fe=C[0]-x[0],ce=C[1]-x[1],Ae=E*ce-fe*F,Ie=T*ce-fe*o;return Ae>0&&Ie<0||Ae<0&&Ie>0}
743function nd(b,f,x){const C=[];for(let E=0;E<b.length;E++){const F=[];for(let T=0;T<b[E].length;T++){const o=rv(b[E][T],x);vc(f,o),F.push(o)}C.push(F)}return C}function Km(b,f,x){const C=[];for(let E=0;E<b.length;E++){const F=nd(b[E],f,x);C.push(F)}return C}function Jm(b,f,x,C){if(b[0]<x[0]||b[0]>x[2]){const E=C*.5;let F=b[0]-x[0]>E?-C:x[0]-b[0]>E?C:0;F===0&&(F=b[0]-x[2]>E?-C:x[2]-b[0]>E?C:0),b[0]+=F}vc(f,b)}function dv(b){b[0]=b[1]=1/0,b[2]=b[3]=-1/0}function um(b,f,x,C){const E=Math.pow(2,C.z)*Ga,F=[C.x*Ga,C.y*Ga],T=[];for(const o of b)for(const fe of o){const ce=[fe.x+F[0],fe.y+F[1]];Jm(ce,f,x,E),T.push(ce)}return T}function hm(b,f,x,C){const E=Math.pow(2,C.z)*Ga,F=[C.x*Ga,C.y*Ga],T=[];for(const o of b){const fe=[];for(const ce of o){const Ae=[ce.x+F[0],ce.y+F[1]];vc(f,Ae),fe.push(Ae)}T.push(fe)}if(f[2]-f[0]<=E/2){dv(f);for(const o of T)for(const fe of o)Jm(fe,f,x,E)}return T}function fv(b,f){const x=[1/0,1/0,-1/0,-1/0],C=[1/0,1/0,-1/0,-1/0],E=b.canonicalID();if(f.type==="Polygon"){const F=nd(f.coordinates,C,E),T=um(b.geometry(),x,C,E);if(!xc(x,C))return!1;for(const o of T)if(!tl(o,F))return!1}if(f.type==="MultiPolygon"){const F=Km(f.coordinates,C,E),T=um(b.geometry(),x,C,E);if(!xc(x,C))return!1;for(const o of T)if(!uv(o,F))return!1}return!0}function mv(b,f){const x=[1/0,1/0,-1/0,-1/0],C=[1/0,1/0,-1/0,-1/0],E=b.canonicalID();if(f.type==="Polygon"){const F=nd(f.coordinates,C,E),T=hm(b.geometry(),x,C,E);if(!xc(x,C))return!1;for(const o of T)if(!Ym(o,F))return!1}if(f.type==="MultiPolygon"){const F=Km(f.coordinates,C,E),T=hm(b.geometry(),x,C,E);if(!xc(x,C))return!1;for(const o of T)if(!hv(o,F))return!1}return!0}class Hn{constructor(f,x){this.type=bt,this.geojson=f,this.geometries=x}static parse(f,x){if(f.length!==2)return x.error(`'within' expression requires exactly one argument, but found ${f.length-1} instead.`);if(yc(f[1])){const C=f[1];if(C.type==="FeatureCollection"){const E=[];for(const F of C.features){const{type:T,coordinates:o}=F.geometry;T==="Polygon"&&E.push(o),T==="MultiPolygon"&&E.push(...o)}if(E.length){const F={type:"MultiPolygon",coordinates:E};return new Hn(C,F)}}else if(C.type==="Feature"){const E=C.geometry.type;if(E==="Polygon"||E==="MultiPolygon")return new Hn(C,C.geometry)}else if(C.type==="Polygon"||C.type==="MultiPolygon")return new Hn(C,C)}return x.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(f){if(f.geometry()!=null&&f.canonicalID()!=null){if(f.geometryType()==="Point")return fv(f,this.geometries);if(f.geometryType()==="LineString")return mv(f,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class Qm{constructor(f=[],x=(C,E)=>C<E?-1:C>E?1:0){if(this.data=f,this.length=this.data.length,this.compare=x,this.length>0)for(let C=(this.length>>1)-1;C>=0;C--)this._down(C)}push(f){this.data.push(f),this._up(this.length++)}pop(){if(this.length===0)return;const f=this.data[0],x=this.data.pop();return--this.length>0&&(this.data[0]=x,this._down(0)),f}peek(){return this.data[0]}_up(f){const{data:x,compare:C}=this,E=x[f];for(;f>0;){const F=f-1>>1,T=x[F];if(C(E,T)>=0)break;x[f]=T,f=F}x[f]=E}_down(f){const{data:x,compare:C}=this,E=this.length>>1,F=x[f];for(;f<E;){let T=(f<<1)+1;const o=T+1;if(o<this.length&&C(x[o],x[T])<0&&(T=o),C(x[T],F)>=0)break;x[f]=x[T],f=T}x[f]=F}}function gv(b,f){if(b.length<=1)return[b];const x=[];let C,E;for(const F of b){const T=_v(F);T!==0&&(F.area=Math.abs(T),E===void 0&&(E=T<0),E===T<0?(C&&x.push(C),C=[F]):C.push(F))}return C&&x.push(C),x}function _v(b){let f=0;for(let x=0,C=b.length,E=C-1,F,T;x<C;E=x++)F=b[x],T=b[E],f+=(T.x-F.x)*(F.y+T.y);return f}const yv=6378.137,pm=1/298.257223563,dm=pm*(2-pm),fm=Math.PI/180;class od{constructor(f){const x=fm*yv*1e3,C=Math.cos(f*fm),E=1/(1-dm*(1-C*C)),F=Math.sqrt(E);this.kx=x*F*C,this.ky=x*F*E*(1-dm)}distance(f,x){const C=this.wrap(f[0]-x[0])*this.kx,E=(f[1]-x[1])*this.ky;return Math.sqrt(C*C+E*E)}pointOnLine(f,x){let C=1/0,E,F,T,o;for(let fe=0;fe<f.length-1;fe++){let ce=f[fe][0],Ae=f[fe][1],Ie=this.wrap(f[fe+1][0]-ce)*this.kx,De=(f[fe+1][1]-Ae)*this.ky,ie=0;(Ie!==0||De!==0)&&(ie=(this.wrap(x[0]-ce)*this.kx*Ie+(x[1]-Ae)*this.ky*De)/(Ie*Ie+De*De),ie>1?(ce=f[fe+1][0],Ae=f[fe+1][1]):ie>0&&(ce+=Ie/this.kx*ie,Ae+=De/this.ky*ie)),Ie=this.wrap(x[0]-ce)*this.kx,De=(x[1]-Ae)*this.ky;const be=Ie*Ie+De*De;be<C&&(C=be,E=ce,F=Ae,T=fe,o=ie)}return{point:[E,F],index:T,t:Math.max(0,Math.min(1,o))}}wrap(f){for(;f<-180;)f+=360;for(;f>180;)f-=360;return f}}const zp=100,Dp=50;function eg(b,f){return f[0]-b[0]}function Nu(b){return b[1]-b[0]+1}function fs(b,f){return b[1]>=b[0]&&b[1]<f}function Lp(b,f){if(b[0]>
743b[1])return[null,null];const x=Nu(b);if(f){if(x===2)return[b,null];const E=Math.floor(x/2);return[[b[0],b[0]+E],[b[0]+E,b[1]]]}if(x===1)return[b,null];const C=Math.floor(x/2)-1;return[[b[0],b[0]+C],[b[0]+C+1,b[1]]]}function Rp(b,f){if(!fs(f,b.length))return[1/0,1/0,-1/0,-1/0];const x=[1/0,1/0,-1/0,-1/0];for(let C=f[0];C<=f[1];++C)vc(x,b[C]);return x}function Fp(b){const f=[1/0,1/0,-1/0,-1/0];for(const x of b)for(const C of x)vc(f,C);return f}function mm(b){return b[0]!==-1/0&&b[1]!==-1/0&&b[2]!==1/0&&b[3]!==1/0}function ld(b,f,x){if(!mm(b)||!mm(f))return NaN;let C=0,E=0;return b[2]<f[0]&&(C=f[0]-b[2]),b[0]>f[2]&&(C=b[0]-f[2]),b[1]>f[3]&&(E=b[1]-f[3]),b[3]<f[1]&&(E=f[1]-b[3]),x.distance([0,0],[C,E])}function Zn(b,f,x){const C=x.pointOnLine(f,b);return x.distance(b,C.point)}function cd(b,f,x,C,E){const F=Math.min(Zn(b,[x,C],E),Zn(f,[x,C],E)),T=Math.min(Zn(x,[b,f],E),Zn(C,[b,f],E));return Math.min(F,T)}function xv(b,f,x,C,E){if(!(fs(f,b.length)&&fs(C,x.length)))return 1/0;let F=1/0;for(let T=f[0];T<f[1];++T){const o=b[T],fe=b[T+1];for(let ce=C[0];ce<C[1];++ce){const Ae=x[ce],Ie=x[ce+1];if(Wu(o,fe,Ae,Ie))return 0;F=Math.min(F,cd(o,fe,Ae,Ie,E))}}return F}function vv(b,f,x,C,E){if(!(fs(f,b.length)&&fs(C,x.length)))return NaN;let F=1/0;for(let T=f[0];T<=f[1];++T)for(let o=C[0];o<=C[1];++o)if(F=Math.min(F,E.distance(b[T],x[o])),F===0)return F;return F}function bv(b,f,x){if(tl(b,f,!0))return 0;let C=1/0;for(const E of f){const F=E[0],T=E[E.length-1];if(F!==T&&(C=Math.min(C,Zn(b,[T,F],x)),C===0))return C;const o=x.pointOnLine(E,b);if(C=Math.min(C,x.distance(b,o.point)),C===0)return C}return C}function wv(b,f,x,C){if(!fs(f,b.length))return NaN;for(let F=f[0];F<=f[1];++F)if(tl(b[F],x,!0))return 0;let E=1/0;for(let F=f[0];F<f[1];++F){const T=b[F],o=b[F+1];for(const fe of x)for(let ce=0,Ae=fe.length,Ie=Ae-1;ce<Ae;Ie=ce++){const De=fe[Ie],ie=fe[ce];if(Wu(T,o,De,ie))return 0;E=Math.min(E,cd(T,o,De,ie,C))}}return E}function gm(b,f){for(const x of b)for(const C of x)if(tl(C,f,!0))return!0;return!1}function Tv(b,f,x,C=1/0){const E=Fp(b),F=Fp(f);if(C!==1/0&&ld(E,F,x)>=C)return C;if(xc(E,F)){if(gm(b,f))return 0}else if(gm(f,b))return 0;let T=1/0;for(const o of b)for(let fe=0,ce=o.length,Ae=ce-1;fe<ce;Ae=fe++){const Ie=o[Ae],De=o[fe];for(const ie of f)for(let be=0,et=ie.length,ft=et-1;be<et;ft=be++){const Nt=ie[ft],qt=ie[be];if(Wu(Ie,De,Nt,qt))return 0;T=Math.min(T,cd(Ie,De,Nt,qt,x))}}return T}function _m(b,f,x,C,E,F){if(!F)return;const T=ld(Rp(C,F),E,x);T<f&&b.push([T,F,[0,0]])}function Lu(b,f,x,C,E,F,T){if(!F||!T)return;const o=ld(Rp(C,F),Rp(E,T),x);o<f&&b.push([o,F,T])}function Uu(b,f,x,C,E=1/0){let F=Math.min(C.distance(b[0],x[0][0]),E);if(F===0)return F;const T=new Qm([[0,[0,b.length-1],[0,0]]],eg),o=Fp(x);for(;T.length>0;){const fe=T.pop();if(fe[0]>=F)continue;const ce=fe[1],Ae=f?Dp:zp;if(Nu(ce)<=Ae){if(!fs(ce,b.length))return NaN;if(f){const Ie=wv(b,ce,x,C);if(isNaN(Ie)||Ie===0)return Ie;F=Math.min(F,Ie)}else for(let Ie=ce[0];Ie<=ce[1];++Ie){const De=bv(b[Ie],x,C);if(F=Math.min(F,De),F===0)return 0}}else{const Ie=Lp(ce,f);_m(T,F,C,b,o,Ie[0]),_m(T,F,C,b,o,Ie[1])}}return F}function $u(b,f,x,C,E,F=1/0){let T=Math.min(F,E.distance(b[0],x[0]));if(T===0)return T;const o=new Qm([[0,[0,b.length-1],[0,x.length-1]]],eg);for(;o.length>0;){const fe=o.pop();if(fe[0]>=T)continue;const ce=fe[1],Ae=fe[2],Ie=f?Dp:zp,De=C?Dp:zp;if(Nu(ce)<=Ie&&Nu(Ae)<=De){if(!fs(ce,b.length)&&fs(Ae,x.length))return NaN;let ie;if(f&&C)ie=xv(b,ce,x,Ae,E),T=Math.min(T,ie);else if(f&&!C){const be=b.slice(ce[0],ce[1]+1);for(let et=Ae[0];et<=Ae[1];++et)if(ie=Zn(x[et],be,E),T=Math.min(T,ie),T===0)return T}else if(!f&&C){const be=x.slice(Ae[0],Ae[1]+1);for(let et=ce[0];et<=ce[1];++et)if(ie=Zn(b[et],be,E),T=Math.min(T,ie),T===0)return T}else ie=vv(b,ce,x,Ae,E),T=Math.min(T,ie)}else{const ie=Lp(ce,f),be=Lp(Ae,C);Lu(o,T,E,b,x,ie[0],be[0]),Lu(o,T,E,b,x,ie[0],be[1]),Lu(o,T,E,b,x,ie[1],be[0]),Lu(o,T,E,b,x,ie[1],be[1])}}return T}function Sv(b,f){const x=b.geometry(),C=x.flat().map(T=>sd([T.x,T.y],b.canonical));if(x.length===0)return NaN;const E=new od(C[0][1]);let F=1/0;for(const T of f){switch(T.type){case"Point":F=Math.min(F,$u(C,!1,[T.coordinates],!1,E,F));break;case"LineString":F=Math.min(F,$u(C,!1,T.coordinates,!0,E,F));break;case"Polygon":F=Math.min(F,Uu(C,!1,T.coordinates,E,F));break}if(F===0)return F}return F}function Cv(b,f){const x=b.geometry(),C=x.flat().map(T=>sd([T.x,T.y],b.canonical));if(x.length===0)return NaN;const E=new od(C[0][1]);let F=1/0;for(const T of f){switch(T.type){case"Point":F=Math.min(F,$u(C,!0,[T.coordinates],!1,E,F));break;case"LineString":F=Math.min(F,$u(C,!0,T.coordinates,!0,E,F));break;case"Polygon":F=Math.min(F,Uu(C,!0,T.coordinates,E,F));break}if(F===0)return F}return F}function Mv(b,f){const x=b.geometry();if(x.length===0||x[0].length===0)return NaN;const C=gv(x).map(T=>T.map(o=>o.map(fe=>sd([fe.x,fe.y],b.canonical)))),E=new od(C[0][0][0][1]);let F=1/0;
743for(const T of f)for(const o of C){switch(T.type){case"Point":F=Math.min(F,Uu([T.coordinates],!1,o,E,F));break;case"LineString":F=Math.min(F,Uu(T.coordinates,!0,o,E,F));break;case"Polygon":F=Math.min(F,Tv(o,T.coordinates,E,F));break}if(F===0)return F}return F}function wp(b){return b.type==="MultiPolygon"?b.coordinates.map(f=>({type:"Polygon",coordinates:f})):b.type==="MultiLineString"?b.coordinates.map(f=>({type:"LineString",coordinates:f})):b.type==="MultiPoint"?b.coordinates.map(f=>({type:"Point",coordinates:f})):[b]}class Wn{constructor(f,x){this.type=Ue,this.geojson=f,this.geometries=x}static parse(f,x){if(f.length!==2)return x.error(`'distance' expression requires exactly one argument, but found ${f.length-1} instead.`);if(yc(f[1])){const C=f[1];if(C.type==="FeatureCollection")return new Wn(C,C.features.map(E=>wp(E.geometry)).flat());if(C.type==="Feature")return new Wn(C,wp(C.geometry));if("type"in C&&"coordinates"in C)return new Wn(C,wp(C))}return x.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(f){if(f.geometry()!=null&&f.canonicalID()!=null){if(f.geometryType()==="Point")return Sv(f,this.geometries);if(f.geometryType()==="LineString")return Cv(f,this.geometries);if(f.geometryType()==="Polygon")return Mv(f,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class Xu{constructor(f){this.type=xt,this.key=f}static parse(f,x){if(f.length!==2)return x.error(`Expected 1 argument, but found ${f.length-1} instead.`);const C=f[1];return C==null?x.error("Global state property must be defined."):typeof C!="string"?x.error(`Global state property must be string, but found ${typeof f[1]} instead.`):new Xu(C)}evaluate(f){var x;const C=(x=f.globals)===null||x===void 0?void 0:x.globalState;return!C||Object.keys(C).length===0?null:qm(C,this.key)}eachChild(){}outputDefined(){return!1}}const tg={"==":Yx,"!=":Kx,">":Qx,"<":Jx,">=":tv,"<=":ev,array:Ca,at:Yp,boolean:Ca,case:Qp,coalesce:ju,collator:Hu,format:rd,image:id,in:Kp,"index-of":Bu,interpolate:Jo,"interpolate-hcl":Jo,"interpolate-lab":Jo,length:ad,let:Xp,literal:Qo,match:Jp,number:Ca,"number-format":td,object:Ca,slice:Ou,step:ed,string:Ca,"to-boolean":Xs,"to-color":Xs,"to-number":Xs,"to-string":Xs,var:Gu,within:Hn,distance:Wn,"global-state":Xu};class us{constructor(f,x,C,E){this.name=f,this.type=x,this._evaluate=C,this.args=E}evaluate(f){return this._evaluate(f,this.args)}eachChild(f){this.args.forEach(f)}outputDefined(){return!1}static parse(f,x){const C=f[0],E=us.definitions[C];if(!E)return x.error(`Unknown expression "${C}". If you wanted a literal array, use ["literal", [...]].`,0);const F=Array.isArray(E)?E[0]:E.type,T=Array.isArray(E)?[[E[1],E[2]]]:E.overloads,o=T.filter(([ce])=>!Array.isArray(ce)||ce.length===f.length-1);let fe=null;for(const[ce,Ae]of o){fe=new Wp(x.registry,Bp,x.path,null,x.scope);const Ie=[];let De=!1;for(let ie=1;ie<f.length;ie++){const be=f[ie],et=Array.isArray(ce)?ce[ie-1]:ce.type,ft=fe.parse(be,1+Ie.length,et);if(!ft){De=!0;break}Ie.push(ft)}if(!De){if(Array.isArray(ce)&&ce.length!==Ie.length){fe.error(`Expected ${ce.length} arguments, but found ${Ie.length} instead.`);continue}for(let ie=0;ie<Ie.length;ie++){const be=Array.isArray(ce)?ce[ie]:ce.type,et=Ie[ie];fe.concat(ie+1).checkSubtype(be,et.type)}if(fe.errors.length===0)return new us(C,F,Ae,Ie)}}if(o.length===1)x.errors.push(...fe.errors);else{const ce=(o.length?o:T).map(([Ie])=>Av(Ie)).join(" | "),Ae=[];for(let Ie=1;Ie<f.length;Ie++){const De=x.parse(f[Ie],1+Ae.length);if(!De)return null;Ae.push(cr(De.type))}x.error(`Expected arguments of type ${ce}, but found (${Ae.join(", ")}) instead.`)}return null}static register(f,x){us.definitions=x;for(const C in x)f[C]=us}}function ym(b,[f,x,C,E]){f=f.evaluate(b),x=x.evaluate(b),C=C.evaluate(b);const F=E?E.evaluate(b):1,T=Gm(f,x,C,F);if(T)throw new xr(T);return new Wt(f/255,x/255,C/255,F,!1)}function xm(b,f){return b in f}function Tp(b,f){const x=f[b];return typeof x>"u"?null:x}function Iv(b,f,x,C){for(;x<=C;){const E=x+C>>1;if(f[E]===b)return!0;f[E]>b?C=E-1:x=E+1}return!1}function $n(b){return{type:b}}us.register(tg,{error:[vx,[Mt],(b,[f])=>{throw new xr(f.evaluate(b))}],typeof:[Mt,[xt],(b,[f])=>cr(Yr(f.evaluate(b)))],"to-rgba":[ha(Ue,4),[hs],(b,[f])=>{const[x,C,E,F]=f.evaluate(b).rgb;return[x*255,C*255,E*255,F]}],rgb:[hs,[Ue,Ue,Ue],ym],rgba:[hs,[Ue,Ue,Ue,Ue],ym],has:{type:bt,overloads:[[[Mt],(b,[f])=>xm(f.evaluate(b),b.properties())],[[Mt,Yo],(b,[f,x])=>xm(f.evaluate(b),x.evaluate(b))]]},get:{type:xt,overloads:[[[Mt],(b,[f])=>Tp(f.evaluate(b),b.properties())],[[Mt,Yo],(b,[f,x])=>Tp(f.evaluate(b),x.evaluate(b))]]},"feature-state":[xt,[Mt],(b,[f])=>Tp(f.evaluate(b),b.featureState||{})],properties:[Yo,[],b=>b.properties()],"geometry-type":[Mt,[],b=>b.geometryType()],id:[xt,[],b=>b.id()],zoom:[Ue,[],b=>b.globals.zoom],"heatmap-density":[Ue,[],b=>b.globals.heatmapDensity||0],elevation:[Ue,[],b=>b.globals.elevation||0],"line-progress":[Ue,[],b=>b.globals.lineProgress||0],accumulated:[xt,[],b=>b.globals.accumulated===void 0?null:b.globals.accumulated],"+":[Ue,$n(Ue),(b,f)=>{let x=0;for(const C of f)x+=C.evaluate(b);return x}],"*":[Ue,$n(Ue),(b,f)=>{let x=1;for(const C of f)x*=C.evaluate(b);return x}],"-":{type:Ue,overloads:[[[Ue,Ue],(b,[f,x])=>f.evaluate(b)-x.evaluate(b)],[[Ue],(b,[f])=>-f.evaluate(b)]]},"/":[Ue,[Ue,Ue],(b,[f,x])=>f.evaluate(b)/x.evaluate(b)],"%":[Ue,[Ue,Ue],(b,[f,x])=>f.evaluate(b)%x.evaluate(b)],ln2:[Ue,[],()=>Math.LN2],pi:[Ue,[],()=>Math.PI],e:[Ue,[],()=>Math.E],"^":[Ue,[Ue,Ue],(b,[f,x])=>Math.pow(f.evaluate(b),x.evaluate(b))],sqrt:[Ue,[Ue],(b,[f])=>Math.sqrt(f.evaluate(b))],log10:[Ue,[Ue],(b,[f])=>Math.log(f.evaluate(b))/Math.LN10],ln:[Ue,[Ue],(b,[f])=>Math.log(f.evaluate(b))],log2:[Ue,[Ue],(b,[f])=>Math.log(f.evaluate(b))/Math.LN2],sin:[Ue,[Ue],(b,[f])=>Math.sin(f.evaluate(b))],cos:[Ue,[Ue],(b,[f])=>Math.cos(f.evaluate(b))],tan:[Ue,[Ue],(b,[f])=>Math.tan(f.evaluate(b))],asin:[Ue,[Ue],(b,[f])=>Math.asin(f.evaluate(b))],acos:[Ue,[Ue],(b,[f])=>Math.acos(f.evaluate(b))],atan:[Ue,[Ue],(b,[f])=>Math.atan(f.evaluate(b))],min:[Ue,$n(Ue),(b,f)=>Math.min(...f.map(x=>x.evaluate(b)))],max:[Ue,$n(Ue),(b,f)=>Math.max(...f.map(x=>x.evaluate(b)))],abs:[Ue,[Ue],(b,[f])=>Math.abs(f.evaluate(b))],round:[Ue,[Ue],(b,[f])=>{const x=f.evaluate(b);return x<0?-Math.round(-x):Math.round(x)}],floor:[Ue,[Ue],(b,[f])=>Math.floor(f.evaluate(b))],ceil:[Ue,[Ue],(b,[f])=>Math.ceil(f.evaluate(b))],"filter-==":[bt,[Mt,xt],(b,[f,x])=>b.properties()[f.value]===x.value],"filter-id-==":[bt,[xt],(b,[f])=>b.id()===f.value],"filter-type-==":[bt,[Mt],(b,[f])=>b.geometryType()===f.value],"filter-<":[bt,[Mt,xt],(b,[f,x])=>{const C=b.properties()[f.value],E=x.value;return typeof C==typeof E&&C<E}],"filter-id-<":[bt,[xt],(b,[f])=>{const x=b.id(),C=f.value;return typeof x==typeof C&&x<C}],"filter->":[bt,[Mt,xt],(b,[f,x])=>{const C=b.properties()[f.value],E=x.value;return typeof C==typeof E&&C>E}],"filter-id->":[bt,[xt],(b,[f])=>{const x=b.id(),C=f.value;return typeof x==typeof C&&x>C}],"filter-<=":[bt,[Mt,xt],(b,[f,x])=>{const C=b.properties()[f.value],E=x.value;return typeof C==typeof E&&C<=E}],"filter-id-<=":[bt,[xt],(b,[f])=>{const x=b.id(),C=f.value;return typeof x==typeof C&&x<=C}],"filter->=":[bt,[Mt,xt],(b,[f,x])=>{const C=b.properties()[f.value],E=x.value;return typeof C==typeof E&&C>=E}],"filter-id->=":[bt,[xt],(b,[f])=>{const x=b.id(),C=f.value;return typeof x==typeof C&&x>=C}],"filter-has":[bt,[xt],(b,[f])=>f.value in b.properties()],"filter-has-id":[bt,[],b=>b.id()!==null&&b.id()!==void 0],"filter-type-in":[bt,[ha(Mt)],(b,[f])=>f.value.indexOf(b.geometryType())>=0],"filter-id-in":[bt,[ha(xt)],(b,[f])=>f.value.indexOf(b.id())>=0],"filter-in-small":[bt,[Mt,ha(xt)],(b,[f,x])=>x.value.indexOf(b.properties()[f.value])>=0],"filter-in-large":[bt,[Mt,ha(xt)],(b,[f,x])=>Iv(b.properties()[f.value],x.value,0,x.value.length-1)],all:{type:bt,overloads:[[[bt,bt],(b,[f,x])=>f.evaluate(b)&&x.evaluate(b)],[$n(bt),(b,f)=>{for(const x of f)if(!x.evaluate(b))return!1;return!0}]]},any:{type:bt,overloads:[[[bt,bt],(b,[f,x])=>f.evaluate(b)||x.evaluate(b)],[$n(bt),(b,f)=>{for(const x of f)if(x.evaluate(b))return!0;return!1}]]},"!":[bt,[bt],(b,[f])=>!f.evaluate(b)],"is-supported-script":[bt,[Mt],(b,[f])=>{const x=b.globals&&b.globals.isSupportedScript;return x?x(f.evaluate(b)):!0}],upcase:[Mt,[Mt],(b,[f])=>f.evaluate(b).toUpperCase()],downcase:[Mt,[Mt],(b,[f])=>f.evaluate(b).toLowerCase()],concat:[Mt,$n(xt),(b,f)=>f.map(x=>mc(x.evaluate(b))).join("")],"resolved-locale":[Mt,[Zu],(b,[f])=>f.evaluate(b).resolvedLocale()]});function Av(b){return Array.isArray(b)?`(${b.map(cr).join(", ")})`:`(${cr(b.type)}...)`}function Bp(b){if(b instanceof Gu)return Bp(b.boundExpression);if(b instanceof us&&b.name==="error"||b instanceof Hu||b instanceof Hn||b instanceof Wn||b instanceof Xu)return!1;const f=b instanceof Xs||b instanceof Ca;let x=!0;return b.eachChild(C=>{f?x=x&&Bp(C):x=x&&C instanceof Qo}),x?rg(b)&&ig(b,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function rg(b){if(b instanceof us&&(b.name==="get"&&b.args.length===1||b.name==="feature-state"||b.name==="has"&&b.args.length===1||b.name==="properties"||b.name==="geometry-type"||b.name==="id"||/^filter-/.test(b.name))||b instanceof Hn||b instanceof Wn)return!1;let f=!0;return b.eachChild(x=>{f&&!rg(x)&&(f=!1)}),f}function ig(b,f){if(b instanceof us&&f.indexOf(b.name)>=0)return!1;let x=!0;return b.eachChild(C=>{x&&!ig(C,f)&&(x=!1)}),x}function Pv(b){return b["property-type"]==="data-driven"||b["property-type"]==="cross-faded-data-driven"}function vm(b){return Array.isArray(b)&&b.length>0&&typeof b[0]=="string"&&b[0]in tg}const Sp=yx;function bm(b){var f,x,C,E,F;if(b){if(b.type=="line")return((f=b.paint)==null?void 0:f["line-opacity"])<=.001;if(b.type=="fill")return!(((x=b.paint)==null?void 0:x["fill-opacity"])<=.001);if(b.type=="symbol")return(C=b.layout)!=null&&C["icon-image"]?((E=b.paint)==null?void 0:E["icon-opacity"])<=.001:((F=b.paint)==null?void 0:F["text-opacity"])<=.001}}function wm(b){if(b){let f=0;for(const x in b._vectorTileFeature)typeof b._vectorTileFeature[x]=="number"&&(f+=b._vectorTileFeature[x]);return f}}function kv(b,f){if(!b||!f)return!1;const x=b.id===void 0?wm(b):b.id,C=f.id===void 0?wm(f):f.id;return x===C}function Ev(b,f,x){return["case",["boolean",["feature-state",b],!1],typeof f=="object"&&!vm(f)?["literal",f]:f,typeof x=="object"&&!vm(x)?["literal",x]:x]}const Tm=["paint","layout"],zv=["select","hover"],Dv={maxPitch:75,center:{lng:11.40037,lat:47.26816},zoom:12};let Lv=class extends Xn.Map{constructor(b){Ii.apiKey=(b==null?void 0:b.apiKey)||"",typeof(b==null?void 0:b.locale)=="str
743ing"&&(Ii.locale=b==null?void 0:b.locale),b=Object.assign({style:ky.TERRAIN},Dv,b);const f=document.createElement("div");f.classList.add("maptoolkit-map"),f.style.width=f.style.height="100%",super({...b,container:f,attributionControl:!1,maplibreLogo:!1}),Ii.pixelRatio=this.getPixelRatio(),this._locale=Object.assign({},Cy(),typeof b.locale=="object"?b.locale:null),this._style=void 0,this._states={global:{},feature:{}},this._statesActive={global:{},feature:{}},b.attributionControl!==!1&&this.addControl(new Iy(b.attributionControl)),b.logoControl!==!1&&this.addControl(new Py(b.logoControl)),this.on("mousemove",x=>{const C=[[x.point.x-3,x.point.y-3],[x.point.x+3,x.point.y+3]];if("select"in this._states.feature){const E=this._getStateFeature("select",C);this._canvasContainer.style.cursor=E?"pointer":""}if("hover"in this._states.feature){const E=this._getStateFeature("hover",C);this._setStateFeature("hover",E,x)}}),this.on("click",x=>{const C=[[x.point.x-3,x.point.y-3],[x.point.x+3,x.point.y+3]],E=this._getStateFeature("select",C);this._setStateFeature("select",E,x)}),b.container&&this.setContainer(b.container)}set selectedFeature(b){this._setStateFeature("select",b||void 0)}get selectedFeature(){return this._statesActive.feature.select}set hoveredFeature(b){this._setStateFeature("hover",b||void 0)}get hoveredFeature(){return this._statesActive.feature.hover}_getStateFeature(b,f){if(b in this._states.global||b in this._states.feature){const x=Object.keys(this._states.global[b]||this._states.feature[b]);return this.queryRenderedFeatures(f,{layers:x}).filter(C=>!bm(C.layer))[0]}}_setStateFeature(b,f,x){const C={hover:{enable:["mouseover"],disable:["mouseout"]},select:{enable:["select"],disable:["deselect"]}},E=kv(f,this._statesActive.feature[b]);if(this._statesActive.feature[b]&&!E){if(this._statesActive.feature[b].id!==void 0&&this.setFeatureState(this._statesActive.feature[b],{[b]:!1}),x){const F=x;if(F.feature=this._statesActive.feature[b],C[b]&&C[b].disable)for(const T of C[b].disable)this.fire(`feature.${T}`,F)}delete this._statesActive.feature[b]}if(f&&!bm(f.layer)&&!E){if(f.id!==void 0)this.setFeatureState(f,{[b]:!0});else{const F=f.layer?`${f.layer.id}: `:"";console.warn(`${F}Feature state '${b}' couldn't be set, source feature must provide an id.`)}if(this._statesActive.feature[b]=f,x){const F=x;if(F.feature=f,C[b]&&C[b].enable)for(const T of C[b].enable)this.fire(`feature.${T}`,F)}}this._applyStates()}_parseStates(){const b=this.style.serialize();if(b){this._truncateStates();for(const f of b.layers){const x=f.metadata;if(x){const C=x["maptoolkit:states"]||x["mtk:states"];if(C)for(const E in C){const F=zv.includes(E)?this._states.feature:this._states.global;F[E]||(F[E]={}),F[E][f.id]=C[E]}}}}}_truncateStates(){this._states={global:{},feature:{}}}_applyStates(){const b=JSON.parse(JSON.stringify(this._style));for(const f in this._states.global)if(this._statesActive.global[f]===!0){for(const x of b.layers
743)if(x.id in this._states.global[f]){for(const C in this._states.global[f][x.id])if(C!=="metadata")if(!Tm.includes(C))x[C]=this._states.global[f][x.id][C];else{C in x||(x[C]={});for(const E in this._states.global[f][x.id][C])x[C][E]=this._states.global[f][x.id][C][E]}}}for(const f in this._states.feature)for(let x=0;x<b.layers.length;++x)if(b.layers[x].id in this._states.feature[f])for(const C of Tm)for(const E in this._states.feature[f][b.layers[x].id][C]){const F=Pv(Sp[`${C}_${b.layers[x].type}`][E]),T=Sp[`${C}_${b.layers[x].type}`][E].expression.parameters.includes("feature-state");if(F){if(!T){console.error(`layers[${x}].${b.layers[x].type}.${C}.${E}: doesn't support "feature-state" data expressions.`),delete this._states.feature[f][b.layers[x].id][C][E];continue}}else{console.error(`layers[${x}].${b.layers[x].type}.${C}.${E} doesn't support data expressions and can't use feature states.`),delete this._states.feature[f][b.layers[x].id][C][E];continue}const o=Sp[`${C}_${b.layers[x].type}`][E].default,fe=b.layers[x][C][E],ce=this._states.feature[f][b.layers[x].id][C][E];b.layers[x][C][E]=Ev(f,ce,fe===void 0?o:fe)}this.setStyle(b,{},!0),this.redraw()}setContainer(b){if(typeof b=="string"){const f=document.getElementById(b);f?this._parent=f:console.error(`Container with id "${b}" not found.`)}else b instanceof HTMLElement&&(this._parent=b);return this._parent?(this._parent.contains(this._container)||(this._parent.innerHTML=""),this._parent.appendChild(this._container)&&this.resize()):console.error("Invalid type: 'container' must be a String or HTMLElement."),this}remove(){return this._container.remove(),this._parent=void 0,this}getStates(){return this._statesActive.global?Object.keys(this._statesActive.global).filter(b=>this._statesActive.global[b]===!0):[]}setStates(b){if(this._statesActive.global={},Array.isArray(b))for(const f of b)this._statesActive.global[f]=!0;return this.style._loaded&&this._applyStates(),this}setStyle(b,f,x){return x!==!0&&this.fire("style.set",{style:b}),super.setStyle(b,f),x!==!0&&(this._truncateStates(),this._styleId=Ey(typeof b=="string"?b:JSON.stringify(b)),this.once("styledata",()=>{this._parseStates(),this._style=this.style?this.style.serialize():void 0,this._applyStates()})),this}addLayer(b,f){const x=Array.isArray(b)?b:[b];this._lazyInitEmptyStyle();for(const C of x)this.style.addLayer(C,f);return this._update(!0),this._parseStates(),this._style=this.style?this.style.serialize():void 0,this._applyStates(),this}removeLayer(b){return this.style.removeLayer(b),this._update(!0),this._parseStates(),this._style=this.style?this.style.serialize():void 0,this._applyStates(),this}moveLayer(b,f){return this.style.moveLayer(b,f),this._update(!0),this._parseStates(),this._style=this.style?this.style.serialize():void 0,this._applyStates(),this}_getUIString(b,f){try{const x=super._getUIString(b);return f&&typeof f=="object"?x.replace(/{(.*?)}/g,(C,E)=>E in f?f[E]:C):x}catch(x){return console.warn(x),""}}addControl(b,f){return super.addControl(b,f),this}_setupContainer(){super._setupContainer();const b=document.createElement("div");b.classList.add("maplibregl-ctrl-top-center"),this._controlContainer.insertBefore(b,this._controlPositions["top-right"]),this._controlPositions["top-center"]=b;const f=document.createElement("div");f.classList.add("maplibregl-ctrl-bottom-center"),this._controlContainer.insertBefore(f,this._controlPositions["bottom-right"]),this._controlPositions["bottom-center"]=f}};const Rv={type:"raster-dem",tiles:[`${Ii.vtcCdnHost}/terrain/{z}/{x}/{y}.webp`],encoding:"mapbox",minzoom:5,maxzoom:12},Cp={knobSize:16,sliderSize:52,autoHide:!1};class Sm{constructor(f){this.options=Object.assign(Cp,f),this._active=!1}getDefaultPosition(){return"bottom-left"}onAdd(f){this._map=f;const x=this.options.knobSize||Cp.knobSize||16,C=this.options.sliderSize||Cp.sliderSize||52;this._container=document.createElement("div"),this._container.classList.add("maplibregl-ctrl","maptoolkit-ctrl","maptoolkit-ctrl-pitch"),this._container.style.height=`${C}px`;const E=document.createElement("div");E.classList.add("maptoolkit-ctrl-pitch-slide");const F=document.createElement("div");F.classList.add("maptoolkit-ctrl-pitch-knob"),F.title=f._getUIString("PitchControl.ChangePitch"),F.style.width=F.style.height=`${x}px`,F.style.margin=`-${x/2}px calc(50% - ${x/2}px)`;let T=0,o=f.getPitch()/f.getMaxPitch()*(C-x),fe=o;this._onMouseDown=Ae=>{var Ie;return this._active=!0,T=Ae instanceof TouchEvent?(Ie=Ae.touches[0])==null?void 0:Ie.pageY:Ae.pageY,o=f.getPitch()/f.getMaxPitch()*(C-x),Ae.stopPropagation(),Ae.preventDefault(),!1},this._onMouseMove=Ae=>{var Ie;if(this._active){const De=T-(Ae instanceof TouchEvent?(Ie=Ae.touches[0])==null?void 0:Ie.pageY:Ae.pageY);fe=Math.max(0,Math.min(C-x,o+De)),f.setPitch(fe/(C-x)*f.getMaxPitch())}},this._onMouseUp=()=>{this._active=!1,o=fe},F.addEventListener("mousedown",this._onMouseDown),F.addEventListener("touchstart",this._onMouseDown),window.addEventListener("mousemove",this._onMouseMove),window.addEventListener("touchmove",this._onMouseMove),window.addEventListener("mouseup",this._onMouseUp),window.addEventListener("touchend",this._onMouseUp);let ce;return this._onPitch=()=>{F.style.top=`${C-f.getPitch()/f.getMaxPitch()*C}px`,clearTimeout(ce),this.options.autoHide&&(this.isHidden()&&f.transform.pitch>0?this.show():!this.isHidden()&&f.transform.pitch===0&&(ce=setTimeout(()=>this.hide(),400)))},f.on("pitch",this._onPitch),this._onPitch({}),this._container.appendChild(E),this._container.appendChild(F),this._container}onRemove(){var f;this._onMouseUp&&(window.removeEventListener("mousedown",this._onMouseUp),window.removeEventListener("touchstart",this._onMouseUp)),this._onMouseMove&&(window.removeEventListener("mousemove",this._onMouseMove),window.removeEventListener("touchmove",this._onMouseMove)),this._onMouseUp&&(window.removeEventListener("mouseup",this._onMouseUp),window.removeEventListener("touchend",this._onMouseUp)),this._map&&this._onPitch&&this._map.off("pitch",this._onPitch),(f=this._container)!=null&&f.parentNode&&this._container.parentNode.removeChild(this._container),this._map=void 0}isActive(){return this._active}isHidden(){return this._container?this._container.classList.contains("maptoolkit-ctrl-pitch-hide"):!0}show(){return this._container&&(this._container.style.height=`${this.options.sliderSize}px`,this._container.classList.remove("maptoolkit-ctrl-pitch-hide")),this}hide(){return this._container&&(this._container.style.height="0px",this._container.classList.add("maptoolkit-ctrl-pitch-hide")),this}}const Fv={};class Cm{constructor(f){this.options=Object.assign(Fv,f)}getDefaultPosition(){return"bottom-left"}onAdd(f){this._map=f,this._container=document.createElement("div"),this._container.classList.add("maplibregl-ctrl","maptoolkit-ctrl","maptoolkit-ctrl-compass");const x=document.createElement("div");
743x.classList.add("maptoolkit-ctrl-compass-img");const C=document.createElement("div");C.classList.add("maptoolkit-ctrl-compass-label"),C.title=f._getUIString("CompassControl.ResetBearing"),C.addEventListener("click",()=>f.resetNorth());const E=document.createElement("div");E.classList.add("maptoolkit-ctrl-compass-arrow-left"),E.title=f._getUIString("CompassControl.RotateLeft"),E.addEventListener("click",()=>f.easeTo({bearing:f.getBearing()+90}));const F=document.createElement("div");return F.classList.add("maptoolkit-ctrl-compass-arrow-right"),F.title=f._getUIString("CompassControl.RotateRight"),F.addEventListener("click",()=>f.easeTo({bearing:f.getBearing()-90})),this._onRotate=()=>{let T=(f.transform.bearing+360)%360;x.style.transform=`rotate(${T*-1}deg)`,T<0&&(T+=360),T>315||T<=45?C.innerText="N":T>45&&T<=135?C.innerText="E":T>135&&T<=225?C.innerText="S":T>225&&T<=315&&(C.innerText="W")},f.on("rotate",this._onRotate),this._onRotate({}),this._container.appendChild(x),this._container.appendChild(E),this._container.appendChild(C),this._container.appendChild(F),this._container}onRemove(){var f;this._map&&this._onRotate&&this._map.off("rotate",this._onRotate),(f=this._container)!=null&&f.parentNode&&this._container.parentNode.removeChild(this._container),this._map=void 0}}const Bv={pitch:60,globe:!1};class Mm{constructor(f){this.options=Object.assign(Bv,f),this._active=!1,this._enabled=!1,this._loaded=!1}getDefaultPosition(){return"bottom-left"}onAdd(f){this._map=f,this._container=document.createElement("div"),this._container.classList.add("maplibregl-ctrl","maplibregl-ctrl-group","maptoolkit-ctrl","maptoolkit-ctrl-terrain");const x=document.createElement("button");x.title=f._getUIString("TerrainControl.ToggleTilt"),x.addEventListener("click",()=>{this._active||(this._enabled?this.disable():this.enable())}),this._container.appendChild(x);function C(){x.innerText=f.transform.pitch>0?"2D":"3D"}return C(),this._onPitch=E=>{this._active||(this._active=!0),f.transform.pitch>0&&!this._enabled?(C(),this._enabled=!0,E.originalEvent instanceof MouseEvent?(this._update(),this._loaded=!0):this._loaded?this._update():f.once("pitchend",()=>{this._update(),this._loaded=!0})):f.transform.pitch==0&&this._enabled&&(C(),this._update(),this._enabled=!1)},this._onPitchEnd=()=>{this._active=!1},this._onStyleSet=()=>{this._map&&this._map.once("styledata",E=>{typeof this._projection>"u"&&(this._projection=E.target.getProjection()||{type:"mercator"}),this._update()})},f.on("pitch",this._onPitch),f.on("pitchend",this._onPitchEnd),f.on("style.set",this._onStyleSet),this._onStyleSet({target:f}),this._container}onRemove(){var f;this.disable(),this._map&&(this._onPitch&&this._map.off("pitch",this._onPitch),this._onPitchEnd&&this._map.off("pitchend",this._onPitchEnd),this._onStyleSet&&this._map.off("style.set",this._onStyleSet)),(f=this._container)!=null&&f.parentNode&&this._container.parentNode.removeChild(this._container),this._map=void 0}_update(){this._terrain(this._enabled),this.options.globe&&this._globe(this._enabled)}_terrain(f){this._map&&(this._map.style._loaded?f===!0?(this._map.getSource("maptoolkit-terrain")||this._map.addSource("maptoolkit-terrain",Rv),this._map.setTerrain({source:"maptoolkit-terrain"})):this._map.setTerrain(null):this._map.once("styledata",()=>this._terrain(f)))}_globe(f){this._map&&(this._map.style._loaded?this._projection&&this._projection.type!=="globe"&&(f===!0?this._map.setProjection({type:"globe"}):this._map.setProjection(this._projection)):this._map.once("styledata",()=>this._globe(f)))}enable(){return this._map&&!this._enabled&&this._map.transform.pitch===0&&this._map.easeTo({pitch:this.options.pitch}),this}disable(){return this._map&&this._enabled&&this._map.transform.pitch>0&&this._map.easeTo({pitch:0}),this}isEnabled(){return this._enabled}isActive(){return this._active}isLoaded(){return this._loaded}}const Ov={navigationControl:{showCompass:!1},pitchControl:{autoHide:!0}};class jv{constructor(f){this.options=Object.assign(Ov,f),this._navigationControl=new Xn.NavigationControl(this.options.navigationControl),this.options.terrainControl!==!1&&(this._terrainControl
743=new Mm(this.options.terrainControl)),this.options.pitchControl!==!1&&(this._pitchControl=new Sm(this.options.pitchControl)),this.options.compassControl!==!1&&(this._compassControl=new Cm(this.options.compassControl))}getDefaultPosition(){return"bottom-right"}onAdd(f){return this._container=document.createElement("div"),this._container.classList.add("maptoolkit-ctrl-navigation"),this._container.appendChild(this._navigationControl.onAdd(f)),this._compassControl instanceof Cm&&this._container.appendChild(this._compassControl.onAdd(f)),this._pitchControl instanceof Sm&&this._container.appendChild(this._pitchControl.onAdd(f)),this._terrainControl instanceof Mm&&this._container.appendChild(this._terrainControl.onAdd(f)),this._container}onRemove(){var f;(f=this._container)!=null&&f.parentNode&&this._container.parentNode.removeChild(this._container),this._map=void 0}}Yn.Map;Yn.NavigationControl;Yn.AttributionControl;Yn.LogoControl;Yn.TerrainControl;Yn.config;const{GeolocateControl:D0,ScaleControl:L0,FullscreenControl:R0,GlobeControl:F0,Hash:B0,Popup:Nv,Marker:O0,Style:j0,LngLat:N0,LngLatBounds:Uv,Point:U0,MercatorCoordinate:$0,Evented:V0,Event:Z0,AJAXError:q0,CanvasSource:G0,GeoJSONSource:H0,ImageSource:W0,RasterDEMTileSource:X0,RasterTileSource:Y0,VectorTileSource:K0,VideoSource:J0,EdgeInsets:Q0,BoxZoomHandler:eb,DragRotateHandler:tb,DragPanHandler:rb,ScrollZoomHandler:ib,TwoFingersTouchZoomRotateHandler:ab,CooperativeGesturesHandler:sb,DoubleClickZoomHandler:nb,KeyboardHandler:ob,TwoFingersTouchZoomHandler:lb,TwoFingersTouchRotateHandler:cb,TwoFingersTouchPitchHandler:ub,MapWheelEvent:hb,MapTouchEvent:pb,MapMouseEvent:db,setRTLTextPlugin:fb,getRTLTextPluginStatus:mb,prewarm:gb,clearPrewarmedResources:_b,getVersion:yb,getWorkerCount:xb,setWorkerCount:vb,getMaxParallelImageRequests:bb,setMaxParallelImageRequests:wb,getWorkerUrl:Tb,setWorkerUrl:Sb,addProtocol:Cb,removeProtocol:Mb,addSourceType:Ib,importScriptInWorkers:Ab,createTileMesh:Pb}=Yn,Wo="maptoolkit_article_map_",$v=jp({__name:"MapToolkit",props:cy({mapOptions:{},options:{},geojson:{},hoveredFeature:{},selectedFeature:{}},{hoveredFeature:{default:null},hoveredFeatureModifiers:{},selectedFeature:{default:null},selectedFeatureModifiers:{}}),emits:["update:hoveredFeature","update:selectedFeature"],setup(b,{expose:f}){var Et,zt,fr,ri;const x=b,C=tm(b,"hoveredFeature"),E=tm(b,"selectedFeature"),F=`${Wo}geojson`,T={},o=Ci(!1),fe=Ci(null);if((Et=x.geojson)!=null&&Et.features&&!((zt=x.mapOptions)!=null&&zt.center)){const Je=new Uv,ot=We=>{Array.isArray(We[0])?We.forEach(ot):Je.extend(We)};for(const We of x.geojson.features)ot(We.geometry.coordinates);Je.isEmpty()||(T.bounds=Je)}const ce=new Lv(Object.assign(T,x.mapOptions)),Ae=new jv({compassControl:!1,pitchControl:!1,terrainControl:!1});function Ie(){ce.getSource(F)||ce.addSource(F,{type:"geojson",data:x.geojson})}function De(){const Je=ce.getSource(F);Je&&Je.setData(x.geojson)}function ie(){var nt,Lt,ur,mr,Ui,Ai;ce.addLayer({id:`${Wo}_lines`,source:F,filter:["in",["geometry-type"],"LineString"],type:"line",layout:Object.assign({"line-cap":"round","line-join":"round"},(ur=(Lt=(nt=x.options)==null?void 0:nt.line)==null?void 0:Lt.default)==null?void 0:ur.layout),paint:Object.assign({"line-width":4,"line-color":"#DC0000"},(Ai=(Ui=(mr=x.options)==null?void 0:mr.line)==null?void 0:Ui.default)==null?void 0:Ai.paint)});const ot="data:image/svg+xml;base64,"+btoa(` 744 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"> 745 <path d="M12 2.10913C10.1435 2.10913 8.36301 2.82049 7.05025 4.08672C5.7375 5.35295 5 7.07032 5 8.86104C5 11.8234 9.375 18.9889 11.2563 21.9597C11.3347 22.0819 11.4442 22.1827 11.5744 22.2526C11.7045 22.3224 11.851 22.3591 12 22.3591C12.149 22.3591 12.2955 22.3224 12.4256 22.2526C12.5558 22.1827 12.6653 22.0819 12.7438 21.9597C14.625 18.9889 19 11.8234 19 8.86104C19 7.07032 18.2625 5.35295 16.9497 4.08672C15.637 2.82049 13.8565 2.10913 12 2.10913ZM12 11.815C11.3943 11.815 10.8022 11.6418 10.2986 11.3172C9.79494 10.9926 9.40241 10.5312 9.17062 9.99147C8.93883 9.45171 8.87818 8.85776 8.99635 8.28475C9.11451 7.71174 9.40619 7.18539 9.83449 6.77227C10.2628 6.35916 10.8085 6.07782 11.4025 5.96384C11.9966 5.84986 12.6124 5.90836 13.172 6.13194C13.7316 6.35552 14.2099 6.73413 14.5464 7.21991C14.8829 7.70568 15.0625 8.2768 15.0625 8.86104C15.0625 9.24896 14.9833 9.63308 14.8294 9.99147C14.6755 10.3499 14.4499 10.6755 14.1655 10.9498C13.8811 11.2241 13.5435 11.4417 13.172 11.5901C12.8004 11.7386 12.4022 11.815 12 11.815Z" fill="#DC0000" stroke="black" stroke-width="0.3" /> 746 </svg> 747 `),We=new Image(84,84);We.onload=()=>{var $i,Vi,Pi,br,Ct,Nr,Ur,ci,yi,ki,Qi,Gt,Zi,wr,Tr,It,Sr,hr;ce.addImage("svg-poi-icon",We),ce.addLayer({id:`${Wo}_points`,source:F,filter:["in",["geometry-type"],"Point"],type:"symbol",layout:Object.assign({"icon-image":"svg-poi-icon","icon-anchor":"bottom","icon-size":.4,"icon-allow-overlap":!0,"icon-ignore-placement":!0,"icon-offset":[0,4]},(Pi=(Vi=($i=x.options)==null?void 0:$i.icon)==null?void 0:Vi.default)==null?void 0:Pi.layout),paint:Object.assign({"icon-opacity":["case",["any",["boolean",["feature-state","hover"],!1],["boolean",["feature-state","select"],!1]],1e-4,1]},(Nr=(Ct=(br=x.options)==null?void 0:br.icon)==null?void 0:Ct.default)==null?void 0:Nr.paint)}),ce.addLayer({id:`${Wo}_points_hover`,source:F,filter:["in",["geometry-type"],"Point"],type:"symbol",layout:Object.assign({"icon-image":"svg-poi-icon","icon-anchor":"bottom","icon-size":.5,"icon-allow-overlap":!0,"icon-ignore-placement":!0,"icon-offset":[0,4]},(yi=(ci=(Ur=x.options)==null?void 0:Ur.icon)==null?void 0:ci.hover)==null?void 0:yi.layout),paint:Object.assign({"icon-opacity":["case",["all",["boolean",["feature-state","hover"],!1],["!",["boolean",["feature-state","select"],!1]]],1,1e-4]},(Gt=(Qi=(ki=x.options)==null?void 0:ki.icon)==null?void 0:Qi.hover)==null?void 0:Gt.paint)}),ce.addLayer({id:`${Wo}_points_select`,source:F,filter:["in",["geometry-type"],"Point"],type:"symbol",layout:Object.assign({"icon-image":"svg-poi-icon","icon-anchor":"bottom","icon-size":.5,"icon-allow-overlap":!0,"icon-ignore-placement":!0,"icon-offset":[0,4]},(Tr=(wr=(Zi=x.options)==null?void 0:Zi.icon)==null?void 0:wr.select)==null?void 0:Tr.layout),paint:Object.assign({"icon-opacity":["case",["boolean",["feature-state","select"],!1],1,1e-4]},(hr=(Sr=(It=x.options)==null?void 0:It.icon)==null?void 0:Sr.select)==null?void 0:hr.paint)})},We.onerror=$i=>{console.error("Error loading SVG icon:",$i)},We.src=ot}function be(Je){return ce.queryRenderedFeatures(Je,{layers:[`${Wo}_points`]}).filter(We=>We.layer.type==="symbol")}const et=Object.assign({closeButton:!1,className:"maptoolkit-v-map-popup"},(ri=(fr=x.options)==null?void 0:fr.popup)==null?void 0:ri.options),ft=new Nv(et);function Nt(Je){typeof Je=="string"?ft.setHTML(Je):Je instanceof Node&&ft.setDOMContent(Je)}
747function qt(Je,ot){var We;if((We=x.geojson)!=null&&We.features)for(const nt of x.geojson.features){const Lt=Je==nt.id,ur=ce.getFeatureState({id:nt.id,source:F})[ot]||!1;Lt!==ur&&ce.setFeatureState({id:nt.id,source:F},{[ot]:Lt})}}async function vr(Je){var nt,Lt,ur;const ot=be(Je.point)[0],We=Je.target.getCanvasContainer();if((ot==null?void 0:ot.id)!=((nt=C.value)==null?void 0:nt.id)&&(C.value=ot||null),ot){if(We.style.cursor="pointer",typeof((ur=(Lt=x.options)==null?void 0:Lt.popup)==null?void 0:ur.content)=="function"){const mr=x.options.popup.content(ot);ft.setLngLat(ot.geometry.coordinates),mr instanceof Promise?Nt(await mr):Nt(mr),ft._map||ft.addTo(ce)}}else We.style.cursor="",ft._map&&ft.remove()}function Bt(Je){var We;const ot=be(Je.point)[0];(ot==null?void 0:ot.id)!=((We=E.value)==null?void 0:We.id)&&(E.value=ot||null)}return fc(()=>x.geojson,()=>De(),{deep:!0}),fc(C,Je=>{o.value&&qt(Je==null?void 0:Je.id,"hover")}),fc(E,Je=>{o.value&&qt(Je==null?void 0:Je.id,"select")}),ce.once("style.load",()=>{ce.addControl(Ae,"bottom-right"),x.geojson&&(Ie(),ie(),ce.on("mousemove",vr),ce.on("click",Bt)),o.value=!0}),Rm(()=>{fe.value&&ce.setContainer(fe.value)}),uy("map",ce),f({map:ce}),(Je,ot)=>(nr(),Ni("div",{ref_key:"container",ref:fe,class:"maptoolkit-v-map"},null,512))}});async function Vv(b){if(!b)return{};const f=W_(),x={},C=[...new Set(b.features.map(E=>{var F;return(F=E.properties)==null?void 0:F.image_uuid}).filter(Boolean))];return await Promise.all(C.map(async E=>{try{const{data:F}=await X_(`asset-${E}`,async()=>await f.getAssetMetadata(E),{transform:T=>Y_(T)});F.value&&(x[E]=F.value)}catch(F){console.error(`Failed to fetch metadata for UUID: ${E}`,F)}})),x}function dc(b){return b.includes("austria.info/")||b.includes(".pages.dev/")||b.includes("localhost")?!1:!!(b.startsWith("http")||b.startsWith("https"))}function Im(b){try{return dc(b)?b:b.replace(new URL(b).origin,"")}catch{return b}}function Am(b){if(!b)return[];const f=[];return b.url_primary&&b.url_button_primary&&f.push({link:{id:b.url_primary,href:Im(b.url_primary),external:dc(b.url_primary),target:dc(b.url_primary)?"_blank":"_self"},buttonText:b.url_button_primary}),b.url_secondary&&b.url_button_secondary&&f.push({link:{id:b.url_secondary,href:Im(b.url_secondary),external:dc(b.url_secondary),target:dc(b.url_secondary)?"_blank":"_self"},buttonText:b.url_button_secondary}),f}const Mp=190,Ip=250,Ap=280;function Zv(b,f){const{t:x}=Em(),{maptoolkitApiKey:C}=K_().public,E=Ci(),F=Ci(!1),T=Ci("feature-list"),o=Ci(!1),fe=Ci(null),ce=Ci(!1),Ae=Ci(void 0),Ie=Ci(null),De=Ci(null),ie=Ci(),be=Ci(),et=J_(Q_),ft=et.smaller("md"),Nt=et.between("md","lg"),qt={popup:{options:{offset:[0,-34]},content:Je=>{var ot;return(ot=Je.properties)==null?void 0:ot.title}}},vr={apiKey:C,minZoom:Number(b.blok.minZoom),maxZoom:Number(b.blok.maxZoom),scrollZoom:!0,dragRotate:!1,dragPan:!0,boxZoom:!1,locale:{"CooperativeGesturesHandler.MobileHelpText":x("maptoolkit.cooperativeGesturesMobileHelpText")},cooperativeGestures:!0,fitBoundsOptions:{padding:ft.value?75:0,offset:ft.value?[0,40]:[0,0]}},Bt=Je=>{Je.on("load",()=>{ie.value=Je.getCenter(),be.value=Je.getZoom(),Je.touchZoomRotate.disableRotation()})},Et=Je=>{var We;const ot={center:Je.geometry.coordinates,offset:ft.value?[0,Mp]:[Nt.value?Ip:Ap,0]};(We=Ae.value)==null||We.map.flyTo({...ot,...b.blok.enableFlyToZoom&&{zoom:Math.max(Ae.value.map.getZoom(),Number(b.blok.flyToZoom))}})},zt=()=>{var Je;(Je=Ae.value)==null||Je.map.flyTo({center:ie.value,zoom:be.value,offset:ft.value?[0,F.value?Mp:0]:[F.value?Nt.value?Ip:Ap:0,0],essential:!0})},fr=Je=>{var ot;De.value=((ot=De.value)==null?void 0:ot.id)!==(Je==null?void 0:Je.id)?Je:null},ri=Je=>{var ot,We,nt;(nt=Ae.value)==null||nt.map.flyTo({center:(ot=Ae.value)==null?void 0:ot.map.getCenter(),zoom:(We=Ae.value)==null?void 0:We.map.getZoom(),offset:Je?ft.value?[0,Mp]:[Nt.value?Ip:Ap,0]:ft.value?[0,-190]:[Nt.value?-250:-280,0]})};return fc(De,Je=>{Je?(Et(Je),F.value||(o.value=!0,b.blok.mapType!=="pois"&&(T.value="initial",setTimeout(()=>{E.value.openItem(0)}))),T.value="feature"):(T.value="feature-list",zt())}),{maptoolkitRef:Ae,accordionRef:E,accordionState:F,accordionItem:T,accordionTriggered:o,hoveredFeature:Ie,selectedFeature:De,mapCardRef:fe,expandedViewRef:ce,articleMapOptions:qt,mapOptions:vr,isMobile:ft,initializeMap:Bt,adjustMapOffset:ri,onListItemClick:fr}}const qv=["data-gtm-section-id","data-gtm-section-name"],Gv={class:"container py-6 sm:py-10"},Hv={class:"relative overflow-hidden pb-10 2xl:container md:pb-20"},Wv={class:"relative h-[620px] w-full lg:h-[718px] xl:h-[936px]"},Xv={class:"pointer-events-none absolute top-0 z-10 size-full"},Yv={class:"relative w-full max-2xl:container"},Kv={key:0,class:"pointer-events-auto relative left-0 top-5 flex w-full max-w-[380px] flex-col overflow-hidden rounded-2xl bg-white shadow md:max-w-[450px] lg:top-10 lg:max-w-[480px] xl:max-w-[554px] 2xl:left-10"},Jv={class:"absolute end-4 top-4 z-10"},Qv={class:"hidden md:block"},e0={key:0,class:"line-clamp-2 font-alaska text-sm font-medium leading-tight text-neutral-950 lg:text-base lg:leading-snug xl:text-lg xl:leading-normal"},t0={class:"flex items-center text-xs lg:text-sm"},r0={class:"mt-px line-clamp-1 font-semibold lg:mt-[3px]"},i0={key:0,class:"relative"},a0={class:"absolute end-4 top-4 z-10"},s0={key:0,class:"relative transition-all duration-300 max-lg:overflow-y-auto max-md:max-h-[208px] md:max-h-[450px] lg:max-h-[510px] xl:max-h-[720px]"},n0={class:"flex flex-col p-2"},o0=["data-id"],l0=["onMouseover","onClick"],c0={class:"size-20 shrink-0 overflow-hidden rounded-md lg:size-[150px]"},u0={class:"flex shrink flex-col items-start gap-0 overflow-hidden lg:gap-2 lg:py-2"},h0={key:0,class:"font-alaska text-base font-medium text-neutral-950 lg:text-lg xl:text-xl"},p0={class:"line-clamp-3 text-left leading-tight lg:line-clamp-4 lg:leading-normal"},d0={class:"ms-auto shrink-0 pe-2"},f0={key:1,class:"relative"},m0={class:"absolute end-4 top-4 z-10"},g0={class:"hidden md:block"},_0={class:"size-full overflow-hidden bg-neutral-50 2xl:rounded-xl"},y0=jp({__name:"MaptoolkitModule",props:{blok:{}},async setup(b){let f,x;const C=b,E=Vn(()=>C.blok.editor.geojson),{accordionRef:F,accordionState:T,accordionItem:o,accordionTriggered:fe,maptoolkitRef:ce,hoveredFeature:Ae,selectedFeature:Ie,articleMapOptions:De,mapCardRef:ie,expandedViewRef:be,mapOptions:et,isMobile:ft,initializeMap:Nt,adjustMapOffset:qt,onListItemClick:vr}=Zv(C,E.value),Bt=Vn(()=>ie.value?ie.value.clientHeight:0),Et=([f,x]=hy(()=>Vv(E.value)),f=await f,x(),f),zt=Vn(()=>E.value?E.value.features.filter(We=>We.geometry.type==="LineString"):[]),fr=Ci({distance:0,timing:0}),{t:ri}=Em(),Je=Vn(()=>{const We=Math.round(fr.value.timing/60/1e3);if(We<60)return`${We} ${ri("maptoolkit.minutes")}`;const nt=Math.floor(We/60),Lt=We%60;return Lt===0?`${nt} ${ri("maptoolkit.hours")}`:`${nt} ${ri("maptoolkit.hours")} ${Lt} ${ri("maptoolkit.minutes")}`}),ot=Vn(()=>{var We;return((We=C.blok.routeButtons)==null?void 0:We.length)||C.blok.routeDescription||C.blok.routeSubheadline});return Rm(()=>{py(()=>{ce.value&&Nt(ce.value.map)});const We=zt.value[0];We&&$fetch("/api/maptoolkit/route-stats",{method:"POST",body:{geometry:We.geometry,routeType:C.blok.routeType}}).then(({distance:nt,time:Lt})=>{const ur=C.blok.routeType==="foot"?"walking":"cycling";fr.value={distance:nt,timing:((Lt==null?void 0:Lt[ur])??0)*1e3}}).catch(nt=>{console.error("[MaptoolkitModule] route-stats failed:",nt),fr.value={distance:0,timing:0}})}),(We,nt)=>{var Pi,br,Ct,Nr,Ur,ci,yi,ki,Qi,Gt,Zi,wr;const Lt=V_,ur=Z_,mr=Op,Ui=ty,Ai=xy,$i=ey,Vi=dy("editable");return Lm((nr(),Ni("section",{"data-gtm-section-type":"interactive-map","data-gtm-section-id":(Pi=We.blok)==null?void 0:Pi._uid,"data-gtm-section-name":We.blok.headline},[lr("div",Gv,[_i(Lt,{class:"w-full",level:"h2",headline:(br=We.blok)==null?void 0:br.headline,"sub-headline":(Ct=We.blok)==null?void 0:Ct.subheadline},null,8,["headline","sub-headline"])]),lr("div",Hv,[lr("div",Wv,[lr("div",Xv,[lr("div",Yv,[C.blok.mapType==="pois"?(nr(),Sa(Pp,{key:0,name:"fade",mode:"out-in",duration:300},{default:Mi(()=>{var Tr,It,Sr,hr,Ei,rr,Cr;return[Xe(Ie)?(nr(),Ni("div",Kv,[lr("div",Jv,[Xe(Bt)>
747=336?(nr(),Sa(Xe($a),{key:0,icon:Xe(be)?"i-heroicons-arrows-pointing-in-solid":"i-heroicons-arrows-pointing-out-solid",size:"md",variant:"outline",class:"me-4 bg-white/80 backdrop-blur hover:bg-white/80 md:hidden",color:"white",onClick:nt[0]||(nt[0]=Pr=>be.value=!Xe(be))},null,8,["icon"])):Ua("",!0),_i(Xe($a),{icon:"i-oew-close-solid",size:"md",variant:"outline",class:"bg-white/80 ps-2.5 backdrop-blur hover:bg-white/80 max-md:px-2.5 md:w-auto",color:"white",onClick:nt[1]||(nt[1]=()=>{Ie.value=null,be.value=!1})},{default:Mi(()=>[lr("span",Qv,Ws(We.$t("common.close")),1)]),_:1})]),lr("div",{class:ua(["relative z-0 overflow-y-auto max-lg:transition-all max-lg:duration-300 md:max-h-[532px] lg:max-h-[610px] xl:max-h-[828px]",Xe(be)?"max-md:max-h-[532px]":"max-md:max-h-[338px]"])},[lr("div",{ref_key:"mapCardRef",ref:ie},[_i(ur,{id:`${(Tr=Xe(Ie))==null?void 0:Tr.id}`,asset:Xe(Et)[(Sr=(It=Xe(Ie))==null?void 0:It.properties)==null?void 0:Sr.image_uuid],headline:(Ei=(hr=Xe(Ie))==null?void 0:hr.properties)==null?void 0:Ei.title,text:(Cr=(rr=Xe(Ie))==null?void 0:rr.properties)==null?void 0:Cr.description,background:!0,buttons:Xe(Am)(Xe(Ie).properties)},null,8,["id","asset","headline","text","buttons"])],512)],2)])):Ua("",!0)]}),_:1})):(nr(),Sa(Ai,{key:1,ref_key:"accordionRef",ref:F,items:Xe(zt),ui:{item:{base:"border-t border-neutral-100 lg:overflow-y-auto ",padding:"p-0"}},class:"pointer-events-auto relative left-0 top-5 flex w-full max-w-[380px] flex-col overflow-hidden rounded-2xl bg-white shadow md:max-w-[450px] lg:top-10 lg:max-w-[480px] xl:max-w-[554px] 2xl:left-10",onOpen:nt[6]||(nt[6]=()=>{Xe(ot)&&(T.value=!0,Xe(fe)||Xe(qt)(!0),fe.value=!1)}),onClose:nt[7]||(nt[7]=()=>{Xe(ot)&&(T.value=!1,Xe(qt)(!1))})},fy({default:Mi(({item:Tr,open:It})=>[(nr(),Sa(my(Xe(ot)?Xe($a):"div"),{color:"white",variant:"outline",icon:Tr.icon,class:ua(["relative flex flex-col items-start gap-1 rounded-2xl bg-transparent py-3 pl-4 pr-12 text-neutral-950 outline-offset-[-8px] ring-0 hover:bg-transparent",It])},{trailing:Mi(()=>[Xe(ot)?(nr(),Sa(mr,{key:0,name:It?"i-oew-minus-solid":"i-oew-plus-solid",class:"absolute right-4 top-3 size-5 lg:top-3.5 xl:top-4"},null,8,["name"])):Ua("",!0)]),default:Mi(()=>[We.blok.routeHeadline?(nr(),Ni("span",e0,Ws(We.blok.routeHeadline),1)):Ua("",!0),lr("span",t0,[_i(mr,{class:ua(["me-1 size-4 lg:size-5",We.blok.routeType==="bike"&&"lg:size-6"]),name:`i-oew-${We.blok.routeType}-solid`},null,8,["class","name"]),lr("span",r0,Ws(`${(Xe(fr).distance/1e3).toFixed(1)} km â ${Xe(Je)} (${We.$t(We.blok.routeType==="foot"?"maptoolkit.walking":"maptoolkit.cycling")})`),1)])]),_:2},1032,["icon","class"]))]),_:2},[Xe(ot)?{name:"item",fn:Mi(({open:Tr})=>{var It,Sr,hr,Ei,rr,Cr,Pr;return[C.blok.mapType==="route"?(nr(),Ni("div",i0,[lr("div",a0,[Xe(Bt)>=270?(nr(),Sa(Xe($a),{key:0,icon:Xe(be)?"i-heroicons-arrows-pointing-in-solid":"i-heroicons-arrows-pointing-out-solid",size:"md",variant:"outline",class:"bg-white/80 backdrop-blur hover:bg-white/80 md:hidden",color:"white",onClick:nt[2]||(nt[2]=$r=>be.value=!Xe(be))},null,8,["icon"])):Ua("",!0)]),lr("div",{class:ua(["relative z-0 overflow-y-auto max-lg:transition-all max-lg:duration-300 md:max-h-[450px] lg:max-h-[510px] xl:max-h-[720px]",Xe(be)?"max-md:max-h-[450px]":"max-md:max-h-[268px]"])},[Tr?(nr(),Ni("div",{key:0,ref_key:"mapCardRef",ref:ie},[_i(ur,{id:`${(It=Xe(Ie))==null?void 0:It.id}`,asset:(Ei=(hr=(Sr=C.blok.media)==null?void 0:Sr.at(0))==null?void 0:hr.mediaAsset)==null?void 0:Ei.at(0),"asset-gravity":(Cr=(rr=C.blok.media)==null?void 0:rr.at(0))==null?void 0:Cr.imageCrop,headline:C.blok.routeSubheadline,text:C.blok.routeDescription,background:!0,buttons:(Pr=C.blok.routeButtons)==null?void 0:Pr.map($r
747=>{var ui,qi;return{link:{id:$r._uid,href:("useLinkResolver"in We?We.useLinkResolver:Xe(pp))($r.link),external:((ui=$r.link)==null?void 0:ui.linktype)==="url",target:((qi=$r.link)==null?void 0:qi.linktype)==="url"?"_blank":"_self"},buttonText:$r.label}})},null,8,["id","asset","asset-gravity","headline","text","buttons"])],512)):Ua("",!0)],2)])):(nr(),Sa(Pp,{key:1,name:"fade",mode:"out-in",duration:Xe(fe)?0:300},{default:Mi(()=>{var $r,ui,qi,ea,zi,ta,Di,Kr;return[Xe(o)==="feature-list"?(nr(),Ni("div",s0,[lr("ul",n0,[(nr(!0),Ni(zm,null,Dm(Xe(E).features.filter($t=>$t.geometry.type==="Point"),$t=>{var Ma,Ha,Li,he,N,U,Z;return nr(),Ni("li",{key:$t.id,"data-id":$t.id},[lr("button",{class:ua(["group relative flex w-full cursor-pointer items-center gap-4 overflow-hidden rounded-xl p-2 transition-colors duration-300 hover:bg-neutral-50",{hover:$t.id===((Ma=Xe(Ae))==null?void 0:Ma.id)}]),onMouseover:J=>Ae.value=$t,onMouseout:nt[3]||(nt[3]=J=>Ae.value=null),onClick:J=>Xe(vr)($t)},[lr("div",c0,[_i(Ui,{asset:Xe(Et)[(Ha=$t==null?void 0:$t.properties)==null?void 0:Ha.image_uuid],width:80,height:80,srcset:[{viewport:768,width:150,aspectRatio:1/1}],"show-info-badge":!1,title:(he=(Li=$t.properties)==null?void 0:Li.asset)==null?void 0:he.name,class:"aspect-1/1 size-full object-cover"},null,8,["asset","title"])]),lr("div",u0,[(N=$t.properties)!=null&&N.title?(nr(),Ni("span",h0,Ws((U=$t.properties)==null?void 0:U.title),1)):Ua("",!0),lr("span",p0,Ws((Z=$t.properties)==null?void 0:Z.description),1)]),lr("div",d0,[_i(Xe($a),{as:"div",ui:{rounded:"rounded-full"},icon:"i-oew-arrow-right-mini",variant:"outline",class:"duration-200 group-hover:text-black group-hover:ring-black"})])],42,l0)],8,o0)}),128))])])):Xe(o)==="feature"?(nr(),Ni("div",f0,[lr("div",m0,[Xe(Bt)>=270?(nr(),Sa(Xe($a),{key:0,icon:Xe(be)?"i-heroicons-arrows-pointing-in-solid":"i-heroicons-arrows-pointing-out-solid",size:"md",variant:"outline",class:"me-4 bg-white/80 backdrop-blur hover:bg-white/80 md:hidden",color:"white",onClick:nt[4]||(nt[4]=$t=>be.value=!Xe(be))},null,8,["icon"])):Ua("",!0),_i(Xe($a),{icon:"i-oew-close-solid",size:"md",variant:"outline",class:"bg-white/80 ps-2.5 backdrop-blur hover:bg-white/80 max-md:px-2.5 md:w-auto",color:"white",onClick:nt[5]||(nt[5]=()=>{Ie.value=null,be.value=!1})},{default:Mi(()=>[lr("span",g0,Ws(We.$t("common.close")),1)]),_:1})]),lr("div",{class:ua(["relative z-0 overflow-y-auto max-lg:transition-all max-lg:duration-300 md:max-h-[450px] lg:max-h-[510px] xl:max-h-[720px]",Xe(be)?"max-md:max-h-[450px]":"max-md:max-h-[268px]"])},[lr("div",{ref_key:"mapCardRef",ref:ie},[_i(ur,{id:`${($r=Xe(Ie))==null?void 0:$r.id}`,asset:Xe(Et)[(qi=(ui=Xe(Ie))==null?void 0:ui.properties)==null?void 0:qi.image_uuid],headline:(zi=(ea=Xe(Ie))==null?void 0:ea.properties)==null?void 0:zi.title,text:(Di=(ta=Xe(Ie))==null?void 0:ta.properties)==null?void 0:Di.description,background:!0,buttons:Xe(Am)((Kr=Xe(Ie))==null?void 0:Kr.properties)},null,8,["id","asset","headline","text","buttons"])],512)],2)])):Ua("",!0)]}),_:1},8,["duration"]))]}),key:"0"}:void 0]),1032,["items"]))])]),lr("div",_0,[_i($i,null,{default:Mi(()=>[_i($v,{ref_key:"maptoolkitRef",ref:ce,"hovered-feature":Xe(Ae),"onUpdate:hoveredFeature":nt[8]||(nt[8]=Tr=>rm(Ae)?Ae.value=Tr:null),"selected-feature":Xe(Ie),"onUpdate:selectedFeature":nt[9]||(nt[9]=Tr=>rm(Ie)?Ie.value=Tr:null),geojson:Xe(E),options:Xe(De),"map-options":Xe(et),class:ua([[C.blok.mapType==="pois"?Xe(be)&&Xe(ft)&&"pointer-events-none":Xe(T)&&Xe(be)&&Xe(ft)&&"pointer-events-none"],"map size-full"])},null,8,["hovered-feature","selected-feature","geojson","options","map-options","class"])]),_:1})]),C.blok.mapLink&&("useLinkResolver"in We?We.useLinkResolver:Xe(pp))((Nr=C.blok.mapLink.at(0))==null?void 0:Nr.link)?(nr(),Sa(Xe($a),{key:0,icon:((ci=(Ur=C.blok.mapLink.at(0))==null?void 0:Ur.link)==null?void 0:ci.linktype)==="url"?"i-oew-external-link-solid":"i-oew-arrow-right-solid",label:(yi=C.blok.mapLink.at(0))==null?void 0:yi.label,to:("useLinkResolver"in We?We.useLinkResolver:Xe(pp))((ki=C.blok.mapLink.at(0))==null?void 0:ki.link),target:((Gt=(Qi=C.blok.mapLink.at(0))==null?void 0:Qi.link)==null?void 0:Gt.linktype)==="url"?"_blank":"_self",rel:((wr=(Zi=C.blok.mapLink.at(0))==null?void 0:Zi.link)==null?void 0:wr.linktype)==="url"?"noopener":void 0,variant:"solid",class:"absolute -bottom-5 left-1/2 z-20 -translate-x-1/2"},null,8,["icon","label","to","target","rel"])):Ua("",!0)])])],8,qv)),[[Vi,We.blok]])}}}),kb=km(y0,[["__scopeId","data-v-c51d2cd3"]]);export{kb as default};
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.